Prompt:
def maximizeXor(nums: List[int], queries: List[List[int]]) -> List[int]:
    """
    You are given an array nums consisting of non-negative integers. You are also given a queries array, where queries[i] = [xi, mi].
    The answer to the ith query is the maximum bitwise XOR value of xi and any element of nums that does not exceed mi. In other words, the answer is max(nums[j] XOR xi) for all j such that nums[j] <= mi. If all elements in nums are larger than mi, then the answer is -1.
    Return an integer array answer where answer.length == queries.length and answer[i] is the answer to the ith query.

    Example 1:

    >>> maximizeXor(nums = [0,1,2,3,4], queries = [[3,1],[1,3],[5,6]])
    >>> [3,3,7]
    Explanation:
    1) 0 and 1 are the only two integers not greater than 1. 0 XOR 3 = 3 and 1 XOR 3 = 2. The larger of the two is 3.
    2) 1 XOR 2 = 3.
    3) 5 XOR 2 = 7.

    Example 2:

    >>> maximizeXor(nums = [5,2,4,6,6,3], queries = [[12,4],[8,1],[6,3]])
    >>> [15,-1,5]
    """


Prompt:
def largestSubarray(nums: List[int], k: int) -> List[int]:
    """
    An array A is larger than some array B if for the first index i where A[i] != B[i], A[i] > B[i].
    For example, consider 0-indexing:

    [1,3,2,4] > [1,2,2,4], since at index 1, 3 > 2.
    [1,4,4,4] < [2,1,1,1], since at index 0, 1 < 2.

    A subarray is a contiguous subsequence of the array.
    Given an integer array nums of distinct integers, return the largest subarray of nums of length k.

    Example 1:

    >>> largestSubarray(nums = [1,4,5,2,3], k = 3)
    >>> [5,2,3]
    Explanation: The subarrays of size 3 are: [1,4,5], [4,5,2], and [5,2,3].
    Of these, [5,2,3] is the largest.
    Example 2:

    >>> largestSubarray(nums = [1,4,5,2,3], k = 4)
    >>> [4,5,2,3]
    Explanation: The subarrays of size 4 are: [1,4,5,2], and [4,5,2,3].
    Of these, [4,5,2,3] is the largest.
    Example 3:

    >>> largestSubarray(nums = [1,4,5,2,3], k = 1)
    >>> [5]
    """


Prompt:
def maximumUnits(boxTypes: List[List[int]], truckSize: int) -> int:
    """
    You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]:

    numberOfBoxesi is the number of boxes of type i.
    numberOfUnitsPerBoxi is the number of units in each box of the type i.

    You are also given an integer truckSize, which is the maximum number of boxes that can be put on the truck. You can choose any boxes to put on the truck as long as the number of boxes does not exceed truckSize.
    Return the maximum total number of units that can be put on the truck.

    Example 1:

    >>> maximumUnits(boxTypes = [[1,3],[2,2],[3,1]], truckSize = 4)
    >>> 8
    Explanation: There are:
    - 1 box of the first type that contains 3 units.
    - 2 boxes of the second type that contain 2 units each.
    - 3 boxes of the third type that contain 1 unit each.
    You can take all the boxes of the first and second types, and one box of the third type.
    The total number of units will be = (1 * 3) + (2 * 2) + (1 * 1) = 8.

    Example 2:

    >>> maximumUnits(boxTypes = [[5,10],[2,5],[4,7],[3,9]], truckSize = 10)
    >>> 91
    """


Prompt:
def countPairs(deliciousness: List[int]) -> int:
    """
    A good meal is a meal that contains exactly two different food items with a sum of deliciousness equal to a power of two.
    You can pick any two different foods to make a good meal.
    Given an array of integers deliciousness where deliciousness[i] is the deliciousness of the ith item of food, return the number of different good meals you can make from this list modulo 109 + 7.
    Note that items with different indices are considered different even if they have the same deliciousness value.

    Example 1:

    >>> countPairs(deliciousness = [1,3,5,7,9])
    >>> 4
    Explanation: The good meals are (1,3), (1,7), (3,5) and, (7,9).
    Their respective sums are 4, 8, 8, and 16, all of which are powers of 2.

    Example 2:

    >>> countPairs(deliciousness = [1,1,1,3,3,3,7])
    >>> 15
    Explanation: The good meals are (1,1) with 3 ways, (1,3) with 9 ways, and (1,7) with 3 ways.
    """


Prompt:
def waysToSplit(nums: List[int]) -> int:
    """
    A split of an integer array is good if:

    The array is split into three non-empty contiguous subarrays - named left, mid, right respectively from left to right.
    The sum of the elements in left is less than or equal to the sum of the elements in mid, and the sum of the elements in mid is less than or equal to the sum of the elements in right.

    Given nums, an array of non-negative integers, return the number of good ways to split nums. As the number may be too large, return it modulo 109 + 7.

    Example 1:

    >>> waysToSplit(nums = [1,1,1])
    >>> 1
    Explanation: The only good way to split nums is [1] [1] [1].
    Example 2:

    >>> waysToSplit(nums = [1,2,2,2,5,0])
    >>> 3
    Explanation: There are three good ways of splitting nums:
    [1] [2] [2,2,5,0]
    [1] [2,2] [2,5,0]
    [1,2] [2,2] [5,0]

    Example 3:

    >>> waysToSplit(nums = [3,2,1])
    >>> 0
    Explanation: There is no good way to split nums.
    """


Prompt:
def minOperations(target: List[int], arr: List[int]) -> int:
    """
    You are given an array target that consists of distinct integers and another integer array arr that can have duplicates.
    In one operation, you can insert any integer at any position in arr. For example, if arr = [1,4,1,2], you can add 3 in the middle and make it [1,4,3,1,2]. Note that you can insert the integer at the very beginning or end of the array.
    Return the minimum number of operations needed to make target a subsequence of arr.
    A subsequence of an array is a new array generated from the original array by deleting some elements (possibly none) without changing the remaining elements' relative order. For example, [2,7,4] is a subsequence of [4,2,3,7,2,1,4] (the underlined elements), while [2,4,2] is not.

    Example 1:

    >>> minOperations(target = [5,1,3], arr = [9,4,2,3,4])
    >>> 2
    Explanation: You can add 5 and 1 in such a way that makes arr = [5,9,4,1,2,3,4], then target will be a subsequence of arr.

    Example 2:

    >>> minOperations(target = [6,4,8,1,3,2], arr = [4,7,6,2,3,8,6,1])
    >>> 3
    """


Prompt:
def solve(nums: List[int], queries: List[List[int]]) -> List[int]:
    """
    You are given a 0-indexed integer array nums consisting of n non-negative integers.
    You are also given an array queries, where queries[i] = [xi, yi]. The answer to the ith query is the sum of all nums[j] where xi <= j < n and (j - xi) is divisible by yi.
    Return an array answer where answer.length == queries.length and answer[i] is the answer to the ith query modulo 109 + 7.

    Example 1:

    >>> solve(nums = [0,1,2,3,4,5,6,7], queries = [[0,3],[5,1],[4,2]])
    >>> [9,18,10]
    Explanation: The answers of the queries are as follows:
    1) The j indices that satisfy this query are 0, 3, and 6. nums[0] + nums[3] + nums[6] = 9
    2) The j indices that satisfy this query are 5, 6, and 7. nums[5] + nums[6] + nums[7] = 18
    3) The j indices that satisfy this query are 4 and 6. nums[4] + nums[6] = 10

    Example 2:

    >>> solve(nums = [100,200,101,201,102,202,103,203], queries = [[0,7]])
    >>> [303]
    """


Prompt:
def totalMoney(n: int) -> int:
    """
    Hercy wants to save money for his first car. He puts money in the Leetcode bank every day.
    He starts by putting in $1 on Monday, the first day. Every day from Tuesday to Sunday, he will put in $1 more than the day before. On every subsequent Monday, he will put in $1 more than the previous Monday.
    Given n, return the total amount of money he will have in the Leetcode bank at the end of the nth day.

    Example 1:

    >>> totalMoney(n = 4)
    >>> 10
    Explanation: After the 4th day, the total is 1 + 2 + 3 + 4 = 10.

    Example 2:

    >>> totalMoney(n = 10)
    >>> 37
    Explanation: After the 10th day, the total is (1 + 2 + 3 + 4 + 5 + 6 + 7) + (2 + 3 + 4) = 37. Notice that on the 2nd Monday, Hercy only puts in $2.

    Example 3:

    >>> totalMoney(n = 20)
    >>> 96
    Explanation: After the 20th day, the total is (1 + 2 + 3 + 4 + 5 + 6 + 7) + (2 + 3 + 4 + 5 + 6 + 7 + 8) + (3 + 4 + 5 + 6 + 7 + 8) = 96.
    """


Prompt:
def maximumGain(s: str, x: int, y: int) -> int:
    """
    You are given a string s and two integers x and y. You can perform two types of operations any number of times.

    Remove substring "ab" and gain x points.

    For example, when removing "ab" from "cabxbae" it becomes "cxbae".

    Remove substring "ba" and gain y points.

    For example, when removing "ba" from "cabxbae" it becomes "cabxe".

    Return the maximum points you can gain after applying the above operations on s.

    Example 1:

    >>> maximumGain(s = "cdbcbbaaabab", x = 4, y = 5)
    >>> 19
    Explanation:
    - Remove the "ba" underlined in "cdbcbbaaabab". Now, s = "cdbcbbaaab" and 5 points are added to the score.
    - Remove the "ab" underlined in "cdbcbbaaab". Now, s = "cdbcbbaa" and 4 points are added to the score.
    - Remove the "ba" underlined in "cdbcbbaa". Now, s = "cdbcba" and 5 points are added to the score.
    - Remove the "ba" underlined in "cdbcba". Now, s = "cdbc" and 5 points are added to the score.
    Total score = 5 + 4 + 5 + 5 = 19.
    Example 2:

    >>> maximumGain(s = "aabbaaxybbaabb", x = 5, y = 4)
    >>> 20
    """


Prompt:
def constructDistancedSequence(n: int) -> List[int]:
    """
    Given an integer n, find a sequence with elements in the range [1, n] that satisfies all of the following:

    The integer 1 occurs once in the sequence.
    Each integer between 2 and n occurs twice in the sequence.
    For every integer i between 2 and n, the distance between the two occurrences of i is exactly i.

    The distance between two numbers on the sequence, a[i] and a[j], is the absolute difference of their indices, |j - i|.
    Return the lexicographically largest sequence. It is guaranteed that under the given constraints, there is always a solution.
    A sequence a is lexicographically larger than a sequence b (of the same length) if in the first position where a and b differ, sequence a has a number greater than the corresponding number in b. For example, [0,1,9,0] is lexicographically larger than [0,1,5,6] because the first position they differ is at the third number, and 9 is greater than 5.

    Example 1:

    >>> constructDistancedSequence(n = 3)
    >>> [3,1,2,3,2]
    Explanation: [2,3,2,1,3] is also a valid sequence, but [3,1,2,3,2] is the lexicographically largest valid sequence.

    Example 2:

    >>> constructDistancedSequence(n = 5)
    >>> [5,3,1,4,3,5,2,4,2]
    """


Prompt:
def checkWays(pairs: List[List[int]]) -> int:
    """
    You are given an array pairs, where pairs[i] = [xi, yi], and:

    There are no duplicates.
    xi < yi

    Let ways be the number of rooted trees that satisfy the following conditions:

    The tree consists of nodes whose values appeared in pairs.
    A pair [xi, yi] exists in pairs if and only if xi is an ancestor of yi or yi is an ancestor of xi.
    Note: the tree does not have to be a binary tree.

    Two ways are considered to be different if there is at least one node that has different parents in both ways.
    Return:

    0 if ways == 0
    1 if ways == 1
    2 if ways > 1

    A rooted tree is a tree that has a single root node, and all edges are oriented to be outgoing from the root.
    An ancestor of a node is any node on the path from the root to that node (excluding the node itself). The root has no ancestors.

    Example 1:

    >>> checkWays(pairs = [[1,2],[2,3]])
    >>> 1
    Explanation: There is exactly one valid rooted tree, which is shown in the above figure.

    Example 2:

    >>> checkWays(pairs = [[1,2],[2,3],[1,3]])
    >>> 2
    Explanation: There are multiple valid rooted trees. Three of them are shown in the above figures.

    Example 3:

    >>> checkWays(pairs = [[1,2],[2,3],[2,4],[1,5]])
    >>> 0
    Explanation: There are no valid rooted trees.
    """


Prompt:
def decode(encoded: List[int], first: int) -> List[int]:
    """
    There is a hidden integer array arr that consists of n non-negative integers.
    It was encoded into another integer array encoded of length n - 1, such that encoded[i] = arr[i] XOR arr[i + 1]. For example, if arr = [1,0,2,1], then encoded = [1,2,3].
    You are given the encoded array. You are also given an integer first, that is the first element of arr, i.e. arr[0].
    Return the original array arr. It can be proved that the answer exists and is unique.

    Example 1:

    >>> decode(encoded = [1,2,3], first = 1)
    >>> [1,0,2,1]
    Explanation: If arr = [1,0,2,1], then first = 1 and encoded = [1 XOR 0, 0 XOR 2, 2 XOR 1] = [1,2,3]

    Example 2:

    >>> decode(encoded = [6,2,7,3], first = 4)
    >>> [4,2,0,7,4]
    """


Prompt:
# class ListNode:
#     def __init__(val=0, next=None):
#         self.val = val
#         self.next = next
class Solution:
    def swapNodes(head: Optional[ListNode], k: int) -> Optional[ListNode]:
    """
    You are given the head of a linked list, and an integer k.
    Return the head of the linked list after swapping the values of the kth node from the beginning and the kth node from the end (the list is 1-indexed).

    Example 1:

    >>> __init__(head = [1,2,3,4,5], k = 2)
    >>> [1,4,3,2,5]

    Example 2:

    >>> __init__(head = [7,9,6,6,7,8,3,0,9,5], k = 5)
    >>> [7,9,6,6,8,7,3,0,9,5]
    """


Prompt:
def minimumHammingDistance(source: List[int], target: List[int], allowedSwaps: List[List[int]]) -> int:
    """
    You are given two integer arrays, source and target, both of length n. You are also given an array allowedSwaps where each allowedSwaps[i] = [ai, bi] indicates that you are allowed to swap the elements at index ai and index bi (0-indexed) of array source. Note that you can swap elements at a specific pair of indices multiple times and in any order.
    The Hamming distance of two arrays of the same length, source and target, is the number of positions where the elements are different. Formally, it is the number of indices i for 0 <= i <= n-1 where source[i] != target[i] (0-indexed).
    Return the minimum Hamming distance of source and target after performing any amount of swap operations on array source.

    Example 1:

    >>> minimumHammingDistance(source = [1,2,3,4], target = [2,1,4,5], allowedSwaps = [[0,1],[2,3]])
    >>> 1
    Explanation: source can be transformed the following way:
    - Swap indices 0 and 1: source = [2,1,3,4]
    - Swap indices 2 and 3: source = [2,1,4,3]
    The Hamming distance of source and target is 1 as they differ in 1 position: index 3.

    Example 2:

    >>> minimumHammingDistance(source = [1,2,3,4], target = [1,3,2,4], allowedSwaps = [])
    >>> 2
    Explanation: There are no allowed swaps.
    The Hamming distance of source and target is 2 as they differ in 2 positions: index 1 and index 2.

    Example 3:

    >>> minimumHammingDistance(source = [5,1,2,4,3], target = [1,5,4,2,3], allowedSwaps = [[0,4],[4,2],[1,3],[1,4]])
    >>> 0
    """


Prompt:
def minimumTimeRequired(jobs: List[int], k: int) -> int:
    """
    You are given an integer array jobs, where jobs[i] is the amount of time it takes to complete the ith job.
    There are k workers that you can assign jobs to. Each job should be assigned to exactly one worker. The working time of a worker is the sum of the time it takes to complete all jobs assigned to them. Your goal is to devise an optimal assignment such that the maximum working time of any worker is minimized.
    Return the minimum possible maximum working time of any assignment.

    Example 1:

    >>> minimumTimeRequired(jobs = [3,2,3], k = 3)
    >>> 3
    Explanation: By assigning each person one job, the maximum time is 3.

    Example 2:

    >>> minimumTimeRequired(jobs = [1,2,4,7,8], k = 2)
    >>> 11
    Explanation: Assign the jobs the following way:
    Worker 1: 1, 2, 8 (working time = 1 + 2 + 8 = 11)
    Worker 2: 4, 7 (working time = 4 + 7 = 11)
    The maximum working time is 11.
    """


Prompt:
def countGoodRectangles(rectangles: List[List[int]]) -> int:
    """
    You are given an array rectangles where rectangles[i] = [li, wi] represents the ith rectangle of length li and width wi.\r
    \r
    You can cut the ith rectangle to form a square with a side length of k if both k <= li and k <= wi. For example, if you have a rectangle [4,6], you can cut it to get a square with a side length of at most 4.\r
    \r
    Let maxLen be the side length of the largest square you can obtain from any of the given rectangles.\r
    \r
    Return the number of rectangles that can make a square with a side length of maxLen.\r
    \r
     \r
    Example 1:\r
    \r
    \r
    >>> countGoodRectangles(rectangles = [[5,8],[3,9],[5,12],[16,5]]\r)
    >>> 3\r
    Explanation: The largest squares you can get from each rectangle are of lengths [5,3,5,5].\r
    The largest possible square is of length 5, and you can get it out of 3 rectangles.\r
    \r
    \r
    Example 2:\r
    \r
    \r
    >>> countGoodRectangles(rectangles = [[2,3],[3,7],[4,3],[3,7]]\r)
    >>> 3\r
    \r
    \r
     \r
    """


Prompt:
def tupleSameProduct(nums: List[int]) -> int:
    """
    Given an array nums of distinct positive integers, return the number of tuples (a, b, c, d) such that a * b = c * d where a, b, c, and d are elements of nums, and a != b != c != d.

    Example 1:

    >>> tupleSameProduct(nums = [2,3,4,6])
    >>> 8
    Explanation: There are 8 valid tuples:
    (2,6,3,4) , (2,6,4,3) , (6,2,3,4) , (6,2,4,3)
    (3,4,2,6) , (4,3,2,6) , (3,4,6,2) , (4,3,6,2)

    Example 2:

    >>> tupleSameProduct(nums = [1,2,4,5,10])
    >>> 16
    Explanation: There are 16 valid tuples:
    (1,10,2,5) , (1,10,5,2) , (10,1,2,5) , (10,1,5,2)
    (2,5,1,10) , (2,5,10,1) , (5,2,1,10) , (5,2,10,1)
    (2,10,4,5) , (2,10,5,4) , (10,2,4,5) , (10,2,5,4)
    (4,5,2,10) , (4,5,10,2) , (5,4,2,10) , (5,4,10,2)
    """


Prompt:
def largestSubmatrix(matrix: List[List[int]]) -> int:
    """
    You are given a binary matrix matrix of size m x n, and you are allowed to rearrange the columns of the matrix in any order.
    Return the area of the largest submatrix within matrix where every element of the submatrix is 1 after reordering the columns optimally.

    Example 1:

    >>> largestSubmatrix(matrix = [[0,0,1],[1,1,1],[1,0,1]])
    >>> 4
    Explanation: You can rearrange the columns as shown above.
    The largest submatrix of 1s, in bold, has an area of 4.

    Example 2:

    >>> largestSubmatrix(matrix = [[1,0,1,0,1]])
    >>> 3
    Explanation: You can rearrange the columns as shown above.
    The largest submatrix of 1s, in bold, has an area of 3.

    Example 3:

    >>> largestSubmatrix(matrix = [[1,1,0],[1,0,1]])
    >>> 2
    Explanation: Notice that you must rearrange entire columns, and there is no way to make a submatrix of 1s larger than an area of 2.
    """


Prompt:
def canMouseWin(grid: List[str], catJump: int, mouseJump: int) -> bool:
    """
    A game is played by a cat and a mouse named Cat and Mouse.
    The environment is represented by a grid of size rows x cols, where each element is a wall, floor, player (Cat, Mouse), or food.

    Players are represented by the characters 'C'(Cat),'M'(Mouse).
    Floors are represented by the character '.' and can be walked on.
    Walls are represented by the character '#' and cannot be walked on.
    Food is represented by the character 'F' and can be walked on.
    There is only one of each character 'C', 'M', and 'F' in grid.

    Mouse and Cat play according to the following rules:

    Mouse moves first, then they take turns to move.
    During each turn, Cat and Mouse can jump in one of the four directions (left, right, up, down). They cannot jump over the wall nor outside of the grid.
    catJump, mouseJump are the maximum lengths Cat and Mouse can jump at a time, respectively. Cat and Mouse can jump less than the maximum length.
    Staying in the same position is allowed.
    Mouse can jump over Cat.

    The game can end in 4 ways:

    If Cat occupies the same position as Mouse, Cat wins.
    If Cat reaches the food first, Cat wins.
    If Mouse reaches the food first, Mouse wins.
    If Mouse cannot get to the food within 1000 turns, Cat wins.

    Given a rows x cols matrix grid and two integers catJump and mouseJump, return true if Mouse can win the game if both Cat and Mouse play optimally, otherwise return false.

    Example 1:

    >>> canMouseWin(grid = ["####F","#C...","M...."], catJump = 1, mouseJump = 2)
    >>> true
    Explanation: Cat cannot catch Mouse on its turn nor can it get the food before Mouse.

    Example 2:

    >>> canMouseWin(grid = ["M.C...F"], catJump = 1, mouseJump = 4)
    >>> true

    Example 3:

    >>> canMouseWin(grid = ["M.C...F"], catJump = 1, mouseJump = 3)
    >>> false
    """


Prompt:
def getFood(grid: List[List[str]]) -> int:
    """
    You are starving and you want to eat food as quickly as possible. You want to find the shortest path to arrive at any food cell.
    You are given an m x n character matrix, grid, of these different types of cells:

    '*' is your location. There is exactly one '*' cell.
    '#' is a food cell. There may be multiple food cells.
    'O' is free space, and you can travel through these cells.
    'X' is an obstacle, and you cannot travel through these cells.

    You can travel to any adjacent cell north, east, south, or west of your current location if there is not an obstacle.
    Return the length of the shortest path for you to reach any food cell. If there is no path for you to reach food, return -1.

    Example 1:

    >>> getFood(grid = [["X","X","X","X","X","X"],["X","*","O","O","O","X"],["X","O","O","#","O","X"],["X","X","X","X","X","X"]])
    >>> 3
    Explanation: It takes 3 steps to reach the food.

    Example 2:

    >>> getFood(grid = [["X","X","X","X","X"],["X","*","X","O","X"],["X","O","X","#","X"],["X","X","X","X","X"]])
    >>> -1
    Explanation: It is not possible to reach the food.

    Example 3:

    >>> getFood(grid = [["X","X","X","X","X","X","X","X"],["X","*","O","X","O","#","O","X"],["X","O","O","X","O","O","X","X"],["X","O","O","O","O","#","O","X"],["X","X","X","X","X","X","X","X"]])
    >>> 6
    Explanation: There can be multiple food cells. It only takes 6 steps to reach the bottom food.
    Example 4:

    >>> getFood(grid = [["X","X","X","X","X","X","X","X"],["X","*","O","X","O","#","O","X"],["X","O","O","X","O","O","X","X"],["X","O","O","O","O","#","O","X"],["O","O","O","O","O","O","O","O"]])
    >>> 5
    """


Prompt:
def largestAltitude(gain: List[int]) -> int:
    """
    There is a biker going on a road trip. The road trip consists of n + 1 points at different altitudes. The biker starts his trip on point 0 with altitude equal 0.
    You are given an integer array gain of length n where gain[i] is the net gain in altitude between points i and i + 1 for all (0 <= i < n). Return the highest altitude of a point.

    Example 1:

    >>> largestAltitude(gain = [-5,1,5,0,-7])
    >>> 1
    Explanation: The altitudes are [0,-5,-4,1,1,-6]. The highest is 1.

    Example 2:

    >>> largestAltitude(gain = [-4,-3,-2,-1,4,3,2])
    >>> 0
    Explanation: The altitudes are [0,-4,-7,-9,-10,-6,-3,-1]. The highest is 0.
    """


Prompt:
def minimumTeachings(n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:
    """
    On a social network consisting of m users and some friendships between users, two users can communicate with each other if they know a common language.
    You are given an integer n, an array languages, and an array friendships where:

    There are n languages numbered 1 through n,
    languages[i] is the set of languages the ith user knows, and
    friendships[i] = [ui, vi] denotes a friendship between the users ui and vi.

    You can choose one language and teach it to some users so that all friends can communicate with each other. Return the minimum number of users you need to teach.
    Note that friendships are not transitive, meaning if x is a friend of y and y is a friend of z, this doesn't guarantee that x is a friend of z.

    Example 1:

    >>> minimumTeachings(n = 2, languages = [[1],[2],[1,2]], friendships = [[1,2],[1,3],[2,3]])
    >>> 1
    Explanation: You can either teach user 1 the second language or user 2 the first language.

    Example 2:

    >>> minimumTeachings(n = 3, languages = [[2],[1,3],[1,2],[3]], friendships = [[1,4],[1,2],[3,4],[2,3]])
    >>> 2
    Explanation: Teach the third language to users 1 and 3, yielding two users to teach.
    """


Prompt:
def decode(encoded: List[int]) -> List[int]:
    """
    There is an integer array perm that is a permutation of the first n positive integers, where n is always odd.
    It was encoded into another integer array encoded of length n - 1, such that encoded[i] = perm[i] XOR perm[i + 1]. For example, if perm = [1,3,2], then encoded = [2,1].
    Given the encoded array, return the original array perm. It is guaranteed that the answer exists and is unique.

    Example 1:

    >>> decode(encoded = [3,1])
    >>> [1,2,3]
    Explanation: If perm = [1,2,3], then encoded = [1 XOR 2,2 XOR 3] = [3,1]

    Example 2:

    >>> decode(encoded = [6,5,4,6])
    >>> [2,4,1,5,3]
    """


Prompt:
def maximumTime(time: str) -> str:
    """
    You are given a string time in the form of  hh:mm, where some of the digits in the string are hidden (represented by ?).
    The valid times are those inclusively between 00:00 and 23:59.
    Return the latest valid time you can get from time by replacing the hidden digits.

    Example 1:

    >>> maximumTime(time = "2?:?0")
    >>> "23:50"
    Explanation: The latest hour beginning with the digit '2' is 23 and the latest minute ending with the digit '0' is 50.

    Example 2:

    >>> maximumTime(time = "0?:3?")
    >>> "09:39"

    Example 3:

    >>> maximumTime(time = "1?:22")
    >>> "19:22"
    """


Prompt:
def minCharacters(a: str, b: str) -> int:
    """
    You are given two strings a and b that consist of lowercase letters. In one operation, you can change any character in a or b to any lowercase letter.
    Your goal is to satisfy one of the following three conditions:

    Every letter in a is strictly less than every letter in b in the alphabet.
    Every letter in b is strictly less than every letter in a in the alphabet.
    Both a and b consist of only one distinct letter.

    Return the minimum number of operations needed to achieve your goal.

    Example 1:

    >>> minCharacters(a = "aba", b = "caa")
    >>> 2
    Explanation: Consider the best way to make each condition true:
    1) Change b to "ccc" in 2 operations, then every letter in a is less than every letter in b.
    2) Change a to "bbb" and b to "aaa" in 3 operations, then every letter in b is less than every letter in a.
    3) Change a to "aaa" and b to "aaa" in 2 operations, then a and b consist of one distinct letter.
    The best way was done in 2 operations (either condition 1 or condition 3).

    Example 2:

    >>> minCharacters(a = "dabadd", b = "cda")
    >>> 3
    Explanation: The best way is to make condition 1 true by changing b to "eee".
    """


Prompt:
def kthLargestValue(matrix: List[List[int]], k: int) -> int:
    """
    You are given a 2D matrix of size m x n, consisting of non-negative integers. You are also given an integer k.
    The value of coordinate (a, b) of the matrix is the XOR of all matrix[i][j] where 0 <= i <= a < m and 0 <= j <= b < n (0-indexed).
    Find the kth largest value (1-indexed) of all the coordinates of matrix.

    Example 1:

    >>> kthLargestValue(matrix = [[5,2],[1,6]], k = 1)
    >>> 7
    Explanation: The value of coordinate (0,1) is 5 XOR 2 = 7, which is the largest value.

    Example 2:

    >>> kthLargestValue(matrix = [[5,2],[1,6]], k = 2)
    >>> 5
    Explanation: The value of coordinate (0,0) is 5 = 5, which is the 2nd largest value.

    Example 3:

    >>> kthLargestValue(matrix = [[5,2],[1,6]], k = 3)
    >>> 4
    Explanation: The value of coordinate (1,0) is 5 XOR 1 = 4, which is the 3rd largest value.
    """


Prompt:
def minimumBoxes(n: int) -> int:
    """
    You have a cubic storeroom where the width, length, and height of the room are all equal to n units. You are asked to place n boxes in this room where each box is a cube of unit side length. There are however some rules to placing the boxes:

    You can place the boxes anywhere on the floor.
    If box x is placed on top of the box y, then each side of the four vertical sides of the box y must either be adjacent to another box or to a wall.

    Given an integer n, return the minimum possible number of boxes touching the floor.

    Example 1:

    >>> minimumBoxes(n = 3)
    >>> 3
    Explanation: The figure above is for the placement of the three boxes.
    These boxes are placed in the corner of the room, where the corner is on the left side.

    Example 2:

    >>> minimumBoxes(n = 4)
    >>> 3
    Explanation: The figure above is for the placement of the four boxes.
    These boxes are placed in the corner of the room, where the corner is on the left side.

    Example 3:

    >>> minimumBoxes(n = 10)
    >>> 6
    Explanation: The figure above is for the placement of the ten boxes.
    These boxes are placed in the corner of the room, where the corner is on the back side.
    """


Prompt:
# class TreeNode:
#     def __init__(val=0, left=None, right=None):
#         self.val = val
#         self.left = left
#         self.right = right
class Solution:
    def findDistance(root: Optional[TreeNode], p: int, q: int) -> int:
    """
    Given the root of a binary tree and two integers p and q, return the distance between the nodes of value p and value q in the tree.
    The distance between two nodes is the number of edges on the path from one to the other.

    Example 1:

    >>> __init__(root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 0)
    >>> 3
    Explanation: There are 3 edges between 5 and 0: 5-3-1-0.
    Example 2:

    >>> __init__(root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 7)
    >>> 2
    Explanation: There are 2 edges between 5 and 7: 5-2-7.
    Example 3:

    >>> __init__(root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 5)
    >>> 0
    Explanation: The distance between a node and itself is 0.
    """


Prompt:
def countBalls(lowLimit: int, highLimit: int) -> int:
    """
    You are working in a ball factory where you have n balls numbered from lowLimit up to highLimit inclusive (i.e., n == highLimit - lowLimit + 1), and an infinite number of boxes numbered from 1 to infinity.
    Your job at this factory is to put each ball in the box with a number equal to the sum of digits of the ball's number. For example, the ball number 321 will be put in the box number 3 + 2 + 1 = 6 and the ball number 10 will be put in the box number 1 + 0 = 1.
    Given two integers lowLimit and highLimit, return the number of balls in the box with the most balls.

    Example 1:

    >>> countBalls(lowLimit = 1, highLimit = 10)
    >>> 2
    Explanation:
    Box Number:  1 2 3 4 5 6 7 8 9 10 11 ...
    Ball Count:  2 1 1 1 1 1 1 1 1 0  0  ...
    Box 1 has the most number of balls with 2 balls.
    Example 2:

    >>> countBalls(lowLimit = 5, highLimit = 15)
    >>> 2
    Explanation:
    Box Number:  1 2 3 4 5 6 7 8 9 10 11 ...
    Ball Count:  1 1 1 1 2 2 1 1 1 0  0  ...
    Boxes 5 and 6 have the most number of balls with 2 balls in each.

    Example 3:

    >>> countBalls(lowLimit = 19, highLimit = 28)
    >>> 2
    Explanation:
    Box Number:  1 2 3 4 5 6 7 8 9 10 11 12 ...
    Ball Count:  0 1 1 1 1 1 1 1 1 2  0  0  ...
    Box 10 has the most number of balls with 2 balls.
    """


Prompt:
def restoreArray(adjacentPairs: List[List[int]]) -> List[int]:
    """
    There is an integer array nums that consists of n unique elements, but you have forgotten it. However, you do remember every pair of adjacent elements in nums.
    You are given a 2D integer array adjacentPairs of size n - 1 where each adjacentPairs[i] = [ui, vi] indicates that the elements ui and vi are adjacent in nums.
    It is guaranteed that every adjacent pair of elements nums[i] and nums[i+1] will exist in adjacentPairs, either as [nums[i], nums[i+1]] or [nums[i+1], nums[i]]. The pairs can appear in any order.
    Return the original array nums. If there are multiple solutions, return any of them.

    Example 1:

    >>> restoreArray(adjacentPairs = [[2,1],[3,4],[3,2]])
    >>> [1,2,3,4]
    Explanation: This array has all its adjacent pairs in adjacentPairs.
    Notice that adjacentPairs[i] may not be in left-to-right order.

    Example 2:

    >>> restoreArray(adjacentPairs = [[4,-2],[1,4],[-3,1]])
    >>> [-2,4,1,-3]
    Explanation: There can be negative numbers.
    Another solution is [-3,1,4,-2], which would also be accepted.

    Example 3:

    >>> restoreArray(adjacentPairs = [[100000,-100000]])
    >>> [100000,-100000]
    """


Prompt:
def canEat(candiesCount: List[int], queries: List[List[int]]) -> List[bool]:
    """
    You are given a (0-indexed) array of positive integers candiesCount where candiesCount[i] represents the number of candies of the ith type you have. You are also given a 2D array queries where queries[i] = [favoriteTypei, favoriteDayi, dailyCapi].
    You play a game with the following rules:

    You start eating candies on day 0.
    You cannot eat any candy of type i unless you have eaten all candies of type i - 1.
    You must eat at least one candy per day until you have eaten all the candies.

    Construct a boolean array answer such that answer.length == queries.length and answer[i] is true if you can eat a candy of type favoriteTypei on day favoriteDayi without eating more than dailyCapi candies on any day, and false otherwise. Note that you can eat different types of candy on the same day, provided that you follow rule 2.
    Return the constructed array answer.

    Example 1:

    >>> canEat(candiesCount = [7,4,5,3,8], queries = [[0,2,2],[4,2,4],[2,13,1000000000]])
    >>> [true,false,true]
    Explanation:
    1- If you eat 2 candies (type 0) on day 0 and 2 candies (type 0) on day 1, you will eat a candy of type 0 on day 2.
    2- You can eat at most 4 candies each day.
       If you eat 4 candies every day, you will eat 4 candies (type 0) on day 0 and 4 candies (type 0 and type 1) on day 1.
       On day 2, you can only eat 4 candies (type 1 and type 2), so you cannot eat a candy of type 4 on day 2.
    3- If you eat 1 candy each day, you will eat a candy of type 2 on day 13.

    Example 2:

    >>> canEat(candiesCount = [5,2,6,4,1], queries = [[3,1,2],[4,10,3],[3,10,100],[4,100,30],[1,3,1]])
    >>> [false,true,true,false,false]
    """


Prompt:
def checkPartitioning(s: str) -> bool:
    """
    Given a string s, return true if it is possible to split the string s into three non-empty palindromic substrings. Otherwise, return false.
    A string is said to be palindrome if it the same string when reversed.

    Example 1:

    >>> checkPartitioning(s = "abcbdd")
    >>> true
    Explanation: "abcbdd" = "a" + "bcb" + "dd", and all three substrings are palindromes.

    Example 2:

    >>> checkPartitioning(s = "bcbddxy")
    >>> false
    Explanation: s cannot be split into 3 palindromes.
    """


Prompt:
def maxSumAfterOperation(nums: List[int]) -> int:
    """
    You are given an integer array nums. You must perform exactly one operation where you can replace one element nums[i] with nums[i] * nums[i]. \r
    \r
    Return the maximum possible subarray sum after exactly one operation. The subarray must be non-empty.\r
    \r
     \r
    Example 1:\r
    \r
    \r
    >>> maxSumAfterOperation(nums = [2,-1,-4,-3]\r)
    >>> 17\r
    Explanation: You can perform the operation on index 2 (0-indexed) to make nums = [2,-1,16,-3]. Now, the maximum subarray sum is 2 + -1 + 16 = 17.\r
    \r
    Example 2:\r
    \r
    \r
    >>> maxSumAfterOperation(nums = [1,-1,1,1,-1,-1,1]\r)
    >>> 4\r
    Explanation: You can perform the operation on index 1 (0-indexed) to make nums = [1,1,1,1,-1,-1,1]. Now, the maximum subarray sum is 1 + 1 + 1 + 1 = 4.\r
    \r
     \r
    """


Prompt:
def sumOfUnique(nums: List[int]) -> int:
    """
    You are given an integer array nums. The unique elements of an array are the elements that appear exactly once in the array.
    Return the sum of all the unique elements of nums.

    Example 1:

    >>> sumOfUnique(nums = [1,2,3,2])
    >>> 4
    Explanation: The unique elements are [1,3], and the sum is 4.

    Example 2:

    >>> sumOfUnique(nums = [1,1,1,1,1])
    >>> 0
    Explanation: There are no unique elements, and the sum is 0.

    Example 3:

    >>> sumOfUnique(nums = [1,2,3,4,5])
    >>> 15
    Explanation: The unique elements are [1,2,3,4,5], and the sum is 15.
    """


Prompt:
def maxAbsoluteSum(nums: List[int]) -> int:
    """
    You are given an integer array nums. The absolute sum of a subarray [numsl, numsl+1, ..., numsr-1, numsr] is abs(numsl + numsl+1 + ... + numsr-1 + numsr).
    Return the maximum absolute sum of any (possibly empty) subarray of nums.
    Note that abs(x) is defined as follows:

    If x is a negative integer, then abs(x) = -x.
    If x is a non-negative integer, then abs(x) = x.

    Example 1:

    >>> maxAbsoluteSum(nums = [1,-3,2,3,-4])
    >>> 5
    Explanation: The subarray [2,3] has absolute sum = abs(2+3) = abs(5) = 5.

    Example 2:

    >>> maxAbsoluteSum(nums = [2,-5,1,-4,3,-2])
    >>> 8
    Explanation: The subarray [-5,1,-4] has absolute sum = abs(-5+1-4) = abs(-8) = 8.
    """


Prompt:
def minimumLength(s: str) -> int:
    """
    Given a string s consisting only of characters 'a', 'b', and 'c'. You are asked to apply the following algorithm on the string any number of times:

    Pick a non-empty prefix from the string s where all the characters in the prefix are equal.
    Pick a non-empty suffix from the string s where all the characters in this suffix are equal.
    The prefix and the suffix should not intersect at any index.
    The characters from the prefix and suffix must be the same.
    Delete both the prefix and the suffix.

    Return the minimum length of s after performing the above operation any number of times (possibly zero times).

    Example 1:

    >>> minimumLength(s = "ca")
    >>> 2
    Explanation: You can't remove any characters, so the string stays as is.

    Example 2:

    >>> minimumLength(s = "cabaabac")
    >>> 0
    Explanation: An optimal sequence of operations is:
    - Take prefix = "c" and suffix = "c" and remove them, s = "abaaba".
    - Take prefix = "a" and suffix = "a" and remove them, s = "baab".
    - Take prefix = "b" and suffix = "b" and remove them, s = "aa".
    - Take prefix = "a" and suffix = "a" and remove them, s = "".
    Example 3:

    >>> minimumLength(s = "aabccabba")
    >>> 3
    Explanation: An optimal sequence of operations is:
    - Take prefix = "aa" and suffix = "a" and remove them, s = "bccabb".
    - Take prefix = "b" and suffix = "bb" and remove them, s = "cca".
    """


Prompt:
def maxValue(events: List[List[int]], k: int) -> int:
    """
    You are given an array of events where events[i] = [startDayi, endDayi, valuei]. The ith event starts at startDayi and ends at endDayi, and if you attend this event, you will receive a value of valuei. You are also given an integer k which represents the maximum number of events you can attend.
    You can only attend one event at a time. If you choose to attend an event, you must attend the entire event. Note that the end day is inclusive: that is, you cannot attend two events where one of them starts and the other ends on the same day.
    Return the maximum sum of values that you can receive by attending events.

    Example 1:

    >>> maxValue(events = [[1,2,4],[3,4,3],[2,3,1]], k = 2)
    >>> 7
    Explanation: Choose the green events, 0 and 1 (0-indexed) for a total value of 4 + 3 = 7.
    Example 2:

    >>> maxValue(events = [[1,2,4],[3,4,3],[2,3,10]], k = 2)
    >>> 10
    Explanation: Choose event 2 for a total value of 10.
    Notice that you cannot attend any other event as they overlap, and that you do not have to attend k events.
    Example 3:

    >>> maxValue(events = [[1,1,1],[2,2,2],[3,3,3],[4,4,4]], k = 3)
    >>> 9
    Explanation: Although the events do not overlap, you can only attend 3 events. Pick the highest valued three.
    """


Prompt:
def check(nums: List[int]) -> bool:
    """
    Given an array nums, return true if the array was originally sorted in non-decreasing order, then rotated some number of positions (including zero). Otherwise, return false.
    There may be duplicates in the original array.
    Note: An array A rotated by x positions results in an array B of the same length such that B[i] == A[(i+x) % A.length] for every valid index i.

    Example 1:

    >>> check(nums = [3,4,5,1,2])
    >>> true
    Explanation: [1,2,3,4,5] is the original sorted array.
    You can rotate the array by x = 3 positions to begin on the element of value 3: [3,4,5,1,2].

    Example 2:

    >>> check(nums = [2,1,3,4])
    >>> false
    Explanation: There is no sorted array once rotated that can make nums.

    Example 3:

    >>> check(nums = [1,2,3])
    >>> true
    Explanation: [1,2,3] is the original sorted array.
    You can rotate the array by x = 0 positions (i.e. no rotation) to make nums.
    """


Prompt:
def maximumScore(a: int, b: int, c: int) -> int:
    """
    You are playing a solitaire game with three piles of stones of sizes a, b, and c respectively. Each turn you choose two different non-empty piles, take one stone from each, and add 1 point to your score. The game stops when there are fewer than two non-empty piles (meaning there are no more available moves).
    Given three integers a, b, and c, return the maximum score you can get.

    Example 1:

    >>> maximumScore(a = 2, b = 4, c = 6)
    >>> 6
    Explanation: The starting state is (2, 4, 6). One optimal set of moves is:
    - Take from 1st and 3rd piles, state is now (1, 4, 5)
    - Take from 1st and 3rd piles, state is now (0, 4, 4)
    - Take from 2nd and 3rd piles, state is now (0, 3, 3)
    - Take from 2nd and 3rd piles, state is now (0, 2, 2)
    - Take from 2nd and 3rd piles, state is now (0, 1, 1)
    - Take from 2nd and 3rd piles, state is now (0, 0, 0)
    There are fewer than two non-empty piles, so the game ends. Total: 6 points.

    Example 2:

    >>> maximumScore(a = 4, b = 4, c = 6)
    >>> 7
    Explanation: The starting state is (4, 4, 6). One optimal set of moves is:
    - Take from 1st and 2nd piles, state is now (3, 3, 6)
    - Take from 1st and 3rd piles, state is now (2, 3, 5)
    - Take from 1st and 3rd piles, state is now (1, 3, 4)
    - Take from 1st and 3rd piles, state is now (0, 3, 3)
    - Take from 2nd and 3rd piles, state is now (0, 2, 2)
    - Take from 2nd and 3rd piles, state is now (0, 1, 1)
    - Take from 2nd and 3rd piles, state is now (0, 0, 0)
    There are fewer than two non-empty piles, so the game ends. Total: 7 points.

    Example 3:

    >>> maximumScore(a = 1, b = 8, c = 8)
    >>> 8
    Explanation: One optimal set of moves is to take from the 2nd and 3rd piles for 8 turns until they are empty.
    After that, there are fewer than two non-empty piles, so the game ends.
    """


Prompt:
def largestMerge(word1: str, word2: str) -> str:
    """
    You are given two strings word1 and word2. You want to construct a string merge in the following way: while either word1 or word2 are non-empty, choose one of the following options:

    If word1 is non-empty, append the first character in word1 to merge and delete it from word1.

    For example, if word1 = "abc" and merge = "dv", then after choosing this operation, word1 = "bc" and merge = "dva".

    If word2 is non-empty, append the first character in word2 to merge and delete it from word2.

    For example, if word2 = "abc" and merge = "", then after choosing this operation, word2 = "bc" and merge = "a".

    Return the lexicographically largest merge you can construct.
    A string a is lexicographically larger than a string b (of the same length) if in the first position where a and b differ, a has a character strictly larger than the corresponding character in b. For example, "abcd" is lexicographically larger than "abcc" because the first position they differ is at the fourth character, and d is greater than c.

    Example 1:

    >>> largestMerge(word1 = "cabaa", word2 = "bcaaa")
    >>> "cbcabaaaaa"
    Explanation: One way to get the lexicographically largest merge is:
    - Take from word1: merge = "c", word1 = "abaa", word2 = "bcaaa"
    - Take from word2: merge = "cb", word1 = "abaa", word2 = "caaa"
    - Take from word2: merge = "cbc", word1 = "abaa", word2 = "aaa"
    - Take from word1: merge = "cbca", word1 = "baa", word2 = "aaa"
    - Take from word1: merge = "cbcab", word1 = "aa", word2 = "aaa"
    - Append the remaining 5 a's from word1 and word2 at the end of merge.

    Example 2:

    >>> largestMerge(word1 = "abcabc", word2 = "abdcaba")
    >>> "abdcabcabcaba"
    """


Prompt:
def minAbsDifference(nums: List[int], goal: int) -> int:
    """
    You are given an integer array nums and an integer goal.
    You want to choose a subsequence of nums such that the sum of its elements is the closest possible to goal. That is, if the sum of the subsequence's elements is sum, then you want to minimize the absolute difference abs(sum - goal).
    Return the minimum possible value of abs(sum - goal).
    Note that a subsequence of an array is an array formed by removing some elements (possibly all or none) of the original array.

    Example 1:

    >>> minAbsDifference(nums = [5,-7,3,5], goal = 6)
    >>> 0
    Explanation: Choose the whole array as a subsequence, with a sum of 6.
    This is equal to the goal, so the absolute difference is 0.

    Example 2:

    >>> minAbsDifference(nums = [7,-9,15,-2], goal = -5)
    >>> 1
    Explanation: Choose the subsequence [7,-9,-2], with a sum of -4.
    The absolute difference is abs(-4 - (-5)) = abs(1) = 1, which is the minimum.

    Example 3:

    >>> minAbsDifference(nums = [1,2,3], goal = -7)
    >>> 7
    """


Prompt:
def minOperations(s: str) -> int:
    """
    You are given a string s consisting only of the characters '0' and '1'. In one operation, you can change any '0' to '1' or vice versa.
    The string is called alternating if no two adjacent characters are equal. For example, the string "010" is alternating, while the string "0100" is not.
    Return the minimum number of operations needed to make s alternating.

    Example 1:

    >>> minOperations(s = "0100")
    >>> 1
    Explanation: If you change the last character to '1', s will be "0101", which is alternating.

    Example 2:

    >>> minOperations(s = "10")
    >>> 0
    Explanation: s is already alternating.

    Example 3:

    >>> minOperations(s = "1111")
    >>> 2
    Explanation: You need two operations to reach "0101" or "1010".
    """


Prompt:
def countHomogenous(s: str) -> int:
    """
    Given a string s, return the number of homogenous substrings of s. Since the answer may be too large, return it modulo 109 + 7.
    A string is homogenous if all the characters of the string are the same.
    A substring is a contiguous sequence of characters within a string.

    Example 1:

    >>> countHomogenous(s = "abbcccaa")
    >>> 13
    Explanation: The homogenous substrings are listed as below:
    "a"   appears 3 times.
    "aa"  appears 1 time.
    "b"   appears 2 times.
    "bb"  appears 1 time.
    "c"   appears 3 times.
    "cc"  appears 2 times.
    "ccc" appears 1 time.
    3 + 1 + 2 + 1 + 3 + 2 + 1 = 13.
    Example 2:

    >>> countHomogenous(s = "xy")
    >>> 2
    Explanation: The homogenous substrings are "x" and "y".
    Example 3:

    >>> countHomogenous(s = "zzzzz")
    >>> 15
    """


Prompt:
def minimumSize(nums: List[int], maxOperations: int) -> int:
    """
    You are given an integer array nums where the ith bag contains nums[i] balls. You are also given an integer maxOperations.
    You can perform the following operation at most maxOperations times:

    Take any bag of balls and divide it into two new bags with a positive number of balls.

    For example, a bag of 5 balls can become two new bags of 1 and 4 balls, or two new bags of 2 and 3 balls.

    Your penalty is the maximum number of balls in a bag. You want to minimize your penalty after the operations.
    Return the minimum possible penalty after performing the operations.

    Example 1:

    >>> minimumSize(nums = [9], maxOperations = 2)
    >>> 3
    Explanation:
    - Divide the bag with 9 balls into two bags of sizes 6 and 3. [9] -> [6,3].
    - Divide the bag with 6 balls into two bags of sizes 3 and 3. [6,3] -> [3,3,3].
    The bag with the most number of balls has 3 balls, so your penalty is 3 and you should return 3.

    Example 2:

    >>> minimumSize(nums = [2,4,8,2], maxOperations = 4)
    >>> 2
    Explanation:
    - Divide the bag with 8 balls into two bags of sizes 4 and 4. [2,4,8,2] -> [2,4,4,4,2].
    - Divide the bag with 4 balls into two bags of sizes 2 and 2. [2,4,4,4,2] -> [2,2,2,4,4,2].
    - Divide the bag with 4 balls into two bags of sizes 2 and 2. [2,2,2,4,4,2] -> [2,2,2,2,2,4,2].
    - Divide the bag with 4 balls into two bags of sizes 2 and 2. [2,2,2,2,2,4,2] -> [2,2,2,2,2,2,2,2].
    The bag with the most number of balls has 2 balls, so your penalty is 2, and you should return 2.
    """


Prompt:
def minTrioDegree(n: int, edges: List[List[int]]) -> int:
    """
    You are given an undirected graph. You are given an integer n which is the number of nodes in the graph and an array edges, where each edges[i] = [ui, vi] indicates that there is an undirected edge between ui and vi.
    A connected trio is a set of three nodes where there is an edge between every pair of them.
    The degree of a connected trio is the number of edges where one endpoint is in the trio, and the other is not.
    Return the minimum degree of a connected trio in the graph, or -1 if the graph has no connected trios.

    Example 1:

    >>> minTrioDegree(n = 6, edges = [[1,2],[1,3],[3,2],[4,1],[5,2],[3,6]])
    >>> 3
    Explanation: There is exactly one trio, which is [1,2,3]. The edges that form its degree are bolded in the figure above.

    Example 2:

    >>> minTrioDegree(n = 7, edges = [[1,3],[4,1],[4,3],[2,5],[5,6],[6,7],[7,5],[2,6]])
    >>> 0
    Explanation: There are exactly three trios:
    1) [1,4,3] with degree 0.
    2) [2,5,6] with degree 2.
    3) [5,6,7] with degree 2.
    """


Prompt:
def findBuildings(heights: List[int]) -> List[int]:
    """
    There are n buildings in a line. You are given an integer array heights of size n that represents the heights of the buildings in the line.
    The ocean is to the right of the buildings. A building has an ocean view if the building can see the ocean without obstructions. Formally, a building has an ocean view if all the buildings to its right have a smaller height.
    Return a list of indices (0-indexed) of buildings that have an ocean view, sorted in increasing order.

    Example 1:

    >>> findBuildings(heights = [4,2,3,1])
    >>> [0,2,3]
    Explanation: Building 1 (0-indexed) does not have an ocean view because building 2 is taller.

    Example 2:

    >>> findBuildings(heights = [4,3,2,1])
    >>> [0,1,2,3]
    Explanation: All the buildings have an ocean view.

    Example 3:

    >>> findBuildings(heights = [1,3,2,4])
    >>> [3]
    Explanation: Only building 3 has an ocean view.
    """


Prompt:
def longestNiceSubstring(s: str) -> str:
    """
    A string s is nice if, for every letter of the alphabet that s contains, it appears both in uppercase and lowercase. For example, "abABB" is nice because 'A' and 'a' appear, and 'B' and 'b' appear. However, "abA" is not because 'b' appears, but 'B' does not.
    Given a string s, return the longest substring of s that is nice. If there are multiple, return the substring of the earliest occurrence. If there are none, return an empty string.

    Example 1:

    >>> longestNiceSubstring(s = "YazaAay")
    >>> "aAa"
    Explanation: "aAa" is a nice string because 'A/a' is the only letter of the alphabet in s, and both 'A' and 'a' appear.
    "aAa" is the longest nice substring.

    Example 2:

    >>> longestNiceSubstring(s = "Bb")
    >>> "Bb"
    Explanation: "Bb" is a nice string because both 'B' and 'b' appear. The whole string is a substring.

    Example 3:

    >>> longestNiceSubstring(s = "c")
    >>> ""
    Explanation: There are no nice substrings.
    """


Prompt:
def canChoose(groups: List[List[int]], nums: List[int]) -> bool:
    """
    You are given a 2D integer array groups of length n. You are also given an integer array nums.
    You are asked if you can choose n disjoint subarrays from the array nums such that the ith subarray is equal to groups[i] (0-indexed), and if i > 0, the (i-1)th subarray appears before the ith subarray in nums (i.e. the subarrays must be in the same order as groups).
    Return true if you can do this task, and false otherwise.
    Note that the subarrays are disjoint if and only if there is no index k such that nums[k] belongs to more than one subarray. A subarray is a contiguous sequence of elements within an array.

    Example 1:

    >>> canChoose(groups = [[1,-1,-1],[3,-2,0]], nums = [1,-1,0,1,-1,-1,3,-2,0])
    >>> true
    Explanation: You can choose the 0th subarray as [1,-1,0,1,-1,-1,3,-2,0] and the 1st one as [1,-1,0,1,-1,-1,3,-2,0].
    These subarrays are disjoint as they share no common nums[k] element.

    Example 2:

    >>> canChoose(groups = [[10,-2],[1,2,3,4]], nums = [1,2,3,4,10,-2])
    >>> false
    Explanation: Note that choosing the subarrays [1,2,3,4,10,-2] and [1,2,3,4,10,-2] is incorrect because they are not in the same order as in groups.
    [10,-2] must come before [1,2,3,4].

    Example 3:

    >>> canChoose(groups = [[1,2,3],[3,4]], nums = [7,7,1,2,3,4,7,7])
    >>> false
    Explanation: Note that choosing the subarrays [7,7,1,2,3,4,7,7] and [7,7,1,2,3,4,7,7] is invalid because they are not disjoint.
    They share a common elements nums[4] (0-indexed).
    """


Prompt:
def highestPeak(isWater: List[List[int]]) -> List[List[int]]:
    """
    You are given an integer matrix isWater of size m x n that represents a map of land and water cells.

    If isWater[i][j] == 0, cell (i, j) is a land cell.
    If isWater[i][j] == 1, cell (i, j) is a water cell.

    You must assign each cell a height in a way that follows these rules:

    The height of each cell must be non-negative.
    If the cell is a water cell, its height must be 0.
    Any two adjacent cells must have an absolute height difference of at most 1. A cell is adjacent to another cell if the former is directly north, east, south, or west of the latter (i.e., their sides are touching).

    Find an assignment of heights such that the maximum height in the matrix is maximized.
    Return an integer matrix height of size m x n where height[i][j] is cell (i, j)'s height. If there are multiple solutions, return any of them.

    Example 1:

    >>> highestPeak(isWater = [[0,1],[0,0]])
    >>> [[1,0],[2,1]]
    Explanation: The image shows the assigned heights of each cell.
    The blue cell is the water cell, and the green cells are the land cells.

    Example 2:

    >>> highestPeak(isWater = [[0,0,1],[1,0,0],[0,0,0]])
    >>> [[1,1,0],[0,1,1],[1,2,2]]
    Explanation: A height of 2 is the maximum possible height of any assignment.
    Any height assignment that has a maximum height of 2 while still meeting the rules will also be accepted.
    """


Prompt:
def getCoprimes(nums: List[int], edges: List[List[int]]) -> List[int]:
    """
    There is a tree (i.e., a connected, undirected graph that has no cycles) consisting of n nodes numbered from 0 to n - 1 and exactly n - 1 edges. Each node has a value associated with it, and the root of the tree is node 0.
    To represent this tree, you are given an integer array nums and a 2D array edges. Each nums[i] represents the ith node's value, and each edges[j] = [uj, vj] represents an edge between nodes uj and vj in the tree.
    Two values x and y are coprime if gcd(x, y) == 1 where gcd(x, y) is the greatest common divisor of x and y.
    An ancestor of a node i is any other node on the shortest path from node i to the root. A node is not considered an ancestor of itself.
    Return an array ans of size n, where ans[i] is the closest ancestor to node i such that nums[i] and nums[ans[i]] are coprime, or -1 if there is no such ancestor.

    Example 1:

    >>> getCoprimes(nums = [2,3,3,2], edges = [[0,1],[1,2],[1,3]])
    >>> [-1,0,0,1]
    Explanation: In the above figure, each node's value is in parentheses.
    - Node 0 has no coprime ancestors.
    - Node 1 has only one ancestor, node 0. Their values are coprime (gcd(2,3) == 1).
    - Node 2 has two ancestors, nodes 1 and 0. Node 1's value is not coprime (gcd(3,3) == 3), but node 0's
      value is (gcd(2,3) == 1), so node 0 is the closest valid ancestor.
    - Node 3 has two ancestors, nodes 1 and 0. It is coprime with node 1 (gcd(3,2) == 1), so node 1 is its
      closest valid ancestor.

    Example 2:

    >>> getCoprimes(nums = [5,6,10,2,3,6,15], edges = [[0,1],[0,2],[1,3],[1,4],[2,5],[2,6]])
    >>> [-1,0,-1,0,0,0,-1]
    """


Prompt:
def mergeAlternately(word1: str, word2: str) -> str:
    """
    You are given two strings word1 and word2. Merge the strings by adding letters in alternating order, starting with word1. If a string is longer than the other, append the additional letters onto the end of the merged string.\r
    \r
    Return the merged string.\r
    \r
     \r
    Example 1:\r
    \r
    \r
    >>> mergeAlternately(word1 = "abc", word2 = "pqr"\r)
    >>> "apbqcr"\r
    Explanation: The merged string will be merged as so:\r
    word1:  a   b   c\r
    word2:    p   q   r\r
    merged: a p b q c r\r
    \r
    \r
    Example 2:\r
    \r
    \r
    >>> mergeAlternately(word1 = "ab", word2 = "pqrs"\r)
    >>> "apbqrs"\r
    Explanation: Notice that as word2 is longer, "rs" is appended to the end.\r
    word1:  a   b \r
    word2:    p   q   r   s\r
    merged: a p b q   r   s\r
    \r
    \r
    Example 3:\r
    \r
    \r
    >>> mergeAlternately(word1 = "abcd", word2 = "pq"\r)
    >>> "apbqcd"\r
    Explanation: Notice that as word1 is longer, "cd" is appended to the end.\r
    word1:  a   b   c   d\r
    word2:    p   q \r
    merged: a p b q c   d\r
    \r
    \r
     \r
    """


Prompt:
def minOperations(boxes: str) -> List[int]:
    """
    You have n boxes. You are given a binary string boxes of length n, where boxes[i] is '0' if the ith box is empty, and '1' if it contains one ball.
    In one operation, you can move one ball from a box to an adjacent box. Box i is adjacent to box j if abs(i - j) == 1. Note that after doing so, there may be more than one ball in some boxes.
    Return an array answer of size n, where answer[i] is the minimum number of operations needed to move all the balls to the ith box.
    Each answer[i] is calculated considering the initial state of the boxes.

    Example 1:

    >>> minOperations(boxes = "110")
    >>> [1,1,3]
    Explanation: The answer for each box is as follows:
    1) First box: you will have to move one ball from the second box to the first box in one operation.
    2) Second box: you will have to move one ball from the first box to the second box in one operation.
    3) Third box: you will have to move one ball from the first box to the third box in two operations, and move one ball from the second box to the third box in one operation.

    Example 2:

    >>> minOperations(boxes = "001011")
    >>> [11,8,5,4,3,4]
    """


Prompt:
def maximumScore(nums: List[int], multipliers: List[int]) -> int:
    """
    You are given two 0-indexed integer arrays nums and multipliers of size n and m respectively, where n >= m.
    You begin with a score of 0. You want to perform exactly m operations. On the ith operation (0-indexed) you will:

    Choose one integer x from either the start or the end of the array nums.
    Add multipliers[i] * x to your score.

    Note that multipliers[0] corresponds to the first operation, multipliers[1] to the second operation, and so on.

    Remove x from nums.

    Return the maximum score after performing m operations.

    Example 1:

    >>> maximumScore(nums = [1,2,3], multipliers = [3,2,1])
    >>> 14
    Explanation: An optimal solution is as follows:
    - Choose from the end, [1,2,3], adding 3 * 3 = 9 to the score.
    - Choose from the end, [1,2], adding 2 * 2 = 4 to the score.
    - Choose from the end, [1], adding 1 * 1 = 1 to the score.
    The total score is 9 + 4 + 1 = 14.
    Example 2:

    >>> maximumScore(nums = [-5,-3,-3,-2,7,1], multipliers = [-10,-5,3,4,6])
    >>> 102
    Explanation: An optimal solution is as follows:
    - Choose from the start, [-5,-3,-3,-2,7,1], adding -5 * -10 = 50 to the score.
    - Choose from the start, [-3,-3,-2,7,1], adding -3 * -5 = 15 to the score.
    - Choose from the start, [-3,-2,7,1], adding -3 * 3 = -9 to the score.
    - Choose from the end, [-2,7,1], adding 1 * 4 = 4 to the score.
    - Choose from the end, [-2,7], adding 7 * 6 = 42 to the score.
    The total score is 50 + 15 - 9 + 4 + 42 = 102.
    """


Prompt:
def longestPalindrome(word1: str, word2: str) -> int:
    """
    You are given two strings, word1 and word2. You want to construct a string in the following manner:

    Choose some non-empty subsequence subsequence1 from word1.
    Choose some non-empty subsequence subsequence2 from word2.
    Concatenate the subsequences: subsequence1 + subsequence2, to make the string.

    Return the length of the longest palindrome that can be constructed in the described manner. If no palindromes can be constructed, return 0.
    A subsequence of a string s is a string that can be made by deleting some (possibly none) characters from s without changing the order of the remaining characters.
    A palindrome is a string that reads the same forward as well as backward.

    Example 1:

    >>> longestPalindrome(word1 = "cacb", word2 = "cbba")
    >>> 5
    Explanation: Choose "ab" from word1 and "cba" from word2 to make "abcba", which is a palindrome.
    Example 2:

    >>> longestPalindrome(word1 = "ab", word2 = "ab")
    >>> 3
    Explanation: Choose "ab" from word1 and "a" from word2 to make "aba", which is a palindrome.
    Example 3:

    >>> longestPalindrome(word1 = "aa", word2 = "bb")
    >>> 0
    Explanation: You cannot construct a palindrome from the described method, so return 0.
    """


Prompt:
def sortFeatures(features: List[str], responses: List[str]) -> List[str]:
    """
    You are given a string array features where features[i] is a single word that represents the name of a feature of the latest product you are working on. You have made a survey where users have reported which features they like. You are given a string array responses, where each responses[i] is a string containing space-separated words.
    The popularity of a feature is the number of responses[i] that contain the feature. You want to sort the features in non-increasing order by their popularity. If two features have the same popularity, order them by their original index in features. Notice that one response could contain the same feature multiple times; this feature is only counted once in its popularity.
    Return the features in sorted order.

    Example 1:

    >>> sortFeatures(features = ["cooler","lock","touch"], responses = ["i like cooler cooler","lock touch cool","locker like touch"])
    >>> ["touch","cooler","lock"]
    Explanation: appearances("cooler") = 1, appearances("lock") = 1, appearances("touch") = 2. Since "cooler" and "lock" both had 1 appearance, "cooler" comes first because "cooler" came first in the features array.

    Example 2:

    >>> sortFeatures(features = ["a","aa","b","c"], responses = ["a","a aa","a a a a a","b a"])
    >>> ["a","aa","b","c"]
    """


Prompt:
def countMatches(items: List[List[str]], ruleKey: str, ruleValue: str) -> int:
    """
    You are given an array items, where each items[i] = [typei, colori, namei] describes the type, color, and name of the ith item. You are also given a rule represented by two strings, ruleKey and ruleValue.
    The ith item is said to match the rule if one of the following is true:

    ruleKey == "type" and ruleValue == typei.
    ruleKey == "color" and ruleValue == colori.
    ruleKey == "name" and ruleValue == namei.

    Return the number of items that match the given rule.

    Example 1:

    >>> countMatches(items = [["phone","blue","pixel"],["computer","silver","lenovo"],["phone","gold","iphone"]], ruleKey = "color", ruleValue = "silver")
    >>> 1
    Explanation: There is only one item matching the given rule, which is ["computer","silver","lenovo"].

    Example 2:

    >>> countMatches(items = [["phone","blue","pixel"],["computer","silver","phone"],["phone","gold","iphone"]], ruleKey = "type", ruleValue = "phone")
    >>> 2
    Explanation: There are only two items matching the given rule, which are ["phone","blue","pixel"] and ["phone","gold","iphone"]. Note that the item ["computer","silver","phone"] does not match.
    """


Prompt:
def closestCost(baseCosts: List[int], toppingCosts: List[int], target: int) -> int:
    """
    You would like to make dessert and are preparing to buy the ingredients. You have n ice cream base flavors and m types of toppings to choose from. You must follow these rules when making your dessert:

    There must be exactly one ice cream base.
    You can add one or more types of topping or have no toppings at all.
    There are at most two of each type of topping.

    You are given three inputs:

    baseCosts, an integer array of length n, where each baseCosts[i] represents the price of the ith ice cream base flavor.
    toppingCosts, an integer array of length m, where each toppingCosts[i] is the price of one of the ith topping.
    target, an integer representing your target price for dessert.

    You want to make a dessert with a total cost as close to target as possible.
    Return the closest possible cost of the dessert to target. If there are multiple, return the lower one.

    Example 1:

    >>> closestCost(baseCosts = [1,7], toppingCosts = [3,4], target = 10)
    >>> 10
    Explanation: Consider the following combination (all 0-indexed):
    - Choose base 1: cost 7
    - Take 1 of topping 0: cost 1 x 3 = 3
    - Take 0 of topping 1: cost 0 x 4 = 0
    Total: 7 + 3 + 0 = 10.

    Example 2:

    >>> closestCost(baseCosts = [2,3], toppingCosts = [4,5,100], target = 18)
    >>> 17
    Explanation: Consider the following combination (all 0-indexed):
    - Choose base 1: cost 3
    - Take 1 of topping 0: cost 1 x 4 = 4
    - Take 2 of topping 1: cost 2 x 5 = 10
    - Take 0 of topping 2: cost 0 x 100 = 0
    Total: 3 + 4 + 10 + 0 = 17. You cannot make a dessert with a total cost of 18.

    Example 3:

    >>> closestCost(baseCosts = [3,10], toppingCosts = [2,5], target = 9)
    >>> 8
    Explanation: It is possible to make desserts with cost 8 and 10. Return 8 as it is the lower cost.
    """


Prompt:
def minOperations(nums1: List[int], nums2: List[int]) -> int:
    """
    You are given two arrays of integers nums1 and nums2, possibly of different lengths. The values in the arrays are between 1 and 6, inclusive.
    In one operation, you can change any integer's value in any of the arrays to any value between 1 and 6, inclusive.
    Return the minimum number of operations required to make the sum of values in nums1 equal to the sum of values in nums2. Return -1 if it is not possible to make the sum of the two arrays equal.

    Example 1:

    >>> minOperations(nums1 = [1,2,3,4,5,6], nums2 = [1,1,2,2,2,2])
    >>> 3
    Explanation: You can make the sums of nums1 and nums2 equal with 3 operations. All indices are 0-indexed.
    - Change nums2[0] to 6. nums1 = [1,2,3,4,5,6], nums2 = [6,1,2,2,2,2].
    - Change nums1[5] to 1. nums1 = [1,2,3,4,5,1], nums2 = [6,1,2,2,2,2].
    - Change nums1[2] to 2. nums1 = [1,2,2,4,5,1], nums2 = [6,1,2,2,2,2].

    Example 2:

    >>> minOperations(nums1 = [1,1,1,1,1,1,1], nums2 = [6])
    >>> -1
    Explanation: There is no way to decrease the sum of nums1 or to increase the sum of nums2 to make them equal.

    Example 3:

    >>> minOperations(nums1 = [6,6], nums2 = [1])
    >>> 3
    Explanation: You can make the sums of nums1 and nums2 equal with 3 operations. All indices are 0-indexed.
    - Change nums1[0] to 2. nums1 = [2,6], nums2 = [1].
    - Change nums1[1] to 2. nums1 = [2,2], nums2 = [1].
    - Change nums2[0] to 4. nums1 = [2,2], nums2 = [4].
    """


Prompt:
def getCollisionTimes(cars: List[List[int]]) -> List[float]:
    """
    There are n cars traveling at different speeds in the same direction along a one-lane road. You are given an array cars of length n, where cars[i] = [positioni, speedi] represents:

    positioni is the distance between the ith car and the beginning of the road in meters. It is guaranteed that positioni < positioni+1.
    speedi is the initial speed of the ith car in meters per second.

    For simplicity, cars can be considered as points moving along the number line. Two cars collide when they occupy the same position. Once a car collides with another car, they unite and form a single car fleet. The cars in the formed fleet will have the same position and the same speed, which is the initial speed of the slowest car in the fleet.
    Return an array answer, where answer[i] is the time, in seconds, at which the ith car collides with the next car, or -1 if the car does not collide with the next car. Answers within 10-5 of the actual answers are accepted.

    Example 1:

    >>> getCollisionTimes(cars = [[1,2],[2,1],[4,3],[7,2]])
    >>> [1.00000,-1.00000,3.00000,-1.00000]
    Explanation: After exactly one second, the first car will collide with the second car, and form a car fleet with speed 1 m/s. After exactly 3 seconds, the third car will collide with the fourth car, and form a car fleet with speed 2 m/s.

    Example 2:

    >>> getCollisionTimes(cars = [[3,4],[5,4],[6,3],[9,1]])
    >>> [2.00000,1.00000,1.50000,-1.00000]
    """


Prompt:
def nearestValidPoint(x: int, y: int, points: List[List[int]]) -> int:
    """
    You are given two integers, x and y, which represent your current location on a Cartesian grid: (x, y). You are also given an array points where each points[i] = [ai, bi] represents that a point exists at (ai, bi). A point is valid if it shares the same x-coordinate or the same y-coordinate as your location.
    Return the index (0-indexed) of the valid point with the smallest Manhattan distance from your current location. If there are multiple, return the valid point with the smallest index. If there are no valid points, return -1.
    The Manhattan distance between two points (x1, y1) and (x2, y2) is abs(x1 - x2) + abs(y1 - y2).

    Example 1:

    >>> nearestValidPoint(x = 3, y = 4, points = [[1,2],[3,1],[2,4],[2,3],[4,4]])
    >>> 2
    Explanation: Of all the points, only [3,1], [2,4] and [4,4] are valid. Of the valid points, [2,4] and [4,4] have the smallest Manhattan distance from your current location, with a distance of 1. [2,4] has the smallest index, so return 2.
    Example 2:

    >>> nearestValidPoint(x = 3, y = 4, points = [[3,4]])
    >>> 0
    Explanation: The answer is allowed to be on the same location as your current location.
    Example 3:

    >>> nearestValidPoint(x = 3, y = 4, points = [[2,3]])
    >>> -1
    Explanation: There are no valid points.
    """


Prompt:
def checkPowersOfThree(n: int) -> bool:
    """
    Given an integer n, return true if it is possible to represent n as the sum of distinct powers of three. Otherwise, return false.
    An integer y is a power of three if there exists an integer x such that y == 3x.

    Example 1:

    >>> checkPowersOfThree(n = 12)
    >>> true
    Explanation: 12 = 31 + 32

    Example 2:

    >>> checkPowersOfThree(n = 91)
    >>> true
    Explanation: 91 = 30 + 32 + 34

    Example 3:

    >>> checkPowersOfThree(n = 21)
    >>> false
    """


Prompt:
def beautySum(s: str) -> int:
    """
    The beauty of a string is the difference in frequencies between the most frequent and least frequent characters.

    For example, the beauty of "abaacc" is 3 - 1 = 2.

    Given a string s, return the sum of beauty of all of its substrings.

    Example 1:

    >>> beautySum(s = "aabcb")
    >>> 5
    Explanation: The substrings with non-zero beauty are ["aab","aabc","aabcb","abcb","bcb"], each with beauty equal to 1.
    Example 2:

    >>> beautySum(s = "aabcbaa")
    >>> 17
    """


Prompt:
def countPairs(n: int, edges: List[List[int]], queries: List[int]) -> List[int]:
    """
    You are given an undirected graph defined by an integer n, the number of nodes, and a 2D integer array edges, the edges in the graph, where edges[i] = [ui, vi] indicates that there is an undirected edge between ui and vi. You are also given an integer array queries.
    Let incident(a, b) be defined as the number of edges that are connected to either node a or b.
    The answer to the jth query is the number of pairs of nodes (a, b) that satisfy both of the following conditions:

    a < b
    incident(a, b) > queries[j]

    Return an array answers such that answers.length == queries.length and answers[j] is the answer of the jth query.
    Note that there can be multiple edges between the same two nodes.

    Example 1:

    >>> countPairs(n = 4, edges = [[1,2],[2,4],[1,3],[2,3],[2,1]], queries = [2,3])
    >>> [6,5]
    Explanation: The calculations for incident(a, b) are shown in the table above.
    The answers for each of the queries are as follows:
    - answers[0] = 6. All the pairs have an incident(a, b) value greater than 2.
    - answers[1] = 5. All the pairs except (3, 4) have an incident(a, b) value greater than 3.

    Example 2:

    >>> countPairs(n = 5, edges = [[1,5],[1,5],[3,4],[2,5],[1,3],[5,1],[2,3],[2,5]], queries = [1,2,3,4,5])
    >>> [10,10,9,8,6]
    """


Prompt:
def checkOnesSegment(s: str) -> bool:
    """
    Given a binary string s without leading zeros, return true if s contains at most one contiguous segment of ones. Otherwise, return false.

    Example 1:

    >>> checkOnesSegment(s = "1001")
    >>> false
    Explanation: The ones do not form a contiguous segment.

    Example 2:

    >>> checkOnesSegment(s = "110")
    >>> true
    """


Prompt:
def minElements(nums: List[int], limit: int, goal: int) -> int:
    """
    You are given an integer array nums and two integers limit and goal. The array nums has an interesting property that abs(nums[i]) <= limit.
    Return the minimum number of elements you need to add to make the sum of the array equal to goal. The array must maintain its property that abs(nums[i]) <= limit.
    Note that abs(x) equals x if x >= 0, and -x otherwise.

    Example 1:

    >>> minElements(nums = [1,-1,1], limit = 3, goal = -4)
    >>> 2
    Explanation: You can add -2 and -3, then the sum of the array will be 1 - 1 + 1 - 2 - 3 = -4.

    Example 2:

    >>> minElements(nums = [1,-10,9,1], limit = 100, goal = 0)
    >>> 1
    """


Prompt:
def countRestrictedPaths(n: int, edges: List[List[int]]) -> int:
    """
    There is an undirected weighted connected graph. You are given a positive integer n which denotes that the graph has n nodes labeled from 1 to n, and an array edges where each edges[i] = [ui, vi, weighti] denotes that there is an edge between nodes ui and vi with weight equal to weighti.
    A path from node start to node end is a sequence of nodes [z0, z1, z2, ..., zk] such that z0 = start and zk = end and there is an edge between zi and zi+1 where 0 <= i <= k-1.
    The distance of a path is the sum of the weights on the edges of the path. Let distanceToLastNode(x) denote the shortest distance of a path between node n and node x. A restricted path is a path that also satisfies that distanceToLastNode(zi) > distanceToLastNode(zi+1) where 0 <= i <= k-1.
    Return the number of restricted paths from node 1 to node n. Since that number may be too large, return it modulo 109 + 7.

    Example 1:

    >>> countRestrictedPaths(n = 5, edges = [[1,2,3],[1,3,3],[2,3,1],[1,4,2],[5,2,2],[3,5,1],[5,4,10]])
    >>> 3
    Explanation: Each circle contains the node number in black and its distanceToLastNode value in blue. The three restricted paths are:
    1) 1 --> 2 --> 5
    2) 1 --> 2 --> 3 --> 5
    3) 1 --> 3 --> 5

    Example 2:

    >>> countRestrictedPaths(n = 7, edges = [[1,3,1],[4,1,2],[7,3,4],[2,5,3],[5,6,1],[6,7,2],[7,5,3],[2,6,4]])
    >>> 1
    Explanation: Each circle contains the node number in black and its distanceToLastNode value in blue. The only restricted path is 1 --> 3 --> 7.
    """


Prompt:
def minChanges(nums: List[int], k: int) -> int:
    """
    You are given an array nums and an integer k. The XOR of a segment [left, right] where left <= right is the XOR of all the elements with indices between left and right, inclusive: nums[left] XOR nums[left+1] XOR ... XOR nums[right].
    Return the minimum number of elements to change in the array such that the XOR of all segments of size k is equal to zero.

    Example 1:

    >>> minChanges(nums = [1,2,0,3,0], k = 1)
    >>> 3
    Explanation: Modify the array from [1,2,0,3,0] to from [0,0,0,0,0].

    Example 2:

    >>> minChanges(nums = [3,4,5,2,1,7,3,4,7], k = 3)
    >>> 3
    Explanation: Modify the array from [3,4,5,2,1,7,3,4,7] to [3,4,7,3,4,7,3,4,7].

    Example 3:

    >>> minChanges(nums = [1,2,4,1,2,5,1,2,6], k = 3)
    >>> 3
    Explanation: Modify the array from [1,2,4,1,2,5,1,2,6] to [1,2,3,1,2,3,1,2,3].
    """


Prompt:
def maximumBeauty(flowers: List[int]) -> int:
    """
    There is a garden of n flowers, and each flower has an integer beauty value. The flowers are arranged in a line. You are given an integer array flowers of size n and each flowers[i] represents the beauty of the ith flower.\r
    \r
    A garden is valid if it meets these conditions:\r
    \r
    \r
    	The garden has at least two flowers.\r
    	The first and the last flower of the garden have the same beauty value.\r
    \r
    \r
    As the appointed gardener, you have the ability to remove any (possibly none) flowers from the garden. You want to remove flowers in a way that makes the remaining garden valid. The beauty of the garden is the sum of the beauty of all the remaining flowers.\r
    \r
    Return the maximum possible beauty of some valid garden after you have removed any (possibly none) flowers.\r
    \r
     \r
    Example 1:\r
    \r
    \r
    >>> maximumBeauty(flowers = [1,2,3,1,2]\r)
    >>> 8\r
    Explanation: You can produce the valid garden [2,3,1,2] to have a total beauty of 2 + 3 + 1 + 2 = 8.\r
    \r
    Example 2:\r
    \r
    \r
    >>> maximumBeauty(flowers = [100,1,1,-3,1]\r)
    >>> 3\r
    Explanation: You can produce the valid garden [1,1,1] to have a total beauty of 1 + 1 + 1 = 3.\r
    \r
    \r
    Example 3:\r
    \r
    \r
    >>> maximumBeauty(flowers = [-1,-2,0,-1]\r)
    >>> -2\r
    Explanation: You can produce the valid garden [-1,-1] to have a total beauty of -1 + -1 = -2.\r
    \r
    \r
     \r
    """


Prompt:
def areAlmostEqual(s1: str, s2: str) -> bool:
    """
    You are given two strings s1 and s2 of equal length. A string swap is an operation where you choose two indices in a string (not necessarily different) and swap the characters at these indices.
    Return true if it is possible to make both strings equal by performing at most one string swap on exactly one of the strings. Otherwise, return false.

    Example 1:

    >>> areAlmostEqual(s1 = "bank", s2 = "kanb")
    >>> true
    Explanation: For example, swap the first character with the last character of s2 to make "bank".

    Example 2:

    >>> areAlmostEqual(s1 = "attack", s2 = "defend")
    >>> false
    Explanation: It is impossible to make them equal with one string swap.

    Example 3:

    >>> areAlmostEqual(s1 = "kelb", s2 = "kelb")
    >>> true
    Explanation: The two strings are already equal, so no string swap operation is required.
    """


Prompt:
def findCenter(edges: List[List[int]]) -> int:
    """
    There is an undirected star graph consisting of n nodes labeled from 1 to n. A star graph is a graph where there is one center node and exactly n - 1 edges that connect the center node with every other node.
    You are given a 2D integer array edges where each edges[i] = [ui, vi] indicates that there is an edge between the nodes ui and vi. Return the center of the given star graph.

    Example 1:

    >>> findCenter(edges = [[1,2],[2,3],[4,2]])
    >>> 2
    Explanation: As shown in the figure above, node 2 is connected to every other node, so 2 is the center.

    Example 2:

    >>> findCenter(edges = [[1,2],[5,1],[1,3],[1,4]])
    >>> 1
    """


Prompt:
def maxAverageRatio(classes: List[List[int]], extraStudents: int) -> float:
    """
    There is a school that has classes of students and each class will be having a final exam. You are given a 2D integer array classes, where classes[i] = [passi, totali]. You know beforehand that in the ith class, there are totali total students, but only passi number of students will pass the exam.
    You are also given an integer extraStudents. There are another extraStudents brilliant students that are guaranteed to pass the exam of any class they are assigned to. You want to assign each of the extraStudents students to a class in a way that maximizes the average pass ratio across all the classes.
    The pass ratio of a class is equal to the number of students of the class that will pass the exam divided by the total number of students of the class. The average pass ratio is the sum of pass ratios of all the classes divided by the number of the classes.
    Return the maximum possible average pass ratio after assigning the extraStudents students. Answers within 10-5 of the actual answer will be accepted.

    Example 1:

    >>> maxAverageRatio(classes = [[1,2],[3,5],[2,2]], extraStudents = 2)
    >>> 0.78333
    Explanation: You can assign the two extra students to the first class. The average pass ratio will be equal to (3/4 + 3/5 + 2/2) / 3 = 0.78333.

    Example 2:

    >>> maxAverageRatio(classes = [[2,4],[3,9],[4,5],[2,10]], extraStudents = 4)
    >>> 0.53485
    """


Prompt:
def maximumScore(nums: List[int], k: int) -> int:
    """
    You are given an array of integers nums (0-indexed) and an integer k.
    The score of a subarray (i, j) is defined as min(nums[i], nums[i+1], ..., nums[j]) * (j - i + 1). A good subarray is a subarray where i <= k <= j.
    Return the maximum possible score of a good subarray.

    Example 1:

    >>> maximumScore(nums = [1,4,3,7,4,5], k = 3)
    >>> 15
    Explanation: The optimal subarray is (1, 5) with a score of min(4,3,7,4,5) * (5-1+1) = 3 * 5 = 15.

    Example 2:

    >>> maximumScore(nums = [5,5,4,5,4,1,1,1], k = 0)
    >>> 20
    Explanation: The optimal subarray is (0, 4) with a score of min(5,5,4,5,4) * (4-0+1) = 4 * 5 = 20.
    """


Prompt:
def countQuadruples(firstString: str, secondString: str) -> int:
    """
    You are given two strings firstString and secondString that are 0-indexed and consist only of lowercase English letters. Count the number of index quadruples (i,j,a,b) that satisfy the following conditions:

    0 <= i <= j < firstString.length
    0 <= a <= b < secondString.length
    The substring of firstString that starts at the ith character and ends at the jth character (inclusive) is equal to the substring of secondString that starts at the ath character and ends at the bth character (inclusive).
    j - a is the minimum possible value among all quadruples that satisfy the previous conditions.

    Return the number of such quadruples.

    Example 1:

    >>> countQuadruples(firstString = "abcd", secondString = "bccda")
    >>> 1
    Explanation: The quadruple (0,0,4,4) is the only one that satisfies all the conditions and minimizes j - a.

    Example 2:

    >>> countQuadruples(firstString = "ab", secondString = "cd")
    >>> 0
    Explanation: There are no quadruples satisfying all the conditions.
    """


Prompt:
def secondHighest(s: str) -> int:
    """
    Given an alphanumeric string s, return the second largest numerical digit that appears in s, or -1 if it does not exist.
    An alphanumeric string is a string consisting of lowercase English letters and digits.

    Example 1:

    >>> secondHighest(s = "dfa12321afd")
    >>> 2
    Explanation: The digits that appear in s are [1, 2, 3]. The second largest digit is 2.

    Example 2:

    >>> secondHighest(s = "abc1111")
    >>> -1
    Explanation: The digits that appear in s are [1]. There is no second largest digit.
    """


Prompt:
def getMaximumConsecutive(coins: List[int]) -> int:
    """
    You are given an integer array coins of length n which represents the n coins that you own. The value of the ith coin is coins[i]. You can make some value x if you can choose some of your n coins such that their values sum up to x.
    Return the maximum number of consecutive integer values that you can make with your coins starting from and including 0.
    Note that you may have multiple coins of the same value.

    Example 1:

    >>> getMaximumConsecutive(coins = [1,3])
    >>> 2
    Explanation: You can make the following values:
    - 0: take []
    - 1: take [1]
    You can make 2 consecutive integer values starting from 0.
    Example 2:

    >>> getMaximumConsecutive(coins = [1,1,1,4])
    >>> 8
    Explanation: You can make the following values:
    - 0: take []
    - 1: take [1]
    - 2: take [1,1]
    - 3: take [1,1,1]
    - 4: take [4]
    - 5: take [4,1]
    - 6: take [4,1,1]
    - 7: take [4,1,1,1]
    You can make 8 consecutive integer values starting from 0.
    Example 3:

    >>> getMaximumConsecutive(coins = [1,4,10,3,1])
    >>> 20
    """


Prompt:
def maxAscendingSum(nums: List[int]) -> int:
    """
    Given an array of positive integers nums, return the maximum possible sum of an strictly increasing subarray in nums.
    A subarray is defined as a contiguous sequence of numbers in an array.

    Example 1:

    >>> maxAscendingSum(nums = [10,20,30,5,10,50])
    >>> 65
    Explanation: [5,10,50] is the ascending subarray with the maximum sum of 65.

    Example 2:

    >>> maxAscendingSum(nums = [10,20,30,40,50])
    >>> 150
    Explanation: [10,20,30,40,50] is the ascending subarray with the maximum sum of 150.

    Example 3:

    >>> maxAscendingSum(nums = [12,17,15,13,10,11,12])
    >>> 33
    Explanation: [10,11,12] is the ascending subarray with the maximum sum of 33.
    """


Prompt:
def getNumberOfBacklogOrders(orders: List[List[int]]) -> int:
    """
    You are given a 2D integer array orders, where each orders[i] = [pricei, amounti, orderTypei] denotes that amounti orders have been placed of type orderTypei at the price pricei. The orderTypei is:\r
    \r
    \r
    	0 if it is a batch of buy orders, or\r
    	1 if it is a batch of sell orders.\r
    \r
    \r
    Note that orders[i] represents a batch of amounti independent orders with the same price and order type. All orders represented by orders[i] will be placed before all orders represented by orders[i+1] for all valid i.\r
    \r
    There is a backlog that consists of orders that have not been executed. The backlog is initially empty. When an order is placed, the following happens:\r
    \r
    \r
    	If the order is a buy order, you look at the sell order with the smallest price in the backlog. If that sell order's price is smaller than or equal to the current buy order's price, they will match and be executed, and that sell order will be removed from the backlog. Else, the buy order is added to the backlog.\r
    	Vice versa, if the order is a sell order, you look at the buy order with the largest price in the backlog. If that buy order's price is larger than or equal to the current sell order's price, they will match and be executed, and that buy order will be removed from the backlog. Else, the sell order is added to the backlog.\r
    \r
    \r
    Return the total amount of orders in the backlog after placing all the orders from the input. Since this number can be large, return it modulo 109 + 7.\r
    \r
     \r
    Example 1:\r
    \r
    \r
    >>> getNumberOfBacklogOrders(orders = [[10,5,0],[15,2,1],[25,1,1],[30,4,0]]\r)
    >>> 6\r
    Explanation: Here is what happens with the orders:\r
    - 5 orders of type buy with price 10 are placed. There are no sell orders, so the 5 orders are added to the backlog.\r
    - 2 orders of type sell with price 15 are placed. There are no buy orders with prices larger than or equal to 15, so the 2 orders are added to the backlog.\r
    - 1 order of type sell with price 25 is placed. There are no buy orders with prices larger than or equal to 25 in the backlog, so this order is added to the backlog.\r
    - 4 orders of type buy with price 30 are placed. The first 2 orders are matched with the 2 sell orders of the least price, which is 15 and these 2 sell orders are removed from the backlog. The 3rd order is matched with the sell order of the least price, which is 25 and this sell order is removed from the backlog. Then, there are no more sell orders in the backlog, so the 4th order is added to the backlog.\r
    Finally, the backlog has 5 buy orders with price 10, and 1 buy order with price 30. So the total number of orders in the backlog is 6.\r
    \r
    \r
    Example 2:\r
    \r
    \r
    >>> getNumberOfBacklogOrders(orders = [[7,1000000000,1],[15,3,0],[5,999999995,0],[5,1,1]]\r)
    >>> 999999984\r
    Explanation: Here is what happens with the orders:\r
    - 109 orders of type sell with price 7 are placed. There are no buy orders, so the 109 orders are added to the backlog.\r
    - 3 orders of type buy with price 15 are placed. They are matched with the 3 sell orders with the least price which is 7, and those 3 sell orders are removed from the backlog.\r
    - 999999995 orders of type buy with price 5 are placed. The least price of a sell order is 7, so the 999999995 orders are added to the backlog.\r
    - 1 order of type sell with price 5 is placed. It is matched with the buy order of the highest price, which is 5, and that buy order is removed from the backlog.\r
    Finally, the backlog has (1000000000-3) sell orders with price 7, and (999999995-1) buy orders with price 5. So the total number of orders = 1999999991, which is equal to 999999984 % (109 + 7).\r
    \r
    \r
     \r
    """


Prompt:
def maxValue(n: int, index: int, maxSum: int) -> int:
    """
    You are given three positive integers: n, index, and maxSum. You want to construct an array nums (0-indexed) that satisfies the following conditions:

    nums.length == n
    nums[i] is a positive integer where 0 <= i < n.
    abs(nums[i] - nums[i+1]) <= 1 where 0 <= i < n-1.
    The sum of all the elements of nums does not exceed maxSum.
    nums[index] is maximized.

    Return nums[index] of the constructed array.
    Note that abs(x) equals x if x >= 0, and -x otherwise.

    Example 1:

    >>> maxValue(n = 4, index = 2,  maxSum = 6)
    >>> 2
    Explanation: nums = [1,2,2,1] is one array that satisfies all the conditions.
    There are no arrays that satisfy all the conditions and have nums[2] == 3, so 2 is the maximum nums[2].

    Example 2:

    >>> maxValue(n = 6, index = 1,  maxSum = 10)
    >>> 3
    """


Prompt:
def countPairs(nums: List[int], low: int, high: int) -> int:
    """
    Given a (0-indexed) integer array nums and two integers low and high, return the number of nice pairs.\r
    \r
    A nice pair is a pair (i, j) where 0 <= i < j < nums.length and low <= (nums[i] XOR nums[j]) <= high.\r
    \r
     \r
    Example 1:\r
    \r
    \r
    >>> countPairs(nums = [1,4,2,7], low = 2, high = 6\r)
    >>> 6\r
    Explanation: All nice pairs (i, j) are as follows:\r
        - (0, 1): nums[0] XOR nums[1] = 5 \r
        - (0, 2): nums[0] XOR nums[2] = 3\r
        - (0, 3): nums[0] XOR nums[3] = 6\r
        - (1, 2): nums[1] XOR nums[2] = 6\r
        - (1, 3): nums[1] XOR nums[3] = 3\r
        - (2, 3): nums[2] XOR nums[3] = 5\r
    \r
    \r
    Example 2:\r
    \r
    \r
    >>> countPairs(nums = [9,8,4,2,1], low = 5, high = 14\r)
    >>> 8\r
    Explanation: All nice pairs (i, j) are as follows:\r
        - (0, 2): nums[0] XOR nums[2] = 13\r
        - (0, 3): nums[0] XOR nums[3] = 11\r
        - (0, 4): nums[0] XOR nums[4] = 8\r
        - (1, 2): nums[1] XOR nums[2] = 12\r
        - (1, 3): nums[1] XOR nums[3] = 10\r
        - (1, 4): nums[1] XOR nums[4] = 9\r
        - (2, 3): nums[2] XOR nums[3] = 6\r
        - (2, 4): nums[2] XOR nums[4] = 5\r
    \r
     \r
    """


Prompt:
def numDifferentIntegers(word: str) -> int:
    """
    You are given a string word that consists of digits and lowercase English letters.
    You will replace every non-digit character with a space. For example, "a123bc34d8ef34" will become " 123  34 8  34". Notice that you are left with some integers that are separated by at least one space: "123", "34", "8", and "34".
    Return the number of different integers after performing the replacement operations on word.
    Two integers are considered different if their decimal representations without any leading zeros are different.

    Example 1:

    >>> numDifferentIntegers(word = "a123bc34d8ef34")
    >>> 3
    Explanation: The three different integers are "123", "34", and "8". Notice that "34" is only counted once.

    Example 2:

    >>> numDifferentIntegers(word = "leet1234code234")
    >>> 2

    Example 3:

    >>> numDifferentIntegers(word = "a1b01c001")
    >>> 1
    Explanation: The three integers "1", "01", and "001" all represent the same integer because
    the leading zeros are ignored when comparing their decimal values.
    """


Prompt:
def reinitializePermutation(n: int) -> int:
    """
    You are given an even integer n. You initially have a permutation perm of size n where perm[i] == i (0-indexed).
    In one operation, you will create a new array arr, and for each i:

    If i % 2 == 0, then arr[i] = perm[i / 2].
    If i % 2 == 1, then arr[i] = perm[n / 2 + (i - 1) / 2].

    You will then assign arr to perm.
    Return the minimum non-zero number of operations you need to perform on perm to return the permutation to its initial value.

    Example 1:

    >>> reinitializePermutation(n = 2)
    >>> 1
    Explanation: perm = [0,1] initially.
    After the 1st operation, perm = [0,1]
    So it takes only 1 operation.

    Example 2:

    >>> reinitializePermutation(n = 4)
    >>> 2
    Explanation: perm = [0,1,2,3] initially.
    After the 1st operation, perm = [0,2,1,3]
    After the 2nd operation, perm = [0,1,2,3]
    So it takes only 2 operations.

    Example 3:

    >>> reinitializePermutation(n = 6)
    >>> 4
    """


Prompt:
def evaluate(s: str, knowledge: List[List[str]]) -> str:
    """
    You are given a string s that contains some bracket pairs, with each pair containing a non-empty key.

    For example, in the string "(name)is(age)yearsold", there are two bracket pairs that contain the keys "name" and "age".

    You know the values of a wide range of keys. This is represented by a 2D string array knowledge where each knowledge[i] = [keyi, valuei] indicates that key keyi has a value of valuei.
    You are tasked to evaluate all of the bracket pairs. When you evaluate a bracket pair that contains some key keyi, you will:

    Replace keyi and the bracket pair with the key's corresponding valuei.
    If you do not know the value of the key, you will replace keyi and the bracket pair with a question mark "?" (without the quotation marks).

    Each key will appear at most once in your knowledge. There will not be any nested brackets in s.
    Return the resulting string after evaluating all of the bracket pairs.

    Example 1:

    >>> evaluate(s = "(name)is(age)yearsold", knowledge = [["name","bob"],["age","two"]])
    >>> "bobistwoyearsold"
    Explanation:
    The key "name" has a value of "bob", so replace "(name)" with "bob".
    The key "age" has a value of "two", so replace "(age)" with "two".

    Example 2:

    >>> evaluate(s = "hi(name)", knowledge = [["a","b"]])
    >>> "hi?"
    Explanation: As you do not know the value of the key "name", replace "(name)" with "?".

    Example 3:

    >>> evaluate(s = "(a)(a)(a)aaa", knowledge = [["a","yes"]])
    >>> "yesyesyesaaa"
    Explanation: The same key can appear multiple times.
    The key "a" has a value of "yes", so replace all occurrences of "(a)" with "yes".
    Notice that the "a"s not in a bracket pair are not evaluated.
    """


Prompt:
def maxNiceDivisors(primeFactors: int) -> int:
    """
    You are given a positive integer primeFactors. You are asked to construct a positive integer n that satisfies the following conditions:\r
    \r
    \r
      The number of prime factors of n (not necessarily distinct) is at most primeFactors.\r
      The number of nice divisors of n is maximized. Note that a divisor of n is nice if it is divisible by every prime factor of n. For example, if n = 12, then its prime factors are [2,2,3], then 6 and 12 are nice divisors, while 3 and 4 are not.\r
    \r
    \r
    Return the number of nice divisors of n. Since that number can be too large, return it modulo 109 + 7.\r
    \r
    Note that a prime number is a natural number greater than 1 that is not a product of two smaller natural numbers. The prime factors of a number n is a list of prime numbers such that their product equals n.\r
    \r
     \r
    Example 1:\r
    \r
    \r
    >>> maxNiceDivisors(primeFactors = 5\r)
    >>> 6\r
    Explanation: 200 is a valid value of n.\r
    It has 5 prime factors: [2,2,2,5,5], and it has 6 nice divisors: [10,20,40,50,100,200].\r
    There is not other value of n that has at most 5 prime factors and more nice divisors.\r
    \r
    \r
    Example 2:\r
    \r
    \r
    >>> maxNiceDivisors(primeFactors = 8\r)
    >>> 18\r
    \r
    \r
     \r
    """


Prompt:
def squareIsWhite(coordinates: str) -> bool:
    """
    You are given coordinates, a string that represents the coordinates of a square of the chessboard. Below is a chessboard for your reference.

    Return true if the square is white, and false if the square is black.
    The coordinate will always represent a valid chessboard square. The coordinate will always have the letter first, and the number second.

    Example 1:

    >>> squareIsWhite(coordinates = "a1")
    >>> false
    Explanation: From the chessboard above, the square with coordinates "a1" is black, so return false.

    Example 2:

    >>> squareIsWhite(coordinates = "h3")
    >>> true
    Explanation: From the chessboard above, the square with coordinates "h3" is white, so return true.

    Example 3:

    >>> squareIsWhite(coordinates = "c7")
    >>> false
    """