diff --git "a/python/data.jsonl" "b/python/data.jsonl" new file mode 100644--- /dev/null +++ "b/python/data.jsonl" @@ -0,0 +1,260 @@ +{"id": "LeetCode/3263", "content": "# Divide an Array Into Subarrays With Minimum Cost I\n\nYou are given an array of integers `nums` of length `n`.\n\n\nThe **cost** of an array is the value of its **first** element. For example, the cost of `[1,2,3]` is `1` while the cost of `[3,4,1]` is `3`.\n\n\nYou need to divide `nums` into `3` **disjoint contiguous** subarrays.\n\n\nReturn *the **minimum** possible **sum** of the cost of these subarrays*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,12]\n**Output:** 6\n**Explanation:** The best possible way to form 3 subarrays is: [1], [2], and [3,12] at a total cost of 1 + 2 + 3 = 6.\nThe other possible ways to form 3 subarrays are:\n- [1], [2,3], and [12] at a total cost of 1 + 2 + 12 = 15.\n- [1,2], [3], and [12] at a total cost of 1 + 3 + 12 = 16.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,4,3]\n**Output:** 12\n**Explanation:** The best possible way to form 3 subarrays is: [5], [4], and [3] at a total cost of 5 + 4 + 3 = 12.\nIt can be shown that 12 is the minimum cost achievable.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [10,3,1,1]\n**Output:** 12\n**Explanation:** The best possible way to form 3 subarrays is: [10,3], [1], and [1] at a total cost of 10 + 1 + 1 = 12.\nIt can be shown that 12 is the minimum cost achievable.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `3 <= n <= 50`\n* `1 <= nums[i] <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumCost(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumCost(**[[1, 2, 3, 12]]) == 6\nassert my_solution.minimumCost(**[[5, 4, 3]]) == 12\nassert my_solution.minimumCost(**[[10, 3, 1, 1]]) == 12\nassert my_solution.minimumCost(**[[1, 1, 1]]) == 3\nassert my_solution.minimumCost(**[[1, 1, 2]]) == 4\nassert my_solution.minimumCost(**[[1, 1, 3]]) == 5\nassert my_solution.minimumCost(**[[1, 1, 4]]) == 6\nassert my_solution.minimumCost(**[[1, 1, 5]]) == 7\nassert my_solution.minimumCost(**[[1, 2, 1]]) == 4\nassert my_solution.minimumCost(**[[1, 2, 2]]) == 5\nassert my_solution.minimumCost(**[[1, 2, 3]]) == 6\nassert my_solution.minimumCost(**[[1, 2, 4]]) == 7\nassert my_solution.minimumCost(**[[1, 2, 5]]) == 8\nassert my_solution.minimumCost(**[[1, 3, 1]]) == 5\nassert my_solution.minimumCost(**[[1, 3, 2]]) == 6\nassert my_solution.minimumCost(**[[1, 3, 3]]) == 7\nassert my_solution.minimumCost(**[[1, 3, 4]]) == 8\nassert my_solution.minimumCost(**[[1, 3, 5]]) == 9\nassert my_solution.minimumCost(**[[1, 4, 1]]) == 6\nassert my_solution.minimumCost(**[[1, 4, 2]]) == 7\n"}, "labels": {"questionId": "3263", "questionFrontendId": "3010", "questionTitle": "Divide an Array Into Subarrays With Minimum Cost I", "stats": {"totalAccepted": "2.6K", "totalSubmission": "3.6K", "totalAcceptedRaw": 2567, "totalSubmissionRaw": 3605, "acRate": "71.2%"}, "probedCases": [{"inputs": [[1, 2, 3, 12]], "output": 6}, {"inputs": [[5, 4, 3]], "output": 12}, {"inputs": [[10, 3, 1, 1]], "output": 12}, {"inputs": [[1, 1, 1]], "output": 3}, {"inputs": [[1, 1, 2]], "output": 4}, {"inputs": [[1, 1, 3]], "output": 5}, {"inputs": [[1, 1, 4]], "output": 6}, {"inputs": [[1, 1, 5]], "output": 7}, {"inputs": [[1, 2, 1]], "output": 4}, {"inputs": [[1, 2, 2]], "output": 5}, {"inputs": [[1, 2, 3]], "output": 6}, {"inputs": [[1, 2, 4]], "output": 7}, {"inputs": [[1, 2, 5]], "output": 8}, {"inputs": [[1, 3, 1]], "output": 5}, {"inputs": [[1, 3, 2]], "output": 6}, {"inputs": [[1, 3, 3]], "output": 7}, {"inputs": [[1, 3, 4]], "output": 8}, {"inputs": [[1, 3, 5]], "output": 9}, {"inputs": [[1, 4, 1]], "output": 6}, {"inputs": [[1, 4, 2]], "output": 7}]}} +{"id": "LeetCode/3291", "content": "# Find if Array Can Be Sorted\n\nYou are given a **0-indexed** array of **positive** integers `nums`.\n\n\nIn one **operation**, you can swap any two **adjacent** elements if they have the **same** number of set bits. You are allowed to do this operation **any** number of times (**including zero**).\n\n\nReturn `true` *if you can sort the array, else return* `false`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [8,4,2,30,15]\n**Output:** true\n**Explanation:** Let's look at the binary representation of every element. The numbers 2, 4, and 8 have one set bit each with binary representation \"10\", \"100\", and \"1000\" respectively. The numbers 15 and 30 have four set bits each with binary representation \"1111\" and \"11110\".\nWe can sort the array using 4 operations:\n- Swap nums[0] with nums[1]. This operation is valid because 8 and 4 have one set bit each. The array becomes [4,8,2,30,15].\n- Swap nums[1] with nums[2]. This operation is valid because 8 and 2 have one set bit each. The array becomes [4,2,8,30,15].\n- Swap nums[0] with nums[1]. This operation is valid because 4 and 2 have one set bit each. The array becomes [2,4,8,30,15].\n- Swap nums[3] with nums[4]. This operation is valid because 30 and 15 have four set bits each. The array becomes [2,4,8,15,30].\nThe array has become sorted, hence we return true.\nNote that there may be other sequences of operations which also sort the array.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4,5]\n**Output:** true\n**Explanation:** The array is already sorted, hence we return true.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [3,16,8,4,2]\n**Output:** false\n**Explanation:** It can be shown that it is not possible to sort the input array using any number of operations.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 100`\n* `1 <= nums[i] <= 28`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def canSortArray(self, nums: List[int]) -> bool:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.canSortArray(**[[8, 4, 2, 30, 15]]) == True\nassert my_solution.canSortArray(**[[1, 2, 3, 4, 5]]) == True\nassert my_solution.canSortArray(**[[3, 16, 8, 4, 2]]) == False\nassert my_solution.canSortArray(**[[1]]) == True\nassert my_solution.canSortArray(**[[4]]) == True\nassert my_solution.canSortArray(**[[7]]) == True\nassert my_solution.canSortArray(**[[10]]) == True\nassert my_solution.canSortArray(**[[18]]) == True\nassert my_solution.canSortArray(**[[30]]) == True\nassert my_solution.canSortArray(**[[1, 2]]) == True\nassert my_solution.canSortArray(**[[2, 17]]) == True\nassert my_solution.canSortArray(**[[20, 16]]) == False\nassert my_solution.canSortArray(**[[21, 17]]) == False\nassert my_solution.canSortArray(**[[24, 12]]) == True\nassert my_solution.canSortArray(**[[26, 10]]) == False\nassert my_solution.canSortArray(**[[128, 128]]) == True\nassert my_solution.canSortArray(**[[1, 2, 3]]) == True\nassert my_solution.canSortArray(**[[1, 256, 64]]) == True\nassert my_solution.canSortArray(**[[2, 28, 9]]) == False\nassert my_solution.canSortArray(**[[6, 6, 192]]) == True\n"}, "labels": {"questionId": "3291", "questionFrontendId": "3011", "questionTitle": "Find if Array Can Be Sorted", "stats": {"totalAccepted": "2.3K", "totalSubmission": "4.8K", "totalAcceptedRaw": 2349, "totalSubmissionRaw": 4798, "acRate": "49.0%"}, "probedCases": [{"inputs": [[8, 4, 2, 30, 15]], "output": true}, {"inputs": [[1, 2, 3, 4, 5]], "output": true}, {"inputs": [[3, 16, 8, 4, 2]], "output": false}, {"inputs": [[1]], "output": true}, {"inputs": [[4]], "output": true}, {"inputs": [[7]], "output": true}, {"inputs": [[10]], "output": true}, {"inputs": [[18]], "output": true}, {"inputs": [[30]], "output": true}, {"inputs": [[1, 2]], "output": true}, {"inputs": [[2, 17]], "output": true}, {"inputs": [[20, 16]], "output": false}, {"inputs": [[21, 17]], "output": false}, {"inputs": [[24, 12]], "output": true}, {"inputs": [[26, 10]], "output": false}, {"inputs": [[128, 128]], "output": true}, {"inputs": [[1, 2, 3]], "output": true}, {"inputs": [[1, 256, 64]], "output": true}, {"inputs": [[2, 28, 9]], "output": false}, {"inputs": [[6, 6, 192]], "output": true}]}} +{"id": "LeetCode/3244", "content": "# Minimize Length of Array Using Operations\n\nYou are given a **0-indexed** integer array `nums` containing **positive** integers.\n\n\nYour task is to **minimize** the length of `nums` by performing the following operations **any** number of times (including zero):\n\n\n* Select **two** **distinct** indices `i` and `j` from `nums`, such that `nums[i] > 0` and `nums[j] > 0`.\n* Insert the result of `nums[i] % nums[j]` at the end of `nums`.\n* Delete the elements at indices `i` and `j` from `nums`.\n\n\nReturn *an integer denoting the **minimum** **length** of* `nums` *after performing the operation any number of times.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,4,3,1]\n**Output:** 1\n**Explanation:** One way to minimize the length of the array is as follows:\nOperation 1: Select indices 2 and 1, insert nums[2] % nums[1] at the end and it becomes [1,4,3,1,3], then delete elements at indices 2 and 1.\nnums becomes [1,1,3].\nOperation 2: Select indices 1 and 2, insert nums[1] % nums[2] at the end and it becomes [1,1,3,1], then delete elements at indices 1 and 2.\nnums becomes [1,1].\nOperation 3: Select indices 1 and 0, insert nums[1] % nums[0] at the end and it becomes [1,1,0], then delete elements at indices 1 and 0.\nnums becomes [0].\nThe length of nums cannot be reduced further. Hence, the answer is 1.\nIt can be shown that 1 is the minimum achievable length. \n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,5,5,10,5]\n**Output:** 2\n**Explanation:** One way to minimize the length of the array is as follows:\nOperation 1: Select indices 0 and 3, insert nums[0] % nums[3] at the end and it becomes [5,5,5,10,5,5], then delete elements at indices 0 and 3.\nnums becomes [5,5,5,5]. \nOperation 2: Select indices 2 and 3, insert nums[2] % nums[3] at the end and it becomes [5,5,5,5,0], then delete elements at indices 2 and 3. \nnums becomes [5,5,0]. \nOperation 3: Select indices 0 and 1, insert nums[0] % nums[1] at the end and it becomes [5,5,0,0], then delete elements at indices 0 and 1.\nnums becomes [0,0].\nThe length of nums cannot be reduced further. Hence, the answer is 2.\nIt can be shown that 2 is the minimum achievable length. \n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [2,3,4]\n**Output:** 1\n**Explanation:** One way to minimize the length of the array is as follows: \nOperation 1: Select indices 1 and 2, insert nums[1] % nums[2] at the end and it becomes [2,3,4,3], then delete elements at indices 1 and 2.\nnums becomes [2,3].\nOperation 2: Select indices 1 and 0, insert nums[1] % nums[0] at the end and it becomes [2,3,1], then delete elements at indices 1 and 0.\nnums becomes [1].\nThe length of nums cannot be reduced further. Hence, the answer is 1.\nIt can be shown that 1 is the minimum achievable length.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumArrayLength(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumArrayLength(**[[1, 4, 3, 1]]) == 1\nassert my_solution.minimumArrayLength(**[[5, 5, 5, 10, 5]]) == 2\nassert my_solution.minimumArrayLength(**[[2, 3, 4]]) == 1\nassert my_solution.minimumArrayLength(**[[1]]) == 1\nassert my_solution.minimumArrayLength(**[[3]]) == 1\nassert my_solution.minimumArrayLength(**[[6]]) == 1\nassert my_solution.minimumArrayLength(**[[1, 4]]) == 1\nassert my_solution.minimumArrayLength(**[[1, 5]]) == 1\nassert my_solution.minimumArrayLength(**[[2, 4]]) == 1\nassert my_solution.minimumArrayLength(**[[3, 4]]) == 1\nassert my_solution.minimumArrayLength(**[[5, 3]]) == 1\nassert my_solution.minimumArrayLength(**[[6, 9]]) == 1\nassert my_solution.minimumArrayLength(**[[8, 2]]) == 1\nassert my_solution.minimumArrayLength(**[[9, 9]]) == 1\nassert my_solution.minimumArrayLength(**[[9, 10]]) == 1\nassert my_solution.minimumArrayLength(**[[1, 2, 5]]) == 1\nassert my_solution.minimumArrayLength(**[[2, 1, 1]]) == 1\nassert my_solution.minimumArrayLength(**[[2, 7, 10]]) == 1\nassert my_solution.minimumArrayLength(**[[2, 9, 5]]) == 1\nassert my_solution.minimumArrayLength(**[[3, 2, 1]]) == 1\n"}, "labels": {"questionId": "3244", "questionFrontendId": "3012", "questionTitle": "Minimize Length of Array Using Operations", "stats": {"totalAccepted": "1.5K", "totalSubmission": "5.4K", "totalAcceptedRaw": 1523, "totalSubmissionRaw": 5406, "acRate": "28.2%"}, "probedCases": [{"inputs": [[1, 4, 3, 1]], "output": 1}, {"inputs": [[5, 5, 5, 10, 5]], "output": 2}, {"inputs": [[2, 3, 4]], "output": 1}, {"inputs": [[1]], "output": 1}, {"inputs": [[3]], "output": 1}, {"inputs": [[6]], "output": 1}, {"inputs": [[1, 4]], "output": 1}, {"inputs": [[1, 5]], "output": 1}, {"inputs": [[2, 4]], "output": 1}, {"inputs": [[3, 4]], "output": 1}, {"inputs": [[5, 3]], "output": 1}, {"inputs": [[6, 9]], "output": 1}, {"inputs": [[8, 2]], "output": 1}, {"inputs": [[9, 9]], "output": 1}, {"inputs": [[9, 10]], "output": 1}, {"inputs": [[1, 2, 5]], "output": 1}, {"inputs": [[2, 1, 1]], "output": 1}, {"inputs": [[2, 7, 10]], "output": 1}, {"inputs": [[2, 9, 5]], "output": 1}, {"inputs": [[3, 2, 1]], "output": 1}]}} +{"id": "LeetCode/3260", "content": "# Divide an Array Into Subarrays With Minimum Cost II\n\nYou are given a **0-indexed** array of integers `nums` of length `n`, and two **positive** integers `k` and `dist`.\n\n\nThe **cost** of an array is the value of its **first** element. For example, the cost of `[1,2,3]` is `1` while the cost of `[3,4,1]` is `3`.\n\n\nYou need to divide `nums` into `k` **disjoint contiguous** subarrays, such that the difference between the starting index of the **second** subarray and the starting index of the `kth` subarray should be **less than or equal to** `dist`. In other words, if you divide `nums` into the subarrays `nums[0..(i1 - 1)], nums[i1..(i2 - 1)], ..., nums[ik-1..(n - 1)]`, then `ik-1 - i1 <= dist`.\n\n\nReturn *the **minimum** possible sum of the cost of these* *subarrays*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,3,2,6,4,2], k = 3, dist = 3\n**Output:** 5\n**Explanation:** The best possible way to divide nums into 3 subarrays is: [1,3], [2,6,4], and [2]. This choice is valid because ik-1 - i1 is 5 - 2 = 3 which is equal to dist. The total cost is nums[0] + nums[2] + nums[5] which is 1 + 2 + 2 = 5.\nIt can be shown that there is no possible way to divide nums into 3 subarrays at a cost lower than 5.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [10,1,2,2,2,1], k = 4, dist = 3\n**Output:** 15\n**Explanation:** The best possible way to divide nums into 4 subarrays is: [10], [1], [2], and [2,2,1]. This choice is valid because ik-1 - i1 is 3 - 1 = 2 which is less than dist. The total cost is nums[0] + nums[1] + nums[2] + nums[3] which is 10 + 1 + 2 + 2 = 15.\nThe division [10], [1], [2,2,2], and [1] is not valid, because the difference between ik-1 and i1 is 5 - 1 = 4, which is greater than dist.\nIt can be shown that there is no possible way to divide nums into 4 subarrays at a cost lower than 15.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [10,8,18,9], k = 3, dist = 1\n**Output:** 36\n**Explanation:** The best possible way to divide nums into 4 subarrays is: [10], [8], and [18,9]. This choice is valid because ik-1 - i1 is 2 - 1 = 1 which is equal to dist.The total cost is nums[0] + nums[1] + nums[2] which is 10 + 8 + 18 = 36.\nThe division [10], [8,18], and [9] is not valid, because the difference between ik-1 and i1 is 3 - 1 = 2, which is greater than dist.\nIt can be shown that there is no possible way to divide nums into 3 subarrays at a cost lower than 36.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `3 <= n <= 105`\n* `1 <= nums[i] <= 109`\n* `3 <= k <= n`\n* `k - 2 <= dist <= n - 2`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumCost(self, nums: List[int], k: int, dist: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumCost(**[[1, 3, 2, 6, 4, 2], 3, 3]) == 5\nassert my_solution.minimumCost(**[[10, 1, 2, 2, 2, 1], 4, 3]) == 15\nassert my_solution.minimumCost(**[[10, 8, 18, 9], 3, 1]) == 36\nassert my_solution.minimumCost(**[[1, 1, 1], 3, 1]) == 3\nassert my_solution.minimumCost(**[[1, 1, 3], 3, 1]) == 5\nassert my_solution.minimumCost(**[[1, 2, 2], 3, 1]) == 5\nassert my_solution.minimumCost(**[[1, 2, 5], 3, 1]) == 8\nassert my_solution.minimumCost(**[[1, 4, 4], 3, 1]) == 9\nassert my_solution.minimumCost(**[[2, 2, 1], 3, 1]) == 5\nassert my_solution.minimumCost(**[[2, 3, 2], 3, 1]) == 7\nassert my_solution.minimumCost(**[[2, 5, 4], 3, 1]) == 11\nassert my_solution.minimumCost(**[[3, 1, 2], 3, 1]) == 6\nassert my_solution.minimumCost(**[[3, 1, 3], 3, 1]) == 7\nassert my_solution.minimumCost(**[[3, 2, 2], 3, 1]) == 7\nassert my_solution.minimumCost(**[[3, 3, 2], 3, 1]) == 8\nassert my_solution.minimumCost(**[[3, 4, 1], 3, 1]) == 8\nassert my_solution.minimumCost(**[[3, 5, 3], 3, 1]) == 11\nassert my_solution.minimumCost(**[[4, 1, 4], 3, 1]) == 9\nassert my_solution.minimumCost(**[[4, 1, 5], 3, 1]) == 10\nassert my_solution.minimumCost(**[[4, 2, 1], 3, 1]) == 7\n"}, "labels": {"questionId": "3260", "questionFrontendId": "3013", "questionTitle": "Divide an Array Into Subarrays With Minimum Cost II", "stats": {"totalAccepted": "1K", "totalSubmission": "2.6K", "totalAcceptedRaw": 1021, "totalSubmissionRaw": 2604, "acRate": "39.2%"}, "probedCases": [{"inputs": [[1, 3, 2, 6, 4, 2], 3, 3], "output": 5}, {"inputs": [[10, 1, 2, 2, 2, 1], 4, 3], "output": 15}, {"inputs": [[10, 8, 18, 9], 3, 1], "output": 36}, {"inputs": [[1, 1, 1], 3, 1], "output": 3}, {"inputs": [[1, 1, 3], 3, 1], "output": 5}, {"inputs": [[1, 2, 2], 3, 1], "output": 5}, {"inputs": [[1, 2, 5], 3, 1], "output": 8}, {"inputs": [[1, 4, 4], 3, 1], "output": 9}, {"inputs": [[2, 2, 1], 3, 1], "output": 5}, {"inputs": [[2, 3, 2], 3, 1], "output": 7}, {"inputs": [[2, 5, 4], 3, 1], "output": 11}, {"inputs": [[3, 1, 2], 3, 1], "output": 6}, {"inputs": [[3, 1, 3], 3, 1], "output": 7}, {"inputs": [[3, 2, 2], 3, 1], "output": 7}, {"inputs": [[3, 3, 2], 3, 1], "output": 8}, {"inputs": [[3, 4, 1], 3, 1], "output": 8}, {"inputs": [[3, 5, 3], 3, 1], "output": 11}, {"inputs": [[4, 1, 4], 3, 1], "output": 9}, {"inputs": [[4, 1, 5], 3, 1], "output": 10}, {"inputs": [[4, 2, 1], 3, 1], "output": 7}]}} +{"id": "LeetCode/3242", "content": "# Count Elements With Maximum Frequency\n\nYou are given an array `nums` consisting of **positive** integers.\n\n\nReturn *the **total frequencies** of elements in*`nums` *such that those elements all have the **maximum** frequency*.\n\n\nThe **frequency** of an element is the number of occurrences of that element in the array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,2,3,1,4]\n**Output:** 4\n**Explanation:** The elements 1 and 2 have a frequency of 2 which is the maximum frequency in the array.\nSo the number of elements in the array with maximum frequency is 4.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4,5]\n**Output:** 5\n**Explanation:** All elements of the array have a frequency of 1 which is the maximum.\nSo the number of elements in the array with maximum frequency is 5.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 100`\n* `1 <= nums[i] <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxFrequencyElements(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxFrequencyElements(**[[1, 2, 2, 3, 1, 4]]) == 4\nassert my_solution.maxFrequencyElements(**[[1, 2, 3, 4, 5]]) == 5\nassert my_solution.maxFrequencyElements(**[[15]]) == 1\nassert my_solution.maxFrequencyElements(**[[10, 12, 11, 9, 6, 19, 11]]) == 2\nassert my_solution.maxFrequencyElements(**[[2, 12, 17, 18, 11]]) == 5\nassert my_solution.maxFrequencyElements(**[[19, 19, 19, 20, 19, 8, 19]]) == 5\nassert my_solution.maxFrequencyElements(**[[1, 1, 1, 1]]) == 4\nassert my_solution.maxFrequencyElements(**[[10, 1, 12, 10, 10, 19, 10]]) == 4\nassert my_solution.maxFrequencyElements(**[[1, 1, 1, 20, 6, 1]]) == 4\nassert my_solution.maxFrequencyElements(**[[17, 17]]) == 2\nassert my_solution.maxFrequencyElements(**[[6, 13, 15, 15, 11, 6, 7, 12, 4, 11]]) == 6\nassert my_solution.maxFrequencyElements(**[[1, 2]]) == 2\nassert my_solution.maxFrequencyElements(**[[14, 14, 17]]) == 2\nassert my_solution.maxFrequencyElements(**[[17, 17, 2, 12, 20, 17, 12]]) == 3\nassert my_solution.maxFrequencyElements(**[[3, 9, 11, 11, 20]]) == 2\nassert my_solution.maxFrequencyElements(**[[8, 15, 8, 11, 8, 13, 12, 11, 8]]) == 4\nassert my_solution.maxFrequencyElements(**[[17, 8, 17, 19, 17, 13, 17, 17, 17, 5]]) == 6\nassert my_solution.maxFrequencyElements(**[[11]]) == 1\nassert my_solution.maxFrequencyElements(**[[5]]) == 1\nassert my_solution.maxFrequencyElements(**[[4, 4, 10]]) == 2\n"}, "labels": {"questionId": "3242", "questionFrontendId": "3005", "questionTitle": "Count Elements With Maximum Frequency", "stats": {"totalAccepted": "5.1K", "totalSubmission": "6.6K", "totalAcceptedRaw": 5130, "totalSubmissionRaw": 6572, "acRate": "78.1%"}, "probedCases": [{"inputs": [[1, 2, 2, 3, 1, 4]], "output": 4}, {"inputs": [[1, 2, 3, 4, 5]], "output": 5}, {"inputs": [[15]], "output": 1}, {"inputs": [[10, 12, 11, 9, 6, 19, 11]], "output": 2}, {"inputs": [[2, 12, 17, 18, 11]], "output": 5}, {"inputs": [[19, 19, 19, 20, 19, 8, 19]], "output": 5}, {"inputs": [[1, 1, 1, 1]], "output": 4}, {"inputs": [[10, 1, 12, 10, 10, 19, 10]], "output": 4}, {"inputs": [[1, 1, 1, 20, 6, 1]], "output": 4}, {"inputs": [[17, 17]], "output": 2}, {"inputs": [[6, 13, 15, 15, 11, 6, 7, 12, 4, 11]], "output": 6}, {"inputs": [[1, 2]], "output": 2}, {"inputs": [[14, 14, 17]], "output": 2}, {"inputs": [[17, 17, 2, 12, 20, 17, 12]], "output": 3}, {"inputs": [[3, 9, 11, 11, 20]], "output": 2}, {"inputs": [[8, 15, 8, 11, 8, 13, 12, 11, 8]], "output": 4}, {"inputs": [[17, 8, 17, 19, 17, 13, 17, 17, 17, 5]], "output": 6}, {"inputs": [[11]], "output": 1}, {"inputs": [[5]], "output": 1}, {"inputs": [[4, 4, 10]], "output": 2}]}} +{"id": "LeetCode/3245", "content": "# Find Beautiful Indices in the Given Array I\n\nYou are given a **0-indexed** string `s`, a string `a`, a string `b`, and an integer `k`.\n\n\nAn index `i` is **beautiful** if:\n\n\n* `0 <= i <= s.length - a.length`\n* `s[i..(i + a.length - 1)] == a`\n* There exists an index `j` such that:\n\t+ `0 <= j <= s.length - b.length`\n\t+ `s[j..(j + b.length - 1)] == b`\n\t+ `|j - i| <= k`\n\n\nReturn *the array that contains beautiful indices in **sorted order from smallest to largest***.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"isawsquirrelnearmysquirrelhouseohmy\", a = \"my\", b = \"squirrel\", k = 15\n**Output:** [16,33]\n**Explanation:** There are 2 beautiful indices: [16,33].\n- The index 16 is beautiful as s[16..17] == \"my\" and there exists an index 4 with s[4..11] == \"squirrel\" and |16 - 4| <= 15.\n- The index 33 is beautiful as s[33..34] == \"my\" and there exists an index 18 with s[18..25] == \"squirrel\" and |33 - 18| <= 15.\nThus we return [16,33] as the result.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"abcd\", a = \"a\", b = \"a\", k = 4\n**Output:** [0]\n**Explanation:** There is 1 beautiful index: [0].\n- The index 0 is beautiful as s[0..0] == \"a\" and there exists an index 0 with s[0..0] == \"a\" and |0 - 0| <= 4.\nThus we return [0] as the result.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= k <= s.length <= 105`\n* `1 <= a.length, b.length <= 10`\n* `s`, `a`, and `b` contain only lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def beautifulIndices(self, s: str, a: str, b: str, k: int) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.beautifulIndices(**['isawsquirrelnearmysquirrelhouseohmy', 'my', 'squirrel', 15]) == [16, 33]\nassert my_solution.beautifulIndices(**['abcd', 'a', 'a', 4]) == [0]\nassert my_solution.beautifulIndices(**['sqgrt', 'rt', 'sq', 3]) == [3]\nassert my_solution.beautifulIndices(**['mquz', 'tklr', 'caz', 4]) == []\nassert my_solution.beautifulIndices(**['wl', 'xjigt', 'wl', 2]) == []\nassert my_solution.beautifulIndices(**['bavgoc', 'ba', 'c', 6]) == [0]\nassert my_solution.beautifulIndices(**['xpcp', 'yxnod', 'xpc', 4]) == []\nassert my_solution.beautifulIndices(**['lahhnlwx', 'hhnlw', 'ty', 6]) == []\nassert my_solution.beautifulIndices(**['dexgscgecd', 'gscge', 'd', 6]) == [3]\nassert my_solution.beautifulIndices(**['vjrao', 'vjr', 'yxpsw', 5]) == []\nassert my_solution.beautifulIndices(**['oo', 'swhup', 'o', 1]) == []\nassert my_solution.beautifulIndices(**['bxlzgxc', 'ducf', 'xlzgx', 3]) == []\nassert my_solution.beautifulIndices(**['wetlgztzm', 'box', 'wetl', 4]) == []\nassert my_solution.beautifulIndices(**['ocmm', 'm', 'oc', 3]) == [2, 3]\nassert my_solution.beautifulIndices(**['goxmox', 'gibs', 'ox', 6]) == []\nassert my_solution.beautifulIndices(**['kzlrqzldvy', 'zl', 'tfsr', 9]) == []\nassert my_solution.beautifulIndices(**['qhd', 'hd', 'od', 1]) == []\nassert my_solution.beautifulIndices(**['bozpeh', 'bozp', 'vrjn', 2]) == []\nassert my_solution.beautifulIndices(**['ggfsg', 'gfsg', 'g', 4]) == [1]\nassert my_solution.beautifulIndices(**['fape', 'vq', 'ap', 4]) == []\n"}, "labels": {"questionId": "3245", "questionFrontendId": "3006", "questionTitle": "Find Beautiful Indices in the Given Array I", "stats": {"totalAccepted": "4.1K", "totalSubmission": "9.5K", "totalAcceptedRaw": 4101, "totalSubmissionRaw": 9521, "acRate": "43.1%"}, "probedCases": [{"inputs": ["isawsquirrelnearmysquirrelhouseohmy", "my", "squirrel", 15], "output": [16, 33]}, {"inputs": ["abcd", "a", "a", 4], "output": [0]}, {"inputs": ["sqgrt", "rt", "sq", 3], "output": [3]}, {"inputs": ["mquz", "tklr", "caz", 4], "output": []}, {"inputs": ["wl", "xjigt", "wl", 2], "output": []}, {"inputs": ["bavgoc", "ba", "c", 6], "output": [0]}, {"inputs": ["xpcp", "yxnod", "xpc", 4], "output": []}, {"inputs": ["lahhnlwx", "hhnlw", "ty", 6], "output": []}, {"inputs": ["dexgscgecd", "gscge", "d", 6], "output": [3]}, {"inputs": ["vjrao", "vjr", "yxpsw", 5], "output": []}, {"inputs": ["oo", "swhup", "o", 1], "output": []}, {"inputs": ["bxlzgxc", "ducf", "xlzgx", 3], "output": []}, {"inputs": ["wetlgztzm", "box", "wetl", 4], "output": []}, {"inputs": ["ocmm", "m", "oc", 3], "output": [2, 3]}, {"inputs": ["goxmox", "gibs", "ox", 6], "output": []}, {"inputs": ["kzlrqzldvy", "zl", "tfsr", 9], "output": []}, {"inputs": ["qhd", "hd", "od", 1], "output": []}, {"inputs": ["bozpeh", "bozp", "vrjn", 2], "output": []}, {"inputs": ["ggfsg", "gfsg", "g", 4], "output": [1]}, {"inputs": ["fape", "vq", "ap", 4], "output": []}]}} +{"id": "LeetCode/3240", "content": "# Maximum Number That Sum of the Prices Is Less Than or Equal to K\n\nYou are given an integer `k` and an integer `x`.\n\n\nConsider `s` is the **1-indexed** binary representation of an integer `num`. The **price** of a number `num` is the number of `i`'s such that `i % x == 0` and `s[i]` is a **set bit**.\n\n\nReturn *the **greatest** integer* `num` *such that the sum of **prices** of all numbers from* `1` *to* `num` *is less than or equal to* `k`*.*\n\n\n**Note**:\n\n\n* In the binary representation of a number **set bit** is a bit of value `1`.\n* The binary representation of a number will be indexed from right to left. For example, if `s == 11100`, `s[4] == 1` and `s[2] == 0`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** k = 9, x = 1\n**Output:** 6\n**Explanation:** The numbers 1, 2, 3, 4, 5, and 6 can be written in binary representation as \"1\", \"10\", \"11\", \"100\", \"101\", and \"110\" respectively.\nSince x is equal to 1, the price of each number is the number of its set bits.\nThe number of set bits in these numbers is 9. So the sum of the prices of the first 6 numbers is 9.\nSo the answer is 6.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** k = 7, x = 2\n**Output:** 9\n**Explanation:** Since x is equal to 2, we should just check eventh bits.\nThe second bit of binary representation of numbers 2 and 3 is a set bit. So the sum of their prices is 2.\nThe second bit of binary representation of numbers 6 and 7 is a set bit. So the sum of their prices is 2.\nThe fourth bit of binary representation of numbers 8 and 9 is a set bit but their second bit is not. So the sum of their prices is 2.\nNumbers 1, 4, and 5 don't have set bits in their eventh bits in their binary representation. So the sum of their prices is 0.\nThe second and the fourth bit of the binary representation of the number 10 are a set bit. So its price is 2.\nThe sum of the prices of the first 9 numbers is 6.\nBecause the sum of the prices of the first 10 numbers is 8, the answer is 9.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= k <= 1015`\n* `1 <= x <= 8`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findMaximumNumber(self, k: int, x: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findMaximumNumber(**[9, 1]) == 6\nassert my_solution.findMaximumNumber(**[7, 2]) == 9\nassert my_solution.findMaximumNumber(**[19, 6]) == 50\nassert my_solution.findMaximumNumber(**[57, 4]) == 120\nassert my_solution.findMaximumNumber(**[58, 5]) == 121\nassert my_solution.findMaximumNumber(**[60, 8]) == 187\nassert my_solution.findMaximumNumber(**[72, 5]) == 151\nassert my_solution.findMaximumNumber(**[81, 6]) == 176\nassert my_solution.findMaximumNumber(**[83, 1]) == 33\nassert my_solution.findMaximumNumber(**[83, 7]) == 210\nassert my_solution.findMaximumNumber(**[116, 5]) == 243\nassert my_solution.findMaximumNumber(**[157, 6]) == 316\nassert my_solution.findMaximumNumber(**[201, 3]) == 212\nassert my_solution.findMaximumNumber(**[268, 6]) == 555\nassert my_solution.findMaximumNumber(**[281, 5]) == 531\nassert my_solution.findMaximumNumber(**[283, 3]) == 274\nassert my_solution.findMaximumNumber(**[309, 4]) == 364\nassert my_solution.findMaximumNumber(**[363, 7]) == 746\nassert my_solution.findMaximumNumber(**[409, 2]) == 220\nassert my_solution.findMaximumNumber(**[456, 7]) == 967\n"}, "labels": {"questionId": "3240", "questionFrontendId": "3007", "questionTitle": "Maximum Number That Sum of the Prices Is Less Than or Equal to K", "stats": {"totalAccepted": "2.6K", "totalSubmission": "6.2K", "totalAcceptedRaw": 2567, "totalSubmissionRaw": 6194, "acRate": "41.4%"}, "probedCases": [{"inputs": [9, 1], "output": 6}, {"inputs": [7, 2], "output": 9}, {"inputs": [19, 6], "output": 50}, {"inputs": [57, 4], "output": 120}, {"inputs": [58, 5], "output": 121}, {"inputs": [60, 8], "output": 187}, {"inputs": [72, 5], "output": 151}, {"inputs": [81, 6], "output": 176}, {"inputs": [83, 1], "output": 33}, {"inputs": [83, 7], "output": 210}, {"inputs": [116, 5], "output": 243}, {"inputs": [157, 6], "output": 316}, {"inputs": [201, 3], "output": 212}, {"inputs": [268, 6], "output": 555}, {"inputs": [281, 5], "output": 531}, {"inputs": [283, 3], "output": 274}, {"inputs": [309, 4], "output": 364}, {"inputs": [363, 7], "output": 746}, {"inputs": [409, 2], "output": 220}, {"inputs": [456, 7], "output": 967}]}} +{"id": "LeetCode/3303", "content": "# Find Beautiful Indices in the Given Array II\n\nYou are given a **0-indexed** string `s`, a string `a`, a string `b`, and an integer `k`.\n\n\nAn index `i` is **beautiful** if:\n\n\n* `0 <= i <= s.length - a.length`\n* `s[i..(i + a.length - 1)] == a`\n* There exists an index `j` such that:\n\t+ `0 <= j <= s.length - b.length`\n\t+ `s[j..(j + b.length - 1)] == b`\n\t+ `|j - i| <= k`\n\n\nReturn *the array that contains beautiful indices in **sorted order from smallest to largest***.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"isawsquirrelnearmysquirrelhouseohmy\", a = \"my\", b = \"squirrel\", k = 15\n**Output:** [16,33]\n**Explanation:** There are 2 beautiful indices: [16,33].\n- The index 16 is beautiful as s[16..17] == \"my\" and there exists an index 4 with s[4..11] == \"squirrel\" and |16 - 4| <= 15.\n- The index 33 is beautiful as s[33..34] == \"my\" and there exists an index 18 with s[18..25] == \"squirrel\" and |33 - 18| <= 15.\nThus we return [16,33] as the result.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"abcd\", a = \"a\", b = \"a\", k = 4\n**Output:** [0]\n**Explanation:** There is 1 beautiful index: [0].\n- The index 0 is beautiful as s[0..0] == \"a\" and there exists an index 0 with s[0..0] == \"a\" and |0 - 0| <= 4.\nThus we return [0] as the result.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= k <= s.length <= 5 * 105`\n* `1 <= a.length, b.length <= 5 * 105`\n* `s`, `a`, and `b` contain only lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def beautifulIndices(self, s: str, a: str, b: str, k: int) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.beautifulIndices(**['isawsquirrelnearmysquirrelhouseohmy', 'my', 'squirrel', 15]) == [16, 33]\nassert my_solution.beautifulIndices(**['abcd', 'a', 'a', 4]) == [0]\nassert my_solution.beautifulIndices(**['a', 'a', 'a', 1]) == [0]\nassert my_solution.beautifulIndices(**['aba', 'a', 'a', 1]) == [0, 2]\nassert my_solution.beautifulIndices(**['nvnvt', 'eq', 'nv', 1]) == []\nassert my_solution.beautifulIndices(**['npearbvede', 'myqpb', 'pearb', 9]) == []\nassert my_solution.beautifulIndices(**['vatevavakz', 'va', 'lbda', 1]) == []\nassert my_solution.beautifulIndices(**['ithhi', 't', 'hhi', 1]) == [1]\nassert my_solution.beautifulIndices(**['osuv', 'osuv', 'wrn', 1]) == []\nassert my_solution.beautifulIndices(**['dc', 'dreec', 'dc', 2]) == []\nassert my_solution.beautifulIndices(**['jajrfw', 'rf', 'j', 3]) == [3]\nassert my_solution.beautifulIndices(**['zcvx', 'kfdvv', 'tru', 1]) == []\nassert my_solution.beautifulIndices(**['wltmqbxt', 'mqbxt', 'lt', 7]) == [3]\nassert my_solution.beautifulIndices(**['gggsytwgzg', 'sytwg', 'g', 4]) == [3]\nassert my_solution.beautifulIndices(**['diive', 'viw', 'lqqdn', 4]) == []\nassert my_solution.beautifulIndices(**['ss', 'omkdt', 's', 1]) == []\nassert my_solution.beautifulIndices(**['hfzoxcm', 'hfzo', 'ipelr', 1]) == []\nassert my_solution.beautifulIndices(**['xllimtmil', 'imt', 'iwqx', 5]) == []\nassert my_solution.beautifulIndices(**['vdyl', 'i', 'ir', 4]) == []\nassert my_solution.beautifulIndices(**['ouwpaz', 'mxre', 'pa', 5]) == []\n"}, "labels": {"questionId": "3303", "questionFrontendId": "3008", "questionTitle": "Find Beautiful Indices in the Given Array II", "stats": {"totalAccepted": "2.7K", "totalSubmission": "9.7K", "totalAcceptedRaw": 2698, "totalSubmissionRaw": 9738, "acRate": "27.7%"}, "probedCases": [{"inputs": ["isawsquirrelnearmysquirrelhouseohmy", "my", "squirrel", 15], "output": [16, 33]}, {"inputs": ["abcd", "a", "a", 4], "output": [0]}, {"inputs": ["a", "a", "a", 1], "output": [0]}, {"inputs": ["aba", "a", "a", 1], "output": [0, 2]}, {"inputs": ["nvnvt", "eq", "nv", 1], "output": []}, {"inputs": ["npearbvede", "myqpb", "pearb", 9], "output": []}, {"inputs": ["vatevavakz", "va", "lbda", 1], "output": []}, {"inputs": ["ithhi", "t", "hhi", 1], "output": [1]}, {"inputs": ["osuv", "osuv", "wrn", 1], "output": []}, {"inputs": ["dc", "dreec", "dc", 2], "output": []}, {"inputs": ["jajrfw", "rf", "j", 3], "output": [3]}, {"inputs": ["zcvx", "kfdvv", "tru", 1], "output": []}, {"inputs": ["wltmqbxt", "mqbxt", "lt", 7], "output": [3]}, {"inputs": ["gggsytwgzg", "sytwg", "g", 4], "output": [3]}, {"inputs": ["diive", "viw", "lqqdn", 4], "output": []}, {"inputs": ["ss", "omkdt", "s", 1], "output": []}, {"inputs": ["hfzoxcm", "hfzo", "ipelr", 1], "output": []}, {"inputs": ["xllimtmil", "imt", "iwqx", 5], "output": []}, {"inputs": ["vdyl", "i", "ir", 4], "output": []}, {"inputs": ["ouwpaz", "mxre", "pa", 5], "output": []}]}} +{"id": "LeetCode/3251", "content": "# Maximum Area of Longest Diagonal Rectangle\n\nYou are given a 2D **0-indexed** integer array `dimensions`.\n\n\nFor all indices `i`, `0 <= i < dimensions.length`, `dimensions[i][0]` represents the length and `dimensions[i][1]` represents the width of the rectangle `i`.\n\n\nReturn *the **area** of the rectangle having the **longest** diagonal. If there are multiple rectangles with the longest diagonal, return the area of the rectangle having the **maximum** area.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** dimensions = [[9,3],[8,6]]\n**Output:** 48\n**Explanation:** \nFor index = 0, length = 9 and width = 3. Diagonal length = sqrt(9 * 9 + 3 * 3) = sqrt(90) ≈ 9.487.\nFor index = 1, length = 8 and width = 6. Diagonal length = sqrt(8 * 8 + 6 * 6) = sqrt(100) = 10.\nSo, the rectangle at index 1 has a greater diagonal length therefore we return area = 8 * 6 = 48.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** dimensions = [[3,4],[4,3]]\n**Output:** 12\n**Explanation:** Length of diagonal is the same for both which is 5, so maximum area = 12.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= dimensions.length <= 100`\n* `dimensions[i].length == 2`\n* `1 <= dimensions[i][0], dimensions[i][1] <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def areaOfMaxDiagonal(self, dimensions: List[List[int]]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.areaOfMaxDiagonal(**[[[9, 3], [8, 6]]]) == 48\nassert my_solution.areaOfMaxDiagonal(**[[[3, 4], [4, 3]]]) == 12\nassert my_solution.areaOfMaxDiagonal(**[[[4, 10], [4, 9], [9, 3], [10, 8]]]) == 80\nassert my_solution.areaOfMaxDiagonal(**[[[2, 6], [5, 1], [3, 10], [8, 4]]]) == 30\nassert my_solution.areaOfMaxDiagonal(**[[[3, 7], [2, 10], [3, 4], [9, 9], [5, 10]]]) == 81\nassert my_solution.areaOfMaxDiagonal(**[[[10, 4]]]) == 40\nassert my_solution.areaOfMaxDiagonal(**[[[9, 9], [1, 8], [10, 5], [2, 8], [6, 3], [7, 1]]]) == 81\nassert my_solution.areaOfMaxDiagonal(**[[[10, 3], [5, 9], [8, 3]]]) == 30\nassert my_solution.areaOfMaxDiagonal(**[[[2, 7], [3, 2], [3, 3], [10, 4], [5, 3], [8, 10], [8, 8], [4, 7]]]) == 80\nassert my_solution.areaOfMaxDiagonal(**[[[1, 10], [3, 10], [4, 4], [2, 6], [6, 3], [6, 4], [9, 1], [6, 1], [2, 3]]]) == 30\nassert my_solution.areaOfMaxDiagonal(**[[[4, 7], [10, 10], [3, 7], [9, 1], [5, 7], [3, 9], [10, 4], [4, 8]]]) == 100\nassert my_solution.areaOfMaxDiagonal(**[[[1, 1], [6, 8], [6, 9], [7, 2], [6, 8], [1, 3], [3, 1], [1, 9]]]) == 54\nassert my_solution.areaOfMaxDiagonal(**[[[6, 6], [1, 3], [8, 10], [10, 1], [3, 10], [7, 7], [10, 8]]]) == 80\nassert my_solution.areaOfMaxDiagonal(**[[[6, 5], [8, 6], [2, 10], [8, 1], [9, 2], [3, 5], [3, 5]]]) == 20\nassert my_solution.areaOfMaxDiagonal(**[[[5, 1], [4, 9], [9, 1], [5, 8], [2, 9], [3, 2], [10, 10], [5, 2]]]) == 100\nassert my_solution.areaOfMaxDiagonal(**[[[8, 3], [9, 10], [7, 7], [6, 5], [6, 9], [9, 10], [5, 10]]]) == 90\nassert my_solution.areaOfMaxDiagonal(**[[[6, 10], [8, 6], [10, 1], [7, 10], [10, 10], [9, 5]]]) == 100\nassert my_solution.areaOfMaxDiagonal(**[[[9, 5], [9, 2], [2, 2], [8, 9], [5, 7], [8, 10], [3, 5]]]) == 80\nassert my_solution.areaOfMaxDiagonal(**[[[3, 9], [9, 5]]]) == 45\nassert my_solution.areaOfMaxDiagonal(**[[[10, 10], [5, 5], [3, 2], [2, 6], [3, 1], [10, 7], [4, 8], [7, 9], [9, 9], [1, 2]]]) == 100\n"}, "labels": {"questionId": "3251", "questionFrontendId": "3000", "questionTitle": "Maximum Area of Longest Diagonal Rectangle", "stats": {"totalAccepted": "4.7K", "totalSubmission": "10.8K", "totalAcceptedRaw": 4667, "totalSubmissionRaw": 10779, "acRate": "43.3%"}, "probedCases": [{"inputs": [[[9, 3], [8, 6]]], "output": 48}, {"inputs": [[[3, 4], [4, 3]]], "output": 12}, {"inputs": [[[4, 10], [4, 9], [9, 3], [10, 8]]], "output": 80}, {"inputs": [[[2, 6], [5, 1], [3, 10], [8, 4]]], "output": 30}, {"inputs": [[[3, 7], [2, 10], [3, 4], [9, 9], [5, 10]]], "output": 81}, {"inputs": [[[10, 4]]], "output": 40}, {"inputs": [[[9, 9], [1, 8], [10, 5], [2, 8], [6, 3], [7, 1]]], "output": 81}, {"inputs": [[[10, 3], [5, 9], [8, 3]]], "output": 30}, {"inputs": [[[2, 7], [3, 2], [3, 3], [10, 4], [5, 3], [8, 10], [8, 8], [4, 7]]], "output": 80}, {"inputs": [[[1, 10], [3, 10], [4, 4], [2, 6], [6, 3], [6, 4], [9, 1], [6, 1], [2, 3]]], "output": 30}, {"inputs": [[[4, 7], [10, 10], [3, 7], [9, 1], [5, 7], [3, 9], [10, 4], [4, 8]]], "output": 100}, {"inputs": [[[1, 1], [6, 8], [6, 9], [7, 2], [6, 8], [1, 3], [3, 1], [1, 9]]], "output": 54}, {"inputs": [[[6, 6], [1, 3], [8, 10], [10, 1], [3, 10], [7, 7], [10, 8]]], "output": 80}, {"inputs": [[[6, 5], [8, 6], [2, 10], [8, 1], [9, 2], [3, 5], [3, 5]]], "output": 20}, {"inputs": [[[5, 1], [4, 9], [9, 1], [5, 8], [2, 9], [3, 2], [10, 10], [5, 2]]], "output": 100}, {"inputs": [[[8, 3], [9, 10], [7, 7], [6, 5], [6, 9], [9, 10], [5, 10]]], "output": 90}, {"inputs": [[[6, 10], [8, 6], [10, 1], [7, 10], [10, 10], [9, 5]]], "output": 100}, {"inputs": [[[9, 5], [9, 2], [2, 2], [8, 9], [5, 7], [8, 10], [3, 5]]], "output": 80}, {"inputs": [[[3, 9], [9, 5]]], "output": 45}, {"inputs": [[[10, 10], [5, 5], [3, 2], [2, 6], [3, 1], [10, 7], [4, 8], [7, 9], [9, 9], [1, 2]]], "output": 100}]}} +{"id": "LeetCode/3228", "content": "# Maximum Size of a Set After Removals\n\nYou are given two **0-indexed** integer arrays `nums1` and `nums2` of even length `n`.\n\n\nYou must remove `n / 2` elements from `nums1` and `n / 2` elements from `nums2`. After the removals, you insert the remaining elements of `nums1` and `nums2` into a set `s`.\n\n\nReturn *the **maximum** possible size of the set* `s`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums1 = [1,2,1,2], nums2 = [1,1,1,1]\n**Output:** 2\n**Explanation:** We remove two occurences of 1 from nums1 and nums2. After the removals, the arrays become equal to nums1 = [2,2] and nums2 = [1,1]. Therefore, s = {1,2}.\nIt can be shown that 2 is the maximum possible size of the set s after the removals.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums1 = [1,2,3,4,5,6], nums2 = [2,3,2,3,2,3]\n**Output:** 5\n**Explanation:** We remove 2, 3, and 6 from nums1, as well as 2 and two occurrences of 3 from nums2. After the removals, the arrays become equal to nums1 = [1,4,5] and nums2 = [2,3,2]. Therefore, s = {1,2,3,4,5}.\nIt can be shown that 5 is the maximum possible size of the set s after the removals.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums1 = [1,1,2,2,3,3], nums2 = [4,4,5,5,6,6]\n**Output:** 6\n**Explanation:** We remove 1, 2, and 3 from nums1, as well as 4, 5, and 6 from nums2. After the removals, the arrays become equal to nums1 = [1,2,3] and nums2 = [4,5,6]. Therefore, s = {1,2,3,4,5,6}.\nIt can be shown that 6 is the maximum possible size of the set s after the removals.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `n == nums1.length == nums2.length`\n* `1 <= n <= 2 * 104`\n* `n` is even.\n* `1 <= nums1[i], nums2[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumSetSize(self, nums1: List[int], nums2: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumSetSize(**[[1, 2, 1, 2], [1, 1, 1, 1]]) == 2\nassert my_solution.maximumSetSize(**[[1, 2, 3, 4, 5, 6], [2, 3, 2, 3, 2, 3]]) == 5\nassert my_solution.maximumSetSize(**[[1, 1, 2, 2, 3, 3], [4, 4, 5, 5, 6, 6]]) == 6\nassert my_solution.maximumSetSize(**[[1, 2, 1, 1], [1, 2, 3, 4]]) == 4\nassert my_solution.maximumSetSize(**[[1, 1, 1, 1], [12, 23, 41, 9]]) == 3\nassert my_solution.maximumSetSize(**[[12, 23, 41, 9], [1, 1, 1, 1]]) == 3\nassert my_solution.maximumSetSize(**[[9, 8, 4, 7], [5, 5, 9, 5]]) == 4\nassert my_solution.maximumSetSize(**[[8, 9], [4, 3]]) == 2\nassert my_solution.maximumSetSize(**[[7, 1], [6, 10]]) == 2\nassert my_solution.maximumSetSize(**[[10, 3], [5, 6]]) == 2\nassert my_solution.maximumSetSize(**[[3, 6], [6, 6]]) == 2\nassert my_solution.maximumSetSize(**[[5, 1], [6, 6]]) == 2\nassert my_solution.maximumSetSize(**[[10, 7], [8, 4]]) == 2\nassert my_solution.maximumSetSize(**[[10, 8, 7, 9], [7, 9, 9, 5]]) == 4\nassert my_solution.maximumSetSize(**[[1, 10, 6, 5], [3, 7, 10, 10]]) == 4\nassert my_solution.maximumSetSize(**[[5, 2, 8, 6], [7, 4, 1, 1]]) == 4\nassert my_solution.maximumSetSize(**[[2, 4, 1, 4], [10, 2, 4, 10]]) == 4\nassert my_solution.maximumSetSize(**[[5, 7], [3, 1]]) == 2\nassert my_solution.maximumSetSize(**[[1, 10, 1, 2], [9, 5, 8, 5]]) == 4\nassert my_solution.maximumSetSize(**[[9, 4], [5, 7]]) == 2\n"}, "labels": {"questionId": "3228", "questionFrontendId": "3002", "questionTitle": "Maximum Size of a Set After Removals", "stats": {"totalAccepted": "3.5K", "totalSubmission": "6.9K", "totalAcceptedRaw": 3537, "totalSubmissionRaw": 6917, "acRate": "51.1%"}, "probedCases": [{"inputs": [[1, 2, 1, 2], [1, 1, 1, 1]], "output": 2}, {"inputs": [[1, 2, 3, 4, 5, 6], [2, 3, 2, 3, 2, 3]], "output": 5}, {"inputs": [[1, 1, 2, 2, 3, 3], [4, 4, 5, 5, 6, 6]], "output": 6}, {"inputs": [[1, 2, 1, 1], [1, 2, 3, 4]], "output": 4}, {"inputs": [[1, 1, 1, 1], [12, 23, 41, 9]], "output": 3}, {"inputs": [[12, 23, 41, 9], [1, 1, 1, 1]], "output": 3}, {"inputs": [[9, 8, 4, 7], [5, 5, 9, 5]], "output": 4}, {"inputs": [[8, 9], [4, 3]], "output": 2}, {"inputs": [[7, 1], [6, 10]], "output": 2}, {"inputs": [[10, 3], [5, 6]], "output": 2}, {"inputs": [[3, 6], [6, 6]], "output": 2}, {"inputs": [[5, 1], [6, 6]], "output": 2}, {"inputs": [[10, 7], [8, 4]], "output": 2}, {"inputs": [[10, 8, 7, 9], [7, 9, 9, 5]], "output": 4}, {"inputs": [[1, 10, 6, 5], [3, 7, 10, 10]], "output": 4}, {"inputs": [[5, 2, 8, 6], [7, 4, 1, 1]], "output": 4}, {"inputs": [[2, 4, 1, 4], [10, 2, 4, 10]], "output": 4}, {"inputs": [[5, 7], [3, 1]], "output": 2}, {"inputs": [[1, 10, 1, 2], [9, 5, 8, 5]], "output": 4}, {"inputs": [[9, 4], [5, 7]], "output": 2}]}} +{"id": "LeetCode/3233", "content": "# Maximize the Number of Partitions After Operations\n\nYou are given a **0-indexed** string `s` and an integer `k`.\n\n\nYou are to perform the following partitioning operations until `s` is **empty**:\n\n\n* Choose the **longest** **prefix** of `s` containing at most `k` **distinct** characters.\n* **Delete** the prefix from `s` and increase the number of partitions by one. The remaining characters (if any) in `s` maintain their initial order.\n\n\n**Before** the operations, you are allowed to change **at most** **one** index in `s` to another lowercase English letter.\n\n\nReturn *an integer denoting the **maximum** number of resulting partitions after the operations by optimally choosing at most one index to change.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"accca\", k = 2\n**Output:** 3\n**Explanation:** In this example, to maximize the number of resulting partitions, s[2] can be changed to 'b'.\ns becomes \"acbca\".\nThe operations can now be performed as follows until s becomes empty:\n- Choose the longest prefix containing at most 2 distinct characters, \"acbca\".\n- Delete the prefix, and s becomes \"bca\". The number of partitions is now 1.\n- Choose the longest prefix containing at most 2 distinct characters, \"bca\".\n- Delete the prefix, and s becomes \"a\". The number of partitions is now 2.\n- Choose the longest prefix containing at most 2 distinct characters, \"a\".\n- Delete the prefix, and s becomes empty. The number of partitions is now 3.\nHence, the answer is 3.\nIt can be shown that it is not possible to obtain more than 3 partitions.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"aabaab\", k = 3\n**Output:** 1\n**Explanation:** In this example, to maximize the number of resulting partitions we can leave s as it is.\nThe operations can now be performed as follows until s becomes empty: \n- Choose the longest prefix containing at most 3 distinct characters, \"aabaab\".\n- Delete the prefix, and s becomes empty. The number of partitions becomes 1. \nHence, the answer is 1. \nIt can be shown that it is not possible to obtain more than 1 partition.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"xxyz\", k = 1\n**Output:** 4\n**Explanation:** In this example, to maximize the number of resulting partitions, s[1] can be changed to 'a'.\ns becomes \"xayz\".\nThe operations can now be performed as follows until s becomes empty:\n- Choose the longest prefix containing at most 1 distinct character, \"xayz\".\n- Delete the prefix, and s becomes \"ayz\". The number of partitions is now 1.\n- Choose the longest prefix containing at most 1 distinct character, \"ayz\".\n- Delete the prefix, and s becomes \"yz\". The number of partitions is now 2.\n- Choose the longest prefix containing at most 1 distinct character, \"yz\".\n- Delete the prefix, and s becomes \"z\". The number of partitions is now 3.\n- Choose the longest prefix containing at most 1 distinct character, \"z\".\n- Delete the prefix, and s becomes empty. The number of partitions is now 4.\nHence, the answer is 4.\nIt can be shown that it is not possible to obtain more than 4 partitions.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 104`\n* `s` consists only of lowercase English letters.\n* `1 <= k <= 26`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxPartitionsAfterOperations(self, s: str, k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxPartitionsAfterOperations(**['accca', 2]) == 3\nassert my_solution.maxPartitionsAfterOperations(**['aabaab', 3]) == 1\nassert my_solution.maxPartitionsAfterOperations(**['xxyz', 1]) == 4\nassert my_solution.maxPartitionsAfterOperations(**['c', 3]) == 1\nassert my_solution.maxPartitionsAfterOperations(**['c', 5]) == 1\nassert my_solution.maxPartitionsAfterOperations(**['h', 17]) == 1\nassert my_solution.maxPartitionsAfterOperations(**['p', 13]) == 1\nassert my_solution.maxPartitionsAfterOperations(**['ab', 5]) == 1\nassert my_solution.maxPartitionsAfterOperations(**['ba', 1]) == 2\nassert my_solution.maxPartitionsAfterOperations(**['ba', 3]) == 1\nassert my_solution.maxPartitionsAfterOperations(**['ca', 1]) == 2\nassert my_solution.maxPartitionsAfterOperations(**['fh', 8]) == 1\nassert my_solution.maxPartitionsAfterOperations(**['abb', 1]) == 3\nassert my_solution.maxPartitionsAfterOperations(**['aca', 2]) == 2\nassert my_solution.maxPartitionsAfterOperations(**['acb', 2]) == 2\nassert my_solution.maxPartitionsAfterOperations(**['acb', 4]) == 1\nassert my_solution.maxPartitionsAfterOperations(**['bab', 3]) == 1\nassert my_solution.maxPartitionsAfterOperations(**['cba', 1]) == 3\nassert my_solution.maxPartitionsAfterOperations(**['cbb', 5]) == 1\nassert my_solution.maxPartitionsAfterOperations(**['cca', 5]) == 1\n"}, "labels": {"questionId": "3233", "questionFrontendId": "3003", "questionTitle": "Maximize the Number of Partitions After Operations", "stats": {"totalAccepted": "1.3K", "totalSubmission": "4K", "totalAcceptedRaw": 1261, "totalSubmissionRaw": 4041, "acRate": "31.2%"}, "probedCases": [{"inputs": ["accca", 2], "output": 3}, {"inputs": ["aabaab", 3], "output": 1}, {"inputs": ["xxyz", 1], "output": 4}, {"inputs": ["c", 3], "output": 1}, {"inputs": ["c", 5], "output": 1}, {"inputs": ["h", 17], "output": 1}, {"inputs": ["p", 13], "output": 1}, {"inputs": ["ab", 5], "output": 1}, {"inputs": ["ba", 1], "output": 2}, {"inputs": ["ba", 3], "output": 1}, {"inputs": ["ca", 1], "output": 2}, {"inputs": ["fh", 8], "output": 1}, {"inputs": ["abb", 1], "output": 3}, {"inputs": ["aca", 2], "output": 2}, {"inputs": ["acb", 2], "output": 2}, {"inputs": ["acb", 4], "output": 1}, {"inputs": ["bab", 3], "output": 1}, {"inputs": ["cba", 1], "output": 3}, {"inputs": ["cbb", 5], "output": 1}, {"inputs": ["cca", 5], "output": 1}]}} +{"id": "LeetCode/3236", "content": "# Smallest Missing Integer Greater Than Sequential Prefix Sum\n\nYou are given a **0-indexed** array of integers `nums`.\n\n\nA prefix `nums[0..i]` is **sequential** if, for all `1 <= j <= i`, `nums[j] = nums[j - 1] + 1`. In particular, the prefix consisting only of `nums[0]` is **sequential**.\n\n\nReturn *the **smallest** integer* `x` *missing from* `nums` *such that* `x` *is greater than or equal to the sum of the **longest** sequential prefix.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,2,5]\n**Output:** 6\n**Explanation:** The longest sequential prefix of nums is [1,2,3] with a sum of 6. 6 is not in the array, therefore 6 is the smallest missing integer greater than or equal to the sum of the longest sequential prefix.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [3,4,5,1,12,14,13]\n**Output:** 15\n**Explanation:** The longest sequential prefix of nums is [3,4,5] with a sum of 12. 12, 13, and 14 belong to the array while 15 does not. Therefore 15 is the smallest missing integer greater than or equal to the sum of the longest sequential prefix.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 50`\n* `1 <= nums[i] <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def missingInteger(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.missingInteger(**[[1, 2, 3, 2, 5]]) == 6\nassert my_solution.missingInteger(**[[3, 4, 5, 1, 12, 14, 13]]) == 15\nassert my_solution.missingInteger(**[[29, 30, 31, 32, 33, 34, 35, 36, 37]]) == 297\nassert my_solution.missingInteger(**[[19, 20, 21, 22]]) == 82\nassert my_solution.missingInteger(**[[18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 9]]) == 253\nassert my_solution.missingInteger(**[[4, 5, 6, 7, 8, 8, 9, 4, 3, 2, 7]]) == 30\nassert my_solution.missingInteger(**[[38]]) == 39\nassert my_solution.missingInteger(**[[1]]) == 2\nassert my_solution.missingInteger(**[[11, 12, 13]]) == 36\nassert my_solution.missingInteger(**[[47, 48, 49, 5, 3]]) == 144\nassert my_solution.missingInteger(**[[23, 24, 25, 4, 5, 1]]) == 72\nassert my_solution.missingInteger(**[[8, 9, 10, 10, 7, 8]]) == 27\nassert my_solution.missingInteger(**[[31, 32, 33, 34, 10, 8, 7, 9, 7, 9, 9, 5, 10, 1]]) == 130\nassert my_solution.missingInteger(**[[17, 18, 19, 20, 21, 22, 3, 7, 10, 10]]) == 117\nassert my_solution.missingInteger(**[[6, 7, 8, 9, 10, 8, 6, 7, 4, 1]]) == 40\nassert my_solution.missingInteger(**[[46, 8, 2, 4, 1, 4, 10, 2, 4, 10, 2, 5, 7, 3, 1]]) == 47\nassert my_solution.missingInteger(**[[37, 1, 2, 9, 5, 8, 5, 2, 9, 4]]) == 38\nassert my_solution.missingInteger(**[[31, 32, 33, 34, 1]]) == 130\nassert my_solution.missingInteger(**[[45, 46, 47, 48, 49, 10, 8, 1, 7, 4, 10, 10, 6, 6, 2]]) == 235\nassert my_solution.missingInteger(**[[13, 10, 7, 5, 7, 10, 6, 10, 2]]) == 14\n"}, "labels": {"questionId": "3236", "questionFrontendId": "2996", "questionTitle": "Smallest Missing Integer Greater Than Sequential Prefix Sum", "stats": {"totalAccepted": "2.7K", "totalSubmission": "7.5K", "totalAcceptedRaw": 2718, "totalSubmissionRaw": 7537, "acRate": "36.1%"}, "probedCases": [{"inputs": [[1, 2, 3, 2, 5]], "output": 6}, {"inputs": [[3, 4, 5, 1, 12, 14, 13]], "output": 15}, {"inputs": [[29, 30, 31, 32, 33, 34, 35, 36, 37]], "output": 297}, {"inputs": [[19, 20, 21, 22]], "output": 82}, {"inputs": [[18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 9]], "output": 253}, {"inputs": [[4, 5, 6, 7, 8, 8, 9, 4, 3, 2, 7]], "output": 30}, {"inputs": [[38]], "output": 39}, {"inputs": [[1]], "output": 2}, {"inputs": [[11, 12, 13]], "output": 36}, {"inputs": [[47, 48, 49, 5, 3]], "output": 144}, {"inputs": [[23, 24, 25, 4, 5, 1]], "output": 72}, {"inputs": [[8, 9, 10, 10, 7, 8]], "output": 27}, {"inputs": [[31, 32, 33, 34, 10, 8, 7, 9, 7, 9, 9, 5, 10, 1]], "output": 130}, {"inputs": [[17, 18, 19, 20, 21, 22, 3, 7, 10, 10]], "output": 117}, {"inputs": [[6, 7, 8, 9, 10, 8, 6, 7, 4, 1]], "output": 40}, {"inputs": [[46, 8, 2, 4, 1, 4, 10, 2, 4, 10, 2, 5, 7, 3, 1]], "output": 47}, {"inputs": [[37, 1, 2, 9, 5, 8, 5, 2, 9, 4]], "output": 38}, {"inputs": [[31, 32, 33, 34, 1]], "output": 130}, {"inputs": [[45, 46, 47, 48, 49, 10, 8, 1, 7, 4, 10, 10, 6, 6, 2]], "output": 235}, {"inputs": [[13, 10, 7, 5, 7, 10, 6, 10, 2]], "output": 14}]}} +{"id": "LeetCode/3249", "content": "# Minimum Number of Operations to Make Array XOR Equal to K\n\nYou are given a **0-indexed** integer array `nums` and a positive integer `k`.\n\n\nYou can apply the following operation on the array **any** number of times:\n\n\n* Choose **any** element of the array and **flip** a bit in its **binary** representation. Flipping a bit means changing a `0` to `1` or vice versa.\n\n\nReturn *the **minimum** number of operations required to make the bitwise* `XOR` *of **all** elements of the final array equal to* `k`.\n\n\n**Note** that you can flip leading zero bits in the binary representation of elements. For example, for the number `(101)2` you can flip the fourth bit and obtain `(1101)2`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,1,3,4], k = 1\n**Output:** 2\n**Explanation:** We can do the following operations:\n- Choose element 2 which is 3 == (011)2, we flip the first bit and we obtain (010)2 == 2. nums becomes [2,1,2,4].\n- Choose element 0 which is 2 == (010)2, we flip the third bit and we obtain (110)2 = 6. nums becomes [6,1,2,4].\nThe XOR of elements of the final array is (6 XOR 1 XOR 2 XOR 4) == 1 == k.\nIt can be shown that we cannot make the XOR equal to k in less than 2 operations.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,0,2,0], k = 0\n**Output:** 0\n**Explanation:** The XOR of elements of the array is (2 XOR 0 XOR 2 XOR 0) == 0 == k. So no operation is needed.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `0 <= nums[i] <= 106`\n* `0 <= k <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minOperations(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minOperations(**[[2, 1, 3, 4], 1]) == 2\nassert my_solution.minOperations(**[[2, 0, 2, 0], 0]) == 0\nassert my_solution.minOperations(**[[4], 7]) == 2\nassert my_solution.minOperations(**[[3, 13, 9, 8, 5, 18, 11, 10], 13]) == 2\nassert my_solution.minOperations(**[[9, 7, 9, 14, 8, 6], 12]) == 3\nassert my_solution.minOperations(**[[13, 9, 10, 16, 11, 8, 1], 17]) == 3\nassert my_solution.minOperations(**[[12, 14], 1]) == 2\nassert my_solution.minOperations(**[[18, 18], 20]) == 2\nassert my_solution.minOperations(**[[3, 5, 1, 1], 19]) == 3\nassert my_solution.minOperations(**[[7, 0, 0, 0], 8]) == 4\nassert my_solution.minOperations(**[[13, 15, 19, 18, 2, 9, 18, 11, 0, 7], 6]) == 1\nassert my_solution.minOperations(**[[9, 15, 19, 15, 10, 15, 14, 0, 2, 5], 20]) == 1\nassert my_solution.minOperations(**[[19, 4, 19, 6, 3, 19, 14, 4, 16, 12], 4]) == 0\nassert my_solution.minOperations(**[[2, 10, 5, 5, 12, 3, 14, 6, 11, 14], 3]) == 2\nassert my_solution.minOperations(**[[11, 20], 10]) == 3\nassert my_solution.minOperations(**[[10, 12, 5, 3, 16, 0], 1]) == 2\nassert my_solution.minOperations(**[[0, 4, 4, 7, 14, 13], 1]) == 2\nassert my_solution.minOperations(**[[16, 2, 20, 13, 15, 20, 13], 16]) == 3\nassert my_solution.minOperations(**[[19, 11, 11, 0, 16, 2, 2, 0, 9], 4]) == 3\nassert my_solution.minOperations(**[[10, 17, 19, 8, 15], 19]) == 3\n"}, "labels": {"questionId": "3249", "questionFrontendId": "2997", "questionTitle": "Minimum Number of Operations to Make Array XOR Equal to K", "stats": {"totalAccepted": "2.5K", "totalSubmission": "3K", "totalAcceptedRaw": 2485, "totalSubmissionRaw": 2957, "acRate": "84.0%"}, "probedCases": [{"inputs": [[2, 1, 3, 4], 1], "output": 2}, {"inputs": [[2, 0, 2, 0], 0], "output": 0}, {"inputs": [[4], 7], "output": 2}, {"inputs": [[3, 13, 9, 8, 5, 18, 11, 10], 13], "output": 2}, {"inputs": [[9, 7, 9, 14, 8, 6], 12], "output": 3}, {"inputs": [[13, 9, 10, 16, 11, 8, 1], 17], "output": 3}, {"inputs": [[12, 14], 1], "output": 2}, {"inputs": [[18, 18], 20], "output": 2}, {"inputs": [[3, 5, 1, 1], 19], "output": 3}, {"inputs": [[7, 0, 0, 0], 8], "output": 4}, {"inputs": [[13, 15, 19, 18, 2, 9, 18, 11, 0, 7], 6], "output": 1}, {"inputs": [[9, 15, 19, 15, 10, 15, 14, 0, 2, 5], 20], "output": 1}, {"inputs": [[19, 4, 19, 6, 3, 19, 14, 4, 16, 12], 4], "output": 0}, {"inputs": [[2, 10, 5, 5, 12, 3, 14, 6, 11, 14], 3], "output": 2}, {"inputs": [[11, 20], 10], "output": 3}, {"inputs": [[10, 12, 5, 3, 16, 0], 1], "output": 2}, {"inputs": [[0, 4, 4, 7, 14, 13], 1], "output": 2}, {"inputs": [[16, 2, 20, 13, 15, 20, 13], 16], "output": 3}, {"inputs": [[19, 11, 11, 0, 16, 2, 2, 0, 9], 4], "output": 3}, {"inputs": [[10, 17, 19, 8, 15], 19], "output": 3}]}} +{"id": "LeetCode/3239", "content": "# Minimum Number of Operations to Make X and Y Equal\n\nYou are given two positive integers `x` and `y`.\n\n\nIn one operation, you can do one of the four following operations:\n\n\n1. Divide `x` by `11` if `x` is a multiple of `11`.\n2. Divide `x` by `5` if `x` is a multiple of `5`.\n3. Decrement `x` by `1`.\n4. Increment `x` by `1`.\n\n\nReturn *the **minimum** number of operations required to make* `x` *and* `y` equal.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** x = 26, y = 1\n**Output:** 3\n**Explanation:** We can make 26 equal to 1 by applying the following operations: \n1. Decrement x by 1\n2. Divide x by 5\n3. Divide x by 5\nIt can be shown that 3 is the minimum number of operations required to make 26 equal to 1.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** x = 54, y = 2\n**Output:** 4\n**Explanation:** We can make 54 equal to 2 by applying the following operations: \n1. Increment x by 1\n2. Divide x by 11 \n3. Divide x by 5\n4. Increment x by 1\nIt can be shown that 4 is the minimum number of operations required to make 54 equal to 2.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** x = 25, y = 30\n**Output:** 5\n**Explanation:** We can make 25 equal to 30 by applying the following operations: \n1. Increment x by 1\n2. Increment x by 1\n3. Increment x by 1\n4. Increment x by 1\n5. Increment x by 1\nIt can be shown that 5 is the minimum number of operations required to make 25 equal to 30.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= x, y <= 104`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumOperationsToMakeEqual(self, x: int, y: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumOperationsToMakeEqual(**[26, 1]) == 3\nassert my_solution.minimumOperationsToMakeEqual(**[54, 2]) == 4\nassert my_solution.minimumOperationsToMakeEqual(**[25, 30]) == 5\nassert my_solution.minimumOperationsToMakeEqual(**[1, 1]) == 0\nassert my_solution.minimumOperationsToMakeEqual(**[1, 2]) == 1\nassert my_solution.minimumOperationsToMakeEqual(**[1, 3]) == 2\nassert my_solution.minimumOperationsToMakeEqual(**[1, 4]) == 3\nassert my_solution.minimumOperationsToMakeEqual(**[1, 5]) == 4\nassert my_solution.minimumOperationsToMakeEqual(**[1, 6]) == 5\nassert my_solution.minimumOperationsToMakeEqual(**[1, 7]) == 6\nassert my_solution.minimumOperationsToMakeEqual(**[1, 8]) == 7\nassert my_solution.minimumOperationsToMakeEqual(**[1, 9]) == 8\nassert my_solution.minimumOperationsToMakeEqual(**[1, 10]) == 9\nassert my_solution.minimumOperationsToMakeEqual(**[1, 11]) == 10\nassert my_solution.minimumOperationsToMakeEqual(**[1, 12]) == 11\nassert my_solution.minimumOperationsToMakeEqual(**[1, 13]) == 12\nassert my_solution.minimumOperationsToMakeEqual(**[1, 14]) == 13\nassert my_solution.minimumOperationsToMakeEqual(**[1, 15]) == 14\nassert my_solution.minimumOperationsToMakeEqual(**[1, 16]) == 15\nassert my_solution.minimumOperationsToMakeEqual(**[1, 17]) == 16\n"}, "labels": {"questionId": "3239", "questionFrontendId": "2998", "questionTitle": "Minimum Number of Operations to Make X and Y Equal", "stats": {"totalAccepted": "2.6K", "totalSubmission": "5.7K", "totalAcceptedRaw": 2596, "totalSubmissionRaw": 5655, "acRate": "45.9%"}, "probedCases": [{"inputs": [26, 1], "output": 3}, {"inputs": [54, 2], "output": 4}, {"inputs": [25, 30], "output": 5}, {"inputs": [1, 1], "output": 0}, {"inputs": [1, 2], "output": 1}, {"inputs": [1, 3], "output": 2}, {"inputs": [1, 4], "output": 3}, {"inputs": [1, 5], "output": 4}, {"inputs": [1, 6], "output": 5}, {"inputs": [1, 7], "output": 6}, {"inputs": [1, 8], "output": 7}, {"inputs": [1, 9], "output": 8}, {"inputs": [1, 10], "output": 9}, {"inputs": [1, 11], "output": 10}, {"inputs": [1, 12], "output": 11}, {"inputs": [1, 13], "output": 12}, {"inputs": [1, 14], "output": 13}, {"inputs": [1, 15], "output": 14}, {"inputs": [1, 16], "output": 15}, {"inputs": [1, 17], "output": 16}]}} +{"id": "LeetCode/3243", "content": "# Count the Number of Powerful Integers\n\nYou are given three integers `start`, `finish`, and `limit`. You are also given a **0-indexed** string `s` representing a **positive** integer.\n\n\nA **positive** integer `x` is called **powerful** if it ends with `s` (in other words, `s` is a **suffix** of `x`) and each digit in `x` is at most `limit`.\n\n\nReturn *the **total** number of powerful integers in the range* `[start..finish]`.\n\n\nA string `x` is a suffix of a string `y` if and only if `x` is a substring of `y` that starts from some index (**including** `0`) in `y` and extends to the index `y.length - 1`. For example, `25` is a suffix of `5125` whereas `512` is not.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** start = 1, finish = 6000, limit = 4, s = \"124\"\n**Output:** 5\n**Explanation:** The powerful integers in the range [1..6000] are 124, 1124, 2124, 3124, and, 4124. All these integers have each digit <= 4, and \"124\" as a suffix. Note that 5124 is not a powerful integer because the first digit is 5 which is greater than 4.\nIt can be shown that there are only 5 powerful integers in this range.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** start = 15, finish = 215, limit = 6, s = \"10\"\n**Output:** 2\n**Explanation:** The powerful integers in the range [15..215] are 110 and 210. All these integers have each digit <= 6, and \"10\" as a suffix.\nIt can be shown that there are only 2 powerful integers in this range.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** start = 1000, finish = 2000, limit = 4, s = \"3000\"\n**Output:** 0\n**Explanation:** All integers in the range [1000..2000] are smaller than 3000, hence \"3000\" cannot be a suffix of any integer in this range.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= start <= finish <= 1015`\n* `1 <= limit <= 9`\n* `1 <= s.length <= floor(log10(finish)) + 1`\n* `s` only consists of numeric digits which are at most `limit`.\n* `s` does not have leading zeros.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def numberOfPowerfulInt(self, start: int, finish: int, limit: int, s: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.numberOfPowerfulInt(**[1, 6000, 4, '124']) == 5\nassert my_solution.numberOfPowerfulInt(**[15, 215, 6, '10']) == 2\nassert my_solution.numberOfPowerfulInt(**[1000, 2000, 4, '3000']) == 0\nassert my_solution.numberOfPowerfulInt(**[141, 148, 9, '9']) == 0\nassert my_solution.numberOfPowerfulInt(**[1, 971, 9, '17']) == 10\nassert my_solution.numberOfPowerfulInt(**[1, 971, 9, '27']) == 10\nassert my_solution.numberOfPowerfulInt(**[1, 971, 9, '41']) == 10\nassert my_solution.numberOfPowerfulInt(**[1, 971, 9, '47']) == 10\nassert my_solution.numberOfPowerfulInt(**[1, 971, 9, '61']) == 10\nassert my_solution.numberOfPowerfulInt(**[1, 971, 9, '66']) == 10\nassert my_solution.numberOfPowerfulInt(**[1, 971, 9, '71']) == 10\nassert my_solution.numberOfPowerfulInt(**[1, 971, 9, '72']) == 9\nassert my_solution.numberOfPowerfulInt(**[20, 1159, 5, '20']) == 8\nassert my_solution.numberOfPowerfulInt(**[20, 1159, 5, '24']) == 8\nassert my_solution.numberOfPowerfulInt(**[20, 1159, 5, '32']) == 8\nassert my_solution.numberOfPowerfulInt(**[20, 1159, 5, '33']) == 8\nassert my_solution.numberOfPowerfulInt(**[20, 1159, 5, '40']) == 8\nassert my_solution.numberOfPowerfulInt(**[20, 1159, 5, '41']) == 8\nassert my_solution.numberOfPowerfulInt(**[20, 1159, 5, '42']) == 8\nassert my_solution.numberOfPowerfulInt(**[20, 1159, 5, '43']) == 8\n"}, "labels": {"questionId": "3243", "questionFrontendId": "2999", "questionTitle": "Count the Number of Powerful Integers", "stats": {"totalAccepted": "1.7K", "totalSubmission": "4.5K", "totalAcceptedRaw": 1748, "totalSubmissionRaw": 4535, "acRate": "38.5%"}, "probedCases": [{"inputs": [1, 6000, 4, "124"], "output": 5}, {"inputs": [15, 215, 6, "10"], "output": 2}, {"inputs": [1000, 2000, 4, "3000"], "output": 0}, {"inputs": [141, 148, 9, "9"], "output": 0}, {"inputs": [1, 971, 9, "17"], "output": 10}, {"inputs": [1, 971, 9, "27"], "output": 10}, {"inputs": [1, 971, 9, "41"], "output": 10}, {"inputs": [1, 971, 9, "47"], "output": 10}, {"inputs": [1, 971, 9, "61"], "output": 10}, {"inputs": [1, 971, 9, "66"], "output": 10}, {"inputs": [1, 971, 9, "71"], "output": 10}, {"inputs": [1, 971, 9, "72"], "output": 9}, {"inputs": [20, 1159, 5, "20"], "output": 8}, {"inputs": [20, 1159, 5, "24"], "output": 8}, {"inputs": [20, 1159, 5, "32"], "output": 8}, {"inputs": [20, 1159, 5, "33"], "output": 8}, {"inputs": [20, 1159, 5, "40"], "output": 8}, {"inputs": [20, 1159, 5, "41"], "output": 8}, {"inputs": [20, 1159, 5, "42"], "output": 8}, {"inputs": [20, 1159, 5, "43"], "output": 8}]}} +{"id": "LeetCode/3246", "content": "# Check if Bitwise OR Has Trailing Zeros\n\nYou are given an array of **positive** integers `nums`.\n\n\nYou have to check if it is possible to select **two or more** elements in the array such that the bitwise `OR` of the selected elements has **at least** one trailing zero in its binary representation.\n\n\nFor example, the binary representation of `5`, which is `\"101\"`, does not have any trailing zeros, whereas the binary representation of `4`, which is `\"100\"`, has two trailing zeros.\n\n\nReturn `true` *if it is possible to select two or more elements whose bitwise* `OR` *has trailing zeros, return* `false` *otherwise*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4,5]\n**Output:** true\n**Explanation:** If we select the elements 2 and 4, their bitwise OR is 6, which has the binary representation \"110\" with one trailing zero.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,4,8,16]\n**Output:** true\n**Explanation:** If we select the elements 2 and 4, their bitwise OR is 6, which has the binary representation \"110\" with one trailing zero.\nOther possible ways to select elements to have trailing zeroes in the binary representation of their bitwise OR are: (2, 8), (2, 16), (4, 8), (4, 16), (8, 16), (2, 4, 8), (2, 4, 16), (2, 8, 16), (4, 8, 16), and (2, 4, 8, 16).\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,3,5,7,9]\n**Output:** false\n**Explanation:** There is no possible way to select two or more elements to have trailing zeros in the binary representation of their bitwise OR.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= nums.length <= 100`\n* `1 <= nums[i] <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def hasTrailingZeros(self, nums: List[int]) -> bool:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.hasTrailingZeros(**[[1, 2, 3, 4, 5]]) == True\nassert my_solution.hasTrailingZeros(**[[2, 4, 8, 16]]) == True\nassert my_solution.hasTrailingZeros(**[[1, 3, 5, 7, 9]]) == False\nassert my_solution.hasTrailingZeros(**[[1, 2]]) == False\nassert my_solution.hasTrailingZeros(**[[1, 3]]) == False\nassert my_solution.hasTrailingZeros(**[[1, 7]]) == False\nassert my_solution.hasTrailingZeros(**[[2, 2]]) == True\nassert my_solution.hasTrailingZeros(**[[3, 3]]) == False\nassert my_solution.hasTrailingZeros(**[[3, 4]]) == False\nassert my_solution.hasTrailingZeros(**[[3, 9]]) == False\nassert my_solution.hasTrailingZeros(**[[4, 3]]) == False\nassert my_solution.hasTrailingZeros(**[[4, 8]]) == True\nassert my_solution.hasTrailingZeros(**[[4, 32]]) == True\nassert my_solution.hasTrailingZeros(**[[5, 6]]) == False\nassert my_solution.hasTrailingZeros(**[[6, 2]]) == True\nassert my_solution.hasTrailingZeros(**[[6, 8]]) == True\nassert my_solution.hasTrailingZeros(**[[7, 9]]) == False\nassert my_solution.hasTrailingZeros(**[[7, 10]]) == False\nassert my_solution.hasTrailingZeros(**[[8, 2]]) == True\nassert my_solution.hasTrailingZeros(**[[8, 4]]) == True\n"}, "labels": {"questionId": "3246", "questionFrontendId": "2980", "questionTitle": "Check if Bitwise OR Has Trailing Zeros", "stats": {"totalAccepted": "4.3K", "totalSubmission": "5.7K", "totalAcceptedRaw": 4315, "totalSubmissionRaw": 5721, "acRate": "75.4%"}, "probedCases": [{"inputs": [[1, 2, 3, 4, 5]], "output": true}, {"inputs": [[2, 4, 8, 16]], "output": true}, {"inputs": [[1, 3, 5, 7, 9]], "output": false}, {"inputs": [[1, 2]], "output": false}, {"inputs": [[1, 3]], "output": false}, {"inputs": [[1, 7]], "output": false}, {"inputs": [[2, 2]], "output": true}, {"inputs": [[3, 3]], "output": false}, {"inputs": [[3, 4]], "output": false}, {"inputs": [[3, 9]], "output": false}, {"inputs": [[4, 3]], "output": false}, {"inputs": [[4, 8]], "output": true}, {"inputs": [[4, 32]], "output": true}, {"inputs": [[5, 6]], "output": false}, {"inputs": [[6, 2]], "output": true}, {"inputs": [[6, 8]], "output": true}, {"inputs": [[7, 9]], "output": false}, {"inputs": [[7, 10]], "output": false}, {"inputs": [[8, 2]], "output": true}, {"inputs": [[8, 4]], "output": true}]}} +{"id": "LeetCode/3267", "content": "# Find Longest Special Substring That Occurs Thrice I\n\nYou are given a string `s` that consists of lowercase English letters.\n\n\nA string is called **special** if it is made up of only a single character. For example, the string `\"abc\"` is not special, whereas the strings `\"ddd\"`, `\"zz\"`, and `\"f\"` are special.\n\n\nReturn *the length of the **longest special substring** of* `s` *which occurs **at least thrice***, *or* `-1` *if no special substring occurs at least thrice*.\n\n\nA **substring** is a contiguous **non-empty** sequence of characters within a string.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"aaaa\"\n**Output:** 2\n**Explanation:** The longest special substring which occurs thrice is \"aa\": substrings \"**aa**aa\", \"a**aa**a\", and \"aa**aa**\".\nIt can be shown that the maximum length achievable is 2.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"abcdef\"\n**Output:** -1\n**Explanation:** There exists no special substring which occurs at least thrice. Hence return -1.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"abcaba\"\n**Output:** 1\n**Explanation:** The longest special substring which occurs thrice is \"a\": substrings \"**a**bcaba\", \"abc**a**ba\", and \"abcab**a**\".\nIt can be shown that the maximum length achievable is 1.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `3 <= s.length <= 50`\n* `s` consists of only lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumLength(self, s: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumLength(**['aaaa']) == 2\nassert my_solution.maximumLength(**['abcdef']) == -1\nassert my_solution.maximumLength(**['abcaba']) == 1\nassert my_solution.maximumLength(**['abcccccdddd']) == 3\nassert my_solution.maximumLength(**['aaa']) == 1\nassert my_solution.maximumLength(**['acc']) == -1\nassert my_solution.maximumLength(**['cab']) == -1\nassert my_solution.maximumLength(**['cad']) == -1\nassert my_solution.maximumLength(**['cbc']) == -1\nassert my_solution.maximumLength(**['ccc']) == 1\nassert my_solution.maximumLength(**['dca']) == -1\nassert my_solution.maximumLength(**['ddd']) == 1\nassert my_solution.maximumLength(**['fff']) == 1\nassert my_solution.maximumLength(**['ggg']) == 1\nassert my_solution.maximumLength(**['hhh']) == 1\nassert my_solution.maximumLength(**['kkk']) == 1\nassert my_solution.maximumLength(**['lll']) == 1\nassert my_solution.maximumLength(**['ooo']) == 1\nassert my_solution.maximumLength(**['ppp']) == 1\nassert my_solution.maximumLength(**['qqq']) == 1\n"}, "labels": {"questionId": "3267", "questionFrontendId": "2981", "questionTitle": "Find Longest Special Substring That Occurs Thrice I", "stats": {"totalAccepted": "3.5K", "totalSubmission": "7.4K", "totalAcceptedRaw": 3541, "totalSubmissionRaw": 7356, "acRate": "48.1%"}, "probedCases": [{"inputs": ["aaaa"], "output": 2}, {"inputs": ["abcdef"], "output": -1}, {"inputs": ["abcaba"], "output": 1}, {"inputs": ["abcccccdddd"], "output": 3}, {"inputs": ["aaa"], "output": 1}, {"inputs": ["acc"], "output": -1}, {"inputs": ["cab"], "output": -1}, {"inputs": ["cad"], "output": -1}, {"inputs": ["cbc"], "output": -1}, {"inputs": ["ccc"], "output": 1}, {"inputs": ["dca"], "output": -1}, {"inputs": ["ddd"], "output": 1}, {"inputs": ["fff"], "output": 1}, {"inputs": ["ggg"], "output": 1}, {"inputs": ["hhh"], "output": 1}, {"inputs": ["kkk"], "output": 1}, {"inputs": ["lll"], "output": 1}, {"inputs": ["ooo"], "output": 1}, {"inputs": ["ppp"], "output": 1}, {"inputs": ["qqq"], "output": 1}]}} +{"id": "LeetCode/3266", "content": "# Find Longest Special Substring That Occurs Thrice II\n\nYou are given a string `s` that consists of lowercase English letters.\n\n\nA string is called **special** if it is made up of only a single character. For example, the string `\"abc\"` is not special, whereas the strings `\"ddd\"`, `\"zz\"`, and `\"f\"` are special.\n\n\nReturn *the length of the **longest special substring** of* `s` *which occurs **at least thrice***, *or* `-1` *if no special substring occurs at least thrice*.\n\n\nA **substring** is a contiguous **non-empty** sequence of characters within a string.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"aaaa\"\n**Output:** 2\n**Explanation:** The longest special substring which occurs thrice is \"aa\": substrings \"**aa**aa\", \"a**aa**a\", and \"aa**aa**\".\nIt can be shown that the maximum length achievable is 2.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"abcdef\"\n**Output:** -1\n**Explanation:** There exists no special substring which occurs at least thrice. Hence return -1.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"abcaba\"\n**Output:** 1\n**Explanation:** The longest special substring which occurs thrice is \"a\": substrings \"**a**bcaba\", \"abc**a**ba\", and \"abcab**a**\".\nIt can be shown that the maximum length achievable is 1.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `3 <= s.length <= 5 * 105`\n* `s` consists of only lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumLength(self, s: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumLength(**['aaaa']) == 2\nassert my_solution.maximumLength(**['abcdef']) == -1\nassert my_solution.maximumLength(**['abcaba']) == 1\nassert my_solution.maximumLength(**['abcccccdddd']) == 3\nassert my_solution.maximumLength(**['acd']) == -1\nassert my_solution.maximumLength(**['bad']) == -1\nassert my_solution.maximumLength(**['bbc']) == -1\nassert my_solution.maximumLength(**['ccc']) == 1\nassert my_solution.maximumLength(**['cda']) == -1\nassert my_solution.maximumLength(**['dab']) == -1\nassert my_solution.maximumLength(**['ddd']) == 1\nassert my_solution.maximumLength(**['eee']) == 1\nassert my_solution.maximumLength(**['fff']) == 1\nassert my_solution.maximumLength(**['hhh']) == 1\nassert my_solution.maximumLength(**['jjj']) == 1\nassert my_solution.maximumLength(**['kkk']) == 1\nassert my_solution.maximumLength(**['lll']) == 1\nassert my_solution.maximumLength(**['mmm']) == 1\nassert my_solution.maximumLength(**['nnn']) == 1\nassert my_solution.maximumLength(**['ooo']) == 1\n"}, "labels": {"questionId": "3266", "questionFrontendId": "2982", "questionTitle": "Find Longest Special Substring That Occurs Thrice II", "stats": {"totalAccepted": "3.9K", "totalSubmission": "10.1K", "totalAcceptedRaw": 3897, "totalSubmissionRaw": 10118, "acRate": "38.5%"}, "probedCases": [{"inputs": ["aaaa"], "output": 2}, {"inputs": ["abcdef"], "output": -1}, {"inputs": ["abcaba"], "output": 1}, {"inputs": ["abcccccdddd"], "output": 3}, {"inputs": ["acd"], "output": -1}, {"inputs": ["bad"], "output": -1}, {"inputs": ["bbc"], "output": -1}, {"inputs": ["ccc"], "output": 1}, {"inputs": ["cda"], "output": -1}, {"inputs": ["dab"], "output": -1}, {"inputs": ["ddd"], "output": 1}, {"inputs": ["eee"], "output": 1}, {"inputs": ["fff"], "output": 1}, {"inputs": ["hhh"], "output": 1}, {"inputs": ["jjj"], "output": 1}, {"inputs": ["kkk"], "output": 1}, {"inputs": ["lll"], "output": 1}, {"inputs": ["mmm"], "output": 1}, {"inputs": ["nnn"], "output": 1}, {"inputs": ["ooo"], "output": 1}]}} +{"id": "LeetCode/3203", "content": "# Palindrome Rearrangement Queries\n\nYou are given a **0-indexed** string `s` having an **even** length `n`.\n\n\nYou are also given a **0-indexed** 2D integer array, `queries`, where `queries[i] = [ai, bi, ci, di]`.\n\n\nFor each query `i`, you are allowed to perform the following operations:\n\n\n* Rearrange the characters within the **substring** `s[ai:bi]`, where `0 <= ai <= bi < n / 2`.\n* Rearrange the characters within the **substring** `s[ci:di]`, where `n / 2 <= ci <= di < n`.\n\n\nFor each query, your task is to determine whether it is possible to make `s` a **palindrome** by performing the operations.\n\n\nEach query is answered **independently** of the others.\n\n\nReturn *a **0-indexed** array* `answer`*, where* `answer[i] == true` *if it is possible to make* `s` *a palindrome by performing operations specified by the* `ith` *query, and* `false` *otherwise.*\n\n\n* A **substring** is a contiguous sequence of characters within a string.\n* `s[x:y]` represents the substring consisting of characters from the index `x` to index `y` in `s`, **both inclusive**.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"abcabc\", queries = [[1,1,3,5],[0,2,5,5]]\n**Output:** [true,true]\n**Explanation:** In this example, there are two queries:\nIn the first query:\n- a0 = 1, b0 = 1, c0 = 3, d0 = 5.\n- So, you are allowed to rearrange s[1:1] => abcabc and s[3:5] => abcabc.\n- To make s a palindrome, s[3:5] can be rearranged to become => abccba.\n- Now, s is a palindrome. So, answer[0] = true.\nIn the second query:\n- a1 = 0, b1 = 2, c1 = 5, d1 = 5.\n- So, you are allowed to rearrange s[0:2] => abcabc and s[5:5] => abcabc.\n- To make s a palindrome, s[0:2] can be rearranged to become => cbaabc.\n- Now, s is a palindrome. So, answer[1] = true.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"abbcdecbba\", queries = [[0,2,7,9]]\n**Output:** [false]\n**Explanation:** In this example, there is only one query.\na0 = 0, b0 = 2, c0 = 7, d0 = 9.\nSo, you are allowed to rearrange s[0:2] => abbcdecbba and s[7:9] => abbcdecbba.\nIt is not possible to make s a palindrome by rearranging these substrings because s[3:6] is not a palindrome.\nSo, answer[0] = false.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"acbcab\", queries = [[1,2,4,5]]\n**Output:** [true]\n**Explanation:** In this example, there is only one query.\na0 = 1, b0 = 2, c0 = 4, d0 = 5.\nSo, you are allowed to rearrange s[1:2] => acbcab and s[4:5] => acbcab.\nTo make s a palindrome s[1:2] can be rearranged to become abccab.\nThen, s[4:5] can be rearranged to become abccba.\nNow, s is a palindrome. So, answer[0] = true.\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= n == s.length <= 105`\n* `1 <= queries.length <= 105`\n* `queries[i].length == 4`\n* `ai == queries[i][0], bi == queries[i][1]`\n* `ci == queries[i][2], di == queries[i][3]`\n* `0 <= ai <= bi < n / 2`\n* `n / 2 <= ci <= di < n`\n* `n` is even.\n* `s` consists of only lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def canMakePalindromeQueries(self, s: str, queries: List[List[int]]) -> List[bool]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.canMakePalindromeQueries(**['abcabc', [[1, 1, 3, 5], [0, 2, 5, 5]]]) == [True, True]\nassert my_solution.canMakePalindromeQueries(**['abbcdecbba', [[0, 2, 7, 9]]]) == [False]\nassert my_solution.canMakePalindromeQueries(**['acbcab', [[1, 2, 4, 5]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['bb', [[0, 0, 1, 1]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['dd', [[0, 0, 1, 1]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['bdbd', [[0, 0, 2, 3]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['eeee', [[0, 1, 2, 3]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['bbccbb', [[0, 1, 4, 5]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['bcdbdc', [[1, 2, 3, 3]]]) == [False]\nassert my_solution.canMakePalindromeQueries(**['cababc', [[1, 2, 3, 4]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['cbbbbc', [[1, 1, 5, 5]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['cdbdbc', [[1, 2, 3, 3]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['ceacea', [[0, 2, 3, 5]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['daeaed', [[0, 2, 3, 3]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['ddaadd', [[0, 2, 3, 4]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['ddedde', [[0, 2, 4, 5]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['ecbbce', [[0, 1, 3, 5]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['eczecz', [[0, 0, 3, 5]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['mpepem', [[0, 2, 3, 4]]]) == [True]\nassert my_solution.canMakePalindromeQueries(**['bccacacb', [[3, 3, 4, 7]]]) == [True]\n"}, "labels": {"questionId": "3203", "questionFrontendId": "2983", "questionTitle": "Palindrome Rearrangement Queries", "stats": {"totalAccepted": "1.2K", "totalSubmission": "3.9K", "totalAcceptedRaw": 1243, "totalSubmissionRaw": 3947, "acRate": "31.5%"}, "probedCases": [{"inputs": ["abcabc", [[1, 1, 3, 5], [0, 2, 5, 5]]], "output": [true, true]}, {"inputs": ["abbcdecbba", [[0, 2, 7, 9]]], "output": [false]}, {"inputs": ["acbcab", [[1, 2, 4, 5]]], "output": [true]}, {"inputs": ["bb", [[0, 0, 1, 1]]], "output": [true]}, {"inputs": ["dd", [[0, 0, 1, 1]]], "output": [true]}, {"inputs": ["bdbd", [[0, 0, 2, 3]]], "output": [true]}, {"inputs": ["eeee", [[0, 1, 2, 3]]], "output": [true]}, {"inputs": ["bbccbb", [[0, 1, 4, 5]]], "output": [true]}, {"inputs": ["bcdbdc", [[1, 2, 3, 3]]], "output": [false]}, {"inputs": ["cababc", [[1, 2, 3, 4]]], "output": [true]}, {"inputs": ["cbbbbc", [[1, 1, 5, 5]]], "output": [true]}, {"inputs": ["cdbdbc", [[1, 2, 3, 3]]], "output": [true]}, {"inputs": ["ceacea", [[0, 2, 3, 5]]], "output": [true]}, {"inputs": ["daeaed", [[0, 2, 3, 3]]], "output": [true]}, {"inputs": ["ddaadd", [[0, 2, 3, 4]]], "output": [true]}, {"inputs": ["ddedde", [[0, 2, 4, 5]]], "output": [true]}, {"inputs": ["ecbbce", [[0, 1, 3, 5]]], "output": [true]}, {"inputs": ["eczecz", [[0, 0, 3, 5]]], "output": [true]}, {"inputs": ["mpepem", [[0, 2, 3, 4]]], "output": [true]}, {"inputs": ["bccacacb", [[3, 3, 4, 7]]], "output": [true]}]}} +{"id": "LeetCode/3226", "content": "# Minimum Number Game\n\nYou are given a **0-indexed** integer array `nums` of **even** length and there is also an empty array `arr`. Alice and Bob decided to play a game where in every round Alice and Bob will do one move. The rules of the game are as follows:\n\n\n* Every round, first Alice will remove the **minimum** element from `nums`, and then Bob does the same.\n* Now, first Bob will append the removed element in the array `arr`, and then Alice does the same.\n* The game continues until `nums` becomes empty.\n\n\nReturn *the resulting array* `arr`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [5,4,2,3]\n**Output:** [3,2,5,4]\n**Explanation:** In round one, first Alice removes 2 and then Bob removes 3. Then in arr firstly Bob appends 3 and then Alice appends 2. So arr = [3,2].\nAt the begining of round two, nums = [5,4]. Now, first Alice removes 4 and then Bob removes 5. Then both append in arr which becomes [3,2,5,4].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,5]\n**Output:** [5,2]\n**Explanation:** In round one, first Alice removes 2 and then Bob removes 5. Then in arr firstly Bob appends and then Alice appends. So arr = [5,2].\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 100`\n* `1 <= nums[i] <= 100`\n* `nums.length % 2 == 0`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def numberGame(self, nums: List[int]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.numberGame(**[[5, 4, 2, 3]]) == [3, 2, 5, 4]\nassert my_solution.numberGame(**[[2, 5]]) == [5, 2]\nassert my_solution.numberGame(**[[4, 4, 3, 8]]) == [4, 3, 8, 4]\nassert my_solution.numberGame(**[[2, 5, 3, 8]]) == [3, 2, 8, 5]\nassert my_solution.numberGame(**[[2, 7, 9, 6, 4, 6]]) == [4, 2, 6, 6, 9, 7]\nassert my_solution.numberGame(**[[18, 26, 37, 46, 13, 33, 39, 1, 37, 16]]) == [13, 1, 18, 16, 33, 26, 37, 37, 46, 39]\nassert my_solution.numberGame(**[[17, 2, 4, 11, 14, 18]]) == [4, 2, 14, 11, 18, 17]\nassert my_solution.numberGame(**[[20, 30, 12, 3, 11, 17, 32, 12]]) == [11, 3, 12, 12, 20, 17, 32, 30]\nassert my_solution.numberGame(**[[9, 32, 6, 11, 11, 39, 18, 29, 44, 29]]) == [9, 6, 11, 11, 29, 18, 32, 29, 44, 39]\nassert my_solution.numberGame(**[[7, 2, 3, 4]]) == [3, 2, 7, 4]\nassert my_solution.numberGame(**[[8, 7, 1, 3]]) == [3, 1, 8, 7]\nassert my_solution.numberGame(**[[2, 6, 6, 6]]) == [6, 2, 6, 6]\nassert my_solution.numberGame(**[[1, 2]]) == [2, 1]\nassert my_solution.numberGame(**[[4, 1, 1, 3]]) == [1, 1, 4, 3]\nassert my_solution.numberGame(**[[13, 12, 18, 11, 15, 28, 26, 2]]) == [11, 2, 13, 12, 18, 15, 28, 26]\nassert my_solution.numberGame(**[[14, 30, 29, 3, 23, 21, 26, 23]]) == [14, 3, 23, 21, 26, 23, 30, 29]\nassert my_solution.numberGame(**[[1, 1]]) == [1, 1]\nassert my_solution.numberGame(**[[2, 1]]) == [2, 1]\nassert my_solution.numberGame(**[[12, 1, 28, 23, 2, 31, 11, 26]]) == [2, 1, 12, 11, 26, 23, 31, 28]\nassert my_solution.numberGame(**[[21, 11, 37, 1, 40, 50, 49, 45, 28, 47]]) == [11, 1, 28, 21, 40, 37, 47, 45, 50, 49]\n"}, "labels": {"questionId": "3226", "questionFrontendId": "2974", "questionTitle": "Minimum Number Game", "stats": {"totalAccepted": "5.8K", "totalSubmission": "6.7K", "totalAcceptedRaw": 5847, "totalSubmissionRaw": 6669, "acRate": "87.7%"}, "probedCases": [{"inputs": [[5, 4, 2, 3]], "output": [3, 2, 5, 4]}, {"inputs": [[2, 5]], "output": [5, 2]}, {"inputs": [[4, 4, 3, 8]], "output": [4, 3, 8, 4]}, {"inputs": [[2, 5, 3, 8]], "output": [3, 2, 8, 5]}, {"inputs": [[2, 7, 9, 6, 4, 6]], "output": [4, 2, 6, 6, 9, 7]}, {"inputs": [[18, 26, 37, 46, 13, 33, 39, 1, 37, 16]], "output": [13, 1, 18, 16, 33, 26, 37, 37, 46, 39]}, {"inputs": [[17, 2, 4, 11, 14, 18]], "output": [4, 2, 14, 11, 18, 17]}, {"inputs": [[20, 30, 12, 3, 11, 17, 32, 12]], "output": [11, 3, 12, 12, 20, 17, 32, 30]}, {"inputs": [[9, 32, 6, 11, 11, 39, 18, 29, 44, 29]], "output": [9, 6, 11, 11, 29, 18, 32, 29, 44, 39]}, {"inputs": [[7, 2, 3, 4]], "output": [3, 2, 7, 4]}, {"inputs": [[8, 7, 1, 3]], "output": [3, 1, 8, 7]}, {"inputs": [[2, 6, 6, 6]], "output": [6, 2, 6, 6]}, {"inputs": [[1, 2]], "output": [2, 1]}, {"inputs": [[4, 1, 1, 3]], "output": [1, 1, 4, 3]}, {"inputs": [[13, 12, 18, 11, 15, 28, 26, 2]], "output": [11, 2, 13, 12, 18, 15, 28, 26]}, {"inputs": [[14, 30, 29, 3, 23, 21, 26, 23]], "output": [14, 3, 23, 21, 26, 23, 30, 29]}, {"inputs": [[1, 1]], "output": [1, 1]}, {"inputs": [[2, 1]], "output": [2, 1]}, {"inputs": [[12, 1, 28, 23, 2, 31, 11, 26]], "output": [2, 1, 12, 11, 26, 23, 31, 28]}, {"inputs": [[21, 11, 37, 1, 40, 50, 49, 45, 28, 47]], "output": [11, 1, 28, 21, 40, 37, 47, 45, 50, 49]}]}} +{"id": "LeetCode/3235", "content": "# Minimum Cost to Convert String I\n\nYou are given two **0-indexed** strings `source` and `target`, both of length `n` and consisting of **lowercase** English letters. You are also given two **0-indexed** character arrays `original` and `changed`, and an integer array `cost`, where `cost[i]` represents the cost of changing the character `original[i]` to the character `changed[i]`.\n\n\nYou start with the string `source`. In one operation, you can pick a character `x` from the string and change it to the character `y` at a cost of `z` **if** there exists **any** index `j` such that `cost[j] == z`, `original[j] == x`, and `changed[j] == y`.\n\n\nReturn *the **minimum** cost to convert the string* `source` *to the string* `target` *using **any** number of operations. If it is impossible to convert* `source` *to* `target`, *return* `-1`.\n\n\n**Note** that there may exist indices `i`, `j` such that `original[j] == original[i]` and `changed[j] == changed[i]`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** source = \"abcd\", target = \"acbe\", original = [\"a\",\"b\",\"c\",\"c\",\"e\",\"d\"], changed = [\"b\",\"c\",\"b\",\"e\",\"b\",\"e\"], cost = [2,5,5,1,2,20]\n**Output:** 28\n**Explanation:** To convert the string \"abcd\" to string \"acbe\":\n- Change value at index 1 from 'b' to 'c' at a cost of 5.\n- Change value at index 2 from 'c' to 'e' at a cost of 1.\n- Change value at index 2 from 'e' to 'b' at a cost of 2.\n- Change value at index 3 from 'd' to 'e' at a cost of 20.\nThe total cost incurred is 5 + 1 + 2 + 20 = 28.\nIt can be shown that this is the minimum possible cost.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** source = \"aaaa\", target = \"bbbb\", original = [\"a\",\"c\"], changed = [\"c\",\"b\"], cost = [1,2]\n**Output:** 12\n**Explanation:** To change the character 'a' to 'b' change the character 'a' to 'c' at a cost of 1, followed by changing the character 'c' to 'b' at a cost of 2, for a total cost of 1 + 2 = 3. To change all occurrences of 'a' to 'b', a total cost of 3 * 4 = 12 is incurred.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** source = \"abcd\", target = \"abce\", original = [\"a\"], changed = [\"e\"], cost = [10000]\n**Output:** -1\n**Explanation:** It is impossible to convert source to target because the value at index 3 cannot be changed from 'd' to 'e'.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= source.length == target.length <= 105`\n* `source`, `target` consist of lowercase English letters.\n* `1 <= cost.length == original.length == changed.length <= 2000`\n* `original[i]`, `changed[i]` are lowercase English letters.\n* `1 <= cost[i] <= 106`\n* `original[i] != changed[i]`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumCost(self, source: str, target: str, original: List[str], changed: List[str], cost: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumCost(**['abcd', 'acbe', ['a', 'b', 'c', 'c', 'e', 'd'], ['b', 'c', 'b', 'e', 'b', 'e'], [2, 5, 5, 1, 2, 20]]) == 28\nassert my_solution.minimumCost(**['aaaa', 'bbbb', ['a', 'c'], ['c', 'b'], [1, 2]]) == 12\nassert my_solution.minimumCost(**['abcd', 'abce', ['a'], ['e'], [10000]]) == -1\nassert my_solution.minimumCost(**['aaaabadaaa', 'dbdadddbad', ['c', 'a', 'c', 'a', 'a', 'b', 'b', 'b', 'd', 'd', 'c'], ['a', 'c', 'b', 'd', 'b', 'c', 'a', 'd', 'c', 'b', 'd'], [7, 8, 11, 9, 7, 6, 4, 6, 9, 5, 9]]) == 56\nassert my_solution.minimumCost(**['aaadbdcdac', 'cdbabaddba', ['a', 'c', 'b', 'd', 'b', 'a', 'c'], ['c', 'a', 'd', 'b', 'c', 'b', 'd'], [7, 2, 1, 3, 6, 1, 7]]) == 39\nassert my_solution.minimumCost(**['aababdaacb', 'bcdcdcbdcb', ['a', 'd', 'd', 'a', 'c', 'b', 'c', 'a', 'c', 'd', 'b', 'b'], ['b', 'c', 'b', 'd', 'a', 'a', 'b', 'c', 'd', 'a', 'c', 'd'], [11, 4, 3, 2, 7, 11, 7, 6, 9, 2, 1, 7]]) == 42\nassert my_solution.minimumCost(**['aababdbddc', 'adcbbbcdba', ['a', 'd', 'b', 'a', 'd', 'c', 'd', 'b'], ['b', 'a', 'd', 'c', 'c', 'a', 'b', 'a'], [10, 6, 8, 3, 6, 10, 8, 6]]) == 72\nassert my_solution.minimumCost(**['aabbcabbdb', 'acddbabbdd', ['c', 'd', 'c', 'a', 'd', 'c', 'a', 'd', 'b', 'a', 'b'], ['d', 'b', 'a', 'c', 'c', 'b', 'b', 'a', 'd', 'd', 'c'], [5, 3, 8, 10, 9, 7, 8, 7, 5, 1, 10]]) == 32\nassert my_solution.minimumCost(**['aabbddccbc', 'abbbaabaca', ['a', 'b', 'c', 'b', 'a', 'd'], ['d', 'c', 'b', 'd', 'b', 'b'], [3, 8, 7, 6, 7, 10]]) == -1\nassert my_solution.minimumCost(**['aabdbaabaa', 'bdaacabcab', ['b', 'd', 'd', 'a', 'c', 'c', 'a', 'd', 'a', 'b'], ['c', 'c', 'b', 'd', 'b', 'd', 'b', 'a', 'c', 'a'], [9, 1, 7, 9, 2, 1, 3, 8, 8, 2]]) == 43\nassert my_solution.minimumCost(**['aacacaaccd', 'dadaacaabd', ['c', 'c', 'a', 'a', 'd', 'b', 'd', 'd'], ['b', 'd', 'd', 'b', 'b', 'c', 'c', 'a'], [7, 8, 9, 11, 4, 6, 9, 10]]) == 77\nassert my_solution.minimumCost(**['aacbabbacc', 'adbdbcbdaa', ['c', 'b', 'a', 'b', 'a', 'c', 'd', 'c', 'd'], ['b', 'c', 'b', 'd', 'd', 'a', 'b', 'd', 'c'], [2, 6, 7, 4, 7, 4, 3, 5, 6]]) == 41\nassert my_solution.minimumCost(**['aacbbabdad', 'ddadcababd', ['d', 'b', 'c', 'a', 'b', 'c', 'd', 'c', 'b', 'a', 'a'], ['c', 'd', 'd', 'b', 'c', 'b', 'b', 'a', 'a', 'c', 'd'], [7, 10, 4, 2, 7, 4, 4, 4, 6, 2, 8]]) == 45\nassert my_solution.minimumCost(**['aacbbbbcab', 'cdacdcddac', ['b', 'd', 'c', 'c', 'b', 'a'], ['c', 'c', 'b', 'a', 'a', 'd'], [4, 7, 9, 11, 3, 4]]) == 67\nassert my_solution.minimumCost(**['aacbcabcad', 'bbcadddcdd', ['b', 'a', 'd', 'a', 'b', 'c', 'a', 'd', 'd', 'b'], ['d', 'b', 'b', 'd', 'c', 'a', 'c', 'c', 'a', 'a'], [7, 7, 9, 8, 6, 3, 8, 2, 1, 5]]) == 53\nassert my_solution.minimumCost(**['aacbdbcdca', 'bbbdbcaacd', ['a', 'c', 'b', 'd', 'd', 'a', 'c', 'd'], ['c', 'b', 'c', 'c', 'b', 'd', 'd', 'a'], [9, 5, 4, 1, 2, 4, 7, 1]]) == 47\nassert my_solution.minimumCost(**['aadbbcdbbd', 'badddbdbac', ['c', 'd', 'c', 'd', 'b', 'a'], ['b', 'b', 'a', 'a', 'a', 'd'], [11, 4, 7, 8, 5, 2]]) == -1\nassert my_solution.minimumCost(**['aadbccbddd', 'cacdbabadc', ['d', 'b', 'c', 'd', 'a', 'a', 'c', 'b'], ['c', 'c', 'b', 'b', 'b', 'd', 'a', 'a'], [5, 8, 7, 2, 4, 7, 1, 5]]) == 46\nassert my_solution.minimumCost(**['aadbddcabd', 'bdcdccbada', ['d', 'a', 'a', 'b', 'd', 'b'], ['b', 'c', 'd', 'c', 'a', 'd'], [6, 10, 5, 8, 11, 4]]) == -1\nassert my_solution.minimumCost(**['aaddadccad', 'cbaaadbcba', ['c', 'a', 'a', 'd', 'c', 'c', 'b', 'b', 'a', 'd'], ['a', 'c', 'd', 'c', 'd', 'b', 'd', 'c', 'b', 'b'], [1, 10, 2, 8, 9, 1, 9, 10, 5, 1]]) == 44\n"}, "labels": {"questionId": "3235", "questionFrontendId": "2976", "questionTitle": "Minimum Cost to Convert String I", "stats": {"totalAccepted": "3K", "totalSubmission": "6.7K", "totalAcceptedRaw": 3023, "totalSubmissionRaw": 6678, "acRate": "45.3%"}, "probedCases": [{"inputs": ["abcd", "acbe", ["a", "b", "c", "c", "e", "d"], ["b", "c", "b", "e", "b", "e"], [2, 5, 5, 1, 2, 20]], "output": 28}, {"inputs": ["aaaa", "bbbb", ["a", "c"], ["c", "b"], [1, 2]], "output": 12}, {"inputs": ["abcd", "abce", ["a"], ["e"], [10000]], "output": -1}, {"inputs": ["aaaabadaaa", "dbdadddbad", ["c", "a", "c", "a", "a", "b", "b", "b", "d", "d", "c"], ["a", "c", "b", "d", "b", "c", "a", "d", "c", "b", "d"], [7, 8, 11, 9, 7, 6, 4, 6, 9, 5, 9]], "output": 56}, {"inputs": ["aaadbdcdac", "cdbabaddba", ["a", "c", "b", "d", "b", "a", "c"], ["c", "a", "d", "b", "c", "b", "d"], [7, 2, 1, 3, 6, 1, 7]], "output": 39}, {"inputs": ["aababdaacb", "bcdcdcbdcb", ["a", "d", "d", "a", "c", "b", "c", "a", "c", "d", "b", "b"], ["b", "c", "b", "d", "a", "a", "b", "c", "d", "a", "c", "d"], [11, 4, 3, 2, 7, 11, 7, 6, 9, 2, 1, 7]], "output": 42}, {"inputs": ["aababdbddc", "adcbbbcdba", ["a", "d", "b", "a", "d", "c", "d", "b"], ["b", "a", "d", "c", "c", "a", "b", "a"], [10, 6, 8, 3, 6, 10, 8, 6]], "output": 72}, {"inputs": ["aabbcabbdb", "acddbabbdd", ["c", "d", "c", "a", "d", "c", "a", "d", "b", "a", "b"], ["d", "b", "a", "c", "c", "b", "b", "a", "d", "d", "c"], [5, 3, 8, 10, 9, 7, 8, 7, 5, 1, 10]], "output": 32}, {"inputs": ["aabbddccbc", "abbbaabaca", ["a", "b", "c", "b", "a", "d"], ["d", "c", "b", "d", "b", "b"], [3, 8, 7, 6, 7, 10]], "output": -1}, {"inputs": ["aabdbaabaa", "bdaacabcab", ["b", "d", "d", "a", "c", "c", "a", "d", "a", "b"], ["c", "c", "b", "d", "b", "d", "b", "a", "c", "a"], [9, 1, 7, 9, 2, 1, 3, 8, 8, 2]], "output": 43}, {"inputs": ["aacacaaccd", "dadaacaabd", ["c", "c", "a", "a", "d", "b", "d", "d"], ["b", "d", "d", "b", "b", "c", "c", "a"], [7, 8, 9, 11, 4, 6, 9, 10]], "output": 77}, {"inputs": ["aacbabbacc", "adbdbcbdaa", ["c", "b", "a", "b", "a", "c", "d", "c", "d"], ["b", "c", "b", "d", "d", "a", "b", "d", "c"], [2, 6, 7, 4, 7, 4, 3, 5, 6]], "output": 41}, {"inputs": ["aacbbabdad", "ddadcababd", ["d", "b", "c", "a", "b", "c", "d", "c", "b", "a", "a"], ["c", "d", "d", "b", "c", "b", "b", "a", "a", "c", "d"], [7, 10, 4, 2, 7, 4, 4, 4, 6, 2, 8]], "output": 45}, {"inputs": ["aacbbbbcab", "cdacdcddac", ["b", "d", "c", "c", "b", "a"], ["c", "c", "b", "a", "a", "d"], [4, 7, 9, 11, 3, 4]], "output": 67}, {"inputs": ["aacbcabcad", "bbcadddcdd", ["b", "a", "d", "a", "b", "c", "a", "d", "d", "b"], ["d", "b", "b", "d", "c", "a", "c", "c", "a", "a"], [7, 7, 9, 8, 6, 3, 8, 2, 1, 5]], "output": 53}, {"inputs": ["aacbdbcdca", "bbbdbcaacd", ["a", "c", "b", "d", "d", "a", "c", "d"], ["c", "b", "c", "c", "b", "d", "d", "a"], [9, 5, 4, 1, 2, 4, 7, 1]], "output": 47}, {"inputs": ["aadbbcdbbd", "badddbdbac", ["c", "d", "c", "d", "b", "a"], ["b", "b", "a", "a", "a", "d"], [11, 4, 7, 8, 5, 2]], "output": -1}, {"inputs": ["aadbccbddd", "cacdbabadc", ["d", "b", "c", "d", "a", "a", "c", "b"], ["c", "c", "b", "b", "b", "d", "a", "a"], [5, 8, 7, 2, 4, 7, 1, 5]], "output": 46}, {"inputs": ["aadbddcabd", "bdcdccbada", ["d", "a", "a", "b", "d", "b"], ["b", "c", "d", "c", "a", "d"], [6, 10, 5, 8, 11, 4]], "output": -1}, {"inputs": ["aaddadccad", "cbaaadbcba", ["c", "a", "a", "d", "c", "c", "b", "b", "a", "d"], ["a", "c", "d", "c", "d", "b", "d", "c", "b", "b"], [1, 10, 2, 8, 9, 1, 9, 10, 5, 1]], "output": 44}]}} +{"id": "LeetCode/3238", "content": "# Minimum Cost to Convert String II\n\nYou are given two **0-indexed** strings `source` and `target`, both of length `n` and consisting of **lowercase** English characters. You are also given two **0-indexed** string arrays `original` and `changed`, and an integer array `cost`, where `cost[i]` represents the cost of converting the string `original[i]` to the string `changed[i]`.\n\n\nYou start with the string `source`. In one operation, you can pick a **substring** `x` from the string, and change it to `y` at a cost of `z` **if** there exists **any** index `j` such that `cost[j] == z`, `original[j] == x`, and `changed[j] == y`. You are allowed to do **any** number of operations, but any pair of operations must satisfy **either** of these two conditions:\n\n\n* The substrings picked in the operations are `source[a..b]` and `source[c..d]` with either `b < c` **or** `d < a`. In other words, the indices picked in both operations are **disjoint**.\n* The substrings picked in the operations are `source[a..b]` and `source[c..d]` with `a == c` **and** `b == d`. In other words, the indices picked in both operations are **identical**.\n\n\nReturn *the **minimum** cost to convert the string* `source` *to the string* `target` *using **any** number of operations*. *If it is impossible to convert* `source` *to* `target`, *return* `-1`.\n\n\n**Note** that there may exist indices `i`, `j` such that `original[j] == original[i]` and `changed[j] == changed[i]`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** source = \"abcd\", target = \"acbe\", original = [\"a\",\"b\",\"c\",\"c\",\"e\",\"d\"], changed = [\"b\",\"c\",\"b\",\"e\",\"b\",\"e\"], cost = [2,5,5,1,2,20]\n**Output:** 28\n**Explanation:** To convert \"abcd\" to \"acbe\", do the following operations:\n- Change substring source[1..1] from \"b\" to \"c\" at a cost of 5.\n- Change substring source[2..2] from \"c\" to \"e\" at a cost of 1.\n- Change substring source[2..2] from \"e\" to \"b\" at a cost of 2.\n- Change substring source[3..3] from \"d\" to \"e\" at a cost of 20.\nThe total cost incurred is 5 + 1 + 2 + 20 = 28. \nIt can be shown that this is the minimum possible cost.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** source = \"abcdefgh\", target = \"acdeeghh\", original = [\"bcd\",\"fgh\",\"thh\"], changed = [\"cde\",\"thh\",\"ghh\"], cost = [1,3,5]\n**Output:** 9\n**Explanation:** To convert \"abcdefgh\" to \"acdeeghh\", do the following operations:\n- Change substring source[1..3] from \"bcd\" to \"cde\" at a cost of 1.\n- Change substring source[5..7] from \"fgh\" to \"thh\" at a cost of 3. We can do this operation because indices [5,7] are disjoint with indices picked in the first operation.\n- Change substring source[5..7] from \"thh\" to \"ghh\" at a cost of 5. We can do this operation because indices [5,7] are disjoint with indices picked in the first operation, and identical with indices picked in the second operation.\nThe total cost incurred is 1 + 3 + 5 = 9.\nIt can be shown that this is the minimum possible cost.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** source = \"abcdefgh\", target = \"addddddd\", original = [\"bcd\",\"defgh\"], changed = [\"ddd\",\"ddddd\"], cost = [100,1578]\n**Output:** -1\n**Explanation:** It is impossible to convert \"abcdefgh\" to \"addddddd\".\nIf you select substring source[1..3] as the first operation to change \"abcdefgh\" to \"adddefgh\", you cannot select substring source[3..7] as the second operation because it has a common index, 3, with the first operation.\nIf you select substring source[3..7] as the first operation to change \"abcdefgh\" to \"abcddddd\", you cannot select substring source[1..3] as the second operation because it has a common index, 3, with the first operation.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= source.length == target.length <= 1000`\n* `source`, `target` consist only of lowercase English characters.\n* `1 <= cost.length == original.length == changed.length <= 100`\n* `1 <= original[i].length == changed[i].length <= source.length`\n* `original[i]`, `changed[i]` consist only of lowercase English characters.\n* `original[i] != changed[i]`\n* `1 <= cost[i] <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumCost(self, source: str, target: str, original: List[str], changed: List[str], cost: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumCost(**['abcd', 'acbe', ['a', 'b', 'c', 'c', 'e', 'd'], ['b', 'c', 'b', 'e', 'b', 'e'], [2, 5, 5, 1, 2, 20]]) == 28\nassert my_solution.minimumCost(**['abcdefgh', 'acdeeghh', ['bcd', 'fgh', 'thh'], ['cde', 'thh', 'ghh'], [1, 3, 5]]) == 9\nassert my_solution.minimumCost(**['abcdefgh', 'addddddd', ['bcd', 'defgh'], ['ddd', 'ddddd'], [100, 1578]]) == -1\nassert my_solution.minimumCost(**['a', 'b', ['a'], ['b'], [1]]) == 1\nassert my_solution.minimumCost(**['a', 'c', ['a', 'b', 'a', 'a'], ['b', 'c', 'c', 'c'], [1, 2, 10, 1]]) == 1\nassert my_solution.minimumCost(**['a', 'd', ['a'], ['b'], [1]]) == -1\nassert my_solution.minimumCost(**['ajhpd', 'djjdc', ['hpd', 'iyk', 'qzd', 'hpi', 'aic', 'znh', 'cea', 'fug', 'wir', 'kwu', 'yjo', 'rzi', 'a', 'n', 'f', 'q', 'u', 'w', 'x', 'i', 'x', 's', 'o', 'u'], ['iyk', 'qzd', 'hpi', 'aic', 'znh', 'cea', 'fug', 'wir', 'kwu', 'yjo', 'rzi', 'jdc', 'n', 'f', 'q', 'u', 'w', 'x', 'i', 'x', 's', 'o', 'u', 'd'], [80257, 95140, 96349, 89449, 81714, 5859, 96734, 96109, 41211, 99975, 57611, 32644, 82896, 22164, 99889, 98061, 95403, 90922, 64031, 94558, 58418, 99717, 96588, 88286]]) == 1264348\nassert my_solution.minimumCost(**['bzshh', 'mlosr', ['shh', 'wbs', 'hup', 'sab', 'csp', 'tel', 'mhq', 'ezp', 'eap', 'fqb', 'iea', 'cej', 'b', 'v', 'g', 'e', 'd', 'x', 'q', 'v', 'g', 'x', 'u', 'm', 'u', 'q', 'z', 'q', 'n', 'p'], ['wbs', 'hup', 'sab', 'csp', 'tel', 'mhq', 'ezp', 'eap', 'fqb', 'iea', 'cej', 'osr', 'v', 'g', 'e', 'd', 'x', 'q', 'v', 'g', 'x', 'u', 'm', 'u', 'q', 'm', 'q', 'n', 'p', 'l'], [69565, 82190, 75322, 85502, 89675, 98424, 86521, 85852, 32285, 99465, 82356, 97775, 30173, 88276, 82158, 40971, 75361, 65284, 89814, 68219, 44777, 95082, 99781, 99072, 74513, 49667, 99719, 93132, 99203, 54171]]) == 1589277\nassert my_solution.minimumCost(**['fjybg', 'apyyt', ['bg', 'xr', 'cc', 'ip', 'vq', 'po', 'ym', 'rh', 'vw', 'lf', 'lo', 'ee', 'qv', 'yr', 'f', 'w', 'i', 'u', 'g', 'a', 'e', 'f', 's', 'r', 'p', 'j', 'o', 'g', 'i', 'u'], ['xr', 'cc', 'ip', 'vq', 'po', 'ym', 'rh', 'vw', 'lf', 'lo', 'ee', 'qv', 'yr', 'yt', 'w', 'i', 'u', 'g', 'a', 'e', 'f', 's', 'r', 'p', 'a', 'o', 'g', 'i', 'u', 'p'], [97733, 90086, 87125, 85361, 75644, 46301, 21616, 79538, 52507, 95884, 79353, 61127, 58665, 96031, 95035, 12116, 41158, 91096, 47819, 88522, 25493, 80186, 66981, 87597, 56691, 86820, 89031, 99954, 41271, 39699]]) == 1628332\nassert my_solution.minimumCost(**['htkdz', 'oaqaw', ['kdz', 'yyv', 'cde', 'oks', 'fzu', 'hkm', 'dmb', 'arh', 'lix', 'eij', 'ksv', 't', 'u', 'f', 'w', 'b', 'u', 'v', 'h', 'o', 'b', 'o', 'p', 'z', 'h', 'w', 't', 'p', 'x', 'y'], ['yyv', 'cde', 'oks', 'fzu', 'hkm', 'dmb', 'arh', 'lix', 'eij', 'ksv', 'qaw', 'u', 'f', 'w', 'b', 'u', 'v', 'h', 'o', 'b', 'o', 'p', 'z', 'a', 'w', 't', 'p', 'x', 'y', 'o'], [90243, 86765, 84893, 80924, 85915, 42672, 99995, 99429, 88069, 84925, 71184, 54929, 83245, 72750, 87238, 30151, 58657, 94445, 98330, 90683, 83980, 96513, 75536, 95212, 79301, 74556, 94836, 94781, 76273, 86147]]) == 1278928\nassert my_solution.minimumCost(**['iktgh', 'srwcg', ['h', 'e', 'y', 'g', 'q', 'y', 't', 'n', 'r', 'e', 'i', 'x', 'iktg', 'xwgv', 'ddrp', 'saxt', 'rvdq', 'moiy', 'loln', 'bkgj', 'jjgi', 'vatf'], ['e', 'y', 'g', 'q', 'y', 't', 'n', 'r', 'e', 'i', 'x', 'g', 'xwgv', 'ddrp', 'saxt', 'rvdq', 'moiy', 'loln', 'bkgj', 'jjgi', 'vatf', 'srwc'], [70839, 75691, 55903, 82637, 97906, 86576, 92197, 74464, 86638, 61531, 80041, 52732, 96361, 39766, 74988, 59857, 69068, 89990, 74293, 82838, 37650, 26885]]) == 854129\nassert my_solution.minimumCost(**['imbin', 'dmhjv', ['bin', 'pwo', 'fwt', 'xwi', 'xal', 'uqt', 'lmp', 'erq', 'kac', 'dgv', 'qgh', 'rei', 'nbx', 'i', 'u', 'b', 'v', 'c', 'q', 'p', 'f', 'q', 'v', 't', 'n', 'b'], ['pwo', 'fwt', 'xwi', 'xal', 'uqt', 'lmp', 'erq', 'kac', 'dgv', 'qgh', 'rei', 'nbx', 'hjv', 'u', 'b', 'v', 'c', 'q', 'p', 'f', 'q', 'v', 't', 'n', 'b', 'd'], [47307, 30907, 64949, 35735, 84284, 83424, 69858, 92113, 51405, 69242, 97014, 91471, 78165, 92733, 79709, 99573, 78055, 20529, 85549, 90496, 60896, 75354, 50630, 49094, 41380, 46980]]) == 1115296\nassert my_solution.minimumCost(**['jegbx', 'ezhfc', ['egbx', 'hrbf', 'twne', 'snjd', 'ysrf', 'qzqg', 'rcll', 'ekvz', 'inpr', 'frxs', 'xcww', 'unsw', 'vdug', 'ycvs', 'j', 'v', 'j', 'y', 'n', 'q', 'w', 'a', 'z', 'g', 'b', 'd'], ['hrbf', 'twne', 'snjd', 'ysrf', 'qzqg', 'rcll', 'ekvz', 'inpr', 'frxs', 'xcww', 'unsw', 'vdug', 'ycvs', 'zhfc', 'v', 'j', 'y', 'n', 'q', 'w', 'a', 'z', 'g', 'b', 'd', 'e'], [50682, 89150, 91153, 85032, 97960, 96862, 81138, 86570, 77628, 45200, 44955, 70845, 99254, 80325, 91331, 95349, 84374, 94177, 53994, 94284, 79531, 92353, 60384, 100000, 93152, 19787]]) == 1868790\nassert my_solution.minimumCost(**['jpyjj', 'jqnfp', ['j', 'i', 'q', 'u', 'y', 'w', 'd', 'a', 'h', 's', 'i', 'y', 'w', 'pyj', 'qng', 'lrn', 'nrm', 'tvn', 'fei', 'fpj', 'qlw', 'lrb', 'ufu', 'kll', 'nqp'], ['i', 'q', 'u', 'y', 'w', 'd', 'a', 'h', 's', 'i', 'y', 'w', 'p', 'qng', 'lrn', 'nrm', 'tvn', 'fei', 'fpj', 'qlw', 'lrb', 'ufu', 'kll', 'nqp', 'qnf'], [62657, 90954, 55348, 88767, 87756, 55487, 49700, 51801, 94877, 81661, 99027, 91814, 62872, 25235, 62153, 96875, 12009, 85321, 68993, 75866, 72888, 96411, 78568, 83975, 60456]]) == 1131062\nassert my_solution.minimumCost(**['nialx', 'qvqfl', ['x', 'r', 'a', 'x', 'c', 'w', 's', 'a', 'n', 'e', 'q', 'p', 'v', 'k', 'o', 'ial', 'qzu', 'owr', 'kyq', 'ukk', 'gpq', 'jdp', 'dus', 'eng', 'btu', 'cbp'], ['r', 'a', 'x', 'c', 'w', 's', 'a', 'l', 'e', 'q', 'p', 'v', 'k', 'o', 'q', 'qzu', 'owr', 'kyq', 'ukk', 'gpq', 'jdp', 'dus', 'eng', 'btu', 'cbp', 'vqf'], [64196, 95812, 96987, 40860, 41507, 99365, 99208, 53062, 44440, 65136, 95625, 86166, 61798, 84228, 92555, 97678, 97576, 19742, 92989, 98167, 68457, 82411, 39923, 81778, 87792, 7523]]) == 1096682\nassert my_solution.minimumCost(**['pagpe', 'xacng', ['gpe', 'owt', 'wyv', 'eba', 'xgp', 'uny', 'ibc', 'usb', 'mzj', 'wdo', 'lyc', 'eof', 'oci', 'p', 'e', 'p', 'u', 'h', 'w', 'i', 'l'], ['owt', 'wyv', 'eba', 'xgp', 'uny', 'ibc', 'usb', 'mzj', 'wdo', 'lyc', 'eof', 'oci', 'cng', 'e', 'p', 'u', 'h', 'w', 'i', 'l', 'x'], [56193, 92982, 90717, 67407, 91949, 77752, 88841, 43278, 51149, 43646, 99585, 41038, 84989, 57688, 64474, 96532, 77511, 37031, 90895, 62831, 87342]]) == 1381668\nassert my_solution.minimumCost(**['aaabbebbbhbbbbebaaeh', 'hhbebebbahhhehhbbhee', ['a', 'b', 'b', 'b', 'e', 'a', 'h'], ['b', 'e', 'a', 'h', 'h', 'h', 'e'], [9, 8, 5, 9, 3, 7, 9]]) == 99\nassert my_solution.minimumCost(**['abbbeebebehbbhhhbeab', 'aehebehebaeaebbaahhb', ['b', 'b', 'e', 'e', 'h', 'h', 'h', 'b', 'e', 'a'], ['e', 'h', 'b', 'a', 'e', 'b', 'a', 'a', 'h', 'h'], [10, 2, 9, 10, 7, 8, 10, 10, 6, 9]]) == 118\nassert my_solution.minimumCost(**['abebbeeeahhbahaehaab', 'eebhheeahaahbaebaaea', ['a', 'b', 'e', 'a', 'h', 'a', 'e', 'b'], ['e', 'h', 'a', 'h', 'a', 'b', 'b', 'a'], [6, 8, 5, 10, 10, 10, 10, 8]]) == 149\nassert my_solution.minimumCost(**['aeaaebhbhehbeehbehea', 'babehheaaeebeebahhba', ['a', 'e', 'a', 'e', 'b', 'h', 'b', 'h', 'h', 'e'], ['b', 'a', 'e', 'h', 'h', 'e', 'a', 'a', 'b', 'b'], [8, 6, 3, 8, 7, 9, 9, 10, 10, 5]]) == 109\n"}, "labels": {"questionId": "3238", "questionFrontendId": "2977", "questionTitle": "Minimum Cost to Convert String II", "stats": {"totalAccepted": "2K", "totalSubmission": "6.9K", "totalAcceptedRaw": 1993, "totalSubmissionRaw": 6946, "acRate": "28.7%"}, "probedCases": [{"inputs": ["abcd", "acbe", ["a", "b", "c", "c", "e", "d"], ["b", "c", "b", "e", "b", "e"], [2, 5, 5, 1, 2, 20]], "output": 28}, {"inputs": ["abcdefgh", "acdeeghh", ["bcd", "fgh", "thh"], ["cde", "thh", "ghh"], [1, 3, 5]], "output": 9}, {"inputs": ["abcdefgh", "addddddd", ["bcd", "defgh"], ["ddd", "ddddd"], [100, 1578]], "output": -1}, {"inputs": ["a", "b", ["a"], ["b"], [1]], "output": 1}, {"inputs": ["a", "c", ["a", "b", "a", "a"], ["b", "c", "c", "c"], [1, 2, 10, 1]], "output": 1}, {"inputs": ["a", "d", ["a"], ["b"], [1]], "output": -1}, {"inputs": ["ajhpd", "djjdc", ["hpd", "iyk", "qzd", "hpi", "aic", "znh", "cea", "fug", "wir", "kwu", "yjo", "rzi", "a", "n", "f", "q", "u", "w", "x", "i", "x", "s", "o", "u"], ["iyk", "qzd", "hpi", "aic", "znh", "cea", "fug", "wir", "kwu", "yjo", "rzi", "jdc", "n", "f", "q", "u", "w", "x", "i", "x", "s", "o", "u", "d"], [80257, 95140, 96349, 89449, 81714, 5859, 96734, 96109, 41211, 99975, 57611, 32644, 82896, 22164, 99889, 98061, 95403, 90922, 64031, 94558, 58418, 99717, 96588, 88286]], "output": 1264348}, {"inputs": ["bzshh", "mlosr", ["shh", "wbs", "hup", "sab", "csp", "tel", "mhq", "ezp", "eap", "fqb", "iea", "cej", "b", "v", "g", "e", "d", "x", "q", "v", "g", "x", "u", "m", "u", "q", "z", "q", "n", "p"], ["wbs", "hup", "sab", "csp", "tel", "mhq", "ezp", "eap", "fqb", "iea", "cej", "osr", "v", "g", "e", "d", "x", "q", "v", "g", "x", "u", "m", "u", "q", "m", "q", "n", "p", "l"], [69565, 82190, 75322, 85502, 89675, 98424, 86521, 85852, 32285, 99465, 82356, 97775, 30173, 88276, 82158, 40971, 75361, 65284, 89814, 68219, 44777, 95082, 99781, 99072, 74513, 49667, 99719, 93132, 99203, 54171]], "output": 1589277}, {"inputs": ["fjybg", "apyyt", ["bg", "xr", "cc", "ip", "vq", "po", "ym", "rh", "vw", "lf", "lo", "ee", "qv", "yr", "f", "w", "i", "u", "g", "a", "e", "f", "s", "r", "p", "j", "o", "g", "i", "u"], ["xr", "cc", "ip", "vq", "po", "ym", "rh", "vw", "lf", "lo", "ee", "qv", "yr", "yt", "w", "i", "u", "g", "a", "e", "f", "s", "r", "p", "a", "o", "g", "i", "u", "p"], [97733, 90086, 87125, 85361, 75644, 46301, 21616, 79538, 52507, 95884, 79353, 61127, 58665, 96031, 95035, 12116, 41158, 91096, 47819, 88522, 25493, 80186, 66981, 87597, 56691, 86820, 89031, 99954, 41271, 39699]], "output": 1628332}, {"inputs": ["htkdz", "oaqaw", ["kdz", "yyv", "cde", "oks", "fzu", "hkm", "dmb", "arh", "lix", "eij", "ksv", "t", "u", "f", "w", "b", "u", "v", "h", "o", "b", "o", "p", "z", "h", "w", "t", "p", "x", "y"], ["yyv", "cde", "oks", "fzu", "hkm", "dmb", "arh", "lix", "eij", "ksv", "qaw", "u", "f", "w", "b", "u", "v", "h", "o", "b", "o", "p", "z", "a", "w", "t", "p", "x", "y", "o"], [90243, 86765, 84893, 80924, 85915, 42672, 99995, 99429, 88069, 84925, 71184, 54929, 83245, 72750, 87238, 30151, 58657, 94445, 98330, 90683, 83980, 96513, 75536, 95212, 79301, 74556, 94836, 94781, 76273, 86147]], "output": 1278928}, {"inputs": ["iktgh", "srwcg", ["h", "e", "y", "g", "q", "y", "t", "n", "r", "e", "i", "x", "iktg", "xwgv", "ddrp", "saxt", "rvdq", "moiy", "loln", "bkgj", "jjgi", "vatf"], ["e", "y", "g", "q", "y", "t", "n", "r", "e", "i", "x", "g", "xwgv", "ddrp", "saxt", "rvdq", "moiy", "loln", "bkgj", "jjgi", "vatf", "srwc"], [70839, 75691, 55903, 82637, 97906, 86576, 92197, 74464, 86638, 61531, 80041, 52732, 96361, 39766, 74988, 59857, 69068, 89990, 74293, 82838, 37650, 26885]], "output": 854129}, {"inputs": ["imbin", "dmhjv", ["bin", "pwo", "fwt", "xwi", "xal", "uqt", "lmp", "erq", "kac", "dgv", "qgh", "rei", "nbx", "i", "u", "b", "v", "c", "q", "p", "f", "q", "v", "t", "n", "b"], ["pwo", "fwt", "xwi", "xal", "uqt", "lmp", "erq", "kac", "dgv", "qgh", "rei", "nbx", "hjv", "u", "b", "v", "c", "q", "p", "f", "q", "v", "t", "n", "b", "d"], [47307, 30907, 64949, 35735, 84284, 83424, 69858, 92113, 51405, 69242, 97014, 91471, 78165, 92733, 79709, 99573, 78055, 20529, 85549, 90496, 60896, 75354, 50630, 49094, 41380, 46980]], "output": 1115296}, {"inputs": ["jegbx", "ezhfc", ["egbx", "hrbf", "twne", "snjd", "ysrf", "qzqg", "rcll", "ekvz", "inpr", "frxs", "xcww", "unsw", "vdug", "ycvs", "j", "v", "j", "y", "n", "q", "w", "a", "z", "g", "b", "d"], ["hrbf", "twne", "snjd", "ysrf", "qzqg", "rcll", "ekvz", "inpr", "frxs", "xcww", "unsw", "vdug", "ycvs", "zhfc", "v", "j", "y", "n", "q", "w", "a", "z", "g", "b", "d", "e"], [50682, 89150, 91153, 85032, 97960, 96862, 81138, 86570, 77628, 45200, 44955, 70845, 99254, 80325, 91331, 95349, 84374, 94177, 53994, 94284, 79531, 92353, 60384, 100000, 93152, 19787]], "output": 1868790}, {"inputs": ["jpyjj", "jqnfp", ["j", "i", "q", "u", "y", "w", "d", "a", "h", "s", "i", "y", "w", "pyj", "qng", "lrn", "nrm", "tvn", "fei", "fpj", "qlw", "lrb", "ufu", "kll", "nqp"], ["i", "q", "u", "y", "w", "d", "a", "h", "s", "i", "y", "w", "p", "qng", "lrn", "nrm", "tvn", "fei", "fpj", "qlw", "lrb", "ufu", "kll", "nqp", "qnf"], [62657, 90954, 55348, 88767, 87756, 55487, 49700, 51801, 94877, 81661, 99027, 91814, 62872, 25235, 62153, 96875, 12009, 85321, 68993, 75866, 72888, 96411, 78568, 83975, 60456]], "output": 1131062}, {"inputs": ["nialx", "qvqfl", ["x", "r", "a", "x", "c", "w", "s", "a", "n", "e", "q", "p", "v", "k", "o", "ial", "qzu", "owr", "kyq", "ukk", "gpq", "jdp", "dus", "eng", "btu", "cbp"], ["r", "a", "x", "c", "w", "s", "a", "l", "e", "q", "p", "v", "k", "o", "q", "qzu", "owr", "kyq", "ukk", "gpq", "jdp", "dus", "eng", "btu", "cbp", "vqf"], [64196, 95812, 96987, 40860, 41507, 99365, 99208, 53062, 44440, 65136, 95625, 86166, 61798, 84228, 92555, 97678, 97576, 19742, 92989, 98167, 68457, 82411, 39923, 81778, 87792, 7523]], "output": 1096682}, {"inputs": ["pagpe", "xacng", ["gpe", "owt", "wyv", "eba", "xgp", "uny", "ibc", "usb", "mzj", "wdo", "lyc", "eof", "oci", "p", "e", "p", "u", "h", "w", "i", "l"], ["owt", "wyv", "eba", "xgp", "uny", "ibc", "usb", "mzj", "wdo", "lyc", "eof", "oci", "cng", "e", "p", "u", "h", "w", "i", "l", "x"], [56193, 92982, 90717, 67407, 91949, 77752, 88841, 43278, 51149, 43646, 99585, 41038, 84989, 57688, 64474, 96532, 77511, 37031, 90895, 62831, 87342]], "output": 1381668}, {"inputs": ["aaabbebbbhbbbbebaaeh", "hhbebebbahhhehhbbhee", ["a", "b", "b", "b", "e", "a", "h"], ["b", "e", "a", "h", "h", "h", "e"], [9, 8, 5, 9, 3, 7, 9]], "output": 99}, {"inputs": ["abbbeebebehbbhhhbeab", "aehebehebaeaebbaahhb", ["b", "b", "e", "e", "h", "h", "h", "b", "e", "a"], ["e", "h", "b", "a", "e", "b", "a", "a", "h", "h"], [10, 2, 9, 10, 7, 8, 10, 10, 6, 9]], "output": 118}, {"inputs": ["abebbeeeahhbahaehaab", "eebhheeahaahbaebaaea", ["a", "b", "e", "a", "h", "a", "e", "b"], ["e", "h", "a", "h", "a", "b", "b", "a"], [6, 8, 5, 10, 10, 10, 10, 8]], "output": 149}, {"inputs": ["aeaaebhbhehbeehbehea", "babehheaaeebeebahhba", ["a", "e", "a", "e", "b", "h", "b", "h", "h", "e"], ["b", "a", "e", "h", "h", "e", "a", "a", "b", "b"], [8, 6, 3, 8, 7, 9, 9, 10, 10, 5]], "output": 109}]}} +{"id": "LeetCode/3252", "content": "# Count the Number of Incremovable Subarrays I\n\nYou are given a **0-indexed** array of **positive** integers `nums`.\n\n\nA subarray of `nums` is called **incremovable** if `nums` becomes **strictly increasing** on removing the subarray. For example, the subarray `[3, 4]` is an incremovable subarray of `[5, 3, 4, 6, 7]` because removing this subarray changes the array `[5, 3, 4, 6, 7]` to `[5, 6, 7]` which is strictly increasing.\n\n\nReturn *the total number of **incremovable** subarrays of* `nums`.\n\n\n**Note** that an empty array is considered strictly increasing.\n\n\nA **subarray** is a contiguous non-empty sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4]\n**Output:** 10\n**Explanation:** The 10 incremovable subarrays are: [1], [2], [3], [4], [1,2], [2,3], [3,4], [1,2,3], [2,3,4], and [1,2,3,4], because on removing any one of these subarrays nums becomes strictly increasing. Note that you cannot select an empty subarray.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [6,5,7,8]\n**Output:** 7\n**Explanation:** The 7 incremovable subarrays are: [5], [6], [5,7], [6,5], [5,7,8], [6,5,7] and [6,5,7,8].\nIt can be shown that there are only 7 incremovable subarrays in nums.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [8,7,6,6]\n**Output:** 3\n**Explanation:** The 3 incremovable subarrays are: [8,7,6], [7,6,6], and [8,7,6,6]. Note that [8,7] is not an incremovable subarray because after removing [8,7] nums becomes [6,6], which is sorted in ascending order but not strictly increasing.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 50`\n* `1 <= nums[i] <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def incremovableSubarrayCount(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.incremovableSubarrayCount(**[[1, 2, 3, 4]]) == 10\nassert my_solution.incremovableSubarrayCount(**[[6, 5, 7, 8]]) == 7\nassert my_solution.incremovableSubarrayCount(**[[8, 7, 6, 6]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[1]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[2]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[3]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[4]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[5]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[6]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[7]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[8]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[9]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[10]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[1, 2]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[1, 4]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[1, 8]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[2, 10]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[3, 4]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[3, 8]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[3, 10]]) == 3\n"}, "labels": {"questionId": "3252", "questionFrontendId": "2970", "questionTitle": "Count the Number of Incremovable Subarrays I", "stats": {"totalAccepted": "2.4K", "totalSubmission": "4K", "totalAcceptedRaw": 2420, "totalSubmissionRaw": 4010, "acRate": "60.3%"}, "probedCases": [{"inputs": [[1, 2, 3, 4]], "output": 10}, {"inputs": [[6, 5, 7, 8]], "output": 7}, {"inputs": [[8, 7, 6, 6]], "output": 3}, {"inputs": [[1]], "output": 1}, {"inputs": [[2]], "output": 1}, {"inputs": [[3]], "output": 1}, {"inputs": [[4]], "output": 1}, {"inputs": [[5]], "output": 1}, {"inputs": [[6]], "output": 1}, {"inputs": [[7]], "output": 1}, {"inputs": [[8]], "output": 1}, {"inputs": [[9]], "output": 1}, {"inputs": [[10]], "output": 1}, {"inputs": [[1, 2]], "output": 3}, {"inputs": [[1, 4]], "output": 3}, {"inputs": [[1, 8]], "output": 3}, {"inputs": [[2, 10]], "output": 3}, {"inputs": [[3, 4]], "output": 3}, {"inputs": [[3, 8]], "output": 3}, {"inputs": [[3, 10]], "output": 3}]}} +{"id": "LeetCode/3262", "content": "# Find Polygon With the Largest Perimeter\n\nYou are given an array of **positive** integers `nums` of length `n`.\n\n\nA **polygon** is a closed plane figure that has at least `3` sides. The **longest side** of a polygon is **smaller** than the sum of its other sides.\n\n\nConversely, if you have `k` (`k >= 3`) **positive** real numbers `a1`, `a2`, `a3`, ..., `ak` where `a1 <= a2 <= a3 <= ... <= ak` **and** `a1 + a2 + a3 + ... + ak-1 > ak`, then there **always** exists a polygon with `k` sides whose lengths are `a1`, `a2`, `a3`, ..., `ak`.\n\n\nThe **perimeter** of a polygon is the sum of lengths of its sides.\n\n\nReturn *the **largest** possible **perimeter** of a **polygon** whose sides can be formed from* `nums`, *or* `-1` *if it is not possible to create a polygon*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [5,5,5]\n**Output:** 15\n**Explanation:** The only possible polygon that can be made from nums has 3 sides: 5, 5, and 5. The perimeter is 5 + 5 + 5 = 15.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,12,1,2,5,50,3]\n**Output:** 12\n**Explanation:** The polygon with the largest perimeter which can be made from nums has 5 sides: 1, 1, 2, 3, and 5. The perimeter is 1 + 1 + 2 + 3 + 5 = 12.\nWe cannot have a polygon with either 12 or 50 as the longest side because it is not possible to include 2 or more smaller sides that have a greater sum than either of them.\nIt can be shown that the largest possible perimeter is 12.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [5,5,50]\n**Output:** -1\n**Explanation:** There is no possible way to form a polygon from nums, as a polygon has at least 3 sides and 50 > 5 + 5.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `3 <= n <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def largestPerimeter(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.largestPerimeter(**[[5, 5, 5]]) == 15\nassert my_solution.largestPerimeter(**[[1, 12, 1, 2, 5, 50, 3]]) == 12\nassert my_solution.largestPerimeter(**[[5, 5, 50]]) == -1\nassert my_solution.largestPerimeter(**[[1, 1, 1]]) == 3\nassert my_solution.largestPerimeter(**[[1, 1, 2]]) == -1\nassert my_solution.largestPerimeter(**[[1, 1, 3]]) == -1\nassert my_solution.largestPerimeter(**[[1, 1, 4]]) == -1\nassert my_solution.largestPerimeter(**[[1, 1, 5]]) == -1\nassert my_solution.largestPerimeter(**[[1, 2, 1]]) == -1\nassert my_solution.largestPerimeter(**[[1, 2, 2]]) == 5\nassert my_solution.largestPerimeter(**[[1, 2, 3]]) == -1\nassert my_solution.largestPerimeter(**[[1, 2, 4]]) == -1\nassert my_solution.largestPerimeter(**[[1, 2, 5]]) == -1\nassert my_solution.largestPerimeter(**[[1, 3, 1]]) == -1\nassert my_solution.largestPerimeter(**[[1, 3, 2]]) == -1\nassert my_solution.largestPerimeter(**[[1, 3, 3]]) == 7\nassert my_solution.largestPerimeter(**[[1, 3, 4]]) == -1\nassert my_solution.largestPerimeter(**[[1, 3, 5]]) == -1\nassert my_solution.largestPerimeter(**[[1, 4, 1]]) == -1\nassert my_solution.largestPerimeter(**[[1, 4, 2]]) == -1\n"}, "labels": {"questionId": "3262", "questionFrontendId": "2971", "questionTitle": "Find Polygon With the Largest Perimeter", "stats": {"totalAccepted": "2.8K", "totalSubmission": "4.1K", "totalAcceptedRaw": 2813, "totalSubmissionRaw": 4118, "acRate": "68.3%"}, "probedCases": [{"inputs": [[5, 5, 5]], "output": 15}, {"inputs": [[1, 12, 1, 2, 5, 50, 3]], "output": 12}, {"inputs": [[5, 5, 50]], "output": -1}, {"inputs": [[1, 1, 1]], "output": 3}, {"inputs": [[1, 1, 2]], "output": -1}, {"inputs": [[1, 1, 3]], "output": -1}, {"inputs": [[1, 1, 4]], "output": -1}, {"inputs": [[1, 1, 5]], "output": -1}, {"inputs": [[1, 2, 1]], "output": -1}, {"inputs": [[1, 2, 2]], "output": 5}, {"inputs": [[1, 2, 3]], "output": -1}, {"inputs": [[1, 2, 4]], "output": -1}, {"inputs": [[1, 2, 5]], "output": -1}, {"inputs": [[1, 3, 1]], "output": -1}, {"inputs": [[1, 3, 2]], "output": -1}, {"inputs": [[1, 3, 3]], "output": 7}, {"inputs": [[1, 3, 4]], "output": -1}, {"inputs": [[1, 3, 5]], "output": -1}, {"inputs": [[1, 4, 1]], "output": -1}, {"inputs": [[1, 4, 2]], "output": -1}]}} +{"id": "LeetCode/3248", "content": "# Count the Number of Incremovable Subarrays II\n\nYou are given a **0-indexed** array of **positive** integers `nums`.\n\n\nA subarray of `nums` is called **incremovable** if `nums` becomes **strictly increasing** on removing the subarray. For example, the subarray `[3, 4]` is an incremovable subarray of `[5, 3, 4, 6, 7]` because removing this subarray changes the array `[5, 3, 4, 6, 7]` to `[5, 6, 7]` which is strictly increasing.\n\n\nReturn *the total number of **incremovable** subarrays of* `nums`.\n\n\n**Note** that an empty array is considered strictly increasing.\n\n\nA **subarray** is a contiguous non-empty sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4]\n**Output:** 10\n**Explanation:** The 10 incremovable subarrays are: [1], [2], [3], [4], [1,2], [2,3], [3,4], [1,2,3], [2,3,4], and [1,2,3,4], because on removing any one of these subarrays nums becomes strictly increasing. Note that you cannot select an empty subarray.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [6,5,7,8]\n**Output:** 7\n**Explanation:** The 7 incremovable subarrays are: [5], [6], [5,7], [6,5], [5,7,8], [6,5,7] and [6,5,7,8].\nIt can be shown that there are only 7 incremovable subarrays in nums.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [8,7,6,6]\n**Output:** 3\n**Explanation:** The 3 incremovable subarrays are: [8,7,6], [7,6,6], and [8,7,6,6]. Note that [8,7] is not an incremovable subarray because after removing [8,7] nums becomes [6,6], which is sorted in ascending order but not strictly increasing.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def incremovableSubarrayCount(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.incremovableSubarrayCount(**[[1, 2, 3, 4]]) == 10\nassert my_solution.incremovableSubarrayCount(**[[6, 5, 7, 8]]) == 7\nassert my_solution.incremovableSubarrayCount(**[[8, 7, 6, 6]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[1]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[2]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[3]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[4]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[5]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[6]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[7]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[8]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[9]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[10]]) == 1\nassert my_solution.incremovableSubarrayCount(**[[4, 10]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[7, 3]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[8, 5]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[8, 10]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[9, 9]]) == 3\nassert my_solution.incremovableSubarrayCount(**[[5, 5, 6]]) == 5\nassert my_solution.incremovableSubarrayCount(**[[6, 7, 5]]) == 4\n"}, "labels": {"questionId": "3248", "questionFrontendId": "2972", "questionTitle": "Count the Number of Incremovable Subarrays II", "stats": {"totalAccepted": "2K", "totalSubmission": "3.8K", "totalAcceptedRaw": 1974, "totalSubmissionRaw": 3774, "acRate": "52.3%"}, "probedCases": [{"inputs": [[1, 2, 3, 4]], "output": 10}, {"inputs": [[6, 5, 7, 8]], "output": 7}, {"inputs": [[8, 7, 6, 6]], "output": 3}, {"inputs": [[1]], "output": 1}, {"inputs": [[2]], "output": 1}, {"inputs": [[3]], "output": 1}, {"inputs": [[4]], "output": 1}, {"inputs": [[5]], "output": 1}, {"inputs": [[6]], "output": 1}, {"inputs": [[7]], "output": 1}, {"inputs": [[8]], "output": 1}, {"inputs": [[9]], "output": 1}, {"inputs": [[10]], "output": 1}, {"inputs": [[4, 10]], "output": 3}, {"inputs": [[7, 3]], "output": 3}, {"inputs": [[8, 5]], "output": 3}, {"inputs": [[8, 10]], "output": 3}, {"inputs": [[9, 9]], "output": 3}, {"inputs": [[5, 5, 6]], "output": 5}, {"inputs": [[6, 7, 5]], "output": 4}]}} +{"id": "LeetCode/3227", "content": "# Find Missing and Repeated Values\n\nYou are given a **0-indexed** 2D integer matrix `grid` of size `n * n` with values in the range `[1, n2]`. Each integer appears **exactly once** except `a` which appears **twice** and `b` which is **missing**. The task is to find the repeating and missing numbers `a` and `b`.\n\n\nReturn *a **0-indexed** integer array* `ans` *of size* `2` *where* `ans[0]` *equals to* `a` *and* `ans[1]` *equals to* `b`*.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** grid = [[1,3],[2,2]]\n**Output:** [2,4]\n**Explanation:** Number 2 is repeated and number 4 is missing so the answer is [2,4].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** grid = [[9,1,7],[8,9,2],[3,4,6]]\n**Output:** [9,5]\n**Explanation:** Number 9 is repeated and number 5 is missing so the answer is [9,5].\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= n == grid.length == grid[i].length <= 50`\n* `1 <= grid[i][j] <= n * n`\n* For all `x` that `1 <= x <= n * n` there is exactly one `x` that is not equal to any of the grid members.\n* For all `x` that `1 <= x <= n * n` there is exactly one `x` that is equal to exactly two of the grid members.\n* For all `x` that `1 <= x <= n * n` except two of them there is exatly one pair of `i, j` that `0 <= i, j <= n - 1` and `grid[i][j] == x`.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findMissingAndRepeatedValues(self, grid: List[List[int]]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 3], [2, 2]]]) == [2, 4]\nassert my_solution.findMissingAndRepeatedValues(**[[[9, 1, 7], [8, 9, 2], [3, 4, 6]]]) == [9, 5]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 1], [3, 2]]]) == [1, 4]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 1], [3, 4]]]) == [1, 2]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 2], [1, 3]]]) == [1, 4]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 2], [1, 4]]]) == [1, 3]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 2], [3, 3]]]) == [3, 4]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 2], [4, 1]]]) == [1, 3]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 2], [4, 2]]]) == [2, 3]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 2], [4, 4]]]) == [4, 3]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 4], [1, 3]]]) == [1, 2]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 4], [2, 1]]]) == [1, 3]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 4], [3, 1]]]) == [1, 2]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 4], [3, 4]]]) == [4, 2]\nassert my_solution.findMissingAndRepeatedValues(**[[[1, 4], [4, 2]]]) == [4, 3]\nassert my_solution.findMissingAndRepeatedValues(**[[[2, 1], [4, 2]]]) == [2, 3]\nassert my_solution.findMissingAndRepeatedValues(**[[[2, 1], [4, 4]]]) == [4, 3]\nassert my_solution.findMissingAndRepeatedValues(**[[[2, 2], [3, 4]]]) == [2, 1]\nassert my_solution.findMissingAndRepeatedValues(**[[[2, 2], [4, 1]]]) == [2, 3]\nassert my_solution.findMissingAndRepeatedValues(**[[[2, 3], [2, 1]]]) == [2, 4]\n"}, "labels": {"questionId": "3227", "questionFrontendId": "2965", "questionTitle": "Find Missing and Repeated Values", "stats": {"totalAccepted": "5.2K", "totalSubmission": "6.6K", "totalAcceptedRaw": 5216, "totalSubmissionRaw": 6569, "acRate": "79.4%"}, "probedCases": [{"inputs": [[[1, 3], [2, 2]]], "output": [2, 4]}, {"inputs": [[[9, 1, 7], [8, 9, 2], [3, 4, 6]]], "output": [9, 5]}, {"inputs": [[[1, 1], [3, 2]]], "output": [1, 4]}, {"inputs": [[[1, 1], [3, 4]]], "output": [1, 2]}, {"inputs": [[[1, 2], [1, 3]]], "output": [1, 4]}, {"inputs": [[[1, 2], [1, 4]]], "output": [1, 3]}, {"inputs": [[[1, 2], [3, 3]]], "output": [3, 4]}, {"inputs": [[[1, 2], [4, 1]]], "output": [1, 3]}, {"inputs": [[[1, 2], [4, 2]]], "output": [2, 3]}, {"inputs": [[[1, 2], [4, 4]]], "output": [4, 3]}, {"inputs": [[[1, 4], [1, 3]]], "output": [1, 2]}, {"inputs": [[[1, 4], [2, 1]]], "output": [1, 3]}, {"inputs": [[[1, 4], [3, 1]]], "output": [1, 2]}, {"inputs": [[[1, 4], [3, 4]]], "output": [4, 2]}, {"inputs": [[[1, 4], [4, 2]]], "output": [4, 3]}, {"inputs": [[[2, 1], [4, 2]]], "output": [2, 3]}, {"inputs": [[[2, 1], [4, 4]]], "output": [4, 3]}, {"inputs": [[[2, 2], [3, 4]]], "output": [2, 1]}, {"inputs": [[[2, 2], [4, 1]]], "output": [2, 3]}, {"inputs": [[[2, 3], [2, 1]]], "output": [2, 4]}]}} +{"id": "LeetCode/3241", "content": "# Divide Array Into Arrays With Max Difference\n\nYou are given an integer array `nums` of size `n` and a positive integer `k`.\n\n\nDivide the array into one or more arrays of size `3` satisfying the following conditions:\n\n\n* **Each** element of `nums` should be in **exactly** one array.\n* The difference between **any** two elements in one array is less than or equal to `k`.\n\n\nReturn *a* **2D** *array containing all the arrays. If it is impossible to satisfy the conditions, return an empty array. And if there are multiple answers, return **any** of them.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,3,4,8,7,9,3,5,1], k = 2\n**Output:** [[1,1,3],[3,4,5],[7,8,9]]\n**Explanation:** We can divide the array into the following arrays: [1,1,3], [3,4,5] and [7,8,9].\nThe difference between any two elements in each array is less than or equal to 2.\nNote that the order of elements is not important.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,3,3,2,7,3], k = 3\n**Output:** []\n**Explanation:** It is not possible to divide the array satisfying all the conditions.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `n == nums.length`\n* `1 <= n <= 105`\n* `n` is a multiple of `3`.\n* `1 <= nums[i] <= 105`\n* `1 <= k <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def divideArray(self, nums: List[int], k: int) -> List[List[int]]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.divideArray(**[[1, 3, 4, 8, 7, 9, 3, 5, 1], 2]) == [[1, 1, 3], [3, 4, 5], [7, 8, 9]]\nassert my_solution.divideArray(**[[1, 3, 3, 2, 7, 3], 3]) == []\nassert my_solution.divideArray(**[[4, 2, 9, 8, 2, 12, 7, 12, 10, 5, 8, 5, 5, 7, 9, 2, 5, 11], 14]) == [[2, 2, 2], [4, 5, 5], [5, 5, 7], [7, 8, 8], [9, 9, 10], [11, 12, 12]]\nassert my_solution.divideArray(**[[33, 26, 4, 18, 16, 24, 24, 15, 8, 18, 34, 20, 24, 16, 3], 16]) == [[3, 4, 8], [15, 16, 16], [18, 18, 20], [24, 24, 24], [26, 33, 34]]\nassert my_solution.divideArray(**[[6, 1, 8, 8, 5, 8, 5, 9, 8, 9, 5, 8, 3, 4, 6], 7]) == [[1, 3, 4], [5, 5, 5], [6, 6, 8], [8, 8, 8], [8, 9, 9]]\nassert my_solution.divideArray(**[[20, 21, 34, 3, 19, 2, 23, 32, 20, 17, 14, 13, 19, 20, 6], 15]) == [[2, 3, 6], [13, 14, 17], [19, 19, 20], [20, 20, 21], [23, 32, 34]]\nassert my_solution.divideArray(**[[6, 10, 5, 12, 7, 11, 6, 6, 12, 12, 11, 7], 2]) == [[5, 6, 6], [6, 7, 7], [10, 11, 11], [12, 12, 12]]\nassert my_solution.divideArray(**[[12, 15, 26, 7, 10, 13, 15, 5, 27, 16, 14, 15], 18]) == [[5, 7, 10], [12, 13, 14], [15, 15, 15], [16, 26, 27]]\nassert my_solution.divideArray(**[[12, 7, 13, 10, 7, 19, 11, 23, 3, 3, 7, 9], 16]) == [[3, 3, 7], [7, 7, 9], [10, 11, 12], [13, 19, 23]]\nassert my_solution.divideArray(**[[19, 3, 23, 4, 8, 1, 1, 3, 26], 7]) == [[1, 1, 3], [3, 4, 8], [19, 23, 26]]\nassert my_solution.divideArray(**[[11, 13, 24, 11, 9, 23, 16, 19, 13], 8]) == [[9, 11, 11], [13, 13, 16], [19, 23, 24]]\nassert my_solution.divideArray(**[[6, 12, 21, 12, 6, 12, 25, 20, 15, 22, 11, 19, 8, 4, 18, 26, 17, 18, 12, 5, 8], 11]) == [[4, 5, 6], [6, 8, 8], [11, 12, 12], [12, 12, 15], [17, 18, 18], [19, 20, 21], [22, 25, 26]]\nassert my_solution.divideArray(**[[15, 17, 14, 3, 25, 15, 11, 25, 15, 16, 12, 18], 10]) == [[3, 11, 12], [14, 15, 15], [15, 16, 17], [18, 25, 25]]\nassert my_solution.divideArray(**[[16, 20, 16, 19, 20, 13, 14, 20, 14], 10]) == [[13, 14, 14], [16, 16, 19], [20, 20, 20]]\nassert my_solution.divideArray(**[[2, 13, 15, 14, 18, 15, 3, 13, 2], 1]) == []\nassert my_solution.divideArray(**[[1, 14, 20, 7, 17, 2, 14, 1, 8], 11]) == [[1, 1, 2], [7, 8, 14], [14, 17, 20]]\nassert my_solution.divideArray(**[[8, 12, 19, 8, 9, 19, 9, 19, 9, 8, 6, 9, 6, 6, 12], 3]) == [[6, 6, 6], [8, 8, 8], [9, 9, 9], [9, 12, 12], [19, 19, 19]]\nassert my_solution.divideArray(**[[18, 16, 17, 19, 12, 25, 11, 27, 11, 32, 32, 17], 20]) == [[11, 11, 12], [16, 17, 17], [18, 19, 25], [27, 32, 32]]\nassert my_solution.divideArray(**[[21, 11, 24, 20, 17, 13, 7, 20, 20, 16, 24, 20, 12, 17, 16, 15, 7, 7, 18, 15, 20], 6]) == [[7, 7, 7], [11, 12, 13], [15, 15, 16], [16, 17, 17], [18, 20, 20], [20, 20, 20], [21, 24, 24]]\nassert my_solution.divideArray(**[[6, 7, 7, 6, 7, 6], 13]) == [[6, 6, 6], [7, 7, 7]]\n"}, "labels": {"questionId": "3241", "questionFrontendId": "2966", "questionTitle": "Divide Array Into Arrays With Max Difference", "stats": {"totalAccepted": "4.7K", "totalSubmission": "7K", "totalAcceptedRaw": 4670, "totalSubmissionRaw": 7035, "acRate": "66.4%"}, "probedCases": [{"inputs": [[1, 3, 4, 8, 7, 9, 3, 5, 1], 2], "output": [[1, 1, 3], [3, 4, 5], [7, 8, 9]]}, {"inputs": [[1, 3, 3, 2, 7, 3], 3], "output": []}, {"inputs": [[4, 2, 9, 8, 2, 12, 7, 12, 10, 5, 8, 5, 5, 7, 9, 2, 5, 11], 14], "output": [[2, 2, 2], [4, 5, 5], [5, 5, 7], [7, 8, 8], [9, 9, 10], [11, 12, 12]]}, {"inputs": [[33, 26, 4, 18, 16, 24, 24, 15, 8, 18, 34, 20, 24, 16, 3], 16], "output": [[3, 4, 8], [15, 16, 16], [18, 18, 20], [24, 24, 24], [26, 33, 34]]}, {"inputs": [[6, 1, 8, 8, 5, 8, 5, 9, 8, 9, 5, 8, 3, 4, 6], 7], "output": [[1, 3, 4], [5, 5, 5], [6, 6, 8], [8, 8, 8], [8, 9, 9]]}, {"inputs": [[20, 21, 34, 3, 19, 2, 23, 32, 20, 17, 14, 13, 19, 20, 6], 15], "output": [[2, 3, 6], [13, 14, 17], [19, 19, 20], [20, 20, 21], [23, 32, 34]]}, {"inputs": [[6, 10, 5, 12, 7, 11, 6, 6, 12, 12, 11, 7], 2], "output": [[5, 6, 6], [6, 7, 7], [10, 11, 11], [12, 12, 12]]}, {"inputs": [[12, 15, 26, 7, 10, 13, 15, 5, 27, 16, 14, 15], 18], "output": [[5, 7, 10], [12, 13, 14], [15, 15, 15], [16, 26, 27]]}, {"inputs": [[12, 7, 13, 10, 7, 19, 11, 23, 3, 3, 7, 9], 16], "output": [[3, 3, 7], [7, 7, 9], [10, 11, 12], [13, 19, 23]]}, {"inputs": [[19, 3, 23, 4, 8, 1, 1, 3, 26], 7], "output": [[1, 1, 3], [3, 4, 8], [19, 23, 26]]}, {"inputs": [[11, 13, 24, 11, 9, 23, 16, 19, 13], 8], "output": [[9, 11, 11], [13, 13, 16], [19, 23, 24]]}, {"inputs": [[6, 12, 21, 12, 6, 12, 25, 20, 15, 22, 11, 19, 8, 4, 18, 26, 17, 18, 12, 5, 8], 11], "output": [[4, 5, 6], [6, 8, 8], [11, 12, 12], [12, 12, 15], [17, 18, 18], [19, 20, 21], [22, 25, 26]]}, {"inputs": [[15, 17, 14, 3, 25, 15, 11, 25, 15, 16, 12, 18], 10], "output": [[3, 11, 12], [14, 15, 15], [15, 16, 17], [18, 25, 25]]}, {"inputs": [[16, 20, 16, 19, 20, 13, 14, 20, 14], 10], "output": [[13, 14, 14], [16, 16, 19], [20, 20, 20]]}, {"inputs": [[2, 13, 15, 14, 18, 15, 3, 13, 2], 1], "output": []}, {"inputs": [[1, 14, 20, 7, 17, 2, 14, 1, 8], 11], "output": [[1, 1, 2], [7, 8, 14], [14, 17, 20]]}, {"inputs": [[8, 12, 19, 8, 9, 19, 9, 19, 9, 8, 6, 9, 6, 6, 12], 3], "output": [[6, 6, 6], [8, 8, 8], [9, 9, 9], [9, 12, 12], [19, 19, 19]]}, {"inputs": [[18, 16, 17, 19, 12, 25, 11, 27, 11, 32, 32, 17], 20], "output": [[11, 11, 12], [16, 17, 17], [18, 19, 25], [27, 32, 32]]}, {"inputs": [[21, 11, 24, 20, 17, 13, 7, 20, 20, 16, 24, 20, 12, 17, 16, 15, 7, 7, 18, 15, 20], 6], "output": [[7, 7, 7], [11, 12, 13], [15, 15, 16], [16, 17, 17], [18, 20, 20], [20, 20, 20], [21, 24, 24]]}, {"inputs": [[6, 7, 7, 6, 7, 6], 13], "output": [[6, 6, 6], [7, 7, 7]]}]}} +{"id": "LeetCode/3229", "content": "# Minimum Cost to Make Array Equalindromic\n\nYou are given a **0-indexed** integer array `nums` having length `n`.\n\n\nYou are allowed to perform a special move **any** number of times (**including zero**) on `nums`. In one **special** **move** you perform the following steps **in order**:\n\n\n* Choose an index `i` in the range `[0, n - 1]`, and a **positive** integer `x`.\n* Add `|nums[i] - x|` to the total cost.\n* Change the value of `nums[i]` to `x`.\n\n\nA **palindromic number** is a positive integer that remains the same when its digits are reversed. For example, `121`, `2552` and `65756` are palindromic numbers whereas `24`, `46`, `235` are not palindromic numbers.\n\n\nAn array is considered **equalindromic** if all the elements in the array are equal to an integer `y`, where `y` is a **palindromic number** less than `109`.\n\n\nReturn *an integer denoting the **minimum** possible total cost to make* `nums` ***equalindromic** by performing any number of special moves.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4,5]\n**Output:** 6\n**Explanation:** We can make the array equalindromic by changing all elements to 3 which is a palindromic number. The cost of changing the array to [3,3,3,3,3] using 4 special moves is given by |1 - 3| + |2 - 3| + |4 - 3| + |5 - 3| = 6.\nIt can be shown that changing all elements to any palindromic number other than 3 cannot be achieved at a lower cost.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [10,12,13,14,15]\n**Output:** 11\n**Explanation:** We can make the array equalindromic by changing all elements to 11 which is a palindromic number. The cost of changing the array to [11,11,11,11,11] using 5 special moves is given by |10 - 11| + |12 - 11| + |13 - 11| + |14 - 11| + |15 - 11| = 11.\nIt can be shown that changing all elements to any palindromic number other than 11 cannot be achieved at a lower cost.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [22,33,22,33,22]\n**Output:** 22\n**Explanation:** We can make the array equalindromic by changing all elements to 22 which is a palindromic number. The cost of changing the array to [22,22,22,22,22] using 2 special moves is given by |33 - 22| + |33 - 22| = 22.\nIt can be shown that changing all elements to any palindromic number other than 22 cannot be achieved at a lower cost.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumCost(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumCost(**[[1, 2, 3, 4, 5]]) == 6\nassert my_solution.minimumCost(**[[10, 12, 13, 14, 15]]) == 11\nassert my_solution.minimumCost(**[[22, 33, 22, 33, 22]]) == 22\nassert my_solution.minimumCost(**[[1]]) == 0\nassert my_solution.minimumCost(**[[2]]) == 0\nassert my_solution.minimumCost(**[[3]]) == 0\nassert my_solution.minimumCost(**[[4]]) == 0\nassert my_solution.minimumCost(**[[5]]) == 0\nassert my_solution.minimumCost(**[[2, 1]]) == 1\nassert my_solution.minimumCost(**[[3, 1]]) == 2\nassert my_solution.minimumCost(**[[3, 2]]) == 1\nassert my_solution.minimumCost(**[[4, 1]]) == 3\nassert my_solution.minimumCost(**[[4, 2]]) == 2\nassert my_solution.minimumCost(**[[4, 3]]) == 1\nassert my_solution.minimumCost(**[[5, 1]]) == 4\nassert my_solution.minimumCost(**[[5, 2]]) == 3\nassert my_solution.minimumCost(**[[5, 3]]) == 2\nassert my_solution.minimumCost(**[[5, 4]]) == 1\nassert my_solution.minimumCost(**[[3, 2, 1]]) == 2\nassert my_solution.minimumCost(**[[4, 2, 1]]) == 3\n"}, "labels": {"questionId": "3229", "questionFrontendId": "2967", "questionTitle": "Minimum Cost to Make Array Equalindromic", "stats": {"totalAccepted": "3.6K", "totalSubmission": "16.1K", "totalAcceptedRaw": 3637, "totalSubmissionRaw": 16137, "acRate": "22.5%"}, "probedCases": [{"inputs": [[1, 2, 3, 4, 5]], "output": 6}, {"inputs": [[10, 12, 13, 14, 15]], "output": 11}, {"inputs": [[22, 33, 22, 33, 22]], "output": 22}, {"inputs": [[1]], "output": 0}, {"inputs": [[2]], "output": 0}, {"inputs": [[3]], "output": 0}, {"inputs": [[4]], "output": 0}, {"inputs": [[5]], "output": 0}, {"inputs": [[2, 1]], "output": 1}, {"inputs": [[3, 1]], "output": 2}, {"inputs": [[3, 2]], "output": 1}, {"inputs": [[4, 1]], "output": 3}, {"inputs": [[4, 2]], "output": 2}, {"inputs": [[4, 3]], "output": 1}, {"inputs": [[5, 1]], "output": 4}, {"inputs": [[5, 2]], "output": 3}, {"inputs": [[5, 3]], "output": 2}, {"inputs": [[5, 4]], "output": 1}, {"inputs": [[3, 2, 1]], "output": 2}, {"inputs": [[4, 2, 1]], "output": 3}]}} +{"id": "LeetCode/3196", "content": "# Apply Operations to Maximize Frequency Score\n\nYou are given a **0-indexed** integer array `nums` and an integer `k`.\n\n\nYou can perform the following operation on the array **at most** `k` times:\n\n\n* Choose any index `i` from the array and **increase** or **decrease** `nums[i]` by `1`.\n\n\nThe score of the final array is the **frequency** of the most frequent element in the array.\n\n\nReturn *the **maximum** score you can achieve*.\n\n\nThe frequency of an element is the number of occurences of that element in the array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,6,4], k = 3\n**Output:** 3\n**Explanation:** We can do the following operations on the array:\n- Choose i = 0, and increase the value of nums[0] by 1. The resulting array is [2,2,6,4].\n- Choose i = 3, and decrease the value of nums[3] by 1. The resulting array is [2,2,6,3].\n- Choose i = 3, and decrease the value of nums[3] by 1. The resulting array is [2,2,6,2].\nThe element 2 is the most frequent in the final array so our score is 3.\nIt can be shown that we cannot achieve a better score.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,4,4,2,4], k = 0\n**Output:** 3\n**Explanation:** We cannot apply any operations so our score will be the frequency of the most frequent element in the original array, which is 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n* `0 <= k <= 1014`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxFrequencyScore(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxFrequencyScore(**[[1, 2, 6, 4], 3]) == 3\nassert my_solution.maxFrequencyScore(**[[1, 4, 4, 2, 4], 0]) == 3\nassert my_solution.maxFrequencyScore(**[[3, 20, 13, 2, 3, 15, 24, 19, 8, 13, 19, 20, 21], 45]) == 10\nassert my_solution.maxFrequencyScore(**[[13, 22, 29, 21, 13, 17, 5, 2, 27, 6, 10, 4, 23, 29, 27], 117]) == 14\nassert my_solution.maxFrequencyScore(**[[27, 8, 30, 3, 13, 28, 7, 14, 21, 19, 24, 28, 29, 1, 14, 22, 6], 23]) == 8\nassert my_solution.maxFrequencyScore(**[[10, 11, 3], 1]) == 2\nassert my_solution.maxFrequencyScore(**[[10, 19, 26, 18, 27, 18], 9]) == 4\nassert my_solution.maxFrequencyScore(**[[17, 24, 10, 23, 22, 15, 25, 2, 13, 24, 22, 25, 25, 21], 52]) == 13\nassert my_solution.maxFrequencyScore(**[[28, 6, 22, 10], 12]) == 2\nassert my_solution.maxFrequencyScore(**[[17, 17, 25, 14, 29, 28, 20, 14, 16, 22, 4, 28, 2, 5, 3, 11, 6, 20, 17], 76]) == 14\nassert my_solution.maxFrequencyScore(**[[23, 10, 18, 21, 16, 23, 14], 2]) == 3\nassert my_solution.maxFrequencyScore(**[[5, 13, 7], 8]) == 3\nassert my_solution.maxFrequencyScore(**[[6, 29, 3, 19, 10, 6, 20, 26, 1, 30, 11, 25, 29, 12, 29, 14, 15, 16, 5], 64]) == 12\nassert my_solution.maxFrequencyScore(**[[10, 26, 21, 18, 30, 25, 1], 8]) == 3\nassert my_solution.maxFrequencyScore(**[[29, 10, 26, 1, 2, 2, 17, 7, 5, 16, 24, 27, 7, 7, 26, 26, 24], 3]) == 5\nassert my_solution.maxFrequencyScore(**[[11, 16, 6, 12, 3, 8, 5, 29, 9, 15, 7, 9, 14, 6, 11, 14, 12, 23, 22, 14], 79]) == 19\nassert my_solution.maxFrequencyScore(**[[5, 17, 15, 14, 27, 11, 22, 6, 4], 26]) == 6\nassert my_solution.maxFrequencyScore(**[[13, 22, 17], 4]) == 2\nassert my_solution.maxFrequencyScore(**[[24, 6, 14, 6, 30, 9, 6, 11, 21, 10, 12, 27, 1], 90]) == 13\nassert my_solution.maxFrequencyScore(**[[19, 5, 2, 23, 16, 22, 3, 2, 5, 20, 17, 3, 22, 1], 15]) == 7\n"}, "labels": {"questionId": "3196", "questionFrontendId": "2968", "questionTitle": "Apply Operations to Maximize Frequency Score", "stats": {"totalAccepted": "2.2K", "totalSubmission": "4.6K", "totalAcceptedRaw": 2167, "totalSubmissionRaw": 4564, "acRate": "47.5%"}, "probedCases": [{"inputs": [[1, 2, 6, 4], 3], "output": 3}, {"inputs": [[1, 4, 4, 2, 4], 0], "output": 3}, {"inputs": [[3, 20, 13, 2, 3, 15, 24, 19, 8, 13, 19, 20, 21], 45], "output": 10}, {"inputs": [[13, 22, 29, 21, 13, 17, 5, 2, 27, 6, 10, 4, 23, 29, 27], 117], "output": 14}, {"inputs": [[27, 8, 30, 3, 13, 28, 7, 14, 21, 19, 24, 28, 29, 1, 14, 22, 6], 23], "output": 8}, {"inputs": [[10, 11, 3], 1], "output": 2}, {"inputs": [[10, 19, 26, 18, 27, 18], 9], "output": 4}, {"inputs": [[17, 24, 10, 23, 22, 15, 25, 2, 13, 24, 22, 25, 25, 21], 52], "output": 13}, {"inputs": [[28, 6, 22, 10], 12], "output": 2}, {"inputs": [[17, 17, 25, 14, 29, 28, 20, 14, 16, 22, 4, 28, 2, 5, 3, 11, 6, 20, 17], 76], "output": 14}, {"inputs": [[23, 10, 18, 21, 16, 23, 14], 2], "output": 3}, {"inputs": [[5, 13, 7], 8], "output": 3}, {"inputs": [[6, 29, 3, 19, 10, 6, 20, 26, 1, 30, 11, 25, 29, 12, 29, 14, 15, 16, 5], 64], "output": 12}, {"inputs": [[10, 26, 21, 18, 30, 25, 1], 8], "output": 3}, {"inputs": [[29, 10, 26, 1, 2, 2, 17, 7, 5, 16, 24, 27, 7, 7, 26, 26, 24], 3], "output": 5}, {"inputs": [[11, 16, 6, 12, 3, 8, 5, 29, 9, 15, 7, 9, 14, 6, 11, 14, 12, 23, 22, 14], 79], "output": 19}, {"inputs": [[5, 17, 15, 14, 27, 11, 22, 6, 4], 26], "output": 6}, {"inputs": [[13, 22, 17], 4], "output": 2}, {"inputs": [[24, 6, 14, 6, 30, 9, 6, 11, 21, 10, 12, 27, 1], 90], "output": 13}, {"inputs": [[19, 5, 2, 23, 16, 22, 3, 2, 5, 20, 17, 3, 22, 1], 15], "output": 7}]}} +{"id": "LeetCode/3220", "content": "# Count Tested Devices After Test Operations\n\nYou are given a **0-indexed** integer array `batteryPercentages` having length `n`, denoting the battery percentages of `n` **0-indexed** devices.\n\n\nYour task is to test each device `i` **in order** from `0` to `n - 1`, by performing the following test operations:\n\n\n* If `batteryPercentages[i]` is **greater** than `0`:\n\t+ **Increment** the count of tested devices.\n\t+ **Decrease** the battery percentage of all devices with indices `j` in the range `[i + 1, n - 1]` by `1`, ensuring their battery percentage **never goes below** `0`, i.e, `batteryPercentages[j] = max(0, batteryPercentages[j] - 1)`.\n\t+ Move to the next device.\n* Otherwise, move to the next device without performing any test.\n\n\nReturn *an integer denoting the number of devices that will be tested after performing the test operations in order.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** batteryPercentages = [1,1,2,1,3]\n**Output:** 3\n**Explanation:** Performing the test operations in order starting from device 0:\nAt device 0, batteryPercentages[0] > 0, so there is now 1 tested device, and batteryPercentages becomes [1,0,1,0,2].\nAt device 1, batteryPercentages[1] == 0, so we move to the next device without testing.\nAt device 2, batteryPercentages[2] > 0, so there are now 2 tested devices, and batteryPercentages becomes [1,0,1,0,1].\nAt device 3, batteryPercentages[3] == 0, so we move to the next device without testing.\nAt device 4, batteryPercentages[4] > 0, so there are now 3 tested devices, and batteryPercentages stays the same.\nSo, the answer is 3.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** batteryPercentages = [0,1,2]\n**Output:** 2\n**Explanation:** Performing the test operations in order starting from device 0:\nAt device 0, batteryPercentages[0] == 0, so we move to the next device without testing.\nAt device 1, batteryPercentages[1] > 0, so there is now 1 tested device, and batteryPercentages becomes [0,1,1].\nAt device 2, batteryPercentages[2] > 0, so there are now 2 tested devices, and batteryPercentages stays the same.\nSo, the answer is 2.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == batteryPercentages.length <= 100`\n* `0 <= batteryPercentages[i] <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countTestedDevices(self, batteryPercentages: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countTestedDevices(**[[1, 1, 2, 1, 3]]) == 3\nassert my_solution.countTestedDevices(**[[0, 1, 2]]) == 2\nassert my_solution.countTestedDevices(**[[0]]) == 0\nassert my_solution.countTestedDevices(**[[1]]) == 1\nassert my_solution.countTestedDevices(**[[0, 0]]) == 0\nassert my_solution.countTestedDevices(**[[0, 1]]) == 1\nassert my_solution.countTestedDevices(**[[0, 2]]) == 1\nassert my_solution.countTestedDevices(**[[1, 0]]) == 1\nassert my_solution.countTestedDevices(**[[1, 2]]) == 2\nassert my_solution.countTestedDevices(**[[2, 1]]) == 1\nassert my_solution.countTestedDevices(**[[2, 2]]) == 2\nassert my_solution.countTestedDevices(**[[0, 0, 1]]) == 1\nassert my_solution.countTestedDevices(**[[0, 0, 2]]) == 1\nassert my_solution.countTestedDevices(**[[1, 1, 0]]) == 1\nassert my_solution.countTestedDevices(**[[1, 2, 0]]) == 2\nassert my_solution.countTestedDevices(**[[1, 3, 1]]) == 2\nassert my_solution.countTestedDevices(**[[2, 0, 1]]) == 1\nassert my_solution.countTestedDevices(**[[2, 2, 0]]) == 2\nassert my_solution.countTestedDevices(**[[2, 2, 2]]) == 2\nassert my_solution.countTestedDevices(**[[3, 0, 3]]) == 2\n"}, "labels": {"questionId": "3220", "questionFrontendId": "2960", "questionTitle": "Count Tested Devices After Test Operations", "stats": {"totalAccepted": "5.8K", "totalSubmission": "6.8K", "totalAcceptedRaw": 5796, "totalSubmissionRaw": 6847, "acRate": "84.7%"}, "probedCases": [{"inputs": [[1, 1, 2, 1, 3]], "output": 3}, {"inputs": [[0, 1, 2]], "output": 2}, {"inputs": [[0]], "output": 0}, {"inputs": [[1]], "output": 1}, {"inputs": [[0, 0]], "output": 0}, {"inputs": [[0, 1]], "output": 1}, {"inputs": [[0, 2]], "output": 1}, {"inputs": [[1, 0]], "output": 1}, {"inputs": [[1, 2]], "output": 2}, {"inputs": [[2, 1]], "output": 1}, {"inputs": [[2, 2]], "output": 2}, {"inputs": [[0, 0, 1]], "output": 1}, {"inputs": [[0, 0, 2]], "output": 1}, {"inputs": [[1, 1, 0]], "output": 1}, {"inputs": [[1, 2, 0]], "output": 2}, {"inputs": [[1, 3, 1]], "output": 2}, {"inputs": [[2, 0, 1]], "output": 1}, {"inputs": [[2, 2, 0]], "output": 2}, {"inputs": [[2, 2, 2]], "output": 2}, {"inputs": [[3, 0, 3]], "output": 2}]}} +{"id": "LeetCode/3234", "content": "# Double Modular Exponentiation\n\nYou are given a **0-indexed** 2D array `variables` where `variables[i] = [ai, bi, ci, mi]`, and an integer `target`.\n\n\nAn index `i` is **good** if the following formula holds:\n\n\n* `0 <= i < variables.length`\n* `((aibi % 10)ci) % mi == target`\n\n\nReturn *an array consisting of **good** indices in **any order***.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** variables = [[2,3,3,10],[3,3,3,1],[6,1,1,4]], target = 2\n**Output:** [0,2]\n**Explanation:** For each index i in the variables array:\n1) For the index 0, variables[0] = [2,3,3,10], (23 % 10)3 % 10 = 2.\n2) For the index 1, variables[1] = [3,3,3,1], (33 % 10)3 % 1 = 0.\n3) For the index 2, variables[2] = [6,1,1,4], (61 % 10)1 % 4 = 2.\nTherefore we return [0,2] as the answer.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** variables = [[39,3,1000,1000]], target = 17\n**Output:** []\n**Explanation:** For each index i in the variables array:\n1) For the index 0, variables[0] = [39,3,1000,1000], (393 % 10)1000 % 1000 = 1.\nTherefore we return [] as the answer.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= variables.length <= 100`\n* `variables[i] == [ai, bi, ci, mi]`\n* `1 <= ai, bi, ci, mi <= 103`\n* `0 <= target <= 103`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def getGoodIndices(self, variables: List[List[int]], target: int) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.getGoodIndices(**[[[2, 3, 3, 10], [3, 3, 3, 1], [6, 1, 1, 4]], 2]) == [0, 2]\nassert my_solution.getGoodIndices(**[[[39, 3, 1000, 1000]], 17]) == []\nassert my_solution.getGoodIndices(**[[[3, 2, 4, 2], [3, 3, 1, 3], [2, 2, 2, 4], [4, 4, 2, 3], [2, 4, 1, 3]], 4]) == []\nassert my_solution.getGoodIndices(**[[[9, 2, 8, 5], [7, 8, 8, 8], [8, 9, 6, 1], [8, 6, 2, 2], [3, 6, 3, 1]], 9]) == []\nassert my_solution.getGoodIndices(**[[[2, 2, 3, 2], [1, 3, 3, 2], [3, 2, 2, 3], [3, 1, 2, 3], [1, 2, 3, 1], [2, 2, 2, 2], [2, 1, 3, 1], [3, 2, 2, 2], [2, 1, 3, 1], [3, 3, 1, 3]], 0]) == [0, 2, 3, 4, 5, 6, 8]\nassert my_solution.getGoodIndices(**[[[1, 3, 2, 3], [4, 2, 3, 3], [4, 1, 4, 4], [4, 2, 3, 1], [4, 2, 1, 1], [1, 2, 4, 1], [1, 1, 4, 2], [1, 4, 4, 3], [1, 2, 2, 3]], 2]) == []\nassert my_solution.getGoodIndices(**[[[5, 4, 1, 3], [2, 5, 5, 1], [5, 3, 4, 1]], 5]) == []\nassert my_solution.getGoodIndices(**[[[4, 7, 6, 7], [7, 6, 6, 4], [6, 8, 2, 3], [8, 3, 5, 8]], 4]) == []\nassert my_solution.getGoodIndices(**[[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], 0]) == [0, 1, 2, 3, 4, 5, 6]\nassert my_solution.getGoodIndices(**[[[3, 5, 1, 2], [3, 2, 5, 2], [4, 4, 3, 2], [3, 2, 5, 3], [1, 5, 1, 4]], 1]) == [0, 1, 4]\nassert my_solution.getGoodIndices(**[[[1, 2, 1, 1], [2, 2, 2, 2], [1, 1, 1, 2], [1, 2, 2, 2]], 2]) == []\nassert my_solution.getGoodIndices(**[[[3, 3, 5, 6], [8, 2, 9, 2], [1, 4, 6, 1], [6, 4, 7, 7]], 8]) == []\nassert my_solution.getGoodIndices(**[[[3, 5, 4, 3], [1, 3, 3, 1], [3, 3, 5, 5], [4, 5, 5, 5], [5, 1, 4, 3], [2, 5, 3, 4]], 7]) == []\nassert my_solution.getGoodIndices(**[[[9, 7, 2, 7], [9, 1, 8, 1], [9, 3, 5, 6], [6, 1, 8, 4], [9, 6, 2, 3]], 8]) == []\nassert my_solution.getGoodIndices(**[[[10, 6, 8, 7], [3, 6, 1, 8]], 5]) == []\nassert my_solution.getGoodIndices(**[[[4, 6, 5, 2], [2, 6, 4, 6], [4, 6, 3, 6], [2, 2, 6, 5], [6, 5, 5, 2]], 2]) == []\nassert my_solution.getGoodIndices(**[[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], 1]) == []\nassert my_solution.getGoodIndices(**[[[5, 6, 5, 1], [4, 3, 1, 6], [5, 4, 4, 2]], 4]) == [1]\nassert my_solution.getGoodIndices(**[[[5, 1, 2, 4], [4, 5, 5, 5], [5, 9, 7, 4], [7, 9, 6, 3], [1, 8, 6, 1], [1, 1, 9, 9], [3, 7, 6, 5], [2, 6, 2, 6]], 1]) == [0, 2, 3, 5]\nassert my_solution.getGoodIndices(**[[[1, 3, 2, 5], [5, 4, 1, 2], [2, 2, 3, 2], [4, 2, 5, 4], [1, 5, 4, 1], [2, 2, 5, 2], [3, 3, 2, 1], [2, 5, 4, 3], [2, 1, 5, 1]], 4]) == []\n"}, "labels": {"questionId": "3234", "questionFrontendId": "2961", "questionTitle": "Double Modular Exponentiation", "stats": {"totalAccepted": "4.6K", "totalSubmission": "9.7K", "totalAcceptedRaw": 4597, "totalSubmissionRaw": 9672, "acRate": "47.5%"}, "probedCases": [{"inputs": [[[2, 3, 3, 10], [3, 3, 3, 1], [6, 1, 1, 4]], 2], "output": [0, 2]}, {"inputs": [[[39, 3, 1000, 1000]], 17], "output": []}, {"inputs": [[[3, 2, 4, 2], [3, 3, 1, 3], [2, 2, 2, 4], [4, 4, 2, 3], [2, 4, 1, 3]], 4], "output": []}, {"inputs": [[[9, 2, 8, 5], [7, 8, 8, 8], [8, 9, 6, 1], [8, 6, 2, 2], [3, 6, 3, 1]], 9], "output": []}, {"inputs": [[[2, 2, 3, 2], [1, 3, 3, 2], [3, 2, 2, 3], [3, 1, 2, 3], [1, 2, 3, 1], [2, 2, 2, 2], [2, 1, 3, 1], [3, 2, 2, 2], [2, 1, 3, 1], [3, 3, 1, 3]], 0], "output": [0, 2, 3, 4, 5, 6, 8]}, {"inputs": [[[1, 3, 2, 3], [4, 2, 3, 3], [4, 1, 4, 4], [4, 2, 3, 1], [4, 2, 1, 1], [1, 2, 4, 1], [1, 1, 4, 2], [1, 4, 4, 3], [1, 2, 2, 3]], 2], "output": []}, {"inputs": [[[5, 4, 1, 3], [2, 5, 5, 1], [5, 3, 4, 1]], 5], "output": []}, {"inputs": [[[4, 7, 6, 7], [7, 6, 6, 4], [6, 8, 2, 3], [8, 3, 5, 8]], 4], "output": []}, {"inputs": [[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], 0], "output": [0, 1, 2, 3, 4, 5, 6]}, {"inputs": [[[3, 5, 1, 2], [3, 2, 5, 2], [4, 4, 3, 2], [3, 2, 5, 3], [1, 5, 1, 4]], 1], "output": [0, 1, 4]}, {"inputs": [[[1, 2, 1, 1], [2, 2, 2, 2], [1, 1, 1, 2], [1, 2, 2, 2]], 2], "output": []}, {"inputs": [[[3, 3, 5, 6], [8, 2, 9, 2], [1, 4, 6, 1], [6, 4, 7, 7]], 8], "output": []}, {"inputs": [[[3, 5, 4, 3], [1, 3, 3, 1], [3, 3, 5, 5], [4, 5, 5, 5], [5, 1, 4, 3], [2, 5, 3, 4]], 7], "output": []}, {"inputs": [[[9, 7, 2, 7], [9, 1, 8, 1], [9, 3, 5, 6], [6, 1, 8, 4], [9, 6, 2, 3]], 8], "output": []}, {"inputs": [[[10, 6, 8, 7], [3, 6, 1, 8]], 5], "output": []}, {"inputs": [[[4, 6, 5, 2], [2, 6, 4, 6], [4, 6, 3, 6], [2, 2, 6, 5], [6, 5, 5, 2]], 2], "output": []}, {"inputs": [[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], 1], "output": []}, {"inputs": [[[5, 6, 5, 1], [4, 3, 1, 6], [5, 4, 4, 2]], 4], "output": [1]}, {"inputs": [[[5, 1, 2, 4], [4, 5, 5, 5], [5, 9, 7, 4], [7, 9, 6, 3], [1, 8, 6, 1], [1, 1, 9, 9], [3, 7, 6, 5], [2, 6, 2, 6]], 1], "output": [0, 2, 3, 5]}, {"inputs": [[[1, 3, 2, 5], [5, 4, 1, 2], [2, 2, 3, 2], [4, 2, 5, 4], [1, 5, 4, 1], [2, 2, 5, 2], [3, 3, 2, 1], [2, 5, 4, 3], [2, 1, 5, 1]], 4], "output": []}]}} +{"id": "LeetCode/3213", "content": "# Count Subarrays Where Max Element Appears at Least K Times\n\nYou are given an integer array `nums` and a **positive** integer `k`.\n\n\nReturn *the number of subarrays where the **maximum** element of* `nums` *appears **at least*** `k` *times in that subarray.*\n\n\nA **subarray** is a contiguous sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,3,2,3,3], k = 2\n**Output:** 6\n**Explanation:** The subarrays that contain the element 3 at least 2 times are: [1,3,2,3], [1,3,2,3,3], [3,2,3], [3,2,3,3], [2,3,3] and [3,3].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,4,2,1], k = 3\n**Output:** 0\n**Explanation:** No subarray contains the element 4 at least 3 times.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 106`\n* `1 <= k <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countSubarrays(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countSubarrays(**[[1, 3, 2, 3, 3], 2]) == 6\nassert my_solution.countSubarrays(**[[1, 4, 2, 1], 3]) == 0\nassert my_solution.countSubarrays(**[[61, 23, 38, 23, 56, 40, 82, 56, 82, 82, 82, 70, 8, 69, 8, 7, 19, 14, 58, 42, 82, 10, 82, 78, 15, 82], 2]) == 224\nassert my_solution.countSubarrays(**[[37, 20, 38, 66, 34, 38, 9, 41, 1, 14, 25, 63, 8, 12, 66, 66, 60, 12, 35, 27, 16, 38, 12, 66, 38, 36, 59, 54, 66, 54, 66, 48, 59, 66, 34, 11, 50, 66, 42, 51, 53, 66, 31, 24, 66, 44, 66, 1, 66, 66, 29, 54], 5]) == 594\nassert my_solution.countSubarrays(**[[28, 5, 58, 91, 24, 91, 53, 9, 48, 85, 16, 70, 91, 91, 47, 91, 61, 4, 54, 61, 49], 1]) == 187\nassert my_solution.countSubarrays(**[[43, 105, 105, 88, 19, 82, 95, 32, 80, 37, 49, 105, 25, 105, 46, 54, 45, 84, 105, 88, 26, 20, 49, 54, 31, 105, 8, 103, 37, 32, 105, 105, 97, 27, 105, 89, 105, 47, 25, 87, 29, 105, 105, 105, 24, 105, 105, 48, 19, 91, 96, 71], 7]) == 454\nassert my_solution.countSubarrays(**[[107, 101, 180, 137, 191, 148, 83, 15, 188, 22, 100, 124, 69, 94, 191, 181, 171, 64, 136, 96, 91, 191, 107, 191, 191, 191, 107, 191, 191, 11, 140, 33, 4, 110, 83, 5, 86, 33, 42, 186, 191, 6, 42, 61, 94, 129, 191, 119, 191, 134, 43, 182, 191, 187, 63, 116, 172, 118, 50, 141, 124, 191, 125, 145, 191, 34, 191, 191], 9]) == 548\nassert my_solution.countSubarrays(**[[41, 121, 92, 15, 24, 59, 45, 110, 97, 132, 75, 72, 31, 38, 103, 37, 132, 91, 132, 132, 105, 24], 3]) == 61\nassert my_solution.countSubarrays(**[[21, 11, 13, 15, 16, 21, 8, 9, 6, 21], 2]) == 10\nassert my_solution.countSubarrays(**[[31, 18, 36, 166, 166, 166, 135, 166, 166, 12, 102], 3]) == 31\nassert my_solution.countSubarrays(**[[2, 2, 2, 2, 1, 3, 3, 2, 2, 1, 1, 3, 1, 1, 2, 3, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 3], 5]) == 31\nassert my_solution.countSubarrays(**[[3, 2, 4, 4, 3, 4, 3, 1, 1, 1, 1, 3, 2, 1, 2, 1, 3, 4, 4, 1, 2, 4, 1, 1, 2, 3, 3, 3, 4, 4, 4, 1, 3, 1, 4, 1, 4, 4, 4, 2, 2, 3, 4, 3, 3, 2, 2, 2, 1, 2, 4, 2, 2, 4, 4, 1, 3, 2, 3, 2, 4, 4, 4, 2, 3, 4, 2, 4, 1, 4, 1, 4, 1, 4, 4, 3, 4, 2, 4, 3, 3, 2, 3, 3, 2, 3, 4, 2, 1, 1, 1, 2, 3], 23]) == 473\nassert my_solution.countSubarrays(**[[1, 1, 1, 2, 3, 2, 1, 2, 3, 3, 3, 3, 2, 3, 2, 1, 1, 2, 2, 1, 3, 2, 3, 1, 2, 1, 3, 1, 1, 3, 1, 2, 1, 1, 1, 1, 1, 1, 3], 8]) == 148\nassert my_solution.countSubarrays(**[[54, 161, 161, 161, 161, 31, 74, 51, 87, 19, 161, 116, 108, 149, 6, 19, 155, 101, 161, 161, 154, 161, 78, 132, 62, 156, 112, 51, 161, 42, 92, 151, 142, 17, 110, 85], 4]) == 279\nassert my_solution.countSubarrays(**[[97, 102, 144, 55, 144, 128, 16, 93, 144, 9, 144, 15, 144, 144, 32, 68, 144, 60, 94, 56, 103, 5, 41, 27, 48, 144, 12, 86, 129, 144, 144, 99, 93, 96, 144, 73, 106, 76, 107, 144, 53, 21, 144, 144, 98, 32, 85, 97, 71, 127, 144, 9, 144, 144, 133, 125, 144, 135, 52, 144, 144, 46, 134, 23, 23, 144, 79], 1]) == 2163\nassert my_solution.countSubarrays(**[[17, 17, 15, 9, 14, 11, 15, 1, 6, 2, 1, 17, 3, 17, 11, 12, 9, 11, 2, 4, 15, 17, 3, 17, 8, 6, 7, 12, 3, 16, 2, 9, 14, 17, 17, 17, 3, 7, 8, 9, 8, 17, 17, 17, 4, 2, 12, 17, 7, 17, 17, 16, 17, 17, 8, 12, 11, 3, 10, 4, 10, 17, 14, 7, 5, 17, 12, 10, 17, 13, 5, 17, 8, 14, 9, 17, 17, 17, 7, 16, 10, 13, 17, 15, 1, 14, 6, 8, 11, 3], 15]) == 1055\nassert my_solution.countSubarrays(**[[17, 12, 16, 17, 7, 1, 12, 6, 17, 5, 17, 13, 16, 16, 17, 14, 17, 6, 17, 17, 17, 17, 16, 17, 14, 8, 14, 1, 12, 13, 17, 17, 14, 8, 14, 5, 16, 17, 17], 5]) == 404\nassert my_solution.countSubarrays(**[[98, 59, 98, 32, 45, 15, 98, 98, 98, 65, 98, 10, 98, 89, 87, 51, 42, 58, 76, 23, 85, 98, 98, 35, 18, 65, 39, 88, 56, 62, 10, 32, 8, 16, 32, 98, 6, 39, 14, 24, 98, 95, 68, 98, 77, 47, 98, 23, 69, 98, 49, 98, 7, 11, 92, 98, 27, 25, 85, 98, 45, 30, 50, 62, 46, 1, 79, 58, 69, 15, 59, 57, 85, 19, 98, 95, 98, 67, 52, 98, 59, 8, 98, 98, 98, 73, 86, 20, 98, 96, 21, 98, 79, 97, 52, 22, 98, 86], 12]) == 1168\nassert my_solution.countSubarrays(**[[6, 50, 118, 27, 133, 133, 3, 121, 133, 72, 117, 133, 91, 57, 107, 93, 66, 122, 133, 6, 133, 122, 81, 20, 133, 133, 121, 133, 46, 25, 133, 133, 133, 17, 8, 49, 133, 116, 40, 133, 67, 9, 133, 133, 133, 133, 109, 41, 127, 13, 39, 133, 133, 133, 122, 58, 8, 125, 33, 62], 12]) == 538\nassert my_solution.countSubarrays(**[[94, 34, 112, 106, 112, 13, 12, 112, 112, 21, 48, 71, 112, 104, 112, 29, 99, 58, 23, 11, 49, 112, 20, 86], 4]) == 105\n"}, "labels": {"questionId": "3213", "questionFrontendId": "2962", "questionTitle": "Count Subarrays Where Max Element Appears at Least K Times", "stats": {"totalAccepted": "5K", "totalSubmission": "10.6K", "totalAcceptedRaw": 4961, "totalSubmissionRaw": 10606, "acRate": "46.8%"}, "probedCases": [{"inputs": [[1, 3, 2, 3, 3], 2], "output": 6}, {"inputs": [[1, 4, 2, 1], 3], "output": 0}, {"inputs": [[61, 23, 38, 23, 56, 40, 82, 56, 82, 82, 82, 70, 8, 69, 8, 7, 19, 14, 58, 42, 82, 10, 82, 78, 15, 82], 2], "output": 224}, {"inputs": [[37, 20, 38, 66, 34, 38, 9, 41, 1, 14, 25, 63, 8, 12, 66, 66, 60, 12, 35, 27, 16, 38, 12, 66, 38, 36, 59, 54, 66, 54, 66, 48, 59, 66, 34, 11, 50, 66, 42, 51, 53, 66, 31, 24, 66, 44, 66, 1, 66, 66, 29, 54], 5], "output": 594}, {"inputs": [[28, 5, 58, 91, 24, 91, 53, 9, 48, 85, 16, 70, 91, 91, 47, 91, 61, 4, 54, 61, 49], 1], "output": 187}, {"inputs": [[43, 105, 105, 88, 19, 82, 95, 32, 80, 37, 49, 105, 25, 105, 46, 54, 45, 84, 105, 88, 26, 20, 49, 54, 31, 105, 8, 103, 37, 32, 105, 105, 97, 27, 105, 89, 105, 47, 25, 87, 29, 105, 105, 105, 24, 105, 105, 48, 19, 91, 96, 71], 7], "output": 454}, {"inputs": [[107, 101, 180, 137, 191, 148, 83, 15, 188, 22, 100, 124, 69, 94, 191, 181, 171, 64, 136, 96, 91, 191, 107, 191, 191, 191, 107, 191, 191, 11, 140, 33, 4, 110, 83, 5, 86, 33, 42, 186, 191, 6, 42, 61, 94, 129, 191, 119, 191, 134, 43, 182, 191, 187, 63, 116, 172, 118, 50, 141, 124, 191, 125, 145, 191, 34, 191, 191], 9], "output": 548}, {"inputs": [[41, 121, 92, 15, 24, 59, 45, 110, 97, 132, 75, 72, 31, 38, 103, 37, 132, 91, 132, 132, 105, 24], 3], "output": 61}, {"inputs": [[21, 11, 13, 15, 16, 21, 8, 9, 6, 21], 2], "output": 10}, {"inputs": [[31, 18, 36, 166, 166, 166, 135, 166, 166, 12, 102], 3], "output": 31}, {"inputs": [[2, 2, 2, 2, 1, 3, 3, 2, 2, 1, 1, 3, 1, 1, 2, 3, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 3], 5], "output": 31}, {"inputs": [[3, 2, 4, 4, 3, 4, 3, 1, 1, 1, 1, 3, 2, 1, 2, 1, 3, 4, 4, 1, 2, 4, 1, 1, 2, 3, 3, 3, 4, 4, 4, 1, 3, 1, 4, 1, 4, 4, 4, 2, 2, 3, 4, 3, 3, 2, 2, 2, 1, 2, 4, 2, 2, 4, 4, 1, 3, 2, 3, 2, 4, 4, 4, 2, 3, 4, 2, 4, 1, 4, 1, 4, 1, 4, 4, 3, 4, 2, 4, 3, 3, 2, 3, 3, 2, 3, 4, 2, 1, 1, 1, 2, 3], 23], "output": 473}, {"inputs": [[1, 1, 1, 2, 3, 2, 1, 2, 3, 3, 3, 3, 2, 3, 2, 1, 1, 2, 2, 1, 3, 2, 3, 1, 2, 1, 3, 1, 1, 3, 1, 2, 1, 1, 1, 1, 1, 1, 3], 8], "output": 148}, {"inputs": [[54, 161, 161, 161, 161, 31, 74, 51, 87, 19, 161, 116, 108, 149, 6, 19, 155, 101, 161, 161, 154, 161, 78, 132, 62, 156, 112, 51, 161, 42, 92, 151, 142, 17, 110, 85], 4], "output": 279}, {"inputs": [[97, 102, 144, 55, 144, 128, 16, 93, 144, 9, 144, 15, 144, 144, 32, 68, 144, 60, 94, 56, 103, 5, 41, 27, 48, 144, 12, 86, 129, 144, 144, 99, 93, 96, 144, 73, 106, 76, 107, 144, 53, 21, 144, 144, 98, 32, 85, 97, 71, 127, 144, 9, 144, 144, 133, 125, 144, 135, 52, 144, 144, 46, 134, 23, 23, 144, 79], 1], "output": 2163}, {"inputs": [[17, 17, 15, 9, 14, 11, 15, 1, 6, 2, 1, 17, 3, 17, 11, 12, 9, 11, 2, 4, 15, 17, 3, 17, 8, 6, 7, 12, 3, 16, 2, 9, 14, 17, 17, 17, 3, 7, 8, 9, 8, 17, 17, 17, 4, 2, 12, 17, 7, 17, 17, 16, 17, 17, 8, 12, 11, 3, 10, 4, 10, 17, 14, 7, 5, 17, 12, 10, 17, 13, 5, 17, 8, 14, 9, 17, 17, 17, 7, 16, 10, 13, 17, 15, 1, 14, 6, 8, 11, 3], 15], "output": 1055}, {"inputs": [[17, 12, 16, 17, 7, 1, 12, 6, 17, 5, 17, 13, 16, 16, 17, 14, 17, 6, 17, 17, 17, 17, 16, 17, 14, 8, 14, 1, 12, 13, 17, 17, 14, 8, 14, 5, 16, 17, 17], 5], "output": 404}, {"inputs": [[98, 59, 98, 32, 45, 15, 98, 98, 98, 65, 98, 10, 98, 89, 87, 51, 42, 58, 76, 23, 85, 98, 98, 35, 18, 65, 39, 88, 56, 62, 10, 32, 8, 16, 32, 98, 6, 39, 14, 24, 98, 95, 68, 98, 77, 47, 98, 23, 69, 98, 49, 98, 7, 11, 92, 98, 27, 25, 85, 98, 45, 30, 50, 62, 46, 1, 79, 58, 69, 15, 59, 57, 85, 19, 98, 95, 98, 67, 52, 98, 59, 8, 98, 98, 98, 73, 86, 20, 98, 96, 21, 98, 79, 97, 52, 22, 98, 86], 12], "output": 1168}, {"inputs": [[6, 50, 118, 27, 133, 133, 3, 121, 133, 72, 117, 133, 91, 57, 107, 93, 66, 122, 133, 6, 133, 122, 81, 20, 133, 133, 121, 133, 46, 25, 133, 133, 133, 17, 8, 49, 133, 116, 40, 133, 67, 9, 133, 133, 133, 133, 109, 41, 127, 13, 39, 133, 133, 133, 122, 58, 8, 125, 33, 62], 12], "output": 538}, {"inputs": [[94, 34, 112, 106, 112, 13, 12, 112, 112, 21, 48, 71, 112, 104, 112, 29, 99, 58, 23, 11, 49, 112, 20, 86], 4], "output": 105}]}} +{"id": "LeetCode/3212", "content": "# Count the Number of Good Partitions\n\nYou are given a **0-indexed** array `nums` consisting of **positive** integers.\n\n\nA partition of an array into one or more **contiguous** subarrays is called **good** if no two subarrays contain the same number.\n\n\nReturn *the **total number** of good partitions of* `nums`.\n\n\nSince the answer may be large, return it **modulo** `109 + 7`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4]\n**Output:** 8\n**Explanation:** The 8 possible good partitions are: ([1], [2], [3], [4]), ([1], [2], [3,4]), ([1], [2,3], [4]), ([1], [2,3,4]), ([1,2], [3], [4]), ([1,2], [3,4]), ([1,2,3], [4]), and ([1,2,3,4]).\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,1,1,1]\n**Output:** 1\n**Explanation:** The only possible good partition is: ([1,1,1,1]).\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,2,1,3]\n**Output:** 2\n**Explanation:** The 2 possible good partitions are: ([1,2,1], [3]) and ([1,2,1,3]).\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def numberOfGoodPartitions(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.numberOfGoodPartitions(**[[1, 2, 3, 4]]) == 8\nassert my_solution.numberOfGoodPartitions(**[[1, 1, 1, 1]]) == 1\nassert my_solution.numberOfGoodPartitions(**[[1, 2, 1, 3]]) == 2\nassert my_solution.numberOfGoodPartitions(**[[1]]) == 1\nassert my_solution.numberOfGoodPartitions(**[[100000]]) == 1\nassert my_solution.numberOfGoodPartitions(**[[1000000000]]) == 1\nassert my_solution.numberOfGoodPartitions(**[[1, 1, 1, 3, 2]]) == 4\nassert my_solution.numberOfGoodPartitions(**[[1, 1, 1, 9, 7]]) == 4\nassert my_solution.numberOfGoodPartitions(**[[1, 1, 5, 9, 2]]) == 8\nassert my_solution.numberOfGoodPartitions(**[[1, 4, 1, 7, 5]]) == 4\nassert my_solution.numberOfGoodPartitions(**[[1, 5, 1, 5, 6]]) == 2\nassert my_solution.numberOfGoodPartitions(**[[1, 5, 1, 10, 8]]) == 4\nassert my_solution.numberOfGoodPartitions(**[[1, 6, 8, 1, 5]]) == 2\nassert my_solution.numberOfGoodPartitions(**[[1, 6, 9, 4, 10]]) == 16\nassert my_solution.numberOfGoodPartitions(**[[1, 7, 1, 6, 8]]) == 4\nassert my_solution.numberOfGoodPartitions(**[[1, 9, 1, 1, 7]]) == 2\nassert my_solution.numberOfGoodPartitions(**[[2, 1, 6, 7, 5]]) == 16\nassert my_solution.numberOfGoodPartitions(**[[2, 3, 2, 6, 9]]) == 4\nassert my_solution.numberOfGoodPartitions(**[[2, 3, 2, 8, 8]]) == 2\nassert my_solution.numberOfGoodPartitions(**[[2, 3, 9, 2, 6]]) == 2\n"}, "labels": {"questionId": "3212", "questionFrontendId": "2963", "questionTitle": "Count the Number of Good Partitions", "stats": {"totalAccepted": "3.4K", "totalSubmission": "6.8K", "totalAcceptedRaw": 3378, "totalSubmissionRaw": 6754, "acRate": "50.0%"}, "probedCases": [{"inputs": [[1, 2, 3, 4]], "output": 8}, {"inputs": [[1, 1, 1, 1]], "output": 1}, {"inputs": [[1, 2, 1, 3]], "output": 2}, {"inputs": [[1]], "output": 1}, {"inputs": [[100000]], "output": 1}, {"inputs": [[1000000000]], "output": 1}, {"inputs": [[1, 1, 1, 3, 2]], "output": 4}, {"inputs": [[1, 1, 1, 9, 7]], "output": 4}, {"inputs": [[1, 1, 5, 9, 2]], "output": 8}, {"inputs": [[1, 4, 1, 7, 5]], "output": 4}, {"inputs": [[1, 5, 1, 5, 6]], "output": 2}, {"inputs": [[1, 5, 1, 10, 8]], "output": 4}, {"inputs": [[1, 6, 8, 1, 5]], "output": 2}, {"inputs": [[1, 6, 9, 4, 10]], "output": 16}, {"inputs": [[1, 7, 1, 6, 8]], "output": 4}, {"inputs": [[1, 9, 1, 1, 7]], "output": 2}, {"inputs": [[2, 1, 6, 7, 5]], "output": 16}, {"inputs": [[2, 3, 2, 6, 9]], "output": 4}, {"inputs": [[2, 3, 2, 8, 8]], "output": 2}, {"inputs": [[2, 3, 9, 2, 6]], "output": 2}]}} +{"id": "LeetCode/3206", "content": "# Find Common Elements Between Two Arrays\n\nYou are given two **0-indexed** integer arrays `nums1` and `nums2` of sizes `n` and `m`, respectively.\n\n\nConsider calculating the following values:\n\n\n* The number of indices `i` such that `0 <= i < n` and `nums1[i]` occurs **at least** once in `nums2`.\n* The number of indices `i` such that `0 <= i < m` and `nums2[i]` occurs **at least** once in `nums1`.\n\n\nReturn *an integer array* `answer` *of size* `2` *containing the two values **in the above order***.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums1 = [4,3,2,3,1], nums2 = [2,2,5,2,3,6]\n**Output:** [3,4]\n**Explanation:** We calculate the values as follows:\n- The elements at indices 1, 2, and 3 in nums1 occur at least once in nums2. So the first value is 3.\n- The elements at indices 0, 1, 3, and 4 in nums2 occur at least once in nums1. So the second value is 4.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums1 = [3,4,2,3], nums2 = [1,5]\n**Output:** [0,0]\n**Explanation:** There are no common elements between the two arrays, so the two values will be 0.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `n == nums1.length`\n* `m == nums2.length`\n* `1 <= n, m <= 100`\n* `1 <= nums1[i], nums2[i] <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findIntersectionValues(self, nums1: List[int], nums2: List[int]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findIntersectionValues(**[[4, 3, 2, 3, 1], [2, 2, 5, 2, 3, 6]]) == [3, 4]\nassert my_solution.findIntersectionValues(**[[3, 4, 2, 3], [1, 5]]) == [0, 0]\nassert my_solution.findIntersectionValues(**[[24, 28, 7, 27, 7, 27, 9, 24, 9, 10], [12, 29, 9, 7, 5]]) == [4, 2]\nassert my_solution.findIntersectionValues(**[[10, 30, 16, 18], [23, 30, 30, 6, 10, 26, 9, 27, 6, 16, 18, 10, 27, 2, 20, 7, 16]]) == [4, 7]\nassert my_solution.findIntersectionValues(**[[7, 23, 27, 20, 21, 29, 7, 27, 27, 18, 7, 6, 20, 10], [27, 27, 28, 24, 20, 4, 6, 17, 9, 29, 20, 14, 20]]) == [7, 7]\nassert my_solution.findIntersectionValues(**[[15, 30, 6, 6], [15, 4, 16, 10, 7, 23, 24, 3, 4, 6, 14, 8, 18, 1, 29, 27, 2, 17]]) == [3, 2]\nassert my_solution.findIntersectionValues(**[[24, 7, 8, 6, 22, 28, 22, 28, 7, 19], [3, 7, 28, 7, 3, 3]]) == [4, 3]\nassert my_solution.findIntersectionValues(**[[23, 4, 26, 17, 23, 13], [24, 17, 20, 16, 1, 13, 17, 28, 17]]) == [2, 4]\nassert my_solution.findIntersectionValues(**[[5, 8, 18, 27, 16, 29, 27, 12, 1, 29, 16, 27, 22, 19, 14, 12, 11, 25], [24, 8, 16]]) == [3, 2]\nassert my_solution.findIntersectionValues(**[[29, 17, 30, 17, 15, 30, 11, 2, 24, 28, 28, 30, 30, 27, 30, 2, 30, 9, 1, 7], [12, 12, 11, 21, 2, 28, 5, 24, 12, 17, 24, 29, 22, 19, 11, 17, 1, 23]]) == [10, 10]\nassert my_solution.findIntersectionValues(**[[4, 27, 12, 16, 16, 21, 26, 7, 19, 21, 24, 26, 12, 24, 22, 12, 16], [1, 25, 8, 27, 23, 27, 27, 24]]) == [3, 4]\nassert my_solution.findIntersectionValues(**[[27, 19, 20, 16, 24, 27, 27, 24], [30, 21, 21, 6, 17, 16]]) == [1, 1]\nassert my_solution.findIntersectionValues(**[[3, 19, 21, 5, 24, 26, 22, 22, 5], [23, 26, 20, 14, 30, 9, 10, 24, 19, 22, 19, 6, 3, 20, 22, 22, 5, 24, 24]]) == [8, 11]\nassert my_solution.findIntersectionValues(**[[13, 13, 29, 12], [29, 29, 13, 7, 30, 22]]) == [3, 3]\nassert my_solution.findIntersectionValues(**[[30, 4, 16, 14, 14, 14, 20, 15, 20, 30, 6, 10, 14], [30, 16, 20, 2, 18, 10, 5, 6, 30, 20, 22, 18, 14, 23, 15]]) == [12, 9]\nassert my_solution.findIntersectionValues(**[[22, 1, 22, 4, 11, 22, 4, 20, 11, 29, 11, 11, 4, 26, 20, 12, 20, 8, 26, 17], [4, 17, 7, 15]]) == [4, 2]\nassert my_solution.findIntersectionValues(**[[30, 15, 16, 15, 11, 16, 26, 15, 21], [22, 25, 27, 2, 26, 20, 18, 15, 26, 20, 16]]) == [6, 4]\nassert my_solution.findIntersectionValues(**[[5, 6], [13, 12, 8, 5, 19, 13, 27]]) == [1, 1]\nassert my_solution.findIntersectionValues(**[[27, 28, 15, 20, 5, 13, 28, 29, 24, 29, 20, 15, 5, 20, 20, 25, 9, 20, 24, 20], [16, 20, 13, 24, 11]]) == [9, 3]\nassert my_solution.findIntersectionValues(**[[25, 7, 18], [28, 1, 14, 22, 24, 8, 25, 17]]) == [1, 1]\n"}, "labels": {"questionId": "3206", "questionFrontendId": "2956", "questionTitle": "Find Common Elements Between Two Arrays", "stats": {"totalAccepted": "3.6K", "totalSubmission": "4.5K", "totalAcceptedRaw": 3641, "totalSubmissionRaw": 4520, "acRate": "80.6%"}, "probedCases": [{"inputs": [[4, 3, 2, 3, 1], [2, 2, 5, 2, 3, 6]], "output": [3, 4]}, {"inputs": [[3, 4, 2, 3], [1, 5]], "output": [0, 0]}, {"inputs": [[24, 28, 7, 27, 7, 27, 9, 24, 9, 10], [12, 29, 9, 7, 5]], "output": [4, 2]}, {"inputs": [[10, 30, 16, 18], [23, 30, 30, 6, 10, 26, 9, 27, 6, 16, 18, 10, 27, 2, 20, 7, 16]], "output": [4, 7]}, {"inputs": [[7, 23, 27, 20, 21, 29, 7, 27, 27, 18, 7, 6, 20, 10], [27, 27, 28, 24, 20, 4, 6, 17, 9, 29, 20, 14, 20]], "output": [7, 7]}, {"inputs": [[15, 30, 6, 6], [15, 4, 16, 10, 7, 23, 24, 3, 4, 6, 14, 8, 18, 1, 29, 27, 2, 17]], "output": [3, 2]}, {"inputs": [[24, 7, 8, 6, 22, 28, 22, 28, 7, 19], [3, 7, 28, 7, 3, 3]], "output": [4, 3]}, {"inputs": [[23, 4, 26, 17, 23, 13], [24, 17, 20, 16, 1, 13, 17, 28, 17]], "output": [2, 4]}, {"inputs": [[5, 8, 18, 27, 16, 29, 27, 12, 1, 29, 16, 27, 22, 19, 14, 12, 11, 25], [24, 8, 16]], "output": [3, 2]}, {"inputs": [[29, 17, 30, 17, 15, 30, 11, 2, 24, 28, 28, 30, 30, 27, 30, 2, 30, 9, 1, 7], [12, 12, 11, 21, 2, 28, 5, 24, 12, 17, 24, 29, 22, 19, 11, 17, 1, 23]], "output": [10, 10]}, {"inputs": [[4, 27, 12, 16, 16, 21, 26, 7, 19, 21, 24, 26, 12, 24, 22, 12, 16], [1, 25, 8, 27, 23, 27, 27, 24]], "output": [3, 4]}, {"inputs": [[27, 19, 20, 16, 24, 27, 27, 24], [30, 21, 21, 6, 17, 16]], "output": [1, 1]}, {"inputs": [[3, 19, 21, 5, 24, 26, 22, 22, 5], [23, 26, 20, 14, 30, 9, 10, 24, 19, 22, 19, 6, 3, 20, 22, 22, 5, 24, 24]], "output": [8, 11]}, {"inputs": [[13, 13, 29, 12], [29, 29, 13, 7, 30, 22]], "output": [3, 3]}, {"inputs": [[30, 4, 16, 14, 14, 14, 20, 15, 20, 30, 6, 10, 14], [30, 16, 20, 2, 18, 10, 5, 6, 30, 20, 22, 18, 14, 23, 15]], "output": [12, 9]}, {"inputs": [[22, 1, 22, 4, 11, 22, 4, 20, 11, 29, 11, 11, 4, 26, 20, 12, 20, 8, 26, 17], [4, 17, 7, 15]], "output": [4, 2]}, {"inputs": [[30, 15, 16, 15, 11, 16, 26, 15, 21], [22, 25, 27, 2, 26, 20, 18, 15, 26, 20, 16]], "output": [6, 4]}, {"inputs": [[5, 6], [13, 12, 8, 5, 19, 13, 27]], "output": [1, 1]}, {"inputs": [[27, 28, 15, 20, 5, 13, 28, 29, 24, 29, 20, 15, 5, 20, 20, 25, 9, 20, 24, 20], [16, 20, 13, 24, 11]], "output": [9, 3]}, {"inputs": [[25, 7, 18], [28, 1, 14, 22, 24, 8, 25, 17]], "output": [1, 1]}]}} +{"id": "LeetCode/3230", "content": "# Remove Adjacent Almost-Equal Characters\n\nYou are given a **0-indexed** string `word`.\n\n\nIn one operation, you can pick any index `i` of `word` and change `word[i]` to any lowercase English letter.\n\n\nReturn *the **minimum** number of operations needed to remove all adjacent **almost-equal** characters from* `word`.\n\n\nTwo characters `a` and `b` are **almost-equal** if `a == b` or `a` and `b` are adjacent in the alphabet.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** word = \"aaaaa\"\n**Output:** 2\n**Explanation:** We can change word into \"a**c**a**c**a\" which does not have any adjacent almost-equal characters.\nIt can be shown that the minimum number of operations needed to remove all adjacent almost-equal characters from word is 2.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** word = \"abddez\"\n**Output:** 2\n**Explanation:** We can change word into \"**y**bd**o**ez\" which does not have any adjacent almost-equal characters.\nIt can be shown that the minimum number of operations needed to remove all adjacent almost-equal characters from word is 2.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** word = \"zyxyxyz\"\n**Output:** 3\n**Explanation:** We can change word into \"z**a**x**a**x**a**z\" which does not have any adjacent almost-equal characters. \nIt can be shown that the minimum number of operations needed to remove all adjacent almost-equal characters from word is 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= word.length <= 100`\n* `word` consists only of lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def removeAlmostEqualCharacters(self, word: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.removeAlmostEqualCharacters(**['aaaaa']) == 2\nassert my_solution.removeAlmostEqualCharacters(**['abddez']) == 2\nassert my_solution.removeAlmostEqualCharacters(**['zyxyxyz']) == 3\nassert my_solution.removeAlmostEqualCharacters(**['a']) == 0\nassert my_solution.removeAlmostEqualCharacters(**['b']) == 0\nassert my_solution.removeAlmostEqualCharacters(**['c']) == 0\nassert my_solution.removeAlmostEqualCharacters(**['aa']) == 1\nassert my_solution.removeAlmostEqualCharacters(**['ab']) == 1\nassert my_solution.removeAlmostEqualCharacters(**['ac']) == 0\nassert my_solution.removeAlmostEqualCharacters(**['ba']) == 1\nassert my_solution.removeAlmostEqualCharacters(**['bb']) == 1\nassert my_solution.removeAlmostEqualCharacters(**['bc']) == 1\nassert my_solution.removeAlmostEqualCharacters(**['ca']) == 0\nassert my_solution.removeAlmostEqualCharacters(**['cb']) == 1\nassert my_solution.removeAlmostEqualCharacters(**['cc']) == 1\nassert my_solution.removeAlmostEqualCharacters(**['aaa']) == 1\nassert my_solution.removeAlmostEqualCharacters(**['aab']) == 1\nassert my_solution.removeAlmostEqualCharacters(**['aac']) == 1\nassert my_solution.removeAlmostEqualCharacters(**['aba']) == 1\nassert my_solution.removeAlmostEqualCharacters(**['abb']) == 1\n"}, "labels": {"questionId": "3230", "questionFrontendId": "2957", "questionTitle": "Remove Adjacent Almost-Equal Characters", "stats": {"totalAccepted": "3.3K", "totalSubmission": "5.6K", "totalAcceptedRaw": 3259, "totalSubmissionRaw": 5561, "acRate": "58.6%"}, "probedCases": [{"inputs": ["aaaaa"], "output": 2}, {"inputs": ["abddez"], "output": 2}, {"inputs": ["zyxyxyz"], "output": 3}, {"inputs": ["a"], "output": 0}, {"inputs": ["b"], "output": 0}, {"inputs": ["c"], "output": 0}, {"inputs": ["aa"], "output": 1}, {"inputs": ["ab"], "output": 1}, {"inputs": ["ac"], "output": 0}, {"inputs": ["ba"], "output": 1}, {"inputs": ["bb"], "output": 1}, {"inputs": ["bc"], "output": 1}, {"inputs": ["ca"], "output": 0}, {"inputs": ["cb"], "output": 1}, {"inputs": ["cc"], "output": 1}, {"inputs": ["aaa"], "output": 1}, {"inputs": ["aab"], "output": 1}, {"inputs": ["aac"], "output": 1}, {"inputs": ["aba"], "output": 1}, {"inputs": ["abb"], "output": 1}]}} +{"id": "LeetCode/3225", "content": "# Length of Longest Subarray With at Most K Frequency\n\nYou are given an integer array `nums` and an integer `k`.\n\n\nThe **frequency** of an element `x` is the number of times it occurs in an array.\n\n\nAn array is called **good** if the frequency of each element in this array is **less than or equal** to `k`.\n\n\nReturn *the length of the **longest** **good** subarray of* `nums`*.*\n\n\nA **subarray** is a contiguous non-empty sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,1,2,3,1,2], k = 2\n**Output:** 6\n**Explanation:** The longest possible good subarray is [1,2,3,1,2,3] since the values 1, 2, and 3 occur at most twice in this subarray. Note that the subarrays [2,3,1,2,3,1] and [3,1,2,3,1,2] are also good.\nIt can be shown that there are no good subarrays with length more than 6.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2,1,2,1,2,1,2], k = 1\n**Output:** 2\n**Explanation:** The longest possible good subarray is [1,2] since the values 1 and 2 occur at most once in this subarray. Note that the subarray [2,1] is also good.\nIt can be shown that there are no good subarrays with length more than 2.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [5,5,5,5,5,5,5], k = 4\n**Output:** 4\n**Explanation:** The longest possible good subarray is [5,5,5,5] since the value 5 occurs 4 times in this subarray.\nIt can be shown that there are no good subarrays with length more than 4.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n* `1 <= k <= nums.length`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxSubarrayLength(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxSubarrayLength(**[[1, 2, 3, 1, 2, 3, 1, 2], 2]) == 6\nassert my_solution.maxSubarrayLength(**[[1, 2, 1, 2, 1, 2, 1, 2], 1]) == 2\nassert my_solution.maxSubarrayLength(**[[5, 5, 5, 5, 5, 5, 5], 4]) == 4\nassert my_solution.maxSubarrayLength(**[[1], 1]) == 1\nassert my_solution.maxSubarrayLength(**[[2], 1]) == 1\nassert my_solution.maxSubarrayLength(**[[3], 1]) == 1\nassert my_solution.maxSubarrayLength(**[[4], 1]) == 1\nassert my_solution.maxSubarrayLength(**[[5], 1]) == 1\nassert my_solution.maxSubarrayLength(**[[6], 1]) == 1\nassert my_solution.maxSubarrayLength(**[[7], 1]) == 1\nassert my_solution.maxSubarrayLength(**[[8], 1]) == 1\nassert my_solution.maxSubarrayLength(**[[9], 1]) == 1\nassert my_solution.maxSubarrayLength(**[[10], 1]) == 1\nassert my_solution.maxSubarrayLength(**[[1, 11], 2]) == 2\nassert my_solution.maxSubarrayLength(**[[2, 11], 1]) == 2\nassert my_solution.maxSubarrayLength(**[[3, 5], 2]) == 2\nassert my_solution.maxSubarrayLength(**[[4, 6], 2]) == 2\nassert my_solution.maxSubarrayLength(**[[5, 8], 2]) == 2\nassert my_solution.maxSubarrayLength(**[[6, 7], 1]) == 2\nassert my_solution.maxSubarrayLength(**[[7, 9], 2]) == 2\n"}, "labels": {"questionId": "3225", "questionFrontendId": "2958", "questionTitle": "Length of Longest Subarray With at Most K Frequency", "stats": {"totalAccepted": "3.4K", "totalSubmission": "7.1K", "totalAcceptedRaw": 3372, "totalSubmissionRaw": 7115, "acRate": "47.4%"}, "probedCases": [{"inputs": [[1, 2, 3, 1, 2, 3, 1, 2], 2], "output": 6}, {"inputs": [[1, 2, 1, 2, 1, 2, 1, 2], 1], "output": 2}, {"inputs": [[5, 5, 5, 5, 5, 5, 5], 4], "output": 4}, {"inputs": [[1], 1], "output": 1}, {"inputs": [[2], 1], "output": 1}, {"inputs": [[3], 1], "output": 1}, {"inputs": [[4], 1], "output": 1}, {"inputs": [[5], 1], "output": 1}, {"inputs": [[6], 1], "output": 1}, {"inputs": [[7], 1], "output": 1}, {"inputs": [[8], 1], "output": 1}, {"inputs": [[9], 1], "output": 1}, {"inputs": [[10], 1], "output": 1}, {"inputs": [[1, 11], 2], "output": 2}, {"inputs": [[2, 11], 1], "output": 2}, {"inputs": [[3, 5], 2], "output": 2}, {"inputs": [[4, 6], 2], "output": 2}, {"inputs": [[5, 8], 2], "output": 2}, {"inputs": [[6, 7], 1], "output": 2}, {"inputs": [[7, 9], 2], "output": 2}]}} +{"id": "LeetCode/3221", "content": "# Find the Peaks\n\nYou are given a **0-indexed** array `mountain`. Your task is to find all the **peaks** in the `mountain` array.\n\n\nReturn *an array that consists of* indices *of **peaks** in the given array in **any order**.*\n\n\n**Notes:**\n\n\n* A **peak** is defined as an element that is **strictly greater** than its neighboring elements.\n* The first and last elements of the array are **not** a peak.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** mountain = [2,4,4]\n**Output:** []\n**Explanation:** mountain[0] and mountain[2] can not be a peak because they are first and last elements of the array.\nmountain[1] also can not be a peak because it is not strictly greater than mountain[2].\nSo the answer is [].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** mountain = [1,4,3,8,5]\n**Output:** [1,3]\n**Explanation:** mountain[0] and mountain[4] can not be a peak because they are first and last elements of the array.\nmountain[2] also can not be a peak because it is not strictly greater than mountain[3] and mountain[1].\nBut mountain [1] and mountain[3] are strictly greater than their neighboring elements.\nSo the answer is [1,3].\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `3 <= mountain.length <= 100`\n* `1 <= mountain[i] <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findPeaks(self, mountain: List[int]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findPeaks(**[[2, 4, 4]]) == []\nassert my_solution.findPeaks(**[[1, 4, 3, 8, 5]]) == [1, 3]\nassert my_solution.findPeaks(**[[1, 1, 1]]) == []\nassert my_solution.findPeaks(**[[1, 1, 3]]) == []\nassert my_solution.findPeaks(**[[1, 1, 5]]) == []\nassert my_solution.findPeaks(**[[1, 2, 5]]) == []\nassert my_solution.findPeaks(**[[1, 4, 1]]) == [1]\nassert my_solution.findPeaks(**[[1, 4, 3]]) == [1]\nassert my_solution.findPeaks(**[[1, 5, 5]]) == []\nassert my_solution.findPeaks(**[[1, 6, 4]]) == [1]\nassert my_solution.findPeaks(**[[2, 1, 1]]) == []\nassert my_solution.findPeaks(**[[2, 1, 2]]) == []\nassert my_solution.findPeaks(**[[2, 2, 3]]) == []\nassert my_solution.findPeaks(**[[2, 2, 5]]) == []\nassert my_solution.findPeaks(**[[2, 3, 2]]) == [1]\nassert my_solution.findPeaks(**[[2, 3, 6]]) == []\nassert my_solution.findPeaks(**[[2, 4, 3]]) == [1]\nassert my_solution.findPeaks(**[[2, 4, 5]]) == []\nassert my_solution.findPeaks(**[[2, 6, 4]]) == [1]\nassert my_solution.findPeaks(**[[3, 3, 3]]) == []\n"}, "labels": {"questionId": "3221", "questionFrontendId": "2951", "questionTitle": "Find the Peaks", "stats": {"totalAccepted": "6.3K", "totalSubmission": "8K", "totalAcceptedRaw": 6316, "totalSubmissionRaw": 8009, "acRate": "78.9%"}, "probedCases": [{"inputs": [[2, 4, 4]], "output": []}, {"inputs": [[1, 4, 3, 8, 5]], "output": [1, 3]}, {"inputs": [[1, 1, 1]], "output": []}, {"inputs": [[1, 1, 3]], "output": []}, {"inputs": [[1, 1, 5]], "output": []}, {"inputs": [[1, 2, 5]], "output": []}, {"inputs": [[1, 4, 1]], "output": [1]}, {"inputs": [[1, 4, 3]], "output": [1]}, {"inputs": [[1, 5, 5]], "output": []}, {"inputs": [[1, 6, 4]], "output": [1]}, {"inputs": [[2, 1, 1]], "output": []}, {"inputs": [[2, 1, 2]], "output": []}, {"inputs": [[2, 2, 3]], "output": []}, {"inputs": [[2, 2, 5]], "output": []}, {"inputs": [[2, 3, 2]], "output": [1]}, {"inputs": [[2, 3, 6]], "output": []}, {"inputs": [[2, 4, 3]], "output": [1]}, {"inputs": [[2, 4, 5]], "output": []}, {"inputs": [[2, 6, 4]], "output": [1]}, {"inputs": [[3, 3, 3]], "output": []}]}} +{"id": "LeetCode/3231", "content": "# Minimum Number of Coins to be Added\n\nYou are given a **0-indexed** integer array `coins`, representing the values of the coins available, and an integer `target`.\n\n\nAn integer `x` is **obtainable** if there exists a subsequence of `coins` that sums to `x`.\n\n\nReturn *the **minimum** number of coins **of any value** that need to be added to the array so that every integer in the range* `[1, target]` *is **obtainable***.\n\n\nA **subsequence** of an array is a new **non-empty** array that is formed from the original array by deleting some (**possibly none**) of the elements without disturbing the relative positions of the remaining elements.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** coins = [1,4,10], target = 19\n**Output:** 2\n**Explanation:** We need to add coins 2 and 8. The resulting array will be [1,2,4,8,10].\nIt can be shown that all integers from 1 to 19 are obtainable from the resulting array, and that 2 is the minimum number of coins that need to be added to the array. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** coins = [1,4,10,5,7,19], target = 19\n**Output:** 1\n**Explanation:** We only need to add the coin 2. The resulting array will be [1,2,4,5,7,10,19].\nIt can be shown that all integers from 1 to 19 are obtainable from the resulting array, and that 1 is the minimum number of coins that need to be added to the array. \n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** coins = [1,1,1], target = 20\n**Output:** 3\n**Explanation:** We need to add coins 4, 8, and 16. The resulting array will be [1,1,1,4,8,16].\nIt can be shown that all integers from 1 to 20 are obtainable from the resulting array, and that 3 is the minimum number of coins that need to be added to the array.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= target <= 105`\n* `1 <= coins.length <= 105`\n* `1 <= coins[i] <= target`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumAddedCoins(self, coins: List[int], target: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumAddedCoins(**[[1, 4, 10], 19]) == 2\nassert my_solution.minimumAddedCoins(**[[1, 4, 10, 5, 7, 19], 19]) == 1\nassert my_solution.minimumAddedCoins(**[[1, 1, 1], 20]) == 3\nassert my_solution.minimumAddedCoins(**[[1], 100000]) == 16\nassert my_solution.minimumAddedCoins(**[[100000], 100000]) == 17\nassert my_solution.minimumAddedCoins(**[[2], 5]) == 2\nassert my_solution.minimumAddedCoins(**[[5, 6, 7], 10]) == 3\nassert my_solution.minimumAddedCoins(**[[5, 6, 7], 15]) == 3\nassert my_solution.minimumAddedCoins(**[[4, 11, 13, 15, 7, 5, 12, 11, 5, 9], 34]) == 2\nassert my_solution.minimumAddedCoins(**[[8, 12, 9], 27]) == 3\nassert my_solution.minimumAddedCoins(**[[2, 13, 7, 1, 11], 35]) == 1\nassert my_solution.minimumAddedCoins(**[[10, 3, 5, 11, 6], 27]) == 2\nassert my_solution.minimumAddedCoins(**[[6, 6, 6, 15, 4], 31]) == 2\nassert my_solution.minimumAddedCoins(**[[6, 15, 6], 22]) == 3\nassert my_solution.minimumAddedCoins(**[[8, 14, 15, 4, 14, 15, 8, 10, 8], 42]) == 2\nassert my_solution.minimumAddedCoins(**[[9, 14, 14, 9, 14, 5, 12, 10, 11], 17]) == 3\nassert my_solution.minimumAddedCoins(**[[14, 5, 13, 3, 7, 10, 10, 10], 32]) == 2\nassert my_solution.minimumAddedCoins(**[[8, 6, 7, 12], 26]) == 3\nassert my_solution.minimumAddedCoins(**[[15, 1, 12], 43]) == 4\nassert my_solution.minimumAddedCoins(**[[4, 1, 4, 10], 16]) == 1\n"}, "labels": {"questionId": "3231", "questionFrontendId": "2952", "questionTitle": "Minimum Number of Coins to be Added", "stats": {"totalAccepted": "4.1K", "totalSubmission": "8.2K", "totalAcceptedRaw": 4143, "totalSubmissionRaw": 8235, "acRate": "50.3%"}, "probedCases": [{"inputs": [[1, 4, 10], 19], "output": 2}, {"inputs": [[1, 4, 10, 5, 7, 19], 19], "output": 1}, {"inputs": [[1, 1, 1], 20], "output": 3}, {"inputs": [[1], 100000], "output": 16}, {"inputs": [[100000], 100000], "output": 17}, {"inputs": [[2], 5], "output": 2}, {"inputs": [[5, 6, 7], 10], "output": 3}, {"inputs": [[5, 6, 7], 15], "output": 3}, {"inputs": [[4, 11, 13, 15, 7, 5, 12, 11, 5, 9], 34], "output": 2}, {"inputs": [[8, 12, 9], 27], "output": 3}, {"inputs": [[2, 13, 7, 1, 11], 35], "output": 1}, {"inputs": [[10, 3, 5, 11, 6], 27], "output": 2}, {"inputs": [[6, 6, 6, 15, 4], 31], "output": 2}, {"inputs": [[6, 15, 6], 22], "output": 3}, {"inputs": [[8, 14, 15, 4, 14, 15, 8, 10, 8], 42], "output": 2}, {"inputs": [[9, 14, 14, 9, 14, 5, 12, 10, 11], 17], "output": 3}, {"inputs": [[14, 5, 13, 3, 7, 10, 10, 10], 32], "output": 2}, {"inputs": [[8, 6, 7, 12], 26], "output": 3}, {"inputs": [[15, 1, 12], 43], "output": 4}, {"inputs": [[4, 1, 4, 10], 16], "output": 1}]}} +{"id": "LeetCode/3223", "content": "# Count Complete Substrings\n\nYou are given a string `word` and an integer `k`.\n\n\nA substring `s` of `word` is **complete** if:\n\n\n* Each character in `s` occurs **exactly** `k` times.\n* The difference between two adjacent characters is **at most** `2`. That is, for any two adjacent characters `c1` and `c2` in `s`, the absolute difference in their positions in the alphabet is **at most** `2`.\n\n\nReturn *the number of **complete** substrings of* `word`.\n\n\nA **substring** is a **non-empty** contiguous sequence of characters in a string.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** word = \"igigee\", k = 2\n**Output:** 3\n**Explanation:** The complete substrings where each character appears exactly twice and the difference between adjacent characters is at most 2 are: **igig**ee, igig**ee**, **igigee**.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** word = \"aaabbbccc\", k = 3\n**Output:** 6\n**Explanation:** The complete substrings where each character appears exactly three times and the difference between adjacent characters is at most 2 are: **aaa**bbbccc, aaa**bbb**ccc, aaabbb**ccc**, **aaabbb**ccc, aaa**bbbccc**, **aaabbbccc**.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= word.length <= 105`\n* `word` consists only of lowercase English letters.\n* `1 <= k <= word.length`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countCompleteSubstrings(self, word: str, k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countCompleteSubstrings(**['igigee', 2]) == 3\nassert my_solution.countCompleteSubstrings(**['aaabbbccc', 3]) == 6\nassert my_solution.countCompleteSubstrings(**['a', 1]) == 1\nassert my_solution.countCompleteSubstrings(**['b', 1]) == 1\nassert my_solution.countCompleteSubstrings(**['c', 1]) == 1\nassert my_solution.countCompleteSubstrings(**['aa', 2]) == 1\nassert my_solution.countCompleteSubstrings(**['ab', 2]) == 0\nassert my_solution.countCompleteSubstrings(**['ac', 2]) == 0\nassert my_solution.countCompleteSubstrings(**['ba', 1]) == 3\nassert my_solution.countCompleteSubstrings(**['bb', 2]) == 1\nassert my_solution.countCompleteSubstrings(**['bc', 1]) == 3\nassert my_solution.countCompleteSubstrings(**['ca', 1]) == 3\nassert my_solution.countCompleteSubstrings(**['cb', 1]) == 3\nassert my_solution.countCompleteSubstrings(**['cc', 2]) == 1\nassert my_solution.countCompleteSubstrings(**['aaa', 1]) == 3\nassert my_solution.countCompleteSubstrings(**['aab', 3]) == 0\nassert my_solution.countCompleteSubstrings(**['aac', 2]) == 1\nassert my_solution.countCompleteSubstrings(**['aba', 3]) == 0\nassert my_solution.countCompleteSubstrings(**['abb', 1]) == 4\nassert my_solution.countCompleteSubstrings(**['abc', 3]) == 0\n"}, "labels": {"questionId": "3223", "questionFrontendId": "2953", "questionTitle": "Count Complete Substrings", "stats": {"totalAccepted": "3.4K", "totalSubmission": "10.2K", "totalAcceptedRaw": 3433, "totalSubmissionRaw": 10180, "acRate": "33.7%"}, "probedCases": [{"inputs": ["igigee", 2], "output": 3}, {"inputs": ["aaabbbccc", 3], "output": 6}, {"inputs": ["a", 1], "output": 1}, {"inputs": ["b", 1], "output": 1}, {"inputs": ["c", 1], "output": 1}, {"inputs": ["aa", 2], "output": 1}, {"inputs": ["ab", 2], "output": 0}, {"inputs": ["ac", 2], "output": 0}, {"inputs": ["ba", 1], "output": 3}, {"inputs": ["bb", 2], "output": 1}, {"inputs": ["bc", 1], "output": 3}, {"inputs": ["ca", 1], "output": 3}, {"inputs": ["cb", 1], "output": 3}, {"inputs": ["cc", 2], "output": 1}, {"inputs": ["aaa", 1], "output": 3}, {"inputs": ["aab", 3], "output": 0}, {"inputs": ["aac", 2], "output": 1}, {"inputs": ["aba", 3], "output": 0}, {"inputs": ["abb", 1], "output": 4}, {"inputs": ["abc", 3], "output": 0}]}} +{"id": "LeetCode/3224", "content": "# Count the Number of Infection Sequences\n\nYou are given an integer `n` and a **0-indexed**integer array `sick` which is **sorted** in **increasing** order.\n\n\nThere are `n` children standing in a queue with positions `0` to `n - 1` assigned to them. The array `sick` contains the positions of the children who are infected with an infectious disease. An infected child at position `i` can spread the disease to either of its immediate neighboring children at positions `i - 1` and `i + 1` **if** they exist and are currently not infected. **At most one** child who was previously not infected can get infected with the disease in one second.\n\n\nIt can be shown that after a finite number of seconds, all the children in the queue will get infected with the disease. An **infection sequence** is the sequential order of positions in which **all** of the non-infected children get infected with the disease. Return *the total number of possible infection sequences*.\n\n\nSince the answer may be large, return it modulo `109 + 7`.\n\n\n**Note** that an infection sequence **does not** contain positions of children who were already infected with the disease in the beginning.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 5, sick = [0,4]\n**Output:** 4\n**Explanation:** Children at positions 1, 2, and 3 are not infected in the beginning. There are 4 possible infection sequences:\n- The children at positions 1 and 3 can get infected since their positions are adjacent to the infected children 0 and 4. The child at position 1 gets infected first.\nNow, the child at position 2 is adjacent to the child at position 1 who is infected and the child at position 3 is adjacent to the child at position 4 who is infected, hence either of them can get infected. The child at position 2 gets infected.\nFinally, the child at position 3 gets infected because it is adjacent to children at positions 2 and 4 who are infected. The infection sequence is [1,2,3].\n- The children at positions 1 and 3 can get infected because their positions are adjacent to the infected children 0 and 4. The child at position 1 gets infected first.\nNow, the child at position 2 is adjacent to the child at position 1 who is infected and the child at position 3 is adjacent to the child at position 4 who is infected, hence either of them can get infected. The child at position 3 gets infected.\nFinally, the child at position 2 gets infected because it is adjacent to children at positions 1 and 3 who are infected. The infection sequence is [1,3,2].\n- The infection sequence is [3,1,2]. The order of infection of disease in the children can be seen as: [0,1,2,3,4] => [0,1,2,3,4] => [0,1,2,3,4] => [0,1,2,3,4].\n- The infection sequence is [3,2,1]. The order of infection of disease in the children can be seen as: [0,1,2,3,4] => [0,1,2,3,4] => [0,1,2,3,4] => [0,1,2,3,4].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 4, sick = [1]\n**Output:** 3\n**Explanation:** Children at positions 0, 2, and 3 are not infected in the beginning. There are 3 possible infection sequences:\n- The infection sequence is [0,2,3]. The order of infection of disease in the children can be seen as: [0,1,2,3] => [0,1,2,3] => [0,1,2,3] => [0,1,2,3].\n- The infection sequence is [2,0,3]. The order of infection of disease in the children can be seen as: [0,1,2,3] => [0,1,2,3] => [0,1,2,3] => [0,1,2,3].\n- The infection sequence is [2,3,0]. The order of infection of disease in the children can be seen as: [0,1,2,3] => [0,1,2,3] => [0,1,2,3] => [0,1,2,3].\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= n <= 105`\n* `1 <= sick.length <= n - 1`\n* `0 <= sick[i] <= n - 1`\n* `sick` is sorted in increasing order.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def numberOfSequence(self, n: int, sick: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.numberOfSequence(**[5, [0, 4]]) == 4\nassert my_solution.numberOfSequence(**[4, [1]]) == 3\nassert my_solution.numberOfSequence(**[2, [0]]) == 1\nassert my_solution.numberOfSequence(**[5, [0]]) == 1\nassert my_solution.numberOfSequence(**[100, [0]]) == 1\nassert my_solution.numberOfSequence(**[2, [1]]) == 1\nassert my_solution.numberOfSequence(**[5, [1]]) == 4\nassert my_solution.numberOfSequence(**[5, [2]]) == 6\nassert my_solution.numberOfSequence(**[5, [3]]) == 4\nassert my_solution.numberOfSequence(**[5, [4]]) == 1\nassert my_solution.numberOfSequence(**[5, [0, 1]]) == 1\nassert my_solution.numberOfSequence(**[3, [0, 2]]) == 1\nassert my_solution.numberOfSequence(**[5, [0, 2]]) == 3\nassert my_solution.numberOfSequence(**[5, [0, 3]]) == 6\nassert my_solution.numberOfSequence(**[5, [1, 2]]) == 3\nassert my_solution.numberOfSequence(**[5, [1, 3]]) == 6\nassert my_solution.numberOfSequence(**[5, [1, 4]]) == 6\nassert my_solution.numberOfSequence(**[5, [2, 3]]) == 3\nassert my_solution.numberOfSequence(**[5, [2, 4]]) == 3\nassert my_solution.numberOfSequence(**[5, [3, 4]]) == 1\n"}, "labels": {"questionId": "3224", "questionFrontendId": "2954", "questionTitle": "Count the Number of Infection Sequences", "stats": {"totalAccepted": "1.3K", "totalSubmission": "3.3K", "totalAcceptedRaw": 1335, "totalSubmissionRaw": 3325, "acRate": "40.2%"}, "probedCases": [{"inputs": [5, [0, 4]], "output": 4}, {"inputs": [4, [1]], "output": 3}, {"inputs": [2, [0]], "output": 1}, {"inputs": [5, [0]], "output": 1}, {"inputs": [100, [0]], "output": 1}, {"inputs": [2, [1]], "output": 1}, {"inputs": [5, [1]], "output": 4}, {"inputs": [5, [2]], "output": 6}, {"inputs": [5, [3]], "output": 4}, {"inputs": [5, [4]], "output": 1}, {"inputs": [5, [0, 1]], "output": 1}, {"inputs": [3, [0, 2]], "output": 1}, {"inputs": [5, [0, 2]], "output": 3}, {"inputs": [5, [0, 3]], "output": 6}, {"inputs": [5, [1, 2]], "output": 3}, {"inputs": [5, [1, 3]], "output": 6}, {"inputs": [5, [1, 4]], "output": 6}, {"inputs": [5, [2, 3]], "output": 3}, {"inputs": [5, [2, 4]], "output": 3}, {"inputs": [5, [3, 4]], "output": 1}]}} +{"id": "LeetCode/3210", "content": "# Count Beautiful Substrings I\n\nYou are given a string `s` and a positive integer `k`.\n\n\nLet `vowels` and `consonants` be the number of vowels and consonants in a string.\n\n\nA string is **beautiful** if:\n\n\n* `vowels == consonants`.\n* `(vowels * consonants) % k == 0`, in other terms the multiplication of `vowels` and `consonants` is divisible by `k`.\n\n\nReturn *the number of **non-empty beautiful substrings** in the given string* `s`.\n\n\nA **substring** is a contiguous sequence of characters in a string.\n\n\n**Vowel letters** in English are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`.\n\n\n**Consonant letters** in English are every letter except vowels.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"baeyh\", k = 2\n**Output:** 2\n**Explanation:** There are 2 beautiful substrings in the given string.\n- Substring \"baeyh\", vowels = 2 ([\"a\",e\"]), consonants = 2 ([\"y\",\"h\"]).\nYou can see that string \"aeyh\" is beautiful as vowels == consonants and vowels * consonants % k == 0.\n- Substring \"baeyh\", vowels = 2 ([\"a\",e\"]), consonants = 2 ([\"b\",\"y\"]). \nYou can see that string \"baey\" is beautiful as vowels == consonants and vowels * consonants % k == 0.\nIt can be shown that there are only 2 beautiful substrings in the given string.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"abba\", k = 1\n**Output:** 3\n**Explanation:** There are 3 beautiful substrings in the given string.\n- Substring \"abba\", vowels = 1 ([\"a\"]), consonants = 1 ([\"b\"]). \n- Substring \"abba\", vowels = 1 ([\"a\"]), consonants = 1 ([\"b\"]).\n- Substring \"abba\", vowels = 2 ([\"a\",\"a\"]), consonants = 2 ([\"b\",\"b\"]).\nIt can be shown that there are only 3 beautiful substrings in the given string.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"bcdf\", k = 1\n**Output:** 0\n**Explanation:** There are no beautiful substrings in the given string.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 1000`\n* `1 <= k <= 1000`\n* `s` consists of only English lowercase letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def beautifulSubstrings(self, s: str, k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.beautifulSubstrings(**['baeyh', 2]) == 2\nassert my_solution.beautifulSubstrings(**['abba', 1]) == 3\nassert my_solution.beautifulSubstrings(**['bcdf', 1]) == 0\nassert my_solution.beautifulSubstrings(**['ihroyeeb', 5]) == 0\nassert my_solution.beautifulSubstrings(**['uzuxpzou', 3]) == 1\nassert my_solution.beautifulSubstrings(**['ouuoeqd', 2]) == 1\nassert my_solution.beautifulSubstrings(**['eeebjoxxujuaeoqibd', 8]) == 4\nassert my_solution.beautifulSubstrings(**['ilougekqlovegioemdvu', 4]) == 21\nassert my_solution.beautifulSubstrings(**['tqaewreikaztwpfwnef', 8]) == 3\nassert my_solution.beautifulSubstrings(**['oykiuhsafgfjumnzb', 7]) == 0\nassert my_solution.beautifulSubstrings(**['ifvsa', 3]) == 0\nassert my_solution.beautifulSubstrings(**['svzauyuevujektj', 5]) == 3\nassert my_solution.beautifulSubstrings(**['urahjig', 2]) == 2\nassert my_solution.beautifulSubstrings(**['ime', 2]) == 0\nassert my_solution.beautifulSubstrings(**['oacghieut', 5]) == 0\nassert my_solution.beautifulSubstrings(**['aoluu', 3]) == 0\nassert my_solution.beautifulSubstrings(**['ioaoiciiuoziout', 1]) == 5\nassert my_solution.beautifulSubstrings(**['ouafupsuhid', 6]) == 0\nassert my_solution.beautifulSubstrings(**['ox', 2]) == 0\nassert my_solution.beautifulSubstrings(**['tlaiwoauazutusiaaui', 10]) == 0\n"}, "labels": {"questionId": "3210", "questionFrontendId": "2947", "questionTitle": "Count Beautiful Substrings I", "stats": {"totalAccepted": "4.2K", "totalSubmission": "7.1K", "totalAcceptedRaw": 4176, "totalSubmissionRaw": 7130, "acRate": "58.6%"}, "probedCases": [{"inputs": ["baeyh", 2], "output": 2}, {"inputs": ["abba", 1], "output": 3}, {"inputs": ["bcdf", 1], "output": 0}, {"inputs": ["ihroyeeb", 5], "output": 0}, {"inputs": ["uzuxpzou", 3], "output": 1}, {"inputs": ["ouuoeqd", 2], "output": 1}, {"inputs": ["eeebjoxxujuaeoqibd", 8], "output": 4}, {"inputs": ["ilougekqlovegioemdvu", 4], "output": 21}, {"inputs": ["tqaewreikaztwpfwnef", 8], "output": 3}, {"inputs": ["oykiuhsafgfjumnzb", 7], "output": 0}, {"inputs": ["ifvsa", 3], "output": 0}, {"inputs": ["svzauyuevujektj", 5], "output": 3}, {"inputs": ["urahjig", 2], "output": 2}, {"inputs": ["ime", 2], "output": 0}, {"inputs": ["oacghieut", 5], "output": 0}, {"inputs": ["aoluu", 3], "output": 0}, {"inputs": ["ioaoiciiuoziout", 1], "output": 5}, {"inputs": ["ouafupsuhid", 6], "output": 0}, {"inputs": ["ox", 2], "output": 0}, {"inputs": ["tlaiwoauazutusiaaui", 10], "output": 0}]}} +{"id": "LeetCode/3219", "content": "# Make Lexicographically Smallest Array by Swapping Elements\n\nYou are given a **0-indexed** array of **positive** integers `nums` and a **positive** integer `limit`.\n\n\nIn one operation, you can choose any two indices `i` and `j` and swap `nums[i]` and `nums[j]` **if** `|nums[i] - nums[j]| <= limit`.\n\n\nReturn *the **lexicographically smallest array** that can be obtained by performing the operation any number of times*.\n\n\nAn array `a` is lexicographically smaller than an array `b` if in the first position where `a` and `b` differ, array `a` has an element that is less than the corresponding element in `b`. For example, the array `[2,10,3]` is lexicographically smaller than the array `[10,2,3]` because they differ at index `0` and `2 < 10`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,5,3,9,8], limit = 2\n**Output:** [1,3,5,8,9]\n**Explanation:** Apply the operation 2 times:\n- Swap nums[1] with nums[2]. The array becomes [1,3,5,9,8]\n- Swap nums[3] with nums[4]. The array becomes [1,3,5,8,9]\nWe cannot obtain a lexicographically smaller array by applying any more operations.\nNote that it may be possible to get the same result by doing different operations.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,7,6,18,2,1], limit = 3\n**Output:** [1,6,7,18,1,2]\n**Explanation:** Apply the operation 3 times:\n- Swap nums[1] with nums[2]. The array becomes [1,6,7,18,2,1]\n- Swap nums[0] with nums[4]. The array becomes [2,6,7,18,1,1]\n- Swap nums[0] with nums[5]. The array becomes [1,6,7,18,1,2]\nWe cannot obtain a lexicographically smaller array by applying any more operations.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,7,28,19,10], limit = 3\n**Output:** [1,7,28,19,10]\n**Explanation:** [1,7,28,19,10] is the lexicographically smallest array we can obtain because we cannot apply the operation on any two indices.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n* `1 <= limit <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def lexicographicallySmallestArray(self, nums: List[int], limit: int) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.lexicographicallySmallestArray(**[[1, 5, 3, 9, 8], 2]) == [1, 3, 5, 8, 9]\nassert my_solution.lexicographicallySmallestArray(**[[1, 7, 6, 18, 2, 1], 3]) == [1, 6, 7, 18, 1, 2]\nassert my_solution.lexicographicallySmallestArray(**[[1, 7, 28, 19, 10], 3]) == [1, 7, 28, 19, 10]\nassert my_solution.lexicographicallySmallestArray(**[[1000000000], 1]) == [1000000000]\nassert my_solution.lexicographicallySmallestArray(**[[1, 60, 34, 84, 62, 56, 39, 76, 49, 38], 4]) == [1, 56, 34, 84, 60, 62, 38, 76, 49, 39]\nassert my_solution.lexicographicallySmallestArray(**[[1, 81, 10, 79, 36, 2, 87, 12, 20, 77], 7]) == [1, 77, 10, 79, 36, 2, 81, 12, 20, 87]\nassert my_solution.lexicographicallySmallestArray(**[[2, 71, 5, 87, 11, 15, 70, 70, 14, 38], 14]) == [2, 70, 5, 87, 11, 14, 70, 71, 15, 38]\nassert my_solution.lexicographicallySmallestArray(**[[4, 3, 23, 84, 34, 88, 44, 44, 18, 15], 3]) == [3, 4, 23, 84, 34, 88, 44, 44, 15, 18]\nassert my_solution.lexicographicallySmallestArray(**[[4, 34, 29, 73, 51, 11, 8, 53, 98, 47], 10]) == [4, 29, 34, 73, 47, 8, 11, 51, 98, 53]\nassert my_solution.lexicographicallySmallestArray(**[[4, 52, 38, 59, 71, 27, 31, 83, 88, 10], 14]) == [4, 27, 31, 38, 52, 59, 71, 83, 88, 10]\nassert my_solution.lexicographicallySmallestArray(**[[4, 68, 8, 10, 70, 62, 27, 5, 42, 61], 11]) == [4, 61, 5, 8, 62, 68, 27, 10, 42, 70]\nassert my_solution.lexicographicallySmallestArray(**[[5, 9, 35, 60, 73, 91, 61, 57, 87, 76], 11]) == [5, 9, 35, 57, 73, 76, 60, 61, 87, 91]\nassert my_solution.lexicographicallySmallestArray(**[[5, 15, 68, 47, 49, 67, 9, 6, 35, 14], 4]) == [5, 14, 67, 47, 49, 68, 6, 9, 35, 15]\nassert my_solution.lexicographicallySmallestArray(**[[5, 16, 43, 15, 66, 21, 58, 74, 55, 66], 9]) == [5, 15, 43, 16, 55, 21, 58, 66, 66, 74]\nassert my_solution.lexicographicallySmallestArray(**[[5, 30, 92, 4, 31, 2, 17, 39, 15, 7], 3]) == [2, 30, 92, 4, 31, 5, 15, 39, 17, 7]\nassert my_solution.lexicographicallySmallestArray(**[[5, 38, 68, 80, 64, 79, 50, 5, 8, 95], 7]) == [5, 38, 64, 79, 68, 80, 50, 5, 8, 95]\nassert my_solution.lexicographicallySmallestArray(**[[5, 100, 44, 45, 16, 30, 14, 65, 83, 64], 15]) == [5, 100, 14, 16, 30, 44, 45, 64, 83, 65]\nassert my_solution.lexicographicallySmallestArray(**[[6, 57, 100, 67, 4, 63, 47, 59, 21, 66], 8]) == [4, 57, 100, 59, 6, 63, 47, 66, 21, 67]\nassert my_solution.lexicographicallySmallestArray(**[[6, 70, 90, 1, 33, 81, 60, 80, 68, 44], 7]) == [1, 68, 90, 6, 33, 80, 60, 81, 70, 44]\nassert my_solution.lexicographicallySmallestArray(**[[6, 74, 74, 74, 30, 70, 91, 74, 76, 41], 1]) == [6, 74, 74, 74, 30, 70, 91, 74, 76, 41]\n"}, "labels": {"questionId": "3219", "questionFrontendId": "2948", "questionTitle": "Make Lexicographically Smallest Array by Swapping Elements", "stats": {"totalAccepted": "3.2K", "totalSubmission": "7.4K", "totalAcceptedRaw": 3223, "totalSubmissionRaw": 7361, "acRate": "43.8%"}, "probedCases": [{"inputs": [[1, 5, 3, 9, 8], 2], "output": [1, 3, 5, 8, 9]}, {"inputs": [[1, 7, 6, 18, 2, 1], 3], "output": [1, 6, 7, 18, 1, 2]}, {"inputs": [[1, 7, 28, 19, 10], 3], "output": [1, 7, 28, 19, 10]}, {"inputs": [[1000000000], 1], "output": [1000000000]}, {"inputs": [[1, 60, 34, 84, 62, 56, 39, 76, 49, 38], 4], "output": [1, 56, 34, 84, 60, 62, 38, 76, 49, 39]}, {"inputs": [[1, 81, 10, 79, 36, 2, 87, 12, 20, 77], 7], "output": [1, 77, 10, 79, 36, 2, 81, 12, 20, 87]}, {"inputs": [[2, 71, 5, 87, 11, 15, 70, 70, 14, 38], 14], "output": [2, 70, 5, 87, 11, 14, 70, 71, 15, 38]}, {"inputs": [[4, 3, 23, 84, 34, 88, 44, 44, 18, 15], 3], "output": [3, 4, 23, 84, 34, 88, 44, 44, 15, 18]}, {"inputs": [[4, 34, 29, 73, 51, 11, 8, 53, 98, 47], 10], "output": [4, 29, 34, 73, 47, 8, 11, 51, 98, 53]}, {"inputs": [[4, 52, 38, 59, 71, 27, 31, 83, 88, 10], 14], "output": [4, 27, 31, 38, 52, 59, 71, 83, 88, 10]}, {"inputs": [[4, 68, 8, 10, 70, 62, 27, 5, 42, 61], 11], "output": [4, 61, 5, 8, 62, 68, 27, 10, 42, 70]}, {"inputs": [[5, 9, 35, 60, 73, 91, 61, 57, 87, 76], 11], "output": [5, 9, 35, 57, 73, 76, 60, 61, 87, 91]}, {"inputs": [[5, 15, 68, 47, 49, 67, 9, 6, 35, 14], 4], "output": [5, 14, 67, 47, 49, 68, 6, 9, 35, 15]}, {"inputs": [[5, 16, 43, 15, 66, 21, 58, 74, 55, 66], 9], "output": [5, 15, 43, 16, 55, 21, 58, 66, 66, 74]}, {"inputs": [[5, 30, 92, 4, 31, 2, 17, 39, 15, 7], 3], "output": [2, 30, 92, 4, 31, 5, 15, 39, 17, 7]}, {"inputs": [[5, 38, 68, 80, 64, 79, 50, 5, 8, 95], 7], "output": [5, 38, 64, 79, 68, 80, 50, 5, 8, 95]}, {"inputs": [[5, 100, 44, 45, 16, 30, 14, 65, 83, 64], 15], "output": [5, 100, 14, 16, 30, 44, 45, 64, 83, 65]}, {"inputs": [[6, 57, 100, 67, 4, 63, 47, 59, 21, 66], 8], "output": [4, 57, 100, 59, 6, 63, 47, 66, 21, 67]}, {"inputs": [[6, 70, 90, 1, 33, 81, 60, 80, 68, 44], 7], "output": [1, 68, 90, 6, 33, 80, 60, 81, 70, 44]}, {"inputs": [[6, 74, 74, 74, 30, 70, 91, 74, 76, 41], 1], "output": [6, 74, 74, 74, 30, 70, 91, 74, 76, 41]}]}} +{"id": "LeetCode/3208", "content": "# Count Beautiful Substrings II\n\nYou are given a string `s` and a positive integer `k`.\n\n\nLet `vowels` and `consonants` be the number of vowels and consonants in a string.\n\n\nA string is **beautiful** if:\n\n\n* `vowels == consonants`.\n* `(vowels * consonants) % k == 0`, in other terms the multiplication of `vowels` and `consonants` is divisible by `k`.\n\n\nReturn *the number of **non-empty beautiful substrings** in the given string* `s`.\n\n\nA **substring** is a contiguous sequence of characters in a string.\n\n\n**Vowel letters** in English are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`.\n\n\n**Consonant letters** in English are every letter except vowels.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"baeyh\", k = 2\n**Output:** 2\n**Explanation:** There are 2 beautiful substrings in the given string.\n- Substring \"baeyh\", vowels = 2 ([\"a\",e\"]), consonants = 2 ([\"y\",\"h\"]).\nYou can see that string \"aeyh\" is beautiful as vowels == consonants and vowels * consonants % k == 0.\n- Substring \"baeyh\", vowels = 2 ([\"a\",e\"]), consonants = 2 ([\"b\",\"y\"]).\nYou can see that string \"baey\" is beautiful as vowels == consonants and vowels * consonants % k == 0.\nIt can be shown that there are only 2 beautiful substrings in the given string.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"abba\", k = 1\n**Output:** 3\n**Explanation:** There are 3 beautiful substrings in the given string.\n- Substring \"abba\", vowels = 1 ([\"a\"]), consonants = 1 ([\"b\"]).\n- Substring \"abba\", vowels = 1 ([\"a\"]), consonants = 1 ([\"b\"]).\n- Substring \"abba\", vowels = 2 ([\"a\",\"a\"]), consonants = 2 ([\"b\",\"b\"]).\nIt can be shown that there are only 3 beautiful substrings in the given string.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"bcdf\", k = 1\n**Output:** 0\n**Explanation:** There are no beautiful substrings in the given string.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 5 * 104`\n* `1 <= k <= 1000`\n* `s` consists of only English lowercase letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def beautifulSubstrings(self, s: str, k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.beautifulSubstrings(**['baeyh', 2]) == 2\nassert my_solution.beautifulSubstrings(**['abba', 1]) == 3\nassert my_solution.beautifulSubstrings(**['bcdf', 1]) == 0\nassert my_solution.beautifulSubstrings(**['ihroyeeb', 5]) == 0\nassert my_solution.beautifulSubstrings(**['uzuxpzou', 3]) == 1\nassert my_solution.beautifulSubstrings(**['ouuoeqd', 2]) == 1\nassert my_solution.beautifulSubstrings(**['eeebjoxxujuaeoqibd', 8]) == 4\nassert my_solution.beautifulSubstrings(**['ilougekqlovegioemdvu', 4]) == 21\nassert my_solution.beautifulSubstrings(**['tqaewreikaztwpfwnef', 8]) == 3\nassert my_solution.beautifulSubstrings(**['oykiuhsafgfjumnzb', 7]) == 0\nassert my_solution.beautifulSubstrings(**['ifvsa', 3]) == 0\nassert my_solution.beautifulSubstrings(**['svzauyuevujektj', 5]) == 3\nassert my_solution.beautifulSubstrings(**['urahjig', 2]) == 2\nassert my_solution.beautifulSubstrings(**['ime', 2]) == 0\nassert my_solution.beautifulSubstrings(**['oacghieut', 5]) == 0\nassert my_solution.beautifulSubstrings(**['aoluu', 3]) == 0\nassert my_solution.beautifulSubstrings(**['ioaoiciiuoziout', 1]) == 5\nassert my_solution.beautifulSubstrings(**['ouafupsuhid', 6]) == 0\nassert my_solution.beautifulSubstrings(**['ox', 2]) == 0\nassert my_solution.beautifulSubstrings(**['tlaiwoauazutusiaaui', 10]) == 0\n"}, "labels": {"questionId": "3208", "questionFrontendId": "2949", "questionTitle": "Count Beautiful Substrings II", "stats": {"totalAccepted": "2.1K", "totalSubmission": "6.4K", "totalAcceptedRaw": 2066, "totalSubmissionRaw": 6390, "acRate": "32.3%"}, "probedCases": [{"inputs": ["baeyh", 2], "output": 2}, {"inputs": ["abba", 1], "output": 3}, {"inputs": ["bcdf", 1], "output": 0}, {"inputs": ["ihroyeeb", 5], "output": 0}, {"inputs": ["uzuxpzou", 3], "output": 1}, {"inputs": ["ouuoeqd", 2], "output": 1}, {"inputs": ["eeebjoxxujuaeoqibd", 8], "output": 4}, {"inputs": ["ilougekqlovegioemdvu", 4], "output": 21}, {"inputs": ["tqaewreikaztwpfwnef", 8], "output": 3}, {"inputs": ["oykiuhsafgfjumnzb", 7], "output": 0}, {"inputs": ["ifvsa", 3], "output": 0}, {"inputs": ["svzauyuevujektj", 5], "output": 3}, {"inputs": ["urahjig", 2], "output": 2}, {"inputs": ["ime", 2], "output": 0}, {"inputs": ["oacghieut", 5], "output": 0}, {"inputs": ["aoluu", 3], "output": 0}, {"inputs": ["ioaoiciiuoziout", 1], "output": 5}, {"inputs": ["ouafupsuhid", 6], "output": 0}, {"inputs": ["ox", 2], "output": 0}, {"inputs": ["tlaiwoauazutusiaaui", 10], "output": 0}]}} +{"id": "LeetCode/3194", "content": "# Find Words Containing Character\n\nYou are given a **0-indexed** array of strings `words` and a character `x`.\n\n\nReturn *an **array of indices** representing the words that contain the character* `x`.\n\n\n**Note** that the returned array may be in **any** order.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** words = [\"leet\",\"code\"], x = \"e\"\n**Output:** [0,1]\n**Explanation:** \"e\" occurs in both words: \"l**ee**t\", and \"cod**e**\". Hence, we return indices 0 and 1.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** words = [\"abc\",\"bcd\",\"aaaa\",\"cbc\"], x = \"a\"\n**Output:** [0,2]\n**Explanation:** \"a\" occurs in \"**a**bc\", and \"**aaaa**\". Hence, we return indices 0 and 2.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** words = [\"abc\",\"bcd\",\"aaaa\",\"cbc\"], x = \"z\"\n**Output:** []\n**Explanation:** \"z\" does not occur in any of the words. Hence, we return an empty array.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= words.length <= 50`\n* `1 <= words[i].length <= 50`\n* `x` is a lowercase English letter.\n* `words[i]` consists only of lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findWordsContaining(self, words: List[str], x: str) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findWordsContaining(**[['leet', 'code'], 'e']) == [0, 1]\nassert my_solution.findWordsContaining(**[['abc', 'bcd', 'aaaa', 'cbc'], 'a']) == [0, 2]\nassert my_solution.findWordsContaining(**[['abc', 'bcd', 'aaaa', 'cbc'], 'z']) == []\nassert my_solution.findWordsContaining(**[['sgtkshnss', 'm', 'ryvbkyvuz', 'ezittyjwgb', 'wudlwg'], 'x']) == []\nassert my_solution.findWordsContaining(**[['lkwnhpbj', 'tlohm', 'juazsb', 'f', 'rq'], 'v']) == []\nassert my_solution.findWordsContaining(**[['aaa', 'imvtfjmxr', 'wbzfoovjnf', 'hqwrwmi'], 'c']) == []\nassert my_solution.findWordsContaining(**[['utyeachht', 'bgpkcs', 'skeecqvvvw', 'nccrd'], 'i']) == []\nassert my_solution.findWordsContaining(**[['alcpxexztg', 'r'], 'h']) == []\nassert my_solution.findWordsContaining(**[['ekcpg', 'pdknua', 'fot', 'janppw', 'ofomkfvx'], 'g']) == [0]\nassert my_solution.findWordsContaining(**[['dq', 'rlvopu'], 'd']) == [0]\nassert my_solution.findWordsContaining(**[['wzppkd', 'jxvk', 'zaztizmwuv', 'hvcdtobr'], 'b']) == [3]\nassert my_solution.findWordsContaining(**[['y', 'hs', 'qznrkpi'], 'v']) == []\nassert my_solution.findWordsContaining(**[['pze', 'yojczsb', 'mjvyr', 'i', 'xsygks'], 'q']) == []\nassert my_solution.findWordsContaining(**[['qsgtjagcu', 'm'], 'e']) == []\nassert my_solution.findWordsContaining(**[['kidtwmw', 'ogh', 'trdedlh', 'wwbtlindg', 'naoylytpof', 'ujcbzwzkm', 'doamcoxdv'], 'o']) == [1, 4, 6]\nassert my_solution.findWordsContaining(**[['tsmeupctki'], 't']) == [0]\nassert my_solution.findWordsContaining(**[['dqxlbljmpf', 'uvdzfoiqg', 'jsnbnx', 'fbedae', 'nodewb', 'o', 'ivepktj'], 'g']) == [1]\nassert my_solution.findWordsContaining(**[['fjlmmecm', 'sautsoorhl', 'n', 'hsyco', 'amlukrpjpv', 'rmhdnj', 'g'], 'e']) == [0]\nassert my_solution.findWordsContaining(**[['khjchmeciv', 'vgx', 'xghr', 'bbufgegu', 'qyfxu'], 'r']) == [2]\nassert my_solution.findWordsContaining(**[['jhtcugtcpl', 'bvhlgmmla', 'ntfkwzite', 'imbtzafaj', 'sdl', 't'], 'm']) == [1, 3]\n"}, "labels": {"questionId": "3194", "questionFrontendId": "2942", "questionTitle": "Find Words Containing Character", "stats": {"totalAccepted": "4.8K", "totalSubmission": "5.4K", "totalAcceptedRaw": 4826, "totalSubmissionRaw": 5440, "acRate": "88.7%"}, "probedCases": [{"inputs": [["leet", "code"], "e"], "output": [0, 1]}, {"inputs": [["abc", "bcd", "aaaa", "cbc"], "a"], "output": [0, 2]}, {"inputs": [["abc", "bcd", "aaaa", "cbc"], "z"], "output": []}, {"inputs": [["sgtkshnss", "m", "ryvbkyvuz", "ezittyjwgb", "wudlwg"], "x"], "output": []}, {"inputs": [["lkwnhpbj", "tlohm", "juazsb", "f", "rq"], "v"], "output": []}, {"inputs": [["aaa", "imvtfjmxr", "wbzfoovjnf", "hqwrwmi"], "c"], "output": []}, {"inputs": [["utyeachht", "bgpkcs", "skeecqvvvw", "nccrd"], "i"], "output": []}, {"inputs": [["alcpxexztg", "r"], "h"], "output": []}, {"inputs": [["ekcpg", "pdknua", "fot", "janppw", "ofomkfvx"], "g"], "output": [0]}, {"inputs": [["dq", "rlvopu"], "d"], "output": [0]}, {"inputs": [["wzppkd", "jxvk", "zaztizmwuv", "hvcdtobr"], "b"], "output": [3]}, {"inputs": [["y", "hs", "qznrkpi"], "v"], "output": []}, {"inputs": [["pze", "yojczsb", "mjvyr", "i", "xsygks"], "q"], "output": []}, {"inputs": [["qsgtjagcu", "m"], "e"], "output": []}, {"inputs": [["kidtwmw", "ogh", "trdedlh", "wwbtlindg", "naoylytpof", "ujcbzwzkm", "doamcoxdv"], "o"], "output": [1, 4, 6]}, {"inputs": [["tsmeupctki"], "t"], "output": [0]}, {"inputs": [["dqxlbljmpf", "uvdzfoiqg", "jsnbnx", "fbedae", "nodewb", "o", "ivepktj"], "g"], "output": [1]}, {"inputs": [["fjlmmecm", "sautsoorhl", "n", "hsyco", "amlukrpjpv", "rmhdnj", "g"], "e"], "output": [0]}, {"inputs": [["khjchmeciv", "vgx", "xghr", "bbufgegu", "qyfxu"], "r"], "output": [2]}, {"inputs": [["jhtcugtcpl", "bvhlgmmla", "ntfkwzite", "imbtzafaj", "sdl", "t"], "m"], "output": [1, 3]}]}} +{"id": "LeetCode/3209", "content": "# Minimum Number of Coins for Fruits\n\nYou are at a fruit market with different types of exotic fruits on display.\n\n\nYou are given a **1-indexed** array `prices`, where `prices[i]` denotes the number of coins needed to purchase the `ith` fruit.\n\n\nThe fruit market has the following offer:\n\n\n* If you purchase the `ith` fruit at `prices[i]` coins, you can get the next `i` fruits for free.\n\n\n**Note** that even if you **can** take fruit `j` for free, you can still purchase it for `prices[j]` coins to receive a new offer.\n\n\nReturn *the **minimum** number of coins needed to acquire all the fruits*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** prices = [3,1,2]\n**Output:** 4\n**Explanation:** You can acquire the fruits as follows:\n- Purchase the 1st fruit with 3 coins, you are allowed to take the 2nd fruit for free.\n- Purchase the 2nd fruit with 1 coin, you are allowed to take the 3rd fruit for free.\n- Take the 3rd fruit for free.\nNote that even though you were allowed to take the 2nd fruit for free, you purchased it because it is more optimal.\nIt can be proven that 4 is the minimum number of coins needed to acquire all the fruits.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** prices = [1,10,1,1]\n**Output:** 2\n**Explanation:** You can acquire the fruits as follows:\n- Purchase the 1st fruit with 1 coin, you are allowed to take the 2nd fruit for free.\n- Take the 2nd fruit for free.\n- Purchase the 3rd fruit for 1 coin, you are allowed to take the 4th fruit for free.\n- Take the 4th fruit for free.\nIt can be proven that 2 is the minimum number of coins needed to acquire all the fruits.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= prices.length <= 1000`\n* `1 <= prices[i] <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumCoins(self, prices: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumCoins(**[[3, 1, 2]]) == 4\nassert my_solution.minimumCoins(**[[1, 10, 1, 1]]) == 2\nassert my_solution.minimumCoins(**[[26, 18, 6, 12, 49, 7, 45, 45]]) == 39\nassert my_solution.minimumCoins(**[[27, 17, 29, 45, 3, 39, 42, 26]]) == 47\nassert my_solution.minimumCoins(**[[14, 37, 37, 38, 24, 15, 12]]) == 63\nassert my_solution.minimumCoins(**[[1, 37, 19, 38, 11, 42, 18, 33, 6, 37, 15, 48, 23, 12, 41, 18, 27, 32]]) == 37\nassert my_solution.minimumCoins(**[[38, 23, 27, 32, 47, 45, 48, 24, 39, 26, 37, 42, 24, 45, 27, 26, 15, 16, 26, 6]]) == 132\nassert my_solution.minimumCoins(**[[45, 44, 5, 9, 22, 14, 29, 14, 21, 13, 45, 10, 2, 16, 14, 30, 26, 1, 49]]) == 66\nassert my_solution.minimumCoins(**[[37, 42, 6, 50, 50, 38, 30, 38, 1, 13, 25, 39, 18, 1, 35, 32, 12]]) == 74\nassert my_solution.minimumCoins(**[[17, 32, 11, 25, 22]]) == 28\nassert my_solution.minimumCoins(**[[18, 10, 1, 11, 6, 30, 19, 24, 1, 18, 37, 29, 28, 27, 38]]) == 26\nassert my_solution.minimumCoins(**[[3, 10, 25, 47, 49, 10, 49]]) == 38\nassert my_solution.minimumCoins(**[[46, 7, 15]]) == 53\nassert my_solution.minimumCoins(**[[16, 45, 25, 5, 18, 19, 25, 13, 33]]) == 59\nassert my_solution.minimumCoins(**[[21, 16, 7, 10, 30]]) == 28\nassert my_solution.minimumCoins(**[[21, 22, 29, 37, 23, 15, 39, 9, 19, 10, 6, 9, 33, 28, 43]]) == 71\nassert my_solution.minimumCoins(**[[37, 16, 42, 47, 16, 31, 39, 8, 26, 50, 33]]) == 77\nassert my_solution.minimumCoins(**[[32, 4]]) == 32\nassert my_solution.minimumCoins(**[[31, 9, 2, 36, 4, 45, 28, 28, 12, 22, 44, 17, 10, 48, 15, 22, 7, 14, 41]]) == 56\nassert my_solution.minimumCoins(**[[1, 31, 9, 36, 44, 2, 23]]) == 12\n"}, "labels": {"questionId": "3209", "questionFrontendId": "2944", "questionTitle": "Minimum Number of Coins for Fruits", "stats": {"totalAccepted": "3.5K", "totalSubmission": "5.9K", "totalAcceptedRaw": 3538, "totalSubmissionRaw": 5909, "acRate": "59.9%"}, "probedCases": [{"inputs": [[3, 1, 2]], "output": 4}, {"inputs": [[1, 10, 1, 1]], "output": 2}, {"inputs": [[26, 18, 6, 12, 49, 7, 45, 45]], "output": 39}, {"inputs": [[27, 17, 29, 45, 3, 39, 42, 26]], "output": 47}, {"inputs": [[14, 37, 37, 38, 24, 15, 12]], "output": 63}, {"inputs": [[1, 37, 19, 38, 11, 42, 18, 33, 6, 37, 15, 48, 23, 12, 41, 18, 27, 32]], "output": 37}, {"inputs": [[38, 23, 27, 32, 47, 45, 48, 24, 39, 26, 37, 42, 24, 45, 27, 26, 15, 16, 26, 6]], "output": 132}, {"inputs": [[45, 44, 5, 9, 22, 14, 29, 14, 21, 13, 45, 10, 2, 16, 14, 30, 26, 1, 49]], "output": 66}, {"inputs": [[37, 42, 6, 50, 50, 38, 30, 38, 1, 13, 25, 39, 18, 1, 35, 32, 12]], "output": 74}, {"inputs": [[17, 32, 11, 25, 22]], "output": 28}, {"inputs": [[18, 10, 1, 11, 6, 30, 19, 24, 1, 18, 37, 29, 28, 27, 38]], "output": 26}, {"inputs": [[3, 10, 25, 47, 49, 10, 49]], "output": 38}, {"inputs": [[46, 7, 15]], "output": 53}, {"inputs": [[16, 45, 25, 5, 18, 19, 25, 13, 33]], "output": 59}, {"inputs": [[21, 16, 7, 10, 30]], "output": 28}, {"inputs": [[21, 22, 29, 37, 23, 15, 39, 9, 19, 10, 6, 9, 33, 28, 43]], "output": 71}, {"inputs": [[37, 16, 42, 47, 16, 31, 39, 8, 26, 50, 33]], "output": 77}, {"inputs": [[32, 4]], "output": 32}, {"inputs": [[31, 9, 2, 36, 4, 45, 28, 28, 12, 22, 44, 17, 10, 48, 15, 22, 7, 14, 41]], "output": 56}, {"inputs": [[1, 31, 9, 36, 44, 2, 23]], "output": 12}]}} +{"id": "LeetCode/3211", "content": "# Find Maximum Non-decreasing Array Length\n\nYou are given a **0-indexed** integer array `nums`.\n\n\nYou can perform any number of operations, where each operation involves selecting a **subarray** of the array and replacing it with the **sum** of its elements. For example, if the given array is `[1,3,5,6]` and you select subarray `[3,5]` the array will convert to `[1,8,6]`.\n\n\nReturn *the* ***maximum*** *length of a* ***non-decreasing*** *array that can be made after applying operations.*\n\n\nA **subarray** is a contiguous **non-empty** sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [5,2,2]\n**Output:** 1\n**Explanation:** This array with length 3 is not non-decreasing.\nWe have two ways to make the array length two.\nFirst, choosing subarray [2,2] converts the array to [5,4].\nSecond, choosing subarray [5,2] converts the array to [7,2].\nIn these two ways the array is not non-decreasing.\nAnd if we choose subarray [5,2,2] and replace it with [9] it becomes non-decreasing. \nSo the answer is 1.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4]\n**Output:** 4\n**Explanation:** The array is non-decreasing. So the answer is 4.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [4,3,2,6]\n**Output:** 3\n**Explanation:** Replacing [3,2] with [5] converts the given array to [4,5,6] that is non-decreasing.\nBecause the given array is not non-decreasing, the maximum possible answer is 3.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findMaximumLength(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findMaximumLength(**[[5, 2, 2]]) == 1\nassert my_solution.findMaximumLength(**[[1, 2, 3, 4]]) == 4\nassert my_solution.findMaximumLength(**[[4, 3, 2, 6]]) == 3\nassert my_solution.findMaximumLength(**[[32]]) == 1\nassert my_solution.findMaximumLength(**[[38]]) == 1\nassert my_solution.findMaximumLength(**[[60]]) == 1\nassert my_solution.findMaximumLength(**[[79]]) == 1\nassert my_solution.findMaximumLength(**[[85]]) == 1\nassert my_solution.findMaximumLength(**[[170]]) == 1\nassert my_solution.findMaximumLength(**[[198]]) == 1\nassert my_solution.findMaximumLength(**[[220]]) == 1\nassert my_solution.findMaximumLength(**[[318]]) == 1\nassert my_solution.findMaximumLength(**[[350]]) == 1\nassert my_solution.findMaximumLength(**[[381]]) == 1\nassert my_solution.findMaximumLength(**[[413]]) == 1\nassert my_solution.findMaximumLength(**[[426]]) == 1\nassert my_solution.findMaximumLength(**[[429]]) == 1\nassert my_solution.findMaximumLength(**[[431]]) == 1\nassert my_solution.findMaximumLength(**[[445]]) == 1\nassert my_solution.findMaximumLength(**[[488]]) == 1\n"}, "labels": {"questionId": "3211", "questionFrontendId": "2945", "questionTitle": "Find Maximum Non-decreasing Array Length", "stats": {"totalAccepted": "1.1K", "totalSubmission": "4.1K", "totalAcceptedRaw": 1054, "totalSubmissionRaw": 4133, "acRate": "25.5%"}, "probedCases": [{"inputs": [[5, 2, 2]], "output": 1}, {"inputs": [[1, 2, 3, 4]], "output": 4}, {"inputs": [[4, 3, 2, 6]], "output": 3}, {"inputs": [[32]], "output": 1}, {"inputs": [[38]], "output": 1}, {"inputs": [[60]], "output": 1}, {"inputs": [[79]], "output": 1}, {"inputs": [[85]], "output": 1}, {"inputs": [[170]], "output": 1}, {"inputs": [[198]], "output": 1}, {"inputs": [[220]], "output": 1}, {"inputs": [[318]], "output": 1}, {"inputs": [[350]], "output": 1}, {"inputs": [[381]], "output": 1}, {"inputs": [[413]], "output": 1}, {"inputs": [[426]], "output": 1}, {"inputs": [[429]], "output": 1}, {"inputs": [[431]], "output": 1}, {"inputs": [[445]], "output": 1}, {"inputs": [[488]], "output": 1}]}} +{"id": "LeetCode/3207", "content": "# Make Three Strings Equal\n\nYou are given three strings `s1`, `s2`, and `s3`. You have to perform the following operation on these three strings **as many times** as you want.\n\n\nIn one operation you can choose one of these three strings such that its length is at least `2` and delete the **rightmost** character of it.\n\n\nReturn *the **minimum** number of operations you need to perform to make the three strings equal if there is a way to make them equal, otherwise, return* `-1`*.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s1 = \"abc\", s2 = \"abb\", s3 = \"ab\"\n**Output:** 2\n**Explanation:** Performing operations on s1 and s2 once will lead to three equal strings.\nIt can be shown that there is no way to make them equal with less than two operations.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s1 = \"dac\", s2 = \"bac\", s3 = \"cac\"\n**Output:** -1\n**Explanation:** Because the leftmost letters of s1 and s2 are not equal, they could not be equal after any number of operations. So the answer is -1.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s1.length, s2.length, s3.length <= 100`\n* `s1`, `s2` and `s3` consist only of lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findMinimumOperations(self, s1: str, s2: str, s3: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findMinimumOperations(**['abc', 'abb', 'ab']) == 2\nassert my_solution.findMinimumOperations(**['dac', 'bac', 'cac']) == -1\nassert my_solution.findMinimumOperations(**['a', 'a', 'a']) == 0\nassert my_solution.findMinimumOperations(**['kui', 'm', 'v']) == -1\nassert my_solution.findMinimumOperations(**['a', 'aabc', 'a']) == 3\nassert my_solution.findMinimumOperations(**['cc', 'cccb', 'c']) == 4\nassert my_solution.findMinimumOperations(**['luso', 'lu', 'lu']) == 2\nassert my_solution.findMinimumOperations(**['xx', 'phe', 'xie']) == -1\nassert my_solution.findMinimumOperations(**['gzd', 'bcju', 'db']) == -1\nassert my_solution.findMinimumOperations(**['cbba', 'cbaa', 'c']) == 6\nassert my_solution.findMinimumOperations(**['k', 'kfb', 'krcnf']) == 6\nassert my_solution.findMinimumOperations(**['oby', 'obz', 'obf']) == 3\nassert my_solution.findMinimumOperations(**['b', 'aba', 'aaccaa']) == -1\nassert my_solution.findMinimumOperations(**['a', 'accabb', 'aaa']) == 7\nassert my_solution.findMinimumOperations(**['b', 'bccaaba', 'ba']) == 7\nassert my_solution.findMinimumOperations(**['b', 'bacccab', 'cc']) == -1\nassert my_solution.findMinimumOperations(**['ca', 'cccabb', 'cb']) == 7\nassert my_solution.findMinimumOperations(**['ccb', 'ccba', 'ccb']) == 1\nassert my_solution.findMinimumOperations(**['mbooi', 'pdq', 'br']) == -1\nassert my_solution.findMinimumOperations(**['xxfzj', 'faho', 'c']) == -1\n"}, "labels": {"questionId": "3207", "questionFrontendId": "2937", "questionTitle": "Make Three Strings Equal", "stats": {"totalAccepted": "5.9K", "totalSubmission": "12.7K", "totalAcceptedRaw": 5885, "totalSubmissionRaw": 12732, "acRate": "46.2%"}, "probedCases": [{"inputs": ["abc", "abb", "ab"], "output": 2}, {"inputs": ["dac", "bac", "cac"], "output": -1}, {"inputs": ["a", "a", "a"], "output": 0}, {"inputs": ["kui", "m", "v"], "output": -1}, {"inputs": ["a", "aabc", "a"], "output": 3}, {"inputs": ["cc", "cccb", "c"], "output": 4}, {"inputs": ["luso", "lu", "lu"], "output": 2}, {"inputs": ["xx", "phe", "xie"], "output": -1}, {"inputs": ["gzd", "bcju", "db"], "output": -1}, {"inputs": ["cbba", "cbaa", "c"], "output": 6}, {"inputs": ["k", "kfb", "krcnf"], "output": 6}, {"inputs": ["oby", "obz", "obf"], "output": 3}, {"inputs": ["b", "aba", "aaccaa"], "output": -1}, {"inputs": ["a", "accabb", "aaa"], "output": 7}, {"inputs": ["b", "bccaaba", "ba"], "output": 7}, {"inputs": ["b", "bacccab", "cc"], "output": -1}, {"inputs": ["ca", "cccabb", "cb"], "output": 7}, {"inputs": ["ccb", "ccba", "ccb"], "output": 1}, {"inputs": ["mbooi", "pdq", "br"], "output": -1}, {"inputs": ["xxfzj", "faho", "c"], "output": -1}]}} +{"id": "LeetCode/3195", "content": "# Separate Black and White Balls\n\nThere are `n` balls on a table, each ball has a color black or white.\n\n\nYou are given a **0-indexed** binary string `s` of length `n`, where `1` and `0` represent black and white balls, respectively.\n\n\nIn each step, you can choose two adjacent balls and swap them.\n\n\nReturn *the **minimum** number of steps to group all the black balls to the right and all the white balls to the left*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"101\"\n**Output:** 1\n**Explanation:** We can group all the black balls to the right in the following way:\n- Swap s[0] and s[1], s = \"011\".\nInitially, 1s are not grouped together, requiring at least 1 step to group them to the right.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"100\"\n**Output:** 2\n**Explanation:** We can group all the black balls to the right in the following way:\n- Swap s[0] and s[1], s = \"010\".\n- Swap s[1] and s[2], s = \"001\".\nIt can be proven that the minimum number of steps needed is 2.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"0111\"\n**Output:** 0\n**Explanation:** All the black balls are already grouped to the right.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == s.length <= 105`\n* `s[i]` is either `'0'` or `'1'`.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumSteps(self, s: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumSteps(**['101']) == 1\nassert my_solution.minimumSteps(**['100']) == 2\nassert my_solution.minimumSteps(**['0111']) == 0\nassert my_solution.minimumSteps(**['11000111']) == 6\nassert my_solution.minimumSteps(**['01010001']) == 7\nassert my_solution.minimumSteps(**['0100101']) == 4\nassert my_solution.minimumSteps(**['111111111100100010']) == 65\nassert my_solution.minimumSteps(**['10100000110010011010']) == 44\nassert my_solution.minimumSteps(**['1101110000111011110']) == 42\nassert my_solution.minimumSteps(**['01000010111010001']) == 29\nassert my_solution.minimumSteps(**['11110']) == 4\nassert my_solution.minimumSteps(**['010001001011010']) == 21\nassert my_solution.minimumSteps(**['0011011']) == 2\nassert my_solution.minimumSteps(**['001']) == 0\nassert my_solution.minimumSteps(**['000100100']) == 6\nassert my_solution.minimumSteps(**['00110']) == 2\nassert my_solution.minimumSteps(**['001110001110001']) == 27\nassert my_solution.minimumSteps(**['10000000001']) == 9\nassert my_solution.minimumSteps(**['01']) == 0\nassert my_solution.minimumSteps(**['0100011100001100100']) == 45\n"}, "labels": {"questionId": "3195", "questionFrontendId": "2938", "questionTitle": "Separate Black and White Balls", "stats": {"totalAccepted": "5.7K", "totalSubmission": "10.6K", "totalAcceptedRaw": 5664, "totalSubmissionRaw": 10560, "acRate": "53.6%"}, "probedCases": [{"inputs": ["101"], "output": 1}, {"inputs": ["100"], "output": 2}, {"inputs": ["0111"], "output": 0}, {"inputs": ["11000111"], "output": 6}, {"inputs": ["01010001"], "output": 7}, {"inputs": ["0100101"], "output": 4}, {"inputs": ["111111111100100010"], "output": 65}, {"inputs": ["10100000110010011010"], "output": 44}, {"inputs": ["1101110000111011110"], "output": 42}, {"inputs": ["01000010111010001"], "output": 29}, {"inputs": ["11110"], "output": 4}, {"inputs": ["010001001011010"], "output": 21}, {"inputs": ["0011011"], "output": 2}, {"inputs": ["001"], "output": 0}, {"inputs": ["000100100"], "output": 6}, {"inputs": ["00110"], "output": 2}, {"inputs": ["001110001110001"], "output": 27}, {"inputs": ["10000000001"], "output": 9}, {"inputs": ["01"], "output": 0}, {"inputs": ["0100011100001100100"], "output": 45}]}} +{"id": "LeetCode/3192", "content": "# Maximum Xor Product\n\nGiven three integers `a`, `b`, and `n`, return *the **maximum value** of* `(a XOR x) * (b XOR x)` *where* `0 <= x < 2n`.\n\n\nSince the answer may be too large, return it **modulo** `109 + 7`.\n\n\n**Note** that `XOR` is the bitwise XOR operation.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** a = 12, b = 5, n = 4\n**Output:** 98\n**Explanation:** For x = 2, (a XOR x) = 14 and (b XOR x) = 7. Hence, (a XOR x) * (b XOR x) = 98. \nIt can be shown that 98 is the maximum value of (a XOR x) * (b XOR x) for all 0 <= x < 2n.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** a = 6, b = 7 , n = 5\n**Output:** 930\n**Explanation:** For x = 25, (a XOR x) = 31 and (b XOR x) = 30. Hence, (a XOR x) * (b XOR x) = 930.\nIt can be shown that 930 is the maximum value of (a XOR x) * (b XOR x) for all 0 <= x < 2n.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** a = 1, b = 6, n = 3\n**Output:** 12\n**Explanation:** For x = 5, (a XOR x) = 4 and (b XOR x) = 3. Hence, (a XOR x) * (b XOR x) = 12.\nIt can be shown that 12 is the maximum value of (a XOR x) * (b XOR x) for all 0 <= x < 2n.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `0 <= a, b < 250`\n* `0 <= n <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumXorProduct(self, a: int, b: int, n: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumXorProduct(**[12, 5, 4]) == 98\nassert my_solution.maximumXorProduct(**[6, 7, 5]) == 930\nassert my_solution.maximumXorProduct(**[1, 6, 3]) == 12\nassert my_solution.maximumXorProduct(**[0, 0, 1]) == 1\nassert my_solution.maximumXorProduct(**[0, 1, 6]) == 3906\nassert my_solution.maximumXorProduct(**[0, 2, 7]) == 15875\nassert my_solution.maximumXorProduct(**[0, 3, 1]) == 2\nassert my_solution.maximumXorProduct(**[0, 4, 0]) == 0\nassert my_solution.maximumXorProduct(**[0, 5, 6]) == 3658\nassert my_solution.maximumXorProduct(**[0, 6, 1]) == 7\nassert my_solution.maximumXorProduct(**[0, 7, 2]) == 12\nassert my_solution.maximumXorProduct(**[0, 8, 5]) == 713\nassert my_solution.maximumXorProduct(**[0, 9, 2]) == 30\nassert my_solution.maximumXorProduct(**[0, 10, 7]) == 14875\nassert my_solution.maximumXorProduct(**[0, 11, 4]) == 84\nassert my_solution.maximumXorProduct(**[0, 12, 2]) == 45\nassert my_solution.maximumXorProduct(**[0, 13, 2]) == 42\nassert my_solution.maximumXorProduct(**[0, 14, 0]) == 0\nassert my_solution.maximumXorProduct(**[0, 15, 6]) == 3080\nassert my_solution.maximumXorProduct(**[1, 0, 3]) == 42\n"}, "labels": {"questionId": "3192", "questionFrontendId": "2939", "questionTitle": "Maximum Xor Product", "stats": {"totalAccepted": "3.4K", "totalSubmission": "11.2K", "totalAcceptedRaw": 3379, "totalSubmissionRaw": 11169, "acRate": "30.3%"}, "probedCases": [{"inputs": [12, 5, 4], "output": 98}, {"inputs": [6, 7, 5], "output": 930}, {"inputs": [1, 6, 3], "output": 12}, {"inputs": [0, 0, 1], "output": 1}, {"inputs": [0, 1, 6], "output": 3906}, {"inputs": [0, 2, 7], "output": 15875}, {"inputs": [0, 3, 1], "output": 2}, {"inputs": [0, 4, 0], "output": 0}, {"inputs": [0, 5, 6], "output": 3658}, {"inputs": [0, 6, 1], "output": 7}, {"inputs": [0, 7, 2], "output": 12}, {"inputs": [0, 8, 5], "output": 713}, {"inputs": [0, 9, 2], "output": 30}, {"inputs": [0, 10, 7], "output": 14875}, {"inputs": [0, 11, 4], "output": 84}, {"inputs": [0, 12, 2], "output": 45}, {"inputs": [0, 13, 2], "output": 42}, {"inputs": [0, 14, 0], "output": 0}, {"inputs": [0, 15, 6], "output": 3080}, {"inputs": [1, 0, 3], "output": 42}]}} +{"id": "LeetCode/3181", "content": "# Find Building Where Alice and Bob Can Meet\n\nYou are given a **0-indexed** array `heights` of positive integers, where `heights[i]` represents the height of the `ith` building.\n\n\nIf a person is in building `i`, they can move to any other building `j` if and only if `i < j` and `heights[i] < heights[j]`.\n\n\nYou are also given another array `queries` where `queries[i] = [ai, bi]`. On the `ith` query, Alice is in building `ai` while Bob is in building `bi`.\n\n\nReturn *an array* `ans` *where* `ans[i]` *is **the index of the leftmost building** where Alice and Bob can meet on the* `ith` *query*. *If Alice and Bob cannot move to a common building on query* `i`, *set* `ans[i]` *to* `-1`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** heights = [6,4,8,5,2,7], queries = [[0,1],[0,3],[2,4],[3,4],[2,2]]\n**Output:** [2,5,-1,5,2]\n**Explanation:** In the first query, Alice and Bob can move to building 2 since heights[0] < heights[2] and heights[1] < heights[2]. \nIn the second query, Alice and Bob can move to building 5 since heights[0] < heights[5] and heights[3] < heights[5]. \nIn the third query, Alice cannot meet Bob since Alice cannot move to any other building.\nIn the fourth query, Alice and Bob can move to building 5 since heights[3] < heights[5] and heights[4] < heights[5].\nIn the fifth query, Alice and Bob are already in the same building. \nFor ans[i] != -1, It can be shown that ans[i] is the leftmost building where Alice and Bob can meet.\nFor ans[i] == -1, It can be shown that there is no building where Alice and Bob can meet.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** heights = [5,3,8,2,6,1,4,6], queries = [[0,7],[3,5],[5,2],[3,0],[1,6]]\n**Output:** [7,6,-1,4,6]\n**Explanation:** In the first query, Alice can directly move to Bob's building since heights[0] < heights[7].\nIn the second query, Alice and Bob can move to building 6 since heights[3] < heights[6] and heights[5] < heights[6].\nIn the third query, Alice cannot meet Bob since Bob cannot move to any other building.\nIn the fourth query, Alice and Bob can move to building 4 since heights[3] < heights[4] and heights[0] < heights[4].\nIn the fifth query, Alice can directly move to Bob's building since heights[1] < heights[6].\nFor ans[i] != -1, It can be shown that ans[i] is the leftmost building where Alice and Bob can meet.\nFor ans[i] == -1, It can be shown that there is no building where Alice and Bob can meet.\n\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= heights.length <= 5 * 104`\n* `1 <= heights[i] <= 109`\n* `1 <= queries.length <= 5 * 104`\n* `queries[i] = [ai, bi]`\n* `0 <= ai, bi <= heights.length - 1`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def leftmostBuildingQueries(self, heights: List[int], queries: List[List[int]]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.leftmostBuildingQueries(**[[6, 4, 8, 5, 2, 7], [[0, 1], [0, 3], [2, 4], [3, 4], [2, 2]]]) == [2, 5, -1, 5, 2]\nassert my_solution.leftmostBuildingQueries(**[[5, 3, 8, 2, 6, 1, 4, 6], [[0, 7], [3, 5], [5, 2], [3, 0], [1, 6]]]) == [7, 6, -1, 4, 6]\nassert my_solution.leftmostBuildingQueries(**[[1], [[0, 0]]]) == [0]\nassert my_solution.leftmostBuildingQueries(**[[1000000000], [[0, 0]]]) == [0]\nassert my_solution.leftmostBuildingQueries(**[[1, 2], [[0, 0], [0, 1], [1, 0], [1, 1]]]) == [0, 1, 1, 1]\nassert my_solution.leftmostBuildingQueries(**[[2, 1], [[0, 0], [0, 1], [1, 0], [1, 1]]]) == [0, -1, -1, 1]\nassert my_solution.leftmostBuildingQueries(**[[1, 2, 3], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]]) == [0, 1, 2, 1, 1, 2, 2, 2, 2]\nassert my_solution.leftmostBuildingQueries(**[[1, 3, 2], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]]) == [0, 1, 2, 1, 1, -1, 2, -1, 2]\nassert my_solution.leftmostBuildingQueries(**[[2, 1, 3], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]]) == [0, 2, 2, 2, 1, 2, 2, 2, 2]\nassert my_solution.leftmostBuildingQueries(**[[2, 3, 1], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]]) == [0, 1, -1, 1, 1, -1, -1, -1, 2]\nassert my_solution.leftmostBuildingQueries(**[[3, 1, 2], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]]) == [0, -1, -1, -1, 1, 2, -1, 2, 2]\nassert my_solution.leftmostBuildingQueries(**[[3, 2, 1], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]]) == [0, -1, -1, -1, 1, -1, -1, -1, 2]\nassert my_solution.leftmostBuildingQueries(**[[1, 2, 3, 4], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]]) == [0, 1, 2, 3, 1, 1, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3]\nassert my_solution.leftmostBuildingQueries(**[[1, 2, 4, 3], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]]) == [0, 1, 2, 3, 1, 1, 2, 3, 2, 2, 2, -1, 3, 3, -1, 3]\nassert my_solution.leftmostBuildingQueries(**[[1, 3, 2, 4], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]]) == [0, 1, 2, 3, 1, 1, 3, 3, 2, 3, 2, 3, 3, 3, 3, 3]\nassert my_solution.leftmostBuildingQueries(**[[1, 3, 4, 2], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]]) == [0, 1, 2, 3, 1, 1, 2, -1, 2, 2, 2, -1, 3, -1, -1, 3]\nassert my_solution.leftmostBuildingQueries(**[[1, 4, 2, 3], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]]) == [0, 1, 2, 3, 1, 1, -1, -1, 2, -1, 2, 3, 3, -1, 3, 3]\nassert my_solution.leftmostBuildingQueries(**[[1, 4, 3, 2], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]]) == [0, 1, 2, 3, 1, 1, -1, -1, 2, -1, 2, -1, 3, -1, -1, 3]\nassert my_solution.leftmostBuildingQueries(**[[2, 1, 3, 4], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]]) == [0, 2, 2, 3, 2, 1, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3]\nassert my_solution.leftmostBuildingQueries(**[[2, 1, 4, 3], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]]) == [0, 2, 2, 3, 2, 1, 2, 3, 2, 2, 2, -1, 3, 3, -1, 3]\n"}, "labels": {"questionId": "3181", "questionFrontendId": "2940", "questionTitle": "Find Building Where Alice and Bob Can Meet", "stats": {"totalAccepted": "3K", "totalSubmission": "6.5K", "totalAcceptedRaw": 3005, "totalSubmissionRaw": 6491, "acRate": "46.3%"}, "probedCases": [{"inputs": [[6, 4, 8, 5, 2, 7], [[0, 1], [0, 3], [2, 4], [3, 4], [2, 2]]], "output": [2, 5, -1, 5, 2]}, {"inputs": [[5, 3, 8, 2, 6, 1, 4, 6], [[0, 7], [3, 5], [5, 2], [3, 0], [1, 6]]], "output": [7, 6, -1, 4, 6]}, {"inputs": [[1], [[0, 0]]], "output": [0]}, {"inputs": [[1000000000], [[0, 0]]], "output": [0]}, {"inputs": [[1, 2], [[0, 0], [0, 1], [1, 0], [1, 1]]], "output": [0, 1, 1, 1]}, {"inputs": [[2, 1], [[0, 0], [0, 1], [1, 0], [1, 1]]], "output": [0, -1, -1, 1]}, {"inputs": [[1, 2, 3], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]], "output": [0, 1, 2, 1, 1, 2, 2, 2, 2]}, {"inputs": [[1, 3, 2], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]], "output": [0, 1, 2, 1, 1, -1, 2, -1, 2]}, {"inputs": [[2, 1, 3], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]], "output": [0, 2, 2, 2, 1, 2, 2, 2, 2]}, {"inputs": [[2, 3, 1], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]], "output": [0, 1, -1, 1, 1, -1, -1, -1, 2]}, {"inputs": [[3, 1, 2], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]], "output": [0, -1, -1, -1, 1, 2, -1, 2, 2]}, {"inputs": [[3, 2, 1], [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]], "output": [0, -1, -1, -1, 1, -1, -1, -1, 2]}, {"inputs": [[1, 2, 3, 4], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]], "output": [0, 1, 2, 3, 1, 1, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3]}, {"inputs": [[1, 2, 4, 3], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]], "output": [0, 1, 2, 3, 1, 1, 2, 3, 2, 2, 2, -1, 3, 3, -1, 3]}, {"inputs": [[1, 3, 2, 4], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]], "output": [0, 1, 2, 3, 1, 1, 3, 3, 2, 3, 2, 3, 3, 3, 3, 3]}, {"inputs": [[1, 3, 4, 2], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]], "output": [0, 1, 2, 3, 1, 1, 2, -1, 2, 2, 2, -1, 3, -1, -1, 3]}, {"inputs": [[1, 4, 2, 3], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]], "output": [0, 1, 2, 3, 1, 1, -1, -1, 2, -1, 2, 3, 3, -1, 3, 3]}, {"inputs": [[1, 4, 3, 2], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]], "output": [0, 1, 2, 3, 1, 1, -1, -1, 2, -1, 2, -1, 3, -1, -1, 3]}, {"inputs": [[2, 1, 3, 4], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]], "output": [0, 2, 2, 3, 2, 1, 2, 3, 2, 2, 2, 3, 3, 3, 3, 3]}, {"inputs": [[2, 1, 4, 3], [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]], "output": [0, 2, 2, 3, 2, 1, 2, 3, 2, 2, 2, -1, 3, 3, -1, 3]}]}} +{"id": "LeetCode/3193", "content": "# Maximum Strong Pair XOR I\n\nYou are given a **0-indexed** integer array `nums`. A pair of integers `x` and `y` is called a **strong** pair if it satisfies the condition:\n\n\n* `|x - y| <= min(x, y)`\n\n\nYou need to select two integers from `nums` such that they form a strong pair and their bitwise `XOR` is the **maximum** among all strong pairs in the array.\n\n\nReturn *the **maximum*** `XOR` *value out of all possible strong pairs in the array* `nums`.\n\n\n**Note** that you can pick the same integer twice to form a pair.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4,5]\n**Output:** 7\n**Explanation:** There are 11 strong pairs in the array nums: (1, 1), (1, 2), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (3, 5), (4, 4), (4, 5) and (5, 5).\nThe maximum XOR possible from these pairs is 3 XOR 4 = 7.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [10,100]\n**Output:** 0\n**Explanation:** There are 2 strong pairs in the array nums: (10, 10) and (100, 100).\nThe maximum XOR possible from these pairs is 10 XOR 10 = 0 since the pair (100, 100) also gives 100 XOR 100 = 0.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [5,6,25,30]\n**Output:** 7\n**Explanation:** There are 6 strong pairs in the array nums: (5, 5), (5, 6), (6, 6), (25, 25), (25, 30) and (30, 30).\nThe maximum XOR possible from these pairs is 25 XOR 30 = 7 since the only other non-zero XOR value is 5 XOR 6 = 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 50`\n* `1 <= nums[i] <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumStrongPairXor(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumStrongPairXor(**[[1, 2, 3, 4, 5]]) == 7\nassert my_solution.maximumStrongPairXor(**[[10, 100]]) == 0\nassert my_solution.maximumStrongPairXor(**[[5, 6, 25, 30]]) == 7\nassert my_solution.maximumStrongPairXor(**[[1]]) == 0\nassert my_solution.maximumStrongPairXor(**[[100]]) == 0\nassert my_solution.maximumStrongPairXor(**[[1, 1, 2, 3, 5]]) == 6\nassert my_solution.maximumStrongPairXor(**[[1, 1, 3, 8, 7]]) == 15\nassert my_solution.maximumStrongPairXor(**[[1, 1, 4, 4, 3]]) == 7\nassert my_solution.maximumStrongPairXor(**[[1, 1, 6, 6, 9]]) == 15\nassert my_solution.maximumStrongPairXor(**[[1, 1, 10, 3, 9]]) == 3\nassert my_solution.maximumStrongPairXor(**[[1, 2, 1, 5, 3]]) == 6\nassert my_solution.maximumStrongPairXor(**[[1, 2, 2, 1, 2]]) == 3\nassert my_solution.maximumStrongPairXor(**[[1, 2, 3, 8, 1]]) == 3\nassert my_solution.maximumStrongPairXor(**[[1, 2, 5, 5, 10]]) == 15\nassert my_solution.maximumStrongPairXor(**[[1, 2, 8, 3, 2]]) == 3\nassert my_solution.maximumStrongPairXor(**[[1, 2, 9, 2, 8]]) == 3\nassert my_solution.maximumStrongPairXor(**[[1, 3, 3, 2, 1]]) == 3\nassert my_solution.maximumStrongPairXor(**[[1, 3, 8, 5, 3]]) == 13\nassert my_solution.maximumStrongPairXor(**[[1, 3, 9, 6, 5]]) == 15\nassert my_solution.maximumStrongPairXor(**[[1, 4, 1, 2, 5]]) == 6\n"}, "labels": {"questionId": "3193", "questionFrontendId": "2932", "questionTitle": "Maximum Strong Pair XOR I", "stats": {"totalAccepted": "5.4K", "totalSubmission": "7.2K", "totalAcceptedRaw": 5422, "totalSubmissionRaw": 7215, "acRate": "75.1%"}, "probedCases": [{"inputs": [[1, 2, 3, 4, 5]], "output": 7}, {"inputs": [[10, 100]], "output": 0}, {"inputs": [[5, 6, 25, 30]], "output": 7}, {"inputs": [[1]], "output": 0}, {"inputs": [[100]], "output": 0}, {"inputs": [[1, 1, 2, 3, 5]], "output": 6}, {"inputs": [[1, 1, 3, 8, 7]], "output": 15}, {"inputs": [[1, 1, 4, 4, 3]], "output": 7}, {"inputs": [[1, 1, 6, 6, 9]], "output": 15}, {"inputs": [[1, 1, 10, 3, 9]], "output": 3}, {"inputs": [[1, 2, 1, 5, 3]], "output": 6}, {"inputs": [[1, 2, 2, 1, 2]], "output": 3}, {"inputs": [[1, 2, 3, 8, 1]], "output": 3}, {"inputs": [[1, 2, 5, 5, 10]], "output": 15}, {"inputs": [[1, 2, 8, 3, 2]], "output": 3}, {"inputs": [[1, 2, 9, 2, 8]], "output": 3}, {"inputs": [[1, 3, 3, 2, 1]], "output": 3}, {"inputs": [[1, 3, 8, 5, 3]], "output": 13}, {"inputs": [[1, 3, 9, 6, 5]], "output": 15}, {"inputs": [[1, 4, 1, 2, 5]], "output": 6}]}} +{"id": "LeetCode/3202", "content": "# High-Access Employees\n\nYou are given a 2D **0-indexed** array of strings, `access_times`, with size `n`. For each `i` where `0 <= i <= n - 1`, `access_times[i][0]` represents the name of an employee, and `access_times[i][1]` represents the access time of that employee. All entries in `access_times` are within the same day.\n\n\nThe access time is represented as **four digits** using a **24-hour** time format, for example, `\"0800\"` or `\"2250\"`.\n\n\nAn employee is said to be **high-access** if he has accessed the system **three or more** times within a **one-hour period**.\n\n\nTimes with exactly one hour of difference are **not** considered part of the same one-hour period. For example, `\"0815\"` and `\"0915\"` are not part of the same one-hour period.\n\n\nAccess times at the start and end of the day are **not** counted within the same one-hour period. For example, `\"0005\"` and `\"2350\"` are not part of the same one-hour period.\n\n\nReturn *a list that contains the names of **high-access** employees with any order you want.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** access_times = [[\"a\",\"0549\"],[\"b\",\"0457\"],[\"a\",\"0532\"],[\"a\",\"0621\"],[\"b\",\"0540\"]]\n**Output:** [\"a\"]\n**Explanation:** \"a\" has three access times in the one-hour period of [05:32, 06:31] which are 05:32, 05:49, and 06:21.\nBut \"b\" does not have more than two access times at all.\nSo the answer is [\"a\"].\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** access_times = [[\"d\",\"0002\"],[\"c\",\"0808\"],[\"c\",\"0829\"],[\"e\",\"0215\"],[\"d\",\"1508\"],[\"d\",\"1444\"],[\"d\",\"1410\"],[\"c\",\"0809\"]]\n**Output:** [\"c\",\"d\"]\n**Explanation:** \"c\" has three access times in the one-hour period of [08:08, 09:07] which are 08:08, 08:09, and 08:29.\n\"d\" has also three access times in the one-hour period of [14:10, 15:09] which are 14:10, 14:44, and 15:08.\nHowever, \"e\" has just one access time, so it can not be in the answer and the final answer is [\"c\",\"d\"].\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** access_times = [[\"cd\",\"1025\"],[\"ab\",\"1025\"],[\"cd\",\"1046\"],[\"cd\",\"1055\"],[\"ab\",\"1124\"],[\"ab\",\"1120\"]]\n**Output:** [\"ab\",\"cd\"]\n**Explanation:** \"ab\" has three access times in the one-hour period of [10:25, 11:24] which are 10:25, 11:20, and 11:24.\n\"cd\" has also three access times in the one-hour period of [10:25, 11:24] which are 10:25, 10:46, and 10:55.\nSo the answer is [\"ab\",\"cd\"].\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= access_times.length <= 100`\n* `access_times[i].length == 2`\n* `1 <= access_times[i][0].length <= 10`\n* `access_times[i][0]` consists only of English small letters.\n* `access_times[i][1].length == 4`\n* `access_times[i][1]` is in 24-hour time format.\n* `access_times[i][1]` consists only of `'0'` to `'9'`.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findHighAccessEmployees(self, access_times: List[List[str]]) -> List[str]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findHighAccessEmployees(**[[['a', '0549'], ['b', '0457'], ['a', '0532'], ['a', '0621'], ['b', '0540']]]) == ['a']\nassert my_solution.findHighAccessEmployees(**[[['d', '0002'], ['c', '0808'], ['c', '0829'], ['e', '0215'], ['d', '1508'], ['d', '1444'], ['d', '1410'], ['c', '0809']]]) == ['c', 'd']\nassert my_solution.findHighAccessEmployees(**[[['cd', '1025'], ['ab', '1025'], ['cd', '1046'], ['cd', '1055'], ['ab', '1124'], ['ab', '1120']]]) == ['ab', 'cd']\nassert my_solution.findHighAccessEmployees(**[[['baipstt', '1456']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['bouo', '1126']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['cavfbqg', '2304']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['cenjcq', '1007']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['cqotrwqcaq', '0131']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['downbuk', '1951']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['dqsoiyz', '2204']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['duzeyrov', '0243']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['erfg', '1223']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['fwhefd', '2026']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['gbefbne', '0911']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['gp', '1540']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['ht', '1319']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['inahnsjdqz', '1750']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['jwxvijxo', '0851']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['kibwwvjuez', '0716']]]) == []\nassert my_solution.findHighAccessEmployees(**[[['lvry', '0706']]]) == []\n"}, "labels": {"questionId": "3202", "questionFrontendId": "2933", "questionTitle": "High-Access Employees", "stats": {"totalAccepted": "4.8K", "totalSubmission": "9.7K", "totalAcceptedRaw": 4847, "totalSubmissionRaw": 9734, "acRate": "49.8%"}, "probedCases": [{"inputs": [[["a", "0549"], ["b", "0457"], ["a", "0532"], ["a", "0621"], ["b", "0540"]]], "output": ["a"]}, {"inputs": [[["d", "0002"], ["c", "0808"], ["c", "0829"], ["e", "0215"], ["d", "1508"], ["d", "1444"], ["d", "1410"], ["c", "0809"]]], "output": ["c", "d"]}, {"inputs": [[["cd", "1025"], ["ab", "1025"], ["cd", "1046"], ["cd", "1055"], ["ab", "1124"], ["ab", "1120"]]], "output": ["ab", "cd"]}, {"inputs": [[["baipstt", "1456"]]], "output": []}, {"inputs": [[["bouo", "1126"]]], "output": []}, {"inputs": [[["cavfbqg", "2304"]]], "output": []}, {"inputs": [[["cenjcq", "1007"]]], "output": []}, {"inputs": [[["cqotrwqcaq", "0131"]]], "output": []}, {"inputs": [[["downbuk", "1951"]]], "output": []}, {"inputs": [[["dqsoiyz", "2204"]]], "output": []}, {"inputs": [[["duzeyrov", "0243"]]], "output": []}, {"inputs": [[["erfg", "1223"]]], "output": []}, {"inputs": [[["fwhefd", "2026"]]], "output": []}, {"inputs": [[["gbefbne", "0911"]]], "output": []}, {"inputs": [[["gp", "1540"]]], "output": []}, {"inputs": [[["ht", "1319"]]], "output": []}, {"inputs": [[["inahnsjdqz", "1750"]]], "output": []}, {"inputs": [[["jwxvijxo", "0851"]]], "output": []}, {"inputs": [[["kibwwvjuez", "0716"]]], "output": []}, {"inputs": [[["lvry", "0706"]]], "output": []}]}} +{"id": "LeetCode/3190", "content": "# Minimum Operations to Maximize Last Elements in Arrays\n\nYou are given two **0-indexed** integer arrays, `nums1` and `nums2`, both having length `n`.\n\n\nYou are allowed to perform a series of **operations** (**possibly none**).\n\n\nIn an operation, you select an index `i` in the range `[0, n - 1]` and **swap** the values of `nums1[i]` and `nums2[i]`.\n\n\nYour task is to find the **minimum** number of operations required to satisfy the following conditions:\n\n\n* `nums1[n - 1]` is equal to the **maximum value** among all elements of `nums1`, i.e., `nums1[n - 1] = max(nums1[0], nums1[1], ..., nums1[n - 1])`.\n* `nums2[n - 1]` is equal to the **maximum** **value** among all elements of `nums2`, i.e., `nums2[n - 1] = max(nums2[0], nums2[1], ..., nums2[n - 1])`.\n\n\nReturn *an integer denoting the **minimum** number of operations needed to meet **both** conditions*, *or* `-1` *if it is **impossible** to satisfy both conditions.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums1 = [1,2,7], nums2 = [4,5,3]\n**Output:** 1\n**Explanation:** In this example, an operation can be performed using index i = 2.\nWhen nums1[2] and nums2[2] are swapped, nums1 becomes [1,2,3] and nums2 becomes [4,5,7].\nBoth conditions are now satisfied.\nIt can be shown that the minimum number of operations needed to be performed is 1.\nSo, the answer is 1.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums1 = [2,3,4,5,9], nums2 = [8,8,4,4,4]\n**Output:** 2\n**Explanation:** In this example, the following operations can be performed:\nFirst operation using index i = 4.\nWhen nums1[4] and nums2[4] are swapped, nums1 becomes [2,3,4,5,4], and nums2 becomes [8,8,4,4,9].\nAnother operation using index i = 3.\nWhen nums1[3] and nums2[3] are swapped, nums1 becomes [2,3,4,4,4], and nums2 becomes [8,8,4,5,9].\nBoth conditions are now satisfied.\nIt can be shown that the minimum number of operations needed to be performed is 2.\nSo, the answer is 2. \n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums1 = [1,5,4], nums2 = [2,5,3]\n**Output:** -1\n**Explanation:** In this example, it is not possible to satisfy both conditions. \nSo, the answer is -1.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == nums1.length == nums2.length <= 1000`\n* `1 <= nums1[i] <= 109`\n* `1 <= nums2[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minOperations(self, nums1: List[int], nums2: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minOperations(**[[1, 2, 7], [4, 5, 3]]) == 1\nassert my_solution.minOperations(**[[2, 3, 4, 5, 9], [8, 8, 4, 4, 4]]) == 2\nassert my_solution.minOperations(**[[1, 5, 4], [2, 5, 3]]) == -1\nassert my_solution.minOperations(**[[1], [1]]) == 0\nassert my_solution.minOperations(**[[1, 2], [2, 1]]) == 1\nassert my_solution.minOperations(**[[1, 1, 10], [1, 5, 1]]) == 1\nassert my_solution.minOperations(**[[1, 4, 16], [16, 16, 16]]) == 0\nassert my_solution.minOperations(**[[1, 5, 15], [1, 1, 1]]) == 0\nassert my_solution.minOperations(**[[2, 5, 7], [2, 2, 2]]) == 0\nassert my_solution.minOperations(**[[8, 9, 10], [10, 9, 9]]) == 1\nassert my_solution.minOperations(**[[9, 14, 14], [14, 11, 14]]) == 0\nassert my_solution.minOperations(**[[16, 16, 16], [6, 7, 16]]) == 0\nassert my_solution.minOperations(**[[19, 7, 19], [5, 19, 19]]) == 0\nassert my_solution.minOperations(**[[1, 1, 8, 9], [1, 7, 1, 1]]) == 1\nassert my_solution.minOperations(**[[1, 5, 9, 9], [9, 9, 8, 9]]) == 0\nassert my_solution.minOperations(**[[1, 7, 7, 7], [7, 3, 3, 7]]) == 0\nassert my_solution.minOperations(**[[10, 18, 12, 12], [19, 6, 5, 12]]) == -1\nassert my_solution.minOperations(**[[12, 9, 11, 12], [3, 9, 9, 9]]) == 0\nassert my_solution.minOperations(**[[15, 54, 22, 54], [54, 19, 54, 54]]) == 0\nassert my_solution.minOperations(**[[20, 20, 20, 20], [5, 8, 19, 20]]) == 0\n"}, "labels": {"questionId": "3190", "questionFrontendId": "2934", "questionTitle": "Minimum Operations to Maximize Last Elements in Arrays", "stats": {"totalAccepted": "4K", "totalSubmission": "8.5K", "totalAcceptedRaw": 3987, "totalSubmissionRaw": 8460, "acRate": "47.1%"}, "probedCases": [{"inputs": [[1, 2, 7], [4, 5, 3]], "output": 1}, {"inputs": [[2, 3, 4, 5, 9], [8, 8, 4, 4, 4]], "output": 2}, {"inputs": [[1, 5, 4], [2, 5, 3]], "output": -1}, {"inputs": [[1], [1]], "output": 0}, {"inputs": [[1, 2], [2, 1]], "output": 1}, {"inputs": [[1, 1, 10], [1, 5, 1]], "output": 1}, {"inputs": [[1, 4, 16], [16, 16, 16]], "output": 0}, {"inputs": [[1, 5, 15], [1, 1, 1]], "output": 0}, {"inputs": [[2, 5, 7], [2, 2, 2]], "output": 0}, {"inputs": [[8, 9, 10], [10, 9, 9]], "output": 1}, {"inputs": [[9, 14, 14], [14, 11, 14]], "output": 0}, {"inputs": [[16, 16, 16], [6, 7, 16]], "output": 0}, {"inputs": [[19, 7, 19], [5, 19, 19]], "output": 0}, {"inputs": [[1, 1, 8, 9], [1, 7, 1, 1]], "output": 1}, {"inputs": [[1, 5, 9, 9], [9, 9, 8, 9]], "output": 0}, {"inputs": [[1, 7, 7, 7], [7, 3, 3, 7]], "output": 0}, {"inputs": [[10, 18, 12, 12], [19, 6, 5, 12]], "output": -1}, {"inputs": [[12, 9, 11, 12], [3, 9, 9, 9]], "output": 0}, {"inputs": [[15, 54, 22, 54], [54, 19, 54, 54]], "output": 0}, {"inputs": [[20, 20, 20, 20], [5, 8, 19, 20]], "output": 0}]}} +{"id": "LeetCode/3197", "content": "# Maximum Strong Pair XOR II\n\nYou are given a **0-indexed** integer array `nums`. A pair of integers `x` and `y` is called a **strong** pair if it satisfies the condition:\n\n\n* `|x - y| <= min(x, y)`\n\n\nYou need to select two integers from `nums` such that they form a strong pair and their bitwise `XOR` is the **maximum** among all strong pairs in the array.\n\n\nReturn *the **maximum*** `XOR` *value out of all possible strong pairs in the array* `nums`.\n\n\n**Note** that you can pick the same integer twice to form a pair.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4,5]\n**Output:** 7\n**Explanation:** There are 11 strong pairs in the array nums: (1, 1), (1, 2), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (3, 5), (4, 4), (4, 5) and (5, 5).\nThe maximum XOR possible from these pairs is 3 XOR 4 = 7.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [10,100]\n**Output:** 0\n**Explanation:** There are 2 strong pairs in the array nums: (10, 10) and (100, 100).\nThe maximum XOR possible from these pairs is 10 XOR 10 = 0 since the pair (100, 100) also gives 100 XOR 100 = 0.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [500,520,2500,3000]\n**Output:** 1020\n**Explanation:** There are 6 strong pairs in the array nums: (500, 500), (500, 520), (520, 520), (2500, 2500), (2500, 3000) and (3000, 3000).\nThe maximum XOR possible from these pairs is 500 XOR 520 = 1020 since the only other non-zero XOR value is 2500 XOR 3000 = 636.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 5 * 104`\n* `1 <= nums[i] <= 220 - 1`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumStrongPairXor(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumStrongPairXor(**[[1, 2, 3, 4, 5]]) == 7\nassert my_solution.maximumStrongPairXor(**[[10, 100]]) == 0\nassert my_solution.maximumStrongPairXor(**[[500, 520, 2500, 3000]]) == 1020\nassert my_solution.maximumStrongPairXor(**[[1]]) == 0\nassert my_solution.maximumStrongPairXor(**[[2, 3]]) == 1\nassert my_solution.maximumStrongPairXor(**[[3, 4]]) == 7\nassert my_solution.maximumStrongPairXor(**[[4, 5]]) == 1\nassert my_solution.maximumStrongPairXor(**[[5, 6]]) == 3\nassert my_solution.maximumStrongPairXor(**[[1, 1, 1]]) == 0\nassert my_solution.maximumStrongPairXor(**[[1, 1, 2]]) == 3\nassert my_solution.maximumStrongPairXor(**[[1, 1, 3]]) == 0\nassert my_solution.maximumStrongPairXor(**[[1, 1, 4]]) == 0\nassert my_solution.maximumStrongPairXor(**[[1, 1, 5]]) == 0\nassert my_solution.maximumStrongPairXor(**[[1, 2, 1]]) == 3\nassert my_solution.maximumStrongPairXor(**[[1, 2, 2]]) == 3\nassert my_solution.maximumStrongPairXor(**[[1, 2, 3]]) == 3\nassert my_solution.maximumStrongPairXor(**[[1, 2, 4]]) == 6\nassert my_solution.maximumStrongPairXor(**[[1, 2, 5]]) == 3\nassert my_solution.maximumStrongPairXor(**[[1, 3, 1]]) == 0\nassert my_solution.maximumStrongPairXor(**[[1, 3, 2]]) == 3\n"}, "labels": {"questionId": "3197", "questionFrontendId": "2935", "questionTitle": "Maximum Strong Pair XOR II", "stats": {"totalAccepted": "3.5K", "totalSubmission": "9.1K", "totalAcceptedRaw": 3499, "totalSubmissionRaw": 9066, "acRate": "38.6%"}, "probedCases": [{"inputs": [[1, 2, 3, 4, 5]], "output": 7}, {"inputs": [[10, 100]], "output": 0}, {"inputs": [[500, 520, 2500, 3000]], "output": 1020}, {"inputs": [[1]], "output": 0}, {"inputs": [[2, 3]], "output": 1}, {"inputs": [[3, 4]], "output": 7}, {"inputs": [[4, 5]], "output": 1}, {"inputs": [[5, 6]], "output": 3}, {"inputs": [[1, 1, 1]], "output": 0}, {"inputs": [[1, 1, 2]], "output": 3}, {"inputs": [[1, 1, 3]], "output": 0}, {"inputs": [[1, 1, 4]], "output": 0}, {"inputs": [[1, 1, 5]], "output": 0}, {"inputs": [[1, 2, 1]], "output": 3}, {"inputs": [[1, 2, 2]], "output": 3}, {"inputs": [[1, 2, 3]], "output": 3}, {"inputs": [[1, 2, 4]], "output": 6}, {"inputs": [[1, 2, 5]], "output": 3}, {"inputs": [[1, 3, 1]], "output": 0}, {"inputs": [[1, 3, 2]], "output": 3}]}} +{"id": "LeetCode/3199", "content": "# Distribute Candies Among Children I\n\nYou are given two positive integers `n` and `limit`.\n\n\nReturn *the **total number** of ways to distribute* `n` *candies among* `3` *children such that no child gets more than* `limit` *candies.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 5, limit = 2\n**Output:** 3\n**Explanation:** There are 3 ways to distribute 5 candies such that no child gets more than 2 candies: (1, 2, 2), (2, 1, 2) and (2, 2, 1).\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 3, limit = 3\n**Output:** 10\n**Explanation:** There are 10 ways to distribute 3 candies such that no child gets more than 3 candies: (0, 0, 3), (0, 1, 2), (0, 2, 1), (0, 3, 0), (1, 0, 2), (1, 1, 1), (1, 2, 0), (2, 0, 1), (2, 1, 0) and (3, 0, 0).\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 50`\n* `1 <= limit <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def distributeCandies(self, n: int, limit: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.distributeCandies(**[5, 2]) == 3\nassert my_solution.distributeCandies(**[3, 3]) == 10\nassert my_solution.distributeCandies(**[1, 1]) == 3\nassert my_solution.distributeCandies(**[1, 2]) == 3\nassert my_solution.distributeCandies(**[1, 3]) == 3\nassert my_solution.distributeCandies(**[1, 4]) == 3\nassert my_solution.distributeCandies(**[1, 5]) == 3\nassert my_solution.distributeCandies(**[1, 6]) == 3\nassert my_solution.distributeCandies(**[1, 7]) == 3\nassert my_solution.distributeCandies(**[1, 8]) == 3\nassert my_solution.distributeCandies(**[1, 9]) == 3\nassert my_solution.distributeCandies(**[1, 10]) == 3\nassert my_solution.distributeCandies(**[1, 11]) == 3\nassert my_solution.distributeCandies(**[1, 12]) == 3\nassert my_solution.distributeCandies(**[1, 13]) == 3\nassert my_solution.distributeCandies(**[1, 14]) == 3\nassert my_solution.distributeCandies(**[1, 15]) == 3\nassert my_solution.distributeCandies(**[1, 16]) == 3\nassert my_solution.distributeCandies(**[1, 17]) == 3\nassert my_solution.distributeCandies(**[1, 18]) == 3\n"}, "labels": {"questionId": "3199", "questionFrontendId": "2928", "questionTitle": "Distribute Candies Among Children I", "stats": {"totalAccepted": "3.5K", "totalSubmission": "4.7K", "totalAcceptedRaw": 3504, "totalSubmissionRaw": 4722, "acRate": "74.2%"}, "probedCases": [{"inputs": [5, 2], "output": 3}, {"inputs": [3, 3], "output": 10}, {"inputs": [1, 1], "output": 3}, {"inputs": [1, 2], "output": 3}, {"inputs": [1, 3], "output": 3}, {"inputs": [1, 4], "output": 3}, {"inputs": [1, 5], "output": 3}, {"inputs": [1, 6], "output": 3}, {"inputs": [1, 7], "output": 3}, {"inputs": [1, 8], "output": 3}, {"inputs": [1, 9], "output": 3}, {"inputs": [1, 10], "output": 3}, {"inputs": [1, 11], "output": 3}, {"inputs": [1, 12], "output": 3}, {"inputs": [1, 13], "output": 3}, {"inputs": [1, 14], "output": 3}, {"inputs": [1, 15], "output": 3}, {"inputs": [1, 16], "output": 3}, {"inputs": [1, 17], "output": 3}, {"inputs": [1, 18], "output": 3}]}} +{"id": "LeetCode/3201", "content": "# Distribute Candies Among Children II\n\nYou are given two positive integers `n` and `limit`.\n\n\nReturn *the **total number** of ways to distribute* `n` *candies among* `3` *children such that no child gets more than* `limit` *candies.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 5, limit = 2\n**Output:** 3\n**Explanation:** There are 3 ways to distribute 5 candies such that no child gets more than 2 candies: (1, 2, 2), (2, 1, 2) and (2, 2, 1).\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 3, limit = 3\n**Output:** 10\n**Explanation:** There are 10 ways to distribute 3 candies such that no child gets more than 3 candies: (0, 0, 3), (0, 1, 2), (0, 2, 1), (0, 3, 0), (1, 0, 2), (1, 1, 1), (1, 2, 0), (2, 0, 1), (2, 1, 0) and (3, 0, 0).\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 106`\n* `1 <= limit <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def distributeCandies(self, n: int, limit: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.distributeCandies(**[5, 2]) == 3\nassert my_solution.distributeCandies(**[3, 3]) == 10\nassert my_solution.distributeCandies(**[1, 1]) == 3\nassert my_solution.distributeCandies(**[1, 2]) == 3\nassert my_solution.distributeCandies(**[1, 3]) == 3\nassert my_solution.distributeCandies(**[1, 4]) == 3\nassert my_solution.distributeCandies(**[1, 5]) == 3\nassert my_solution.distributeCandies(**[1, 6]) == 3\nassert my_solution.distributeCandies(**[1, 7]) == 3\nassert my_solution.distributeCandies(**[1, 8]) == 3\nassert my_solution.distributeCandies(**[1, 9]) == 3\nassert my_solution.distributeCandies(**[1, 10]) == 3\nassert my_solution.distributeCandies(**[1, 11]) == 3\nassert my_solution.distributeCandies(**[1, 12]) == 3\nassert my_solution.distributeCandies(**[1, 13]) == 3\nassert my_solution.distributeCandies(**[1, 14]) == 3\nassert my_solution.distributeCandies(**[1, 15]) == 3\nassert my_solution.distributeCandies(**[1, 16]) == 3\nassert my_solution.distributeCandies(**[1, 17]) == 3\nassert my_solution.distributeCandies(**[1, 18]) == 3\n"}, "labels": {"questionId": "3201", "questionFrontendId": "2929", "questionTitle": "Distribute Candies Among Children II", "stats": {"totalAccepted": "2.8K", "totalSubmission": "7.6K", "totalAcceptedRaw": 2777, "totalSubmissionRaw": 7586, "acRate": "36.6%"}, "probedCases": [{"inputs": [5, 2], "output": 3}, {"inputs": [3, 3], "output": 10}, {"inputs": [1, 1], "output": 3}, {"inputs": [1, 2], "output": 3}, {"inputs": [1, 3], "output": 3}, {"inputs": [1, 4], "output": 3}, {"inputs": [1, 5], "output": 3}, {"inputs": [1, 6], "output": 3}, {"inputs": [1, 7], "output": 3}, {"inputs": [1, 8], "output": 3}, {"inputs": [1, 9], "output": 3}, {"inputs": [1, 10], "output": 3}, {"inputs": [1, 11], "output": 3}, {"inputs": [1, 12], "output": 3}, {"inputs": [1, 13], "output": 3}, {"inputs": [1, 14], "output": 3}, {"inputs": [1, 15], "output": 3}, {"inputs": [1, 16], "output": 3}, {"inputs": [1, 17], "output": 3}, {"inputs": [1, 18], "output": 3}]}} +{"id": "LeetCode/3200", "content": "# Number of Strings Which Can Be Rearranged to Contain Substring\n\nYou are given an integer `n`.\n\n\nA string `s` is called **good** if it contains only lowercase English characters **and** it is possible to rearrange the characters of `s` such that the new string contains `\"leet\"` as a **substring**.\n\n\nFor example:\n\n\n* The string `\"lteer\"` is good because we can rearrange it to form `\"leetr\"` .\n* `\"letl\"` is not good because we cannot rearrange it to contain `\"leet\"` as a substring.\n\n\nReturn *the **total** number of good strings of length* `n`.\n\n\nSince the answer may be large, return it **modulo** `109 + 7`.\n\n\nA **substring** is a contiguous sequence of characters within a string.\n\n\n \n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 4\n**Output:** 12\n**Explanation:** The 12 strings which can be rearranged to have \"leet\" as a substring are: \"eelt\", \"eetl\", \"elet\", \"elte\", \"etel\", \"etle\", \"leet\", \"lete\", \"ltee\", \"teel\", \"tele\", and \"tlee\".\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 10\n**Output:** 83943898\n**Explanation:** The number of strings with length 10 which can be rearranged to have \"leet\" as a substring is 526083947580. Hence the answer is 526083947580 % (109 + 7) = 83943898.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def stringCount(self, n: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.stringCount(**[4]) == 12\nassert my_solution.stringCount(**[10]) == 83943898\nassert my_solution.stringCount(**[1]) == 0\nassert my_solution.stringCount(**[2]) == 0\nassert my_solution.stringCount(**[3]) == 0\nassert my_solution.stringCount(**[5]) == 1460\nassert my_solution.stringCount(**[6]) == 106620\nassert my_solution.stringCount(**[7]) == 6058192\nassert my_solution.stringCount(**[8]) == 295164156\nassert my_solution.stringCount(**[9]) == 947613240\nassert my_solution.stringCount(**[11]) == 795234177\nassert my_solution.stringCount(**[12]) == 55396773\nassert my_solution.stringCount(**[13]) == 968092561\nassert my_solution.stringCount(**[14]) == 715599898\nassert my_solution.stringCount(**[15]) == 430509685\nassert my_solution.stringCount(**[16]) == 462719236\nassert my_solution.stringCount(**[17]) == 155543310\nassert my_solution.stringCount(**[18]) == 159683962\nassert my_solution.stringCount(**[19]) == 808507313\nassert my_solution.stringCount(**[20]) == 291395991\n"}, "labels": {"questionId": "3200", "questionFrontendId": "2930", "questionTitle": "Number of Strings Which Can Be Rearranged to Contain Substring", "stats": {"totalAccepted": "1.9K", "totalSubmission": "3K", "totalAcceptedRaw": 1862, "totalSubmissionRaw": 2990, "acRate": "62.3%"}, "probedCases": [{"inputs": [4], "output": 12}, {"inputs": [10], "output": 83943898}, {"inputs": [1], "output": 0}, {"inputs": [2], "output": 0}, {"inputs": [3], "output": 0}, {"inputs": [5], "output": 1460}, {"inputs": [6], "output": 106620}, {"inputs": [7], "output": 6058192}, {"inputs": [8], "output": 295164156}, {"inputs": [9], "output": 947613240}, {"inputs": [11], "output": 795234177}, {"inputs": [12], "output": 55396773}, {"inputs": [13], "output": 968092561}, {"inputs": [14], "output": 715599898}, {"inputs": [15], "output": 430509685}, {"inputs": [16], "output": 462719236}, {"inputs": [17], "output": 155543310}, {"inputs": [18], "output": 159683962}, {"inputs": [19], "output": 808507313}, {"inputs": [20], "output": 291395991}]}} +{"id": "LeetCode/3107", "content": "# Maximum Spending After Buying Items\n\nYou are given a **0-indexed** `m * n` integer matrix `values`, representing the values of `m * n` different items in `m` different shops. Each shop has `n` items where the `jth` item in the `ith` shop has a value of `values[i][j]`. Additionally, the items in the `ith` shop are sorted in non-increasing order of value. That is, `values[i][j] >= values[i][j + 1]` for all `0 <= j < n - 1`.\n\n\nOn each day, you would like to buy a single item from one of the shops. Specifically, On the `dth` day you can:\n\n\n* Pick any shop `i`.\n* Buy the rightmost available item `j` for the price of `values[i][j] * d`. That is, find the greatest index `j` such that item `j` was never bought before, and buy it for the price of `values[i][j] * d`.\n\n\n**Note** that all items are pairwise different. For example, if you have bought item `0` from shop `1`, you can still buy item `0` from any other shop.\n\n\nReturn *the **maximum amount of money that can be spent** on buying all* `m * n` *products*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** values = [[8,5,2],[6,4,1],[9,7,3]]\n**Output:** 285\n**Explanation:** On the first day, we buy product 2 from shop 1 for a price of values[1][2] * 1 = 1.\nOn the second day, we buy product 2 from shop 0 for a price of values[0][2] * 2 = 4.\nOn the third day, we buy product 2 from shop 2 for a price of values[2][2] * 3 = 9.\nOn the fourth day, we buy product 1 from shop 1 for a price of values[1][1] * 4 = 16.\nOn the fifth day, we buy product 1 from shop 0 for a price of values[0][1] * 5 = 25.\nOn the sixth day, we buy product 0 from shop 1 for a price of values[1][0] * 6 = 36.\nOn the seventh day, we buy product 1 from shop 2 for a price of values[2][1] * 7 = 49.\nOn the eighth day, we buy product 0 from shop 0 for a price of values[0][0] * 8 = 64.\nOn the ninth day, we buy product 0 from shop 2 for a price of values[2][0] * 9 = 81.\nHence, our total spending is equal to 285.\nIt can be shown that 285 is the maximum amount of money that can be spent buying all m * n products. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** values = [[10,8,6,4,2],[9,7,5,3,2]]\n**Output:** 386\n**Explanation:** On the first day, we buy product 4 from shop 0 for a price of values[0][4] * 1 = 2.\nOn the second day, we buy product 4 from shop 1 for a price of values[1][4] * 2 = 4.\nOn the third day, we buy product 3 from shop 1 for a price of values[1][3] * 3 = 9.\nOn the fourth day, we buy product 3 from shop 0 for a price of values[0][3] * 4 = 16.\nOn the fifth day, we buy product 2 from shop 1 for a price of values[1][2] * 5 = 25.\nOn the sixth day, we buy product 2 from shop 0 for a price of values[0][2] * 6 = 36.\nOn the seventh day, we buy product 1 from shop 1 for a price of values[1][1] * 7 = 49.\nOn the eighth day, we buy product 1 from shop 0 for a price of values[0][1] * 8 = 64\nOn the ninth day, we buy product 0 from shop 1 for a price of values[1][0] * 9 = 81.\nOn the tenth day, we buy product 0 from shop 0 for a price of values[0][0] * 10 = 100.\nHence, our total spending is equal to 386.\nIt can be shown that 386 is the maximum amount of money that can be spent buying all m * n products.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= m == values.length <= 10`\n* `1 <= n == values[i].length <= 104`\n* `1 <= values[i][j] <= 106`\n* `values[i]` are sorted in non-increasing order.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxSpending(self, values: List[List[int]]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxSpending(**[[[8, 5, 2], [6, 4, 1], [9, 7, 3]]]) == 285\nassert my_solution.maxSpending(**[[[10, 8, 6, 4, 2], [9, 7, 5, 3, 2]]]) == 386\nassert my_solution.maxSpending(**[[[1000000]]]) == 1000000\nassert my_solution.maxSpending(**[[[1]]]) == 1\nassert my_solution.maxSpending(**[[[1], [2]]]) == 5\nassert my_solution.maxSpending(**[[[2], [1]]]) == 5\nassert my_solution.maxSpending(**[[[1], [1]]]) == 3\nassert my_solution.maxSpending(**[[[5, 2]]]) == 12\nassert my_solution.maxSpending(**[[[5, 5]]]) == 15\nassert my_solution.maxSpending(**[[[7, 5]]]) == 19\nassert my_solution.maxSpending(**[[[3, 2, 1]]]) == 14\nassert my_solution.maxSpending(**[[[2, 2, 1]]]) == 11\nassert my_solution.maxSpending(**[[[3, 3, 2]]]) == 17\nassert my_solution.maxSpending(**[[[3], [2], [1]]]) == 14\nassert my_solution.maxSpending(**[[[2], [10], [1]]]) == 35\nassert my_solution.maxSpending(**[[[1000000, 1000000, 1000000]]]) == 6000000\nassert my_solution.maxSpending(**[[[1000000, 1000000, 1000000, 1000000]]]) == 10000000\nassert my_solution.maxSpending(**[[[1000000], [1000000], [1000000], [1000000]]]) == 10000000\nassert my_solution.maxSpending(**[[[1000000, 1000000], [1000000, 1000000]]]) == 10000000\nassert my_solution.maxSpending(**[[[2, 1], [4, 3]]]) == 30\n"}, "labels": {"questionId": "3107", "questionFrontendId": "2931", "questionTitle": "Maximum Spending After Buying Items", "stats": {"totalAccepted": "2.1K", "totalSubmission": "3.1K", "totalAcceptedRaw": 2144, "totalSubmissionRaw": 3118, "acRate": "68.8%"}, "probedCases": [{"inputs": [[[8, 5, 2], [6, 4, 1], [9, 7, 3]]], "output": 285}, {"inputs": [[[10, 8, 6, 4, 2], [9, 7, 5, 3, 2]]], "output": 386}, {"inputs": [[[1000000]]], "output": 1000000}, {"inputs": [[[1]]], "output": 1}, {"inputs": [[[1], [2]]], "output": 5}, {"inputs": [[[2], [1]]], "output": 5}, {"inputs": [[[1], [1]]], "output": 3}, {"inputs": [[[5, 2]]], "output": 12}, {"inputs": [[[5, 5]]], "output": 15}, {"inputs": [[[7, 5]]], "output": 19}, {"inputs": [[[3, 2, 1]]], "output": 14}, {"inputs": [[[2, 2, 1]]], "output": 11}, {"inputs": [[[3, 3, 2]]], "output": 17}, {"inputs": [[[3], [2], [1]]], "output": 14}, {"inputs": [[[2], [10], [1]]], "output": 35}, {"inputs": [[[1000000, 1000000, 1000000]]], "output": 6000000}, {"inputs": [[[1000000, 1000000, 1000000, 1000000]]], "output": 10000000}, {"inputs": [[[1000000], [1000000], [1000000], [1000000]]], "output": 10000000}, {"inputs": [[[1000000, 1000000], [1000000, 1000000]]], "output": 10000000}, {"inputs": [[[2, 1], [4, 3]]], "output": 30}]}} +{"id": "LeetCode/3188", "content": "# Find Champion I\n\nThere are `n` teams numbered from `0` to `n - 1` in a tournament.\n\n\nGiven a **0-indexed** 2D boolean matrix `grid` of size `n * n`. For all `i, j` that `0 <= i, j <= n - 1` and `i != j` team `i` is **stronger** than team `j` if `grid[i][j] == 1`, otherwise, team `j` is **stronger** than team `i`.\n\n\nTeam `a` will be the **champion** of the tournament if there is no team `b` that is stronger than team `a`.\n\n\nReturn *the team that will be the champion of the tournament.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** grid = [[0,1],[0,0]]\n**Output:** 0\n**Explanation:** There are two teams in this tournament.\ngrid[0][1] == 1 means that team 0 is stronger than team 1. So team 0 will be the champion.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** grid = [[0,0,1],[1,0,1],[0,0,0]]\n**Output:** 1\n**Explanation:** There are three teams in this tournament.\ngrid[1][0] == 1 means that team 1 is stronger than team 0.\ngrid[1][2] == 1 means that team 1 is stronger than team 2.\nSo team 1 will be the champion.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `n == grid.length`\n* `n == grid[i].length`\n* `2 <= n <= 100`\n* `grid[i][j]` is either `0` or `1`.\n* For all `i grid[i][i]` is `0.`\n* For all `i, j` that `i != j`, `grid[i][j] != grid[j][i]`.\n* The input is generated such that if team `a` is stronger than team `b` and team `b` is stronger than team `c`, then team `a` is stronger than team `c`.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findChampion(self, grid: List[List[int]]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findChampion(**[[[0, 1], [0, 0]]]) == 0\nassert my_solution.findChampion(**[[[0, 0, 1], [1, 0, 1], [0, 0, 0]]]) == 1\nassert my_solution.findChampion(**[[[0, 0], [1, 0]]]) == 1\nassert my_solution.findChampion(**[[[0, 0, 0], [1, 0, 0], [1, 1, 0]]]) == 2\nassert my_solution.findChampion(**[[[0, 0, 0], [1, 0, 1], [1, 0, 0]]]) == 1\nassert my_solution.findChampion(**[[[0, 1, 0], [0, 0, 0], [1, 1, 0]]]) == 2\nassert my_solution.findChampion(**[[[0, 1, 1], [0, 0, 0], [0, 1, 0]]]) == 0\nassert my_solution.findChampion(**[[[0, 1, 1], [0, 0, 1], [0, 0, 0]]]) == 0\nassert my_solution.findChampion(**[[[0, 0, 0, 0], [1, 0, 0, 0], [1, 1, 0, 0], [1, 1, 1, 0]]]) == 3\nassert my_solution.findChampion(**[[[0, 0, 0, 0], [1, 0, 0, 0], [1, 1, 0, 1], [1, 1, 0, 0]]]) == 2\nassert my_solution.findChampion(**[[[0, 0, 0, 0], [1, 0, 0, 1], [1, 1, 0, 1], [1, 0, 0, 0]]]) == 2\nassert my_solution.findChampion(**[[[0, 0, 0, 0], [1, 0, 1, 0], [1, 0, 0, 0], [1, 1, 1, 0]]]) == 3\nassert my_solution.findChampion(**[[[0, 0, 0, 0], [1, 0, 1, 1], [1, 0, 0, 0], [1, 0, 1, 0]]]) == 1\nassert my_solution.findChampion(**[[[0, 0, 0, 0], [1, 0, 1, 1], [1, 0, 0, 1], [1, 0, 0, 0]]]) == 1\nassert my_solution.findChampion(**[[[0, 0, 0, 1], [1, 0, 0, 1], [1, 1, 0, 1], [0, 0, 0, 0]]]) == 2\nassert my_solution.findChampion(**[[[0, 0, 0, 1], [1, 0, 1, 1], [1, 0, 0, 1], [0, 0, 0, 0]]]) == 1\nassert my_solution.findChampion(**[[[0, 0, 1, 0], [1, 0, 1, 0], [0, 0, 0, 0], [1, 1, 1, 0]]]) == 3\nassert my_solution.findChampion(**[[[0, 0, 1, 0], [1, 0, 1, 1], [0, 0, 0, 0], [1, 0, 1, 0]]]) == 1\nassert my_solution.findChampion(**[[[0, 0, 1, 1], [1, 0, 1, 1], [0, 0, 0, 0], [0, 0, 1, 0]]]) == 1\nassert my_solution.findChampion(**[[[0, 0, 1, 1], [1, 0, 1, 1], [0, 0, 0, 1], [0, 0, 0, 0]]]) == 1\n"}, "labels": {"questionId": "3188", "questionFrontendId": "2923", "questionTitle": "Find Champion I", "stats": {"totalAccepted": "6.3K", "totalSubmission": "8.3K", "totalAcceptedRaw": 6315, "totalSubmissionRaw": 8300, "acRate": "76.1%"}, "probedCases": [{"inputs": [[[0, 1], [0, 0]]], "output": 0}, {"inputs": [[[0, 0, 1], [1, 0, 1], [0, 0, 0]]], "output": 1}, {"inputs": [[[0, 0], [1, 0]]], "output": 1}, {"inputs": [[[0, 0, 0], [1, 0, 0], [1, 1, 0]]], "output": 2}, {"inputs": [[[0, 0, 0], [1, 0, 1], [1, 0, 0]]], "output": 1}, {"inputs": [[[0, 1, 0], [0, 0, 0], [1, 1, 0]]], "output": 2}, {"inputs": [[[0, 1, 1], [0, 0, 0], [0, 1, 0]]], "output": 0}, {"inputs": [[[0, 1, 1], [0, 0, 1], [0, 0, 0]]], "output": 0}, {"inputs": [[[0, 0, 0, 0], [1, 0, 0, 0], [1, 1, 0, 0], [1, 1, 1, 0]]], "output": 3}, {"inputs": [[[0, 0, 0, 0], [1, 0, 0, 0], [1, 1, 0, 1], [1, 1, 0, 0]]], "output": 2}, {"inputs": [[[0, 0, 0, 0], [1, 0, 0, 1], [1, 1, 0, 1], [1, 0, 0, 0]]], "output": 2}, {"inputs": [[[0, 0, 0, 0], [1, 0, 1, 0], [1, 0, 0, 0], [1, 1, 1, 0]]], "output": 3}, {"inputs": [[[0, 0, 0, 0], [1, 0, 1, 1], [1, 0, 0, 0], [1, 0, 1, 0]]], "output": 1}, {"inputs": [[[0, 0, 0, 0], [1, 0, 1, 1], [1, 0, 0, 1], [1, 0, 0, 0]]], "output": 1}, {"inputs": [[[0, 0, 0, 1], [1, 0, 0, 1], [1, 1, 0, 1], [0, 0, 0, 0]]], "output": 2}, {"inputs": [[[0, 0, 0, 1], [1, 0, 1, 1], [1, 0, 0, 1], [0, 0, 0, 0]]], "output": 1}, {"inputs": [[[0, 0, 1, 0], [1, 0, 1, 0], [0, 0, 0, 0], [1, 1, 1, 0]]], "output": 3}, {"inputs": [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 0, 0, 0], [1, 0, 1, 0]]], "output": 1}, {"inputs": [[[0, 0, 1, 1], [1, 0, 1, 1], [0, 0, 0, 0], [0, 0, 1, 0]]], "output": 1}, {"inputs": [[[0, 0, 1, 1], [1, 0, 1, 1], [0, 0, 0, 1], [0, 0, 0, 0]]], "output": 1}]}} +{"id": "LeetCode/3184", "content": "# Maximum Balanced Subsequence Sum\n\nYou are given a **0-indexed** integer array `nums`.\n\n\nA **subsequence** of `nums` having length `k` and consisting of **indices** `i0 < i1 < ... < ik-1` is **balanced** if the following holds:\n\n\n* `nums[ij] - nums[ij-1] >= ij - ij-1`, for every `j` in the range `[1, k - 1]`.\n\n\nA **subsequence** of `nums` having length `1` is considered balanced.\n\n\nReturn *an integer denoting the **maximum** possible **sum of elements** in a **balanced** subsequence of* `nums`.\n\n\nA **subsequence** of an array is a new **non-empty** array that is formed from the original array by deleting some (**possibly none**) of the elements without disturbing the relative positions of the remaining elements.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [3,3,5,6]\n**Output:** 14\n**Explanation:** In this example, the subsequence [3,5,6] consisting of indices 0, 2, and 3 can be selected.\nnums[2] - nums[0] >= 2 - 0.\nnums[3] - nums[2] >= 3 - 2.\nHence, it is a balanced subsequence, and its sum is the maximum among the balanced subsequences of nums.\nThe subsequence consisting of indices 1, 2, and 3 is also valid.\nIt can be shown that it is not possible to get a balanced subsequence with a sum greater than 14.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,-1,-3,8]\n**Output:** 13\n**Explanation:** In this example, the subsequence [5,8] consisting of indices 0 and 3 can be selected.\nnums[3] - nums[0] >= 3 - 0.\nHence, it is a balanced subsequence, and its sum is the maximum among the balanced subsequences of nums.\nIt can be shown that it is not possible to get a balanced subsequence with a sum greater than 13.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [-2,-1]\n**Output:** -1\n**Explanation:** In this example, the subsequence [-1] can be selected.\nIt is a balanced subsequence, and its sum is the maximum among the balanced subsequences of nums.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `-109 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxBalancedSubsequenceSum(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxBalancedSubsequenceSum(**[[3, 3, 5, 6]]) == 14\nassert my_solution.maxBalancedSubsequenceSum(**[[5, -1, -3, 8]]) == 13\nassert my_solution.maxBalancedSubsequenceSum(**[[-2, -1]]) == -1\nassert my_solution.maxBalancedSubsequenceSum(**[[0]]) == 0\nassert my_solution.maxBalancedSubsequenceSum(**[[-47]]) == -47\nassert my_solution.maxBalancedSubsequenceSum(**[[-8]]) == -8\nassert my_solution.maxBalancedSubsequenceSum(**[[-7]]) == -7\nassert my_solution.maxBalancedSubsequenceSum(**[[-6]]) == -6\nassert my_solution.maxBalancedSubsequenceSum(**[[-5]]) == -5\nassert my_solution.maxBalancedSubsequenceSum(**[[-3]]) == -3\nassert my_solution.maxBalancedSubsequenceSum(**[[-2]]) == -2\nassert my_solution.maxBalancedSubsequenceSum(**[[-1]]) == -1\nassert my_solution.maxBalancedSubsequenceSum(**[[1]]) == 1\nassert my_solution.maxBalancedSubsequenceSum(**[[3]]) == 3\nassert my_solution.maxBalancedSubsequenceSum(**[[4]]) == 4\nassert my_solution.maxBalancedSubsequenceSum(**[[5]]) == 5\nassert my_solution.maxBalancedSubsequenceSum(**[[7]]) == 7\nassert my_solution.maxBalancedSubsequenceSum(**[[8]]) == 8\nassert my_solution.maxBalancedSubsequenceSum(**[[9]]) == 9\nassert my_solution.maxBalancedSubsequenceSum(**[[45]]) == 45\n"}, "labels": {"questionId": "3184", "questionFrontendId": "2926", "questionTitle": "Maximum Balanced Subsequence Sum", "stats": {"totalAccepted": "2.7K", "totalSubmission": "7.2K", "totalAcceptedRaw": 2737, "totalSubmissionRaw": 7185, "acRate": "38.1%"}, "probedCases": [{"inputs": [[3, 3, 5, 6]], "output": 14}, {"inputs": [[5, -1, -3, 8]], "output": 13}, {"inputs": [[-2, -1]], "output": -1}, {"inputs": [[0]], "output": 0}, {"inputs": [[-47]], "output": -47}, {"inputs": [[-8]], "output": -8}, {"inputs": [[-7]], "output": -7}, {"inputs": [[-6]], "output": -6}, {"inputs": [[-5]], "output": -5}, {"inputs": [[-3]], "output": -3}, {"inputs": [[-2]], "output": -2}, {"inputs": [[-1]], "output": -1}, {"inputs": [[1]], "output": 1}, {"inputs": [[3]], "output": 3}, {"inputs": [[4]], "output": 4}, {"inputs": [[5]], "output": 5}, {"inputs": [[7]], "output": 7}, {"inputs": [[8]], "output": 8}, {"inputs": [[9]], "output": 9}, {"inputs": [[45]], "output": 45}]}} +{"id": "LeetCode/3183", "content": "# Find the K-or of an Array\n\nYou are given a **0-indexed** integer array `nums`, and an integer `k`.\n\n\nThe **K-or** of `nums` is a non-negative integer that satisfies the following:\n\n\n* The `ith` bit is set in the K-or **if and only if** there are at least `k` elements of nums in which bit `i` is set.\n\n\nReturn *the **K-or** of* `nums`.\n\n\n**Note** that a bit `i` is set in `x` if `(2i AND x) == 2i`, where `AND` is the bitwise `AND` operator.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [7,12,9,8,9,15], k = 4\n**Output:** 9\n**Explanation:** Bit 0 is set at nums[0], nums[2], nums[4], and nums[5].\nBit 1 is set at nums[0], and nums[5].\nBit 2 is set at nums[0], nums[1], and nums[5].\nBit 3 is set at nums[1], nums[2], nums[3], nums[4], and nums[5].\nOnly bits 0 and 3 are set in at least k elements of the array, and bits i >= 4 are not set in any of the array's elements. Hence, the answer is 2^0 + 2^3 = 9.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,12,1,11,4,5], k = 6\n**Output:** 0\n**Explanation:** Since k == 6 == nums.length, the 6-or of the array is equal to the bitwise AND of all its elements. Hence, the answer is 2 AND 12 AND 1 AND 11 AND 4 AND 5 = 0.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [10,8,5,9,11,6,8], k = 1\n**Output:** 15\n**Explanation:** Since k == 1, the 1-or of the array is equal to the bitwise OR of all its elements. Hence, the answer is 10 OR 8 OR 5 OR 9 OR 11 OR 6 OR 8 = 15.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 50`\n* `0 <= nums[i] < 231`\n* `1 <= k <= nums.length`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findKOr(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findKOr(**[[7, 12, 9, 8, 9, 15], 4]) == 9\nassert my_solution.findKOr(**[[2, 12, 1, 11, 4, 5], 6]) == 0\nassert my_solution.findKOr(**[[10, 8, 5, 9, 11, 6, 8], 1]) == 15\nassert my_solution.findKOr(**[[14, 7, 12, 9, 8, 9, 1, 15], 4]) == 13\nassert my_solution.findKOr(**[[2, 12, 1, 11, 4, 5], 3]) == 5\nassert my_solution.findKOr(**[[10, 8, 5, 10, 11, 11, 6, 8], 1]) == 15\nassert my_solution.findKOr(**[[0], 1]) == 0\nassert my_solution.findKOr(**[[1], 1]) == 1\nassert my_solution.findKOr(**[[2], 1]) == 2\nassert my_solution.findKOr(**[[3], 1]) == 3\nassert my_solution.findKOr(**[[4], 1]) == 4\nassert my_solution.findKOr(**[[5], 1]) == 5\nassert my_solution.findKOr(**[[6], 1]) == 6\nassert my_solution.findKOr(**[[7], 1]) == 7\nassert my_solution.findKOr(**[[8], 1]) == 8\nassert my_solution.findKOr(**[[9], 1]) == 9\nassert my_solution.findKOr(**[[10], 1]) == 10\nassert my_solution.findKOr(**[[11], 1]) == 11\nassert my_solution.findKOr(**[[12], 1]) == 12\nassert my_solution.findKOr(**[[13], 1]) == 13\n"}, "labels": {"questionId": "3183", "questionFrontendId": "2917", "questionTitle": "Find the K-or of an Array", "stats": {"totalAccepted": "5.6K", "totalSubmission": "7.9K", "totalAcceptedRaw": 5625, "totalSubmissionRaw": 7924, "acRate": "71.0%"}, "probedCases": [{"inputs": [[7, 12, 9, 8, 9, 15], 4], "output": 9}, {"inputs": [[2, 12, 1, 11, 4, 5], 6], "output": 0}, {"inputs": [[10, 8, 5, 9, 11, 6, 8], 1], "output": 15}, {"inputs": [[14, 7, 12, 9, 8, 9, 1, 15], 4], "output": 13}, {"inputs": [[2, 12, 1, 11, 4, 5], 3], "output": 5}, {"inputs": [[10, 8, 5, 10, 11, 11, 6, 8], 1], "output": 15}, {"inputs": [[0], 1], "output": 0}, {"inputs": [[1], 1], "output": 1}, {"inputs": [[2], 1], "output": 2}, {"inputs": [[3], 1], "output": 3}, {"inputs": [[4], 1], "output": 4}, {"inputs": [[5], 1], "output": 5}, {"inputs": [[6], 1], "output": 6}, {"inputs": [[7], 1], "output": 7}, {"inputs": [[8], 1], "output": 8}, {"inputs": [[9], 1], "output": 9}, {"inputs": [[10], 1], "output": 10}, {"inputs": [[11], 1], "output": 11}, {"inputs": [[12], 1], "output": 12}, {"inputs": [[13], 1], "output": 13}]}} +{"id": "LeetCode/3171", "content": "# Minimum Equal Sum of Two Arrays After Replacing Zeros\n\nYou are given two arrays `nums1` and `nums2` consisting of positive integers.\n\n\nYou have to replace **all** the `0`'s in both arrays with **strictly** positive integers such that the sum of elements of both arrays becomes **equal**.\n\n\nReturn *the **minimum** equal sum you can obtain, or* `-1` *if it is impossible*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums1 = [3,2,0,1,0], nums2 = [6,5,0]\n**Output:** 12\n**Explanation:** We can replace 0's in the following way:\n- Replace the two 0's in nums1 with the values 2 and 4. The resulting array is nums1 = [3,2,2,1,4].\n- Replace the 0 in nums2 with the value 1. The resulting array is nums2 = [6,5,1].\nBoth arrays have an equal sum of 12. It can be shown that it is the minimum sum we can obtain.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums1 = [2,0,2,0], nums2 = [1,4]\n**Output:** -1\n**Explanation:** It is impossible to make the sum of both arrays equal.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums1.length, nums2.length <= 105`\n* `0 <= nums1[i], nums2[i] <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minSum(self, nums1: List[int], nums2: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minSum(**[[3, 2, 0, 1, 0], [6, 5, 0]]) == 12\nassert my_solution.minSum(**[[2, 0, 2, 0], [1, 4]]) == -1\nassert my_solution.minSum(**[[0, 7, 28, 17, 18], [1, 2, 6, 26, 1, 0, 27, 3, 0, 30]]) == 98\nassert my_solution.minSum(**[[8, 13, 15, 18, 0, 18, 0, 0, 5, 20, 12, 27, 3, 14, 22, 0], [29, 1, 6, 0, 10, 24, 27, 17, 14, 13, 2, 19, 2, 11]]) == 179\nassert my_solution.minSum(**[[9, 5], [15, 12, 5, 21, 4, 26, 27, 9, 6, 29, 0, 18, 16, 0, 0, 0, 20]]) == -1\nassert my_solution.minSum(**[[0, 29, 5, 22, 5, 9, 30, 11, 20, 0, 18, 16, 26, 11, 3, 0, 24, 24, 14, 24], [30, 12, 16, 3, 24, 6, 13, 0, 16]]) == 294\nassert my_solution.minSum(**[[9, 13, 0, 0, 12, 10, 0, 8, 0, 0, 5, 13, 0], [8, 14, 11, 2, 27, 0, 0]]) == 76\nassert my_solution.minSum(**[[3, 0, 20, 9, 20, 0, 20, 25, 26, 9, 0, 12, 6, 11, 0, 6], [0, 3, 8, 13, 27, 0, 0, 0, 29, 27, 0, 11, 23, 0, 19, 19, 0]]) == 186\nassert my_solution.minSum(**[[25, 28, 13, 0, 14, 23, 14, 0, 3, 3, 12], [24, 30, 0, 15, 20, 19, 18, 0, 23, 23, 0, 16, 26, 0, 29, 19, 16, 25]]) == 307\nassert my_solution.minSum(**[[0, 29, 30, 18, 5, 24, 16, 5, 17, 0, 18, 16, 26, 0, 15, 19, 14, 20, 3, 26], [0, 8, 14, 11, 13, 6, 8, 0, 13]]) == 304\nassert my_solution.minSum(**[[0, 17, 20, 17, 5, 0, 14, 19, 7, 8, 16, 18, 6], [21, 1, 27, 19, 2, 2, 24, 21, 16, 1, 13, 27, 8, 5, 3, 11, 13, 7, 29, 7]]) == 257\nassert my_solution.minSum(**[[26, 1, 25, 10, 14, 14, 4, 0, 10, 0, 23], [23, 8, 30, 18, 8, 15, 6, 9, 0, 2, 0, 0, 19, 8, 19, 4, 10]]) == 182\nassert my_solution.minSum(**[[15, 10, 7, 16], [8, 16, 2, 6, 4, 12, 6, 16, 24, 0]]) == -1\nassert my_solution.minSum(**[[0, 0, 0, 17, 0, 6, 2, 22, 12, 0, 25, 18, 1, 12, 19, 0, 0], [0, 0, 0, 30, 4, 3, 13, 25, 9, 25, 3, 0, 1, 12, 2, 10, 4, 7, 30, 16]]) == 198\nassert my_solution.minSum(**[[23, 17], [7, 3, 22, 0, 12]]) == -1\nassert my_solution.minSum(**[[15, 0, 8, 30, 6, 3, 24, 6, 0, 11, 13, 30, 6, 25, 23, 3], [12, 20, 0, 6, 0, 0, 14, 0, 0, 8, 5, 19, 16, 0, 0, 15]]) == 205\nassert my_solution.minSum(**[[3, 25, 1, 13], [19, 13, 10, 27, 10, 20, 27, 0, 3, 12, 16, 26, 0, 27]]) == -1\nassert my_solution.minSum(**[[0, 0], [29, 28]]) == 57\nassert my_solution.minSum(**[[17, 4, 11, 8, 0, 17, 0, 0, 12, 27, 20, 28, 0, 30, 21, 18, 12], [0, 2, 30, 0, 5, 17, 0, 0, 0, 15, 11, 2, 25, 18, 18]]) == 229\nassert my_solution.minSum(**[[0, 17, 0, 7, 29, 10, 22, 27, 13, 8, 19], [26, 23, 8, 14, 0, 17, 20, 4, 26, 15, 0, 9, 14, 0, 12, 10, 23, 16]]) == 240\n"}, "labels": {"questionId": "3171", "questionFrontendId": "2918", "questionTitle": "Minimum Equal Sum of Two Arrays After Replacing Zeros", "stats": {"totalAccepted": "5.4K", "totalSubmission": "15.3K", "totalAcceptedRaw": 5439, "totalSubmissionRaw": 15335, "acRate": "35.5%"}, "probedCases": [{"inputs": [[3, 2, 0, 1, 0], [6, 5, 0]], "output": 12}, {"inputs": [[2, 0, 2, 0], [1, 4]], "output": -1}, {"inputs": [[0, 7, 28, 17, 18], [1, 2, 6, 26, 1, 0, 27, 3, 0, 30]], "output": 98}, {"inputs": [[8, 13, 15, 18, 0, 18, 0, 0, 5, 20, 12, 27, 3, 14, 22, 0], [29, 1, 6, 0, 10, 24, 27, 17, 14, 13, 2, 19, 2, 11]], "output": 179}, {"inputs": [[9, 5], [15, 12, 5, 21, 4, 26, 27, 9, 6, 29, 0, 18, 16, 0, 0, 0, 20]], "output": -1}, {"inputs": [[0, 29, 5, 22, 5, 9, 30, 11, 20, 0, 18, 16, 26, 11, 3, 0, 24, 24, 14, 24], [30, 12, 16, 3, 24, 6, 13, 0, 16]], "output": 294}, {"inputs": [[9, 13, 0, 0, 12, 10, 0, 8, 0, 0, 5, 13, 0], [8, 14, 11, 2, 27, 0, 0]], "output": 76}, {"inputs": [[3, 0, 20, 9, 20, 0, 20, 25, 26, 9, 0, 12, 6, 11, 0, 6], [0, 3, 8, 13, 27, 0, 0, 0, 29, 27, 0, 11, 23, 0, 19, 19, 0]], "output": 186}, {"inputs": [[25, 28, 13, 0, 14, 23, 14, 0, 3, 3, 12], [24, 30, 0, 15, 20, 19, 18, 0, 23, 23, 0, 16, 26, 0, 29, 19, 16, 25]], "output": 307}, {"inputs": [[0, 29, 30, 18, 5, 24, 16, 5, 17, 0, 18, 16, 26, 0, 15, 19, 14, 20, 3, 26], [0, 8, 14, 11, 13, 6, 8, 0, 13]], "output": 304}, {"inputs": [[0, 17, 20, 17, 5, 0, 14, 19, 7, 8, 16, 18, 6], [21, 1, 27, 19, 2, 2, 24, 21, 16, 1, 13, 27, 8, 5, 3, 11, 13, 7, 29, 7]], "output": 257}, {"inputs": [[26, 1, 25, 10, 14, 14, 4, 0, 10, 0, 23], [23, 8, 30, 18, 8, 15, 6, 9, 0, 2, 0, 0, 19, 8, 19, 4, 10]], "output": 182}, {"inputs": [[15, 10, 7, 16], [8, 16, 2, 6, 4, 12, 6, 16, 24, 0]], "output": -1}, {"inputs": [[0, 0, 0, 17, 0, 6, 2, 22, 12, 0, 25, 18, 1, 12, 19, 0, 0], [0, 0, 0, 30, 4, 3, 13, 25, 9, 25, 3, 0, 1, 12, 2, 10, 4, 7, 30, 16]], "output": 198}, {"inputs": [[23, 17], [7, 3, 22, 0, 12]], "output": -1}, {"inputs": [[15, 0, 8, 30, 6, 3, 24, 6, 0, 11, 13, 30, 6, 25, 23, 3], [12, 20, 0, 6, 0, 0, 14, 0, 0, 8, 5, 19, 16, 0, 0, 15]], "output": 205}, {"inputs": [[3, 25, 1, 13], [19, 13, 10, 27, 10, 20, 27, 0, 3, 12, 16, 26, 0, 27]], "output": -1}, {"inputs": [[0, 0], [29, 28]], "output": 57}, {"inputs": [[17, 4, 11, 8, 0, 17, 0, 0, 12, 27, 20, 28, 0, 30, 21, 18, 12], [0, 2, 30, 0, 5, 17, 0, 0, 0, 15, 11, 2, 25, 18, 18]], "output": 229}, {"inputs": [[0, 17, 0, 7, 29, 10, 22, 27, 13, 8, 19], [26, 23, 8, 14, 0, 17, 20, 4, 26, 15, 0, 9, 14, 0, 12, 10, 23, 16]], "output": 240}]}} +{"id": "LeetCode/3178", "content": "# Minimum Increment Operations to Make Array Beautiful\n\nYou are given a **0-indexed** integer array `nums` having length `n`, and an integer `k`.\n\n\nYou can perform the following **increment** operation **any** number of times (**including zero**):\n\n\n* Choose an index `i` in the range `[0, n - 1]`, and increase `nums[i]` by `1`.\n\n\nAn array is considered **beautiful** if, for any **subarray** with a size of `3` or **more**, its **maximum** element is **greater than or equal** to `k`.\n\n\nReturn *an integer denoting the **minimum** number of increment operations needed to make* `nums` ***beautiful**.*\n\n\nA subarray is a contiguous **non-empty** sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,3,0,0,2], k = 4\n**Output:** 3\n**Explanation:** We can perform the following increment operations to make nums beautiful:\nChoose index i = 1 and increase nums[1] by 1 -> [2,4,0,0,2].\nChoose index i = 4 and increase nums[4] by 1 -> [2,4,0,0,3].\nChoose index i = 4 and increase nums[4] by 1 -> [2,4,0,0,4].\nThe subarrays with a size of 3 or more are: [2,4,0], [4,0,0], [0,0,4], [2,4,0,0], [4,0,0,4], [2,4,0,0,4].\nIn all the subarrays, the maximum element is equal to k = 4, so nums is now beautiful.\nIt can be shown that nums cannot be made beautiful with fewer than 3 increment operations.\nHence, the answer is 3.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [0,1,3,3], k = 5\n**Output:** 2\n**Explanation:** We can perform the following increment operations to make nums beautiful:\nChoose index i = 2 and increase nums[2] by 1 -> [0,1,4,3].\nChoose index i = 2 and increase nums[2] by 1 -> [0,1,5,3].\nThe subarrays with a size of 3 or more are: [0,1,5], [1,5,3], [0,1,5,3].\nIn all the subarrays, the maximum element is equal to k = 5, so nums is now beautiful.\nIt can be shown that nums cannot be made beautiful with fewer than 2 increment operations.\nHence, the answer is 2.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,1,2], k = 1\n**Output:** 0\n**Explanation:** The only subarray with a size of 3 or more in this example is [1,1,2].\nThe maximum element, 2, is already greater than k = 1, so we don't need any increment operation.\nHence, the answer is 0.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `3 <= n == nums.length <= 105`\n* `0 <= nums[i] <= 109`\n* `0 <= k <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minIncrementOperations(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minIncrementOperations(**[[2, 3, 0, 0, 2], 4]) == 3\nassert my_solution.minIncrementOperations(**[[0, 1, 3, 3], 5]) == 2\nassert my_solution.minIncrementOperations(**[[1, 1, 2], 1]) == 0\nassert my_solution.minIncrementOperations(**[[0, 5, 5], 8]) == 3\nassert my_solution.minIncrementOperations(**[[0, 18, 28], 93]) == 65\nassert my_solution.minIncrementOperations(**[[0, 24, 14], 7]) == 0\nassert my_solution.minIncrementOperations(**[[2, 3, 4], 3]) == 0\nassert my_solution.minIncrementOperations(**[[3, 5, 9], 6]) == 0\nassert my_solution.minIncrementOperations(**[[4, 3, 0], 2]) == 0\nassert my_solution.minIncrementOperations(**[[5, 6, 5], 9]) == 3\nassert my_solution.minIncrementOperations(**[[6, 9, 6], 3]) == 0\nassert my_solution.minIncrementOperations(**[[7, 9, 0], 6]) == 0\nassert my_solution.minIncrementOperations(**[[7, 47, 16], 39]) == 0\nassert my_solution.minIncrementOperations(**[[9, 6, 1], 6]) == 0\nassert my_solution.minIncrementOperations(**[[41, 44, 37], 55]) == 11\nassert my_solution.minIncrementOperations(**[[48, 3, 13], 1]) == 0\nassert my_solution.minIncrementOperations(**[[1, 2, 6, 9], 8]) == 2\nassert my_solution.minIncrementOperations(**[[1, 3, 1, 6], 6]) == 3\nassert my_solution.minIncrementOperations(**[[2, 35, 41, 20], 4]) == 0\nassert my_solution.minIncrementOperations(**[[3, 9, 9, 7], 6]) == 0\n"}, "labels": {"questionId": "3178", "questionFrontendId": "2919", "questionTitle": "Minimum Increment Operations to Make Array Beautiful", "stats": {"totalAccepted": "4.2K", "totalSubmission": "10.8K", "totalAcceptedRaw": 4223, "totalSubmissionRaw": 10751, "acRate": "39.3%"}, "probedCases": [{"inputs": [[2, 3, 0, 0, 2], 4], "output": 3}, {"inputs": [[0, 1, 3, 3], 5], "output": 2}, {"inputs": [[1, 1, 2], 1], "output": 0}, {"inputs": [[0, 5, 5], 8], "output": 3}, {"inputs": [[0, 18, 28], 93], "output": 65}, {"inputs": [[0, 24, 14], 7], "output": 0}, {"inputs": [[2, 3, 4], 3], "output": 0}, {"inputs": [[3, 5, 9], 6], "output": 0}, {"inputs": [[4, 3, 0], 2], "output": 0}, {"inputs": [[5, 6, 5], 9], "output": 3}, {"inputs": [[6, 9, 6], 3], "output": 0}, {"inputs": [[7, 9, 0], 6], "output": 0}, {"inputs": [[7, 47, 16], 39], "output": 0}, {"inputs": [[9, 6, 1], 6], "output": 0}, {"inputs": [[41, 44, 37], 55], "output": 11}, {"inputs": [[48, 3, 13], 1], "output": 0}, {"inputs": [[1, 2, 6, 9], 8], "output": 2}, {"inputs": [[1, 3, 1, 6], 6], "output": 3}, {"inputs": [[2, 35, 41, 20], 4], "output": 0}, {"inputs": [[3, 9, 9, 7], 6], "output": 0}]}} +{"id": "LeetCode/3163", "content": "# Subarrays Distinct Element Sum of Squares I\n\nYou are given a **0-indexed** integer array `nums`.\n\n\nThe **distinct count** of a subarray of `nums` is defined as:\n\n\n* Let `nums[i..j]` be a subarray of `nums` consisting of all the indices from `i` to `j` such that `0 <= i <= j < nums.length`. Then the number of distinct values in `nums[i..j]` is called the distinct count of `nums[i..j]`.\n\n\nReturn *the sum of the **squares** of **distinct counts** of all subarrays of* `nums`.\n\n\nA subarray is a contiguous **non-empty** sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,1]\n**Output:** 15\n**Explanation:** Six possible subarrays are:\n[1]: 1 distinct value\n[2]: 1 distinct value\n[1]: 1 distinct value\n[1,2]: 2 distinct values\n[2,1]: 2 distinct values\n[1,2,1]: 2 distinct values\nThe sum of the squares of the distinct counts in all subarrays is equal to 12 + 12 + 12 + 22 + 22 + 22 = 15.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,1]\n**Output:** 3\n**Explanation:** Three possible subarrays are:\n[1]: 1 distinct value\n[1]: 1 distinct value\n[1,1]: 1 distinct value\nThe sum of the squares of the distinct counts in all subarrays is equal to 12 + 12 + 12 = 3.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 100`\n* `1 <= nums[i] <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def sumCounts(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.sumCounts(**[[1, 2, 1]]) == 15\nassert my_solution.sumCounts(**[[1, 1]]) == 3\nassert my_solution.sumCounts(**[[2, 2, 5, 5]]) == 22\nassert my_solution.sumCounts(**[[5, 2, 4, 2, 1, 3, 2, 4, 3, 1]]) == 578\nassert my_solution.sumCounts(**[[2, 3, 2, 1, 2, 5, 3, 4, 5, 2]]) == 629\nassert my_solution.sumCounts(**[[5, 1, 5, 2, 3, 5, 1, 5, 1]]) == 385\nassert my_solution.sumCounts(**[[4, 5, 4, 3, 4, 2]]) == 120\nassert my_solution.sumCounts(**[[2]]) == 1\nassert my_solution.sumCounts(**[[3, 4, 2, 5, 2, 4, 1, 2, 2, 5]]) == 535\nassert my_solution.sumCounts(**[[4, 4, 2, 4, 1]]) == 57\nassert my_solution.sumCounts(**[[2, 2, 5]]) == 12\nassert my_solution.sumCounts(**[[4, 5, 1, 2, 2, 1, 3, 3]]) == 266\nassert my_solution.sumCounts(**[[3, 1, 5, 5, 2, 3, 2, 2, 1]]) == 334\nassert my_solution.sumCounts(**[[2, 5, 2, 5, 3, 2, 5, 2]]) == 205\nassert my_solution.sumCounts(**[[5, 4, 1, 4, 5, 2, 4]]) == 203\nassert my_solution.sumCounts(**[[1, 3, 3, 4, 3, 1, 2, 1]]) == 253\nassert my_solution.sumCounts(**[[4]]) == 1\nassert my_solution.sumCounts(**[[1, 4, 2, 1, 5, 4, 3, 1, 4]]) == 507\nassert my_solution.sumCounts(**[[2, 4, 5, 3, 2, 5, 1, 5, 4, 4]]) == 626\nassert my_solution.sumCounts(**[[3, 4, 1, 4, 5, 2, 2]]) == 220\n"}, "labels": {"questionId": "3163", "questionFrontendId": "2913", "questionTitle": "Subarrays Distinct Element Sum of Squares I", "stats": {"totalAccepted": "3.5K", "totalSubmission": "4.4K", "totalAcceptedRaw": 3491, "totalSubmissionRaw": 4360, "acRate": "80.1%"}, "probedCases": [{"inputs": [[1, 2, 1]], "output": 15}, {"inputs": [[1, 1]], "output": 3}, {"inputs": [[2, 2, 5, 5]], "output": 22}, {"inputs": [[5, 2, 4, 2, 1, 3, 2, 4, 3, 1]], "output": 578}, {"inputs": [[2, 3, 2, 1, 2, 5, 3, 4, 5, 2]], "output": 629}, {"inputs": [[5, 1, 5, 2, 3, 5, 1, 5, 1]], "output": 385}, {"inputs": [[4, 5, 4, 3, 4, 2]], "output": 120}, {"inputs": [[2]], "output": 1}, {"inputs": [[3, 4, 2, 5, 2, 4, 1, 2, 2, 5]], "output": 535}, {"inputs": [[4, 4, 2, 4, 1]], "output": 57}, {"inputs": [[2, 2, 5]], "output": 12}, {"inputs": [[4, 5, 1, 2, 2, 1, 3, 3]], "output": 266}, {"inputs": [[3, 1, 5, 5, 2, 3, 2, 2, 1]], "output": 334}, {"inputs": [[2, 5, 2, 5, 3, 2, 5, 2]], "output": 205}, {"inputs": [[5, 4, 1, 4, 5, 2, 4]], "output": 203}, {"inputs": [[1, 3, 3, 4, 3, 1, 2, 1]], "output": 253}, {"inputs": [[4]], "output": 1}, {"inputs": [[1, 4, 2, 1, 5, 4, 3, 1, 4]], "output": 507}, {"inputs": [[2, 4, 5, 3, 2, 5, 1, 5, 4, 4]], "output": 626}, {"inputs": [[3, 4, 1, 4, 5, 2, 2]], "output": 220}]}} +{"id": "LeetCode/3174", "content": "# Minimum Number of Changes to Make Binary String Beautiful\n\nYou are given a **0-indexed** binary string `s` having an even length.\n\n\nA string is **beautiful** if it's possible to partition it into one or more substrings such that:\n\n\n* Each substring has an **even length**.\n* Each substring contains **only** `1`'s or **only** `0`'s.\n\n\nYou can change any character in `s` to `0` or `1`.\n\n\nReturn *the **minimum** number of changes required to make the string* `s` *beautiful*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"1001\"\n**Output:** 2\n**Explanation:** We change s[1] to 1 and s[3] to 0 to get string \"1100\".\nIt can be seen that the string \"1100\" is beautiful because we can partition it into \"11|00\".\nIt can be proven that 2 is the minimum number of changes needed to make the string beautiful.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"10\"\n**Output:** 1\n**Explanation:** We change s[1] to 1 to get string \"11\".\nIt can be seen that the string \"11\" is beautiful because we can partition it into \"11\".\nIt can be proven that 1 is the minimum number of changes needed to make the string beautiful.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"0000\"\n**Output:** 0\n**Explanation:** We don't need to make any changes as the string \"0000\" is beautiful already.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= s.length <= 105`\n* `s` has an even length.\n* `s[i]` is either `'0'` or `'1'`.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minChanges(self, s: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minChanges(**['1001']) == 2\nassert my_solution.minChanges(**['10']) == 1\nassert my_solution.minChanges(**['0000']) == 0\nassert my_solution.minChanges(**['11000111']) == 1\nassert my_solution.minChanges(**['01010001']) == 3\nassert my_solution.minChanges(**['010010']) == 2\nassert my_solution.minChanges(**['111111111110010001']) == 3\nassert my_solution.minChanges(**['01010000011001001101']) == 6\nassert my_solution.minChanges(**['011011100001110111']) == 5\nassert my_solution.minChanges(**['1001000010111010']) == 5\nassert my_solution.minChanges(**['0011']) == 0\nassert my_solution.minChanges(**['11100100010010']) == 4\nassert my_solution.minChanges(**['110100']) == 1\nassert my_solution.minChanges(**['01']) == 1\nassert my_solution.minChanges(**['10110010']) == 2\nassert my_solution.minChanges(**['0010']) == 1\nassert my_solution.minChanges(**['01000011000111']) == 2\nassert my_solution.minChanges(**['0001110001']) == 2\nassert my_solution.minChanges(**['000000001010100011']) == 3\nassert my_solution.minChanges(**['100001']) == 2\n"}, "labels": {"questionId": "3174", "questionFrontendId": "2914", "questionTitle": "Minimum Number of Changes to Make Binary String Beautiful", "stats": {"totalAccepted": "3.2K", "totalSubmission": "4.3K", "totalAcceptedRaw": 3232, "totalSubmissionRaw": 4297, "acRate": "75.2%"}, "probedCases": [{"inputs": ["1001"], "output": 2}, {"inputs": ["10"], "output": 1}, {"inputs": ["0000"], "output": 0}, {"inputs": ["11000111"], "output": 1}, {"inputs": ["01010001"], "output": 3}, {"inputs": ["010010"], "output": 2}, {"inputs": ["111111111110010001"], "output": 3}, {"inputs": ["01010000011001001101"], "output": 6}, {"inputs": ["011011100001110111"], "output": 5}, {"inputs": ["1001000010111010"], "output": 5}, {"inputs": ["0011"], "output": 0}, {"inputs": ["11100100010010"], "output": 4}, {"inputs": ["110100"], "output": 1}, {"inputs": ["01"], "output": 1}, {"inputs": ["10110010"], "output": 2}, {"inputs": ["0010"], "output": 1}, {"inputs": ["01000011000111"], "output": 2}, {"inputs": ["0001110001"], "output": 2}, {"inputs": ["000000001010100011"], "output": 3}, {"inputs": ["100001"], "output": 2}]}} +{"id": "LeetCode/3106", "content": "# Length of the Longest Subsequence That Sums to Target\n\nYou are given a **0-indexed** array of integers `nums`, and an integer `target`.\n\n\nReturn *the **length of the longest subsequence** of* `nums` *that sums up to* `target`. *If no such subsequence exists, return* `-1`.\n\n\nA **subsequence** is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4,5], target = 9\n**Output:** 3\n**Explanation:** There are 3 subsequences with a sum equal to 9: [4,5], [1,3,5], and [2,3,4]. The longest subsequences are [1,3,5], and [2,3,4]. Hence, the answer is 3.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [4,1,3,2,1,5], target = 7\n**Output:** 4\n**Explanation:** There are 5 subsequences with a sum equal to 7: [4,3], [4,1,2], [4,2,1], [1,1,5], and [1,3,2,1]. The longest subsequence is [1,3,2,1]. Hence, the answer is 4.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,1,5,4,5], target = 3\n**Output:** -1\n**Explanation:** It can be shown that nums has no subsequence that sums up to 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 1000`\n* `1 <= nums[i] <= 1000`\n* `1 <= target <= 1000`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def lengthOfLongestSubsequence(self, nums: List[int], target: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.lengthOfLongestSubsequence(**[[1, 2, 3, 4, 5], 9]) == 3\nassert my_solution.lengthOfLongestSubsequence(**[[4, 1, 3, 2, 1, 5], 7]) == 4\nassert my_solution.lengthOfLongestSubsequence(**[[1, 1, 5, 4, 5], 3]) == -1\nassert my_solution.lengthOfLongestSubsequence(**[[1000], 12]) == -1\nassert my_solution.lengthOfLongestSubsequence(**[[1000], 1000]) == 1\nassert my_solution.lengthOfLongestSubsequence(**[[1, 2], 10]) == -1\nassert my_solution.lengthOfLongestSubsequence(**[[1, 1000], 5]) == -1\nassert my_solution.lengthOfLongestSubsequence(**[[2, 3], 3]) == 1\nassert my_solution.lengthOfLongestSubsequence(**[[2, 3], 5]) == 2\nassert my_solution.lengthOfLongestSubsequence(**[[2, 3, 5], 5]) == 2\nassert my_solution.lengthOfLongestSubsequence(**[[1, 3, 3, 7], 1000]) == -1\nassert my_solution.lengthOfLongestSubsequence(**[[1, 3, 3, 7], 2]) == -1\nassert my_solution.lengthOfLongestSubsequence(**[[1, 3, 3, 8], 7]) == 3\nassert my_solution.lengthOfLongestSubsequence(**[[1, 1, 2, 1], 2]) == 2\nassert my_solution.lengthOfLongestSubsequence(**[[1, 1, 1, 1], 5]) == -1\nassert my_solution.lengthOfLongestSubsequence(**[[1, 1, 1, 2], 3]) == 3\nassert my_solution.lengthOfLongestSubsequence(**[[9, 12, 8, 4, 11, 13, 15, 7, 5], 84]) == 9\nassert my_solution.lengthOfLongestSubsequence(**[[11, 5, 9, 11, 12, 13, 12, 5, 1, 8], 87]) == 10\nassert my_solution.lengthOfLongestSubsequence(**[[9, 11, 11, 15, 4, 14, 3, 2, 13, 7], 89]) == 10\nassert my_solution.lengthOfLongestSubsequence(**[[11, 13, 6, 13, 10], 53]) == 5\n"}, "labels": {"questionId": "3106", "questionFrontendId": "2915", "questionTitle": "Length of the Longest Subsequence That Sums to Target", "stats": {"totalAccepted": "4.1K", "totalSubmission": "10.1K", "totalAcceptedRaw": 4053, "totalSubmissionRaw": 10146, "acRate": "39.9%"}, "probedCases": [{"inputs": [[1, 2, 3, 4, 5], 9], "output": 3}, {"inputs": [[4, 1, 3, 2, 1, 5], 7], "output": 4}, {"inputs": [[1, 1, 5, 4, 5], 3], "output": -1}, {"inputs": [[1000], 12], "output": -1}, {"inputs": [[1000], 1000], "output": 1}, {"inputs": [[1, 2], 10], "output": -1}, {"inputs": [[1, 1000], 5], "output": -1}, {"inputs": [[2, 3], 3], "output": 1}, {"inputs": [[2, 3], 5], "output": 2}, {"inputs": [[2, 3, 5], 5], "output": 2}, {"inputs": [[1, 3, 3, 7], 1000], "output": -1}, {"inputs": [[1, 3, 3, 7], 2], "output": -1}, {"inputs": [[1, 3, 3, 8], 7], "output": 3}, {"inputs": [[1, 1, 2, 1], 2], "output": 2}, {"inputs": [[1, 1, 1, 1], 5], "output": -1}, {"inputs": [[1, 1, 1, 2], 3], "output": 3}, {"inputs": [[9, 12, 8, 4, 11, 13, 15, 7, 5], 84], "output": 9}, {"inputs": [[11, 5, 9, 11, 12, 13, 12, 5, 1, 8], 87], "output": 10}, {"inputs": [[9, 11, 11, 15, 4, 14, 3, 2, 13, 7], 89], "output": 10}, {"inputs": [[11, 13, 6, 13, 10], 53], "output": 5}]}} +{"id": "LeetCode/3139", "content": "# Subarrays Distinct Element Sum of Squares II\n\nYou are given a **0-indexed** integer array `nums`.\n\n\nThe **distinct count** of a subarray of `nums` is defined as:\n\n\n* Let `nums[i..j]` be a subarray of `nums` consisting of all the indices from `i` to `j` such that `0 <= i <= j < nums.length`. Then the number of distinct values in `nums[i..j]` is called the distinct count of `nums[i..j]`.\n\n\nReturn *the sum of the **squares** of **distinct counts** of all subarrays of* `nums`.\n\n\nSince the answer may be very large, return it **modulo** `109 + 7`.\n\n\nA subarray is a contiguous **non-empty** sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,1]\n**Output:** 15\n**Explanation:** Six possible subarrays are:\n[1]: 1 distinct value\n[2]: 1 distinct value\n[1]: 1 distinct value\n[1,2]: 2 distinct values\n[2,1]: 2 distinct values\n[1,2,1]: 2 distinct values\nThe sum of the squares of the distinct counts in all subarrays is equal to 12 + 12 + 12 + 22 + 22 + 22 = 15.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,2]\n**Output:** 3\n**Explanation:** Three possible subarrays are:\n[2]: 1 distinct value\n[2]: 1 distinct value\n[2,2]: 1 distinct value\nThe sum of the squares of the distinct counts in all subarrays is equal to 12 + 12 + 12 = 3.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def sumCounts(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.sumCounts(**[[1, 2, 1]]) == 15\nassert my_solution.sumCounts(**[[2, 2]]) == 3\nassert my_solution.sumCounts(**[[2, 2, 5, 5]]) == 22\nassert my_solution.sumCounts(**[[5, 2, 4, 2, 1, 3, 2, 4, 3, 1]]) == 578\nassert my_solution.sumCounts(**[[2, 3, 2, 1, 2, 5, 3, 4, 5, 2]]) == 629\nassert my_solution.sumCounts(**[[5, 1, 5, 2, 3, 5, 1, 5, 1]]) == 385\nassert my_solution.sumCounts(**[[4, 5, 4, 3, 4, 2]]) == 120\nassert my_solution.sumCounts(**[[2]]) == 1\nassert my_solution.sumCounts(**[[3, 4, 2, 5, 2, 4, 1, 2, 2, 5]]) == 535\nassert my_solution.sumCounts(**[[4, 4, 2, 4, 1]]) == 57\nassert my_solution.sumCounts(**[[2, 2, 5]]) == 12\nassert my_solution.sumCounts(**[[4, 5, 1, 2, 2, 1, 3, 3]]) == 266\nassert my_solution.sumCounts(**[[3, 1, 5, 5, 2, 3, 2, 2, 1]]) == 334\nassert my_solution.sumCounts(**[[2, 5, 2, 5, 3, 2, 5, 2]]) == 205\nassert my_solution.sumCounts(**[[5, 4, 1, 4, 5, 2, 4]]) == 203\nassert my_solution.sumCounts(**[[1, 3, 3, 4, 3, 1, 2, 1]]) == 253\nassert my_solution.sumCounts(**[[4]]) == 1\nassert my_solution.sumCounts(**[[1, 4, 2, 1, 5, 4, 3, 1, 4]]) == 507\nassert my_solution.sumCounts(**[[2, 4, 5, 3, 2, 5, 1, 5, 4, 4]]) == 626\nassert my_solution.sumCounts(**[[3, 4, 1, 4, 5, 2, 2]]) == 220\n"}, "labels": {"questionId": "3139", "questionFrontendId": "2916", "questionTitle": "Subarrays Distinct Element Sum of Squares II", "stats": {"totalAccepted": "1.7K", "totalSubmission": "4.4K", "totalAcceptedRaw": 1674, "totalSubmissionRaw": 4398, "acRate": "38.1%"}, "probedCases": [{"inputs": [[1, 2, 1]], "output": 15}, {"inputs": [[2, 2]], "output": 3}, {"inputs": [[2, 2, 5, 5]], "output": 22}, {"inputs": [[5, 2, 4, 2, 1, 3, 2, 4, 3, 1]], "output": 578}, {"inputs": [[2, 3, 2, 1, 2, 5, 3, 4, 5, 2]], "output": 629}, {"inputs": [[5, 1, 5, 2, 3, 5, 1, 5, 1]], "output": 385}, {"inputs": [[4, 5, 4, 3, 4, 2]], "output": 120}, {"inputs": [[2]], "output": 1}, {"inputs": [[3, 4, 2, 5, 2, 4, 1, 2, 2, 5]], "output": 535}, {"inputs": [[4, 4, 2, 4, 1]], "output": 57}, {"inputs": [[2, 2, 5]], "output": 12}, {"inputs": [[4, 5, 1, 2, 2, 1, 3, 3]], "output": 266}, {"inputs": [[3, 1, 5, 5, 2, 3, 2, 2, 1]], "output": 334}, {"inputs": [[2, 5, 2, 5, 3, 2, 5, 2]], "output": 205}, {"inputs": [[5, 4, 1, 4, 5, 2, 4]], "output": 203}, {"inputs": [[1, 3, 3, 4, 3, 1, 2, 1]], "output": 253}, {"inputs": [[4]], "output": 1}, {"inputs": [[1, 4, 2, 1, 5, 4, 3, 1, 4]], "output": 507}, {"inputs": [[2, 4, 5, 3, 2, 5, 1, 5, 4, 4]], "output": 626}, {"inputs": [[3, 4, 1, 4, 5, 2, 2]], "output": 220}]}} +{"id": "LeetCode/3176", "content": "# Minimum Sum of Mountain Triplets I\n\nYou are given a **0-indexed** array `nums` of integers.\n\n\nA triplet of indices `(i, j, k)` is a **mountain** if:\n\n\n* `i < j < k`\n* `nums[i] < nums[j]` and `nums[k] < nums[j]`\n\n\nReturn *the **minimum possible sum** of a mountain triplet of* `nums`. *If no such triplet exists, return* `-1`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [8,6,1,5,3]\n**Output:** 9\n**Explanation:** Triplet (2, 3, 4) is a mountain triplet of sum 9 since: \n- 2 < 3 < 4\n- nums[2] < nums[3] and nums[4] < nums[3]\nAnd the sum of this triplet is nums[2] + nums[3] + nums[4] = 9. It can be shown that there are no mountain triplets with a sum of less than 9.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,4,8,7,10,2]\n**Output:** 13\n**Explanation:** Triplet (1, 3, 5) is a mountain triplet of sum 13 since: \n- 1 < 3 < 5\n- nums[1] < nums[3] and nums[5] < nums[3]\nAnd the sum of this triplet is nums[1] + nums[3] + nums[5] = 13. It can be shown that there are no mountain triplets with a sum of less than 13.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [6,5,4,3,4,5]\n**Output:** -1\n**Explanation:** It can be shown that there are no mountain triplets in nums.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `3 <= nums.length <= 50`\n* `1 <= nums[i] <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumSum(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumSum(**[[8, 6, 1, 5, 3]]) == 9\nassert my_solution.minimumSum(**[[5, 4, 8, 7, 10, 2]]) == 13\nassert my_solution.minimumSum(**[[6, 5, 4, 3, 4, 5]]) == -1\nassert my_solution.minimumSum(**[[50, 50, 50]]) == -1\nassert my_solution.minimumSum(**[[49, 50, 48]]) == 147\nassert my_solution.minimumSum(**[[48, 50, 49]]) == 147\nassert my_solution.minimumSum(**[[1, 1, 1]]) == -1\nassert my_solution.minimumSum(**[[1, 1, 2]]) == -1\nassert my_solution.minimumSum(**[[1, 1, 3]]) == -1\nassert my_solution.minimumSum(**[[1, 2, 1]]) == 4\nassert my_solution.minimumSum(**[[1, 2, 2]]) == -1\nassert my_solution.minimumSum(**[[1, 2, 3]]) == -1\nassert my_solution.minimumSum(**[[1, 3, 1]]) == 5\nassert my_solution.minimumSum(**[[1, 3, 2]]) == 6\nassert my_solution.minimumSum(**[[1, 3, 3]]) == -1\nassert my_solution.minimumSum(**[[2, 1, 1]]) == -1\nassert my_solution.minimumSum(**[[2, 1, 2]]) == -1\nassert my_solution.minimumSum(**[[2, 1, 3]]) == -1\nassert my_solution.minimumSum(**[[2, 2, 1]]) == -1\nassert my_solution.minimumSum(**[[2, 2, 2]]) == -1\n"}, "labels": {"questionId": "3176", "questionFrontendId": "2908", "questionTitle": "Minimum Sum of Mountain Triplets I", "stats": {"totalAccepted": "7K", "totalSubmission": "10.6K", "totalAcceptedRaw": 7038, "totalSubmissionRaw": 10637, "acRate": "66.2%"}, "probedCases": [{"inputs": [[8, 6, 1, 5, 3]], "output": 9}, {"inputs": [[5, 4, 8, 7, 10, 2]], "output": 13}, {"inputs": [[6, 5, 4, 3, 4, 5]], "output": -1}, {"inputs": [[50, 50, 50]], "output": -1}, {"inputs": [[49, 50, 48]], "output": 147}, {"inputs": [[48, 50, 49]], "output": 147}, {"inputs": [[1, 1, 1]], "output": -1}, {"inputs": [[1, 1, 2]], "output": -1}, {"inputs": [[1, 1, 3]], "output": -1}, {"inputs": [[1, 2, 1]], "output": 4}, {"inputs": [[1, 2, 2]], "output": -1}, {"inputs": [[1, 2, 3]], "output": -1}, {"inputs": [[1, 3, 1]], "output": 5}, {"inputs": [[1, 3, 2]], "output": 6}, {"inputs": [[1, 3, 3]], "output": -1}, {"inputs": [[2, 1, 1]], "output": -1}, {"inputs": [[2, 1, 2]], "output": -1}, {"inputs": [[2, 1, 3]], "output": -1}, {"inputs": [[2, 2, 1]], "output": -1}, {"inputs": [[2, 2, 2]], "output": -1}]}} +{"id": "LeetCode/3186", "content": "# Minimum Sum of Mountain Triplets II\n\nYou are given a **0-indexed** array `nums` of integers.\n\n\nA triplet of indices `(i, j, k)` is a **mountain** if:\n\n\n* `i < j < k`\n* `nums[i] < nums[j]` and `nums[k] < nums[j]`\n\n\nReturn *the **minimum possible sum** of a mountain triplet of* `nums`. *If no such triplet exists, return* `-1`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [8,6,1,5,3]\n**Output:** 9\n**Explanation:** Triplet (2, 3, 4) is a mountain triplet of sum 9 since: \n- 2 < 3 < 4\n- nums[2] < nums[3] and nums[4] < nums[3]\nAnd the sum of this triplet is nums[2] + nums[3] + nums[4] = 9. It can be shown that there are no mountain triplets with a sum of less than 9.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,4,8,7,10,2]\n**Output:** 13\n**Explanation:** Triplet (1, 3, 5) is a mountain triplet of sum 13 since: \n- 1 < 3 < 5\n- nums[1] < nums[3] and nums[5] < nums[3]\nAnd the sum of this triplet is nums[1] + nums[3] + nums[5] = 13. It can be shown that there are no mountain triplets with a sum of less than 13.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [6,5,4,3,4,5]\n**Output:** -1\n**Explanation:** It can be shown that there are no mountain triplets in nums.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `3 <= nums.length <= 105`\n* `1 <= nums[i] <= 108`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumSum(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumSum(**[[8, 6, 1, 5, 3]]) == 9\nassert my_solution.minimumSum(**[[5, 4, 8, 7, 10, 2]]) == 13\nassert my_solution.minimumSum(**[[6, 5, 4, 3, 4, 5]]) == -1\nassert my_solution.minimumSum(**[[50, 50, 50]]) == -1\nassert my_solution.minimumSum(**[[49, 50, 48]]) == 147\nassert my_solution.minimumSum(**[[48, 50, 49]]) == 147\nassert my_solution.minimumSum(**[[99999999, 100000000, 99999999]]) == 299999998\nassert my_solution.minimumSum(**[[1, 1, 1]]) == -1\nassert my_solution.minimumSum(**[[1, 1, 2]]) == -1\nassert my_solution.minimumSum(**[[1, 1, 3]]) == -1\nassert my_solution.minimumSum(**[[1, 2, 1]]) == 4\nassert my_solution.minimumSum(**[[1, 2, 2]]) == -1\nassert my_solution.minimumSum(**[[1, 2, 3]]) == -1\nassert my_solution.minimumSum(**[[1, 3, 1]]) == 5\nassert my_solution.minimumSum(**[[1, 3, 2]]) == 6\nassert my_solution.minimumSum(**[[1, 3, 3]]) == -1\nassert my_solution.minimumSum(**[[2, 1, 1]]) == -1\nassert my_solution.minimumSum(**[[2, 1, 2]]) == -1\nassert my_solution.minimumSum(**[[2, 1, 3]]) == -1\nassert my_solution.minimumSum(**[[2, 2, 1]]) == -1\n"}, "labels": {"questionId": "3186", "questionFrontendId": "2909", "questionTitle": "Minimum Sum of Mountain Triplets II", "stats": {"totalAccepted": "6.4K", "totalSubmission": "12.6K", "totalAcceptedRaw": 6428, "totalSubmissionRaw": 12581, "acRate": "51.1%"}, "probedCases": [{"inputs": [[8, 6, 1, 5, 3]], "output": 9}, {"inputs": [[5, 4, 8, 7, 10, 2]], "output": 13}, {"inputs": [[6, 5, 4, 3, 4, 5]], "output": -1}, {"inputs": [[50, 50, 50]], "output": -1}, {"inputs": [[49, 50, 48]], "output": 147}, {"inputs": [[48, 50, 49]], "output": 147}, {"inputs": [[99999999, 100000000, 99999999]], "output": 299999998}, {"inputs": [[1, 1, 1]], "output": -1}, {"inputs": [[1, 1, 2]], "output": -1}, {"inputs": [[1, 1, 3]], "output": -1}, {"inputs": [[1, 2, 1]], "output": 4}, {"inputs": [[1, 2, 2]], "output": -1}, {"inputs": [[1, 2, 3]], "output": -1}, {"inputs": [[1, 3, 1]], "output": 5}, {"inputs": [[1, 3, 2]], "output": 6}, {"inputs": [[1, 3, 3]], "output": -1}, {"inputs": [[2, 1, 1]], "output": -1}, {"inputs": [[2, 1, 2]], "output": -1}, {"inputs": [[2, 1, 3]], "output": -1}, {"inputs": [[2, 2, 1]], "output": -1}]}} +{"id": "LeetCode/3166", "content": "# Minimum Number of Groups to Create a Valid Assignment\n\nYou are given a **0-indexed** integer array `nums` of length `n`.\n\n\nWe want to group the indices so for each index `i` in the range `[0, n - 1]`, it is assigned to **exactly one** group.\n\n\nA groupassignment is **valid** if the following conditions hold:\n\n\n* For every group `g`, all indices `i` assigned to group `g` have the same value in `nums`.\n* For any two groups `g1` and `g2`, the **difference** between the **number of indices** assigned to `g1` and `g2` should **not exceed** `1`.\n\n\nReturn *an integer denoting* *the **minimum** number of groups needed to create a valid group assignment.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [3,2,3,2,3]\n**Output:** 2\n**Explanation:** One way the indices can be assigned to 2 groups is as follows, where the values in square brackets are indices:\ngroup 1 -> [0,2,4]\ngroup 2 -> [1,3]\nAll indices are assigned to one group.\nIn group 1, nums[0] == nums[2] == nums[4], so all indices have the same value.\nIn group 2, nums[1] == nums[3], so all indices have the same value.\nThe number of indices assigned to group 1 is 3, and the number of indices assigned to group 2 is 2.\nTheir difference doesn't exceed 1.\nIt is not possible to use fewer than 2 groups because, in order to use just 1 group, all indices assigned to that group must have the same value.\nHence, the answer is 2.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [10,10,10,3,1,1]\n**Output:** 4\n**Explanation:** One way the indices can be assigned to 4 groups is as follows, where the values in square brackets are indices:\ngroup 1 -> [0]\ngroup 2 -> [1,2]\ngroup 3 -> [3]\ngroup 4 -> [4,5]\nThe group assignment above satisfies both conditions.\nIt can be shown that it is not possible to create a valid assignment using fewer than 4 groups.\nHence, the answer is 4.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minGroupsForValidAssignment(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minGroupsForValidAssignment(**[[3, 2, 3, 2, 3]]) == 2\nassert my_solution.minGroupsForValidAssignment(**[[10, 10, 10, 3, 1, 1]]) == 4\nassert my_solution.minGroupsForValidAssignment(**[[1, 1]]) == 1\nassert my_solution.minGroupsForValidAssignment(**[[1, 2]]) == 2\nassert my_solution.minGroupsForValidAssignment(**[[1, 3]]) == 2\nassert my_solution.minGroupsForValidAssignment(**[[2, 1]]) == 2\nassert my_solution.minGroupsForValidAssignment(**[[2, 2]]) == 1\nassert my_solution.minGroupsForValidAssignment(**[[3, 1]]) == 2\nassert my_solution.minGroupsForValidAssignment(**[[3, 2]]) == 2\nassert my_solution.minGroupsForValidAssignment(**[[3, 3]]) == 1\nassert my_solution.minGroupsForValidAssignment(**[[3, 4]]) == 2\nassert my_solution.minGroupsForValidAssignment(**[[10, 4]]) == 2\nassert my_solution.minGroupsForValidAssignment(**[[10, 10]]) == 1\nassert my_solution.minGroupsForValidAssignment(**[[14, 15]]) == 2\nassert my_solution.minGroupsForValidAssignment(**[[1, 1, 1]]) == 1\nassert my_solution.minGroupsForValidAssignment(**[[1, 2, 1]]) == 2\nassert my_solution.minGroupsForValidAssignment(**[[1, 7, 10]]) == 3\nassert my_solution.minGroupsForValidAssignment(**[[2, 1, 1]]) == 2\nassert my_solution.minGroupsForValidAssignment(**[[2, 1, 2]]) == 2\nassert my_solution.minGroupsForValidAssignment(**[[2, 2, 1]]) == 2\n"}, "labels": {"questionId": "3166", "questionFrontendId": "2910", "questionTitle": "Minimum Number of Groups to Create a Valid Assignment", "stats": {"totalAccepted": "4.9K", "totalSubmission": "16.5K", "totalAcceptedRaw": 4860, "totalSubmissionRaw": 16459, "acRate": "29.5%"}, "probedCases": [{"inputs": [[3, 2, 3, 2, 3]], "output": 2}, {"inputs": [[10, 10, 10, 3, 1, 1]], "output": 4}, {"inputs": [[1, 1]], "output": 1}, {"inputs": [[1, 2]], "output": 2}, {"inputs": [[1, 3]], "output": 2}, {"inputs": [[2, 1]], "output": 2}, {"inputs": [[2, 2]], "output": 1}, {"inputs": [[3, 1]], "output": 2}, {"inputs": [[3, 2]], "output": 2}, {"inputs": [[3, 3]], "output": 1}, {"inputs": [[3, 4]], "output": 2}, {"inputs": [[10, 4]], "output": 2}, {"inputs": [[10, 10]], "output": 1}, {"inputs": [[14, 15]], "output": 2}, {"inputs": [[1, 1, 1]], "output": 1}, {"inputs": [[1, 2, 1]], "output": 2}, {"inputs": [[1, 7, 10]], "output": 3}, {"inputs": [[2, 1, 1]], "output": 2}, {"inputs": [[2, 1, 2]], "output": 2}, {"inputs": [[2, 2, 1]], "output": 2}]}} +{"id": "LeetCode/2879", "content": "# Minimum Changes to Make K Semi-palindromes\n\nGiven a string `s` and an integer `k`, partition `s` into `k` **substrings** such that the sum of the number of letter changes required to turn each **substring** into a **semi-palindrome** is minimized.\n\n\nReturn *an integer denoting the **minimum** number of letter changes required.*\n\n\n**Notes**\n\n\n* A string is a **palindrome** if it can be read the same way from left to right and right to left.\n* A string with a length of `len` is considered a **semi-palindrome** if there exists a positive integer `d` such that `1 <= d < len` and `len % d == 0`, and if we take indices that have the same modulo by `d`, they form a **palindrome**. For example, `\"aa\"`, `\"aba\"`, `\"adbgad\"`, and, `\"abab\"` are **semi-palindrome** and `\"a\"`, `\"ab\"`, and, `\"abca\"` are not.\n* A **substring** is a contiguous sequence of characters within a string.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"abcac\", k = 2\n**Output:** 1\n**Explanation:** We can divide s into substrings \"ab\" and \"cac\". The string \"cac\" is already a semi-palindrome. If we change \"ab\" to \"aa\", it becomes a semi-palindrome with d = 1.\nIt can be shown that there is no way to divide the string \"abcac\" into two semi-palindrome substrings. Therefore, the answer would be at least 1.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"abcdef\", k = 2\n**Output:** 2\n**Explanation:** We can divide it into substrings \"abc\" and \"def\". Each of the substrings \"abc\" and \"def\" requires one change to become a semi-palindrome, so we need 2 changes in total to make all substrings semi-palindrome.\nIt can be shown that we cannot divide the given string into two substrings in a way that it would require less than 2 changes.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"aabbaa\", k = 3\n**Output:** 0\n**Explanation:** We can divide it into substrings \"aa\", \"bb\" and \"aa\".\nThe strings \"aa\" and \"bb\" are already semi-palindromes. Thus, the answer is zero.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= s.length <= 200`\n* `1 <= k <= s.length / 2`\n* `s` consists only of lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumChanges(self, s: str, k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumChanges(**['abcac', 2]) == 1\nassert my_solution.minimumChanges(**['abcdef', 2]) == 2\nassert my_solution.minimumChanges(**['aabbaa', 3]) == 0\nassert my_solution.minimumChanges(**['aq', 1]) == 1\nassert my_solution.minimumChanges(**['bb', 1]) == 0\nassert my_solution.minimumChanges(**['aac', 1]) == 1\nassert my_solution.minimumChanges(**['abcc', 1]) == 2\nassert my_solution.minimumChanges(**['acba', 2]) == 2\nassert my_solution.minimumChanges(**['edaswf', 1]) == 2\nassert my_solution.minimumChanges(**['aabcbaa', 1]) == 0\nassert my_solution.minimumChanges(**['dqpldq', 3]) == 3\nassert my_solution.minimumChanges(**['eksddulf', 1]) == 3\nassert my_solution.minimumChanges(**['aaaaacabbb', 1]) == 3\nassert my_solution.minimumChanges(**['aaabacacbb', 1]) == 3\nassert my_solution.minimumChanges(**['abbbbacaaa', 1]) == 3\nassert my_solution.minimumChanges(**['abcccbaccb', 1]) == 2\nassert my_solution.minimumChanges(**['baacbbbaba', 1]) == 2\nassert my_solution.minimumChanges(**['babcbaccba', 1]) == 1\nassert my_solution.minimumChanges(**['cabbcabcbc', 1]) == 3\nassert my_solution.minimumChanges(**['ccbccaaabb', 1]) == 4\n"}, "labels": {"questionId": "2879", "questionFrontendId": "2911", "questionTitle": "Minimum Changes to Make K Semi-palindromes", "stats": {"totalAccepted": "2.2K", "totalSubmission": "4.6K", "totalAcceptedRaw": 2209, "totalSubmissionRaw": 4633, "acRate": "47.7%"}, "probedCases": [{"inputs": ["abcac", 2], "output": 1}, {"inputs": ["abcdef", 2], "output": 2}, {"inputs": ["aabbaa", 3], "output": 0}, {"inputs": ["aq", 1], "output": 1}, {"inputs": ["bb", 1], "output": 0}, {"inputs": ["aac", 1], "output": 1}, {"inputs": ["abcc", 1], "output": 2}, {"inputs": ["acba", 2], "output": 2}, {"inputs": ["edaswf", 1], "output": 2}, {"inputs": ["aabcbaa", 1], "output": 0}, {"inputs": ["dqpldq", 3], "output": 3}, {"inputs": ["eksddulf", 1], "output": 3}, {"inputs": ["aaaaacabbb", 1], "output": 3}, {"inputs": ["aaabacacbb", 1], "output": 3}, {"inputs": ["abbbbacaaa", 1], "output": 3}, {"inputs": ["abcccbaccb", 1], "output": 2}, {"inputs": ["baacbbbaba", 1], "output": 2}, {"inputs": ["babcbaccba", 1], "output": 1}, {"inputs": ["cabbcabcbc", 1], "output": 3}, {"inputs": ["ccbccaaabb", 1], "output": 4}]}} +{"id": "LeetCode/3165", "content": "# Find Indices With Index and Value Difference I\n\nYou are given a **0-indexed** integer array `nums` having length `n`, an integer `indexDifference`, and an integer `valueDifference`.\n\n\nYour task is to find **two** indices `i` and `j`, both in the range `[0, n - 1]`, that satisfy the following conditions:\n\n\n* `abs(i - j) >= indexDifference`, and\n* `abs(nums[i] - nums[j]) >= valueDifference`\n\n\nReturn *an integer array* `answer`, *where* `answer = [i, j]` *if there are two such indices*, *and* `answer = [-1, -1]` *otherwise*. If there are multiple choices for the two indices, return *any of them*.\n\n\n**Note:** `i` and `j` may be **equal**.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [5,1,4,1], indexDifference = 2, valueDifference = 4\n**Output:** [0,3]\n**Explanation:** In this example, i = 0 and j = 3 can be selected.\nabs(0 - 3) >= 2 and abs(nums[0] - nums[3]) >= 4.\nHence, a valid answer is [0,3].\n[3,0] is also a valid answer.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,1], indexDifference = 0, valueDifference = 0\n**Output:** [0,0]\n**Explanation:** In this example, i = 0 and j = 0 can be selected.\nabs(0 - 0) >= 0 and abs(nums[0] - nums[0]) >= 0.\nHence, a valid answer is [0,0].\nOther valid answers are [0,1], [1,0], and [1,1].\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,2,3], indexDifference = 2, valueDifference = 4\n**Output:** [-1,-1]\n**Explanation:** In this example, it can be shown that it is impossible to find two indices that satisfy both conditions.\nHence, [-1,-1] is returned.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == nums.length <= 100`\n* `0 <= nums[i] <= 50`\n* `0 <= indexDifference <= 100`\n* `0 <= valueDifference <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findIndices(self, nums: List[int], indexDifference: int, valueDifference: int) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findIndices(**[[5, 1, 4, 1], 2, 4]) == [0, 3]\nassert my_solution.findIndices(**[[2, 1], 0, 0]) == [0, 0]\nassert my_solution.findIndices(**[[1, 2, 3], 2, 4]) == [-1, -1]\nassert my_solution.findIndices(**[[0], 0, 0]) == [0, 0]\nassert my_solution.findIndices(**[[3], 0, 0]) == [0, 0]\nassert my_solution.findIndices(**[[3], 1, 1]) == [-1, -1]\nassert my_solution.findIndices(**[[4], 1, 0]) == [-1, -1]\nassert my_solution.findIndices(**[[5], 1, 3]) == [-1, -1]\nassert my_solution.findIndices(**[[7], 1, 7]) == [-1, -1]\nassert my_solution.findIndices(**[[8], 0, 2]) == [-1, -1]\nassert my_solution.findIndices(**[[8], 1, 7]) == [-1, -1]\nassert my_solution.findIndices(**[[10], 0, 9]) == [-1, -1]\nassert my_solution.findIndices(**[[11], 1, 0]) == [-1, -1]\nassert my_solution.findIndices(**[[18], 1, 4]) == [-1, -1]\nassert my_solution.findIndices(**[[38], 1, 34]) == [-1, -1]\nassert my_solution.findIndices(**[[40], 1, 2]) == [-1, -1]\nassert my_solution.findIndices(**[[5, 10], 1, 2]) == [0, 1]\nassert my_solution.findIndices(**[[5, 48], 0, 29]) == [0, 1]\nassert my_solution.findIndices(**[[6, 3], 1, 2]) == [0, 1]\nassert my_solution.findIndices(**[[7, 6], 1, 0]) == [0, 1]\n"}, "labels": {"questionId": "3165", "questionFrontendId": "2903", "questionTitle": "Find Indices With Index and Value Difference I", "stats": {"totalAccepted": "6.7K", "totalSubmission": "9.5K", "totalAcceptedRaw": 6654, "totalSubmissionRaw": 9526, "acRate": "69.9%"}, "probedCases": [{"inputs": [[5, 1, 4, 1], 2, 4], "output": [0, 3]}, {"inputs": [[2, 1], 0, 0], "output": [0, 0]}, {"inputs": [[1, 2, 3], 2, 4], "output": [-1, -1]}, {"inputs": [[0], 0, 0], "output": [0, 0]}, {"inputs": [[3], 0, 0], "output": [0, 0]}, {"inputs": [[3], 1, 1], "output": [-1, -1]}, {"inputs": [[4], 1, 0], "output": [-1, -1]}, {"inputs": [[5], 1, 3], "output": [-1, -1]}, {"inputs": [[7], 1, 7], "output": [-1, -1]}, {"inputs": [[8], 0, 2], "output": [-1, -1]}, {"inputs": [[8], 1, 7], "output": [-1, -1]}, {"inputs": [[10], 0, 9], "output": [-1, -1]}, {"inputs": [[11], 1, 0], "output": [-1, -1]}, {"inputs": [[18], 1, 4], "output": [-1, -1]}, {"inputs": [[38], 1, 34], "output": [-1, -1]}, {"inputs": [[40], 1, 2], "output": [-1, -1]}, {"inputs": [[5, 10], 1, 2], "output": [0, 1]}, {"inputs": [[5, 48], 0, 29], "output": [0, 1]}, {"inputs": [[6, 3], 1, 2], "output": [0, 1]}, {"inputs": [[7, 6], 1, 0], "output": [0, 1]}]}} +{"id": "LeetCode/3150", "content": "# Shortest and Lexicographically Smallest Beautiful String\n\nYou are given a binary string `s` and a positive integer `k`.\n\n\nA substring of `s` is **beautiful** if the number of `1`'s in it is exactly `k`.\n\n\nLet `len` be the length of the **shortest** beautiful substring.\n\n\nReturn *the lexicographically **smallest** beautiful substring of string* `s` *with length equal to* `len`. If `s` doesn't contain a beautiful substring, return *an **empty** string*.\n\n\nA 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`.\n\n\n* 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`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"100011001\", k = 3\n**Output:** \"11001\"\n**Explanation:** There are 7 beautiful substrings in this example:\n1. The substring \"100011001\".\n2. The substring \"100011001\".\n3. The substring \"100011001\".\n4. The substring \"100011001\".\n5. The substring \"100011001\".\n6. The substring \"100011001\".\n7. The substring \"100011001\".\nThe length of the shortest beautiful substring is 5.\nThe lexicographically smallest beautiful substring with length 5 is the substring \"11001\".\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"1011\", k = 2\n**Output:** \"11\"\n**Explanation:** There are 3 beautiful substrings in this example:\n1. The substring \"1011\".\n2. The substring \"1011\".\n3. The substring \"1011\".\nThe length of the shortest beautiful substring is 2.\nThe lexicographically smallest beautiful substring with length 2 is the substring \"11\".\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"000\", k = 1\n**Output:** \"\"\n**Explanation:** There are no beautiful substrings in this example.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 100`\n* `1 <= k <= s.length`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def shortestBeautifulSubstring(self, s: str, k: int) -> str:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\nassert my_solution.shortestBeautifulSubstring(**['100011001', 3]) == 11001\n"}, "labels": {"questionId": "3150", "questionFrontendId": "2904", "questionTitle": "Shortest and Lexicographically Smallest Beautiful String", "stats": {"totalAccepted": "6K", "totalSubmission": "15.1K", "totalAcceptedRaw": 6013, "totalSubmissionRaw": 15061, "acRate": "39.9%"}, "probedCases": [{"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}, {"inputs": ["100011001", 3], "output": "11001"}]}} +{"id": "LeetCode/3170", "content": "# Find Indices With Index and Value Difference II\n\nYou are given a **0-indexed** integer array `nums` having length `n`, an integer `indexDifference`, and an integer `valueDifference`.\n\n\nYour task is to find **two** indices `i` and `j`, both in the range `[0, n - 1]`, that satisfy the following conditions:\n\n\n* `abs(i - j) >= indexDifference`, and\n* `abs(nums[i] - nums[j]) >= valueDifference`\n\n\nReturn *an integer array* `answer`, *where* `answer = [i, j]` *if there are two such indices*, *and* `answer = [-1, -1]` *otherwise*. If there are multiple choices for the two indices, return *any of them*.\n\n\n**Note:** `i` and `j` may be **equal**.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [5,1,4,1], indexDifference = 2, valueDifference = 4\n**Output:** [0,3]\n**Explanation:** In this example, i = 0 and j = 3 can be selected.\nabs(0 - 3) >= 2 and abs(nums[0] - nums[3]) >= 4.\nHence, a valid answer is [0,3].\n[3,0] is also a valid answer.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,1], indexDifference = 0, valueDifference = 0\n**Output:** [0,0]\n**Explanation:** In this example, i = 0 and j = 0 can be selected.\nabs(0 - 0) >= 0 and abs(nums[0] - nums[0]) >= 0.\nHence, a valid answer is [0,0].\nOther valid answers are [0,1], [1,0], and [1,1].\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,2,3], indexDifference = 2, valueDifference = 4\n**Output:** [-1,-1]\n**Explanation:** In this example, it can be shown that it is impossible to find two indices that satisfy both conditions.\nHence, [-1,-1] is returned.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == nums.length <= 105`\n* `0 <= nums[i] <= 109`\n* `0 <= indexDifference <= 105`\n* `0 <= valueDifference <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findIndices(self, nums: List[int], indexDifference: int, valueDifference: int) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findIndices(**[[5, 1, 4, 1], 2, 4]) == [0, 3]\nassert my_solution.findIndices(**[[2, 1], 0, 0]) == [0, 0]\nassert my_solution.findIndices(**[[1, 2, 3], 2, 4]) == [-1, -1]\nassert my_solution.findIndices(**[[1], 0, 1]) == [-1, -1]\nassert my_solution.findIndices(**[[1], 1, 0]) == [-1, -1]\nassert my_solution.findIndices(**[[2], 0, 2]) == [-1, -1]\nassert my_solution.findIndices(**[[6], 1, 4]) == [-1, -1]\nassert my_solution.findIndices(**[[7], 0, 0]) == [0, 0]\nassert my_solution.findIndices(**[[8], 1, 6]) == [-1, -1]\nassert my_solution.findIndices(**[[9], 0, 1]) == [-1, -1]\nassert my_solution.findIndices(**[[9], 1, 9]) == [-1, -1]\nassert my_solution.findIndices(**[[12], 0, 5]) == [-1, -1]\nassert my_solution.findIndices(**[[16], 0, 16]) == [-1, -1]\nassert my_solution.findIndices(**[[16], 1, 6]) == [-1, -1]\nassert my_solution.findIndices(**[[46], 0, 36]) == [-1, -1]\nassert my_solution.findIndices(**[[0, 10], 2, 4]) == [-1, -1]\nassert my_solution.findIndices(**[[2, 7], 2, 7]) == [-1, -1]\nassert my_solution.findIndices(**[[5, 1], 2, 5]) == [-1, -1]\nassert my_solution.findIndices(**[[5, 12], 0, 10]) == [-1, -1]\nassert my_solution.findIndices(**[[8, 0], 1, 7]) == [0, 1]\n"}, "labels": {"questionId": "3170", "questionFrontendId": "2905", "questionTitle": "Find Indices With Index and Value Difference II", "stats": {"totalAccepted": "4.9K", "totalSubmission": "12.7K", "totalAcceptedRaw": 4873, "totalSubmissionRaw": 12724, "acRate": "38.3%"}, "probedCases": [{"inputs": [[5, 1, 4, 1], 2, 4], "output": [0, 3]}, {"inputs": [[2, 1], 0, 0], "output": [0, 0]}, {"inputs": [[1, 2, 3], 2, 4], "output": [-1, -1]}, {"inputs": [[1], 0, 1], "output": [-1, -1]}, {"inputs": [[1], 1, 0], "output": [-1, -1]}, {"inputs": [[2], 0, 2], "output": [-1, -1]}, {"inputs": [[6], 1, 4], "output": [-1, -1]}, {"inputs": [[7], 0, 0], "output": [0, 0]}, {"inputs": [[8], 1, 6], "output": [-1, -1]}, {"inputs": [[9], 0, 1], "output": [-1, -1]}, {"inputs": [[9], 1, 9], "output": [-1, -1]}, {"inputs": [[12], 0, 5], "output": [-1, -1]}, {"inputs": [[16], 0, 16], "output": [-1, -1]}, {"inputs": [[16], 1, 6], "output": [-1, -1]}, {"inputs": [[46], 0, 36], "output": [-1, -1]}, {"inputs": [[0, 10], 2, 4], "output": [-1, -1]}, {"inputs": [[2, 7], 2, 7], "output": [-1, -1]}, {"inputs": [[5, 1], 2, 5], "output": [-1, -1]}, {"inputs": [[5, 12], 0, 10], "output": [-1, -1]}, {"inputs": [[8, 0], 1, 7], "output": [0, 1]}]}} +{"id": "LeetCode/3031", "content": "# Construct Product Matrix\n\nGiven a **0-indexed** 2D integer matrix `grid` of size `n * m`, we define a **0-indexed** 2D matrix `p` of size `n * m` as the **product** matrix of `grid` if the following condition is met:\n\n\n* Each element `p[i][j]` is calculated as the product of all elements in `grid` except for the element `grid[i][j]`. This product is then taken modulo `12345`.\n\n\nReturn *the product matrix of* `grid`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** grid = [[1,2],[3,4]]\n**Output:** [[24,12],[8,6]]\n**Explanation:** p[0][0] = grid[0][1] * grid[1][0] * grid[1][1] = 2 * 3 * 4 = 24\np[0][1] = grid[0][0] * grid[1][0] * grid[1][1] = 1 * 3 * 4 = 12\np[1][0] = grid[0][0] * grid[0][1] * grid[1][1] = 1 * 2 * 4 = 8\np[1][1] = grid[0][0] * grid[0][1] * grid[1][0] = 1 * 2 * 3 = 6\nSo the answer is [[24,12],[8,6]].\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** grid = [[12345],[2],[1]]\n**Output:** [[2],[0],[0]]\n**Explanation:** p[0][0] = grid[0][1] * grid[0][2] = 2 * 1 = 2.\np[0][1] = grid[0][0] * grid[0][2] = 12345 * 1 = 12345. 12345 % 12345 = 0. So p[0][1] = 0.\np[0][2] = grid[0][0] * grid[0][1] = 12345 * 2 = 24690. 24690 % 12345 = 0. So p[0][2] = 0.\nSo the answer is [[2],[0],[0]].\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == grid.length <= 105`\n* `1 <= m == grid[i].length <= 105`\n* `2 <= n * m <= 105`\n* `1 <= grid[i][j] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def constructProductMatrix(self, grid: List[List[int]]) -> List[List[int]]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.constructProductMatrix(**[[[1, 2], [3, 4]]]) == [[24, 12], [8, 6]]\nassert my_solution.constructProductMatrix(**[[[12345], [2], [1]]]) == [[2], [0], [0]]\nassert my_solution.constructProductMatrix(**[[[1], [2]]]) == [[2], [1]]\nassert my_solution.constructProductMatrix(**[[[1, 2]]]) == [[2, 1]]\nassert my_solution.constructProductMatrix(**[[[12345, 12345]]]) == [[0, 0]]\nassert my_solution.constructProductMatrix(**[[[1], [4]]]) == [[4], [1]]\nassert my_solution.constructProductMatrix(**[[[3], [4]]]) == [[4], [3]]\nassert my_solution.constructProductMatrix(**[[[4], [3]]]) == [[3], [4]]\nassert my_solution.constructProductMatrix(**[[[1, 1, 1]]]) == [[1, 1, 1]]\nassert my_solution.constructProductMatrix(**[[[2, 1, 1]]]) == [[1, 2, 2]]\nassert my_solution.constructProductMatrix(**[[[3], [5], [2]]]) == [[10], [6], [15]]\nassert my_solution.constructProductMatrix(**[[[1, 2], [1, 1], [6, 4]]]) == [[48, 24], [48, 48], [8, 12]]\nassert my_solution.constructProductMatrix(**[[[1, 2, 2], [1, 4, 3]]]) == [[48, 24, 24], [48, 12, 16]]\nassert my_solution.constructProductMatrix(**[[[2], [7], [2], [6]]]) == [[84], [24], [84], [28]]\nassert my_solution.constructProductMatrix(**[[[3], [4], [7], [7]]]) == [[196], [147], [84], [84]]\nassert my_solution.constructProductMatrix(**[[[3, 1, 1], [1, 3, 4]]]) == [[12, 36, 36], [36, 12, 9]]\nassert my_solution.constructProductMatrix(**[[[4], [8], [3], [7]]]) == [[168], [84], [224], [96]]\nassert my_solution.constructProductMatrix(**[[[5], [8], [8], [3]]]) == [[192], [120], [120], [320]]\nassert my_solution.constructProductMatrix(**[[[6], [5], [8], [5]]]) == [[200], [240], [150], [240]]\nassert my_solution.constructProductMatrix(**[[[8], [1], [3], [8]]]) == [[24], [192], [64], [24]]\n"}, "labels": {"questionId": "3031", "questionFrontendId": "2906", "questionTitle": "Construct Product Matrix", "stats": {"totalAccepted": "3.7K", "totalSubmission": "10.3K", "totalAcceptedRaw": 3663, "totalSubmissionRaw": 10292, "acRate": "35.6%"}, "probedCases": [{"inputs": [[[1, 2], [3, 4]]], "output": [[24, 12], [8, 6]]}, {"inputs": [[[12345], [2], [1]]], "output": [[2], [0], [0]]}, {"inputs": [[[1], [2]]], "output": [[2], [1]]}, {"inputs": [[[1, 2]]], "output": [[2, 1]]}, {"inputs": [[[12345, 12345]]], "output": [[0, 0]]}, {"inputs": [[[1], [4]]], "output": [[4], [1]]}, {"inputs": [[[3], [4]]], "output": [[4], [3]]}, {"inputs": [[[4], [3]]], "output": [[3], [4]]}, {"inputs": [[[1, 1, 1]]], "output": [[1, 1, 1]]}, {"inputs": [[[2, 1, 1]]], "output": [[1, 2, 2]]}, {"inputs": [[[3], [5], [2]]], "output": [[10], [6], [15]]}, {"inputs": [[[1, 2], [1, 1], [6, 4]]], "output": [[48, 24], [48, 48], [8, 12]]}, {"inputs": [[[1, 2, 2], [1, 4, 3]]], "output": [[48, 24, 24], [48, 12, 16]]}, {"inputs": [[[2], [7], [2], [6]]], "output": [[84], [24], [84], [28]]}, {"inputs": [[[3], [4], [7], [7]]], "output": [[196], [147], [84], [84]]}, {"inputs": [[[3, 1, 1], [1, 3, 4]]], "output": [[12, 36, 36], [36, 12, 9]]}, {"inputs": [[[4], [8], [3], [7]]], "output": [[168], [84], [224], [96]]}, {"inputs": [[[5], [8], [8], [3]]], "output": [[192], [120], [120], [320]]}, {"inputs": [[[6], [5], [8], [5]]], "output": [[200], [240], [150], [240]]}, {"inputs": [[[8], [1], [3], [8]]], "output": [[24], [192], [64], [24]]}]}} +{"id": "LeetCode/3164", "content": "# Last Visited Integers\n\nGiven a **0-indexed** array of strings `words` where `words[i]` is either a positive integer represented as a string or the string `\"prev\"`.\n\n\nStart iterating from the beginning of the array; for every `\"prev\"` string seen in `words`, find the **last visited integer** in `words` which is defined as follows:\n\n\n* Let `k` be the number of consecutive `\"prev\"` strings seen so far (containing the current string). Let `nums` be the **0-indexed** array of **integers** seen so far and `nums_reverse` be the reverse of `nums`, then the integer at `(k - 1)th` index of `nums_reverse` will be the **last visited integer** for this `\"prev\"`.\n* If `k` is **greater** than the total visited integers, then the last visited integer will be `-1`.\n\n\nReturn *an integer array containing the last visited integers.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** words = [\"1\",\"2\",\"prev\",\"prev\",\"prev\"]\n**Output:** [2,1,-1]\n**Explanation:** \nFor \"prev\" at index = 2, last visited integer will be 2 as here the number of consecutive \"prev\" strings is 1, and in the array reverse_nums, 2 will be the first element.\nFor \"prev\" at index = 3, last visited integer will be 1 as there are a total of two consecutive \"prev\" strings including this \"prev\" which are visited, and 1 is the second last visited integer.\nFor \"prev\" at index = 4, last visited integer will be -1 as there are a total of three consecutive \"prev\" strings including this \"prev\" which are visited, but the total number of integers visited is two.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** words = [\"1\",\"prev\",\"2\",\"prev\",\"prev\"]\n**Output:** [1,2,1]\n**Explanation:**\nFor \"prev\" at index = 1, last visited integer will be 1.\nFor \"prev\" at index = 3, last visited integer will be 2.\nFor \"prev\" at index = 4, last visited integer will be 1 as there are a total of two consecutive \"prev\" strings including this \"prev\" which are visited, and 1 is the second last visited integer.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= words.length <= 100`\n* `words[i] == \"prev\"` or `1 <= int(words[i]) <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def lastVisitedIntegers(self, words: List[str]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.lastVisitedIntegers(**[['1', '2', 'prev', 'prev', 'prev']]) == [2, 1, -1]\nassert my_solution.lastVisitedIntegers(**[['1', 'prev', '2', 'prev', 'prev']]) == [1, 2, 1]\nassert my_solution.lastVisitedIntegers(**[['prev', 'prev', 'prev', '27']]) == [-1, -1, -1]\nassert my_solution.lastVisitedIntegers(**[['17', '42']]) == []\nassert my_solution.lastVisitedIntegers(**[['prev']]) == [-1]\nassert my_solution.lastVisitedIntegers(**[['prev', 'prev', 'prev', '52', 'prev']]) == [-1, -1, -1, 52]\nassert my_solution.lastVisitedIntegers(**[['prev', 'prev', '68', 'prev', 'prev', '53', '40', '23', 'prev']]) == [-1, -1, 68, -1, 23]\nassert my_solution.lastVisitedIntegers(**[['99', '23', 'prev']]) == [23]\nassert my_solution.lastVisitedIntegers(**[['prev', 'prev', 'prev', '58', '99', 'prev', '10', 'prev']]) == [-1, -1, -1, 99, 10]\nassert my_solution.lastVisitedIntegers(**[['prev', '51', 'prev', 'prev']]) == [-1, 51, -1]\nassert my_solution.lastVisitedIntegers(**[['prev', '46', '9', 'prev']]) == [-1, 9]\nassert my_solution.lastVisitedIntegers(**[['prev', 'prev', 'prev', 'prev', 'prev', '26']]) == [-1, -1, -1, -1, -1]\nassert my_solution.lastVisitedIntegers(**[['prev', '21', 'prev', '76', '82', 'prev', '96', 'prev', '57', 'prev']]) == [-1, 21, 82, 96, 57]\nassert my_solution.lastVisitedIntegers(**[['52', '4', 'prev', 'prev', 'prev', '69']]) == [4, 52, -1]\nassert my_solution.lastVisitedIntegers(**[['24', 'prev']]) == [24]\nassert my_solution.lastVisitedIntegers(**[['46', 'prev', '78', 'prev', '83', '21', 'prev', '94', '50']]) == [46, 78, 21]\nassert my_solution.lastVisitedIntegers(**[['14', '66', 'prev', 'prev', '46', 'prev']]) == [66, 14, 46]\nassert my_solution.lastVisitedIntegers(**[['35', '90']]) == []\nassert my_solution.lastVisitedIntegers(**[['prev', '9', 'prev', '8', 'prev']]) == [-1, 9, 8]\nassert my_solution.lastVisitedIntegers(**[['prev', 'prev', '88', '71', '47', '65', '24', '39']]) == [-1, -1]\n"}, "labels": {"questionId": "3164", "questionFrontendId": "2899", "questionTitle": "Last Visited Integers", "stats": {"totalAccepted": "3.7K", "totalSubmission": "5.2K", "totalAcceptedRaw": 3698, "totalSubmissionRaw": 5170, "acRate": "71.5%"}, "probedCases": [{"inputs": [["1", "2", "prev", "prev", "prev"]], "output": [2, 1, -1]}, {"inputs": [["1", "prev", "2", "prev", "prev"]], "output": [1, 2, 1]}, {"inputs": [["prev", "prev", "prev", "27"]], "output": [-1, -1, -1]}, {"inputs": [["17", "42"]], "output": []}, {"inputs": [["prev"]], "output": [-1]}, {"inputs": [["prev", "prev", "prev", "52", "prev"]], "output": [-1, -1, -1, 52]}, {"inputs": [["prev", "prev", "68", "prev", "prev", "53", "40", "23", "prev"]], "output": [-1, -1, 68, -1, 23]}, {"inputs": [["99", "23", "prev"]], "output": [23]}, {"inputs": [["prev", "prev", "prev", "58", "99", "prev", "10", "prev"]], "output": [-1, -1, -1, 99, 10]}, {"inputs": [["prev", "51", "prev", "prev"]], "output": [-1, 51, -1]}, {"inputs": [["prev", "46", "9", "prev"]], "output": [-1, 9]}, {"inputs": [["prev", "prev", "prev", "prev", "prev", "26"]], "output": [-1, -1, -1, -1, -1]}, {"inputs": [["prev", "21", "prev", "76", "82", "prev", "96", "prev", "57", "prev"]], "output": [-1, 21, 82, 96, 57]}, {"inputs": [["52", "4", "prev", "prev", "prev", "69"]], "output": [4, 52, -1]}, {"inputs": [["24", "prev"]], "output": [24]}, {"inputs": [["46", "prev", "78", "prev", "83", "21", "prev", "94", "50"]], "output": [46, 78, 21]}, {"inputs": [["14", "66", "prev", "prev", "46", "prev"]], "output": [66, 14, 46]}, {"inputs": [["35", "90"]], "output": []}, {"inputs": [["prev", "9", "prev", "8", "prev"]], "output": [-1, 9, 8]}, {"inputs": [["prev", "prev", "88", "71", "47", "65", "24", "39"]], "output": [-1, -1]}]}} +{"id": "LeetCode/3143", "content": "# Longest Unequal Adjacent Groups Subsequence I\n\nYou are given an integer `n`, a **0-indexed** string array `words`, and a **0-indexed** **binary** array `groups`, both arrays having length `n`.\n\n\nYou need to select the **longest** **subsequence** from an array of indices `[0, 1, ..., n - 1]`, such that for the subsequence denoted as `[i0, i1, ..., ik - 1]` having length `k`, `groups[ij] != groups[ij + 1]`, for each `j` where `0 < j + 1 < k`.\n\n\nReturn *a string array containing the words corresponding to the indices **(in order)** in the selected subsequence*. If there are multiple answers, return *any of them*.\n\n\nA **subsequence** of an array is a new array that is formed from the original array by deleting some (possibly none) of the elements without disturbing the relative positions of the remaining elements.\n\n\n**Note:** strings in `words` may be **unequal** in length.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 3, words = [\"e\",\"a\",\"b\"], groups = [0,0,1]\n**Output:** [\"e\",\"b\"]\n**Explanation:** A subsequence that can be selected is [0,2] because groups[0] != groups[2].\nSo, a valid answer is [words[0],words[2]] = [\"e\",\"b\"].\nAnother subsequence that can be selected is [1,2] because groups[1] != groups[2].\nThis results in [words[1],words[2]] = [\"a\",\"b\"].\nIt is also a valid answer.\nIt can be shown that the length of the longest subsequence of indices that satisfies the condition is 2.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 4, words = [\"a\",\"b\",\"c\",\"d\"], groups = [1,0,1,1]\n**Output:** [\"a\",\"b\",\"c\"]\n**Explanation:** A subsequence that can be selected is [0,1,2] because groups[0] != groups[1] and groups[1] != groups[2].\nSo, a valid answer is [words[0],words[1],words[2]] = [\"a\",\"b\",\"c\"].\nAnother subsequence that can be selected is [0,1,3] because groups[0] != groups[1] and groups[1] != groups[3].\nThis results in [words[0],words[1],words[3]] = [\"a\",\"b\",\"d\"].\nIt is also a valid answer.\nIt can be shown that the length of the longest subsequence of indices that satisfies the condition is 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == words.length == groups.length <= 100`\n* `1 <= words[i].length <= 10`\n* `0 <= groups[i] < 2`\n* `words` consists of **distinct** strings.\n* `words[i]` consists of lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def getWordsInLongestSubsequence(self, n: int, words: List[str], groups: List[int]) -> List[str]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.getWordsInLongestSubsequence(**[3, ['e', 'a', 'b'], [0, 0, 1]]) == ['e', 'b']\nassert my_solution.getWordsInLongestSubsequence(**[4, ['a', 'b', 'c', 'd'], [1, 0, 1, 1]]) == ['a', 'b', 'c']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['c'], [0]]) == ['c']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['d'], [1]]) == ['d']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['e'], [0]]) == ['e']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['fe'], [0]]) == ['fe']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['frl'], [1]]) == ['frl']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['ha'], [1]]) == ['ha']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['l'], [0]]) == ['l']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['n'], [1]]) == ['n']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['s'], [1]]) == ['s']\nassert my_solution.getWordsInLongestSubsequence(**[2, ['d', 'g'], [0, 1]]) == ['d', 'g']\nassert my_solution.getWordsInLongestSubsequence(**[2, ['lr', 'h'], [0, 0]]) == ['lr']\nassert my_solution.getWordsInLongestSubsequence(**[2, ['wx', 'h'], [0, 1]]) == ['wx', 'h']\nassert my_solution.getWordsInLongestSubsequence(**[2, ['yw', 'n'], [0, 1]]) == ['yw', 'n']\nassert my_solution.getWordsInLongestSubsequence(**[2, ['z', 'n'], [0, 0]]) == ['z']\nassert my_solution.getWordsInLongestSubsequence(**[2, ['zr', 'a'], [0, 0]]) == ['zr']\nassert my_solution.getWordsInLongestSubsequence(**[3, ['h', 'vv', 'kp'], [0, 1, 0]]) == ['h', 'vv', 'kp']\nassert my_solution.getWordsInLongestSubsequence(**[3, ['m', 'v', 'y'], [0, 1, 0]]) == ['m', 'v', 'y']\nassert my_solution.getWordsInLongestSubsequence(**[3, ['o', 'cfy', 'en'], [1, 0, 0]]) == ['o', 'cfy']\n"}, "labels": {"questionId": "3143", "questionFrontendId": "2900", "questionTitle": "Longest Unequal Adjacent Groups Subsequence I", "stats": {"totalAccepted": "3.3K", "totalSubmission": "4.4K", "totalAcceptedRaw": 3298, "totalSubmissionRaw": 4365, "acRate": "75.6%"}, "probedCases": [{"inputs": [3, ["e", "a", "b"], [0, 0, 1]], "output": ["e", "b"]}, {"inputs": [4, ["a", "b", "c", "d"], [1, 0, 1, 1]], "output": ["a", "b", "c"]}, {"inputs": [1, ["c"], [0]], "output": ["c"]}, {"inputs": [1, ["d"], [1]], "output": ["d"]}, {"inputs": [1, ["e"], [0]], "output": ["e"]}, {"inputs": [1, ["fe"], [0]], "output": ["fe"]}, {"inputs": [1, ["frl"], [1]], "output": ["frl"]}, {"inputs": [1, ["ha"], [1]], "output": ["ha"]}, {"inputs": [1, ["l"], [0]], "output": ["l"]}, {"inputs": [1, ["n"], [1]], "output": ["n"]}, {"inputs": [1, ["s"], [1]], "output": ["s"]}, {"inputs": [2, ["d", "g"], [0, 1]], "output": ["d", "g"]}, {"inputs": [2, ["lr", "h"], [0, 0]], "output": ["lr"]}, {"inputs": [2, ["wx", "h"], [0, 1]], "output": ["wx", "h"]}, {"inputs": [2, ["yw", "n"], [0, 1]], "output": ["yw", "n"]}, {"inputs": [2, ["z", "n"], [0, 0]], "output": ["z"]}, {"inputs": [2, ["zr", "a"], [0, 0]], "output": ["zr"]}, {"inputs": [3, ["h", "vv", "kp"], [0, 1, 0]], "output": ["h", "vv", "kp"]}, {"inputs": [3, ["m", "v", "y"], [0, 1, 0]], "output": ["m", "v", "y"]}, {"inputs": [3, ["o", "cfy", "en"], [1, 0, 0]], "output": ["o", "cfy"]}]}} +{"id": "LeetCode/3142", "content": "# Longest Unequal Adjacent Groups Subsequence II\n\nYou are given an integer `n`, a **0-indexed** string array `words`, and a **0-indexed** array `groups`, both arrays having length `n`.\n\n\nThe **hamming distance** between two strings of equal length is the number of positions at which the corresponding characters are **different**.\n\n\nYou need to select the **longest** **subsequence** from an array of indices `[0, 1, ..., n - 1]`, such that for the subsequence denoted as `[i0, i1, ..., ik - 1]` having length `k`, the following holds:\n\n\n* For **adjacent** indices in the subsequence, their corresponding groups are **unequal**, i.e., `groups[ij] != groups[ij + 1]`, for each `j` where `0 < j + 1 < k`.\n* `words[ij]` and `words[ij + 1]` are **equal** in length, and the **hamming distance** between them is `1`, where `0 < j + 1 < k`, for all indices in the subsequence.\n\n\nReturn *a string array containing the words corresponding to the indices **(in order)** in the selected subsequence*. If there are multiple answers, return *any of them*.\n\n\nA **subsequence** of an array is a new array that is formed from the original array by deleting some (possibly none) of the elements without disturbing the relative positions of the remaining elements.\n\n\n**Note:** strings in `words` may be **unequal** in length.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 3, words = [\"bab\",\"dab\",\"cab\"], groups = [1,2,2]\n**Output:** [\"bab\",\"cab\"]\n**Explanation:** A subsequence that can be selected is [0,2].\n- groups[0] != groups[2]\n- words[0].length == words[2].length, and the hamming distance between them is 1.\nSo, a valid answer is [words[0],words[2]] = [\"bab\",\"cab\"].\nAnother subsequence that can be selected is [0,1].\n- groups[0] != groups[1]\n- words[0].length == words[1].length, and the hamming distance between them is 1.\nSo, another valid answer is [words[0],words[1]] = [\"bab\",\"dab\"].\nIt can be shown that the length of the longest subsequence of indices that satisfies the conditions is 2. \n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 4, words = [\"a\",\"b\",\"c\",\"d\"], groups = [1,2,3,4]\n**Output:** [\"a\",\"b\",\"c\",\"d\"]\n**Explanation:** We can select the subsequence [0,1,2,3].\nIt satisfies both conditions.\nHence, the answer is [words[0],words[1],words[2],words[3]] = [\"a\",\"b\",\"c\",\"d\"].\nIt has the longest length among all subsequences of indices that satisfy the conditions.\nHence, it is the only answer.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == words.length == groups.length <= 1000`\n* `1 <= words[i].length <= 10`\n* `1 <= groups[i] <= n`\n* `words` consists of **distinct** strings.\n* `words[i]` consists of lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def getWordsInLongestSubsequence(self, n: int, words: List[str], groups: List[int]) -> List[str]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.getWordsInLongestSubsequence(**[3, ['bab', 'dab', 'cab'], [1, 2, 2]]) == ['bab', 'cab']\nassert my_solution.getWordsInLongestSubsequence(**[4, ['a', 'b', 'c', 'd'], [1, 2, 3, 4]]) == ['a', 'b', 'c', 'd']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['abbbb'], [1]]) == ['abbbb']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['ad'], [1]]) == ['ad']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['baaccb'], [1]]) == ['baaccb']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['bc'], [1]]) == ['bc']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['bdb'], [1]]) == ['bdb']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['cc'], [1]]) == ['cc']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['cd'], [1]]) == ['cd']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['cdb'], [1]]) == ['cdb']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['cea'], [1]]) == ['cea']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['cebbbb'], [1]]) == ['cebbbb']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['da'], [1]]) == ['da']\nassert my_solution.getWordsInLongestSubsequence(**[1, ['daab'], [1]]) == ['daab']\nassert my_solution.getWordsInLongestSubsequence(**[2, ['adbe', 'acace'], [2, 2]]) == ['acace']\nassert my_solution.getWordsInLongestSubsequence(**[2, ['ba', 'dc'], [1, 1]]) == ['dc']\nassert my_solution.getWordsInLongestSubsequence(**[2, ['baa', 'ada'], [1, 2]]) == ['ada']\nassert my_solution.getWordsInLongestSubsequence(**[2, ['bebea', 'ddecc'], [1, 1]]) == ['ddecc']\nassert my_solution.getWordsInLongestSubsequence(**[2, ['cedbca', 'db'], [1, 1]]) == ['db']\nassert my_solution.getWordsInLongestSubsequence(**[2, ['dbcdd', 'baba'], [2, 1]]) == ['baba']\n"}, "labels": {"questionId": "3142", "questionFrontendId": "2901", "questionTitle": "Longest Unequal Adjacent Groups Subsequence II", "stats": {"totalAccepted": "2.7K", "totalSubmission": "7K", "totalAcceptedRaw": 2678, "totalSubmissionRaw": 7014, "acRate": "38.2%"}, "probedCases": [{"inputs": [3, ["bab", "dab", "cab"], [1, 2, 2]], "output": ["bab", "cab"]}, {"inputs": [4, ["a", "b", "c", "d"], [1, 2, 3, 4]], "output": ["a", "b", "c", "d"]}, {"inputs": [1, ["abbbb"], [1]], "output": ["abbbb"]}, {"inputs": [1, ["ad"], [1]], "output": ["ad"]}, {"inputs": [1, ["baaccb"], [1]], "output": ["baaccb"]}, {"inputs": [1, ["bc"], [1]], "output": ["bc"]}, {"inputs": [1, ["bdb"], [1]], "output": ["bdb"]}, {"inputs": [1, ["cc"], [1]], "output": ["cc"]}, {"inputs": [1, ["cd"], [1]], "output": ["cd"]}, {"inputs": [1, ["cdb"], [1]], "output": ["cdb"]}, {"inputs": [1, ["cea"], [1]], "output": ["cea"]}, {"inputs": [1, ["cebbbb"], [1]], "output": ["cebbbb"]}, {"inputs": [1, ["da"], [1]], "output": ["da"]}, {"inputs": [1, ["daab"], [1]], "output": ["daab"]}, {"inputs": [2, ["adbe", "acace"], [2, 2]], "output": ["acace"]}, {"inputs": [2, ["ba", "dc"], [1, 1]], "output": ["dc"]}, {"inputs": [2, ["baa", "ada"], [1, 2]], "output": ["ada"]}, {"inputs": [2, ["bebea", "ddecc"], [1, 1]], "output": ["ddecc"]}, {"inputs": [2, ["cedbca", "db"], [1, 1]], "output": ["db"]}, {"inputs": [2, ["dbcdd", "baba"], [2, 1]], "output": ["baba"]}]}} +{"id": "LeetCode/3091", "content": "# Count of Sub-Multisets With Bounded Sum\n\nYou are given a **0-indexed** array `nums` of non-negative integers, and two integers `l` and `r`.\n\n\nReturn *the **count of sub-multisets** within* `nums` *where the sum of elements in each subset falls within the inclusive range of* `[l, r]`.\n\n\nSince the answer may be large, return it modulo `109 + 7`.\n\n\nA **sub-multiset** is an **unordered** collection of elements of the array in which a given value `x` can occur `0, 1, ..., occ[x]` times, where `occ[x]` is the number of occurrences of `x` in the array.\n\n\n**Note** that:\n\n\n* Two **sub-multisets** are the same if sorting both sub-multisets results in identical multisets.\n* The sum of an **empty** multiset is `0`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,2,3], l = 6, r = 6\n**Output:** 1\n**Explanation:** The only subset of nums that has a sum of 6 is {1, 2, 3}.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,1,4,2,7], l = 1, r = 5\n**Output:** 7\n**Explanation:** The subsets of nums that have a sum within the range [1, 5] are {1}, {2}, {4}, {2, 2}, {1, 2}, {1, 4}, and {1, 2, 2}.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,2,1,3,5,2], l = 3, r = 5\n**Output:** 9\n**Explanation:** The subsets of nums that have a sum within the range [3, 5] are {3}, {5}, {1, 2}, {1, 3}, {2, 2}, {2, 3}, {1, 1, 2}, {1, 1, 3}, and {1, 2, 2}.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 2 * 104`\n* `0 <= nums[i] <= 2 * 104`\n* Sum of `nums` does not exceed `2 * 104`.\n* `0 <= l <= r <= 2 * 104`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countSubMultisets(self, nums: List[int], l: int, r: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countSubMultisets(**[[1, 2, 2, 3], 6, 6]) == 1\nassert my_solution.countSubMultisets(**[[2, 1, 4, 2, 7], 1, 5]) == 7\nassert my_solution.countSubMultisets(**[[1, 2, 1, 3, 5, 2], 3, 5]) == 9\nassert my_solution.countSubMultisets(**[[0, 0, 1, 2, 3], 2, 3]) == 9\nassert my_solution.countSubMultisets(**[[0, 0, 0, 0, 0], 0, 0]) == 6\nassert my_solution.countSubMultisets(**[[0, 0, 0, 1, 2, 5, 2, 3], 0, 3]) == 20\nassert my_solution.countSubMultisets(**[[1, 1], 2, 2]) == 1\nassert my_solution.countSubMultisets(**[[1, 1, 1], 2, 2]) == 1\nassert my_solution.countSubMultisets(**[[1, 1, 2], 2, 4]) == 4\nassert my_solution.countSubMultisets(**[[1, 2, 1], 2, 2]) == 2\nassert my_solution.countSubMultisets(**[[1, 2, 2], 3, 5]) == 3\nassert my_solution.countSubMultisets(**[[2, 1, 1], 1, 2]) == 3\nassert my_solution.countSubMultisets(**[[2, 1, 2], 2, 2]) == 1\nassert my_solution.countSubMultisets(**[[2, 2, 1], 4, 5]) == 2\nassert my_solution.countSubMultisets(**[[2, 2, 2], 3, 6]) == 2\nassert my_solution.countSubMultisets(**[[1, 1, 1, 1], 3, 3]) == 1\nassert my_solution.countSubMultisets(**[[1, 1, 1, 2], 1, 1]) == 1\nassert my_solution.countSubMultisets(**[[1, 1, 1, 3], 4, 4]) == 1\nassert my_solution.countSubMultisets(**[[1, 1, 2, 1], 3, 4]) == 3\nassert my_solution.countSubMultisets(**[[1, 1, 2, 2], 2, 3]) == 3\n"}, "labels": {"questionId": "3091", "questionFrontendId": "2902", "questionTitle": "Count of Sub-Multisets With Bounded Sum", "stats": {"totalAccepted": "1.7K", "totalSubmission": "5.6K", "totalAcceptedRaw": 1733, "totalSubmissionRaw": 5640, "acRate": "30.7%"}, "probedCases": [{"inputs": [[1, 2, 2, 3], 6, 6], "output": 1}, {"inputs": [[2, 1, 4, 2, 7], 1, 5], "output": 7}, {"inputs": [[1, 2, 1, 3, 5, 2], 3, 5], "output": 9}, {"inputs": [[0, 0, 1, 2, 3], 2, 3], "output": 9}, {"inputs": [[0, 0, 0, 0, 0], 0, 0], "output": 6}, {"inputs": [[0, 0, 0, 1, 2, 5, 2, 3], 0, 3], "output": 20}, {"inputs": [[1, 1], 2, 2], "output": 1}, {"inputs": [[1, 1, 1], 2, 2], "output": 1}, {"inputs": [[1, 1, 2], 2, 4], "output": 4}, {"inputs": [[1, 2, 1], 2, 2], "output": 2}, {"inputs": [[1, 2, 2], 3, 5], "output": 3}, {"inputs": [[2, 1, 1], 1, 2], "output": 3}, {"inputs": [[2, 1, 2], 2, 2], "output": 1}, {"inputs": [[2, 2, 1], 4, 5], "output": 2}, {"inputs": [[2, 2, 2], 3, 6], "output": 2}, {"inputs": [[1, 1, 1, 1], 3, 3], "output": 1}, {"inputs": [[1, 1, 1, 2], 1, 1], "output": 1}, {"inputs": [[1, 1, 1, 3], 4, 4], "output": 1}, {"inputs": [[1, 1, 2, 1], 3, 4], "output": 3}, {"inputs": [[1, 1, 2, 2], 2, 3], "output": 3}]}} +{"id": "LeetCode/3172", "content": "# Divisible and Non-divisible Sums Difference\n\nYou are given positive integers `n` and `m`.\n\n\nDefine two integers, `num1` and `num2`, as follows:\n\n\n* `num1`: The sum of all integers in the range `[1, n]` that are **not divisible** by `m`.\n* `num2`: The sum of all integers in the range `[1, n]` that are **divisible** by `m`.\n\n\nReturn *the integer* `num1 - num2`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 10, m = 3\n**Output:** 19\n**Explanation:** In the given example:\n- Integers in the range [1, 10] that are not divisible by 3 are [1,2,4,5,7,8,10], num1 is the sum of those integers = 37.\n- Integers in the range [1, 10] that are divisible by 3 are [3,6,9], num2 is the sum of those integers = 18.\nWe return 37 - 18 = 19 as the answer.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 5, m = 6\n**Output:** 15\n**Explanation:** In the given example:\n- Integers in the range [1, 5] that are not divisible by 6 are [1,2,3,4,5], num1 is the sum of those integers = 15.\n- Integers in the range [1, 5] that are divisible by 6 are [], num2 is the sum of those integers = 0.\nWe return 15 - 0 = 15 as the answer.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** n = 5, m = 1\n**Output:** -15\n**Explanation:** In the given example:\n- Integers in the range [1, 5] that are not divisible by 1 are [], num1 is the sum of those integers = 0.\n- Integers in the range [1, 5] that are divisible by 1 are [1,2,3,4,5], num2 is the sum of those integers = 15.\nWe return 0 - 15 = -15 as the answer.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n, m <= 1000`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def differenceOfSums(self, n: int, m: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.differenceOfSums(**[10, 3]) == 19\nassert my_solution.differenceOfSums(**[5, 6]) == 15\nassert my_solution.differenceOfSums(**[5, 1]) == -15\nassert my_solution.differenceOfSums(**[15, 9]) == 102\nassert my_solution.differenceOfSums(**[8, 10]) == 36\nassert my_solution.differenceOfSums(**[23, 36]) == 276\nassert my_solution.differenceOfSums(**[1, 32]) == 1\nassert my_solution.differenceOfSums(**[36, 7]) == 456\nassert my_solution.differenceOfSums(**[3, 8]) == 6\nassert my_solution.differenceOfSums(**[4, 2]) == -2\nassert my_solution.differenceOfSums(**[9, 7]) == 31\nassert my_solution.differenceOfSums(**[20, 9]) == 156\nassert my_solution.differenceOfSums(**[3, 19]) == 6\nassert my_solution.differenceOfSums(**[6, 16]) == 21\nassert my_solution.differenceOfSums(**[6, 1]) == -21\nassert my_solution.differenceOfSums(**[5, 25]) == 15\nassert my_solution.differenceOfSums(**[9, 3]) == 9\nassert my_solution.differenceOfSums(**[8, 23]) == 36\nassert my_solution.differenceOfSums(**[17, 1]) == -153\nassert my_solution.differenceOfSums(**[18, 9]) == 117\n"}, "labels": {"questionId": "3172", "questionFrontendId": "2894", "questionTitle": "Divisible and Non-divisible Sums Difference", "stats": {"totalAccepted": "7.3K", "totalSubmission": "8.4K", "totalAcceptedRaw": 7318, "totalSubmissionRaw": 8400, "acRate": "87.1%"}, "probedCases": [{"inputs": [10, 3], "output": 19}, {"inputs": [5, 6], "output": 15}, {"inputs": [5, 1], "output": -15}, {"inputs": [15, 9], "output": 102}, {"inputs": [8, 10], "output": 36}, {"inputs": [23, 36], "output": 276}, {"inputs": [1, 32], "output": 1}, {"inputs": [36, 7], "output": 456}, {"inputs": [3, 8], "output": 6}, {"inputs": [4, 2], "output": -2}, {"inputs": [9, 7], "output": 31}, {"inputs": [20, 9], "output": 156}, {"inputs": [3, 19], "output": 6}, {"inputs": [6, 16], "output": 21}, {"inputs": [6, 1], "output": -21}, {"inputs": [5, 25], "output": 15}, {"inputs": [9, 3], "output": 9}, {"inputs": [8, 23], "output": 36}, {"inputs": [17, 1], "output": -153}, {"inputs": [18, 9], "output": 117}]}} +{"id": "LeetCode/3151", "content": "# Minimum Processing Time\n\nYou have `n` processors each having `4` cores and `n * 4` tasks that need to be executed such that each core should perform only **one** task.\n\n\nGiven a **0-indexed** integer array `processorTime` representing the time at which each processor becomes available for the first time and a **0-indexed** integer array `tasks` representing the time it takes to execute each task, return *the **minimum** time when all of the tasks have been executed by the processors.*\n\n\n**Note:** Each core executes the task independently of the others.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** processorTime = [8,10], tasks = [2,2,3,1,8,7,4,5]\n**Output:** 16\n**Explanation:** \nIt's optimal to assign the tasks at indexes 4, 5, 6, 7 to the first processor which becomes available at time = 8, and the tasks at indexes 0, 1, 2, 3 to the second processor which becomes available at time = 10. \nTime taken by the first processor to finish execution of all tasks = max(8 + 8, 8 + 7, 8 + 4, 8 + 5) = 16.\nTime taken by the second processor to finish execution of all tasks = max(10 + 2, 10 + 2, 10 + 3, 10 + 1) = 13.\nHence, it can be shown that the minimum time taken to execute all the tasks is 16.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** processorTime = [10,20], tasks = [2,3,1,2,5,8,4,3]\n**Output:** 23\n**Explanation:** \nIt's optimal to assign the tasks at indexes 1, 4, 5, 6 to the first processor which becomes available at time = 10, and the tasks at indexes 0, 2, 3, 7 to the second processor which becomes available at time = 20.\nTime taken by the first processor to finish execution of all tasks = max(10 + 3, 10 + 5, 10 + 8, 10 + 4) = 18.\nTime taken by the second processor to finish execution of all tasks = max(20 + 2, 20 + 1, 20 + 2, 20 + 3) = 23.\nHence, it can be shown that the minimum time taken to execute all the tasks is 23.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == processorTime.length <= 25000`\n* `1 <= tasks.length <= 105`\n* `0 <= processorTime[i] <= 109`\n* `1 <= tasks[i] <= 109`\n* `tasks.length == 4 * n`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minProcessingTime(self, processorTime: List[int], tasks: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minProcessingTime(**[[8, 10], [2, 2, 3, 1, 8, 7, 4, 5]]) == 16\nassert my_solution.minProcessingTime(**[[10, 20], [2, 3, 1, 2, 5, 8, 4, 3]]) == 23\nassert my_solution.minProcessingTime(**[[121, 99], [287, 315, 293, 260, 333, 362, 69, 233]]) == 461\nassert my_solution.minProcessingTime(**[[33, 320], [132, 68, 232, 166, 30, 300, 112, 138]]) == 452\nassert my_solution.minProcessingTime(**[[50, 82], [288, 138, 205, 295, 367, 100, 258, 308]]) == 417\nassert my_solution.minProcessingTime(**[[291], [125, 169, 269, 32]]) == 560\nassert my_solution.minProcessingTime(**[[55, 350, 166, 210, 389], [276, 253, 157, 237, 92, 396, 331, 19, 82, 301, 136, 396, 251, 92, 280, 70, 253, 47, 81, 84]]) == 470\nassert my_solution.minProcessingTime(**[[143, 228, 349, 231, 392], [102, 365, 363, 211, 38, 96, 98, 79, 365, 289, 252, 201, 259, 346, 21, 68, 128, 56, 167, 183]]) == 517\nassert my_solution.minProcessingTime(**[[168, 32, 299, 303, 96], [382, 183, 337, 73, 115, 350, 6, 18, 93, 238, 102, 302, 96, 381, 327, 385, 387, 288, 138, 83]]) == 456\nassert my_solution.minProcessingTime(**[[324, 117, 374, 219, 303], [374, 202, 328, 11, 353, 208, 383, 287, 107, 236, 226, 387, 21, 183, 352, 164, 207, 182, 15, 65]]) == 571\nassert my_solution.minProcessingTime(**[[376], [21, 247, 274, 38]]) == 650\nassert my_solution.minProcessingTime(**[[93, 3, 281, 218], [182, 16, 241, 312, 81, 339, 207, 330, 306, 166, 82, 290, 7, 317, 396, 389]]) == 459\nassert my_solution.minProcessingTime(**[[374, 250, 197, 170], [247, 56, 330, 361, 240, 261, 67, 65, 138, 181, 308, 26, 59, 150, 137, 244]]) == 531\nassert my_solution.minProcessingTime(**[[115, 271, 137], [34, 72, 328, 312, 159, 32, 283, 6, 234, 280, 46, 349]]) == 464\nassert my_solution.minProcessingTime(**[[47, 217, 349, 233, 283], [195, 188, 181, 259, 145, 96, 298, 322, 213, 154, 278, 292, 315, 191, 177, 228, 291, 204, 310, 266]]) == 526\nassert my_solution.minProcessingTime(**[[177, 6, 326, 318, 294], [136, 215, 260, 259, 35, 248, 340, 377, 144, 248, 83, 150, 63, 48, 269, 197, 317, 135, 36, 344]]) == 542\nassert my_solution.minProcessingTime(**[[266, 372], [260, 325, 159, 316, 296, 366, 335, 146]]) == 668\nassert my_solution.minProcessingTime(**[[63, 339], [79, 316, 98, 354, 220, 267, 333, 11]]) == 559\nassert my_solution.minProcessingTime(**[[149, 60, 172, 5, 212], [230, 374, 276, 281, 55, 96, 52, 83, 56, 399, 69, 333, 145, 6, 50, 101, 216, 327, 120, 209]]) == 404\nassert my_solution.minProcessingTime(**[[220, 375, 285, 267, 150], [53, 317, 367, 258, 337, 280, 232, 322, 153, 169, 121, 211, 171, 345, 76, 370, 265, 107, 45, 320]]) == 542\n"}, "labels": {"questionId": "3151", "questionFrontendId": "2895", "questionTitle": "Minimum Processing Time", "stats": {"totalAccepted": "5.3K", "totalSubmission": "6.8K", "totalAcceptedRaw": 5263, "totalSubmissionRaw": 6822, "acRate": "77.1%"}, "probedCases": [{"inputs": [[8, 10], [2, 2, 3, 1, 8, 7, 4, 5]], "output": 16}, {"inputs": [[10, 20], [2, 3, 1, 2, 5, 8, 4, 3]], "output": 23}, {"inputs": [[121, 99], [287, 315, 293, 260, 333, 362, 69, 233]], "output": 461}, {"inputs": [[33, 320], [132, 68, 232, 166, 30, 300, 112, 138]], "output": 452}, {"inputs": [[50, 82], [288, 138, 205, 295, 367, 100, 258, 308]], "output": 417}, {"inputs": [[291], [125, 169, 269, 32]], "output": 560}, {"inputs": [[55, 350, 166, 210, 389], [276, 253, 157, 237, 92, 396, 331, 19, 82, 301, 136, 396, 251, 92, 280, 70, 253, 47, 81, 84]], "output": 470}, {"inputs": [[143, 228, 349, 231, 392], [102, 365, 363, 211, 38, 96, 98, 79, 365, 289, 252, 201, 259, 346, 21, 68, 128, 56, 167, 183]], "output": 517}, {"inputs": [[168, 32, 299, 303, 96], [382, 183, 337, 73, 115, 350, 6, 18, 93, 238, 102, 302, 96, 381, 327, 385, 387, 288, 138, 83]], "output": 456}, {"inputs": [[324, 117, 374, 219, 303], [374, 202, 328, 11, 353, 208, 383, 287, 107, 236, 226, 387, 21, 183, 352, 164, 207, 182, 15, 65]], "output": 571}, {"inputs": [[376], [21, 247, 274, 38]], "output": 650}, {"inputs": [[93, 3, 281, 218], [182, 16, 241, 312, 81, 339, 207, 330, 306, 166, 82, 290, 7, 317, 396, 389]], "output": 459}, {"inputs": [[374, 250, 197, 170], [247, 56, 330, 361, 240, 261, 67, 65, 138, 181, 308, 26, 59, 150, 137, 244]], "output": 531}, {"inputs": [[115, 271, 137], [34, 72, 328, 312, 159, 32, 283, 6, 234, 280, 46, 349]], "output": 464}, {"inputs": [[47, 217, 349, 233, 283], [195, 188, 181, 259, 145, 96, 298, 322, 213, 154, 278, 292, 315, 191, 177, 228, 291, 204, 310, 266]], "output": 526}, {"inputs": [[177, 6, 326, 318, 294], [136, 215, 260, 259, 35, 248, 340, 377, 144, 248, 83, 150, 63, 48, 269, 197, 317, 135, 36, 344]], "output": 542}, {"inputs": [[266, 372], [260, 325, 159, 316, 296, 366, 335, 146]], "output": 668}, {"inputs": [[63, 339], [79, 316, 98, 354, 220, 267, 333, 11]], "output": 559}, {"inputs": [[149, 60, 172, 5, 212], [230, 374, 276, 281, 55, 96, 52, 83, 56, 399, 69, 333, 145, 6, 50, 101, 216, 327, 120, 209]], "output": 404}, {"inputs": [[220, 375, 285, 267, 150], [53, 317, 367, 258, 337, 280, 232, 322, 153, 169, 121, 211, 171, 345, 76, 370, 265, 107, 45, 320]], "output": 542}]}} +{"id": "LeetCode/3033", "content": "# Apply Operations to Make Two Strings Equal\n\nYou are given two **0-indexed** binary strings `s1` and `s2`, both of length `n`, and a positive integer `x`.\n\n\nYou can perform any of the following operations on the string `s1` **any** number of times:\n\n\n* Choose two indices `i` and `j`, and flip both `s1[i]` and `s1[j]`. The cost of this operation is `x`.\n* Choose an index `i` such that `i < n - 1` and flip both `s1[i]` and `s1[i + 1]`. The cost of this operation is `1`.\n\n\nReturn *the **minimum** cost needed to make the strings* `s1` *and* `s2` *equal, or return* `-1` *if it is impossible.*\n\n\n**Note** that flipping a character means changing it from `0` to `1` or vice-versa.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s1 = \"1100011000\", s2 = \"0101001010\", x = 2\n**Output:** 4\n**Explanation:** We can do the following operations:\n- Choose i = 3 and apply the second operation. The resulting string is s1 = \"110**11**11000\".\n- Choose i = 4 and apply the second operation. The resulting string is s1 = \"1101**00**1000\".\n- Choose i = 0 and j = 8 and apply the first operation. The resulting string is s1 = \"**0**1010010**1**0\" = s2.\nThe total cost is 1 + 1 + 2 = 4. It can be shown that it is the minimum cost possible.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s1 = \"10110\", s2 = \"00011\", x = 4\n**Output:** -1\n**Explanation:** It is not possible to make the two strings equal.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `n == s1.length == s2.length`\n* `1 <= n, x <= 500`\n* `s1` and `s2` consist only of the characters `'0'` and `'1'`.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minOperations(self, s1: str, s2: str, x: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minOperations(**['1100011000', '0101001010', 2]) == 4\nassert my_solution.minOperations(**['10110', '00011', 4]) == -1\nassert my_solution.minOperations(**['101101', '000000', 6]) == 4\nassert my_solution.minOperations(**['0', '1', 2]) == -1\nassert my_solution.minOperations(**['1011100100111000', '1001010001011100', 19]) == -1\nassert my_solution.minOperations(**['00101101100010', '00001010001111', 30]) == 8\nassert my_solution.minOperations(**['1011000', '0001101', 30]) == 4\nassert my_solution.minOperations(**['1111110101010110', '1000100111100101', 19]) == -1\nassert my_solution.minOperations(**['1011100000100100101', '1110001001110000011', 14]) == -1\nassert my_solution.minOperations(**['0', '1', 17]) == -1\nassert my_solution.minOperations(**['0', '1', 3]) == -1\nassert my_solution.minOperations(**['0001110010', '0110100111', 29]) == 5\nassert my_solution.minOperations(**['01111101010100110100', '10010011011001011000', 21]) == 7\nassert my_solution.minOperations(**['00000101', '01001010', 10]) == -1\nassert my_solution.minOperations(**['01', '00', 30]) == -1\nassert my_solution.minOperations(**['11111', '01011', 4]) == 2\nassert my_solution.minOperations(**['001010101011001', '110111000101110', 14]) == 7\nassert my_solution.minOperations(**['010011101', '101111000', 17]) == 4\nassert my_solution.minOperations(**['11110111', '10011111', 16]) == -1\nassert my_solution.minOperations(**['0011', '1100', 14]) == 2\n"}, "labels": {"questionId": "3033", "questionFrontendId": "2896", "questionTitle": "Apply Operations to Make Two Strings Equal", "stats": {"totalAccepted": "3.8K", "totalSubmission": "12.1K", "totalAcceptedRaw": 3800, "totalSubmissionRaw": 12132, "acRate": "31.3%"}, "probedCases": [{"inputs": ["1100011000", "0101001010", 2], "output": 4}, {"inputs": ["10110", "00011", 4], "output": -1}, {"inputs": ["101101", "000000", 6], "output": 4}, {"inputs": ["0", "1", 2], "output": -1}, {"inputs": ["1011100100111000", "1001010001011100", 19], "output": -1}, {"inputs": ["00101101100010", "00001010001111", 30], "output": 8}, {"inputs": ["1011000", "0001101", 30], "output": 4}, {"inputs": ["1111110101010110", "1000100111100101", 19], "output": -1}, {"inputs": ["1011100000100100101", "1110001001110000011", 14], "output": -1}, {"inputs": ["0", "1", 17], "output": -1}, {"inputs": ["0", "1", 3], "output": -1}, {"inputs": ["0001110010", "0110100111", 29], "output": 5}, {"inputs": ["01111101010100110100", "10010011011001011000", 21], "output": 7}, {"inputs": ["00000101", "01001010", 10], "output": -1}, {"inputs": ["01", "00", 30], "output": -1}, {"inputs": ["11111", "01011", 4], "output": 2}, {"inputs": ["001010101011001", "110111000101110", 14], "output": 7}, {"inputs": ["010011101", "101111000", 17], "output": 4}, {"inputs": ["11110111", "10011111", 16], "output": -1}, {"inputs": ["0011", "1100", 14], "output": 2}]}} +{"id": "LeetCode/3153", "content": "# Apply Operations on Array to Maximize Sum of Squares\n\nYou are given a **0-indexed** integer array `nums` and a **positive** integer `k`.\n\n\nYou can do the following operation on the array **any** number of times:\n\n\n* Choose any two distinct indices `i` and `j` and **simultaneously** update the values of `nums[i]` to `(nums[i] AND nums[j])` and `nums[j]` to `(nums[i] OR nums[j])`. Here, `OR` denotes the bitwise `OR` operation, and `AND` denotes the bitwise `AND` operation.\n\n\nYou have to choose `k` elements from the final array and calculate the sum of their **squares**.\n\n\nReturn *the **maximum** sum of squares you can achieve*.\n\n\nSince the answer can be very large, return it **modulo** `109 + 7`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,6,5,8], k = 2\n**Output:** 261\n**Explanation:** We can do the following operations on the array:\n- Choose i = 0 and j = 3, then change nums[0] to (2 AND 8) = 0 and nums[3] to (2 OR 8) = 10. The resulting array is nums = [0,6,5,10].\n- Choose i = 2 and j = 3, then change nums[2] to (5 AND 10) = 0 and nums[3] to (5 OR 10) = 15. The resulting array is nums = [0,6,0,15].\nWe can choose the elements 15 and 6 from the final array. The sum of squares is 152 + 62 = 261.\nIt can be shown that this is the maximum value we can get.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [4,5,4,7], k = 3\n**Output:** 90\n**Explanation:** We do not need to apply any operations.\nWe can choose the elements 7, 5, and 4 with a sum of squares: 72 + 52 + 42 = 90.\nIt can be shown that this is the maximum value we can get.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= k <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxSum(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxSum(**[[2, 6, 5, 8], 2]) == 261\nassert my_solution.maxSum(**[[4, 5, 4, 7], 3]) == 90\nassert my_solution.maxSum(**[[32, 85, 61], 1]) == 15625\nassert my_solution.maxSum(**[[123], 1]) == 15129\nassert my_solution.maxSum(**[[96, 66, 60, 58, 32, 17, 63, 21, 30, 44, 15, 8, 98, 93], 2]) == 32258\nassert my_solution.maxSum(**[[30, 8, 63, 69, 52, 94, 41, 28, 94, 86, 28, 13, 68, 38, 53, 11, 21, 33], 2]) == 32258\nassert my_solution.maxSum(**[[2, 38, 15, 2, 73, 100, 47, 14, 25, 58, 40, 64, 23, 9, 53, 38, 91, 75, 9, 2], 3]) == 48387\nassert my_solution.maxSum(**[[25, 52, 75, 65], 4]) == 24051\nassert my_solution.maxSum(**[[96, 36, 72, 61, 13, 25, 5, 33, 9, 51, 9, 78, 40], 13]) == 53776\nassert my_solution.maxSum(**[[38, 21, 15, 84, 65, 35, 57, 82, 94, 26, 27, 89, 73, 22, 25, 6, 97, 17], 4]) == 64516\nassert my_solution.maxSum(**[[18, 72, 52, 56, 7, 21, 55, 68, 98, 31, 35, 49, 100, 49, 64, 20], 4]) == 62548\nassert my_solution.maxSum(**[[2, 73, 75], 3]) == 11250\nassert my_solution.maxSum(**[[73, 37, 41, 84], 2]) == 27506\nassert my_solution.maxSum(**[[62, 83, 11, 3, 53], 3]) == 20459\nassert my_solution.maxSum(**[[53, 59, 71, 38, 5, 15, 98, 86, 9, 8, 35, 54, 65, 77, 3, 68, 11, 5, 41, 18], 9]) == 95273\nassert my_solution.maxSum(**[[53, 67, 91, 79, 21, 27, 63, 34, 60, 94, 51], 4]) == 64516\nassert my_solution.maxSum(**[[41, 15, 6, 31, 40, 97, 11, 45, 81, 91, 91, 62], 3]) == 48387\nassert my_solution.maxSum(**[[10, 9], 2]) == 185\nassert my_solution.maxSum(**[[9, 6, 8, 32, 92, 12, 47, 45, 62, 96, 5, 66, 82, 90, 34, 39, 49, 86, 16], 13]) == 102770\nassert my_solution.maxSum(**[[1, 19, 29, 30, 68, 13, 80, 16, 71, 32, 8, 76, 41, 24, 16, 2, 30], 14]) == 53470\n"}, "labels": {"questionId": "3153", "questionFrontendId": "2897", "questionTitle": "Apply Operations on Array to Maximize Sum of Squares", "stats": {"totalAccepted": "2.3K", "totalSubmission": "4.1K", "totalAcceptedRaw": 2345, "totalSubmissionRaw": 4091, "acRate": "57.3%"}, "probedCases": [{"inputs": [[2, 6, 5, 8], 2], "output": 261}, {"inputs": [[4, 5, 4, 7], 3], "output": 90}, {"inputs": [[32, 85, 61], 1], "output": 15625}, {"inputs": [[123], 1], "output": 15129}, {"inputs": [[96, 66, 60, 58, 32, 17, 63, 21, 30, 44, 15, 8, 98, 93], 2], "output": 32258}, {"inputs": [[30, 8, 63, 69, 52, 94, 41, 28, 94, 86, 28, 13, 68, 38, 53, 11, 21, 33], 2], "output": 32258}, {"inputs": [[2, 38, 15, 2, 73, 100, 47, 14, 25, 58, 40, 64, 23, 9, 53, 38, 91, 75, 9, 2], 3], "output": 48387}, {"inputs": [[25, 52, 75, 65], 4], "output": 24051}, {"inputs": [[96, 36, 72, 61, 13, 25, 5, 33, 9, 51, 9, 78, 40], 13], "output": 53776}, {"inputs": [[38, 21, 15, 84, 65, 35, 57, 82, 94, 26, 27, 89, 73, 22, 25, 6, 97, 17], 4], "output": 64516}, {"inputs": [[18, 72, 52, 56, 7, 21, 55, 68, 98, 31, 35, 49, 100, 49, 64, 20], 4], "output": 62548}, {"inputs": [[2, 73, 75], 3], "output": 11250}, {"inputs": [[73, 37, 41, 84], 2], "output": 27506}, {"inputs": [[62, 83, 11, 3, 53], 3], "output": 20459}, {"inputs": [[53, 59, 71, 38, 5, 15, 98, 86, 9, 8, 35, 54, 65, 77, 3, 68, 11, 5, 41, 18], 9], "output": 95273}, {"inputs": [[53, 67, 91, 79, 21, 27, 63, 34, 60, 94, 51], 4], "output": 64516}, {"inputs": [[41, 15, 6, 31, 40, 97, 11, 45, 81, 91, 91, 62], 3], "output": 48387}, {"inputs": [[10, 9], 2], "output": 185}, {"inputs": [[9, 6, 8, 32, 92, 12, 47, 45, 62, 96, 5, 66, 82, 90, 34, 39, 49, 86, 16], 13], "output": 102770}, {"inputs": [[1, 19, 29, 30, 68, 13, 80, 16, 71, 32, 8, 76, 41, 24, 16, 2, 30], 14], "output": 53470}]}} +{"id": "LeetCode/3154", "content": "# Maximum Value of an Ordered Triplet I\n\nYou are given a **0-indexed** integer array `nums`.\n\n\nReturn ***the maximum value over all triplets of indices*** `(i, j, k)` *such that* `i < j < k`. If all such triplets have a negative value, return `0`.\n\n\nThe **value of a triplet of indices** `(i, j, k)` is equal to `(nums[i] - nums[j]) * nums[k]`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [12,6,1,2,7]\n**Output:** 77\n**Explanation:** The value of the triplet (0, 2, 4) is (nums[0] - nums[2]) * nums[4] = 77.\nIt can be shown that there are no ordered triplets of indices with a value greater than 77. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,10,3,4,19]\n**Output:** 133\n**Explanation:** The value of the triplet (1, 2, 4) is (nums[1] - nums[2]) * nums[4] = 133.\nIt can be shown that there are no ordered triplets of indices with a value greater than 133.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,2,3]\n**Output:** 0\n**Explanation:** The only ordered triplet of indices (0, 1, 2) has a negative value of (nums[0] - nums[1]) * nums[2] = -3. Hence, the answer would be 0.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `3 <= nums.length <= 100`\n* `1 <= nums[i] <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumTripletValue(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumTripletValue(**[[12, 6, 1, 2, 7]]) == 77\nassert my_solution.maximumTripletValue(**[[1, 10, 3, 4, 19]]) == 133\nassert my_solution.maximumTripletValue(**[[1, 2, 3]]) == 0\nassert my_solution.maximumTripletValue(**[[2, 3, 1]]) == 0\nassert my_solution.maximumTripletValue(**[[5, 7, 8, 4]]) == 0\nassert my_solution.maximumTripletValue(**[[1000000, 1, 1000000]]) == 999999000000\nassert my_solution.maximumTripletValue(**[[18, 15, 8, 13, 10, 9, 17, 10, 2, 16, 17]]) == 272\nassert my_solution.maximumTripletValue(**[[8, 6, 3, 13, 2, 12, 19, 5, 19, 6, 10, 11, 9]]) == 266\nassert my_solution.maximumTripletValue(**[[6, 11, 12, 12, 7, 9, 2, 11, 12, 4, 19, 14, 16, 8, 16]]) == 190\nassert my_solution.maximumTripletValue(**[[15, 14, 17, 13, 18, 17, 10, 19, 2, 20, 12, 9]]) == 340\nassert my_solution.maximumTripletValue(**[[6, 14, 20, 19, 19, 10, 3, 15, 12, 13, 8, 1, 2, 15, 3]]) == 285\nassert my_solution.maximumTripletValue(**[[2, 7, 19, 4, 8, 20]]) == 300\nassert my_solution.maximumTripletValue(**[[10, 13, 6, 2]]) == 14\nassert my_solution.maximumTripletValue(**[[1, 19, 1, 3, 18, 10, 16, 9, 3, 17, 8, 9]]) == 324\nassert my_solution.maximumTripletValue(**[[16, 2, 10, 20, 16, 2, 13, 8, 19]]) == 342\nassert my_solution.maximumTripletValue(**[[19, 11, 12, 4, 17, 1, 7, 20, 13, 10, 14, 20, 11, 19, 3]]) == 360\nassert my_solution.maximumTripletValue(**[[16, 15, 12, 5, 4, 12, 15, 17, 5, 18, 6, 16, 1, 17, 4]]) == 289\nassert my_solution.maximumTripletValue(**[[8, 10, 17, 11, 2, 8, 13]]) == 195\nassert my_solution.maximumTripletValue(**[[13, 4, 3, 19, 16, 14, 17, 6, 20, 6, 16, 4]]) == 260\nassert my_solution.maximumTripletValue(**[[1, 8, 9, 18, 4, 10, 3, 13, 9]]) == 195\n"}, "labels": {"questionId": "3154", "questionFrontendId": "2873", "questionTitle": "Maximum Value of an Ordered Triplet I", "stats": {"totalAccepted": "5.3K", "totalSubmission": "9.8K", "totalAcceptedRaw": 5340, "totalSubmissionRaw": 9825, "acRate": "54.4%"}, "probedCases": [{"inputs": [[12, 6, 1, 2, 7]], "output": 77}, {"inputs": [[1, 10, 3, 4, 19]], "output": 133}, {"inputs": [[1, 2, 3]], "output": 0}, {"inputs": [[2, 3, 1]], "output": 0}, {"inputs": [[5, 7, 8, 4]], "output": 0}, {"inputs": [[1000000, 1, 1000000]], "output": 999999000000}, {"inputs": [[18, 15, 8, 13, 10, 9, 17, 10, 2, 16, 17]], "output": 272}, {"inputs": [[8, 6, 3, 13, 2, 12, 19, 5, 19, 6, 10, 11, 9]], "output": 266}, {"inputs": [[6, 11, 12, 12, 7, 9, 2, 11, 12, 4, 19, 14, 16, 8, 16]], "output": 190}, {"inputs": [[15, 14, 17, 13, 18, 17, 10, 19, 2, 20, 12, 9]], "output": 340}, {"inputs": [[6, 14, 20, 19, 19, 10, 3, 15, 12, 13, 8, 1, 2, 15, 3]], "output": 285}, {"inputs": [[2, 7, 19, 4, 8, 20]], "output": 300}, {"inputs": [[10, 13, 6, 2]], "output": 14}, {"inputs": [[1, 19, 1, 3, 18, 10, 16, 9, 3, 17, 8, 9]], "output": 324}, {"inputs": [[16, 2, 10, 20, 16, 2, 13, 8, 19]], "output": 342}, {"inputs": [[19, 11, 12, 4, 17, 1, 7, 20, 13, 10, 14, 20, 11, 19, 3]], "output": 360}, {"inputs": [[16, 15, 12, 5, 4, 12, 15, 17, 5, 18, 6, 16, 1, 17, 4]], "output": 289}, {"inputs": [[8, 10, 17, 11, 2, 8, 13]], "output": 195}, {"inputs": [[13, 4, 3, 19, 16, 14, 17, 6, 20, 6, 16, 4]], "output": 260}, {"inputs": [[1, 8, 9, 18, 4, 10, 3, 13, 9]], "output": 195}]}} +{"id": "LeetCode/3152", "content": "# Maximum Value of an Ordered Triplet II\n\nYou are given a **0-indexed** integer array `nums`.\n\n\nReturn ***the maximum value over all triplets of indices*** `(i, j, k)` *such that* `i < j < k`*.* If all such triplets have a negative value, return `0`.\n\n\nThe **value of a triplet of indices** `(i, j, k)` is equal to `(nums[i] - nums[j]) * nums[k]`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [12,6,1,2,7]\n**Output:** 77\n**Explanation:** The value of the triplet (0, 2, 4) is (nums[0] - nums[2]) * nums[4] = 77.\nIt can be shown that there are no ordered triplets of indices with a value greater than 77. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,10,3,4,19]\n**Output:** 133\n**Explanation:** The value of the triplet (1, 2, 4) is (nums[1] - nums[2]) * nums[4] = 133.\nIt can be shown that there are no ordered triplets of indices with a value greater than 133.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,2,3]\n**Output:** 0\n**Explanation:** The only ordered triplet of indices (0, 1, 2) has a negative value of (nums[0] - nums[1]) * nums[2] = -3. Hence, the answer would be 0.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `3 <= nums.length <= 105`\n* `1 <= nums[i] <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumTripletValue(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumTripletValue(**[[12, 6, 1, 2, 7]]) == 77\nassert my_solution.maximumTripletValue(**[[1, 10, 3, 4, 19]]) == 133\nassert my_solution.maximumTripletValue(**[[1, 2, 3]]) == 0\nassert my_solution.maximumTripletValue(**[[2, 3, 1]]) == 0\nassert my_solution.maximumTripletValue(**[[5, 7, 8, 4]]) == 0\nassert my_solution.maximumTripletValue(**[[1000000, 1, 1000000]]) == 999999000000\nassert my_solution.maximumTripletValue(**[[18, 15, 8, 13, 10, 9, 17, 10, 2, 16, 17]]) == 272\nassert my_solution.maximumTripletValue(**[[8, 6, 3, 13, 2, 12, 19, 5, 19, 6, 10, 11, 9]]) == 266\nassert my_solution.maximumTripletValue(**[[6, 11, 12, 12, 7, 9, 2, 11, 12, 4, 19, 14, 16, 8, 16]]) == 190\nassert my_solution.maximumTripletValue(**[[15, 14, 17, 13, 18, 17, 10, 19, 2, 20, 12, 9]]) == 340\nassert my_solution.maximumTripletValue(**[[6, 14, 20, 19, 19, 10, 3, 15, 12, 13, 8, 1, 2, 15, 3]]) == 285\nassert my_solution.maximumTripletValue(**[[2, 7, 19, 4, 8, 20]]) == 300\nassert my_solution.maximumTripletValue(**[[10, 13, 6, 2]]) == 14\nassert my_solution.maximumTripletValue(**[[1, 19, 1, 3, 18, 10, 16, 9, 3, 17, 8, 9]]) == 324\nassert my_solution.maximumTripletValue(**[[16, 2, 10, 20, 16, 2, 13, 8, 19]]) == 342\nassert my_solution.maximumTripletValue(**[[19, 11, 12, 4, 17, 1, 7, 20, 13, 10, 14, 20, 11, 19, 3]]) == 360\nassert my_solution.maximumTripletValue(**[[16, 15, 12, 5, 4, 12, 15, 17, 5, 18, 6, 16, 1, 17, 4]]) == 289\nassert my_solution.maximumTripletValue(**[[8, 10, 17, 11, 2, 8, 13]]) == 195\nassert my_solution.maximumTripletValue(**[[13, 4, 3, 19, 16, 14, 17, 6, 20, 6, 16, 4]]) == 260\nassert my_solution.maximumTripletValue(**[[1, 8, 9, 18, 4, 10, 3, 13, 9]]) == 195\n"}, "labels": {"questionId": "3152", "questionFrontendId": "2874", "questionTitle": "Maximum Value of an Ordered Triplet II", "stats": {"totalAccepted": "5.1K", "totalSubmission": "10.6K", "totalAcceptedRaw": 5052, "totalSubmissionRaw": 10617, "acRate": "47.6%"}, "probedCases": [{"inputs": [[12, 6, 1, 2, 7]], "output": 77}, {"inputs": [[1, 10, 3, 4, 19]], "output": 133}, {"inputs": [[1, 2, 3]], "output": 0}, {"inputs": [[2, 3, 1]], "output": 0}, {"inputs": [[5, 7, 8, 4]], "output": 0}, {"inputs": [[1000000, 1, 1000000]], "output": 999999000000}, {"inputs": [[18, 15, 8, 13, 10, 9, 17, 10, 2, 16, 17]], "output": 272}, {"inputs": [[8, 6, 3, 13, 2, 12, 19, 5, 19, 6, 10, 11, 9]], "output": 266}, {"inputs": [[6, 11, 12, 12, 7, 9, 2, 11, 12, 4, 19, 14, 16, 8, 16]], "output": 190}, {"inputs": [[15, 14, 17, 13, 18, 17, 10, 19, 2, 20, 12, 9]], "output": 340}, {"inputs": [[6, 14, 20, 19, 19, 10, 3, 15, 12, 13, 8, 1, 2, 15, 3]], "output": 285}, {"inputs": [[2, 7, 19, 4, 8, 20]], "output": 300}, {"inputs": [[10, 13, 6, 2]], "output": 14}, {"inputs": [[1, 19, 1, 3, 18, 10, 16, 9, 3, 17, 8, 9]], "output": 324}, {"inputs": [[16, 2, 10, 20, 16, 2, 13, 8, 19]], "output": 342}, {"inputs": [[19, 11, 12, 4, 17, 1, 7, 20, 13, 10, 14, 20, 11, 19, 3]], "output": 360}, {"inputs": [[16, 15, 12, 5, 4, 12, 15, 17, 5, 18, 6, 16, 1, 17, 4]], "output": 289}, {"inputs": [[8, 10, 17, 11, 2, 8, 13]], "output": 195}, {"inputs": [[13, 4, 3, 19, 16, 14, 17, 6, 20, 6, 16, 4]], "output": 260}, {"inputs": [[1, 8, 9, 18, 4, 10, 3, 13, 9]], "output": 195}]}} +{"id": "LeetCode/3141", "content": "# Minimum Size Subarray in Infinite Array\n\nYou are given a **0-indexed** array `nums` and an integer `target`.\n\n\nA **0-indexed** array `infinite_nums` is generated by infinitely appending the elements of `nums` to itself.\n\n\nReturn *the length of the **shortest** subarray of the array* `infinite_nums` *with a sum equal to* `target`*.* If there is no such subarray return `-1`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3], target = 5\n**Output:** 2\n**Explanation:** In this example infinite_nums = [1,2,3,1,2,3,1,2,...].\nThe subarray in the range [1,2], has the sum equal to target = 5 and length = 2.\nIt can be proven that 2 is the shortest length of a subarray with sum equal to target = 5.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,1,1,2,3], target = 4\n**Output:** 2\n**Explanation:** In this example infinite_nums = [1,1,1,2,3,1,1,1,2,3,1,1,...].\nThe subarray in the range [4,5], has the sum equal to target = 4 and length = 2.\nIt can be proven that 2 is the shortest length of a subarray with sum equal to target = 4.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [2,4,6,8], target = 3\n**Output:** -1\n**Explanation:** In this example infinite_nums = [2,4,6,8,2,4,6,8,...].\nIt can be proven that there is no subarray with sum equal to target = 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 105`\n* `1 <= target <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minSizeSubarray(self, nums: List[int], target: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minSizeSubarray(**[[1, 2, 3], 5]) == 2\nassert my_solution.minSizeSubarray(**[[1, 1, 1, 2, 3], 4]) == 2\nassert my_solution.minSizeSubarray(**[[2, 4, 6, 8], 3]) == -1\nassert my_solution.minSizeSubarray(**[[2, 1, 5, 7, 7, 1, 6, 3], 39]) == 9\nassert my_solution.minSizeSubarray(**[[17, 4, 3, 14, 17, 6, 15], 85]) == -1\nassert my_solution.minSizeSubarray(**[[18, 3, 11, 19, 7, 16, 6, 7, 3, 6, 18, 9, 9, 1, 14, 17, 15, 14, 12, 10], 7]) == 1\nassert my_solution.minSizeSubarray(**[[2, 3, 5, 2, 3, 4, 4, 1, 3, 5, 2, 2, 5, 1, 1, 2, 5], 19]) == 6\nassert my_solution.minSizeSubarray(**[[4, 1, 5, 7, 1, 6, 1, 7, 2, 2, 5, 5, 5, 6, 3], 20]) == 5\nassert my_solution.minSizeSubarray(**[[7, 3, 5], 36]) == -1\nassert my_solution.minSizeSubarray(**[[1, 11, 6, 4, 13], 22]) == 4\nassert my_solution.minSizeSubarray(**[[1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1], 83]) == 53\nassert my_solution.minSizeSubarray(**[[4, 3, 5, 4, 5, 4, 4, 4, 5, 7, 4, 5, 6, 3, 1, 4, 6, 3, 7], 15]) == 3\nassert my_solution.minSizeSubarray(**[[1, 2, 3, 2, 1, 5, 3, 4, 5], 53]) == 19\nassert my_solution.minSizeSubarray(**[[2, 5, 6, 4], 95]) == 22\nassert my_solution.minSizeSubarray(**[[6, 6, 4, 5, 2, 8, 1, 8, 7, 6, 6, 7, 4, 1, 9, 6, 8, 8], 55]) == 9\nassert my_solution.minSizeSubarray(**[[1, 2, 8, 19, 17, 2, 3, 11, 8, 12, 16, 18, 7], 36]) == 2\nassert my_solution.minSizeSubarray(**[[12, 14, 4, 14, 13, 16, 5], 36]) == -1\nassert my_solution.minSizeSubarray(**[[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 37]) == 37\nassert my_solution.minSizeSubarray(**[[5, 7, 2, 6, 4, 1, 6, 7, 1, 4, 7, 6, 7, 7, 6, 6, 4, 6, 8], 90]) == 17\nassert my_solution.minSizeSubarray(**[[3, 5, 15, 17, 6, 17, 10, 15, 10, 4, 6], 25]) == 2\n"}, "labels": {"questionId": "3141", "questionFrontendId": "2875", "questionTitle": "Minimum Size Subarray in Infinite Array", "stats": {"totalAccepted": "4.2K", "totalSubmission": "12.1K", "totalAcceptedRaw": 4156, "totalSubmissionRaw": 12073, "acRate": "34.4%"}, "probedCases": [{"inputs": [[1, 2, 3], 5], "output": 2}, {"inputs": [[1, 1, 1, 2, 3], 4], "output": 2}, {"inputs": [[2, 4, 6, 8], 3], "output": -1}, {"inputs": [[2, 1, 5, 7, 7, 1, 6, 3], 39], "output": 9}, {"inputs": [[17, 4, 3, 14, 17, 6, 15], 85], "output": -1}, {"inputs": [[18, 3, 11, 19, 7, 16, 6, 7, 3, 6, 18, 9, 9, 1, 14, 17, 15, 14, 12, 10], 7], "output": 1}, {"inputs": [[2, 3, 5, 2, 3, 4, 4, 1, 3, 5, 2, 2, 5, 1, 1, 2, 5], 19], "output": 6}, {"inputs": [[4, 1, 5, 7, 1, 6, 1, 7, 2, 2, 5, 5, 5, 6, 3], 20], "output": 5}, {"inputs": [[7, 3, 5], 36], "output": -1}, {"inputs": [[1, 11, 6, 4, 13], 22], "output": 4}, {"inputs": [[1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1], 83], "output": 53}, {"inputs": [[4, 3, 5, 4, 5, 4, 4, 4, 5, 7, 4, 5, 6, 3, 1, 4, 6, 3, 7], 15], "output": 3}, {"inputs": [[1, 2, 3, 2, 1, 5, 3, 4, 5], 53], "output": 19}, {"inputs": [[2, 5, 6, 4], 95], "output": 22}, {"inputs": [[6, 6, 4, 5, 2, 8, 1, 8, 7, 6, 6, 7, 4, 1, 9, 6, 8, 8], 55], "output": 9}, {"inputs": [[1, 2, 8, 19, 17, 2, 3, 11, 8, 12, 16, 18, 7], 36], "output": 2}, {"inputs": [[12, 14, 4, 14, 13, 16, 5], 36], "output": -1}, {"inputs": [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 37], "output": 37}, {"inputs": [[5, 7, 2, 6, 4, 1, 6, 7, 1, 4, 7, 6, 7, 7, 6, 6, 4, 6, 8], 90], "output": 17}, {"inputs": [[3, 5, 15, 17, 6, 17, 10, 15, 10, 4, 6], 25], "output": 2}]}} +{"id": "LeetCode/3044", "content": "# Minimum Operations to Collect Elements\n\nYou are given an array `nums` of positive integers and an integer `k`.\n\n\nIn one operation, you can remove the last element of the array and add it to your collection.\n\n\nReturn *the **minimum number of operations** needed to collect elements* `1, 2, ..., k`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [3,1,5,4,2], k = 2\n**Output:** 4\n**Explanation:** After 4 operations, we collect elements 2, 4, 5, and 1, in this order. Our collection contains elements 1 and 2. Hence, the answer is 4.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [3,1,5,4,2], k = 5\n**Output:** 5\n**Explanation:** After 5 operations, we collect elements 2, 4, 5, 1, and 3, in this order. Our collection contains elements 1 through 5. Hence, the answer is 5.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [3,2,5,3,1], k = 3\n**Output:** 4\n**Explanation:** After 4 operations, we collect elements 1, 3, 5, and 2, in this order. Our collection contains elements 1 through 3. Hence, the answer is 4.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 50`\n* `1 <= nums[i] <= nums.length`\n* `1 <= k <= nums.length`\n* The input is generated such that you can collect elements `1, 2, ..., k`.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minOperations(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minOperations(**[[3, 1, 5, 4, 2], 2]) == 4\nassert my_solution.minOperations(**[[3, 1, 5, 4, 2], 5]) == 5\nassert my_solution.minOperations(**[[3, 2, 5, 3, 1], 3]) == 4\nassert my_solution.minOperations(**[[1], 1]) == 1\nassert my_solution.minOperations(**[[1, 1], 1]) == 1\nassert my_solution.minOperations(**[[1, 2], 1]) == 2\nassert my_solution.minOperations(**[[1, 2], 2]) == 2\nassert my_solution.minOperations(**[[2, 1], 1]) == 1\nassert my_solution.minOperations(**[[2, 1], 2]) == 2\nassert my_solution.minOperations(**[[1, 1, 1], 1]) == 1\nassert my_solution.minOperations(**[[1, 1, 2], 1]) == 2\nassert my_solution.minOperations(**[[1, 1, 2], 2]) == 2\nassert my_solution.minOperations(**[[1, 1, 3], 1]) == 2\nassert my_solution.minOperations(**[[1, 2, 1], 1]) == 1\nassert my_solution.minOperations(**[[1, 2, 1], 2]) == 2\nassert my_solution.minOperations(**[[1, 2, 2], 1]) == 3\nassert my_solution.minOperations(**[[1, 2, 2], 2]) == 3\nassert my_solution.minOperations(**[[1, 2, 3], 1]) == 3\nassert my_solution.minOperations(**[[1, 2, 3], 2]) == 3\nassert my_solution.minOperations(**[[1, 2, 3], 3]) == 3\n"}, "labels": {"questionId": "3044", "questionFrontendId": "2869", "questionTitle": "Minimum Operations to Collect Elements", "stats": {"totalAccepted": "4K", "totalSubmission": "5.6K", "totalAcceptedRaw": 3999, "totalSubmissionRaw": 5606, "acRate": "71.3%"}, "probedCases": [{"inputs": [[3, 1, 5, 4, 2], 2], "output": 4}, {"inputs": [[3, 1, 5, 4, 2], 5], "output": 5}, {"inputs": [[3, 2, 5, 3, 1], 3], "output": 4}, {"inputs": [[1], 1], "output": 1}, {"inputs": [[1, 1], 1], "output": 1}, {"inputs": [[1, 2], 1], "output": 2}, {"inputs": [[1, 2], 2], "output": 2}, {"inputs": [[2, 1], 1], "output": 1}, {"inputs": [[2, 1], 2], "output": 2}, {"inputs": [[1, 1, 1], 1], "output": 1}, {"inputs": [[1, 1, 2], 1], "output": 2}, {"inputs": [[1, 1, 2], 2], "output": 2}, {"inputs": [[1, 1, 3], 1], "output": 2}, {"inputs": [[1, 2, 1], 1], "output": 1}, {"inputs": [[1, 2, 1], 2], "output": 2}, {"inputs": [[1, 2, 2], 1], "output": 3}, {"inputs": [[1, 2, 2], 2], "output": 3}, {"inputs": [[1, 2, 3], 1], "output": 3}, {"inputs": [[1, 2, 3], 2], "output": 3}, {"inputs": [[1, 2, 3], 3], "output": 3}]}} +{"id": "LeetCode/3094", "content": "# Minimum Number of Operations to Make Array Empty\n\nYou are given a **0-indexed** array `nums` consisting of positive integers.\n\n\nThere are two types of operations that you can apply on the array **any** number of times:\n\n\n* Choose **two** elements with **equal** values and **delete** them from the array.\n* Choose **three** elements with **equal** values and **delete** them from the array.\n\n\nReturn *the **minimum** number of operations required to make the array empty, or* `-1` *if it is not possible*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,3,3,2,2,4,2,3,4]\n**Output:** 4\n**Explanation:** We can apply the following operations to make the array empty:\n- Apply the first operation on the elements at indices 0 and 3. The resulting array is nums = [3,3,2,4,2,3,4].\n- Apply the first operation on the elements at indices 2 and 4. The resulting array is nums = [3,3,4,3,4].\n- Apply the second operation on the elements at indices 0, 1, and 3. The resulting array is nums = [4,4].\n- Apply the first operation on the elements at indices 0 and 1. The resulting array is nums = [].\nIt can be shown that we cannot make the array empty in less than 4 operations.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,1,2,2,3,3]\n**Output:** -1\n**Explanation:** It is impossible to empty the array.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= nums.length <= 105`\n* `1 <= nums[i] <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minOperations(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minOperations(**[[2, 3, 3, 2, 2, 4, 2, 3, 4]]) == 4\nassert my_solution.minOperations(**[[2, 1, 2, 2, 3, 3]]) == -1\nassert my_solution.minOperations(**[[3, 3]]) == 1\nassert my_solution.minOperations(**[[14, 12, 14, 14, 12, 14, 14, 12, 12, 12, 12, 14, 14, 12, 14, 14, 14, 12, 12]]) == 7\nassert my_solution.minOperations(**[[2, 2, 2, 2, 2, 2, 2, 2, 2]]) == 3\nassert my_solution.minOperations(**[[15, 3, 3, 15, 15, 13, 8, 15, 6, 15, 3, 1, 8, 8, 15]]) == -1\nassert my_solution.minOperations(**[[19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19]]) == 5\nassert my_solution.minOperations(**[[13, 7, 13, 7, 13, 7, 13, 13, 7]]) == 4\nassert my_solution.minOperations(**[[5, 5]]) == 1\nassert my_solution.minOperations(**[[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]]) == 5\nassert my_solution.minOperations(**[[3, 14, 3, 14, 3, 14, 14, 3, 3, 14, 14, 14, 3, 14, 14, 3, 14, 14, 14, 3]]) == 7\nassert my_solution.minOperations(**[[16, 16, 16, 19, 16, 3, 16, 8, 16, 16, 16, 19, 3, 16, 16]]) == -1\nassert my_solution.minOperations(**[[11, 11, 11, 11, 19, 11, 11, 11, 11, 11, 19, 11, 11, 11, 11, 11, 19]]) == 6\nassert my_solution.minOperations(**[[1, 1, 1, 5, 1, 5, 1, 1, 1, 1, 1, 1, 1]]) == 5\nassert my_solution.minOperations(**[[16, 16, 16, 3, 16, 16, 3]]) == 3\nassert my_solution.minOperations(**[[14, 4, 4, 19, 19]]) == -1\nassert my_solution.minOperations(**[[1, 14, 1, 1, 1]]) == -1\nassert my_solution.minOperations(**[[3, 10, 11, 3, 3, 11, 3, 3, 3, 3, 3, 3, 3, 3, 10, 3, 3, 3]]) == 7\nassert my_solution.minOperations(**[[3, 8, 8, 8, 8, 3, 8, 8, 8, 8, 8, 8, 8, 8]]) == 5\nassert my_solution.minOperations(**[[9, 9, 9]]) == 1\n"}, "labels": {"questionId": "3094", "questionFrontendId": "2870", "questionTitle": "Minimum Number of Operations to Make Array Empty", "stats": {"totalAccepted": "3.9K", "totalSubmission": "6.1K", "totalAcceptedRaw": 3912, "totalSubmissionRaw": 6067, "acRate": "64.5%"}, "probedCases": [{"inputs": [[2, 3, 3, 2, 2, 4, 2, 3, 4]], "output": 4}, {"inputs": [[2, 1, 2, 2, 3, 3]], "output": -1}, {"inputs": [[3, 3]], "output": 1}, {"inputs": [[14, 12, 14, 14, 12, 14, 14, 12, 12, 12, 12, 14, 14, 12, 14, 14, 14, 12, 12]], "output": 7}, {"inputs": [[2, 2, 2, 2, 2, 2, 2, 2, 2]], "output": 3}, {"inputs": [[15, 3, 3, 15, 15, 13, 8, 15, 6, 15, 3, 1, 8, 8, 15]], "output": -1}, {"inputs": [[19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19]], "output": 5}, {"inputs": [[13, 7, 13, 7, 13, 7, 13, 13, 7]], "output": 4}, {"inputs": [[5, 5]], "output": 1}, {"inputs": [[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]], "output": 5}, {"inputs": [[3, 14, 3, 14, 3, 14, 14, 3, 3, 14, 14, 14, 3, 14, 14, 3, 14, 14, 14, 3]], "output": 7}, {"inputs": [[16, 16, 16, 19, 16, 3, 16, 8, 16, 16, 16, 19, 3, 16, 16]], "output": -1}, {"inputs": [[11, 11, 11, 11, 19, 11, 11, 11, 11, 11, 19, 11, 11, 11, 11, 11, 19]], "output": 6}, {"inputs": [[1, 1, 1, 5, 1, 5, 1, 1, 1, 1, 1, 1, 1]], "output": 5}, {"inputs": [[16, 16, 16, 3, 16, 16, 3]], "output": 3}, {"inputs": [[14, 4, 4, 19, 19]], "output": -1}, {"inputs": [[1, 14, 1, 1, 1]], "output": -1}, {"inputs": [[3, 10, 11, 3, 3, 11, 3, 3, 3, 3, 3, 3, 3, 3, 10, 3, 3, 3]], "output": 7}, {"inputs": [[3, 8, 8, 8, 8, 3, 8, 8, 8, 8, 8, 8, 8, 8]], "output": 5}, {"inputs": [[9, 9, 9]], "output": 1}]}} +{"id": "LeetCode/3080", "content": "# Split Array Into Maximum Number of Subarrays\n\nYou are given an array `nums` consisting of **non-negative** integers.\n\n\nWe define the score of subarray `nums[l..r]` such that `l <= r` as `nums[l] AND nums[l + 1] AND ... AND nums[r]` where **AND** is the bitwise `AND` operation.\n\n\nConsider splitting the array into one or more subarrays such that the following conditions are satisfied:\n\n\n* **E****ach** element of the array belongs to **exactly** one subarray.\n* The sum of scores of the subarrays is the **minimum** possible.\n\n\nReturn *the **maximum** number of subarrays in a split that satisfies the conditions above.*\n\n\nA **subarray** is a contiguous part of an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,0,2,0,1,2]\n**Output:** 3\n**Explanation:** We can split the array into the following subarrays:\n- [1,0]. The score of this subarray is 1 AND 0 = 0.\n- [2,0]. The score of this subarray is 2 AND 0 = 0.\n- [1,2]. The score of this subarray is 1 AND 2 = 0.\nThe sum of scores is 0 + 0 + 0 = 0, which is the minimum possible score that we can obtain.\nIt can be shown that we cannot split the array into more than 3 subarrays with a total score of 0. So we return 3.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,7,1,3]\n**Output:** 1\n**Explanation:** We can split the array into one subarray: [5,7,1,3] with a score of 1, which is the minimum possible score that we can obtain.\nIt can be shown that we cannot split the array into more than 1 subarray with a total score of 1. So we return 1.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `0 <= nums[i] <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxSubarrays(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxSubarrays(**[[1, 0, 2, 0, 1, 2]]) == 3\nassert my_solution.maxSubarrays(**[[5, 7, 1, 3]]) == 1\nassert my_solution.maxSubarrays(**[[1, 0, 2, 1]]) == 2\nassert my_solution.maxSubarrays(**[[0]]) == 1\nassert my_solution.maxSubarrays(**[[0, 0]]) == 2\nassert my_solution.maxSubarrays(**[[100000]]) == 1\nassert my_solution.maxSubarrays(**[[1, 2, 2, 1]]) == 2\nassert my_solution.maxSubarrays(**[[30, 18, 19, 20, 11, 21, 12, 22, 26]]) == 2\nassert my_solution.maxSubarrays(**[[0, 8, 0, 0, 0, 23]]) == 4\nassert my_solution.maxSubarrays(**[[8, 10, 23, 26, 21, 28, 21, 14, 21, 14, 9, 16, 24, 29, 7, 26]]) == 4\nassert my_solution.maxSubarrays(**[[18, 12, 16, 28, 7, 15, 24, 7, 8, 26, 22, 6, 23, 7, 17, 1, 16]]) == 6\nassert my_solution.maxSubarrays(**[[22]]) == 1\nassert my_solution.maxSubarrays(**[[15, 24, 20, 28, 11, 16, 0, 0, 0, 22, 7, 18]]) == 5\nassert my_solution.maxSubarrays(**[[0, 0, 27]]) == 2\nassert my_solution.maxSubarrays(**[[18, 7, 20, 10, 0, 14, 0, 28, 7, 0, 0, 9, 12, 0]]) == 6\nassert my_solution.maxSubarrays(**[[0, 29, 16, 0, 6, 17]]) == 3\nassert my_solution.maxSubarrays(**[[4, 7, 13, 0, 23, 6, 4]]) == 1\nassert my_solution.maxSubarrays(**[[4, 27]]) == 1\nassert my_solution.maxSubarrays(**[[29, 5, 0, 25, 0, 15, 19, 24, 20, 0, 23]]) == 4\nassert my_solution.maxSubarrays(**[[24, 6]]) == 1\n"}, "labels": {"questionId": "3080", "questionFrontendId": "2871", "questionTitle": "Split Array Into Maximum Number of Subarrays", "stats": {"totalAccepted": "2.8K", "totalSubmission": "5.7K", "totalAcceptedRaw": 2829, "totalSubmissionRaw": 5701, "acRate": "49.6%"}, "probedCases": [{"inputs": [[1, 0, 2, 0, 1, 2]], "output": 3}, {"inputs": [[5, 7, 1, 3]], "output": 1}, {"inputs": [[1, 0, 2, 1]], "output": 2}, {"inputs": [[0]], "output": 1}, {"inputs": [[0, 0]], "output": 2}, {"inputs": [[100000]], "output": 1}, {"inputs": [[1, 2, 2, 1]], "output": 2}, {"inputs": [[30, 18, 19, 20, 11, 21, 12, 22, 26]], "output": 2}, {"inputs": [[0, 8, 0, 0, 0, 23]], "output": 4}, {"inputs": [[8, 10, 23, 26, 21, 28, 21, 14, 21, 14, 9, 16, 24, 29, 7, 26]], "output": 4}, {"inputs": [[18, 12, 16, 28, 7, 15, 24, 7, 8, 26, 22, 6, 23, 7, 17, 1, 16]], "output": 6}, {"inputs": [[22]], "output": 1}, {"inputs": [[15, 24, 20, 28, 11, 16, 0, 0, 0, 22, 7, 18]], "output": 5}, {"inputs": [[0, 0, 27]], "output": 2}, {"inputs": [[18, 7, 20, 10, 0, 14, 0, 28, 7, 0, 0, 9, 12, 0]], "output": 6}, {"inputs": [[0, 29, 16, 0, 6, 17]], "output": 3}, {"inputs": [[4, 7, 13, 0, 23, 6, 4]], "output": 1}, {"inputs": [[4, 27]], "output": 1}, {"inputs": [[29, 5, 0, 25, 0, 15, 19, 24, 20, 0, 23]], "output": 4}, {"inputs": [[24, 6]], "output": 1}]}} +{"id": "LeetCode/3055", "content": "# Maximum Odd Binary Number\n\nYou are given a **binary** string `s` that contains at least one `'1'`.\n\n\nYou have to **rearrange** the bits in such a way that the resulting binary number is the **maximum odd binary number** that can be created from this combination.\n\n\nReturn *a string representing the maximum odd binary number that can be created from the given combination.*\n\n\n**Note** that the resulting string **can** have leading zeros.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"010\"\n**Output:** \"001\"\n**Explanation:** Because there is just one '1', it must be in the last position. So the answer is \"001\".\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"0101\"\n**Output:** \"1001\"\n**Explanation:** One of the '1's must be in the last position. The maximum number that can be made with the remaining digits is \"100\". So the answer is \"1001\".\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 100`\n* `s` consists only of `'0'` and `'1'`.\n* `s` contains at least one `'1'`.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumOddBinaryNumber(self, s: str) -> str:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumOddBinaryNumber(**['010']) == 001\nassert my_solution.maximumOddBinaryNumber(**['0101']) == 1001\nassert my_solution.maximumOddBinaryNumber(**['1']) == 1\nassert my_solution.maximumOddBinaryNumber(**['01']) == 01\nassert my_solution.maximumOddBinaryNumber(**['10']) == 01\nassert my_solution.maximumOddBinaryNumber(**['11']) == 11\nassert my_solution.maximumOddBinaryNumber(**['001']) == 001\nassert my_solution.maximumOddBinaryNumber(**['011']) == 101\nassert my_solution.maximumOddBinaryNumber(**['100']) == 001\nassert my_solution.maximumOddBinaryNumber(**['101']) == 101\nassert my_solution.maximumOddBinaryNumber(**['110']) == 101\nassert my_solution.maximumOddBinaryNumber(**['111']) == 111\nassert my_solution.maximumOddBinaryNumber(**['0010']) == 0001\nassert my_solution.maximumOddBinaryNumber(**['0011']) == 1001\nassert my_solution.maximumOddBinaryNumber(**['0100']) == 0001\nassert my_solution.maximumOddBinaryNumber(**['0111']) == 1101\nassert my_solution.maximumOddBinaryNumber(**['1000']) == 0001\nassert my_solution.maximumOddBinaryNumber(**['1001']) == 1001\nassert my_solution.maximumOddBinaryNumber(**['1011']) == 1101\nassert my_solution.maximumOddBinaryNumber(**['1100']) == 1001\n"}, "labels": {"questionId": "3055", "questionFrontendId": "2864", "questionTitle": "Maximum Odd Binary Number", "stats": {"totalAccepted": "7.5K", "totalSubmission": "9.3K", "totalAcceptedRaw": 7522, "totalSubmissionRaw": 9297, "acRate": "80.9%"}, "probedCases": [{"inputs": ["010"], "output": "001"}, {"inputs": ["0101"], "output": "1001"}, {"inputs": ["1"], "output": "1"}, {"inputs": ["01"], "output": "01"}, {"inputs": ["10"], "output": "01"}, {"inputs": ["11"], "output": "11"}, {"inputs": ["001"], "output": "001"}, {"inputs": ["011"], "output": "101"}, {"inputs": ["100"], "output": "001"}, {"inputs": ["101"], "output": "101"}, {"inputs": ["110"], "output": "101"}, {"inputs": ["111"], "output": "111"}, {"inputs": ["0010"], "output": "0001"}, {"inputs": ["0011"], "output": "1001"}, {"inputs": ["0100"], "output": "0001"}, {"inputs": ["0111"], "output": "1101"}, {"inputs": ["1000"], "output": "0001"}, {"inputs": ["1001"], "output": "1001"}, {"inputs": ["1011"], "output": "1101"}, {"inputs": ["1100"], "output": "1001"}]}} +{"id": "LeetCode/3114", "content": "# Beautiful Towers I\n\nYou are given a **0-indexed** array `maxHeights` of `n` integers.\n\n\nYou are tasked with building `n` towers in the coordinate line. The `ith` tower is built at coordinate `i` and has a height of `heights[i]`.\n\n\nA configuration of towers is **beautiful** if the following conditions hold:\n\n\n1. `1 <= heights[i] <= maxHeights[i]`\n2. `heights` is a **mountain** array.\n\n\nArray `heights` is a **mountain** if there exists an index `i` such that:\n\n\n* For all `0 < j <= i`, `heights[j - 1] <= heights[j]`\n* For all `i <= k < n - 1`, `heights[k + 1] <= heights[k]`\n\n\nReturn *the **maximum possible sum of heights** of a beautiful configuration of towers*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** maxHeights = [5,3,4,1,1]\n**Output:** 13\n**Explanation:** One beautiful configuration with a maximum sum is heights = [5,3,3,1,1]. This configuration is beautiful since:\n- 1 <= heights[i] <= maxHeights[i] \n- heights is a mountain of peak i = 0.\nIt can be shown that there exists no other beautiful configuration with a sum of heights greater than 13.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** maxHeights = [6,5,3,9,2,7]\n**Output:** 22\n**Explanation:** One beautiful configuration with a maximum sum is heights = [3,3,3,9,2,2]. This configuration is beautiful since:\n- 1 <= heights[i] <= maxHeights[i]\n- heights is a mountain of peak i = 3.\nIt can be shown that there exists no other beautiful configuration with a sum of heights greater than 22.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** maxHeights = [3,2,5,5,2,3]\n**Output:** 18\n**Explanation:** One beautiful configuration with a maximum sum is heights = [2,2,5,5,2,2]. This configuration is beautiful since:\n- 1 <= heights[i] <= maxHeights[i]\n- heights is a mountain of peak i = 2. \nNote that, for this configuration, i = 3 can also be considered a peak.\nIt can be shown that there exists no other beautiful configuration with a sum of heights greater than 18.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == maxHeights <= 103`\n* `1 <= maxHeights[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumSumOfHeights(self, maxHeights: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumSumOfHeights(**[[5, 3, 4, 1, 1]]) == 13\nassert my_solution.maximumSumOfHeights(**[[6, 5, 3, 9, 2, 7]]) == 22\nassert my_solution.maximumSumOfHeights(**[[3, 2, 5, 5, 2, 3]]) == 18\nassert my_solution.maximumSumOfHeights(**[[1000000000]]) == 1000000000\nassert my_solution.maximumSumOfHeights(**[[1]]) == 1\nassert my_solution.maximumSumOfHeights(**[[933754743]]) == 933754743\nassert my_solution.maximumSumOfHeights(**[[1, 1000000000]]) == 1000000001\nassert my_solution.maximumSumOfHeights(**[[1000000000, 1000000000]]) == 2000000000\nassert my_solution.maximumSumOfHeights(**[[999999999, 1000000000]]) == 1999999999\nassert my_solution.maximumSumOfHeights(**[[1000000000, 999999999]]) == 1999999999\nassert my_solution.maximumSumOfHeights(**[[30, 1]]) == 31\nassert my_solution.maximumSumOfHeights(**[[1, 12, 19]]) == 32\nassert my_solution.maximumSumOfHeights(**[[1000000000, 1000000000, 1000000000]]) == 3000000000\nassert my_solution.maximumSumOfHeights(**[[999999999, 1000000000, 999999999]]) == 2999999998\nassert my_solution.maximumSumOfHeights(**[[1000000000, 999999999, 999999998]]) == 2999999997\nassert my_solution.maximumSumOfHeights(**[[999999998, 999999999, 1000000000]]) == 2999999997\nassert my_solution.maximumSumOfHeights(**[[1, 1, 1]]) == 3\nassert my_solution.maximumSumOfHeights(**[[1, 1, 4, 3, 3, 3, 6]]) == 20\nassert my_solution.maximumSumOfHeights(**[[2, 4, 1, 3, 5]]) == 11\nassert my_solution.maximumSumOfHeights(**[[1, 5, 2, 5, 6, 4, 6, 3, 4, 5]]) == 33\n"}, "labels": {"questionId": "3114", "questionFrontendId": "2865", "questionTitle": "Beautiful Towers I", "stats": {"totalAccepted": "6K", "totalSubmission": "12.2K", "totalAcceptedRaw": 6000, "totalSubmissionRaw": 12159, "acRate": "49.3%"}, "probedCases": [{"inputs": [[5, 3, 4, 1, 1]], "output": 13}, {"inputs": [[6, 5, 3, 9, 2, 7]], "output": 22}, {"inputs": [[3, 2, 5, 5, 2, 3]], "output": 18}, {"inputs": [[1000000000]], "output": 1000000000}, {"inputs": [[1]], "output": 1}, {"inputs": [[933754743]], "output": 933754743}, {"inputs": [[1, 1000000000]], "output": 1000000001}, {"inputs": [[1000000000, 1000000000]], "output": 2000000000}, {"inputs": [[999999999, 1000000000]], "output": 1999999999}, {"inputs": [[1000000000, 999999999]], "output": 1999999999}, {"inputs": [[30, 1]], "output": 31}, {"inputs": [[1, 12, 19]], "output": 32}, {"inputs": [[1000000000, 1000000000, 1000000000]], "output": 3000000000}, {"inputs": [[999999999, 1000000000, 999999999]], "output": 2999999998}, {"inputs": [[1000000000, 999999999, 999999998]], "output": 2999999997}, {"inputs": [[999999998, 999999999, 1000000000]], "output": 2999999997}, {"inputs": [[1, 1, 1]], "output": 3}, {"inputs": [[1, 1, 4, 3, 3, 3, 6]], "output": 20}, {"inputs": [[2, 4, 1, 3, 5]], "output": 11}, {"inputs": [[1, 5, 2, 5, 6, 4, 6, 3, 4, 5]], "output": 33}]}} +{"id": "LeetCode/3113", "content": "# Beautiful Towers II\n\nYou are given a **0-indexed** array `maxHeights` of `n` integers.\n\n\nYou are tasked with building `n` towers in the coordinate line. The `ith` tower is built at coordinate `i` and has a height of `heights[i]`.\n\n\nA configuration of towers is **beautiful** if the following conditions hold:\n\n\n1. `1 <= heights[i] <= maxHeights[i]`\n2. `heights` is a **mountain** array.\n\n\nArray `heights` is a **mountain** if there exists an index `i` such that:\n\n\n* For all `0 < j <= i`, `heights[j - 1] <= heights[j]`\n* For all `i <= k < n - 1`, `heights[k + 1] <= heights[k]`\n\n\nReturn *the **maximum possible sum of heights** of a beautiful configuration of towers*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** maxHeights = [5,3,4,1,1]\n**Output:** 13\n**Explanation:** One beautiful configuration with a maximum sum is heights = [5,3,3,1,1]. This configuration is beautiful since:\n- 1 <= heights[i] <= maxHeights[i] \n- heights is a mountain of peak i = 0.\nIt can be shown that there exists no other beautiful configuration with a sum of heights greater than 13.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** maxHeights = [6,5,3,9,2,7]\n**Output:** 22\n**Explanation:** One beautiful configuration with a maximum sum is heights = [3,3,3,9,2,2]. This configuration is beautiful since:\n- 1 <= heights[i] <= maxHeights[i]\n- heights is a mountain of peak i = 3.\nIt can be shown that there exists no other beautiful configuration with a sum of heights greater than 22.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** maxHeights = [3,2,5,5,2,3]\n**Output:** 18\n**Explanation:** One beautiful configuration with a maximum sum is heights = [2,2,5,5,2,2]. This configuration is beautiful since:\n- 1 <= heights[i] <= maxHeights[i]\n- heights is a mountain of peak i = 2. \nNote that, for this configuration, i = 3 can also be considered a peak.\nIt can be shown that there exists no other beautiful configuration with a sum of heights greater than 18.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == maxHeights <= 105`\n* `1 <= maxHeights[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumSumOfHeights(self, maxHeights: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumSumOfHeights(**[[5, 3, 4, 1, 1]]) == 13\nassert my_solution.maximumSumOfHeights(**[[6, 5, 3, 9, 2, 7]]) == 22\nassert my_solution.maximumSumOfHeights(**[[3, 2, 5, 5, 2, 3]]) == 18\nassert my_solution.maximumSumOfHeights(**[[1000000000]]) == 1000000000\nassert my_solution.maximumSumOfHeights(**[[1]]) == 1\nassert my_solution.maximumSumOfHeights(**[[352939501]]) == 352939501\nassert my_solution.maximumSumOfHeights(**[[1, 1000000000]]) == 1000000001\nassert my_solution.maximumSumOfHeights(**[[1000000000, 1000000000]]) == 2000000000\nassert my_solution.maximumSumOfHeights(**[[999999999, 1000000000]]) == 1999999999\nassert my_solution.maximumSumOfHeights(**[[1000000000, 999999999]]) == 1999999999\nassert my_solution.maximumSumOfHeights(**[[2, 1]]) == 3\nassert my_solution.maximumSumOfHeights(**[[26, 30, 30]]) == 86\nassert my_solution.maximumSumOfHeights(**[[1000000000, 1000000000, 1000000000]]) == 3000000000\nassert my_solution.maximumSumOfHeights(**[[999999999, 1000000000, 999999999]]) == 2999999998\nassert my_solution.maximumSumOfHeights(**[[1000000000, 999999999, 999999998]]) == 2999999997\nassert my_solution.maximumSumOfHeights(**[[999999998, 999999999, 1000000000]]) == 2999999997\nassert my_solution.maximumSumOfHeights(**[[1, 1, 1]]) == 3\nassert my_solution.maximumSumOfHeights(**[[1, 1, 5, 6, 2, 2, 3]]) == 19\nassert my_solution.maximumSumOfHeights(**[[3, 5, 3, 5, 1, 5, 4, 4, 4]]) == 22\nassert my_solution.maximumSumOfHeights(**[[4, 2, 4, 2, 1, 5, 4, 6]]) == 19\n"}, "labels": {"questionId": "3113", "questionFrontendId": "2866", "questionTitle": "Beautiful Towers II", "stats": {"totalAccepted": "16.1K", "totalSubmission": "35K", "totalAcceptedRaw": 16063, "totalSubmissionRaw": 34990, "acRate": "45.9%"}, "probedCases": [{"inputs": [[5, 3, 4, 1, 1]], "output": 13}, {"inputs": [[6, 5, 3, 9, 2, 7]], "output": 22}, {"inputs": [[3, 2, 5, 5, 2, 3]], "output": 18}, {"inputs": [[1000000000]], "output": 1000000000}, {"inputs": [[1]], "output": 1}, {"inputs": [[352939501]], "output": 352939501}, {"inputs": [[1, 1000000000]], "output": 1000000001}, {"inputs": [[1000000000, 1000000000]], "output": 2000000000}, {"inputs": [[999999999, 1000000000]], "output": 1999999999}, {"inputs": [[1000000000, 999999999]], "output": 1999999999}, {"inputs": [[2, 1]], "output": 3}, {"inputs": [[26, 30, 30]], "output": 86}, {"inputs": [[1000000000, 1000000000, 1000000000]], "output": 3000000000}, {"inputs": [[999999999, 1000000000, 999999999]], "output": 2999999998}, {"inputs": [[1000000000, 999999999, 999999998]], "output": 2999999997}, {"inputs": [[999999998, 999999999, 1000000000]], "output": 2999999997}, {"inputs": [[1, 1, 1]], "output": 3}, {"inputs": [[1, 1, 5, 6, 2, 2, 3]], "output": 19}, {"inputs": [[3, 5, 3, 5, 1, 5, 4, 4, 4]], "output": 22}, {"inputs": [[4, 2, 4, 2, 1, 5, 4, 6]], "output": 19}]}} +{"id": "LeetCode/3093", "content": "# Sum of Values at Indices With K Set Bits\n\nYou are given a **0-indexed** integer array `nums` and an integer `k`.\n\n\nReturn *an integer that denotes the **sum** of elements in* `nums` *whose corresponding **indices** have **exactly*** `k` *set bits in their binary representation.*\n\n\nThe **set bits** in an integer are the `1`'s present when it is written in binary.\n\n\n* For example, the binary representation of `21` is `10101`, which has `3` set bits.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [5,10,1,5,2], k = 1\n**Output:** 13\n**Explanation:** The binary representation of the indices are: \n0 = 0002\n1 = 0012\n2 = 0102\n3 = 0112\n4 = 1002Indices 1, 2, and 4 have k = 1 set bits in their binary representation.\nHence, the answer is nums[1] + nums[2] + nums[4] = 13.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [4,3,2,1], k = 2\n**Output:** 1\n**Explanation:** The binary representation of the indices are:\n0 = 002\n1 = 012\n2 = 102\n3 = 112Only index 3 has k = 2 set bits in its binary representation.\nHence, the answer is nums[3] = 1.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 1000`\n* `1 <= nums[i] <= 105`\n* `0 <= k <= 10`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def sumIndicesWithKSetBits(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.sumIndicesWithKSetBits(**[[5, 10, 1, 5, 2], 1]) == 13\nassert my_solution.sumIndicesWithKSetBits(**[[4, 3, 2, 1], 2]) == 1\nassert my_solution.sumIndicesWithKSetBits(**[[1], 0]) == 1\nassert my_solution.sumIndicesWithKSetBits(**[[100000], 0]) == 100000\nassert my_solution.sumIndicesWithKSetBits(**[[2, 2], 1]) == 2\nassert my_solution.sumIndicesWithKSetBits(**[[2, 4], 1]) == 4\nassert my_solution.sumIndicesWithKSetBits(**[[2, 7], 1]) == 7\nassert my_solution.sumIndicesWithKSetBits(**[[3, 3], 1]) == 3\nassert my_solution.sumIndicesWithKSetBits(**[[3, 9], 1]) == 9\nassert my_solution.sumIndicesWithKSetBits(**[[4, 7], 1]) == 7\nassert my_solution.sumIndicesWithKSetBits(**[[4, 8], 1]) == 8\nassert my_solution.sumIndicesWithKSetBits(**[[6, 6], 1]) == 6\nassert my_solution.sumIndicesWithKSetBits(**[[7, 2], 1]) == 2\nassert my_solution.sumIndicesWithKSetBits(**[[7, 4], 1]) == 4\nassert my_solution.sumIndicesWithKSetBits(**[[8, 4], 1]) == 4\nassert my_solution.sumIndicesWithKSetBits(**[[8, 9], 1]) == 9\nassert my_solution.sumIndicesWithKSetBits(**[[9, 9], 1]) == 9\nassert my_solution.sumIndicesWithKSetBits(**[[15, 43], 1]) == 43\nassert my_solution.sumIndicesWithKSetBits(**[[35, 86], 1]) == 86\nassert my_solution.sumIndicesWithKSetBits(**[[36, 14], 1]) == 14\n"}, "labels": {"questionId": "3093", "questionFrontendId": "2859", "questionTitle": "Sum of Values at Indices With K Set Bits", "stats": {"totalAccepted": "7.9K", "totalSubmission": "9.5K", "totalAcceptedRaw": 7937, "totalSubmissionRaw": 9524, "acRate": "83.3%"}, "probedCases": [{"inputs": [[5, 10, 1, 5, 2], 1], "output": 13}, {"inputs": [[4, 3, 2, 1], 2], "output": 1}, {"inputs": [[1], 0], "output": 1}, {"inputs": [[100000], 0], "output": 100000}, {"inputs": [[2, 2], 1], "output": 2}, {"inputs": [[2, 4], 1], "output": 4}, {"inputs": [[2, 7], 1], "output": 7}, {"inputs": [[3, 3], 1], "output": 3}, {"inputs": [[3, 9], 1], "output": 9}, {"inputs": [[4, 7], 1], "output": 7}, {"inputs": [[4, 8], 1], "output": 8}, {"inputs": [[6, 6], 1], "output": 6}, {"inputs": [[7, 2], 1], "output": 2}, {"inputs": [[7, 4], 1], "output": 4}, {"inputs": [[8, 4], 1], "output": 4}, {"inputs": [[8, 9], 1], "output": 9}, {"inputs": [[9, 9], 1], "output": 9}, {"inputs": [[15, 43], 1], "output": 43}, {"inputs": [[35, 86], 1], "output": 86}, {"inputs": [[36, 14], 1], "output": 14}]}} +{"id": "LeetCode/3104", "content": "# Happy Students\n\nYou are given a **0-indexed** integer array `nums` of length `n` where `n` is the total number of students in the class. The class teacher tries to select a group of students so that all the students remain happy.\n\n\nThe `ith` student will become happy if one of these two conditions is met:\n\n\n* The student is selected and the total number of selected students is **strictly greater than** `nums[i]`.\n* The student is not selected and the total number of selected students is **strictly** **less than** `nums[i]`.\n\n\nReturn *the number of ways to select a group of students so that everyone remains happy.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,1]\n**Output:** 2\n**Explanation:** \nThe two possible ways are:\nThe class teacher selects no student.\nThe class teacher selects both students to form the group. \nIf the class teacher selects just one student to form a group then the both students will not be happy. Therefore, there are only two possible ways.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [6,0,3,3,6,7,2,7]\n**Output:** 3\n**Explanation:** \nThe three possible ways are:\nThe class teacher selects the student with index = 1 to form the group.\nThe class teacher selects the students with index = 1, 2, 3, 6 to form the group.\nThe class teacher selects all the students to form the group.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `0 <= nums[i] < nums.length`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countWays(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countWays(**[[1, 1]]) == 2\nassert my_solution.countWays(**[[6, 0, 3, 3, 6, 7, 2, 7]]) == 3\nassert my_solution.countWays(**[[1, 1, 0, 1]]) == 1\nassert my_solution.countWays(**[[5, 0, 3, 4, 2, 1, 2, 4]]) == 1\nassert my_solution.countWays(**[[0, 4, 4, 4, 4, 4, 2]]) == 2\nassert my_solution.countWays(**[[0, 1, 5, 6, 8, 7, 4, 7, 2]]) == 2\nassert my_solution.countWays(**[[0]]) == 1\nassert my_solution.countWays(**[[2, 2, 7, 1, 2, 2, 4, 7]]) == 3\nassert my_solution.countWays(**[[0, 2, 2, 2, 3, 3, 3, 3]]) == 2\nassert my_solution.countWays(**[[7, 7, 7, 7, 7, 7, 7, 7, 2]]) == 2\nassert my_solution.countWays(**[[4, 2, 3, 6, 6, 0, 6, 8, 3]]) == 3\nassert my_solution.countWays(**[[0, 0, 1, 7, 2, 0, 6, 5]]) == 1\nassert my_solution.countWays(**[[6, 6, 6, 6, 6, 6, 6, 7, 1, 7]]) == 2\nassert my_solution.countWays(**[[2, 2, 4, 5, 0, 1, 4, 4, 7]]) == 1\nassert my_solution.countWays(**[[4, 4, 4, 4, 4]]) == 2\nassert my_solution.countWays(**[[0, 4, 0, 3, 4]]) == 2\nassert my_solution.countWays(**[[6, 5, 5, 8, 4, 2, 6, 4, 8]]) == 3\nassert my_solution.countWays(**[[0, 9, 4, 6, 8, 8, 1, 7, 4, 7]]) == 2\nassert my_solution.countWays(**[[1, 0, 0]]) == 1\nassert my_solution.countWays(**[[1, 1, 2, 2, 2, 3, 3, 3, 3]]) == 2\n"}, "labels": {"questionId": "3104", "questionFrontendId": "2860", "questionTitle": "Happy Students", "stats": {"totalAccepted": "5.8K", "totalSubmission": "10.4K", "totalAcceptedRaw": 5817, "totalSubmissionRaw": 10411, "acRate": "55.9%"}, "probedCases": [{"inputs": [[1, 1]], "output": 2}, {"inputs": [[6, 0, 3, 3, 6, 7, 2, 7]], "output": 3}, {"inputs": [[1, 1, 0, 1]], "output": 1}, {"inputs": [[5, 0, 3, 4, 2, 1, 2, 4]], "output": 1}, {"inputs": [[0, 4, 4, 4, 4, 4, 2]], "output": 2}, {"inputs": [[0, 1, 5, 6, 8, 7, 4, 7, 2]], "output": 2}, {"inputs": [[0]], "output": 1}, {"inputs": [[2, 2, 7, 1, 2, 2, 4, 7]], "output": 3}, {"inputs": [[0, 2, 2, 2, 3, 3, 3, 3]], "output": 2}, {"inputs": [[7, 7, 7, 7, 7, 7, 7, 7, 2]], "output": 2}, {"inputs": [[4, 2, 3, 6, 6, 0, 6, 8, 3]], "output": 3}, {"inputs": [[0, 0, 1, 7, 2, 0, 6, 5]], "output": 1}, {"inputs": [[6, 6, 6, 6, 6, 6, 6, 7, 1, 7]], "output": 2}, {"inputs": [[2, 2, 4, 5, 0, 1, 4, 4, 7]], "output": 1}, {"inputs": [[4, 4, 4, 4, 4]], "output": 2}, {"inputs": [[0, 4, 0, 3, 4]], "output": 2}, {"inputs": [[6, 5, 5, 8, 4, 2, 6, 4, 8]], "output": 3}, {"inputs": [[0, 9, 4, 6, 8, 8, 1, 7, 4, 7]], "output": 2}, {"inputs": [[1, 0, 0]], "output": 1}, {"inputs": [[1, 1, 2, 2, 2, 3, 3, 3, 3]], "output": 2}]}} +{"id": "LeetCode/3095", "content": "# Maximum Number of Alloys\n\nYou are the owner of a company that creates alloys using various types of metals. There are `n` different types of metals available, and you have access to `k` machines that can be used to create alloys. Each machine requires a specific amount of each metal type to create an alloy.\n\n\nFor the `ith` machine to create an alloy, it needs `composition[i][j]` units of metal of type `j`. Initially, you have `stock[i]` units of metal type `i`, and purchasing one unit of metal type `i` costs `cost[i]` coins.\n\n\nGiven integers `n`, `k`, `budget`, a **1-indexed** 2D array `composition`, and **1-indexed** arrays `stock` and `cost`, your goal is to **maximize** the number of alloys the company can create while staying within the budget of `budget` coins.\n\n\n**All alloys must be created with the same machine.**\n\n\nReturn *the maximum number of alloys that the company can create*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 3, k = 2, budget = 15, composition = [[1,1,1],[1,1,10]], stock = [0,0,0], cost = [1,2,3]\n**Output:** 2\n**Explanation:** It is optimal to use the 1st machine to create alloys.\nTo create 2 alloys we need to buy the:\n- 2 units of metal of the 1st type.\n- 2 units of metal of the 2nd type.\n- 2 units of metal of the 3rd type.\nIn total, we need 2 * 1 + 2 * 2 + 2 * 3 = 12 coins, which is smaller than or equal to budget = 15.\nNotice that we have 0 units of metal of each type and we have to buy all the required units of metal.\nIt can be proven that we can create at most 2 alloys.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 3, k = 2, budget = 15, composition = [[1,1,1],[1,1,10]], stock = [0,0,100], cost = [1,2,3]\n**Output:** 5\n**Explanation:** It is optimal to use the 2nd machine to create alloys.\nTo create 5 alloys we need to buy:\n- 5 units of metal of the 1st type.\n- 5 units of metal of the 2nd type.\n- 0 units of metal of the 3rd type.\nIn total, we need 5 * 1 + 5 * 2 + 0 * 3 = 15 coins, which is smaller than or equal to budget = 15.\nIt can be proven that we can create at most 5 alloys.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** n = 2, k = 3, budget = 10, composition = [[2,1],[1,2],[1,1]], stock = [1,1], cost = [5,5]\n**Output:** 2\n**Explanation:** It is optimal to use the 3rd machine to create alloys.\nTo create 2 alloys we need to buy the:\n- 1 unit of metal of the 1st type.\n- 1 unit of metal of the 2nd type.\nIn total, we need 1 * 5 + 1 * 5 = 10 coins, which is smaller than or equal to budget = 10.\nIt can be proven that we can create at most 2 alloys.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n, k <= 100`\n* `0 <= budget <= 108`\n* `composition.length == k`\n* `composition[i].length == n`\n* `1 <= composition[i][j] <= 100`\n* `stock.length == cost.length == n`\n* `0 <= stock[i] <= 108`\n* `1 <= cost[i] <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxNumberOfAlloys(self, n: int, k: int, budget: int, composition: List[List[int]], stock: List[int], cost: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxNumberOfAlloys(**[3, 2, 15, [[1, 1, 1], [1, 1, 10]], [0, 0, 0], [1, 2, 3]]) == 2\nassert my_solution.maxNumberOfAlloys(**[3, 2, 15, [[1, 1, 1], [1, 1, 10]], [0, 0, 100], [1, 2, 3]]) == 5\nassert my_solution.maxNumberOfAlloys(**[2, 3, 10, [[2, 1], [1, 2], [1, 1]], [1, 1], [5, 5]]) == 2\nassert my_solution.maxNumberOfAlloys(**[4, 4, 17, [[10, 10, 1, 5], [9, 7, 7, 1], [6, 3, 5, 9], [2, 10, 2, 7]], [9, 8, 2, 7], [9, 2, 6, 10]]) == 1\nassert my_solution.maxNumberOfAlloys(**[4, 9, 55, [[8, 3, 4, 2], [3, 9, 5, 5], [1, 7, 9, 8], [7, 6, 5, 1], [4, 6, 9, 4], [6, 8, 7, 1], [5, 10, 3, 4], [10, 1, 2, 4], [10, 3, 7, 2]], [9, 1, 10, 0], [3, 4, 9, 9]]) == 1\nassert my_solution.maxNumberOfAlloys(**[10, 10, 142, [[5, 3, 7, 3, 5, 5, 1, 6, 4, 3], [4, 8, 10, 8, 8, 3, 10, 6, 3, 8], [10, 2, 5, 10, 9, 2, 8, 5, 10, 7], [10, 8, 8, 8, 10, 8, 9, 6, 1, 8], [6, 2, 2, 3, 6, 3, 1, 10, 5, 8], [10, 7, 3, 10, 7, 6, 6, 10, 4, 5], [10, 2, 8, 10, 1, 8, 7, 6, 6, 7], [4, 1, 9, 6, 8, 8, 7, 1, 1, 4], [10, 9, 1, 2, 6, 4, 6, 8, 9, 4], [5, 6, 7, 2, 7, 10, 7, 8, 3, 5]], [0, 6, 3, 0, 0, 8, 1, 2, 8, 6], [2, 2, 2, 7, 4, 2, 10, 8, 9, 8]]) == 1\nassert my_solution.maxNumberOfAlloys(**[9, 3, 90, [[10, 9, 1, 3, 3, 5, 5, 10, 7], [2, 6, 4, 9, 9, 1, 9, 6, 7], [1, 4, 7, 6, 7, 7, 10, 6, 6]], [3, 10, 10, 8, 10, 5, 7, 1, 2], [9, 8, 10, 9, 9, 3, 9, 5, 8]]) == 1\nassert my_solution.maxNumberOfAlloys(**[8, 4, 196, [[5, 2, 3, 4, 7, 3, 3, 1], [1, 5, 9, 9, 6, 1, 9, 7], [5, 8, 3, 10, 2, 4, 8, 7], [9, 9, 5, 9, 6, 8, 4, 3]], [3, 5, 3, 6, 1, 5, 8, 1], [4, 5, 4, 9, 4, 8, 7, 5]]) == 2\nassert my_solution.maxNumberOfAlloys(**[2, 5, 48, [[6, 3], [9, 5], [1, 9], [1, 8], [3, 3]], [4, 8], [10, 1]]) == 5\nassert my_solution.maxNumberOfAlloys(**[3, 8, 50, [[10, 8, 5], [9, 8, 8], [2, 3, 1], [6, 2, 7], [5, 5, 3], [3, 5, 6], [8, 2, 9], [10, 2, 1]], [3, 9, 5], [1, 10, 6]]) == 4\nassert my_solution.maxNumberOfAlloys(**[6, 1, 195, [[4, 7, 7, 9, 6, 9]], [7, 4, 1, 4, 4, 0], [6, 6, 9, 10, 7, 9]]) == 0\nassert my_solution.maxNumberOfAlloys(**[10, 4, 149, [[9, 10, 1, 7, 6, 4, 9, 5, 7, 8], [9, 7, 2, 10, 7, 9, 10, 10, 1, 8], [1, 10, 9, 3, 5, 6, 6, 1, 8, 4], [9, 6, 2, 3, 9, 10, 6, 8, 7, 3]], [5, 0, 7, 5, 7, 8, 2, 2, 6, 10], [7, 5, 3, 3, 10, 9, 9, 3, 6, 8]]) == 1\nassert my_solution.maxNumberOfAlloys(**[5, 3, 110, [[5, 8, 9, 3, 10], [10, 10, 2, 1, 9], [7, 8, 2, 3, 4]], [7, 3, 4, 8, 4], [2, 2, 6, 5, 7]]) == 2\nassert my_solution.maxNumberOfAlloys(**[2, 3, 12, [[5, 9], [7, 8], [1, 1]], [0, 9], [8, 5]]) == 1\nassert my_solution.maxNumberOfAlloys(**[9, 5, 172, [[8, 8, 7, 6, 5, 3, 6, 10, 8], [9, 5, 4, 5, 9, 9, 2, 8, 5], [1, 9, 7, 8, 4, 10, 5, 1, 2], [10, 10, 4, 4, 5, 5, 5, 5, 9], [7, 10, 4, 7, 9, 6, 3, 1, 8]], [5, 0, 10, 0, 0, 8, 10, 9, 8], [3, 7, 6, 10, 10, 5, 2, 10, 6]]) == 0\nassert my_solution.maxNumberOfAlloys(**[7, 10, 31, [[10, 6, 2, 1, 6, 3, 9], [9, 7, 1, 4, 3, 3, 6], [4, 8, 3, 10, 7, 2, 10], [8, 1, 3, 3, 9, 3, 6], [6, 3, 2, 4, 9, 7, 5], [4, 2, 10, 2, 9, 8, 2], [9, 3, 6, 1, 3, 8, 1], [9, 5, 6, 9, 4, 10, 3], [1, 8, 8, 2, 5, 4, 10], [1, 6, 6, 6, 10, 6, 4]], [3, 9, 10, 4, 4, 8, 9], [6, 6, 9, 2, 1, 9, 6]]) == 1\nassert my_solution.maxNumberOfAlloys(**[4, 9, 103, [[5, 9, 6, 3], [1, 5, 7, 5], [5, 4, 10, 6], [2, 2, 4, 6], [1, 1, 2, 2], [10, 6, 5, 4], [9, 7, 8, 9], [3, 7, 8, 2], [8, 2, 4, 4]], [7, 7, 7, 3], [4, 7, 6, 10]]) == 5\nassert my_solution.maxNumberOfAlloys(**[10, 1, 197, [[7, 6, 6, 1, 2, 4, 8, 6, 4, 10]], [1, 3, 2, 1, 3, 4, 2, 6, 1, 1], [10, 6, 2, 1, 6, 2, 6, 5, 9, 8]]) == 0\nassert my_solution.maxNumberOfAlloys(**[10, 4, 152, [[1, 7, 1, 3, 9, 6, 8, 9, 10, 4], [8, 8, 9, 3, 10, 10, 4, 3, 2, 2], [3, 6, 4, 6, 1, 9, 4, 1, 4, 5], [2, 5, 1, 8, 3, 10, 6, 3, 8, 4]], [7, 2, 9, 6, 9, 4, 6, 6, 3, 6], [8, 2, 3, 9, 1, 10, 1, 9, 5, 4]]) == 1\nassert my_solution.maxNumberOfAlloys(**[6, 9, 72, [[1, 10, 8, 5, 4, 3], [6, 7, 3, 6, 10, 3], [10, 9, 8, 6, 2, 10], [8, 9, 10, 7, 9, 10], [2, 7, 2, 7, 6, 9], [4, 2, 8, 2, 7, 9], [2, 1, 1, 8, 8, 9], [5, 7, 1, 7, 3, 5], [4, 4, 4, 3, 10, 4]], [3, 3, 1, 6, 10, 8], [1, 8, 9, 8, 3, 3]]) == 1\n"}, "labels": {"questionId": "3095", "questionFrontendId": "2861", "questionTitle": "Maximum Number of Alloys", "stats": {"totalAccepted": "4.8K", "totalSubmission": "13.8K", "totalAcceptedRaw": 4828, "totalSubmissionRaw": 13788, "acRate": "35.0%"}, "probedCases": [{"inputs": [3, 2, 15, [[1, 1, 1], [1, 1, 10]], [0, 0, 0], [1, 2, 3]], "output": 2}, {"inputs": [3, 2, 15, [[1, 1, 1], [1, 1, 10]], [0, 0, 100], [1, 2, 3]], "output": 5}, {"inputs": [2, 3, 10, [[2, 1], [1, 2], [1, 1]], [1, 1], [5, 5]], "output": 2}, {"inputs": [4, 4, 17, [[10, 10, 1, 5], [9, 7, 7, 1], [6, 3, 5, 9], [2, 10, 2, 7]], [9, 8, 2, 7], [9, 2, 6, 10]], "output": 1}, {"inputs": [4, 9, 55, [[8, 3, 4, 2], [3, 9, 5, 5], [1, 7, 9, 8], [7, 6, 5, 1], [4, 6, 9, 4], [6, 8, 7, 1], [5, 10, 3, 4], [10, 1, 2, 4], [10, 3, 7, 2]], [9, 1, 10, 0], [3, 4, 9, 9]], "output": 1}, {"inputs": [10, 10, 142, [[5, 3, 7, 3, 5, 5, 1, 6, 4, 3], [4, 8, 10, 8, 8, 3, 10, 6, 3, 8], [10, 2, 5, 10, 9, 2, 8, 5, 10, 7], [10, 8, 8, 8, 10, 8, 9, 6, 1, 8], [6, 2, 2, 3, 6, 3, 1, 10, 5, 8], [10, 7, 3, 10, 7, 6, 6, 10, 4, 5], [10, 2, 8, 10, 1, 8, 7, 6, 6, 7], [4, 1, 9, 6, 8, 8, 7, 1, 1, 4], [10, 9, 1, 2, 6, 4, 6, 8, 9, 4], [5, 6, 7, 2, 7, 10, 7, 8, 3, 5]], [0, 6, 3, 0, 0, 8, 1, 2, 8, 6], [2, 2, 2, 7, 4, 2, 10, 8, 9, 8]], "output": 1}, {"inputs": [9, 3, 90, [[10, 9, 1, 3, 3, 5, 5, 10, 7], [2, 6, 4, 9, 9, 1, 9, 6, 7], [1, 4, 7, 6, 7, 7, 10, 6, 6]], [3, 10, 10, 8, 10, 5, 7, 1, 2], [9, 8, 10, 9, 9, 3, 9, 5, 8]], "output": 1}, {"inputs": [8, 4, 196, [[5, 2, 3, 4, 7, 3, 3, 1], [1, 5, 9, 9, 6, 1, 9, 7], [5, 8, 3, 10, 2, 4, 8, 7], [9, 9, 5, 9, 6, 8, 4, 3]], [3, 5, 3, 6, 1, 5, 8, 1], [4, 5, 4, 9, 4, 8, 7, 5]], "output": 2}, {"inputs": [2, 5, 48, [[6, 3], [9, 5], [1, 9], [1, 8], [3, 3]], [4, 8], [10, 1]], "output": 5}, {"inputs": [3, 8, 50, [[10, 8, 5], [9, 8, 8], [2, 3, 1], [6, 2, 7], [5, 5, 3], [3, 5, 6], [8, 2, 9], [10, 2, 1]], [3, 9, 5], [1, 10, 6]], "output": 4}, {"inputs": [6, 1, 195, [[4, 7, 7, 9, 6, 9]], [7, 4, 1, 4, 4, 0], [6, 6, 9, 10, 7, 9]], "output": 0}, {"inputs": [10, 4, 149, [[9, 10, 1, 7, 6, 4, 9, 5, 7, 8], [9, 7, 2, 10, 7, 9, 10, 10, 1, 8], [1, 10, 9, 3, 5, 6, 6, 1, 8, 4], [9, 6, 2, 3, 9, 10, 6, 8, 7, 3]], [5, 0, 7, 5, 7, 8, 2, 2, 6, 10], [7, 5, 3, 3, 10, 9, 9, 3, 6, 8]], "output": 1}, {"inputs": [5, 3, 110, [[5, 8, 9, 3, 10], [10, 10, 2, 1, 9], [7, 8, 2, 3, 4]], [7, 3, 4, 8, 4], [2, 2, 6, 5, 7]], "output": 2}, {"inputs": [2, 3, 12, [[5, 9], [7, 8], [1, 1]], [0, 9], [8, 5]], "output": 1}, {"inputs": [9, 5, 172, [[8, 8, 7, 6, 5, 3, 6, 10, 8], [9, 5, 4, 5, 9, 9, 2, 8, 5], [1, 9, 7, 8, 4, 10, 5, 1, 2], [10, 10, 4, 4, 5, 5, 5, 5, 9], [7, 10, 4, 7, 9, 6, 3, 1, 8]], [5, 0, 10, 0, 0, 8, 10, 9, 8], [3, 7, 6, 10, 10, 5, 2, 10, 6]], "output": 0}, {"inputs": [7, 10, 31, [[10, 6, 2, 1, 6, 3, 9], [9, 7, 1, 4, 3, 3, 6], [4, 8, 3, 10, 7, 2, 10], [8, 1, 3, 3, 9, 3, 6], [6, 3, 2, 4, 9, 7, 5], [4, 2, 10, 2, 9, 8, 2], [9, 3, 6, 1, 3, 8, 1], [9, 5, 6, 9, 4, 10, 3], [1, 8, 8, 2, 5, 4, 10], [1, 6, 6, 6, 10, 6, 4]], [3, 9, 10, 4, 4, 8, 9], [6, 6, 9, 2, 1, 9, 6]], "output": 1}, {"inputs": [4, 9, 103, [[5, 9, 6, 3], [1, 5, 7, 5], [5, 4, 10, 6], [2, 2, 4, 6], [1, 1, 2, 2], [10, 6, 5, 4], [9, 7, 8, 9], [3, 7, 8, 2], [8, 2, 4, 4]], [7, 7, 7, 3], [4, 7, 6, 10]], "output": 5}, {"inputs": [10, 1, 197, [[7, 6, 6, 1, 2, 4, 8, 6, 4, 10]], [1, 3, 2, 1, 3, 4, 2, 6, 1, 1], [10, 6, 2, 1, 6, 2, 6, 5, 9, 8]], "output": 0}, {"inputs": [10, 4, 152, [[1, 7, 1, 3, 9, 6, 8, 9, 10, 4], [8, 8, 9, 3, 10, 10, 4, 3, 2, 2], [3, 6, 4, 6, 1, 9, 4, 1, 4, 5], [2, 5, 1, 8, 3, 10, 6, 3, 8, 4]], [7, 2, 9, 6, 9, 4, 6, 6, 3, 6], [8, 2, 3, 9, 1, 10, 1, 9, 5, 4]], "output": 1}, {"inputs": [6, 9, 72, [[1, 10, 8, 5, 4, 3], [6, 7, 3, 6, 10, 3], [10, 9, 8, 6, 2, 10], [8, 9, 10, 7, 9, 10], [2, 7, 2, 7, 6, 9], [4, 2, 8, 2, 7, 9], [2, 1, 1, 8, 8, 9], [5, 7, 1, 7, 3, 5], [4, 4, 4, 3, 10, 4]], [3, 3, 1, 6, 10, 8], [1, 8, 9, 8, 3, 3]], "output": 1}]}} +{"id": "LeetCode/3047", "content": "# Maximum Element-Sum of a Complete Subset of Indices\n\nYou are given a **1****-indexed** array `nums` of `n` integers.\n\n\nA set of numbers is **complete** if the product of every pair of its elements is a perfect square.\n\n\nFor a subset of the indices set `{1, 2, ..., n}` represented as `{i1, i2, ..., ik}`, we define its **element-sum** as: `nums[i1] + nums[i2] + ... + nums[ik]`.\n\n\nReturn *the **maximum element-sum** of a **complete** subset of the indices set* `{1, 2, ..., n}`.\n\n\nA perfect square is a number that can be expressed as the product of an integer by itself.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [8,7,3,5,7,2,4,9]\n**Output:** 16\n**Explanation:** Apart from the subsets consisting of a single index, there are two other complete subsets of indices: {1,4} and {2,8}.\nThe sum of the elements corresponding to indices 1 and 4 is equal to nums[1] + nums[4] = 8 + 5 = 13.\nThe sum of the elements corresponding to indices 2 and 8 is equal to nums[2] + nums[8] = 7 + 9 = 16.\nHence, the maximum element-sum of a complete subset of indices is 16.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,10,3,10,1,13,7,9,4]\n**Output:** 19\n**Explanation:** Apart from the subsets consisting of a single index, there are four other complete subsets of indices: {1,4}, {1,9}, {2,8}, {4,9}, and {1,4,9}.\nThe sum of the elements corresponding to indices 1 and 4 is equal to nums[1] + nums[4] = 5 + 10 = 15.\nThe sum of the elements corresponding to indices 1 and 9 is equal to nums[1] + nums[9] = 5 + 4 = 9.\nThe sum of the elements corresponding to indices 2 and 8 is equal to nums[2] + nums[8] = 10 + 9 = 19.\nThe sum of the elements corresponding to indices 4 and 9 is equal to nums[4] + nums[9] = 10 + 4 = 14.\nThe sum of the elements corresponding to indices 1, 4, and 9 is equal to nums[1] + nums[4] + nums[9] = 5 + 10 + 4 = 19.\nHence, the maximum element-sum of a complete subset of indices is 19.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == nums.length <= 104`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumSum(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumSum(**[[8, 7, 3, 5, 7, 2, 4, 9]]) == 16\nassert my_solution.maximumSum(**[[5, 10, 3, 10, 1, 13, 7, 9, 4]]) == 19\nassert my_solution.maximumSum(**[[1, 1, 1, 1]]) == 2\nassert my_solution.maximumSum(**[[1, 100, 100, 1]]) == 100\nassert my_solution.maximumSum(**[[998244353, 998244353, 998244353, 998244353]]) == 1996488706\nassert my_solution.maximumSum(**[[1000000000, 1, 1, 1000000000]]) == 2000000000\nassert my_solution.maximumSum(**[[1, 1, 1000000000, 1]]) == 1000000000\nassert my_solution.maximumSum(**[[5, 10, 3, 10, 1, 13, 7, 20, 4]]) == 30\nassert my_solution.maximumSum(**[[5, 3, 3, 10, 1, 13, 7, 67, 4]]) == 70\nassert my_solution.maximumSum(**[[35, 45, 29, 16, 42, 49, 25, 19, 46]]) == 97\nassert my_solution.maximumSum(**[[34, 43, 47, 50, 45]]) == 84\nassert my_solution.maximumSum(**[[4, 31, 45, 34, 44]]) == 45\nassert my_solution.maximumSum(**[[12, 5, 49, 26]]) == 49\nassert my_solution.maximumSum(**[[41]]) == 41\nassert my_solution.maximumSum(**[[38, 9, 37, 11, 20, 43]]) == 49\nassert my_solution.maximumSum(**[[47, 50, 17, 49, 12, 22]]) == 96\nassert my_solution.maximumSum(**[[23, 13, 17, 3, 21, 23]]) == 26\nassert my_solution.maximumSum(**[[38, 28]]) == 38\nassert my_solution.maximumSum(**[[16, 31, 37, 29, 28, 34, 25, 36]]) == 67\nassert my_solution.maximumSum(**[[19, 46, 37, 44, 4, 40, 24, 17, 49]]) == 112\n"}, "labels": {"questionId": "3047", "questionFrontendId": "2862", "questionTitle": "Maximum Element-Sum of a Complete Subset of Indices", "stats": {"totalAccepted": "3.2K", "totalSubmission": "6.7K", "totalAcceptedRaw": 3221, "totalSubmissionRaw": 6704, "acRate": "48.0%"}, "probedCases": [{"inputs": [[8, 7, 3, 5, 7, 2, 4, 9]], "output": 16}, {"inputs": [[5, 10, 3, 10, 1, 13, 7, 9, 4]], "output": 19}, {"inputs": [[1, 1, 1, 1]], "output": 2}, {"inputs": [[1, 100, 100, 1]], "output": 100}, {"inputs": [[998244353, 998244353, 998244353, 998244353]], "output": 1996488706}, {"inputs": [[1000000000, 1, 1, 1000000000]], "output": 2000000000}, {"inputs": [[1, 1, 1000000000, 1]], "output": 1000000000}, {"inputs": [[5, 10, 3, 10, 1, 13, 7, 20, 4]], "output": 30}, {"inputs": [[5, 3, 3, 10, 1, 13, 7, 67, 4]], "output": 70}, {"inputs": [[35, 45, 29, 16, 42, 49, 25, 19, 46]], "output": 97}, {"inputs": [[34, 43, 47, 50, 45]], "output": 84}, {"inputs": [[4, 31, 45, 34, 44]], "output": 45}, {"inputs": [[12, 5, 49, 26]], "output": 49}, {"inputs": [[41]], "output": 41}, {"inputs": [[38, 9, 37, 11, 20, 43]], "output": 49}, {"inputs": [[47, 50, 17, 49, 12, 22]], "output": 96}, {"inputs": [[23, 13, 17, 3, 21, 23]], "output": 26}, {"inputs": [[38, 28]], "output": 38}, {"inputs": [[16, 31, 37, 29, 28, 34, 25, 36]], "output": 67}, {"inputs": [[19, 46, 37, 44, 4, 40, 24, 17, 49]], "output": 112}]}} +{"id": "LeetCode/3045", "content": "# Minimum Right Shifts to Sort the Array\n\nYou are given a **0-indexed** array `nums` of length `n` containing **distinct** positive integers. Return *the **minimum** number of **right shifts** required to sort* `nums` *and* `-1` *if this is not possible.*\n\n\nA **right shift** is defined as shifting the element at index `i` to index `(i + 1) % n`, for all indices.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [3,4,5,1,2]\n**Output:** 2\n**Explanation:** \nAfter the first right shift, nums = [2,3,4,5,1].\nAfter the second right shift, nums = [1,2,3,4,5].\nNow nums is sorted; therefore the answer is 2.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,3,5]\n**Output:** 0\n**Explanation:** nums is already sorted therefore, the answer is 0.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [2,1,4]\n**Output:** -1\n**Explanation:** It's impossible to sort the array using right shifts.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 100`\n* `1 <= nums[i] <= 100`\n* `nums` contains distinct integers.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumRightShifts(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumRightShifts(**[[3, 4, 5, 1, 2]]) == 2\nassert my_solution.minimumRightShifts(**[[1, 3, 5]]) == 0\nassert my_solution.minimumRightShifts(**[[2, 1, 4]]) == -1\nassert my_solution.minimumRightShifts(**[[31, 72, 79, 25]]) == 1\nassert my_solution.minimumRightShifts(**[[27, 33, 42, 58, 81, 8, 9, 17]]) == 3\nassert my_solution.minimumRightShifts(**[[72, 13, 21, 35, 52]]) == 4\nassert my_solution.minimumRightShifts(**[[65, 73, 77, 1]]) == 1\nassert my_solution.minimumRightShifts(**[[100, 8, 14, 68, 80, 84]]) == 5\nassert my_solution.minimumRightShifts(**[[53, 60, 64, 69, 98, 40]]) == 1\nassert my_solution.minimumRightShifts(**[[21]]) == 0\nassert my_solution.minimumRightShifts(**[[78, 12, 18, 21, 23, 36, 64, 70]]) == 7\nassert my_solution.minimumRightShifts(**[[25, 26, 53, 91, 92, 99, 10, 24]]) == 2\nassert my_solution.minimumRightShifts(**[[63, 51, 65, 87, 6, 17, 32, 14, 42, 46]]) == -1\nassert my_solution.minimumRightShifts(**[[43, 46, 75, 76, 85, 96, 9, 19, 25]]) == 3\nassert my_solution.minimumRightShifts(**[[5]]) == 0\nassert my_solution.minimumRightShifts(**[[35, 72, 76, 82, 96, 97, 24, 26]]) == 2\nassert my_solution.minimumRightShifts(**[[82, 30, 94, 55, 76, 51, 3, 89, 52, 96]]) == -1\nassert my_solution.minimumRightShifts(**[[57, 59, 88, 97, 6, 27, 41, 46, 52]]) == 5\nassert my_solution.minimumRightShifts(**[[17]]) == 0\nassert my_solution.minimumRightShifts(**[[62]]) == 0\n"}, "labels": {"questionId": "3045", "questionFrontendId": "2855", "questionTitle": "Minimum Right Shifts to Sort the Array", "stats": {"totalAccepted": "4.4K", "totalSubmission": "7.4K", "totalAcceptedRaw": 4373, "totalSubmissionRaw": 7420, "acRate": "58.9%"}, "probedCases": [{"inputs": [[3, 4, 5, 1, 2]], "output": 2}, {"inputs": [[1, 3, 5]], "output": 0}, {"inputs": [[2, 1, 4]], "output": -1}, {"inputs": [[31, 72, 79, 25]], "output": 1}, {"inputs": [[27, 33, 42, 58, 81, 8, 9, 17]], "output": 3}, {"inputs": [[72, 13, 21, 35, 52]], "output": 4}, {"inputs": [[65, 73, 77, 1]], "output": 1}, {"inputs": [[100, 8, 14, 68, 80, 84]], "output": 5}, {"inputs": [[53, 60, 64, 69, 98, 40]], "output": 1}, {"inputs": [[21]], "output": 0}, {"inputs": [[78, 12, 18, 21, 23, 36, 64, 70]], "output": 7}, {"inputs": [[25, 26, 53, 91, 92, 99, 10, 24]], "output": 2}, {"inputs": [[63, 51, 65, 87, 6, 17, 32, 14, 42, 46]], "output": -1}, {"inputs": [[43, 46, 75, 76, 85, 96, 9, 19, 25]], "output": 3}, {"inputs": [[5]], "output": 0}, {"inputs": [[35, 72, 76, 82, 96, 97, 24, 26]], "output": 2}, {"inputs": [[82, 30, 94, 55, 76, 51, 3, 89, 52, 96]], "output": -1}, {"inputs": [[57, 59, 88, 97, 6, 27, 41, 46, 52]], "output": 5}, {"inputs": [[17]], "output": 0}, {"inputs": [[62]], "output": 0}]}} +{"id": "LeetCode/3081", "content": "# Minimum Array Length After Pair Removals\n\nYou are given a **0-indexed** **sorted** array of integers `nums`.\n\n\nYou can perform the following operation any number of times:\n\n\n* Choose **two** indices, `i` and `j`, where `i < j`, such that `nums[i] < nums[j]`.\n* Then, remove the elements at indices `i` and `j` from `nums`. The remaining elements retain their original order, and the array is re-indexed.\n\n\nReturn *an integer that denotes the **minimum** length of* `nums` *after performing the operation any number of times (**including zero**).*\n\n\nNote that `nums` is sorted in **non-decreasing** order.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,3,4,9]\n**Output:** 0\n**Explanation:** Initially, nums = [1, 3, 4, 9].\nIn the first operation, we can choose index 0 and 1 because nums[0] < nums[1] <=> 1 < 3.\nRemove indices 0 and 1, and nums becomes [4, 9].\nFor the next operation, we can choose index 0 and 1 because nums[0] < nums[1] <=> 4 < 9.\nRemove indices 0 and 1, and nums becomes an empty array [].\nHence, the minimum length achievable is 0.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,3,6,9]\n**Output:** 0\n**Explanation:** Initially, nums = [2, 3, 6, 9]. \nIn the first operation, we can choose index 0 and 2 because nums[0] < nums[2] <=> 2 < 6. \nRemove indices 0 and 2, and nums becomes [3, 9]. \nFor the next operation, we can choose index 0 and 1 because nums[0] < nums[1] <=> 3 < 9. \nRemove indices 0 and 1, and nums becomes an empty array []. \nHence, the minimum length achievable is 0.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,1,2]\n**Output:** 1\n**Explanation:** Initially, nums = [1, 1, 2].\nIn an operation, we can choose index 0 and 2 because nums[0] < nums[2] <=> 1 < 2. \nRemove indices 0 and 2, and nums becomes [1]. \nIt is no longer possible to perform an operation on the array. \nHence, the minimum achievable length is 1. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n* `nums` is sorted in **non-decreasing** order.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minLengthAfterRemovals(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minLengthAfterRemovals(**[[1, 3, 4, 9]]) == 0\nassert my_solution.minLengthAfterRemovals(**[[2, 3, 6, 9]]) == 0\nassert my_solution.minLengthAfterRemovals(**[[1, 1, 2]]) == 1\nassert my_solution.minLengthAfterRemovals(**[[1]]) == 1\nassert my_solution.minLengthAfterRemovals(**[[2]]) == 1\nassert my_solution.minLengthAfterRemovals(**[[3]]) == 1\nassert my_solution.minLengthAfterRemovals(**[[5]]) == 1\nassert my_solution.minLengthAfterRemovals(**[[1, 1]]) == 2\nassert my_solution.minLengthAfterRemovals(**[[1, 2]]) == 0\nassert my_solution.minLengthAfterRemovals(**[[1, 4]]) == 0\nassert my_solution.minLengthAfterRemovals(**[[2, 3]]) == 0\nassert my_solution.minLengthAfterRemovals(**[[3, 3]]) == 2\nassert my_solution.minLengthAfterRemovals(**[[4, 5]]) == 0\nassert my_solution.minLengthAfterRemovals(**[[1, 1, 1]]) == 3\nassert my_solution.minLengthAfterRemovals(**[[1, 2, 2]]) == 1\nassert my_solution.minLengthAfterRemovals(**[[1, 3, 3]]) == 1\nassert my_solution.minLengthAfterRemovals(**[[2, 2, 2]]) == 3\nassert my_solution.minLengthAfterRemovals(**[[2, 3, 3]]) == 1\nassert my_solution.minLengthAfterRemovals(**[[2, 3, 4]]) == 1\nassert my_solution.minLengthAfterRemovals(**[[3, 4, 5]]) == 1\n"}, "labels": {"questionId": "3081", "questionFrontendId": "2856", "questionTitle": "Minimum Array Length After Pair Removals", "stats": {"totalAccepted": "3.4K", "totalSubmission": "13K", "totalAcceptedRaw": 3447, "totalSubmissionRaw": 12981, "acRate": "26.6%"}, "probedCases": [{"inputs": [[1, 3, 4, 9]], "output": 0}, {"inputs": [[2, 3, 6, 9]], "output": 0}, {"inputs": [[1, 1, 2]], "output": 1}, {"inputs": [[1]], "output": 1}, {"inputs": [[2]], "output": 1}, {"inputs": [[3]], "output": 1}, {"inputs": [[5]], "output": 1}, {"inputs": [[1, 1]], "output": 2}, {"inputs": [[1, 2]], "output": 0}, {"inputs": [[1, 4]], "output": 0}, {"inputs": [[2, 3]], "output": 0}, {"inputs": [[3, 3]], "output": 2}, {"inputs": [[4, 5]], "output": 0}, {"inputs": [[1, 1, 1]], "output": 3}, {"inputs": [[1, 2, 2]], "output": 1}, {"inputs": [[1, 3, 3]], "output": 1}, {"inputs": [[2, 2, 2]], "output": 3}, {"inputs": [[2, 3, 3]], "output": 1}, {"inputs": [[2, 3, 4]], "output": 1}, {"inputs": [[3, 4, 5]], "output": 1}]}} +{"id": "LeetCode/2953", "content": "# Count Pairs of Points With Distance k\n\nYou are given a **2D** integer array `coordinates` and an integer `k`, where `coordinates[i] = [xi, yi]` are the coordinates of the `ith` point in a 2D plane.\n\n\nWe define the **distance** between two points `(x1, y1)` and `(x2, y2)` as `(x1 XOR x2) + (y1 XOR y2)` where `XOR` is the bitwise `XOR` operation.\n\n\nReturn *the number of pairs* `(i, j)` *such that* `i < j` *and the distance between points* `i` *and* `j` *is equal to* `k`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** coordinates = [[1,2],[4,2],[1,3],[5,2]], k = 5\n**Output:** 2\n**Explanation:** We can choose the following pairs:\n- (0,1): Because we have (1 XOR 4) + (2 XOR 2) = 5.\n- (2,3): Because we have (1 XOR 5) + (3 XOR 2) = 5.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** coordinates = [[1,3],[1,3],[1,3],[1,3],[1,3]], k = 0\n**Output:** 10\n**Explanation:** Any two chosen pairs will have a distance of 0. There are 10 ways to choose two pairs.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= coordinates.length <= 50000`\n* `0 <= xi, yi <= 106`\n* `0 <= k <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countPairs(self, coordinates: List[List[int]], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countPairs(**[[[1, 2], [4, 2], [1, 3], [5, 2]], 5]) == 2\nassert my_solution.countPairs(**[[[1, 3], [1, 3], [1, 3], [1, 3], [1, 3]], 0]) == 10\nassert my_solution.countPairs(**[[[27, 94], [61, 68], [47, 0], [100, 4], [127, 89], [61, 103], [26, 4], [51, 54], [91, 26], [98, 23], [80, 74], [19, 93]], 95]) == 5\nassert my_solution.countPairs(**[[[39, 29], [98, 59], [65, 77], [41, 26], [95, 12], [71, 66], [41, 93], [28, 33], [96, 40], [39, 8], [106, 54], [8, 49], [68, 59], [21, 15], [3, 66], [77, 85], [111, 51]], 21]) == 6\nassert my_solution.countPairs(**[[[100, 32], [69, 8], [85, 31], [69, 47], [62, 34], [102, 43], [81, 39], [90, 0], [123, 6], [79, 18], [21, 94], [13, 36], [49, 97], [76, 59], [42, 74], [60, 68], [21, 11], [71, 21], [64, 13], [64, 95], [5, 85], [118, 53], [70, 44], [38, 57], [32, 119], [80, 61], [13, 68], [43, 108], [86, 49]], 39]) == 20\nassert my_solution.countPairs(**[[[60, 55], [35, 32], [99, 2], [58, 57], [16, 2], [43, 28], [30, 35], [35, 83], [104, 41], [20, 69], [58, 14], [12, 92], [71, 49], [7, 82], [65, 68], [9, 40], [15, 56], [57, 46], [21, 8], [37, 64], [42, 94], [73, 91], [12, 121], [10, 21], [41, 89]], 54]) == 10\nassert my_solution.countPairs(**[[[94, 23], [86, 58], [126, 55], [107, 23], [121, 60], [89, 28], [123, 15], [127, 3], [100, 49], [5, 3], [81, 49], [93, 0], [95, 37], [92, 25]], 53]) == 18\nassert my_solution.countPairs(**[[[40, 54], [8, 68], [33, 11], [51, 93], [95, 95], [17, 53], [35, 39], [59, 42], [28, 63], [41, 63], [54, 0], [88, 31], [5, 107], [32, 124], [74, 64], [15, 27], [61, 92], [16, 47], [62, 22], [2, 28], [27, 14], [53, 39], [21, 91], [7, 11]], 60]) == 11\nassert my_solution.countPairs(**[[[28, 14], [2, 13], [28, 14], [4, 7], [23, 1], [54, 0], [43, 22], [98, 16]], 33]) == 5\nassert my_solution.countPairs(**[[[84, 92], [84, 92], [84, 92], [84, 92], [84, 92], [54, 59], [84, 92], [93, 44]], 0]) == 15\nassert my_solution.countPairs(**[[[10, 57], [12, 62], [92, 44], [7, 60], [8, 55], [13, 50], [5, 55], [71, 82], [64, 26], [68, 43], [61, 88], [9, 44], [95, 16], [17, 16], [12, 53], [9, 59], [81, 44], [3, 56], [70, 94], [0, 58], [84, 29], [13, 63], [79, 87], [19, 39], [74, 35], [92, 7], [31, 6], [2, 50]], 13]) == 19\nassert my_solution.countPairs(**[[[56, 47], [26, 50], [51, 2], [40, 7], [24, 34], [55, 2], [13, 92], [57, 50], [47, 35], [32, 96], [14, 0], [4, 84], [86, 95]], 56]) == 4\nassert my_solution.countPairs(**[[[34, 60], [17, 93], [87, 90], [32, 125], [71, 27], [27, 26], [127, 115], [91, 27], [63, 68], [97, 48], [69, 73], [120, 78], [43, 55], [101, 125], [86, 87], [12, 35], [5, 20], [46, 12], [17, 24], [107, 62], [86, 88], [26, 80], [30, 41], [110, 114]], 81]) == 17\nassert my_solution.countPairs(**[[[65, 19], [12, 80], [90, 64], [38, 68], [17, 25], [49, 36], [91, 47], [20, 31], [81, 54], [83, 20], [90, 100], [0, 6], [93, 121]], 36]) == 3\nassert my_solution.countPairs(**[[[24, 75], [22, 67]], 23]) == 0\nassert my_solution.countPairs(**[[[42, 32], [62, 60], [57, 61], [100, 56], [91, 62], [57, 21], [100, 56], [63, 63], [45, 52], [59, 75], [32, 61], [57, 43], [61, 57], [64, 52], [24, 54], [92, 15], [53, 25], [84, 63], [1, 18], [21, 57], [29, 9], [68, 91], [22, 43], [105, 27]], 48]) == 18\nassert my_solution.countPairs(**[[[70, 98], [79, 66], [71, 63], [111, 94], [3, 50], [64, 111], [98, 67], [23, 41], [66, 14], [40, 19], [15, 13], [32, 86], [59, 58], [73, 94], [18, 10], [77, 50], [20, 60], [66, 8], [15, 30], [71, 2], [55, 9]], 60]) == 7\nassert my_solution.countPairs(**[[[5, 100], [60, 9], [84, 65], [38, 66], [83, 35], [17, 80], [88, 76], [80, 101], [55, 74], [46, 62], [28, 73], [54, 40], [119, 71], [10, 94], [45, 82], [20, 90], [47, 27], [41, 97], [66, 5], [33, 0], [101, 5], [89, 125], [6, 58], [61, 107], [25, 17], [104, 0], [29, 2]], 73]) == 15\nassert my_solution.countPairs(**[[[29, 23], [8, 19], [26, 5], [12, 25], [37, 2], [37, 27], [18, 68], [3, 53], [81, 85], [27, 94], [29, 39], [41, 64], [26, 28], [23, 80], [13, 46], [5, 68], [16, 18], [21, 77]], 25]) == 8\nassert my_solution.countPairs(**[[[90, 31], [113, 54], [92, 36], [67, 49], [123, 124], [127, 112], [16, 24], [85, 50], [58, 94], [115, 48], [83, 30], [51, 112], [39, 23], [0, 21], [27, 44], [99, 100], [122, 63], [34, 39], [25, 48], [44, 49], [84, 97], [31, 61]], 84]) == 10\n"}, "labels": {"questionId": "2953", "questionFrontendId": "2857", "questionTitle": "Count Pairs of Points With Distance k", "stats": {"totalAccepted": "2.8K", "totalSubmission": "7K", "totalAcceptedRaw": 2822, "totalSubmissionRaw": 7003, "acRate": "40.3%"}, "probedCases": [{"inputs": [[[1, 2], [4, 2], [1, 3], [5, 2]], 5], "output": 2}, {"inputs": [[[1, 3], [1, 3], [1, 3], [1, 3], [1, 3]], 0], "output": 10}, {"inputs": [[[27, 94], [61, 68], [47, 0], [100, 4], [127, 89], [61, 103], [26, 4], [51, 54], [91, 26], [98, 23], [80, 74], [19, 93]], 95], "output": 5}, {"inputs": [[[39, 29], [98, 59], [65, 77], [41, 26], [95, 12], [71, 66], [41, 93], [28, 33], [96, 40], [39, 8], [106, 54], [8, 49], [68, 59], [21, 15], [3, 66], [77, 85], [111, 51]], 21], "output": 6}, {"inputs": [[[100, 32], [69, 8], [85, 31], [69, 47], [62, 34], [102, 43], [81, 39], [90, 0], [123, 6], [79, 18], [21, 94], [13, 36], [49, 97], [76, 59], [42, 74], [60, 68], [21, 11], [71, 21], [64, 13], [64, 95], [5, 85], [118, 53], [70, 44], [38, 57], [32, 119], [80, 61], [13, 68], [43, 108], [86, 49]], 39], "output": 20}, {"inputs": [[[60, 55], [35, 32], [99, 2], [58, 57], [16, 2], [43, 28], [30, 35], [35, 83], [104, 41], [20, 69], [58, 14], [12, 92], [71, 49], [7, 82], [65, 68], [9, 40], [15, 56], [57, 46], [21, 8], [37, 64], [42, 94], [73, 91], [12, 121], [10, 21], [41, 89]], 54], "output": 10}, {"inputs": [[[94, 23], [86, 58], [126, 55], [107, 23], [121, 60], [89, 28], [123, 15], [127, 3], [100, 49], [5, 3], [81, 49], [93, 0], [95, 37], [92, 25]], 53], "output": 18}, {"inputs": [[[40, 54], [8, 68], [33, 11], [51, 93], [95, 95], [17, 53], [35, 39], [59, 42], [28, 63], [41, 63], [54, 0], [88, 31], [5, 107], [32, 124], [74, 64], [15, 27], [61, 92], [16, 47], [62, 22], [2, 28], [27, 14], [53, 39], [21, 91], [7, 11]], 60], "output": 11}, {"inputs": [[[28, 14], [2, 13], [28, 14], [4, 7], [23, 1], [54, 0], [43, 22], [98, 16]], 33], "output": 5}, {"inputs": [[[84, 92], [84, 92], [84, 92], [84, 92], [84, 92], [54, 59], [84, 92], [93, 44]], 0], "output": 15}, {"inputs": [[[10, 57], [12, 62], [92, 44], [7, 60], [8, 55], [13, 50], [5, 55], [71, 82], [64, 26], [68, 43], [61, 88], [9, 44], [95, 16], [17, 16], [12, 53], [9, 59], [81, 44], [3, 56], [70, 94], [0, 58], [84, 29], [13, 63], [79, 87], [19, 39], [74, 35], [92, 7], [31, 6], [2, 50]], 13], "output": 19}, {"inputs": [[[56, 47], [26, 50], [51, 2], [40, 7], [24, 34], [55, 2], [13, 92], [57, 50], [47, 35], [32, 96], [14, 0], [4, 84], [86, 95]], 56], "output": 4}, {"inputs": [[[34, 60], [17, 93], [87, 90], [32, 125], [71, 27], [27, 26], [127, 115], [91, 27], [63, 68], [97, 48], [69, 73], [120, 78], [43, 55], [101, 125], [86, 87], [12, 35], [5, 20], [46, 12], [17, 24], [107, 62], [86, 88], [26, 80], [30, 41], [110, 114]], 81], "output": 17}, {"inputs": [[[65, 19], [12, 80], [90, 64], [38, 68], [17, 25], [49, 36], [91, 47], [20, 31], [81, 54], [83, 20], [90, 100], [0, 6], [93, 121]], 36], "output": 3}, {"inputs": [[[24, 75], [22, 67]], 23], "output": 0}, {"inputs": [[[42, 32], [62, 60], [57, 61], [100, 56], [91, 62], [57, 21], [100, 56], [63, 63], [45, 52], [59, 75], [32, 61], [57, 43], [61, 57], [64, 52], [24, 54], [92, 15], [53, 25], [84, 63], [1, 18], [21, 57], [29, 9], [68, 91], [22, 43], [105, 27]], 48], "output": 18}, {"inputs": [[[70, 98], [79, 66], [71, 63], [111, 94], [3, 50], [64, 111], [98, 67], [23, 41], [66, 14], [40, 19], [15, 13], [32, 86], [59, 58], [73, 94], [18, 10], [77, 50], [20, 60], [66, 8], [15, 30], [71, 2], [55, 9]], 60], "output": 7}, {"inputs": [[[5, 100], [60, 9], [84, 65], [38, 66], [83, 35], [17, 80], [88, 76], [80, 101], [55, 74], [46, 62], [28, 73], [54, 40], [119, 71], [10, 94], [45, 82], [20, 90], [47, 27], [41, 97], [66, 5], [33, 0], [101, 5], [89, 125], [6, 58], [61, 107], [25, 17], [104, 0], [29, 2]], 73], "output": 15}, {"inputs": [[[29, 23], [8, 19], [26, 5], [12, 25], [37, 2], [37, 27], [18, 68], [3, 53], [81, 85], [27, 94], [29, 39], [41, 64], [26, 28], [23, 80], [13, 46], [5, 68], [16, 18], [21, 77]], 25], "output": 8}, {"inputs": [[[90, 31], [113, 54], [92, 36], [67, 49], [123, 124], [127, 112], [16, 24], [85, 50], [58, 94], [115, 48], [83, 30], [51, 112], [39, 23], [0, 21], [27, 44], [99, 100], [122, 63], [34, 39], [25, 48], [44, 49], [84, 97], [31, 61]], 84], "output": 10}]}} +{"id": "LeetCode/3034", "content": "# Points That Intersect With Cars\n\nYou are given a **0-indexed** 2D integer array `nums` representing the coordinates of the cars parking on a number line. For any index `i`, `nums[i] = [starti, endi]` where `starti` is the starting point of the `ith` car and `endi` is the ending point of the `ith` car.\n\n\nReturn *the number of integer points on the line that are covered with **any part** of a car.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [[3,6],[1,5],[4,7]]\n**Output:** 7\n**Explanation:** All the points from 1 to 7 intersect at least one car, therefore the answer would be 7.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [[1,3],[5,8]]\n**Output:** 7\n**Explanation:** Points intersecting at least one car are 1, 2, 3, 5, 6, 7, 8. There are a total of 7 points, therefore the answer would be 7.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 100`\n* `nums[i].length == 2`\n* `1 <= starti <= endi <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def numberOfPoints(self, nums: List[List[int]]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.numberOfPoints(**[[[3, 6], [1, 5], [4, 7]]]) == 7\nassert my_solution.numberOfPoints(**[[[1, 3], [5, 8]]]) == 7\nassert my_solution.numberOfPoints(**[[[4, 4], [9, 10], [9, 10], [3, 8]]]) == 8\nassert my_solution.numberOfPoints(**[[[2, 5], [3, 8], [1, 6], [4, 10]]]) == 10\nassert my_solution.numberOfPoints(**[[[2, 3], [3, 9], [5, 7], [4, 10], [9, 10]]]) == 9\nassert my_solution.numberOfPoints(**[[[4, 10]]]) == 7\nassert my_solution.numberOfPoints(**[[[1, 9], [2, 10], [6, 7], [8, 9], [5, 8], [1, 3]]]) == 10\nassert my_solution.numberOfPoints(**[[[5, 10], [3, 8], [3, 9]]]) == 8\nassert my_solution.numberOfPoints(**[[[2, 3], [3, 10], [5, 8], [4, 8], [2, 7], [3, 4], [3, 10], [7, 8]]]) == 9\nassert my_solution.numberOfPoints(**[[[1, 3], [2, 4], [6, 6], [6, 9], [2, 10], [4, 10], [3, 6], [1, 4], [1, 3]]]) == 10\nassert my_solution.numberOfPoints(**[[[4, 10], [3, 9], [3, 5], [4, 10], [7, 10], [1, 7], [7, 9], [4, 8]]]) == 10\nassert my_solution.numberOfPoints(**[[[1, 6], [6, 7], [1, 6], [1, 3], [1, 8], [2, 9], [3, 8], [1, 9]]]) == 9\nassert my_solution.numberOfPoints(**[[[1, 6], [8, 10], [3, 7], [6, 10], [3, 10], [1, 10], [7, 8]]]) == 10\nassert my_solution.numberOfPoints(**[[[6, 8], [2, 8], [3, 9], [3, 5], [6, 10], [1, 2], [5, 5]]]) == 10\nassert my_solution.numberOfPoints(**[[[4, 5], [5, 9], [2, 3], [5, 10], [1, 9], [1, 8], [2, 9], [2, 10]]]) == 10\nassert my_solution.numberOfPoints(**[[[8, 9], [6, 7], [6, 9], [3, 5], [7, 10], [5, 9], [10, 10]]]) == 8\nassert my_solution.numberOfPoints(**[[[6, 8], [7, 10], [9, 10], [6, 10], [1, 10], [5, 10]]]) == 10\nassert my_solution.numberOfPoints(**[[[9, 9], [2, 8], [5, 8], [3, 5], [2, 2], [7, 9], [5, 10]]]) == 9\nassert my_solution.numberOfPoints(**[[[3, 9], [5, 9]]]) == 7\nassert my_solution.numberOfPoints(**[[[5, 10], [2, 3], [3, 10], [4, 7], [1, 9], [5, 10], [2, 6], [1, 7], [8, 9], [2, 9]]]) == 10\n"}, "labels": {"questionId": "3034", "questionFrontendId": "2848", "questionTitle": "Points That Intersect With Cars", "stats": {"totalAccepted": "8K", "totalSubmission": "10.8K", "totalAcceptedRaw": 7978, "totalSubmissionRaw": 10798, "acRate": "73.9%"}, "probedCases": [{"inputs": [[[3, 6], [1, 5], [4, 7]]], "output": 7}, {"inputs": [[[1, 3], [5, 8]]], "output": 7}, {"inputs": [[[4, 4], [9, 10], [9, 10], [3, 8]]], "output": 8}, {"inputs": [[[2, 5], [3, 8], [1, 6], [4, 10]]], "output": 10}, {"inputs": [[[2, 3], [3, 9], [5, 7], [4, 10], [9, 10]]], "output": 9}, {"inputs": [[[4, 10]]], "output": 7}, {"inputs": [[[1, 9], [2, 10], [6, 7], [8, 9], [5, 8], [1, 3]]], "output": 10}, {"inputs": [[[5, 10], [3, 8], [3, 9]]], "output": 8}, {"inputs": [[[2, 3], [3, 10], [5, 8], [4, 8], [2, 7], [3, 4], [3, 10], [7, 8]]], "output": 9}, {"inputs": [[[1, 3], [2, 4], [6, 6], [6, 9], [2, 10], [4, 10], [3, 6], [1, 4], [1, 3]]], "output": 10}, {"inputs": [[[4, 10], [3, 9], [3, 5], [4, 10], [7, 10], [1, 7], [7, 9], [4, 8]]], "output": 10}, {"inputs": [[[1, 6], [6, 7], [1, 6], [1, 3], [1, 8], [2, 9], [3, 8], [1, 9]]], "output": 9}, {"inputs": [[[1, 6], [8, 10], [3, 7], [6, 10], [3, 10], [1, 10], [7, 8]]], "output": 10}, {"inputs": [[[6, 8], [2, 8], [3, 9], [3, 5], [6, 10], [1, 2], [5, 5]]], "output": 10}, {"inputs": [[[4, 5], [5, 9], [2, 3], [5, 10], [1, 9], [1, 8], [2, 9], [2, 10]]], "output": 10}, {"inputs": [[[8, 9], [6, 7], [6, 9], [3, 5], [7, 10], [5, 9], [10, 10]]], "output": 8}, {"inputs": [[[6, 8], [7, 10], [9, 10], [6, 10], [1, 10], [5, 10]]], "output": 10}, {"inputs": [[[9, 9], [2, 8], [5, 8], [3, 5], [2, 2], [7, 9], [5, 10]]], "output": 9}, {"inputs": [[[3, 9], [5, 9]]], "output": 7}, {"inputs": [[[5, 10], [2, 3], [3, 10], [4, 7], [1, 9], [5, 10], [2, 6], [1, 7], [8, 9], [2, 9]]], "output": 10}]}} +{"id": "LeetCode/3024", "content": "# String Transformation\n\nYou are given two strings `s` and `t` of equal length `n`. You can perform the following operation on the string `s`:\n\n\n* Remove a **suffix** of `s` of length `l` where `0 < l < n` and append it at the start of `s`. \n\n For example, let `s = 'abcd'` then in one operation you can remove the suffix `'cd'` and append it in front of `s` making `s = 'cdab'`.\n\n\nYou are also given an integer `k`. Return *the number of ways in which* `s` *can be transformed into* `t` *in **exactly*** `k` *operations.*\n\n\nSince the answer can be large, return it **modulo** `109 + 7`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"abcd\", t = \"cdab\", k = 2\n**Output:** 2\n**Explanation:** \nFirst way:\nIn first operation, choose suffix from index = 3, so resulting s = \"dabc\".\nIn second operation, choose suffix from index = 3, so resulting s = \"cdab\".\n\nSecond way:\nIn first operation, choose suffix from index = 1, so resulting s = \"bcda\".\nIn second operation, choose suffix from index = 1, so resulting s = \"cdab\".\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"ababab\", t = \"ababab\", k = 1\n**Output:** 2\n**Explanation:** \nFirst way:\nChoose suffix from index = 2, so resulting s = \"ababab\".\n\nSecond way:\nChoose suffix from index = 4, so resulting s = \"ababab\".\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= s.length <= 5 * 105`\n* `1 <= k <= 1015`\n* `s.length == t.length`\n* `s` and `t` consist of only lowercase English alphabets.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def numberOfWays(self, s: str, t: str, k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.numberOfWays(**['abcd', 'cdab', 2]) == 2\nassert my_solution.numberOfWays(**['ababab', 'ababab', 1]) == 2\nassert my_solution.numberOfWays(**['goxoq', 'dfqgl', 244326024901249]) == 0\nassert my_solution.numberOfWays(**['ceoceo', 'eoceoc', 4]) == 208\nassert my_solution.numberOfWays(**['ib', 'ib', 10]) == 1\nassert my_solution.numberOfWays(**['ttttttt', 'ttttttt', 5]) == 7776\nassert my_solution.numberOfWays(**['aaaa', 'aaaa', 8]) == 6561\nassert my_solution.numberOfWays(**['meplrmeplr', 'eplrmeplrm', 7]) == 956594\nassert my_solution.numberOfWays(**['dsmn', 'smnd', 3]) == 7\nassert my_solution.numberOfWays(**['jjj', 'jjj', 10]) == 1024\nassert my_solution.numberOfWays(**['rrrrr', 'rrrrr', 1]) == 4\nassert my_solution.numberOfWays(**['fefe', 'fefe', 9]) == 9841\nassert my_solution.numberOfWays(**['pfly', 'wvqr', 840550364246523]) == 0\nassert my_solution.numberOfWays(**['ltjwwltjww', 'jwwltjwwlt', 1]) == 2\nassert my_solution.numberOfWays(**['mb', 'mb', 3]) == 0\nassert my_solution.numberOfWays(**['jjjjjjjjjj', 'jjjjjjjjjj', 3]) == 729\nassert my_solution.numberOfWays(**['oqytlmi', 'lmioqyt', 8]) == 239945\nassert my_solution.numberOfWays(**['hpcg', 'pcgh', 5]) == 61\nassert my_solution.numberOfWays(**['bqbqbqbqbq', 'bqbqbqbqbq', 9]) == 193710244\nassert my_solution.numberOfWays(**['ccccccccc', 'ccccccccc', 7]) == 2097152\n"}, "labels": {"questionId": "3024", "questionFrontendId": "2851", "questionTitle": "String Transformation", "stats": {"totalAccepted": "1.5K", "totalSubmission": "3.5K", "totalAcceptedRaw": 1493, "totalSubmissionRaw": 3522, "acRate": "42.4%"}, "probedCases": [{"inputs": ["abcd", "cdab", 2], "output": 2}, {"inputs": ["ababab", "ababab", 1], "output": 2}, {"inputs": ["goxoq", "dfqgl", 244326024901249], "output": 0}, {"inputs": ["ceoceo", "eoceoc", 4], "output": 208}, {"inputs": ["ib", "ib", 10], "output": 1}, {"inputs": ["ttttttt", "ttttttt", 5], "output": 7776}, {"inputs": ["aaaa", "aaaa", 8], "output": 6561}, {"inputs": ["meplrmeplr", "eplrmeplrm", 7], "output": 956594}, {"inputs": ["dsmn", "smnd", 3], "output": 7}, {"inputs": ["jjj", "jjj", 10], "output": 1024}, {"inputs": ["rrrrr", "rrrrr", 1], "output": 4}, {"inputs": ["fefe", "fefe", 9], "output": 9841}, {"inputs": ["pfly", "wvqr", 840550364246523], "output": 0}, {"inputs": ["ltjwwltjww", "jwwltjwwlt", 1], "output": 2}, {"inputs": ["mb", "mb", 3], "output": 0}, {"inputs": ["jjjjjjjjjj", "jjjjjjjjjj", 3], "output": 729}, {"inputs": ["oqytlmi", "lmioqyt", 8], "output": 239945}, {"inputs": ["hpcg", "pcgh", 5], "output": 61}, {"inputs": ["bqbqbqbqbq", "bqbqbqbqbq", 9], "output": 193710244}, {"inputs": ["ccccccccc", "ccccccccc", 7], "output": 2097152}]}} +{"id": "LeetCode/2998", "content": "# Count Symmetric Integers\n\nYou are given two positive integers `low` and `high`.\n\n\nAn integer `x` consisting of `2 * n` digits is **symmetric** if the sum of the first `n` digits of `x` is equal to the sum of the last `n` digits of `x`. Numbers with an odd number of digits are never symmetric.\n\n\nReturn *the **number of symmetric** integers in the range* `[low, high]`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** low = 1, high = 100\n**Output:** 9\n**Explanation:** There are 9 symmetric integers between 1 and 100: 11, 22, 33, 44, 55, 66, 77, 88, and 99.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** low = 1200, high = 1230\n**Output:** 4\n**Explanation:** There are 4 symmetric integers between 1200 and 1230: 1203, 1212, 1221, and 1230.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= low <= high <= 104`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countSymmetricIntegers(self, low: int, high: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countSymmetricIntegers(**[1, 100]) == 9\nassert my_solution.countSymmetricIntegers(**[1200, 1230]) == 4\nassert my_solution.countSymmetricIntegers(**[1, 1]) == 0\nassert my_solution.countSymmetricIntegers(**[1, 2]) == 0\nassert my_solution.countSymmetricIntegers(**[1, 3]) == 0\nassert my_solution.countSymmetricIntegers(**[1, 4]) == 0\nassert my_solution.countSymmetricIntegers(**[1, 5]) == 0\nassert my_solution.countSymmetricIntegers(**[1, 6]) == 0\nassert my_solution.countSymmetricIntegers(**[1, 7]) == 0\nassert my_solution.countSymmetricIntegers(**[1, 8]) == 0\nassert my_solution.countSymmetricIntegers(**[1, 9]) == 0\nassert my_solution.countSymmetricIntegers(**[1, 10]) == 0\nassert my_solution.countSymmetricIntegers(**[1, 11]) == 1\nassert my_solution.countSymmetricIntegers(**[1, 12]) == 1\nassert my_solution.countSymmetricIntegers(**[1, 13]) == 1\nassert my_solution.countSymmetricIntegers(**[1, 14]) == 1\nassert my_solution.countSymmetricIntegers(**[1, 15]) == 1\nassert my_solution.countSymmetricIntegers(**[1, 16]) == 1\nassert my_solution.countSymmetricIntegers(**[1, 17]) == 1\nassert my_solution.countSymmetricIntegers(**[1, 18]) == 1\n"}, "labels": {"questionId": "2998", "questionFrontendId": "2843", "questionTitle": " Count Symmetric Integers", "stats": {"totalAccepted": "7.7K", "totalSubmission": "10.9K", "totalAcceptedRaw": 7725, "totalSubmissionRaw": 10853, "acRate": "71.2%"}, "probedCases": [{"inputs": [1, 100], "output": 9}, {"inputs": [1200, 1230], "output": 4}, {"inputs": [1, 1], "output": 0}, {"inputs": [1, 2], "output": 0}, {"inputs": [1, 3], "output": 0}, {"inputs": [1, 4], "output": 0}, {"inputs": [1, 5], "output": 0}, {"inputs": [1, 6], "output": 0}, {"inputs": [1, 7], "output": 0}, {"inputs": [1, 8], "output": 0}, {"inputs": [1, 9], "output": 0}, {"inputs": [1, 10], "output": 0}, {"inputs": [1, 11], "output": 1}, {"inputs": [1, 12], "output": 1}, {"inputs": [1, 13], "output": 1}, {"inputs": [1, 14], "output": 1}, {"inputs": [1, 15], "output": 1}, {"inputs": [1, 16], "output": 1}, {"inputs": [1, 17], "output": 1}, {"inputs": [1, 18], "output": 1}]}} +{"id": "LeetCode/3046", "content": "# Minimum Operations to Make a Special Number\n\nYou are given a **0-indexed** string `num` representing a non-negative integer.\n\n\nIn one operation, you can pick any digit of `num` and delete it. Note that if you delete all the digits of `num`, `num` becomes `0`.\n\n\nReturn *the **minimum number of operations** required to make* `num` *special*.\n\n\nAn integer `x` is considered **special** if it is divisible by `25`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** num = \"2245047\"\n**Output:** 2\n**Explanation:** Delete digits num[5] and num[6]. The resulting number is \"22450\" which is special since it is divisible by 25.\nIt can be shown that 2 is the minimum number of operations required to get a special number.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** num = \"2908305\"\n**Output:** 3\n**Explanation:** Delete digits num[3], num[4], and num[6]. The resulting number is \"2900\" which is special since it is divisible by 25.\nIt can be shown that 3 is the minimum number of operations required to get a special number.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** num = \"10\"\n**Output:** 1\n**Explanation:** Delete digit num[0]. The resulting number is \"0\" which is special since it is divisible by 25.\nIt can be shown that 1 is the minimum number of operations required to get a special number.\n\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= num.length <= 100`\n* `num` only consists of digits `'0'` through `'9'`.\n* `num` does not contain any leading zeros.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumOperations(self, num: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumOperations(**['2245047']) == 2\nassert my_solution.minimumOperations(**['2908305']) == 3\nassert my_solution.minimumOperations(**['10']) == 1\nassert my_solution.minimumOperations(**['1']) == 1\nassert my_solution.minimumOperations(**['2']) == 1\nassert my_solution.minimumOperations(**['3']) == 1\nassert my_solution.minimumOperations(**['4']) == 1\nassert my_solution.minimumOperations(**['5']) == 1\nassert my_solution.minimumOperations(**['6']) == 1\nassert my_solution.minimumOperations(**['7']) == 1\nassert my_solution.minimumOperations(**['8']) == 1\nassert my_solution.minimumOperations(**['9']) == 1\nassert my_solution.minimumOperations(**['11']) == 2\nassert my_solution.minimumOperations(**['12']) == 2\nassert my_solution.minimumOperations(**['13']) == 2\nassert my_solution.minimumOperations(**['14']) == 2\nassert my_solution.minimumOperations(**['15']) == 2\nassert my_solution.minimumOperations(**['16']) == 2\nassert my_solution.minimumOperations(**['17']) == 2\nassert my_solution.minimumOperations(**['18']) == 2\n"}, "labels": {"questionId": "3046", "questionFrontendId": "2844", "questionTitle": "Minimum Operations to Make a Special Number", "stats": {"totalAccepted": "5.5K", "totalSubmission": "13.3K", "totalAcceptedRaw": 5519, "totalSubmissionRaw": 13348, "acRate": "41.3%"}, "probedCases": [{"inputs": ["2245047"], "output": 2}, {"inputs": ["2908305"], "output": 3}, {"inputs": ["10"], "output": 1}, {"inputs": ["1"], "output": 1}, {"inputs": ["2"], "output": 1}, {"inputs": ["3"], "output": 1}, {"inputs": ["4"], "output": 1}, {"inputs": ["5"], "output": 1}, {"inputs": ["6"], "output": 1}, {"inputs": ["7"], "output": 1}, {"inputs": ["8"], "output": 1}, {"inputs": ["9"], "output": 1}, {"inputs": ["11"], "output": 2}, {"inputs": ["12"], "output": 2}, {"inputs": ["13"], "output": 2}, {"inputs": ["14"], "output": 2}, {"inputs": ["15"], "output": 2}, {"inputs": ["16"], "output": 2}, {"inputs": ["17"], "output": 2}, {"inputs": ["18"], "output": 2}]}} +{"id": "LeetCode/2915", "content": "# Count of Interesting Subarrays\n\nYou are given a **0-indexed** integer array `nums`, an integer `modulo`, and an integer `k`.\n\n\nYour task is to find the count of subarrays that are **interesting**.\n\n\nA **subarray** `nums[l..r]` is **interesting** if the following condition holds:\n\n\n* Let `cnt` be the number of indices `i` in the range `[l, r]` such that `nums[i] % modulo == k`. Then, `cnt % modulo == k`.\n\n\nReturn *an integer denoting the count of interesting subarrays.* \n\n\n**Note:** A subarray is *a contiguous non-empty sequence of elements within an array*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [3,2,4], modulo = 2, k = 1\n**Output:** 3\n**Explanation:** In this example the interesting subarrays are: \nThe subarray nums[0..0] which is [3]. \n- There is only one index, i = 0, in the range [0, 0] that satisfies nums[i] % modulo == k. \n- Hence, cnt = 1 and cnt % modulo == k. \nThe subarray nums[0..1] which is [3,2].\n- There is only one index, i = 0, in the range [0, 1] that satisfies nums[i] % modulo == k. \n- Hence, cnt = 1 and cnt % modulo == k.\nThe subarray nums[0..2] which is [3,2,4]. \n- There is only one index, i = 0, in the range [0, 2] that satisfies nums[i] % modulo == k. \n- Hence, cnt = 1 and cnt % modulo == k. \nIt can be shown that there are no other interesting subarrays. So, the answer is 3.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [3,1,9,6], modulo = 3, k = 0\n**Output:** 2\n**Explanation:** In this example the interesting subarrays are: \nThe subarray nums[0..3] which is [3,1,9,6]. \n- There are three indices, i = 0, 2, 3, in the range [0, 3] that satisfy nums[i] % modulo == k. \n- Hence, cnt = 3 and cnt % modulo == k. \nThe subarray nums[1..1] which is [1]. \n- There is no index, i, in the range [1, 1] that satisfies nums[i] % modulo == k. \n- Hence, cnt = 0 and cnt % modulo == k. \nIt can be shown that there are no other interesting subarrays. So, the answer is 2.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n* `1 <= modulo <= 109`\n* `0 <= k < modulo`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countInterestingSubarrays(self, nums: List[int], modulo: int, k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countInterestingSubarrays(**[[3, 2, 4], 2, 1]) == 3\nassert my_solution.countInterestingSubarrays(**[[3, 1, 9, 6], 3, 0]) == 2\nassert my_solution.countInterestingSubarrays(**[[11, 12, 21, 31], 10, 1]) == 5\nassert my_solution.countInterestingSubarrays(**[[2, 4], 7, 2]) == 0\nassert my_solution.countInterestingSubarrays(**[[2, 7], 7, 0]) == 1\nassert my_solution.countInterestingSubarrays(**[[2, 45], 13, 2]) == 0\nassert my_solution.countInterestingSubarrays(**[[3, 3], 5, 3]) == 0\nassert my_solution.countInterestingSubarrays(**[[3, 4], 8, 3]) == 0\nassert my_solution.countInterestingSubarrays(**[[4, 5], 1, 0]) == 3\nassert my_solution.countInterestingSubarrays(**[[5, 1], 6, 1]) == 2\nassert my_solution.countInterestingSubarrays(**[[7, 2], 7, 0]) == 1\nassert my_solution.countInterestingSubarrays(**[[7, 4], 7, 0]) == 1\nassert my_solution.countInterestingSubarrays(**[[8, 8], 4, 0]) == 0\nassert my_solution.countInterestingSubarrays(**[[9, 2], 2, 0]) == 1\nassert my_solution.countInterestingSubarrays(**[[18, 43], 3, 0]) == 1\nassert my_solution.countInterestingSubarrays(**[[19, 67], 47, 19]) == 0\nassert my_solution.countInterestingSubarrays(**[[20, 8], 41, 8]) == 0\nassert my_solution.countInterestingSubarrays(**[[26, 5], 21, 5]) == 0\nassert my_solution.countInterestingSubarrays(**[[81, 36], 4, 0]) == 1\nassert my_solution.countInterestingSubarrays(**[[2, 1, 5], 9, 1]) == 4\n"}, "labels": {"questionId": "2915", "questionFrontendId": "2845", "questionTitle": "Count of Interesting Subarrays", "stats": {"totalAccepted": "4.1K", "totalSubmission": "11.7K", "totalAcceptedRaw": 4117, "totalSubmissionRaw": 11655, "acRate": "35.3%"}, "probedCases": [{"inputs": [[3, 2, 4], 2, 1], "output": 3}, {"inputs": [[3, 1, 9, 6], 3, 0], "output": 2}, {"inputs": [[11, 12, 21, 31], 10, 1], "output": 5}, {"inputs": [[2, 4], 7, 2], "output": 0}, {"inputs": [[2, 7], 7, 0], "output": 1}, {"inputs": [[2, 45], 13, 2], "output": 0}, {"inputs": [[3, 3], 5, 3], "output": 0}, {"inputs": [[3, 4], 8, 3], "output": 0}, {"inputs": [[4, 5], 1, 0], "output": 3}, {"inputs": [[5, 1], 6, 1], "output": 2}, {"inputs": [[7, 2], 7, 0], "output": 1}, {"inputs": [[7, 4], 7, 0], "output": 1}, {"inputs": [[8, 8], 4, 0], "output": 0}, {"inputs": [[9, 2], 2, 0], "output": 1}, {"inputs": [[18, 43], 3, 0], "output": 1}, {"inputs": [[19, 67], 47, 19], "output": 0}, {"inputs": [[20, 8], 41, 8], "output": 0}, {"inputs": [[26, 5], 21, 5], "output": 0}, {"inputs": [[81, 36], 4, 0], "output": 1}, {"inputs": [[2, 1, 5], 9, 1], "output": 4}]}} +{"id": "LeetCode/2999", "content": "# Check if Strings Can be Made Equal With Operations I\n\nYou are given two strings `s1` and `s2`, both of length `4`, consisting of **lowercase** English letters.\n\n\nYou can apply the following operation on any of the two strings **any** number of times:\n\n\n* Choose any two indices `i` and `j` such that `j - i = 2`, then **swap** the two characters at those indices in the string.\n\n\nReturn `true` *if you can make the strings* `s1` *and* `s2` *equal, and* `false` *otherwise*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s1 = \"abcd\", s2 = \"cdab\"\n**Output:** true\n**Explanation:** We can do the following operations on s1:\n- Choose the indices i = 0, j = 2. The resulting string is s1 = \"cbad\".\n- Choose the indices i = 1, j = 3. The resulting string is s1 = \"cdab\" = s2.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s1 = \"abcd\", s2 = \"dacb\"\n**Output:** false\n**Explanation:** It is not possible to make the two strings equal.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `s1.length == s2.length == 4`\n* `s1` and `s2` consist only of lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def canBeEqual(self, s1: str, s2: str) -> bool:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.canBeEqual(**['abcd', 'cdab']) == True\nassert my_solution.canBeEqual(**['abcd', 'dacb']) == False\nassert my_solution.canBeEqual(**['bnxw', 'bwxn']) == True\nassert my_solution.canBeEqual(**['gudo', 'ogdu']) == False\nassert my_solution.canBeEqual(**['xsvc', 'vcxs']) == True\nassert my_solution.canBeEqual(**['hvsz', 'hzsv']) == True\nassert my_solution.canBeEqual(**['zzon', 'zozn']) == False\nassert my_solution.canBeEqual(**['zrmq', 'mrzq']) == True\nassert my_solution.canBeEqual(**['cmpr', 'rmcp']) == False\nassert my_solution.canBeEqual(**['qnde', 'flsi']) == False\nassert my_solution.canBeEqual(**['kina', 'kina']) == True\nassert my_solution.canBeEqual(**['vofo', 'oofv']) == False\nassert my_solution.canBeEqual(**['riti', 'riti']) == True\nassert my_solution.canBeEqual(**['ifjz', 'jzfi']) == False\nassert my_solution.canBeEqual(**['hazw', 'pfmp']) == False\nassert my_solution.canBeEqual(**['goze', 'gezo']) == True\nassert my_solution.canBeEqual(**['gcdm', 'dmgc']) == True\nassert my_solution.canBeEqual(**['fymg', 'famj']) == False\nassert my_solution.canBeEqual(**['seeo', 'vfvm']) == False\nassert my_solution.canBeEqual(**['kvne', 'nekv']) == True\n"}, "labels": {"questionId": "2999", "questionFrontendId": "2839", "questionTitle": "Check if Strings Can be Made Equal With Operations I", "stats": {"totalAccepted": "4.6K", "totalSubmission": "7.1K", "totalAcceptedRaw": 4637, "totalSubmissionRaw": 7123, "acRate": "65.1%"}, "probedCases": [{"inputs": ["abcd", "cdab"], "output": true}, {"inputs": ["abcd", "dacb"], "output": false}, {"inputs": ["bnxw", "bwxn"], "output": true}, {"inputs": ["gudo", "ogdu"], "output": false}, {"inputs": ["xsvc", "vcxs"], "output": true}, {"inputs": ["hvsz", "hzsv"], "output": true}, {"inputs": ["zzon", "zozn"], "output": false}, {"inputs": ["zrmq", "mrzq"], "output": true}, {"inputs": ["cmpr", "rmcp"], "output": false}, {"inputs": ["qnde", "flsi"], "output": false}, {"inputs": ["kina", "kina"], "output": true}, {"inputs": ["vofo", "oofv"], "output": false}, {"inputs": ["riti", "riti"], "output": true}, {"inputs": ["ifjz", "jzfi"], "output": false}, {"inputs": ["hazw", "pfmp"], "output": false}, {"inputs": ["goze", "gezo"], "output": true}, {"inputs": ["gcdm", "dmgc"], "output": true}, {"inputs": ["fymg", "famj"], "output": false}, {"inputs": ["seeo", "vfvm"], "output": false}, {"inputs": ["kvne", "nekv"], "output": true}]}} +{"id": "LeetCode/2978", "content": "# Check if Strings Can be Made Equal With Operations II\n\nYou are given two strings `s1` and `s2`, both of length `n`, consisting of **lowercase** English letters.\n\n\nYou can apply the following operation on **any** of the two strings **any** number of times:\n\n\n* Choose any two indices `i` and `j` such that `i < j` and the difference `j - i` is **even**, then **swap** the two characters at those indices in the string.\n\n\nReturn `true` *if you can make the strings* `s1` *and* `s2` *equal, and*`false` *otherwise*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s1 = \"abcdba\", s2 = \"cabdab\"\n**Output:** true\n**Explanation:** We can apply the following operations on s1:\n- Choose the indices i = 0, j = 2. The resulting string is s1 = \"cbadba\".\n- Choose the indices i = 2, j = 4. The resulting string is s1 = \"cbbdaa\".\n- Choose the indices i = 1, j = 5. The resulting string is s1 = \"cabdab\" = s2.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s1 = \"abe\", s2 = \"bea\"\n**Output:** false\n**Explanation:** It is not possible to make the two strings equal.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `n == s1.length == s2.length`\n* `1 <= n <= 105`\n* `s1` and `s2` consist only of lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def checkStrings(self, s1: str, s2: str) -> bool:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.checkStrings(**['abcdba', 'cabdab']) == True\nassert my_solution.checkStrings(**['abe', 'bea']) == False\nassert my_solution.checkStrings(**['ublnlasppynwgx', 'ganplbuylnswpx']) == True\nassert my_solution.checkStrings(**['aavizsxpqhxztrwi', 'zvisqatzpaxhixwr']) == False\nassert my_solution.checkStrings(**['jghn', 'jghn']) == True\nassert my_solution.checkStrings(**['slmqqdbrwyvm', 'qyldmmwsrqvb']) == False\nassert my_solution.checkStrings(**['pqtsprqmvi', 'qrvqpitmps']) == True\nassert my_solution.checkStrings(**['shvqocguj', 'vqsghujco']) == False\nassert my_solution.checkStrings(**['usvpwcehhvlg', 'ehuvvshcwplg']) == True\nassert my_solution.checkStrings(**['ppmfd', 'pfdpm']) == True\nassert my_solution.checkStrings(**['ktjpralqanofuuqsyal', 'qjlornpasktfuyluaqa']) == False\nassert my_solution.checkStrings(**['epjtzubboiallzd', 'dboilpzzjteualb']) == True\nassert my_solution.checkStrings(**['mgflranpdjdkrh', 'fpcgobmkdxbzyl']) == False\nassert my_solution.checkStrings(**['jh', 'fy']) == False\nassert my_solution.checkStrings(**['c', 'c']) == True\nassert my_solution.checkStrings(**['kfqofkvsoiiirznw', 'hosthwbinxrsikkf']) == False\nassert my_solution.checkStrings(**['ntuuwwh', 'jyjwmdf']) == False\nassert my_solution.checkStrings(**['oziiqbotydegrm', 'ytizriobogqmed']) == True\nassert my_solution.checkStrings(**['ztmuzn', 'muztzn']) == True\nassert my_solution.checkStrings(**['lcgcm', 'brdxe']) == False\n"}, "labels": {"questionId": "2978", "questionFrontendId": "2840", "questionTitle": "Check if Strings Can be Made Equal With Operations II", "stats": {"totalAccepted": "4K", "totalSubmission": "6.6K", "totalAcceptedRaw": 4011, "totalSubmissionRaw": 6562, "acRate": "61.1%"}, "probedCases": [{"inputs": ["abcdba", "cabdab"], "output": true}, {"inputs": ["abe", "bea"], "output": false}, {"inputs": ["ublnlasppynwgx", "ganplbuylnswpx"], "output": true}, {"inputs": ["aavizsxpqhxztrwi", "zvisqatzpaxhixwr"], "output": false}, {"inputs": ["jghn", "jghn"], "output": true}, {"inputs": ["slmqqdbrwyvm", "qyldmmwsrqvb"], "output": false}, {"inputs": ["pqtsprqmvi", "qrvqpitmps"], "output": true}, {"inputs": ["shvqocguj", "vqsghujco"], "output": false}, {"inputs": ["usvpwcehhvlg", "ehuvvshcwplg"], "output": true}, {"inputs": ["ppmfd", "pfdpm"], "output": true}, {"inputs": ["ktjpralqanofuuqsyal", "qjlornpasktfuyluaqa"], "output": false}, {"inputs": ["epjtzubboiallzd", "dboilpzzjteualb"], "output": true}, {"inputs": ["mgflranpdjdkrh", "fpcgobmkdxbzyl"], "output": false}, {"inputs": ["jh", "fy"], "output": false}, {"inputs": ["c", "c"], "output": true}, {"inputs": ["kfqofkvsoiiirznw", "hosthwbinxrsikkf"], "output": false}, {"inputs": ["ntuuwwh", "jyjwmdf"], "output": false}, {"inputs": ["oziiqbotydegrm", "ytizriobogqmed"], "output": true}, {"inputs": ["ztmuzn", "muztzn"], "output": true}, {"inputs": ["lcgcm", "brdxe"], "output": false}]}} +{"id": "LeetCode/2954", "content": "# Maximum Sum of Almost Unique Subarray\n\nYou are given an integer array `nums` and two positive integers `m` and `k`.\n\n\nReturn *the **maximum sum** out of all **almost unique** subarrays of length* `k` *of* `nums`. If no such subarray exists, return `0`.\n\n\nA subarray of `nums` is **almost unique** if it contains at least `m` distinct elements.\n\n\nA subarray is a contiguous **non-empty** sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,6,7,3,1,7], m = 3, k = 4\n**Output:** 18\n**Explanation:** There are 3 almost unique subarrays of size k = 4. These subarrays are [2, 6, 7, 3], [6, 7, 3, 1], and [7, 3, 1, 7]. Among these subarrays, the one with the maximum sum is [2, 6, 7, 3] which has a sum of 18.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,9,9,2,4,5,4], m = 1, k = 3\n**Output:** 23\n**Explanation:** There are 5 almost unique subarrays of size k. These subarrays are [5, 9, 9], [9, 9, 2], [9, 2, 4], [2, 4, 5], and [4, 5, 4]. Among these subarrays, the one with the maximum sum is [5, 9, 9] which has a sum of 23.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,2,1,2,1,2,1], m = 3, k = 3\n**Output:** 0\n**Explanation:** There are no subarrays of size k = 3 that contain at least m = 3 distinct elements in the given array [1,2,1,2,1,2,1]. Therefore, no almost unique subarrays exist, and the maximum sum is 0.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 2 * 104`\n* `1 <= m <= k <= nums.length`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxSum(self, nums: List[int], m: int, k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxSum(**[[2, 6, 7, 3, 1, 7], 3, 4]) == 18\nassert my_solution.maxSum(**[[5, 9, 9, 2, 4, 5, 4], 1, 3]) == 23\nassert my_solution.maxSum(**[[1, 2, 1, 2, 1, 2, 1], 3, 3]) == 0\nassert my_solution.maxSum(**[[1], 1, 1]) == 1\nassert my_solution.maxSum(**[[1, 1], 2, 2]) == 0\nassert my_solution.maxSum(**[[1, 1, 1], 1, 1]) == 1\nassert my_solution.maxSum(**[[1, 1, 1, 1], 1, 1]) == 1\nassert my_solution.maxSum(**[[1, 1, 1, 2], 2, 4]) == 5\nassert my_solution.maxSum(**[[1, 1, 1, 3], 2, 2]) == 4\nassert my_solution.maxSum(**[[1, 1, 1, 4], 2, 4]) == 7\nassert my_solution.maxSum(**[[1, 1, 2], 1, 1]) == 2\nassert my_solution.maxSum(**[[1, 1, 2, 1], 2, 2]) == 3\nassert my_solution.maxSum(**[[1, 1, 2, 2], 1, 3]) == 5\nassert my_solution.maxSum(**[[1, 1, 2, 3], 1, 1]) == 3\nassert my_solution.maxSum(**[[1, 1, 2, 4], 1, 1]) == 4\nassert my_solution.maxSum(**[[1, 1, 3], 1, 2]) == 4\nassert my_solution.maxSum(**[[1, 1, 3, 1], 2, 4]) == 6\nassert my_solution.maxSum(**[[1, 1, 3, 2], 1, 2]) == 5\nassert my_solution.maxSum(**[[1, 1, 3, 3], 1, 1]) == 3\nassert my_solution.maxSum(**[[1, 1, 3, 4], 1, 1]) == 4\n"}, "labels": {"questionId": "2954", "questionFrontendId": "2841", "questionTitle": "Maximum Sum of Almost Unique Subarray", "stats": {"totalAccepted": "4.4K", "totalSubmission": "9.9K", "totalAcceptedRaw": 4425, "totalSubmissionRaw": 9946, "acRate": "44.5%"}, "probedCases": [{"inputs": [[2, 6, 7, 3, 1, 7], 3, 4], "output": 18}, {"inputs": [[5, 9, 9, 2, 4, 5, 4], 1, 3], "output": 23}, {"inputs": [[1, 2, 1, 2, 1, 2, 1], 3, 3], "output": 0}, {"inputs": [[1], 1, 1], "output": 1}, {"inputs": [[1, 1], 2, 2], "output": 0}, {"inputs": [[1, 1, 1], 1, 1], "output": 1}, {"inputs": [[1, 1, 1, 1], 1, 1], "output": 1}, {"inputs": [[1, 1, 1, 2], 2, 4], "output": 5}, {"inputs": [[1, 1, 1, 3], 2, 2], "output": 4}, {"inputs": [[1, 1, 1, 4], 2, 4], "output": 7}, {"inputs": [[1, 1, 2], 1, 1], "output": 2}, {"inputs": [[1, 1, 2, 1], 2, 2], "output": 3}, {"inputs": [[1, 1, 2, 2], 1, 3], "output": 5}, {"inputs": [[1, 1, 2, 3], 1, 1], "output": 3}, {"inputs": [[1, 1, 2, 4], 1, 1], "output": 4}, {"inputs": [[1, 1, 3], 1, 2], "output": 4}, {"inputs": [[1, 1, 3, 1], 2, 4], "output": 6}, {"inputs": [[1, 1, 3, 2], 1, 2], "output": 5}, {"inputs": [[1, 1, 3, 3], 1, 1], "output": 3}, {"inputs": [[1, 1, 3, 4], 1, 1], "output": 4}]}} +{"id": "LeetCode/3057", "content": "# Count K-Subsequences of a String With Maximum Beauty\n\nYou are given a string `s` and an integer `k`.\n\n\nA **k-subsequence** is a **subsequence** of `s`, having length `k`, and all its characters are **unique**, **i.e**., every character occurs once.\n\n\nLet `f(c)` denote the number of times the character `c` occurs in `s`.\n\n\nThe **beauty** of a **k-subsequence** is the **sum** of `f(c)` for every character `c` in the k-subsequence.\n\n\nFor example, consider `s = \"abbbdd\"` and `k = 2`:\n\n\n* `f('a') = 1`, `f('b') = 3`, `f('d') = 2`\n* Some k-subsequences of `s` are:\n\t+ `\"**ab**bbdd\"` -> `\"ab\"` having a beauty of `f('a') + f('b') = 4`\n\t+ `\"**a**bbb**d**d\"` -> `\"ad\"` having a beauty of `f('a') + f('d') = 3`\n\t+ `\"a**b**bb**d**d\"` -> `\"bd\"` having a beauty of `f('b') + f('d') = 5`\n\n\nReturn *an integer denoting the number of k-subsequences* *whose **beauty** is the **maximum** among all **k-subsequences***. Since the answer may be too large, return it modulo `109 + 7`.\n\n\nA subsequence of a string is a new string formed from the original string by deleting some (possibly none) of the characters without disturbing the relative positions of the remaining characters.\n\n\n**Notes**\n\n\n* `f(c)` is the number of times a character `c` occurs in `s`, not a k-subsequence.\n* Two k-subsequences are considered different if one is formed by an index that is not present in the other. So, two k-subsequences may form the same string.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"bcca\", k = 2\n**Output:** 4\n**Explanation:** From s we have f('a') = 1, f('b') = 1, and f('c') = 2.\nThe k-subsequences of s are: \n**bc**ca having a beauty of f('b') + f('c') = 3 \n**b**c**c**a having a beauty of f('b') + f('c') = 3 \n**b**cc**a** having a beauty of f('b') + f('a') = 2 \nb**c**c**a**having a beauty of f('c') + f('a') = 3\nbc**ca** having a beauty of f('c') + f('a') = 3 \nThere are 4 k-subsequences that have the maximum beauty, 3. \nHence, the answer is 4. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"abbcd\", k = 4\n**Output:** 2\n**Explanation:** From s we have f('a') = 1, f('b') = 2, f('c') = 1, and f('d') = 1. \nThe k-subsequences of s are: \n**ab**b**cd** having a beauty of f('a') + f('b') + f('c') + f('d') = 5\n**a**b**bcd** having a beauty of f('a') + f('b') + f('c') + f('d') = 5 \nThere are 2 k-subsequences that have the maximum beauty, 5. \nHence, the answer is 2. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 2 * 105`\n* `1 <= k <= s.length`\n* `s` consists only of lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countKSubsequencesWithMaxBeauty(self, s: str, k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countKSubsequencesWithMaxBeauty(**['bcca', 2]) == 4\nassert my_solution.countKSubsequencesWithMaxBeauty(**['abbcd', 4]) == 2\nassert my_solution.countKSubsequencesWithMaxBeauty(**['am', 2]) == 1\nassert my_solution.countKSubsequencesWithMaxBeauty(**['az', 2]) == 1\nassert my_solution.countKSubsequencesWithMaxBeauty(**['ci', 1]) == 2\nassert my_solution.countKSubsequencesWithMaxBeauty(**['dd', 2]) == 0\nassert my_solution.countKSubsequencesWithMaxBeauty(**['di', 2]) == 1\nassert my_solution.countKSubsequencesWithMaxBeauty(**['dw', 2]) == 1\nassert my_solution.countKSubsequencesWithMaxBeauty(**['ef', 1]) == 2\nassert my_solution.countKSubsequencesWithMaxBeauty(**['gq', 2]) == 1\nassert my_solution.countKSubsequencesWithMaxBeauty(**['hj', 1]) == 2\nassert my_solution.countKSubsequencesWithMaxBeauty(**['hx', 1]) == 2\nassert my_solution.countKSubsequencesWithMaxBeauty(**['ii', 2]) == 0\nassert my_solution.countKSubsequencesWithMaxBeauty(**['il', 2]) == 1\nassert my_solution.countKSubsequencesWithMaxBeauty(**['jb', 1]) == 2\nassert my_solution.countKSubsequencesWithMaxBeauty(**['kx', 1]) == 2\nassert my_solution.countKSubsequencesWithMaxBeauty(**['qh', 2]) == 1\nassert my_solution.countKSubsequencesWithMaxBeauty(**['qk', 2]) == 1\nassert my_solution.countKSubsequencesWithMaxBeauty(**['qr', 2]) == 1\nassert my_solution.countKSubsequencesWithMaxBeauty(**['rg', 2]) == 1\n"}, "labels": {"questionId": "3057", "questionFrontendId": "2842", "questionTitle": "Count K-Subsequences of a String With Maximum Beauty", "stats": {"totalAccepted": "2.7K", "totalSubmission": "9.3K", "totalAcceptedRaw": 2658, "totalSubmissionRaw": 9265, "acRate": "28.7%"}, "probedCases": [{"inputs": ["bcca", 2], "output": 4}, {"inputs": ["abbcd", 4], "output": 2}, {"inputs": ["am", 2], "output": 1}, {"inputs": ["az", 2], "output": 1}, {"inputs": ["ci", 1], "output": 2}, {"inputs": ["dd", 2], "output": 0}, {"inputs": ["di", 2], "output": 1}, {"inputs": ["dw", 2], "output": 1}, {"inputs": ["ef", 1], "output": 2}, {"inputs": ["gq", 2], "output": 1}, {"inputs": ["hj", 1], "output": 2}, {"inputs": ["hx", 1], "output": 2}, {"inputs": ["ii", 2], "output": 0}, {"inputs": ["il", 2], "output": 1}, {"inputs": ["jb", 1], "output": 2}, {"inputs": ["kx", 1], "output": 2}, {"inputs": ["qh", 2], "output": 1}, {"inputs": ["qk", 2], "output": 1}, {"inputs": ["qr", 2], "output": 1}, {"inputs": ["rg", 2], "output": 1}]}} +{"id": "LeetCode/3019", "content": "# Furthest Point From Origin\n\nYou are given a string `moves` of length `n` consisting only of characters `'L'`, `'R'`, and `'_'`. The string represents your movement on a number line starting from the origin `0`.\n\n\nIn the `ith` move, you can choose one of the following directions:\n\n\n* move to the left if `moves[i] = 'L'` or `moves[i] = '_'`\n* move to the right if `moves[i] = 'R'` or `moves[i] = '_'`\n\n\nReturn *the **distance from the origin** of the **furthest** point you can get to after* `n` *moves*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** moves = \"L_RL__R\"\n**Output:** 3\n**Explanation:** The furthest point we can reach from the origin 0 is point -3 through the following sequence of moves \"LLRLLLR\".\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** moves = \"_R__LL_\"\n**Output:** 5\n**Explanation:** The furthest point we can reach from the origin 0 is point -5 through the following sequence of moves \"LRLLLLL\".\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** moves = \"_______\"\n**Output:** 7\n**Explanation:** The furthest point we can reach from the origin 0 is point 7 through the following sequence of moves \"RRRRRRR\".\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= moves.length == n <= 50`\n* `moves` consists only of characters `'L'`, `'R'` and `'_'`.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def furthestDistanceFromOrigin(self, moves: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.furthestDistanceFromOrigin(**['L_RL__R']) == 3\nassert my_solution.furthestDistanceFromOrigin(**['_R__LL_']) == 5\nassert my_solution.furthestDistanceFromOrigin(**['_______']) == 7\nassert my_solution.furthestDistanceFromOrigin(**['L']) == 1\nassert my_solution.furthestDistanceFromOrigin(**['R']) == 1\nassert my_solution.furthestDistanceFromOrigin(**['_']) == 1\nassert my_solution.furthestDistanceFromOrigin(**['LL']) == 2\nassert my_solution.furthestDistanceFromOrigin(**['LR']) == 0\nassert my_solution.furthestDistanceFromOrigin(**['L_']) == 2\nassert my_solution.furthestDistanceFromOrigin(**['RL']) == 0\nassert my_solution.furthestDistanceFromOrigin(**['RR']) == 2\nassert my_solution.furthestDistanceFromOrigin(**['R_']) == 2\nassert my_solution.furthestDistanceFromOrigin(**['_L']) == 2\nassert my_solution.furthestDistanceFromOrigin(**['_R']) == 2\nassert my_solution.furthestDistanceFromOrigin(**['__']) == 2\nassert my_solution.furthestDistanceFromOrigin(**['LLL']) == 3\nassert my_solution.furthestDistanceFromOrigin(**['LLR']) == 1\nassert my_solution.furthestDistanceFromOrigin(**['LL_']) == 3\nassert my_solution.furthestDistanceFromOrigin(**['LRL']) == 1\nassert my_solution.furthestDistanceFromOrigin(**['LRR']) == 1\n"}, "labels": {"questionId": "3019", "questionFrontendId": "2833", "questionTitle": "Furthest Point From Origin", "stats": {"totalAccepted": "8.2K", "totalSubmission": "10.4K", "totalAcceptedRaw": 8173, "totalSubmissionRaw": 10353, "acRate": "78.9%"}, "probedCases": [{"inputs": ["L_RL__R"], "output": 3}, {"inputs": ["_R__LL_"], "output": 5}, {"inputs": ["_______"], "output": 7}, {"inputs": ["L"], "output": 1}, {"inputs": ["R"], "output": 1}, {"inputs": ["_"], "output": 1}, {"inputs": ["LL"], "output": 2}, {"inputs": ["LR"], "output": 0}, {"inputs": ["L_"], "output": 2}, {"inputs": ["RL"], "output": 0}, {"inputs": ["RR"], "output": 2}, {"inputs": ["R_"], "output": 2}, {"inputs": ["_L"], "output": 2}, {"inputs": ["_R"], "output": 2}, {"inputs": ["__"], "output": 2}, {"inputs": ["LLL"], "output": 3}, {"inputs": ["LLR"], "output": 1}, {"inputs": ["LL_"], "output": 3}, {"inputs": ["LRL"], "output": 1}, {"inputs": ["LRR"], "output": 1}]}} +{"id": "LeetCode/3026", "content": "# Find the Minimum Possible Sum of a Beautiful Array\n\nYou are given positive integers `n` and `target`.\n\n\nAn array `nums` is **beautiful** if it meets the following conditions:\n\n\n* `nums.length == n`.\n* `nums` consists of pairwise **distinct** **positive** integers.\n* There doesn't exist two **distinct** indices, `i` and `j`, in the range `[0, n - 1]`, such that `nums[i] + nums[j] == target`.\n\n\nReturn *the **minimum** possible sum that a beautiful array could have modulo* `109 + 7`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 2, target = 3\n**Output:** 4\n**Explanation:** We can see that nums = [1,3] is beautiful.\n- The array nums has length n = 2.\n- The array nums consists of pairwise distinct positive integers.\n- There doesn't exist two distinct indices, i and j, with nums[i] + nums[j] == 3.\nIt can be proven that 4 is the minimum possible sum that a beautiful array could have.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 3, target = 3\n**Output:** 8\n**Explanation:** We can see that nums = [1,3,4] is beautiful.\n- The array nums has length n = 3.\n- The array nums consists of pairwise distinct positive integers.\n- There doesn't exist two distinct indices, i and j, with nums[i] + nums[j] == 3.\nIt can be proven that 8 is the minimum possible sum that a beautiful array could have.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** n = 1, target = 1\n**Output:** 1\n**Explanation:** We can see, that nums = [1] is beautiful.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 109`\n* `1 <= target <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumPossibleSum(self, n: int, target: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumPossibleSum(**[2, 3]) == 4\nassert my_solution.minimumPossibleSum(**[3, 3]) == 8\nassert my_solution.minimumPossibleSum(**[1, 1]) == 1\nassert my_solution.minimumPossibleSum(**[16, 6]) == 162\nassert my_solution.minimumPossibleSum(**[16, 32]) == 136\nassert my_solution.minimumPossibleSum(**[13, 50]) == 91\nassert my_solution.minimumPossibleSum(**[36, 21]) == 926\nassert my_solution.minimumPossibleSum(**[40, 17]) == 1076\nassert my_solution.minimumPossibleSum(**[37, 46]) == 1011\nassert my_solution.minimumPossibleSum(**[33, 7]) == 651\nassert my_solution.minimumPossibleSum(**[42, 46]) == 1321\nassert my_solution.minimumPossibleSum(**[46, 29]) == 1529\nassert my_solution.minimumPossibleSum(**[9, 43]) == 45\nassert my_solution.minimumPossibleSum(**[30, 31]) == 690\nassert my_solution.minimumPossibleSum(**[14, 47]) == 105\nassert my_solution.minimumPossibleSum(**[5, 3]) == 19\nassert my_solution.minimumPossibleSum(**[41, 23]) == 1191\nassert my_solution.minimumPossibleSum(**[17, 13]) == 219\nassert my_solution.minimumPossibleSum(**[9, 13]) == 63\nassert my_solution.minimumPossibleSum(**[29, 18]) == 595\n"}, "labels": {"questionId": "3026", "questionFrontendId": "2834", "questionTitle": "Find the Minimum Possible Sum of a Beautiful Array", "stats": {"totalAccepted": "6.4K", "totalSubmission": "15.6K", "totalAcceptedRaw": 6372, "totalSubmissionRaw": 15619, "acRate": "40.8%"}, "probedCases": [{"inputs": [2, 3], "output": 4}, {"inputs": [3, 3], "output": 8}, {"inputs": [1, 1], "output": 1}, {"inputs": [16, 6], "output": 162}, {"inputs": [16, 32], "output": 136}, {"inputs": [13, 50], "output": 91}, {"inputs": [36, 21], "output": 926}, {"inputs": [40, 17], "output": 1076}, {"inputs": [37, 46], "output": 1011}, {"inputs": [33, 7], "output": 651}, {"inputs": [42, 46], "output": 1321}, {"inputs": [46, 29], "output": 1529}, {"inputs": [9, 43], "output": 45}, {"inputs": [30, 31], "output": 690}, {"inputs": [14, 47], "output": 105}, {"inputs": [5, 3], "output": 19}, {"inputs": [41, 23], "output": 1191}, {"inputs": [17, 13], "output": 219}, {"inputs": [9, 13], "output": 63}, {"inputs": [29, 18], "output": 595}]}} +{"id": "LeetCode/3025", "content": "# Minimum Operations to Form Subsequence With Target Sum\n\nYou are given a **0-indexed** array `nums` consisting of **non-negative** powers of `2`, and an integer `target`.\n\n\nIn one operation, you must apply the following changes to the array:\n\n\n* Choose any element of the array `nums[i]` such that `nums[i] > 1`.\n* Remove `nums[i]` from the array.\n* Add **two** occurrences of `nums[i] / 2` to the **end** of `nums`.\n\n\nReturn the ***minimum number of operations** you need to perform so that* `nums` *contains a **subsequence** whose elements sum to* `target`. If it is impossible to obtain such a subsequence, return `-1`.\n\n\nA **subsequence** is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,8], target = 7\n**Output:** 1\n**Explanation:** In the first operation, we choose element nums[2]. The array becomes equal to nums = [1,2,4,4].\nAt this stage, nums contains the subsequence [1,2,4] which sums up to 7.\nIt can be shown that there is no shorter sequence of operations that results in a subsequnce that sums up to 7.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,32,1,2], target = 12\n**Output:** 2\n**Explanation:** In the first operation, we choose element nums[1]. The array becomes equal to nums = [1,1,2,16,16].\nIn the second operation, we choose element nums[3]. The array becomes equal to nums = [1,1,2,16,8,8]\nAt this stage, nums contains the subsequence [1,1,2,8] which sums up to 12.\nIt can be shown that there is no shorter sequence of operations that results in a subsequence that sums up to 12.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,32,1], target = 35\n**Output:** -1\n**Explanation:** It can be shown that no sequence of operations results in a subsequence that sums up to 35.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 1000`\n* `1 <= nums[i] <= 230`\n* `nums` consists only of non-negative powers of two.\n* `1 <= target < 231`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minOperations(self, nums: List[int], target: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minOperations(**[[1, 2, 8], 7]) == 1\nassert my_solution.minOperations(**[[1, 32, 1, 2], 12]) == 2\nassert my_solution.minOperations(**[[1, 32, 1], 35]) == -1\nassert my_solution.minOperations(**[[1], 1]) == 0\nassert my_solution.minOperations(**[[16, 128, 32], 1]) == 4\nassert my_solution.minOperations(**[[1, 1], 2]) == 0\nassert my_solution.minOperations(**[[64, 128, 128], 2]) == 5\nassert my_solution.minOperations(**[[2], 2]) == 0\nassert my_solution.minOperations(**[[32, 256, 4], 2]) == 1\nassert my_solution.minOperations(**[[1, 1, 1], 3]) == 0\nassert my_solution.minOperations(**[[1, 256, 16, 128], 3]) == 3\nassert my_solution.minOperations(**[[1, 2], 3]) == 0\nassert my_solution.minOperations(**[[16, 16, 4], 3]) == 2\nassert my_solution.minOperations(**[[1, 1, 1, 1], 4]) == 0\nassert my_solution.minOperations(**[[128, 1, 128, 1, 64], 4]) == 4\nassert my_solution.minOperations(**[[2, 1, 1], 4]) == 0\nassert my_solution.minOperations(**[[8, 2, 64, 32], 4]) == 1\nassert my_solution.minOperations(**[[16, 128, 8, 1, 1], 4]) == 1\nassert my_solution.minOperations(**[[1, 2, 1], 4]) == 0\nassert my_solution.minOperations(**[[128, 8, 8, 2], 4]) == 1\n"}, "labels": {"questionId": "3025", "questionFrontendId": "2835", "questionTitle": "Minimum Operations to Form Subsequence With Target Sum", "stats": {"totalAccepted": "3.7K", "totalSubmission": "10.8K", "totalAcceptedRaw": 3709, "totalSubmissionRaw": 10750, "acRate": "34.5%"}, "probedCases": [{"inputs": [[1, 2, 8], 7], "output": 1}, {"inputs": [[1, 32, 1, 2], 12], "output": 2}, {"inputs": [[1, 32, 1], 35], "output": -1}, {"inputs": [[1], 1], "output": 0}, {"inputs": [[16, 128, 32], 1], "output": 4}, {"inputs": [[1, 1], 2], "output": 0}, {"inputs": [[64, 128, 128], 2], "output": 5}, {"inputs": [[2], 2], "output": 0}, {"inputs": [[32, 256, 4], 2], "output": 1}, {"inputs": [[1, 1, 1], 3], "output": 0}, {"inputs": [[1, 256, 16, 128], 3], "output": 3}, {"inputs": [[1, 2], 3], "output": 0}, {"inputs": [[16, 16, 4], 3], "output": 2}, {"inputs": [[1, 1, 1, 1], 4], "output": 0}, {"inputs": [[128, 1, 128, 1, 64], 4], "output": 4}, {"inputs": [[2, 1, 1], 4], "output": 0}, {"inputs": [[8, 2, 64, 32], 4], "output": 1}, {"inputs": [[16, 128, 8, 1, 1], 4], "output": 1}, {"inputs": [[1, 2, 1], 4], "output": 0}, {"inputs": [[128, 8, 8, 2], 4], "output": 1}]}} +{"id": "LeetCode/3032", "content": "# Maximize Value of Function in a Ball Passing Game\n\nYou are given a **0-indexed** integer array `receiver` of length `n` and an integer `k`.\n\n\nThere are `n` players having a **unique id** in the range `[0, n - 1]` who will play a ball passing game, and `receiver[i]` is the id of the player who receives passes from the player with id `i`. Players can pass to themselves, **i.e.** `receiver[i]` may be equal to `i`.\n\n\nYou must choose one of the `n` players as the starting player for the game, and the ball will be passed **exactly** `k` times starting from the chosen player.\n\n\nFor a chosen starting player having id `x`, we define a function `f(x)` that denotes the **sum** of `x` and the **ids** of all players who receive the ball during the `k` passes, **including repetitions**. In other words, `f(x) = x + receiver[x] + receiver[receiver[x]] + ... + receiver(k)[x]`.\n\n\nYour task is to choose a starting player having id `x` that **maximizes** the value of `f(x)`.\n\n\nReturn *an integer denoting the **maximum** value of the function.*\n\n\n**Note:** `receiver` may contain duplicates.\n\n\n \n\n\n**Example 1:**\n\n\n\n\n| Pass Number | Sender ID | Receiver ID | x + Receiver IDs |\n| --- | --- | --- | --- |\n| | | | 2 |\n| 1 | 2 | 1 | 3 |\n| 2 | 1 | 0 | 3 |\n| 3 | 0 | 2 | 5 |\n| 4 | 2 | 1 | 6 |\n\n\n\n```\n\n**Input:** receiver = [2,0,1], k = 4\n**Output:** 6\n**Explanation:** The table above shows a simulation of the game starting with the player having id x = 2. \nFrom the table, f(2) is equal to 6. \nIt can be shown that 6 is the maximum achievable value of the function. \nHence, the output is 6. \n\n```\n\n**Example 2:**\n\n\n\n\n| Pass Number | Sender ID | Receiver ID | x + Receiver IDs |\n| --- | --- | --- | --- |\n| | | | 4 |\n| 1 | 4 | 3 | 7 |\n| 2 | 3 | 2 | 9 |\n| 3 | 2 | 1 | 10 |\n\n\n\n```\n\n**Input:** receiver = [1,1,1,2,3], k = 3\n**Output:** 10\n**Explanation:** The table above shows a simulation of the game starting with the player having id x = 4. \nFrom the table, f(4) is equal to 10. \nIt can be shown that 10 is the maximum achievable value of the function. \nHence, the output is 10. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= receiver.length == n <= 105`\n* `0 <= receiver[i] <= n - 1`\n* `1 <= k <= 1010`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def getMaxFunctionValue(self, receiver: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.getMaxFunctionValue(**[[2, 0, 1], 4]) == 6\nassert my_solution.getMaxFunctionValue(**[[1, 1, 1, 2, 3], 3]) == 10\nassert my_solution.getMaxFunctionValue(**[[0], 1]) == 0\nassert my_solution.getMaxFunctionValue(**[[0], 2]) == 0\nassert my_solution.getMaxFunctionValue(**[[0], 3]) == 0\nassert my_solution.getMaxFunctionValue(**[[0], 100]) == 0\nassert my_solution.getMaxFunctionValue(**[[0, 0], 1]) == 1\nassert my_solution.getMaxFunctionValue(**[[0, 0], 7]) == 1\nassert my_solution.getMaxFunctionValue(**[[0, 0], 10]) == 1\nassert my_solution.getMaxFunctionValue(**[[0, 0], 13]) == 1\nassert my_solution.getMaxFunctionValue(**[[0, 0], 16]) == 1\nassert my_solution.getMaxFunctionValue(**[[0, 1], 1]) == 2\nassert my_solution.getMaxFunctionValue(**[[0, 1], 3]) == 4\nassert my_solution.getMaxFunctionValue(**[[0, 1], 5]) == 6\nassert my_solution.getMaxFunctionValue(**[[0, 1], 8]) == 9\nassert my_solution.getMaxFunctionValue(**[[0, 1], 13]) == 14\nassert my_solution.getMaxFunctionValue(**[[0, 1], 14]) == 15\nassert my_solution.getMaxFunctionValue(**[[0, 1], 15]) == 16\nassert my_solution.getMaxFunctionValue(**[[1, 0], 5]) == 3\nassert my_solution.getMaxFunctionValue(**[[1, 0], 6]) == 4\n"}, "labels": {"questionId": "3032", "questionFrontendId": "2836", "questionTitle": "Maximize Value of Function in a Ball Passing Game", "stats": {"totalAccepted": "2.5K", "totalSubmission": "6.3K", "totalAcceptedRaw": 2453, "totalSubmissionRaw": 6282, "acRate": "39.0%"}, "probedCases": [{"inputs": [[2, 0, 1], 4], "output": 6}, {"inputs": [[1, 1, 1, 2, 3], 3], "output": 10}, {"inputs": [[0], 1], "output": 0}, {"inputs": [[0], 2], "output": 0}, {"inputs": [[0], 3], "output": 0}, {"inputs": [[0], 100], "output": 0}, {"inputs": [[0, 0], 1], "output": 1}, {"inputs": [[0, 0], 7], "output": 1}, {"inputs": [[0, 0], 10], "output": 1}, {"inputs": [[0, 0], 13], "output": 1}, {"inputs": [[0, 0], 16], "output": 1}, {"inputs": [[0, 1], 1], "output": 2}, {"inputs": [[0, 1], 3], "output": 4}, {"inputs": [[0, 1], 5], "output": 6}, {"inputs": [[0, 1], 8], "output": 9}, {"inputs": [[0, 1], 13], "output": 14}, {"inputs": [[0, 1], 14], "output": 15}, {"inputs": [[0, 1], 15], "output": 16}, {"inputs": [[1, 0], 5], "output": 3}, {"inputs": [[1, 0], 6], "output": 4}]}} +{"id": "LeetCode/2977", "content": "# Check if a String Is an Acronym of Words\n\nGiven an array of strings `words` and a string `s`, determine if `s` is an **acronym** of words.\n\n\nThe string `s` is considered an acronym of `words` if it can be formed by concatenating the **first** character of each string in `words` **in order**. For example, `\"ab\"` can be formed from `[\"apple\", \"banana\"]`, but it can't be formed from `[\"bear\", \"aardvark\"]`.\n\n\nReturn `true` *if* `s` *is an acronym of* `words`*, and* `false` *otherwise.* \n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** words = [\"alice\",\"bob\",\"charlie\"], s = \"abc\"\n**Output:** true\n**Explanation:** The first character in the words \"alice\", \"bob\", and \"charlie\" are 'a', 'b', and 'c', respectively. Hence, s = \"abc\" is the acronym. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** words = [\"an\",\"apple\"], s = \"a\"\n**Output:** false\n**Explanation:** The first character in the words \"an\" and \"apple\" are 'a' and 'a', respectively. \nThe acronym formed by concatenating these characters is \"aa\". \nHence, s = \"a\" is not the acronym.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** words = [\"never\",\"gonna\",\"give\",\"up\",\"on\",\"you\"], s = \"ngguoy\"\n**Output:** true\n**Explanation:** By concatenating the first character of the words in the array, we get the string \"ngguoy\". \nHence, s = \"ngguoy\" is the acronym.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= words.length <= 100`\n* `1 <= words[i].length <= 10`\n* `1 <= s.length <= 100`\n* `words[i]` and `s` consist of lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def isAcronym(self, words: List[str], s: str) -> bool:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.isAcronym(**[['alice', 'bob', 'charlie'], 'abc']) == True\nassert my_solution.isAcronym(**[['an', 'apple'], 'a']) == False\nassert my_solution.isAcronym(**[['never', 'gonna', 'give', 'up', 'on', 'you'], 'ngguoy']) == True\nassert my_solution.isAcronym(**[['ad', 'uadhrwxki'], 'au']) == True\nassert my_solution.isAcronym(**[['afkc', 'icxufam'], 'ai']) == True\nassert my_solution.isAcronym(**[['afqcpzsx', 'icenu'], 'yi']) == False\nassert my_solution.isAcronym(**[['ahbibag', 'aoximesw'], 'aa']) == True\nassert my_solution.isAcronym(**[['auqoc', 'koioxa'], 'ak']) == True\nassert my_solution.isAcronym(**[['b', 'x'], 'bx']) == True\nassert my_solution.isAcronym(**[['bpctc', 'kaqquqbpmw'], 'bk']) == True\nassert my_solution.isAcronym(**[['c', 'df'], 'bd']) == False\nassert my_solution.isAcronym(**[['c', 'evlvvhrsqa'], 'ce']) == True\nassert my_solution.isAcronym(**[['cfsrsyt', 'md'], 'cm']) == True\nassert my_solution.isAcronym(**[['ddnlfpvy', 'exs'], 'de']) == True\nassert my_solution.isAcronym(**[['deacf', 'hldiauk'], 'dh']) == True\nassert my_solution.isAcronym(**[['dllcn', 'tnzrnzypg'], 'dt']) == True\nassert my_solution.isAcronym(**[['dmekslxlpo', 'wqdgxqwdk'], 'dw']) == True\nassert my_solution.isAcronym(**[['dv', 'g'], 'sg']) == False\nassert my_solution.isAcronym(**[['dvn', 'acafe'], 'dp']) == False\nassert my_solution.isAcronym(**[['dwrvgkxdtm', 'wy'], 'hw']) == False\n"}, "labels": {"questionId": "2977", "questionFrontendId": "2828", "questionTitle": "Check if a String Is an Acronym of Words", "stats": {"totalAccepted": "29.8K", "totalSubmission": "35K", "totalAcceptedRaw": 29846, "totalSubmissionRaw": 34967, "acRate": "85.4%"}, "probedCases": [{"inputs": [["alice", "bob", "charlie"], "abc"], "output": true}, {"inputs": [["an", "apple"], "a"], "output": false}, {"inputs": [["never", "gonna", "give", "up", "on", "you"], "ngguoy"], "output": true}, {"inputs": [["ad", "uadhrwxki"], "au"], "output": true}, {"inputs": [["afkc", "icxufam"], "ai"], "output": true}, {"inputs": [["afqcpzsx", "icenu"], "yi"], "output": false}, {"inputs": [["ahbibag", "aoximesw"], "aa"], "output": true}, {"inputs": [["auqoc", "koioxa"], "ak"], "output": true}, {"inputs": [["b", "x"], "bx"], "output": true}, {"inputs": [["bpctc", "kaqquqbpmw"], "bk"], "output": true}, {"inputs": [["c", "df"], "bd"], "output": false}, {"inputs": [["c", "evlvvhrsqa"], "ce"], "output": true}, {"inputs": [["cfsrsyt", "md"], "cm"], "output": true}, {"inputs": [["ddnlfpvy", "exs"], "de"], "output": true}, {"inputs": [["deacf", "hldiauk"], "dh"], "output": true}, {"inputs": [["dllcn", "tnzrnzypg"], "dt"], "output": true}, {"inputs": [["dmekslxlpo", "wqdgxqwdk"], "dw"], "output": true}, {"inputs": [["dv", "g"], "sg"], "output": false}, {"inputs": [["dvn", "acafe"], "dp"], "output": false}, {"inputs": [["dwrvgkxdtm", "wy"], "hw"], "output": false}]}} +{"id": "LeetCode/2811", "content": "# Determine the Minimum Sum of a k-avoiding Array\n\nYou are given two integers, `n` and `k`.\n\n\nAn array of **distinct** positive integers is called a **k-avoiding** array if there does not exist any pair of distinct elements that sum to `k`.\n\n\nReturn *the **minimum** possible sum of a k-avoiding array of length* `n`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 5, k = 4\n**Output:** 18\n**Explanation:** Consider the k-avoiding array [1,2,4,5,6], which has a sum of 18.\nIt can be proven that there is no k-avoiding array with a sum less than 18.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 2, k = 6\n**Output:** 3\n**Explanation:** We can construct the array [1,2], which has a sum of 3.\nIt can be proven that there is no k-avoiding array with a sum less than 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n, k <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumSum(self, n: int, k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumSum(**[5, 4]) == 18\nassert my_solution.minimumSum(**[2, 6]) == 3\nassert my_solution.minimumSum(**[1, 1]) == 1\nassert my_solution.minimumSum(**[1, 2]) == 1\nassert my_solution.minimumSum(**[1, 3]) == 1\nassert my_solution.minimumSum(**[1, 4]) == 1\nassert my_solution.minimumSum(**[1, 5]) == 1\nassert my_solution.minimumSum(**[1, 6]) == 1\nassert my_solution.minimumSum(**[1, 7]) == 1\nassert my_solution.minimumSum(**[1, 8]) == 1\nassert my_solution.minimumSum(**[1, 9]) == 1\nassert my_solution.minimumSum(**[1, 10]) == 1\nassert my_solution.minimumSum(**[1, 11]) == 1\nassert my_solution.minimumSum(**[1, 12]) == 1\nassert my_solution.minimumSum(**[1, 13]) == 1\nassert my_solution.minimumSum(**[1, 14]) == 1\nassert my_solution.minimumSum(**[1, 15]) == 1\nassert my_solution.minimumSum(**[1, 16]) == 1\nassert my_solution.minimumSum(**[1, 17]) == 1\nassert my_solution.minimumSum(**[1, 18]) == 1\n"}, "labels": {"questionId": "2811", "questionFrontendId": "2829", "questionTitle": "Determine the Minimum Sum of a k-avoiding Array", "stats": {"totalAccepted": "6.7K", "totalSubmission": "11.3K", "totalAcceptedRaw": 6723, "totalSubmissionRaw": 11308, "acRate": "59.5%"}, "probedCases": [{"inputs": [5, 4], "output": 18}, {"inputs": [2, 6], "output": 3}, {"inputs": [1, 1], "output": 1}, {"inputs": [1, 2], "output": 1}, {"inputs": [1, 3], "output": 1}, {"inputs": [1, 4], "output": 1}, {"inputs": [1, 5], "output": 1}, {"inputs": [1, 6], "output": 1}, {"inputs": [1, 7], "output": 1}, {"inputs": [1, 8], "output": 1}, {"inputs": [1, 9], "output": 1}, {"inputs": [1, 10], "output": 1}, {"inputs": [1, 11], "output": 1}, {"inputs": [1, 12], "output": 1}, {"inputs": [1, 13], "output": 1}, {"inputs": [1, 14], "output": 1}, {"inputs": [1, 15], "output": 1}, {"inputs": [1, 16], "output": 1}, {"inputs": [1, 17], "output": 1}, {"inputs": [1, 18], "output": 1}]}} +{"id": "LeetCode/2979", "content": "# Maximize the Profit as the Salesman\n\nYou are given an integer `n` representing the number of houses on a number line, numbered from `0` to `n - 1`.\n\n\nAdditionally, you are given a 2D integer array `offers` where `offers[i] = [starti, endi, goldi]`, indicating that `ith` buyer wants to buy all the houses from `starti` to `endi` for `goldi` amount of gold.\n\n\nAs a salesman, your goal is to **maximize** your earnings by strategically selecting and selling houses to buyers.\n\n\nReturn *the maximum amount of gold you can earn*.\n\n\n**Note** that different buyers can't buy the same house, and some houses may remain unsold.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 5, offers = [[0,0,1],[0,2,2],[1,3,2]]\n**Output:** 3\n**Explanation:** There are 5 houses numbered from 0 to 4 and there are 3 purchase offers.\nWe sell houses in the range [0,0] to 1st buyer for 1 gold and houses in the range [1,3] to 3rd buyer for 2 golds.\nIt can be proven that 3 is the maximum amount of gold we can achieve.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 5, offers = [[0,0,1],[0,2,10],[1,3,2]]\n**Output:** 10\n**Explanation:** There are 5 houses numbered from 0 to 4 and there are 3 purchase offers.\nWe sell houses in the range [0,2] to 2nd buyer for 10 golds.\nIt can be proven that 10 is the maximum amount of gold we can achieve.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 105`\n* `1 <= offers.length <= 105`\n* `offers[i].length == 3`\n* `0 <= starti <= endi <= n - 1`\n* `1 <= goldi <= 103`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximizeTheProfit(self, n: int, offers: List[List[int]]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximizeTheProfit(**[5, [[0, 0, 1], [0, 2, 2], [1, 3, 2]]]) == 3\nassert my_solution.maximizeTheProfit(**[5, [[0, 0, 1], [0, 2, 10], [1, 3, 2]]]) == 10\nassert my_solution.maximizeTheProfit(**[4, [[1, 3, 10], [1, 3, 3], [0, 0, 1], [0, 0, 7]]]) == 17\nassert my_solution.maximizeTheProfit(**[4, [[0, 0, 6], [1, 2, 8], [0, 3, 7], [2, 2, 5], [0, 1, 5], [2, 3, 2], [0, 2, 8], [2, 3, 10], [0, 3, 2]]]) == 16\nassert my_solution.maximizeTheProfit(**[15, [[5, 5, 10], [2, 6, 6], [8, 11, 5], [7, 11, 9], [2, 4, 1], [3, 8, 5], [0, 6, 9], [0, 10, 5], [5, 10, 8], [4, 5, 1]]]) == 20\nassert my_solution.maximizeTheProfit(**[10, [[1, 6, 1], [0, 1, 10], [3, 6, 2], [0, 5, 10], [0, 0, 3], [0, 0, 4], [1, 1, 4], [0, 6, 7], [4, 4, 1]]]) == 12\nassert my_solution.maximizeTheProfit(**[11, [[7, 8, 6], [6, 6, 4], [4, 6, 9], [6, 7, 4], [5, 5, 8], [1, 5, 9], [7, 7, 8], [1, 2, 5], [0, 2, 9], [1, 3, 8], [0, 2, 7], [2, 2, 8]]]) == 29\nassert my_solution.maximizeTheProfit(**[3, [[0, 0, 6], [0, 1, 8], [1, 2, 1], [0, 1, 4], [0, 1, 2], [0, 0, 7], [0, 0, 6], [0, 0, 5]]]) == 8\nassert my_solution.maximizeTheProfit(**[4, [[0, 1, 9], [1, 1, 4]]]) == 9\nassert my_solution.maximizeTheProfit(**[11, [[1, 10, 6], [1, 10, 5], [0, 2, 7], [0, 0, 8], [8, 10, 7]]]) == 15\nassert my_solution.maximizeTheProfit(**[3, [[0, 1, 8], [1, 1, 6], [2, 2, 7], [0, 2, 6], [0, 2, 2], [0, 0, 6], [0, 0, 9], [0, 1, 4]]]) == 22\nassert my_solution.maximizeTheProfit(**[6, [[0, 2, 4]]]) == 4\nassert my_solution.maximizeTheProfit(**[10, [[5, 9, 3], [1, 5, 8], [0, 0, 6], [5, 8, 10]]]) == 16\nassert my_solution.maximizeTheProfit(**[5, [[1, 1, 3], [1, 1, 3], [0, 0, 8], [1, 3, 8], [0, 2, 1], [3, 3, 9], [0, 0, 7], [0, 2, 3], [0, 0, 5], [0, 3, 10], [1, 3, 10], [4, 4, 6], [0, 1, 1], [2, 4, 10]]]) == 26\nassert my_solution.maximizeTheProfit(**[13, [[2, 2, 5], [1, 8, 10], [2, 3, 3]]]) == 10\nassert my_solution.maximizeTheProfit(**[2, [[1, 1, 8], [1, 1, 8], [1, 1, 10], [1, 1, 7], [0, 0, 7], [0, 0, 3], [0, 1, 8], [0, 0, 4], [0, 0, 4], [0, 0, 7], [0, 0, 10], [0, 1, 4], [1, 1, 1], [0, 1, 5]]]) == 20\nassert my_solution.maximizeTheProfit(**[3, [[0, 1, 7], [1, 1, 3], [0, 0, 2], [1, 1, 6], [0, 0, 10], [1, 1, 7], [0, 2, 3], [0, 1, 2], [0, 0, 7]]]) == 17\nassert my_solution.maximizeTheProfit(**[5, [[0, 0, 5], [1, 3, 9], [0, 2, 2], [1, 1, 6], [1, 2, 10], [0, 2, 10], [1, 1, 3]]]) == 15\nassert my_solution.maximizeTheProfit(**[10, [[0, 1, 9], [5, 6, 10], [1, 3, 8], [1, 9, 7], [7, 8, 1], [2, 7, 1], [0, 8, 7], [1, 6, 6], [1, 4, 4], [0, 5, 4], [0, 0, 3], [0, 8, 6]]]) == 22\nassert my_solution.maximizeTheProfit(**[4, [[0, 0, 1], [0, 0, 10], [0, 2, 1], [0, 0, 6], [0, 3, 10], [0, 1, 5], [1, 2, 10], [0, 0, 2], [3, 3, 1], [0, 0, 9], [0, 1, 2], [0, 0, 4], [1, 3, 5], [1, 1, 1]]]) == 21\n"}, "labels": {"questionId": "2979", "questionFrontendId": "2830", "questionTitle": "Maximize the Profit as the Salesman", "stats": {"totalAccepted": "5.8K", "totalSubmission": "13.7K", "totalAcceptedRaw": 5837, "totalSubmissionRaw": 13747, "acRate": "42.5%"}, "probedCases": [{"inputs": [5, [[0, 0, 1], [0, 2, 2], [1, 3, 2]]], "output": 3}, {"inputs": [5, [[0, 0, 1], [0, 2, 10], [1, 3, 2]]], "output": 10}, {"inputs": [4, [[1, 3, 10], [1, 3, 3], [0, 0, 1], [0, 0, 7]]], "output": 17}, {"inputs": [4, [[0, 0, 6], [1, 2, 8], [0, 3, 7], [2, 2, 5], [0, 1, 5], [2, 3, 2], [0, 2, 8], [2, 3, 10], [0, 3, 2]]], "output": 16}, {"inputs": [15, [[5, 5, 10], [2, 6, 6], [8, 11, 5], [7, 11, 9], [2, 4, 1], [3, 8, 5], [0, 6, 9], [0, 10, 5], [5, 10, 8], [4, 5, 1]]], "output": 20}, {"inputs": [10, [[1, 6, 1], [0, 1, 10], [3, 6, 2], [0, 5, 10], [0, 0, 3], [0, 0, 4], [1, 1, 4], [0, 6, 7], [4, 4, 1]]], "output": 12}, {"inputs": [11, [[7, 8, 6], [6, 6, 4], [4, 6, 9], [6, 7, 4], [5, 5, 8], [1, 5, 9], [7, 7, 8], [1, 2, 5], [0, 2, 9], [1, 3, 8], [0, 2, 7], [2, 2, 8]]], "output": 29}, {"inputs": [3, [[0, 0, 6], [0, 1, 8], [1, 2, 1], [0, 1, 4], [0, 1, 2], [0, 0, 7], [0, 0, 6], [0, 0, 5]]], "output": 8}, {"inputs": [4, [[0, 1, 9], [1, 1, 4]]], "output": 9}, {"inputs": [11, [[1, 10, 6], [1, 10, 5], [0, 2, 7], [0, 0, 8], [8, 10, 7]]], "output": 15}, {"inputs": [3, [[0, 1, 8], [1, 1, 6], [2, 2, 7], [0, 2, 6], [0, 2, 2], [0, 0, 6], [0, 0, 9], [0, 1, 4]]], "output": 22}, {"inputs": [6, [[0, 2, 4]]], "output": 4}, {"inputs": [10, [[5, 9, 3], [1, 5, 8], [0, 0, 6], [5, 8, 10]]], "output": 16}, {"inputs": [5, [[1, 1, 3], [1, 1, 3], [0, 0, 8], [1, 3, 8], [0, 2, 1], [3, 3, 9], [0, 0, 7], [0, 2, 3], [0, 0, 5], [0, 3, 10], [1, 3, 10], [4, 4, 6], [0, 1, 1], [2, 4, 10]]], "output": 26}, {"inputs": [13, [[2, 2, 5], [1, 8, 10], [2, 3, 3]]], "output": 10}, {"inputs": [2, [[1, 1, 8], [1, 1, 8], [1, 1, 10], [1, 1, 7], [0, 0, 7], [0, 0, 3], [0, 1, 8], [0, 0, 4], [0, 0, 4], [0, 0, 7], [0, 0, 10], [0, 1, 4], [1, 1, 1], [0, 1, 5]]], "output": 20}, {"inputs": [3, [[0, 1, 7], [1, 1, 3], [0, 0, 2], [1, 1, 6], [0, 0, 10], [1, 1, 7], [0, 2, 3], [0, 1, 2], [0, 0, 7]]], "output": 17}, {"inputs": [5, [[0, 0, 5], [1, 3, 9], [0, 2, 2], [1, 1, 6], [1, 2, 10], [0, 2, 10], [1, 1, 3]]], "output": 15}, {"inputs": [10, [[0, 1, 9], [5, 6, 10], [1, 3, 8], [1, 9, 7], [7, 8, 1], [2, 7, 1], [0, 8, 7], [1, 6, 6], [1, 4, 4], [0, 5, 4], [0, 0, 3], [0, 8, 6]]], "output": 22}, {"inputs": [4, [[0, 0, 1], [0, 0, 10], [0, 2, 1], [0, 0, 6], [0, 3, 10], [0, 1, 5], [1, 2, 10], [0, 0, 2], [3, 3, 1], [0, 0, 9], [0, 1, 2], [0, 0, 4], [1, 3, 5], [1, 1, 1]]], "output": 21}]}} +{"id": "LeetCode/2832", "content": "# Find the Longest Equal Subarray\n\nYou are given a **0-indexed** integer array `nums` and an integer `k`.\n\n\nA subarray is called **equal** if all of its elements are equal. Note that the empty subarray is an **equal** subarray.\n\n\nReturn *the length of the **longest** possible equal subarray after deleting **at most*** `k` *elements from* `nums`.\n\n\nA **subarray** is a contiguous, possibly empty sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,3,2,3,1,3], k = 3\n**Output:** 3\n**Explanation:** It's optimal to delete the elements at index 2 and index 4.\nAfter deleting them, nums becomes equal to [1, 3, 3, 3].\nThe longest equal subarray starts at i = 1 and ends at j = 3 with length equal to 3.\nIt can be proven that no longer equal subarrays can be created.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,1,2,2,1,1], k = 2\n**Output:** 4\n**Explanation:** It's optimal to delete the elements at index 2 and index 3.\nAfter deleting them, nums becomes equal to [1, 1, 1, 1].\nThe array itself is an equal subarray, so the answer is 4.\nIt can be proven that no longer equal subarrays can be created.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= nums.length`\n* `0 <= k <= nums.length`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def longestEqualSubarray(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.longestEqualSubarray(**[[1, 3, 2, 3, 1, 3], 3]) == 3\nassert my_solution.longestEqualSubarray(**[[1, 1, 2, 2, 1, 1], 2]) == 4\nassert my_solution.longestEqualSubarray(**[[1], 0]) == 1\nassert my_solution.longestEqualSubarray(**[[1], 1]) == 1\nassert my_solution.longestEqualSubarray(**[[2, 1], 1]) == 1\nassert my_solution.longestEqualSubarray(**[[2, 2], 1]) == 2\nassert my_solution.longestEqualSubarray(**[[1, 1], 0]) == 2\nassert my_solution.longestEqualSubarray(**[[2, 1], 0]) == 1\nassert my_solution.longestEqualSubarray(**[[1, 2], 1]) == 1\nassert my_solution.longestEqualSubarray(**[[2, 2], 2]) == 2\nassert my_solution.longestEqualSubarray(**[[2, 3, 2], 1]) == 2\nassert my_solution.longestEqualSubarray(**[[3, 2, 2], 1]) == 2\nassert my_solution.longestEqualSubarray(**[[3, 1, 1], 2]) == 2\nassert my_solution.longestEqualSubarray(**[[1, 2, 3], 2]) == 1\nassert my_solution.longestEqualSubarray(**[[1, 2, 3], 3]) == 1\nassert my_solution.longestEqualSubarray(**[[2, 3, 1], 2]) == 1\nassert my_solution.longestEqualSubarray(**[[2, 2, 1], 1]) == 2\nassert my_solution.longestEqualSubarray(**[[1, 3, 2], 3]) == 1\nassert my_solution.longestEqualSubarray(**[[2, 3, 3], 3]) == 2\nassert my_solution.longestEqualSubarray(**[[3, 2, 3], 3]) == 2\n"}, "labels": {"questionId": "2832", "questionFrontendId": "2831", "questionTitle": "Find the Longest Equal Subarray", "stats": {"totalAccepted": "4.9K", "totalSubmission": "11.9K", "totalAcceptedRaw": 4881, "totalSubmissionRaw": 11886, "acRate": "41.1%"}, "probedCases": [{"inputs": [[1, 3, 2, 3, 1, 3], 3], "output": 3}, {"inputs": [[1, 1, 2, 2, 1, 1], 2], "output": 4}, {"inputs": [[1], 0], "output": 1}, {"inputs": [[1], 1], "output": 1}, {"inputs": [[2, 1], 1], "output": 1}, {"inputs": [[2, 2], 1], "output": 2}, {"inputs": [[1, 1], 0], "output": 2}, {"inputs": [[2, 1], 0], "output": 1}, {"inputs": [[1, 2], 1], "output": 1}, {"inputs": [[2, 2], 2], "output": 2}, {"inputs": [[2, 3, 2], 1], "output": 2}, {"inputs": [[3, 2, 2], 1], "output": 2}, {"inputs": [[3, 1, 1], 2], "output": 2}, {"inputs": [[1, 2, 3], 2], "output": 1}, {"inputs": [[1, 2, 3], 3], "output": 1}, {"inputs": [[2, 3, 1], 2], "output": 1}, {"inputs": [[2, 2, 1], 1], "output": 2}, {"inputs": [[1, 3, 2], 3], "output": 1}, {"inputs": [[2, 3, 3], 3], "output": 2}, {"inputs": [[3, 2, 3], 3], "output": 2}]}} +{"id": "LeetCode/2917", "content": "# Count Pairs Whose Sum is Less than Target\n\nGiven a **0-indexed** integer array `nums` of length `n` and an integer `target`, return *the number of pairs* `(i, j)` *where* `0 <= i < j < n` *and* `nums[i] + nums[j] < target`.\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [-1,1,2,3,1], target = 2\n**Output:** 3\n**Explanation:** There are 3 pairs of indices that satisfy the conditions in the statement:\n- (0, 1) since 0 < 1 and nums[0] + nums[1] = 0 < target\n- (0, 2) since 0 < 2 and nums[0] + nums[2] = 1 < target \n- (0, 4) since 0 < 4 and nums[0] + nums[4] = 0 < target\nNote that (0, 3) is not counted since nums[0] + nums[3] is not strictly less than the target.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [-6,2,5,-2,-7,-1,3], target = -2\n**Output:** 10\n**Explanation:** There are 10 pairs of indices that satisfy the conditions in the statement:\n- (0, 1) since 0 < 1 and nums[0] + nums[1] = -4 < target\n- (0, 3) since 0 < 3 and nums[0] + nums[3] = -8 < target\n- (0, 4) since 0 < 4 and nums[0] + nums[4] = -13 < target\n- (0, 5) since 0 < 5 and nums[0] + nums[5] = -7 < target\n- (0, 6) since 0 < 6 and nums[0] + nums[6] = -3 < target\n- (1, 4) since 1 < 4 and nums[1] + nums[4] = -5 < target\n- (3, 4) since 3 < 4 and nums[3] + nums[4] = -9 < target\n- (3, 5) since 3 < 5 and nums[3] + nums[5] = -3 < target\n- (4, 5) since 4 < 5 and nums[4] + nums[5] = -8 < target\n- (4, 6) since 4 < 6 and nums[4] + nums[6] = -4 < target\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length == n <= 50`\n* `-50 <= nums[i], target <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countPairs(self, nums: List[int], target: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countPairs(**[[-1, 1, 2, 3, 1], 2]) == 3\nassert my_solution.countPairs(**[[-6, 2, 5, -2, -7, -1, 3], -2]) == 10\nassert my_solution.countPairs(**[[9, -5, -5, 5, -5, -4, -6, 6, -6], 3]) == 27\nassert my_solution.countPairs(**[[-8, -5, 5, -4, 10], 2]) == 6\nassert my_solution.countPairs(**[[-5, 0, -7, -1, 9, 8, -9, 9], -14]) == 1\nassert my_solution.countPairs(**[[6, -1, 7, 4, 2, 3], 8]) == 8\nassert my_solution.countPairs(**[[2, 8, 2, 8, 7], 10]) == 3\nassert my_solution.countPairs(**[[-6, 1, 1, -1, -10, -7, 1, -5, -4, 0], -15]) == 2\nassert my_solution.countPairs(**[[10, -2, -1, 7, 8, 5, 3, -4, -9], -10]) == 2\nassert my_solution.countPairs(**[[3, 8, -3, 4, 10, -6], 1]) == 4\nassert my_solution.countPairs(**[[-4, -6, -7, 8], -13]) == 0\nassert my_solution.countPairs(**[[-4, 0, 10, 8, -2], 0]) == 3\nassert my_solution.countPairs(**[[-8, -5, -3, 1, -7], -6]) == 7\nassert my_solution.countPairs(**[[4, -8, -2, 5, 2, -9, 6, 5, -4], -4]) == 9\nassert my_solution.countPairs(**[[-1, -5, 4, 4, -10], -6]) == 2\nassert my_solution.countPairs(**[[-5, 4, -6, -5, -10, -1, 10, 3], 6]) == 24\nassert my_solution.countPairs(**[[-9, 6, -4, 10, 1, 8], 11]) == 11\nassert my_solution.countPairs(**[[-10, -6, -8, -9, 6, 6, -6, -6, -3], -2]) == 25\nassert my_solution.countPairs(**[[-7, 7, 6, -9, -4, 10, 8, -8, 2, 2], -1]) == 17\nassert my_solution.countPairs(**[[0, -1, 0, -6, -9], -9]) == 2\n"}, "labels": {"questionId": "2917", "questionFrontendId": "2824", "questionTitle": "Count Pairs Whose Sum is Less than Target", "stats": {"totalAccepted": "31.1K", "totalSubmission": "35.7K", "totalAcceptedRaw": 31062, "totalSubmissionRaw": 35741, "acRate": "86.9%"}, "probedCases": [{"inputs": [[-1, 1, 2, 3, 1], 2], "output": 3}, {"inputs": [[-6, 2, 5, -2, -7, -1, 3], -2], "output": 10}, {"inputs": [[9, -5, -5, 5, -5, -4, -6, 6, -6], 3], "output": 27}, {"inputs": [[-8, -5, 5, -4, 10], 2], "output": 6}, {"inputs": [[-5, 0, -7, -1, 9, 8, -9, 9], -14], "output": 1}, {"inputs": [[6, -1, 7, 4, 2, 3], 8], "output": 8}, {"inputs": [[2, 8, 2, 8, 7], 10], "output": 3}, {"inputs": [[-6, 1, 1, -1, -10, -7, 1, -5, -4, 0], -15], "output": 2}, {"inputs": [[10, -2, -1, 7, 8, 5, 3, -4, -9], -10], "output": 2}, {"inputs": [[3, 8, -3, 4, 10, -6], 1], "output": 4}, {"inputs": [[-4, -6, -7, 8], -13], "output": 0}, {"inputs": [[-4, 0, 10, 8, -2], 0], "output": 3}, {"inputs": [[-8, -5, -3, 1, -7], -6], "output": 7}, {"inputs": [[4, -8, -2, 5, 2, -9, 6, 5, -4], -4], "output": 9}, {"inputs": [[-1, -5, 4, 4, -10], -6], "output": 2}, {"inputs": [[-5, 4, -6, -5, -10, -1, 10, 3], 6], "output": 24}, {"inputs": [[-9, 6, -4, 10, 1, 8], 11], "output": 11}, {"inputs": [[-10, -6, -8, -9, 6, 6, -6, -6, -3], -2], "output": 25}, {"inputs": [[-7, 7, 6, -9, -4, 10, 8, -8, 2, 2], -1], "output": 17}, {"inputs": [[0, -1, 0, -6, -9], -9], "output": 2}]}} +{"id": "LeetCode/3018", "content": "# Make String a Subsequence Using Cyclic Increments\n\nYou are given two **0-indexed** strings `str1` and `str2`.\n\n\nIn an operation, you select a **set** of indices in `str1`, and for each index `i` in the set, increment `str1[i]` to the next character **cyclically**. That is `'a'` becomes `'b'`, `'b'` becomes `'c'`, and so on, and `'z'` becomes `'a'`.\n\n\nReturn `true` *if it is possible to make* `str2` *a subsequence of* `str1` *by performing the operation **at most once***, *and* `false` *otherwise*.\n\n\n**Note:** A subsequence of a string is a new string that is formed from the original string by deleting some (possibly none) of the characters without disturbing the relative positions of the remaining characters.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** str1 = \"abc\", str2 = \"ad\"\n**Output:** true\n**Explanation:** Select index 2 in str1.\nIncrement str1[2] to become 'd'. \nHence, str1 becomes \"abd\" and str2 is now a subsequence. Therefore, true is returned.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** str1 = \"zc\", str2 = \"ad\"\n**Output:** true\n**Explanation:** Select indices 0 and 1 in str1. \nIncrement str1[0] to become 'a'. \nIncrement str1[1] to become 'd'. \nHence, str1 becomes \"ad\" and str2 is now a subsequence. Therefore, true is returned.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** str1 = \"ab\", str2 = \"d\"\n**Output:** false\n**Explanation:** In this example, it can be shown that it is impossible to make str2 a subsequence of str1 using the operation at most once. \nTherefore, false is returned.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= str1.length <= 105`\n* `1 <= str2.length <= 105`\n* `str1` and `str2` consist of only lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def canMakeSubsequence(self, str1: str, str2: str) -> bool:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.canMakeSubsequence(**['abc', 'ad']) == True\nassert my_solution.canMakeSubsequence(**['zc', 'ad']) == True\nassert my_solution.canMakeSubsequence(**['ab', 'd']) == False\nassert my_solution.canMakeSubsequence(**['a', 'd']) == False\nassert my_solution.canMakeSubsequence(**['b', 'c']) == True\nassert my_solution.canMakeSubsequence(**['b', 'v']) == False\nassert my_solution.canMakeSubsequence(**['c', 'b']) == False\nassert my_solution.canMakeSubsequence(**['c', 'k']) == False\nassert my_solution.canMakeSubsequence(**['c', 'm']) == False\nassert my_solution.canMakeSubsequence(**['d', 'h']) == False\nassert my_solution.canMakeSubsequence(**['d', 'm']) == False\nassert my_solution.canMakeSubsequence(**['d', 'x']) == False\nassert my_solution.canMakeSubsequence(**['f', 'f']) == True\nassert my_solution.canMakeSubsequence(**['f', 'g']) == True\nassert my_solution.canMakeSubsequence(**['f', 's']) == False\nassert my_solution.canMakeSubsequence(**['g', 'g']) == True\nassert my_solution.canMakeSubsequence(**['h', 'i']) == True\nassert my_solution.canMakeSubsequence(**['i', 'e']) == False\nassert my_solution.canMakeSubsequence(**['i', 'j']) == True\nassert my_solution.canMakeSubsequence(**['j', 'j']) == True\n"}, "labels": {"questionId": "3018", "questionFrontendId": "2825", "questionTitle": "Make String a Subsequence Using Cyclic Increments", "stats": {"totalAccepted": "4.2K", "totalSubmission": "7.6K", "totalAcceptedRaw": 4195, "totalSubmissionRaw": 7638, "acRate": "54.9%"}, "probedCases": [{"inputs": ["abc", "ad"], "output": true}, {"inputs": ["zc", "ad"], "output": true}, {"inputs": ["ab", "d"], "output": false}, {"inputs": ["a", "d"], "output": false}, {"inputs": ["b", "c"], "output": true}, {"inputs": ["b", "v"], "output": false}, {"inputs": ["c", "b"], "output": false}, {"inputs": ["c", "k"], "output": false}, {"inputs": ["c", "m"], "output": false}, {"inputs": ["d", "h"], "output": false}, {"inputs": ["d", "m"], "output": false}, {"inputs": ["d", "x"], "output": false}, {"inputs": ["f", "f"], "output": true}, {"inputs": ["f", "g"], "output": true}, {"inputs": ["f", "s"], "output": false}, {"inputs": ["g", "g"], "output": true}, {"inputs": ["h", "i"], "output": true}, {"inputs": ["i", "e"], "output": false}, {"inputs": ["i", "j"], "output": true}, {"inputs": ["j", "j"], "output": true}]}} +{"id": "LeetCode/2904", "content": "# Sorting Three Groups\n\nYou are given a **0-indexed** integer array `nums` of length `n`. \n\n \n\nThe numbers from `0` to `n - 1` are divided into three groups numbered from `1` to `3`, where number `i` belongs to group `nums[i]`. Notice that some groups may be **empty**. \n\n \n\nYou are allowed to perform this operation any number of times:\n\n\n* Pick number `x` and change its group. More formally, change `nums[x]` to any number from `1` to `3`.\n\n\nA new array `res` is constructed using the following procedure:\n\n\n1. Sort the numbers in each group independently.\n2. Append the elements of groups `1`, `2`, and `3` to `res` **in this order**.\n\n\nArray `nums` is called a **beautiful array** if the constructed array `res` is sorted in **non-decreasing** order.\n\n\nReturn *the **minimum** number of operations to make* `nums` *a **beautiful array***.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,1,3,2,1]\n**Output:** 3\n**Explanation:** It's optimal to perform three operations:\n1. change nums[0] to 1.\n2. change nums[2] to 1.\n3. change nums[3] to 1.\nAfter performing the operations and sorting the numbers in each group, group 1 becomes equal to [0,1,2,3,4] and group 2 and group 3 become empty. Hence, res is equal to [0,1,2,3,4] which is sorted in non-decreasing order.\nIt can be proven that there is no valid sequence of less than three operations.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,3,2,1,3,3]\n**Output:** 2\n**Explanation:** It's optimal to perform two operations:\n1. change nums[1] to 1.\n2. change nums[2] to 1.\nAfter performing the operations and sorting the numbers in each group, group 1 becomes equal to [0,1,2,3], group 2 becomes empty, and group 3 becomes equal to [4,5]. Hence, res is equal to [0,1,2,3,4,5] which is sorted in non-decreasing order.\nIt can be proven that there is no valid sequence of less than two operations.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [2,2,2,2,3,3]\n**Output:** 0\n**Explanation:** It's optimal to not perform operations.\nAfter sorting the numbers in each group, group 1 becomes empty, group 2 becomes equal to [0,1,2,3] and group 3 becomes equal to [4,5]. Hence, res is equal to [0,1,2,3,4,5] which is sorted in non-decreasing order.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 100`\n* `1 <= nums[i] <= 3`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumOperations(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumOperations(**[[2, 1, 3, 2, 1]]) == 3\nassert my_solution.minimumOperations(**[[1, 3, 2, 1, 3, 3]]) == 2\nassert my_solution.minimumOperations(**[[2, 2, 2, 2, 3, 3]]) == 0\nassert my_solution.minimumOperations(**[[1]]) == 0\nassert my_solution.minimumOperations(**[[2]]) == 0\nassert my_solution.minimumOperations(**[[3]]) == 0\nassert my_solution.minimumOperations(**[[1, 2]]) == 0\nassert my_solution.minimumOperations(**[[2, 2]]) == 0\nassert my_solution.minimumOperations(**[[3, 2]]) == 1\nassert my_solution.minimumOperations(**[[1, 3]]) == 0\nassert my_solution.minimumOperations(**[[2, 3]]) == 0\nassert my_solution.minimumOperations(**[[3, 3]]) == 0\nassert my_solution.minimumOperations(**[[1, 1, 2]]) == 0\nassert my_solution.minimumOperations(**[[2, 1, 2]]) == 1\nassert my_solution.minimumOperations(**[[3, 1, 2]]) == 1\nassert my_solution.minimumOperations(**[[1, 2, 2]]) == 0\nassert my_solution.minimumOperations(**[[2, 2, 2]]) == 0\nassert my_solution.minimumOperations(**[[3, 2, 2]]) == 1\nassert my_solution.minimumOperations(**[[1, 3, 2]]) == 1\nassert my_solution.minimumOperations(**[[2, 3, 2]]) == 1\n"}, "labels": {"questionId": "2904", "questionFrontendId": "2826", "questionTitle": "Sorting Three Groups", "stats": {"totalAccepted": "3.8K", "totalSubmission": "7.2K", "totalAcceptedRaw": 3831, "totalSubmissionRaw": 7183, "acRate": "53.3%"}, "probedCases": [{"inputs": [[2, 1, 3, 2, 1]], "output": 3}, {"inputs": [[1, 3, 2, 1, 3, 3]], "output": 2}, {"inputs": [[2, 2, 2, 2, 3, 3]], "output": 0}, {"inputs": [[1]], "output": 0}, {"inputs": [[2]], "output": 0}, {"inputs": [[3]], "output": 0}, {"inputs": [[1, 2]], "output": 0}, {"inputs": [[2, 2]], "output": 0}, {"inputs": [[3, 2]], "output": 1}, {"inputs": [[1, 3]], "output": 0}, {"inputs": [[2, 3]], "output": 0}, {"inputs": [[3, 3]], "output": 0}, {"inputs": [[1, 1, 2]], "output": 0}, {"inputs": [[2, 1, 2]], "output": 1}, {"inputs": [[3, 1, 2]], "output": 1}, {"inputs": [[1, 2, 2]], "output": 0}, {"inputs": [[2, 2, 2]], "output": 0}, {"inputs": [[3, 2, 2]], "output": 1}, {"inputs": [[1, 3, 2]], "output": 1}, {"inputs": [[2, 3, 2]], "output": 1}]}} +{"id": "LeetCode/3017", "content": "# Number of Beautiful Integers in the Range\n\nYou are given positive integers `low`, `high`, and `k`.\n\n\nA number is **beautiful** if it meets both of the following conditions:\n\n\n* The count of even digits in the number is equal to the count of odd digits.\n* The number is divisible by `k`.\n\n\nReturn *the number of beautiful integers in the range* `[low, high]`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** low = 10, high = 20, k = 3\n**Output:** 2\n**Explanation:** There are 2 beautiful integers in the given range: [12,18]. \n- 12 is beautiful because it contains 1 odd digit and 1 even digit, and is divisible by k = 3.\n- 18 is beautiful because it contains 1 odd digit and 1 even digit, and is divisible by k = 3.\nAdditionally we can see that:\n- 16 is not beautiful because it is not divisible by k = 3.\n- 15 is not beautiful because it does not contain equal counts even and odd digits.\nIt can be shown that there are only 2 beautiful integers in the given range.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** low = 1, high = 10, k = 1\n**Output:** 1\n**Explanation:** There is 1 beautiful integer in the given range: [10].\n- 10 is beautiful because it contains 1 odd digit and 1 even digit, and is divisible by k = 1.\nIt can be shown that there is only 1 beautiful integer in the given range.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** low = 5, high = 5, k = 2\n**Output:** 0\n**Explanation:** There are 0 beautiful integers in the given range.\n- 5 is not beautiful because it is not divisible by k = 2 and it does not contain equal even and odd digits.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `0 < low <= high <= 109`\n* `0 < k <= 20`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def numberOfBeautifulIntegers(self, low: int, high: int, k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.numberOfBeautifulIntegers(**[10, 20, 3]) == 2\nassert my_solution.numberOfBeautifulIntegers(**[1, 10, 1]) == 1\nassert my_solution.numberOfBeautifulIntegers(**[5, 5, 2]) == 0\nassert my_solution.numberOfBeautifulIntegers(**[3, 31, 16]) == 1\nassert my_solution.numberOfBeautifulIntegers(**[25, 31, 11]) == 0\nassert my_solution.numberOfBeautifulIntegers(**[9, 25, 4]) == 2\nassert my_solution.numberOfBeautifulIntegers(**[58, 72, 16]) == 0\nassert my_solution.numberOfBeautifulIntegers(**[5, 79, 12]) == 3\nassert my_solution.numberOfBeautifulIntegers(**[26, 74, 7]) == 4\nassert my_solution.numberOfBeautifulIntegers(**[36, 65, 7]) == 3\nassert my_solution.numberOfBeautifulIntegers(**[12, 84, 8]) == 4\nassert my_solution.numberOfBeautifulIntegers(**[13, 91, 13]) == 3\nassert my_solution.numberOfBeautifulIntegers(**[8, 18, 4]) == 2\nassert my_solution.numberOfBeautifulIntegers(**[22, 59, 6]) == 3\nassert my_solution.numberOfBeautifulIntegers(**[15, 27, 9]) == 2\nassert my_solution.numberOfBeautifulIntegers(**[4, 9, 19]) == 0\nassert my_solution.numberOfBeautifulIntegers(**[14, 81, 17]) == 1\nassert my_solution.numberOfBeautifulIntegers(**[12, 33, 18]) == 1\nassert my_solution.numberOfBeautifulIntegers(**[10, 17, 8]) == 1\nassert my_solution.numberOfBeautifulIntegers(**[42, 58, 3]) == 2\n"}, "labels": {"questionId": "3017", "questionFrontendId": "2827", "questionTitle": "Number of Beautiful Integers in the Range", "stats": {"totalAccepted": "2.6K", "totalSubmission": "7.6K", "totalAcceptedRaw": 2579, "totalSubmissionRaw": 7589, "acRate": "34.0%"}, "probedCases": [{"inputs": [10, 20, 3], "output": 2}, {"inputs": [1, 10, 1], "output": 1}, {"inputs": [5, 5, 2], "output": 0}, {"inputs": [3, 31, 16], "output": 1}, {"inputs": [25, 31, 11], "output": 0}, {"inputs": [9, 25, 4], "output": 2}, {"inputs": [58, 72, 16], "output": 0}, {"inputs": [5, 79, 12], "output": 3}, {"inputs": [26, 74, 7], "output": 4}, {"inputs": [36, 65, 7], "output": 3}, {"inputs": [12, 84, 8], "output": 4}, {"inputs": [13, 91, 13], "output": 3}, {"inputs": [8, 18, 4], "output": 2}, {"inputs": [22, 59, 6], "output": 3}, {"inputs": [15, 27, 9], "output": 2}, {"inputs": [4, 9, 19], "output": 0}, {"inputs": [14, 81, 17], "output": 1}, {"inputs": [12, 33, 18], "output": 1}, {"inputs": [10, 17, 8], "output": 1}, {"inputs": [42, 58, 3], "output": 2}]}} +{"id": "LeetCode/2902", "content": "# Max Pair Sum in an Array\n\nYou are given a **0-indexed** integer array `nums`. You have to find the **maximum** sum of a pair of numbers from `nums` such that the maximum **digit** in both numbers are equal.\n\n\nReturn *the maximum sum or* `-1` *if no such pair exists*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [51,71,17,24,42]\n**Output:** 88\n**Explanation:** \nFor i = 1 and j = 2, nums[i] and nums[j] have equal maximum digits with a pair sum of 71 + 17 = 88. \nFor i = 3 and j = 4, nums[i] and nums[j] have equal maximum digits with a pair sum of 24 + 42 = 66.\nIt can be shown that there are no other pairs with equal maximum digits, so the answer is 88.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4]\n**Output:** -1\n**Explanation:** No pair exists in nums with equal maximum digits.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= nums.length <= 100`\n* `1 <= nums[i] <= 104`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxSum(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxSum(**[[51, 71, 17, 24, 42]]) == 88\nassert my_solution.maxSum(**[[1, 2, 3, 4]]) == -1\nassert my_solution.maxSum(**[[31, 25, 72, 79, 74]]) == 146\nassert my_solution.maxSum(**[[84, 91, 18, 59, 27, 9, 81, 33, 17, 58]]) == 165\nassert my_solution.maxSum(**[[8, 75, 28, 35, 21, 13, 21]]) == 42\nassert my_solution.maxSum(**[[35, 52, 74, 92, 25, 65, 77, 1, 73, 32]]) == 151\nassert my_solution.maxSum(**[[68, 8, 100, 84, 80, 14, 88]]) == 172\nassert my_solution.maxSum(**[[53, 98, 69, 64, 40, 60, 23]]) == 167\nassert my_solution.maxSum(**[[21, 76]]) == -1\nassert my_solution.maxSum(**[[99, 63, 23, 70, 18, 64]]) == 127\nassert my_solution.maxSum(**[[21, 21, 78]]) == 42\nassert my_solution.maxSum(**[[58, 88, 58, 99, 26, 92]]) == 191\nassert my_solution.maxSum(**[[10, 24, 25, 20, 92, 73, 63, 51]]) == 76\nassert my_solution.maxSum(**[[87, 6, 17, 32, 14, 42, 46, 65, 43, 9]]) == 111\nassert my_solution.maxSum(**[[96, 46, 85, 19, 29]]) == 125\nassert my_solution.maxSum(**[[5, 24]]) == -1\nassert my_solution.maxSum(**[[26, 76, 24, 96, 82, 97, 97, 72, 35]]) == 194\nassert my_solution.maxSum(**[[77, 82, 30, 94]]) == -1\nassert my_solution.maxSum(**[[76, 94, 51, 82, 3, 89, 52, 96]]) == 190\nassert my_solution.maxSum(**[[27, 59, 57, 97, 6, 46, 88, 41, 52, 46]]) == 156\n"}, "labels": {"questionId": "2902", "questionFrontendId": "2815", "questionTitle": "Max Pair Sum in an Array", "stats": {"totalAccepted": "8K", "totalSubmission": "11.8K", "totalAcceptedRaw": 8044, "totalSubmissionRaw": 11816, "acRate": "68.1%"}, "probedCases": [{"inputs": [[51, 71, 17, 24, 42]], "output": 88}, {"inputs": [[1, 2, 3, 4]], "output": -1}, {"inputs": [[31, 25, 72, 79, 74]], "output": 146}, {"inputs": [[84, 91, 18, 59, 27, 9, 81, 33, 17, 58]], "output": 165}, {"inputs": [[8, 75, 28, 35, 21, 13, 21]], "output": 42}, {"inputs": [[35, 52, 74, 92, 25, 65, 77, 1, 73, 32]], "output": 151}, {"inputs": [[68, 8, 100, 84, 80, 14, 88]], "output": 172}, {"inputs": [[53, 98, 69, 64, 40, 60, 23]], "output": 167}, {"inputs": [[21, 76]], "output": -1}, {"inputs": [[99, 63, 23, 70, 18, 64]], "output": 127}, {"inputs": [[21, 21, 78]], "output": 42}, {"inputs": [[58, 88, 58, 99, 26, 92]], "output": 191}, {"inputs": [[10, 24, 25, 20, 92, 73, 63, 51]], "output": 76}, {"inputs": [[87, 6, 17, 32, 14, 42, 46, 65, 43, 9]], "output": 111}, {"inputs": [[96, 46, 85, 19, 29]], "output": 125}, {"inputs": [[5, 24]], "output": -1}, {"inputs": [[26, 76, 24, 96, 82, 97, 97, 72, 35]], "output": 194}, {"inputs": [[77, 82, 30, 94]], "output": -1}, {"inputs": [[76, 94, 51, 82, 3, 89, 52, 96]], "output": 190}, {"inputs": [[27, 59, 57, 97, 6, 46, 88, 41, 52, 46]], "output": 156}]}} +{"id": "LeetCode/3000", "content": "# Minimum Absolute Difference Between Elements With Constraint\n\nYou are given a **0-indexed** integer array `nums` and an integer `x`.\n\n\nFind the **minimum absolute difference** between two elements in the array that are at least `x` indices apart.\n\n\nIn other words, find two indices `i` and `j` such that `abs(i - j) >= x` and `abs(nums[i] - nums[j])` is minimized.\n\n\nReturn *an integer denoting the **minimum** absolute difference between two elements that are at least* `x` *indices apart*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [4,3,2,4], x = 2\n**Output:** 0\n**Explanation:** We can select nums[0] = 4 and nums[3] = 4. \nThey are at least 2 indices apart, and their absolute difference is the minimum, 0. \nIt can be shown that 0 is the optimal answer.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,3,2,10,15], x = 1\n**Output:** 1\n**Explanation:** We can select nums[1] = 3 and nums[2] = 2.\nThey are at least 1 index apart, and their absolute difference is the minimum, 1.\nIt can be shown that 1 is the optimal answer.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4], x = 3\n**Output:** 3\n**Explanation:** We can select nums[0] = 1 and nums[3] = 4.\nThey are at least 3 indices apart, and their absolute difference is the minimum, 3.\nIt can be shown that 3 is the optimal answer.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n* `0 <= x < nums.length`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minAbsoluteDifference(self, nums: List[int], x: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minAbsoluteDifference(**[[4, 3, 2, 4], 2]) == 0\nassert my_solution.minAbsoluteDifference(**[[5, 3, 2, 10, 15], 1]) == 1\nassert my_solution.minAbsoluteDifference(**[[1, 2, 3, 4], 3]) == 3\nassert my_solution.minAbsoluteDifference(**[[1, 67], 1]) == 66\nassert my_solution.minAbsoluteDifference(**[[7, 398], 1]) == 391\nassert my_solution.minAbsoluteDifference(**[[12, 141], 1]) == 129\nassert my_solution.minAbsoluteDifference(**[[21, 75], 1]) == 54\nassert my_solution.minAbsoluteDifference(**[[22, 147], 1]) == 125\nassert my_solution.minAbsoluteDifference(**[[25, 197], 1]) == 172\nassert my_solution.minAbsoluteDifference(**[[27, 275], 1]) == 248\nassert my_solution.minAbsoluteDifference(**[[37, 192], 1]) == 155\nassert my_solution.minAbsoluteDifference(**[[41, 163], 1]) == 122\nassert my_solution.minAbsoluteDifference(**[[45, 49], 1]) == 4\nassert my_solution.minAbsoluteDifference(**[[48, 195], 1]) == 147\nassert my_solution.minAbsoluteDifference(**[[68, 68], 1]) == 0\nassert my_solution.minAbsoluteDifference(**[[71, 4], 1]) == 67\nassert my_solution.minAbsoluteDifference(**[[72, 169], 1]) == 97\nassert my_solution.minAbsoluteDifference(**[[74, 62], 1]) == 12\nassert my_solution.minAbsoluteDifference(**[[75, 1], 1]) == 74\nassert my_solution.minAbsoluteDifference(**[[76, 49], 1]) == 27\n"}, "labels": {"questionId": "3000", "questionFrontendId": "2817", "questionTitle": "Minimum Absolute Difference Between Elements With Constraint", "stats": {"totalAccepted": "5.1K", "totalSubmission": "16K", "totalAcceptedRaw": 5075, "totalSubmissionRaw": 15974, "acRate": "31.8%"}, "probedCases": [{"inputs": [[4, 3, 2, 4], 2], "output": 0}, {"inputs": [[5, 3, 2, 10, 15], 1], "output": 1}, {"inputs": [[1, 2, 3, 4], 3], "output": 3}, {"inputs": [[1, 67], 1], "output": 66}, {"inputs": [[7, 398], 1], "output": 391}, {"inputs": [[12, 141], 1], "output": 129}, {"inputs": [[21, 75], 1], "output": 54}, {"inputs": [[22, 147], 1], "output": 125}, {"inputs": [[25, 197], 1], "output": 172}, {"inputs": [[27, 275], 1], "output": 248}, {"inputs": [[37, 192], 1], "output": 155}, {"inputs": [[41, 163], 1], "output": 122}, {"inputs": [[45, 49], 1], "output": 4}, {"inputs": [[48, 195], 1], "output": 147}, {"inputs": [[68, 68], 1], "output": 0}, {"inputs": [[71, 4], 1], "output": 67}, {"inputs": [[72, 169], 1], "output": 97}, {"inputs": [[74, 62], 1], "output": 12}, {"inputs": [[75, 1], 1], "output": 74}, {"inputs": [[76, 49], 1], "output": 27}]}} +{"id": "LeetCode/3001", "content": "# Apply Operations to Maximize Score\n\nYou are given an array `nums` of `n` positive integers and an integer `k`.\n\n\nInitially, you start with a score of `1`. You have to maximize your score by applying the following operation at most `k` times:\n\n\n* Choose any **non-empty** subarray `nums[l, ..., r]` that you haven't chosen previously.\n* Choose an element `x` of `nums[l, ..., r]` with the highest **prime score**. If multiple such elements exist, choose the one with the smallest index.\n* Multiply your score by `x`.\n\n\nHere, `nums[l, ..., r]` denotes the subarray of `nums` starting at index `l` and ending at the index `r`, both ends being inclusive.\n\n\nThe **prime score** of an integer `x` is equal to the number of distinct prime factors of `x`. For example, the prime score of `300` is `3` since `300 = 2 * 2 * 3 * 5 * 5`.\n\n\nReturn *the **maximum possible score** after applying at most* `k` *operations*.\n\n\nSince the answer may be large, return it modulo `109 + 7`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [8,3,9,3,8], k = 2\n**Output:** 81\n**Explanation:** To get a score of 81, we can apply the following operations:\n- Choose subarray nums[2, ..., 2]. nums[2] is the only element in this subarray. Hence, we multiply the score by nums[2]. The score becomes 1 * 9 = 9.\n- Choose subarray nums[2, ..., 3]. Both nums[2] and nums[3] have a prime score of 1, but nums[2] has the smaller index. Hence, we multiply the score by nums[2]. The score becomes 9 * 9 = 81.\nIt can be proven that 81 is the highest score one can obtain.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [19,12,14,6,10,18], k = 3\n**Output:** 4788\n**Explanation:** To get a score of 4788, we can apply the following operations: \n- Choose subarray nums[0, ..., 0]. nums[0] is the only element in this subarray. Hence, we multiply the score by nums[0]. The score becomes 1 * 19 = 19.\n- Choose subarray nums[5, ..., 5]. nums[5] is the only element in this subarray. Hence, we multiply the score by nums[5]. The score becomes 19 * 18 = 342.\n- Choose subarray nums[2, ..., 3]. Both nums[2] and nums[3] have a prime score of 2, but nums[2] has the smaller index. Hence, we multipy the score by nums[2]. The score becomes 342 * 14 = 4788.\nIt can be proven that 4788 is the highest score one can obtain.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length == n <= 105`\n* `1 <= nums[i] <= 105`\n* `1 <= k <= min(n * (n + 1) / 2, 109)`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumScore(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumScore(**[[8, 3, 9, 3, 8], 2]) == 81\nassert my_solution.maximumScore(**[[19, 12, 14, 6, 10, 18], 3]) == 4788\nassert my_solution.maximumScore(**[[3289, 2832, 14858, 22011], 6]) == 256720975\nassert my_solution.maximumScore(**[[1, 7, 11, 1, 5], 14]) == 823751938\nassert my_solution.maximumScore(**[[1, 1, 2, 18, 1, 9, 3, 1], 32]) == 346264255\nassert my_solution.maximumScore(**[[1, 1, 1], 2]) == 1\nassert my_solution.maximumScore(**[[1, 2, 1, 12, 1, 3], 3]) == 1728\nassert my_solution.maximumScore(**[[12, 5, 1, 6, 9, 1, 17, 14], 12]) == 62996359\nassert my_solution.maximumScore(**[[1], 1]) == 1\nassert my_solution.maximumScore(**[[1, 10, 15, 1, 3], 13]) == 499978741\nassert my_solution.maximumScore(**[[6, 1, 13, 10, 1, 17, 6], 27]) == 630596200\nassert my_solution.maximumScore(**[[1, 14], 1]) == 14\nassert my_solution.maximumScore(**[[2, 1, 14, 5, 18, 1, 8, 5], 34]) == 799392504\nassert my_solution.maximumScore(**[[5, 12, 11, 15, 10, 18], 18]) == 557423913\nassert my_solution.maximumScore(**[[4, 1], 3]) == 16\nassert my_solution.maximumScore(**[[1, 2, 5, 1, 10, 1, 1], 20]) == 600000014\nassert my_solution.maximumScore(**[[13, 16, 12, 15, 12, 1, 13, 1, 18, 1], 46]) == 912532739\nassert my_solution.maximumScore(**[[10, 11], 3]) == 1100\nassert my_solution.maximumScore(**[[15, 16, 12, 1, 10, 14], 19]) == 311972352\nassert my_solution.maximumScore(**[[14, 12, 5, 2, 14], 6]) == 7529536\n"}, "labels": {"questionId": "3001", "questionFrontendId": "2818", "questionTitle": "Apply Operations to Maximize Score", "stats": {"totalAccepted": "3.8K", "totalSubmission": "8.2K", "totalAcceptedRaw": 3825, "totalSubmissionRaw": 8220, "acRate": "46.5%"}, "probedCases": [{"inputs": [[8, 3, 9, 3, 8], 2], "output": 81}, {"inputs": [[19, 12, 14, 6, 10, 18], 3], "output": 4788}, {"inputs": [[3289, 2832, 14858, 22011], 6], "output": 256720975}, {"inputs": [[1, 7, 11, 1, 5], 14], "output": 823751938}, {"inputs": [[1, 1, 2, 18, 1, 9, 3, 1], 32], "output": 346264255}, {"inputs": [[1, 1, 1], 2], "output": 1}, {"inputs": [[1, 2, 1, 12, 1, 3], 3], "output": 1728}, {"inputs": [[12, 5, 1, 6, 9, 1, 17, 14], 12], "output": 62996359}, {"inputs": [[1], 1], "output": 1}, {"inputs": [[1, 10, 15, 1, 3], 13], "output": 499978741}, {"inputs": [[6, 1, 13, 10, 1, 17, 6], 27], "output": 630596200}, {"inputs": [[1, 14], 1], "output": 14}, {"inputs": [[2, 1, 14, 5, 18, 1, 8, 5], 34], "output": 799392504}, {"inputs": [[5, 12, 11, 15, 10, 18], 18], "output": 557423913}, {"inputs": [[4, 1], 3], "output": 16}, {"inputs": [[1, 2, 5, 1, 10, 1, 1], 20], "output": 600000014}, {"inputs": [[13, 16, 12, 15, 12, 1, 13, 1, 18, 1], 46], "output": 912532739}, {"inputs": [[10, 11], 3], "output": 1100}, {"inputs": [[15, 16, 12, 1, 10, 14], 19], "output": 311972352}, {"inputs": [[14, 12, 5, 2, 14], 6], "output": 7529536}]}} +{"id": "LeetCode/2886", "content": "# Faulty Keyboard\n\nYour laptop keyboard is faulty, and whenever you type a character `'i'` on it, it reverses the string that you have written. Typing other characters works as expected.\n\n\nYou are given a **0-indexed** string `s`, and you type each character of `s` using your faulty keyboard.\n\n\nReturn *the final string that will be present on your laptop screen.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"string\"\n**Output:** \"rtsng\"\n**Explanation:** \nAfter typing first character, the text on the screen is \"s\".\nAfter the second character, the text is \"st\". \nAfter the third character, the text is \"str\".\nSince the fourth character is an 'i', the text gets reversed and becomes \"rts\".\nAfter the fifth character, the text is \"rtsn\". \nAfter the sixth character, the text is \"rtsng\". \nTherefore, we return \"rtsng\".\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"poiinter\"\n**Output:** \"ponter\"\n**Explanation:** \nAfter the first character, the text on the screen is \"p\".\nAfter the second character, the text is \"po\". \nSince the third character you type is an 'i', the text gets reversed and becomes \"op\". \nSince the fourth character you type is an 'i', the text gets reversed and becomes \"po\".\nAfter the fifth character, the text is \"pon\".\nAfter the sixth character, the text is \"pont\". \nAfter the seventh character, the text is \"ponte\". \nAfter the eighth character, the text is \"ponter\". \nTherefore, we return \"ponter\".\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 100`\n* `s` consists of lowercase English letters.\n* `s[0] != 'i'`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def finalString(self, s: str) -> str:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.finalString(**['string']) == rtsng\nassert my_solution.finalString(**['poiinter']) == ponter\nassert my_solution.finalString(**['goci']) == cog\nassert my_solution.finalString(**['ksi']) == sk\nassert my_solution.finalString(**['fii']) == f\nassert my_solution.finalString(**['qskyviiiii']) == vyksq\nassert my_solution.finalString(**['pft']) == pft\nassert my_solution.finalString(**['viwif']) == wvf\nassert my_solution.finalString(**['wiie']) == we\nassert my_solution.finalString(**['kiis']) == ks\nassert my_solution.finalString(**['xihbosxitx']) == xsobhxtx\nassert my_solution.finalString(**['uwioili']) == lwuo\nassert my_solution.finalString(**['aapziai']) == aaapz\nassert my_solution.finalString(**['pviist']) == pvst\nassert my_solution.finalString(**['miiuiei']) == emu\nassert my_solution.finalString(**['diiiiq']) == dq\nassert my_solution.finalString(**['eirov']) == erov\nassert my_solution.finalString(**['niiiiisiii']) == sn\nassert my_solution.finalString(**['siiuii']) == su\nassert my_solution.finalString(**['piijciivq']) == pjcvq\n"}, "labels": {"questionId": "2886", "questionFrontendId": "2810", "questionTitle": "Faulty Keyboard", "stats": {"totalAccepted": "9.1K", "totalSubmission": "11.1K", "totalAcceptedRaw": 9146, "totalSubmissionRaw": 11110, "acRate": "82.3%"}, "probedCases": [{"inputs": ["string"], "output": "rtsng"}, {"inputs": ["poiinter"], "output": "ponter"}, {"inputs": ["goci"], "output": "cog"}, {"inputs": ["ksi"], "output": "sk"}, {"inputs": ["fii"], "output": "f"}, {"inputs": ["qskyviiiii"], "output": "vyksq"}, {"inputs": ["pft"], "output": "pft"}, {"inputs": ["viwif"], "output": "wvf"}, {"inputs": ["wiie"], "output": "we"}, {"inputs": ["kiis"], "output": "ks"}, {"inputs": ["xihbosxitx"], "output": "xsobhxtx"}, {"inputs": ["uwioili"], "output": "lwuo"}, {"inputs": ["aapziai"], "output": "aaapz"}, {"inputs": ["pviist"], "output": "pvst"}, {"inputs": ["miiuiei"], "output": "emu"}, {"inputs": ["diiiiq"], "output": "dq"}, {"inputs": ["eirov"], "output": "erov"}, {"inputs": ["niiiiisiii"], "output": "sn"}, {"inputs": ["siiuii"], "output": "su"}, {"inputs": ["piijciivq"], "output": "pjcvq"}]}} +{"id": "LeetCode/2916", "content": "# Check if it is Possible to Split Array\n\nYou are given an array `nums` of length `n` and an integer `m`. You need to determine if it is possible to split the array into `n` **non-empty** arrays by performing a series of steps.\n\n\nIn each step, you can select an existing array (which may be the result of previous steps) with a length of **at least two** and split it into **two** subarrays, if, **for each** resulting subarray, **at least** one of the following holds:\n\n\n* The length of the subarray is one, or\n* The sum of elements of the subarray is **greater than or equal** to `m`.\n\n\nReturn `true` *if you can split the given array into* `n` *arrays, otherwise return* `false`.\n\n\n**Note:** A subarray is *a contiguous non-empty sequence of elements within an array*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2, 2, 1], m = 4\n**Output:** true\n**Explanation:** We can split the array into [2, 2] and [1] in the first step. Then, in the second step, we can split [2, 2] into [2] and [2]. As a result, the answer is true.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2, 1, 3], m = 5 \n**Output:** false\n**Explanation:** We can try splitting the array in two different ways: the first way is to have [2, 1] and [3], and the second way is to have [2] and [1, 3]. However, both of these ways are not valid. So, the answer is false.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [2, 3, 3, 2, 3], m = 6\n**Output:** true\n**Explanation:** We can split the array into [2, 3, 3, 2] and [3] in the first step. Then, in the second step, we can split [2, 3, 3, 2] into [2, 3, 3] and [2]. Then, in the third step, we can split [2, 3, 3] into [2] and [3, 3]. And in the last step we can split [3, 3] into [3] and [3]. As a result, the answer is true.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == nums.length <= 100`\n* `1 <= nums[i] <= 100`\n* `1 <= m <= 200`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def canSplitArray(self, nums: List[int], m: int) -> bool:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.canSplitArray(**[[2, 2, 1], 4]) == True\nassert my_solution.canSplitArray(**[[2, 1, 3], 5]) == False\nassert my_solution.canSplitArray(**[[2, 3, 3, 2, 3], 6]) == True\nassert my_solution.canSplitArray(**[[1], 1]) == True\nassert my_solution.canSplitArray(**[[2], 1]) == True\nassert my_solution.canSplitArray(**[[3], 1]) == True\nassert my_solution.canSplitArray(**[[1], 2]) == True\nassert my_solution.canSplitArray(**[[2], 2]) == True\nassert my_solution.canSplitArray(**[[3], 2]) == True\nassert my_solution.canSplitArray(**[[3], 3]) == True\nassert my_solution.canSplitArray(**[[7], 5]) == True\nassert my_solution.canSplitArray(**[[4], 7]) == True\nassert my_solution.canSplitArray(**[[9], 7]) == True\nassert my_solution.canSplitArray(**[[2], 8]) == True\nassert my_solution.canSplitArray(**[[4], 8]) == True\nassert my_solution.canSplitArray(**[[10], 11]) == True\nassert my_solution.canSplitArray(**[[6], 12]) == True\nassert my_solution.canSplitArray(**[[2], 14]) == True\nassert my_solution.canSplitArray(**[[3], 18]) == True\nassert my_solution.canSplitArray(**[[9, 7], 1]) == True\n"}, "labels": {"questionId": "2916", "questionFrontendId": "2811", "questionTitle": "Check if it is Possible to Split Array", "stats": {"totalAccepted": "7K", "totalSubmission": "21.6K", "totalAcceptedRaw": 7044, "totalSubmissionRaw": 21582, "acRate": "32.6%"}, "probedCases": [{"inputs": [[2, 2, 1], 4], "output": true}, {"inputs": [[2, 1, 3], 5], "output": false}, {"inputs": [[2, 3, 3, 2, 3], 6], "output": true}, {"inputs": [[1], 1], "output": true}, {"inputs": [[2], 1], "output": true}, {"inputs": [[3], 1], "output": true}, {"inputs": [[1], 2], "output": true}, {"inputs": [[2], 2], "output": true}, {"inputs": [[3], 2], "output": true}, {"inputs": [[3], 3], "output": true}, {"inputs": [[7], 5], "output": true}, {"inputs": [[4], 7], "output": true}, {"inputs": [[9], 7], "output": true}, {"inputs": [[2], 8], "output": true}, {"inputs": [[4], 8], "output": true}, {"inputs": [[10], 11], "output": true}, {"inputs": [[6], 12], "output": true}, {"inputs": [[2], 14], "output": true}, {"inputs": [[3], 18], "output": true}, {"inputs": [[9, 7], 1], "output": true}]}} +{"id": "LeetCode/2894", "content": "# Maximum Elegance of a K-Length Subsequence\n\nYou are given a **0-indexed** 2D integer array `items` of length `n` and an integer `k`.\n\n\n`items[i] = [profiti, categoryi]`, where `profiti` and `categoryi` denote the profit and category of the `ith` item respectively.\n\n\nLet's define the **elegance** of a **subsequence** of `items` as `total_profit + distinct_categories2`, where `total_profit` is the sum of all profits in the subsequence, and `distinct_categories` is the number of **distinct** categories from all the categories in the selected subsequence.\n\n\nYour task is to find the **maximum elegance** from all subsequences of size `k` in `items`.\n\n\nReturn *an integer denoting the maximum elegance of a subsequence of* `items` *with size exactly* `k`.\n\n\n**Note:** 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.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** items = [[3,2],[5,1],[10,1]], k = 2\n**Output:** 17\n**Explanation:** In this example, we have to select a subsequence of size 2.\nWe can select items[0] = [3,2] and items[2] = [10,1].\nThe total profit in this subsequence is 3 + 10 = 13, and the subsequence contains 2 distinct categories [2,1].\nHence, the elegance is 13 + 22 = 17, and we can show that it is the maximum achievable elegance. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** items = [[3,1],[3,1],[2,2],[5,3]], k = 3\n**Output:** 19\n**Explanation:** In this example, we have to select a subsequence of size 3. \nWe can select items[0] = [3,1], items[2] = [2,2], and items[3] = [5,3]. \nThe total profit in this subsequence is 3 + 2 + 5 = 10, and the subsequence contains 3 distinct categories [1,2,3]. \nHence, the elegance is 10 + 32 = 19, and we can show that it is the maximum achievable elegance.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** items = [[1,1],[2,1],[3,1]], k = 3\n**Output:** 7\n**Explanation:** In this example, we have to select a subsequence of size 3. \nWe should select all the items. \nThe total profit will be 1 + 2 + 3 = 6, and the subsequence contains 1 distinct category [1]. \nHence, the maximum elegance is 6 + 12 = 7. \n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= items.length == n <= 105`\n* `items[i].length == 2`\n* `items[i][0] == profiti`\n* `items[i][1] == categoryi`\n* `1 <= profiti <= 109`\n* `1 <= categoryi <= n`\n* `1 <= k <= n`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findMaximumElegance(self, items: List[List[int]], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findMaximumElegance(**[[[3, 2], [5, 1], [10, 1]], 2]) == 17\nassert my_solution.findMaximumElegance(**[[[3, 1], [3, 1], [2, 2], [5, 3]], 3]) == 19\nassert my_solution.findMaximumElegance(**[[[1, 1], [2, 1], [3, 1]], 3]) == 7\nassert my_solution.findMaximumElegance(**[[[1, 1], [1, 2]], 2]) == 6\nassert my_solution.findMaximumElegance(**[[[1, 1], [4, 1]], 1]) == 5\nassert my_solution.findMaximumElegance(**[[[1, 1], [4, 1]], 2]) == 6\nassert my_solution.findMaximumElegance(**[[[1, 1], [6, 1]], 1]) == 7\nassert my_solution.findMaximumElegance(**[[[1, 1], [6, 1]], 2]) == 8\nassert my_solution.findMaximumElegance(**[[[1, 1], [8, 2]], 2]) == 13\nassert my_solution.findMaximumElegance(**[[[1, 2], [6, 2]], 1]) == 7\nassert my_solution.findMaximumElegance(**[[[1, 2], [10, 1]], 1]) == 11\nassert my_solution.findMaximumElegance(**[[[2, 1], [6, 1]], 2]) == 9\nassert my_solution.findMaximumElegance(**[[[2, 1], [7, 1]], 2]) == 10\nassert my_solution.findMaximumElegance(**[[[2, 1], [9, 2]], 1]) == 10\nassert my_solution.findMaximumElegance(**[[[2, 2], [2, 2]], 1]) == 3\nassert my_solution.findMaximumElegance(**[[[2, 2], [2, 2]], 2]) == 5\nassert my_solution.findMaximumElegance(**[[[2, 2], [3, 1]], 2]) == 9\nassert my_solution.findMaximumElegance(**[[[2, 2], [6, 1]], 2]) == 12\nassert my_solution.findMaximumElegance(**[[[3, 1], [1, 2]], 2]) == 8\nassert my_solution.findMaximumElegance(**[[[3, 1], [9, 1]], 2]) == 13\n"}, "labels": {"questionId": "2894", "questionFrontendId": "2813", "questionTitle": "Maximum Elegance of a K-Length Subsequence", "stats": {"totalAccepted": "2.4K", "totalSubmission": "5.9K", "totalAcceptedRaw": 2415, "totalSubmissionRaw": 5872, "acRate": "41.1%"}, "probedCases": [{"inputs": [[[3, 2], [5, 1], [10, 1]], 2], "output": 17}, {"inputs": [[[3, 1], [3, 1], [2, 2], [5, 3]], 3], "output": 19}, {"inputs": [[[1, 1], [2, 1], [3, 1]], 3], "output": 7}, {"inputs": [[[1, 1], [1, 2]], 2], "output": 6}, {"inputs": [[[1, 1], [4, 1]], 1], "output": 5}, {"inputs": [[[1, 1], [4, 1]], 2], "output": 6}, {"inputs": [[[1, 1], [6, 1]], 1], "output": 7}, {"inputs": [[[1, 1], [6, 1]], 2], "output": 8}, {"inputs": [[[1, 1], [8, 2]], 2], "output": 13}, {"inputs": [[[1, 2], [6, 2]], 1], "output": 7}, {"inputs": [[[1, 2], [10, 1]], 1], "output": 11}, {"inputs": [[[2, 1], [6, 1]], 2], "output": 9}, {"inputs": [[[2, 1], [7, 1]], 2], "output": 10}, {"inputs": [[[2, 1], [9, 2]], 1], "output": 10}, {"inputs": [[[2, 2], [2, 2]], 1], "output": 3}, {"inputs": [[[2, 2], [2, 2]], 2], "output": 5}, {"inputs": [[[2, 2], [3, 1]], 2], "output": 9}, {"inputs": [[[2, 2], [6, 1]], 2], "output": 12}, {"inputs": [[[3, 1], [1, 2]], 2], "output": 8}, {"inputs": [[[3, 1], [9, 1]], 2], "output": 13}]}} +{"id": "LeetCode/2955", "content": "# Account Balance After Rounded Purchase\n\nInitially, you have a bank account balance of `100` dollars.\n\n\nYou are given an integer `purchaseAmount` representing the amount you will spend on a purchase in dollars.\n\n\nAt the store where you will make the purchase, the purchase amount is rounded to the **nearest multiple** of `10`. In other words, you pay a **non-negative** amount, `roundedAmount`, such that `roundedAmount` is a multiple of `10` and `abs(roundedAmount - purchaseAmount)` is **minimized**.\n\n\nIf there is more than one nearest multiple of `10`, the **largest multiple** is chosen.\n\n\nReturn *an integer denoting your account balance after making a purchase worth* `purchaseAmount` *dollars from the store.*\n\n\n**Note:** `0` is considered to be a multiple of `10` in this problem.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** purchaseAmount = 9\n**Output:** 90\n**Explanation:** In this example, the nearest multiple of 10 to 9 is 10. Hence, your account balance becomes 100 - 10 = 90.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** purchaseAmount = 15\n**Output:** 80\n**Explanation:** In this example, there are two nearest multiples of 10 to 15: 10 and 20. So, the larger multiple, 20, is chosen.\nHence, your account balance becomes 100 - 20 = 80.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `0 <= purchaseAmount <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def accountBalanceAfterPurchase(self, purchaseAmount: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.accountBalanceAfterPurchase(**[9]) == 90\nassert my_solution.accountBalanceAfterPurchase(**[15]) == 80\nassert my_solution.accountBalanceAfterPurchase(**[10]) == 90\nassert my_solution.accountBalanceAfterPurchase(**[11]) == 90\nassert my_solution.accountBalanceAfterPurchase(**[12]) == 90\nassert my_solution.accountBalanceAfterPurchase(**[13]) == 90\nassert my_solution.accountBalanceAfterPurchase(**[14]) == 90\nassert my_solution.accountBalanceAfterPurchase(**[16]) == 80\nassert my_solution.accountBalanceAfterPurchase(**[17]) == 80\nassert my_solution.accountBalanceAfterPurchase(**[18]) == 80\nassert my_solution.accountBalanceAfterPurchase(**[19]) == 80\nassert my_solution.accountBalanceAfterPurchase(**[1]) == 100\nassert my_solution.accountBalanceAfterPurchase(**[2]) == 100\nassert my_solution.accountBalanceAfterPurchase(**[3]) == 100\nassert my_solution.accountBalanceAfterPurchase(**[4]) == 100\nassert my_solution.accountBalanceAfterPurchase(**[5]) == 90\nassert my_solution.accountBalanceAfterPurchase(**[6]) == 90\nassert my_solution.accountBalanceAfterPurchase(**[7]) == 90\nassert my_solution.accountBalanceAfterPurchase(**[8]) == 90\nassert my_solution.accountBalanceAfterPurchase(**[20]) == 80\n"}, "labels": {"questionId": "2955", "questionFrontendId": "2806", "questionTitle": "Account Balance After Rounded Purchase", "stats": {"totalAccepted": "4.7K", "totalSubmission": "7.5K", "totalAcceptedRaw": 4681, "totalSubmissionRaw": 7508, "acRate": "62.3%"}, "probedCases": [{"inputs": [9], "output": 90}, {"inputs": [15], "output": 80}, {"inputs": [10], "output": 90}, {"inputs": [11], "output": 90}, {"inputs": [12], "output": 90}, {"inputs": [13], "output": 90}, {"inputs": [14], "output": 90}, {"inputs": [16], "output": 80}, {"inputs": [17], "output": 80}, {"inputs": [18], "output": 80}, {"inputs": [19], "output": 80}, {"inputs": [1], "output": 100}, {"inputs": [2], "output": 100}, {"inputs": [3], "output": 100}, {"inputs": [4], "output": 100}, {"inputs": [5], "output": 90}, {"inputs": [6], "output": 90}, {"inputs": [7], "output": 90}, {"inputs": [8], "output": 90}, {"inputs": [20], "output": 80}]}} +{"id": "LeetCode/2920", "content": "# Minimum Seconds to Equalize a Circular Array\n\nYou are given a **0-indexed** array `nums` containing `n` integers.\n\n\nAt each second, you perform the following operation on the array:\n\n\n* For every index `i` in the range `[0, n - 1]`, replace `nums[i]` with either `nums[i]`, `nums[(i - 1 + n) % n]`, or `nums[(i + 1) % n]`.\n\n\n**Note** that all the elements get replaced simultaneously.\n\n\nReturn *the **minimum** number of seconds needed to make all elements in the array* `nums` *equal*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,1,2]\n**Output:** 1\n**Explanation:** We can equalize the array in 1 second in the following way:\n- At 1st second, replace values at each index with [nums[3],nums[1],nums[3],nums[3]]. After replacement, nums = [2,2,2,2].\nIt can be proven that 1 second is the minimum amount of seconds needed for equalizing the array.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,1,3,3,2]\n**Output:** 2\n**Explanation:** We can equalize the array in 2 seconds in the following way:\n- At 1st second, replace values at each index with [nums[0],nums[2],nums[2],nums[2],nums[3]]. After replacement, nums = [2,3,3,3,3].\n- At 2nd second, replace values at each index with [nums[1],nums[1],nums[2],nums[3],nums[4]]. After replacement, nums = [3,3,3,3,3].\nIt can be proven that 2 seconds is the minimum amount of seconds needed for equalizing the array.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [5,5,5,5]\n**Output:** 0\n**Explanation:** We don't need to perform any operations as all elements in the initial array are the same.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumSeconds(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumSeconds(**[[1, 2, 1, 2]]) == 1\nassert my_solution.minimumSeconds(**[[2, 1, 3, 3, 2]]) == 2\nassert my_solution.minimumSeconds(**[[5, 5, 5, 5]]) == 0\nassert my_solution.minimumSeconds(**[[4, 18]]) == 1\nassert my_solution.minimumSeconds(**[[11, 7]]) == 1\nassert my_solution.minimumSeconds(**[[14, 2]]) == 1\nassert my_solution.minimumSeconds(**[[14, 9]]) == 1\nassert my_solution.minimumSeconds(**[[20, 1]]) == 1\nassert my_solution.minimumSeconds(**[[17, 15]]) == 1\nassert my_solution.minimumSeconds(**[[11, 13]]) == 1\nassert my_solution.minimumSeconds(**[[7, 13]]) == 1\nassert my_solution.minimumSeconds(**[[18, 17]]) == 1\nassert my_solution.minimumSeconds(**[[15, 17]]) == 1\nassert my_solution.minimumSeconds(**[[13, 8]]) == 1\nassert my_solution.minimumSeconds(**[[12, 16]]) == 1\nassert my_solution.minimumSeconds(**[[12, 8]]) == 1\nassert my_solution.minimumSeconds(**[[18, 16]]) == 1\nassert my_solution.minimumSeconds(**[[16, 16]]) == 0\nassert my_solution.minimumSeconds(**[[6, 12]]) == 1\nassert my_solution.minimumSeconds(**[[9, 6]]) == 1\n"}, "labels": {"questionId": "2920", "questionFrontendId": "2808", "questionTitle": "Minimum Seconds to Equalize a Circular Array", "stats": {"totalAccepted": "3.2K", "totalSubmission": "8.7K", "totalAcceptedRaw": 3192, "totalSubmissionRaw": 8676, "acRate": "36.8%"}, "probedCases": [{"inputs": [[1, 2, 1, 2]], "output": 1}, {"inputs": [[2, 1, 3, 3, 2]], "output": 2}, {"inputs": [[5, 5, 5, 5]], "output": 0}, {"inputs": [[4, 18]], "output": 1}, {"inputs": [[11, 7]], "output": 1}, {"inputs": [[14, 2]], "output": 1}, {"inputs": [[14, 9]], "output": 1}, {"inputs": [[20, 1]], "output": 1}, {"inputs": [[17, 15]], "output": 1}, {"inputs": [[11, 13]], "output": 1}, {"inputs": [[7, 13]], "output": 1}, {"inputs": [[18, 17]], "output": 1}, {"inputs": [[15, 17]], "output": 1}, {"inputs": [[13, 8]], "output": 1}, {"inputs": [[12, 16]], "output": 1}, {"inputs": [[12, 8]], "output": 1}, {"inputs": [[18, 16]], "output": 1}, {"inputs": [[16, 16]], "output": 0}, {"inputs": [[6, 12]], "output": 1}, {"inputs": [[9, 6]], "output": 1}]}} +{"id": "LeetCode/2952", "content": "# Minimum Time to Make Array Sum At Most x\n\nYou are given two **0-indexed** integer arrays `nums1` and `nums2` of equal length. Every second, for all indices `0 <= i < nums1.length`, value of `nums1[i]` is incremented by `nums2[i]`. **After** this is done, you can do the following operation:\n\n\n* Choose an index `0 <= i < nums1.length` and make `nums1[i] = 0`.\n\n\nYou are also given an integer `x`.\n\n\nReturn *the **minimum** time in which you can make the sum of all elements of* `nums1` *to be **less than or equal** to* `x`, *or* `-1` *if this is not possible.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums1 = [1,2,3], nums2 = [1,2,3], x = 4\n**Output:** 3\n**Explanation:** \nFor the 1st second, we apply the operation on i = 0. Therefore nums1 = [0,2+2,3+3] = [0,4,6]. \nFor the 2nd second, we apply the operation on i = 1. Therefore nums1 = [0+1,0,6+3] = [1,0,9]. \nFor the 3rd second, we apply the operation on i = 2. Therefore nums1 = [1+1,0+2,0] = [2,2,0]. \nNow sum of nums1 = 4. It can be shown that these operations are optimal, so we return 3.\n\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums1 = [1,2,3], nums2 = [3,3,3], x = 4\n**Output:** -1\n**Explanation:** It can be shown that the sum of nums1 will always be greater than x, no matter which operations are performed.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums1.length <= 103`\n* `1 <= nums1[i] <= 103`\n* `0 <= nums2[i] <= 103`\n* `nums1.length == nums2.length`\n* `0 <= x <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumTime(self, nums1: List[int], nums2: List[int], x: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumTime(**[[1, 2, 3], [1, 2, 3], 4]) == 3\nassert my_solution.minimumTime(**[[1, 2, 3], [3, 3, 3], 4]) == -1\nassert my_solution.minimumTime(**[[4, 4, 9, 10], [4, 4, 1, 3], 16]) == 4\nassert my_solution.minimumTime(**[[5, 3], [3, 2], 4]) == 2\nassert my_solution.minimumTime(**[[4, 5, 3, 2, 3, 9, 5, 7, 10, 4], [4, 4, 0, 4, 1, 2, 4, 0, 4, 0], 47]) == -1\nassert my_solution.minimumTime(**[[7, 9, 8, 5, 8, 3], [0, 1, 4, 2, 3, 1], 37]) == 2\nassert my_solution.minimumTime(**[[8, 2, 3], [1, 4, 2], 13]) == 0\nassert my_solution.minimumTime(**[[4, 7, 2, 3, 4, 3, 10, 8], [3, 4, 0, 1, 1, 0, 2, 2], 36]) == 4\nassert my_solution.minimumTime(**[[2, 10, 10, 4, 6, 3], [1, 0, 0, 1, 3, 1], 35]) == 0\nassert my_solution.minimumTime(**[[9, 5, 3], [4, 1, 3], 17]) == 0\nassert my_solution.minimumTime(**[[1, 7, 9, 4, 8, 8, 1], [2, 2, 3, 2, 0, 1, 0], 20]) == 6\nassert my_solution.minimumTime(**[[9, 2, 8, 3, 1, 9, 7, 6], [0, 3, 4, 1, 3, 4, 2, 1], 40]) == 8\nassert my_solution.minimumTime(**[[10], [3], 10]) == 0\nassert my_solution.minimumTime(**[[7, 6, 8, 2, 8, 9, 3, 3], [2, 2, 4, 0, 0, 2, 2, 3], 45]) == 5\nassert my_solution.minimumTime(**[[4, 9, 5, 2, 3], [4, 2, 0, 4, 0], 18]) == 3\nassert my_solution.minimumTime(**[[2, 10, 2, 7, 8, 9, 7, 6, 6], [4, 2, 1, 4, 3, 2, 4, 4, 4], 55]) == -1\nassert my_solution.minimumTime(**[[6, 8, 10, 7, 10, 9], [4, 2, 0, 4, 4, 2], 38]) == 5\nassert my_solution.minimumTime(**[[9, 2, 8, 5, 8, 3, 5, 2, 2], [4, 3, 4, 2, 0, 1, 4, 4, 2], 41]) == -1\nassert my_solution.minimumTime(**[[5, 3, 2, 3, 10, 4, 7, 9, 1, 10], [2, 0, 2, 0, 3, 3, 4, 4, 0, 1], 30]) == -1\nassert my_solution.minimumTime(**[[2, 3, 5], [0, 0, 1], 8]) == 1\n"}, "labels": {"questionId": "2952", "questionFrontendId": "2809", "questionTitle": "Minimum Time to Make Array Sum At Most x", "stats": {"totalAccepted": "10.8K", "totalSubmission": "17.4K", "totalAcceptedRaw": 10761, "totalSubmissionRaw": 17396, "acRate": "61.9%"}, "probedCases": [{"inputs": [[1, 2, 3], [1, 2, 3], 4], "output": 3}, {"inputs": [[1, 2, 3], [3, 3, 3], 4], "output": -1}, {"inputs": [[4, 4, 9, 10], [4, 4, 1, 3], 16], "output": 4}, {"inputs": [[5, 3], [3, 2], 4], "output": 2}, {"inputs": [[4, 5, 3, 2, 3, 9, 5, 7, 10, 4], [4, 4, 0, 4, 1, 2, 4, 0, 4, 0], 47], "output": -1}, {"inputs": [[7, 9, 8, 5, 8, 3], [0, 1, 4, 2, 3, 1], 37], "output": 2}, {"inputs": [[8, 2, 3], [1, 4, 2], 13], "output": 0}, {"inputs": [[4, 7, 2, 3, 4, 3, 10, 8], [3, 4, 0, 1, 1, 0, 2, 2], 36], "output": 4}, {"inputs": [[2, 10, 10, 4, 6, 3], [1, 0, 0, 1, 3, 1], 35], "output": 0}, {"inputs": [[9, 5, 3], [4, 1, 3], 17], "output": 0}, {"inputs": [[1, 7, 9, 4, 8, 8, 1], [2, 2, 3, 2, 0, 1, 0], 20], "output": 6}, {"inputs": [[9, 2, 8, 3, 1, 9, 7, 6], [0, 3, 4, 1, 3, 4, 2, 1], 40], "output": 8}, {"inputs": [[10], [3], 10], "output": 0}, {"inputs": [[7, 6, 8, 2, 8, 9, 3, 3], [2, 2, 4, 0, 0, 2, 2, 3], 45], "output": 5}, {"inputs": [[4, 9, 5, 2, 3], [4, 2, 0, 4, 0], 18], "output": 3}, {"inputs": [[2, 10, 2, 7, 8, 9, 7, 6, 6], [4, 2, 1, 4, 3, 2, 4, 4, 4], 55], "output": -1}, {"inputs": [[6, 8, 10, 7, 10, 9], [4, 2, 0, 4, 4, 2], 38], "output": 5}, {"inputs": [[9, 2, 8, 5, 8, 3, 5, 2, 2], [4, 3, 4, 2, 0, 1, 4, 4, 2], 41], "output": -1}, {"inputs": [[5, 3, 2, 3, 10, 4, 7, 9, 1, 10], [2, 0, 2, 0, 3, 3, 4, 4, 0, 1], 30], "output": -1}, {"inputs": [[2, 3, 5], [0, 0, 1], 8], "output": 1}]}} +{"id": "LeetCode/2876", "content": "# Number of Employees Who Met the Target\n\nThere are `n` employees in a company, numbered from `0` to `n - 1`. Each employee `i` has worked for `hours[i]` hours in the company.\n\n\nThe company requires each employee to work for **at least** `target` hours.\n\n\nYou are given a **0-indexed** array of non-negative integers `hours` of length `n` and a non-negative integer `target`.\n\n\nReturn *the integer denoting the number of employees who worked at least* `target` *hours*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** hours = [0,1,2,3,4], target = 2\n**Output:** 3\n**Explanation:** The company wants each employee to work for at least 2 hours.\n- Employee 0 worked for 0 hours and didn't meet the target.\n- Employee 1 worked for 1 hours and didn't meet the target.\n- Employee 2 worked for 2 hours and met the target.\n- Employee 3 worked for 3 hours and met the target.\n- Employee 4 worked for 4 hours and met the target.\nThere are 3 employees who met the target.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** hours = [5,1,4,2,2], target = 6\n**Output:** 0\n**Explanation:** The company wants each employee to work for at least 6 hours.\nThere are 0 employees who met the target.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == hours.length <= 50`\n* `0 <= hours[i], target <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def numberOfEmployeesWhoMetTarget(self, hours: List[int], target: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[0, 1, 2, 3, 4], 2]) == 3\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[5, 1, 4, 2, 2], 6]) == 0\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[98], 5]) == 1\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[19], 13]) == 1\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[70], 13]) == 1\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[26], 14]) == 1\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[2], 16]) == 0\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[77], 19]) == 1\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[6], 21]) == 0\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[27], 21]) == 1\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[36], 22]) == 1\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[42], 25]) == 1\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[70], 27]) == 1\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[2], 28]) == 0\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[14], 31]) == 0\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[45], 34]) == 1\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[44], 35]) == 1\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[11], 39]) == 0\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[71], 39]) == 1\nassert my_solution.numberOfEmployeesWhoMetTarget(**[[91], 45]) == 1\n"}, "labels": {"questionId": "2876", "questionFrontendId": "2798", "questionTitle": "Number of Employees Who Met the Target", "stats": {"totalAccepted": "10.2K", "totalSubmission": "11.9K", "totalAcceptedRaw": 10171, "totalSubmissionRaw": 11950, "acRate": "85.1%"}, "probedCases": [{"inputs": [[0, 1, 2, 3, 4], 2], "output": 3}, {"inputs": [[5, 1, 4, 2, 2], 6], "output": 0}, {"inputs": [[98], 5], "output": 1}, {"inputs": [[19], 13], "output": 1}, {"inputs": [[70], 13], "output": 1}, {"inputs": [[26], 14], "output": 1}, {"inputs": [[2], 16], "output": 0}, {"inputs": [[77], 19], "output": 1}, {"inputs": [[6], 21], "output": 0}, {"inputs": [[27], 21], "output": 1}, {"inputs": [[36], 22], "output": 1}, {"inputs": [[42], 25], "output": 1}, {"inputs": [[70], 27], "output": 1}, {"inputs": [[2], 28], "output": 0}, {"inputs": [[14], 31], "output": 0}, {"inputs": [[45], 34], "output": 1}, {"inputs": [[44], 35], "output": 1}, {"inputs": [[11], 39], "output": 0}, {"inputs": [[71], 39], "output": 1}, {"inputs": [[91], 45], "output": 1}]}} +{"id": "LeetCode/2856", "content": "# Count Complete Subarrays in an Array\n\nYou are given an array `nums` consisting of **positive** integers.\n\n\nWe call a subarray of an array **complete** if the following condition is satisfied:\n\n\n* The number of **distinct** elements in the subarray is equal to the number of distinct elements in the whole array.\n\n\nReturn *the number of **complete** subarrays*.\n\n\nA **subarray** is a contiguous non-empty part of an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,3,1,2,2]\n**Output:** 4\n**Explanation:** The complete subarrays are the following: [1,3,1,2], [1,3,1,2,2], [3,1,2] and [3,1,2,2].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,5,5,5]\n**Output:** 10\n**Explanation:** The array consists only of the integer 5, so any subarray is complete. The number of subarrays that we can choose is 10.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 1000`\n* `1 <= nums[i] <= 2000`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countCompleteSubarrays(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countCompleteSubarrays(**[[1, 3, 1, 2, 2]]) == 4\nassert my_solution.countCompleteSubarrays(**[[5, 5, 5, 5]]) == 10\nassert my_solution.countCompleteSubarrays(**[[459, 459, 962, 1579, 1435, 756, 1872, 1597]]) == 2\nassert my_solution.countCompleteSubarrays(**[[1786, 1786, 1786, 114]]) == 3\nassert my_solution.countCompleteSubarrays(**[[1632, 1632, 528, 359, 1671, 1632, 511, 1087, 424, 1684]]) == 3\nassert my_solution.countCompleteSubarrays(**[[1430, 12, 1430, 1075, 1722]]) == 2\nassert my_solution.countCompleteSubarrays(**[[1917, 1917, 608, 608, 1313, 751, 558, 1561, 608]]) == 4\nassert my_solution.countCompleteSubarrays(**[[254, 1690, 1690, 1068, 1779]]) == 1\nassert my_solution.countCompleteSubarrays(**[[1116]]) == 1\nassert my_solution.countCompleteSubarrays(**[[1677, 1677, 1352, 1219, 1666, 1677, 1892, 1892, 319]]) == 3\nassert my_solution.countCompleteSubarrays(**[[1386, 1997, 1997, 574, 574, 1360, 989]]) == 1\nassert my_solution.countCompleteSubarrays(**[[50, 48, 1118, 540, 1248, 1984, 1698, 41, 1984, 186]]) == 1\nassert my_solution.countCompleteSubarrays(**[[273, 524, 40, 1323, 1323]]) == 2\nassert my_solution.countCompleteSubarrays(**[[246, 376, 828, 191, 1942, 210]]) == 1\nassert my_solution.countCompleteSubarrays(**[[463, 1497, 1676, 127, 1379, 17, 1075, 190]]) == 1\nassert my_solution.countCompleteSubarrays(**[[765, 1370]]) == 1\nassert my_solution.countCompleteSubarrays(**[[1110, 804, 1110, 839, 728, 839]]) == 4\nassert my_solution.countCompleteSubarrays(**[[1001]]) == 1\nassert my_solution.countCompleteSubarrays(**[[665, 867, 954, 1411, 728, 1006, 372, 1411]]) == 2\nassert my_solution.countCompleteSubarrays(**[[1213, 1203, 1277, 369, 1277]]) == 2\n"}, "labels": {"questionId": "2856", "questionFrontendId": "2799", "questionTitle": "Count Complete Subarrays in an Array", "stats": {"totalAccepted": "7.4K", "totalSubmission": "12.6K", "totalAcceptedRaw": 7372, "totalSubmissionRaw": 12634, "acRate": "58.4%"}, "probedCases": [{"inputs": [[1, 3, 1, 2, 2]], "output": 4}, {"inputs": [[5, 5, 5, 5]], "output": 10}, {"inputs": [[459, 459, 962, 1579, 1435, 756, 1872, 1597]], "output": 2}, {"inputs": [[1786, 1786, 1786, 114]], "output": 3}, {"inputs": [[1632, 1632, 528, 359, 1671, 1632, 511, 1087, 424, 1684]], "output": 3}, {"inputs": [[1430, 12, 1430, 1075, 1722]], "output": 2}, {"inputs": [[1917, 1917, 608, 608, 1313, 751, 558, 1561, 608]], "output": 4}, {"inputs": [[254, 1690, 1690, 1068, 1779]], "output": 1}, {"inputs": [[1116]], "output": 1}, {"inputs": [[1677, 1677, 1352, 1219, 1666, 1677, 1892, 1892, 319]], "output": 3}, {"inputs": [[1386, 1997, 1997, 574, 574, 1360, 989]], "output": 1}, {"inputs": [[50, 48, 1118, 540, 1248, 1984, 1698, 41, 1984, 186]], "output": 1}, {"inputs": [[273, 524, 40, 1323, 1323]], "output": 2}, {"inputs": [[246, 376, 828, 191, 1942, 210]], "output": 1}, {"inputs": [[463, 1497, 1676, 127, 1379, 17, 1075, 190]], "output": 1}, {"inputs": [[765, 1370]], "output": 1}, {"inputs": [[1110, 804, 1110, 839, 728, 839]], "output": 4}, {"inputs": [[1001]], "output": 1}, {"inputs": [[665, 867, 954, 1411, 728, 1006, 372, 1411]], "output": 2}, {"inputs": [[1213, 1203, 1277, 369, 1277]], "output": 2}]}} +{"id": "LeetCode/2877", "content": "# Shortest String That Contains Three Strings\n\nGiven three strings `a`, `b`, and `c`, your task is to find a string that has the **minimum** length and contains all three strings as **substrings**.\nIf there are multiple such strings, return the**lexicographicallysmallest** one.\n\n\nReturn *a string denoting the answer to the problem.*\n\n\n**Notes**\n\n\n* A string `a` is **lexicographically smaller** than a string `b` (of the same length) if in the first position where `a` and `b` differ, string `a` has a letter that appears **earlier** in the alphabet than the corresponding letter in `b`.\n* A **substring** is a contiguous sequence of characters within a string.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** a = \"abc\", b = \"bca\", c = \"aaa\"\n**Output:** \"aaabca\"\n**Explanation:** We show that \"aaabca\" contains all the given strings: a = ans[2...4], b = ans[3..5], c = ans[0..2]. It can be shown that the length of the resulting string would be at least 6 and \"aaabca\" is the lexicographically smallest one.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** a = \"ab\", b = \"ba\", c = \"aba\"\n**Output:** \"aba\"\n**Explanation:** We show that the string \"aba\" contains all the given strings: a = ans[0..1], b = ans[1..2], c = ans[0..2]. Since the length of c is 3, the length of the resulting string would be at least 3. It can be shown that \"aba\" is the lexicographically smallest one.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= a.length, b.length, c.length <= 100`\n* `a`, `b`, `c` consist only of lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumString(self, a: str, b: str, c: str) -> str:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumString(**['abc', 'bca', 'aaa']) == aaabca\nassert my_solution.minimumString(**['ab', 'ba', 'aba']) == aba\nassert my_solution.minimumString(**['xyyyz', 'xzyz', 'zzz']) == xyyyzxzyzzz\nassert my_solution.minimumString(**['a', 'a', 'a']) == a\nassert my_solution.minimumString(**['a', 'a', 'b']) == ab\nassert my_solution.minimumString(**['a', 'c', 'a']) == ac\nassert my_solution.minimumString(**['a', 'b', 'b']) == ab\nassert my_solution.minimumString(**['a', 'a', 'c']) == ac\nassert my_solution.minimumString(**['a', 'c', 'b']) == abc\nassert my_solution.minimumString(**['c', 'c', 'a']) == ac\nassert my_solution.minimumString(**['k', 'e', 'a']) == aek\nassert my_solution.minimumString(**['a', 'b', 'a']) == ab\nassert my_solution.minimumString(**['b', 'b', 'a']) == ab\nassert my_solution.minimumString(**['b', 'b', 'b']) == b\nassert my_solution.minimumString(**['b', 'b', 'c']) == bc\nassert my_solution.minimumString(**['c', 'b', 'b']) == bc\nassert my_solution.minimumString(**['b', 'c', 'c']) == bc\nassert my_solution.minimumString(**['b', 'c', 'a']) == abc\nassert my_solution.minimumString(**['c', 'a', 'c']) == ac\nassert my_solution.minimumString(**['c', 'b', 'c']) == bc\n"}, "labels": {"questionId": "2877", "questionFrontendId": "2800", "questionTitle": "Shortest String That Contains Three Strings", "stats": {"totalAccepted": "4.6K", "totalSubmission": "13.2K", "totalAcceptedRaw": 4622, "totalSubmissionRaw": 13225, "acRate": "34.9%"}, "probedCases": [{"inputs": ["abc", "bca", "aaa"], "output": "aaabca"}, {"inputs": ["ab", "ba", "aba"], "output": "aba"}, {"inputs": ["xyyyz", "xzyz", "zzz"], "output": "xyyyzxzyzzz"}, {"inputs": ["a", "a", "a"], "output": "a"}, {"inputs": ["a", "a", "b"], "output": "ab"}, {"inputs": ["a", "c", "a"], "output": "ac"}, {"inputs": ["a", "b", "b"], "output": "ab"}, {"inputs": ["a", "a", "c"], "output": "ac"}, {"inputs": ["a", "c", "b"], "output": "abc"}, {"inputs": ["c", "c", "a"], "output": "ac"}, {"inputs": ["k", "e", "a"], "output": "aek"}, {"inputs": ["a", "b", "a"], "output": "ab"}, {"inputs": ["b", "b", "a"], "output": "ab"}, {"inputs": ["b", "b", "b"], "output": "b"}, {"inputs": ["b", "b", "c"], "output": "bc"}, {"inputs": ["c", "b", "b"], "output": "bc"}, {"inputs": ["b", "c", "c"], "output": "bc"}, {"inputs": ["b", "c", "a"], "output": "abc"}, {"inputs": ["c", "a", "c"], "output": "ac"}, {"inputs": ["c", "b", "c"], "output": "bc"}]}} +{"id": "LeetCode/2921", "content": "# Count Stepping Numbers in Range\n\nGiven two positive integers `low` and `high` represented as strings, find the count of **stepping numbers** in the inclusive range `[low, high]`.\n\n\nA **stepping number** is an integer such that all of its adjacent digits have an absolute difference of **exactly** `1`.\n\n\nReturn *an integer denoting the count of stepping numbers in the inclusive range* `[low, high]`*.* \n\n\nSince the answer may be very large, return it **modulo** `109 + 7`.\n\n\n**Note:** A stepping number should not have a leading zero.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** low = \"1\", high = \"11\"\n**Output:** 10\n**Explanation:** The stepping numbers in the range [1,11] are 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10. There are a total of 10 stepping numbers in the range. Hence, the output is 10.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** low = \"90\", high = \"101\"\n**Output:** 2\n**Explanation:** The stepping numbers in the range [90,101] are 98 and 101. There are a total of 2 stepping numbers in the range. Hence, the output is 2. \n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= int(low) <= int(high) < 10100`\n* `1 <= low.length, high.length <= 100`\n* `low` and `high` consist of only digits.\n* `low` and `high` don't have any leading zeros.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countSteppingNumbers(self, low: str, high: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countSteppingNumbers(**['1', '11']) == 10\nassert my_solution.countSteppingNumbers(**['90', '101']) == 2\nassert my_solution.countSteppingNumbers(**['2', '40']) == 14\nassert my_solution.countSteppingNumbers(**['26', '60']) == 6\nassert my_solution.countSteppingNumbers(**['40', '70']) == 6\nassert my_solution.countSteppingNumbers(**['46', '66']) == 3\nassert my_solution.countSteppingNumbers(**['58', '58']) == 0\nassert my_solution.countSteppingNumbers(**['23', '99']) == 14\nassert my_solution.countSteppingNumbers(**['44', '86']) == 7\nassert my_solution.countSteppingNumbers(**['20', '111']) == 16\nassert my_solution.countSteppingNumbers(**['70', '75']) == 0\nassert my_solution.countSteppingNumbers(**['37', '111']) == 12\nassert my_solution.countSteppingNumbers(**['17', '149']) == 18\nassert my_solution.countSteppingNumbers(**['21', '145']) == 18\nassert my_solution.countSteppingNumbers(**['47', '124']) == 12\nassert my_solution.countSteppingNumbers(**['81', '91']) == 2\nassert my_solution.countSteppingNumbers(**['18', '159']) == 18\nassert my_solution.countSteppingNumbers(**['85', '92']) == 2\nassert my_solution.countSteppingNumbers(**['66', '112']) == 7\nassert my_solution.countSteppingNumbers(**['84', '102']) == 4\n"}, "labels": {"questionId": "2921", "questionFrontendId": "2801", "questionTitle": "Count Stepping Numbers in Range", "stats": {"totalAccepted": "2.9K", "totalSubmission": "6.9K", "totalAcceptedRaw": 2947, "totalSubmissionRaw": 6888, "acRate": "42.8%"}, "probedCases": [{"inputs": ["1", "11"], "output": 10}, {"inputs": ["90", "101"], "output": 2}, {"inputs": ["2", "40"], "output": 14}, {"inputs": ["26", "60"], "output": 6}, {"inputs": ["40", "70"], "output": 6}, {"inputs": ["46", "66"], "output": 3}, {"inputs": ["58", "58"], "output": 0}, {"inputs": ["23", "99"], "output": 14}, {"inputs": ["44", "86"], "output": 7}, {"inputs": ["20", "111"], "output": 16}, {"inputs": ["70", "75"], "output": 0}, {"inputs": ["37", "111"], "output": 12}, {"inputs": ["17", "149"], "output": 18}, {"inputs": ["21", "145"], "output": 18}, {"inputs": ["47", "124"], "output": 12}, {"inputs": ["81", "91"], "output": 2}, {"inputs": ["18", "159"], "output": 18}, {"inputs": ["85", "92"], "output": 2}, {"inputs": ["66", "112"], "output": 7}, {"inputs": ["84", "102"], "output": 4}]}} +{"id": "LeetCode/2881", "content": "# Split Strings by Separator\n\nGiven an array of strings `words` and a character `separator`, **split** each string in `words` by `separator`.\n\n\nReturn *an array of strings containing the new strings formed after the splits, **excluding empty strings**.*\n\n\n**Notes**\n\n\n* `separator` is used to determine where the split should occur, but it is not included as part of the resulting strings.\n* A split may result in more than two strings.\n* The resulting strings must maintain the same order as they were initially given.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** words = [\"one.two.three\",\"four.five\",\"six\"], separator = \".\"\n**Output:** [\"one\",\"two\",\"three\",\"four\",\"five\",\"six\"]\n**Explanation:** In this example we split as follows:\n\n\"one.two.three\" splits into \"one\", \"two\", \"three\"\n\"four.five\" splits into \"four\", \"five\"\n\"six\" splits into \"six\" \n\nHence, the resulting array is [\"one\",\"two\",\"three\",\"four\",\"five\",\"six\"].\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** words = [\"$easy$\",\"$problem$\"], separator = \"$\"\n**Output:** [\"easy\",\"problem\"]\n**Explanation:** In this example we split as follows: \n\n\"$easy$\" splits into \"easy\" (excluding empty strings)\n\"$problem$\" splits into \"problem\" (excluding empty strings)\n\nHence, the resulting array is [\"easy\",\"problem\"].\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** words = [\"|||\"], separator = \"|\"\n**Output:** []\n**Explanation:** In this example the resulting split of \"|||\" will contain only empty strings, so we return an empty array []. \n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= words.length <= 100`\n* `1 <= words[i].length <= 20`\n* characters in `words[i]` are either lowercase English letters or characters from the string `\".,|$#@\"` (excluding the quotes)\n* `separator` is a character from the string `\".,|$#@\"` (excluding the quotes)\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def splitWordsBySeparator(self, words: List[str], separator: str) -> List[str]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.splitWordsBySeparator(**[['one.two.three', 'four.five', 'six'], '.']) == ['one', 'two', 'three', 'four', 'five', 'six']\nassert my_solution.splitWordsBySeparator(**[['$easy$', '$problem$'], '$']) == ['easy', 'problem']\nassert my_solution.splitWordsBySeparator(**[['|||'], '|']) == []\nassert my_solution.splitWordsBySeparator(**[['stars.bars.$'], '.']) == ['stars', 'bars', '$']\nassert my_solution.splitWordsBySeparator(**[['###x#i@f'], '#']) == ['x', 'i@f']\nassert my_solution.splitWordsBySeparator(**[['##q@t#'], '#']) == ['q@t']\nassert my_solution.splitWordsBySeparator(**[['#,'], '#']) == [',']\nassert my_solution.splitWordsBySeparator(**[['#@'], '@']) == ['#']\nassert my_solution.splitWordsBySeparator(**[['#a$f$nwgq#vw'], '$']) == ['#a', 'f', 'nwgq#vw']\nassert my_solution.splitWordsBySeparator(**[['#uyddd,trxiwfv'], ',']) == ['#uyddd', 'trxiwfv']\nassert my_solution.splitWordsBySeparator(**[['#x'], '$']) == ['#x']\nassert my_solution.splitWordsBySeparator(**[['#x#,'], ',']) == ['#x#']\nassert my_solution.splitWordsBySeparator(**[['#|'], '#']) == ['|']\nassert my_solution.splitWordsBySeparator(**[['#|a|b|##|#|#g#u|'], '|']) == ['#', 'a', 'b', '##', '#', '#g#u']\nassert my_solution.splitWordsBySeparator(**[['$$.o.$$.'], '$']) == ['.o.', '.']\nassert my_solution.splitWordsBySeparator(**[['$,,'], ',']) == ['$']\nassert my_solution.splitWordsBySeparator(**[['$j@@@'], '@']) == ['$j']\nassert my_solution.splitWordsBySeparator(**[[',$$'], '$']) == [',']\nassert my_solution.splitWordsBySeparator(**[[',,'], '|']) == [',,']\nassert my_solution.splitWordsBySeparator(**[[',,,@@n'], ',']) == ['@@n']\n"}, "labels": {"questionId": "2881", "questionFrontendId": "2788", "questionTitle": "Split Strings by Separator", "stats": {"totalAccepted": "23.7K", "totalSubmission": "29.4K", "totalAcceptedRaw": 23744, "totalSubmissionRaw": 29444, "acRate": "80.6%"}, "probedCases": [{"inputs": [["one.two.three", "four.five", "six"], "."], "output": ["one", "two", "three", "four", "five", "six"]}, {"inputs": [["$easy$", "$problem$"], "$"], "output": ["easy", "problem"]}, {"inputs": [["|||"], "|"], "output": []}, {"inputs": [["stars.bars.$"], "."], "output": ["stars", "bars", "$"]}, {"inputs": [["###x#i@f"], "#"], "output": ["x", "i@f"]}, {"inputs": [["##q@t#"], "#"], "output": ["q@t"]}, {"inputs": [["#,"], "#"], "output": [","]}, {"inputs": [["#@"], "@"], "output": ["#"]}, {"inputs": [["#a$f$nwgq#vw"], "$"], "output": ["#a", "f", "nwgq#vw"]}, {"inputs": [["#uyddd,trxiwfv"], ","], "output": ["#uyddd", "trxiwfv"]}, {"inputs": [["#x"], "$"], "output": ["#x"]}, {"inputs": [["#x#,"], ","], "output": ["#x#"]}, {"inputs": [["#|"], "#"], "output": ["|"]}, {"inputs": [["#|a|b|##|#|#g#u|"], "|"], "output": ["#", "a", "b", "##", "#", "#g#u"]}, {"inputs": [["$$.o.$$."], "$"], "output": [".o.", "."]}, {"inputs": [["$,,"], ","], "output": ["$"]}, {"inputs": [["$j@@@"], "@"], "output": ["$j"]}, {"inputs": [[",$$"], "$"], "output": [","]}, {"inputs": [[",,"], "|"], "output": [",,"]}, {"inputs": [[",,,@@n"], ","], "output": ["@@n"]}]}} +{"id": "LeetCode/2872", "content": "# Largest Element in an Array after Merge Operations\n\nYou are given a **0-indexed** array `nums` consisting of positive integers.\n\n\nYou can do the following operation on the array **any** number of times:\n\n\n* Choose an integer `i` such that `0 <= i < nums.length - 1` and `nums[i] <= nums[i + 1]`. Replace the element `nums[i + 1]` with `nums[i] + nums[i + 1]` and delete the element `nums[i]` from the array.\n\n\nReturn *the value of the **largest** element that you can possibly obtain in the final array.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,3,7,9,3]\n**Output:** 21\n**Explanation:** We can apply the following operations on the array:\n- Choose i = 0. The resulting array will be nums = [5,7,9,3].\n- Choose i = 1. The resulting array will be nums = [5,16,3].\n- Choose i = 0. The resulting array will be nums = [21,3].\nThe largest element in the final array is 21. It can be shown that we cannot obtain a larger element.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,3,3]\n**Output:** 11\n**Explanation:** We can do the following operations on the array:\n- Choose i = 1. The resulting array will be nums = [5,6].\n- Choose i = 0. The resulting array will be nums = [11].\nThere is only one element in the final array, which is 11.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxArrayValue(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxArrayValue(**[[2, 3, 7, 9, 3]]) == 21\nassert my_solution.maxArrayValue(**[[5, 3, 3]]) == 11\nassert my_solution.maxArrayValue(**[[77]]) == 77\nassert my_solution.maxArrayValue(**[[34, 95, 50, 12, 25, 100, 21, 3, 25, 16, 76, 73, 93, 46, 18]]) == 623\nassert my_solution.maxArrayValue(**[[40, 15, 35, 98, 77, 79, 24, 62, 53, 84, 97, 16, 30, 22, 49]]) == 781\nassert my_solution.maxArrayValue(**[[64, 35, 42, 19, 95, 8, 83, 89, 33, 21, 97, 11, 51, 93, 36, 34, 67, 53]]) == 878\nassert my_solution.maxArrayValue(**[[65, 68, 55, 6, 79, 30, 81, 25, 61, 2, 28, 59, 63, 15, 35, 8, 10, 83]]) == 773\nassert my_solution.maxArrayValue(**[[56]]) == 56\nassert my_solution.maxArrayValue(**[[100]]) == 100\nassert my_solution.maxArrayValue(**[[35, 23, 71, 38]]) == 129\nassert my_solution.maxArrayValue(**[[56, 67, 18, 81, 95, 41, 39, 56, 63, 70, 56, 31, 84, 46, 28, 38, 27, 56, 13, 10, 58, 16, 85, 21, 63, 8]]) == 1134\nassert my_solution.maxArrayValue(**[[72, 72]]) == 144\nassert my_solution.maxArrayValue(**[[16, 31, 55]]) == 102\nassert my_solution.maxArrayValue(**[[6, 65, 68, 7, 35, 19, 28]]) == 228\nassert my_solution.maxArrayValue(**[[38, 37, 88, 60, 93, 4, 5, 65, 74, 25, 59, 28, 86, 33, 28, 33, 93]]) == 849\nassert my_solution.maxArrayValue(**[[29, 9, 3, 55, 25, 38, 88, 39, 38, 73, 47, 57, 40, 56, 4, 52, 1, 44, 88, 20, 18, 8]]) == 786\nassert my_solution.maxArrayValue(**[[34, 92, 42, 24, 98, 87, 40, 82, 51, 67, 70, 75, 45, 57, 67]]) == 931\nassert my_solution.maxArrayValue(**[[31, 75, 44, 92, 13, 10, 3, 41, 47, 89, 5, 92, 17, 62, 65, 40, 43, 68, 30, 45, 85, 24, 40, 77, 80, 65]]) == 1218\nassert my_solution.maxArrayValue(**[[63, 58, 61, 58, 82, 48, 83, 24, 24, 61, 31, 16, 26, 50]]) == 685\nassert my_solution.maxArrayValue(**[[10, 82, 74, 54, 20, 43, 74, 95, 17, 28, 44, 74, 25, 19, 75, 2, 84, 99]]) == 919\n"}, "labels": {"questionId": "2872", "questionFrontendId": "2789", "questionTitle": "Largest Element in an Array after Merge Operations", "stats": {"totalAccepted": "6.5K", "totalSubmission": "13.1K", "totalAcceptedRaw": 6493, "totalSubmissionRaw": 13053, "acRate": "49.7%"}, "probedCases": [{"inputs": [[2, 3, 7, 9, 3]], "output": 21}, {"inputs": [[5, 3, 3]], "output": 11}, {"inputs": [[77]], "output": 77}, {"inputs": [[34, 95, 50, 12, 25, 100, 21, 3, 25, 16, 76, 73, 93, 46, 18]], "output": 623}, {"inputs": [[40, 15, 35, 98, 77, 79, 24, 62, 53, 84, 97, 16, 30, 22, 49]], "output": 781}, {"inputs": [[64, 35, 42, 19, 95, 8, 83, 89, 33, 21, 97, 11, 51, 93, 36, 34, 67, 53]], "output": 878}, {"inputs": [[65, 68, 55, 6, 79, 30, 81, 25, 61, 2, 28, 59, 63, 15, 35, 8, 10, 83]], "output": 773}, {"inputs": [[56]], "output": 56}, {"inputs": [[100]], "output": 100}, {"inputs": [[35, 23, 71, 38]], "output": 129}, {"inputs": [[56, 67, 18, 81, 95, 41, 39, 56, 63, 70, 56, 31, 84, 46, 28, 38, 27, 56, 13, 10, 58, 16, 85, 21, 63, 8]], "output": 1134}, {"inputs": [[72, 72]], "output": 144}, {"inputs": [[16, 31, 55]], "output": 102}, {"inputs": [[6, 65, 68, 7, 35, 19, 28]], "output": 228}, {"inputs": [[38, 37, 88, 60, 93, 4, 5, 65, 74, 25, 59, 28, 86, 33, 28, 33, 93]], "output": 849}, {"inputs": [[29, 9, 3, 55, 25, 38, 88, 39, 38, 73, 47, 57, 40, 56, 4, 52, 1, 44, 88, 20, 18, 8]], "output": 786}, {"inputs": [[34, 92, 42, 24, 98, 87, 40, 82, 51, 67, 70, 75, 45, 57, 67]], "output": 931}, {"inputs": [[31, 75, 44, 92, 13, 10, 3, 41, 47, 89, 5, 92, 17, 62, 65, 40, 43, 68, 30, 45, 85, 24, 40, 77, 80, 65]], "output": 1218}, {"inputs": [[63, 58, 61, 58, 82, 48, 83, 24, 24, 61, 31, 16, 26, 50]], "output": 685}, {"inputs": [[10, 82, 74, 54, 20, 43, 74, 95, 17, 28, 44, 74, 25, 19, 75, 2, 84, 99]], "output": 919}]}} +{"id": "LeetCode/2919", "content": "# Maximum Number of Groups With Increasing Length\n\nYou are given a **0-indexed** array `usageLimits` of length `n`.\n\n\nYour task is to create **groups** using numbers from `0` to `n - 1`, ensuring that each number, `i`, is used no more than `usageLimits[i]` times in total **across all groups**. You must also satisfy the following conditions:\n\n\n* Each group must consist of **distinct** numbers, meaning that no duplicate numbers are allowed within a single group.\n* Each group (except the first one) must have a length **strictly greater** than the previous group.\n\n\nReturn *an integer denoting the **maximum** number of groups you can create while satisfying these conditions.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** usageLimits = [1,2,5]\n**Output:** 3\n**Explanation:** In this example, we can use 0 at most once, 1 at most twice, and 2 at most five times.\nOne way of creating the maximum number of groups while satisfying the conditions is: \nGroup 1 contains the number [2].\nGroup 2 contains the numbers [1,2].\nGroup 3 contains the numbers [0,1,2]. \nIt can be shown that the maximum number of groups is 3. \nSo, the output is 3. \n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** usageLimits = [2,1,2]\n**Output:** 2\n**Explanation:** In this example, we can use 0 at most twice, 1 at most once, and 2 at most twice.\nOne way of creating the maximum number of groups while satisfying the conditions is:\nGroup 1 contains the number [0].\nGroup 2 contains the numbers [1,2].\nIt can be shown that the maximum number of groups is 2.\nSo, the output is 2. \n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** usageLimits = [1,1]\n**Output:** 1\n**Explanation:** In this example, we can use both 0 and 1 at most once.\nOne way of creating the maximum number of groups while satisfying the conditions is:\nGroup 1 contains the number [0].\nIt can be shown that the maximum number of groups is 1.\nSo, the output is 1. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= usageLimits.length <= 105`\n* `1 <= usageLimits[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxIncreasingGroups(self, usageLimits: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxIncreasingGroups(**[[1, 2, 5]]) == 3\nassert my_solution.maxIncreasingGroups(**[[2, 1, 2]]) == 2\nassert my_solution.maxIncreasingGroups(**[[1, 1]]) == 1\nassert my_solution.maxIncreasingGroups(**[[1, 4]]) == 2\nassert my_solution.maxIncreasingGroups(**[[1, 5]]) == 2\nassert my_solution.maxIncreasingGroups(**[[1, 7]]) == 2\nassert my_solution.maxIncreasingGroups(**[[1, 8]]) == 2\nassert my_solution.maxIncreasingGroups(**[[2, 1]]) == 2\nassert my_solution.maxIncreasingGroups(**[[2, 2]]) == 2\nassert my_solution.maxIncreasingGroups(**[[2, 3]]) == 2\nassert my_solution.maxIncreasingGroups(**[[2, 4]]) == 2\nassert my_solution.maxIncreasingGroups(**[[2, 5]]) == 2\nassert my_solution.maxIncreasingGroups(**[[2, 7]]) == 2\nassert my_solution.maxIncreasingGroups(**[[2, 8]]) == 2\nassert my_solution.maxIncreasingGroups(**[[2, 9]]) == 2\nassert my_solution.maxIncreasingGroups(**[[3, 1]]) == 2\nassert my_solution.maxIncreasingGroups(**[[3, 4]]) == 2\nassert my_solution.maxIncreasingGroups(**[[3, 7]]) == 2\nassert my_solution.maxIncreasingGroups(**[[3, 10]]) == 2\nassert my_solution.maxIncreasingGroups(**[[4, 1]]) == 2\n"}, "labels": {"questionId": "2919", "questionFrontendId": "2790", "questionTitle": "Maximum Number of Groups With Increasing Length", "stats": {"totalAccepted": "2.8K", "totalSubmission": "12.7K", "totalAcceptedRaw": 2801, "totalSubmissionRaw": 12691, "acRate": "22.1%"}, "probedCases": [{"inputs": [[1, 2, 5]], "output": 3}, {"inputs": [[2, 1, 2]], "output": 2}, {"inputs": [[1, 1]], "output": 1}, {"inputs": [[1, 4]], "output": 2}, {"inputs": [[1, 5]], "output": 2}, {"inputs": [[1, 7]], "output": 2}, {"inputs": [[1, 8]], "output": 2}, {"inputs": [[2, 1]], "output": 2}, {"inputs": [[2, 2]], "output": 2}, {"inputs": [[2, 3]], "output": 2}, {"inputs": [[2, 4]], "output": 2}, {"inputs": [[2, 5]], "output": 2}, {"inputs": [[2, 7]], "output": 2}, {"inputs": [[2, 8]], "output": 2}, {"inputs": [[2, 9]], "output": 2}, {"inputs": [[3, 1]], "output": 2}, {"inputs": [[3, 4]], "output": 2}, {"inputs": [[3, 7]], "output": 2}, {"inputs": [[3, 10]], "output": 2}, {"inputs": [[4, 1]], "output": 2}]}} +{"id": "LeetCode/2892", "content": "# Check if Array is Good\n\nYou are given an integer array `nums`. We consider an array **good** if it is a permutation of an array `base[n]`.\n\n\n`base[n] = [1, 2, ..., n - 1, n, n]` (in other words, it is an array of length `n + 1` which contains `1` to `n - 1` exactly once, plus two occurrences of `n`). For example, `base[1] = [1, 1]` and `base[3] = [1, 2, 3, 3]`.\n\n\nReturn `true` *if the given array is good, otherwise return*`false`.\n\n\n**Note:** A permutation of integers represents an arrangement of these numbers.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2, 1, 3]\n**Output:** false\n**Explanation:** Since the maximum element of the array is 3, the only candidate n for which this array could be a permutation of base[n], is n = 3. However, base[3] has four elements but array nums has three. Therefore, it can not be a permutation of base[3] = [1, 2, 3, 3]. So the answer is false.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1, 3, 3, 2]\n**Output:** true\n**Explanation:** Since the maximum element of the array is 3, the only candidate n for which this array could be a permutation of base[n], is n = 3. It can be seen that nums is a permutation of base[3] = [1, 2, 3, 3] (by swapping the second and fourth elements in nums, we reach base[3]). Therefore, the answer is true.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1, 1]\n**Output:** true\n**Explanation:** Since the maximum element of the array is 1, the only candidate n for which this array could be a permutation of base[n], is n = 1. It can be seen that nums is a permutation of base[1] = [1, 1]. Therefore, the answer is true.\n```\n\n**Example 4:**\n\n\n\n```\n\n**Input:** nums = [3, 4, 4, 1, 2, 1]\n**Output:** false\n**Explanation:** Since the maximum element of the array is 4, the only candidate n for which this array could be a permutation of base[n], is n = 4. However, base[4] has five elements but array nums has six. Therefore, it can not be a permutation of base[4] = [1, 2, 3, 4, 4]. So the answer is false.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 100`\n* `1 <= num[i] <= 200`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def isGood(self, nums: List[int]) -> bool:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.isGood(**[[2, 1, 3]]) == False\nassert my_solution.isGood(**[[1, 3, 3, 2]]) == True\nassert my_solution.isGood(**[[1, 1]]) == True\nassert my_solution.isGood(**[[3, 4, 4, 1, 2, 1]]) == False\nassert my_solution.isGood(**[[1]]) == False\nassert my_solution.isGood(**[[2]]) == False\nassert my_solution.isGood(**[[3]]) == False\nassert my_solution.isGood(**[[4]]) == False\nassert my_solution.isGood(**[[5]]) == False\nassert my_solution.isGood(**[[6]]) == False\nassert my_solution.isGood(**[[8]]) == False\nassert my_solution.isGood(**[[9]]) == False\nassert my_solution.isGood(**[[10]]) == False\nassert my_solution.isGood(**[[12]]) == False\nassert my_solution.isGood(**[[13]]) == False\nassert my_solution.isGood(**[[14]]) == False\nassert my_solution.isGood(**[[15]]) == False\nassert my_solution.isGood(**[[82]]) == False\nassert my_solution.isGood(**[[1, 8]]) == False\nassert my_solution.isGood(**[[1, 13]]) == False\n"}, "labels": {"questionId": "2892", "questionFrontendId": "2784", "questionTitle": "Check if Array is Good", "stats": {"totalAccepted": "4.8K", "totalSubmission": "7.7K", "totalAcceptedRaw": 4778, "totalSubmissionRaw": 7743, "acRate": "61.7%"}, "probedCases": [{"inputs": [[2, 1, 3]], "output": false}, {"inputs": [[1, 3, 3, 2]], "output": true}, {"inputs": [[1, 1]], "output": true}, {"inputs": [[3, 4, 4, 1, 2, 1]], "output": false}, {"inputs": [[1]], "output": false}, {"inputs": [[2]], "output": false}, {"inputs": [[3]], "output": false}, {"inputs": [[4]], "output": false}, {"inputs": [[5]], "output": false}, {"inputs": [[6]], "output": false}, {"inputs": [[8]], "output": false}, {"inputs": [[9]], "output": false}, {"inputs": [[10]], "output": false}, {"inputs": [[12]], "output": false}, {"inputs": [[13]], "output": false}, {"inputs": [[14]], "output": false}, {"inputs": [[15]], "output": false}, {"inputs": [[82]], "output": false}, {"inputs": [[1, 8]], "output": false}, {"inputs": [[1, 13]], "output": false}]}} +{"id": "LeetCode/2887", "content": "# Sort Vowels in a String\n\nGiven a **0-indexed** string `s`, **permute** `s` to get a new string `t` such that:\n\n\n* All consonants remain in their original places. More formally, if there is an index `i` with `0 <= i < s.length` such that `s[i]` is a consonant, then `t[i] = s[i]`.\n* The vowels must be sorted in the **nondecreasing** order of their **ASCII** values. More formally, for pairs of indices `i`, `j` with `0 <= i < j < s.length` such that `s[i]` and `s[j]` are vowels, then `t[i]` must not have a higher ASCII value than `t[j]`.\n\n\nReturn *the resulting string*.\n\n\nThe vowels are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`, and they can appear in lowercase or uppercase. Consonants comprise all letters that are not vowels.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"lEetcOde\"\n**Output:** \"lEOtcede\"\n**Explanation:** 'E', 'O', and 'e' are the vowels in s; 'l', 't', 'c', and 'd' are all consonants. The vowels are sorted according to their ASCII values, and the consonants remain in the same places.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"lYmpH\"\n**Output:** \"lYmpH\"\n**Explanation:** There are no vowels in s (all characters in s are consonants), so we return \"lYmpH\".\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 105`\n* `s` consists only of letters of the English alphabet in **uppercase and lowercase**.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def sortVowels(self, s: str) -> str:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.sortVowels(**['lEetcOde']) == lEOtcede\nassert my_solution.sortVowels(**['lYmpH']) == lYmpH\nassert my_solution.sortVowels(**['mDVD']) == mDVD\nassert my_solution.sortVowels(**['xdX']) == xdX\nassert my_solution.sortVowels(**['xdE']) == xdE\nassert my_solution.sortVowels(**['RiQYo']) == RiQYo\nassert my_solution.sortVowels(**['LQRamBOHfq']) == LQROmBaHfq\nassert my_solution.sortVowels(**['UpjPbEnOj']) == EpjPbOnUj\nassert my_solution.sortVowels(**['ziF']) == ziF\nassert my_solution.sortVowels(**['WxkKdjhL']) == WxkKdjhL\nassert my_solution.sortVowels(**['uZcPmqAd']) == AZcPmqud\nassert my_solution.sortVowels(**['UjshJXjkjS']) == UjshJXjkjS\nassert my_solution.sortVowels(**['nElwWTQHJ']) == nElwWTQHJ\nassert my_solution.sortVowels(**['kwcJqvsgM']) == kwcJqvsgM\nassert my_solution.sortVowels(**['z']) == z\nassert my_solution.sortVowels(**['Pz']) == Pz\nassert my_solution.sortVowels(**['T']) == T\nassert my_solution.sortVowels(**['syRWvFi']) == syRWvFi\nassert my_solution.sortVowels(**['G']) == G\nassert my_solution.sortVowels(**['MuQYHVy']) == MuQYHVy\n"}, "labels": {"questionId": "2887", "questionFrontendId": "2785", "questionTitle": "Sort Vowels in a String", "stats": {"totalAccepted": "4.2K", "totalSubmission": "5.5K", "totalAcceptedRaw": 4201, "totalSubmissionRaw": 5452, "acRate": "77.1%"}, "probedCases": [{"inputs": ["lEetcOde"], "output": "lEOtcede"}, {"inputs": ["lYmpH"], "output": "lYmpH"}, {"inputs": ["mDVD"], "output": "mDVD"}, {"inputs": ["xdX"], "output": "xdX"}, {"inputs": ["xdE"], "output": "xdE"}, {"inputs": ["RiQYo"], "output": "RiQYo"}, {"inputs": ["LQRamBOHfq"], "output": "LQROmBaHfq"}, {"inputs": ["UpjPbEnOj"], "output": "EpjPbOnUj"}, {"inputs": ["ziF"], "output": "ziF"}, {"inputs": ["WxkKdjhL"], "output": "WxkKdjhL"}, {"inputs": ["uZcPmqAd"], "output": "AZcPmqud"}, {"inputs": ["UjshJXjkjS"], "output": "UjshJXjkjS"}, {"inputs": ["nElwWTQHJ"], "output": "nElwWTQHJ"}, {"inputs": ["kwcJqvsgM"], "output": "kwcJqvsgM"}, {"inputs": ["z"], "output": "z"}, {"inputs": ["Pz"], "output": "Pz"}, {"inputs": ["T"], "output": "T"}, {"inputs": ["syRWvFi"], "output": "syRWvFi"}, {"inputs": ["G"], "output": "G"}, {"inputs": ["MuQYHVy"], "output": "MuQYHVy"}]}} +{"id": "LeetCode/2893", "content": "# Visit Array Positions to Maximize Score\n\nYou are given a **0-indexed** integer array `nums` and a positive integer `x`.\n\n\nYou are **initially** at position `0` in the array and you can visit other positions according to the following rules:\n\n\n* If you are currently in position `i`, then you can move to **any** position `j` such that `i < j`.\n* For each position `i` that you visit, you get a score of `nums[i]`.\n* If you move from a position `i` to a position `j` and the **parities** of `nums[i]` and `nums[j]` differ, then you lose a score of `x`.\n\n\nReturn *the **maximum** total score you can get*.\n\n\n**Note** that initially you have `nums[0]` points.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,3,6,1,9,2], x = 5\n**Output:** 13\n**Explanation:** We can visit the following positions in the array: 0 -> 2 -> 3 -> 4.\nThe corresponding values are 2, 6, 1 and 9. Since the integers 6 and 1 have different parities, the move 2 -> 3 will make you lose a score of x = 5.\nThe total score will be: 2 + 6 + 1 + 9 - 5 = 13.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,4,6,8], x = 3\n**Output:** 20\n**Explanation:** All the integers in the array have the same parities, so we can visit all of them without losing any score.\nThe total score is: 2 + 4 + 6 + 8 = 20.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= nums.length <= 105`\n* `1 <= nums[i], x <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxScore(self, nums: List[int], x: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxScore(**[[2, 3, 6, 1, 9, 2], 5]) == 13\nassert my_solution.maxScore(**[[2, 4, 6, 8], 3]) == 20\nassert my_solution.maxScore(**[[38, 92, 23, 30, 25, 96, 6, 71, 78, 77, 33, 23, 71, 48, 87, 77, 53, 28, 6, 20, 90, 83, 42, 21, 64, 95, 84, 29, 22, 21, 33, 36, 53, 51, 85, 25, 80, 56, 71, 69, 5, 21, 4, 84, 28, 16, 65, 7], 52]) == 1545\nassert my_solution.maxScore(**[[18, 13, 60, 61, 57, 21, 10, 98, 51, 3, 13, 36, 72, 70, 68, 62, 52, 83, 63, 63, 53, 42, 59, 98, 95, 48, 22, 64, 94, 80, 14, 14], 2]) == 1633\nassert my_solution.maxScore(**[[90, 87, 79, 59, 91, 19, 96], 51]) == 419\nassert my_solution.maxScore(**[[96, 81, 48, 3, 60, 78, 74, 82, 14, 7, 87, 72, 42, 41, 80, 4, 92, 82, 59, 16, 19, 94, 70, 45, 83, 58, 2, 91, 11, 96, 17, 62, 79, 34, 44, 47, 89, 76, 85, 21, 5, 57, 35, 51], 24]) == 1952\nassert my_solution.maxScore(**[[99, 88, 98, 15, 34, 40, 29, 81, 2, 6, 12, 9, 82, 93, 5, 81, 84, 71, 83, 31, 12, 22, 9, 65, 56, 9, 68, 79, 39, 84, 50, 7, 25, 3, 49], 19]) == 1363\nassert my_solution.maxScore(**[[8, 50, 65, 85, 8, 73, 55, 50, 29, 95, 5, 68, 52, 79], 74]) == 470\nassert my_solution.maxScore(**[[45, 9, 20, 89, 18, 94, 12, 51, 38, 77, 100, 95, 46, 1, 76, 41, 8, 90, 82, 33, 92, 32, 76, 43, 6, 61, 85, 40, 63, 10, 74, 18, 44, 43, 17, 100, 17, 33, 100, 77, 97, 8, 99, 85, 88, 9, 63, 31, 32], 68]) == 1694\nassert my_solution.maxScore(**[[87, 23, 53, 57, 21, 60, 68, 84, 66, 49, 48, 61, 32, 95, 71, 11, 15, 61, 10, 86, 50, 53, 38, 20, 63], 92]) == 814\nassert my_solution.maxScore(**[[39, 47, 76, 64, 90, 17, 30, 57, 19, 40, 9, 76, 68, 33, 36, 61, 19, 93, 8, 1, 31, 2, 55, 70, 24, 85, 97, 40, 35, 93, 56, 67, 64, 67, 52, 2, 75, 13, 89, 97], 77]) == 1390\nassert my_solution.maxScore(**[[92, 87, 85, 27, 27, 10, 24, 94, 26, 78, 24, 61, 4, 46, 3, 76, 29, 65, 52, 61, 34, 67, 74, 61, 90, 40, 81, 60, 10, 98, 87, 57, 28, 77, 55, 33, 10, 91, 57, 72, 3, 72, 4, 39, 99], 70]) == 1551\nassert my_solution.maxScore(**[[20, 90, 68], 39]) == 178\nassert my_solution.maxScore(**[[43, 100, 72, 33, 45, 9, 51, 10, 22, 42, 7, 74, 41, 68, 100, 24, 20, 20, 79, 30, 99, 82], 1]) == 1060\nassert my_solution.maxScore(**[[100, 87, 29, 94, 56, 41, 53, 98, 34, 17, 52, 3, 54, 51, 22, 39, 37, 9, 76], 40]) == 670\nassert my_solution.maxScore(**[[55, 37, 87, 45, 96, 7, 66, 62, 91, 51, 33, 92, 65, 99], 81]) == 625\nassert my_solution.maxScore(**[[2, 75, 65, 43], 39]) == 146\nassert my_solution.maxScore(**[[74, 82, 80, 95, 72, 23, 49, 43, 76, 28, 87, 27, 58, 39, 7, 77, 26, 63, 56, 96, 77, 75, 82, 60, 90, 69, 83, 20, 13, 82, 16, 90, 40, 23, 36, 17, 77, 15, 18, 10], 40]) == 1571\nassert my_solution.maxScore(**[[75, 99, 45, 34, 63, 19, 71, 48, 73, 66, 2, 14, 76, 41, 92, 23, 6, 31, 49, 6, 70, 40, 69, 25, 97, 58, 20, 84, 21, 37, 100, 75, 73, 10, 59, 87, 30], 96]) == 1181\nassert my_solution.maxScore(**[[9, 58, 17, 54, 91, 90, 32, 6, 13, 67, 24, 80, 8, 56, 29, 66, 85, 38, 45, 13, 20, 73, 16, 98, 28, 56, 23, 2, 47, 85, 11, 97, 72, 2, 28, 52, 33], 90]) == 886\n"}, "labels": {"questionId": "2893", "questionFrontendId": "2786", "questionTitle": "Visit Array Positions to Maximize Score", "stats": {"totalAccepted": "3.8K", "totalSubmission": "9.5K", "totalAcceptedRaw": 3830, "totalSubmissionRaw": 9465, "acRate": "40.5%"}, "probedCases": [{"inputs": [[2, 3, 6, 1, 9, 2], 5], "output": 13}, {"inputs": [[2, 4, 6, 8], 3], "output": 20}, {"inputs": [[38, 92, 23, 30, 25, 96, 6, 71, 78, 77, 33, 23, 71, 48, 87, 77, 53, 28, 6, 20, 90, 83, 42, 21, 64, 95, 84, 29, 22, 21, 33, 36, 53, 51, 85, 25, 80, 56, 71, 69, 5, 21, 4, 84, 28, 16, 65, 7], 52], "output": 1545}, {"inputs": [[18, 13, 60, 61, 57, 21, 10, 98, 51, 3, 13, 36, 72, 70, 68, 62, 52, 83, 63, 63, 53, 42, 59, 98, 95, 48, 22, 64, 94, 80, 14, 14], 2], "output": 1633}, {"inputs": [[90, 87, 79, 59, 91, 19, 96], 51], "output": 419}, {"inputs": [[96, 81, 48, 3, 60, 78, 74, 82, 14, 7, 87, 72, 42, 41, 80, 4, 92, 82, 59, 16, 19, 94, 70, 45, 83, 58, 2, 91, 11, 96, 17, 62, 79, 34, 44, 47, 89, 76, 85, 21, 5, 57, 35, 51], 24], "output": 1952}, {"inputs": [[99, 88, 98, 15, 34, 40, 29, 81, 2, 6, 12, 9, 82, 93, 5, 81, 84, 71, 83, 31, 12, 22, 9, 65, 56, 9, 68, 79, 39, 84, 50, 7, 25, 3, 49], 19], "output": 1363}, {"inputs": [[8, 50, 65, 85, 8, 73, 55, 50, 29, 95, 5, 68, 52, 79], 74], "output": 470}, {"inputs": [[45, 9, 20, 89, 18, 94, 12, 51, 38, 77, 100, 95, 46, 1, 76, 41, 8, 90, 82, 33, 92, 32, 76, 43, 6, 61, 85, 40, 63, 10, 74, 18, 44, 43, 17, 100, 17, 33, 100, 77, 97, 8, 99, 85, 88, 9, 63, 31, 32], 68], "output": 1694}, {"inputs": [[87, 23, 53, 57, 21, 60, 68, 84, 66, 49, 48, 61, 32, 95, 71, 11, 15, 61, 10, 86, 50, 53, 38, 20, 63], 92], "output": 814}, {"inputs": [[39, 47, 76, 64, 90, 17, 30, 57, 19, 40, 9, 76, 68, 33, 36, 61, 19, 93, 8, 1, 31, 2, 55, 70, 24, 85, 97, 40, 35, 93, 56, 67, 64, 67, 52, 2, 75, 13, 89, 97], 77], "output": 1390}, {"inputs": [[92, 87, 85, 27, 27, 10, 24, 94, 26, 78, 24, 61, 4, 46, 3, 76, 29, 65, 52, 61, 34, 67, 74, 61, 90, 40, 81, 60, 10, 98, 87, 57, 28, 77, 55, 33, 10, 91, 57, 72, 3, 72, 4, 39, 99], 70], "output": 1551}, {"inputs": [[20, 90, 68], 39], "output": 178}, {"inputs": [[43, 100, 72, 33, 45, 9, 51, 10, 22, 42, 7, 74, 41, 68, 100, 24, 20, 20, 79, 30, 99, 82], 1], "output": 1060}, {"inputs": [[100, 87, 29, 94, 56, 41, 53, 98, 34, 17, 52, 3, 54, 51, 22, 39, 37, 9, 76], 40], "output": 670}, {"inputs": [[55, 37, 87, 45, 96, 7, 66, 62, 91, 51, 33, 92, 65, 99], 81], "output": 625}, {"inputs": [[2, 75, 65, 43], 39], "output": 146}, {"inputs": [[74, 82, 80, 95, 72, 23, 49, 43, 76, 28, 87, 27, 58, 39, 7, 77, 26, 63, 56, 96, 77, 75, 82, 60, 90, 69, 83, 20, 13, 82, 16, 90, 40, 23, 36, 17, 77, 15, 18, 10], 40], "output": 1571}, {"inputs": [[75, 99, 45, 34, 63, 19, 71, 48, 73, 66, 2, 14, 76, 41, 92, 23, 6, 31, 49, 6, 70, 40, 69, 25, 97, 58, 20, 84, 21, 37, 100, 75, 73, 10, 59, 87, 30], 96], "output": 1181}, {"inputs": [[9, 58, 17, 54, 91, 90, 32, 6, 13, 67, 24, 80, 8, 56, 29, 66, 85, 38, 45, 13, 20, 73, 16, 98, 28, 56, 23, 2, 47, 85, 11, 97, 72, 2, 28, 52, 33], 90], "output": 886}]}} +{"id": "LeetCode/2882", "content": "# Ways to Express an Integer as Sum of Powers\n\nGiven two **positive** integers `n` and `x`.\n\n\nReturn *the number of ways* `n` *can be expressed as the sum of the* `xth` *power of **unique** positive integers, in other words, the number of sets of unique integers* `[n1, n2, ..., nk]` *where* `n = n1x + n2x + ... + nkx`*.*\n\n\nSince the result can be very large, return it modulo `109 + 7`.\n\n\nFor example, if `n = 160` and `x = 3`, one way to express `n` is `n = 23 + 33 + 53`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 10, x = 2\n**Output:** 1\n**Explanation:** We can express n as the following: n = 32 + 12 = 10.\nIt can be shown that it is the only way to express 10 as the sum of the 2nd power of unique integers.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 4, x = 1\n**Output:** 2\n**Explanation:** We can express n in the following ways:\n- n = 41 = 4.\n- n = 31 + 11 = 4.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 300`\n* `1 <= x <= 5`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def numberOfWays(self, n: int, x: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.numberOfWays(**[10, 2]) == 1\nassert my_solution.numberOfWays(**[4, 1]) == 2\nassert my_solution.numberOfWays(**[1, 1]) == 1\nassert my_solution.numberOfWays(**[1, 2]) == 1\nassert my_solution.numberOfWays(**[1, 3]) == 1\nassert my_solution.numberOfWays(**[1, 4]) == 1\nassert my_solution.numberOfWays(**[1, 5]) == 1\nassert my_solution.numberOfWays(**[2, 1]) == 1\nassert my_solution.numberOfWays(**[2, 2]) == 0\nassert my_solution.numberOfWays(**[2, 3]) == 0\nassert my_solution.numberOfWays(**[2, 4]) == 0\nassert my_solution.numberOfWays(**[2, 5]) == 0\nassert my_solution.numberOfWays(**[3, 1]) == 2\nassert my_solution.numberOfWays(**[3, 2]) == 0\nassert my_solution.numberOfWays(**[3, 3]) == 0\nassert my_solution.numberOfWays(**[3, 4]) == 0\nassert my_solution.numberOfWays(**[3, 5]) == 0\nassert my_solution.numberOfWays(**[4, 2]) == 1\nassert my_solution.numberOfWays(**[4, 3]) == 0\nassert my_solution.numberOfWays(**[4, 4]) == 0\n"}, "labels": {"questionId": "2882", "questionFrontendId": "2787", "questionTitle": "Ways to Express an Integer as Sum of Powers", "stats": {"totalAccepted": "3.3K", "totalSubmission": "7.5K", "totalAcceptedRaw": 3345, "totalSubmissionRaw": 7515, "acRate": "44.5%"}, "probedCases": [{"inputs": [10, 2], "output": 1}, {"inputs": [4, 1], "output": 2}, {"inputs": [1, 1], "output": 1}, {"inputs": [1, 2], "output": 1}, {"inputs": [1, 3], "output": 1}, {"inputs": [1, 4], "output": 1}, {"inputs": [1, 5], "output": 1}, {"inputs": [2, 1], "output": 1}, {"inputs": [2, 2], "output": 0}, {"inputs": [2, 3], "output": 0}, {"inputs": [2, 4], "output": 0}, {"inputs": [2, 5], "output": 0}, {"inputs": [3, 1], "output": 2}, {"inputs": [3, 2], "output": 0}, {"inputs": [3, 3], "output": 0}, {"inputs": [3, 4], "output": 0}, {"inputs": [3, 5], "output": 0}, {"inputs": [4, 2], "output": 1}, {"inputs": [4, 3], "output": 0}, {"inputs": [4, 4], "output": 0}]}} +{"id": "LeetCode/2844", "content": "# Sum of Squares of Special Elements \n\nYou are given a **1-indexed** integer array `nums` of length `n`.\n\n\nAn element `nums[i]` of `nums` is called **special** if `i` divides `n`, i.e. `n % i == 0`.\n\n\nReturn *the **sum of the squares** of all **special** elements of* `nums`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4]\n**Output:** 21\n**Explanation:** There are exactly 3 special elements in nums: nums[1] since 1 divides 4, nums[2] since 2 divides 4, and nums[4] since 4 divides 4. \nHence, the sum of the squares of all special elements of nums is nums[1] * nums[1] + nums[2] * nums[2] + nums[4] * nums[4] = 1 * 1 + 2 * 2 + 4 * 4 = 21. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,7,1,19,18,3]\n**Output:** 63\n**Explanation:** There are exactly 4 special elements in nums: nums[1] since 1 divides 6, nums[2] since 2 divides 6, nums[3] since 3 divides 6, and nums[6] since 6 divides 6. \nHence, the sum of the squares of all special elements of nums is nums[1] * nums[1] + nums[2] * nums[2] + nums[3] * nums[3] + nums[6] * nums[6] = 2 * 2 + 7 * 7 + 1 * 1 + 3 * 3 = 63. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length == n <= 50`\n* `1 <= nums[i] <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def sumOfSquares(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.sumOfSquares(**[[1, 2, 3, 4]]) == 21\nassert my_solution.sumOfSquares(**[[2, 7, 1, 19, 18, 3]]) == 63\nassert my_solution.sumOfSquares(**[[1]]) == 1\nassert my_solution.sumOfSquares(**[[2]]) == 4\nassert my_solution.sumOfSquares(**[[3]]) == 9\nassert my_solution.sumOfSquares(**[[4]]) == 16\nassert my_solution.sumOfSquares(**[[5]]) == 25\nassert my_solution.sumOfSquares(**[[6]]) == 36\nassert my_solution.sumOfSquares(**[[7]]) == 49\nassert my_solution.sumOfSquares(**[[8]]) == 64\nassert my_solution.sumOfSquares(**[[9]]) == 81\nassert my_solution.sumOfSquares(**[[10]]) == 100\nassert my_solution.sumOfSquares(**[[11]]) == 121\nassert my_solution.sumOfSquares(**[[12]]) == 144\nassert my_solution.sumOfSquares(**[[13]]) == 169\nassert my_solution.sumOfSquares(**[[14]]) == 196\nassert my_solution.sumOfSquares(**[[15]]) == 225\nassert my_solution.sumOfSquares(**[[16]]) == 256\nassert my_solution.sumOfSquares(**[[17]]) == 289\nassert my_solution.sumOfSquares(**[[18]]) == 324\n"}, "labels": {"questionId": "2844", "questionFrontendId": "2778", "questionTitle": "Sum of Squares of Special Elements ", "stats": {"totalAccepted": "8.2K", "totalSubmission": "10.4K", "totalAcceptedRaw": 8223, "totalSubmissionRaw": 10400, "acRate": "79.1%"}, "probedCases": [{"inputs": [[1, 2, 3, 4]], "output": 21}, {"inputs": [[2, 7, 1, 19, 18, 3]], "output": 63}, {"inputs": [[1]], "output": 1}, {"inputs": [[2]], "output": 4}, {"inputs": [[3]], "output": 9}, {"inputs": [[4]], "output": 16}, {"inputs": [[5]], "output": 25}, {"inputs": [[6]], "output": 36}, {"inputs": [[7]], "output": 49}, {"inputs": [[8]], "output": 64}, {"inputs": [[9]], "output": 81}, {"inputs": [[10]], "output": 100}, {"inputs": [[11]], "output": 121}, {"inputs": [[12]], "output": 144}, {"inputs": [[13]], "output": 169}, {"inputs": [[14]], "output": 196}, {"inputs": [[15]], "output": 225}, {"inputs": [[16]], "output": 256}, {"inputs": [[17]], "output": 289}, {"inputs": [[18]], "output": 324}]}} +{"id": "LeetCode/2891", "content": "# Maximum Beauty of an Array After Applying Operation\n\nYou are given a **0-indexed** array `nums` and a **non-negative** integer `k`.\n\n\nIn one operation, you can do the following:\n\n\n* Choose an index `i` that **hasn't been chosen before** from the range `[0, nums.length - 1]`.\n* Replace `nums[i]` with any integer from the range `[nums[i] - k, nums[i] + k]`.\n\n\nThe **beauty** of the array is the length of the longest subsequence consisting of equal elements.\n\n\nReturn *the **maximum** possible beauty of the array* `nums` *after applying the operation any number of times.*\n\n\n**Note** that you can apply the operation to each index **only once**.\n\n\nA **subsequence** of an array is a new array generated from the original array by deleting some elements (possibly none) without changing the order of the remaining elements.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [4,6,1,2], k = 2\n**Output:** 3\n**Explanation:** In this example, we apply the following operations:\n- Choose index 1, replace it with 4 (from range [4,8]), nums = [4,4,1,2].\n- Choose index 3, replace it with 4 (from range [0,4]), nums = [4,4,1,4].\nAfter the applied operations, the beauty of the array nums is 3 (subsequence consisting of indices 0, 1, and 3).\nIt can be proven that 3 is the maximum possible length we can achieve.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,1,1,1], k = 10\n**Output:** 4\n**Explanation:** In this example we don't have to apply any operations.\nThe beauty of the array nums is 4 (whole array).\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `0 <= nums[i], k <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumBeauty(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumBeauty(**[[4, 6, 1, 2], 2]) == 3\nassert my_solution.maximumBeauty(**[[1, 1, 1, 1], 10]) == 4\nassert my_solution.maximumBeauty(**[[12, 71], 10]) == 1\nassert my_solution.maximumBeauty(**[[27, 55], 1]) == 1\nassert my_solution.maximumBeauty(**[[52, 34], 21]) == 2\nassert my_solution.maximumBeauty(**[[76, 0], 16]) == 1\nassert my_solution.maximumBeauty(**[[56, 40], 26]) == 2\nassert my_solution.maximumBeauty(**[[49, 26], 12]) == 2\nassert my_solution.maximumBeauty(**[[69, 66], 14]) == 2\nassert my_solution.maximumBeauty(**[[64, 98], 12]) == 1\nassert my_solution.maximumBeauty(**[[83, 81], 7]) == 2\nassert my_solution.maximumBeauty(**[[44, 93], 15]) == 1\nassert my_solution.maximumBeauty(**[[44, 31], 26]) == 2\nassert my_solution.maximumBeauty(**[[70, 60], 15]) == 2\nassert my_solution.maximumBeauty(**[[60, 22], 11]) == 1\nassert my_solution.maximumBeauty(**[[33, 20], 1]) == 1\nassert my_solution.maximumBeauty(**[[64, 24], 4]) == 1\nassert my_solution.maximumBeauty(**[[59, 20], 28]) == 2\nassert my_solution.maximumBeauty(**[[10, 98], 27]) == 1\nassert my_solution.maximumBeauty(**[[54, 21], 20]) == 2\n"}, "labels": {"questionId": "2891", "questionFrontendId": "2779", "questionTitle": "Maximum Beauty of an Array After Applying Operation", "stats": {"totalAccepted": "6.7K", "totalSubmission": "16.7K", "totalAcceptedRaw": 6655, "totalSubmissionRaw": 16677, "acRate": "39.9%"}, "probedCases": [{"inputs": [[4, 6, 1, 2], 2], "output": 3}, {"inputs": [[1, 1, 1, 1], 10], "output": 4}, {"inputs": [[12, 71], 10], "output": 1}, {"inputs": [[27, 55], 1], "output": 1}, {"inputs": [[52, 34], 21], "output": 2}, {"inputs": [[76, 0], 16], "output": 1}, {"inputs": [[56, 40], 26], "output": 2}, {"inputs": [[49, 26], 12], "output": 2}, {"inputs": [[69, 66], 14], "output": 2}, {"inputs": [[64, 98], 12], "output": 1}, {"inputs": [[83, 81], 7], "output": 2}, {"inputs": [[44, 93], 15], "output": 1}, {"inputs": [[44, 31], 26], "output": 2}, {"inputs": [[70, 60], 15], "output": 2}, {"inputs": [[60, 22], 11], "output": 1}, {"inputs": [[33, 20], 1], "output": 1}, {"inputs": [[64, 24], 4], "output": 1}, {"inputs": [[59, 20], 28], "output": 2}, {"inputs": [[10, 98], 27], "output": 1}, {"inputs": [[54, 21], 20], "output": 2}]}} +{"id": "LeetCode/2888", "content": "# Minimum Index of a Valid Split\n\nAn element `x` of an integer array `arr` of length `m` is **dominant** if `freq(x) * 2 > m`, where `freq(x)` is the number of occurrences of `x` in `arr`. Note that this definition implies that `arr` can have **at most one** dominant element.\n\n\nYou are given a **0-indexed** integer array `nums` of length `n` with one dominant element.\n\n\nYou can split `nums` at an index `i` into two arrays `nums[0, ..., i]` and `nums[i + 1, ..., n - 1]`, but the split is only **valid** if:\n\n\n* `0 <= i < n - 1`\n* `nums[0, ..., i]`, and `nums[i + 1, ..., n - 1]` have the same dominant element.\n\n\nHere, `nums[i, ..., j]` denotes the subarray of `nums` starting at index `i` and ending at index `j`, both ends being inclusive. Particularly, if `j < i` then `nums[i, ..., j]` denotes an empty subarray.\n\n\nReturn *the **minimum** index of a **valid split***. If no valid split exists, return `-1`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,2,2]\n**Output:** 2\n**Explanation:** We can split the array at index 2 to obtain arrays [1,2,2] and [2]. \nIn array [1,2,2], element 2 is dominant since it occurs twice in the array and 2 * 2 > 3. \nIn array [2], element 2 is dominant since it occurs once in the array and 1 * 2 > 1.\nBoth [1,2,2] and [2] have the same dominant element as nums, so this is a valid split. \nIt can be shown that index 2 is the minimum index of a valid split. \n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,1,3,1,1,1,7,1,2,1]\n**Output:** 4\n**Explanation:** We can split the array at index 4 to obtain arrays [2,1,3,1,1] and [1,7,1,2,1].\nIn array [2,1,3,1,1], element 1 is dominant since it occurs thrice in the array and 3 * 2 > 5.\nIn array [1,7,1,2,1], element 1 is dominant since it occurs thrice in the array and 3 * 2 > 5.\nBoth [2,1,3,1,1] and [1,7,1,2,1] have the same dominant element as nums, so this is a valid split.\nIt can be shown that index 4 is the minimum index of a valid split.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [3,3,3,3,7,2,2]\n**Output:** -1\n**Explanation:** It can be shown that there is no valid split.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n* `nums` has exactly one dominant element.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumIndex(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumIndex(**[[1, 2, 2, 2]]) == 2\nassert my_solution.minimumIndex(**[[2, 1, 3, 1, 1, 1, 7, 1, 2, 1]]) == 4\nassert my_solution.minimumIndex(**[[3, 3, 3, 3, 7, 2, 2]]) == -1\nassert my_solution.minimumIndex(**[[1]]) == -1\nassert my_solution.minimumIndex(**[[1, 1]]) == 0\nassert my_solution.minimumIndex(**[[1, 1, 1]]) == 0\nassert my_solution.minimumIndex(**[[1, 1, 1, 1]]) == 0\nassert my_solution.minimumIndex(**[[1, 1, 1, 2]]) == 0\nassert my_solution.minimumIndex(**[[1, 1, 1, 3]]) == 0\nassert my_solution.minimumIndex(**[[1, 1, 1, 4]]) == 0\nassert my_solution.minimumIndex(**[[1, 1, 2]]) == -1\nassert my_solution.minimumIndex(**[[1, 1, 2, 1]]) == 0\nassert my_solution.minimumIndex(**[[1, 1, 3]]) == -1\nassert my_solution.minimumIndex(**[[1, 1, 3, 1]]) == 0\nassert my_solution.minimumIndex(**[[1, 1, 4]]) == -1\nassert my_solution.minimumIndex(**[[1, 1, 4, 1]]) == 0\nassert my_solution.minimumIndex(**[[1, 2, 1]]) == -1\nassert my_solution.minimumIndex(**[[1, 2, 1, 1]]) == 0\nassert my_solution.minimumIndex(**[[1, 2, 2]]) == -1\nassert my_solution.minimumIndex(**[[1, 3, 1]]) == -1\n"}, "labels": {"questionId": "2888", "questionFrontendId": "2780", "questionTitle": "Minimum Index of a Valid Split", "stats": {"totalAccepted": "5K", "totalSubmission": "7.5K", "totalAcceptedRaw": 4951, "totalSubmissionRaw": 7546, "acRate": "65.6%"}, "probedCases": [{"inputs": [[1, 2, 2, 2]], "output": 2}, {"inputs": [[2, 1, 3, 1, 1, 1, 7, 1, 2, 1]], "output": 4}, {"inputs": [[3, 3, 3, 3, 7, 2, 2]], "output": -1}, {"inputs": [[1]], "output": -1}, {"inputs": [[1, 1]], "output": 0}, {"inputs": [[1, 1, 1]], "output": 0}, {"inputs": [[1, 1, 1, 1]], "output": 0}, {"inputs": [[1, 1, 1, 2]], "output": 0}, {"inputs": [[1, 1, 1, 3]], "output": 0}, {"inputs": [[1, 1, 1, 4]], "output": 0}, {"inputs": [[1, 1, 2]], "output": -1}, {"inputs": [[1, 1, 2, 1]], "output": 0}, {"inputs": [[1, 1, 3]], "output": -1}, {"inputs": [[1, 1, 3, 1]], "output": 0}, {"inputs": [[1, 1, 4]], "output": -1}, {"inputs": [[1, 1, 4, 1]], "output": 0}, {"inputs": [[1, 2, 1]], "output": -1}, {"inputs": [[1, 2, 1, 1]], "output": 0}, {"inputs": [[1, 2, 2]], "output": -1}, {"inputs": [[1, 3, 1]], "output": -1}]}} +{"id": "LeetCode/2884", "content": "# Length of the Longest Valid Substring\n\nYou are given a string `word` and an array of strings `forbidden`.\n\n\nA string is called **valid** if none of its substrings are present in `forbidden`.\n\n\nReturn *the length of the **longest valid substring** of the string* `word`.\n\n\nA **substring** is a contiguous sequence of characters in a string, possibly empty.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** word = \"cbaaaabc\", forbidden = [\"aaa\",\"cb\"]\n**Output:** 4\n**Explanation:** There are 11 valid substrings in word: \"c\", \"b\", \"a\", \"ba\", \"aa\", \"bc\", \"baa\", \"aab\", \"ab\", \"abc\" and \"aabc\". The length of the longest valid substring is 4. \nIt can be shown that all other substrings contain either \"aaa\" or \"cb\" as a substring. \n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** word = \"leetcode\", forbidden = [\"de\",\"le\",\"e\"]\n**Output:** 4\n**Explanation:** There are 11 valid substrings in word: \"l\", \"t\", \"c\", \"o\", \"d\", \"tc\", \"co\", \"od\", \"tco\", \"cod\", and \"tcod\". The length of the longest valid substring is 4.\nIt can be shown that all other substrings contain either \"de\", \"le\", or \"e\" as a substring. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= word.length <= 105`\n* `word` consists only of lowercase English letters.\n* `1 <= forbidden.length <= 105`\n* `1 <= forbidden[i].length <= 10`\n* `forbidden[i]` consists only of lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def longestValidSubstring(self, word: str, forbidden: List[str]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.longestValidSubstring(**['cbaaaabc', ['aaa', 'cb']]) == 4\nassert my_solution.longestValidSubstring(**['leetcode', ['de', 'le', 'e']]) == 4\nassert my_solution.longestValidSubstring(**['a', ['n']]) == 1\nassert my_solution.longestValidSubstring(**['a', ['s']]) == 1\nassert my_solution.longestValidSubstring(**['a', ['a']]) == 0\nassert my_solution.longestValidSubstring(**['b', ['g']]) == 1\nassert my_solution.longestValidSubstring(**['b', ['t']]) == 1\nassert my_solution.longestValidSubstring(**['b', ['b']]) == 0\nassert my_solution.longestValidSubstring(**['c', ['k']]) == 1\nassert my_solution.longestValidSubstring(**['c', ['s']]) == 1\nassert my_solution.longestValidSubstring(**['c', ['c']]) == 0\nassert my_solution.longestValidSubstring(**['d', ['h']]) == 1\nassert my_solution.longestValidSubstring(**['d', ['n']]) == 1\nassert my_solution.longestValidSubstring(**['d', ['d']]) == 0\nassert my_solution.longestValidSubstring(**['e', ['s']]) == 1\nassert my_solution.longestValidSubstring(**['e', ['e']]) == 0\nassert my_solution.longestValidSubstring(**['f', ['b']]) == 1\nassert my_solution.longestValidSubstring(**['f', ['s']]) == 1\nassert my_solution.longestValidSubstring(**['f', ['f']]) == 0\nassert my_solution.longestValidSubstring(**['g', ['r']]) == 1\n"}, "labels": {"questionId": "2884", "questionFrontendId": "2781", "questionTitle": "Length of the Longest Valid Substring", "stats": {"totalAccepted": "4K", "totalSubmission": "10.3K", "totalAcceptedRaw": 4003, "totalSubmissionRaw": 10322, "acRate": "38.8%"}, "probedCases": [{"inputs": ["cbaaaabc", ["aaa", "cb"]], "output": 4}, {"inputs": ["leetcode", ["de", "le", "e"]], "output": 4}, {"inputs": ["a", ["n"]], "output": 1}, {"inputs": ["a", ["s"]], "output": 1}, {"inputs": ["a", ["a"]], "output": 0}, {"inputs": ["b", ["g"]], "output": 1}, {"inputs": ["b", ["t"]], "output": 1}, {"inputs": ["b", ["b"]], "output": 0}, {"inputs": ["c", ["k"]], "output": 1}, {"inputs": ["c", ["s"]], "output": 1}, {"inputs": ["c", ["c"]], "output": 0}, {"inputs": ["d", ["h"]], "output": 1}, {"inputs": ["d", ["n"]], "output": 1}, {"inputs": ["d", ["d"]], "output": 0}, {"inputs": ["e", ["s"]], "output": 1}, {"inputs": ["e", ["e"]], "output": 0}, {"inputs": ["f", ["b"]], "output": 1}, {"inputs": ["f", ["s"]], "output": 1}, {"inputs": ["f", ["f"]], "output": 0}, {"inputs": ["g", ["r"]], "output": 1}]}} +{"id": "LeetCode/2812", "content": "# Find the Maximum Achievable Number\n\nYou are given two integers, `num` and `t`.\n\n\nAn integer `x` is called **achievable** if it can become equal to `num` after applying the following operation no more than `t` times:\n\n\n* Increase or decrease `x` by `1`, and simultaneously increase or decrease `num` by `1`.\n\n\nReturn *the maximum possible achievable number*. It can be proven that there exists at least one achievable number.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** num = 4, t = 1\n**Output:** 6\n**Explanation:** The maximum achievable number is x = 6; it can become equal to num after performing this operation:\n1- Decrease x by 1, and increase num by 1. Now, x = 5 and num = 5. \nIt can be proven that there is no achievable number larger than 6.\n\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** num = 3, t = 2\n**Output:** 7\n**Explanation:** The maximum achievable number is x = 7; after performing these operations, x will equal num: \n1- Decrease x by 1, and increase num by 1. Now, x = 6 and num = 4.\n2- Decrease x by 1, and increase num by 1. Now, x = 5 and num = 5.\nIt can be proven that there is no achievable number larger than 7.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= num, t <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def theMaximumAchievableX(self, num: int, t: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.theMaximumAchievableX(**[4, 1]) == 6\nassert my_solution.theMaximumAchievableX(**[3, 2]) == 7\nassert my_solution.theMaximumAchievableX(**[1, 1]) == 3\nassert my_solution.theMaximumAchievableX(**[1, 2]) == 5\nassert my_solution.theMaximumAchievableX(**[1, 3]) == 7\nassert my_solution.theMaximumAchievableX(**[1, 4]) == 9\nassert my_solution.theMaximumAchievableX(**[1, 5]) == 11\nassert my_solution.theMaximumAchievableX(**[1, 6]) == 13\nassert my_solution.theMaximumAchievableX(**[1, 7]) == 15\nassert my_solution.theMaximumAchievableX(**[1, 8]) == 17\nassert my_solution.theMaximumAchievableX(**[1, 9]) == 19\nassert my_solution.theMaximumAchievableX(**[1, 10]) == 21\nassert my_solution.theMaximumAchievableX(**[1, 11]) == 23\nassert my_solution.theMaximumAchievableX(**[1, 12]) == 25\nassert my_solution.theMaximumAchievableX(**[1, 13]) == 27\nassert my_solution.theMaximumAchievableX(**[1, 14]) == 29\nassert my_solution.theMaximumAchievableX(**[1, 15]) == 31\nassert my_solution.theMaximumAchievableX(**[1, 16]) == 33\nassert my_solution.theMaximumAchievableX(**[1, 17]) == 35\nassert my_solution.theMaximumAchievableX(**[1, 18]) == 37\n"}, "labels": {"questionId": "2812", "questionFrontendId": "2769", "questionTitle": "Find the Maximum Achievable Number", "stats": {"totalAccepted": "13.9K", "totalSubmission": "15.5K", "totalAcceptedRaw": 13921, "totalSubmissionRaw": 15516, "acRate": "89.7%"}, "probedCases": [{"inputs": [4, 1], "output": 6}, {"inputs": [3, 2], "output": 7}, {"inputs": [1, 1], "output": 3}, {"inputs": [1, 2], "output": 5}, {"inputs": [1, 3], "output": 7}, {"inputs": [1, 4], "output": 9}, {"inputs": [1, 5], "output": 11}, {"inputs": [1, 6], "output": 13}, {"inputs": [1, 7], "output": 15}, {"inputs": [1, 8], "output": 17}, {"inputs": [1, 9], "output": 19}, {"inputs": [1, 10], "output": 21}, {"inputs": [1, 11], "output": 23}, {"inputs": [1, 12], "output": 25}, {"inputs": [1, 13], "output": 27}, {"inputs": [1, 14], "output": 29}, {"inputs": [1, 15], "output": 31}, {"inputs": [1, 16], "output": 33}, {"inputs": [1, 17], "output": 35}, {"inputs": [1, 18], "output": 37}]}} +{"id": "LeetCode/2855", "content": "# Maximum Number of Jumps to Reach the Last Index\n\nYou are given a **0-indexed** array `nums` of `n` integers and an integer `target`.\n\n\nYou are initially positioned at index `0`. In one step, you can jump from index `i` to any index `j` such that:\n\n\n* `0 <= i < j < n`\n* `-target <= nums[j] - nums[i] <= target`\n\n\nReturn *the **maximum number of jumps** you can make to reach index* `n - 1`.\n\n\nIf there is no way to reach index `n - 1`, return `-1`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,3,6,4,1,2], target = 2\n**Output:** 3\n**Explanation:** To go from index 0 to index n - 1 with the maximum number of jumps, you can perform the following jumping sequence:\n- Jump from index 0 to index 1. \n- Jump from index 1 to index 3.\n- Jump from index 3 to index 5.\nIt can be proven that there is no other jumping sequence that goes from 0 to n - 1 with more than 3 jumps. Hence, the answer is 3. \n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,3,6,4,1,2], target = 3\n**Output:** 5\n**Explanation:** To go from index 0 to index n - 1 with the maximum number of jumps, you can perform the following jumping sequence:\n- Jump from index 0 to index 1.\n- Jump from index 1 to index 2.\n- Jump from index 2 to index 3.\n- Jump from index 3 to index 4.\n- Jump from index 4 to index 5.\nIt can be proven that there is no other jumping sequence that goes from 0 to n - 1 with more than 5 jumps. Hence, the answer is 5. \n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,3,6,4,1,2], target = 0\n**Output:** -1\n**Explanation:** It can be proven that there is no jumping sequence that goes from 0 to n - 1. Hence, the answer is -1. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= nums.length == n <= 1000`\n* `-109 <= nums[i] <= 109`\n* `0 <= target <= 2 * 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumJumps(self, nums: List[int], target: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumJumps(**[[1, 3, 6, 4, 1, 2], 2]) == 3\nassert my_solution.maximumJumps(**[[1, 3, 6, 4, 1, 2], 3]) == 5\nassert my_solution.maximumJumps(**[[1, 3, 6, 4, 1, 2], 0]) == -1\nassert my_solution.maximumJumps(**[[0, 1], 0]) == -1\nassert my_solution.maximumJumps(**[[0, 1], 1]) == 1\nassert my_solution.maximumJumps(**[[0, 1], 2]) == 1\nassert my_solution.maximumJumps(**[[1, 0], 0]) == -1\nassert my_solution.maximumJumps(**[[1, 0], 1]) == 1\nassert my_solution.maximumJumps(**[[1, 0], 2]) == 1\nassert my_solution.maximumJumps(**[[0, 1, 2], 0]) == -1\nassert my_solution.maximumJumps(**[[0, 1, 2], 1]) == 2\nassert my_solution.maximumJumps(**[[0, 1, 2], 2]) == 2\nassert my_solution.maximumJumps(**[[0, 1, 2], 3]) == 2\nassert my_solution.maximumJumps(**[[0, 2, 1], 0]) == -1\nassert my_solution.maximumJumps(**[[0, 2, 1], 1]) == 1\nassert my_solution.maximumJumps(**[[0, 2, 1], 2]) == 2\nassert my_solution.maximumJumps(**[[0, 2, 1], 3]) == 2\nassert my_solution.maximumJumps(**[[1, 0, 2], 0]) == -1\nassert my_solution.maximumJumps(**[[1, 0, 2], 1]) == 1\nassert my_solution.maximumJumps(**[[1, 0, 2], 2]) == 2\n"}, "labels": {"questionId": "2855", "questionFrontendId": "2770", "questionTitle": "Maximum Number of Jumps to Reach the Last Index", "stats": {"totalAccepted": "6.8K", "totalSubmission": "19K", "totalAcceptedRaw": 6779, "totalSubmissionRaw": 18955, "acRate": "35.8%"}, "probedCases": [{"inputs": [[1, 3, 6, 4, 1, 2], 2], "output": 3}, {"inputs": [[1, 3, 6, 4, 1, 2], 3], "output": 5}, {"inputs": [[1, 3, 6, 4, 1, 2], 0], "output": -1}, {"inputs": [[0, 1], 0], "output": -1}, {"inputs": [[0, 1], 1], "output": 1}, {"inputs": [[0, 1], 2], "output": 1}, {"inputs": [[1, 0], 0], "output": -1}, {"inputs": [[1, 0], 1], "output": 1}, {"inputs": [[1, 0], 2], "output": 1}, {"inputs": [[0, 1, 2], 0], "output": -1}, {"inputs": [[0, 1, 2], 1], "output": 2}, {"inputs": [[0, 1, 2], 2], "output": 2}, {"inputs": [[0, 1, 2], 3], "output": 2}, {"inputs": [[0, 2, 1], 0], "output": -1}, {"inputs": [[0, 2, 1], 1], "output": 1}, {"inputs": [[0, 2, 1], 2], "output": 2}, {"inputs": [[0, 2, 1], 3], "output": 2}, {"inputs": [[1, 0, 2], 0], "output": -1}, {"inputs": [[1, 0, 2], 1], "output": 1}, {"inputs": [[1, 0, 2], 2], "output": 2}]}} +{"id": "LeetCode/2869", "content": "# Longest Non-decreasing Subarray From Two Arrays\n\nYou are given two **0-indexed** integer arrays `nums1` and `nums2` of length `n`.\n\n\nLet's define another **0-indexed** integer array, `nums3`, of length `n`. For each index `i` in the range `[0, n - 1]`, you can assign either `nums1[i]` or `nums2[i]` to `nums3[i]`.\n\n\nYour task is to maximize the length of the **longest non-decreasing subarray** in `nums3` by choosing its values optimally.\n\n\nReturn *an integer representing the length of the **longest non-decreasing** subarray in* `nums3`.\n\n\n**Note:** A **subarray** is a contiguous **non-empty** sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums1 = [2,3,1], nums2 = [1,2,1]\n**Output:** 2\n**Explanation:** One way to construct nums3 is: \nnums3 = [nums1[0], nums2[1], nums2[2]] => [2,2,1]. \nThe subarray starting from index 0 and ending at index 1, [2,2], forms a non-decreasing subarray of length 2. \nWe can show that 2 is the maximum achievable length.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums1 = [1,3,2,1], nums2 = [2,2,3,4]\n**Output:** 4\n**Explanation:** One way to construct nums3 is: \nnums3 = [nums1[0], nums2[1], nums2[2], nums2[3]] => [1,2,3,4]. \nThe entire array forms a non-decreasing subarray of length 4, making it the maximum achievable length.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums1 = [1,1], nums2 = [2,2]\n**Output:** 2\n**Explanation:** One way to construct nums3 is: \nnums3 = [nums1[0], nums1[1]] => [1,1]. \nThe entire array forms a non-decreasing subarray of length 2, making it the maximum achievable length.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums1.length == nums2.length == n <= 105`\n* `1 <= nums1[i], nums2[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxNonDecreasingLength(self, nums1: List[int], nums2: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxNonDecreasingLength(**[[2, 3, 1], [1, 2, 1]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[1, 3, 2, 1], [2, 2, 3, 4]]) == 4\nassert my_solution.maxNonDecreasingLength(**[[1, 1], [2, 2]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[1], [1]]) == 1\nassert my_solution.maxNonDecreasingLength(**[[1], [2]]) == 1\nassert my_solution.maxNonDecreasingLength(**[[1, 4], [4, 19]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[1, 8], [10, 1]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[1, 11], [9, 1]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[1, 13], [18, 1]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[1, 19], [12, 20]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[1, 19], [18, 9]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[2, 20], [1, 18]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[3, 5], [13, 3]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[3, 6], [10, 12]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[3, 7], [8, 3]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[3, 8], [15, 2]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[3, 9], [11, 3]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[3, 12], [7, 3]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[3, 12], [20, 3]]) == 2\nassert my_solution.maxNonDecreasingLength(**[[3, 20], [5, 17]]) == 2\n"}, "labels": {"questionId": "2869", "questionFrontendId": "2771", "questionTitle": "Longest Non-decreasing Subarray From Two Arrays", "stats": {"totalAccepted": "5.7K", "totalSubmission": "16.3K", "totalAcceptedRaw": 5687, "totalSubmissionRaw": 16309, "acRate": "34.9%"}, "probedCases": [{"inputs": [[2, 3, 1], [1, 2, 1]], "output": 2}, {"inputs": [[1, 3, 2, 1], [2, 2, 3, 4]], "output": 4}, {"inputs": [[1, 1], [2, 2]], "output": 2}, {"inputs": [[1], [1]], "output": 1}, {"inputs": [[1], [2]], "output": 1}, {"inputs": [[1, 4], [4, 19]], "output": 2}, {"inputs": [[1, 8], [10, 1]], "output": 2}, {"inputs": [[1, 11], [9, 1]], "output": 2}, {"inputs": [[1, 13], [18, 1]], "output": 2}, {"inputs": [[1, 19], [12, 20]], "output": 2}, {"inputs": [[1, 19], [18, 9]], "output": 2}, {"inputs": [[2, 20], [1, 18]], "output": 2}, {"inputs": [[3, 5], [13, 3]], "output": 2}, {"inputs": [[3, 6], [10, 12]], "output": 2}, {"inputs": [[3, 7], [8, 3]], "output": 2}, {"inputs": [[3, 8], [15, 2]], "output": 2}, {"inputs": [[3, 9], [11, 3]], "output": 2}, {"inputs": [[3, 12], [7, 3]], "output": 2}, {"inputs": [[3, 12], [20, 3]], "output": 2}, {"inputs": [[3, 20], [5, 17]], "output": 2}]}} +{"id": "LeetCode/2878", "content": "# Apply Operations to Make All Array Elements Equal to Zero\n\nYou are given a **0-indexed** integer array `nums` and a positive integer `k`.\n\n\nYou can apply the following operation on the array **any** number of times:\n\n\n* Choose **any** subarray of size `k` from the array and **decrease** all its elements by `1`.\n\n\nReturn `true` *if you can make all the array elements equal to* `0`*, or* `false` *otherwise*.\n\n\nA **subarray** is a contiguous non-empty part of an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,2,3,1,1,0], k = 3\n**Output:** true\n**Explanation:** We can do the following operations:\n- Choose the subarray [2,2,3]. The resulting array will be nums = [**1**,**1**,**2**,1,1,0].\n- Choose the subarray [2,1,1]. The resulting array will be nums = [1,1,**1**,**0**,**0**,0].\n- Choose the subarray [1,1,1]. The resulting array will be nums = [**0**,**0**,**0**,0,0,0].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,3,1,1], k = 2\n**Output:** false\n**Explanation:** It is not possible to make all the array elements equal to 0.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= k <= nums.length <= 105`\n* `0 <= nums[i] <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def checkArray(self, nums: List[int], k: int) -> bool:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.checkArray(**[[2, 2, 3, 1, 1, 0], 3]) == True\nassert my_solution.checkArray(**[[1, 3, 1, 1], 2]) == False\nassert my_solution.checkArray(**[[60, 72, 87, 89, 63, 52, 64, 62, 31, 37, 57, 83, 98, 94, 92, 77, 94, 91, 87, 100, 91, 91, 50, 26], 4]) == True\nassert my_solution.checkArray(**[[63, 40, 30, 0, 72, 53], 1]) == True\nassert my_solution.checkArray(**[[59, 60, 99, 99, 99, 99, 99, 99, 99, 40, 39, 0], 9]) == True\nassert my_solution.checkArray(**[[24, 24, 14, 37, 31, 88, 94, 38, 94, 0, 100, 100, 4, 46, 5, 50, 0, 33, 22, 25, 0], 10]) == False\nassert my_solution.checkArray(**[[0, 0, 51, 67, 80, 98, 88, 75, 89, 83, 100, 70, 77, 82, 57, 100, 80, 69, 19, 17], 3]) == True\nassert my_solution.checkArray(**[[22], 1]) == True\nassert my_solution.checkArray(**[[22, 4, 1, 25, 68, 30, 97, 99, 100, 22, 20, 39, 85, 68, 3, 1, 1, 74], 4]) == False\nassert my_solution.checkArray(**[[8, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 43, 0], 25]) == True\nassert my_solution.checkArray(**[[27, 99, 7, 1, 94, 63, 84, 46, 76, 35, 97, 77, 19, 72, 3], 2]) == False\nassert my_solution.checkArray(**[[0, 0, 39, 84, 86, 94, 55, 10, 8, 0], 4]) == True\nassert my_solution.checkArray(**[[60, 78, 96, 97, 97, 97, 49, 7, 97, 97, 97, 99, 97, 97, 97, 97, 85, 97, 97, 97, 37, 5, 1], 20]) == False\nassert my_solution.checkArray(**[[12, 79, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 83, 16, 0], 24]) == True\nassert my_solution.checkArray(**[[0, 0, 33, 72, 86, 53, 14], 3]) == True\nassert my_solution.checkArray(**[[0, 0, 8, 64, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 81, 25], 25]) == True\nassert my_solution.checkArray(**[[84, 0, 68, 95, 95, 0, 25, 0, 7, 71, 4, 68, 23, 97, 80, 0], 1]) == True\nassert my_solution.checkArray(**[[48, 48, 48, 48, 48], 5]) == True\nassert my_solution.checkArray(**[[34, 34, 99, 93, 93, 26, 99, 100, 94, 94, 82, 86, 100, 100, 87, 100, 100, 100, 100, 100, 63, 100, 100, 66, 17, 10, 8, 7, 3, 1], 23]) == False\nassert my_solution.checkArray(**[[67, 98, 97, 99, 98, 97, 97, 96, 99, 99, 99, 42, 68, 18, 99, 44, 95, 79, 1, 16, 49, 1, 2, 2, 0], 16]) == False\n"}, "labels": {"questionId": "2878", "questionFrontendId": "2772", "questionTitle": "Apply Operations to Make All Array Elements Equal to Zero", "stats": {"totalAccepted": "5.6K", "totalSubmission": "15K", "totalAcceptedRaw": 5587, "totalSubmissionRaw": 15049, "acRate": "37.1%"}, "probedCases": [{"inputs": [[2, 2, 3, 1, 1, 0], 3], "output": true}, {"inputs": [[1, 3, 1, 1], 2], "output": false}, {"inputs": [[60, 72, 87, 89, 63, 52, 64, 62, 31, 37, 57, 83, 98, 94, 92, 77, 94, 91, 87, 100, 91, 91, 50, 26], 4], "output": true}, {"inputs": [[63, 40, 30, 0, 72, 53], 1], "output": true}, {"inputs": [[59, 60, 99, 99, 99, 99, 99, 99, 99, 40, 39, 0], 9], "output": true}, {"inputs": [[24, 24, 14, 37, 31, 88, 94, 38, 94, 0, 100, 100, 4, 46, 5, 50, 0, 33, 22, 25, 0], 10], "output": false}, {"inputs": [[0, 0, 51, 67, 80, 98, 88, 75, 89, 83, 100, 70, 77, 82, 57, 100, 80, 69, 19, 17], 3], "output": true}, {"inputs": [[22], 1], "output": true}, {"inputs": [[22, 4, 1, 25, 68, 30, 97, 99, 100, 22, 20, 39, 85, 68, 3, 1, 1, 74], 4], "output": false}, {"inputs": [[8, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 43, 0], 25], "output": true}, {"inputs": [[27, 99, 7, 1, 94, 63, 84, 46, 76, 35, 97, 77, 19, 72, 3], 2], "output": false}, {"inputs": [[0, 0, 39, 84, 86, 94, 55, 10, 8, 0], 4], "output": true}, {"inputs": [[60, 78, 96, 97, 97, 97, 49, 7, 97, 97, 97, 99, 97, 97, 97, 97, 85, 97, 97, 97, 37, 5, 1], 20], "output": false}, {"inputs": [[12, 79, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 83, 16, 0], 24], "output": true}, {"inputs": [[0, 0, 33, 72, 86, 53, 14], 3], "output": true}, {"inputs": [[0, 0, 8, 64, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 81, 25], 25], "output": true}, {"inputs": [[84, 0, 68, 95, 95, 0, 25, 0, 7, 71, 4, 68, 23, 97, 80, 0], 1], "output": true}, {"inputs": [[48, 48, 48, 48, 48], 5], "output": true}, {"inputs": [[34, 34, 99, 93, 93, 26, 99, 100, 94, 94, 82, 86, 100, 100, 87, 100, 100, 100, 100, 100, 63, 100, 100, 66, 17, 10, 8, 7, 3, 1], 23], "output": false}, {"inputs": [[67, 98, 97, 99, 98, 97, 97, 96, 99, 99, 99, 42, 68, 18, 99, 44, 95, 79, 1, 16, 49, 1, 2, 2, 0], 16], "output": false}]}} +{"id": "LeetCode/2870", "content": "# Longest Alternating Subarray\n\nYou are given a **0-indexed** integer array `nums`. A subarray `s` of length `m` is called **alternating** if:\n\n\n* `m` is greater than `1`.\n* `s1 = s0 + 1`.\n* The **0-indexed** subarray `s` looks like `[s0, s1, s0, s1,...,s(m-1) % 2]`. In other words, `s1 - s0 = 1`, `s2 - s1 = -1`, `s3 - s2 = 1`, `s4 - s3 = -1`, and so on up to `s[m - 1] - s[m - 2] = (-1)m`.\n\n\nReturn *the maximum length of all **alternating** subarrays present in* `nums` *or* `-1` *if no such subarray exists**.*\n\n\nA subarray is a contiguous **non-empty** sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,3,4,3,4]\n**Output:** 4\n**Explanation:** The alternating subarrays are [3,4], [3,4,3], and [3,4,3,4]. The longest of these is [3,4,3,4], which is of length 4.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [4,5,6]\n**Output:** 2\n**Explanation:** [4,5] and [5,6] are the only two alternating subarrays. They are both of length 2.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= nums.length <= 100`\n* `1 <= nums[i] <= 104`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def alternatingSubarray(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.alternatingSubarray(**[[2, 3, 4, 3, 4]]) == 4\nassert my_solution.alternatingSubarray(**[[4, 5, 6]]) == 2\nassert my_solution.alternatingSubarray(**[[31, 32, 31, 32, 33]]) == 4\nassert my_solution.alternatingSubarray(**[[21, 9, 5]]) == -1\nassert my_solution.alternatingSubarray(**[[42, 43, 44, 43, 44, 43, 44, 45, 46]]) == 6\nassert my_solution.alternatingSubarray(**[[13, 14, 15, 14]]) == 3\nassert my_solution.alternatingSubarray(**[[74, 75, 74, 75, 74, 75, 74, 75]]) == 8\nassert my_solution.alternatingSubarray(**[[77, 78, 79, 78, 79, 78, 79, 78, 79, 80]]) == 8\nassert my_solution.alternatingSubarray(**[[88, 42, 53]]) == -1\nassert my_solution.alternatingSubarray(**[[64, 65, 64, 65, 64, 65, 66, 65, 66, 65]]) == 6\nassert my_solution.alternatingSubarray(**[[99, 100, 99, 100]]) == 4\nassert my_solution.alternatingSubarray(**[[21, 22]]) == 2\nassert my_solution.alternatingSubarray(**[[23, 24, 23, 24, 25, 24, 25, 24, 25]]) == 6\nassert my_solution.alternatingSubarray(**[[20, 9, 15, 15]]) == -1\nassert my_solution.alternatingSubarray(**[[92, 93, 92, 93, 92]]) == 5\nassert my_solution.alternatingSubarray(**[[24, 25, 26]]) == 2\nassert my_solution.alternatingSubarray(**[[51, 52, 53, 52, 53, 52, 53, 54, 53]]) == 6\nassert my_solution.alternatingSubarray(**[[65, 66, 65, 66, 67, 68, 69]]) == 4\nassert my_solution.alternatingSubarray(**[[29, 2, 5, 24]]) == -1\nassert my_solution.alternatingSubarray(**[[26, 27, 26, 27, 28, 27, 28, 27, 28]]) == 6\n"}, "labels": {"questionId": "2870", "questionFrontendId": "2765", "questionTitle": "Longest Alternating Subarray", "stats": {"totalAccepted": "14.8K", "totalSubmission": "29.8K", "totalAcceptedRaw": 14784, "totalSubmissionRaw": 29841, "acRate": "49.5%"}, "probedCases": [{"inputs": [[2, 3, 4, 3, 4]], "output": 4}, {"inputs": [[4, 5, 6]], "output": 2}, {"inputs": [[31, 32, 31, 32, 33]], "output": 4}, {"inputs": [[21, 9, 5]], "output": -1}, {"inputs": [[42, 43, 44, 43, 44, 43, 44, 45, 46]], "output": 6}, {"inputs": [[13, 14, 15, 14]], "output": 3}, {"inputs": [[74, 75, 74, 75, 74, 75, 74, 75]], "output": 8}, {"inputs": [[77, 78, 79, 78, 79, 78, 79, 78, 79, 80]], "output": 8}, {"inputs": [[88, 42, 53]], "output": -1}, {"inputs": [[64, 65, 64, 65, 64, 65, 66, 65, 66, 65]], "output": 6}, {"inputs": [[99, 100, 99, 100]], "output": 4}, {"inputs": [[21, 22]], "output": 2}, {"inputs": [[23, 24, 23, 24, 25, 24, 25, 24, 25]], "output": 6}, {"inputs": [[20, 9, 15, 15]], "output": -1}, {"inputs": [[92, 93, 92, 93, 92]], "output": 5}, {"inputs": [[24, 25, 26]], "output": 2}, {"inputs": [[51, 52, 53, 52, 53, 52, 53, 54, 53]], "output": 6}, {"inputs": [[65, 66, 65, 66, 67, 68, 69]], "output": 4}, {"inputs": [[29, 2, 5, 24]], "output": -1}, {"inputs": [[26, 27, 26, 27, 28, 27, 28, 27, 28]], "output": 6}]}} +{"id": "LeetCode/2834", "content": "# Relocate Marbles\n\nYou are given a **0-indexed** integer array `nums` representing the initial positions of some marbles. You are also given two **0-indexed** integer arrays `moveFrom` and `moveTo` of **equal** length.\n\n\nThroughout `moveFrom.length` steps, you will change the positions of the marbles. On the `ith` step, you will move **all** marbles at position `moveFrom[i]` to position `moveTo[i]`.\n\n\nAfter completing all the steps, return *the sorted list of **occupied** positions*.\n\n\n**Notes:**\n\n\n* We call a position **occupied** if there is at least one marble in that position.\n* There may be multiple marbles in a single position.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,6,7,8], moveFrom = [1,7,2], moveTo = [2,9,5]\n**Output:** [5,6,8,9]\n**Explanation:** Initially, the marbles are at positions 1,6,7,8.\nAt the i = 0th step, we move the marbles at position 1 to position 2. Then, positions 2,6,7,8 are occupied.\nAt the i = 1st step, we move the marbles at position 7 to position 9. Then, positions 2,6,8,9 are occupied.\nAt the i = 2nd step, we move the marbles at position 2 to position 5. Then, positions 5,6,8,9 are occupied.\nAt the end, the final positions containing at least one marbles are [5,6,8,9].\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,1,3,3], moveFrom = [1,3], moveTo = [2,2]\n**Output:** [2]\n**Explanation:** Initially, the marbles are at positions [1,1,3,3].\nAt the i = 0th step, we move all the marbles at position 1 to position 2. Then, the marbles are at positions [2,2,3,3].\nAt the i = 1st step, we move all the marbles at position 3 to position 2. Then, the marbles are at positions [2,2,2,2].\nSince 2 is the only occupied position, we return [2].\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= moveFrom.length <= 105`\n* `moveFrom.length == moveTo.length`\n* `1 <= nums[i], moveFrom[i], moveTo[i] <= 109`\n* The test cases are generated such that there is at least a marble in `moveFrom[i]` at the moment we want to apply the `ith` move.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def relocateMarbles(self, nums: List[int], moveFrom: List[int], moveTo: List[int]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.relocateMarbles(**[[1, 6, 7, 8], [1, 7, 2], [2, 9, 5]]) == [5, 6, 8, 9]\nassert my_solution.relocateMarbles(**[[1, 1, 3, 3], [1, 3], [2, 2]]) == [2]\nassert my_solution.relocateMarbles(**[[5, 7, 8, 15], [5, 7, 8, 9], [9, 15, 2, 7]]) == [2, 7, 15]\nassert my_solution.relocateMarbles(**[[4, 6, 6, 9, 18], [18, 6, 17, 4, 9, 19, 2], [23, 17, 20, 19, 11, 2, 20]]) == [11, 20, 23]\nassert my_solution.relocateMarbles(**[[3, 4], [4, 3, 1, 2, 2, 3, 2, 4, 1], [3, 1, 2, 2, 3, 2, 4, 1, 1]]) == [1]\nassert my_solution.relocateMarbles(**[[5, 13, 22, 23, 23, 33], [13, 5, 12], [1, 12, 13]]) == [1, 13, 22, 23, 33]\nassert my_solution.relocateMarbles(**[[21, 24, 35, 72, 77, 82, 82, 96, 97, 97], [82, 76, 3, 97], [76, 3, 52, 27]]) == [21, 24, 27, 35, 52, 72, 77, 96]\nassert my_solution.relocateMarbles(**[[4, 6, 17, 41, 46, 46, 52, 57], [4], [62]]) == [6, 17, 41, 46, 52, 57, 62]\nassert my_solution.relocateMarbles(**[[1, 4, 10, 24, 46, 55, 61, 63, 71], [10, 52, 1, 80, 63, 55, 4, 46, 71, 24], [52, 42, 80, 55, 50, 62, 60, 17, 46, 38]]) == [17, 38, 42, 46, 50, 60, 61, 62]\nassert my_solution.relocateMarbles(**[[8, 9, 16, 17, 23], [8, 5, 16, 2, 9], [5, 20, 2, 18, 22]]) == [17, 18, 20, 22, 23]\nassert my_solution.relocateMarbles(**[[12, 37, 46, 47, 49, 55, 59, 65, 71, 88], [88, 59, 71], [81, 39, 73]]) == [12, 37, 39, 46, 47, 49, 55, 65, 73, 81]\nassert my_solution.relocateMarbles(**[[2, 45, 45, 48, 51, 57, 67, 73, 78, 78], [78, 67, 45, 34, 51, 62, 48, 95, 2, 67], [34, 65, 62, 95, 62, 12, 85, 67, 79, 71]]) == [12, 57, 65, 71, 73, 79, 85]\nassert my_solution.relocateMarbles(**[[1, 2], [1, 2, 3], [2, 3, 2]]) == [2]\nassert my_solution.relocateMarbles(**[[7, 19, 28, 34, 36, 36, 47], [36, 33, 34, 28, 41, 19, 14, 47, 28, 40], [33, 41, 27, 47, 14, 40, 46, 28, 42, 16]]) == [7, 16, 27, 42, 46]\nassert my_solution.relocateMarbles(**[[1, 1, 1], [1], [7]]) == [7]\nassert my_solution.relocateMarbles(**[[1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]]) == [1]\nassert my_solution.relocateMarbles(**[[5, 9, 17, 20, 29, 29], [20, 5, 1, 29, 22, 21, 9, 36, 33, 1], [1, 22, 21, 36, 36, 15, 33, 1, 3, 15]]) == [3, 15, 17]\nassert my_solution.relocateMarbles(**[[1], [1, 1, 1, 1], [1, 1, 1, 1]]) == [1]\nassert my_solution.relocateMarbles(**[[27, 41, 50, 52, 57, 60, 65, 67, 70], [52, 67, 70, 50, 57, 27, 47], [45, 45, 61, 47, 21, 65, 60]]) == [21, 41, 45, 60, 61, 65]\nassert my_solution.relocateMarbles(**[[2, 3, 7], [2, 7, 8, 8, 3, 5, 1, 4], [8, 5, 8, 1, 4, 4, 4, 5]]) == [5]\n"}, "labels": {"questionId": "2834", "questionFrontendId": "2766", "questionTitle": "Relocate Marbles", "stats": {"totalAccepted": "3.8K", "totalSubmission": "6.9K", "totalAcceptedRaw": 3816, "totalSubmissionRaw": 6860, "acRate": "55.6%"}, "probedCases": [{"inputs": [[1, 6, 7, 8], [1, 7, 2], [2, 9, 5]], "output": [5, 6, 8, 9]}, {"inputs": [[1, 1, 3, 3], [1, 3], [2, 2]], "output": [2]}, {"inputs": [[5, 7, 8, 15], [5, 7, 8, 9], [9, 15, 2, 7]], "output": [2, 7, 15]}, {"inputs": [[4, 6, 6, 9, 18], [18, 6, 17, 4, 9, 19, 2], [23, 17, 20, 19, 11, 2, 20]], "output": [11, 20, 23]}, {"inputs": [[3, 4], [4, 3, 1, 2, 2, 3, 2, 4, 1], [3, 1, 2, 2, 3, 2, 4, 1, 1]], "output": [1]}, {"inputs": [[5, 13, 22, 23, 23, 33], [13, 5, 12], [1, 12, 13]], "output": [1, 13, 22, 23, 33]}, {"inputs": [[21, 24, 35, 72, 77, 82, 82, 96, 97, 97], [82, 76, 3, 97], [76, 3, 52, 27]], "output": [21, 24, 27, 35, 52, 72, 77, 96]}, {"inputs": [[4, 6, 17, 41, 46, 46, 52, 57], [4], [62]], "output": [6, 17, 41, 46, 52, 57, 62]}, {"inputs": [[1, 4, 10, 24, 46, 55, 61, 63, 71], [10, 52, 1, 80, 63, 55, 4, 46, 71, 24], [52, 42, 80, 55, 50, 62, 60, 17, 46, 38]], "output": [17, 38, 42, 46, 50, 60, 61, 62]}, {"inputs": [[8, 9, 16, 17, 23], [8, 5, 16, 2, 9], [5, 20, 2, 18, 22]], "output": [17, 18, 20, 22, 23]}, {"inputs": [[12, 37, 46, 47, 49, 55, 59, 65, 71, 88], [88, 59, 71], [81, 39, 73]], "output": [12, 37, 39, 46, 47, 49, 55, 65, 73, 81]}, {"inputs": [[2, 45, 45, 48, 51, 57, 67, 73, 78, 78], [78, 67, 45, 34, 51, 62, 48, 95, 2, 67], [34, 65, 62, 95, 62, 12, 85, 67, 79, 71]], "output": [12, 57, 65, 71, 73, 79, 85]}, {"inputs": [[1, 2], [1, 2, 3], [2, 3, 2]], "output": [2]}, {"inputs": [[7, 19, 28, 34, 36, 36, 47], [36, 33, 34, 28, 41, 19, 14, 47, 28, 40], [33, 41, 27, 47, 14, 40, 46, 28, 42, 16]], "output": [7, 16, 27, 42, 46]}, {"inputs": [[1, 1, 1], [1], [7]], "output": [7]}, {"inputs": [[1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]], "output": [1]}, {"inputs": [[5, 9, 17, 20, 29, 29], [20, 5, 1, 29, 22, 21, 9, 36, 33, 1], [1, 22, 21, 36, 36, 15, 33, 1, 3, 15]], "output": [3, 15, 17]}, {"inputs": [[1], [1, 1, 1, 1], [1, 1, 1, 1]], "output": [1]}, {"inputs": [[27, 41, 50, 52, 57, 60, 65, 67, 70], [52, 67, 70, 50, 57, 27, 47], [45, 45, 61, 47, 21, 65, 60]], "output": [21, 41, 45, 60, 61, 65]}, {"inputs": [[2, 3, 7], [2, 7, 8, 8, 3, 5, 1, 4], [8, 5, 8, 1, 4, 4, 4, 5]], "output": [5]}]}} +{"id": "LeetCode/2883", "content": "# Partition String Into Minimum Beautiful Substrings\n\nGiven a binary string `s`, partition the string into one or more **substrings** such that each substring is **beautiful**.\n\n\nA string is **beautiful** if:\n\n\n* It doesn't contain leading zeros.\n* It's the **binary** representation of a number that is a power of `5`.\n\n\nReturn *the **minimum** number of substrings in such partition.* If it is impossible to partition the string `s` into beautiful substrings, return `-1`.\n\n\nA **substring** is a contiguous sequence of characters in a string.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"1011\"\n**Output:** 2\n**Explanation:** We can paritition the given string into [\"101\", \"1\"].\n- The string \"101\" does not contain leading zeros and is the binary representation of integer 51 = 5.\n- The string \"1\" does not contain leading zeros and is the binary representation of integer 50 = 1.\nIt can be shown that 2 is the minimum number of beautiful substrings that s can be partitioned into.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"111\"\n**Output:** 3\n**Explanation:** We can paritition the given string into [\"1\", \"1\", \"1\"].\n- The string \"1\" does not contain leading zeros and is the binary representation of integer 50 = 1.\nIt can be shown that 3 is the minimum number of beautiful substrings that s can be partitioned into.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"0\"\n**Output:** -1\n**Explanation:** We can not partition the given string into beautiful substrings.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 15`\n* `s[i]` is either `'0'` or `'1'`.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumBeautifulSubstrings(self, s: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumBeautifulSubstrings(**['1011']) == 2\nassert my_solution.minimumBeautifulSubstrings(**['111']) == 3\nassert my_solution.minimumBeautifulSubstrings(**['0']) == -1\nassert my_solution.minimumBeautifulSubstrings(**['100111000110111']) == 4\nassert my_solution.minimumBeautifulSubstrings(**['100111000111']) == 3\nassert my_solution.minimumBeautifulSubstrings(**['1001110001111']) == 4\nassert my_solution.minimumBeautifulSubstrings(**['100111000111101']) == 4\nassert my_solution.minimumBeautifulSubstrings(**['10110011100011']) == 3\nassert my_solution.minimumBeautifulSubstrings(**['101101']) == 2\nassert my_solution.minimumBeautifulSubstrings(**['101101101']) == 3\nassert my_solution.minimumBeautifulSubstrings(**['101101101101101']) == 5\nassert my_solution.minimumBeautifulSubstrings(**['1011011011101']) == 5\nassert my_solution.minimumBeautifulSubstrings(**['10110110111011']) == 6\nassert my_solution.minimumBeautifulSubstrings(**['101101101111001']) == 5\nassert my_solution.minimumBeautifulSubstrings(**['1011011011111']) == 7\nassert my_solution.minimumBeautifulSubstrings(**['101101110011101']) == 5\nassert my_solution.minimumBeautifulSubstrings(**['10110111001111']) == 6\nassert my_solution.minimumBeautifulSubstrings(**['1011011101101']) == 5\nassert my_solution.minimumBeautifulSubstrings(**['101101110110111']) == 7\nassert my_solution.minimumBeautifulSubstrings(**['101101110111011']) == 7\n"}, "labels": {"questionId": "2883", "questionFrontendId": "2767", "questionTitle": "Partition String Into Minimum Beautiful Substrings", "stats": {"totalAccepted": "3.2K", "totalSubmission": "5.6K", "totalAcceptedRaw": 3180, "totalSubmissionRaw": 5615, "acRate": "56.6%"}, "probedCases": [{"inputs": ["1011"], "output": 2}, {"inputs": ["111"], "output": 3}, {"inputs": ["0"], "output": -1}, {"inputs": ["100111000110111"], "output": 4}, {"inputs": ["100111000111"], "output": 3}, {"inputs": ["1001110001111"], "output": 4}, {"inputs": ["100111000111101"], "output": 4}, {"inputs": ["10110011100011"], "output": 3}, {"inputs": ["101101"], "output": 2}, {"inputs": ["101101101"], "output": 3}, {"inputs": ["101101101101101"], "output": 5}, {"inputs": ["1011011011101"], "output": 5}, {"inputs": ["10110110111011"], "output": 6}, {"inputs": ["101101101111001"], "output": 5}, {"inputs": ["1011011011111"], "output": 7}, {"inputs": ["101101110011101"], "output": 5}, {"inputs": ["10110111001111"], "output": 6}, {"inputs": ["1011011101101"], "output": 5}, {"inputs": ["101101110110111"], "output": 7}, {"inputs": ["101101110111011"], "output": 7}]}} +{"id": "LeetCode/2866", "content": "# Longest Even Odd Subarray With Threshold\n\nYou are given a **0-indexed** integer array `nums` and an integer `threshold`.\n\n\nFind the length of the **longest subarray** of `nums` starting at index `l` and ending at index `r` `(0 <= l <= r < nums.length)` that satisfies the following conditions:\n\n\n* `nums[l] % 2 == 0`\n* For all indices `i` in the range `[l, r - 1]`, `nums[i] % 2 != nums[i + 1] % 2`\n* For all indices `i` in the range `[l, r]`, `nums[i] <= threshold`\n\n\nReturn *an integer denoting the length of the longest such subarray.*\n\n\n**Note:** A **subarray** is a contiguous non-empty sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [3,2,5,4], threshold = 5\n**Output:** 3\n**Explanation:** In this example, we can select the subarray that starts at l = 1 and ends at r = 3 => [2,5,4]. This subarray satisfies the conditions.\nHence, the answer is the length of the subarray, 3. We can show that 3 is the maximum possible achievable length.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2], threshold = 2\n**Output:** 1\n**Explanation:** In this example, we can select the subarray that starts at l = 1 and ends at r = 1 => [2]. \nIt satisfies all the conditions and we can show that 1 is the maximum possible achievable length.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [2,3,4,5], threshold = 4\n**Output:** 3\n**Explanation:** In this example, we can select the subarray that starts at l = 0 and ends at r = 2 => [2,3,4]. \nIt satisfies all the conditions.\nHence, the answer is the length of the subarray, 3. We can show that 3 is the maximum possible achievable length.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 100`\n* `1 <= nums[i] <= 100`\n* `1 <= threshold <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def longestAlternatingSubarray(self, nums: List[int], threshold: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.longestAlternatingSubarray(**[[3, 2, 5, 4], 5]) == 3\nassert my_solution.longestAlternatingSubarray(**[[1, 2], 2]) == 1\nassert my_solution.longestAlternatingSubarray(**[[2, 3, 4, 5], 4]) == 3\nassert my_solution.longestAlternatingSubarray(**[[1], 1]) == 0\nassert my_solution.longestAlternatingSubarray(**[[2], 2]) == 1\nassert my_solution.longestAlternatingSubarray(**[[3], 3]) == 0\nassert my_solution.longestAlternatingSubarray(**[[4], 1]) == 0\nassert my_solution.longestAlternatingSubarray(**[[5], 3]) == 0\nassert my_solution.longestAlternatingSubarray(**[[6], 5]) == 0\nassert my_solution.longestAlternatingSubarray(**[[7], 2]) == 0\nassert my_solution.longestAlternatingSubarray(**[[8], 1]) == 0\nassert my_solution.longestAlternatingSubarray(**[[9], 7]) == 0\nassert my_solution.longestAlternatingSubarray(**[[10], 7]) == 0\nassert my_solution.longestAlternatingSubarray(**[[1, 3], 16]) == 0\nassert my_solution.longestAlternatingSubarray(**[[1, 6], 2]) == 0\nassert my_solution.longestAlternatingSubarray(**[[1, 10], 6]) == 0\nassert my_solution.longestAlternatingSubarray(**[[1, 10], 7]) == 0\nassert my_solution.longestAlternatingSubarray(**[[2, 2], 18]) == 1\nassert my_solution.longestAlternatingSubarray(**[[2, 4], 7]) == 1\nassert my_solution.longestAlternatingSubarray(**[[2, 5], 2]) == 1\n"}, "labels": {"questionId": "2866", "questionFrontendId": "2760", "questionTitle": "Longest Even Odd Subarray With Threshold", "stats": {"totalAccepted": "28.9K", "totalSubmission": "63.7K", "totalAcceptedRaw": 28941, "totalSubmissionRaw": 63719, "acRate": "45.4%"}, "probedCases": [{"inputs": [[3, 2, 5, 4], 5], "output": 3}, {"inputs": [[1, 2], 2], "output": 1}, {"inputs": [[2, 3, 4, 5], 4], "output": 3}, {"inputs": [[1], 1], "output": 0}, {"inputs": [[2], 2], "output": 1}, {"inputs": [[3], 3], "output": 0}, {"inputs": [[4], 1], "output": 0}, {"inputs": [[5], 3], "output": 0}, {"inputs": [[6], 5], "output": 0}, {"inputs": [[7], 2], "output": 0}, {"inputs": [[8], 1], "output": 0}, {"inputs": [[9], 7], "output": 0}, {"inputs": [[10], 7], "output": 0}, {"inputs": [[1, 3], 16], "output": 0}, {"inputs": [[1, 6], 2], "output": 0}, {"inputs": [[1, 10], 6], "output": 0}, {"inputs": [[1, 10], 7], "output": 0}, {"inputs": [[2, 2], 18], "output": 1}, {"inputs": [[2, 4], 7], "output": 1}, {"inputs": [[2, 5], 2], "output": 1}]}} +{"id": "LeetCode/2873", "content": "# Prime Pairs With Target Sum\n\nYou are given an integer `n`. We say that two integers `x` and `y` form a prime number pair if:\n\n\n* `1 <= x <= y <= n`\n* `x + y == n`\n* `x` and `y` are prime numbers\n\n\nReturn *the 2D sorted list of prime number pairs* `[xi, yi]`. The list should be sorted in **increasing** order of `xi`. If there are no prime number pairs at all, return *an empty array*.\n\n\n**Note:** A prime number is a natural number greater than `1` with only two factors, itself and `1`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 10\n**Output:** [[3,7],[5,5]]\n**Explanation:** In this example, there are two prime pairs that satisfy the criteria. \nThese pairs are [3,7] and [5,5], and we return them in the sorted order as described in the problem statement.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 2\n**Output:** []\n**Explanation:** We can show that there is no prime number pair that gives a sum of 2, so we return an empty array. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findPrimePairs(self, n: int) -> List[List[int]]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findPrimePairs(**[10]) == [[3, 7], [5, 5]]\nassert my_solution.findPrimePairs(**[2]) == []\nassert my_solution.findPrimePairs(**[1]) == []\nassert my_solution.findPrimePairs(**[3]) == []\nassert my_solution.findPrimePairs(**[4]) == [[2, 2]]\nassert my_solution.findPrimePairs(**[5]) == [[2, 3]]\nassert my_solution.findPrimePairs(**[6]) == [[3, 3]]\nassert my_solution.findPrimePairs(**[7]) == [[2, 5]]\nassert my_solution.findPrimePairs(**[8]) == [[3, 5]]\nassert my_solution.findPrimePairs(**[9]) == [[2, 7]]\nassert my_solution.findPrimePairs(**[11]) == []\nassert my_solution.findPrimePairs(**[12]) == [[5, 7]]\nassert my_solution.findPrimePairs(**[13]) == [[2, 11]]\nassert my_solution.findPrimePairs(**[14]) == [[3, 11], [7, 7]]\nassert my_solution.findPrimePairs(**[15]) == [[2, 13]]\nassert my_solution.findPrimePairs(**[16]) == [[3, 13], [5, 11]]\nassert my_solution.findPrimePairs(**[17]) == []\nassert my_solution.findPrimePairs(**[18]) == [[5, 13], [7, 11]]\nassert my_solution.findPrimePairs(**[19]) == [[2, 17]]\nassert my_solution.findPrimePairs(**[20]) == [[3, 17], [7, 13]]\n"}, "labels": {"questionId": "2873", "questionFrontendId": "2761", "questionTitle": "Prime Pairs With Target Sum", "stats": {"totalAccepted": "6.1K", "totalSubmission": "17.8K", "totalAcceptedRaw": 6135, "totalSubmissionRaw": 17830, "acRate": "34.4%"}, "probedCases": [{"inputs": [10], "output": [[3, 7], [5, 5]]}, {"inputs": [2], "output": []}, {"inputs": [1], "output": []}, {"inputs": [3], "output": []}, {"inputs": [4], "output": [[2, 2]]}, {"inputs": [5], "output": [[2, 3]]}, {"inputs": [6], "output": [[3, 3]]}, {"inputs": [7], "output": [[2, 5]]}, {"inputs": [8], "output": [[3, 5]]}, {"inputs": [9], "output": [[2, 7]]}, {"inputs": [11], "output": []}, {"inputs": [12], "output": [[5, 7]]}, {"inputs": [13], "output": [[2, 11]]}, {"inputs": [14], "output": [[3, 11], [7, 7]]}, {"inputs": [15], "output": [[2, 13]]}, {"inputs": [16], "output": [[3, 13], [5, 11]]}, {"inputs": [17], "output": []}, {"inputs": [18], "output": [[5, 13], [7, 11]]}, {"inputs": [19], "output": [[2, 17]]}, {"inputs": [20], "output": [[3, 17], [7, 13]]}]}} +{"id": "LeetCode/2868", "content": "# Continuous Subarrays\n\nYou are given a **0-indexed** integer array `nums`. A subarray of `nums` is called **continuous** if:\n\n\n* Let `i`, `i + 1`, ..., `j`be the indices in the subarray. Then, for each pair of indices `i <= i1, i2 <= j`, `0 <= |nums[i1] - nums[i2]| <= 2`.\n\n\nReturn *the total number of **continuous** subarrays.*\n\n\nA subarray is a contiguous **non-empty** sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [5,4,2,4]\n**Output:** 8\n**Explanation:** \nContinuous subarray of size 1: [5], [4], [2], [4].\nContinuous subarray of size 2: [5,4], [4,2], [2,4].\nContinuous subarray of size 3: [4,2,4].\nThereare no subarrys of size 4.\nTotal continuous subarrays = 4 + 3 + 1 = 8.\nIt can be shown that there are no more continuous subarrays.\n\n```\n\n \n\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2,3]\n**Output:** 6\n**Explanation:** \nContinuous subarray of size 1: [1], [2], [3].\nContinuous subarray of size 2: [1,2], [2,3].\nContinuous subarray of size 3: [1,2,3].\nTotal continuous subarrays = 3 + 2 + 1 = 6.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def continuousSubarrays(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.continuousSubarrays(**[[5, 4, 2, 4]]) == 8\nassert my_solution.continuousSubarrays(**[[1, 2, 3]]) == 6\nassert my_solution.continuousSubarrays(**[[31, 30, 31, 32]]) == 10\nassert my_solution.continuousSubarrays(**[[65, 66, 67, 66, 66, 65, 64, 65, 65, 64]]) == 43\nassert my_solution.continuousSubarrays(**[[42, 41, 42, 41, 41, 40, 39, 38]]) == 28\nassert my_solution.continuousSubarrays(**[[35, 35, 36, 37, 36, 37, 38, 37, 38]]) == 39\nassert my_solution.continuousSubarrays(**[[43, 44, 43, 44]]) == 10\nassert my_solution.continuousSubarrays(**[[14, 15, 15, 15, 16, 16, 16, 16, 15, 16]]) == 55\nassert my_solution.continuousSubarrays(**[[21]]) == 1\nassert my_solution.continuousSubarrays(**[[34, 34, 33, 34, 33, 33, 32, 31, 30, 31]]) == 39\nassert my_solution.continuousSubarrays(**[[58, 59, 59, 58, 59]]) == 15\nassert my_solution.continuousSubarrays(**[[10, 9, 8, 7, 8, 9, 9]]) == 24\nassert my_solution.continuousSubarrays(**[[65, 66, 65, 64, 63, 62, 62]]) == 20\nassert my_solution.continuousSubarrays(**[[65, 65, 64, 65, 66, 65]]) == 21\nassert my_solution.continuousSubarrays(**[[85, 84, 83, 84, 83, 82]]) == 20\nassert my_solution.continuousSubarrays(**[[60, 59, 60]]) == 6\nassert my_solution.continuousSubarrays(**[[96, 97, 98]]) == 6\nassert my_solution.continuousSubarrays(**[[21, 22, 23, 22, 23]]) == 15\nassert my_solution.continuousSubarrays(**[[76, 77, 77, 78, 77, 78, 78]]) == 28\nassert my_solution.continuousSubarrays(**[[27, 27, 27, 26, 26, 27, 27, 27, 27]]) == 45\n"}, "labels": {"questionId": "2868", "questionFrontendId": "2762", "questionTitle": "Continuous Subarrays", "stats": {"totalAccepted": "5K", "totalSubmission": "10.4K", "totalAcceptedRaw": 5024, "totalSubmissionRaw": 10377, "acRate": "48.4%"}, "probedCases": [{"inputs": [[5, 4, 2, 4]], "output": 8}, {"inputs": [[1, 2, 3]], "output": 6}, {"inputs": [[31, 30, 31, 32]], "output": 10}, {"inputs": [[65, 66, 67, 66, 66, 65, 64, 65, 65, 64]], "output": 43}, {"inputs": [[42, 41, 42, 41, 41, 40, 39, 38]], "output": 28}, {"inputs": [[35, 35, 36, 37, 36, 37, 38, 37, 38]], "output": 39}, {"inputs": [[43, 44, 43, 44]], "output": 10}, {"inputs": [[14, 15, 15, 15, 16, 16, 16, 16, 15, 16]], "output": 55}, {"inputs": [[21]], "output": 1}, {"inputs": [[34, 34, 33, 34, 33, 33, 32, 31, 30, 31]], "output": 39}, {"inputs": [[58, 59, 59, 58, 59]], "output": 15}, {"inputs": [[10, 9, 8, 7, 8, 9, 9]], "output": 24}, {"inputs": [[65, 66, 65, 64, 63, 62, 62]], "output": 20}, {"inputs": [[65, 65, 64, 65, 66, 65]], "output": 21}, {"inputs": [[85, 84, 83, 84, 83, 82]], "output": 20}, {"inputs": [[60, 59, 60]], "output": 6}, {"inputs": [[96, 97, 98]], "output": 6}, {"inputs": [[21, 22, 23, 22, 23]], "output": 15}, {"inputs": [[76, 77, 77, 78, 77, 78, 78]], "output": 28}, {"inputs": [[27, 27, 27, 26, 26, 27, 27, 27, 27]], "output": 45}]}} +{"id": "LeetCode/2849", "content": "# Sum of Imbalance Numbers of All Subarrays\n\nThe **imbalance number** of a **0-indexed** integer array `arr` of length `n` is defined as the number of indices in `sarr = sorted(arr)` such that:\n\n\n* `0 <= i < n - 1`, and\n* `sarr[i+1] - sarr[i] > 1`\n\n\nHere, `sorted(arr)` is the function that returns the sorted version of `arr`.\n\n\nGiven a **0-indexed** integer array `nums`, return *the **sum of imbalance numbers** of all its **subarrays***.\n\n\nA **subarray** is a contiguous **non-empty** sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,3,1,4]\n**Output:** 3\n**Explanation:** There are 3 subarrays with non-zeroimbalance numbers:\n- Subarray [3, 1] with an imbalance number of 1.\n- Subarray [3, 1, 4] with an imbalance number of 1.\n- Subarray [1, 4] with an imbalance number of 1.\nThe imbalance number of all other subarrays is 0. Hence, the sum of imbalance numbers of all the subarrays of nums is 3. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,3,3,3,5]\n**Output:** 8\n**Explanation:** There are 7 subarrays with non-zero imbalance numbers:\n- Subarray [1, 3] with an imbalance number of 1.\n- Subarray [1, 3, 3] with an imbalance number of 1.\n- Subarray [1, 3, 3, 3] with an imbalance number of 1.\n- Subarray [1, 3, 3, 3, 5] with an imbalance number of 2. \n- Subarray [3, 3, 3, 5] with an imbalance number of 1. \n- Subarray [3, 3, 5] with an imbalance number of 1.\n- Subarray [3, 5] with an imbalance number of 1.\nThe imbalance number of all other subarrays is 0. Hence, the sum of imbalance numbers of all the subarrays of nums is 8. \n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 1000`\n* `1 <= nums[i] <= nums.length`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def sumImbalanceNumbers(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.sumImbalanceNumbers(**[[2, 3, 1, 4]]) == 3\nassert my_solution.sumImbalanceNumbers(**[[1, 3, 3, 3, 5]]) == 8\nassert my_solution.sumImbalanceNumbers(**[[1]]) == 0\nassert my_solution.sumImbalanceNumbers(**[[1, 1]]) == 0\nassert my_solution.sumImbalanceNumbers(**[[1, 2]]) == 0\nassert my_solution.sumImbalanceNumbers(**[[2, 1]]) == 0\nassert my_solution.sumImbalanceNumbers(**[[2, 2]]) == 0\nassert my_solution.sumImbalanceNumbers(**[[1, 1, 1]]) == 0\nassert my_solution.sumImbalanceNumbers(**[[1, 1, 2]]) == 0\nassert my_solution.sumImbalanceNumbers(**[[1, 1, 3]]) == 2\nassert my_solution.sumImbalanceNumbers(**[[1, 2, 1]]) == 0\nassert my_solution.sumImbalanceNumbers(**[[1, 2, 2]]) == 0\nassert my_solution.sumImbalanceNumbers(**[[1, 2, 3]]) == 0\nassert my_solution.sumImbalanceNumbers(**[[1, 3, 1]]) == 3\nassert my_solution.sumImbalanceNumbers(**[[1, 3, 2]]) == 1\nassert my_solution.sumImbalanceNumbers(**[[1, 3, 3]]) == 2\nassert my_solution.sumImbalanceNumbers(**[[2, 1, 1]]) == 0\nassert my_solution.sumImbalanceNumbers(**[[2, 1, 2]]) == 0\nassert my_solution.sumImbalanceNumbers(**[[2, 1, 3]]) == 1\nassert my_solution.sumImbalanceNumbers(**[[2, 2, 1]]) == 0\n"}, "labels": {"questionId": "2849", "questionFrontendId": "2763", "questionTitle": "Sum of Imbalance Numbers of All Subarrays", "stats": {"totalAccepted": "2.8K", "totalSubmission": "4.5K", "totalAcceptedRaw": 2802, "totalSubmissionRaw": 4492, "acRate": "62.4%"}, "probedCases": [{"inputs": [[2, 3, 1, 4]], "output": 3}, {"inputs": [[1, 3, 3, 3, 5]], "output": 8}, {"inputs": [[1]], "output": 0}, {"inputs": [[1, 1]], "output": 0}, {"inputs": [[1, 2]], "output": 0}, {"inputs": [[2, 1]], "output": 0}, {"inputs": [[2, 2]], "output": 0}, {"inputs": [[1, 1, 1]], "output": 0}, {"inputs": [[1, 1, 2]], "output": 0}, {"inputs": [[1, 1, 3]], "output": 2}, {"inputs": [[1, 2, 1]], "output": 0}, {"inputs": [[1, 2, 2]], "output": 0}, {"inputs": [[1, 2, 3]], "output": 0}, {"inputs": [[1, 3, 1]], "output": 3}, {"inputs": [[1, 3, 2]], "output": 1}, {"inputs": [[1, 3, 3]], "output": 2}, {"inputs": [[2, 1, 1]], "output": 0}, {"inputs": [[2, 1, 2]], "output": 0}, {"inputs": [[2, 1, 3]], "output": 1}, {"inputs": [[2, 2, 1]], "output": 0}]}} +{"id": "LeetCode/2831", "content": "# Number of Beautiful Pairs\n\nYou are given a **0-indexed** integer array `nums`. A pair of indices `i`, `j` where `0 <= i < j < nums.length` is called beautiful if the **first digit** of `nums[i]` and the **last digit** of `nums[j]` are **coprime**.\n\n\nReturn *the total number of beautiful pairs in* `nums`.\n\n\nTwo integers `x` and `y` are **coprime** if there is no integer greater than 1 that divides both of them. In other words, `x` and `y` are coprime if `gcd(x, y) == 1`, where `gcd(x, y)` is the **greatest common divisor** of `x` and `y`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,5,1,4]\n**Output:** 5\n**Explanation:** There are 5 beautiful pairs in nums:\nWhen i = 0 and j = 1: the first digit of nums[0] is 2, and the last digit of nums[1] is 5. We can confirm that 2 and 5 are coprime, since gcd(2,5) == 1.\nWhen i = 0 and j = 2: the first digit of nums[0] is 2, and the last digit of nums[2] is 1. Indeed, gcd(2,1) == 1.\nWhen i = 1 and j = 2: the first digit of nums[1] is 5, and the last digit of nums[2] is 1. Indeed, gcd(5,1) == 1.\nWhen i = 1 and j = 3: the first digit of nums[1] is 5, and the last digit of nums[3] is 4. Indeed, gcd(5,4) == 1.\nWhen i = 2 and j = 3: the first digit of nums[2] is 1, and the last digit of nums[3] is 4. Indeed, gcd(1,4) == 1.\nThus, we return 5.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [11,21,12]\n**Output:** 2\n**Explanation:** There are 2 beautiful pairs:\nWhen i = 0 and j = 1: the first digit of nums[0] is 1, and the last digit of nums[1] is 1. Indeed, gcd(1,1) == 1.\nWhen i = 0 and j = 2: the first digit of nums[0] is 1, and the last digit of nums[2] is 2. Indeed, gcd(1,2) == 1.\nThus, we return 2.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= nums.length <= 100`\n* `1 <= nums[i] <= 9999`\n* `nums[i] % 10 != 0`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countBeautifulPairs(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countBeautifulPairs(**[[2, 5, 1, 4]]) == 5\nassert my_solution.countBeautifulPairs(**[[11, 21, 12]]) == 2\nassert my_solution.countBeautifulPairs(**[[31, 25, 72, 79, 74]]) == 7\nassert my_solution.countBeautifulPairs(**[[84, 91, 18, 59, 27, 9, 81, 33, 17, 58]]) == 37\nassert my_solution.countBeautifulPairs(**[[8, 75, 28, 35, 21, 13, 21]]) == 19\nassert my_solution.countBeautifulPairs(**[[35, 52, 74, 92, 25, 65, 77, 1, 73, 32]]) == 37\nassert my_solution.countBeautifulPairs(**[[68, 8, 84, 14, 88, 42, 53]]) == 7\nassert my_solution.countBeautifulPairs(**[[64, 23, 99, 83, 5, 21, 76, 34, 99, 63]]) == 25\nassert my_solution.countBeautifulPairs(**[[18, 64, 12, 21]]) == 5\nassert my_solution.countBeautifulPairs(**[[78, 36, 58, 88]]) == 6\nassert my_solution.countBeautifulPairs(**[[99, 26, 92, 91, 53, 24, 25, 92, 73]]) == 22\nassert my_solution.countBeautifulPairs(**[[51, 65, 87, 6, 17, 32, 14, 42, 46]]) == 19\nassert my_solution.countBeautifulPairs(**[[43, 9, 75, 76, 25, 96, 46, 85, 19, 29]]) == 32\nassert my_solution.countBeautifulPairs(**[[5, 24]]) == 1\nassert my_solution.countBeautifulPairs(**[[26, 76, 24, 96, 82, 97, 97, 72, 35]]) == 25\nassert my_solution.countBeautifulPairs(**[[77, 82, 94, 55]]) == 5\nassert my_solution.countBeautifulPairs(**[[82, 3, 89, 52, 96, 72, 27, 59]]) == 17\nassert my_solution.countBeautifulPairs(**[[97, 6, 46, 88, 41, 52, 46, 4, 17]]) == 17\nassert my_solution.countBeautifulPairs(**[[95, 6]]) == 0\nassert my_solution.countBeautifulPairs(**[[69, 63, 24, 1, 71, 55, 46, 4, 61]]) == 26\n"}, "labels": {"questionId": "2831", "questionFrontendId": "2748", "questionTitle": "Number of Beautiful Pairs", "stats": {"totalAccepted": "5.6K", "totalSubmission": "9.7K", "totalAcceptedRaw": 5612, "totalSubmissionRaw": 9720, "acRate": "57.7%"}, "probedCases": [{"inputs": [[2, 5, 1, 4]], "output": 5}, {"inputs": [[11, 21, 12]], "output": 2}, {"inputs": [[31, 25, 72, 79, 74]], "output": 7}, {"inputs": [[84, 91, 18, 59, 27, 9, 81, 33, 17, 58]], "output": 37}, {"inputs": [[8, 75, 28, 35, 21, 13, 21]], "output": 19}, {"inputs": [[35, 52, 74, 92, 25, 65, 77, 1, 73, 32]], "output": 37}, {"inputs": [[68, 8, 84, 14, 88, 42, 53]], "output": 7}, {"inputs": [[64, 23, 99, 83, 5, 21, 76, 34, 99, 63]], "output": 25}, {"inputs": [[18, 64, 12, 21]], "output": 5}, {"inputs": [[78, 36, 58, 88]], "output": 6}, {"inputs": [[99, 26, 92, 91, 53, 24, 25, 92, 73]], "output": 22}, {"inputs": [[51, 65, 87, 6, 17, 32, 14, 42, 46]], "output": 19}, {"inputs": [[43, 9, 75, 76, 25, 96, 46, 85, 19, 29]], "output": 32}, {"inputs": [[5, 24]], "output": 1}, {"inputs": [[26, 76, 24, 96, 82, 97, 97, 72, 35]], "output": 25}, {"inputs": [[77, 82, 94, 55]], "output": 5}, {"inputs": [[82, 3, 89, 52, 96, 72, 27, 59]], "output": 17}, {"inputs": [[97, 6, 46, 88, 41, 52, 46, 4, 17]], "output": 17}, {"inputs": [[95, 6]], "output": 0}, {"inputs": [[69, 63, 24, 1, 71, 55, 46, 4, 61]], "output": 26}]}} +{"id": "LeetCode/2837", "content": "# Minimum Operations to Make the Integer Zero\n\nYou are given two integers `num1` and `num2`.\n\n\nIn one operation, you can choose integer `i` in the range `[0, 60]` and subtract `2i + num2` from `num1`.\n\n\nReturn *the integer denoting the **minimum** number of operations needed to make* `num1` *equal to* `0`.\n\n\nIf it is impossible to make `num1` equal to `0`, return `-1`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** num1 = 3, num2 = -2\n**Output:** 3\n**Explanation:** We can make 3 equal to 0 with the following operations:\n- We choose i = 2 and substract 22 + (-2) from 3, 3 - (4 + (-2)) = 1.\n- We choose i = 2 and substract 22 + (-2) from 1, 1 - (4 + (-2)) = -1.\n- We choose i = 0 and substract 20 + (-2) from -1, (-1) - (1 + (-2)) = 0.\nIt can be proven, that 3 is the minimum number of operations that we need to perform.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** num1 = 5, num2 = 7\n**Output:** -1\n**Explanation:** It can be proven, that it is impossible to make 5 equal to 0 with the given operation.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= num1 <= 109`\n* `-109 <= num2 <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def makeTheIntegerZero(self, num1: int, num2: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.makeTheIntegerZero(**[3, -2]) == 3\nassert my_solution.makeTheIntegerZero(**[5, 7]) == -1\nassert my_solution.makeTheIntegerZero(**[5, -21]) == 3\nassert my_solution.makeTheIntegerZero(**[2, 71]) == -1\nassert my_solution.makeTheIntegerZero(**[59, 70]) == -1\nassert my_solution.makeTheIntegerZero(**[12, -55]) == 4\nassert my_solution.makeTheIntegerZero(**[71, -13]) == 5\nassert my_solution.makeTheIntegerZero(**[52, -12]) == 1\nassert my_solution.makeTheIntegerZero(**[3, -75]) == 6\nassert my_solution.makeTheIntegerZero(**[20, -12]) == 1\nassert my_solution.makeTheIntegerZero(**[29, -37]) == 3\nassert my_solution.makeTheIntegerZero(**[6, -2]) == 1\nassert my_solution.makeTheIntegerZero(**[14, 33]) == -1\nassert my_solution.makeTheIntegerZero(**[16, -11]) == 3\nassert my_solution.makeTheIntegerZero(**[16, -21]) == 4\nassert my_solution.makeTheIntegerZero(**[8, -6]) == 2\nassert my_solution.makeTheIntegerZero(**[34, 9]) == 2\nassert my_solution.makeTheIntegerZero(**[17, -65]) == 4\nassert my_solution.makeTheIntegerZero(**[74, 1]) == 2\nassert my_solution.makeTheIntegerZero(**[16, 10]) == -1\n"}, "labels": {"questionId": "2837", "questionFrontendId": "2749", "questionTitle": "Minimum Operations to Make the Integer Zero", "stats": {"totalAccepted": "3.7K", "totalSubmission": "10.9K", "totalAcceptedRaw": 3672, "totalSubmissionRaw": 10932, "acRate": "33.6%"}, "probedCases": [{"inputs": [3, -2], "output": 3}, {"inputs": [5, 7], "output": -1}, {"inputs": [5, -21], "output": 3}, {"inputs": [2, 71], "output": -1}, {"inputs": [59, 70], "output": -1}, {"inputs": [12, -55], "output": 4}, {"inputs": [71, -13], "output": 5}, {"inputs": [52, -12], "output": 1}, {"inputs": [3, -75], "output": 6}, {"inputs": [20, -12], "output": 1}, {"inputs": [29, -37], "output": 3}, {"inputs": [6, -2], "output": 1}, {"inputs": [14, 33], "output": -1}, {"inputs": [16, -11], "output": 3}, {"inputs": [16, -21], "output": 4}, {"inputs": [8, -6], "output": 2}, {"inputs": [34, 9], "output": 2}, {"inputs": [17, -65], "output": 4}, {"inputs": [74, 1], "output": 2}, {"inputs": [16, 10], "output": -1}]}} +{"id": "LeetCode/2867", "content": "# Ways to Split Array Into Good Subarrays\n\nYou are given a binary array `nums`.\n\n\nA subarray of an array is **good** if it contains **exactly** **one** element with the value `1`.\n\n\nReturn *an integer denoting the number of ways to split the array* `nums` *into **good** subarrays*. As the number may be too large, return it **modulo** `109 + 7`.\n\n\nA subarray is a contiguous **non-empty** sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [0,1,0,0,1]\n**Output:** 3\n**Explanation:** There are 3 ways to split nums into good subarrays:\n- [0,1] [0,0,1]\n- [0,1,0] [0,1]\n- [0,1,0,0] [1]\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [0,1,0]\n**Output:** 1\n**Explanation:** There is 1 way to split nums into good subarrays:\n- [0,1,0]\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `0 <= nums[i] <= 1`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def numberOfGoodSubarraySplits(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.numberOfGoodSubarraySplits(**[[0, 1, 0, 0, 1]]) == 3\nassert my_solution.numberOfGoodSubarraySplits(**[[0, 1, 0]]) == 1\nassert my_solution.numberOfGoodSubarraySplits(**[[0, 1, 0, 0]]) == 1\nassert my_solution.numberOfGoodSubarraySplits(**[[0, 0, 1, 1]]) == 1\nassert my_solution.numberOfGoodSubarraySplits(**[[1, 0, 0, 0, 0, 0, 1, 0, 1]]) == 12\nassert my_solution.numberOfGoodSubarraySplits(**[[0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1]]) == 8\nassert my_solution.numberOfGoodSubarraySplits(**[[0, 1, 1, 1, 0, 1, 1, 0, 0, 0]]) == 2\nassert my_solution.numberOfGoodSubarraySplits(**[[0, 1, 0, 0, 1, 0, 1, 0, 1, 1]]) == 12\nassert my_solution.numberOfGoodSubarraySplits(**[[1, 0, 1, 1, 0, 1, 0, 0, 1]]) == 12\nassert my_solution.numberOfGoodSubarraySplits(**[[0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1]]) == 6\nassert my_solution.numberOfGoodSubarraySplits(**[[0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1]]) == 18\nassert my_solution.numberOfGoodSubarraySplits(**[[0, 0, 1]]) == 1\nassert my_solution.numberOfGoodSubarraySplits(**[[1, 1, 0, 1, 1, 1, 1, 1]]) == 2\nassert my_solution.numberOfGoodSubarraySplits(**[[0, 1]]) == 1\nassert my_solution.numberOfGoodSubarraySplits(**[[1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0]]) == 18\nassert my_solution.numberOfGoodSubarraySplits(**[[1, 0, 1, 0, 0]]) == 2\nassert my_solution.numberOfGoodSubarraySplits(**[[1, 1, 0]]) == 1\nassert my_solution.numberOfGoodSubarraySplits(**[[1, 0, 0, 1, 0, 0, 1, 1]]) == 9\nassert my_solution.numberOfGoodSubarraySplits(**[[1, 0, 1, 1, 0, 0]]) == 2\nassert my_solution.numberOfGoodSubarraySplits(**[[1]]) == 1\n"}, "labels": {"questionId": "2867", "questionFrontendId": "2750", "questionTitle": "Ways to Split Array Into Good Subarrays", "stats": {"totalAccepted": "4.1K", "totalSubmission": "10.5K", "totalAcceptedRaw": 4148, "totalSubmissionRaw": 10543, "acRate": "39.3%"}, "probedCases": [{"inputs": [[0, 1, 0, 0, 1]], "output": 3}, {"inputs": [[0, 1, 0]], "output": 1}, {"inputs": [[0, 1, 0, 0]], "output": 1}, {"inputs": [[0, 0, 1, 1]], "output": 1}, {"inputs": [[1, 0, 0, 0, 0, 0, 1, 0, 1]], "output": 12}, {"inputs": [[0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1]], "output": 8}, {"inputs": [[0, 1, 1, 1, 0, 1, 1, 0, 0, 0]], "output": 2}, {"inputs": [[0, 1, 0, 0, 1, 0, 1, 0, 1, 1]], "output": 12}, {"inputs": [[1, 0, 1, 1, 0, 1, 0, 0, 1]], "output": 12}, {"inputs": [[0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1]], "output": 6}, {"inputs": [[0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1]], "output": 18}, {"inputs": [[0, 0, 1]], "output": 1}, {"inputs": [[1, 1, 0, 1, 1, 1, 1, 1]], "output": 2}, {"inputs": [[0, 1]], "output": 1}, {"inputs": [[1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0]], "output": 18}, {"inputs": [[1, 0, 1, 0, 0]], "output": 2}, {"inputs": [[1, 1, 0]], "output": 1}, {"inputs": [[1, 0, 0, 1, 0, 0, 1, 1]], "output": 9}, {"inputs": [[1, 0, 1, 1, 0, 0]], "output": 2}, {"inputs": [[1]], "output": 1}]}} +{"id": "LeetCode/2847", "content": "# Find Maximum Number of String Pairs\n\nYou are given a **0-indexed** array `words` consisting of **distinct** strings.\n\n\nThe string `words[i]` can be paired with the string `words[j]` if:\n\n\n* The string `words[i]` is equal to the reversed string of `words[j]`.\n* `0 <= i < j < words.length`.\n\n\nReturn *the **maximum** number of pairs that can be formed from the array* `words`*.*\n\n\nNote that each string can belong in **at most one** pair.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** words = [\"cd\",\"ac\",\"dc\",\"ca\",\"zz\"]\n**Output:** 2\n**Explanation:** In this example, we can form 2 pair of strings in the following way:\n- We pair the 0th string with the 2nd string, as the reversed string of word[0] is \"dc\" and is equal to words[2].\n- We pair the 1st string with the 3rd string, as the reversed string of word[1] is \"ca\" and is equal to words[3].\nIt can be proven that 2 is the maximum number of pairs that can be formed.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** words = [\"ab\",\"ba\",\"cc\"]\n**Output:** 1\n**Explanation:** In this example, we can form 1 pair of strings in the following way:\n- We pair the 0th string with the 1st string, as the reversed string of words[1] is \"ab\" and is equal to words[0].\nIt can be proven that 1 is the maximum number of pairs that can be formed.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** words = [\"aa\",\"ab\"]\n**Output:** 0\n**Explanation:** In this example, we are unable to form any pair of strings.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= words.length <= 50`\n* `words[i].length == 2`\n* `words` consists of distinct strings.\n* `words[i]` contains only lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumNumberOfStringPairs(self, words: List[str]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumNumberOfStringPairs(**[['cd', 'ac', 'dc', 'ca', 'zz']]) == 2\nassert my_solution.maximumNumberOfStringPairs(**[['ab', 'ba', 'cc']]) == 1\nassert my_solution.maximumNumberOfStringPairs(**[['aa', 'ab']]) == 0\nassert my_solution.maximumNumberOfStringPairs(**[['ku', 'dd', 'gu', 'uk']]) == 1\nassert my_solution.maximumNumberOfStringPairs(**[['qf', 'ke', 'rh', 'bl']]) == 0\nassert my_solution.maximumNumberOfStringPairs(**[['zs', 'pp', 'sz', 'ie']]) == 1\nassert my_solution.maximumNumberOfStringPairs(**[['wk', 'xf', 'ot', 'je', 'hd', 'kw', 'fx', 'to', 'ej']]) == 4\nassert my_solution.maximumNumberOfStringPairs(**[['wm', 'lg', 'wy', 'ge', 'zq', 'kn', 'tx', 'dr', 'ws', 'iy']]) == 0\nassert my_solution.maximumNumberOfStringPairs(**[['ny', 'gz', 'yr', 'kt', 'qd', 'yn', 'zg', 'ry', 'tk', 'dq']]) == 5\nassert my_solution.maximumNumberOfStringPairs(**[['xi', 'nw', 'qp', 'to', 'oo', 'xp', 'ix', 'wn', 'pq']]) == 3\nassert my_solution.maximumNumberOfStringPairs(**[['ws', 'zt', 'sw']]) == 1\nassert my_solution.maximumNumberOfStringPairs(**[['qb', 'pl', 'ir', 'jj', 'pu', 'dn', 'bq', 'lp']]) == 2\nassert my_solution.maximumNumberOfStringPairs(**[['cw', 'fg', 'wc', 'gf']]) == 2\nassert my_solution.maximumNumberOfStringPairs(**[['ip', 'pi']]) == 1\nassert my_solution.maximumNumberOfStringPairs(**[['ik', 'mn', 'hq', 'fx', 'ki']]) == 1\nassert my_solution.maximumNumberOfStringPairs(**[['jn', 'ik', 'ry']]) == 0\nassert my_solution.maximumNumberOfStringPairs(**[['aa', 'wj', 'zp', 'df', 'xb', 'sa', 'jw', 'pz']]) == 2\nassert my_solution.maximumNumberOfStringPairs(**[['hw', 'pa', 'xx', 'la', 'am', 'vg']]) == 0\nassert my_solution.maximumNumberOfStringPairs(**[['hj']]) == 0\nassert my_solution.maximumNumberOfStringPairs(**[['tg', 'gf', 'oz', 'nd', 'ks', 'fo', 'ac', 'gl', 'gt', 'fg']]) == 2\n"}, "labels": {"questionId": "2847", "questionFrontendId": "2744", "questionTitle": "Find Maximum Number of String Pairs", "stats": {"totalAccepted": "28.4K", "totalSubmission": "32.6K", "totalAcceptedRaw": 28385, "totalSubmissionRaw": 32647, "acRate": "86.9%"}, "probedCases": [{"inputs": [["cd", "ac", "dc", "ca", "zz"]], "output": 2}, {"inputs": [["ab", "ba", "cc"]], "output": 1}, {"inputs": [["aa", "ab"]], "output": 0}, {"inputs": [["ku", "dd", "gu", "uk"]], "output": 1}, {"inputs": [["qf", "ke", "rh", "bl"]], "output": 0}, {"inputs": [["zs", "pp", "sz", "ie"]], "output": 1}, {"inputs": [["wk", "xf", "ot", "je", "hd", "kw", "fx", "to", "ej"]], "output": 4}, {"inputs": [["wm", "lg", "wy", "ge", "zq", "kn", "tx", "dr", "ws", "iy"]], "output": 0}, {"inputs": [["ny", "gz", "yr", "kt", "qd", "yn", "zg", "ry", "tk", "dq"]], "output": 5}, {"inputs": [["xi", "nw", "qp", "to", "oo", "xp", "ix", "wn", "pq"]], "output": 3}, {"inputs": [["ws", "zt", "sw"]], "output": 1}, {"inputs": [["qb", "pl", "ir", "jj", "pu", "dn", "bq", "lp"]], "output": 2}, {"inputs": [["cw", "fg", "wc", "gf"]], "output": 2}, {"inputs": [["ip", "pi"]], "output": 1}, {"inputs": [["ik", "mn", "hq", "fx", "ki"]], "output": 1}, {"inputs": [["jn", "ik", "ry"]], "output": 0}, {"inputs": [["aa", "wj", "zp", "df", "xb", "sa", "jw", "pz"]], "output": 2}, {"inputs": [["hw", "pa", "xx", "la", "am", "vg"]], "output": 0}, {"inputs": [["hj"]], "output": 0}, {"inputs": [["tg", "gf", "oz", "nd", "ks", "fo", "ac", "gl", "gt", "fg"]], "output": 2}]}} +{"id": "LeetCode/2850", "content": "# Construct the Longest New String\n\nYou are given three integers `x`, `y`, and `z`.\n\n\nYou have `x` strings equal to `\"AA\"`, `y` strings equal to `\"BB\"`, and `z` strings equal to `\"AB\"`. You want to choose some (possibly all or none) of these strings and concatenate them in some order to form a new string. This new string must not contain `\"AAA\"` or `\"BBB\"` as a substring.\n\n\nReturn *the maximum possible length of the new string*.\n\n\nA **substring** is a contiguous **non-empty** sequence of characters within a string.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** x = 2, y = 5, z = 1\n**Output:** 12\n**Explanation:** We can concactenate the strings \"BB\", \"AA\", \"BB\", \"AA\", \"BB\", and \"AB\" in that order. Then, our new string is \"BBAABBAABBAB\". \nThat string has length 12, and we can show that it is impossible to construct a string of longer length.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** x = 3, y = 2, z = 2\n**Output:** 14\n**Explanation:** We can concactenate the strings \"AB\", \"AB\", \"AA\", \"BB\", \"AA\", \"BB\", and \"AA\" in that order. Then, our new string is \"ABABAABBAABBAA\". \nThat string has length 14, and we can show that it is impossible to construct a string of longer length.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= x, y, z <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def longestString(self, x: int, y: int, z: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.longestString(**[2, 5, 1]) == 12\nassert my_solution.longestString(**[3, 2, 2]) == 14\nassert my_solution.longestString(**[1, 34, 1]) == 8\nassert my_solution.longestString(**[1, 39, 14]) == 34\nassert my_solution.longestString(**[1, 24, 7]) == 20\nassert my_solution.longestString(**[1, 43, 40]) == 86\nassert my_solution.longestString(**[1, 34, 39]) == 84\nassert my_solution.longestString(**[1, 10, 29]) == 64\nassert my_solution.longestString(**[1, 11, 9]) == 24\nassert my_solution.longestString(**[1, 34, 3]) == 12\nassert my_solution.longestString(**[1, 26, 35]) == 76\nassert my_solution.longestString(**[1, 43, 24]) == 54\nassert my_solution.longestString(**[1, 28, 11]) == 28\nassert my_solution.longestString(**[1, 40, 21]) == 48\nassert my_solution.longestString(**[1, 4, 20]) == 46\nassert my_solution.longestString(**[1, 41, 30]) == 66\nassert my_solution.longestString(**[1, 37, 7]) == 20\nassert my_solution.longestString(**[1, 23, 25]) == 56\nassert my_solution.longestString(**[1, 8, 5]) == 16\nassert my_solution.longestString(**[1, 14, 8]) == 22\n"}, "labels": {"questionId": "2850", "questionFrontendId": "2745", "questionTitle": "Construct the Longest New String", "stats": {"totalAccepted": "3.7K", "totalSubmission": "6.3K", "totalAcceptedRaw": 3667, "totalSubmissionRaw": 6265, "acRate": "58.5%"}, "probedCases": [{"inputs": [2, 5, 1], "output": 12}, {"inputs": [3, 2, 2], "output": 14}, {"inputs": [1, 34, 1], "output": 8}, {"inputs": [1, 39, 14], "output": 34}, {"inputs": [1, 24, 7], "output": 20}, {"inputs": [1, 43, 40], "output": 86}, {"inputs": [1, 34, 39], "output": 84}, {"inputs": [1, 10, 29], "output": 64}, {"inputs": [1, 11, 9], "output": 24}, {"inputs": [1, 34, 3], "output": 12}, {"inputs": [1, 26, 35], "output": 76}, {"inputs": [1, 43, 24], "output": 54}, {"inputs": [1, 28, 11], "output": 28}, {"inputs": [1, 40, 21], "output": 48}, {"inputs": [1, 4, 20], "output": 46}, {"inputs": [1, 41, 30], "output": 66}, {"inputs": [1, 37, 7], "output": 20}, {"inputs": [1, 23, 25], "output": 56}, {"inputs": [1, 8, 5], "output": 16}, {"inputs": [1, 14, 8], "output": 22}]}} +{"id": "LeetCode/2854", "content": "# Decremental String Concatenation\n\nYou are given a **0-indexed** array `words` containing `n` strings.\n\n\nLet's define a **join** operation `join(x, y)` between two strings `x` and `y` as concatenating them into `xy`. However, if the last character of `x` is equal to the first character of `y`, one of them is **deleted**.\n\n\nFor example `join(\"ab\", \"ba\") = \"aba\"` and `join(\"ab\", \"cde\") = \"abcde\"`.\n\n\nYou are to perform `n - 1` **join** operations. Let `str0 = words[0]`. Starting from `i = 1` up to `i = n - 1`, for the `ith` operation, you can do one of the following:\n\n\n* Make `stri = join(stri - 1, words[i])`\n* Make `stri = join(words[i], stri - 1)`\n\n\nYour task is to **minimize** the length of `strn - 1`.\n\n\nReturn *an integer denoting the minimum possible length of* `strn - 1`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** words = [\"aa\",\"ab\",\"bc\"]\n**Output:** 4\n**Explanation:** In this example, we can perform join operations in the following order to minimize the length of str2: \nstr0 = \"aa\"\nstr1 = join(str0, \"ab\") = \"aab\"\nstr2 = join(str1, \"bc\") = \"aabc\" \nIt can be shown that the minimum possible length of str2 is 4.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** words = [\"ab\",\"b\"]\n**Output:** 2\n**Explanation:** In this example, str0 = \"ab\", there are two ways to get str1: \njoin(str0, \"b\") = \"ab\" or join(\"b\", str0) = \"bab\". \nThe first string, \"ab\", has the minimum length. Hence, the answer is 2.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** words = [\"aaa\",\"c\",\"aba\"]\n**Output:** 6\n**Explanation:** In this example, we can perform join operations in the following order to minimize the length of str2: \nstr0 = \"aaa\"\nstr1 = join(str0, \"c\") = \"aaac\"\nstr2 = join(\"aba\", str1) = \"abaaac\"\nIt can be shown that the minimum possible length of str2 is 6.\n\n```\n\n \n \n\n\n**Constraints:**\n\n\n* `1 <= words.length <= 1000`\n* `1 <= words[i].length <= 50`\n* Each character in `words[i]` is an English lowercase letter\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimizeConcatenatedLength(self, words: List[str]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimizeConcatenatedLength(**[['aa', 'ab', 'bc']]) == 4\nassert my_solution.minimizeConcatenatedLength(**[['ab', 'b']]) == 2\nassert my_solution.minimizeConcatenatedLength(**[['aaa', 'c', 'aba']]) == 6\nassert my_solution.minimizeConcatenatedLength(**[['a', 'a']]) == 1\nassert my_solution.minimizeConcatenatedLength(**[['a', 'ab']]) == 2\nassert my_solution.minimizeConcatenatedLength(**[['a', 'b']]) == 2\nassert my_solution.minimizeConcatenatedLength(**[['a', 'ca']]) == 2\nassert my_solution.minimizeConcatenatedLength(**[['a', 'cb']]) == 3\nassert my_solution.minimizeConcatenatedLength(**[['aa', 'a']]) == 2\nassert my_solution.minimizeConcatenatedLength(**[['aa', 'b']]) == 3\nassert my_solution.minimizeConcatenatedLength(**[['aa', 'ca']]) == 3\nassert my_solution.minimizeConcatenatedLength(**[['aa', 'ccc']]) == 5\nassert my_solution.minimizeConcatenatedLength(**[['aab', 'b']]) == 3\nassert my_solution.minimizeConcatenatedLength(**[['aab', 'ba']]) == 4\nassert my_solution.minimizeConcatenatedLength(**[['aab', 'bb']]) == 4\nassert my_solution.minimizeConcatenatedLength(**[['aab', 'bba']]) == 5\nassert my_solution.minimizeConcatenatedLength(**[['aab', 'c']]) == 4\nassert my_solution.minimizeConcatenatedLength(**[['aac', 'b']]) == 4\nassert my_solution.minimizeConcatenatedLength(**[['ab', 'acb']]) == 5\nassert my_solution.minimizeConcatenatedLength(**[['ab', 'bc']]) == 3\n"}, "labels": {"questionId": "2854", "questionFrontendId": "2746", "questionTitle": "Decremental String Concatenation", "stats": {"totalAccepted": "2.5K", "totalSubmission": "6.4K", "totalAcceptedRaw": 2537, "totalSubmissionRaw": 6371, "acRate": "39.8%"}, "probedCases": [{"inputs": [["aa", "ab", "bc"]], "output": 4}, {"inputs": [["ab", "b"]], "output": 2}, {"inputs": [["aaa", "c", "aba"]], "output": 6}, {"inputs": [["a", "a"]], "output": 1}, {"inputs": [["a", "ab"]], "output": 2}, {"inputs": [["a", "b"]], "output": 2}, {"inputs": [["a", "ca"]], "output": 2}, {"inputs": [["a", "cb"]], "output": 3}, {"inputs": [["aa", "a"]], "output": 2}, {"inputs": [["aa", "b"]], "output": 3}, {"inputs": [["aa", "ca"]], "output": 3}, {"inputs": [["aa", "ccc"]], "output": 5}, {"inputs": [["aab", "b"]], "output": 3}, {"inputs": [["aab", "ba"]], "output": 4}, {"inputs": [["aab", "bb"]], "output": 4}, {"inputs": [["aab", "bba"]], "output": 5}, {"inputs": [["aab", "c"]], "output": 4}, {"inputs": [["aac", "b"]], "output": 4}, {"inputs": [["ab", "acb"]], "output": 5}, {"inputs": [["ab", "bc"]], "output": 3}]}} +{"id": "LeetCode/2833", "content": "# Count Zero Request Servers\n\nYou are given an integer `n` denoting the total number of servers and a **2D** **0-indexed** integer array `logs`, where `logs[i] = [server_id, time]` denotes that the server with id `server_id` received a request at time `time`.\n\n\nYou are also given an integer `x` and a **0-indexed** integer array `queries`.\n\n\nReturn *a **0-indexed** integer array* `arr` *of length* `queries.length` *where* `arr[i]` *represents the number of servers that **did not receive** any requests during the time interval* `[queries[i] - x, queries[i]]`.\n\n\nNote that the time intervals are inclusive.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 3, logs = [[1,3],[2,6],[1,5]], x = 5, queries = [10,11]\n**Output:** [1,2]\n**Explanation:** \nFor queries[0]: The servers with ids 1 and 2 get requests in the duration of [5, 10]. Hence, only server 3 gets zero requests.\nFor queries[1]: Only the server with id 2 gets a request in duration of [6,11]. Hence, the servers with ids 1 and 3 are the only servers that do not receive any requests during that time period.\n\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 3, logs = [[2,4],[2,1],[1,2],[3,1]], x = 2, queries = [3,4]\n**Output:** [0,1]\n**Explanation:** \nFor queries[0]: All servers get at least one request in the duration of [1, 3].\nFor queries[1]: Only server with id 3 gets no request in the duration [2,4].\n\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 105`\n* `1 <= logs.length <= 105`\n* `1 <= queries.length <= 105`\n* `logs[i].length == 2`\n* `1 <= logs[i][0] <= n`\n* `1 <= logs[i][1] <= 106`\n* `1 <= x <= 105`\n* `x < queries[i] <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countServers(self, n: int, logs: List[List[int]], x: int, queries: List[int]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countServers(**[3, [[1, 3], [2, 6], [1, 5]], 5, [10, 11]]) == [1, 2]\nassert my_solution.countServers(**[3, [[2, 4], [2, 1], [1, 2], [3, 1]], 2, [3, 4]]) == [0, 1]\nassert my_solution.countServers(**[4, [[2, 30], [2, 5], [3, 9], [4, 21]], 9, [11, 28, 16, 18]]) == [2, 3, 3, 3]\nassert my_solution.countServers(**[3, [[2, 26], [3, 13], [3, 1]], 9, [28, 17]]) == [2, 2]\nassert my_solution.countServers(**[6, [[1, 21]], 10, [24, 35, 28, 26, 20, 25, 16, 31, 12]]) == [5, 6, 5, 5, 6, 5, 6, 5, 6]\nassert my_solution.countServers(**[3, [[1, 35], [1, 32], [1, 11], [1, 39], [2, 29]], 8, [38, 30, 23, 33, 15, 31, 34, 22, 11, 14]]) == [2, 2, 3, 1, 2, 2, 1, 3, 2, 2]\nassert my_solution.countServers(**[4, [[4, 3], [2, 16], [1, 21], [3, 22], [1, 13], [3, 10], [2, 1], [1, 12], [4, 13], [2, 18]], 8, [14, 28, 29]]) == [1, 2, 2]\nassert my_solution.countServers(**[4, [[1, 26], [2, 30], [4, 3], [3, 21], [4, 23], [1, 9], [1, 3], [4, 35], [1, 32], [2, 1]], 7, [35, 25, 21, 19, 8, 23, 27]]) == [1, 2, 3, 4, 1, 2, 1]\nassert my_solution.countServers(**[3, [[1, 1], [3, 28], [3, 32], [2, 22], [2, 7], [3, 30], [3, 9], [1, 18], [2, 4], [1, 19]], 6, [15, 33, 22, 29, 34, 14, 23]]) == [2, 2, 1, 2, 2, 2, 1]\nassert my_solution.countServers(**[5, [[3, 4], [5, 1], [4, 6]], 10, [32, 29]]) == [5, 5]\nassert my_solution.countServers(**[2, [[2, 24], [2, 33], [2, 12], [2, 20], [2, 23], [2, 37], [2, 34], [2, 1]], 9, [30, 29, 28, 18, 23, 26, 32]]) == [1, 1, 1, 1, 1, 1, 1]\nassert my_solution.countServers(**[2, [[1, 19], [1, 6], [2, 17], [1, 10], [2, 37]], 8, [31, 29, 18, 13, 12, 30, 34, 28]]) == [2, 2, 0, 1, 1, 2, 2, 2]\nassert my_solution.countServers(**[4, [[3, 4], [3, 1], [4, 26], [4, 24], [1, 6], [1, 25], [2, 21], [3, 28], [1, 4]], 1, [8, 15, 22, 9, 28, 19, 25]]) == [4, 4, 3, 4, 3, 4, 2]\nassert my_solution.countServers(**[9, [[9, 29], [5, 22], [4, 27], [6, 10], [9, 14]], 2, [5, 22, 12, 26, 25, 19, 16, 29, 7]]) == [9, 8, 8, 9, 9, 9, 8, 7, 9]\nassert my_solution.countServers(**[10, [[3, 3], [1, 2], [7, 1], [2, 24], [6, 23], [8, 28], [1, 28]], 4, [14, 28, 29, 34, 12, 30, 31, 19, 15]]) == [10, 7, 8, 10, 10, 8, 8, 10, 10]\nassert my_solution.countServers(**[2, [[2, 29], [2, 27], [1, 8], [2, 28], [2, 24]], 3, [27, 21, 12, 26, 18, 33, 32, 14, 4, 29]]) == [1, 2, 2, 1, 2, 2, 1, 2, 2, 1]\nassert my_solution.countServers(**[4, [[1, 10], [3, 15], [3, 19], [1, 13], [2, 24], [1, 3], [2, 26]], 2, [22, 16, 18, 5, 27]]) == [4, 3, 4, 3, 3]\nassert my_solution.countServers(**[6, [[3, 5], [1, 2], [6, 23], [2, 23], [1, 18], [3, 7], [4, 2], [4, 9], [6, 20], [1, 17]], 1, [16]]) == [6]\nassert my_solution.countServers(**[6, [[5, 34], [4, 33], [4, 16], [3, 31]], 7, [19, 15, 25, 23, 32, 31, 13]]) == [5, 6, 6, 5, 5, 5, 6]\nassert my_solution.countServers(**[6, [[5, 7], [2, 26], [4, 6]], 1, [4, 26, 15, 7, 22]]) == [6, 5, 6, 4, 6]\n"}, "labels": {"questionId": "2833", "questionFrontendId": "2747", "questionTitle": "Count Zero Request Servers", "stats": {"totalAccepted": "2K", "totalSubmission": "5.3K", "totalAcceptedRaw": 2009, "totalSubmissionRaw": 5259, "acRate": "38.2%"}, "probedCases": [{"inputs": [3, [[1, 3], [2, 6], [1, 5]], 5, [10, 11]], "output": [1, 2]}, {"inputs": [3, [[2, 4], [2, 1], [1, 2], [3, 1]], 2, [3, 4]], "output": [0, 1]}, {"inputs": [4, [[2, 30], [2, 5], [3, 9], [4, 21]], 9, [11, 28, 16, 18]], "output": [2, 3, 3, 3]}, {"inputs": [3, [[2, 26], [3, 13], [3, 1]], 9, [28, 17]], "output": [2, 2]}, {"inputs": [6, [[1, 21]], 10, [24, 35, 28, 26, 20, 25, 16, 31, 12]], "output": [5, 6, 5, 5, 6, 5, 6, 5, 6]}, {"inputs": [3, [[1, 35], [1, 32], [1, 11], [1, 39], [2, 29]], 8, [38, 30, 23, 33, 15, 31, 34, 22, 11, 14]], "output": [2, 2, 3, 1, 2, 2, 1, 3, 2, 2]}, {"inputs": [4, [[4, 3], [2, 16], [1, 21], [3, 22], [1, 13], [3, 10], [2, 1], [1, 12], [4, 13], [2, 18]], 8, [14, 28, 29]], "output": [1, 2, 2]}, {"inputs": [4, [[1, 26], [2, 30], [4, 3], [3, 21], [4, 23], [1, 9], [1, 3], [4, 35], [1, 32], [2, 1]], 7, [35, 25, 21, 19, 8, 23, 27]], "output": [1, 2, 3, 4, 1, 2, 1]}, {"inputs": [3, [[1, 1], [3, 28], [3, 32], [2, 22], [2, 7], [3, 30], [3, 9], [1, 18], [2, 4], [1, 19]], 6, [15, 33, 22, 29, 34, 14, 23]], "output": [2, 2, 1, 2, 2, 2, 1]}, {"inputs": [5, [[3, 4], [5, 1], [4, 6]], 10, [32, 29]], "output": [5, 5]}, {"inputs": [2, [[2, 24], [2, 33], [2, 12], [2, 20], [2, 23], [2, 37], [2, 34], [2, 1]], 9, [30, 29, 28, 18, 23, 26, 32]], "output": [1, 1, 1, 1, 1, 1, 1]}, {"inputs": [2, [[1, 19], [1, 6], [2, 17], [1, 10], [2, 37]], 8, [31, 29, 18, 13, 12, 30, 34, 28]], "output": [2, 2, 0, 1, 1, 2, 2, 2]}, {"inputs": [4, [[3, 4], [3, 1], [4, 26], [4, 24], [1, 6], [1, 25], [2, 21], [3, 28], [1, 4]], 1, [8, 15, 22, 9, 28, 19, 25]], "output": [4, 4, 3, 4, 3, 4, 2]}, {"inputs": [9, [[9, 29], [5, 22], [4, 27], [6, 10], [9, 14]], 2, [5, 22, 12, 26, 25, 19, 16, 29, 7]], "output": [9, 8, 8, 9, 9, 9, 8, 7, 9]}, {"inputs": [10, [[3, 3], [1, 2], [7, 1], [2, 24], [6, 23], [8, 28], [1, 28]], 4, [14, 28, 29, 34, 12, 30, 31, 19, 15]], "output": [10, 7, 8, 10, 10, 8, 8, 10, 10]}, {"inputs": [2, [[2, 29], [2, 27], [1, 8], [2, 28], [2, 24]], 3, [27, 21, 12, 26, 18, 33, 32, 14, 4, 29]], "output": [1, 2, 2, 1, 2, 2, 1, 2, 2, 1]}, {"inputs": [4, [[1, 10], [3, 15], [3, 19], [1, 13], [2, 24], [1, 3], [2, 26]], 2, [22, 16, 18, 5, 27]], "output": [4, 3, 4, 3, 3]}, {"inputs": [6, [[3, 5], [1, 2], [6, 23], [2, 23], [1, 18], [3, 7], [4, 2], [4, 9], [6, 20], [1, 17]], 1, [16]], "output": [6]}, {"inputs": [6, [[5, 34], [4, 33], [4, 16], [3, 31]], 7, [19, 15, 25, 23, 32, 31, 13]], "output": [5, 6, 6, 5, 5, 5, 6]}, {"inputs": [6, [[5, 7], [2, 26], [4, 6]], 1, [4, 26, 15, 7, 22]], "output": [6, 5, 6, 4, 6]}]}} +{"id": "LeetCode/2857", "content": "# Total Distance Traveled\n\nA truck has two fuel tanks. You are given two integers, `mainTank` representing the fuel present in the main tank in liters and `additionalTank` representing the fuel present in the additional tank in liters.\n\n\nThe truck has a mileage of `10` km per liter. Whenever `5` liters of fuel get used up in the main tank, if the additional tank has at least `1` liters of fuel, `1` liters of fuel will be transferred from the additional tank to the main tank.\n\n\nReturn *the maximum distance which can be traveled.*\n\n\n**Note:** Injection from the additional tank is not continuous. It happens suddenly and immediately for every 5 liters consumed.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** mainTank = 5, additionalTank = 10\n**Output:** 60\n**Explanation:** \nAfter spending 5 litre of fuel, fuel remaining is (5 - 5 + 1) = 1 litre and distance traveled is 50km.\nAfter spending another 1 litre of fuel, no fuel gets injected in the main tank and the main tank becomes empty.\nTotal distance traveled is 60km.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** mainTank = 1, additionalTank = 2\n**Output:** 10\n**Explanation:** \nAfter spending 1 litre of fuel, the main tank becomes empty.\nTotal distance traveled is 10km.\n\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= mainTank, additionalTank <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def distanceTraveled(self, mainTank: int, additionalTank: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.distanceTraveled(**[5, 10]) == 60\nassert my_solution.distanceTraveled(**[1, 2]) == 10\nassert my_solution.distanceTraveled(**[1, 1]) == 10\nassert my_solution.distanceTraveled(**[1, 3]) == 10\nassert my_solution.distanceTraveled(**[1, 4]) == 10\nassert my_solution.distanceTraveled(**[1, 5]) == 10\nassert my_solution.distanceTraveled(**[1, 6]) == 10\nassert my_solution.distanceTraveled(**[1, 7]) == 10\nassert my_solution.distanceTraveled(**[1, 8]) == 10\nassert my_solution.distanceTraveled(**[1, 9]) == 10\nassert my_solution.distanceTraveled(**[1, 10]) == 10\nassert my_solution.distanceTraveled(**[1, 11]) == 10\nassert my_solution.distanceTraveled(**[1, 12]) == 10\nassert my_solution.distanceTraveled(**[1, 13]) == 10\nassert my_solution.distanceTraveled(**[1, 14]) == 10\nassert my_solution.distanceTraveled(**[1, 15]) == 10\nassert my_solution.distanceTraveled(**[1, 16]) == 10\nassert my_solution.distanceTraveled(**[1, 17]) == 10\nassert my_solution.distanceTraveled(**[1, 18]) == 10\nassert my_solution.distanceTraveled(**[1, 19]) == 10\n"}, "labels": {"questionId": "2857", "questionFrontendId": "2739", "questionTitle": "Total Distance Traveled", "stats": {"totalAccepted": "7.2K", "totalSubmission": "13.8K", "totalAcceptedRaw": 7238, "totalSubmissionRaw": 13804, "acRate": "52.4%"}, "probedCases": [{"inputs": [5, 10], "output": 60}, {"inputs": [1, 2], "output": 10}, {"inputs": [1, 1], "output": 10}, {"inputs": [1, 3], "output": 10}, {"inputs": [1, 4], "output": 10}, {"inputs": [1, 5], "output": 10}, {"inputs": [1, 6], "output": 10}, {"inputs": [1, 7], "output": 10}, {"inputs": [1, 8], "output": 10}, {"inputs": [1, 9], "output": 10}, {"inputs": [1, 10], "output": 10}, {"inputs": [1, 11], "output": 10}, {"inputs": [1, 12], "output": 10}, {"inputs": [1, 13], "output": 10}, {"inputs": [1, 14], "output": 10}, {"inputs": [1, 15], "output": 10}, {"inputs": [1, 16], "output": 10}, {"inputs": [1, 17], "output": 10}, {"inputs": [1, 18], "output": 10}, {"inputs": [1, 19], "output": 10}]}} +{"id": "LeetCode/2845", "content": "# Find the Value of the Partition\n\nYou are given a **positive** integer array `nums`.\n\n\nPartition `nums` into two arrays, `nums1` and `nums2`, such that:\n\n\n* Each element of the array `nums` belongs to either the array `nums1` or the array `nums2`.\n* Both arrays are **non-empty**.\n* The value of the partition is **minimized**.\n\n\nThe value of the partition is `|max(nums1) - min(nums2)|`.\n\n\nHere, `max(nums1)` denotes the maximum element of the array `nums1`, and `min(nums2)` denotes the minimum element of the array `nums2`.\n\n\nReturn *the integer denoting the value of such partition*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,3,2,4]\n**Output:** 1\n**Explanation:** We can partition the array nums into nums1 = [1,2] and nums2 = [3,4].\n- The maximum element of the array nums1 is equal to 2.\n- The minimum element of the array nums2 is equal to 3.\nThe value of the partition is |2 - 3| = 1. \nIt can be proven that 1 is the minimum value out of all partitions.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [100,1,10]\n**Output:** 9\n**Explanation:** We can partition the array nums into nums1 = [10] and nums2 = [100,1].\n- The maximum element of the array nums1 is equal to 10.\n- The minimum element of the array nums2 is equal to 1.\nThe value of the partition is |10 - 1| = 9.\nIt can be proven that 9 is the minimum value out of all partitions.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findValueOfPartition(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findValueOfPartition(**[[1, 3, 2, 4]]) == 1\nassert my_solution.findValueOfPartition(**[[100, 1, 10]]) == 9\nassert my_solution.findValueOfPartition(**[[59, 51, 1, 98, 73]]) == 8\nassert my_solution.findValueOfPartition(**[[84, 11, 100, 100, 75]]) == 0\nassert my_solution.findValueOfPartition(**[[59, 76, 2, 26, 49]]) == 10\nassert my_solution.findValueOfPartition(**[[78, 36, 2, 70, 64, 24, 34, 63, 21, 49]]) == 1\nassert my_solution.findValueOfPartition(**[[43, 35, 19, 1, 21, 11, 59, 38, 47, 1]]) == 0\nassert my_solution.findValueOfPartition(**[[35, 74, 58, 56]]) == 2\nassert my_solution.findValueOfPartition(**[[54, 75, 6, 20, 49, 94, 97, 20, 97]]) == 0\nassert my_solution.findValueOfPartition(**[[92, 13, 30, 32, 89]]) == 2\nassert my_solution.findValueOfPartition(**[[49, 10, 36]]) == 13\nassert my_solution.findValueOfPartition(**[[37, 50, 25, 65, 41, 31]]) == 4\nassert my_solution.findValueOfPartition(**[[14, 20, 59, 42]]) == 6\nassert my_solution.findValueOfPartition(**[[43, 57, 73, 45, 30, 77, 17, 38, 20]]) == 2\nassert my_solution.findValueOfPartition(**[[11, 17, 65, 55, 85, 74, 32]]) == 6\nassert my_solution.findValueOfPartition(**[[84, 93]]) == 9\nassert my_solution.findValueOfPartition(**[[31, 61, 78, 15, 52]]) == 9\nassert my_solution.findValueOfPartition(**[[100, 65, 64, 8, 61, 17]]) == 1\nassert my_solution.findValueOfPartition(**[[3, 72, 8, 90]]) == 5\nassert my_solution.findValueOfPartition(**[[55, 55, 23]]) == 0\n"}, "labels": {"questionId": "2845", "questionFrontendId": "2740", "questionTitle": "Find the Value of the Partition", "stats": {"totalAccepted": "6.2K", "totalSubmission": "8.4K", "totalAcceptedRaw": 6227, "totalSubmissionRaw": 8377, "acRate": "74.3%"}, "probedCases": [{"inputs": [[1, 3, 2, 4]], "output": 1}, {"inputs": [[100, 1, 10]], "output": 9}, {"inputs": [[59, 51, 1, 98, 73]], "output": 8}, {"inputs": [[84, 11, 100, 100, 75]], "output": 0}, {"inputs": [[59, 76, 2, 26, 49]], "output": 10}, {"inputs": [[78, 36, 2, 70, 64, 24, 34, 63, 21, 49]], "output": 1}, {"inputs": [[43, 35, 19, 1, 21, 11, 59, 38, 47, 1]], "output": 0}, {"inputs": [[35, 74, 58, 56]], "output": 2}, {"inputs": [[54, 75, 6, 20, 49, 94, 97, 20, 97]], "output": 0}, {"inputs": [[92, 13, 30, 32, 89]], "output": 2}, {"inputs": [[49, 10, 36]], "output": 13}, {"inputs": [[37, 50, 25, 65, 41, 31]], "output": 4}, {"inputs": [[14, 20, 59, 42]], "output": 6}, {"inputs": [[43, 57, 73, 45, 30, 77, 17, 38, 20]], "output": 2}, {"inputs": [[11, 17, 65, 55, 85, 74, 32]], "output": 6}, {"inputs": [[84, 93]], "output": 9}, {"inputs": [[31, 61, 78, 15, 52]], "output": 9}, {"inputs": [[100, 65, 64, 8, 61, 17]], "output": 1}, {"inputs": [[3, 72, 8, 90]], "output": 5}, {"inputs": [[55, 55, 23]], "output": 0}]}} +{"id": "LeetCode/2848", "content": "# Special Permutations\n\nYou are given a **0-indexed** integer array `nums` containing `n` **distinct** positive integers. A permutation of `nums` is called special if:\n\n\n* For all indexes `0 <= i < n - 1`, either `nums[i] % nums[i+1] == 0` or `nums[i+1] % nums[i] == 0`.\n\n\nReturn *the total number of special permutations.*As the answer could be large, return it **modulo**`109+ 7`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,3,6]\n**Output:** 2\n**Explanation:** [3,6,2] and [2,6,3] are the two special permutations of nums.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,4,3]\n**Output:** 2\n**Explanation:** [3,1,4] and [4,1,3] are the two special permutations of nums.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= nums.length <= 14`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def specialPerm(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.specialPerm(**[[2, 3, 6]]) == 2\nassert my_solution.specialPerm(**[[1, 4, 3]]) == 2\nassert my_solution.specialPerm(**[[31, 93]]) == 2\nassert my_solution.specialPerm(**[[20, 100, 50, 5, 10, 70, 7]]) == 48\nassert my_solution.specialPerm(**[[24, 3, 27, 54, 9, 90, 30, 60, 20, 100]]) == 4\nassert my_solution.specialPerm(**[[3, 21, 84, 14, 56, 7]]) == 34\nassert my_solution.specialPerm(**[[6, 30, 3, 9, 36, 72, 18, 54]]) == 1440\nassert my_solution.specialPerm(**[[14, 28, 84, 21, 63, 9, 27, 81]]) == 8\nassert my_solution.specialPerm(**[[64, 8, 1, 3, 30]]) == 8\nassert my_solution.specialPerm(**[[83, 105]]) == 0\nassert my_solution.specialPerm(**[[99, 11, 44, 88, 22, 66, 33]]) == 72\nassert my_solution.specialPerm(**[[87, 29]]) == 2\nassert my_solution.specialPerm(**[[29, 87]]) == 2\nassert my_solution.specialPerm(**[[30, 6, 54, 27, 81, 9, 90, 15]]) == 56\nassert my_solution.specialPerm(**[[2, 14, 70]]) == 6\nassert my_solution.specialPerm(**[[74, 37]]) == 2\nassert my_solution.specialPerm(**[[68, 17, 51]]) == 2\nassert my_solution.specialPerm(**[[66, 11, 99, 33]]) == 12\nassert my_solution.specialPerm(**[[24, 72, 12]]) == 6\nassert my_solution.specialPerm(**[[94, 47]]) == 2\n"}, "labels": {"questionId": "2848", "questionFrontendId": "2741", "questionTitle": "Special Permutations", "stats": {"totalAccepted": "4.6K", "totalSubmission": "12.5K", "totalAcceptedRaw": 4591, "totalSubmissionRaw": 12533, "acRate": "36.6%"}, "probedCases": [{"inputs": [[2, 3, 6]], "output": 2}, {"inputs": [[1, 4, 3]], "output": 2}, {"inputs": [[31, 93]], "output": 2}, {"inputs": [[20, 100, 50, 5, 10, 70, 7]], "output": 48}, {"inputs": [[24, 3, 27, 54, 9, 90, 30, 60, 20, 100]], "output": 4}, {"inputs": [[3, 21, 84, 14, 56, 7]], "output": 34}, {"inputs": [[6, 30, 3, 9, 36, 72, 18, 54]], "output": 1440}, {"inputs": [[14, 28, 84, 21, 63, 9, 27, 81]], "output": 8}, {"inputs": [[64, 8, 1, 3, 30]], "output": 8}, {"inputs": [[83, 105]], "output": 0}, {"inputs": [[99, 11, 44, 88, 22, 66, 33]], "output": 72}, {"inputs": [[87, 29]], "output": 2}, {"inputs": [[29, 87]], "output": 2}, {"inputs": [[30, 6, 54, 27, 81, 9, 90, 15]], "output": 56}, {"inputs": [[2, 14, 70]], "output": 6}, {"inputs": [[74, 37]], "output": 2}, {"inputs": [[68, 17, 51]], "output": 2}, {"inputs": [[66, 11, 99, 33]], "output": 12}, {"inputs": [[24, 72, 12]], "output": 6}, {"inputs": [[94, 47]], "output": 2}]}} +{"id": "LeetCode/2808", "content": "# Painting the Walls\n\nYou are given two **0-indexed** integer arrays, `cost` and `time`, of size `n` representing the costs and the time taken to paint `n` different walls respectively. There are two painters available:\n\n\n* A**paid painter** that paints the `ith` wall in `time[i]` units of time and takes `cost[i]` units of money.\n* A**free painter** that paints **any** wall in `1` unit of time at a cost of `0`. But the free painter can only be used if the paid painter is already **occupied**.\n\n\nReturn *the minimum amount of money required to paint the* `n`*walls.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** cost = [1,2,3,2], time = [1,2,3,2]\n**Output:** 3\n**Explanation:** The walls at index 0 and 1 will be painted by the paid painter, and it will take 3 units of time; meanwhile, the free painter will paint the walls at index 2 and 3, free of cost in 2 units of time. Thus, the total cost is 1 + 2 = 3.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** cost = [2,3,4,2], time = [1,1,1,1]\n**Output:** 4\n**Explanation:** The walls at index 0 and 3 will be painted by the paid painter, and it will take 2 units of time; meanwhile, the free painter will paint the walls at index 1 and 2, free of cost in 2 units of time. Thus, the total cost is 2 + 2 = 4.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= cost.length <= 500`\n* `cost.length == time.length`\n* `1 <= cost[i] <= 106`\n* `1 <= time[i] <= 500`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def paintWalls(self, cost: List[int], time: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.paintWalls(**[[1, 2, 3, 2], [1, 2, 3, 2]]) == 3\nassert my_solution.paintWalls(**[[2, 3, 4, 2], [1, 1, 1, 1]]) == 4\nassert my_solution.paintWalls(**[[8, 7, 5, 15], [1, 1, 2, 1]]) == 12\nassert my_solution.paintWalls(**[[42, 8, 28, 35, 21, 13, 21, 35], [2, 1, 1, 1, 2, 1, 1, 2]]) == 63\nassert my_solution.paintWalls(**[[49, 35, 32, 20, 30, 12, 42], [1, 1, 2, 2, 1, 1, 2]]) == 62\nassert my_solution.paintWalls(**[[2, 2], [1, 1]]) == 2\nassert my_solution.paintWalls(**[[26, 53, 10, 24, 25, 20, 63, 51], [1, 1, 1, 1, 2, 2, 2, 1]]) == 55\nassert my_solution.paintWalls(**[[76, 25, 96, 46, 85, 19, 29, 88, 2, 5], [1, 2, 1, 3, 1, 3, 3, 3, 2, 1]]) == 46\nassert my_solution.paintWalls(**[[82, 30, 94, 55, 76, 94, 51, 82, 3, 89], [2, 3, 3, 1, 2, 2, 1, 2, 3, 2]]) == 84\nassert my_solution.paintWalls(**[[23, 2, 9, 1, 48, 3, 31], [1, 2, 1, 1, 2, 2, 1]]) == 6\nassert my_solution.paintWalls(**[[21, 52, 42, 21, 2, 55, 63, 50], [2, 2, 1, 2, 1, 1, 2, 2]]) == 44\nassert my_solution.paintWalls(**[[7, 15, 38, 35, 61, 90, 34, 29, 68, 35], [1, 1, 3, 3, 2, 1, 3, 1, 2, 3]]) == 76\nassert my_solution.paintWalls(**[[1, 4], [1, 1]]) == 1\nassert my_solution.paintWalls(**[[23, 33, 19, 12, 27, 20], [2, 2, 2, 2, 2, 1]]) == 31\nassert my_solution.paintWalls(**[[74, 34, 54, 65, 65, 9, 62, 85, 95, 36], [2, 1, 2, 1, 1, 3, 2, 3, 2, 1]]) == 125\nassert my_solution.paintWalls(**[[9, 9, 5], [1, 1, 1]]) == 14\nassert my_solution.paintWalls(**[[4, 7, 9], [1, 1, 1]]) == 11\nassert my_solution.paintWalls(**[[1, 27, 29, 35, 36, 7], [1, 1, 1, 1, 1, 2]]) == 35\nassert my_solution.paintWalls(**[[1], [1]]) == 1\nassert my_solution.paintWalls(**[[41, 15, 27, 36, 28, 47, 36], [2, 1, 2, 2, 2, 1, 2]]) == 70\n"}, "labels": {"questionId": "2808", "questionFrontendId": "2742", "questionTitle": "Painting the Walls", "stats": {"totalAccepted": "3.3K", "totalSubmission": "9K", "totalAcceptedRaw": 3337, "totalSubmissionRaw": 9014, "acRate": "37.0%"}, "probedCases": [{"inputs": [[1, 2, 3, 2], [1, 2, 3, 2]], "output": 3}, {"inputs": [[2, 3, 4, 2], [1, 1, 1, 1]], "output": 4}, {"inputs": [[8, 7, 5, 15], [1, 1, 2, 1]], "output": 12}, {"inputs": [[42, 8, 28, 35, 21, 13, 21, 35], [2, 1, 1, 1, 2, 1, 1, 2]], "output": 63}, {"inputs": [[49, 35, 32, 20, 30, 12, 42], [1, 1, 2, 2, 1, 1, 2]], "output": 62}, {"inputs": [[2, 2], [1, 1]], "output": 2}, {"inputs": [[26, 53, 10, 24, 25, 20, 63, 51], [1, 1, 1, 1, 2, 2, 2, 1]], "output": 55}, {"inputs": [[76, 25, 96, 46, 85, 19, 29, 88, 2, 5], [1, 2, 1, 3, 1, 3, 3, 3, 2, 1]], "output": 46}, {"inputs": [[82, 30, 94, 55, 76, 94, 51, 82, 3, 89], [2, 3, 3, 1, 2, 2, 1, 2, 3, 2]], "output": 84}, {"inputs": [[23, 2, 9, 1, 48, 3, 31], [1, 2, 1, 1, 2, 2, 1]], "output": 6}, {"inputs": [[21, 52, 42, 21, 2, 55, 63, 50], [2, 2, 1, 2, 1, 1, 2, 2]], "output": 44}, {"inputs": [[7, 15, 38, 35, 61, 90, 34, 29, 68, 35], [1, 1, 3, 3, 2, 1, 3, 1, 2, 3]], "output": 76}, {"inputs": [[1, 4], [1, 1]], "output": 1}, {"inputs": [[23, 33, 19, 12, 27, 20], [2, 2, 2, 2, 2, 1]], "output": 31}, {"inputs": [[74, 34, 54, 65, 65, 9, 62, 85, 95, 36], [2, 1, 2, 1, 1, 3, 2, 3, 2, 1]], "output": 125}, {"inputs": [[9, 9, 5], [1, 1, 1]], "output": 14}, {"inputs": [[4, 7, 9], [1, 1, 1]], "output": 11}, {"inputs": [[1, 27, 29, 35, 36, 7], [1, 1, 1, 1, 1, 2]], "output": 35}, {"inputs": [[1], [1]], "output": 1}, {"inputs": [[41, 15, 27, 36, 28, 47, 36], [2, 1, 2, 2, 2, 1, 2]], "output": 70}]}} +{"id": "LeetCode/2836", "content": "# Neither Minimum nor Maximum\n\nGiven an integer array `nums` containing **distinct** **positive** integers, find and return **any** number from the array that is neither the **minimum** nor the **maximum** value in the array, or **`-1`** if there is no such number.\n\n\nReturn *the selected integer.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [3,2,1,4]\n**Output:** 2\n**Explanation:** In this example, the minimum value is 1 and the maximum value is 4. Therefore, either 2 or 3 can be valid answers.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2]\n**Output:** -1\n**Explanation:** Since there is no number in nums that is neither the maximum nor the minimum, we cannot select a number that satisfies the given condition. Therefore, there is no answer.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [2,1,3]\n**Output:** 2\n**Explanation:** Since 2 is neither the maximum nor the minimum value in nums, it is the only valid answer. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 100`\n* `1 <= nums[i] <= 100`\n* All values in `nums` are distinct\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findNonMinOrMax(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findNonMinOrMax(**[[3, 2, 1, 4]]) == 2\nassert my_solution.findNonMinOrMax(**[[1, 2]]) == -1\nassert my_solution.findNonMinOrMax(**[[2, 1, 3]]) == 2\nassert my_solution.findNonMinOrMax(**[[1]]) == -1\nassert my_solution.findNonMinOrMax(**[[2]]) == -1\nassert my_solution.findNonMinOrMax(**[[5]]) == -1\nassert my_solution.findNonMinOrMax(**[[6]]) == -1\nassert my_solution.findNonMinOrMax(**[[7]]) == -1\nassert my_solution.findNonMinOrMax(**[[8]]) == -1\nassert my_solution.findNonMinOrMax(**[[9]]) == -1\nassert my_solution.findNonMinOrMax(**[[10]]) == -1\nassert my_solution.findNonMinOrMax(**[[11]]) == -1\nassert my_solution.findNonMinOrMax(**[[12]]) == -1\nassert my_solution.findNonMinOrMax(**[[13]]) == -1\nassert my_solution.findNonMinOrMax(**[[14]]) == -1\nassert my_solution.findNonMinOrMax(**[[15]]) == -1\nassert my_solution.findNonMinOrMax(**[[17]]) == -1\nassert my_solution.findNonMinOrMax(**[[18]]) == -1\nassert my_solution.findNonMinOrMax(**[[20]]) == -1\nassert my_solution.findNonMinOrMax(**[[22]]) == -1\n"}, "labels": {"questionId": "2836", "questionFrontendId": "2733", "questionTitle": "Neither Minimum nor Maximum", "stats": {"totalAccepted": "9.6K", "totalSubmission": "12.3K", "totalAcceptedRaw": 9556, "totalSubmissionRaw": 12269, "acRate": "77.9%"}, "probedCases": [{"inputs": [[3, 2, 1, 4]], "output": 2}, {"inputs": [[1, 2]], "output": -1}, {"inputs": [[2, 1, 3]], "output": 2}, {"inputs": [[1]], "output": -1}, {"inputs": [[2]], "output": -1}, {"inputs": [[5]], "output": -1}, {"inputs": [[6]], "output": -1}, {"inputs": [[7]], "output": -1}, {"inputs": [[8]], "output": -1}, {"inputs": [[9]], "output": -1}, {"inputs": [[10]], "output": -1}, {"inputs": [[11]], "output": -1}, {"inputs": [[12]], "output": -1}, {"inputs": [[13]], "output": -1}, {"inputs": [[14]], "output": -1}, {"inputs": [[15]], "output": -1}, {"inputs": [[17]], "output": -1}, {"inputs": [[18]], "output": -1}, {"inputs": [[20]], "output": -1}, {"inputs": [[22]], "output": -1}]}} +{"id": "LeetCode/2828", "content": "# Lexicographically Smallest String After Substring Operation\n\nYou are given a string `s` consisting of only lowercase English letters. In one operation, you can do the following:\n\n\n* Select any non-empty substring of `s`, possibly the entire string, then replace each one of its characters with the previous character of the English alphabet. For example, 'b' is converted to 'a', and 'a' is converted to 'z'.\n\n\nReturn *the **lexicographically smallest** string you can obtain after performing the above operation **exactly once**.*\n\n\nA **substring** is a contiguous sequence of characters in a string.\n\n\nA string `x` is **lexicographically smaller** than a string `y` of the same length if `x[i]` comes before `y[i]` in alphabetic order for the first position `i` such that `x[i] != y[i]`.\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"cbabc\"\n**Output:** \"baabc\"\n**Explanation:** We apply the operation on the substring starting at index 0, and ending at index 1 inclusive. \nIt can be proven that the resulting string is the lexicographically smallest. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"acbbc\"\n**Output:** \"abaab\"\n**Explanation:** We apply the operation on the substring starting at index 1, and ending at index 4 inclusive. \nIt can be proven that the resulting string is the lexicographically smallest. \n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"leetcode\"\n**Output:** \"kddsbncd\"\n**Explanation:** We apply the operation on the entire string. \nIt can be proven that the resulting string is the lexicographically smallest. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 3 * 105`\n* `s` consists of lowercase English letters\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def smallestString(self, s: str) -> str:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.smallestString(**['cbabc']) == baabc\nassert my_solution.smallestString(**['acbbc']) == abaab\nassert my_solution.smallestString(**['leetcode']) == kddsbncd\nassert my_solution.smallestString(**['a']) == z\nassert my_solution.smallestString(**['b']) == a\nassert my_solution.smallestString(**['c']) == b\nassert my_solution.smallestString(**['d']) == c\nassert my_solution.smallestString(**['e']) == d\nassert my_solution.smallestString(**['f']) == e\nassert my_solution.smallestString(**['g']) == f\nassert my_solution.smallestString(**['h']) == g\nassert my_solution.smallestString(**['i']) == h\nassert my_solution.smallestString(**['j']) == i\nassert my_solution.smallestString(**['k']) == j\nassert my_solution.smallestString(**['l']) == k\nassert my_solution.smallestString(**['m']) == l\nassert my_solution.smallestString(**['n']) == m\nassert my_solution.smallestString(**['o']) == n\nassert my_solution.smallestString(**['p']) == o\nassert my_solution.smallestString(**['q']) == p\n"}, "labels": {"questionId": "2828", "questionFrontendId": "2734", "questionTitle": "Lexicographically Smallest String After Substring Operation", "stats": {"totalAccepted": "6K", "totalSubmission": "17.5K", "totalAcceptedRaw": 5992, "totalSubmissionRaw": 17481, "acRate": "34.3%"}, "probedCases": [{"inputs": ["cbabc"], "output": "baabc"}, {"inputs": ["acbbc"], "output": "abaab"}, {"inputs": ["leetcode"], "output": "kddsbncd"}, {"inputs": ["a"], "output": "z"}, {"inputs": ["b"], "output": "a"}, {"inputs": ["c"], "output": "b"}, {"inputs": ["d"], "output": "c"}, {"inputs": ["e"], "output": "d"}, {"inputs": ["f"], "output": "e"}, {"inputs": ["g"], "output": "f"}, {"inputs": ["h"], "output": "g"}, {"inputs": ["i"], "output": "h"}, {"inputs": ["j"], "output": "i"}, {"inputs": ["k"], "output": "j"}, {"inputs": ["l"], "output": "k"}, {"inputs": ["m"], "output": "l"}, {"inputs": ["n"], "output": "m"}, {"inputs": ["o"], "output": "n"}, {"inputs": ["p"], "output": "o"}, {"inputs": ["q"], "output": "p"}]}} +{"id": "LeetCode/2810", "content": "# Collecting Chocolates\n\nYou are given a **0-indexed** integer array `nums` of size `n` representing the cost of collecting different chocolates. The cost of collecting the chocolate at the index `i` is `nums[i]`. Each chocolate is of a different type, and initially, the chocolate at the index `i` is of `ith` type.\n\n\nIn one operation, you can do the following with an incurred **cost** of `x`:\n\n\n* Simultaneously change the chocolate of `ith` type to `((i + 1) mod n)th` type for all chocolates.\n\n\nReturn *the minimum cost to collect chocolates of all types, given that you can perform as many operations as you would like.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [20,1,15], x = 5\n**Output:** 13\n**Explanation:** Initially, the chocolate types are [0,1,2]. We will buy the 1st type of chocolate at a cost of 1.\nNow, we will perform the operation at a cost of 5, and the types of chocolates will become [1,2,0]. We will buy the 2ndtype of chocolate at a cost of 1.\nNow, we will again perform the operation at a cost of 5, and the chocolate types will become [2,0,1]. We will buy the 0th type of chocolate at a cost of 1. \nThus, the total cost will become (1 + 5 + 1 + 5 + 1) = 13. We can prove that this is optimal.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2,3], x = 4\n**Output:** 6\n**Explanation:** We will collect all three types of chocolates at their own price without performing any operations. Therefore, the total cost is 1 + 2 + 3 = 6.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 1000`\n* `1 <= nums[i] <= 109`\n* `1 <= x <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minCost(self, nums: List[int], x: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minCost(**[[20, 1, 15], 5]) == 13\nassert my_solution.minCost(**[[1, 2, 3], 4]) == 6\nassert my_solution.minCost(**[[31, 25, 18, 59], 27]) == 119\nassert my_solution.minCost(**[[5, 3], 8]) == 8\nassert my_solution.minCost(**[[15, 150, 56, 69, 214, 203], 42]) == 298\nassert my_solution.minCost(**[[3, 5], 7]) == 8\nassert my_solution.minCost(**[[733, 200, 839, 515, 852, 615, 8, 584, 250, 337], 537]) == 3188\nassert my_solution.minCost(**[[1], 1]) == 1\nassert my_solution.minCost(**[[276, 253, 157, 237, 92, 331, 19], 82]) == 607\nassert my_solution.minCost(**[[271, 902, 792, 501, 184, 559, 140, 506, 94, 161], 167]) == 1947\nassert my_solution.minCost(**[[288, 457, 953, 700, 464, 785, 203, 729, 725, 422], 76]) == 2714\nassert my_solution.minCost(**[[7, 5, 27], 23]) == 39\nassert my_solution.minCost(**[[503, 401, 517, 692, 42, 135, 823, 883, 255, 111], 334]) == 2101\nassert my_solution.minCost(**[[129, 85, 17, 150, 152, 49], 191]) == 558\nassert my_solution.minCost(**[[169, 37, 58, 175, 3, 9], 47]) == 186\nassert my_solution.minCost(**[[204, 191, 276, 165, 235, 440, 403, 22], 416]) == 1810\nassert my_solution.minCost(**[[214, 471, 451, 41, 365, 703, 327, 414, 363], 30]) == 609\nassert my_solution.minCost(**[[1, 24, 2], 16]) == 20\nassert my_solution.minCost(**[[76, 499, 188, 8, 563, 438, 363, 32, 482], 623]) == 1844\nassert my_solution.minCost(**[[22, 13, 21], 20]) == 56\n"}, "labels": {"questionId": "2810", "questionFrontendId": "2735", "questionTitle": "Collecting Chocolates", "stats": {"totalAccepted": "16.9K", "totalSubmission": "30.7K", "totalAcceptedRaw": 16860, "totalSubmissionRaw": 30748, "acRate": "54.8%"}, "probedCases": [{"inputs": [[20, 1, 15], 5], "output": 13}, {"inputs": [[1, 2, 3], 4], "output": 6}, {"inputs": [[31, 25, 18, 59], 27], "output": 119}, {"inputs": [[5, 3], 8], "output": 8}, {"inputs": [[15, 150, 56, 69, 214, 203], 42], "output": 298}, {"inputs": [[3, 5], 7], "output": 8}, {"inputs": [[733, 200, 839, 515, 852, 615, 8, 584, 250, 337], 537], "output": 3188}, {"inputs": [[1], 1], "output": 1}, {"inputs": [[276, 253, 157, 237, 92, 331, 19], 82], "output": 607}, {"inputs": [[271, 902, 792, 501, 184, 559, 140, 506, 94, 161], 167], "output": 1947}, {"inputs": [[288, 457, 953, 700, 464, 785, 203, 729, 725, 422], 76], "output": 2714}, {"inputs": [[7, 5, 27], 23], "output": 39}, {"inputs": [[503, 401, 517, 692, 42, 135, 823, 883, 255, 111], 334], "output": 2101}, {"inputs": [[129, 85, 17, 150, 152, 49], 191], "output": 558}, {"inputs": [[169, 37, 58, 175, 3, 9], 47], "output": 186}, {"inputs": [[204, 191, 276, 165, 235, 440, 403, 22], 416], "output": 1810}, {"inputs": [[214, 471, 451, 41, 365, 703, 327, 414, 363], 30], "output": 609}, {"inputs": [[1, 24, 2], 16], "output": 20}, {"inputs": [[76, 499, 188, 8, 563, 438, 363, 32, 482], 623], "output": 1844}, {"inputs": [[22, 13, 21], 20], "output": 56}]}} +{"id": "LeetCode/2839", "content": "# Maximum Sum Queries\n\nYou are given two **0-indexed** integer arrays `nums1` and `nums2`, each of length `n`, and a **1-indexed 2D array** `queries` where `queries[i] = [xi, yi]`.\n\n\nFor the `ith` query, find the **maximum value** of `nums1[j] + nums2[j]` among all indices `j` `(0 <= j < n)`, where `nums1[j] >= xi` and `nums2[j] >= yi`, or **-1** if there is no `j` satisfying the constraints.\n\n\nReturn *an array* `answer` *where* `answer[i]` *is the answer to the* `ith` *query.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums1 = [4,3,1,2], nums2 = [2,4,9,5], queries = [[4,1],[1,3],[2,5]]\n**Output:** [6,10,7]\n**Explanation:** \nFor the 1st query xi = 4 and yi = 1, we can select index j = 0 since nums1[j] >= 4 and nums2[j] >= 1. The sum nums1[j] + nums2[j] is 6, and we can show that 6 is the maximum we can obtain.\n\nFor the 2nd query xi = 1 and yi = 3, we can select index j = 2 since nums1[j] >= 1 and nums2[j] >= 3. The sum nums1[j] + nums2[j] is 10, and we can show that 10 is the maximum we can obtain. \n\nFor the 3rd query xi = 2 and yi = 5, we can select index j = 3 since nums1[j] >= 2 and nums2[j] >= 5. The sum nums1[j] + nums2[j] is 7, and we can show that 7 is the maximum we can obtain.\n\nTherefore, we return [6,10,7].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums1 = [3,2,5], nums2 = [2,3,4], queries = [[4,4],[3,2],[1,1]]\n**Output:** [9,9,9]\n**Explanation:** For this example, we can use index j = 2 for all the queries since it satisfies the constraints for each query.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums1 = [2,1], nums2 = [2,3], queries = [[3,3]]\n**Output:** [-1]\n**Explanation:** There is one query in this example with xi = 3 and yi = 3. For every index, j, either nums1[j] < xi or nums2[j] < yi. Hence, there is no solution. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `nums1.length == nums2.length`\n* `n == nums1.length`\n* `1 <= n <= 105`\n* `1 <= nums1[i], nums2[i] <= 109`\n* `1 <= queries.length <= 105`\n* `queries[i].length == 2`\n* `xi == queries[i][1]`\n* `yi == queries[i][2]`\n* `1 <= xi, yi <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumSumQueries(self, nums1: List[int], nums2: List[int], queries: List[List[int]]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumSumQueries(**[[4, 3, 1, 2], [2, 4, 9, 5], [[4, 1], [1, 3], [2, 5]]]) == [6, 10, 7]\nassert my_solution.maximumSumQueries(**[[3, 2, 5], [2, 3, 4], [[4, 4], [3, 2], [1, 1]]]) == [9, 9, 9]\nassert my_solution.maximumSumQueries(**[[2, 1], [2, 3], [[3, 3]]]) == [-1]\nassert my_solution.maximumSumQueries(**[[6], [50], [[79, 91]]]) == [-1]\nassert my_solution.maximumSumQueries(**[[23], [38], [[68, 22]]]) == [-1]\nassert my_solution.maximumSumQueries(**[[25], [29], [[66, 65]]]) == [-1]\nassert my_solution.maximumSumQueries(**[[31], [17], [[1, 79]]]) == [-1]\nassert my_solution.maximumSumQueries(**[[39], [30], [[94, 84]]]) == [-1]\nassert my_solution.maximumSumQueries(**[[40], [81], [[71, 45]]]) == [-1]\nassert my_solution.maximumSumQueries(**[[76], [14], [[54, 41]]]) == [-1]\nassert my_solution.maximumSumQueries(**[[95], [75], [[17, 57]]]) == [170]\nassert my_solution.maximumSumQueries(**[[6, 36], [5, 4], [[39, 5]]]) == [-1]\nassert my_solution.maximumSumQueries(**[[9, 17], [37, 10], [[68, 97]]]) == [-1]\nassert my_solution.maximumSumQueries(**[[17], [42], [[9, 60], [94, 22]]]) == [-1, -1]\nassert my_solution.maximumSumQueries(**[[18], [40], [[40, 26], [89, 31]]]) == [-1, -1]\nassert my_solution.maximumSumQueries(**[[24, 50], [62, 62], [[39, 98]]]) == [-1]\nassert my_solution.maximumSumQueries(**[[37], [5], [[23, 63], [12, 89]]]) == [-1, -1]\nassert my_solution.maximumSumQueries(**[[39], [75], [[30, 57], [46, 33]]]) == [114, -1]\nassert my_solution.maximumSumQueries(**[[41], [2], [[15, 60], [30, 17]]]) == [-1, -1]\nassert my_solution.maximumSumQueries(**[[44, 55], [77, 95], [[41, 60]]]) == [150]\n"}, "labels": {"questionId": "2839", "questionFrontendId": "2736", "questionTitle": "Maximum Sum Queries", "stats": {"totalAccepted": "12.5K", "totalSubmission": "23.8K", "totalAcceptedRaw": 12499, "totalSubmissionRaw": 23813, "acRate": "52.5%"}, "probedCases": [{"inputs": [[4, 3, 1, 2], [2, 4, 9, 5], [[4, 1], [1, 3], [2, 5]]], "output": [6, 10, 7]}, {"inputs": [[3, 2, 5], [2, 3, 4], [[4, 4], [3, 2], [1, 1]]], "output": [9, 9, 9]}, {"inputs": [[2, 1], [2, 3], [[3, 3]]], "output": [-1]}, {"inputs": [[6], [50], [[79, 91]]], "output": [-1]}, {"inputs": [[23], [38], [[68, 22]]], "output": [-1]}, {"inputs": [[25], [29], [[66, 65]]], "output": [-1]}, {"inputs": [[31], [17], [[1, 79]]], "output": [-1]}, {"inputs": [[39], [30], [[94, 84]]], "output": [-1]}, {"inputs": [[40], [81], [[71, 45]]], "output": [-1]}, {"inputs": [[76], [14], [[54, 41]]], "output": [-1]}, {"inputs": [[95], [75], [[17, 57]]], "output": [170]}, {"inputs": [[6, 36], [5, 4], [[39, 5]]], "output": [-1]}, {"inputs": [[9, 17], [37, 10], [[68, 97]]], "output": [-1]}, {"inputs": [[17], [42], [[9, 60], [94, 22]]], "output": [-1, -1]}, {"inputs": [[18], [40], [[40, 26], [89, 31]]], "output": [-1, -1]}, {"inputs": [[24, 50], [62, 62], [[39, 98]]], "output": [-1]}, {"inputs": [[37], [5], [[23, 63], [12, 89]]], "output": [-1, -1]}, {"inputs": [[39], [75], [[30, 57], [46, 33]]], "output": [114, -1]}, {"inputs": [[41], [2], [[15, 60], [30, 17]]], "output": [-1, -1]}, {"inputs": [[44, 55], [77, 95], [[41, 60]]], "output": [150]}]}} +{"id": "LeetCode/2786", "content": "# Find the Longest Semi-Repetitive Substring\n\nYou are given a **0-indexed** string `s` that consists of digits from `0` to `9`.\n\n\nA string `t` is called a **semi-repetitive** if there is at most one consecutive pair of the same digits inside `t`. For example, `0010`, `002020`, `0123`, `2002`, and `54944` are semi-repetitive while `00101022`, and `1101234883` are not.\n\n\nReturn *the length of the longest semi-repetitive substring inside* `s`.\n\n\nA **substring** is a contiguous **non-empty** sequence of characters within a string.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"52233\"\n**Output:** 4\n**Explanation:** The longest semi-repetitive substring is \"5223\", which starts at i = 0 and ends at j = 3. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"5494\"\n**Output:** 4\n**Explanation:** s is a semi-reptitive string, so the answer is 4.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"1111111\"\n**Output:** 2\n**Explanation:** The longest semi-repetitive substring is \"11\", which starts at i = 0 and ends at j = 1.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 50`\n* `'0' <= s[i] <= '9'`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def longestSemiRepetitiveSubstring(self, s: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.longestSemiRepetitiveSubstring(**['52233']) == 4\nassert my_solution.longestSemiRepetitiveSubstring(**['5494']) == 4\nassert my_solution.longestSemiRepetitiveSubstring(**['1111111']) == 2\nassert my_solution.longestSemiRepetitiveSubstring(**['0']) == 1\nassert my_solution.longestSemiRepetitiveSubstring(**['1']) == 1\nassert my_solution.longestSemiRepetitiveSubstring(**['2']) == 1\nassert my_solution.longestSemiRepetitiveSubstring(**['3']) == 1\nassert my_solution.longestSemiRepetitiveSubstring(**['4']) == 1\nassert my_solution.longestSemiRepetitiveSubstring(**['5']) == 1\nassert my_solution.longestSemiRepetitiveSubstring(**['6']) == 1\nassert my_solution.longestSemiRepetitiveSubstring(**['7']) == 1\nassert my_solution.longestSemiRepetitiveSubstring(**['8']) == 1\nassert my_solution.longestSemiRepetitiveSubstring(**['9']) == 1\nassert my_solution.longestSemiRepetitiveSubstring(**['00']) == 2\nassert my_solution.longestSemiRepetitiveSubstring(**['01']) == 2\nassert my_solution.longestSemiRepetitiveSubstring(**['02']) == 2\nassert my_solution.longestSemiRepetitiveSubstring(**['03']) == 2\nassert my_solution.longestSemiRepetitiveSubstring(**['04']) == 2\nassert my_solution.longestSemiRepetitiveSubstring(**['05']) == 2\nassert my_solution.longestSemiRepetitiveSubstring(**['06']) == 2\n"}, "labels": {"questionId": "2786", "questionFrontendId": "2730", "questionTitle": "Find the Longest Semi-Repetitive Substring", "stats": {"totalAccepted": "4.9K", "totalSubmission": "10.4K", "totalAcceptedRaw": 4896, "totalSubmissionRaw": 10440, "acRate": "46.9%"}, "probedCases": [{"inputs": ["52233"], "output": 4}, {"inputs": ["5494"], "output": 4}, {"inputs": ["1111111"], "output": 2}, {"inputs": ["0"], "output": 1}, {"inputs": ["1"], "output": 1}, {"inputs": ["2"], "output": 1}, {"inputs": ["3"], "output": 1}, {"inputs": ["4"], "output": 1}, {"inputs": ["5"], "output": 1}, {"inputs": ["6"], "output": 1}, {"inputs": ["7"], "output": 1}, {"inputs": ["8"], "output": 1}, {"inputs": ["9"], "output": 1}, {"inputs": ["00"], "output": 2}, {"inputs": ["01"], "output": 2}, {"inputs": ["02"], "output": 2}, {"inputs": ["03"], "output": 2}, {"inputs": ["04"], "output": 2}, {"inputs": ["05"], "output": 2}, {"inputs": ["06"], "output": 2}]}} +{"id": "LeetCode/2787", "content": "# Movement of Robots\n\nSome robots are standing on an infinite number line with their initial coordinates given by a **0-indexed** integer array `nums` and will start moving once given the command to move. The robots will move a unit distance each second.\n\n\nYou are given a string `s` denoting the direction in which robots will move on command. `'L'` means the robot will move towards the left side or negative side of the number line, whereas `'R'` means the robot will move towards the right side or positive side of the number line.\n\n\nIf two robots collide, they will start moving in opposite directions.\n\n\nReturn *the sum of distances between all the pairs of robots* `d` *seconds after the command.* Since the sum can be very large, return it modulo `109 + 7`.\n\n\n**Note:** \n\n\n* For two robots at the index `i` and `j`, pair `(i,j)` and pair `(j,i)` are considered the same pair.\n* When robots collide, they **instantly change** their directions without wasting any time.\n* Collision happens when two robots share the same place in a moment.\n\t+ For example, if a robot is positioned in 0 going to the right and another is positioned in 2 going to the left, the next second they'll be both in 1 and they will change direction and the next second the first one will be in 0, heading left, and another will be in 2, heading right.\n\t+ For example, if a robot is positioned in 0 going to the right and another is positioned in 1 going to the left, the next second the first one will be in 0, heading left, and another will be in 1, heading right.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [-2,0,2], s = \"RLL\", d = 3\n**Output:** 8\n**Explanation:** \nAfter 1 second, the positions are [-1,-1,1]. Now, the robot at index 0 will move left, and the robot at index 1 will move right.\nAfter 2 seconds, the positions are [-2,0,0]. Now, the robot at index 1 will move left, and the robot at index 2 will move right.\nAfter 3 seconds, the positions are [-3,-1,1].\nThe distance between the robot at index 0 and 1 is abs(-3 - (-1)) = 2.\nThe distance between the robot at index 0 and 2 is abs(-3 - 1) = 4.\nThe distance between the robot at index 1 and 2 is abs(-1 - 1) = 2.\nThe sum of the pairs of all distances = 2 + 4 + 2 = 8.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,0], s = \"RL\", d = 2\n**Output:** 5\n**Explanation:** \nAfter 1 second, the positions are [2,-1].\nAfter 2 seconds, the positions are [3,-2].\nThe distance between the two robots is abs(-2 - 3) = 5.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= nums.length <= 105`\n* `-2 * 109 <= nums[i] <= 2 * 109`\n* `0 <= d <= 109`\n* `nums.length == s.length`\n* `s` consists of 'L' and 'R' only\n* `nums[i]` will be unique.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def sumDistance(self, nums: List[int], s: str, d: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.sumDistance(**[[-2, 0, 2], 'RLL', 3]) == 8\nassert my_solution.sumDistance(**[[1, 0], 'RL', 2]) == 5\nassert my_solution.sumDistance(**[[-10, -13, 10, 14, 11], 'LRLLR', 2]) == 146\nassert my_solution.sumDistance(**[[1, -67, 68, -26, -13, -40, -56, 62, 21], 'LLLRLLRRR', 4]) == 2106\nassert my_solution.sumDistance(**[[-36, -72, -41, 69, -14, 44, 58, -47, 45], 'LLLRRRLRL', 2]) == 2284\nassert my_solution.sumDistance(**[[-16, 20, 11, 6, 0], 'LLLLR', 5]) == 154\nassert my_solution.sumDistance(**[[-16, -84, 49, 51, -52, 90, -9, 68, -64, -43], 'LLLRLLRLLR', 9]) == 3344\nassert my_solution.sumDistance(**[[-59, 39, -11, 53, 48, -54, 27, 17], 'RRLLLLRL', 7]) == 1440\nassert my_solution.sumDistance(**[[-16, 11, 6, -15], 'RLRR', 2]) == 90\nassert my_solution.sumDistance(**[[2, 3], 'RR', 7]) == 1\nassert my_solution.sumDistance(**[[5, 7, -5], 'LRR', 9]) == 40\nassert my_solution.sumDistance(**[[-3, 0], 'RR', 4]) == 3\nassert my_solution.sumDistance(**[[8, -8, -21, -17, 15], 'RLLRL', 10]) == 242\nassert my_solution.sumDistance(**[[4, 5, 3], 'RRR', 2]) == 4\nassert my_solution.sumDistance(**[[12, 31, 24, 49, 37, -61, 3, 43], 'LRRRLRLL', 8]) == 1086\nassert my_solution.sumDistance(**[[3, -47, -25, 15, 8, -27, -33, -16], 'RLRLRLRR', 8]) == 832\nassert my_solution.sumDistance(**[[-73, -53, -75, -59, 99, -66, 66, -28, -98, -76], 'LRLRRRLRRR', 3]) == 3091\nassert my_solution.sumDistance(**[[21, -27, -11, -42, 11, 42, 46, -26], 'RLLLLLLL', 6]) == 1160\nassert my_solution.sumDistance(**[[-3, 1], 'RR', 7]) == 4\nassert my_solution.sumDistance(**[[-59, 45, 15, 8, -4, -3, 9, 51], 'RLRLRRRR', 10]) == 1024\n"}, "labels": {"questionId": "2787", "questionFrontendId": "2731", "questionTitle": "Movement of Robots", "stats": {"totalAccepted": "20.3K", "totalSubmission": "53.3K", "totalAcceptedRaw": 20268, "totalSubmissionRaw": 53335, "acRate": "38.0%"}, "probedCases": [{"inputs": [[-2, 0, 2], "RLL", 3], "output": 8}, {"inputs": [[1, 0], "RL", 2], "output": 5}, {"inputs": [[-10, -13, 10, 14, 11], "LRLLR", 2], "output": 146}, {"inputs": [[1, -67, 68, -26, -13, -40, -56, 62, 21], "LLLRLLRRR", 4], "output": 2106}, {"inputs": [[-36, -72, -41, 69, -14, 44, 58, -47, 45], "LLLRRRLRL", 2], "output": 2284}, {"inputs": [[-16, 20, 11, 6, 0], "LLLLR", 5], "output": 154}, {"inputs": [[-16, -84, 49, 51, -52, 90, -9, 68, -64, -43], "LLLRLLRLLR", 9], "output": 3344}, {"inputs": [[-59, 39, -11, 53, 48, -54, 27, 17], "RRLLLLRL", 7], "output": 1440}, {"inputs": [[-16, 11, 6, -15], "RLRR", 2], "output": 90}, {"inputs": [[2, 3], "RR", 7], "output": 1}, {"inputs": [[5, 7, -5], "LRR", 9], "output": 40}, {"inputs": [[-3, 0], "RR", 4], "output": 3}, {"inputs": [[8, -8, -21, -17, 15], "RLLRL", 10], "output": 242}, {"inputs": [[4, 5, 3], "RRR", 2], "output": 4}, {"inputs": [[12, 31, 24, 49, 37, -61, 3, 43], "LRRRLRLL", 8], "output": 1086}, {"inputs": [[3, -47, -25, 15, 8, -27, -33, -16], "RLRLRLRR", 8], "output": 832}, {"inputs": [[-73, -53, -75, -59, 99, -66, 66, -28, -98, -76], "LRLRRRLRRR", 3], "output": 3091}, {"inputs": [[21, -27, -11, -42, 11, 42, 46, -26], "RLLLLLLL", 6], "output": 1160}, {"inputs": [[-3, 1], "RR", 7], "output": 4}, {"inputs": [[-59, 45, 15, 8, -4, -3, 9, 51], "RLRLRRRR", 10], "output": 1024}]}} +{"id": "LeetCode/2826", "content": "# Find a Good Subset of the Matrix\n\nYou are given a **0-indexed** `m x n` binary matrix `grid`.\n\n\nLet us call a **non-empty** subset of rows **good** if the sum of each column of the subset is at most half of the length of the subset.\n\n\nMore formally, if the length of the chosen subset of rows is `k`, then the sum of each column should be at most `floor(k / 2)`.\n\n\nReturn *an integer array that contains row indices of a good subset sorted in **ascending** order.*\n\n\nIf there are multiple good subsets, you can return any of them. If there are no good subsets, return an empty array.\n\n\nA **subset** of rows of the matrix `grid` is any matrix that can be obtained by deleting some (possibly none or all) rows from `grid`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** grid = [[0,1,1,0],[0,0,0,1],[1,1,1,1]]\n**Output:** [0,1]\n**Explanation:** We can choose the 0th and 1st rows to create a good subset of rows.\nThe length of the chosen subset is 2.\n- The sum of the 0th column is 0 + 0 = 0, which is at most half of the length of the subset.\n- The sum of the 1st column is 1 + 0 = 1, which is at most half of the length of the subset.\n- The sum of the 2nd column is 1 + 0 = 1, which is at most half of the length of the subset.\n- The sum of the 3rd column is 0 + 1 = 1, which is at most half of the length of the subset.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** grid = [[0]]\n**Output:** [0]\n**Explanation:** We can choose the 0th row to create a good subset of rows.\nThe length of the chosen subset is 1.\n- The sum of the 0th column is 0, which is at most half of the length of the subset.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** grid = [[1,1,1],[1,1,1]]\n**Output:** []\n**Explanation:** It is impossible to choose any subset of rows to create a good subset.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `m == grid.length`\n* `n == grid[i].length`\n* `1 <= m <= 104`\n* `1 <= n <= 5`\n* `grid[i][j]` is either `0` or `1`.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def goodSubsetofBinaryMatrix(self, grid: List[List[int]]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.goodSubsetofBinaryMatrix(**[[[0, 1, 1, 0], [0, 0, 0, 1], [1, 1, 1, 1]]]) == [0, 1]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[0]]]) == [0]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[1, 1, 1], [1, 1, 1]]]) == []\nassert my_solution.goodSubsetofBinaryMatrix(**[[[0, 0], [1, 1], [1, 0], [1, 0]]]) == [0]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[1, 0, 0, 1, 0], [1, 0, 1, 0, 1], [0, 0, 0, 0, 1], [1, 0, 1, 1, 1]]]) == [0, 2]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[1, 1, 0, 0, 1], [0, 1, 1, 1, 0], [1, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [1, 0, 1, 1, 0], [1, 0, 0, 0, 1], [1, 1, 0, 1, 0], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]]) == [0, 3]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[1, 1], [0, 1], [1, 0], [0, 0], [1, 0], [0, 1], [1, 1], [0, 1], [1, 1]]]) == [3]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[0, 1], [0, 1], [0, 1], [1, 1], [1, 1], [0, 0], [1, 1], [1, 1]]]) == [5]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[0, 0, 0], [0, 0, 1]]]) == [0]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[0, 1, 1, 0], [1, 1, 1, 0], [1, 1, 1, 0]]]) == []\nassert my_solution.goodSubsetofBinaryMatrix(**[[[1], [0], [1], [0], [0], [0]]]) == [1]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[0, 0], [1, 0], [0, 0], [1, 0], [0, 1], [1, 1], [0, 0], [0, 1], [1, 1], [0, 1]]]) == [0]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[0, 0], [1, 1], [0, 0], [1, 1], [1, 1]]]) == [0]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[1, 1], [0, 1]]]) == []\nassert my_solution.goodSubsetofBinaryMatrix(**[[[1, 0, 0], [1, 0, 1], [1, 1, 0], [0, 0, 1], [0, 0, 0], [0, 1, 1], [0, 1, 1], [1, 0, 0], [0, 1, 1]]]) == [4]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[1, 1, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 1, 0], [0, 1, 1, 1, 0], [1, 0, 1, 0, 0], [1, 0, 0, 1, 0], [0, 1, 1, 1, 1]]]) == [1, 4]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[0, 0, 0, 1, 0], [1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 0, 1]]]) == [0, 1]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[0], [1], [1], [1], [1], [1], [0], [1], [1], [0]]]) == [0]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[1, 1], [1, 0], [1, 1], [0, 1], [1, 1], [1, 0], [1, 0], [1, 0], [0, 1], [1, 1]]]) == [1, 3]\nassert my_solution.goodSubsetofBinaryMatrix(**[[[0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [1, 0, 1, 1, 1], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1], [1, 1, 1, 0, 0]]]) == [4, 5]\n"}, "labels": {"questionId": "2826", "questionFrontendId": "2732", "questionTitle": "Find a Good Subset of the Matrix", "stats": {"totalAccepted": "1.7K", "totalSubmission": "3.1K", "totalAcceptedRaw": 1740, "totalSubmissionRaw": 3051, "acRate": "57.0%"}, "probedCases": [{"inputs": [[[0, 1, 1, 0], [0, 0, 0, 1], [1, 1, 1, 1]]], "output": [0, 1]}, {"inputs": [[[0]]], "output": [0]}, {"inputs": [[[1, 1, 1], [1, 1, 1]]], "output": []}, {"inputs": [[[0, 0], [1, 1], [1, 0], [1, 0]]], "output": [0]}, {"inputs": [[[1, 0, 0, 1, 0], [1, 0, 1, 0, 1], [0, 0, 0, 0, 1], [1, 0, 1, 1, 1]]], "output": [0, 2]}, {"inputs": [[[1, 1, 0, 0, 1], [0, 1, 1, 1, 0], [1, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [1, 0, 1, 1, 0], [1, 0, 0, 0, 1], [1, 1, 0, 1, 0], [1, 0, 1, 0, 1], [1, 1, 1, 1, 1]]], "output": [0, 3]}, {"inputs": [[[1, 1], [0, 1], [1, 0], [0, 0], [1, 0], [0, 1], [1, 1], [0, 1], [1, 1]]], "output": [3]}, {"inputs": [[[0, 1], [0, 1], [0, 1], [1, 1], [1, 1], [0, 0], [1, 1], [1, 1]]], "output": [5]}, {"inputs": [[[0, 0, 0], [0, 0, 1]]], "output": [0]}, {"inputs": [[[0, 1, 1, 0], [1, 1, 1, 0], [1, 1, 1, 0]]], "output": []}, {"inputs": [[[1], [0], [1], [0], [0], [0]]], "output": [1]}, {"inputs": [[[0, 0], [1, 0], [0, 0], [1, 0], [0, 1], [1, 1], [0, 0], [0, 1], [1, 1], [0, 1]]], "output": [0]}, {"inputs": [[[0, 0], [1, 1], [0, 0], [1, 1], [1, 1]]], "output": [0]}, {"inputs": [[[1, 1], [0, 1]]], "output": []}, {"inputs": [[[1, 0, 0], [1, 0, 1], [1, 1, 0], [0, 0, 1], [0, 0, 0], [0, 1, 1], [0, 1, 1], [1, 0, 0], [0, 1, 1]]], "output": [4]}, {"inputs": [[[1, 1, 1, 0, 0], [0, 1, 0, 1, 0], [1, 0, 0, 1, 0], [0, 1, 1, 1, 0], [1, 0, 1, 0, 0], [1, 0, 0, 1, 0], [0, 1, 1, 1, 1]]], "output": [1, 4]}, {"inputs": [[[0, 0, 0, 1, 0], [1, 1, 1, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 0, 1]]], "output": [0, 1]}, {"inputs": [[[0], [1], [1], [1], [1], [1], [0], [1], [1], [0]]], "output": [0]}, {"inputs": [[[1, 1], [1, 0], [1, 1], [0, 1], [1, 1], [1, 0], [1, 0], [1, 0], [0, 1], [1, 1]]], "output": [1, 3]}, {"inputs": [[[0, 1, 0, 1, 0], [0, 1, 1, 1, 0], [1, 0, 1, 1, 1], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1], [1, 1, 1, 0, 0]]], "output": [4, 5]}]}} +{"id": "LeetCode/2825", "content": "# Minimize String Length\n\nGiven a **0-indexed** string `s`, repeatedly perform the following operation **any** number of times:\n\n\n* Choose an index `i` in the string, and let `c` be the character in position `i`. **Delete** the **closest occurrence** of `c` to the **left** of `i` (if any) and the **closest occurrence** of `c` to the **right** of `i` (if any).\n\n\nYour task is to **minimize** the length of `s` by performing the above operation any number of times.\n\n\nReturn *an integer denoting the length of the **minimized** string.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"aaabc\"\n**Output:** 3\n**Explanation:** In this example, s is \"aaabc\". We can start by selecting the character 'a' at index 1. We then remove the closest 'a' to the left of index 1, which is at index 0, and the closest 'a' to the right of index 1, which is at index 2. After this operation, the string becomes \"abc\". Any further operation we perform on the string will leave it unchanged. Therefore, the length of the minimized string is 3.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"cbbd\"\n**Output:** 3\n**Explanation:** For this we can start with character 'b' at index 1. There is no occurrence of 'b' to the left of index 1, but there is one to the right at index 2, so we delete the 'b' at index 2. The string becomes \"cbd\" and further operations will leave it unchanged. Hence, the minimized length is 3. \n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"dddaaa\"\n**Output:** 2\n**Explanation:** For this, we can start with the character 'd' at index 1. The closest occurrence of a 'd' to its left is at index 0, and the closest occurrence of a 'd' to its right is at index 2. We delete both index 0 and 2, so the string becomes \"daaa\". In the new string, we can select the character 'a' at index 2. The closest occurrence of an 'a' to its left is at index 1, and the closest occurrence of an 'a' to its right is at index 3. We delete both of them, and the string becomes \"da\". We cannot minimize this further, so the minimized length is 2.\n\n```\n\n \n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 100`\n* `s` contains only lowercase English letters\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimizedStringLength(self, s: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimizedStringLength(**['aaabc']) == 3\nassert my_solution.minimizedStringLength(**['cbbd']) == 3\nassert my_solution.minimizedStringLength(**['dddaaa']) == 2\nassert my_solution.minimizedStringLength(**['a']) == 1\nassert my_solution.minimizedStringLength(**['b']) == 1\nassert my_solution.minimizedStringLength(**['c']) == 1\nassert my_solution.minimizedStringLength(**['d']) == 1\nassert my_solution.minimizedStringLength(**['e']) == 1\nassert my_solution.minimizedStringLength(**['f']) == 1\nassert my_solution.minimizedStringLength(**['g']) == 1\nassert my_solution.minimizedStringLength(**['h']) == 1\nassert my_solution.minimizedStringLength(**['i']) == 1\nassert my_solution.minimizedStringLength(**['j']) == 1\nassert my_solution.minimizedStringLength(**['k']) == 1\nassert my_solution.minimizedStringLength(**['l']) == 1\nassert my_solution.minimizedStringLength(**['m']) == 1\nassert my_solution.minimizedStringLength(**['n']) == 1\nassert my_solution.minimizedStringLength(**['o']) == 1\nassert my_solution.minimizedStringLength(**['p']) == 1\nassert my_solution.minimizedStringLength(**['q']) == 1\n"}, "labels": {"questionId": "2825", "questionFrontendId": "2716", "questionTitle": "Minimize String Length", "stats": {"totalAccepted": "7.3K", "totalSubmission": "10K", "totalAcceptedRaw": 7280, "totalSubmissionRaw": 9995, "acRate": "72.8%"}, "probedCases": [{"inputs": ["aaabc"], "output": 3}, {"inputs": ["cbbd"], "output": 3}, {"inputs": ["dddaaa"], "output": 2}, {"inputs": ["a"], "output": 1}, {"inputs": ["b"], "output": 1}, {"inputs": ["c"], "output": 1}, {"inputs": ["d"], "output": 1}, {"inputs": ["e"], "output": 1}, {"inputs": ["f"], "output": 1}, {"inputs": ["g"], "output": 1}, {"inputs": ["h"], "output": 1}, {"inputs": ["i"], "output": 1}, {"inputs": ["j"], "output": 1}, {"inputs": ["k"], "output": 1}, {"inputs": ["l"], "output": 1}, {"inputs": ["m"], "output": 1}, {"inputs": ["n"], "output": 1}, {"inputs": ["o"], "output": 1}, {"inputs": ["p"], "output": 1}, {"inputs": ["q"], "output": 1}]}} +{"id": "LeetCode/2785", "content": "# Semi-Ordered Permutation\n\nYou are given a **0-indexed** permutation of `n` integers `nums`.\n\n\nA permutation is called **semi-ordered** if the first number equals `1` and the last number equals `n`. You can perform the below operation as many times as you want until you make `nums` a **semi-ordered** permutation:\n\n\n* Pick two adjacent elements in `nums`, then swap them.\n\n\nReturn *the minimum number of operations to make* `nums` *a **semi-ordered permutation***.\n\n\nA **permutation** is a sequence of integers from `1` to `n` of length `n` containing each number exactly once.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,1,4,3]\n**Output:** 2\n**Explanation:** We can make the permutation semi-ordered using these sequence of operations: \n1 - swap i = 0 and j = 1. The permutation becomes [1,2,4,3].\n2 - swap i = 2 and j = 3. The permutation becomes [1,2,3,4].\nIt can be proved that there is no sequence of less than two operations that make nums a semi-ordered permutation. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,4,1,3]\n**Output:** 3\n**Explanation:** We can make the permutation semi-ordered using these sequence of operations:\n1 - swap i = 1 and j = 2. The permutation becomes [2,1,4,3].\n2 - swap i = 0 and j = 1. The permutation becomes [1,2,4,3].\n3 - swap i = 2 and j = 3. The permutation becomes [1,2,3,4].\nIt can be proved that there is no sequence of less than three operations that make nums a semi-ordered permutation.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,3,4,2,5]\n**Output:** 0\n**Explanation:** The permutation is already a semi-ordered permutation.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= nums.length == n <= 50`\n* `1 <= nums[i] <= 50`\n* `nums is a permutation.`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def semiOrderedPermutation(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.semiOrderedPermutation(**[[2, 1, 4, 3]]) == 2\nassert my_solution.semiOrderedPermutation(**[[2, 4, 1, 3]]) == 3\nassert my_solution.semiOrderedPermutation(**[[1, 3, 4, 2, 5]]) == 0\nassert my_solution.semiOrderedPermutation(**[[1, 2]]) == 0\nassert my_solution.semiOrderedPermutation(**[[2, 1]]) == 1\nassert my_solution.semiOrderedPermutation(**[[1, 2, 3]]) == 0\nassert my_solution.semiOrderedPermutation(**[[2, 1, 3]]) == 1\nassert my_solution.semiOrderedPermutation(**[[2, 3, 1]]) == 2\nassert my_solution.semiOrderedPermutation(**[[1, 3, 2]]) == 1\nassert my_solution.semiOrderedPermutation(**[[3, 1, 2]]) == 2\nassert my_solution.semiOrderedPermutation(**[[3, 2, 1]]) == 3\nassert my_solution.semiOrderedPermutation(**[[1, 2, 3, 4]]) == 0\nassert my_solution.semiOrderedPermutation(**[[2, 1, 3, 4]]) == 1\nassert my_solution.semiOrderedPermutation(**[[2, 3, 1, 4]]) == 2\nassert my_solution.semiOrderedPermutation(**[[2, 3, 4, 1]]) == 3\nassert my_solution.semiOrderedPermutation(**[[1, 3, 2, 4]]) == 0\nassert my_solution.semiOrderedPermutation(**[[3, 1, 2, 4]]) == 1\nassert my_solution.semiOrderedPermutation(**[[3, 2, 1, 4]]) == 2\nassert my_solution.semiOrderedPermutation(**[[3, 2, 4, 1]]) == 3\nassert my_solution.semiOrderedPermutation(**[[1, 3, 4, 2]]) == 1\n"}, "labels": {"questionId": "2785", "questionFrontendId": "2717", "questionTitle": "Semi-Ordered Permutation", "stats": {"totalAccepted": "7K", "totalSubmission": "9.5K", "totalAcceptedRaw": 6957, "totalSubmissionRaw": 9475, "acRate": "73.4%"}, "probedCases": [{"inputs": [[2, 1, 4, 3]], "output": 2}, {"inputs": [[2, 4, 1, 3]], "output": 3}, {"inputs": [[1, 3, 4, 2, 5]], "output": 0}, {"inputs": [[1, 2]], "output": 0}, {"inputs": [[2, 1]], "output": 1}, {"inputs": [[1, 2, 3]], "output": 0}, {"inputs": [[2, 1, 3]], "output": 1}, {"inputs": [[2, 3, 1]], "output": 2}, {"inputs": [[1, 3, 2]], "output": 1}, {"inputs": [[3, 1, 2]], "output": 2}, {"inputs": [[3, 2, 1]], "output": 3}, {"inputs": [[1, 2, 3, 4]], "output": 0}, {"inputs": [[2, 1, 3, 4]], "output": 1}, {"inputs": [[2, 3, 1, 4]], "output": 2}, {"inputs": [[2, 3, 4, 1]], "output": 3}, {"inputs": [[1, 3, 2, 4]], "output": 0}, {"inputs": [[3, 1, 2, 4]], "output": 1}, {"inputs": [[3, 2, 1, 4]], "output": 2}, {"inputs": [[3, 2, 4, 1]], "output": 3}, {"inputs": [[1, 3, 4, 2]], "output": 1}]}} +{"id": "LeetCode/2757", "content": "# Count of Integers\n\nYou are given two numeric strings `num1` and `num2` and two integers `max_sum` and `min_sum`. We denote an integer `x` to be *good* if:\n\n\n* `num1 <= x <= num2`\n* `min_sum <= digit_sum(x) <= max_sum`.\n\n\nReturn *the number of good integers*. Since the answer may be large, return it modulo `109 + 7`.\n\n\nNote that `digit_sum(x)` denotes the sum of the digits of `x`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** num1 = \"1\", num2 = \"12\", min_sum = 1, max_sum = 8\n**Output:** 11\n**Explanation:** There are 11 integers whose sum of digits lies between 1 and 8 are 1,2,3,4,5,6,7,8,10,11, and 12. Thus, we return 11.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** num1 = \"1\", num2 = \"5\", min_sum = 1, max_sum = 5\n**Output:** 5\n**Explanation:** The 5 integers whose sum of digits lies between 1 and 5 are 1,2,3,4, and 5. Thus, we return 5.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= num1 <= num2 <= 1022`\n* `1 <= min_sum <= max_sum <= 400`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def count(self, num1: str, num2: str, min_sum: int, max_sum: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.count(**['1', '12', 1, 8]) == 11\nassert my_solution.count(**['1', '5', 1, 5]) == 5\nassert my_solution.count(**['4179205230', '7748704426', 8, 46]) == 883045899\nassert my_solution.count(**['1479192516', '5733987233', 36, 108]) == 519488312\nassert my_solution.count(**['4859473643', '30159981595', 58, 59]) == 972251498\nassert my_solution.count(**['1012640017461217236611', '9234552128261772272769', 67, 148]) == 683479047\nassert my_solution.count(**['2991881296', '8678809677', 46, 326]) == 887229207\nassert my_solution.count(**['6312', '9416', 29, 30]) == 114\nassert my_solution.count(**['1000000007', '2000000014', 1, 400]) == 1\nassert my_solution.count(**['1', '12', 5, 8]) == 4\nassert my_solution.count(**['664', '4906', 17, 24]) == 1778\nassert my_solution.count(**['6635', '9845', 27, 29]) == 339\nassert my_solution.count(**['7809', '9275', 19, 22]) == 429\nassert my_solution.count(**['8269', '8554', 10, 14]) == 19\nassert my_solution.count(**['1554', '5658', 30, 30]) == 4\nassert my_solution.count(**['5082', '5891', 24, 24]) == 35\nassert my_solution.count(**['5410', '9277', 18, 19]) == 569\nassert my_solution.count(**['5797', '9353', 11, 30]) == 3419\nassert my_solution.count(**['3351', '7877', 16, 23]) == 2551\nassert my_solution.count(**['8542', '9075', 2, 27]) == 424\n"}, "labels": {"questionId": "2757", "questionFrontendId": "2719", "questionTitle": "Count of Integers", "stats": {"totalAccepted": "14.4K", "totalSubmission": "25.6K", "totalAcceptedRaw": 14375, "totalSubmissionRaw": 25620, "acRate": "56.1%"}, "probedCases": [{"inputs": ["1", "12", 1, 8], "output": 11}, {"inputs": ["1", "5", 1, 5], "output": 5}, {"inputs": ["4179205230", "7748704426", 8, 46], "output": 883045899}, {"inputs": ["1479192516", "5733987233", 36, 108], "output": 519488312}, {"inputs": ["4859473643", "30159981595", 58, 59], "output": 972251498}, {"inputs": ["1012640017461217236611", "9234552128261772272769", 67, 148], "output": 683479047}, {"inputs": ["2991881296", "8678809677", 46, 326], "output": 887229207}, {"inputs": ["6312", "9416", 29, 30], "output": 114}, {"inputs": ["1000000007", "2000000014", 1, 400], "output": 1}, {"inputs": ["1", "12", 5, 8], "output": 4}, {"inputs": ["664", "4906", 17, 24], "output": 1778}, {"inputs": ["6635", "9845", 27, 29], "output": 339}, {"inputs": ["7809", "9275", 19, 22], "output": 429}, {"inputs": ["8269", "8554", 10, 14], "output": 19}, {"inputs": ["1554", "5658", 30, 30], "output": 4}, {"inputs": ["5082", "5891", 24, 24], "output": 35}, {"inputs": ["5410", "9277", 18, 19], "output": 569}, {"inputs": ["5797", "9353", 11, 30], "output": 3419}, {"inputs": ["3351", "7877", 16, 23], "output": 2551}, {"inputs": ["8542", "9075", 2, 27], "output": 424}]}} +{"id": "LeetCode/2819", "content": "# Remove Trailing Zeros From a String\n\nGiven a **positive** integer `num` represented as a string, return *the integer* `num` *without trailing zeros as a string*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** num = \"51230100\"\n**Output:** \"512301\"\n**Explanation:** Integer \"51230100\" has 2 trailing zeros, we remove them and return integer \"512301\".\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** num = \"123\"\n**Output:** \"123\"\n**Explanation:** Integer \"123\" has no trailing zeros, we return integer \"123\".\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= num.length <= 1000`\n* `num` consists of only digits.\n* `num` doesn't have any leading zeros.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def removeTrailingZeros(self, num: str) -> str:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.removeTrailingZeros(**['51230100']) == 512301\nassert my_solution.removeTrailingZeros(**['123']) == 123\nassert my_solution.removeTrailingZeros(**['1720865079269529096765717822459']) == 1720865079269529096765717822459\nassert my_solution.removeTrailingZeros(**['7144743841294080781916786558429']) == 7144743841294080781916786558429\nassert my_solution.removeTrailingZeros(**['4899557969895099468817472']) == 4899557969895099468817472\nassert my_solution.removeTrailingZeros(**['411869412884994212936809415067881212124013636868841988745365283194866298']) == 411869412884994212936809415067881212124013636868841988745365283194866298\nassert my_solution.removeTrailingZeros(**['6320000060155576064433475194277496015965584784508346180457590630139671509042003']) == 6320000060155576064433475194277496015965584784508346180457590630139671509042003\nassert my_solution.removeTrailingZeros(**['18536064908756368878635753877725420832721627175417705334313163152743918284']) == 18536064908756368878635753877725420832721627175417705334313163152743918284\nassert my_solution.removeTrailingZeros(**['31514216007864075756059111751787923413952537015859352242147727420']) == 3151421600786407575605911175178792341395253701585935224214772742\nassert my_solution.removeTrailingZeros(**['778176412164709639995320949248193524679567596956633611253735320337609197903694087247']) == 778176412164709639995320949248193524679567596956633611253735320337609197903694087247\nassert my_solution.removeTrailingZeros(**['2654202174504976690262133614463853127557953924212869337916870720806625423513072805010881594']) == 2654202174504976690262133614463853127557953924212869337916870720806625423513072805010881594\nassert my_solution.removeTrailingZeros(**['201756093344491217']) == 201756093344491217\nassert my_solution.removeTrailingZeros(**['98600182211138782435099309645219818178710738351680959628189']) == 98600182211138782435099309645219818178710738351680959628189\nassert my_solution.removeTrailingZeros(**['699339439231788234588164122']) == 699339439231788234588164122\nassert my_solution.removeTrailingZeros(**['335432394']) == 335432394\nassert my_solution.removeTrailingZeros(**['434426765199302232747258078617604694844575046742075444847184456682707778402158253']) == 434426765199302232747258078617604694844575046742075444847184456682707778402158253\nassert my_solution.removeTrailingZeros(**['768228974017629407344065188577158']) == 768228974017629407344065188577158\nassert my_solution.removeTrailingZeros(**['99413590779889837']) == 99413590779889837\nassert my_solution.removeTrailingZeros(**['8964416159649830616315621934936192519393899006248536553413']) == 8964416159649830616315621934936192519393899006248536553413\nassert my_solution.removeTrailingZeros(**['161000610717026350996481067819904866052481']) == 161000610717026350996481067819904866052481\n"}, "labels": {"questionId": "2819", "questionFrontendId": "2710", "questionTitle": "Remove Trailing Zeros From a String", "stats": {"totalAccepted": "9.2K", "totalSubmission": "11.2K", "totalAcceptedRaw": 9183, "totalSubmissionRaw": 11198, "acRate": "82.0%"}, "probedCases": [{"inputs": ["51230100"], "output": "512301"}, {"inputs": ["123"], "output": "123"}, {"inputs": ["1720865079269529096765717822459"], "output": "1720865079269529096765717822459"}, {"inputs": ["7144743841294080781916786558429"], "output": "7144743841294080781916786558429"}, {"inputs": ["4899557969895099468817472"], "output": "4899557969895099468817472"}, {"inputs": ["411869412884994212936809415067881212124013636868841988745365283194866298"], "output": "411869412884994212936809415067881212124013636868841988745365283194866298"}, {"inputs": ["6320000060155576064433475194277496015965584784508346180457590630139671509042003"], "output": "6320000060155576064433475194277496015965584784508346180457590630139671509042003"}, {"inputs": ["18536064908756368878635753877725420832721627175417705334313163152743918284"], "output": "18536064908756368878635753877725420832721627175417705334313163152743918284"}, {"inputs": ["31514216007864075756059111751787923413952537015859352242147727420"], "output": "3151421600786407575605911175178792341395253701585935224214772742"}, {"inputs": ["778176412164709639995320949248193524679567596956633611253735320337609197903694087247"], "output": "778176412164709639995320949248193524679567596956633611253735320337609197903694087247"}, {"inputs": ["2654202174504976690262133614463853127557953924212869337916870720806625423513072805010881594"], "output": "2654202174504976690262133614463853127557953924212869337916870720806625423513072805010881594"}, {"inputs": ["201756093344491217"], "output": "201756093344491217"}, {"inputs": ["98600182211138782435099309645219818178710738351680959628189"], "output": "98600182211138782435099309645219818178710738351680959628189"}, {"inputs": ["699339439231788234588164122"], "output": "699339439231788234588164122"}, {"inputs": ["335432394"], "output": "335432394"}, {"inputs": ["434426765199302232747258078617604694844575046742075444847184456682707778402158253"], "output": "434426765199302232747258078617604694844575046742075444847184456682707778402158253"}, {"inputs": ["768228974017629407344065188577158"], "output": "768228974017629407344065188577158"}, {"inputs": ["99413590779889837"], "output": "99413590779889837"}, {"inputs": ["8964416159649830616315621934936192519393899006248536553413"], "output": "8964416159649830616315621934936192519393899006248536553413"}, {"inputs": ["161000610717026350996481067819904866052481"], "output": "161000610717026350996481067819904866052481"}]}} +{"id": "LeetCode/2817", "content": "# Minimum Cost to Make All Characters Equal\n\nYou are given a **0-indexed** binary string `s` of length `n` on which you can apply two types of operations:\n\n\n* Choose an index `i` and invert all characters from index `0` to index `i` (both inclusive), with a cost of `i + 1`\n* Choose an index `i` and invert all characters from index `i` to index `n - 1` (both inclusive), with a cost of `n - i`\n\n\nReturn *the **minimum cost** to make all characters of the string **equal***.\n\n\n**Invert** a character means if its value is '0' it becomes '1' and vice-versa.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"0011\"\n**Output:** 2\n**Explanation:** Apply the second operation with i = 2 to obtain s = \"0000\" for a cost of 2. It can be shown that 2 is the minimum cost to make all characters equal.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"010101\"\n**Output:** 9\n**Explanation:** Apply the first operation with i = 2 to obtain s = \"101101\" for a cost of 3.\nApply the first operation with i = 1 to obtain s = \"011101\" for a cost of 2. \nApply the first operation with i = 0 to obtain s = \"111101\" for a cost of 1. \nApply the second operation with i = 4 to obtain s = \"111110\" for a cost of 2.\nApply the second operation with i = 5 to obtain s = \"111111\" for a cost of 1. \nThe total cost to make all characters equal is 9. It can be shown that 9 is the minimum cost to make all characters equal.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length == n <= 105`\n* `s[i]` is either `'0'` or `'1'`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumCost(self, s: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumCost(**['0011']) == 2\nassert my_solution.minimumCost(**['010101']) == 9\nassert my_solution.minimumCost(**['0']) == 0\nassert my_solution.minimumCost(**['00']) == 0\nassert my_solution.minimumCost(**['000']) == 0\nassert my_solution.minimumCost(**['0000']) == 0\nassert my_solution.minimumCost(**['00000']) == 0\nassert my_solution.minimumCost(**['000000']) == 0\nassert my_solution.minimumCost(**['0000000']) == 0\nassert my_solution.minimumCost(**['00000000']) == 0\nassert my_solution.minimumCost(**['000000000']) == 0\nassert my_solution.minimumCost(**['000000001']) == 1\nassert my_solution.minimumCost(**['00000001']) == 1\nassert my_solution.minimumCost(**['000000010']) == 3\nassert my_solution.minimumCost(**['000000011']) == 2\nassert my_solution.minimumCost(**['0000001']) == 1\nassert my_solution.minimumCost(**['00000010']) == 3\nassert my_solution.minimumCost(**['000000100']) == 5\nassert my_solution.minimumCost(**['000000101']) == 6\nassert my_solution.minimumCost(**['00000011']) == 2\n"}, "labels": {"questionId": "2817", "questionFrontendId": "2712", "questionTitle": "Minimum Cost to Make All Characters Equal", "stats": {"totalAccepted": "4.8K", "totalSubmission": "8.4K", "totalAcceptedRaw": 4782, "totalSubmissionRaw": 8374, "acRate": "57.1%"}, "probedCases": [{"inputs": ["0011"], "output": 2}, {"inputs": ["010101"], "output": 9}, {"inputs": ["0"], "output": 0}, {"inputs": ["00"], "output": 0}, {"inputs": ["000"], "output": 0}, {"inputs": ["0000"], "output": 0}, {"inputs": ["00000"], "output": 0}, {"inputs": ["000000"], "output": 0}, {"inputs": ["0000000"], "output": 0}, {"inputs": ["00000000"], "output": 0}, {"inputs": ["000000000"], "output": 0}, {"inputs": ["000000001"], "output": 1}, {"inputs": ["00000001"], "output": 1}, {"inputs": ["000000010"], "output": 3}, {"inputs": ["000000011"], "output": 2}, {"inputs": ["0000001"], "output": 1}, {"inputs": ["00000010"], "output": 3}, {"inputs": ["000000100"], "output": 5}, {"inputs": ["000000101"], "output": 6}, {"inputs": ["00000011"], "output": 2}]}} +{"id": "LeetCode/2756", "content": "# Buy Two Chocolates\n\nYou are given an integer array `prices` representing the prices of various chocolates in a store. You are also given a single integer `money`, which represents your initial amount of money.\n\n\nYou must buy **exactly** two chocolates in such a way that you still have some **non-negative** leftover money. You would like to minimize the sum of the prices of the two chocolates you buy.\n\n\nReturn *the amount of money you will have leftover after buying the two chocolates*. If there is no way for you to buy two chocolates without ending up in debt, return `money`. Note that the leftover must be non-negative.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** prices = [1,2,2], money = 3\n**Output:** 0\n**Explanation:** Purchase the chocolates priced at 1 and 2 units respectively. You will have 3 - 3 = 0 units of money afterwards. Thus, we return 0.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** prices = [3,2,3], money = 3\n**Output:** 3\n**Explanation:** You cannot buy 2 chocolates without going in debt, so we return 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= prices.length <= 50`\n* `1 <= prices[i] <= 100`\n* `1 <= money <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def buyChoco(self, prices: List[int], money: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.buyChoco(**[[1, 2, 2], 3]) == 0\nassert my_solution.buyChoco(**[[3, 2, 3], 3]) == 3\nassert my_solution.buyChoco(**[[98, 54, 6, 34, 66, 63, 52, 39], 62]) == 22\nassert my_solution.buyChoco(**[[75, 28, 65, 18, 37, 18, 97], 13]) == 13\nassert my_solution.buyChoco(**[[69, 91, 78, 19, 40, 13], 94]) == 62\nassert my_solution.buyChoco(**[[88, 43, 61], 72]) == 72\nassert my_solution.buyChoco(**[[46, 56, 41], 79]) == 79\nassert my_solution.buyChoco(**[[71, 62, 57, 67, 34], 8]) == 8\nassert my_solution.buyChoco(**[[2, 12, 93, 52, 91, 86, 81, 1, 79, 64], 43]) == 40\nassert my_solution.buyChoco(**[[94, 42, 91, 9, 25], 73]) == 39\nassert my_solution.buyChoco(**[[31, 19, 70, 58, 12], 11]) == 11\nassert my_solution.buyChoco(**[[66, 63, 14, 39, 71, 38, 91], 16]) == 16\nassert my_solution.buyChoco(**[[43, 70, 27, 78, 71, 76, 37, 57, 12, 77], 50]) == 11\nassert my_solution.buyChoco(**[[74, 31, 38, 24, 25, 24, 5], 79]) == 50\nassert my_solution.buyChoco(**[[61, 9, 12, 87, 97, 17], 20]) == 20\nassert my_solution.buyChoco(**[[11, 90], 70]) == 70\nassert my_solution.buyChoco(**[[91, 68, 36, 67, 31, 28, 87, 76], 54]) == 54\nassert my_solution.buyChoco(**[[58, 64, 85, 83, 90, 46], 11]) == 11\nassert my_solution.buyChoco(**[[79, 15, 63, 76, 81, 43, 25], 32]) == 32\nassert my_solution.buyChoco(**[[94, 35], 15]) == 15\n"}, "labels": {"questionId": "2756", "questionFrontendId": "2706", "questionTitle": "Buy Two Chocolates", "stats": {"totalAccepted": "26.8K", "totalSubmission": "34.6K", "totalAcceptedRaw": 26830, "totalSubmissionRaw": 34620, "acRate": "77.5%"}, "probedCases": [{"inputs": [[1, 2, 2], 3], "output": 0}, {"inputs": [[3, 2, 3], 3], "output": 3}, {"inputs": [[98, 54, 6, 34, 66, 63, 52, 39], 62], "output": 22}, {"inputs": [[75, 28, 65, 18, 37, 18, 97], 13], "output": 13}, {"inputs": [[69, 91, 78, 19, 40, 13], 94], "output": 62}, {"inputs": [[88, 43, 61], 72], "output": 72}, {"inputs": [[46, 56, 41], 79], "output": 79}, {"inputs": [[71, 62, 57, 67, 34], 8], "output": 8}, {"inputs": [[2, 12, 93, 52, 91, 86, 81, 1, 79, 64], 43], "output": 40}, {"inputs": [[94, 42, 91, 9, 25], 73], "output": 39}, {"inputs": [[31, 19, 70, 58, 12], 11], "output": 11}, {"inputs": [[66, 63, 14, 39, 71, 38, 91], 16], "output": 16}, {"inputs": [[43, 70, 27, 78, 71, 76, 37, 57, 12, 77], 50], "output": 11}, {"inputs": [[74, 31, 38, 24, 25, 24, 5], 79], "output": 50}, {"inputs": [[61, 9, 12, 87, 97, 17], 20], "output": 20}, {"inputs": [[11, 90], 70], "output": 70}, {"inputs": [[91, 68, 36, 67, 31, 28, 87, 76], 54], "output": 54}, {"inputs": [[58, 64, 85, 83, 90, 46], 11], "output": 11}, {"inputs": [[79, 15, 63, 76, 81, 43, 25], 32], "output": 32}, {"inputs": [[94, 35], 15], "output": 15}]}} +{"id": "LeetCode/2755", "content": "# Extra Characters in a String\n\nYou are given a **0-indexed** string `s` and a dictionary of words `dictionary`. You have to break `s` into one or more **non-overlapping** substrings such that each substring is present in `dictionary`. There may be some **extra characters** in `s` which are not present in any of the substrings.\n\n\nReturn *the **minimum** number of extra characters left over if you break up* `s` *optimally.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"leetscode\", dictionary = [\"leet\",\"code\",\"leetcode\"]\n**Output:** 1\n**Explanation:** We can break s in two substrings: \"leet\" from index 0 to 3 and \"code\" from index 5 to 8. There is only 1 unused character (at index 4), so we return 1.\n\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"sayhelloworld\", dictionary = [\"hello\",\"world\"]\n**Output:** 3\n**Explanation:** We can break s in two substrings: \"hello\" from index 3 to 7 and \"world\" from index 8 to 12. The characters at indices 0, 1, 2 are not used in any substring and thus are considered as extra characters. Hence, we return 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 50`\n* `1 <= dictionary.length <= 50`\n* `1 <= dictionary[i].length <= 50`\n* `dictionary[i]` and `s` consists of only lowercase English letters\n* `dictionary` contains distinct words\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minExtraChar(self, s: str, dictionary: List[str]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minExtraChar(**['leetscode', ['leet', 'code', 'leetcode']]) == 1\nassert my_solution.minExtraChar(**['sayhelloworld', ['hello', 'world']]) == 3\nassert my_solution.minExtraChar(**['dwmodizxvvbosxxw', ['ox', 'lb', 'diz', 'gu', 'v', 'ksv', 'o', 'nuq', 'r', 'txhe', 'e', 'wmo', 'cehy', 'tskz', 'ds', 'kzbu']]) == 7\nassert my_solution.minExtraChar(**['ecolloycollotkvzqpdaumuqgs', ['flbri', 'uaaz', 'numy', 'laper', 'ioqyt', 'tkvz', 'ndjb', 'gmg', 'gdpbo', 'x', 'collo', 'vuh', 'qhozp', 'iwk', 'paqgn', 'm', 'mhx', 'jgren', 'qqshd', 'qr', 'qpdau', 'oeeuq', 'c', 'qkot', 'uxqvx', 'lhgid', 'vchsk', 'drqx', 'keaua', 'yaru', 'mla', 'shz', 'lby', 'vdxlv', 'xyai', 'lxtgl', 'inz', 'brhi', 'iukt', 'f', 'lbjou', 'vb', 'sz', 'ilkra', 'izwk', 'muqgs', 'gom', 'je']]) == 2\nassert my_solution.minExtraChar(**['eglglxa', ['rs', 'j', 'h', 'g', 'fy', 'l', 'fc', 's', 'zf', 'i', 'k', 'x', 'gl', 'qr', 'qj', 'b', 'm', 'cm', 'pe', 'y', 'ei', 'wg', 'e', 'c', 'll', 'u', 'lb', 'kc', 'r', 'gs', 'p', 'ga', 'pq', 'o', 'wq', 'mp', 'ms', 'vp', 'kg', 'cu']]) == 1\nassert my_solution.minExtraChar(**['kngmktvcxrwubjzk', ['ktvc', 'pajp', 'x', 'emye', 'hde', 'haol', 'ubjz', 'tc', 'rb', 'kng', 'li', 'fph', 'd', 'rgrg']]) == 4\nassert my_solution.minExtraChar(**['voctvochpgutoywpnafylzelqsnzsbandjcqdciyoefi', ['tf', 'v', 'wadrya', 'a', 'cqdci', 'uqfg', 'voc', 'zelqsn', 'band', 'b', 'yoefi', 'utoywp', 'herqqn', 'umra', 'frfuyj', 'vczatj', 'sdww']]) == 11\nassert my_solution.minExtraChar(**['nwlztjn', ['a', 'f', 'v', 'me', 'm', 'bv', 'g', 'ss', 'tu', 'jm', 'z', 'kg', 'l', 'go', 'cn', 'uj', 'kx', 'w', 'qz', 'e', 'ut', 'tf', 'zn', 'ha', 'ke', 'af', 'aj', 'ls', 'r', 'no', 'pm', 'qn', 'yw', 'cs', 'oz', 'b']]) == 4\nassert my_solution.minExtraChar(**['smsvy', ['j', 'p', 'y', 'r', 't', 'nj', 'k', 'xj', 'vg', 'da', 'm', 'u', 'yq', 'as', 'wh', 'b', 'vo', 'h', 'wb', 'z', 'np', 'uy', 'i', 'f', 'w', 'wg', 's', 'ls', 'xf', 'ou', 'mj', 'pf']]) == 1\nassert my_solution.minExtraChar(**['azchrwjli', ['nrd', 'ulh', 'r', 'u', 'm', 'ue', 'jzd', 'zch', 'pbl', 'op', 'mw', 'wjl', 'wv', 'e']]) == 2\nassert my_solution.minExtraChar(**['octncmdbgnxapjoqlofuzypthlytkmchayflwky', ['m', 'its', 'imaby', 'pa', 'ijmnvj', 'k', 'mhka', 'n', 'y', 'nc', 'wq', 'p', 'mjqqa', 'ht', 'dfoa', 'yqa', 'kk', 'pixq', 'ixsdln', 'rh', 'dwl', 'dbgnxa', 'kmpfz', 'nhxjm', 'wg', 'wky', 'oct', 'og', 'uhin', 'zxb', 'qz', 'tpf', 'hlrc', 'j', 'l', 'tew', 'xbn', 'a', 'uzypt', 'uvln', 'mchay', 'onnbi', 'hlytk', 'pjoqlo', 'dxsjr', 'u', 'uj']]) == 2\nassert my_solution.minExtraChar(**['rqdrlfpthqkevauuks', ['pt', 'r', 'luet', 'hn', 'djj', 'nqk', 'yztb', 'yvrm', 'hjw', 'fon', 'hqke', 'btr', 'fg', 'guo', 'un', 'eyl', 'x', 'b', 'wj', 'yzy', 'dpj', 'z', 'oj', 'uu', 'fmp', 'ypmv', 'qd', 'rz', 'efj', 'sfc']]) == 6\nassert my_solution.minExtraChar(**['etzdfxoxyajiothfsxxcxoxhfsxxcbvfmtcibmjkhniq', ['nio', 'y', 'jkhni', 'bu', 'hfsxxc', 'iacjvr', 'xox', 'vrslt', 'bvfm', 'gi', 'tjazf', 'ipfexh', 'tcib', 'crx', 'umxvs', 'q', 'e', 'rlpgq']]) == 10\nassert my_solution.minExtraChar(**['t', ['q', 'f', 'b', 's', 'k', 't', 'p', 'i', 'o', 'v', 'l', 'u', 'c', 'm', 'r', 'd', 'g', 'e', 'j', 'h', 'y']]) == 0\nassert my_solution.minExtraChar(**['cmizgedmufhbnqge', ['yid', 'u', 'jii', 'rdg', 'zcy', 'uo', 'buy', 's', 'vhn', 'ae', 'fygs', 'vlw', 'hv', 'nqge', 'fhb', 'oh', 'm', 'z', 't', 'rqwf', 'iqp', 'xan', 'ir', 'cmi', 'bim', 'bbd', 'jf', 'gs', 'vj']]) == 3\nassert my_solution.minExtraChar(**['ybo', ['k', 'w', 'n', 's', 'v', 'i', 'q', 'j', 'h', 'o', 't', 'y', 'g', 'e', 'z', 'a', 'c', 'x', 'd', 'l', 'f']]) == 1\nassert my_solution.minExtraChar(**['msgaxldzkgi', ['ax', 'ms', 'hvb', 'w', 'z', 'ajc', 'ti', 'cn', 'x', 'j', 'gi', 'r', 'nj', 'f', 'xr', 'iuz', 'ya', 'gty', 'hgs', 'ug', 'mfv', 'bw', 'vr', 'oe', 'xv', 'jf', 'vy', 'q', 'qf', 'oo', 'iq', 't', 'v', 'htx', 'g', 'gjp', 'dis', 'gt', 'gv', 'wu', 'vtx', 'cmo', 'wdl', 'b']]) == 3\nassert my_solution.minExtraChar(**['jztkzefkuhgldeuxumtecjfhwkumklktbvoefjzgbvoebvoeo', ['tkzef', 'teq', 'idx', 'czset', 'jfh', 'fjz', 'nij', 'hpr', 'rhijyw', 'bvoe', 'k', 'umklkt', 'szbescz', 'pyiri', 'bc', 'fzyzcgc', 'lf', 's', 'kxalcws', 'w', 'euxumt', 'hlroawe', 'yvoyx', 'ucvzmc', 'blr', 'piasks', 'fblc']]) == 11\nassert my_solution.minExtraChar(**['pkfydgpkffmfam', ['pk', 'f', 'kdy', 'tw', 'm']]) == 4\nassert my_solution.minExtraChar(**['pucblaexghipwhcfkhwawsuszagdlajctwevqiccnqpyt', ['pyvu', 'vt', 'it', 'jc', 'ex', 'zmn', 'qahtts', 'c', 'q', 'jlui', 'zx', 'gt', 'djb', 'ywdyt', 'dc', 'fhw', 'ninhz', 'vqic', 'ern', 'dwzyiq', 'cvh', 'ualv', 'jgmal', 'soj', 'khwaw', 'zejzs', 'cjqrt', 'la', 'pucb', 'uc', 'ezqcsl', 'uxx', 'pvz', 'uownow', 'f', 'ipwhcf', 'us', 'cx', 'k']]) == 14\n"}, "labels": {"questionId": "2755", "questionFrontendId": "2707", "questionTitle": "Extra Characters in a String", "stats": {"totalAccepted": "20.2K", "totalSubmission": "31.8K", "totalAcceptedRaw": 20196, "totalSubmissionRaw": 31839, "acRate": "63.4%"}, "probedCases": [{"inputs": ["leetscode", ["leet", "code", "leetcode"]], "output": 1}, {"inputs": ["sayhelloworld", ["hello", "world"]], "output": 3}, {"inputs": ["dwmodizxvvbosxxw", ["ox", "lb", "diz", "gu", "v", "ksv", "o", "nuq", "r", "txhe", "e", "wmo", "cehy", "tskz", "ds", "kzbu"]], "output": 7}, {"inputs": ["ecolloycollotkvzqpdaumuqgs", ["flbri", "uaaz", "numy", "laper", "ioqyt", "tkvz", "ndjb", "gmg", "gdpbo", "x", "collo", "vuh", "qhozp", "iwk", "paqgn", "m", "mhx", "jgren", "qqshd", "qr", "qpdau", "oeeuq", "c", "qkot", "uxqvx", "lhgid", "vchsk", "drqx", "keaua", "yaru", "mla", "shz", "lby", "vdxlv", "xyai", "lxtgl", "inz", "brhi", "iukt", "f", "lbjou", "vb", "sz", "ilkra", "izwk", "muqgs", "gom", "je"]], "output": 2}, {"inputs": ["eglglxa", ["rs", "j", "h", "g", "fy", "l", "fc", "s", "zf", "i", "k", "x", "gl", "qr", "qj", "b", "m", "cm", "pe", "y", "ei", "wg", "e", "c", "ll", "u", "lb", "kc", "r", "gs", "p", "ga", "pq", "o", "wq", "mp", "ms", "vp", "kg", "cu"]], "output": 1}, {"inputs": ["kngmktvcxrwubjzk", ["ktvc", "pajp", "x", "emye", "hde", "haol", "ubjz", "tc", "rb", "kng", "li", "fph", "d", "rgrg"]], "output": 4}, {"inputs": ["voctvochpgutoywpnafylzelqsnzsbandjcqdciyoefi", ["tf", "v", "wadrya", "a", "cqdci", "uqfg", "voc", "zelqsn", "band", "b", "yoefi", "utoywp", "herqqn", "umra", "frfuyj", "vczatj", "sdww"]], "output": 11}, {"inputs": ["nwlztjn", ["a", "f", "v", "me", "m", "bv", "g", "ss", "tu", "jm", "z", "kg", "l", "go", "cn", "uj", "kx", "w", "qz", "e", "ut", "tf", "zn", "ha", "ke", "af", "aj", "ls", "r", "no", "pm", "qn", "yw", "cs", "oz", "b"]], "output": 4}, {"inputs": ["smsvy", ["j", "p", "y", "r", "t", "nj", "k", "xj", "vg", "da", "m", "u", "yq", "as", "wh", "b", "vo", "h", "wb", "z", "np", "uy", "i", "f", "w", "wg", "s", "ls", "xf", "ou", "mj", "pf"]], "output": 1}, {"inputs": ["azchrwjli", ["nrd", "ulh", "r", "u", "m", "ue", "jzd", "zch", "pbl", "op", "mw", "wjl", "wv", "e"]], "output": 2}, {"inputs": ["octncmdbgnxapjoqlofuzypthlytkmchayflwky", ["m", "its", "imaby", "pa", "ijmnvj", "k", "mhka", "n", "y", "nc", "wq", "p", "mjqqa", "ht", "dfoa", "yqa", "kk", "pixq", "ixsdln", "rh", "dwl", "dbgnxa", "kmpfz", "nhxjm", "wg", "wky", "oct", "og", "uhin", "zxb", "qz", "tpf", "hlrc", "j", "l", "tew", "xbn", "a", "uzypt", "uvln", "mchay", "onnbi", "hlytk", "pjoqlo", "dxsjr", "u", "uj"]], "output": 2}, {"inputs": ["rqdrlfpthqkevauuks", ["pt", "r", "luet", "hn", "djj", "nqk", "yztb", "yvrm", "hjw", "fon", "hqke", "btr", "fg", "guo", "un", "eyl", "x", "b", "wj", "yzy", "dpj", "z", "oj", "uu", "fmp", "ypmv", "qd", "rz", "efj", "sfc"]], "output": 6}, {"inputs": ["etzdfxoxyajiothfsxxcxoxhfsxxcbvfmtcibmjkhniq", ["nio", "y", "jkhni", "bu", "hfsxxc", "iacjvr", "xox", "vrslt", "bvfm", "gi", "tjazf", "ipfexh", "tcib", "crx", "umxvs", "q", "e", "rlpgq"]], "output": 10}, {"inputs": ["t", ["q", "f", "b", "s", "k", "t", "p", "i", "o", "v", "l", "u", "c", "m", "r", "d", "g", "e", "j", "h", "y"]], "output": 0}, {"inputs": ["cmizgedmufhbnqge", ["yid", "u", "jii", "rdg", "zcy", "uo", "buy", "s", "vhn", "ae", "fygs", "vlw", "hv", "nqge", "fhb", "oh", "m", "z", "t", "rqwf", "iqp", "xan", "ir", "cmi", "bim", "bbd", "jf", "gs", "vj"]], "output": 3}, {"inputs": ["ybo", ["k", "w", "n", "s", "v", "i", "q", "j", "h", "o", "t", "y", "g", "e", "z", "a", "c", "x", "d", "l", "f"]], "output": 1}, {"inputs": ["msgaxldzkgi", ["ax", "ms", "hvb", "w", "z", "ajc", "ti", "cn", "x", "j", "gi", "r", "nj", "f", "xr", "iuz", "ya", "gty", "hgs", "ug", "mfv", "bw", "vr", "oe", "xv", "jf", "vy", "q", "qf", "oo", "iq", "t", "v", "htx", "g", "gjp", "dis", "gt", "gv", "wu", "vtx", "cmo", "wdl", "b"]], "output": 3}, {"inputs": ["jztkzefkuhgldeuxumtecjfhwkumklktbvoefjzgbvoebvoeo", ["tkzef", "teq", "idx", "czset", "jfh", "fjz", "nij", "hpr", "rhijyw", "bvoe", "k", "umklkt", "szbescz", "pyiri", "bc", "fzyzcgc", "lf", "s", "kxalcws", "w", "euxumt", "hlroawe", "yvoyx", "ucvzmc", "blr", "piasks", "fblc"]], "output": 11}, {"inputs": ["pkfydgpkffmfam", ["pk", "f", "kdy", "tw", "m"]], "output": 4}, {"inputs": ["pucblaexghipwhcfkhwawsuszagdlajctwevqiccnqpyt", ["pyvu", "vt", "it", "jc", "ex", "zmn", "qahtts", "c", "q", "jlui", "zx", "gt", "djb", "ywdyt", "dc", "fhw", "ninhz", "vqic", "ern", "dwzyiq", "cvh", "ualv", "jgmal", "soj", "khwaw", "zejzs", "cjqrt", "la", "pucb", "uc", "ezqcsl", "uxx", "pvz", "uownow", "f", "ipwhcf", "us", "cx", "k"]], "output": 14}]}} +{"id": "LeetCode/2754", "content": "# Maximum Strength of a Group\n\nYou are given a **0-indexed** integer array `nums` representing the score of students in an exam. The teacher would like to form one **non-empty** group of students with maximal **strength**, where the strength of a group of students of indices `i0`, `i1`, `i2`, ... , `ik` is defined as `nums[i0] * nums[i1] * nums[i2] * ... * nums[ik​]`.\n\n\nReturn *the maximum strength of a group the teacher can create*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [3,-1,-5,2,5,-9]\n**Output:** 1350\n**Explanation:** One way to form a group of maximal strength is to group the students at indices [0,2,3,4,5]. Their strength is 3 * (-5) * 2 * 5 * (-9) = 1350, which we can show is optimal.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [-4,-5,-4]\n**Output:** 20\n**Explanation:** Group the students at indices [0, 1] . Then, we’ll have a resulting strength of 20. We cannot achieve greater strength.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 13`\n* `-9 <= nums[i] <= 9`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxStrength(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxStrength(**[[3, -1, -5, 2, 5, -9]]) == 1350\nassert my_solution.maxStrength(**[[-4, -5, -4]]) == 20\nassert my_solution.maxStrength(**[[-2, -3, 8, 9]]) == 432\nassert my_solution.maxStrength(**[[-5, 5, -3, -7, -1, -5, 5, 1, -8]]) == 105000\nassert my_solution.maxStrength(**[[-3, -1, -4, -6, -4, 8, -1, 3, 9, -3]]) == 186624\nassert my_solution.maxStrength(**[[-9, 9, -2, 1, 7, -8, -6, 1, 4]]) == 217728\nassert my_solution.maxStrength(**[[8, 6, 0, 5, -4, -8, -4, 9, -1, 6, -4, 8, -5]]) == 265420800\nassert my_solution.maxStrength(**[[-7, -4, -4, -1, 5, 5, -3, 4]]) == 33600\nassert my_solution.maxStrength(**[[-4, -3]]) == 12\nassert my_solution.maxStrength(**[[9, 6, 3]]) == 162\nassert my_solution.maxStrength(**[[-8, -5, -2, -6, 1, 2, 7, 1, -7]]) == 23520\nassert my_solution.maxStrength(**[[9, -3, 2, -5, -2, -9, -8, -4, 5, -3]]) == 1166400\nassert my_solution.maxStrength(**[[-4, 8, -1, -4, -2, 4, 9, 3, -9, 3]]) == 746496\nassert my_solution.maxStrength(**[[8, -3, 5, 5, -8, 2, 1, 3, 2, -9, -5, -9]]) == 7776000\nassert my_solution.maxStrength(**[[-8, 6, 8, -7, 6, -4, -9, 8, 4, 2, -9, 6]]) == 501645312\nassert my_solution.maxStrength(**[[-4, 3, 1, -4, 9, -9, 4, 6, 3, 1]]) == 69984\nassert my_solution.maxStrength(**[[-6, 5, 7, -5, -5, -1, 2, -8]]) == 84000\nassert my_solution.maxStrength(**[[0, -1]]) == 0\nassert my_solution.maxStrength(**[[-1, -2, 7, -1, -7, -5, 0, -8]]) == 3920\nassert my_solution.maxStrength(**[[-9, 5, 8, -7, 9, -7, 4, 5, 8]]) == 3628800\n"}, "labels": {"questionId": "2754", "questionFrontendId": "2708", "questionTitle": "Maximum Strength of a Group", "stats": {"totalAccepted": "4.9K", "totalSubmission": "16.1K", "totalAcceptedRaw": 4897, "totalSubmissionRaw": 16063, "acRate": "30.5%"}, "probedCases": [{"inputs": [[3, -1, -5, 2, 5, -9]], "output": 1350}, {"inputs": [[-4, -5, -4]], "output": 20}, {"inputs": [[-2, -3, 8, 9]], "output": 432}, {"inputs": [[-5, 5, -3, -7, -1, -5, 5, 1, -8]], "output": 105000}, {"inputs": [[-3, -1, -4, -6, -4, 8, -1, 3, 9, -3]], "output": 186624}, {"inputs": [[-9, 9, -2, 1, 7, -8, -6, 1, 4]], "output": 217728}, {"inputs": [[8, 6, 0, 5, -4, -8, -4, 9, -1, 6, -4, 8, -5]], "output": 265420800}, {"inputs": [[-7, -4, -4, -1, 5, 5, -3, 4]], "output": 33600}, {"inputs": [[-4, -3]], "output": 12}, {"inputs": [[9, 6, 3]], "output": 162}, {"inputs": [[-8, -5, -2, -6, 1, 2, 7, 1, -7]], "output": 23520}, {"inputs": [[9, -3, 2, -5, -2, -9, -8, -4, 5, -3]], "output": 1166400}, {"inputs": [[-4, 8, -1, -4, -2, 4, 9, 3, -9, 3]], "output": 746496}, {"inputs": [[8, -3, 5, 5, -8, 2, 1, 3, 2, -9, -5, -9]], "output": 7776000}, {"inputs": [[-8, 6, 8, -7, 6, -4, -9, 8, 4, 2, -9, 6]], "output": 501645312}, {"inputs": [[-4, 3, 1, -4, 9, -9, 4, 6, 3, 1]], "output": 69984}, {"inputs": [[-6, 5, 7, -5, -5, -1, 2, -8]], "output": 84000}, {"inputs": [[0, -1]], "output": 0}, {"inputs": [[-1, -2, 7, -1, -7, -5, 0, -8]], "output": 3920}, {"inputs": [[-9, 5, 8, -7, 9, -7, 4, 5, 8]], "output": 3628800}]}} +{"id": "LeetCode/2827", "content": "# Greatest Common Divisor Traversal\n\nYou are given a **0-indexed** integer array `nums`, and you are allowed to **traverse** between its indices. You can traverse between index `i` and index `j`, `i != j`, if and only if `gcd(nums[i], nums[j]) > 1`, where `gcd` is the **greatest common divisor**.\n\n\nYour task is to determine if for **every pair** of indices `i` and `j` in nums, where `i < j`, there exists a **sequence of traversals** that can take us from `i` to `j`.\n\n\nReturn `true` *if it is possible to traverse between all such pairs of indices,* *or* `false` *otherwise.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,3,6]\n**Output:** true\n**Explanation:** In this example, there are 3 possible pairs of indices: (0, 1), (0, 2), and (1, 2).\nTo go from index 0 to index 1, we can use the sequence of traversals 0 -> 2 -> 1, where we move from index 0 to index 2 because gcd(nums[0], nums[2]) = gcd(2, 6) = 2 > 1, and then move from index 2 to index 1 because gcd(nums[2], nums[1]) = gcd(6, 3) = 3 > 1.\nTo go from index 0 to index 2, we can just go directly because gcd(nums[0], nums[2]) = gcd(2, 6) = 2 > 1. Likewise, to go from index 1 to index 2, we can just go directly because gcd(nums[1], nums[2]) = gcd(3, 6) = 3 > 1.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [3,9,5]\n**Output:** false\n**Explanation:** No sequence of traversals can take us from index 0 to index 2 in this example. So, we return false.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [4,3,12,8]\n**Output:** true\n**Explanation:** There are 6 possible pairs of indices to traverse between: (0, 1), (0, 2), (0, 3), (1, 2), (1, 3), and (2, 3). A valid sequence of traversals exists for each pair, so we return true.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def canTraverseAllPairs(self, nums: List[int]) -> bool:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.canTraverseAllPairs(**[[2, 3, 6]]) == True\nassert my_solution.canTraverseAllPairs(**[[3, 9, 5]]) == False\nassert my_solution.canTraverseAllPairs(**[[4, 3, 12, 8]]) == True\nassert my_solution.canTraverseAllPairs(**[[10]]) == True\nassert my_solution.canTraverseAllPairs(**[[11]]) == True\nassert my_solution.canTraverseAllPairs(**[[14]]) == True\nassert my_solution.canTraverseAllPairs(**[[20]]) == True\nassert my_solution.canTraverseAllPairs(**[[28]]) == True\nassert my_solution.canTraverseAllPairs(**[[30]]) == True\nassert my_solution.canTraverseAllPairs(**[[35]]) == True\nassert my_solution.canTraverseAllPairs(**[[42]]) == True\nassert my_solution.canTraverseAllPairs(**[[44]]) == True\nassert my_solution.canTraverseAllPairs(**[[98]]) == True\nassert my_solution.canTraverseAllPairs(**[[20, 6]]) == True\nassert my_solution.canTraverseAllPairs(**[[28, 39]]) == False\nassert my_solution.canTraverseAllPairs(**[[30, 14]]) == True\nassert my_solution.canTraverseAllPairs(**[[30, 30]]) == True\nassert my_solution.canTraverseAllPairs(**[[33, 60]]) == True\nassert my_solution.canTraverseAllPairs(**[[35, 26]]) == False\nassert my_solution.canTraverseAllPairs(**[[42, 42]]) == True\n"}, "labels": {"questionId": "2827", "questionFrontendId": "2709", "questionTitle": "Greatest Common Divisor Traversal", "stats": {"totalAccepted": "3K", "totalSubmission": "12.1K", "totalAcceptedRaw": 3023, "totalSubmissionRaw": 12060, "acRate": "25.1%"}, "probedCases": [{"inputs": [[2, 3, 6]], "output": true}, {"inputs": [[3, 9, 5]], "output": false}, {"inputs": [[4, 3, 12, 8]], "output": true}, {"inputs": [[10]], "output": true}, {"inputs": [[11]], "output": true}, {"inputs": [[14]], "output": true}, {"inputs": [[20]], "output": true}, {"inputs": [[28]], "output": true}, {"inputs": [[30]], "output": true}, {"inputs": [[35]], "output": true}, {"inputs": [[42]], "output": true}, {"inputs": [[44]], "output": true}, {"inputs": [[98]], "output": true}, {"inputs": [[20, 6]], "output": true}, {"inputs": [[28, 39]], "output": false}, {"inputs": [[30, 14]], "output": true}, {"inputs": [[30, 30]], "output": true}, {"inputs": [[33, 60]], "output": true}, {"inputs": [[35, 26]], "output": false}, {"inputs": [[42, 42]], "output": true}]}} +{"id": "LeetCode/2800", "content": "# Minimum String Length After Removing Substrings\n\nYou are given a string `s` consisting only of **uppercase** English letters.\n\n\nYou can apply some operations to this string where, in one operation, you can remove **any** occurrence of one of the substrings `\"AB\"` or `\"CD\"` from `s`.\n\n\nReturn *the **minimum** possible length of the resulting string that you can obtain*.\n\n\n**Note** that the string concatenates after removing the substring and could produce new `\"AB\"` or `\"CD\"` substrings.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"ABFCACDB\"\n**Output:** 2\n**Explanation:** We can do the following operations:\n- Remove the substring \"ABFCACDB\", so s = \"FCACDB\".\n- Remove the substring \"FCACDB\", so s = \"FCAB\".\n- Remove the substring \"FCAB\", so s = \"FC\".\nSo the resulting length of the string is 2.\nIt can be shown that it is the minimum length that we can obtain.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"ACBBD\"\n**Output:** 5\n**Explanation:** We cannot do any operations on the string so the length remains the same.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 100`\n* `s` consists only of uppercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minLength(self, s: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minLength(**['ABFCACDB']) == 2\nassert my_solution.minLength(**['ACBBD']) == 5\nassert my_solution.minLength(**['A']) == 1\nassert my_solution.minLength(**['D']) == 1\nassert my_solution.minLength(**['Z']) == 1\nassert my_solution.minLength(**['CCCCDDDD']) == 0\nassert my_solution.minLength(**['AATQCABDCBE']) == 7\nassert my_solution.minLength(**['ZKPT']) == 4\nassert my_solution.minLength(**['CCDDACDB']) == 0\nassert my_solution.minLength(**['EUO']) == 3\nassert my_solution.minLength(**['ABG']) == 1\nassert my_solution.minLength(**['FACDHM']) == 4\nassert my_solution.minLength(**['WCCDD']) == 1\nassert my_solution.minLength(**['CCDDLLDW']) == 4\nassert my_solution.minLength(**['GYCD']) == 2\nassert my_solution.minLength(**['CABDCABDAB']) == 0\nassert my_solution.minLength(**['ZCABDRIL']) == 4\nassert my_solution.minLength(**['P']) == 1\nassert my_solution.minLength(**['L']) == 1\nassert my_solution.minLength(**['BQHSABE']) == 5\n"}, "labels": {"questionId": "2800", "questionFrontendId": "2696", "questionTitle": "Minimum String Length After Removing Substrings", "stats": {"totalAccepted": "31.6K", "totalSubmission": "40.8K", "totalAcceptedRaw": 31637, "totalSubmissionRaw": 40759, "acRate": "77.6%"}, "probedCases": [{"inputs": ["ABFCACDB"], "output": 2}, {"inputs": ["ACBBD"], "output": 5}, {"inputs": ["A"], "output": 1}, {"inputs": ["D"], "output": 1}, {"inputs": ["Z"], "output": 1}, {"inputs": ["CCCCDDDD"], "output": 0}, {"inputs": ["AATQCABDCBE"], "output": 7}, {"inputs": ["ZKPT"], "output": 4}, {"inputs": ["CCDDACDB"], "output": 0}, {"inputs": ["EUO"], "output": 3}, {"inputs": ["ABG"], "output": 1}, {"inputs": ["FACDHM"], "output": 4}, {"inputs": ["WCCDD"], "output": 1}, {"inputs": ["CCDDLLDW"], "output": 4}, {"inputs": ["GYCD"], "output": 2}, {"inputs": ["CABDCABDAB"], "output": 0}, {"inputs": ["ZCABDRIL"], "output": 4}, {"inputs": ["P"], "output": 1}, {"inputs": ["L"], "output": 1}, {"inputs": ["BQHSABE"], "output": 5}]}} +{"id": "LeetCode/2816", "content": "# Lexicographically Smallest Palindrome\n\nYou are given a string `s` consisting of **lowercase English letters**, and you are allowed to perform operations on it. In one operation, you can **replace** a character in `s` with another lowercase English letter.\n\n\nYour task is to make `s` a **palindrome** with the **minimum** **number** **of operations** possible. If there are **multiple palindromes** that can be made using the **minimum** number of operations, make the **lexicographically smallest** one.\n\n\nA string `a` is lexicographically smaller than a string `b` (of the same length) if in the first position where `a` and `b` differ, string `a` has a letter that appears earlier in the alphabet than the corresponding letter in `b`.\n\n\nReturn *the resulting palindrome string.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"egcfe\"\n**Output:** \"efcfe\"\n**Explanation:** The minimum number of operations to make \"egcfe\" a palindrome is 1, and the lexicographically smallest palindrome string we can get by modifying one character is \"efcfe\", by changing 'g'.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"abcd\"\n**Output:** \"abba\"\n**Explanation:** The minimum number of operations to make \"abcd\" a palindrome is 2, and the lexicographically smallest palindrome string we can get by modifying two characters is \"abba\".\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"seven\"\n**Output:** \"neven\"\n**Explanation:** The minimum number of operations to make \"seven\" a palindrome is 1, and the lexicographically smallest palindrome string we can get by modifying one character is \"neven\".\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 1000`\n* `s` consists of only lowercase English letters**.**\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def makeSmallestPalindrome(self, s: str) -> str:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.makeSmallestPalindrome(**['egcfe']) == efcfe\nassert my_solution.makeSmallestPalindrome(**['abcd']) == abba\nassert my_solution.makeSmallestPalindrome(**['seven']) == neven\nassert my_solution.makeSmallestPalindrome(**['a']) == a\nassert my_solution.makeSmallestPalindrome(**['b']) == b\nassert my_solution.makeSmallestPalindrome(**['c']) == c\nassert my_solution.makeSmallestPalindrome(**['e']) == e\nassert my_solution.makeSmallestPalindrome(**['f']) == f\nassert my_solution.makeSmallestPalindrome(**['g']) == g\nassert my_solution.makeSmallestPalindrome(**['h']) == h\nassert my_solution.makeSmallestPalindrome(**['i']) == i\nassert my_solution.makeSmallestPalindrome(**['j']) == j\nassert my_solution.makeSmallestPalindrome(**['k']) == k\nassert my_solution.makeSmallestPalindrome(**['m']) == m\nassert my_solution.makeSmallestPalindrome(**['n']) == n\nassert my_solution.makeSmallestPalindrome(**['o']) == o\nassert my_solution.makeSmallestPalindrome(**['p']) == p\nassert my_solution.makeSmallestPalindrome(**['q']) == q\nassert my_solution.makeSmallestPalindrome(**['r']) == r\nassert my_solution.makeSmallestPalindrome(**['s']) == s\n"}, "labels": {"questionId": "2816", "questionFrontendId": "2697", "questionTitle": "Lexicographically Smallest Palindrome", "stats": {"totalAccepted": "28.8K", "totalSubmission": "32.9K", "totalAcceptedRaw": 28789, "totalSubmissionRaw": 32857, "acRate": "87.6%"}, "probedCases": [{"inputs": ["egcfe"], "output": "efcfe"}, {"inputs": ["abcd"], "output": "abba"}, {"inputs": ["seven"], "output": "neven"}, {"inputs": ["a"], "output": "a"}, {"inputs": ["b"], "output": "b"}, {"inputs": ["c"], "output": "c"}, {"inputs": ["e"], "output": "e"}, {"inputs": ["f"], "output": "f"}, {"inputs": ["g"], "output": "g"}, {"inputs": ["h"], "output": "h"}, {"inputs": ["i"], "output": "i"}, {"inputs": ["j"], "output": "j"}, {"inputs": ["k"], "output": "k"}, {"inputs": ["m"], "output": "m"}, {"inputs": ["n"], "output": "n"}, {"inputs": ["o"], "output": "o"}, {"inputs": ["p"], "output": "p"}, {"inputs": ["q"], "output": "q"}, {"inputs": ["r"], "output": "r"}, {"inputs": ["s"], "output": "s"}]}} +{"id": "LeetCode/2802", "content": "# Find the Punishment Number of an Integer\n\nGiven a positive integer `n`, return *the **punishment number*** of `n`.\n\n\nThe **punishment number** of `n` is defined as the sum of the squares of all integers `i` such that:\n\n\n* `1 <= i <= n`\n* The decimal representation of `i * i` can be partitioned into contiguous substrings such that the sum of the integer values of these substrings equals `i`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 10\n**Output:** 182\n**Explanation:** There are exactly 3 integers i that satisfy the conditions in the statement:\n- 1 since 1 * 1 = 1\n- 9 since 9 * 9 = 81 and 81 can be partitioned into 8 + 1.\n- 10 since 10 * 10 = 100 and 100 can be partitioned into 10 + 0.\nHence, the punishment number of 10 is 1 + 81 + 100 = 182\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 37\n**Output:** 1478\n**Explanation:** There are exactly 4 integers i that satisfy the conditions in the statement:\n- 1 since 1 * 1 = 1. \n- 9 since 9 * 9 = 81 and 81 can be partitioned into 8 + 1. \n- 10 since 10 * 10 = 100 and 100 can be partitioned into 10 + 0. \n- 36 since 36 * 36 = 1296 and 1296 can be partitioned into 1 + 29 + 6.\nHence, the punishment number of 37 is 1 + 81 + 100 + 1296 = 1478\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 1000`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def punishmentNumber(self, n: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.punishmentNumber(**[10]) == 182\nassert my_solution.punishmentNumber(**[37]) == 1478\nassert my_solution.punishmentNumber(**[1]) == 1\nassert my_solution.punishmentNumber(**[2]) == 1\nassert my_solution.punishmentNumber(**[3]) == 1\nassert my_solution.punishmentNumber(**[4]) == 1\nassert my_solution.punishmentNumber(**[5]) == 1\nassert my_solution.punishmentNumber(**[6]) == 1\nassert my_solution.punishmentNumber(**[7]) == 1\nassert my_solution.punishmentNumber(**[8]) == 1\nassert my_solution.punishmentNumber(**[9]) == 82\nassert my_solution.punishmentNumber(**[11]) == 182\nassert my_solution.punishmentNumber(**[12]) == 182\nassert my_solution.punishmentNumber(**[13]) == 182\nassert my_solution.punishmentNumber(**[14]) == 182\nassert my_solution.punishmentNumber(**[15]) == 182\nassert my_solution.punishmentNumber(**[16]) == 182\nassert my_solution.punishmentNumber(**[17]) == 182\nassert my_solution.punishmentNumber(**[18]) == 182\nassert my_solution.punishmentNumber(**[19]) == 182\n"}, "labels": {"questionId": "2802", "questionFrontendId": "2698", "questionTitle": "Find the Punishment Number of an Integer", "stats": {"totalAccepted": "27.1K", "totalSubmission": "34.5K", "totalAcceptedRaw": 27123, "totalSubmissionRaw": 34491, "acRate": "78.6%"}, "probedCases": [{"inputs": [10], "output": 182}, {"inputs": [37], "output": 1478}, {"inputs": [1], "output": 1}, {"inputs": [2], "output": 1}, {"inputs": [3], "output": 1}, {"inputs": [4], "output": 1}, {"inputs": [5], "output": 1}, {"inputs": [6], "output": 1}, {"inputs": [7], "output": 1}, {"inputs": [8], "output": 1}, {"inputs": [9], "output": 82}, {"inputs": [11], "output": 182}, {"inputs": [12], "output": 182}, {"inputs": [13], "output": 182}, {"inputs": [14], "output": 182}, {"inputs": [15], "output": 182}, {"inputs": [16], "output": 182}, {"inputs": [17], "output": 182}, {"inputs": [18], "output": 182}, {"inputs": [19], "output": 182}]}} +{"id": "LeetCode/2791", "content": "# Find the Losers of the Circular Game\n\nThere are `n` friends that are playing a game. The friends are sitting in a circle and are numbered from `1` to `n` in **clockwise order**. More formally, moving clockwise from the `ith` friend brings you to the `(i+1)th` friend for `1 <= i < n`, and moving clockwise from the `nth` friend brings you to the `1st` friend.\n\n\nThe rules of the game are as follows:\n\n\n`1st` friend receives the ball.\n\n\n* After that, `1st` friend passes it to the friend who is `k` steps away from them in the **clockwise** direction.\n* After that, the friend who receives the ball should pass it to the friend who is `2 * k` steps away from them in the **clockwise** direction.\n* After that, the friend who receives the ball should pass it to the friend who is `3 * k` steps away from them in the **clockwise** direction, and so on and so forth.\n\n\nIn other words, on the `ith` turn, the friend holding the ball should pass it to the friend who is `i * k` steps away from them in the **clockwise** direction.\n\n\nThe game is finished when some friend receives the ball for the second time.\n\n\nThe **losers** of the game are friends who did not receive the ball in the entire game.\n\n\nGiven the number of friends, `n`, and an integer `k`, return *the array answer, which contains the losers of the game in the **ascending** order*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 5, k = 2\n**Output:** [4,5]\n**Explanation:** The game goes as follows:\n1) Start at 1st friend and pass the ball to the friend who is 2 steps away from them - 3rd friend.\n2) 3rd friend passes the ball to the friend who is 4 steps away from them - 2nd friend.\n3) 2nd friend passes the ball to the friend who is 6 steps away from them - 3rd friend.\n4) The game ends as 3rd friend receives the ball for the second time.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 4, k = 4\n**Output:** [2,3,4]\n**Explanation:** The game goes as follows:\n1) Start at the 1st friend and pass the ball to the friend who is 4 steps away from them - 1st friend.\n2) The game ends as 1st friend receives the ball for the second time.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= k <= n <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def circularGameLosers(self, n: int, k: int) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.circularGameLosers(**[5, 2]) == [4, 5]\nassert my_solution.circularGameLosers(**[4, 4]) == [2, 3, 4]\nassert my_solution.circularGameLosers(**[1, 1]) == []\nassert my_solution.circularGameLosers(**[2, 1]) == []\nassert my_solution.circularGameLosers(**[2, 2]) == [2]\nassert my_solution.circularGameLosers(**[3, 1]) == [3]\nassert my_solution.circularGameLosers(**[3, 2]) == [2]\nassert my_solution.circularGameLosers(**[3, 3]) == [2, 3]\nassert my_solution.circularGameLosers(**[4, 1]) == []\nassert my_solution.circularGameLosers(**[4, 2]) == [2, 4]\nassert my_solution.circularGameLosers(**[4, 3]) == []\nassert my_solution.circularGameLosers(**[5, 1]) == [3, 5]\nassert my_solution.circularGameLosers(**[5, 3]) == [2, 3]\nassert my_solution.circularGameLosers(**[5, 4]) == [2, 4]\nassert my_solution.circularGameLosers(**[5, 5]) == [2, 3, 4, 5]\nassert my_solution.circularGameLosers(**[6, 1]) == [3, 5, 6]\nassert my_solution.circularGameLosers(**[6, 2]) == [2, 4, 5, 6]\nassert my_solution.circularGameLosers(**[6, 3]) == [2, 3, 5, 6]\nassert my_solution.circularGameLosers(**[6, 4]) == [2, 3, 4, 6]\nassert my_solution.circularGameLosers(**[6, 5]) == [2, 3, 5]\n"}, "labels": {"questionId": "2791", "questionFrontendId": "2682", "questionTitle": "Find the Losers of the Circular Game", "stats": {"totalAccepted": "31.1K", "totalSubmission": "51.2K", "totalAcceptedRaw": 31126, "totalSubmissionRaw": 51225, "acRate": "60.8%"}, "probedCases": [{"inputs": [5, 2], "output": [4, 5]}, {"inputs": [4, 4], "output": [2, 3, 4]}, {"inputs": [1, 1], "output": []}, {"inputs": [2, 1], "output": []}, {"inputs": [2, 2], "output": [2]}, {"inputs": [3, 1], "output": [3]}, {"inputs": [3, 2], "output": [2]}, {"inputs": [3, 3], "output": [2, 3]}, {"inputs": [4, 1], "output": []}, {"inputs": [4, 2], "output": [2, 4]}, {"inputs": [4, 3], "output": []}, {"inputs": [5, 1], "output": [3, 5]}, {"inputs": [5, 3], "output": [2, 3]}, {"inputs": [5, 4], "output": [2, 4]}, {"inputs": [5, 5], "output": [2, 3, 4, 5]}, {"inputs": [6, 1], "output": [3, 5, 6]}, {"inputs": [6, 2], "output": [2, 4, 5, 6]}, {"inputs": [6, 3], "output": [2, 3, 5, 6]}, {"inputs": [6, 4], "output": [2, 3, 4, 6]}, {"inputs": [6, 5], "output": [2, 3, 5]}]}} +{"id": "LeetCode/2792", "content": "# Neighboring Bitwise XOR\n\nA **0-indexed** array `derived` with length `n` is derived by computing the **bitwise XOR** (⊕) of adjacent values in a **binary array** `original` of length `n`.\n\n\nSpecifically, for each index `i` in the range `[0, n - 1]`:\n\n\n* If `i = n - 1`, then `derived[i] = original[i] ⊕ original[0]`.\n* Otherwise, `derived[i] = original[i] ⊕ original[i + 1]`.\n\n\nGiven an array `derived`, your task is to determine whether there exists a **valid binary array** `original` that could have formed `derived`.\n\n\nReturn ***true** if such an array exists or **false** otherwise.*\n\n\n* A binary array is an array containing only **0's** and **1's**\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** derived = [1,1,0]\n**Output:** true\n**Explanation:** A valid original array that gives derived is [0,1,0].\nderived[0] = original[0] ⊕ original[1] = 0 ⊕ 1 = 1 \nderived[1] = original[1] ⊕ original[2] = 1 ⊕ 0 = 1\nderived[2] = original[2] ⊕ original[0] = 0 ⊕ 0 = 0\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** derived = [1,1]\n**Output:** true\n**Explanation:** A valid original array that gives derived is [0,1].\nderived[0] = original[0] ⊕ original[1] = 1\nderived[1] = original[1] ⊕ original[0] = 1\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** derived = [1,0]\n**Output:** false\n**Explanation:** There is no valid original array that gives derived.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `n == derived.length`\n* `1 <= n <= 105`\n* The values in `derived` are either **0's** or **1's**\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def doesValidArrayExist(self, derived: List[int]) -> bool:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.doesValidArrayExist(**[[1, 1, 0]]) == True\nassert my_solution.doesValidArrayExist(**[[1, 1]]) == True\nassert my_solution.doesValidArrayExist(**[[1, 0]]) == False\nassert my_solution.doesValidArrayExist(**[[0]]) == True\nassert my_solution.doesValidArrayExist(**[[1]]) == False\nassert my_solution.doesValidArrayExist(**[[0, 0]]) == True\nassert my_solution.doesValidArrayExist(**[[0, 1]]) == False\nassert my_solution.doesValidArrayExist(**[[0, 0, 0]]) == True\nassert my_solution.doesValidArrayExist(**[[0, 0, 1]]) == False\nassert my_solution.doesValidArrayExist(**[[0, 1, 0]]) == False\nassert my_solution.doesValidArrayExist(**[[0, 1, 1]]) == True\nassert my_solution.doesValidArrayExist(**[[1, 0, 0]]) == False\nassert my_solution.doesValidArrayExist(**[[1, 0, 1]]) == True\nassert my_solution.doesValidArrayExist(**[[1, 1, 1]]) == False\nassert my_solution.doesValidArrayExist(**[[0, 0, 0, 0]]) == True\nassert my_solution.doesValidArrayExist(**[[0, 0, 0, 1]]) == False\nassert my_solution.doesValidArrayExist(**[[0, 0, 1, 0]]) == False\nassert my_solution.doesValidArrayExist(**[[0, 0, 1, 1]]) == True\nassert my_solution.doesValidArrayExist(**[[0, 1, 0, 0]]) == False\nassert my_solution.doesValidArrayExist(**[[0, 1, 0, 1]]) == True\n"}, "labels": {"questionId": "2792", "questionFrontendId": "2683", "questionTitle": "Neighboring Bitwise XOR", "stats": {"totalAccepted": "6.4K", "totalSubmission": "9.1K", "totalAcceptedRaw": 6399, "totalSubmissionRaw": 9102, "acRate": "70.3%"}, "probedCases": [{"inputs": [[1, 1, 0]], "output": true}, {"inputs": [[1, 1]], "output": true}, {"inputs": [[1, 0]], "output": false}, {"inputs": [[0]], "output": true}, {"inputs": [[1]], "output": false}, {"inputs": [[0, 0]], "output": true}, {"inputs": [[0, 1]], "output": false}, {"inputs": [[0, 0, 0]], "output": true}, {"inputs": [[0, 0, 1]], "output": false}, {"inputs": [[0, 1, 0]], "output": false}, {"inputs": [[0, 1, 1]], "output": true}, {"inputs": [[1, 0, 0]], "output": false}, {"inputs": [[1, 0, 1]], "output": true}, {"inputs": [[1, 1, 1]], "output": false}, {"inputs": [[0, 0, 0, 0]], "output": true}, {"inputs": [[0, 0, 0, 1]], "output": false}, {"inputs": [[0, 0, 1, 0]], "output": false}, {"inputs": [[0, 0, 1, 1]], "output": true}, {"inputs": [[0, 1, 0, 0]], "output": false}, {"inputs": [[0, 1, 0, 1]], "output": true}]}} +{"id": "LeetCode/2727", "content": "# Number of Senior Citizens\n\nYou are given a **0-indexed** array of strings `details`. Each element of `details` provides information about a given passenger compressed into a string of length `15`. The system is such that:\n\n\n* The first ten characters consist of the phone number of passengers.\n* The next character denotes the gender of the person.\n* The following two characters are used to indicate the age of the person.\n* The last two characters determine the seat allotted to that person.\n\n\nReturn *the number of passengers who are **strictly** **more than 60 years old**.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** details = [\"7868190130M7522\",\"5303914400F9211\",\"9273338290F4010\"]\n**Output:** 2\n**Explanation:** The passengers at indices 0, 1, and 2 have ages 75, 92, and 40. Thus, there are 2 people who are over 60 years old.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** details = [\"1313579440F2036\",\"2921522980M5644\"]\n**Output:** 0\n**Explanation:** None of the passengers are older than 60.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= details.length <= 100`\n* `details[i].length == 15`\n* `details[i] consists of digits from '0' to '9'.`\n* `details[i][10] is either 'M' or 'F' or 'O'.`\n* The phone numbers and seat numbers of the passengers are distinct.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countSeniors(self, details: List[str]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countSeniors(**[['7868190130M7522', '5303914400F9211', '9273338290F4010']]) == 2\nassert my_solution.countSeniors(**[['1313579440F2036', '2921522980M5644']]) == 0\nassert my_solution.countSeniors(**[['5612624052M0130', '5378802576M6424', '5447619845F0171', '2941701174O9078']]) == 2\nassert my_solution.countSeniors(**[['3991316911M8713', '6725249886O4741', '5473888009F5845', '4984061663O0864']]) == 1\nassert my_solution.countSeniors(**[['9751302862F0693', '3888560693F7262', '5485983835F0649', '2580974299F6042', '9976672161M6561', '0234451011F8013', '4294552179O6482']]) == 4\nassert my_solution.countSeniors(**[['7988027446O6842', '9520600906F3730', '8472982398F1852', '4846816953F7286', '4202235069F3818']]) == 2\nassert my_solution.countSeniors(**[['4700210787M5228', '0255398455F6295', '7384431514M7800', '1443977449M3109', '2282994255O5226', '8606200969O9277', '4437405006F0455']]) == 3\nassert my_solution.countSeniors(**[['1392071998O7877', '2871124410F4021', '8421864498O6227', '9931521255O3135', '2473473988O6615', '3280803948F1681', '0237807850F8276', '9514919390M4340']]) == 4\nassert my_solution.countSeniors(**[['0397702323O3173', '4378252056M9757', '9417440094F6155', '9386845039M5153', '6113409278O6674']]) == 3\nassert my_solution.countSeniors(**[['6754701005F5111', '2367591042M1658', '5007460685O3874']]) == 0\nassert my_solution.countSeniors(**[['0734795065O8950', '1621077912F8367']]) == 2\nassert my_solution.countSeniors(**[['2888752261F4414', '0521214419M4752', '4432525667F3437', '0832032564O5212', '2737580494O9719', '8135188724O5822', '1154907412F2727', '0356348635F6299', '6730846554O6789']]) == 3\nassert my_solution.countSeniors(**[['0596524473F9082', '6954537659O5938', '0372781636M8811', '2810637070F6751', '7996396465M0492']]) == 3\nassert my_solution.countSeniors(**[['8019564951O8970', '3548178582M6608', '6469783063O7399', '6021500511M9077', '9155267429O3772', '1544539168F8702', '5685546483F6836', '8130544867F9350']]) == 7\nassert my_solution.countSeniors(**[['4033768340M6635', '5062762244F4277', '4007914018O6198', '4587751274F2513']]) == 2\nassert my_solution.countSeniors(**[['3637439539O5371']]) == 0\nassert my_solution.countSeniors(**[['4515431186M0219', '5905210445F6568']]) == 1\nassert my_solution.countSeniors(**[['7039235288F1130', '8205469350O4522', '4713027183F0597', '1279957477O5991', '4020985356F3599', '4569195356F0641', '5728937156M7527', '9941084817F6951']]) == 2\nassert my_solution.countSeniors(**[['7714889516O0084', '3092492530F3817', '2777997043O4321', '3385255405F1280', '0552767275O7278']]) == 1\nassert my_solution.countSeniors(**[['0605578375M5168', '5369815077F2482', '6406066197M6947', '3059720887O8421', '1583105327M0903', '4276037521O2556', '3507586986M0743']]) == 2\n"}, "labels": {"questionId": "2727", "questionFrontendId": "2678", "questionTitle": "Number of Senior Citizens", "stats": {"totalAccepted": "35.6K", "totalSubmission": "44.9K", "totalAcceptedRaw": 35613, "totalSubmissionRaw": 44872, "acRate": "79.4%"}, "probedCases": [{"inputs": [["7868190130M7522", "5303914400F9211", "9273338290F4010"]], "output": 2}, {"inputs": [["1313579440F2036", "2921522980M5644"]], "output": 0}, {"inputs": [["5612624052M0130", "5378802576M6424", "5447619845F0171", "2941701174O9078"]], "output": 2}, {"inputs": [["3991316911M8713", "6725249886O4741", "5473888009F5845", "4984061663O0864"]], "output": 1}, {"inputs": [["9751302862F0693", "3888560693F7262", "5485983835F0649", "2580974299F6042", "9976672161M6561", "0234451011F8013", "4294552179O6482"]], "output": 4}, {"inputs": [["7988027446O6842", "9520600906F3730", "8472982398F1852", "4846816953F7286", "4202235069F3818"]], "output": 2}, {"inputs": [["4700210787M5228", "0255398455F6295", "7384431514M7800", "1443977449M3109", "2282994255O5226", "8606200969O9277", "4437405006F0455"]], "output": 3}, {"inputs": [["1392071998O7877", "2871124410F4021", "8421864498O6227", "9931521255O3135", "2473473988O6615", "3280803948F1681", "0237807850F8276", "9514919390M4340"]], "output": 4}, {"inputs": [["0397702323O3173", "4378252056M9757", "9417440094F6155", "9386845039M5153", "6113409278O6674"]], "output": 3}, {"inputs": [["6754701005F5111", "2367591042M1658", "5007460685O3874"]], "output": 0}, {"inputs": [["0734795065O8950", "1621077912F8367"]], "output": 2}, {"inputs": [["2888752261F4414", "0521214419M4752", "4432525667F3437", "0832032564O5212", "2737580494O9719", "8135188724O5822", "1154907412F2727", "0356348635F6299", "6730846554O6789"]], "output": 3}, {"inputs": [["0596524473F9082", "6954537659O5938", "0372781636M8811", "2810637070F6751", "7996396465M0492"]], "output": 3}, {"inputs": [["8019564951O8970", "3548178582M6608", "6469783063O7399", "6021500511M9077", "9155267429O3772", "1544539168F8702", "5685546483F6836", "8130544867F9350"]], "output": 7}, {"inputs": [["4033768340M6635", "5062762244F4277", "4007914018O6198", "4587751274F2513"]], "output": 2}, {"inputs": [["3637439539O5371"]], "output": 0}, {"inputs": [["4515431186M0219", "5905210445F6568"]], "output": 1}, {"inputs": [["7039235288F1130", "8205469350O4522", "4713027183F0597", "1279957477O5991", "4020985356F3599", "4569195356F0641", "5728937156M7527", "9941084817F6951"]], "output": 2}, {"inputs": [["7714889516O0084", "3092492530F3817", "2777997043O4321", "3385255405F1280", "0552767275O7278"]], "output": 1}, {"inputs": [["0605578375M5168", "5369815077F2482", "6406066197M6947", "3059720887O8421", "1583105327M0903", "4276037521O2556", "3507586986M0743"]], "output": 2}]}} +{"id": "LeetCode/2728", "content": "# Sum in a Matrix\n\nYou are given a **0-indexed** 2D integer array `nums`. Initially, your score is `0`. Perform the following operations until the matrix becomes empty:\n\n\n1. From each row in the matrix, select the largest number and remove it. In the case of a tie, it does not matter which number is chosen.\n2. Identify the highest number amongst all those removed in step 1. Add that number to your **score**.\n\n\nReturn *the final **score**.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [[7,2,1],[6,4,2],[6,5,3],[3,2,1]]\n**Output:** 15\n**Explanation:** In the first operation, we remove 7, 6, 6, and 3. We then add 7 to our score. Next, we remove 2, 4, 5, and 2. We add 5 to our score. Lastly, we remove 1, 2, 3, and 1. We add 3 to our score. Thus, our final score is 7 + 5 + 3 = 15.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [[1]]\n**Output:** 1\n**Explanation:** We remove 1 and add it to the answer. We return 1.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 300`\n* `1 <= nums[i].length <= 500`\n* `0 <= nums[i][j] <= 103`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def matrixSum(self, nums: List[List[int]]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.matrixSum(**[[[7, 2, 1], [6, 4, 2], [6, 5, 3], [3, 2, 1]]]) == 15\nassert my_solution.matrixSum(**[[[1]]]) == 1\nassert my_solution.matrixSum(**[[[1, 8, 16, 15, 12, 9, 15, 11, 18, 6, 16, 4, 9, 4], [3, 19, 8, 17, 19, 4, 9, 3, 2, 10, 15, 17, 3, 11], [13, 10, 19, 20, 6, 17, 15, 14, 16, 8, 1, 17, 0, 2], [12, 20, 0, 19, 15, 10, 7, 10, 2, 6, 18, 7, 7, 4], [17, 14, 2, 2, 10, 16, 15, 3, 9, 17, 9, 3, 17, 10], [17, 6, 19, 17, 18, 9, 14, 2, 19, 12, 10, 18, 7, 9], [5, 6, 5, 1, 19, 8, 15, 2, 2, 4, 4, 1, 2, 17], [12, 16, 8, 16, 7, 6, 18, 13, 18, 8, 14, 15, 20, 11], [2, 10, 19, 3, 15, 18, 20, 10, 6, 7, 0, 8, 3, 7], [11, 5, 10, 13, 1, 3, 4, 7, 1, 18, 20, 17, 19, 2], [0, 3, 20, 6, 19, 18, 3, 12, 2, 11, 3, 1, 19, 0], [6, 5, 3, 15, 6, 1, 0, 17, 13, 19, 3, 8, 2, 7], [2, 20, 9, 11, 13, 5, 1, 16, 14, 1, 19, 3, 12, 6]]]) == 190\nassert my_solution.matrixSum(**[[[15, 18, 5, 6, 1, 5, 5, 10, 16, 8, 3, 19], [14, 5, 0, 15, 13, 18, 16, 9, 20, 11, 12, 8], [4, 17, 0, 14, 2, 10, 1, 17, 8, 4, 7, 15], [11, 19, 9, 11, 18, 20, 19, 4, 9, 12, 13, 20], [2, 0, 19, 6, 10, 5, 7, 7, 20, 14, 12, 18], [13, 1, 12, 18, 13, 1, 5, 14, 2, 8, 5, 14], [16, 15, 17, 19, 0, 1, 15, 10, 9, 14, 1, 13], [6, 17, 20, 2, 4, 0, 12, 13, 10, 0, 6, 0], [0, 16, 19, 3, 6, 3, 19, 20, 6, 9, 8, 5]]]) == 167\nassert my_solution.matrixSum(**[[[12, 20, 2, 0, 8, 14, 3, 8, 4, 20, 16, 20, 20, 11, 3, 4], [8, 0, 1, 1, 6, 8, 17, 10, 11, 18, 1, 19, 20, 15, 20, 14], [20, 13, 11, 17, 5, 6, 12, 18, 9, 0, 4, 4, 8, 10, 10, 11], [2, 10, 19, 1, 1, 8, 5, 4, 18, 9, 11, 12, 17, 4, 9, 3]]]) == 184\nassert my_solution.matrixSum(**[[[1, 9, 5, 16, 2, 9, 12, 10], [9, 13, 3, 3, 17, 15, 15, 10], [10, 3, 15, 3, 15, 13, 1, 9], [10, 4, 5, 20, 18, 12, 20, 2], [2, 2, 6, 7, 1, 12, 0, 3], [12, 17, 16, 9, 14, 15, 18, 6], [13, 2, 11, 7, 8, 18, 5, 13], [6, 11, 3, 2, 0, 16, 14, 6], [3, 15, 12, 8, 6, 20, 1, 6], [19, 4, 3, 6, 14, 12, 11, 17], [4, 3, 19, 15, 4, 18, 12, 20], [13, 16, 15, 10, 15, 15, 20, 6], [17, 19, 7, 0, 10, 10, 10, 1], [16, 4, 8, 19, 4, 12, 18, 9], [15, 2, 2, 16, 1, 2, 7, 4], [1, 9, 0, 14, 10, 5, 4, 20]]]) == 117\nassert my_solution.matrixSum(**[[[16, 12, 16, 16, 1, 18, 2, 16, 19, 2, 13, 6], [9, 17, 19, 13, 15, 12, 19, 18, 7, 0, 0, 5], [9, 16, 18, 8, 10, 2, 15, 8, 9, 13, 12, 12], [1, 5, 20, 4, 7, 9, 10, 1, 1, 15, 13, 4], [15, 19, 2, 4, 11, 13, 1, 19, 14, 12, 14, 1], [3, 15, 4, 0, 1, 19, 19, 4, 20, 10, 3, 17], [20, 11, 6, 12, 15, 3, 1, 19, 14, 19, 20, 10], [20, 3, 19, 9, 4, 12, 9, 3, 16, 6, 1, 12], [14, 11, 6, 14, 11, 20, 2, 1, 1, 15, 8, 0], [16, 18, 18, 6, 7, 2, 20, 16, 16, 13, 16, 9], [3, 4, 13, 18, 13, 2, 3, 13, 2, 3, 13, 4], [0, 14, 13, 13, 0, 15, 10, 8, 2, 11, 2, 3], [11, 0, 11, 11, 5, 0, 7, 11, 2, 19, 4, 6], [0, 6, 3, 0, 9, 11, 0, 19, 7, 4, 5, 14], [3, 15, 11, 8, 4, 0, 6, 11, 10, 15, 9, 9]]]) == 167\nassert my_solution.matrixSum(**[[[5, 18, 2, 3, 17, 18, 9, 5, 12, 4, 4], [7, 10, 16, 7, 7, 5, 9, 11, 13, 1, 4], [19, 0, 12, 2, 2, 4, 13, 9, 17, 13, 4], [18, 13, 9, 20, 11, 2, 7, 14, 20, 11, 20], [16, 1, 12, 13, 0, 13, 10, 14, 6, 11, 9], [15, 2, 5, 3, 8, 3, 17, 19, 4, 14, 12], [5, 13, 13, 5, 7, 14, 10, 16, 4, 11, 14], [20, 20, 2, 15, 6, 9, 0, 14, 19, 14, 0], [6, 9, 3, 20, 9, 17, 19, 4, 13, 15, 2], [15, 7, 17, 12, 8, 20, 0, 3, 8, 1, 0], [8, 12, 16, 18, 12, 14, 3, 8, 11, 9, 6], [19, 2, 1, 2, 8, 9, 17, 10, 3, 16, 7], [5, 2, 13, 9, 9, 16, 4, 18, 16, 20, 6], [17, 3, 13, 20, 17, 12, 8, 9, 14, 11, 18], [20, 4, 5, 3, 3, 12, 12, 18, 14, 4, 17], [9, 11, 20, 15, 13, 6, 15, 15, 16, 10, 15], [20, 1, 14, 9, 4, 15, 1, 19, 6, 0, 11], [15, 12, 0, 16, 2, 2, 12, 0, 11, 1, 3]]]) == 157\nassert my_solution.matrixSum(**[[[8], [20], [9], [7], [4], [18], [9], [6], [3], [13], [14], [10], [12], [5], [10], [13], [20], [13], [4], [14]]]) == 20\nassert my_solution.matrixSum(**[[[10, 4, 6, 5, 14, 11, 12, 13, 15, 12, 7, 6, 14, 6, 18, 1, 12], [1, 7, 20, 2, 5, 11, 1, 20, 5, 7, 19, 9, 19, 2, 16, 9, 11], [13, 14, 1, 20, 16, 20, 17, 13, 18, 14, 15, 8, 15, 6, 10, 8, 1], [1, 1, 5, 11, 0, 9, 20, 0, 4, 2, 13, 7, 19, 12, 17, 7, 14], [6, 10, 19, 3, 19, 2, 10, 10, 17, 14, 10, 8, 0, 16, 1, 6, 11]]]) == 215\nassert my_solution.matrixSum(**[[[16, 11, 6, 6, 8, 9, 9], [16, 12, 8, 15, 11, 7, 1], [9, 17, 2, 0, 14, 15, 14]]]) == 82\nassert my_solution.matrixSum(**[[[15, 14, 14, 3, 2, 2, 7, 3, 4, 13, 6, 14, 19, 2], [13, 17, 12, 1, 5, 7, 15, 7, 4, 8, 11, 10, 13, 3]]]) == 135\nassert my_solution.matrixSum(**[[[19, 17, 6, 9, 14, 16, 19, 14, 17, 20], [8, 8, 7, 0, 3, 19, 3, 5, 13, 7], [6, 9, 0, 17, 16, 13, 1, 3, 12, 20], [8, 3, 18, 11, 7, 17, 9, 7, 7, 2], [16, 9, 10, 7, 11, 20, 15, 9, 18, 5], [4, 0, 17, 16, 10, 11, 18, 20, 0, 4], [12, 4, 5, 16, 2, 4, 6, 15, 18, 6], [7, 4, 7, 12, 11, 19, 18, 4, 20, 15], [3, 19, 0, 16, 19, 11, 15, 14, 9, 0], [7, 17, 20, 5, 15, 15, 17, 10, 2, 8], [4, 19, 12, 6, 10, 9, 12, 1, 6, 1], [10, 7, 10, 14, 7, 8, 11, 5, 9, 0], [11, 18, 17, 1, 20, 4, 11, 0, 15, 20], [1, 0, 7, 1, 0, 7, 20, 10, 2, 1], [11, 13, 4, 6, 14, 13, 4, 11, 9, 5], [20, 10, 13, 12, 0, 13, 8, 17, 17, 14], [1, 18, 3, 13, 12, 5, 0, 16, 4, 19], [16, 4, 2, 10, 7, 5, 7, 0, 5, 17]]]) == 152\nassert my_solution.matrixSum(**[[[13, 19, 3], [19, 20, 14], [4, 19, 19], [1, 8, 10], [12, 0, 20], [1, 15, 2]]]) == 53\nassert my_solution.matrixSum(**[[[4, 14, 7, 16, 11, 5, 12, 10, 8, 15], [12, 0, 9, 16, 9, 17, 15, 1, 17, 18], [17, 8, 1, 14, 12, 3, 12, 11, 15, 1], [0, 8, 1, 8, 18, 9, 6, 16, 16, 10], [12, 8, 6, 3, 18, 10, 7, 18, 17, 11], [5, 4, 10, 0, 18, 1, 18, 4, 11, 11], [9, 20, 9, 10, 15, 12, 19, 13, 5, 0], [4, 18, 1, 14, 4, 10, 0, 15, 8, 19], [6, 2, 17, 13, 8, 5, 16, 5, 2, 20], [5, 18, 3, 16, 20, 17, 19, 12, 13, 8], [9, 9, 0, 13, 8, 8, 17, 16, 17, 10], [10, 6, 13, 4, 0, 16, 4, 18, 12, 11]]]) == 136\nassert my_solution.matrixSum(**[[[17, 13], [20, 19], [7, 0], [11, 16], [5, 6], [20, 11], [20, 15], [0, 7], [18, 7], [8, 5], [13, 2], [18, 14], [7, 14], [16, 3], [6, 5]]]) == 39\nassert my_solution.matrixSum(**[[[13, 20, 12], [8, 8, 13], [11, 19, 10], [2, 9, 0], [15, 0, 8], [6, 12, 12], [13, 20, 20], [12, 1, 18], [14, 11, 18], [4, 18, 8], [10, 0, 12], [15, 16, 4], [1, 2, 18], [11, 11, 0], [2, 6, 3]]]) == 53\nassert my_solution.matrixSum(**[[[1, 10, 0, 10, 12, 4, 20, 8, 13, 4, 19, 4, 12, 9, 16, 1], [5, 4, 4, 15, 20, 1, 16, 1, 17, 20, 12, 5, 11, 18, 2, 2], [17, 5, 8, 6, 8, 10, 8, 8, 16, 14, 4, 14, 17, 4, 1, 20], [18, 5, 20, 16, 1, 10, 2, 6, 20, 14, 19, 7, 14, 16, 5, 10], [20, 4, 15, 17, 1, 17, 2, 16, 10, 0, 2, 3, 13, 19, 11, 18], [14, 10, 12, 16, 11, 20, 3, 4, 10, 0, 5, 4, 0, 10, 19, 6], [1, 13, 20, 1, 9, 12, 1, 19, 5, 11, 2, 13, 1, 14, 11, 19], [19, 8, 9, 18, 14, 13, 5, 0, 14, 8, 6, 12, 2, 11, 3, 3], [0, 11, 0, 5, 12, 19, 20, 0, 10, 14, 17, 15, 15, 2, 1, 17], [12, 8, 0, 20, 16, 3, 2, 10, 11, 3, 15, 1, 4, 16, 20, 9], [1, 0, 12, 10, 5, 17, 4, 5, 5, 5, 20, 7, 19, 10, 0, 15], [20, 12, 1, 7, 7, 20, 9, 10, 5, 7, 11, 7, 5, 13, 14, 11], [18, 4, 12, 18, 0, 5, 18, 0, 12, 5, 4, 0, 0, 10, 16, 0], [1, 1, 3, 18, 19, 4, 4, 12, 0, 13, 13, 18, 10, 7, 4, 11], [16, 6, 17, 12, 2, 4, 13, 18, 11, 3, 13, 13, 7, 15, 12, 7], [12, 7, 20, 15, 12, 18, 2, 8, 8, 16, 11, 17, 0, 19, 19, 15], [7, 8, 1, 19, 10, 12, 20, 3, 17, 1, 4, 12, 0, 13, 12, 13], [3, 14, 19, 14, 5, 5, 10, 15, 13, 5, 18, 9, 16, 3, 11, 11]]]) == 206\nassert my_solution.matrixSum(**[[[15, 20, 16, 1, 6, 8, 5, 18, 10, 9, 12, 20], [1, 9, 17, 13, 1, 13, 8, 12, 6, 11, 4, 4], [3, 19, 11, 5, 0, 13, 18, 12, 14, 2, 20, 2], [13, 17, 17, 4, 5, 4, 6, 5, 7, 0, 16, 4], [15, 11, 19, 9, 10, 3, 13, 8, 5, 10, 20, 16]]]) == 147\nassert my_solution.matrixSum(**[[[4, 12, 17, 9, 7, 12, 11, 12, 15, 16, 9, 13, 13, 3, 4, 4, 0, 18], [19, 20, 16, 3, 20, 6, 19, 20, 19, 16, 3, 8, 19, 5, 12, 2, 1, 0], [3, 11, 15, 10, 3, 14, 11, 18, 8, 15, 7, 5, 17, 17, 2, 16, 5, 0], [20, 5, 16, 13, 19, 6, 14, 12, 8, 0, 18, 4, 12, 5, 14, 18, 1, 12], [2, 20, 18, 12, 10, 7, 16, 14, 1, 15, 19, 3, 8, 16, 15, 17, 20, 12], [15, 8, 5, 7, 17, 11, 5, 9, 19, 4, 14, 2, 2, 15, 12, 18, 13, 17], [2, 8, 15, 7, 3, 9, 4, 11, 3, 4, 1, 4, 18, 17, 6, 0, 1, 12], [17, 19, 15, 3, 15, 17, 11, 10, 3, 0, 7, 7, 15, 9, 8, 7, 0, 15], [11, 16, 10, 2, 2, 9, 18, 13, 7, 11, 12, 4, 7, 9, 6, 15, 11, 9], [12, 19, 4, 3, 12, 11, 16, 15, 7, 20, 11, 20, 11, 13, 8, 11, 12, 9], [3, 15, 9, 3, 14, 4, 11, 7, 5, 10, 15, 7, 3, 12, 12, 14, 16, 14]]]) == 248\n"}, "labels": {"questionId": "2728", "questionFrontendId": "2679", "questionTitle": "Sum in a Matrix", "stats": {"totalAccepted": "26K", "totalSubmission": "33.3K", "totalAcceptedRaw": 25981, "totalSubmissionRaw": 33306, "acRate": "78.0%"}, "probedCases": [{"inputs": [[[7, 2, 1], [6, 4, 2], [6, 5, 3], [3, 2, 1]]], "output": 15}, {"inputs": [[[1]]], "output": 1}, {"inputs": [[[1, 8, 16, 15, 12, 9, 15, 11, 18, 6, 16, 4, 9, 4], [3, 19, 8, 17, 19, 4, 9, 3, 2, 10, 15, 17, 3, 11], [13, 10, 19, 20, 6, 17, 15, 14, 16, 8, 1, 17, 0, 2], [12, 20, 0, 19, 15, 10, 7, 10, 2, 6, 18, 7, 7, 4], [17, 14, 2, 2, 10, 16, 15, 3, 9, 17, 9, 3, 17, 10], [17, 6, 19, 17, 18, 9, 14, 2, 19, 12, 10, 18, 7, 9], [5, 6, 5, 1, 19, 8, 15, 2, 2, 4, 4, 1, 2, 17], [12, 16, 8, 16, 7, 6, 18, 13, 18, 8, 14, 15, 20, 11], [2, 10, 19, 3, 15, 18, 20, 10, 6, 7, 0, 8, 3, 7], [11, 5, 10, 13, 1, 3, 4, 7, 1, 18, 20, 17, 19, 2], [0, 3, 20, 6, 19, 18, 3, 12, 2, 11, 3, 1, 19, 0], [6, 5, 3, 15, 6, 1, 0, 17, 13, 19, 3, 8, 2, 7], [2, 20, 9, 11, 13, 5, 1, 16, 14, 1, 19, 3, 12, 6]]], "output": 190}, {"inputs": [[[15, 18, 5, 6, 1, 5, 5, 10, 16, 8, 3, 19], [14, 5, 0, 15, 13, 18, 16, 9, 20, 11, 12, 8], [4, 17, 0, 14, 2, 10, 1, 17, 8, 4, 7, 15], [11, 19, 9, 11, 18, 20, 19, 4, 9, 12, 13, 20], [2, 0, 19, 6, 10, 5, 7, 7, 20, 14, 12, 18], [13, 1, 12, 18, 13, 1, 5, 14, 2, 8, 5, 14], [16, 15, 17, 19, 0, 1, 15, 10, 9, 14, 1, 13], [6, 17, 20, 2, 4, 0, 12, 13, 10, 0, 6, 0], [0, 16, 19, 3, 6, 3, 19, 20, 6, 9, 8, 5]]], "output": 167}, {"inputs": [[[12, 20, 2, 0, 8, 14, 3, 8, 4, 20, 16, 20, 20, 11, 3, 4], [8, 0, 1, 1, 6, 8, 17, 10, 11, 18, 1, 19, 20, 15, 20, 14], [20, 13, 11, 17, 5, 6, 12, 18, 9, 0, 4, 4, 8, 10, 10, 11], [2, 10, 19, 1, 1, 8, 5, 4, 18, 9, 11, 12, 17, 4, 9, 3]]], "output": 184}, {"inputs": [[[1, 9, 5, 16, 2, 9, 12, 10], [9, 13, 3, 3, 17, 15, 15, 10], [10, 3, 15, 3, 15, 13, 1, 9], [10, 4, 5, 20, 18, 12, 20, 2], [2, 2, 6, 7, 1, 12, 0, 3], [12, 17, 16, 9, 14, 15, 18, 6], [13, 2, 11, 7, 8, 18, 5, 13], [6, 11, 3, 2, 0, 16, 14, 6], [3, 15, 12, 8, 6, 20, 1, 6], [19, 4, 3, 6, 14, 12, 11, 17], [4, 3, 19, 15, 4, 18, 12, 20], [13, 16, 15, 10, 15, 15, 20, 6], [17, 19, 7, 0, 10, 10, 10, 1], [16, 4, 8, 19, 4, 12, 18, 9], [15, 2, 2, 16, 1, 2, 7, 4], [1, 9, 0, 14, 10, 5, 4, 20]]], "output": 117}, {"inputs": [[[16, 12, 16, 16, 1, 18, 2, 16, 19, 2, 13, 6], [9, 17, 19, 13, 15, 12, 19, 18, 7, 0, 0, 5], [9, 16, 18, 8, 10, 2, 15, 8, 9, 13, 12, 12], [1, 5, 20, 4, 7, 9, 10, 1, 1, 15, 13, 4], [15, 19, 2, 4, 11, 13, 1, 19, 14, 12, 14, 1], [3, 15, 4, 0, 1, 19, 19, 4, 20, 10, 3, 17], [20, 11, 6, 12, 15, 3, 1, 19, 14, 19, 20, 10], [20, 3, 19, 9, 4, 12, 9, 3, 16, 6, 1, 12], [14, 11, 6, 14, 11, 20, 2, 1, 1, 15, 8, 0], [16, 18, 18, 6, 7, 2, 20, 16, 16, 13, 16, 9], [3, 4, 13, 18, 13, 2, 3, 13, 2, 3, 13, 4], [0, 14, 13, 13, 0, 15, 10, 8, 2, 11, 2, 3], [11, 0, 11, 11, 5, 0, 7, 11, 2, 19, 4, 6], [0, 6, 3, 0, 9, 11, 0, 19, 7, 4, 5, 14], [3, 15, 11, 8, 4, 0, 6, 11, 10, 15, 9, 9]]], "output": 167}, {"inputs": [[[5, 18, 2, 3, 17, 18, 9, 5, 12, 4, 4], [7, 10, 16, 7, 7, 5, 9, 11, 13, 1, 4], [19, 0, 12, 2, 2, 4, 13, 9, 17, 13, 4], [18, 13, 9, 20, 11, 2, 7, 14, 20, 11, 20], [16, 1, 12, 13, 0, 13, 10, 14, 6, 11, 9], [15, 2, 5, 3, 8, 3, 17, 19, 4, 14, 12], [5, 13, 13, 5, 7, 14, 10, 16, 4, 11, 14], [20, 20, 2, 15, 6, 9, 0, 14, 19, 14, 0], [6, 9, 3, 20, 9, 17, 19, 4, 13, 15, 2], [15, 7, 17, 12, 8, 20, 0, 3, 8, 1, 0], [8, 12, 16, 18, 12, 14, 3, 8, 11, 9, 6], [19, 2, 1, 2, 8, 9, 17, 10, 3, 16, 7], [5, 2, 13, 9, 9, 16, 4, 18, 16, 20, 6], [17, 3, 13, 20, 17, 12, 8, 9, 14, 11, 18], [20, 4, 5, 3, 3, 12, 12, 18, 14, 4, 17], [9, 11, 20, 15, 13, 6, 15, 15, 16, 10, 15], [20, 1, 14, 9, 4, 15, 1, 19, 6, 0, 11], [15, 12, 0, 16, 2, 2, 12, 0, 11, 1, 3]]], "output": 157}, {"inputs": [[[8], [20], [9], [7], [4], [18], [9], [6], [3], [13], [14], [10], [12], [5], [10], [13], [20], [13], [4], [14]]], "output": 20}, {"inputs": [[[10, 4, 6, 5, 14, 11, 12, 13, 15, 12, 7, 6, 14, 6, 18, 1, 12], [1, 7, 20, 2, 5, 11, 1, 20, 5, 7, 19, 9, 19, 2, 16, 9, 11], [13, 14, 1, 20, 16, 20, 17, 13, 18, 14, 15, 8, 15, 6, 10, 8, 1], [1, 1, 5, 11, 0, 9, 20, 0, 4, 2, 13, 7, 19, 12, 17, 7, 14], [6, 10, 19, 3, 19, 2, 10, 10, 17, 14, 10, 8, 0, 16, 1, 6, 11]]], "output": 215}, {"inputs": [[[16, 11, 6, 6, 8, 9, 9], [16, 12, 8, 15, 11, 7, 1], [9, 17, 2, 0, 14, 15, 14]]], "output": 82}, {"inputs": [[[15, 14, 14, 3, 2, 2, 7, 3, 4, 13, 6, 14, 19, 2], [13, 17, 12, 1, 5, 7, 15, 7, 4, 8, 11, 10, 13, 3]]], "output": 135}, {"inputs": [[[19, 17, 6, 9, 14, 16, 19, 14, 17, 20], [8, 8, 7, 0, 3, 19, 3, 5, 13, 7], [6, 9, 0, 17, 16, 13, 1, 3, 12, 20], [8, 3, 18, 11, 7, 17, 9, 7, 7, 2], [16, 9, 10, 7, 11, 20, 15, 9, 18, 5], [4, 0, 17, 16, 10, 11, 18, 20, 0, 4], [12, 4, 5, 16, 2, 4, 6, 15, 18, 6], [7, 4, 7, 12, 11, 19, 18, 4, 20, 15], [3, 19, 0, 16, 19, 11, 15, 14, 9, 0], [7, 17, 20, 5, 15, 15, 17, 10, 2, 8], [4, 19, 12, 6, 10, 9, 12, 1, 6, 1], [10, 7, 10, 14, 7, 8, 11, 5, 9, 0], [11, 18, 17, 1, 20, 4, 11, 0, 15, 20], [1, 0, 7, 1, 0, 7, 20, 10, 2, 1], [11, 13, 4, 6, 14, 13, 4, 11, 9, 5], [20, 10, 13, 12, 0, 13, 8, 17, 17, 14], [1, 18, 3, 13, 12, 5, 0, 16, 4, 19], [16, 4, 2, 10, 7, 5, 7, 0, 5, 17]]], "output": 152}, {"inputs": [[[13, 19, 3], [19, 20, 14], [4, 19, 19], [1, 8, 10], [12, 0, 20], [1, 15, 2]]], "output": 53}, {"inputs": [[[4, 14, 7, 16, 11, 5, 12, 10, 8, 15], [12, 0, 9, 16, 9, 17, 15, 1, 17, 18], [17, 8, 1, 14, 12, 3, 12, 11, 15, 1], [0, 8, 1, 8, 18, 9, 6, 16, 16, 10], [12, 8, 6, 3, 18, 10, 7, 18, 17, 11], [5, 4, 10, 0, 18, 1, 18, 4, 11, 11], [9, 20, 9, 10, 15, 12, 19, 13, 5, 0], [4, 18, 1, 14, 4, 10, 0, 15, 8, 19], [6, 2, 17, 13, 8, 5, 16, 5, 2, 20], [5, 18, 3, 16, 20, 17, 19, 12, 13, 8], [9, 9, 0, 13, 8, 8, 17, 16, 17, 10], [10, 6, 13, 4, 0, 16, 4, 18, 12, 11]]], "output": 136}, {"inputs": [[[17, 13], [20, 19], [7, 0], [11, 16], [5, 6], [20, 11], [20, 15], [0, 7], [18, 7], [8, 5], [13, 2], [18, 14], [7, 14], [16, 3], [6, 5]]], "output": 39}, {"inputs": [[[13, 20, 12], [8, 8, 13], [11, 19, 10], [2, 9, 0], [15, 0, 8], [6, 12, 12], [13, 20, 20], [12, 1, 18], [14, 11, 18], [4, 18, 8], [10, 0, 12], [15, 16, 4], [1, 2, 18], [11, 11, 0], [2, 6, 3]]], "output": 53}, {"inputs": [[[1, 10, 0, 10, 12, 4, 20, 8, 13, 4, 19, 4, 12, 9, 16, 1], [5, 4, 4, 15, 20, 1, 16, 1, 17, 20, 12, 5, 11, 18, 2, 2], [17, 5, 8, 6, 8, 10, 8, 8, 16, 14, 4, 14, 17, 4, 1, 20], [18, 5, 20, 16, 1, 10, 2, 6, 20, 14, 19, 7, 14, 16, 5, 10], [20, 4, 15, 17, 1, 17, 2, 16, 10, 0, 2, 3, 13, 19, 11, 18], [14, 10, 12, 16, 11, 20, 3, 4, 10, 0, 5, 4, 0, 10, 19, 6], [1, 13, 20, 1, 9, 12, 1, 19, 5, 11, 2, 13, 1, 14, 11, 19], [19, 8, 9, 18, 14, 13, 5, 0, 14, 8, 6, 12, 2, 11, 3, 3], [0, 11, 0, 5, 12, 19, 20, 0, 10, 14, 17, 15, 15, 2, 1, 17], [12, 8, 0, 20, 16, 3, 2, 10, 11, 3, 15, 1, 4, 16, 20, 9], [1, 0, 12, 10, 5, 17, 4, 5, 5, 5, 20, 7, 19, 10, 0, 15], [20, 12, 1, 7, 7, 20, 9, 10, 5, 7, 11, 7, 5, 13, 14, 11], [18, 4, 12, 18, 0, 5, 18, 0, 12, 5, 4, 0, 0, 10, 16, 0], [1, 1, 3, 18, 19, 4, 4, 12, 0, 13, 13, 18, 10, 7, 4, 11], [16, 6, 17, 12, 2, 4, 13, 18, 11, 3, 13, 13, 7, 15, 12, 7], [12, 7, 20, 15, 12, 18, 2, 8, 8, 16, 11, 17, 0, 19, 19, 15], [7, 8, 1, 19, 10, 12, 20, 3, 17, 1, 4, 12, 0, 13, 12, 13], [3, 14, 19, 14, 5, 5, 10, 15, 13, 5, 18, 9, 16, 3, 11, 11]]], "output": 206}, {"inputs": [[[15, 20, 16, 1, 6, 8, 5, 18, 10, 9, 12, 20], [1, 9, 17, 13, 1, 13, 8, 12, 6, 11, 4, 4], [3, 19, 11, 5, 0, 13, 18, 12, 14, 2, 20, 2], [13, 17, 17, 4, 5, 4, 6, 5, 7, 0, 16, 4], [15, 11, 19, 9, 10, 3, 13, 8, 5, 10, 20, 16]]], "output": 147}, {"inputs": [[[4, 12, 17, 9, 7, 12, 11, 12, 15, 16, 9, 13, 13, 3, 4, 4, 0, 18], [19, 20, 16, 3, 20, 6, 19, 20, 19, 16, 3, 8, 19, 5, 12, 2, 1, 0], [3, 11, 15, 10, 3, 14, 11, 18, 8, 15, 7, 5, 17, 17, 2, 16, 5, 0], [20, 5, 16, 13, 19, 6, 14, 12, 8, 0, 18, 4, 12, 5, 14, 18, 1, 12], [2, 20, 18, 12, 10, 7, 16, 14, 1, 15, 19, 3, 8, 16, 15, 17, 20, 12], [15, 8, 5, 7, 17, 11, 5, 9, 19, 4, 14, 2, 2, 15, 12, 18, 13, 17], [2, 8, 15, 7, 3, 9, 4, 11, 3, 4, 1, 4, 18, 17, 6, 0, 1, 12], [17, 19, 15, 3, 15, 17, 11, 10, 3, 0, 7, 7, 15, 9, 8, 7, 0, 15], [11, 16, 10, 2, 2, 9, 18, 13, 7, 11, 12, 4, 7, 9, 6, 15, 11, 9], [12, 19, 4, 3, 12, 11, 16, 15, 7, 20, 11, 20, 11, 13, 8, 11, 12, 9], [3, 15, 9, 3, 14, 4, 11, 7, 5, 10, 15, 7, 3, 12, 12, 14, 16, 14]]], "output": 248}]}} +{"id": "LeetCode/2730", "content": "# Maximum OR\n\nYou are given a **0-indexed** integer array `nums` of length `n` and an integer `k`. In an operation, you can choose an element and multiply it by `2`.\n\n\nReturn *the maximum possible value of* `nums[0] | nums[1] | ... | nums[n - 1]` *that can be obtained after applying the operation on nums at most* `k` *times*.\n\n\nNote that `a | b` denotes the **bitwise or** between two integers `a` and `b`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [12,9], k = 1\n**Output:** 30\n**Explanation:** If we apply the operation to index 1, our new array nums will be equal to [12,18]. Thus, we return the bitwise or of 12 and 18, which is 30.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [8,1,2], k = 2\n**Output:** 35\n**Explanation:** If we apply the operation twice on index 0, we yield a new array of [32,1,2]. Thus, we return 32|1|2 = 35.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n* `1 <= k <= 15`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumOr(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumOr(**[[12, 9], 1]) == 30\nassert my_solution.maximumOr(**[[8, 1, 2], 2]) == 35\nassert my_solution.maximumOr(**[[98, 54, 6, 34, 66, 63, 52, 39, 62, 46, 75, 28, 65, 18, 37, 18, 97, 13, 80, 33, 69, 91, 78, 19, 40], 2]) == 511\nassert my_solution.maximumOr(**[[88, 43, 61, 72, 13], 6]) == 5759\nassert my_solution.maximumOr(**[[41, 79, 82, 27, 71, 62, 57, 67, 34, 8, 71, 2, 12, 93, 52, 91, 86, 81, 1, 79, 64, 43, 32, 94, 42, 91, 9, 25], 10]) == 96383\nassert my_solution.maximumOr(**[[31, 19, 70, 58, 12, 11, 41, 66, 63, 14, 39, 71, 38, 91, 16], 9]) == 46719\nassert my_solution.maximumOr(**[[70, 27, 78, 71, 76, 37, 57, 12, 77, 50, 41, 74, 31, 38, 24, 25, 24, 5, 79, 85, 34, 61], 2]) == 383\nassert my_solution.maximumOr(**[[87, 97, 17, 20, 5, 11], 9]) == 49759\nassert my_solution.maximumOr(**[[91, 68, 36, 67, 31, 28, 87, 76, 54, 75, 36, 58, 64, 85, 83, 90, 46, 11, 42, 79, 15, 63, 76, 81, 43, 25], 4]) == 1535\nassert my_solution.maximumOr(**[[94, 35], 2]) == 379\nassert my_solution.maximumOr(**[[48, 22, 43, 55, 8, 13, 19, 90, 29, 6, 74, 82, 69, 78, 88], 2]) == 383\nassert my_solution.maximumOr(**[[16, 82], 4]) == 1328\nassert my_solution.maximumOr(**[[74, 16, 51, 12, 48, 15, 5, 78, 3, 25, 24, 92, 16, 62, 27, 94, 8, 87, 3, 70, 55, 80, 13, 34, 9, 29, 10, 83, 39, 45, 56, 24, 8, 65, 60, 6, 77, 13, 90], 7]) == 12159\nassert my_solution.maximumOr(**[[34, 46, 94, 61, 73, 22, 90, 87, 27, 99, 8, 87, 21], 3]) == 895\nassert my_solution.maximumOr(**[[68, 33, 16, 77, 57, 86, 23, 2, 61, 88, 53, 73, 66, 40, 84, 46, 50, 85, 33, 20, 72, 89], 1]) == 255\nassert my_solution.maximumOr(**[[95, 11, 43, 95, 6, 70, 36, 18, 31, 98, 62, 46, 79, 37, 87, 46, 76, 82, 80, 17, 92, 40, 50, 96, 54, 84, 11, 1, 77, 25], 6]) == 6399\nassert my_solution.maximumOr(**[[31, 29, 82, 58, 49, 91, 87, 73, 54, 5, 52], 10]) == 93311\nassert my_solution.maximumOr(**[[99, 85, 91, 6, 22, 58, 9, 34, 90, 21, 58, 68, 63, 72, 78, 97, 1, 5, 64, 42, 40, 60, 7, 54, 25, 71, 82], 2]) == 511\nassert my_solution.maximumOr(**[[2, 52, 87, 54, 41, 1, 28, 2, 92], 1]) == 255\nassert my_solution.maximumOr(**[[79, 13, 25, 16, 78, 84, 26, 39, 36, 89, 24, 13, 61, 51, 81, 11, 3, 36, 58, 15, 33, 18, 84, 67, 84, 83, 45, 15, 20, 36, 3, 6, 6, 27], 5]) == 2943\n"}, "labels": {"questionId": "2730", "questionFrontendId": "2680", "questionTitle": "Maximum OR", "stats": {"totalAccepted": "3.5K", "totalSubmission": "8K", "totalAcceptedRaw": 3508, "totalSubmissionRaw": 8048, "acRate": "43.6%"}, "probedCases": [{"inputs": [[12, 9], 1], "output": 30}, {"inputs": [[8, 1, 2], 2], "output": 35}, {"inputs": [[98, 54, 6, 34, 66, 63, 52, 39, 62, 46, 75, 28, 65, 18, 37, 18, 97, 13, 80, 33, 69, 91, 78, 19, 40], 2], "output": 511}, {"inputs": [[88, 43, 61, 72, 13], 6], "output": 5759}, {"inputs": [[41, 79, 82, 27, 71, 62, 57, 67, 34, 8, 71, 2, 12, 93, 52, 91, 86, 81, 1, 79, 64, 43, 32, 94, 42, 91, 9, 25], 10], "output": 96383}, {"inputs": [[31, 19, 70, 58, 12, 11, 41, 66, 63, 14, 39, 71, 38, 91, 16], 9], "output": 46719}, {"inputs": [[70, 27, 78, 71, 76, 37, 57, 12, 77, 50, 41, 74, 31, 38, 24, 25, 24, 5, 79, 85, 34, 61], 2], "output": 383}, {"inputs": [[87, 97, 17, 20, 5, 11], 9], "output": 49759}, {"inputs": [[91, 68, 36, 67, 31, 28, 87, 76, 54, 75, 36, 58, 64, 85, 83, 90, 46, 11, 42, 79, 15, 63, 76, 81, 43, 25], 4], "output": 1535}, {"inputs": [[94, 35], 2], "output": 379}, {"inputs": [[48, 22, 43, 55, 8, 13, 19, 90, 29, 6, 74, 82, 69, 78, 88], 2], "output": 383}, {"inputs": [[16, 82], 4], "output": 1328}, {"inputs": [[74, 16, 51, 12, 48, 15, 5, 78, 3, 25, 24, 92, 16, 62, 27, 94, 8, 87, 3, 70, 55, 80, 13, 34, 9, 29, 10, 83, 39, 45, 56, 24, 8, 65, 60, 6, 77, 13, 90], 7], "output": 12159}, {"inputs": [[34, 46, 94, 61, 73, 22, 90, 87, 27, 99, 8, 87, 21], 3], "output": 895}, {"inputs": [[68, 33, 16, 77, 57, 86, 23, 2, 61, 88, 53, 73, 66, 40, 84, 46, 50, 85, 33, 20, 72, 89], 1], "output": 255}, {"inputs": [[95, 11, 43, 95, 6, 70, 36, 18, 31, 98, 62, 46, 79, 37, 87, 46, 76, 82, 80, 17, 92, 40, 50, 96, 54, 84, 11, 1, 77, 25], 6], "output": 6399}, {"inputs": [[31, 29, 82, 58, 49, 91, 87, 73, 54, 5, 52], 10], "output": 93311}, {"inputs": [[99, 85, 91, 6, 22, 58, 9, 34, 90, 21, 58, 68, 63, 72, 78, 97, 1, 5, 64, 42, 40, 60, 7, 54, 25, 71, 82], 2], "output": 511}, {"inputs": [[2, 52, 87, 54, 41, 1, 28, 2, 92], 1], "output": 255}, {"inputs": [[79, 13, 25, 16, 78, 84, 26, 39, 36, 89, 24, 13, 61, 51, 81, 11, 3, 36, 58, 15, 33, 18, 84, 67, 84, 83, 45, 15, 20, 36, 3, 6, 6, 27], 5], "output": 2943}]}} +{"id": "LeetCode/2784", "content": "# Power of Heroes\n\nYou are given a **0-indexed** integer array `nums` representing the strength of some heroes. The **power** of a group of heroes is defined as follows:\n\n\n* Let `i0`, `i1`, ... ,`ik` be the indices of the heroes in a group. Then, the power of this group is `max(nums[i0], nums[i1], ... ,nums[ik])2 * min(nums[i0], nums[i1], ... ,nums[ik])`.\n\n\nReturn *the sum of the **power** of all **non-empty** groups of heroes possible.* Since the sum could be very large, return it **modulo** `109 + 7`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,1,4]\n**Output:** 141\n**Explanation:** \n1st group: [2] has power = 22 * 2 = 8.\n2nd group: [1] has power = 12 * 1 = 1. \n3rd group: [4] has power = 42 * 4 = 64. \n4th group: [2,1] has power = 22 * 1 = 4. \n5th group: [2,4] has power = 42 * 2 = 32. \n6th group: [1,4] has power = 42 * 1 = 16. \n​​​​​​​7th group: [2,1,4] has power = 42​​​​​​​ * 1 = 16. \nThe sum of powers of all groups is 8 + 1 + 64 + 4 + 32 + 16 + 16 = 141.\n\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,1,1]\n**Output:** 7\n**Explanation:** A total of 7 groups are possible, and the power of each group will be 1. Therefore, the sum of the powers of all groups is 7.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def sumOfPower(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.sumOfPower(**[[2, 1, 4]]) == 141\nassert my_solution.sumOfPower(**[[1, 1, 1]]) == 7\nassert my_solution.sumOfPower(**[[4, 4]]) == 192\nassert my_solution.sumOfPower(**[[8, 4]]) == 832\nassert my_solution.sumOfPower(**[[5, 3]]) == 227\nassert my_solution.sumOfPower(**[[6, 1, 4]]) == 513\nassert my_solution.sumOfPower(**[[3, 2, 3]]) == 143\nassert my_solution.sumOfPower(**[[7, 4, 9]]) == 2547\nassert my_solution.sumOfPower(**[[4, 6]]) == 424\nassert my_solution.sumOfPower(**[[2, 6]]) == 296\nassert my_solution.sumOfPower(**[[9, 8, 5]]) == 3144\nassert my_solution.sumOfPower(**[[3, 1, 3]]) == 109\nassert my_solution.sumOfPower(**[[8, 3, 9]]) == 2594\nassert my_solution.sumOfPower(**[[8, 2]]) == 648\nassert my_solution.sumOfPower(**[[3, 5]]) == 227\nassert my_solution.sumOfPower(**[[8, 4, 7]]) == 2075\nassert my_solution.sumOfPower(**[[3, 4]]) == 139\nassert my_solution.sumOfPower(**[[8, 7]]) == 1303\nassert my_solution.sumOfPower(**[[6, 6]]) == 648\nassert my_solution.sumOfPower(**[[2, 4, 6]]) == 608\n"}, "labels": {"questionId": "2784", "questionFrontendId": "2681", "questionTitle": "Power of Heroes", "stats": {"totalAccepted": "18.7K", "totalSubmission": "44.8K", "totalAcceptedRaw": 18652, "totalSubmissionRaw": 44844, "acRate": "41.6%"}, "probedCases": [{"inputs": [[2, 1, 4]], "output": 141}, {"inputs": [[1, 1, 1]], "output": 7}, {"inputs": [[4, 4]], "output": 192}, {"inputs": [[8, 4]], "output": 832}, {"inputs": [[5, 3]], "output": 227}, {"inputs": [[6, 1, 4]], "output": 513}, {"inputs": [[3, 2, 3]], "output": 143}, {"inputs": [[7, 4, 9]], "output": 2547}, {"inputs": [[4, 6]], "output": 424}, {"inputs": [[2, 6]], "output": 296}, {"inputs": [[9, 8, 5]], "output": 3144}, {"inputs": [[3, 1, 3]], "output": 109}, {"inputs": [[8, 3, 9]], "output": 2594}, {"inputs": [[8, 2]], "output": 648}, {"inputs": [[3, 5]], "output": 227}, {"inputs": [[8, 4, 7]], "output": 2075}, {"inputs": [[3, 4]], "output": 139}, {"inputs": [[8, 7]], "output": 1303}, {"inputs": [[6, 6]], "output": 648}, {"inputs": [[2, 4, 6]], "output": 608}]}} +{"id": "LeetCode/2777", "content": "# Find the Distinct Difference Array\n\nYou are given a **0-indexed** array `nums` of length `n`.\n\n\nThe **distinct difference** array of `nums` is an array `diff` of length `n` such that `diff[i]` is equal to the number of distinct elements in the suffix `nums[i + 1, ..., n - 1]` **subtracted from** the number of distinct elements in the prefix `nums[0, ..., i]`.\n\n\nReturn *the **distinct difference** array of* `nums`.\n\n\nNote that `nums[i, ..., j]` denotes the subarray of `nums` starting at index `i` and ending at index `j` inclusive. Particularly, if `i > j` then `nums[i, ..., j]` denotes an empty subarray.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4,5]\n**Output:** [-3,-1,1,3,5]\n**Explanation:** For index i = 0, there is 1 element in the prefix and 4 distinct elements in the suffix. Thus, diff[0] = 1 - 4 = -3.\nFor index i = 1, there are 2 distinct elements in the prefix and 3 distinct elements in the suffix. Thus, diff[1] = 2 - 3 = -1.\nFor index i = 2, there are 3 distinct elements in the prefix and 2 distinct elements in the suffix. Thus, diff[2] = 3 - 2 = 1.\nFor index i = 3, there are 4 distinct elements in the prefix and 1 distinct element in the suffix. Thus, diff[3] = 4 - 1 = 3.\nFor index i = 4, there are 5 distinct elements in the prefix and no elements in the suffix. Thus, diff[4] = 5 - 0 = 5.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [3,2,3,4,2]\n**Output:** [-2,-1,0,2,3]\n**Explanation:** For index i = 0, there is 1 element in the prefix and 3 distinct elements in the suffix. Thus, diff[0] = 1 - 3 = -2.\nFor index i = 1, there are 2 distinct elements in the prefix and 3 distinct elements in the suffix. Thus, diff[1] = 2 - 3 = -1.\nFor index i = 2, there are 2 distinct elements in the prefix and 2 distinct elements in the suffix. Thus, diff[2] = 2 - 2 = 0.\nFor index i = 3, there are 3 distinct elements in the prefix and 1 distinct element in the suffix. Thus, diff[3] = 3 - 1 = 2.\nFor index i = 4, there are 3 distinct elements in the prefix and no elements in the suffix. Thus, diff[4] = 3 - 0 = 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == nums.length <= 50`\n* `1 <= nums[i] <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def distinctDifferenceArray(self, nums: List[int]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.distinctDifferenceArray(**[[1, 2, 3, 4, 5]]) == [-3, -1, 1, 3, 5]\nassert my_solution.distinctDifferenceArray(**[[3, 2, 3, 4, 2]]) == [-2, -1, 0, 2, 3]\nassert my_solution.distinctDifferenceArray(**[[16]]) == [1]\nassert my_solution.distinctDifferenceArray(**[[16, 16]]) == [0, 1]\nassert my_solution.distinctDifferenceArray(**[[13, 13, 13]]) == [0, 0, 1]\nassert my_solution.distinctDifferenceArray(**[[36, 36, 36, 36]]) == [0, 0, 0, 1]\nassert my_solution.distinctDifferenceArray(**[[40, 40, 40, 40, 40]]) == [0, 0, 0, 0, 1]\nassert my_solution.distinctDifferenceArray(**[[37, 37, 37, 37, 33]]) == [-1, -1, -1, 0, 2]\nassert my_solution.distinctDifferenceArray(**[[42, 42, 42, 42, 47]]) == [-1, -1, -1, 0, 2]\nassert my_solution.distinctDifferenceArray(**[[9, 9, 9, 9, 31]]) == [-1, -1, -1, 0, 2]\nassert my_solution.distinctDifferenceArray(**[[14, 14, 14, 14, 5]]) == [-1, -1, -1, 0, 2]\nassert my_solution.distinctDifferenceArray(**[[41, 41, 41, 17]]) == [-1, -1, 0, 2]\nassert my_solution.distinctDifferenceArray(**[[9, 9, 9, 30, 9]]) == [-1, -1, -1, 1, 2]\nassert my_solution.distinctDifferenceArray(**[[21, 21, 21, 4, 4]]) == [-1, -1, 0, 1, 2]\nassert my_solution.distinctDifferenceArray(**[[38, 38, 38, 14, 19]]) == [-2, -2, -1, 1, 3]\nassert my_solution.distinctDifferenceArray(**[[11, 11, 11, 7, 13]]) == [-2, -2, -1, 1, 3]\nassert my_solution.distinctDifferenceArray(**[[36, 36, 36, 18, 27]]) == [-2, -2, -1, 1, 3]\nassert my_solution.distinctDifferenceArray(**[[37, 37, 37, 47]]) == [-1, -1, 0, 2]\nassert my_solution.distinctDifferenceArray(**[[13, 13, 13, 34, 13]]) == [-1, -1, -1, 1, 2]\nassert my_solution.distinctDifferenceArray(**[[39, 39, 39, 38, 1]]) == [-2, -2, -1, 1, 3]\n"}, "labels": {"questionId": "2777", "questionFrontendId": "2670", "questionTitle": "Find the Distinct Difference Array", "stats": {"totalAccepted": "7.6K", "totalSubmission": "9.9K", "totalAcceptedRaw": 7588, "totalSubmissionRaw": 9899, "acRate": "76.7%"}, "probedCases": [{"inputs": [[1, 2, 3, 4, 5]], "output": [-3, -1, 1, 3, 5]}, {"inputs": [[3, 2, 3, 4, 2]], "output": [-2, -1, 0, 2, 3]}, {"inputs": [[16]], "output": [1]}, {"inputs": [[16, 16]], "output": [0, 1]}, {"inputs": [[13, 13, 13]], "output": [0, 0, 1]}, {"inputs": [[36, 36, 36, 36]], "output": [0, 0, 0, 1]}, {"inputs": [[40, 40, 40, 40, 40]], "output": [0, 0, 0, 0, 1]}, {"inputs": [[37, 37, 37, 37, 33]], "output": [-1, -1, -1, 0, 2]}, {"inputs": [[42, 42, 42, 42, 47]], "output": [-1, -1, -1, 0, 2]}, {"inputs": [[9, 9, 9, 9, 31]], "output": [-1, -1, -1, 0, 2]}, {"inputs": [[14, 14, 14, 14, 5]], "output": [-1, -1, -1, 0, 2]}, {"inputs": [[41, 41, 41, 17]], "output": [-1, -1, 0, 2]}, {"inputs": [[9, 9, 9, 30, 9]], "output": [-1, -1, -1, 1, 2]}, {"inputs": [[21, 21, 21, 4, 4]], "output": [-1, -1, 0, 1, 2]}, {"inputs": [[38, 38, 38, 14, 19]], "output": [-2, -2, -1, 1, 3]}, {"inputs": [[11, 11, 11, 7, 13]], "output": [-2, -2, -1, 1, 3]}, {"inputs": [[36, 36, 36, 18, 27]], "output": [-2, -2, -1, 1, 3]}, {"inputs": [[37, 37, 37, 47]], "output": [-1, -1, 0, 2]}, {"inputs": [[13, 13, 13, 34, 13]], "output": [-1, -1, -1, 1, 2]}, {"inputs": [[39, 39, 39, 38, 1]], "output": [-2, -2, -1, 1, 3]}]}} +{"id": "LeetCode/2779", "content": "# Number of Adjacent Elements With the Same Color\n\nThere is a **0-indexed** array `nums` of length `n`. Initially, all elements are **uncolored** (has a value of `0`).\n\n\nYou are given a 2D integer array `queries` where `queries[i] = [indexi, colori]`.\n\n\nFor each query, you color the index `indexi` with the color `colori` in the array `nums`.\n\n\nReturn *an array* `answer` *of the same length as* `queries` *where* `answer[i]` *is the number of adjacent elements with the same color **after** the* `ith` *query*.\n\n\nMore formally, `answer[i]` is the number of indices `j`, such that `0 <= j < n - 1` and `nums[j] == nums[j + 1]` and `nums[j] != 0` after the `ith` query.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 4, queries = [[0,2],[1,2],[3,1],[1,1],[2,1]]\n**Output:** [0,1,1,0,2]\n**Explanation:** Initially array nums = [0,0,0,0], where 0 denotes uncolored elements of the array.\n- After the 1st query nums = [2,0,0,0]. The count of adjacent elements with the same color is 0.\n- After the 2nd query nums = [2,2,0,0]. The count of adjacent elements with the same color is 1.\n- After the 3rd query nums = [2,2,0,1]. The count of adjacent elements with the same color is 1.\n- After the 4th query nums = [2,1,0,1]. The count of adjacent elements with the same color is 0.\n- After the 5th query nums = [2,1,1,1]. The count of adjacent elements with the same color is 2.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 1, queries = [[0,100000]]\n**Output:** [0]\n**Explanation:** Initially array nums = [0], where 0 denotes uncolored elements of the array.\n- After the 1st query nums = [100000]. The count of adjacent elements with the same color is 0.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 105`\n* `1 <= queries.length <= 105`\n* `queries[i].length == 2`\n* `0 <= indexi <= n - 1`\n* `1 <=  colori <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def colorTheArray(self, n: int, queries: List[List[int]]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.colorTheArray(**[4, [[0, 2], [1, 2], [3, 1], [1, 1], [2, 1]]]) == [0, 1, 1, 0, 2]\nassert my_solution.colorTheArray(**[1, [[0, 100000]]]) == [0]\nassert my_solution.colorTheArray(**[8, [[6, 2], [2, 1], [0, 6], [0, 1], [0, 4], [0, 1], [5, 7], [5, 3], [7, 6], [6, 7], [0, 4], [4, 6], [4, 2], [3, 7], [4, 4], [5, 1]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.colorTheArray(**[18, [[9, 5], [14, 15], [8, 14], [0, 4], [10, 19], [13, 11], [11, 18], [8, 15], [17, 9], [10, 1], [17, 8], [9, 13], [2, 17], [0, 10], [10, 15], [10, 19], [1, 13], [7, 1], [2, 7], [13, 16], [2, 12], [1, 19], [0, 9], [4, 1], [1, 7], [3, 18], [10, 7], [13, 2], [13, 9], [0, 17], [14, 11], [12, 7], [12, 18], [16, 15], [16, 13], [7, 12], [15, 12], [7, 18], [15, 16], [15, 6]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]\nassert my_solution.colorTheArray(**[17, [[11, 3], [5, 1], [16, 2], [4, 4], [5, 1], [13, 2], [15, 1], [15, 3], [8, 1], [14, 4], [1, 3], [6, 2], [8, 2], [2, 2], [3, 4], [7, 1], [10, 2], [14, 3], [6, 5], [3, 5], [5, 5], [9, 2], [2, 3], [3, 3], [4, 1], [12, 1], [0, 4], [16, 4], [8, 1], [14, 3], [15, 3], [12, 1], [11, 5], [3, 1], [2, 4], [10, 1], [14, 5], [15, 5], [5, 2], [8, 1], [6, 5], [10, 2]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 1, 2, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 4, 3, 4, 3, 3, 3, 4]\nassert my_solution.colorTheArray(**[15, [[10, 2], [12, 1], [7, 1], [11, 1], [5, 3], [14, 3], [12, 2], [14, 3], [3, 2], [13, 3], [11, 1], [2, 2], [2, 1], [4, 2]]]) == [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 2, 1, 2]\nassert my_solution.colorTheArray(**[9, [[7, 3], [7, 5], [2, 13], [0, 15], [7, 8], [8, 2], [7, 7], [4, 2], [2, 13]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.colorTheArray(**[11, [[1, 14], [4, 15], [0, 13], [3, 19]]]) == [0, 0, 0, 0]\nassert my_solution.colorTheArray(**[7, [[4, 5], [2, 2], [1, 1], [4, 3], [4, 2], [5, 3], [6, 5], [0, 5], [1, 6], [2, 2], [5, 3], [3, 4], [6, 5], [2, 4], [3, 6], [5, 6], [2, 5], [6, 4]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]\nassert my_solution.colorTheArray(**[4, [[2, 14], [3, 8], [1, 13], [0, 3], [1, 11], [1, 15], [1, 11], [1, 5], [0, 8], [1, 15], [3, 1]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.colorTheArray(**[9, [[1, 19], [7, 19], [0, 7], [6, 9], [0, 18], [7, 6], [4, 16], [2, 13], [5, 9], [2, 1], [2, 3], [7, 10], [5, 1], [4, 19], [7, 14], [6, 19], [0, 5], [6, 5], [1, 8], [3, 13], [1, 9], [4, 13], [3, 17], [5, 8], [1, 5], [7, 11]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1]\nassert my_solution.colorTheArray(**[7, [[2, 15], [6, 19], [6, 12], [1, 20], [1, 10], [1, 3], [1, 17], [3, 19], [1, 8], [6, 16], [4, 4], [3, 17], [3, 2], [3, 5], [0, 18], [0, 14], [3, 6], [2, 9], [1, 8], [2, 4], [6, 7], [5, 1], [3, 5], [4, 1], [2, 2], [0, 1], [4, 17], [0, 11], [4, 10], [1, 2], [0, 15], [2, 14], [6, 1]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1]\nassert my_solution.colorTheArray(**[1, [[0, 4], [0, 5], [0, 2], [0, 2], [0, 7], [0, 1], [0, 3], [0, 2], [0, 2], [0, 8], [0, 5], [0, 6], [0, 4], [0, 7], [0, 6], [0, 2], [0, 2], [0, 8], [0, 1], [0, 4], [0, 6], [0, 7], [0, 6], [0, 3], [0, 7], [0, 4], [0, 4], [0, 4], [0, 8], [0, 4], [0, 6], [0, 7], [0, 2], [0, 3], [0, 4], [0, 5], [0, 3]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.colorTheArray(**[11, [[3, 2], [4, 1], [4, 2], [2, 2], [7, 2], [5, 1], [9, 1], [0, 1], [2, 1], [2, 2], [4, 2], [2, 2], [8, 1], [7, 2], [1, 2], [6, 1], [4, 2], [9, 2], [8, 2], [4, 2], [7, 2], [0, 2], [6, 2], [4, 1], [0, 2], [5, 2], [4, 2], [8, 2], [10, 2], [1, 2], [4, 2], [6, 2], [8, 1], [7, 1]]]) == [0, 0, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 3, 3, 4, 5, 5, 4, 6, 6, 6, 7, 7, 7, 7, 7, 9, 9, 10, 10, 10, 10, 8, 8]\nassert my_solution.colorTheArray(**[20, [[14, 8], [14, 11], [17, 5], [1, 3], [3, 6], [16, 3], [11, 4]]]) == [0, 0, 0, 0, 0, 0, 0]\nassert my_solution.colorTheArray(**[14, [[7, 14], [10, 18], [11, 6], [2, 18], [9, 15], [4, 1], [1, 16], [6, 6], [9, 9], [0, 16], [3, 9], [11, 9], [0, 14], [5, 3], [8, 18], [10, 11], [7, 15], [11, 4], [11, 12], [8, 9], [11, 3], [3, 11], [9, 1], [7, 16], [9, 17], [8, 18], [3, 15], [13, 17], [10, 14], [4, 10], [1, 13], [11, 3], [5, 14], [4, 18], [3, 2], [6, 3], [6, 7], [11, 4], [5, 14], [2, 3], [13, 8], [4, 8], [6, 3], [9, 6], [5, 4], [12, 7], [9, 7], [8, 1], [12, 2]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.colorTheArray(**[16, [[12, 3], [9, 9], [11, 13], [6, 7], [10, 15], [11, 4], [9, 13], [2, 4], [3, 15], [12, 2], [0, 1], [0, 7], [3, 12], [1, 8], [2, 13], [14, 11], [0, 13], [4, 13], [13, 15], [6, 6]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.colorTheArray(**[6, [[0, 2], [5, 2], [4, 1], [0, 2], [3, 1], [4, 1], [2, 2], [3, 1], [2, 1], [2, 1], [4, 1], [3, 1], [3, 1], [2, 1], [3, 1], [1, 1], [1, 2], [2, 1], [5, 2], [5, 2], [3, 2], [2, 1], [1, 2], [4, 1], [2, 2], [5, 2], [0, 2], [4, 1], [1, 1], [5, 1], [1, 1], [3, 1], [4, 1], [5, 1], [1, 1], [4, 2], [1, 2], [1, 2], [2, 1], [5, 2], [1, 1], [1, 2], [4, 2], [3, 1], [4, 2], [5, 1], [3, 1], [2, 1], [5, 2], [2, 2]]]) == [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 1, 3, 3, 3, 3, 1, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 3]\nassert my_solution.colorTheArray(**[6, [[4, 8], [3, 8], [4, 8], [4, 6], [0, 8], [5, 6], [0, 2], [1, 6], [1, 1], [4, 5], [3, 7], [1, 7], [5, 6], [2, 4], [2, 2], [3, 1], [3, 7], [2, 6], [3, 4], [5, 1], [4, 6], [3, 8], [3, 1], [5, 1], [5, 4], [4, 9], [0, 2], [5, 6], [1, 6], [5, 8], [5, 9], [1, 5], [2, 7], [0, 7], [4, 7], [3, 3], [2, 1], [3, 4]]]) == [0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 1, 1, 1, 0, 0, 0, 0]\nassert my_solution.colorTheArray(**[16, [[1, 1], [2, 6], [13, 4], [2, 4], [12, 7], [3, 16], [14, 12], [0, 6], [5, 10], [9, 14], [3, 12], [6, 17]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n"}, "labels": {"questionId": "2779", "questionFrontendId": "2672", "questionTitle": "Number of Adjacent Elements With the Same Color", "stats": {"totalAccepted": "5.3K", "totalSubmission": "9K", "totalAcceptedRaw": 5287, "totalSubmissionRaw": 9036, "acRate": "58.5%"}, "probedCases": [{"inputs": [4, [[0, 2], [1, 2], [3, 1], [1, 1], [2, 1]]], "output": [0, 1, 1, 0, 2]}, {"inputs": [1, [[0, 100000]]], "output": [0]}, {"inputs": [8, [[6, 2], [2, 1], [0, 6], [0, 1], [0, 4], [0, 1], [5, 7], [5, 3], [7, 6], [6, 7], [0, 4], [4, 6], [4, 2], [3, 7], [4, 4], [5, 1]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [18, [[9, 5], [14, 15], [8, 14], [0, 4], [10, 19], [13, 11], [11, 18], [8, 15], [17, 9], [10, 1], [17, 8], [9, 13], [2, 17], [0, 10], [10, 15], [10, 19], [1, 13], [7, 1], [2, 7], [13, 16], [2, 12], [1, 19], [0, 9], [4, 1], [1, 7], [3, 18], [10, 7], [13, 2], [13, 9], [0, 17], [14, 11], [12, 7], [12, 18], [16, 15], [16, 13], [7, 12], [15, 12], [7, 18], [15, 16], [15, 6]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]}, {"inputs": [17, [[11, 3], [5, 1], [16, 2], [4, 4], [5, 1], [13, 2], [15, 1], [15, 3], [8, 1], [14, 4], [1, 3], [6, 2], [8, 2], [2, 2], [3, 4], [7, 1], [10, 2], [14, 3], [6, 5], [3, 5], [5, 5], [9, 2], [2, 3], [3, 3], [4, 1], [12, 1], [0, 4], [16, 4], [8, 1], [14, 3], [15, 3], [12, 1], [11, 5], [3, 1], [2, 4], [10, 1], [14, 5], [15, 5], [5, 2], [8, 1], [6, 5], [10, 2]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 1, 2, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 4, 3, 4, 3, 3, 3, 4]}, {"inputs": [15, [[10, 2], [12, 1], [7, 1], [11, 1], [5, 3], [14, 3], [12, 2], [14, 3], [3, 2], [13, 3], [11, 1], [2, 2], [2, 1], [4, 2]]], "output": [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 2, 1, 2]}, {"inputs": [9, [[7, 3], [7, 5], [2, 13], [0, 15], [7, 8], [8, 2], [7, 7], [4, 2], [2, 13]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [11, [[1, 14], [4, 15], [0, 13], [3, 19]]], "output": [0, 0, 0, 0]}, {"inputs": [7, [[4, 5], [2, 2], [1, 1], [4, 3], [4, 2], [5, 3], [6, 5], [0, 5], [1, 6], [2, 2], [5, 3], [3, 4], [6, 5], [2, 4], [3, 6], [5, 6], [2, 5], [6, 4]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]}, {"inputs": [4, [[2, 14], [3, 8], [1, 13], [0, 3], [1, 11], [1, 15], [1, 11], [1, 5], [0, 8], [1, 15], [3, 1]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [9, [[1, 19], [7, 19], [0, 7], [6, 9], [0, 18], [7, 6], [4, 16], [2, 13], [5, 9], [2, 1], [2, 3], [7, 10], [5, 1], [4, 19], [7, 14], [6, 19], [0, 5], [6, 5], [1, 8], [3, 13], [1, 9], [4, 13], [3, 17], [5, 8], [1, 5], [7, 11]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1]}, {"inputs": [7, [[2, 15], [6, 19], [6, 12], [1, 20], [1, 10], [1, 3], [1, 17], [3, 19], [1, 8], [6, 16], [4, 4], [3, 17], [3, 2], [3, 5], [0, 18], [0, 14], [3, 6], [2, 9], [1, 8], [2, 4], [6, 7], [5, 1], [3, 5], [4, 1], [2, 2], [0, 1], [4, 17], [0, 11], [4, 10], [1, 2], [0, 15], [2, 14], [6, 1]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1]}, {"inputs": [1, [[0, 4], [0, 5], [0, 2], [0, 2], [0, 7], [0, 1], [0, 3], [0, 2], [0, 2], [0, 8], [0, 5], [0, 6], [0, 4], [0, 7], [0, 6], [0, 2], [0, 2], [0, 8], [0, 1], [0, 4], [0, 6], [0, 7], [0, 6], [0, 3], [0, 7], [0, 4], [0, 4], [0, 4], [0, 8], [0, 4], [0, 6], [0, 7], [0, 2], [0, 3], [0, 4], [0, 5], [0, 3]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [11, [[3, 2], [4, 1], [4, 2], [2, 2], [7, 2], [5, 1], [9, 1], [0, 1], [2, 1], [2, 2], [4, 2], [2, 2], [8, 1], [7, 2], [1, 2], [6, 1], [4, 2], [9, 2], [8, 2], [4, 2], [7, 2], [0, 2], [6, 2], [4, 1], [0, 2], [5, 2], [4, 2], [8, 2], [10, 2], [1, 2], [4, 2], [6, 2], [8, 1], [7, 1]]], "output": [0, 0, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 3, 3, 4, 5, 5, 4, 6, 6, 6, 7, 7, 7, 7, 7, 9, 9, 10, 10, 10, 10, 8, 8]}, {"inputs": [20, [[14, 8], [14, 11], [17, 5], [1, 3], [3, 6], [16, 3], [11, 4]]], "output": [0, 0, 0, 0, 0, 0, 0]}, {"inputs": [14, [[7, 14], [10, 18], [11, 6], [2, 18], [9, 15], [4, 1], [1, 16], [6, 6], [9, 9], [0, 16], [3, 9], [11, 9], [0, 14], [5, 3], [8, 18], [10, 11], [7, 15], [11, 4], [11, 12], [8, 9], [11, 3], [3, 11], [9, 1], [7, 16], [9, 17], [8, 18], [3, 15], [13, 17], [10, 14], [4, 10], [1, 13], [11, 3], [5, 14], [4, 18], [3, 2], [6, 3], [6, 7], [11, 4], [5, 14], [2, 3], [13, 8], [4, 8], [6, 3], [9, 6], [5, 4], [12, 7], [9, 7], [8, 1], [12, 2]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [16, [[12, 3], [9, 9], [11, 13], [6, 7], [10, 15], [11, 4], [9, 13], [2, 4], [3, 15], [12, 2], [0, 1], [0, 7], [3, 12], [1, 8], [2, 13], [14, 11], [0, 13], [4, 13], [13, 15], [6, 6]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [6, [[0, 2], [5, 2], [4, 1], [0, 2], [3, 1], [4, 1], [2, 2], [3, 1], [2, 1], [2, 1], [4, 1], [3, 1], [3, 1], [2, 1], [3, 1], [1, 1], [1, 2], [2, 1], [5, 2], [5, 2], [3, 2], [2, 1], [1, 2], [4, 1], [2, 2], [5, 2], [0, 2], [4, 1], [1, 1], [5, 1], [1, 1], [3, 1], [4, 1], [5, 1], [1, 1], [4, 2], [1, 2], [1, 2], [2, 1], [5, 2], [1, 1], [1, 2], [4, 2], [3, 1], [4, 2], [5, 1], [3, 1], [2, 1], [5, 2], [2, 2]]], "output": [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 1, 3, 3, 3, 3, 1, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 3]}, {"inputs": [6, [[4, 8], [3, 8], [4, 8], [4, 6], [0, 8], [5, 6], [0, 2], [1, 6], [1, 1], [4, 5], [3, 7], [1, 7], [5, 6], [2, 4], [2, 2], [3, 1], [3, 7], [2, 6], [3, 4], [5, 1], [4, 6], [3, 8], [3, 1], [5, 1], [5, 4], [4, 9], [0, 2], [5, 6], [1, 6], [5, 8], [5, 9], [1, 5], [2, 7], [0, 7], [4, 7], [3, 3], [2, 1], [3, 4]]], "output": [0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 1, 1, 1, 0, 0, 0, 0]}, {"inputs": [16, [[1, 1], [2, 6], [13, 4], [2, 4], [12, 7], [3, 16], [14, 12], [0, 6], [5, 10], [9, 14], [3, 12], [6, 17]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}]}} +{"id": "LeetCode/2684", "content": "# Determine the Winner of a Bowling Game\n\nYou are given two **0-indexed** integer arrays `player1` and `player2`, that represent the number of pins that player 1 and player 2 hit in a bowling game, respectively.\n\n\nThe bowling game consists of `n` turns, and the number of pins in each turn is exactly `10`.\n\n\nAssume a player hit `xi` pins in the `ith` turn. The value of the `ith` turn for the player is:\n\n\n* `2xi` if the player hit `10` pins in any of the previous two turns.\n* Otherwise, It is `xi`.\n\n\nThe score of the player is the sum of the values of their `n` turns.\n\n\nReturn\n\n\n* `1` *if the score of player 1 is more than the score of player 2,*\n* `2` *if the score of player 2 is more than the score of player 1, and*\n* `0` *in case of a draw.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** player1 = [4,10,7,9], player2 = [6,5,2,3]\n**Output:** 1\n**Explanation:** The score of player1 is 4 + 10 + 2*7 + 2*9 = 46.\nThe score of player2 is 6 + 5 + 2 + 3 = 16.\nScore of player1 is more than the score of player2, so, player1 is the winner, and the answer is 1.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** player1 = [3,5,7,6], player2 = [8,10,10,2]\n**Output:** 2\n**Explanation:** The score of player1 is 3 + 5 + 7 + 6 = 21.\nThe score of player2 is 8 + 10 + 2*10 + 2*2 = 42.\nScore of player2 is more than the score of player1, so, player2 is the winner, and the answer is 2.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** player1 = [2,3], player2 = [4,1]\n**Output:** 0\n**Explanation:** The score of player1 is 2 + 3 = 5\nThe score of player2 is 4 + 1 = 5\nThe score of player1 equals to the score of player2, so, there is a draw, and the answer is 0.\n\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `n == player1.length == player2.length`\n* `1 <= n <= 1000`\n* `0 <= player1[i], player2[i] <= 10`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def isWinner(self, player1: List[int], player2: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.isWinner(**[[4, 10, 7, 9], [6, 5, 2, 3]]) == 1\nassert my_solution.isWinner(**[[3, 5, 7, 6], [8, 10, 10, 2]]) == 2\nassert my_solution.isWinner(**[[2, 3], [4, 1]]) == 0\nassert my_solution.isWinner(**[[0, 4, 7, 2, 0], [2, 3, 3, 0, 1]]) == 1\nassert my_solution.isWinner(**[[5, 6, 1, 10], [5, 1, 10, 5]]) == 2\nassert my_solution.isWinner(**[[0, 9, 2, 0], [4, 6, 9, 1]]) == 2\nassert my_solution.isWinner(**[[7, 3, 6, 7], [4, 2, 6, 7]]) == 1\nassert my_solution.isWinner(**[[6, 10, 4], [5, 9, 2]]) == 1\nassert my_solution.isWinner(**[[9, 8, 5, 3, 7], [8, 7, 4, 9, 0]]) == 1\nassert my_solution.isWinner(**[[2, 8, 10, 6], [8, 0, 4, 2]]) == 1\nassert my_solution.isWinner(**[[3, 2, 6, 6, 2], [1, 4, 5, 2, 5]]) == 1\nassert my_solution.isWinner(**[[0, 1, 8], [3, 9, 1]]) == 2\nassert my_solution.isWinner(**[[5, 2, 4, 2, 0], [6, 1, 5, 2, 6]]) == 2\nassert my_solution.isWinner(**[[3, 6, 9], [0, 7, 4]]) == 1\nassert my_solution.isWinner(**[[1, 2, 7, 6], [6, 7, 0, 0]]) == 1\nassert my_solution.isWinner(**[[7, 5, 10, 5], [2, 5, 7, 10]]) == 1\nassert my_solution.isWinner(**[[9, 6, 10, 0], [4, 4, 0, 5]]) == 1\nassert my_solution.isWinner(**[[7, 1, 3, 10], [10, 9, 0, 9]]) == 2\nassert my_solution.isWinner(**[[7], [8]]) == 2\nassert my_solution.isWinner(**[[1, 3, 0], [2, 0, 0]]) == 1\n"}, "labels": {"questionId": "2684", "questionFrontendId": "2660", "questionTitle": "Determine the Winner of a Bowling Game", "stats": {"totalAccepted": "27K", "totalSubmission": "58.4K", "totalAcceptedRaw": 26998, "totalSubmissionRaw": 58387, "acRate": "46.2%"}, "probedCases": [{"inputs": [[4, 10, 7, 9], [6, 5, 2, 3]], "output": 1}, {"inputs": [[3, 5, 7, 6], [8, 10, 10, 2]], "output": 2}, {"inputs": [[2, 3], [4, 1]], "output": 0}, {"inputs": [[0, 4, 7, 2, 0], [2, 3, 3, 0, 1]], "output": 1}, {"inputs": [[5, 6, 1, 10], [5, 1, 10, 5]], "output": 2}, {"inputs": [[0, 9, 2, 0], [4, 6, 9, 1]], "output": 2}, {"inputs": [[7, 3, 6, 7], [4, 2, 6, 7]], "output": 1}, {"inputs": [[6, 10, 4], [5, 9, 2]], "output": 1}, {"inputs": [[9, 8, 5, 3, 7], [8, 7, 4, 9, 0]], "output": 1}, {"inputs": [[2, 8, 10, 6], [8, 0, 4, 2]], "output": 1}, {"inputs": [[3, 2, 6, 6, 2], [1, 4, 5, 2, 5]], "output": 1}, {"inputs": [[0, 1, 8], [3, 9, 1]], "output": 2}, {"inputs": [[5, 2, 4, 2, 0], [6, 1, 5, 2, 6]], "output": 2}, {"inputs": [[3, 6, 9], [0, 7, 4]], "output": 1}, {"inputs": [[1, 2, 7, 6], [6, 7, 0, 0]], "output": 1}, {"inputs": [[7, 5, 10, 5], [2, 5, 7, 10]], "output": 1}, {"inputs": [[9, 6, 10, 0], [4, 4, 0, 5]], "output": 1}, {"inputs": [[7, 1, 3, 10], [10, 9, 0, 9]], "output": 2}, {"inputs": [[7], [8]], "output": 2}, {"inputs": [[1, 3, 0], [2, 0, 0]], "output": 1}]}} +{"id": "LeetCode/2686", "content": "# Minimum Cost of a Path With Special Roads\n\nYou are given an array `start` where `start = [startX, startY]` represents your initial position `(startX, startY)` in a 2D space. You are also given the array `target` where `target = [targetX, targetY]` represents your target position `(targetX, targetY)`.\n\n\nThe cost of going from a position `(x1, y1)` to any other position in the space `(x2, y2)` is `|x2 - x1| + |y2 - y1|`.\n\n\nThere are also some special roads. You are given a 2D array `specialRoads` where `specialRoads[i] = [x1i, y1i, x2i, y2i, costi]` indicates that the `ith` special road can take you from `(x1i, y1i)` to `(x2i, y2i)` with a cost equal to `costi`. You can use each special road any number of times.\n\n\nReturn *the minimum cost required to go from* `(startX, startY)` to `(targetX, targetY)`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** start = [1,1], target = [4,5], specialRoads = [[1,2,3,3,2],[3,4,4,5,1]]\n**Output:** 5\n**Explanation:** The optimal path from (1,1) to (4,5) is the following:\n- (1,1) -> (1,2). This move has a cost of |1 - 1| + |2 - 1| = 1.\n- (1,2) -> (3,3). This move uses the first special edge, the cost is 2.\n- (3,3) -> (3,4). This move has a cost of |3 - 3| + |4 - 3| = 1.\n- (3,4) -> (4,5). This move uses the second special edge, the cost is 1.\nSo the total cost is 1 + 2 + 1 + 1 = 5.\nIt can be shown that we cannot achieve a smaller total cost than 5.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** start = [3,2], target = [5,7], specialRoads = [[3,2,3,4,4],[3,3,5,5,5],[3,4,5,6,6]]\n**Output:** 7\n**Explanation:** It is optimal to not use any special edges and go directly from the starting to the ending position with a cost |5 - 3| + |7 - 2| = 7.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `start.length == target.length == 2`\n* `1 <= startX <= targetX <= 105`\n* `1 <= startY <= targetY <= 105`\n* `1 <= specialRoads.length <= 200`\n* `specialRoads[i].length == 5`\n* `startX <= x1i, x2i <= targetX`\n* `startY <= y1i, y2i <= targetY`\n* `1 <= costi <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumCost(self, start: List[int], target: List[int], specialRoads: List[List[int]]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumCost(**[[1, 1], [4, 5], [[1, 2, 3, 3, 2], [3, 4, 4, 5, 1]]]) == 5\nassert my_solution.minimumCost(**[[3, 2], [5, 7], [[3, 2, 3, 4, 4], [3, 3, 5, 5, 5], [3, 4, 5, 6, 6]]]) == 7\nassert my_solution.minimumCost(**[[1, 1], [5, 10], [[3, 4, 5, 2, 5], [4, 5, 3, 8, 3], [3, 2, 5, 3, 1]]]) == 11\nassert my_solution.minimumCost(**[[1, 1], [4, 6], [[3, 4, 2, 4, 1], [2, 5, 4, 2, 5], [3, 2, 1, 6, 3]]]) == 8\nassert my_solution.minimumCost(**[[1, 1], [10, 6], [[4, 3, 6, 4, 5], [8, 1, 4, 6, 2], [8, 5, 5, 6, 2], [1, 5, 1, 4, 2]]]) == 14\nassert my_solution.minimumCost(**[[1, 1], [10, 4], [[4, 2, 1, 1, 3], [1, 2, 7, 4, 4], [10, 3, 6, 1, 2], [6, 1, 1, 2, 3]]]) == 8\nassert my_solution.minimumCost(**[[1, 1], [9, 3], [[6, 3, 9, 1, 1], [7, 1, 6, 3, 1], [7, 3, 4, 2, 2], [3, 3, 1, 1, 2]]]) == 10\nassert my_solution.minimumCost(**[[1, 1], [9, 5], [[7, 4, 1, 5, 3], [7, 1, 4, 4, 1], [9, 4, 8, 4, 1], [4, 4, 3, 2, 1], [5, 1, 2, 3, 2]]]) == 12\nassert my_solution.minimumCost(**[[1, 1], [8, 8], [[4, 2, 2, 3, 1], [2, 2, 3, 4, 1], [5, 5, 2, 8, 4], [2, 6, 1, 6, 5]]]) == 12\nassert my_solution.minimumCost(**[[1, 1], [4, 6], [[4, 3, 4, 3, 3], [2, 4, 3, 4, 4], [4, 6, 1, 3, 5], [1, 5, 1, 2, 4], [1, 2, 3, 4, 1]]]) == 5\nassert my_solution.minimumCost(**[[1, 1], [3, 4], [[1, 2, 3, 2, 3], [3, 1, 3, 2, 4], [3, 2, 1, 3, 2]]]) == 5\nassert my_solution.minimumCost(**[[1, 1], [9, 5], [[8, 4, 6, 5, 1], [7, 4, 9, 2, 3], [8, 5, 3, 2, 1], [5, 2, 8, 2, 4], [1, 5, 9, 2, 3]]]) == 10\nassert my_solution.minimumCost(**[[1, 1], [10, 9], [[5, 2, 3, 6, 3], [5, 6, 9, 5, 3], [5, 9, 1, 2, 5], [8, 6, 9, 8, 1]]]) == 15\nassert my_solution.minimumCost(**[[1, 1], [7, 8], [[1, 6, 7, 2, 2]]]) == 13\nassert my_solution.minimumCost(**[[1, 1], [8, 5], [[1, 3, 8, 5, 2], [6, 5, 3, 3, 1], [4, 3, 3, 1, 4], [2, 3, 8, 3, 5]]]) == 4\nassert my_solution.minimumCost(**[[1, 1], [8, 8], [[3, 3, 4, 2, 4], [4, 2, 7, 1, 1], [3, 3, 7, 7, 3]]]) == 9\nassert my_solution.minimumCost(**[[1, 1], [8, 9], [[8, 9, 8, 4, 3], [2, 4, 8, 1, 4], [7, 6, 5, 9, 4], [4, 6, 5, 4, 1]]]) == 15\nassert my_solution.minimumCost(**[[1, 1], [8, 10], [[1, 10, 5, 9, 2], [2, 3, 2, 4, 4], [7, 9, 4, 5, 1], [3, 1, 4, 6, 4]]]) == 14\nassert my_solution.minimumCost(**[[1, 1], [9, 9], [[8, 3, 2, 4, 2], [3, 8, 5, 4, 5], [1, 8, 7, 7, 4], [1, 6, 9, 5, 2]]]) == 11\nassert my_solution.minimumCost(**[[1, 1], [5, 9], [[4, 9, 1, 2, 3]]]) == 12\n"}, "labels": {"questionId": "2686", "questionFrontendId": "2662", "questionTitle": "Minimum Cost of a Path With Special Roads", "stats": {"totalAccepted": "3.9K", "totalSubmission": "10.2K", "totalAcceptedRaw": 3874, "totalSubmissionRaw": 10238, "acRate": "37.8%"}, "probedCases": [{"inputs": [[1, 1], [4, 5], [[1, 2, 3, 3, 2], [3, 4, 4, 5, 1]]], "output": 5}, {"inputs": [[3, 2], [5, 7], [[3, 2, 3, 4, 4], [3, 3, 5, 5, 5], [3, 4, 5, 6, 6]]], "output": 7}, {"inputs": [[1, 1], [5, 10], [[3, 4, 5, 2, 5], [4, 5, 3, 8, 3], [3, 2, 5, 3, 1]]], "output": 11}, {"inputs": [[1, 1], [4, 6], [[3, 4, 2, 4, 1], [2, 5, 4, 2, 5], [3, 2, 1, 6, 3]]], "output": 8}, {"inputs": [[1, 1], [10, 6], [[4, 3, 6, 4, 5], [8, 1, 4, 6, 2], [8, 5, 5, 6, 2], [1, 5, 1, 4, 2]]], "output": 14}, {"inputs": [[1, 1], [10, 4], [[4, 2, 1, 1, 3], [1, 2, 7, 4, 4], [10, 3, 6, 1, 2], [6, 1, 1, 2, 3]]], "output": 8}, {"inputs": [[1, 1], [9, 3], [[6, 3, 9, 1, 1], [7, 1, 6, 3, 1], [7, 3, 4, 2, 2], [3, 3, 1, 1, 2]]], "output": 10}, {"inputs": [[1, 1], [9, 5], [[7, 4, 1, 5, 3], [7, 1, 4, 4, 1], [9, 4, 8, 4, 1], [4, 4, 3, 2, 1], [5, 1, 2, 3, 2]]], "output": 12}, {"inputs": [[1, 1], [8, 8], [[4, 2, 2, 3, 1], [2, 2, 3, 4, 1], [5, 5, 2, 8, 4], [2, 6, 1, 6, 5]]], "output": 12}, {"inputs": [[1, 1], [4, 6], [[4, 3, 4, 3, 3], [2, 4, 3, 4, 4], [4, 6, 1, 3, 5], [1, 5, 1, 2, 4], [1, 2, 3, 4, 1]]], "output": 5}, {"inputs": [[1, 1], [3, 4], [[1, 2, 3, 2, 3], [3, 1, 3, 2, 4], [3, 2, 1, 3, 2]]], "output": 5}, {"inputs": [[1, 1], [9, 5], [[8, 4, 6, 5, 1], [7, 4, 9, 2, 3], [8, 5, 3, 2, 1], [5, 2, 8, 2, 4], [1, 5, 9, 2, 3]]], "output": 10}, {"inputs": [[1, 1], [10, 9], [[5, 2, 3, 6, 3], [5, 6, 9, 5, 3], [5, 9, 1, 2, 5], [8, 6, 9, 8, 1]]], "output": 15}, {"inputs": [[1, 1], [7, 8], [[1, 6, 7, 2, 2]]], "output": 13}, {"inputs": [[1, 1], [8, 5], [[1, 3, 8, 5, 2], [6, 5, 3, 3, 1], [4, 3, 3, 1, 4], [2, 3, 8, 3, 5]]], "output": 4}, {"inputs": [[1, 1], [8, 8], [[3, 3, 4, 2, 4], [4, 2, 7, 1, 1], [3, 3, 7, 7, 3]]], "output": 9}, {"inputs": [[1, 1], [8, 9], [[8, 9, 8, 4, 3], [2, 4, 8, 1, 4], [7, 6, 5, 9, 4], [4, 6, 5, 4, 1]]], "output": 15}, {"inputs": [[1, 1], [8, 10], [[1, 10, 5, 9, 2], [2, 3, 2, 4, 4], [7, 9, 4, 5, 1], [3, 1, 4, 6, 4]]], "output": 14}, {"inputs": [[1, 1], [9, 9], [[8, 3, 2, 4, 2], [3, 8, 5, 4, 5], [1, 8, 7, 7, 4], [1, 6, 9, 5, 2]]], "output": 11}, {"inputs": [[1, 1], [5, 9], [[4, 9, 1, 2, 3]]], "output": 12}]}} +{"id": "LeetCode/2687", "content": "# Lexicographically Smallest Beautiful String\n\nA string is **beautiful** if:\n\n\n* It consists of the first `k` letters of the English lowercase alphabet.\n* It does not contain any substring of length `2` or more which is a palindrome.\n\n\nYou are given a beautiful string `s` of length `n` and a positive integer `k`.\n\n\nReturn *the lexicographically smallest string of length* `n`*, which is larger than* `s` *and is **beautiful***. If there is no such string, return an empty string.\n\n\nA 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`.\n\n\n* 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`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"abcz\", k = 26\n**Output:** \"abda\"\n**Explanation:** The string \"abda\" is beautiful and lexicographically larger than the string \"abcz\".\nIt can be proven that there is no string that is lexicographically larger than the string \"abcz\", beautiful, and lexicographically smaller than the string \"abda\".\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"dc\", k = 4\n**Output:** \"\"\n**Explanation:** It can be proven that there is no string that is lexicographically larger than the string \"dc\" and is beautiful.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == s.length <= 105`\n* `4 <= k <= 26`\n* `s` is a beautiful string.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def smallestBeautifulString(self, s: str, k: int) -> str:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.smallestBeautifulString(**['abcz', 26]) == abda\nassert my_solution.smallestBeautifulString(**['dc', 4]) == \nassert my_solution.smallestBeautifulString(**['abc', 8]) == abd\nassert my_solution.smallestBeautifulString(**['dfa', 6]) == dfb\nassert my_solution.smallestBeautifulString(**['dca', 4]) == dcb\nassert my_solution.smallestBeautifulString(**['da', 8]) == db\nassert my_solution.smallestBeautifulString(**['feda', 7]) == fedb\nassert my_solution.smallestBeautifulString(**['b', 6]) == c\nassert my_solution.smallestBeautifulString(**['ced', 6]) == cef\nassert my_solution.smallestBeautifulString(**['gfc', 8]) == gfd\nassert my_solution.smallestBeautifulString(**['facf', 7]) == facg\nassert my_solution.smallestBeautifulString(**['cegaf', 7]) == cegba\nassert my_solution.smallestBeautifulString(**['edg', 7]) == efa\nassert my_solution.smallestBeautifulString(**['acbac', 5]) == acbad\nassert my_solution.smallestBeautifulString(**['fedc', 6]) == fedf\nassert my_solution.smallestBeautifulString(**['cd', 4]) == da\nassert my_solution.smallestBeautifulString(**['fadce', 7]) == fadcf\nassert my_solution.smallestBeautifulString(**['cfb', 6]) == cfd\nassert my_solution.smallestBeautifulString(**['dfce', 6]) == dfea\nassert my_solution.smallestBeautifulString(**['ebga', 8]) == ebgc\n"}, "labels": {"questionId": "2687", "questionFrontendId": "2663", "questionTitle": "Lexicographically Smallest Beautiful String", "stats": {"totalAccepted": "1.9K", "totalSubmission": "4.2K", "totalAcceptedRaw": 1924, "totalSubmissionRaw": 4196, "acRate": "45.9%"}, "probedCases": [{"inputs": ["abcz", 26], "output": "abda"}, {"inputs": ["dc", 4], "output": ""}, {"inputs": ["abc", 8], "output": "abd"}, {"inputs": ["dfa", 6], "output": "dfb"}, {"inputs": ["dca", 4], "output": "dcb"}, {"inputs": ["da", 8], "output": "db"}, {"inputs": ["feda", 7], "output": "fedb"}, {"inputs": ["b", 6], "output": "c"}, {"inputs": ["ced", 6], "output": "cef"}, {"inputs": ["gfc", 8], "output": "gfd"}, {"inputs": ["facf", 7], "output": "facg"}, {"inputs": ["cegaf", 7], "output": "cegba"}, {"inputs": ["edg", 7], "output": "efa"}, {"inputs": ["acbac", 5], "output": "acbad"}, {"inputs": ["fedc", 6], "output": "fedf"}, {"inputs": ["cd", 4], "output": "da"}, {"inputs": ["fadce", 7], "output": "fadcf"}, {"inputs": ["cfb", 6], "output": "cfd"}, {"inputs": ["dfce", 6], "output": "dfea"}, {"inputs": ["ebga", 8], "output": "ebgc"}]}} +{"id": "LeetCode/2767", "content": "# Maximum Sum With Exactly K Elements \n\nYou are given a **0-indexed** integer array `nums` and an integer `k`. Your task is to perform the following operation **exactly** `k` times in order to maximize your score:\n\n\n1. Select an element `m` from `nums`.\n2. Remove the selected element `m` from the array.\n3. Add a new element with a value of `m + 1` to the array.\n4. Increase your score by `m`.\n\n\nReturn *the maximum score you can achieve after performing the operation exactly* `k` *times.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4,5], k = 3\n**Output:** 18\n**Explanation:** We need to choose exactly 3 elements from nums to maximize the sum.\nFor the first iteration, we choose 5. Then sum is 5 and nums = [1,2,3,4,6]\nFor the second iteration, we choose 6. Then sum is 5 + 6 and nums = [1,2,3,4,7]\nFor the third iteration, we choose 7. Then sum is 5 + 6 + 7 = 18 and nums = [1,2,3,4,8]\nSo, we will return 18.\nIt can be proven, that 18 is the maximum answer that we can achieve.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,5,5], k = 2\n**Output:** 11\n**Explanation:** We need to choose exactly 2 elements from nums to maximize the sum.\nFor the first iteration, we choose 5. Then sum is 5 and nums = [5,5,6]\nFor the second iteration, we choose 6. Then sum is 5 + 6 = 11 and nums = [5,5,7]\nSo, we will return 11.\nIt can be proven, that 11 is the maximum answer that we can achieve.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 100`\n* `1 <= nums[i] <= 100`\n* `1 <= k <= 100`\n\n\n \n\n\n.spoilerbutton {display:block; border:dashed; padding: 0px 0px; margin:10px 0px; font-size:150%; font-weight: bold; color:#000000; background-color:cyan; outline:0; \n}\n.spoiler {overflow:hidden;}\n.spoiler > div {-webkit-transition: all 0s ease;-moz-transition: margin 0s ease;-o-transition: all 0s ease;transition: margin 0s ease;}\n.spoilerbutton[value=\"Show Message\"] + .spoiler > div {margin-top:-500%;}\n.spoilerbutton[value=\"Hide Message\"] + .spoiler {padding:5px;}\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximizeSum(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximizeSum(**[[1, 2, 3, 4, 5], 3]) == 18\nassert my_solution.maximizeSum(**[[5, 5, 5], 2]) == 11\nassert my_solution.maximizeSum(**[[4, 4, 9, 10, 10, 9, 3, 8, 4, 2, 5, 3, 8, 6, 1, 10, 4, 5, 3, 2, 3, 9, 5, 7, 10, 4, 9, 10, 1, 10, 4], 6]) == 75\nassert my_solution.maximizeSum(**[[1, 10, 2, 6, 7, 9, 8, 5, 8, 3, 1, 3, 10, 5, 8, 3, 9, 3, 8, 2, 3, 3, 10, 5, 8, 8, 4, 7, 2, 3, 4, 3, 10, 8, 7, 9, 1, 3, 4, 2, 6, 6, 9, 6, 2, 10, 10, 4, 6, 3, 4, 1, 1, 3, 8, 4, 10, 3, 9, 5, 3, 10, 4, 7, 10, 7, 1, 7], 9]) == 126\nassert my_solution.maximizeSum(**[[8, 8, 1, 6, 6, 7, 6, 1, 3, 1, 1, 8, 9, 2, 8, 3, 1, 9, 7, 6, 1, 8, 10, 3, 7, 10, 6], 3]) == 33\nassert my_solution.maximizeSum(**[[1, 10, 7, 8, 7, 6, 8, 2, 8, 9, 3, 3, 5, 6, 10, 1, 2, 5, 5, 8, 5, 4, 9, 5, 2, 3, 10, 5, 1, 9, 1, 8, 9, 2, 10, 2, 7, 8, 9, 7, 6, 6, 9, 5, 3, 10, 7, 5, 9, 10, 10, 6, 6, 8, 10, 7, 10, 9, 10, 6, 1, 10, 10, 5, 7, 9, 9, 2, 8, 5, 8, 3, 5], 2]) == 21\nassert my_solution.maximizeSum(**[[9, 7, 10, 5, 2, 3, 9, 9, 5, 10, 10, 5], 3]) == 33\nassert my_solution.maximizeSum(**[[3, 10, 4, 7, 9, 1, 10, 5, 2, 6, 1, 7, 8, 9, 9, 2], 3]) == 33\nassert my_solution.maximizeSum(**[[3, 2, 3, 5, 1, 2, 4, 7, 4, 7, 9, 7, 9], 9]) == 117\nassert my_solution.maximizeSum(**[[2, 10, 9, 9, 8, 5, 6, 4, 7, 6, 3, 9, 4, 2, 10, 5, 9, 7, 7, 3, 10, 9, 7, 4, 3, 1, 1, 1, 1, 1, 7, 1, 2, 6, 6, 6, 8, 7], 1]) == 10\nassert my_solution.maximizeSum(**[[5, 5, 4, 4, 5, 8, 6, 2, 10, 5, 3, 8, 8, 5, 10, 7, 1, 2, 6, 10, 7, 6, 6, 9, 5, 8, 9, 5, 6, 1, 9, 4, 5, 7, 2, 9, 1, 5, 6, 8, 6, 10, 1, 7, 4, 1, 2, 4, 10, 7, 8, 2, 6, 1, 10], 1]) == 10\nassert my_solution.maximizeSum(**[[3, 1, 1, 4, 2, 9, 6, 4, 7, 1, 7, 5, 10, 1, 9, 8, 6, 7, 4, 7, 9, 9, 8, 9, 7, 4, 6, 8, 6, 4, 9, 8, 8], 8]) == 108\nassert my_solution.maximizeSum(**[[6, 5, 3, 1, 9, 4, 3, 8, 3, 2, 7, 3, 8, 2, 8, 6, 5, 2, 8, 8, 1, 6, 4], 4]) == 42\nassert my_solution.maximizeSum(**[[4, 2, 4, 2, 7, 4, 2, 6, 3, 8, 5, 4, 10, 2, 9, 3, 9, 5, 4, 2, 6, 2, 5, 3, 2, 7, 1, 1, 8, 9, 7, 5, 1, 8, 6, 8], 6]) == 75\nassert my_solution.maximizeSum(**[[7, 1, 6, 10, 2, 2, 2, 8, 6, 2, 8, 9, 8, 10, 3, 4, 5, 2, 4, 10, 6, 3, 6, 4, 8, 1, 2, 6, 9, 6, 10, 4, 6, 3, 3, 5, 3, 2, 5, 8, 8, 3, 8, 5, 3, 1, 8, 8, 9, 2, 8, 7, 5, 2, 3, 2, 7, 5, 8, 1, 10, 7, 4, 10, 10, 10, 6, 4, 3, 1, 10, 5, 10, 3, 5, 9, 2, 10, 4, 6, 3, 5, 7, 8, 10, 6], 7]) == 91\nassert my_solution.maximizeSum(**[[6, 10, 7, 10, 6, 7, 7, 4, 4, 7, 2, 2, 3, 6, 4, 8, 4, 6, 4, 3, 1, 4, 4, 8, 7, 1, 10, 2, 10, 8, 10, 1, 4, 7, 10, 5, 1, 9, 8, 3, 5, 8, 3, 7, 6, 5, 3, 1, 3, 2, 8, 5, 6, 1, 5, 10, 8, 7, 7, 10, 1, 3, 7, 3], 2]) == 21\nassert my_solution.maximizeSum(**[[4, 7, 2, 5, 5, 7, 4, 9, 6, 4, 2, 3, 8, 6, 6, 8, 10, 6, 4, 10, 3, 5, 3, 2, 3, 9, 7, 10, 4, 4], 8]) == 108\nassert my_solution.maximizeSum(**[[2, 7, 9, 8, 1, 8, 3, 1, 9, 1, 7, 7, 3, 6, 5, 3, 4, 6, 2, 4, 1, 8, 3, 9, 1, 6, 1, 2, 1, 9, 9, 2, 6, 10, 5, 3, 1, 2, 8, 6, 7, 1, 10, 4, 4, 5, 5, 5, 10, 2, 3, 2, 8, 10, 9, 7, 1, 1, 2, 9, 3, 3, 2, 2, 2, 4, 9, 8, 9, 3, 5, 4, 6, 1, 10, 10, 4, 1], 10]) == 145\nassert my_solution.maximizeSum(**[[5, 6, 3, 2, 10, 9, 2, 9, 2, 8, 9, 8, 2, 1, 8, 4, 9, 4, 6, 2, 7, 9, 1, 10, 6, 10, 7, 3, 9, 2, 9, 10, 7, 10, 10, 4, 4, 10, 5, 4, 10, 3, 4, 2, 8, 9, 9, 3, 4, 5, 6, 9, 9, 2, 7], 5]) == 60\nassert my_solution.maximizeSum(**[[3, 3, 4, 4, 6, 5, 4, 3, 4, 10, 5, 5, 4], 5]) == 60\n"}, "labels": {"questionId": "2767", "questionFrontendId": "2656", "questionTitle": "Maximum Sum With Exactly K Elements ", "stats": {"totalAccepted": "35.7K", "totalSubmission": "41.1K", "totalAcceptedRaw": 35732, "totalSubmissionRaw": 41144, "acRate": "86.8%"}, "probedCases": [{"inputs": [[1, 2, 3, 4, 5], 3], "output": 18}, {"inputs": [[5, 5, 5], 2], "output": 11}, {"inputs": [[4, 4, 9, 10, 10, 9, 3, 8, 4, 2, 5, 3, 8, 6, 1, 10, 4, 5, 3, 2, 3, 9, 5, 7, 10, 4, 9, 10, 1, 10, 4], 6], "output": 75}, {"inputs": [[1, 10, 2, 6, 7, 9, 8, 5, 8, 3, 1, 3, 10, 5, 8, 3, 9, 3, 8, 2, 3, 3, 10, 5, 8, 8, 4, 7, 2, 3, 4, 3, 10, 8, 7, 9, 1, 3, 4, 2, 6, 6, 9, 6, 2, 10, 10, 4, 6, 3, 4, 1, 1, 3, 8, 4, 10, 3, 9, 5, 3, 10, 4, 7, 10, 7, 1, 7], 9], "output": 126}, {"inputs": [[8, 8, 1, 6, 6, 7, 6, 1, 3, 1, 1, 8, 9, 2, 8, 3, 1, 9, 7, 6, 1, 8, 10, 3, 7, 10, 6], 3], "output": 33}, {"inputs": [[1, 10, 7, 8, 7, 6, 8, 2, 8, 9, 3, 3, 5, 6, 10, 1, 2, 5, 5, 8, 5, 4, 9, 5, 2, 3, 10, 5, 1, 9, 1, 8, 9, 2, 10, 2, 7, 8, 9, 7, 6, 6, 9, 5, 3, 10, 7, 5, 9, 10, 10, 6, 6, 8, 10, 7, 10, 9, 10, 6, 1, 10, 10, 5, 7, 9, 9, 2, 8, 5, 8, 3, 5], 2], "output": 21}, {"inputs": [[9, 7, 10, 5, 2, 3, 9, 9, 5, 10, 10, 5], 3], "output": 33}, {"inputs": [[3, 10, 4, 7, 9, 1, 10, 5, 2, 6, 1, 7, 8, 9, 9, 2], 3], "output": 33}, {"inputs": [[3, 2, 3, 5, 1, 2, 4, 7, 4, 7, 9, 7, 9], 9], "output": 117}, {"inputs": [[2, 10, 9, 9, 8, 5, 6, 4, 7, 6, 3, 9, 4, 2, 10, 5, 9, 7, 7, 3, 10, 9, 7, 4, 3, 1, 1, 1, 1, 1, 7, 1, 2, 6, 6, 6, 8, 7], 1], "output": 10}, {"inputs": [[5, 5, 4, 4, 5, 8, 6, 2, 10, 5, 3, 8, 8, 5, 10, 7, 1, 2, 6, 10, 7, 6, 6, 9, 5, 8, 9, 5, 6, 1, 9, 4, 5, 7, 2, 9, 1, 5, 6, 8, 6, 10, 1, 7, 4, 1, 2, 4, 10, 7, 8, 2, 6, 1, 10], 1], "output": 10}, {"inputs": [[3, 1, 1, 4, 2, 9, 6, 4, 7, 1, 7, 5, 10, 1, 9, 8, 6, 7, 4, 7, 9, 9, 8, 9, 7, 4, 6, 8, 6, 4, 9, 8, 8], 8], "output": 108}, {"inputs": [[6, 5, 3, 1, 9, 4, 3, 8, 3, 2, 7, 3, 8, 2, 8, 6, 5, 2, 8, 8, 1, 6, 4], 4], "output": 42}, {"inputs": [[4, 2, 4, 2, 7, 4, 2, 6, 3, 8, 5, 4, 10, 2, 9, 3, 9, 5, 4, 2, 6, 2, 5, 3, 2, 7, 1, 1, 8, 9, 7, 5, 1, 8, 6, 8], 6], "output": 75}, {"inputs": [[7, 1, 6, 10, 2, 2, 2, 8, 6, 2, 8, 9, 8, 10, 3, 4, 5, 2, 4, 10, 6, 3, 6, 4, 8, 1, 2, 6, 9, 6, 10, 4, 6, 3, 3, 5, 3, 2, 5, 8, 8, 3, 8, 5, 3, 1, 8, 8, 9, 2, 8, 7, 5, 2, 3, 2, 7, 5, 8, 1, 10, 7, 4, 10, 10, 10, 6, 4, 3, 1, 10, 5, 10, 3, 5, 9, 2, 10, 4, 6, 3, 5, 7, 8, 10, 6], 7], "output": 91}, {"inputs": [[6, 10, 7, 10, 6, 7, 7, 4, 4, 7, 2, 2, 3, 6, 4, 8, 4, 6, 4, 3, 1, 4, 4, 8, 7, 1, 10, 2, 10, 8, 10, 1, 4, 7, 10, 5, 1, 9, 8, 3, 5, 8, 3, 7, 6, 5, 3, 1, 3, 2, 8, 5, 6, 1, 5, 10, 8, 7, 7, 10, 1, 3, 7, 3], 2], "output": 21}, {"inputs": [[4, 7, 2, 5, 5, 7, 4, 9, 6, 4, 2, 3, 8, 6, 6, 8, 10, 6, 4, 10, 3, 5, 3, 2, 3, 9, 7, 10, 4, 4], 8], "output": 108}, {"inputs": [[2, 7, 9, 8, 1, 8, 3, 1, 9, 1, 7, 7, 3, 6, 5, 3, 4, 6, 2, 4, 1, 8, 3, 9, 1, 6, 1, 2, 1, 9, 9, 2, 6, 10, 5, 3, 1, 2, 8, 6, 7, 1, 10, 4, 4, 5, 5, 5, 10, 2, 3, 2, 8, 10, 9, 7, 1, 1, 2, 9, 3, 3, 2, 2, 2, 4, 9, 8, 9, 3, 5, 4, 6, 1, 10, 10, 4, 1], 10], "output": 145}, {"inputs": [[5, 6, 3, 2, 10, 9, 2, 9, 2, 8, 9, 8, 2, 1, 8, 4, 9, 4, 6, 2, 7, 9, 1, 10, 6, 10, 7, 3, 9, 2, 9, 10, 7, 10, 10, 4, 4, 10, 5, 4, 10, 3, 4, 2, 8, 9, 9, 3, 4, 5, 6, 9, 9, 2, 7], 5], "output": 60}, {"inputs": [[3, 3, 4, 4, 6, 5, 4, 3, 4, 10, 5, 5, 4], 5], "output": 60}]}} +{"id": "LeetCode/2766", "content": "# Find the Prefix Common Array of Two Arrays\n\nYou are given two **0-indexed** integerpermutations `A` and `B` of length `n`.\n\n\nA **prefix common array** of `A` and `B` is an array `C` such that `C[i]` is equal to the count of numbers that are present at or before the index `i` in both `A` and `B`.\n\n\nReturn *the **prefix common array** of* `A` *and* `B`.\n\n\nA sequence of `n` integers is called a **permutation** if it contains all integers from `1` to `n` exactly once.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** A = [1,3,2,4], B = [3,1,2,4]\n**Output:** [0,2,3,4]\n**Explanation:** At i = 0: no number is common, so C[0] = 0.\nAt i = 1: 1 and 3 are common in A and B, so C[1] = 2.\nAt i = 2: 1, 2, and 3 are common in A and B, so C[2] = 3.\nAt i = 3: 1, 2, 3, and 4 are common in A and B, so C[3] = 4.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** A = [2,3,1], B = [3,1,2]\n**Output:** [0,1,3]\n**Explanation:** At i = 0: no number is common, so C[0] = 0.\nAt i = 1: only 3 is common in A and B, so C[1] = 1.\nAt i = 2: 1, 2, and 3 are common in A and B, so C[2] = 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= A.length == B.length == n <= 50`\n* `1 <= A[i], B[i] <= n`\n* `It is guaranteed that A and B are both a permutation of n integers.`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findThePrefixCommonArray(self, A: List[int], B: List[int]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findThePrefixCommonArray(**[[1, 3, 2, 4], [3, 1, 2, 4]]) == [0, 2, 3, 4]\nassert my_solution.findThePrefixCommonArray(**[[2, 3, 1], [3, 1, 2]]) == [0, 1, 3]\nassert my_solution.findThePrefixCommonArray(**[[1], [1]]) == [1]\nassert my_solution.findThePrefixCommonArray(**[[1, 2], [1, 2]]) == [1, 2]\nassert my_solution.findThePrefixCommonArray(**[[1, 2], [2, 1]]) == [0, 2]\nassert my_solution.findThePrefixCommonArray(**[[2, 1], [1, 2]]) == [0, 2]\nassert my_solution.findThePrefixCommonArray(**[[2, 1], [2, 1]]) == [1, 2]\nassert my_solution.findThePrefixCommonArray(**[[1, 2, 3], [1, 2, 3]]) == [1, 2, 3]\nassert my_solution.findThePrefixCommonArray(**[[1, 2, 3], [2, 1, 3]]) == [0, 2, 3]\nassert my_solution.findThePrefixCommonArray(**[[1, 2, 3], [2, 3, 1]]) == [0, 1, 3]\nassert my_solution.findThePrefixCommonArray(**[[1, 2, 3], [1, 3, 2]]) == [1, 1, 3]\nassert my_solution.findThePrefixCommonArray(**[[1, 2, 3], [3, 1, 2]]) == [0, 1, 3]\nassert my_solution.findThePrefixCommonArray(**[[1, 2, 3], [3, 2, 1]]) == [0, 1, 3]\nassert my_solution.findThePrefixCommonArray(**[[2, 1, 3], [1, 2, 3]]) == [0, 2, 3]\nassert my_solution.findThePrefixCommonArray(**[[2, 1, 3], [2, 1, 3]]) == [1, 2, 3]\nassert my_solution.findThePrefixCommonArray(**[[2, 1, 3], [2, 3, 1]]) == [1, 1, 3]\nassert my_solution.findThePrefixCommonArray(**[[2, 1, 3], [1, 3, 2]]) == [0, 1, 3]\nassert my_solution.findThePrefixCommonArray(**[[2, 1, 3], [3, 1, 2]]) == [0, 1, 3]\nassert my_solution.findThePrefixCommonArray(**[[2, 1, 3], [3, 2, 1]]) == [0, 1, 3]\nassert my_solution.findThePrefixCommonArray(**[[2, 3, 1], [1, 2, 3]]) == [0, 1, 3]\n"}, "labels": {"questionId": "2766", "questionFrontendId": "2657", "questionTitle": "Find the Prefix Common Array of Two Arrays", "stats": {"totalAccepted": "4.7K", "totalSubmission": "5.8K", "totalAcceptedRaw": 4684, "totalSubmissionRaw": 5756, "acRate": "81.4%"}, "probedCases": [{"inputs": [[1, 3, 2, 4], [3, 1, 2, 4]], "output": [0, 2, 3, 4]}, {"inputs": [[2, 3, 1], [3, 1, 2]], "output": [0, 1, 3]}, {"inputs": [[1], [1]], "output": [1]}, {"inputs": [[1, 2], [1, 2]], "output": [1, 2]}, {"inputs": [[1, 2], [2, 1]], "output": [0, 2]}, {"inputs": [[2, 1], [1, 2]], "output": [0, 2]}, {"inputs": [[2, 1], [2, 1]], "output": [1, 2]}, {"inputs": [[1, 2, 3], [1, 2, 3]], "output": [1, 2, 3]}, {"inputs": [[1, 2, 3], [2, 1, 3]], "output": [0, 2, 3]}, {"inputs": [[1, 2, 3], [2, 3, 1]], "output": [0, 1, 3]}, {"inputs": [[1, 2, 3], [1, 3, 2]], "output": [1, 1, 3]}, {"inputs": [[1, 2, 3], [3, 1, 2]], "output": [0, 1, 3]}, {"inputs": [[1, 2, 3], [3, 2, 1]], "output": [0, 1, 3]}, {"inputs": [[2, 1, 3], [1, 2, 3]], "output": [0, 2, 3]}, {"inputs": [[2, 1, 3], [2, 1, 3]], "output": [1, 2, 3]}, {"inputs": [[2, 1, 3], [2, 3, 1]], "output": [1, 1, 3]}, {"inputs": [[2, 1, 3], [1, 3, 2]], "output": [0, 1, 3]}, {"inputs": [[2, 1, 3], [3, 1, 2]], "output": [0, 1, 3]}, {"inputs": [[2, 1, 3], [3, 2, 1]], "output": [0, 1, 3]}, {"inputs": [[2, 3, 1], [1, 2, 3]], "output": [0, 1, 3]}]}} +{"id": "LeetCode/2765", "content": "# Make Array Empty\n\nYou are given an integer array `nums` containing **distinct** numbers, and you can perform the following operations **until the array is empty**:\n\n\n* If the first element has the **smallest** value, remove it\n* Otherwise, put the first element at the **end** of the array.\n\n\nReturn *an integer denoting the number of operations it takes to make* `nums` *empty.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [3,4,-1]\n**Output:** 5\n\n```\n\n\n\n| Operation | Array |\n| --- | --- |\n| 1 | [4, -1, 3] |\n| 2 | [-1, 3, 4] |\n| 3 | [3, 4] |\n| 4 | [4] |\n| 5 | [] |\n\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2,4,3]\n**Output:** 5\n\n```\n\n\n\n| Operation | Array |\n| --- | --- |\n| 1 | [2, 4, 3] |\n| 2 | [4, 3] |\n| 3 | [3, 4] |\n| 4 | [4] |\n| 5 | [] |\n\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [1,2,3]\n**Output:** 3\n\n```\n\n\n\n| Operation | Array |\n| --- | --- |\n| 1 | [2, 3] |\n| 2 | [3] |\n| 3 | [] |\n\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `-109<= nums[i] <= 109`\n* All values in `nums` are **distinct**.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countOperationsToEmptyArray(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countOperationsToEmptyArray(**[[3, 4, -1]]) == 5\nassert my_solution.countOperationsToEmptyArray(**[[1, 2, 4, 3]]) == 5\nassert my_solution.countOperationsToEmptyArray(**[[1, 2, 3]]) == 3\nassert my_solution.countOperationsToEmptyArray(**[[-18]]) == 1\nassert my_solution.countOperationsToEmptyArray(**[[-17]]) == 1\nassert my_solution.countOperationsToEmptyArray(**[[-13]]) == 1\nassert my_solution.countOperationsToEmptyArray(**[[-8]]) == 1\nassert my_solution.countOperationsToEmptyArray(**[[-6]]) == 1\nassert my_solution.countOperationsToEmptyArray(**[[3]]) == 1\nassert my_solution.countOperationsToEmptyArray(**[[14]]) == 1\nassert my_solution.countOperationsToEmptyArray(**[[-20, -6]]) == 2\nassert my_solution.countOperationsToEmptyArray(**[[-19, -11]]) == 2\nassert my_solution.countOperationsToEmptyArray(**[[-17, -18]]) == 3\nassert my_solution.countOperationsToEmptyArray(**[[-10, -1]]) == 2\nassert my_solution.countOperationsToEmptyArray(**[[-10, 10]]) == 2\nassert my_solution.countOperationsToEmptyArray(**[[-9, -10]]) == 3\nassert my_solution.countOperationsToEmptyArray(**[[-3, -4]]) == 3\nassert my_solution.countOperationsToEmptyArray(**[[1, -4]]) == 3\nassert my_solution.countOperationsToEmptyArray(**[[1, 0]]) == 3\nassert my_solution.countOperationsToEmptyArray(**[[5, 18]]) == 2\n"}, "labels": {"questionId": "2765", "questionFrontendId": "2659", "questionTitle": "Make Array Empty", "stats": {"totalAccepted": "2.6K", "totalSubmission": "6.5K", "totalAcceptedRaw": 2564, "totalSubmissionRaw": 6505, "acRate": "39.4%"}, "probedCases": [{"inputs": [[3, 4, -1]], "output": 5}, {"inputs": [[1, 2, 4, 3]], "output": 5}, {"inputs": [[1, 2, 3]], "output": 3}, {"inputs": [[-18]], "output": 1}, {"inputs": [[-17]], "output": 1}, {"inputs": [[-13]], "output": 1}, {"inputs": [[-8]], "output": 1}, {"inputs": [[-6]], "output": 1}, {"inputs": [[3]], "output": 1}, {"inputs": [[14]], "output": 1}, {"inputs": [[-20, -6]], "output": 2}, {"inputs": [[-19, -11]], "output": 2}, {"inputs": [[-17, -18]], "output": 3}, {"inputs": [[-10, -1]], "output": 2}, {"inputs": [[-10, 10]], "output": 2}, {"inputs": [[-9, -10]], "output": 3}, {"inputs": [[-3, -4]], "output": 3}, {"inputs": [[1, -4]], "output": 3}, {"inputs": [[1, 0]], "output": 3}, {"inputs": [[5, 18]], "output": 2}]}} +{"id": "LeetCode/2748", "content": "# Calculate Delayed Arrival Time\n\nYou are given a positive integer `arrivalTime` denoting the arrival time of a train in hours, and another positive integer `delayedTime` denoting the amount of delay in hours.\n\n\nReturn *the time when the train will arrive at the station.*\n\n\nNote that the time in this problem is in 24-hours format.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** arrivalTime = 15, delayedTime = 5 \n**Output:** 20 \n**Explanation:** Arrival time of the train was 15:00 hours. It is delayed by 5 hours. Now it will reach at 15+5 = 20 (20:00 hours).\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** arrivalTime = 13, delayedTime = 11\n**Output:** 0\n**Explanation:** Arrival time of the train was 13:00 hours. It is delayed by 11 hours. Now it will reach at 13+11=24 (Which is denoted by 00:00 in 24 hours format so return 0).\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= arrivaltime < 24`\n* `1 <= delayedTime <= 24`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findDelayedArrivalTime(self, arrivalTime: int, delayedTime: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findDelayedArrivalTime(**[15, 5]) == 20\nassert my_solution.findDelayedArrivalTime(**[13, 11]) == 0\nassert my_solution.findDelayedArrivalTime(**[1, 1]) == 2\nassert my_solution.findDelayedArrivalTime(**[1, 2]) == 3\nassert my_solution.findDelayedArrivalTime(**[1, 3]) == 4\nassert my_solution.findDelayedArrivalTime(**[1, 4]) == 5\nassert my_solution.findDelayedArrivalTime(**[1, 5]) == 6\nassert my_solution.findDelayedArrivalTime(**[1, 6]) == 7\nassert my_solution.findDelayedArrivalTime(**[1, 7]) == 8\nassert my_solution.findDelayedArrivalTime(**[1, 8]) == 9\nassert my_solution.findDelayedArrivalTime(**[1, 9]) == 10\nassert my_solution.findDelayedArrivalTime(**[1, 10]) == 11\nassert my_solution.findDelayedArrivalTime(**[1, 11]) == 12\nassert my_solution.findDelayedArrivalTime(**[1, 12]) == 13\nassert my_solution.findDelayedArrivalTime(**[1, 13]) == 14\nassert my_solution.findDelayedArrivalTime(**[1, 14]) == 15\nassert my_solution.findDelayedArrivalTime(**[1, 15]) == 16\nassert my_solution.findDelayedArrivalTime(**[1, 16]) == 17\nassert my_solution.findDelayedArrivalTime(**[1, 17]) == 18\nassert my_solution.findDelayedArrivalTime(**[1, 18]) == 19\n"}, "labels": {"questionId": "2748", "questionFrontendId": "2651", "questionTitle": "Calculate Delayed Arrival Time", "stats": {"totalAccepted": "40.6K", "totalSubmission": "46.3K", "totalAcceptedRaw": 40577, "totalSubmissionRaw": 46342, "acRate": "87.6%"}, "probedCases": [{"inputs": [15, 5], "output": 20}, {"inputs": [13, 11], "output": 0}, {"inputs": [1, 1], "output": 2}, {"inputs": [1, 2], "output": 3}, {"inputs": [1, 3], "output": 4}, {"inputs": [1, 4], "output": 5}, {"inputs": [1, 5], "output": 6}, {"inputs": [1, 6], "output": 7}, {"inputs": [1, 7], "output": 8}, {"inputs": [1, 8], "output": 9}, {"inputs": [1, 9], "output": 10}, {"inputs": [1, 10], "output": 11}, {"inputs": [1, 11], "output": 12}, {"inputs": [1, 12], "output": 13}, {"inputs": [1, 13], "output": 14}, {"inputs": [1, 14], "output": 15}, {"inputs": [1, 15], "output": 16}, {"inputs": [1, 16], "output": 17}, {"inputs": [1, 17], "output": 18}, {"inputs": [1, 18], "output": 19}]}} +{"id": "LeetCode/2752", "content": "# Sum Multiples\n\nGiven a positive integer `n`, find the sum of all integers in the range `[1, n]` **inclusive** that are divisible by `3`, `5`, or `7`.\n\n\nReturn *an integer denoting the sum of all numbers in the given range satisfying the constraint.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 7\n**Output:** 21\n**Explanation:** Numbers in the range [1, 7] that are divisible by 3, 5, or 7 are 3, 5, 6, 7. The sum of these numbers is 21.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 10\n**Output:** 40\n**Explanation:** Numbers in the range [1, 10] that are divisible by 3, 5, or 7 are 3, 5, 6, 7, 9, 10. The sum of these numbers is 40.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** n = 9\n**Output:** 30\n**Explanation:** Numbers in the range [1, 9] that are divisible by 3, 5, or 7 are 3, 5, 6, 7, 9. The sum of these numbers is 30.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 103`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def sumOfMultiples(self, n: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.sumOfMultiples(**[7]) == 21\nassert my_solution.sumOfMultiples(**[10]) == 40\nassert my_solution.sumOfMultiples(**[9]) == 30\nassert my_solution.sumOfMultiples(**[1]) == 0\nassert my_solution.sumOfMultiples(**[2]) == 0\nassert my_solution.sumOfMultiples(**[3]) == 3\nassert my_solution.sumOfMultiples(**[4]) == 3\nassert my_solution.sumOfMultiples(**[5]) == 8\nassert my_solution.sumOfMultiples(**[6]) == 14\nassert my_solution.sumOfMultiples(**[8]) == 21\nassert my_solution.sumOfMultiples(**[11]) == 40\nassert my_solution.sumOfMultiples(**[12]) == 52\nassert my_solution.sumOfMultiples(**[13]) == 52\nassert my_solution.sumOfMultiples(**[14]) == 66\nassert my_solution.sumOfMultiples(**[15]) == 81\nassert my_solution.sumOfMultiples(**[16]) == 81\nassert my_solution.sumOfMultiples(**[17]) == 81\nassert my_solution.sumOfMultiples(**[18]) == 99\nassert my_solution.sumOfMultiples(**[19]) == 99\nassert my_solution.sumOfMultiples(**[20]) == 119\n"}, "labels": {"questionId": "2752", "questionFrontendId": "2652", "questionTitle": "Sum Multiples", "stats": {"totalAccepted": "38.5K", "totalSubmission": "48.7K", "totalAcceptedRaw": 38545, "totalSubmissionRaw": 48672, "acRate": "79.2%"}, "probedCases": [{"inputs": [7], "output": 21}, {"inputs": [10], "output": 40}, {"inputs": [9], "output": 30}, {"inputs": [1], "output": 0}, {"inputs": [2], "output": 0}, {"inputs": [3], "output": 3}, {"inputs": [4], "output": 3}, {"inputs": [5], "output": 8}, {"inputs": [6], "output": 14}, {"inputs": [8], "output": 21}, {"inputs": [11], "output": 40}, {"inputs": [12], "output": 52}, {"inputs": [13], "output": 52}, {"inputs": [14], "output": 66}, {"inputs": [15], "output": 81}, {"inputs": [16], "output": 81}, {"inputs": [17], "output": 81}, {"inputs": [18], "output": 99}, {"inputs": [19], "output": 99}, {"inputs": [20], "output": 119}]}} +{"id": "LeetCode/2751", "content": "# Sliding Subarray Beauty\n\nGiven an integer array `nums` containing `n` integers, find the **beauty** of each subarray of size `k`.\n\n\nThe **beauty** of a subarray is the `xth` **smallest integer** in the subarray if it is **negative**, or `0` if there are fewer than `x` negative integers.\n\n\nReturn *an integer array containing* `n - k + 1` *integers, which denote the* **beauty** *of the subarrays **in order** from the first index in the array.*\n\n\n* A subarray is a contiguous **non-empty** sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,-1,-3,-2,3], k = 3, x = 2\n**Output:** [-1,-2,-2]\n**Explanation:** There are 3 subarrays with size k = 3. \nThe first subarray is [1, -1, -3] and the 2nd smallest negative integer is -1. \nThe second subarray is [-1, -3, -2] and the 2nd smallest negative integer is -2. \nThe third subarray is [-3, -2, 3] and the 2nd smallest negative integer is -2.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [-1,-2,-3,-4,-5], k = 2, x = 2\n**Output:** [-1,-2,-3,-4]\n**Explanation:** There are 4 subarrays with size k = 2.\nFor [-1, -2], the 2nd smallest negative integer is -1.\nFor [-2, -3], the 2nd smallest negative integer is -2.\nFor [-3, -4], the 2nd smallest negative integer is -3.\nFor [-4, -5], the 2nd smallest negative integer is -4. \n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [-3,1,2,-3,0,-3], k = 2, x = 1\n**Output:** [-3,0,-3,-3,-3]\n**Explanation:** There are 5 subarrays with size k = 2**.**\nFor [-3, 1], the 1st smallest negative integer is -3.\nFor [1, 2], there is no negative integer so the beauty is 0.\nFor [2, -3], the 1st smallest negative integer is -3.\nFor [-3, 0], the 1st smallest negative integer is -3.\nFor [0, -3], the 1st smallest negative integer is -3.\n```\n\n \n\n\n**Constraints:**\n\n\n* `n == nums.length`\n* `1 <= n <= 105`\n* `1 <= k <= n`\n* `1 <= x <= k`\n* `-50 <= nums[i] <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def getSubarrayBeauty(self, nums: List[int], k: int, x: int) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.getSubarrayBeauty(**[[1, -1, -3, -2, 3], 3, 2]) == [-1, -2, -2]\nassert my_solution.getSubarrayBeauty(**[[-1, -2, -3, -4, -5], 2, 2]) == [-1, -2, -3, -4]\nassert my_solution.getSubarrayBeauty(**[[-3, 1, 2, -3, 0, -3], 2, 1]) == [-3, 0, -3, -3, -3]\nassert my_solution.getSubarrayBeauty(**[[-43], 1, 1]) == [-43]\nassert my_solution.getSubarrayBeauty(**[[-26], 1, 1]) == [-26]\nassert my_solution.getSubarrayBeauty(**[[-22], 1, 1]) == [-22]\nassert my_solution.getSubarrayBeauty(**[[-20], 1, 1]) == [-20]\nassert my_solution.getSubarrayBeauty(**[[-19], 1, 1]) == [-19]\nassert my_solution.getSubarrayBeauty(**[[-18], 1, 1]) == [-18]\nassert my_solution.getSubarrayBeauty(**[[-17], 1, 1]) == [-17]\nassert my_solution.getSubarrayBeauty(**[[-15], 1, 1]) == [-15]\nassert my_solution.getSubarrayBeauty(**[[-2], 1, 1]) == [-2]\nassert my_solution.getSubarrayBeauty(**[[5], 1, 1]) == [0]\nassert my_solution.getSubarrayBeauty(**[[7], 1, 1]) == [0]\nassert my_solution.getSubarrayBeauty(**[[14], 1, 1]) == [0]\nassert my_solution.getSubarrayBeauty(**[[16], 1, 1]) == [0]\nassert my_solution.getSubarrayBeauty(**[[19], 1, 1]) == [0]\nassert my_solution.getSubarrayBeauty(**[[20], 1, 1]) == [0]\nassert my_solution.getSubarrayBeauty(**[[23], 1, 1]) == [0]\nassert my_solution.getSubarrayBeauty(**[[27], 1, 1]) == [0]\n"}, "labels": {"questionId": "2751", "questionFrontendId": "2653", "questionTitle": "Sliding Subarray Beauty", "stats": {"totalAccepted": "5.9K", "totalSubmission": "16.2K", "totalAcceptedRaw": 5917, "totalSubmissionRaw": 16235, "acRate": "36.4%"}, "probedCases": [{"inputs": [[1, -1, -3, -2, 3], 3, 2], "output": [-1, -2, -2]}, {"inputs": [[-1, -2, -3, -4, -5], 2, 2], "output": [-1, -2, -3, -4]}, {"inputs": [[-3, 1, 2, -3, 0, -3], 2, 1], "output": [-3, 0, -3, -3, -3]}, {"inputs": [[-43], 1, 1], "output": [-43]}, {"inputs": [[-26], 1, 1], "output": [-26]}, {"inputs": [[-22], 1, 1], "output": [-22]}, {"inputs": [[-20], 1, 1], "output": [-20]}, {"inputs": [[-19], 1, 1], "output": [-19]}, {"inputs": [[-18], 1, 1], "output": [-18]}, {"inputs": [[-17], 1, 1], "output": [-17]}, {"inputs": [[-15], 1, 1], "output": [-15]}, {"inputs": [[-2], 1, 1], "output": [-2]}, {"inputs": [[5], 1, 1], "output": [0]}, {"inputs": [[7], 1, 1], "output": [0]}, {"inputs": [[14], 1, 1], "output": [0]}, {"inputs": [[16], 1, 1], "output": [0]}, {"inputs": [[19], 1, 1], "output": [0]}, {"inputs": [[20], 1, 1], "output": [0]}, {"inputs": [[23], 1, 1], "output": [0]}, {"inputs": [[27], 1, 1], "output": [0]}]}} +{"id": "LeetCode/2753", "content": "# Minimum Number of Operations to Make All Array Elements Equal to 1\n\nYou are given a **0-indexed** array `nums` consisiting of **positive** integers. You can do the following operation on the array **any** number of times:\n\n\n* Select an index `i` such that `0 <= i < n - 1` and replace either of `nums[i]` or `nums[i+1]` with their gcd value.\n\n\nReturn *the **minimum** number of operations to make all elements of* `nums` *equal to* `1`. If it is impossible, return `-1`.\n\n\nThe gcd of two integers is the greatest common divisor of the two integers.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,6,3,4]\n**Output:** 4\n**Explanation:** We can do the following operations:\n- Choose index i = 2 and replace nums[2] with gcd(3,4) = 1. Now we have nums = [2,6,1,4].\n- Choose index i = 1 and replace nums[1] with gcd(6,1) = 1. Now we have nums = [2,1,1,4].\n- Choose index i = 0 and replace nums[0] with gcd(2,1) = 1. Now we have nums = [1,1,1,4].\n- Choose index i = 2 and replace nums[3] with gcd(1,4) = 1. Now we have nums = [1,1,1,1].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,10,6,14]\n**Output:** -1\n**Explanation:** It can be shown that it is impossible to make all the elements equal to 1.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= nums.length <= 50`\n* `1 <= nums[i] <= 106`\n\n\n \n\n\n**Follow-up:**\n\n\nThe `O(n)` time complexity solution works, but could you find an `O(1)` constant time complexity solution?\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minOperations(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minOperations(**[[2, 6, 3, 4]]) == 4\nassert my_solution.minOperations(**[[2, 10, 6, 14]]) == -1\nassert my_solution.minOperations(**[[410193, 229980, 600441]]) == -1\nassert my_solution.minOperations(**[[6, 10, 15]]) == 4\nassert my_solution.minOperations(**[[4, 2, 6, 3]]) == 5\nassert my_solution.minOperations(**[[48841, 93382, 993143, 170438, 48860, 174356, 291531]]) == 7\nassert my_solution.minOperations(**[[565053, 324050, 845500, 764459, 693331, 849602, 379407]]) == 7\nassert my_solution.minOperations(**[[404514, 309109, 640464, 451473, 954489, 240704, 730484, 888313, 126885]]) == 9\nassert my_solution.minOperations(**[[432320, 571622, 553142, 152985, 127988, 46098, 850399, 251987, 660091]]) == 9\nassert my_solution.minOperations(**[[266354, 828118, 333704, 385834]]) == -1\nassert my_solution.minOperations(**[[715086, 420033, 320095, 230175, 359910, 99010, 261428, 561978, 495675, 817898]]) == 10\nassert my_solution.minOperations(**[[846237, 105643, 71480, 567494, 315367, 503911, 836510, 984966, 748650]]) == 9\nassert my_solution.minOperations(**[[591723, 60746, 374246, 765639, 97358, 188339, 225788, 155868]]) == 8\nassert my_solution.minOperations(**[[780304, 789919, 873587, 158393, 298420, 624934, 660252, 787804]]) == 8\nassert my_solution.minOperations(**[[184432, 604193, 195562, 660134, 410026, 780971, 446702, 401480, 567049, 647296, 32815, 819020]]) == 12\nassert my_solution.minOperations(**[[358771, 577201, 359849, 457987, 710497, 21300, 955067, 665670, 180408, 650137, 997097, 677290]]) == 12\nassert my_solution.minOperations(**[[811340, 393975, 627577, 26811, 209797, 500958, 637753, 592871, 449081, 216228, 498803, 730546, 937075, 122352, 610619, 921594, 47754, 242342, 726157]]) == 19\nassert my_solution.minOperations(**[[985732, 437182, 281370, 204922, 295879, 239067, 105852, 967432, 24512, 977516, 566875, 507422, 988409, 155892]]) == 14\nassert my_solution.minOperations(**[[61934, 478887, 397567, 718200, 461668, 936276, 802169, 833144, 749931, 807386, 109400, 501586, 423875, 877463, 26894, 352687, 755053]]) == 17\nassert my_solution.minOperations(**[[865937, 351065, 864096, 504664, 698592, 630262, 38706, 159959, 198626, 161672, 931247, 719751, 722377, 561747, 937783, 835190, 748284]]) == 17\n"}, "labels": {"questionId": "2753", "questionFrontendId": "2654", "questionTitle": "Minimum Number of Operations to Make All Array Elements Equal to 1", "stats": {"totalAccepted": "3.9K", "totalSubmission": "9.6K", "totalAcceptedRaw": 3885, "totalSubmissionRaw": 9607, "acRate": "40.4%"}, "probedCases": [{"inputs": [[2, 6, 3, 4]], "output": 4}, {"inputs": [[2, 10, 6, 14]], "output": -1}, {"inputs": [[410193, 229980, 600441]], "output": -1}, {"inputs": [[6, 10, 15]], "output": 4}, {"inputs": [[4, 2, 6, 3]], "output": 5}, {"inputs": [[48841, 93382, 993143, 170438, 48860, 174356, 291531]], "output": 7}, {"inputs": [[565053, 324050, 845500, 764459, 693331, 849602, 379407]], "output": 7}, {"inputs": [[404514, 309109, 640464, 451473, 954489, 240704, 730484, 888313, 126885]], "output": 9}, {"inputs": [[432320, 571622, 553142, 152985, 127988, 46098, 850399, 251987, 660091]], "output": 9}, {"inputs": [[266354, 828118, 333704, 385834]], "output": -1}, {"inputs": [[715086, 420033, 320095, 230175, 359910, 99010, 261428, 561978, 495675, 817898]], "output": 10}, {"inputs": [[846237, 105643, 71480, 567494, 315367, 503911, 836510, 984966, 748650]], "output": 9}, {"inputs": [[591723, 60746, 374246, 765639, 97358, 188339, 225788, 155868]], "output": 8}, {"inputs": [[780304, 789919, 873587, 158393, 298420, 624934, 660252, 787804]], "output": 8}, {"inputs": [[184432, 604193, 195562, 660134, 410026, 780971, 446702, 401480, 567049, 647296, 32815, 819020]], "output": 12}, {"inputs": [[358771, 577201, 359849, 457987, 710497, 21300, 955067, 665670, 180408, 650137, 997097, 677290]], "output": 12}, {"inputs": [[811340, 393975, 627577, 26811, 209797, 500958, 637753, 592871, 449081, 216228, 498803, 730546, 937075, 122352, 610619, 921594, 47754, 242342, 726157]], "output": 19}, {"inputs": [[985732, 437182, 281370, 204922, 295879, 239067, 105852, 967432, 24512, 977516, 566875, 507422, 988409, 155892]], "output": 14}, {"inputs": [[61934, 478887, 397567, 718200, 461668, 936276, 802169, 833144, 749931, 807386, 109400, 501586, 423875, 877463, 26894, 352687, 755053]], "output": 17}, {"inputs": [[865937, 351065, 864096, 504664, 698592, 630262, 38706, 159959, 198626, 161672, 931247, 719751, 722377, 561747, 937783, 835190, 748284]], "output": 17}]}} +{"id": "LeetCode/2737", "content": "# Row With Maximum Ones\n\nGiven a `m x n` binary matrix `mat`, find the **0-indexed** position of the row that contains the **maximum** count of **ones,** and the number of ones in that row.\n\n\nIn case there are multiple rows that have the maximum count of ones, the row with the **smallest row number** should be selected.\n\n\nReturn *an array containing the index of the row, and the number of ones in it.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** mat = [[0,1],[1,0]]\n**Output:** [0,1]\n**Explanation:** Both rows have the same number of 1's. So we return the index of the smaller row, 0, and the maximum count of ones (1). So, the answer is [0,1]. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** mat = [[0,0,0],[0,1,1]]\n**Output:** [1,2]\n**Explanation:** The row indexed 1 has the maximum count of ones (2). So we return its index, 1, and the count. So, the answer is [1,2].\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** mat = [[0,0],[1,1],[0,0]]\n**Output:** [1,2]\n**Explanation:** The row indexed 1 has the maximum count of ones (2). So the answer is [1,2].\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `m == mat.length`\n* `n == mat[i].length`\n* `1 <= m, n <= 100`\n* `mat[i][j]` is either `0` or `1`.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def rowAndMaximumOnes(self, mat: List[List[int]]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.rowAndMaximumOnes(**[[[0, 1], [1, 0]]]) == [0, 1]\nassert my_solution.rowAndMaximumOnes(**[[[0, 0, 0], [0, 1, 1]]]) == [1, 2]\nassert my_solution.rowAndMaximumOnes(**[[[0, 0], [1, 1], [0, 0]]]) == [1, 2]\nassert my_solution.rowAndMaximumOnes(**[[[1]]]) == [0, 1]\nassert my_solution.rowAndMaximumOnes(**[[[0], [0]]]) == [0, 0]\nassert my_solution.rowAndMaximumOnes(**[[[0, 1]]]) == [0, 1]\nassert my_solution.rowAndMaximumOnes(**[[[0], [1], [1]]]) == [1, 1]\nassert my_solution.rowAndMaximumOnes(**[[[1, 0, 0]]]) == [0, 1]\nassert my_solution.rowAndMaximumOnes(**[[[0], [1], [0], [0]]]) == [1, 1]\nassert my_solution.rowAndMaximumOnes(**[[[0], [1], [1], [0]]]) == [1, 1]\nassert my_solution.rowAndMaximumOnes(**[[[0, 0], [0, 1]]]) == [1, 1]\nassert my_solution.rowAndMaximumOnes(**[[[0, 0], [1, 1]]]) == [1, 2]\nassert my_solution.rowAndMaximumOnes(**[[[0, 0, 0, 0]]]) == [0, 0]\nassert my_solution.rowAndMaximumOnes(**[[[0, 1], [1, 1]]]) == [1, 2]\nassert my_solution.rowAndMaximumOnes(**[[[1, 0, 1, 1]]]) == [0, 3]\nassert my_solution.rowAndMaximumOnes(**[[[1, 1], [0, 1]]]) == [0, 2]\nassert my_solution.rowAndMaximumOnes(**[[[1, 1, 0, 0]]]) == [0, 2]\nassert my_solution.rowAndMaximumOnes(**[[[0], [1], [0], [0], [0]]]) == [1, 1]\nassert my_solution.rowAndMaximumOnes(**[[[0], [1], [1], [1], [0]]]) == [1, 1]\nassert my_solution.rowAndMaximumOnes(**[[[1], [0], [0], [0], [0]]]) == [0, 1]\n"}, "labels": {"questionId": "2737", "questionFrontendId": "2643", "questionTitle": "Row With Maximum Ones", "stats": {"totalAccepted": "9.8K", "totalSubmission": "12.3K", "totalAcceptedRaw": 9834, "totalSubmissionRaw": 12289, "acRate": "80.0%"}, "probedCases": [{"inputs": [[[0, 1], [1, 0]]], "output": [0, 1]}, {"inputs": [[[0, 0, 0], [0, 1, 1]]], "output": [1, 2]}, {"inputs": [[[0, 0], [1, 1], [0, 0]]], "output": [1, 2]}, {"inputs": [[[1]]], "output": [0, 1]}, {"inputs": [[[0], [0]]], "output": [0, 0]}, {"inputs": [[[0, 1]]], "output": [0, 1]}, {"inputs": [[[0], [1], [1]]], "output": [1, 1]}, {"inputs": [[[1, 0, 0]]], "output": [0, 1]}, {"inputs": [[[0], [1], [0], [0]]], "output": [1, 1]}, {"inputs": [[[0], [1], [1], [0]]], "output": [1, 1]}, {"inputs": [[[0, 0], [0, 1]]], "output": [1, 1]}, {"inputs": [[[0, 0], [1, 1]]], "output": [1, 2]}, {"inputs": [[[0, 0, 0, 0]]], "output": [0, 0]}, {"inputs": [[[0, 1], [1, 1]]], "output": [1, 2]}, {"inputs": [[[1, 0, 1, 1]]], "output": [0, 3]}, {"inputs": [[[1, 1], [0, 1]]], "output": [0, 2]}, {"inputs": [[[1, 1, 0, 0]]], "output": [0, 2]}, {"inputs": [[[0], [1], [0], [0], [0]]], "output": [1, 1]}, {"inputs": [[[0], [1], [1], [1], [0]]], "output": [1, 1]}, {"inputs": [[[1], [0], [0], [0], [0]]], "output": [0, 1]}]}} +{"id": "LeetCode/2736", "content": "# Minimum Additions to Make Valid String\n\nGiven a string `word` to which you can insert letters \"a\", \"b\" or \"c\" anywhere and any number of times, return *the minimum number of letters that must be inserted so that `word` becomes **valid**.*\n\n\nA string is called **valid** if it can be formed by concatenating the string \"abc\" several times.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** word = \"b\"\n**Output:** 2\n**Explanation:** Insert the letter \"a\" right before \"b\", and the letter \"c\" right next to \"a\" to obtain the valid string \"**a**b**c**\".\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** word = \"aaa\"\n**Output:** 6\n**Explanation:** Insert letters \"b\" and \"c\" next to each \"a\" to obtain the valid string \"a**bc**a**bc**a**bc**\".\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** word = \"abc\"\n**Output:** 0\n**Explanation:** word is already valid. No modifications are needed. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= word.length <= 50`\n* `word` consists of letters \"a\", \"b\" and \"c\" only.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def addMinimum(self, word: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.addMinimum(**['b']) == 2\nassert my_solution.addMinimum(**['aaa']) == 6\nassert my_solution.addMinimum(**['abc']) == 0\nassert my_solution.addMinimum(**['a']) == 2\nassert my_solution.addMinimum(**['aa']) == 4\nassert my_solution.addMinimum(**['aaaa']) == 8\nassert my_solution.addMinimum(**['aaaaa']) == 10\nassert my_solution.addMinimum(**['aaaaaa']) == 12\nassert my_solution.addMinimum(**['aaaaab']) == 9\nassert my_solution.addMinimum(**['aaaaac']) == 9\nassert my_solution.addMinimum(**['aaaab']) == 7\nassert my_solution.addMinimum(**['aaaaba']) == 9\nassert my_solution.addMinimum(**['aaaabb']) == 9\nassert my_solution.addMinimum(**['aaaabc']) == 6\nassert my_solution.addMinimum(**['aaaac']) == 7\nassert my_solution.addMinimum(**['aaaaca']) == 9\nassert my_solution.addMinimum(**['aaaacb']) == 9\nassert my_solution.addMinimum(**['aaaacc']) == 9\nassert my_solution.addMinimum(**['aaab']) == 5\nassert my_solution.addMinimum(**['aaaba']) == 7\n"}, "labels": {"questionId": "2736", "questionFrontendId": "2645", "questionTitle": "Minimum Additions to Make Valid String", "stats": {"totalAccepted": "27.9K", "totalSubmission": "41.4K", "totalAcceptedRaw": 27943, "totalSubmissionRaw": 41421, "acRate": "67.5%"}, "probedCases": [{"inputs": ["b"], "output": 2}, {"inputs": ["aaa"], "output": 6}, {"inputs": ["abc"], "output": 0}, {"inputs": ["a"], "output": 2}, {"inputs": ["aa"], "output": 4}, {"inputs": ["aaaa"], "output": 8}, {"inputs": ["aaaaa"], "output": 10}, {"inputs": ["aaaaaa"], "output": 12}, {"inputs": ["aaaaab"], "output": 9}, {"inputs": ["aaaaac"], "output": 9}, {"inputs": ["aaaab"], "output": 7}, {"inputs": ["aaaaba"], "output": 9}, {"inputs": ["aaaabb"], "output": 9}, {"inputs": ["aaaabc"], "output": 6}, {"inputs": ["aaaac"], "output": 7}, {"inputs": ["aaaaca"], "output": 9}, {"inputs": ["aaaacb"], "output": 9}, {"inputs": ["aaaacc"], "output": 9}, {"inputs": ["aaab"], "output": 5}, {"inputs": ["aaaba"], "output": 7}]}} +{"id": "LeetCode/2675", "content": "# Find the Width of Columns of a Grid\n\nYou are given a **0-indexed** `m x n` integer matrix `grid`. The width of a column is the maximum **length** of its integers.\n\n\n* For example, if `grid = [[-10], [3], [12]]`, the width of the only column is `3` since `-10` is of length `3`.\n\n\nReturn *an integer array* `ans` *of size* `n` *where* `ans[i]` *is the width of the* `ith` *column*.\n\n\nThe **length** of an integer `x` with `len` digits is equal to `len` if `x` is non-negative, and `len + 1` otherwise.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** grid = [[1],[22],[333]]\n**Output:** [3]\n**Explanation:** In the 0th column, 333 is of length 3.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** grid = [[-15,1,3],[15,7,12],[5,6,-2]]\n**Output:** [3,1,2]\n**Explanation:** \nIn the 0th column, only -15 is of length 3.\nIn the 1st column, all integers are of length 1. \nIn the 2nd column, both 12 and -2 are of length 2.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `m == grid.length`\n* `n == grid[i].length`\n* `1 <= m, n <= 100`\n* `-109 <= grid[r][c] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findColumnWidth(self, grid: List[List[int]]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findColumnWidth(**[[[1], [22], [333]]]) == [3]\nassert my_solution.findColumnWidth(**[[[-15, 1, 3], [15, 7, 12], [5, 6, -2]]]) == [3, 1, 2]\nassert my_solution.findColumnWidth(**[[[0]]]) == [1]\nassert my_solution.findColumnWidth(**[[[0], [0], [0]]]) == [1]\nassert my_solution.findColumnWidth(**[[[0, 0, 0], [0, 0, 0], [0, 0, 0]]]) == [1, 1, 1]\nassert my_solution.findColumnWidth(**[[[0, 3, 0], [2, 3, 0], [1, 3, 0]]]) == [1, 1, 1]\nassert my_solution.findColumnWidth(**[[[-39, -5, -93], [-87, -69, 28], [-88, 25, 23]]]) == [3, 3, 3]\nassert my_solution.findColumnWidth(**[[[37, 86, -11], [85, -65, 83], [69, -93, 52]]]) == [2, 3, 3]\nassert my_solution.findColumnWidth(**[[[93, -20, -4], [6, -20, -19]]]) == [2, 3, 3]\nassert my_solution.findColumnWidth(**[[[-19, -67, -92], [38, -47, -1]]]) == [3, 3, 3]\nassert my_solution.findColumnWidth(**[[[-90, -89, -51]]]) == [3, 3, 3]\nassert my_solution.findColumnWidth(**[[[31, 100, -6], [10, 0, 68], [-42, -37, -36]]]) == [3, 3, 3]\nassert my_solution.findColumnWidth(**[[[73, -24, 41], [-23, 44, -88], [91, -22, 19]]]) == [3, 3, 3]\nassert my_solution.findColumnWidth(**[[[-22, -77, 76], [48, -46, 81]]]) == [3, 3, 2]\nassert my_solution.findColumnWidth(**[[[-34, -87, -54], [46, 98, 82], [-3, -99, -64]]]) == [3, 3, 3]\nassert my_solution.findColumnWidth(**[[[-92, 24, 81], [-20, -20, -14]]]) == [3, 3, 3]\nassert my_solution.findColumnWidth(**[[[-4, 0, -1, 3, 9, 8, 6], [-2, 5, -5, -7, -2, -6, 7], [4, -4, 1, 7, 0, 6, 8], [-6, 2, -5, 0, 9, 1, -6]]]) == [2, 2, 2, 2, 2, 2, 2]\nassert my_solution.findColumnWidth(**[[[51, 84, 31, 44, -22, -70], [71, -37, -33, -48, -97, -32], [18, 95, -62, -63, 5, 63], [-18, -41, -58, -25, -17, -26], [67, -96, -77, 80, 59, -71], [-15, 20, -72, -27, 3, -97], [66, -1, 5, 80, 57, -58]]]) == [3, 3, 3, 3, 3, 3]\nassert my_solution.findColumnWidth(**[[[325, -483, 796, 121], [-757, -920, -928, 783], [73, -136, 628, -724], [979, 224, -39, -884], [-612, -304, 259, 378], [7, 335, -650, -131], [-351, -104, 640, -258]]]) == [4, 4, 4, 4]\nassert my_solution.findColumnWidth(**[[[2911, -805, 5477, -3349, 163, -6644], [4851, 2990, 2578, 1124, 2897, -1781], [-2153, 1774, -8238, -2894, 4845, 9608]]]) == [5, 4, 5, 5, 4, 5]\n"}, "labels": {"questionId": "2675", "questionFrontendId": "2639", "questionTitle": "Find the Width of Columns of a Grid", "stats": {"totalAccepted": "5.5K", "totalSubmission": "7.2K", "totalAcceptedRaw": 5466, "totalSubmissionRaw": 7171, "acRate": "76.2%"}, "probedCases": [{"inputs": [[[1], [22], [333]]], "output": [3]}, {"inputs": [[[-15, 1, 3], [15, 7, 12], [5, 6, -2]]], "output": [3, 1, 2]}, {"inputs": [[[0]]], "output": [1]}, {"inputs": [[[0], [0], [0]]], "output": [1]}, {"inputs": [[[0, 0, 0], [0, 0, 0], [0, 0, 0]]], "output": [1, 1, 1]}, {"inputs": [[[0, 3, 0], [2, 3, 0], [1, 3, 0]]], "output": [1, 1, 1]}, {"inputs": [[[-39, -5, -93], [-87, -69, 28], [-88, 25, 23]]], "output": [3, 3, 3]}, {"inputs": [[[37, 86, -11], [85, -65, 83], [69, -93, 52]]], "output": [2, 3, 3]}, {"inputs": [[[93, -20, -4], [6, -20, -19]]], "output": [2, 3, 3]}, {"inputs": [[[-19, -67, -92], [38, -47, -1]]], "output": [3, 3, 3]}, {"inputs": [[[-90, -89, -51]]], "output": [3, 3, 3]}, {"inputs": [[[31, 100, -6], [10, 0, 68], [-42, -37, -36]]], "output": [3, 3, 3]}, {"inputs": [[[73, -24, 41], [-23, 44, -88], [91, -22, 19]]], "output": [3, 3, 3]}, {"inputs": [[[-22, -77, 76], [48, -46, 81]]], "output": [3, 3, 2]}, {"inputs": [[[-34, -87, -54], [46, 98, 82], [-3, -99, -64]]], "output": [3, 3, 3]}, {"inputs": [[[-92, 24, 81], [-20, -20, -14]]], "output": [3, 3, 3]}, {"inputs": [[[-4, 0, -1, 3, 9, 8, 6], [-2, 5, -5, -7, -2, -6, 7], [4, -4, 1, 7, 0, 6, 8], [-6, 2, -5, 0, 9, 1, -6]]], "output": [2, 2, 2, 2, 2, 2, 2]}, {"inputs": [[[51, 84, 31, 44, -22, -70], [71, -37, -33, -48, -97, -32], [18, 95, -62, -63, 5, 63], [-18, -41, -58, -25, -17, -26], [67, -96, -77, 80, 59, -71], [-15, 20, -72, -27, 3, -97], [66, -1, 5, 80, 57, -58]]], "output": [3, 3, 3, 3, 3, 3]}, {"inputs": [[[325, -483, 796, 121], [-757, -920, -928, 783], [73, -136, 628, -724], [979, 224, -39, -884], [-612, -304, 259, 378], [7, 335, -650, -131], [-351, -104, 640, -258]]], "output": [4, 4, 4, 4]}, {"inputs": [[[2911, -805, 5477, -3349, 163, -6644], [4851, 2990, 2578, 1124, 2897, -1781], [-2153, 1774, -8238, -2894, 4845, 9608]]], "output": [5, 4, 5, 5, 4, 5]}]}} +{"id": "LeetCode/2676", "content": "# Find the Score of All Prefixes of an Array\n\nWe define the **conversion array** `conver` of an array `arr` as follows:\n\n\n* `conver[i] = arr[i] + max(arr[0..i])` where `max(arr[0..i])` is the maximum value of `arr[j]` over `0 <= j <= i`.\n\n\nWe also define the **score** of an array `arr` as the sum of the values of the conversion array of `arr`.\n\n\nGiven a **0-indexed** integer array `nums` of length `n`, return *an array* `ans` *of length* `n` *where* `ans[i]` *is the score of the prefix* `nums[0..i]`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,3,7,5,10]\n**Output:** [4,10,24,36,56]\n**Explanation:** \nFor the prefix [2], the conversion array is [4] hence the score is 4\nFor the prefix [2, 3], the conversion array is [4, 6] hence the score is 10\nFor the prefix [2, 3, 7], the conversion array is [4, 6, 14] hence the score is 24\nFor the prefix [2, 3, 7, 5], the conversion array is [4, 6, 14, 12] hence the score is 36\nFor the prefix [2, 3, 7, 5, 10], the conversion array is [4, 6, 14, 12, 20] hence the score is 56\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,1,2,4,8,16]\n**Output:** [2,4,8,16,32,64]\n**Explanation:** \nFor the prefix [1], the conversion array is [2] hence the score is 2\nFor the prefix [1, 1], the conversion array is [2, 2] hence the score is 4\nFor the prefix [1, 1, 2], the conversion array is [2, 2, 4] hence the score is 8\nFor the prefix [1, 1, 2, 4], the conversion array is [2, 2, 4, 8] hence the score is 16\nFor the prefix [1, 1, 2, 4, 8], the conversion array is [2, 2, 4, 8, 16] hence the score is 32\nFor the prefix [1, 1, 2, 4, 8, 16], the conversion array is [2, 2, 4, 8, 16, 32] hence the score is 64\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findPrefixScore(self, nums: List[int]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findPrefixScore(**[[2, 3, 7, 5, 10]]) == [4, 10, 24, 36, 56]\nassert my_solution.findPrefixScore(**[[1, 1, 2, 4, 8, 16]]) == [2, 4, 8, 16, 32, 64]\nassert my_solution.findPrefixScore(**[[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]) == [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]\nassert my_solution.findPrefixScore(**[[1, 2, 3, 4, 4, 5, 6, 7, 7, 9]]) == [2, 6, 12, 20, 28, 38, 50, 64, 78, 96]\nassert my_solution.findPrefixScore(**[[17, 17, 12, 14, 13, 8, 8, 9, 10, 18, 10, 18, 10]]) == [34, 68, 97, 128, 158, 183, 208, 234, 261, 297, 325, 361, 389]\nassert my_solution.findPrefixScore(**[[1, 2, 2, 3, 3, 4, 5, 6, 7, 9, 10, 10, 13, 15, 15, 17, 18, 19, 19]]) == [2, 6, 10, 16, 22, 30, 40, 52, 66, 84, 104, 124, 150, 180, 210, 244, 280, 318, 356]\nassert my_solution.findPrefixScore(**[[16, 11, 11, 11, 19, 6, 6]]) == [32, 59, 86, 113, 151, 176, 201]\nassert my_solution.findPrefixScore(**[[3, 4, 5, 6, 8, 18, 8, 9, 13, 14, 15, 16, 19, 17]]) == [6, 14, 24, 36, 52, 88, 114, 141, 172, 204, 237, 271, 309, 345]\nassert my_solution.findPrefixScore(**[[19, 19, 17, 18, 10, 4, 8, 9, 7, 1, 9, 15, 5, 5]]) == [38, 76, 112, 149, 178, 201, 228, 256, 282, 302, 330, 364, 388, 412]\nassert my_solution.findPrefixScore(**[[1, 1, 3, 4, 4, 6, 8, 13, 15, 20, 10, 10, 10, 11, 11, 11]]) == [2, 4, 10, 18, 26, 38, 54, 80, 110, 150, 180, 210, 240, 271, 302, 333]\nassert my_solution.findPrefixScore(**[[14, 5, 20, 16, 2, 7, 11, 20, 16, 6, 14, 11, 14, 12, 13]]) == [28, 47, 87, 123, 145, 172, 203, 243, 279, 305, 339, 370, 404, 436, 469]\nassert my_solution.findPrefixScore(**[[4, 7, 9, 13, 10, 11, 13, 13, 13, 15, 16]]) == [8, 22, 40, 66, 89, 113, 139, 165, 191, 221, 253]\nassert my_solution.findPrefixScore(**[[17, 4, 2, 12, 1, 13, 4, 10, 18, 4, 20, 15]]) == [34, 55, 74, 103, 121, 151, 172, 199, 235, 257, 297, 332]\nassert my_solution.findPrefixScore(**[[1, 10, 1, 4, 7, 8, 9, 10, 11, 11, 13, 13, 18, 18, 19]]) == [2, 22, 33, 47, 64, 82, 101, 121, 143, 165, 191, 217, 253, 289, 327]\nassert my_solution.findPrefixScore(**[[137381902, 583670185, 232449799, 615240518, 692364261, 339595728, 193558230, 477734537, 408666227, 180093966, 73374595, 401827223, 544402033, 460199809, 967906902, 609720313, 20713685, 466223557, 187038791, 821463819, 44138353, 62610391, 286485490, 475645586, 570010342, 772864005, 789886761, 582447818, 449215930, 79498550, 880611913, 498198623, 98223903, 297927296, 929528075, 151612343, 718714067, 441682283, 950308227, 509793041, 310411982, 271303282, 402560714, 831564217, 492421656, 775074730, 462574919, 266050840, 411725032, 692603442, 88005551, 129970833, 314440283, 513936108, 97431418, 1824470, 655637394, 970780627, 611143448, 77750843]]) == [274763804, 1442104174, 2258224158, 3488705194, 4873433716, 5905393705, 6791316196, 7961414994, 9062445482, 9934903709, 10700642565, 11794834049, 13031600343, 14184164413, 16119978217, 17697605432, 18686226019, 20120356478, 21275302171, 23064672892, 24076718147, 25107235440, 26361627832, 27805180320, 29343097564, 31083868471, 32841662134, 34392016854, 35809139686, 36856545138, 38705063953, 40171169478, 41237300283, 42503134481, 44400569458, 45520088703, 47206709672, 48616298857, 50534513986, 52012213929, 53290532813, 54529742997, 55900210613, 57699681732, 59160010290, 60902991922, 62333473743, 63567431485, 64947063419, 66607573763, 67663486216, 68761363951, 70043711136, 71525554146, 72590892466, 73560623838, 75184168134, 77125729388, 78707653463, 79756184933]\nassert my_solution.findPrefixScore(**[[6323811, 79572964, 99819319, 116527461, 252969478, 734202001, 768031890, 275629005, 295208024, 300512356, 774174207, 776414850, 324278225, 325669533, 339685144, 344126938, 354257474, 357663761, 785925759, 409599439, 411493331, 411868239, 418994259, 467549310, 473094964, 474356043, 786916001, 492642181, 513725623, 552811199, 564725797, 609568459, 614155833, 650995194, 666504049, 666570226, 681144888, 802839692, 803839457, 817466286, 865861102, 901104443, 909938938, 930974107, 932485893, 942075928, 945153455]]) == [12647622, 171793550, 371432188, 604487110, 1110426066, 2578830068, 4114893848, 5158554743, 6221794657, 7290338903, 8838687317, 10391517017, 11492210092, 12594294475, 13710394469, 14830936257, 15961608581, 17095687192, 18667538710, 19863063908, 21060482998, 22258276996, 23463197014, 24716672083, 25975692806, 27235974608, 28809806610, 30089364792, 31390006416, 32729733616, 34081375414, 35477859874, 36878931708, 38316842903, 39770262953, 41223749180, 42691810069, 44297489453, 45905168367, 47540100939, 49271823143, 51074032029, 52893909905, 54755858119, 56620829905, 58504981761, 60395288671]\nassert my_solution.findPrefixScore(**[[912705716, 575045775, 842980131, 861696884, 35893066, 718910479, 72407171, 997631254, 79059851, 416271367, 883775650, 938430994, 338917901, 114596964, 340203807, 150198912, 30187442, 764854446, 638934453, 793648833, 510828034, 229378477, 260323819, 235640587, 182404249, 258016807, 185734475, 661736104, 216762865, 100089712, 643410455, 333678461, 786762411, 784277429, 965427354, 581108075, 385832853, 223920291, 40146986, 208043879, 964977390, 19122210, 27160212, 244394005, 161764012, 914158357, 546136995, 620226375, 378935324, 44097215, 240478137, 259568095, 717400508, 624350543, 429767030, 584705735, 484675838, 813698385, 129834979, 290304382, 419289756, 82443486, 730817933, 619694027, 238415126, 946179865, 900451442, 639115282, 471625414, 226743798, 197708087]]) == [1825411432, 3313162923, 5068848770, 6843251370, 7791850152, 9423466347, 10408579234, 12403841742, 13480532847, 14894435468, 16775842372, 18711904620, 20048453775, 21160681993, 22498517054, 23646347220, 24674165916, 26436651616, 28073217323, 29864497410, 31372956698, 32599966429, 33857921502, 35091193343, 36271228846, 37526876907, 38710242636, 40369609994, 41584004113, 42681725079, 44322766788, 45654076503, 47438470168, 49220378851, 51183437459, 52762176788, 54145640895, 55367192440, 56404970680, 57610645813, 59573254457, 60590007921, 61614799387, 62856824646, 64016219912, 65928009523, 67471777772, 69089635401, 70466201979, 71507930448, 72746039839, 74003239188, 75718270950, 77340252747, 78767651031, 80349988020, 81832295112, 83643624751, 84771090984, 86059026620, 87475947630, 88556022370, 90284471557, 91901796838, 93137843218, 95081654337, 96979737033, 98616483569, 100085740237, 101310115289, 102505454630]\nassert my_solution.findPrefixScore(**[[3138043, 10118896, 20615117, 30593213, 459455345, 494353317, 499748454, 45499138, 502289017, 47920608, 74431736, 507203378, 81752610, 82273380, 85123623, 85585241, 101128713, 102515302, 116945350, 129535560, 140743225, 161843305, 178322627, 184234971, 198230513, 241766391, 292965859, 296182011, 300573681, 529676129, 329981128, 333242100, 340963464, 346255493, 352937907, 403183104, 404156500, 407870687, 531622767, 546963584, 409839743, 458713770, 459360127, 570199596, 597626326, 611355574, 615986973, 618897446, 633373057, 634126267, 647865781, 666021433, 673382547, 679764938, 682550883, 695371081, 704063923, 709571374, 716414187, 721281404, 730079901, 732190737, 779875662, 800036065, 800387729, 808362934, 808729325, 821953324, 840969230, 842767395, 846560706, 848918206, 898002991, 917392740, 928951096, 937710329, 942274746, 959414870, 962277091, 967604721, 973531030, 979986890, 990923329, 994192368]]) == [6276086, 26513878, 67744112, 128930538, 1047841228, 2036547862, 3036044770, 3581292362, 4585870396, 5136080021, 5712800774, 6727207530, 7316163518, 7905640276, 8497967277, 9090755896, 9699087987, 10308806667, 10932955395, 11569694333, 12217640936, 12886687619, 13572213624, 14263651973, 14969085864, 15718055633, 16518224870, 17321610259, 18129387318, 19188739576, 20048396833, 20911315062, 21781954655, 22657886277, 23540500313, 24473359546, 25407192175, 26344738991, 27407984525, 28501911693, 29458715020, 30464392374, 31470716085, 32611115277, 33806367929, 35029079077, 36261053023, 37498847915, 38765594029, 40033846563, 41329578125, 42661620991, 44008386085, 45367915961, 46733017727, 48123759889, 49531887735, 50951030483, 52383858857, 53826421665, 55286581467, 56750962941, 58310714265, 59910786395, 61511561853, 63128287721, 64745746371, 66389653019, 68071591479, 69757126269, 71450247681, 73148084093, 74944090075, 76778875555, 78636777747, 80512198405, 82396747897, 84315577637, 86240131819, 88175341261, 90122403321, 92082377101, 94064223759, 96052608495]\nassert my_solution.findPrefixScore(**[[21306416, 60858267, 584491691, 763910832, 714955473, 306550820, 978211504, 45074731, 100579324, 338213826, 472730617, 783589786, 299653553, 856295657, 348531635, 287703108, 636900930, 274010222, 169427242, 646452329, 371283335, 67875725, 254422734, 74278731, 89696341, 481510120, 799744770, 33114030, 798044444, 947703892, 761847671, 946993175, 479640462, 580235512, 107647706, 899383122]]) == [42612832, 164329366, 1333312748, 2861134412, 4340000717, 5410462369, 7366885377, 8390171612, 9468962440, 10785387770, 12236329891, 13998131181, 15275996238, 17110503399, 18437246538, 19703161150, 21318273584, 22570495310, 23718134056, 25342797889, 26692292728, 27738379957, 28971014195, 30023504430, 31091412275, 32551133899, 34329090173, 35340415707, 37116671655, 39042587051, 40782646226, 42707850905, 44165702871, 45724149887, 46810009097, 48687603723]\nassert my_solution.findPrefixScore(**[[13068671, 58631465, 82995068, 747632243, 84754528, 780141794, 85760974, 95415849, 96063111, 794468933, 104157025, 120428033, 128353233, 129996780, 154986311, 158408595, 169300405, 183923883, 188372631, 193585413, 212073371, 214591544, 219917916, 230526897, 242412365, 257100776, 262411342, 317098963, 817944385, 829760100, 323045560, 351369756, 857211784, 359477270, 862020949, 362584212, 392532059, 403061145, 409781318, 419963598, 430155971, 430655397, 431444770, 441575051, 468545749, 477549122, 479916471, 491241257, 538491062, 541303593, 863083653, 542065562, 548608594, 867799985, 587681610, 622873901, 675014570, 677303011, 686864370, 693187954, 741713748, 868283808, 876284627, 744701638, 902489996, 907773691, 914539198, 948282447, 996132761]]) == [26137342, 143400272, 309390408, 1804654894, 2637041665, 4197325253, 5063228021, 5938785664, 6814990569, 8403928435, 9302554393, 10217451359, 11140273525, 12064739238, 13014194482, 13967072010, 14930841348, 15909234164, 16892075728, 17880130074, 18886672378, 19895732855, 20910119704, 21935115534, 22971996832, 24023566541, 25080446816, 26192014712, 27827903482, 29487423682, 30640229342, 31821359198, 33535782766, 34752471820, 36476513718, 37701118879, 38955671887, 40220753981, 41492556248, 42774540795, 44066717715, 45359394061, 46652859780, 47956455780, 49287022478, 50626592549, 51968529969, 53321792175, 54722304186, 56125628728, 57851796034, 59256945249, 60668637496, 62404237466, 63859719061, 65350392947, 66893207502, 68438310498, 69992974853, 71553962792, 73163476525, 74900044141, 76652613395, 78273599660, 80078579652, 81894127034, 83723205430, 85619770324, 87612035846]\n"}, "labels": {"questionId": "2676", "questionFrontendId": "2640", "questionTitle": "Find the Score of All Prefixes of an Array", "stats": {"totalAccepted": "5.3K", "totalSubmission": "6.7K", "totalAcceptedRaw": 5263, "totalSubmissionRaw": 6705, "acRate": "78.5%"}, "probedCases": [{"inputs": [[2, 3, 7, 5, 10]], "output": [4, 10, 24, 36, 56]}, {"inputs": [[1, 1, 2, 4, 8, 16]], "output": [2, 4, 8, 16, 32, 64]}, {"inputs": [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], "output": [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]}, {"inputs": [[1, 2, 3, 4, 4, 5, 6, 7, 7, 9]], "output": [2, 6, 12, 20, 28, 38, 50, 64, 78, 96]}, {"inputs": [[17, 17, 12, 14, 13, 8, 8, 9, 10, 18, 10, 18, 10]], "output": [34, 68, 97, 128, 158, 183, 208, 234, 261, 297, 325, 361, 389]}, {"inputs": [[1, 2, 2, 3, 3, 4, 5, 6, 7, 9, 10, 10, 13, 15, 15, 17, 18, 19, 19]], "output": [2, 6, 10, 16, 22, 30, 40, 52, 66, 84, 104, 124, 150, 180, 210, 244, 280, 318, 356]}, {"inputs": [[16, 11, 11, 11, 19, 6, 6]], "output": [32, 59, 86, 113, 151, 176, 201]}, {"inputs": [[3, 4, 5, 6, 8, 18, 8, 9, 13, 14, 15, 16, 19, 17]], "output": [6, 14, 24, 36, 52, 88, 114, 141, 172, 204, 237, 271, 309, 345]}, {"inputs": [[19, 19, 17, 18, 10, 4, 8, 9, 7, 1, 9, 15, 5, 5]], "output": [38, 76, 112, 149, 178, 201, 228, 256, 282, 302, 330, 364, 388, 412]}, {"inputs": [[1, 1, 3, 4, 4, 6, 8, 13, 15, 20, 10, 10, 10, 11, 11, 11]], "output": [2, 4, 10, 18, 26, 38, 54, 80, 110, 150, 180, 210, 240, 271, 302, 333]}, {"inputs": [[14, 5, 20, 16, 2, 7, 11, 20, 16, 6, 14, 11, 14, 12, 13]], "output": [28, 47, 87, 123, 145, 172, 203, 243, 279, 305, 339, 370, 404, 436, 469]}, {"inputs": [[4, 7, 9, 13, 10, 11, 13, 13, 13, 15, 16]], "output": [8, 22, 40, 66, 89, 113, 139, 165, 191, 221, 253]}, {"inputs": [[17, 4, 2, 12, 1, 13, 4, 10, 18, 4, 20, 15]], "output": [34, 55, 74, 103, 121, 151, 172, 199, 235, 257, 297, 332]}, {"inputs": [[1, 10, 1, 4, 7, 8, 9, 10, 11, 11, 13, 13, 18, 18, 19]], "output": [2, 22, 33, 47, 64, 82, 101, 121, 143, 165, 191, 217, 253, 289, 327]}, {"inputs": [[137381902, 583670185, 232449799, 615240518, 692364261, 339595728, 193558230, 477734537, 408666227, 180093966, 73374595, 401827223, 544402033, 460199809, 967906902, 609720313, 20713685, 466223557, 187038791, 821463819, 44138353, 62610391, 286485490, 475645586, 570010342, 772864005, 789886761, 582447818, 449215930, 79498550, 880611913, 498198623, 98223903, 297927296, 929528075, 151612343, 718714067, 441682283, 950308227, 509793041, 310411982, 271303282, 402560714, 831564217, 492421656, 775074730, 462574919, 266050840, 411725032, 692603442, 88005551, 129970833, 314440283, 513936108, 97431418, 1824470, 655637394, 970780627, 611143448, 77750843]], "output": [274763804, 1442104174, 2258224158, 3488705194, 4873433716, 5905393705, 6791316196, 7961414994, 9062445482, 9934903709, 10700642565, 11794834049, 13031600343, 14184164413, 16119978217, 17697605432, 18686226019, 20120356478, 21275302171, 23064672892, 24076718147, 25107235440, 26361627832, 27805180320, 29343097564, 31083868471, 32841662134, 34392016854, 35809139686, 36856545138, 38705063953, 40171169478, 41237300283, 42503134481, 44400569458, 45520088703, 47206709672, 48616298857, 50534513986, 52012213929, 53290532813, 54529742997, 55900210613, 57699681732, 59160010290, 60902991922, 62333473743, 63567431485, 64947063419, 66607573763, 67663486216, 68761363951, 70043711136, 71525554146, 72590892466, 73560623838, 75184168134, 77125729388, 78707653463, 79756184933]}, {"inputs": [[6323811, 79572964, 99819319, 116527461, 252969478, 734202001, 768031890, 275629005, 295208024, 300512356, 774174207, 776414850, 324278225, 325669533, 339685144, 344126938, 354257474, 357663761, 785925759, 409599439, 411493331, 411868239, 418994259, 467549310, 473094964, 474356043, 786916001, 492642181, 513725623, 552811199, 564725797, 609568459, 614155833, 650995194, 666504049, 666570226, 681144888, 802839692, 803839457, 817466286, 865861102, 901104443, 909938938, 930974107, 932485893, 942075928, 945153455]], "output": [12647622, 171793550, 371432188, 604487110, 1110426066, 2578830068, 4114893848, 5158554743, 6221794657, 7290338903, 8838687317, 10391517017, 11492210092, 12594294475, 13710394469, 14830936257, 15961608581, 17095687192, 18667538710, 19863063908, 21060482998, 22258276996, 23463197014, 24716672083, 25975692806, 27235974608, 28809806610, 30089364792, 31390006416, 32729733616, 34081375414, 35477859874, 36878931708, 38316842903, 39770262953, 41223749180, 42691810069, 44297489453, 45905168367, 47540100939, 49271823143, 51074032029, 52893909905, 54755858119, 56620829905, 58504981761, 60395288671]}, {"inputs": [[912705716, 575045775, 842980131, 861696884, 35893066, 718910479, 72407171, 997631254, 79059851, 416271367, 883775650, 938430994, 338917901, 114596964, 340203807, 150198912, 30187442, 764854446, 638934453, 793648833, 510828034, 229378477, 260323819, 235640587, 182404249, 258016807, 185734475, 661736104, 216762865, 100089712, 643410455, 333678461, 786762411, 784277429, 965427354, 581108075, 385832853, 223920291, 40146986, 208043879, 964977390, 19122210, 27160212, 244394005, 161764012, 914158357, 546136995, 620226375, 378935324, 44097215, 240478137, 259568095, 717400508, 624350543, 429767030, 584705735, 484675838, 813698385, 129834979, 290304382, 419289756, 82443486, 730817933, 619694027, 238415126, 946179865, 900451442, 639115282, 471625414, 226743798, 197708087]], "output": [1825411432, 3313162923, 5068848770, 6843251370, 7791850152, 9423466347, 10408579234, 12403841742, 13480532847, 14894435468, 16775842372, 18711904620, 20048453775, 21160681993, 22498517054, 23646347220, 24674165916, 26436651616, 28073217323, 29864497410, 31372956698, 32599966429, 33857921502, 35091193343, 36271228846, 37526876907, 38710242636, 40369609994, 41584004113, 42681725079, 44322766788, 45654076503, 47438470168, 49220378851, 51183437459, 52762176788, 54145640895, 55367192440, 56404970680, 57610645813, 59573254457, 60590007921, 61614799387, 62856824646, 64016219912, 65928009523, 67471777772, 69089635401, 70466201979, 71507930448, 72746039839, 74003239188, 75718270950, 77340252747, 78767651031, 80349988020, 81832295112, 83643624751, 84771090984, 86059026620, 87475947630, 88556022370, 90284471557, 91901796838, 93137843218, 95081654337, 96979737033, 98616483569, 100085740237, 101310115289, 102505454630]}, {"inputs": [[3138043, 10118896, 20615117, 30593213, 459455345, 494353317, 499748454, 45499138, 502289017, 47920608, 74431736, 507203378, 81752610, 82273380, 85123623, 85585241, 101128713, 102515302, 116945350, 129535560, 140743225, 161843305, 178322627, 184234971, 198230513, 241766391, 292965859, 296182011, 300573681, 529676129, 329981128, 333242100, 340963464, 346255493, 352937907, 403183104, 404156500, 407870687, 531622767, 546963584, 409839743, 458713770, 459360127, 570199596, 597626326, 611355574, 615986973, 618897446, 633373057, 634126267, 647865781, 666021433, 673382547, 679764938, 682550883, 695371081, 704063923, 709571374, 716414187, 721281404, 730079901, 732190737, 779875662, 800036065, 800387729, 808362934, 808729325, 821953324, 840969230, 842767395, 846560706, 848918206, 898002991, 917392740, 928951096, 937710329, 942274746, 959414870, 962277091, 967604721, 973531030, 979986890, 990923329, 994192368]], "output": [6276086, 26513878, 67744112, 128930538, 1047841228, 2036547862, 3036044770, 3581292362, 4585870396, 5136080021, 5712800774, 6727207530, 7316163518, 7905640276, 8497967277, 9090755896, 9699087987, 10308806667, 10932955395, 11569694333, 12217640936, 12886687619, 13572213624, 14263651973, 14969085864, 15718055633, 16518224870, 17321610259, 18129387318, 19188739576, 20048396833, 20911315062, 21781954655, 22657886277, 23540500313, 24473359546, 25407192175, 26344738991, 27407984525, 28501911693, 29458715020, 30464392374, 31470716085, 32611115277, 33806367929, 35029079077, 36261053023, 37498847915, 38765594029, 40033846563, 41329578125, 42661620991, 44008386085, 45367915961, 46733017727, 48123759889, 49531887735, 50951030483, 52383858857, 53826421665, 55286581467, 56750962941, 58310714265, 59910786395, 61511561853, 63128287721, 64745746371, 66389653019, 68071591479, 69757126269, 71450247681, 73148084093, 74944090075, 76778875555, 78636777747, 80512198405, 82396747897, 84315577637, 86240131819, 88175341261, 90122403321, 92082377101, 94064223759, 96052608495]}, {"inputs": [[21306416, 60858267, 584491691, 763910832, 714955473, 306550820, 978211504, 45074731, 100579324, 338213826, 472730617, 783589786, 299653553, 856295657, 348531635, 287703108, 636900930, 274010222, 169427242, 646452329, 371283335, 67875725, 254422734, 74278731, 89696341, 481510120, 799744770, 33114030, 798044444, 947703892, 761847671, 946993175, 479640462, 580235512, 107647706, 899383122]], "output": [42612832, 164329366, 1333312748, 2861134412, 4340000717, 5410462369, 7366885377, 8390171612, 9468962440, 10785387770, 12236329891, 13998131181, 15275996238, 17110503399, 18437246538, 19703161150, 21318273584, 22570495310, 23718134056, 25342797889, 26692292728, 27738379957, 28971014195, 30023504430, 31091412275, 32551133899, 34329090173, 35340415707, 37116671655, 39042587051, 40782646226, 42707850905, 44165702871, 45724149887, 46810009097, 48687603723]}, {"inputs": [[13068671, 58631465, 82995068, 747632243, 84754528, 780141794, 85760974, 95415849, 96063111, 794468933, 104157025, 120428033, 128353233, 129996780, 154986311, 158408595, 169300405, 183923883, 188372631, 193585413, 212073371, 214591544, 219917916, 230526897, 242412365, 257100776, 262411342, 317098963, 817944385, 829760100, 323045560, 351369756, 857211784, 359477270, 862020949, 362584212, 392532059, 403061145, 409781318, 419963598, 430155971, 430655397, 431444770, 441575051, 468545749, 477549122, 479916471, 491241257, 538491062, 541303593, 863083653, 542065562, 548608594, 867799985, 587681610, 622873901, 675014570, 677303011, 686864370, 693187954, 741713748, 868283808, 876284627, 744701638, 902489996, 907773691, 914539198, 948282447, 996132761]], "output": [26137342, 143400272, 309390408, 1804654894, 2637041665, 4197325253, 5063228021, 5938785664, 6814990569, 8403928435, 9302554393, 10217451359, 11140273525, 12064739238, 13014194482, 13967072010, 14930841348, 15909234164, 16892075728, 17880130074, 18886672378, 19895732855, 20910119704, 21935115534, 22971996832, 24023566541, 25080446816, 26192014712, 27827903482, 29487423682, 30640229342, 31821359198, 33535782766, 34752471820, 36476513718, 37701118879, 38955671887, 40220753981, 41492556248, 42774540795, 44066717715, 45359394061, 46652859780, 47956455780, 49287022478, 50626592549, 51968529969, 53321792175, 54722304186, 56125628728, 57851796034, 59256945249, 60668637496, 62404237466, 63859719061, 65350392947, 66893207502, 68438310498, 69992974853, 71553962792, 73163476525, 74900044141, 76652613395, 78273599660, 80078579652, 81894127034, 83723205430, 85619770324, 87612035846]}]}} +{"id": "LeetCode/2721", "content": "# Sum of Distances\n\nYou are given a **0-indexed** integer array `nums`. There exists an array `arr` of length `nums.length`, where `arr[i]` is the sum of `|i - j|` over all `j` such that `nums[j] == nums[i]` and `j != i`. If there is no such `j`, set `arr[i]` to be `0`.\n\n\nReturn *the array* `arr`*.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,3,1,1,2]\n**Output:** [5,0,3,4,0]\n**Explanation:** \nWhen i = 0, nums[0] == nums[2] and nums[0] == nums[3]. Therefore, arr[0] = |0 - 2| + |0 - 3| = 5. \nWhen i = 1, arr[1] = 0 because there is no other index with value 3.\nWhen i = 2, nums[2] == nums[0] and nums[2] == nums[3]. Therefore, arr[2] = |2 - 0| + |2 - 3| = 3. \nWhen i = 3, nums[3] == nums[0] and nums[3] == nums[2]. Therefore, arr[3] = |3 - 0| + |3 - 2| = 4. \nWhen i = 4, arr[4] = 0 because there is no other index with value 2. \n\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [0,5,3]\n**Output:** [0,0,0]\n**Explanation:** Since each element in nums is distinct, arr[i] = 0 for all i.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `0 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def distance(self, nums: List[int]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.distance(**[[1, 3, 1, 1, 2]]) == [5, 0, 3, 4, 0]\nassert my_solution.distance(**[[0, 5, 3]]) == [0, 0, 0]\nassert my_solution.distance(**[[2, 0, 2, 2, 6, 5, 2]]) == [11, 0, 7, 7, 0, 0, 13]\nassert my_solution.distance(**[[0, 5, 3, 1, 2, 8, 6, 6, 6]]) == [0, 0, 0, 0, 0, 0, 3, 2, 3]\nassert my_solution.distance(**[[1]]) == [0]\nassert my_solution.distance(**[[6, 1, 3, 3, 4, 3, 4]]) == [0, 0, 4, 3, 2, 5, 2]\nassert my_solution.distance(**[[3, 2, 0, 2]]) == [0, 2, 0, 2]\nassert my_solution.distance(**[[2, 7, 2, 5, 2, 5, 4]]) == [6, 0, 4, 2, 6, 2, 0]\nassert my_solution.distance(**[[3, 3, 0, 2]]) == [1, 1, 0, 0]\nassert my_solution.distance(**[[1, 2, 4, 2]]) == [0, 2, 0, 2]\nassert my_solution.distance(**[[1, 5, 2, 2]]) == [0, 0, 1, 1]\nassert my_solution.distance(**[[0, 6, 3, 1, 0, 1, 2]]) == [4, 0, 0, 2, 4, 2, 0]\nassert my_solution.distance(**[[0, 1]]) == [0, 0]\nassert my_solution.distance(**[[0]]) == [0]\nassert my_solution.distance(**[[1, 2, 2, 3, 3, 0]]) == [0, 1, 1, 1, 1, 0]\nassert my_solution.distance(**[[7, 9, 4, 0, 2, 2, 0, 8, 5]]) == [0, 0, 0, 3, 1, 1, 3, 0, 0]\nassert my_solution.distance(**[[5, 5, 3, 2, 5, 5]]) == [10, 8, 0, 0, 8, 10]\nassert my_solution.distance(**[[4, 2, 3, 3, 8, 3]]) == [0, 0, 4, 3, 0, 5]\nassert my_solution.distance(**[[3, 0, 3, 5, 0, 0, 7, 7]]) == [2, 7, 2, 0, 4, 5, 1, 1]\nassert my_solution.distance(**[[7, 4, 9, 1, 8, 5, 5, 7, 2, 6, 5]]) == [7, 0, 0, 0, 0, 6, 5, 7, 0, 0, 9]\n"}, "labels": {"questionId": "2721", "questionFrontendId": "2615", "questionTitle": "Sum of Distances", "stats": {"totalAccepted": "6.1K", "totalSubmission": "16.8K", "totalAcceptedRaw": 6110, "totalSubmissionRaw": 16839, "acRate": "36.3%"}, "probedCases": [{"inputs": [[1, 3, 1, 1, 2]], "output": [5, 0, 3, 4, 0]}, {"inputs": [[0, 5, 3]], "output": [0, 0, 0]}, {"inputs": [[2, 0, 2, 2, 6, 5, 2]], "output": [11, 0, 7, 7, 0, 0, 13]}, {"inputs": [[0, 5, 3, 1, 2, 8, 6, 6, 6]], "output": [0, 0, 0, 0, 0, 0, 3, 2, 3]}, {"inputs": [[1]], "output": [0]}, {"inputs": [[6, 1, 3, 3, 4, 3, 4]], "output": [0, 0, 4, 3, 2, 5, 2]}, {"inputs": [[3, 2, 0, 2]], "output": [0, 2, 0, 2]}, {"inputs": [[2, 7, 2, 5, 2, 5, 4]], "output": [6, 0, 4, 2, 6, 2, 0]}, {"inputs": [[3, 3, 0, 2]], "output": [1, 1, 0, 0]}, {"inputs": [[1, 2, 4, 2]], "output": [0, 2, 0, 2]}, {"inputs": [[1, 5, 2, 2]], "output": [0, 0, 1, 1]}, {"inputs": [[0, 6, 3, 1, 0, 1, 2]], "output": [4, 0, 0, 2, 4, 2, 0]}, {"inputs": [[0, 1]], "output": [0, 0]}, {"inputs": [[0]], "output": [0]}, {"inputs": [[1, 2, 2, 3, 3, 0]], "output": [0, 1, 1, 1, 1, 0]}, {"inputs": [[7, 9, 4, 0, 2, 2, 0, 8, 5]], "output": [0, 0, 0, 3, 1, 1, 3, 0, 0]}, {"inputs": [[5, 5, 3, 2, 5, 5]], "output": [10, 8, 0, 0, 8, 10]}, {"inputs": [[4, 2, 3, 3, 8, 3]], "output": [0, 0, 4, 3, 0, 5]}, {"inputs": [[3, 0, 3, 5, 0, 0, 7, 7]], "output": [2, 7, 2, 0, 4, 5, 1, 1]}, {"inputs": [[7, 4, 9, 1, 8, 5, 5, 7, 2, 6, 5]], "output": [7, 0, 0, 0, 0, 6, 5, 7, 0, 0, 9]}]}} +{"id": "LeetCode/2720", "content": "# Minimize the Maximum Difference of Pairs\n\nYou are given a **0-indexed** integer array `nums` and an integer `p`. Find `p` pairs of indices of `nums` such that the **maximum** difference amongst all the pairs is **minimized**. Also, ensure no index appears more than once amongst the `p` pairs.\n\n\nNote that for a pair of elements at the index `i` and `j`, the difference of this pair is `|nums[i] - nums[j]|`, where `|x|` represents the **absolute** **value** of `x`.\n\n\nReturn *the **minimum** **maximum** difference among all* `p` *pairs.* We define the maximum of an empty set to be zero.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [10,1,2,7,1,3], p = 2\n**Output:** 1\n**Explanation:** The first pair is formed from the indices 1 and 4, and the second pair is formed from the indices 2 and 5. \nThe maximum difference is max(|nums[1] - nums[4]|, |nums[2] - nums[5]|) = max(0, 1) = 1. Therefore, we return 1.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [4,2,1,2], p = 1\n**Output:** 0\n**Explanation:** Let the indices 1 and 3 form a pair. The difference of that pair is |2 - 2| = 0, which is the minimum we can attain.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `0 <= nums[i] <= 109`\n* `0 <= p <= (nums.length)/2`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimizeMax(self, nums: List[int], p: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimizeMax(**[[10, 1, 2, 7, 1, 3], 2]) == 1\nassert my_solution.minimizeMax(**[[4, 2, 1, 2], 1]) == 0\nassert my_solution.minimizeMax(**[[4, 0, 2, 1, 2, 5, 5, 3], 3]) == 1\nassert my_solution.minimizeMax(**[[0, 5, 3, 4], 0]) == 0\nassert my_solution.minimizeMax(**[[4, 1, 3, 3, 0, 4, 3], 1]) == 0\nassert my_solution.minimizeMax(**[[3, 4, 1, 2, 1], 2]) == 1\nassert my_solution.minimizeMax(**[[3, 6, 8, 7, 5, 4, 9, 5], 0]) == 0\nassert my_solution.minimizeMax(**[[5, 6, 0, 5, 4, 0, 0], 1]) == 0\nassert my_solution.minimizeMax(**[[8, 9, 1, 5, 4, 3, 6, 4, 3, 7], 4]) == 1\nassert my_solution.minimizeMax(**[[3, 3, 5, 1, 0, 5, 6, 6], 4]) == 1\nassert my_solution.minimizeMax(**[[5, 10, 6, 9, 12, 3, 8, 1, 3, 0, 7], 3]) == 1\nassert my_solution.minimizeMax(**[[3, 1, 5, 0, 3], 0]) == 0\nassert my_solution.minimizeMax(**[[2, 2, 0, 2, 0], 2]) == 0\nassert my_solution.minimizeMax(**[[3, 4, 2, 3, 2, 1, 2], 3]) == 1\nassert my_solution.minimizeMax(**[[4, 2, 8, 0, 0, 0, 3, 5, 4], 0]) == 0\nassert my_solution.minimizeMax(**[[3, 11, 4, 3, 5, 7, 4, 4, 5, 5], 3]) == 0\nassert my_solution.minimizeMax(**[[1, 2], 1]) == 1\nassert my_solution.minimizeMax(**[[2, 6, 2, 4, 2, 2, 0, 2], 4]) == 2\nassert my_solution.minimizeMax(**[[2, 6, 2, 2, 4, 2, 1, 1], 0]) == 0\nassert my_solution.minimizeMax(**[[0, 4, 4, 6, 5, 5, 0, 3], 0]) == 0\n"}, "labels": {"questionId": "2720", "questionFrontendId": "2616", "questionTitle": "Minimize the Maximum Difference of Pairs", "stats": {"totalAccepted": "4.7K", "totalSubmission": "11.4K", "totalAcceptedRaw": 4690, "totalSubmissionRaw": 11401, "acRate": "41.1%"}, "probedCases": [{"inputs": [[10, 1, 2, 7, 1, 3], 2], "output": 1}, {"inputs": [[4, 2, 1, 2], 1], "output": 0}, {"inputs": [[4, 0, 2, 1, 2, 5, 5, 3], 3], "output": 1}, {"inputs": [[0, 5, 3, 4], 0], "output": 0}, {"inputs": [[4, 1, 3, 3, 0, 4, 3], 1], "output": 0}, {"inputs": [[3, 4, 1, 2, 1], 2], "output": 1}, {"inputs": [[3, 6, 8, 7, 5, 4, 9, 5], 0], "output": 0}, {"inputs": [[5, 6, 0, 5, 4, 0, 0], 1], "output": 0}, {"inputs": [[8, 9, 1, 5, 4, 3, 6, 4, 3, 7], 4], "output": 1}, {"inputs": [[3, 3, 5, 1, 0, 5, 6, 6], 4], "output": 1}, {"inputs": [[5, 10, 6, 9, 12, 3, 8, 1, 3, 0, 7], 3], "output": 1}, {"inputs": [[3, 1, 5, 0, 3], 0], "output": 0}, {"inputs": [[2, 2, 0, 2, 0], 2], "output": 0}, {"inputs": [[3, 4, 2, 3, 2, 1, 2], 3], "output": 1}, {"inputs": [[4, 2, 8, 0, 0, 0, 3, 5, 4], 0], "output": 0}, {"inputs": [[3, 11, 4, 3, 5, 7, 4, 4, 5, 5], 3], "output": 0}, {"inputs": [[1, 2], 1], "output": 1}, {"inputs": [[2, 6, 2, 4, 2, 2, 0, 2], 4], "output": 2}, {"inputs": [[2, 6, 2, 2, 4, 2, 1, 1], 0], "output": 0}, {"inputs": [[0, 4, 4, 6, 5, 5, 0, 3], 0], "output": 0}]}} +{"id": "LeetCode/2723", "content": "# Find the Longest Balanced Substring of a Binary String\n\nYou are given a binary string `s` consisting only of zeroes and ones.\n\n\nA substring of `s` is considered balanced if **all zeroes are before ones** and the number of zeroes is equal to the number of ones inside the substring. Notice that the empty substring is considered a balanced substring.\n\n\nReturn *the length of the longest balanced substring of* `s`.\n\n\nA **substring** is a contiguous sequence of characters within a string.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"01000111\"\n**Output:** 6\n**Explanation:** The longest balanced substring is \"000111\", which has length 6.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"00111\"\n**Output:** 4\n**Explanation:** The longest balanced substring is \"0011\", which has length 4. \n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"111\"\n**Output:** 0\n**Explanation:** There is no balanced substring except the empty substring, so the answer is 0.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 50`\n* `'0' <= s[i] <= '1'`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findTheLongestBalancedSubstring(self, s: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findTheLongestBalancedSubstring(**['01000111']) == 6\nassert my_solution.findTheLongestBalancedSubstring(**['0011']) == 4\nassert my_solution.findTheLongestBalancedSubstring(**['111']) == 0\nassert my_solution.findTheLongestBalancedSubstring(**['0']) == 0\nassert my_solution.findTheLongestBalancedSubstring(**['1']) == 0\nassert my_solution.findTheLongestBalancedSubstring(**['00']) == 0\nassert my_solution.findTheLongestBalancedSubstring(**['01']) == 2\nassert my_solution.findTheLongestBalancedSubstring(**['10']) == 0\nassert my_solution.findTheLongestBalancedSubstring(**['11']) == 0\nassert my_solution.findTheLongestBalancedSubstring(**['000']) == 0\nassert my_solution.findTheLongestBalancedSubstring(**['001']) == 2\nassert my_solution.findTheLongestBalancedSubstring(**['010']) == 2\nassert my_solution.findTheLongestBalancedSubstring(**['011']) == 2\nassert my_solution.findTheLongestBalancedSubstring(**['100']) == 0\nassert my_solution.findTheLongestBalancedSubstring(**['101']) == 2\nassert my_solution.findTheLongestBalancedSubstring(**['110']) == 0\nassert my_solution.findTheLongestBalancedSubstring(**['0000']) == 0\nassert my_solution.findTheLongestBalancedSubstring(**['0001']) == 2\nassert my_solution.findTheLongestBalancedSubstring(**['0010']) == 2\nassert my_solution.findTheLongestBalancedSubstring(**['0100']) == 2\n"}, "labels": {"questionId": "2723", "questionFrontendId": "2609", "questionTitle": "Find the Longest Balanced Substring of a Binary String", "stats": {"totalAccepted": "33.5K", "totalSubmission": "57.9K", "totalAcceptedRaw": 33474, "totalSubmissionRaw": 57912, "acRate": "57.8%"}, "probedCases": [{"inputs": ["01000111"], "output": 6}, {"inputs": ["0011"], "output": 4}, {"inputs": ["111"], "output": 0}, {"inputs": ["0"], "output": 0}, {"inputs": ["1"], "output": 0}, {"inputs": ["00"], "output": 0}, {"inputs": ["01"], "output": 2}, {"inputs": ["10"], "output": 0}, {"inputs": ["11"], "output": 0}, {"inputs": ["000"], "output": 0}, {"inputs": ["001"], "output": 2}, {"inputs": ["010"], "output": 2}, {"inputs": ["011"], "output": 2}, {"inputs": ["100"], "output": 0}, {"inputs": ["101"], "output": 2}, {"inputs": ["110"], "output": 0}, {"inputs": ["0000"], "output": 0}, {"inputs": ["0001"], "output": 2}, {"inputs": ["0010"], "output": 2}, {"inputs": ["0100"], "output": 2}]}} +{"id": "LeetCode/2724", "content": "# Convert an Array Into a 2D Array With Conditions\n\nYou are given an integer array `nums`. You need to create a 2D array from `nums` satisfying the following conditions:\n\n\n* The 2D array should contain **only** the elements of the array `nums`.\n* Each row in the 2D array contains **distinct** integers.\n* The number of rows in the 2D array should be **minimal**.\n\n\nReturn *the resulting array*. If there are multiple answers, return any of them.\n\n\n**Note** that the 2D array can have a different number of elements on each row.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,3,4,1,2,3,1]\n**Output:** [[1,3,4,2],[1,3],[1]]\n**Explanation:** We can create a 2D array that contains the following rows:\n- 1,3,4,2\n- 1,3\n- 1\nAll elements of nums were used, and each row of the 2D array contains distinct integers, so it is a valid answer.\nIt can be shown that we cannot have less than 3 rows in a valid array.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4]\n**Output:** [[4,3,2,1]]\n**Explanation:** All elements of the array are distinct, so we can keep all of them in the first row of the 2D array.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 200`\n* `1 <= nums[i] <= nums.length`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findMatrix(self, nums: List[int]) -> List[List[int]]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findMatrix(**[[1, 3, 4, 1, 2, 3, 1]]) == [[1, 3, 4, 2], [1, 3], [1]]\nassert my_solution.findMatrix(**[[2, 1, 1]]) == [[1, 2], [1]]\nassert my_solution.findMatrix(**[[4, 5, 3, 3, 3]]) == [[3, 5, 4], [3], [3]]\nassert my_solution.findMatrix(**[[9, 8, 8, 4, 9, 8, 8, 3, 9]]) == [[8, 9, 4, 3], [8, 9], [8, 9], [8]]\nassert my_solution.findMatrix(**[[8, 8, 8, 8, 2, 4, 4, 2, 4]]) == [[8, 4, 2], [8, 4, 2], [8, 4], [8]]\nassert my_solution.findMatrix(**[[2, 2]]) == [[2], [2]]\nassert my_solution.findMatrix(**[[3, 5, 3, 3, 8, 3, 2, 5]]) == [[3, 5, 8, 2], [3, 5], [3], [3]]\nassert my_solution.findMatrix(**[[4, 4, 4, 4, 2]]) == [[4, 2], [4], [4], [4]]\nassert my_solution.findMatrix(**[[3, 1, 2, 1, 3]]) == [[3, 1, 2], [3, 1]]\nassert my_solution.findMatrix(**[[9, 9, 9, 9, 3, 9, 2, 9, 1]]) == [[9, 3, 2, 1], [9], [9], [9], [9], [9]]\nassert my_solution.findMatrix(**[[3, 3, 4, 3]]) == [[3, 4], [3], [3]]\nassert my_solution.findMatrix(**[[3, 3, 2, 1]]) == [[3, 2, 1], [3]]\nassert my_solution.findMatrix(**[[1, 1]]) == [[1], [1]]\nassert my_solution.findMatrix(**[[3, 3, 3]]) == [[3], [3], [3]]\nassert my_solution.findMatrix(**[[6, 4, 6, 4, 3, 3, 6, 2]]) == [[6, 4, 3, 2], [6, 4, 3], [6]]\nassert my_solution.findMatrix(**[[2, 3, 1, 2]]) == [[2, 3, 1], [2]]\nassert my_solution.findMatrix(**[[8, 7, 8, 8, 1, 8, 8, 7, 9]]) == [[8, 7, 9, 1], [8, 7], [8], [8], [8]]\nassert my_solution.findMatrix(**[[7, 7, 7, 7, 7, 7, 7, 7]]) == [[7], [7], [7], [7], [7], [7], [7], [7]]\nassert my_solution.findMatrix(**[[2, 6, 3, 3, 2, 3, 2, 2, 3]]) == [[3, 2, 6], [3, 2], [3, 2], [3, 2]]\nassert my_solution.findMatrix(**[[1, 2, 2, 1]]) == [[2, 1], [2, 1]]\n"}, "labels": {"questionId": "2724", "questionFrontendId": "2610", "questionTitle": "Convert an Array Into a 2D Array With Conditions", "stats": {"totalAccepted": "9.1K", "totalSubmission": "10.8K", "totalAcceptedRaw": 9147, "totalSubmissionRaw": 10842, "acRate": "84.4%"}, "probedCases": [{"inputs": [[1, 3, 4, 1, 2, 3, 1]], "output": [[1, 3, 4, 2], [1, 3], [1]]}, {"inputs": [[2, 1, 1]], "output": [[1, 2], [1]]}, {"inputs": [[4, 5, 3, 3, 3]], "output": [[3, 5, 4], [3], [3]]}, {"inputs": [[9, 8, 8, 4, 9, 8, 8, 3, 9]], "output": [[8, 9, 4, 3], [8, 9], [8, 9], [8]]}, {"inputs": [[8, 8, 8, 8, 2, 4, 4, 2, 4]], "output": [[8, 4, 2], [8, 4, 2], [8, 4], [8]]}, {"inputs": [[2, 2]], "output": [[2], [2]]}, {"inputs": [[3, 5, 3, 3, 8, 3, 2, 5]], "output": [[3, 5, 8, 2], [3, 5], [3], [3]]}, {"inputs": [[4, 4, 4, 4, 2]], "output": [[4, 2], [4], [4], [4]]}, {"inputs": [[3, 1, 2, 1, 3]], "output": [[3, 1, 2], [3, 1]]}, {"inputs": [[9, 9, 9, 9, 3, 9, 2, 9, 1]], "output": [[9, 3, 2, 1], [9], [9], [9], [9], [9]]}, {"inputs": [[3, 3, 4, 3]], "output": [[3, 4], [3], [3]]}, {"inputs": [[3, 3, 2, 1]], "output": [[3, 2, 1], [3]]}, {"inputs": [[1, 1]], "output": [[1], [1]]}, {"inputs": [[3, 3, 3]], "output": [[3], [3], [3]]}, {"inputs": [[6, 4, 6, 4, 3, 3, 6, 2]], "output": [[6, 4, 3, 2], [6, 4, 3], [6]]}, {"inputs": [[2, 3, 1, 2]], "output": [[2, 3, 1], [2]]}, {"inputs": [[8, 7, 8, 8, 1, 8, 8, 7, 9]], "output": [[8, 7, 9, 1], [8, 7], [8], [8], [8]]}, {"inputs": [[7, 7, 7, 7, 7, 7, 7, 7]], "output": [[7], [7], [7], [7], [7], [7], [7], [7]]}, {"inputs": [[2, 6, 3, 3, 2, 3, 2, 2, 3]], "output": [[3, 2, 6], [3, 2], [3, 2], [3, 2]]}, {"inputs": [[1, 2, 2, 1]], "output": [[2, 1], [2, 1]]}]}} +{"id": "LeetCode/2725", "content": "# Mice and Cheese\n\nThere are two mice and `n` different types of cheese, each type of cheese should be eaten by exactly one mouse.\n\n\nA point of the cheese with index `i` (**0-indexed**) is:\n\n\n* `reward1[i]` if the first mouse eats it.\n* `reward2[i]` if the second mouse eats it.\n\n\nYou are given a positive integer array `reward1`, a positive integer array `reward2`, and a non-negative integer `k`.\n\n\nReturn ***the maximum** points the mice can achieve if the first mouse eats exactly* `k` *types of cheese.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** reward1 = [1,1,3,4], reward2 = [4,4,1,1], k = 2\n**Output:** 15\n**Explanation:** In this example, the first mouse eats the 2nd (0-indexed) and the 3rd types of cheese, and the second mouse eats the 0th and the 1st types of cheese.\nThe total points are 4 + 4 + 3 + 4 = 15.\nIt can be proven that 15 is the maximum total points that the mice can achieve.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** reward1 = [1,1], reward2 = [1,1], k = 2\n**Output:** 2\n**Explanation:** In this example, the first mouse eats the 0th (0-indexed) and 1st types of cheese, and the second mouse does not eat any cheese.\nThe total points are 1 + 1 = 2.\nIt can be proven that 2 is the maximum total points that the mice can achieve.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n == reward1.length == reward2.length <= 105`\n* `1 <= reward1[i], reward2[i] <= 1000`\n* `0 <= k <= n`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def miceAndCheese(self, reward1: List[int], reward2: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.miceAndCheese(**[[1, 1, 3, 4], [4, 4, 1, 1], 2]) == 15\nassert my_solution.miceAndCheese(**[[1, 1], [1, 1], 2]) == 2\nassert my_solution.miceAndCheese(**[[2, 1], [1, 2], 1]) == 4\nassert my_solution.miceAndCheese(**[[3, 3], [3, 5], 1]) == 8\nassert my_solution.miceAndCheese(**[[4, 1, 5, 3, 3], [3, 4, 4, 5, 2], 3]) == 21\nassert my_solution.miceAndCheese(**[[1, 4, 4, 6, 4], [6, 5, 3, 6, 1], 1]) == 24\nassert my_solution.miceAndCheese(**[[1, 2, 1, 2, 1, 2], [2, 1, 1, 2, 2, 1], 0]) == 9\nassert my_solution.miceAndCheese(**[[2, 2, 1, 2], [1, 2, 1, 2], 2]) == 7\nassert my_solution.miceAndCheese(**[[1], [4], 1]) == 1\nassert my_solution.miceAndCheese(**[[1, 2, 2], [2, 1, 2], 2]) == 6\nassert my_solution.miceAndCheese(**[[3, 1, 1, 3], [3, 2, 3, 1], 3]) == 10\nassert my_solution.miceAndCheese(**[[4], [5], 0]) == 5\nassert my_solution.miceAndCheese(**[[2, 3], [3, 3], 2]) == 5\nassert my_solution.miceAndCheese(**[[1, 1], [1, 1], 1]) == 2\nassert my_solution.miceAndCheese(**[[1, 3], [5, 4], 1]) == 8\nassert my_solution.miceAndCheese(**[[2, 1, 4], [1, 4, 2], 0]) == 7\nassert my_solution.miceAndCheese(**[[3, 4, 2, 1, 5], [2, 3, 5, 2, 4], 0]) == 16\nassert my_solution.miceAndCheese(**[[5, 2], [3, 1], 2]) == 7\nassert my_solution.miceAndCheese(**[[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], 5]) == 5\nassert my_solution.miceAndCheese(**[[2, 2, 1, 2, 1], [1, 1, 2, 1, 1], 0]) == 6\n"}, "labels": {"questionId": "2725", "questionFrontendId": "2611", "questionTitle": "Mice and Cheese", "stats": {"totalAccepted": "28.2K", "totalSubmission": "48.3K", "totalAcceptedRaw": 28248, "totalSubmissionRaw": 48347, "acRate": "58.4%"}, "probedCases": [{"inputs": [[1, 1, 3, 4], [4, 4, 1, 1], 2], "output": 15}, {"inputs": [[1, 1], [1, 1], 2], "output": 2}, {"inputs": [[2, 1], [1, 2], 1], "output": 4}, {"inputs": [[3, 3], [3, 5], 1], "output": 8}, {"inputs": [[4, 1, 5, 3, 3], [3, 4, 4, 5, 2], 3], "output": 21}, {"inputs": [[1, 4, 4, 6, 4], [6, 5, 3, 6, 1], 1], "output": 24}, {"inputs": [[1, 2, 1, 2, 1, 2], [2, 1, 1, 2, 2, 1], 0], "output": 9}, {"inputs": [[2, 2, 1, 2], [1, 2, 1, 2], 2], "output": 7}, {"inputs": [[1], [4], 1], "output": 1}, {"inputs": [[1, 2, 2], [2, 1, 2], 2], "output": 6}, {"inputs": [[3, 1, 1, 3], [3, 2, 3, 1], 3], "output": 10}, {"inputs": [[4], [5], 0], "output": 5}, {"inputs": [[2, 3], [3, 3], 2], "output": 5}, {"inputs": [[1, 1], [1, 1], 1], "output": 2}, {"inputs": [[1, 3], [5, 4], 1], "output": 8}, {"inputs": [[2, 1, 4], [1, 4, 2], 0], "output": 7}, {"inputs": [[3, 4, 2, 1, 5], [2, 3, 5, 2, 4], 0], "output": 16}, {"inputs": [[5, 2], [3, 1], 2], "output": 7}, {"inputs": [[1, 1, 1, 1, 1], [1, 1, 1, 1, 1], 5], "output": 5}, {"inputs": [[2, 2, 1, 2, 1], [1, 1, 2, 1, 1], 0], "output": 6}]}} +{"id": "LeetCode/2726", "content": "# Minimum Reverse Operations\n\nYou are given an integer `n` and an integer `p` in the range `[0, n - 1]`. Representing a **0-indexed** array `arr` of length `n` where all positions are set to `0`'s, except position `p` which is set to `1`.\n\n\nYou are also given an integer array `banned` containing some positions from the array. For the **i****th** position in `banned`, `arr[banned[i]] = 0`, and `banned[i] != p`.\n\n\nYou can perform **multiple** operations on `arr`. In an operation, you can choose a **subarray** with size `k` and **reverse** the subarray. However, the `1` in `arr` should never go to any of the positions in `banned`. In other words, after each operation `arr[banned[i]]` **remains** `0`.\n\n\n*Return an array* `ans` *where* *for each* `i` *from* `[0, n - 1]`, `ans[i]` *is the **minimum** number of reverse operations needed to bring the* `1` *to position* `i` *in arr*, *or* `-1` *if it is impossible*.\n\n\n* A **subarray** is a contiguous **non-empty** sequence of elements within an array.\n* The values of `ans[i]` are independent for all `i`'s.\n* The **reverse** of an array is an array containing the values in **reverse order**.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 4, p = 0, banned = [1,2], k = 4\n**Output:** [0,-1,-1,1]\n**Explanation:** In this case k = 4 so there is only one possible reverse operation we can perform, which is reversing the whole array. Initially, 1is placed at position 0 so the amount of operations we need for position 0 is 0. We can never place a 1 on the banned positions, so the answer for positions 1 and 2 is -1. Finally, with one reverse operation we can bring the 1 to index 3, so the answer for position 3 is 1. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 5, p = 0, banned = [2,4], k = 3\n**Output:** [0,-1,-1,-1,-1]\n**Explanation:** In this case the 1 is initially at position 0, so the answer for that position is 0. We can perform reverse operations of size 3. The 1 is currently located at position 0, so we need to reverse the subarray [0, 2] for it to leave that position, but reversing that subarray makes position 2 have a 1, which shouldn't happen. So, we can't move the 1 from position 0, making the result for all the other positions -1. \n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** n = 4, p = 2, banned = [0,1,3], k = 1\n**Output:** [-1,-1,0,-1]\n**Explanation:** In this case we can only perform reverse operations of size 1.So the 1 never changes its position.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 105`\n* `0 <= p <= n - 1`\n* `0 <= banned.length <= n - 1`\n* `0 <= banned[i] <= n - 1`\n* `1 <= k <= n`\n* `banned[i] != p`\n* all values in `banned` are **unique**\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minReverseOperations(self, n: int, p: int, banned: List[int], k: int) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minReverseOperations(**[4, 0, [1, 2], 4]) == [0, -1, -1, 1]\nassert my_solution.minReverseOperations(**[5, 0, [2, 4], 3]) == [0, -1, -1, -1, -1]\nassert my_solution.minReverseOperations(**[4, 2, [0, 1, 3], 1]) == [-1, -1, 0, -1]\nassert my_solution.minReverseOperations(**[5, 0, [], 2]) == [0, 1, 2, 3, 4]\nassert my_solution.minReverseOperations(**[1, 0, [], 1]) == [0]\nassert my_solution.minReverseOperations(**[2, 0, [], 1]) == [0, -1]\nassert my_solution.minReverseOperations(**[2, 0, [], 2]) == [0, 1]\nassert my_solution.minReverseOperations(**[2, 1, [], 1]) == [-1, 0]\nassert my_solution.minReverseOperations(**[2, 1, [], 2]) == [1, 0]\nassert my_solution.minReverseOperations(**[2, 0, [1], 1]) == [0, -1]\nassert my_solution.minReverseOperations(**[2, 0, [1], 2]) == [0, -1]\nassert my_solution.minReverseOperations(**[2, 1, [0], 1]) == [-1, 0]\nassert my_solution.minReverseOperations(**[2, 1, [0], 2]) == [-1, 0]\nassert my_solution.minReverseOperations(**[3, 0, [], 1]) == [0, -1, -1]\nassert my_solution.minReverseOperations(**[3, 0, [], 2]) == [0, 1, 2]\nassert my_solution.minReverseOperations(**[3, 0, [], 3]) == [0, -1, 1]\nassert my_solution.minReverseOperations(**[3, 1, [], 1]) == [-1, 0, -1]\nassert my_solution.minReverseOperations(**[3, 1, [], 2]) == [1, 0, 1]\nassert my_solution.minReverseOperations(**[3, 1, [], 3]) == [-1, 0, -1]\nassert my_solution.minReverseOperations(**[3, 2, [], 1]) == [-1, -1, 0]\n"}, "labels": {"questionId": "2726", "questionFrontendId": "2612", "questionTitle": "Minimum Reverse Operations", "stats": {"totalAccepted": "2.6K", "totalSubmission": "12.4K", "totalAcceptedRaw": 2650, "totalSubmissionRaw": 12400, "acRate": "21.4%"}, "probedCases": [{"inputs": [4, 0, [1, 2], 4], "output": [0, -1, -1, 1]}, {"inputs": [5, 0, [2, 4], 3], "output": [0, -1, -1, -1, -1]}, {"inputs": [4, 2, [0, 1, 3], 1], "output": [-1, -1, 0, -1]}, {"inputs": [5, 0, [], 2], "output": [0, 1, 2, 3, 4]}, {"inputs": [1, 0, [], 1], "output": [0]}, {"inputs": [2, 0, [], 1], "output": [0, -1]}, {"inputs": [2, 0, [], 2], "output": [0, 1]}, {"inputs": [2, 1, [], 1], "output": [-1, 0]}, {"inputs": [2, 1, [], 2], "output": [1, 0]}, {"inputs": [2, 0, [1], 1], "output": [0, -1]}, {"inputs": [2, 0, [1], 2], "output": [0, -1]}, {"inputs": [2, 1, [0], 1], "output": [-1, 0]}, {"inputs": [2, 1, [0], 2], "output": [-1, 0]}, {"inputs": [3, 0, [], 1], "output": [0, -1, -1]}, {"inputs": [3, 0, [], 2], "output": [0, 1, 2]}, {"inputs": [3, 0, [], 3], "output": [0, -1, 1]}, {"inputs": [3, 1, [], 1], "output": [-1, 0, -1]}, {"inputs": [3, 1, [], 2], "output": [1, 0, 1]}, {"inputs": [3, 1, [], 3], "output": [-1, 0, -1]}, {"inputs": [3, 2, [], 1], "output": [-1, -1, 0]}]}} +{"id": "LeetCode/2668", "content": "# Form Smallest Number From Two Digit Arrays\n\nGiven two arrays of **unique** digits `nums1` and `nums2`, return *the **smallest** number that contains **at least** one digit from each array*.\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums1 = [4,1,3], nums2 = [5,7]\n**Output:** 15\n**Explanation:** The number 15 contains the digit 1 from nums1 and the digit 5 from nums2. It can be proven that 15 is the smallest number we can have.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums1 = [3,5,2,6], nums2 = [3,1,7]\n**Output:** 3\n**Explanation:** The number 3 contains the digit 3 which exists in both arrays.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums1.length, nums2.length <= 9`\n* `1 <= nums1[i], nums2[i] <= 9`\n* All digits in each array are **unique**.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minNumber(self, nums1: List[int], nums2: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minNumber(**[[4, 1, 3], [5, 7]]) == 15\nassert my_solution.minNumber(**[[3, 5, 2, 6], [3, 1, 7]]) == 3\nassert my_solution.minNumber(**[[6, 4, 3, 7, 2, 1, 8, 5], [6, 8, 5, 3, 1, 7, 4, 2]]) == 1\nassert my_solution.minNumber(**[[7, 2, 8, 6, 4, 5, 3, 1], [3, 4, 1, 2, 6, 8, 5, 7]]) == 1\nassert my_solution.minNumber(**[[5, 1, 7, 6, 8, 2, 3, 4], [2, 3, 4, 5, 1, 7, 8, 6]]) == 1\nassert my_solution.minNumber(**[[3, 8, 5, 4, 7, 1, 2, 6], [1, 6, 4, 5, 8, 7, 3, 2]]) == 1\nassert my_solution.minNumber(**[[4, 8, 2, 1, 7, 3, 6, 5], [2, 7, 4, 5, 1, 6, 3, 8]]) == 1\nassert my_solution.minNumber(**[[4, 5, 2, 7, 3, 1, 6, 8], [6, 3, 4, 8, 2, 7, 5, 1]]) == 1\nassert my_solution.minNumber(**[[4, 5, 3, 2, 8, 6, 1, 7], [5, 2, 1, 7, 8, 3, 4, 6]]) == 1\nassert my_solution.minNumber(**[[3, 6, 1, 8, 5, 4, 7, 2], [2, 8, 1, 6, 4, 5, 3, 7]]) == 1\nassert my_solution.minNumber(**[[4, 1, 3, 8, 6, 2, 7, 5], [5, 4, 7, 8, 2, 3, 6, 1]]) == 1\nassert my_solution.minNumber(**[[8, 2, 6, 5, 7, 3, 4, 1], [3, 6, 4, 8, 7, 2, 1, 5]]) == 1\nassert my_solution.minNumber(**[[6, 5, 7, 1, 8, 4, 3, 2], [5, 2, 3, 8, 1, 7, 6, 4]]) == 1\nassert my_solution.minNumber(**[[8, 3, 6, 4, 2, 5, 1, 7], [6, 2, 4, 5, 8, 3, 1, 7]]) == 1\nassert my_solution.minNumber(**[[1, 2, 5, 8, 6, 7, 3, 4], [2, 3, 1, 4, 6, 8, 7, 5]]) == 1\nassert my_solution.minNumber(**[[3, 6, 8, 1, 5, 7, 4, 2], [2, 8, 3, 7, 5, 1, 4, 6]]) == 1\nassert my_solution.minNumber(**[[8, 1, 4, 6, 5, 3, 2, 7], [2, 8, 7, 6, 3, 1, 5, 4]]) == 1\nassert my_solution.minNumber(**[[5, 1, 4, 8, 2, 7, 6, 3], [1, 3, 8, 4, 6, 5, 7, 2]]) == 1\nassert my_solution.minNumber(**[[8, 5, 7, 1, 4, 3, 2, 6], [1, 5, 2, 4, 7, 8, 3, 6]]) == 1\nassert my_solution.minNumber(**[[2, 1, 6, 7, 3, 5, 8, 4], [3, 1, 2, 7, 4, 6, 8, 5]]) == 1\n"}, "labels": {"questionId": "2668", "questionFrontendId": "2605", "questionTitle": "Form Smallest Number From Two Digit Arrays", "stats": {"totalAccepted": "35K", "totalSubmission": "52.1K", "totalAcceptedRaw": 34974, "totalSubmissionRaw": 52146, "acRate": "67.1%"}, "probedCases": [{"inputs": [[4, 1, 3], [5, 7]], "output": 15}, {"inputs": [[3, 5, 2, 6], [3, 1, 7]], "output": 3}, {"inputs": [[6, 4, 3, 7, 2, 1, 8, 5], [6, 8, 5, 3, 1, 7, 4, 2]], "output": 1}, {"inputs": [[7, 2, 8, 6, 4, 5, 3, 1], [3, 4, 1, 2, 6, 8, 5, 7]], "output": 1}, {"inputs": [[5, 1, 7, 6, 8, 2, 3, 4], [2, 3, 4, 5, 1, 7, 8, 6]], "output": 1}, {"inputs": [[3, 8, 5, 4, 7, 1, 2, 6], [1, 6, 4, 5, 8, 7, 3, 2]], "output": 1}, {"inputs": [[4, 8, 2, 1, 7, 3, 6, 5], [2, 7, 4, 5, 1, 6, 3, 8]], "output": 1}, {"inputs": [[4, 5, 2, 7, 3, 1, 6, 8], [6, 3, 4, 8, 2, 7, 5, 1]], "output": 1}, {"inputs": [[4, 5, 3, 2, 8, 6, 1, 7], [5, 2, 1, 7, 8, 3, 4, 6]], "output": 1}, {"inputs": [[3, 6, 1, 8, 5, 4, 7, 2], [2, 8, 1, 6, 4, 5, 3, 7]], "output": 1}, {"inputs": [[4, 1, 3, 8, 6, 2, 7, 5], [5, 4, 7, 8, 2, 3, 6, 1]], "output": 1}, {"inputs": [[8, 2, 6, 5, 7, 3, 4, 1], [3, 6, 4, 8, 7, 2, 1, 5]], "output": 1}, {"inputs": [[6, 5, 7, 1, 8, 4, 3, 2], [5, 2, 3, 8, 1, 7, 6, 4]], "output": 1}, {"inputs": [[8, 3, 6, 4, 2, 5, 1, 7], [6, 2, 4, 5, 8, 3, 1, 7]], "output": 1}, {"inputs": [[1, 2, 5, 8, 6, 7, 3, 4], [2, 3, 1, 4, 6, 8, 7, 5]], "output": 1}, {"inputs": [[3, 6, 8, 1, 5, 7, 4, 2], [2, 8, 3, 7, 5, 1, 4, 6]], "output": 1}, {"inputs": [[8, 1, 4, 6, 5, 3, 2, 7], [2, 8, 7, 6, 3, 1, 5, 4]], "output": 1}, {"inputs": [[5, 1, 4, 8, 2, 7, 6, 3], [1, 3, 8, 4, 6, 5, 7, 2]], "output": 1}, {"inputs": [[8, 5, 7, 1, 4, 3, 2, 6], [1, 5, 2, 4, 7, 8, 3, 6]], "output": 1}, {"inputs": [[2, 1, 6, 7, 3, 5, 8, 4], [3, 1, 2, 7, 4, 6, 8, 5]], "output": 1}]}} +{"id": "LeetCode/2669", "content": "# Find the Substring With Maximum Cost\n\nYou are given a string `s`, a string `chars` of **distinct** characters and an integer array `vals` of the same length as `chars`.\n\n\nThe **cost of the substring** is the sum of the values of each character in the substring. The cost of an empty string is considered `0`.\n\n\nThe **value of the character** is defined in the following way:\n\n\n* If the character is not in the string `chars`, then its value is its corresponding position **(1-indexed)** in the alphabet.\n\t+ For example, the value of `'a'` is `1`, the value of `'b'` is `2`, and so on. The value of `'z'` is `26`.\n* Otherwise, assuming `i` is the index where the character occurs in the string `chars`, then its value is `vals[i]`.\n\n\nReturn *the maximum cost among all substrings of the string* `s`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"adaa\", chars = \"d\", vals = [-1000]\n**Output:** 2\n**Explanation:** The value of the characters \"a\" and \"d\" is 1 and -1000 respectively.\nThe substring with the maximum cost is \"aa\" and its cost is 1 + 1 = 2.\nIt can be proven that 2 is the maximum cost.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"abc\", chars = \"abc\", vals = [-1,-1,-1]\n**Output:** 0\n**Explanation:** The value of the characters \"a\", \"b\" and \"c\" is -1, -1, and -1 respectively.\nThe substring with the maximum cost is the empty substring \"\" and its cost is 0.\nIt can be proven that 0 is the maximum cost.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 105`\n* `s` consist of lowercase English letters.\n* `1 <= chars.length <= 26`\n* `chars` consist of **distinct** lowercase English letters.\n* `vals.length == chars.length`\n* `-1000 <= vals[i] <= 1000`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximumCostSubstring(self, s: str, chars: str, vals: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximumCostSubstring(**['adaa', 'd', [-1000]]) == 2\nassert my_solution.maximumCostSubstring(**['abc', 'abc', [-1, -1, -1]]) == 0\nassert my_solution.maximumCostSubstring(**['hghhghgghh', 'hg', [2, 3]]) == 24\nassert my_solution.maximumCostSubstring(**['ddzddzd', 'zfd', [-4, 2, -2]]) == 0\nassert my_solution.maximumCostSubstring(**['kqqqqqkkkq', 'kq', [-6, 6]]) == 30\nassert my_solution.maximumCostSubstring(**['pprpf', 'frep', [-5, -4, -4, 3]]) == 6\nassert my_solution.maximumCostSubstring(**['eggggeee', 'ge', [5, 3]]) == 32\nassert my_solution.maximumCostSubstring(**['ssss', 's', [3]]) == 12\nassert my_solution.maximumCostSubstring(**['ffff', 'f', [1]]) == 4\nassert my_solution.maximumCostSubstring(**['xuusmmums', 'sxmu', [-6, 5, 0, 5]]) == 15\nassert my_solution.maximumCostSubstring(**['axaaxxaxa', 'ax', [-6, 1]]) == 2\nassert my_solution.maximumCostSubstring(**['ffkfuft', 'utkf', [3, -6, 3, 6]]) == 30\nassert my_solution.maximumCostSubstring(**['ll', 'il', [3, -6]]) == 0\nassert my_solution.maximumCostSubstring(**['hwwqwwqqqh', 'wihq', [-2, -5, -4, 4]]) == 12\nassert my_solution.maximumCostSubstring(**['qjjjqqq', 'zqj', [-4, 3, 4]]) == 24\nassert my_solution.maximumCostSubstring(**['talaqlt', 'tqla', [4, 3, 3, -2]]) == 13\nassert my_solution.maximumCostSubstring(**['qqqqqqqqqq', 'q', [0]]) == 0\nassert my_solution.maximumCostSubstring(**['tt', 't', [-2]]) == 0\nassert my_solution.maximumCostSubstring(**['zox', 'zoxr', [2, -5, -4, -5]]) == 2\nassert my_solution.maximumCostSubstring(**['ddddddd', 'd', [-3]]) == 0\n"}, "labels": {"questionId": "2669", "questionFrontendId": "2606", "questionTitle": "Find the Substring With Maximum Cost", "stats": {"totalAccepted": "5.9K", "totalSubmission": "10.4K", "totalAcceptedRaw": 5870, "totalSubmissionRaw": 10432, "acRate": "56.3%"}, "probedCases": [{"inputs": ["adaa", "d", [-1000]], "output": 2}, {"inputs": ["abc", "abc", [-1, -1, -1]], "output": 0}, {"inputs": ["hghhghgghh", "hg", [2, 3]], "output": 24}, {"inputs": ["ddzddzd", "zfd", [-4, 2, -2]], "output": 0}, {"inputs": ["kqqqqqkkkq", "kq", [-6, 6]], "output": 30}, {"inputs": ["pprpf", "frep", [-5, -4, -4, 3]], "output": 6}, {"inputs": ["eggggeee", "ge", [5, 3]], "output": 32}, {"inputs": ["ssss", "s", [3]], "output": 12}, {"inputs": ["ffff", "f", [1]], "output": 4}, {"inputs": ["xuusmmums", "sxmu", [-6, 5, 0, 5]], "output": 15}, {"inputs": ["axaaxxaxa", "ax", [-6, 1]], "output": 2}, {"inputs": ["ffkfuft", "utkf", [3, -6, 3, 6]], "output": 30}, {"inputs": ["ll", "il", [3, -6]], "output": 0}, {"inputs": ["hwwqwwqqqh", "wihq", [-2, -5, -4, 4]], "output": 12}, {"inputs": ["qjjjqqq", "zqj", [-4, 3, 4]], "output": 24}, {"inputs": ["talaqlt", "tqla", [4, 3, 3, -2]], "output": 13}, {"inputs": ["qqqqqqqqqq", "q", [0]], "output": 0}, {"inputs": ["tt", "t", [-2]], "output": 0}, {"inputs": ["zox", "zoxr", [2, -5, -4, -5]], "output": 2}, {"inputs": ["ddddddd", "d", [-3]], "output": 0}]}} +{"id": "LeetCode/2670", "content": "# Make K-Subarray Sums Equal\n\nYou are given a **0-indexed** integer array `arr` and an integer `k`. The array `arr` is circular. In other words, the first element of the array is the next element of the last element, and the last element of the array is the previous element of the first element.\n\n\nYou can do the following operation any number of times:\n\n\n* Pick any element from `arr` and increase or decrease it by `1`.\n\n\nReturn *the minimum number of operations such that the sum of each **subarray** of length* `k` *is equal*.\n\n\nA **subarray** is a contiguous part of the array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** arr = [1,4,1,3], k = 2\n**Output:** 1\n**Explanation:** we can do one operation on index 1 to make its value equal to 3.\nThe array after the operation is [1,3,1,3]\n- Subarray starts at index 0 is [1, 3], and its sum is 4 \n- Subarray starts at index 1 is [3, 1], and its sum is 4 \n- Subarray starts at index 2 is [1, 3], and its sum is 4 \n- Subarray starts at index 3 is [3, 1], and its sum is 4 \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** arr = [2,5,5,7], k = 3\n**Output:** 5\n**Explanation:** we can do three operations on index 0 to make its value equal to 5 and two operations on index 3 to make its value equal to 5.\nThe array after the operations is [5,5,5,5]\n- Subarray starts at index 0 is [5, 5, 5], and its sum is 15\n- Subarray starts at index 1 is [5, 5, 5], and its sum is 15\n- Subarray starts at index 2 is [5, 5, 5], and its sum is 15\n- Subarray starts at index 3 is [5, 5, 5], and its sum is 15 \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= k <= arr.length <= 105`\n* `1 <= arr[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def makeSubKSumEqual(self, arr: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.makeSubKSumEqual(**[[1, 4, 1, 3], 2]) == 1\nassert my_solution.makeSubKSumEqual(**[[2, 5, 5, 7], 3]) == 5\nassert my_solution.makeSubKSumEqual(**[[9], 1]) == 0\nassert my_solution.makeSubKSumEqual(**[[1, 10], 1]) == 9\nassert my_solution.makeSubKSumEqual(**[[4, 6], 2]) == 0\nassert my_solution.makeSubKSumEqual(**[[2, 10, 9], 1]) == 8\nassert my_solution.makeSubKSumEqual(**[[10, 3, 8], 2]) == 7\nassert my_solution.makeSubKSumEqual(**[[3, 3, 9], 3]) == 0\nassert my_solution.makeSubKSumEqual(**[[1, 7, 9, 6], 1]) == 9\nassert my_solution.makeSubKSumEqual(**[[7, 3, 10, 6], 2]) == 6\nassert my_solution.makeSubKSumEqual(**[[1, 5, 8, 10], 3]) == 12\nassert my_solution.makeSubKSumEqual(**[[2, 6, 7, 2], 4]) == 0\nassert my_solution.makeSubKSumEqual(**[[2, 4, 2, 10, 3], 1]) == 10\nassert my_solution.makeSubKSumEqual(**[[9, 1, 5, 10, 6], 2]) == 13\nassert my_solution.makeSubKSumEqual(**[[10, 9, 1, 10, 5], 3]) == 14\nassert my_solution.makeSubKSumEqual(**[[9, 7, 2, 6, 4], 4]) == 10\nassert my_solution.makeSubKSumEqual(**[[10, 5, 10, 2, 9], 5]) == 0\nassert my_solution.makeSubKSumEqual(**[[5, 8, 2, 6, 9, 1], 1]) == 15\nassert my_solution.makeSubKSumEqual(**[[8, 2, 5, 9, 8, 10], 2]) == 11\nassert my_solution.makeSubKSumEqual(**[[9, 4, 8, 8, 5, 8], 3]) == 2\n"}, "labels": {"questionId": "2670", "questionFrontendId": "2607", "questionTitle": "Make K-Subarray Sums Equal", "stats": {"totalAccepted": "3.2K", "totalSubmission": "8.1K", "totalAcceptedRaw": 3230, "totalSubmissionRaw": 8079, "acRate": "40.0%"}, "probedCases": [{"inputs": [[1, 4, 1, 3], 2], "output": 1}, {"inputs": [[2, 5, 5, 7], 3], "output": 5}, {"inputs": [[9], 1], "output": 0}, {"inputs": [[1, 10], 1], "output": 9}, {"inputs": [[4, 6], 2], "output": 0}, {"inputs": [[2, 10, 9], 1], "output": 8}, {"inputs": [[10, 3, 8], 2], "output": 7}, {"inputs": [[3, 3, 9], 3], "output": 0}, {"inputs": [[1, 7, 9, 6], 1], "output": 9}, {"inputs": [[7, 3, 10, 6], 2], "output": 6}, {"inputs": [[1, 5, 8, 10], 3], "output": 12}, {"inputs": [[2, 6, 7, 2], 4], "output": 0}, {"inputs": [[2, 4, 2, 10, 3], 1], "output": 10}, {"inputs": [[9, 1, 5, 10, 6], 2], "output": 13}, {"inputs": [[10, 9, 1, 10, 5], 3], "output": 14}, {"inputs": [[9, 7, 2, 6, 4], 4], "output": 10}, {"inputs": [[10, 5, 10, 2, 9], 5], "output": 0}, {"inputs": [[5, 8, 2, 6, 9, 1], 1], "output": 15}, {"inputs": [[8, 2, 5, 9, 8, 10], 2], "output": 11}, {"inputs": [[9, 4, 8, 8, 5, 8], 3], "output": 2}]}} +{"id": "LeetCode/2715", "content": "# K Items With the Maximum Sum\n\nThere is a bag that consists of items, each item has a number `1`, `0`, or `-1` written on it.\n\n\nYou are given four **non-negative** integers `numOnes`, `numZeros`, `numNegOnes`, and `k`.\n\n\nThe bag initially contains:\n\n\n* `numOnes` items with `1`s written on them.\n* `numZeroes` items with `0`s written on them.\n* `numNegOnes` items with `-1`s written on them.\n\n\nWe want to pick exactly `k` items among the available items. Return *the **maximum** possible sum of numbers written on the items*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** numOnes = 3, numZeros = 2, numNegOnes = 0, k = 2\n**Output:** 2\n**Explanation:** We have a bag of items with numbers written on them {1, 1, 1, 0, 0}. We take 2 items with 1 written on them and get a sum in a total of 2.\nIt can be proven that 2 is the maximum possible sum.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** numOnes = 3, numZeros = 2, numNegOnes = 0, k = 4\n**Output:** 3\n**Explanation:** We have a bag of items with numbers written on them {1, 1, 1, 0, 0}. We take 3 items with 1 written on them, and 1 item with 0 written on it, and get a sum in a total of 3.\nIt can be proven that 3 is the maximum possible sum.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `0 <= numOnes, numZeros, numNegOnes <= 50`\n* `0 <= k <= numOnes + numZeros + numNegOnes`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def kItemsWithMaximumSum(self, numOnes: int, numZeros: int, numNegOnes: int, k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.kItemsWithMaximumSum(**[3, 2, 0, 2]) == 2\nassert my_solution.kItemsWithMaximumSum(**[3, 2, 0, 4]) == 3\nassert my_solution.kItemsWithMaximumSum(**[4, 0, 1, 2]) == 2\nassert my_solution.kItemsWithMaximumSum(**[1, 4, 1, 3]) == 1\nassert my_solution.kItemsWithMaximumSum(**[6, 6, 6, 13]) == 5\nassert my_solution.kItemsWithMaximumSum(**[2, 1, 2, 1]) == 1\nassert my_solution.kItemsWithMaximumSum(**[8, 4, 0, 8]) == 8\nassert my_solution.kItemsWithMaximumSum(**[0, 3, 1, 1]) == 0\nassert my_solution.kItemsWithMaximumSum(**[2, 4, 4, 0]) == 0\nassert my_solution.kItemsWithMaximumSum(**[3, 7, 4, 8]) == 3\nassert my_solution.kItemsWithMaximumSum(**[3, 3, 5, 11]) == -2\nassert my_solution.kItemsWithMaximumSum(**[1, 2, 0, 2]) == 1\nassert my_solution.kItemsWithMaximumSum(**[1, 6, 4, 4]) == 1\nassert my_solution.kItemsWithMaximumSum(**[1, 1, 2, 2]) == 1\nassert my_solution.kItemsWithMaximumSum(**[3, 0, 5, 8]) == -2\nassert my_solution.kItemsWithMaximumSum(**[1, 0, 3, 4]) == -2\nassert my_solution.kItemsWithMaximumSum(**[2, 0, 4, 2]) == 2\nassert my_solution.kItemsWithMaximumSum(**[1, 3, 3, 5]) == 0\nassert my_solution.kItemsWithMaximumSum(**[4, 3, 2, 1]) == 1\nassert my_solution.kItemsWithMaximumSum(**[4, 4, 0, 5]) == 4\n"}, "labels": {"questionId": "2715", "questionFrontendId": "2600", "questionTitle": "K Items With the Maximum Sum", "stats": {"totalAccepted": "34.1K", "totalSubmission": "50.4K", "totalAcceptedRaw": 34131, "totalSubmissionRaw": 50384, "acRate": "67.7%"}, "probedCases": [{"inputs": [3, 2, 0, 2], "output": 2}, {"inputs": [3, 2, 0, 4], "output": 3}, {"inputs": [4, 0, 1, 2], "output": 2}, {"inputs": [1, 4, 1, 3], "output": 1}, {"inputs": [6, 6, 6, 13], "output": 5}, {"inputs": [2, 1, 2, 1], "output": 1}, {"inputs": [8, 4, 0, 8], "output": 8}, {"inputs": [0, 3, 1, 1], "output": 0}, {"inputs": [2, 4, 4, 0], "output": 0}, {"inputs": [3, 7, 4, 8], "output": 3}, {"inputs": [3, 3, 5, 11], "output": -2}, {"inputs": [1, 2, 0, 2], "output": 1}, {"inputs": [1, 6, 4, 4], "output": 1}, {"inputs": [1, 1, 2, 2], "output": 1}, {"inputs": [3, 0, 5, 8], "output": -2}, {"inputs": [1, 0, 3, 4], "output": -2}, {"inputs": [2, 0, 4, 2], "output": 2}, {"inputs": [1, 3, 3, 5], "output": 0}, {"inputs": [4, 3, 2, 1], "output": 1}, {"inputs": [4, 4, 0, 5], "output": 4}]}} +{"id": "LeetCode/2716", "content": "# Prime Subtraction Operation\n\nYou are given a **0-indexed** integer array `nums` of length `n`.\n\n\nYou can perform the following operation as many times as you want:\n\n\n* Pick an index `i` that you haven’t picked before, and pick a prime `p` **strictly less than** `nums[i]`, then subtract `p` from `nums[i]`.\n\n\nReturn *true if you can make `nums` a strictly increasing array using the above operation and false otherwise.*\n\n\nA **strictly increasing array** is an array whose each element is strictly greater than its preceding element.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [4,9,6,10]\n**Output:** true\n**Explanation:** In the first operation: Pick i = 0 and p = 3, and then subtract 3 from nums[0], so that nums becomes [1,9,6,10].\nIn the second operation: i = 1, p = 7, subtract 7 from nums[1], so nums becomes equal to [1,2,6,10].\nAfter the second operation, nums is sorted in strictly increasing order, so the answer is true.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [6,8,11,12]\n**Output:** true\n**Explanation:** Initially nums is sorted in strictly increasing order, so we don't need to make any operations.\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [5,8,3]\n**Output:** false\n**Explanation:** It can be proven that there is no way to perform operations to make nums sorted in strictly increasing order, so the answer is false.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 1000`\n* `1 <= nums[i] <= 1000`\n* `nums.length == n`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def primeSubOperation(self, nums: List[int]) -> bool:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.primeSubOperation(**[[4, 9, 6, 10]]) == True\nassert my_solution.primeSubOperation(**[[6, 8, 11, 12]]) == True\nassert my_solution.primeSubOperation(**[[5, 8, 3]]) == False\nassert my_solution.primeSubOperation(**[[2, 2]]) == False\nassert my_solution.primeSubOperation(**[[998, 2]]) == True\nassert my_solution.primeSubOperation(**[[1, 20, 7, 12, 4]]) == False\nassert my_solution.primeSubOperation(**[[17, 20, 5, 15, 6]]) == False\nassert my_solution.primeSubOperation(**[[17, 2]]) == False\nassert my_solution.primeSubOperation(**[[18, 12, 14, 6]]) == False\nassert my_solution.primeSubOperation(**[[11, 2, 10, 15, 19]]) == False\nassert my_solution.primeSubOperation(**[[12]]) == True\nassert my_solution.primeSubOperation(**[[4, 3, 7, 4]]) == False\nassert my_solution.primeSubOperation(**[[6, 17, 2, 9, 20]]) == False\nassert my_solution.primeSubOperation(**[[20, 18, 2]]) == False\nassert my_solution.primeSubOperation(**[[10, 18, 14, 3, 11]]) == False\nassert my_solution.primeSubOperation(**[[19, 10]]) == True\nassert my_solution.primeSubOperation(**[[4, 18, 10, 16, 3]]) == False\nassert my_solution.primeSubOperation(**[[17, 2, 15]]) == False\nassert my_solution.primeSubOperation(**[[9]]) == True\nassert my_solution.primeSubOperation(**[[15, 20, 17, 7, 16]]) == True\n"}, "labels": {"questionId": "2716", "questionFrontendId": "2601", "questionTitle": "Prime Subtraction Operation", "stats": {"totalAccepted": "7.7K", "totalSubmission": "19.7K", "totalAcceptedRaw": 7730, "totalSubmissionRaw": 19736, "acRate": "39.2%"}, "probedCases": [{"inputs": [[4, 9, 6, 10]], "output": true}, {"inputs": [[6, 8, 11, 12]], "output": true}, {"inputs": [[5, 8, 3]], "output": false}, {"inputs": [[2, 2]], "output": false}, {"inputs": [[998, 2]], "output": true}, {"inputs": [[1, 20, 7, 12, 4]], "output": false}, {"inputs": [[17, 20, 5, 15, 6]], "output": false}, {"inputs": [[17, 2]], "output": false}, {"inputs": [[18, 12, 14, 6]], "output": false}, {"inputs": [[11, 2, 10, 15, 19]], "output": false}, {"inputs": [[12]], "output": true}, {"inputs": [[4, 3, 7, 4]], "output": false}, {"inputs": [[6, 17, 2, 9, 20]], "output": false}, {"inputs": [[20, 18, 2]], "output": false}, {"inputs": [[10, 18, 14, 3, 11]], "output": false}, {"inputs": [[19, 10]], "output": true}, {"inputs": [[4, 18, 10, 16, 3]], "output": false}, {"inputs": [[17, 2, 15]], "output": false}, {"inputs": [[9]], "output": true}, {"inputs": [[15, 20, 17, 7, 16]], "output": true}]}} +{"id": "LeetCode/2718", "content": "# Minimum Operations to Make All Array Elements Equal\n\nYou are given an array `nums` consisting of positive integers.\n\n\nYou are also given an integer array `queries` of size `m`. For the `ith` query, you want to make all of the elements of `nums` equal to `queries[i]`. You can perform the following operation on the array **any** number of times:\n\n\n* **Increase** or **decrease** an element of the array by `1`.\n\n\nReturn *an array* `answer` *of size* `m` *where* `answer[i]` *is the **minimum** number of operations to make all elements of* `nums` *equal to* `queries[i]`.\n\n\n**Note** that after each query the array is reset to its original state.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [3,1,6,8], queries = [1,5]\n**Output:** [14,10]\n**Explanation:** For the first query we can do the following operations:\n- Decrease nums[0] 2 times, so that nums = [1,1,6,8].\n- Decrease nums[2] 5 times, so that nums = [1,1,1,8].\n- Decrease nums[3] 7 times, so that nums = [1,1,1,1].\nSo the total number of operations for the first query is 2 + 5 + 7 = 14.\nFor the second query we can do the following operations:\n- Increase nums[0] 2 times, so that nums = [5,1,6,8].\n- Increase nums[1] 4 times, so that nums = [5,5,6,8].\n- Decrease nums[2] 1 time, so that nums = [5,5,5,8].\n- Decrease nums[3] 3 times, so that nums = [5,5,5,5].\nSo the total number of operations for the second query is 2 + 4 + 1 + 3 = 10.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,9,6,3], queries = [10]\n**Output:** [20]\n**Explanation:** We can increase each value in the array to 10. The total number of operations will be 8 + 1 + 4 + 7 = 20.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `n == nums.length`\n* `m == queries.length`\n* `1 <= n, m <= 105`\n* `1 <= nums[i], queries[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minOperations(self, nums: List[int], queries: List[int]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minOperations(**[[3, 1, 6, 8], [1, 5]]) == [14, 10]\nassert my_solution.minOperations(**[[2, 9, 6, 3], [10]]) == [20]\nassert my_solution.minOperations(**[[47, 50, 97, 58, 87, 72, 41, 63, 41, 51, 17, 21, 7, 100, 69, 66, 79, 92, 84, 9, 57, 26, 26, 28, 83, 38], [50, 84, 76, 41, 64, 82, 20, 22, 64, 7, 38, 92, 39, 28, 22, 3, 41, 46, 47, 50, 88, 51, 9, 49, 38, 67, 26, 65, 89, 27, 71, 25, 77, 72, 65, 41, 84, 68, 51, 26, 84, 24, 79, 41, 96, 83, 92, 9, 93, 84, 35, 70, 74, 79, 37, 38, 26, 26, 41, 26]]) == [607, 855, 747, 655, 633, 825, 943, 905, 633, 1227, 685, 1009, 675, 805, 905, 1331, 655, 625, 619, 607, 929, 605, 1179, 611, 685, 653, 833, 639, 949, 819, 689, 851, 759, 699, 639, 655, 855, 661, 605, 833, 855, 869, 783, 655, 1097, 839, 1009, 1179, 1031, 855, 721, 679, 723, 783, 697, 685, 833, 833, 655, 833]\nassert my_solution.minOperations(**[[39, 21, 5, 58, 11, 73, 93, 87, 4, 63, 66, 64, 77, 60, 24, 2, 6, 82, 97, 94, 100, 92, 67, 52, 82, 97, 9, 99, 29, 31, 100, 67, 56, 28, 8, 81, 41, 18, 63, 43, 22, 60, 96, 91, 33, 22, 92, 16, 89], [82, 99, 21, 5, 91, 97, 85, 67, 33, 87, 92, 67, 33, 22, 64, 81, 44, 63, 43, 31, 56, 74, 62, 4, 57, 20, 9, 32, 30, 63, 39, 92, 6, 16, 92, 89, 60, 73, 38, 81, 56, 2, 39, 22, 63, 67, 1, 97, 66, 9, 37, 2, 32, 88, 2, 21, 2, 78, 87, 33, 9, 92, 96, 88, 92, 16, 41, 60, 32, 82, 67, 28, 99, 67, 19, 4, 45, 59, 100, 91]]) == [1630, 2145, 1901, 2473, 1849, 2059, 1699, 1405, 1637, 1745, 1878, 1405, 1637, 1872, 1382, 1611, 1490, 1377, 1499, 1671, 1390, 1498, 1376, 2518, 1385, 1932, 2309, 1654, 1690, 1377, 1547, 1878, 2430, 2060, 1878, 1795, 1374, 1483, 1562, 1611, 1390, 2612, 1547, 1872, 1377, 1405, 2661, 2059, 1396, 2309, 1577, 2612, 1654, 1770, 2612, 1901, 2612, 1560, 1745, 1637, 2309, 1878, 2020, 1770, 1878, 2060, 1521, 1374, 1654, 1630, 1405, 1730, 2145, 1405, 1963, 2518, 1481, 1377, 2190, 1849]\nassert my_solution.minOperations(**[[67, 53, 67, 35, 88, 76, 92, 99, 12, 80, 78, 11, 59, 49, 52, 50, 10, 89, 46, 100, 74, 90, 7, 76, 34, 78, 85, 74, 38, 12, 75, 46, 60, 43, 88, 32, 5, 61, 53, 99, 13, 82, 11, 75, 83, 80, 53, 98, 46, 95, 67, 70, 90, 21, 10, 23, 43, 80, 22, 23, 62, 74, 78, 4, 50, 47, 39, 82, 90, 73, 34, 47, 78, 89, 99, 76, 45, 64, 58, 14, 3, 57, 30, 21, 73, 32, 11, 76, 46], [59, 60, 14, 62, 61, 83, 45, 73, 45, 76, 73, 12, 50, 11, 55, 92, 22, 74, 73, 23, 32, 80, 73, 84, 92, 76, 82, 43, 22, 62, 80, 22, 53, 46, 82, 79, 75, 53, 76, 5, 51, 83, 77, 3, 50, 76, 98, 78, 49, 76, 19, 9, 6, 5, 27, 42, 41, 90, 52, 53, 75, 67, 76, 97, 49, 32, 76, 78, 99, 83, 23, 21, 72, 10, 73, 35, 25, 34, 34, 60, 66, 88, 13, 46, 49, 73, 38, 34, 78, 12, 99, 82, 89, 74, 14, 85, 47]]) == [2139, 2140, 3852, 2148, 2143, 2699, 2309, 2285, 2309, 2364, 2285, 3984, 2200, 4055, 2153, 3284, 3352, 2306, 2285, 3295, 2822, 2536, 2285, 2758, 3284, 2364, 2642, 2375, 3352, 2148, 2536, 3352, 2163, 2278, 2642, 2489, 2333, 2163, 2364, 4541, 2187, 2699, 2403, 4713, 2200, 2364, 3752, 2442, 2217, 2364, 3537, 4213, 4458, 4541, 3083, 2412, 2449, 3134, 2174, 2163, 2333, 2189, 2364, 3673, 2217, 2822, 2364, 2442, 3833, 2699, 3295, 3411, 2268, 4132, 2285, 2685, 3189, 2728, 2728, 2140, 2180, 3000, 3917, 2278, 2217, 2285, 2562, 2728, 2442, 3984, 3833, 2642, 3065, 2306, 3852, 2817, 2255]\nassert my_solution.minOperations(**[[58, 5, 26, 89, 15, 48, 13, 1, 29, 3, 46, 64, 70, 63, 47, 43, 74, 24, 19, 55, 15, 89, 91, 8, 51, 3], [1, 50, 48, 3, 89, 15, 34, 64, 61, 8, 47, 3, 47, 14, 89, 46, 3, 1, 5, 15, 58, 20, 89, 87, 81, 7, 51, 64, 40, 51, 63, 3, 52, 58, 46, 19, 3, 15, 20, 69, 63, 56, 47, 29, 49, 56, 12, 29, 40, 10, 15, 49, 49, 7, 55, 46, 54, 75, 47, 18, 57, 63, 63, 1, 89, 26, 47, 4, 48, 63, 69, 46, 1, 27, 48, 1, 56, 27, 32, 3, 51, 47, 1, 15, 79, 38, 21, 1, 46, 79, 1, 89]]) == [1023, 659, 647, 975, 1269, 773, 659, 801, 763, 881, 643, 975, 643, 787, 1269, 641, 975, 1023, 935, 773, 727, 725, 1269, 1229, 1109, 899, 665, 801, 647, 665, 787, 975, 673, 727, 641, 733, 975, 773, 725, 881, 787, 707, 643, 669, 653, 707, 817, 669, 647, 849, 773, 653, 653, 899, 697, 641, 689, 989, 643, 743, 717, 787, 787, 1023, 1269, 681, 643, 955, 647, 787, 881, 641, 1023, 677, 647, 1023, 707, 677, 663, 975, 665, 643, 1023, 773, 1069, 651, 717, 1023, 641, 1069, 1023, 1269]\nassert my_solution.minOperations(**[[54, 61, 55, 94, 47, 14, 87, 43, 44, 7, 40, 79, 67, 76, 77, 56, 33, 93, 100, 8, 63, 47, 92, 28, 13, 31, 40, 55, 8, 47, 43, 20, 45, 98, 81, 10, 47, 88, 79, 14, 12, 33, 24, 72, 21, 30, 74, 48, 55, 61, 51, 19, 67, 64, 72, 87, 49, 55, 66, 81, 85, 89, 43, 98, 44, 29, 99, 40, 98, 56, 31, 99, 6, 75, 3, 88, 7, 99, 89, 10, 40, 53, 94, 74, 21, 50, 76, 92], [88, 8, 93, 98, 55, 94, 81, 93, 7, 68, 44, 79, 30]]) == [3135, 4127, 3455, 3821, 2119, 3525, 2775, 3455, 4207, 2325, 2227, 2683, 2765]\nassert my_solution.minOperations(**[[59, 38, 85, 19, 76, 77, 41, 56, 98, 51, 99, 2, 83, 3, 23, 80, 51, 51, 55, 3, 95, 80, 24, 69, 94, 88, 3, 85, 100, 69, 45, 80, 95, 27, 17, 65, 91, 56, 11, 6, 94, 81, 85, 35, 13, 3, 43, 90, 39, 21, 24, 40, 68, 30, 64, 22, 77, 93, 43, 28, 16, 61, 93, 40, 69, 91, 36, 21, 17, 25, 83, 37, 67, 72, 96, 58, 52], [69, 69, 68, 91, 96, 18, 66, 3, 94, 36, 37, 95, 98, 91, 69, 17, 58, 12, 35, 43, 16, 91, 52, 3, 29, 70, 58, 3, 69, 3, 30, 44, 58, 54, 86, 85, 21, 99, 37, 21, 82, 62, 95, 91, 84, 96, 37, 1, 59, 79]]) == [2132, 2132, 2115, 2924, 3233, 2999, 2087, 3948, 3099, 2275, 2246, 3164, 3375, 2924, 2132, 3054, 2017, 3359, 2306, 2118, 3113, 2924, 2021, 3948, 2506, 2155, 2017, 3948, 2132, 3948, 2471, 2105, 2017, 2015, 2671, 2622, 2838, 3448, 2246, 2838, 2497, 2045, 3164, 2924, 2579, 3233, 2246, 4100, 2022, 2390]\nassert my_solution.minOperations(**[[91, 57, 64, 59, 38, 47, 4, 8, 51, 92, 42, 28, 21, 84, 30, 57, 67, 52, 74, 39, 59, 100, 72, 22, 12, 64, 79, 20, 100, 65, 100, 38, 15, 52, 62, 87, 32, 90, 40, 82], [39, 34, 53, 57, 45, 15, 64, 62, 32, 27, 71, 92, 89]]) == [1036, 1132, 908, 900, 968, 1638, 938, 922, 1172, 1290, 1042, 1532, 1442]\nassert my_solution.minOperations(**[[73, 52, 37, 8, 27, 36, 100, 46, 6, 81, 81, 83, 55, 98, 29, 2, 39, 62, 65, 82, 42, 10], [37, 15, 46, 67, 78, 44, 1, 9, 32, 65, 76, 82, 4, 42, 92, 2, 42, 81, 2, 55, 43, 2, 81, 80, 28, 8, 64, 9, 6, 46, 41, 61, 43, 9, 81, 7, 62, 10, 19, 47, 62, 54, 37, 82, 72, 37, 58, 54, 62, 81, 32, 82, 54, 81, 81, 32, 36, 62, 38, 67, 44, 10, 81, 29, 65, 47, 39, 62, 88, 45, 65, 52, 63, 10, 73, 6, 27, 36, 46, 12, 36, 37, 29, 55, 36, 43, 63, 37, 82]]) == [582, 852, 550, 618, 716, 554, 1092, 938, 630, 602, 696, 760, 1030, 558, 938, 1070, 558, 746, 1070, 556, 556, 1070, 746, 736, 672, 954, 596, 938, 990, 550, 562, 580, 556, 938, 746, 972, 584, 922, 796, 550, 584, 554, 582, 760, 658, 582, 568, 554, 584, 746, 630, 760, 554, 746, 746, 630, 590, 584, 576, 618, 554, 922, 746, 660, 602, 550, 570, 584, 866, 552, 602, 550, 590, 922, 666, 990, 684, 590, 550, 894, 590, 582, 660, 556, 590, 556, 590, 582, 760]\nassert my_solution.minOperations(**[[24, 87, 38, 16, 87, 42, 53, 17, 92, 91, 43, 44, 67, 54, 25, 65, 94, 65, 90, 79, 62, 5, 7, 68, 45, 39, 62, 98, 55, 72, 46, 52, 77, 27, 84, 67, 67, 30, 15, 33, 6, 35, 54, 6, 67, 80, 63, 67, 44, 22, 3, 57, 45, 52, 21, 34, 51], [43, 26, 15, 61, 76, 68, 7, 21, 45, 67, 5, 26, 67, 54, 15, 51, 17, 45, 17, 81, 84, 6, 44, 46, 42, 88, 67, 67, 51, 91, 94, 6, 92, 33, 59, 63, 55, 36, 55, 34, 21, 67, 79, 38, 75, 17, 67, 43, 38, 62, 33, 38, 81, 3, 25, 80, 11, 80, 63, 53, 3, 55, 54, 33, 43, 53, 67, 77, 6, 92, 23, 77, 25, 7, 77, 17, 52, 82, 29]]) == [1270, 1699, 2132, 1282, 1687, 1415, 2508, 1880, 1244, 1384, 2610, 1699, 1384, 1213, 2132, 1212, 2044, 1244, 2044, 1876, 1999, 2557, 1255, 1237, 1287, 2175, 1384, 1384, 1212, 2318, 2475, 2557, 2369, 1486, 1260, 1308, 1220, 1411, 1220, 1459, 1880, 1384, 1796, 1365, 1652, 2044, 1384, 1270, 1365, 1293, 1486, 1365, 1876, 2720, 1732, 1835, 2320, 1835, 1308, 1210, 2720, 1220, 1213, 1486, 1270, 1210, 1384, 1722, 2557, 2369, 1804, 1722, 1732, 2508, 1722, 2044, 1209, 1917, 1604]\nassert my_solution.minOperations(**[[8, 98, 26, 17, 45, 64, 68, 82, 58, 29, 58, 7, 40, 6, 16, 62, 46, 85, 64, 9, 72, 28, 34, 77, 5, 53, 9, 92, 39, 15, 95, 7, 41, 73, 27, 48, 44, 76, 6, 59, 59, 54, 55, 20, 86, 96, 69, 11, 86, 42, 83, 27, 94, 36, 64, 97, 24, 33, 50, 42, 52, 17, 5, 27, 76, 63, 30, 34, 62, 3, 36, 47], [64, 73, 9, 7, 73, 45, 64, 42, 86, 86, 94, 20, 54, 40, 1, 5, 8, 48, 27, 64, 77, 42, 29, 9, 76, 41, 27, 29, 77, 90, 76, 76, 58, 72, 16, 25, 42, 7, 62, 11, 48, 97, 65, 76, 54]]) == [1946, 2290, 2770, 2884, 2290, 1678, 1946, 1688, 2936, 2936, 3420, 2246, 1734, 1706, 3296, 3012, 2826, 1684, 1974, 1946, 2470, 1688, 1916, 2770, 2422, 1696, 1974, 1916, 2470, 3176, 2422, 2422, 1796, 2248, 2418, 2048, 1688, 2884, 1888, 2666, 1684, 3618, 1982, 2422, 1734]\nassert my_solution.minOperations(**[[5], [6, 5, 3, 1]]) == [1, 0, 2, 4]\nassert my_solution.minOperations(**[[769, 739, 249, 737, 380, 851, 222, 216, 38, 619, 475, 272, 547, 85, 160, 783, 737, 576, 138, 816, 273, 165, 667, 380, 7, 570, 597, 416, 36, 433, 995, 93, 126, 743, 861, 645, 270, 400, 267, 522, 505, 402, 378, 950, 261, 248, 861, 246, 192, 495, 879, 347, 96, 670, 321, 248, 199, 29, 829, 511, 834, 61, 617, 514, 263, 956, 330, 28, 511, 402, 109, 550, 896, 571, 798, 130, 441, 857, 921, 92, 734, 19, 468, 822, 249, 923, 66, 519, 278, 107, 610, 776, 378, 830, 678, 495, 717, 309, 468, 623, 603, 487, 164, 628, 35, 288, 549, 86, 657, 121, 449, 190, 306, 152, 880, 329, 384, 905, 446, 941, 322, 237, 334, 232, 216, 862, 397, 810, 714, 370, 589, 997, 686, 324, 614, 428, 620, 306, 256, 905, 835, 527, 970, 125, 595, 675, 682, 370, 240, 469, 820, 267, 176, 666, 147, 464, 442], [198, 794, 948, 830, 887, 623, 666, 912, 95, 225, 121, 155, 672, 531, 874, 241, 238, 531, 716, 247, 495, 663, 38, 619, 520, 122, 383, 272, 620, 975, 526, 260, 610, 216, 137, 866, 314, 380, 879, 834, 622, 465, 151, 458, 521, 278, 769, 442, 488, 330, 812, 581, 255, 264, 830, 111, 401, 754, 398, 86, 511, 246, 370, 125, 157, 199, 96, 274, 739, 669, 954, 107, 678, 810, 596, 689, 365, 323, 442, 880, 778, 143, 176, 272, 380, 370, 625, 380, 808, 905, 792, 105, 344, 66, 306, 830, 165, 805, 322, 270, 230, 240, 547, 434, 573, 807, 249, 165, 370, 814, 669, 7, 956, 122, 987, 270, 801, 703, 514, 837, 380, 302, 334, 603, 469, 798, 234, 893, 378, 93, 411, 862, 487, 964, 520, 98, 150, 662, 248, 36, 426, 240, 789, 861, 288, 143, 921, 903, 93, 286, 233, 775, 221, 147, 418, 862, 38, 667, 861, 667, 975, 856, 236, 476, 616, 728, 127, 176, 267, 671, 446, 12, 368, 861, 879, 442, 647, 905, 511, 905, 469, 330, 123, 917, 306, 482, 273, 61, 249, 371, 5, 272, 511, 216, 85, 736, 157, 36, 384, 96, 81, 348, 377, 549, 126, 468, 323, 861, 543, 322, 879, 380, 94, 549, 306, 549, 898, 252, 87, 338, 460, 402, 108, 438, 215, 306, 144, 575, 29, 380, 147, 85, 190, 238, 23, 587, 451, 308, 947, 686, 370, 956, 267, 241, 881, 861, 249, 247, 804, 614, 598, 383, 857, 717, 330, 201, 208, 511, 323, 905, 680, 949, 312, 9, 35, 416, 953, 864, 826, 574, 646, 696, 921, 511, 831, 861, 135, 973, 618, 522, 380, 165, 21, 370, 586, 195, 370, 494, 331, 623, 380, 861, 697, 822, 378, 248, 825, 340, 160, 401, 814, 126, 738, 271, 511, 905, 133, 36, 861, 83, 199, 468, 379, 678, 156, 117, 226, 329, 950, 682, 947, 862, 378, 797, 861, 739, 723, 609, 330, 323, 714, 1, 273, 221, 835, 820, 820, 609, 649, 442, 393, 740, 231, 123, 897, 628, 176, 627, 686, 920, 842, 249, 627, 290, 380, 95, 827, 511, 511, 861, 553, 147, 471, 4, 675, 306, 477, 952, 36, 737, 306, 234, 636, 88, 222, 158, 694, 267, 270, 726, 35, 126, 683, 627, 833, 93, 862, 378, 824, 513, 941, 805, 616, 115, 861, 519, 619, 436, 222, 461, 527, 58, 164, 468, 641, 337, 249, 615, 682, 227, 682, 495, 133, 861, 609, 834, 661, 829, 522, 756, 511, 172, 678, 381, 862, 154, 675, 137, 164, 622, 861, 194, 393, 576, 338, 812, 380, 509, 742, 933, 378, 571, 21, 851, 673, 173, 304, 308, 620, 742, 742, 494, 820, 151, 683, 140, 861, 300, 816, 571, 382, 797, 513, 246, 244, 85, 380, 152, 378, 375, 442, 821, 921, 324, 246, 38, 340, 723, 325, 861, 513, 834, 857, 29, 585, 606, 861, 678, 470, 923, 946, 894, 509, 29, 993, 216, 617, 272, 742, 812, 90, 514, 328, 739, 412, 578, 197, 822, 719, 255, 686, 984, 370, 313, 126, 156, 516, 666, 61, 835, 358, 276, 905, 736, 620, 787, 308, 832, 65, 327, 62, 813, 386, 620, 7, 861, 343, 6, 325, 35, 18, 465, 547, 321, 519, 619, 82, 858, 323, 95, 156, 516, 671, 736, 85, 270, 677, 248, 381, 89, 151, 107, 109, 857, 721, 521, 879, 522, 36, 749, 379, 260, 499, 406, 523, 960, 716, 381, 572, 617, 623, 322, 28, 270, 611, 263, 330, 575, 678, 126, 905, 65, 307, 452, 287, 248, 276, 664, 860, 307, 953, 970, 474, 92, 77, 656, 67, 204, 249, 378, 905, 248, 632, 505, 249, 31, 90, 717, 497, 330, 717, 862, 173, 852, 130, 216, 380, 834, 379, 880, 121, 380, 420, 823, 446, 855, 267, 248, 615, 954, 265, 511, 602, 107, 780, 2, 86, 164, 94, 737, 475, 123, 128, 667, 321, 828, 755, 21, 249, 613, 620, 549, 872, 378, 309, 246, 378, 122, 734, 626, 814, 106, 685, 730, 265, 670, 657, 269, 468, 380, 862, 306, 402, 854, 622, 861, 119, 109, 152, 130, 512, 623, 822, 837, 273, 483, 874, 389, 922, 736, 92, 905, 232, 115, 494, 108, 278, 821, 24, 322, 723, 951, 333, 666, 63, 859, 321, 783, 388, 468, 608, 674, 402, 93, 28, 735, 248, 107, 248, 684, 262, 672, 572, 296, 278, 630, 306, 737, 820, 192, 334, 380, 442, 193, 628, 446, 862, 944, 449, 461, 522, 739, 28, 324, 552, 254, 722, 611, 165, 670, 202, 102, 438, 270, 184, 163, 233, 443, 248, 33, 617, 93, 222, 511, 832, 289, 267, 563, 292, 36, 597, 252, 956, 141, 261, 113, 905, 959, 33, 879, 822, 483, 273, 505, 445, 516, 329, 5, 818, 275, 787, 547, 322, 647, 619, 104, 574, 330, 246, 935, 93, 810, 271, 830, 572, 267, 273, 619, 667, 487, 391, 549, 267, 596, 468, 667, 528, 861, 714, 513, 984, 615, 923, 384, 171, 896, 858, 525, 503, 617, 64, 468, 214, 619, 515, 447, 875, 430, 840, 716, 400, 337, 862, 669, 673, 309, 419, 126, 826, 243, 442, 240, 861, 822, 621, 398, 682, 619, 288, 946, 111, 511, 779, 677, 678, 507, 317, 373, 468, 954, 330, 489, 879, 868, 468, 63, 510, 713, 623, 775, 547, 721, 834, 830]]) == [48233, 55609, 75311, 59487, 66682, 41282, 44127, 70117, 59986, 45654, 56682, 52724, 44567, 37394, 64949, 44226, 44485, 37394, 48157, 43718, 36566, 43920, 67963, 41040, 37071, 56559, 37064, 41927, 41099, 79378, 37241, 42739, 40549, 46485, 54774, 63901, 39613, 37133, 65604, 59955, 41221, 36260, 53170, 36251, 37098, 41571, 53076, 36257, 36475, 38877, 57495, 39190, 43106, 42455, 59487, 57932, 36694, 51621, 36749, 61191, 36850, 43801, 37435, 56190, 52502, 48134, 59855, 41807, 50174, 44344, 76201, 58436, 45023, 57281, 39851, 45912, 37610, 39178, 36257, 65737, 53971, 54082, 50471, 41927, 37133, 37435, 41408, 37133, 57071, 69130, 55403, 58694, 38351, 63969, 40011, 59487, 51626, 56756, 39223, 42053, 45199, 44311, 37890, 36311, 38852, 56966, 43556, 51626, 37435, 57709, 44344, 72682, 76499, 56559, 81214, 42053, 56336, 47074, 36919, 60316, 37133, 40231, 38721, 40192, 36276, 56021, 44839, 67492, 37187, 60248, 36560, 63377, 36462, 77707, 37071, 59597, 53283, 43851, 43635, 68253, 36385, 44311, 55094, 63248, 41001, 54082, 71386, 68856, 60248, 41115, 44928, 53670, 46020, 53622, 36473, 63377, 67963, 44198, 63248, 44198, 79378, 62625, 44661, 36341, 40871, 49199, 55950, 50471, 42248, 44492, 36245, 71907, 37505, 63248, 65604, 36257, 42836, 69130, 36850, 69130, 36276, 38877, 56436, 70822, 40011, 36407, 41866, 64674, 43556, 37404, 72996, 41927, 36850, 46485, 61328, 49899, 52502, 68253, 37041, 59855, 61884, 38205, 37218, 37956, 56069, 36269, 39178, 63248, 37766, 39223, 65604, 37133, 60117, 37956, 40011, 37956, 68171, 43331, 61056, 38573, 36253, 36677, 58309, 36283, 46582, 40011, 53967, 38934, 69294, 37133, 53622, 61328, 49029, 44485, 70210, 39448, 36244, 39909, 75164, 45663, 37435, 76499, 42248, 44226, 65872, 63248, 43556, 43718, 56651, 40761, 39947, 37064, 62748, 48242, 38877, 47940, 47261, 36850, 39178, 69130, 45181, 75458, 39711, 72372, 68400, 36495, 76052, 63639, 59033, 38893, 42769, 46493, 71386, 36850, 59604, 63248, 55008, 79072, 40983, 37125, 37133, 51626, 70516, 37435, 39405, 48530, 37435, 36553, 38838, 41282, 37133, 63248, 46576, 58581, 37187, 43635, 58920, 38499, 52169, 36694, 57709, 56069, 50081, 41990, 36850, 69130, 55242, 68253, 63248, 61606, 48134, 36269, 37160, 45023, 52613, 57182, 45563, 38918, 75605, 45339, 75164, 63377, 37187, 55918, 63248, 50174, 48764, 40498, 38877, 39178, 47987, 73624, 41866, 46020, 60074, 58359, 58359, 40498, 42970, 36257, 36852, 50269, 45108, 56436, 68034, 41597, 50471, 41534, 45663, 71245, 60921, 43556, 41534, 40891, 37133, 59986, 59146, 36850, 36850, 63248, 38102, 53622, 36294, 73153, 44792, 40011, 36352, 75903, 68253, 49988, 40011, 44839, 42117, 60921, 45927, 52391, 46327, 42248, 42053, 49025, 68400, 56069, 45420, 41534, 59838, 60248, 63377, 37187, 58807, 36896, 74282, 56756, 40871, 57432, 63248, 37044, 41040, 36297, 45927, 36254, 37270, 65103, 51733, 36269, 42442, 38610, 43556, 40816, 45339, 45472, 45339, 36566, 55242, 63248, 40498, 59955, 43782, 59372, 37125, 51815, 36850, 50891, 45023, 37110, 63377, 52835, 44792, 54774, 51733, 41221, 63248, 48629, 36852, 38975, 38573, 57495, 37133, 36812, 50459, 73122, 37187, 38770, 70516, 62010, 44642, 50786, 40121, 39909, 41099, 50459, 50459, 36553, 58359, 53170, 45420, 54427, 63248, 40341, 57923, 38770, 37087, 55918, 36896, 43801, 43971, 61328, 37133, 53057, 37187, 37280, 36257, 58470, 71386, 39133, 43801, 67963, 38499, 48764, 39090, 63248, 36896, 59955, 62748, 69294, 39362, 40345, 63248, 45023, 36285, 71672, 75017, 67627, 36812, 69294, 82132, 46485, 40926, 41927, 50459, 57495, 60651, 36919, 38961, 50174, 36547, 39061, 48332, 58581, 48416, 43106, 45663, 80755, 37435, 39662, 56069, 52613, 36969, 44127, 64674, 60074, 37855, 41689, 69130, 49899, 41099, 54888, 39909, 59721, 64110, 39004, 64533, 57602, 36999, 41099, 72682, 63248, 38388, 72839, 39090, 68400, 70977, 36260, 37890, 39270, 37044, 41040, 61745, 62873, 39178, 59986, 52613, 36969, 44492, 49899, 61328, 42053, 44946, 43635, 37110, 60786, 53170, 58436, 58182, 62748, 48590, 37098, 65604, 37125, 68253, 51136, 37160, 42739, 36634, 36625, 37154, 77103, 48157, 37110, 38811, 40926, 41282, 39223, 69445, 42053, 40602, 42524, 38877, 38934, 45023, 56069, 69130, 64110, 39960, 36245, 41058, 43635, 41689, 43989, 63123, 39960, 76052, 78613, 36321, 60381, 62440, 43439, 63830, 47649, 43556, 37187, 69130, 43635, 41857, 36736, 43556, 68996, 60651, 48242, 36600, 38877, 48242, 63377, 50786, 62133, 55593, 46485, 37133, 59955, 37160, 65737, 56682, 37133, 36451, 58694, 36245, 62502, 42248, 43635, 40816, 76201, 42386, 36850, 40143, 58436, 54173, 73467, 61191, 51733, 60117, 49988, 36330, 56436, 55831, 44198, 39270, 59259, 51718, 70516, 43556, 40708, 41099, 37956, 64687, 37187, 39858, 43801, 37187, 56559, 49721, 41471, 57709, 58565, 45582, 49373, 42386, 44417, 43506, 42118, 36269, 37133, 63377, 40011, 36677, 62379, 41221, 63248, 56932, 58182, 53057, 55593, 36873, 41282, 58581, 60316, 41866, 36418, 64949, 36936, 71529, 49899, 60381, 69130, 45017, 57432, 36553, 58309, 41571, 58470, 70057, 39223, 48764, 75754, 38760, 44127, 64392, 62998, 39270, 54476, 36957, 36269, 40447, 44717, 36677, 60248, 69445, 49810, 43635, 58436, 43635, 45501, 42595, 44567, 38811, 40561, 41571, 41727, 40011, 49988, 58359, 48827, 38721, 37133, 36257, 48728, 41597, 36245, 63377, 74723, 36242, 36254, 37125, 50174, 69445, 39133, 38065, 43181, 48677, 40602, 51626, 44417, 47843, 59081, 36283, 42053, 49647, 51842, 44928, 36254, 43635, 68698, 40926, 60248, 45927, 36850, 59721, 40946, 42248, 38472, 40781, 68253, 39898, 43331, 76499, 54312, 42666, 57682, 69130, 76952, 68698, 65604, 58581, 36418, 41866, 36736, 36248, 36969, 38918, 72996, 58141, 41748, 54888, 37890, 39223, 42836, 41040, 58823, 38893, 38877, 43801, 73412, 60248, 57281, 41990, 59487, 38811, 42248, 41866, 41040, 44198, 36462, 36894, 37956, 42248, 39851, 36269, 44198, 37301, 63248, 47987, 36896, 80755, 40816, 71672, 37041, 50996, 67897, 62873, 37212, 36702, 40926, 64251, 36269, 46679, 41040, 36944, 36244, 65080, 36345, 60679, 48157, 36711, 38610, 63377, 44344, 44642, 39858, 36462, 56069, 59033, 44056, 36257, 44311, 63248, 58581, 41160, 36749, 45339, 41040, 41001, 75017, 57932, 36850, 54072, 44946, 45023, 36774, 39466, 37342, 36269, 76201, 38877, 36488, 65604, 64163, 36269, 64392, 36831, 47904, 41282, 53670, 37890, 48590, 59955, 59487]\nassert my_solution.minOperations(**[[544, 178, 526, 934, 40, 8, 560, 787, 695, 22, 542, 550, 11, 506, 858, 257, 370, 313, 405, 379, 580, 581, 736, 449, 835, 174, 442, 226, 256, 812, 685, 671, 287, 277, 639, 173, 576, 912, 150, 135, 425, 961, 520, 276, 21, 5, 932, 583, 200, 957, 213, 409, 572, 861, 975, 867, 504, 631, 875, 625, 829, 409, 719, 257, 567, 258, 592, 828, 833, 513, 551, 156, 481, 782, 856, 613, 4, 534, 280, 967, 95, 958, 234, 240, 71, 302, 401, 193, 435, 85, 258, 414, 629, 122, 518, 273, 514, 91, 981, 260, 213, 681, 746, 256, 689, 49, 370, 692, 447, 566, 196, 26, 621, 809, 740, 523, 312, 16, 185, 299, 232, 72, 831, 342, 74, 478, 736, 459, 978, 510, 240, 127, 568, 56, 284, 715, 674, 511, 670, 873, 338, 633, 786, 856, 541, 108, 390, 515, 21, 968, 458, 779, 767, 140, 517, 2, 743, 481, 123, 592, 733, 124, 139, 811, 174, 615, 63, 49, 670, 608, 492, 119, 687, 120, 380, 978, 723, 934, 404, 544, 980, 901, 195, 280, 542, 568, 332, 500, 422, 780, 77, 252, 625, 362, 686, 877, 574, 442, 842, 846, 665, 366, 310, 733, 169, 590, 910, 769, 15, 499, 520, 350, 25, 857, 779, 641, 216, 629, 632, 181, 738, 208, 101, 149, 827, 374, 517, 411, 127, 770, 603, 62, 872, 83, 714, 414, 610, 962, 888, 469, 411, 140, 593, 394, 807, 748, 28, 15, 899, 483, 168, 500, 363, 227, 133, 329, 114, 97, 792, 694, 917, 245, 895, 822, 186, 341, 169, 587, 288, 43, 618, 645, 987, 859, 251, 591, 193, 428, 150, 531, 732, 21, 260, 691, 105, 559, 97, 141, 889, 692, 128, 972, 195, 172, 57, 836, 880, 223, 918, 209, 334, 224, 447, 17, 408, 452, 81, 690, 433, 1000, 241, 114, 272, 777, 462, 716, 389, 371, 572, 609, 256, 8, 354, 329, 264, 354, 952, 751, 392, 43, 950, 846, 916, 493, 777, 264, 953, 355, 471, 993, 12, 27, 267, 770, 821, 44, 792, 777, 829, 839, 42, 267, 72, 963, 193, 939, 203, 834, 756, 64, 520, 609, 337, 402, 815, 73, 337, 203, 131, 671, 684, 493, 659, 526, 211, 537, 385, 28, 456, 834, 453, 475, 415, 454, 559, 843, 91, 114, 485, 560, 341, 249, 483, 702, 673, 135, 336, 231, 479, 136, 106, 659, 155, 884, 839, 376, 226, 636, 760, 479, 911, 647, 792, 692, 810, 8, 169, 106, 511, 353, 253, 634, 9, 90, 825, 451, 614, 335, 777, 839, 595, 836, 638, 380, 403, 412, 859, 464, 628, 985, 287, 758, 746, 232, 738, 715, 670, 840, 316, 917, 646, 415, 623, 958, 570, 78, 729, 129, 409, 205, 871, 189, 758, 149, 930, 936, 733, 535, 993, 955, 717, 843, 30, 756, 390, 395, 868, 603, 258, 280, 355, 233, 601, 771, 38, 749, 966, 890, 157, 627, 974, 685, 234, 524, 865, 156, 402, 48, 989, 234, 925, 268, 149, 635, 354, 553, 61, 610, 988, 741, 401, 445, 751, 682, 951, 776, 477, 732, 963, 641, 983, 421, 416, 934, 588, 978, 332, 399, 85, 575, 139, 974, 942, 159, 251, 652, 973, 457, 310, 511, 13, 419, 194, 348, 24, 770, 860, 453, 40, 80, 929, 253, 393, 224, 265, 864, 862, 184, 807, 770, 251, 508, 560, 105, 883, 114, 840, 199, 611, 685, 408, 383, 4, 845, 215, 464, 614, 14, 306, 114, 876, 562, 407, 765, 883, 600, 903, 269, 733, 99, 499, 662, 678, 153, 625, 996, 707, 21, 148, 873, 765, 438, 558, 393, 394, 213, 64, 471, 405, 882, 710, 989, 529, 948, 471, 512, 733, 364, 889, 802, 151, 873, 564, 31, 190, 132, 781, 818, 173, 573, 490, 457, 809, 749, 604, 302, 775, 765, 809, 882, 166, 791, 494, 395, 390, 519, 551, 465, 110, 178, 245, 506, 354, 485, 135, 152, 477, 728, 2, 350, 980, 887, 733, 821, 147, 197, 601, 503, 759, 419, 407, 869, 947, 664, 992, 714, 425, 480, 537, 169, 431, 737, 653, 799, 145, 515, 390, 854, 950, 674, 823, 573, 904, 434, 339, 371, 741, 581, 346, 373, 985, 806, 335, 568, 16, 850, 936, 722, 527, 89, 261, 462, 516, 500, 321, 355, 94, 572, 248, 179, 525, 901, 540, 521, 603, 816, 547, 572, 358, 443, 873, 415, 388, 67, 745, 171, 876, 425, 149, 352, 228, 873, 467, 627, 879, 152, 152, 740, 867, 126, 801, 170, 185, 453, 235, 654, 736, 299, 747, 389], [188, 551, 629, 252, 408, 685, 606, 633, 780, 17, 659, 207, 124, 228, 641, 446, 740, 901, 520, 140, 234, 515, 686, 73, 258, 748, 471, 21, 587, 572, 588, 43, 654, 733, 541, 434, 310, 277, 11, 952, 415, 490, 412, 287, 475, 953, 941, 462, 686, 935, 573, 491, 515, 174, 70, 889, 656, 447, 694, 821, 105, 366, 349, 874, 980, 235, 421, 390, 529, 453, 674, 135, 374, 517, 28, 44, 980, 843, 575, 168, 411, 952, 67, 416, 739, 592, 985, 834, 174, 475, 749, 21, 514, 371, 592, 335, 168, 258, 411, 507, 934, 350, 16, 865, 262, 553, 106, 529, 941, 114, 156, 226, 14, 821, 795, 354, 505, 419, 21, 148, 481, 411, 465, 147, 404, 258, 267, 614, 355, 79, 535, 364, 147, 503, 873, 980, 224, 21, 135, 152, 692, 2, 301, 702, 936, 521, 777, 207, 674, 779, 841, 777, 962, 568, 918, 462, 133, 355, 402, 551, 895, 401, 958, 637, 740, 551, 521, 674, 664, 973, 258, 682, 200, 26, 500, 168, 816, 958, 718, 899, 746, 836, 411, 733, 79, 740, 816, 74, 716, 85, 736, 458, 572, 57, 471, 827, 884, 257, 987, 936, 524, 756, 689, 433, 499, 871, 373, 335, 801, 609, 747, 586, 56, 151, 514, 506, 890, 506, 963, 106, 955, 953, 390, 114, 879, 85, 515, 213, 21, 747, 733, 273, 807, 213, 153, 646, 14, 213, 178, 765, 810, 253, 568, 965, 155, 506, 685, 89, 139, 782, 843, 203, 122, 765, 717, 953, 105, 208, 404, 149, 833, 363, 80, 251, 467, 642, 105, 810, 714, 510, 736, 447, 9, 156, 402, 807, 58, 45, 88, 581, 936, 695, 568, 809, 729, 520, 770, 144, 867, 606, 978, 220, 370, 468, 397, 711, 114, 241, 784, 728, 912, 184, 73, 733, 918, 769, 354, 28, 434, 258, 401, 14, 702, 306, 354, 81, 890, 197, 195, 49, 72, 573, 900, 925, 465, 560, 415, 633, 208, 49, 775, 91, 240, 798, 477, 882, 572, 621, 978, 193, 889, 687, 511, 56, 211, 105, 171, 350, 241, 335, 567, 519, 341, 645, 917, 524, 97, 517, 480, 888, 97, 329, 15, 759, 131, 361, 613, 132, 603, 250, 957, 347, 611, 407, 54, 393, 701, 240, 953, 4, 170, 258, 733, 352, 526, 515, 665, 91, 873, 334, 518, 526, 692, 684, 811, 457, 300, 392, 251, 520, 651, 13, 114, 731, 440, 150, 673, 845, 862, 714, 462, 671, 128, 587, 273, 749, 483, 198, 228, 408, 759, 90, 156, 717, 361, 390, 388, 49, 156, 740, 654, 883, 733, 159, 409, 779, 158, 816, 354, 415, 394, 276, 647, 310, 120, 690, 917, 389, 64, 789, 537, 684, 485, 140, 865, 760, 169, 685, 752, 12, 654, 90, 8, 613, 433, 225, 614, 716, 236, 694, 875, 296, 62, 720, 568, 596, 947, 950, 174, 729, 749, 71, 13, 287, 736, 757, 927, 98, 129, 615, 114, 827, 558, 645, 271, 233, 173, 279, 482, 79, 777, 395, 415, 170, 265, 733, 453, 462, 734, 59, 746, 433, 156, 139, 685, 190, 667, 196, 105, 963, 590, 156, 547, 572, 786, 685, 264, 637, 771, 958, 159, 471, 846, 468, 258, 916, 97, 106, 485, 641, 592, 884, 917, 982, 166, 544, 749, 452, 846, 523, 869, 827, 127, 64, 127, 493, 392, 743, 131, 710, 152, 442, 287, 926, 253, 520, 765, 172, 603, 232, 733, 605, 464, 415, 354, 410, 796, 979, 224, 575, 342, 190, 976, 862, 288, 576, 654, 81, 650, 21, 257, 321, 560, 533, 449, 936, 516, 390, 520, 149, 537, 544, 846, 260, 40, 402]]) == [260783, 187893, 200175, 233673, 191639, 214601, 195551, 201077, 249071, 364757, 207469, 252135, 294505, 243141, 202963, 187405, 232677, 314077, 185651, 285345, 240685, 185455, 214897, 326237, 231465, 235739, 185789, 361861, 192369, 190185, 192523, 346425, 206189, 230119, 187019, 188543, 214703, 225009, 369161, 347765, 190679, 185283, 191077, 221797, 185629, 348455, 340281, 186241, 214897, 336237, 190319, 185271, 185455, 267519, 328215, 306503, 206701, 187317, 217331, 268419, 305915, 199715, 203753, 297323, 367619, 240287, 189953, 194683, 186163, 186827, 211469, 288153, 197953, 185525, 356881, 345739, 367619, 279817, 190597, 270517, 191213, 347765, 330201, 190555, 232305, 193153, 371301, 275037, 267519, 185629, 236131, 361861, 185425, 198599, 193153, 207447, 270517, 231465, 191213, 185283, 335567, 203497, 365483, 292069, 230059, 188085, 305301, 186163, 340281, 300441, 276689, 243971, 366947, 268419, 255935, 202495, 185259, 190189, 361861, 280935, 185433, 191213, 186077, 281483, 192255, 231465, 228335, 197063, 202255, 322329, 186569, 200167, 281483, 185241, 296725, 367619, 244811, 361861, 288153, 278785, 216707, 375903, 217435, 219857, 336907, 185701, 247735, 252135, 211469, 248623, 278739, 247735, 354725, 189685, 325031, 186241, 289293, 202255, 192577, 187893, 310281, 192743, 351923, 202009, 232677, 187893, 185701, 211469, 208773, 362547, 231465, 213735, 255251, 358295, 185223, 270517, 265943, 351923, 225017, 312809, 234961, 276083, 191213, 230119, 322329, 232677, 265943, 325583, 224351, 318463, 231199, 186483, 190185, 336899, 185789, 271441, 303397, 231825, 372785, 336907, 185859, 238923, 215795, 188645, 185223, 295551, 198167, 207447, 258735, 196099, 235349, 192217, 337575, 279317, 185425, 185269, 307131, 185269, 355429, 305301, 349839, 348455, 194683, 300441, 300337, 318463, 185455, 249505, 361861, 235349, 230119, 226327, 261567, 249505, 278259, 204185, 366947, 249505, 265567, 242609, 263007, 233299, 189685, 356845, 277211, 185269, 214601, 315911, 285903, 249973, 279817, 253907, 295683, 242609, 224683, 348455, 305915, 251693, 192255, 280389, 274519, 200395, 321681, 234049, 185977, 203207, 305915, 263007, 223695, 185329, 231199, 187317, 370645, 276689, 192577, 261567, 336225, 345055, 316549, 191461, 336907, 217645, 189685, 262523, 228739, 185651, 244707, 283135, 293221, 195551, 366159, 246513, 198819, 185929, 193427, 222729, 300441, 237915, 250881, 228397, 321135, 262679, 326237, 230119, 325031, 244285, 202495, 356881, 188543, 231465, 192743, 366947, 219857, 215911, 202495, 321035, 307131, 256605, 257515, 342321, 326893, 190319, 313443, 329623, 186077, 188779, 190679, 201077, 251693, 342321, 246865, 314641, 238307, 257333, 185553, 302165, 190185, 198481, 366159, 258437, 306503, 215195, 185347, 337575, 250377, 305915, 269005, 203497, 237915, 207447, 189567, 185607, 205827, 203939, 324377, 185859, 310871, 185525, 185459, 305879, 310871, 209149, 366213, 240139, 290439, 200857, 196867, 289865, 195007, 234431, 351227, 204267, 196479, 191789, 338931, 194127, 219541, 238307, 348455, 374391, 269505, 231465, 230119, 202993, 185973, 185455, 209037, 314641, 296725, 207727, 185565, 185973, 216707, 214311, 263493, 186547, 217743, 194311, 234049, 185651, 205433, 367683, 300441, 229427, 187957, 279851, 211191, 280905, 290351, 223695, 186241, 210639, 292169, 192369, 226327, 236131, 185389, 256153, 243141, 191639, 240139, 315275, 276689, 224683, 200857, 194683, 195075, 342321, 276689, 232677, 206189, 302779, 230119, 275139, 191493, 248623, 275655, 265943, 202495, 190679, 193947, 225337, 204433, 214703, 296867, 216097, 324377, 194877, 332193, 253161, 186713, 214311, 185353, 285345, 292069, 240549, 270007, 214601, 237323, 368421, 206189, 315275, 371389, 196867, 188645, 244391, 197063, 224351, 239891, 217331, 297921, 218987, 333531, 225687, 189685, 193817, 344347, 346391, 267519, 228739, 236131, 327553, 367683, 221797, 231199, 239327, 330939, 310249, 291591, 197263, 300441, 271441, 188575, 203939, 226993, 241089, 268011, 224357, 185411, 322329, 247735, 193771, 190679, 269505, 229019, 230119, 186827, 186241, 230479, 335551, 234961, 188645, 276689, 285903, 214601, 259841, 209569, 257059, 305915, 355429, 192835, 276689, 187531, 190185, 251789, 214601, 229363, 202009, 245137, 351923, 275139, 185789, 281451, 185929, 231465, 323727, 310871, 305301, 185353, 202963, 193153, 303397, 324377, 369089, 271541, 187267, 236131, 186905, 281451, 185805, 294383, 271441, 292749, 332193, 292749, 185249, 194311, 233813, 290439, 222407, 278785, 187765, 221797, 330281, 233299, 185651, 242609, 268507, 195007, 241495, 230119, 195369, 186129, 190679, 202495, 191353, 256401, 366889, 244811, 190597, 205565, 259841, 364711, 290351, 221483, 190739, 206189, 321035, 205183, 361861, 231825, 211469, 188779, 186431, 187149, 336907, 185489, 194683, 185651, 280389, 186713, 187267, 281451, 230757, 348499, 192577]\nassert my_solution.minOperations(**[[718, 452, 864, 128, 794, 314, 518, 420, 799, 238, 682, 27, 335, 626, 849, 483, 223, 476, 535, 825, 178, 828, 830, 835, 341, 235, 871, 377, 950, 16, 187, 994, 860, 89, 307, 756, 194, 779, 877, 214, 51, 840, 389, 844, 271, 968, 948, 487, 734, 538, 826, 340, 919, 706, 259, 355, 398, 159, 395, 520, 246, 722, 994, 175, 419, 512, 925, 947, 884, 596, 531, 487, 476, 283, 430, 488, 342, 322, 80, 101, 767, 543, 503, 422, 460, 41, 885, 798, 969, 679, 26, 238, 296, 828, 408, 48, 341, 957, 654, 980, 982, 507, 966, 656, 867, 839, 16, 633, 109, 673, 79, 530, 769, 11, 811, 783, 166, 884, 720, 926, 142, 534, 570, 250, 534, 567, 141, 131, 200, 341, 854, 921, 721, 606, 67, 238, 598, 716, 743, 307, 806, 121, 537, 755, 331, 210, 377, 571, 916, 521, 904, 316, 60, 875, 514, 307, 824, 944, 220, 97, 919, 447, 544, 365, 118, 891, 351, 913, 831, 662, 692, 407, 222, 52, 17, 256, 32, 142, 228, 228, 204, 321, 628, 755, 906, 682, 120, 903, 460, 928, 728, 520, 858, 215, 689, 976, 819, 995, 702, 6, 364, 822, 655, 709, 1000, 872, 109, 51, 539, 993, 316, 360, 618, 908, 446, 680, 192, 876, 437, 9, 790, 378, 451, 966, 989, 523, 59, 232, 864, 323, 230, 626, 235, 887, 759, 376, 10, 350, 588, 235, 772, 659, 747, 352, 827, 804, 145, 279, 579, 473, 296, 806, 489, 89, 925, 653, 898, 734, 767, 861, 281, 611, 268, 33, 451, 810, 606, 508, 243, 24, 680, 234, 938, 478, 783, 686, 296, 984, 576, 654, 632, 645, 98, 346, 262, 937, 899, 873, 589, 440, 604, 397, 300, 67, 206, 150, 508, 271, 745, 924, 862, 922, 665, 737, 907, 372, 599, 389, 31, 566, 230, 445, 895, 357, 610, 88, 654, 78, 295, 157, 671, 631, 693, 842, 623, 689, 449, 122, 770, 176, 241, 1000, 111, 277, 234, 248, 870, 896, 494, 988, 412, 68, 183, 531, 103, 755, 752, 730, 364, 927, 934, 265, 485, 207, 536, 395, 321, 371, 463, 729, 206, 903, 775, 394, 225, 740], [984, 628, 88, 103, 123, 922, 234, 54, 1000, 238, 876, 233, 683, 153, 543, 785, 861, 770, 271, 661, 268, 674, 234, 588, 67, 414, 628, 340, 914, 332, 497, 610, 534, 809, 877, 420, 531, 91, 800, 680, 476, 571, 424, 460, 829, 271, 142, 682, 356, 341, 38, 452, 937, 924, 244, 729, 473, 598, 321, 896, 956, 928, 949, 421, 538, 729, 819, 296, 308, 1000, 682, 456, 307, 243, 110, 806, 477, 262, 48, 791, 230, 571, 781, 873, 88, 871, 632, 203, 859, 79, 654, 877, 734, 464, 722, 408, 631, 672, 335, 823, 299, 991, 738, 223, 460, 447, 476, 831, 922, 109, 529, 806, 776, 512, 869, 321, 926, 250, 509, 594, 695, 995, 477, 206, 394, 929, 193, 968, 846, 386, 908, 78, 712, 59, 714, 602, 262, 985, 225, 215, 667, 922, 314, 265, 893, 903, 175, 523, 827, 321, 234, 925, 371, 49, 839, 993, 770, 896, 670, 196, 587, 21, 390, 142, 446, 452, 214, 408, 487, 597, 536, 910, 119, 243, 279, 884, 395, 692, 296, 487, 296, 641, 234, 26, 439, 296, 626, 611, 79, 241, 482, 680, 867, 657, 718, 631, 131, 537, 586, 357, 154, 770, 321, 366, 640, 51, 364, 719, 806, 734, 938, 234, 512, 532, 460, 708, 228, 990, 220, 825, 78, 7, 389, 907, 745, 359, 234, 2, 142, 531, 937, 368, 828, 539, 656, 205, 207, 296, 349, 822, 925, 300, 377, 689, 488, 418, 570, 78, 576, 279, 11, 839, 721, 595, 222, 606, 230, 534, 925, 780, 540, 885, 122, 629, 247, 296, 534, 734, 121, 862, 987, 341, 757, 598, 412, 611, 307, 938, 783, 32, 568, 659, 861, 553, 537, 514, 176, 895, 119, 568, 452, 516, 258, 601, 364, 307, 867, 525, 821, 24, 530, 142, 831, 875, 707, 857, 895, 24, 680, 618, 248, 737, 341, 120, 489, 307, 136, 802, 627, 685, 234, 100, 414, 568, 855, 605, 271, 406, 371, 804, 507, 925, 912, 142, 587, 925, 235, 629, 314, 225, 307, 850, 54, 283, 885, 721, 745, 606, 263, 473, 847, 341, 825, 296, 860, 705, 945, 341, 10, 280, 938, 228, 309, 462, 891, 356, 350, 827, 446, 861, 89, 919, 981, 994, 230, 532, 247, 350, 983, 508, 148, 903, 268, 503, 927, 904, 173, 865, 109, 350, 582, 68, 606, 596, 419, 937, 828, 534, 904, 487, 78, 871, 588, 521, 250, 451, 606, 307, 632, 452, 881, 519, 925, 480, 859, 862, 536, 824, 932, 895, 680, 171, 350, 675, 88, 830, 79, 16, 210, 235, 241, 411, 471, 26, 772, 51, 885, 906, 796, 729, 913, 918, 570, 297, 831, 222, 568, 903, 724, 206, 912, 740, 372, 567, 966, 355, 10, 771, 654, 885, 238, 998, 465, 686, 17, 23, 536, 872, 731, 365, 802, 842, 246, 740, 218, 523, 720, 238, 828, 518, 556, 159, 49, 654, 452, 923, 51, 716, 228, 230, 89, 533, 846, 233, 176, 67, 261, 654, 3, 413, 361, 570, 865, 81, 764, 988, 819, 876, 815, 232, 68, 235, 292, 215, 461, 947, 235, 875, 566, 92, 184, 101, 728, 799, 316, 994, 645, 48, 488, 485, 764, 967, 537, 985, 832, 923, 530, 332, 919, 207, 530, 99, 980, 156, 25, 444, 316, 150, 922, 801, 244, 350, 356, 192, 352, 830, 903, 102, 842, 24, 997, 287, 944, 821, 238, 865, 966, 645, 389, 10, 277, 806, 389, 346, 395, 858, 187, 408, 632, 395, 342, 827, 352, 537, 983, 159, 235, 459, 951, 377, 101, 238, 487, 207, 229, 682, 892, 529, 493, 755, 903, 925, 246, 875, 377, 333, 542, 520, 67, 289, 121, 266, 521, 419, 345, 638, 482, 905, 567, 754, 149, 16, 507, 882, 483, 626, 68, 101, 766, 655, 133, 563, 26, 599, 748, 806, 829, 871, 213, 26, 543, 508, 963, 994, 238, 999, 861, 389, 822, 146, 448, 806, 947, 323, 207, 223, 223, 673, 218, 955, 944, 941, 907, 738, 653, 994, 995, 950, 24, 29, 876, 375, 936, 719, 449, 281, 29, 755, 443, 570, 283, 895, 17, 921, 628, 995, 350, 968, 257, 589, 777, 826, 29, 660, 281, 307, 845, 515, 995, 915, 585, 781, 898, 97, 819, 689, 843, 147, 238, 821, 536, 411, 680, 728, 300, 283, 873, 794, 5, 177, 235, 222, 144, 576, 92, 770, 682, 872, 503, 130, 904, 770, 541, 365, 506, 307, 230, 779, 693, 831, 273, 154, 767, 67, 79, 408, 313, 567, 876, 520, 969, 534, 492, 21, 414, 36, 654, 296, 200, 89, 961, 430, 867, 775, 206, 887, 689, 571, 855, 200, 397, 680, 472, 877, 985, 862, 565, 194, 840, 913, 32, 925, 19, 690, 900, 119, 174, 274, 22, 459, 977, 721, 51, 9, 243, 558, 515, 598, 825, 622, 741, 112, 357, 922, 341, 430, 50, 855, 507, 335, 980, 408, 447, 505]]) == [168809, 96351, 161747, 157149, 151251, 148343, 122525, 172675, 174503, 121687, 135397, 122743, 101011, 142855, 92881, 115633, 131635, 112957, 115365, 98885, 115911, 100105, 122525, 94247, 168415, 97113, 96351, 104517, 145949, 105611, 92993, 95271, 92713, 120181, 135659, 96671, 92689, 160819, 118431, 100695, 93579, 93627, 96395, 94251, 124281, 115365, 145869, 100903, 102543, 104383, 178061, 94635, 153073, 148955, 120483, 106609, 93699, 94669, 107155, 140775, 159297, 150205, 156975, 96601, 92773, 106609, 122195, 111045, 109123, 174503, 100903, 94443, 109277, 120681, 155053, 119587, 93543, 117021, 174675, 116739, 123401, 93627, 114905, 134621, 161747, 134111, 96625, 129787, 131157, 164575, 98271, 135659, 107307, 94077, 105669, 97565, 96555, 99911, 105197, 123013, 110559, 171269, 107885, 124993, 94251, 94905, 93579, 124719, 148343, 155349, 92683, 119587, 114011, 92737, 133609, 107155, 149575, 119307, 92773, 94497, 102359, 172693, 93543, 129041, 98701, 150523, 132303, 163311, 128109, 99433, 144183, 164893, 104403, 171025, 104651, 94859, 117021, 169159, 124533, 126873, 99439, 148343, 108199, 116463, 139951, 142739, 136957, 92671, 123849, 107155, 122525, 149263, 100893, 174339, 126503, 171977, 112957, 140775, 99721, 131545, 94209, 183935, 99061, 145869, 94963, 94635, 127111, 97565, 93213, 94625, 92739, 144771, 152407, 120681, 113945, 137507, 98613, 102007, 111045, 93213, 111045, 97289, 122525, 182179, 95397, 111045, 96219, 95327, 164575, 121081, 93371, 100695, 133109, 98529, 105151, 96555, 148969, 92755, 94171, 102427, 142583, 112957, 107155, 101423, 97215, 173667, 101637, 105279, 119587, 107307, 153395, 122525, 92737, 92697, 94251, 103909, 123849, 170915, 125693, 123427, 164893, 188937, 99151, 143891, 108921, 102199, 122525, 190765, 145869, 92689, 153073, 101211, 124063, 92793, 98441, 129289, 128797, 111045, 103379, 122807, 149263, 110397, 100281, 101665, 93187, 96817, 93595, 164893, 93797, 113945, 187487, 126503, 105537, 94539, 125225, 95055, 123401, 92713, 149263, 114725, 92815, 137775, 151537, 96419, 119891, 111045, 92713, 107307, 151825, 131877, 169859, 104383, 110789, 94669, 97261, 95327, 109277, 153395, 115265, 180103, 93535, 98705, 131635, 93139, 92755, 92717, 136693, 140499, 152407, 93535, 94635, 92701, 117775, 94811, 101637, 109277, 133109, 92675, 122603, 182879, 92685, 145869, 124719, 135137, 103787, 130683, 140499, 182879, 100695, 95733, 119695, 107739, 104383, 152115, 93163, 109277, 147559, 118815, 96285, 101227, 122525, 158057, 97113, 93535, 130211, 95005, 115365, 97723, 100893, 119199, 92801, 149263, 145359, 145869, 94209, 149263, 122311, 96419, 108199, 124533, 109277, 129039, 172675, 113253, 137775, 105537, 108921, 95055, 116835, 93699, 128341, 104383, 123427, 111045, 131395, 103545, 155665, 104383, 187847, 113771, 153395, 123849, 108969, 94163, 139403, 102543, 103255, 123849, 94963, 131635, 161435, 147435, 167767, 172333, 123401, 92697, 119891, 103255, 168461, 92785, 144219, 142739, 115911, 92873, 149889, 143025, 137489, 132613, 155349, 103255, 94019, 168093, 95055, 94581, 96743, 153073, 124063, 92713, 143025, 93213, 164893, 134111, 94247, 92671, 119307, 94685, 95055, 109277, 96625, 94635, 136715, 92679, 149263, 93439, 131157, 131877, 92739, 123219, 151477, 140499, 100695, 138021, 103255, 100203, 161747, 124499, 164575, 185697, 128071, 122311, 121081, 97337, 93783, 182179, 113305, 173667, 137775, 143601, 117673, 106609, 145653, 147137, 93595, 110883, 124719, 125225, 93535, 142739, 105937, 129041, 145359, 108177, 100789, 93505, 162635, 102659, 187847, 113131, 98271, 137775, 121687, 173779, 94035, 101335, 185343, 183231, 92739, 134365, 106887, 101529, 118815, 127185, 120087, 108177, 126165, 92671, 105407, 121687, 124063, 92685, 93217, 141227, 174339, 98271, 94635, 148649, 173667, 104899, 123849, 123401, 161435, 92705, 128109, 122743, 136693, 168415, 117209, 98271, 190399, 97187, 101973, 93595, 132613, 163945, 111947, 170209, 122195, 135397, 121387, 122961, 168093, 122311, 111723, 126873, 94207, 156317, 122311, 135137, 93477, 160511, 134611, 157753, 106473, 118239, 107895, 172333, 97585, 174675, 93187, 93273, 111947, 162973, 92755, 169159, 124941, 148649, 92685, 105611, 147435, 128797, 92685, 158361, 167421, 142039, 182529, 95085, 107895, 143671, 148343, 118623, 120483, 103255, 102543, 132557, 103013, 124499, 142739, 157451, 127185, 182879, 173417, 112573, 155339, 122603, 121687, 132613, 162635, 97585, 99151, 187847, 114297, 119587, 99151, 103751, 98613, 130919, 133837, 97565, 96625, 98613, 104255, 123849, 103013, 92755, 168461, 141227, 122311, 94299, 157637, 100281, 157753, 121687, 93213, 128797, 123625, 100903, 139677, 92683, 93075, 110463, 142739, 149263, 120087, 135137, 100281, 105473, 92859, 92673, 168415, 112233, 151825, 116279, 92671, 96743, 103877, 97067, 93371, 143313, 93505, 110307, 143945, 185697, 92801, 136979, 93337, 96219, 168093, 157753, 112279, 98355, 148405, 93399, 182179, 94715, 109379, 119587, 124281, 134111, 127351, 182179, 92881, 92785, 161633, 172333, 121687, 174141, 131635, 99151, 122807, 144767, 94849, 119587, 156317, 106869, 128797, 124993, 124993, 100007, 126165, 158965, 155339, 154367, 143891, 107885, 98193, 172333, 172693, 157305, 182879, 181139, 135397, 100483, 152753, 105279, 94793, 113597, 181139, 110463, 95147, 93595, 113253, 140499, 185343, 148039, 96351, 172693, 103255, 163311, 117965, 94287, 114189, 123637, 181139, 98795, 113597, 109277, 127877, 92709, 172693, 146245, 94133, 114905, 141331, 158971, 122195, 101665, 127415, 144493, 121687, 122603, 92739, 97337, 100695, 106473, 110397, 113253, 134621, 117297, 189667, 136431, 122311, 125225, 145317, 93797, 160511, 112957, 100903, 134365, 92873, 149253, 143025, 112957, 92837, 101529, 92819, 109277, 123401, 114545, 102123, 124719, 115009, 142583, 112445, 168415, 164575, 97565, 108353, 93505, 135397, 92673, 163651, 92713, 93097, 183935, 97113, 178741, 98271, 111045, 130537, 161435, 160965, 95987, 133109, 113833, 129041, 138315, 101665, 93627, 130211, 130537, 98445, 100695, 93741, 135659, 169159, 131877, 93451, 132049, 126729, 145653, 180103, 149263, 184639, 101779, 141893, 152407, 137223, 114831, 183583, 94299, 166389, 105537, 173667, 188209, 120681, 93269, 92709, 94669, 123427, 95973, 108325, 154463, 102427, 148343, 104383, 95987, 174003, 130211, 92801, 105197, 167421, 97565, 94905, 92837]\nassert my_solution.minOperations(**[[665, 448, 939, 151, 12, 470, 33, 709, 310, 974, 341, 62, 295, 9, 883, 79, 1, 181, 241, 974, 910, 198, 664, 277, 258, 77, 107, 417, 911, 385, 323, 614, 954, 41, 388, 457, 301, 778, 154, 715, 293, 703, 907, 830, 466, 553, 949, 262, 824, 709, 899, 469, 658, 379, 439, 479, 123, 989, 910, 567, 656, 111, 583, 746, 684, 205, 720, 345, 730, 131, 731, 264, 735, 708, 276, 943, 548, 89, 806, 917, 343, 141, 883, 947, 724, 161, 280, 900, 468, 968, 287, 96, 701, 193, 964, 225, 569, 686, 635, 151, 769, 676, 683, 585, 846, 857, 160, 607, 427, 678, 8, 27, 346, 790, 780, 291, 500, 782, 357, 186, 843, 152, 571, 740, 471, 857, 218, 75, 15, 377, 446, 750, 970, 227, 890, 298, 578, 275, 166, 247, 169, 454, 700, 106, 834, 200, 413, 347, 411, 434, 528, 394, 504, 153, 580, 278, 608, 602, 456, 968, 148, 928, 824, 19, 952, 135, 937, 807, 748, 702, 372, 215, 187, 111, 372, 395, 976, 101, 32, 797, 916, 20, 899, 142, 499, 893, 375, 280, 698, 866, 730, 820, 948, 166, 773, 711, 108, 280, 805, 173, 596, 228, 106, 695, 755, 979, 771, 936, 877, 839, 342, 151, 607, 290, 400, 399, 575, 938, 565, 35, 356, 297, 110, 9, 513, 184, 493, 962, 591, 36, 775, 417, 287, 771, 752], [17, 468, 243, 323, 280, 152, 665, 678, 825, 692, 343, 85, 33, 805, 746, 151, 731, 824, 829, 746, 468, 397, 656, 343, 335, 153, 297, 762, 807, 151, 417, 936, 231, 890, 964, 345, 348, 428, 703, 103, 709, 199, 913, 899, 782, 342, 750, 769, 698, 51, 426, 976, 930, 295, 216, 8, 177, 111, 470, 166, 974, 225, 33, 969, 444, 151, 860, 836, 195, 99, 906, 280, 617, 820, 824, 976, 858, 280, 704, 503, 833, 607, 937, 979, 448, 502, 900, 508, 891, 108, 730, 949, 900, 293, 730, 678, 5, 87, 345, 106, 126, 734, 893, 470, 32, 293, 773, 153, 953, 133, 280, 31, 979, 287, 937, 107, 616, 377, 394, 219, 529, 276, 288, 912, 779, 964, 976, 778, 259, 857, 974, 673, 172, 200, 142, 377, 937, 443, 568, 346, 707, 961, 468, 730, 287, 454, 751, 771, 780, 968, 750, 910, 979, 857, 911, 166, 415, 468, 166, 779, 903, 106, 964, 151, 399, 683, 899, 683, 701, 151, 702, 937, 298, 446, 184, 910, 750, 39, 404, 942, 345, 776, 477, 910, 610, 243, 145, 225, 617, 341, 965, 35, 839, 596, 778, 15, 698, 899, 824, 974, 700, 227, 665, 574, 608, 70, 699, 637, 659, 779, 695, 857, 849, 388, 910, 769, 730, 394, 604, 715, 428, 830, 911, 585, 644, 707, 166, 68, 375, 399, 85, 305, 910, 952, 244, 300, 186, 265, 352, 434, 626, 110, 892, 891, 34, 153, 551, 185, 287, 607, 702, 591, 708, 150, 108, 166, 36, 280, 917, 683, 434, 280, 867, 658, 937, 968, 346, 869, 703, 475, 289, 778, 579, 746, 577, 85, 968, 831, 19, 211, 772, 151, 397, 287, 150, 383, 538, 978, 280, 1, 486, 107, 276, 334, 908, 35, 911, 499, 457, 9, 665, 76, 166, 27, 35, 111, 591, 583, 750, 857, 153, 602, 165, 736, 698, 457, 711, 822, 278, 734, 198, 9, 771, 607, 151, 731, 917, 635, 892, 960, 25, 160, 772, 242, 280, 254, 782, 972, 579, 154, 576, 607, 10, 108, 748, 954, 748, 166, 217, 378, 976, 947, 700, 280, 215, 295, 894, 676, 828, 583, 287, 685, 695, 279, 566, 740, 709, 863, 594, 29, 10, 931, 227, 771, 493, 707, 974, 528, 280, 8, 709, 395, 968, 950, 583, 280, 949, 280, 948, 895, 264, 343, 587, 470, 460, 710, 720, 249, 607, 456, 296, 264, 568, 490, 949, 108, 470, 713, 278, 910, 248, 198, 129, 777, 934, 794, 974, 964, 135, 145, 442, 948, 170, 785, 215, 645, 553, 730, 910, 228, 35, 9, 792, 579, 504, 499, 730, 711, 949, 77, 863, 185, 321, 711, 280, 979, 504, 108, 596, 284, 797, 685, 161, 399, 684, 683, 967, 834, 738, 418, 935, 597, 860, 280, 37, 805, 276, 99, 45, 916, 489, 686, 744, 408, 297, 412, 76, 844, 964, 90, 727, 938, 867, 805, 19, 771, 107, 200, 280, 118, 341, 357, 748, 456, 899, 631, 357, 153, 560, 947, 723, 720, 110, 899, 824, 278, 571, 894, 654, 79, 111, 151, 166, 747, 80, 549, 342, 445, 164, 179, 300, 19, 413, 175, 205, 680, 74, 193, 280, 157, 278, 650, 974, 875, 949, 679, 938, 713, 35, 778, 298, 846, 748, 343, 159, 1, 754, 236, 709, 907, 124, 781, 470, 891, 153, 657, 752, 372, 217, 311, 33, 962, 344, 444, 607, 183, 816, 976, 413, 402, 280, 487, 183, 343, 24, 565, 581, 776, 412, 501, 9, 746, 771, 657, 457, 820, 938, 470, 735, 290, 379, 275, 396, 820, 479, 295, 457, 658, 399, 761, 747, 824, 36, 111, 351, 917, 910, 357, 429, 973, 883, 375, 780, 411, 947, 506, 771, 585, 133, 896, 342, 356, 702, 704, 938, 151, 225, 180, 291, 155, 552, 948, 153, 924, 797, 791, 703, 806, 275, 830, 188, 189, 166, 526, 950, 940, 821, 700, 327, 201, 290, 858, 588, 899, 13, 289, 832, 419, 777, 469, 652, 166, 823, 417, 944, 106, 290, 948, 35, 13, 607, 508, 397, 444, 226, 52, 771, 827, 976, 701, 805, 730, 966, 33, 806, 702, 839, 740, 582, 299, 468, 417, 301, 98, 476, 448, 116, 406, 698, 176, 974, 709, 379, 664, 730, 708, 821, 153, 153, 228, 102, 568, 9, 290, 683, 949, 28, 702, 613, 750, 280, 275, 280, 346, 835, 110, 151, 280, 379, 398, 387, 279, 364, 21, 715, 789, 771, 731, 420, 458, 133, 835, 341, 399, 701, 110, 607, 202, 401, 170, 356, 752, 583, 343, 752, 278, 414, 607, 430, 344, 264, 947, 342, 126, 936, 721, 781, 738, 595, 280, 607, 954, 824, 798, 36, 565, 399, 342, 582, 242, 772, 976, 607, 718, 592, 236, 841, 357, 699, 450, 413, 228, 606, 735, 386, 857, 939, 607, 262, 842, 1, 585, 456, 347, 290, 417, 630, 228, 432, 736, 578, 503, 352, 151, 742, 35, 192, 776, 730, 266, 76, 550, 695, 359, 567, 954, 390, 181, 727, 280, 448, 9, 128, 778, 276, 805, 395, 778, 440, 782, 839, 157, 781, 48, 857, 582, 968, 832, 604, 230, 469, 33, 36, 7, 883, 108, 635, 466, 499, 691, 962, 976, 883, 538, 187, 936, 228, 586, 700, 38, 812, 938, 947, 607, 301, 160, 387, 883, 896, 141, 398, 395, 890, 885, 12, 498, 683, 111, 656, 967, 142, 513, 937, 720, 79, 198, 967, 108, 949, 6, 970, 478, 537, 775, 375, 786, 434, 121, 372, 579, 346, 591, 107, 870, 74, 702, 700, 2, 161, 227, 166, 569, 264, 596, 412, 111, 287, 151, 133, 974, 297, 824, 111, 735, 293, 111, 446, 382, 948, 287, 111, 788, 824, 377, 664, 172, 423, 732, 301, 679, 910, 771, 824, 357, 911, 278, 938, 78, 15, 723, 608, 152, 960, 277, 15, 18, 287]]) == [113622, 61851, 75076, 67590, 71027, 87233, 67350, 68147, 84328, 69103, 66176, 99426, 110122, 81460, 74071, 87394, 72492, 84179, 84924, 74071, 61851, 63406, 66839, 66176, 66738, 87074, 69524, 75901, 81740, 87394, 62756, 103333, 76476, 94763, 109191, 66046, 65863, 62483, 69922, 95890, 70422, 80470, 98892, 96332, 78355, 66243, 74511, 76720, 69535, 106370, 62531, 111871, 102163, 69686, 78299, 115655, 83486, 94382, 61843, 85079, 111413, 77188, 110122, 110290, 62145, 87394, 89771, 85983, 81000, 96666, 97597, 71027, 64808, 83599, 84179, 111871, 89445, 71027, 70005, 61956, 85526, 64314, 103530, 112564, 62073, 61947, 96511, 62009, 94936, 94935, 72391, 105978, 96511, 69852, 72391, 68147, 116354, 99028, 66046, 95311, 91703, 72801, 95282, 61843, 110337, 69852, 77204, 87074, 106824, 90468, 71027, 110554, 112564, 70376, 103530, 95122, 64757, 64258, 63519, 77926, 62274, 71429, 70287, 98703, 77964, 109191, 111871, 77835, 73262, 89282, 111413, 67838, 84203, 80339, 88909, 64258, 103530, 62164, 62937, 65983, 70254, 108542, 61851, 72391, 70376, 61983, 74624, 76958, 78093, 110067, 74511, 98327, 112564, 89282, 98514, 85079, 62814, 61851, 85079, 77964, 97054, 95311, 109191, 87394, 63332, 68472, 96332, 68472, 69762, 87394, 69841, 103530, 69445, 62107, 82491, 98327, 74511, 108858, 63165, 104539, 66046, 77581, 61848, 98327, 64459, 75076, 88402, 77188, 64808, 66312, 109410, 109696, 86442, 63853, 77835, 114068, 69535, 96332, 84179, 111413, 69685, 76946, 67350, 63091, 64361, 102453, 69610, 65832, 67006, 77964, 69316, 89282, 88010, 63765, 98327, 76720, 72391, 63519, 64185, 70964, 62483, 85073, 98514, 63436, 66203, 70254, 85079, 102863, 64356, 63332, 99426, 68914, 98327, 106611, 74961, 69291, 82213, 72604, 65627, 62345, 65267, 94565, 95109, 94936, 109909, 87074, 62610, 82352, 70376, 64314, 69841, 63658, 70337, 87561, 94935, 85079, 109485, 71027, 99650, 68472, 62345, 71027, 90914, 66949, 103530, 110067, 65983, 91244, 69922, 61846, 70198, 77835, 63236, 74071, 63176, 99426, 110067, 85224, 113176, 78932, 77081, 87394, 63406, 70376, 87561, 63984, 62409, 112333, 71027, 117286, 61871, 95122, 71429, 66809, 97961, 109696, 98514, 61922, 61946, 115424, 67350, 101225, 85079, 111422, 109696, 94382, 63658, 63366, 74511, 89282, 87074, 64099, 85230, 73009, 69535, 61946, 70600, 83889, 71225, 72801, 80601, 115424, 76958, 64314, 87394, 72492, 99650, 65726, 95109, 108327, 111860, 85987, 77081, 75191, 71027, 73825, 78355, 110963, 63236, 86917, 63147, 64314, 115197, 94935, 74289, 107037, 74289, 85079, 78174, 64211, 111871, 105562, 69685, 71027, 78424, 69686, 95457, 68021, 84775, 63366, 70376, 68608, 69316, 71126, 62893, 73429, 70422, 90260, 63775, 110988, 115197, 102358, 76946, 76958, 61892, 70254, 111413, 62259, 71027, 115655, 70422, 63480, 110067, 106189, 63366, 71027, 105978, 71027, 105769, 95632, 72711, 66176, 63510, 61843, 61919, 70511, 71429, 74390, 64314, 61957, 69605, 72711, 62937, 61883, 105978, 94935, 61843, 70782, 71225, 98327, 74503, 80601, 91172, 77708, 102943, 79959, 111413, 109191, 90118, 88402, 62183, 105769, 84493, 78754, 78424, 66256, 62644, 72391, 98327, 76827, 109696, 115424, 79689, 63236, 61965, 61922, 72391, 70600, 105978, 101022, 90260, 82352, 67736, 70600, 71027, 112564, 61965, 94935, 63853, 70655, 80364, 68608, 85834, 63332, 68539, 68472, 109848, 85677, 73219, 62731, 103138, 63894, 89771, 71027, 109276, 81460, 71429, 96666, 107612, 99459, 61880, 68677, 73857, 63033, 69524, 62903, 101225, 87219, 109191, 98433, 72100, 103729, 90914, 81460, 113176, 76958, 95122, 80339, 71027, 93129, 66312, 65334, 74289, 61957, 96332, 65522, 65334, 87074, 62777, 105562, 71714, 71429, 94565, 96332, 84179, 71225, 63010, 95457, 66733, 100620, 94382, 87394, 85079, 74180, 100421, 62576, 66243, 62126, 85381, 83200, 69291, 113176, 62872, 83772, 79694, 68277, 101633, 81266, 71027, 86452, 71225, 66521, 111413, 92234, 105978, 68212, 103729, 70782, 109696, 77835, 69445, 87533, 74289, 66176, 86142, 117286, 74967, 75891, 70422, 97778, 92057, 78224, 61843, 94936, 87074, 66894, 74737, 64509, 78174, 68466, 110122, 108757, 66111, 62145, 64314, 82632, 83027, 111871, 62872, 63231, 71027, 61874, 82632, 66176, 112079, 62872, 63300, 77581, 62903, 61938, 115424, 74071, 76958, 66894, 61946, 83599, 103729, 61843, 72904, 70109, 64164, 71534, 63443, 83599, 61850, 69686, 61946, 66949, 63332, 75784, 74180, 84179, 109485, 94382, 65686, 99650, 98327, 65334, 62460, 111188, 93566, 64356, 78093, 62934, 105562, 61987, 76958, 63436, 90468, 95807, 66243, 65391, 69841, 70005, 103729, 87394, 77188, 83057, 70022, 86762, 62627, 105769, 87074, 101001, 80364, 79554, 69922, 81599, 71534, 85073, 81941, 81806, 85079, 62233, 106189, 104133, 83744, 69685, 67306, 80210, 70109, 89445, 63547, 96332, 114518, 70198, 85375, 62706, 77708, 61846, 66627, 85079, 84034, 62756, 104947, 95311, 70109, 105769, 109696, 114518, 64314, 62009, 63406, 62145, 77067, 106163, 76958, 84626, 111871, 69762, 81460, 72391, 109629, 110122, 81599, 69841, 86442, 73429, 63333, 69368, 61851, 62756, 69214, 96861, 61847, 62073, 93487, 63099, 69535, 83629, 111413, 70422, 64164, 67291, 72391, 70337, 83744, 87074, 87074, 76827, 96083, 62937, 115424, 70109, 68472, 105978, 111205, 69841, 64606, 74511, 71027, 71534, 71027, 65983, 85830, 94565, 87394, 71027, 64164, 63369, 63808, 71126, 64949, 112736, 70964, 79286, 76958, 72492, 62681, 61937, 90468, 85830, 66312, 63332, 69762, 94565, 64314, 80081, 63264, 84493, 65391, 74737, 63366, 66176, 74737, 71225, 62843, 64314, 62437, 66111, 72711, 105562, 66243, 91703, 103333, 71524, 78224, 73219, 63814, 71027, 64314, 107037, 84179, 80501, 109485, 62872, 63332, 66243, 63333, 75191, 77081, 111871, 64314, 71243, 63697, 75891, 86752, 65334, 69610, 62043, 62872, 76827, 64271, 72904, 63851, 89282, 103930, 64314, 72929, 86907, 117286, 63436, 61957, 65922, 70109, 62756, 65471, 76827, 62391, 73009, 63205, 61956, 65627, 87394, 73643, 109696, 81401, 77581, 72391, 72497, 101225, 62593, 69316, 65224, 62914, 107037, 63683, 82914, 72100, 71027, 62073, 115424, 91349, 77835, 71429, 81460, 63480, 77835, 62221, 78355, 86442, 86452, 78224, 106991, 89282, 63333, 110067, 85375, 64185, 76593, 61846, 110122, 109485, 115888, 93566, 94935, 65726, 61865, 61922, 69032, 108757, 111871, 93566, 62409, 82076, 103333, 76827, 63473, 69685, 109067, 82455, 103729, 105562, 64314, 69214, 85987, 63808, 93566, 95807, 89080, 63369, 63480, 94763, 93908, 114743, 61917, 68472, 94382, 66839, 109848, 88909, 62064, 103530, 71429, 100620, 80601, 109848, 94935, 105978, 116121, 110513, 61849, 62394, 77454, 64356, 78887, 62345, 92592, 64509, 63236, 65983, 63658, 95122, 91409, 101633, 69841, 69685, 117053, 85834, 76946, 85079, 62960, 72711, 63853, 62903, 94382, 70376, 87394, 90468, 111413, 69524, 84179, 94382, 72904, 69852, 94382, 62107, 64029, 105769, 70376, 94382, 79153, 84179, 64258, 67291, 84203, 62606, 72595, 69214, 68212, 98327, 76958, 84179, 65334, 98514, 71225, 103729, 100821, 114068, 71714, 64361, 87233, 108327, 71326, 114068, 113399, 70376]\nassert my_solution.minOperations(**[[737, 374, 744, 485, 468, 529, 167, 53, 785, 350, 389, 176, 367, 931, 787, 326, 533, 607, 488, 780, 41, 74, 532, 314, 406, 733, 547, 849, 869, 896, 553, 843, 367, 236, 473, 880, 445, 171, 320, 378, 532, 297, 178, 728, 585, 633, 418, 910, 59, 326, 465, 416, 369, 774, 126, 877, 571, 135, 252, 180, 273, 12, 900, 91, 432, 952, 506, 293, 779, 879, 740, 190, 145, 144, 507, 759, 565, 912, 15, 340, 178, 771, 10, 447, 536, 4, 261, 163, 245, 727, 770, 185, 769, 178, 668, 623, 975, 619, 391, 470, 75, 709, 138, 537, 127, 453, 156, 677, 448, 961, 578, 141, 150, 701, 269, 759, 216, 213, 740, 679, 610, 250, 534, 575, 608, 767, 214, 538, 855, 207, 465, 18, 664, 415, 186, 122, 915, 809, 340, 18, 571, 12, 199, 781, 295, 721, 526, 490, 184, 708, 643, 726, 181, 547, 621, 818, 392, 958, 850, 860, 386, 51, 905, 476, 945, 747, 444, 129, 417, 135, 46, 816, 782, 646, 766, 96, 679, 385, 547, 88, 912, 369, 764, 347, 720, 394, 378, 757, 99, 833, 439, 167, 515, 861, 727, 488, 830, 228, 768, 128, 643, 340, 809, 465, 977, 847, 815, 4, 77, 487, 637, 135, 852, 428, 130, 117, 31, 121, 105, 887, 895, 940, 787, 611, 731, 826, 374, 210, 173, 596, 187, 362, 647, 917, 98, 343, 89, 663, 773, 634, 404, 699, 989, 565, 711, 410, 938, 733, 476, 759, 187, 187, 541, 923, 167, 230, 295, 927, 26, 837, 37, 242, 664, 955, 86, 929, 88, 123, 235, 537, 359, 815, 113, 452, 945, 131, 387, 558, 380, 713, 868, 199, 870, 744, 876, 643, 880, 394, 5, 139, 114, 134, 152, 779, 425, 640, 544, 395, 975, 392, 366, 21, 569, 680, 890, 681, 734, 640, 666, 434, 755, 268, 949, 517, 838, 670, 797, 257, 461, 984, 550, 702, 20, 210, 686, 140, 57, 161, 869, 294, 152, 979, 340, 853, 722, 279, 326, 617, 476, 567, 666, 541, 581, 946, 644, 872], [177, 359, 579, 590, 367, 815, 927, 850, 542, 297, 975, 516, 57, 215, 515, 664, 479, 698, 663, 488, 380, 785, 738, 171, 729, 919, 412, 882, 326, 547, 769, 295, 854, 541, 892, 721, 610, 879, 294, 75, 130, 680, 341, 380, 455, 549, 849, 643, 952, 896, 931, 769, 809, 955, 581, 167, 764, 218, 100, 340, 128, 943, 720, 86, 532, 75, 868, 448, 547, 31, 67, 181, 475, 711, 474, 95, 476, 394, 294, 476, 270, 252, 391, 816, 711, 529, 837, 395, 701, 666, 368, 145, 272, 569, 95, 575, 408, 515, 428, 635, 131, 912, 868, 296, 893, 448, 130, 708, 417, 720, 374, 435, 139, 385, 135, 77, 293, 185, 286, 664, 125, 199, 833, 348, 828, 172, 445, 153, 272, 86, 609, 88, 348, 852, 759, 558, 910, 476, 326, 88, 326, 721, 361, 547, 229, 49, 834, 50, 869, 215, 251, 697, 837, 485, 135, 386, 869, 421, 664, 825, 940, 12, 711, 935, 88, 340, 59, 12, 532, 951, 128, 150, 445, 613, 599, 326, 710, 726, 769, 607, 767, 434, 97, 350, 340, 31, 871, 152, 178, 4, 326, 745, 611, 671, 167, 417, 532, 809, 643, 171, 517, 756, 124, 809, 369, 388, 837, 494, 681, 880, 869, 187, 295]]) == [120765, 92675, 87459, 88147, 91807, 120031, 150327, 128477, 85793, 100515, 165909, 85463, 152981, 113497, 85459, 94321, 85583, 98517, 94215, 85483, 90557, 113319, 104397, 122063, 102931, 147871, 88203, 137023, 96607, 85949, 109999, 100791, 129499, 85763, 139877, 101717, 89465, 136175, 100933, 147471, 131787, 96191, 94725, 90557, 86161, 86025, 128225, 92151, 158263, 141031, 151571, 109999, 118663, 159247, 87579, 122943, 109037, 112973, 140097, 94843, 132313, 155355, 101571, 144167, 85575, 147471, 133167, 86403, 85949, 161187, 149917, 119929, 85637, 100279, 85655, 141533, 85619, 89397, 100933, 85619, 104459, 107253, 89623, 120263, 100279, 85545, 125259, 89327, 98911, 94541, 91705, 128043, 104159, 86897, 141533, 87225, 88455, 85459, 87309, 91439, 131527, 145745, 133167, 100653, 140165, 86403, 131787, 99861, 87899, 101571, 91113, 86967, 129499, 90117, 130497, 146867, 101077, 119115, 102099, 94321, 133117, 116431, 124291, 93911, 123095, 121845, 86521, 126149, 104159, 144167, 89395, 143571, 93911, 128985, 108097, 86393, 145149, 85619, 96607, 143571, 96607, 101717, 92455, 85949, 111061, 155473, 124533, 155159, 133433, 113497, 107413, 98387, 125259, 85511, 130497, 90031, 133433, 87681, 94321, 122383, 154401, 167397, 100279, 152827, 143571, 94843, 152365, 167397, 85575, 157937, 132313, 126853, 86521, 89685, 88729, 96607, 100139, 102465, 109999, 89257, 109609, 87013, 140955, 93683, 94843, 161187, 133975, 126381, 120551, 170115, 96607, 105597, 89537, 95119, 122943, 87899, 85575, 118663, 92151, 122063, 85467, 107553, 133387, 118663, 91603, 89865, 125259, 85467, 96317, 136455, 133433, 118717, 100791]\nassert my_solution.minOperations(**[[460, 585, 596, 504, 988, 704, 987, 629, 209, 712, 294, 293, 515, 452, 436, 439, 274, 361, 919, 231, 959, 140, 463, 799, 444, 828, 403, 758, 329, 424, 969, 744, 555, 217, 567, 148, 69, 477, 870, 699, 870, 175, 209, 433, 798, 8, 520, 318, 776, 876, 987, 983, 365, 89, 847, 769, 743, 386, 43, 128, 968, 756, 667, 375, 543, 409, 68, 884, 310, 501, 306, 958, 947, 384, 522, 138, 921, 439, 427, 474, 889, 479, 651, 413, 41, 606, 434, 305, 983, 675, 584, 468, 328, 672, 638, 576, 320, 461, 865, 996, 325, 58, 659, 531, 528, 41, 241, 32, 477, 170, 143, 796, 698, 688, 821, 171, 527, 727, 438, 603, 586, 520, 628, 328, 558, 244, 864, 752, 279, 130, 192, 242, 670, 403, 622, 467, 299, 789, 535, 40, 426, 102, 43, 997, 313, 280, 875, 731, 57, 789, 939, 311, 332, 309, 830, 92, 865, 845, 662, 768, 636, 211, 605, 747, 152, 758, 607, 261, 603, 689, 761, 27, 240, 822, 873, 95, 441, 39, 543, 865, 44, 853, 198, 512, 275, 302, 91, 881, 820, 246, 125, 535, 230, 872, 94, 144, 160, 483, 896, 663, 146, 127, 186, 837, 257, 828, 670, 873, 292, 850, 235, 735, 317, 455, 666, 779, 792, 125, 900, 818, 883, 770, 242, 114, 331, 103, 438, 661, 744, 896, 596, 274, 957, 770, 176, 583, 41, 471, 755, 833, 202, 578, 273, 338, 934, 507, 60, 500, 314, 897, 966, 521, 260, 909, 26, 232, 767, 979, 736, 165, 844, 184, 365, 405, 627, 93, 39, 815, 920, 905, 478, 852, 3, 480, 161, 640, 927, 81, 101, 440, 997, 853, 565, 571, 419, 498, 9, 430, 999, 829, 416, 528, 261, 803, 254, 836, 402, 501, 470, 859, 363, 104, 900, 517, 896, 776, 814, 457, 12, 147, 49, 529, 531, 1000, 57, 834, 834, 298, 212, 495, 360, 435, 943, 212, 549, 193, 937, 408, 815, 907, 896, 160, 842, 943, 522, 332, 255, 630, 863, 206, 973, 827, 633, 719, 456, 770, 511, 242, 59, 543, 461, 436, 261, 537, 57, 375, 835, 255, 328, 540, 628, 627, 260, 686, 15, 569, 75, 308, 332, 12, 675, 991, 327, 693, 141, 35, 634, 641, 679, 134, 636, 633, 948, 149, 649, 958, 49, 760, 294, 452, 438, 291, 438, 398, 819, 919, 324, 86, 582, 928, 32, 812, 401, 786, 200, 933, 602, 507, 569, 999, 382, 775, 999, 417, 872, 11, 402, 6, 322, 910, 791, 332, 467, 356, 65, 117, 400, 462, 743, 129, 189, 895, 974, 465, 83, 501, 979, 18, 508, 328, 770, 1, 127, 666, 99, 933, 152, 553, 956, 566, 327, 149, 86, 964, 19, 959, 139, 664, 89, 996, 496, 888, 177, 140, 780, 538, 791, 669, 615, 224, 496, 139, 208, 286, 714, 700, 604, 18, 661, 925, 951, 307, 108, 905, 990, 128, 739, 292, 824, 904, 251, 54, 210, 804, 595, 683, 141, 321, 440, 4, 176, 878, 191, 935, 647, 519, 261, 239, 989, 494, 721, 808, 704, 366, 744, 544, 554, 507, 169, 645, 344, 133, 247, 859, 570, 312, 333, 85, 249, 466, 3, 86, 862, 815, 853, 429, 606], [313, 144, 176, 896, 456, 703, 471, 628, 854, 582, 518, 232, 743, 935, 91, 853, 18, 889, 760, 797, 9, 834, 859, 959, 89, 312, 242, 242, 756, 50, 138, 915, 361, 515, 318, 896, 152, 565, 847, 383, 570, 86, 442, 415, 306, 815, 583, 596, 744, 323, 71, 926, 203, 722, 132, 498, 242, 474, 687, 242, 403, 744, 7, 143, 15, 883, 987, 637, 820, 943, 815, 744, 329, 94, 895, 365, 57, 461, 58, 466, 897, 60, 57, 199, 670, 981, 18, 328, 883, 247, 479, 104, 926, 876, 919, 95, 85, 915, 739, 329, 776, 425, 176, 312, 99, 905, 191, 735, 828, 364, 672, 437, 496, 306, 144, 567, 141, 682, 643, 439, 85, 461, 878, 834, 212, 846, 522, 331, 311, 966, 776, 94, 596, 483, 3, 528, 41, 670, 989, 75, 760, 86, 471, 669, 293, 815, 152, 779, 659, 596, 622, 125, 32, 700, 418, 744, 442, 427, 155, 462, 280, 799, 853, 496, 926, 117, 117, 900, 569, 493, 520, 186, 169, 73, 356, 847, 873, 478, 527, 832, 446, 895, 957, 42, 645, 576, 139, 250, 375, 549, 933, 281, 495, 242, 959, 670, 407, 161, 440, 117, 609, 133, 416, 176, 628, 294, 605, 937, 317, 431, 139, 149, 523, 224, 836, 95, 10, 275, 521, 677, 937, 993, 999, 242, 292, 900, 807, 569, 499, 139, 852, 430, 579, 896, 207, 702, 209, 595, 987, 452, 897, 667, 163, 522, 361, 313, 504, 480, 169, 251, 327, 872, 306, 43, 255, 94, 117, 937, 146, 498, 943, 630, 272, 58, 474, 987, 328, 324, 332, 968, 823, 823, 501, 18, 261, 86, 987, 853, 295, 169, 709, 18, 872, 399, 772, 1, 583, 169, 933, 993, 405, 549, 430, 57, 400, 632, 434, 564, 538, 440, 687, 537, 735, 171, 324, 850, 254, 86, 663, 967, 128, 235, 244, 561, 864, 770, 241, 473, 529, 666, 85, 791, 832, 934, 208, 543, 94, 519, 432, 128, 899, 261, 855, 101, 636, 404, 628, 10, 177, 194, 770, 790, 641, 321, 195, 666, 942, 468, 507, 909, 467, 859, 625, 841, 819, 439, 578, 292, 735, 261, 149, 18, 209, 829, 465, 149, 293, 405, 328, 261, 332, 692, 210, 168, 198, 776, 43, 210, 628, 261, 404, 480, 853, 427, 734, 647, 935, 481, 212, 804, 851, 966, 676, 460, 423, 582, 896, 584, 758, 667, 40, 322, 43, 567, 361, 438, 988, 919, 675, 308, 309, 651, 292, 528, 605, 504, 274, 544, 875, 242, 900, 999, 482, 879, 496, 996, 872, 511, 40, 674, 314, 743, 569, 776, 661, 607, 95, 834, 640, 19, 438, 306, 177, 39, 209, 72, 524, 964, 704, 756, 501, 967, 210, 828, 718, 583, 915, 338, 450, 365, 569, 294, 544, 877, 712, 744, 627, 401, 937, 231, 744, 919, 365, 675, 331, 44, 479, 895, 477, 41, 160, 948, 8, 438, 629, 228, 872, 661, 477, 954, 888, 528, 149, 633, 452, 138, 764, 595, 909, 209, 328, 495, 422, 996, 438, 475, 795, 320, 550, 774, 669, 501, 169, 792, 293, 192, 770, 873, 758, 981, 833, 761, 554, 460]]) == [155225, 204796, 193328, 216914, 136690, 158185, 136035, 144946, 200362, 139708, 135736, 175458, 167087, 234149, 226575, 199993, 261334, 214021, 171280, 181539, 265997, 193260, 202207, 245485, 227453, 155428, 172534, 172534, 170268, 245402, 207092, 225147, 147135, 135677, 154230, 216914, 201838, 138253, 197831, 144037, 138646, 228782, 137558, 140079, 156688, 187019, 139801, 141104, 167324, 153267, 235597, 230050, 184357, 162310, 209456, 135550, 172534, 135948, 154899, 172534, 141433, 167324, 267049, 205173, 262879, 211567, 259441, 146217, 188610, 237873, 187019, 167324, 152167, 225270, 216499, 146543, 242069, 136425, 241600, 136206, 217337, 240668, 242069, 185649, 151616, 256395, 261334, 152340, 211567, 171137, 135823, 221000, 230050, 208746, 226911, 224839, 229231, 225147, 166155, 152167, 175520, 139037, 193328, 155428, 223123, 220759, 188269, 165233, 191230, 146690, 151990, 137919, 135564, 156688, 204796, 138405, 205931, 153914, 147131, 137761, 229231, 136425, 209548, 193260, 181506, 197474, 135836, 151825, 155633, 248912, 175520, 225270, 141104, 135753, 269165, 136036, 249741, 151616, 260469, 233769, 171280, 228782, 136035, 151433, 159577, 187019, 201838, 176357, 149699, 141104, 144180, 212273, 254228, 157552, 139758, 167324, 137558, 138837, 200755, 136378, 162662, 182135, 199993, 135564, 230050, 215577, 215577, 218612, 138563, 135603, 135780, 189940, 195761, 234683, 147898, 197831, 207553, 135844, 136001, 192580, 137302, 216499, 244519, 249254, 147441, 139166, 206701, 170314, 145131, 137133, 233229, 162423, 135575, 172534, 245485, 151616, 140969, 198593, 137690, 215577, 142567, 209059, 139970, 193328, 144946, 159348, 142083, 235075, 154427, 138455, 206701, 202933, 135869, 177860, 193952, 224839, 265474, 163875, 135807, 152943, 235075, 262547, 265693, 172534, 159808, 218612, 184557, 138563, 135545, 206701, 199630, 138548, 139435, 216914, 183075, 157974, 182439, 141001, 259441, 136924, 217337, 151071, 197883, 135836, 147135, 155225, 135546, 135804, 195761, 170041, 152521, 207160, 156688, 248767, 168959, 225270, 215577, 235075, 204046, 135550, 237873, 145218, 164620, 241600, 135948, 259441, 152340, 153078, 151656, 249898, 189585, 189585, 135537, 261334, 167381, 228782, 259441, 199993, 159123, 195761, 159471, 261334, 207160, 141935, 174426, 270235, 139801, 195761, 233229, 262547, 141199, 137133, 138548, 242069, 141806, 145496, 138178, 138180, 136486, 137690, 154899, 136435, 165233, 195061, 153078, 198908, 169228, 228782, 150369, 249405, 211050, 174573, 171972, 137961, 204078, 173880, 172821, 135977, 136075, 150892, 229231, 179769, 192580, 233688, 182756, 136757, 225270, 135757, 138362, 211050, 218187, 167381, 200731, 222269, 146068, 141316, 144946, 265474, 192987, 187282, 173880, 179480, 146821, 153647, 186955, 150892, 237406, 136132, 135561, 222503, 136167, 202207, 144561, 195705, 188289, 137761, 139344, 159808, 165233, 167381, 202933, 261334, 182439, 191565, 136247, 202933, 159577, 141199, 152340, 167381, 151656, 155908, 182126, 196114, 185974, 175520, 248767, 182126, 144946, 167381, 141316, 135804, 199993, 138837, 165006, 147755, 234149, 135787, 181506, 183642, 199269, 248912, 152750, 136476, 139241, 139708, 216914, 139896, 170770, 151071, 250234, 153456, 248767, 138405, 147135, 137836, 259954, 226911, 152557, 156260, 156049, 148395, 159808, 136036, 142083, 135546, 164120, 136818, 208347, 172534, 218612, 265693, 135770, 209951, 135564, 264110, 207160, 135611, 250234, 152368, 155024, 167087, 138563, 175520, 150029, 142321, 224839, 193260, 146668, 260823, 137836, 156688, 192987, 250729, 182439, 235140, 135902, 247930, 158396, 170268, 135537, 249405, 182126, 191230, 161426, 139801, 225147, 150700, 137050, 146543, 138563, 159348, 136818, 209147, 160116, 167324, 144815, 141679, 235075, 175755, 167324, 226911, 146543, 152557, 151825, 248284, 135823, 216499, 135867, 249741, 198950, 240230, 266522, 137836, 145081, 176656, 207160, 150029, 135867, 243086, 213610, 136036, 202933, 145635, 136924, 207092, 172314, 141001, 222503, 182439, 152340, 135575, 139344, 264110, 137836, 135921, 180947, 153840, 137198, 174972, 151433, 135537, 195761, 180062, 159577, 187938, 173880, 207553, 170770, 256395, 192919, 171537, 137460, 136476]\nassert my_solution.minOperations(**[[308, 371, 776, 732, 673, 897, 457, 147, 301, 923, 890, 966, 775, 122, 79, 225, 253, 120, 564, 396, 292, 311, 652, 568, 445, 792, 620, 44, 599, 15, 669, 653, 84, 58, 865, 259, 188, 771, 18, 961, 885, 801, 516, 709, 219, 244, 744, 764, 856, 887, 611, 9, 993, 337, 626, 494, 944, 977, 640, 77, 322, 740, 539, 739, 589, 239, 825, 761, 538, 880, 339, 993, 773, 394, 851, 425, 230, 171, 995, 343, 216, 167, 3, 298, 142, 747, 505, 162, 456, 831, 673, 374, 300, 917, 729, 543, 420, 665, 17, 981, 895, 537, 594, 924, 780, 184, 554, 738, 558, 207, 854, 851, 244, 916, 730, 22, 986, 597, 578, 395, 730, 786, 774, 925, 671, 846, 836, 908, 41, 82, 999, 361, 96, 375, 849, 210, 729, 181, 341, 490, 297, 774, 864, 814, 415, 59, 439, 196, 912, 776, 940, 440, 486, 904, 259, 847, 293, 79, 8, 546, 13, 973, 594, 181, 134, 202, 217, 820, 283, 763, 584, 795, 902, 856, 391, 710, 425, 778, 421, 994, 668, 499, 715, 966, 718, 60, 613, 505, 297, 921, 133, 286, 745, 917, 1000, 573, 583, 840, 276, 271, 863, 51, 598, 574, 773, 288, 560, 183, 400, 793, 373, 476, 554, 720, 407, 557, 969, 115, 842, 871, 916, 31, 149, 381, 65, 340, 29, 398, 617, 887, 77, 362, 526, 66, 274, 425, 864, 424, 645, 409, 699, 288, 753, 699, 867, 616, 698, 725, 52, 939, 627, 875, 240, 627, 593, 497, 277, 311, 211, 555, 181, 94, 521, 201, 918, 496, 2, 653, 447, 281, 582, 387, 414, 930, 30, 54, 420, 83, 71, 683, 676, 210, 825, 56, 560, 405, 996, 151, 115, 180, 477, 807, 55, 147, 683, 844, 513, 64, 433, 251, 416, 996, 612, 772, 905, 392, 609, 570, 349, 743, 456, 876, 4, 478, 208, 479, 73, 537, 369, 794, 255, 846, 757, 694, 335, 334, 748, 868, 552, 219, 257, 733, 850, 66, 119, 943, 997, 316, 670, 197, 31, 37, 318, 266, 620, 688, 94, 37, 665, 942, 604, 958, 965, 613, 102, 592, 712, 651, 363, 472, 561, 874, 675, 527, 526, 42, 793, 23, 875, 483, 906, 816, 514, 621, 617, 733, 95, 640, 848, 103, 76, 125, 960, 990, 742, 179, 225, 533, 931, 750, 233, 546, 403, 907, 947, 939, 505, 554, 476, 860, 314, 899, 953, 193, 884, 952, 906, 413, 808, 625, 154, 821, 223, 240, 28, 91, 253, 104, 688, 319, 167, 921, 615, 841, 609, 83, 451, 87, 37, 358, 164, 439, 958, 144, 568, 977, 691, 210, 991, 516, 622, 407, 588, 79, 851, 32, 426, 993, 245, 160, 779, 573, 363, 445, 265, 857, 943, 694, 176, 324, 9, 499, 784, 685, 425, 735, 466, 569, 178, 835, 565, 612, 462, 444, 762, 9, 122, 251, 323, 979, 866, 34, 949, 9, 770, 447, 995, 63, 55, 844, 297, 276, 676, 329, 372, 152, 384, 429, 158, 466, 435, 286, 319, 12, 901, 465, 641, 187, 19, 171, 566, 35, 69, 702, 165, 787, 437, 66, 528, 497, 885, 114, 690, 506, 492, 409, 445, 20, 249, 64, 246, 404, 865, 857, 437, 362, 159, 807, 513, 197, 262, 553, 745, 363, 255, 971, 958, 322, 25, 65, 535, 387, 918, 224, 881, 55, 501, 71, 206, 78, 858, 443, 327, 883, 289, 493, 98, 564, 308, 996, 534, 251, 156, 462, 714, 583, 971, 569, 453, 846, 7, 909, 735, 511, 667, 938, 797, 652, 960, 686, 379, 689, 362, 894, 734, 476, 422, 448, 121, 568, 113, 342, 639, 945, 903, 405, 594, 809, 995, 699, 518, 266, 752, 229, 590, 753, 755, 568, 399, 925, 319, 731, 10, 669, 935, 692, 490, 24, 738, 586, 65, 952, 529, 700, 703, 477, 26, 119, 559, 839, 746, 263, 78, 73, 691, 191, 496, 956, 812, 308, 476, 470, 384, 313, 890, 630, 201, 546, 193, 617, 557, 776, 782, 375, 535, 589, 909, 734, 653, 438, 946, 426, 562, 639, 983, 148, 897, 282, 703, 428, 566, 87, 122, 390, 825, 202, 730, 495, 71, 685, 740, 31, 910, 517, 339, 228, 121, 447, 79, 492, 794, 744, 508, 964, 278, 697, 561, 722, 585, 559, 126, 234, 877, 8, 705, 513, 176, 447, 999, 155, 238, 144, 663, 318, 669, 648, 172, 975, 976, 145, 37, 590, 186, 678, 475, 591, 906, 634, 301, 585, 56, 681, 546, 893, 34, 943, 149, 703, 287, 667, 682, 906, 615, 897, 146, 916, 105, 224, 842, 799, 635, 219, 545, 80, 143, 924, 18], [161, 134, 718, 843, 144, 314, 392, 159, 318, 652, 339, 704, 933, 3, 121, 437, 208, 890, 851, 864, 734, 193, 120, 971, 908, 996, 626, 517, 916, 409, 887, 897, 611, 898, 858, 392, 96, 181, 746, 906, 251, 993, 794, 893, 2, 569, 146, 835, 145, 80, 399, 653, 587, 653, 425, 715, 864, 162, 138, 952, 144, 58, 2, 883, 494, 715, 466, 120, 193, 149, 262, 942, 588, 116, 196, 885, 917, 382, 323, 228, 669, 546, 568, 561, 665, 764, 773, 271, 210, 701, 865, 210, 542, 318, 876, 224, 335, 865, 321, 560, 761, 418, 816, 37, 340, 265, 239, 58, 825, 201, 730, 959, 425, 773, 738, 663, 492, 875, 96, 797, 734, 377, 685, 864, 219, 812, 405, 202, 230, 106, 580, 995, 688, 916, 275, 564, 317]]) == [288357, 302760, 225914, 277891, 297276, 226756, 207344, 289381, 225580, 208430, 219827, 221558, 329805, 387535, 309971, 199705, 265898, 303216, 281913, 288736, 231146, 272717, 310538, 355831, 313874, 374120, 203312, 194077, 318842, 204083, 301491, 307287, 200777, 307878, 285552, 207344, 324496, 278387, 235450, 312650, 248123, 371875, 254996, 304953, 388300, 195669, 296196, 274007, 296735, 334144, 205949, 208643, 197483, 208643, 201403, 224963, 288736, 287846, 300564, 342520, 297276, 348324, 388300, 299217, 194688, 224963, 196600, 310538, 272717, 294595, 244018, 335738, 197598, 312826, 271328, 300349, 319471, 209456, 224163, 257318, 212185, 194394, 195582, 195071, 211275, 242406, 246009, 240781, 265012, 220657, 289273, 265012, 194286, 225580, 295296, 258982, 220891, 289273, 224725, 195008, 241221, 202536, 265008, 362681, 219566, 242927, 252837, 348324, 269229, 269039, 229792, 347353, 201403, 246009, 232546, 210833, 194788, 294741, 324496, 256335, 231146, 210553, 216175, 288736, 261105, 263152, 204807, 268586, 256494, 318622, 196734, 373367, 216974, 318842, 239363, 195276, 225873]\n"}, "labels": {"questionId": "2718", "questionFrontendId": "2602", "questionTitle": "Minimum Operations to Make All Array Elements Equal", "stats": {"totalAccepted": "7.7K", "totalSubmission": "22.2K", "totalAcceptedRaw": 7684, "totalSubmissionRaw": 22174, "acRate": "34.7%"}, "probedCases": [{"inputs": [[3, 1, 6, 8], [1, 5]], "output": [14, 10]}, {"inputs": [[2, 9, 6, 3], [10]], "output": [20]}, {"inputs": [[47, 50, 97, 58, 87, 72, 41, 63, 41, 51, 17, 21, 7, 100, 69, 66, 79, 92, 84, 9, 57, 26, 26, 28, 83, 38], [50, 84, 76, 41, 64, 82, 20, 22, 64, 7, 38, 92, 39, 28, 22, 3, 41, 46, 47, 50, 88, 51, 9, 49, 38, 67, 26, 65, 89, 27, 71, 25, 77, 72, 65, 41, 84, 68, 51, 26, 84, 24, 79, 41, 96, 83, 92, 9, 93, 84, 35, 70, 74, 79, 37, 38, 26, 26, 41, 26]], "output": [607, 855, 747, 655, 633, 825, 943, 905, 633, 1227, 685, 1009, 675, 805, 905, 1331, 655, 625, 619, 607, 929, 605, 1179, 611, 685, 653, 833, 639, 949, 819, 689, 851, 759, 699, 639, 655, 855, 661, 605, 833, 855, 869, 783, 655, 1097, 839, 1009, 1179, 1031, 855, 721, 679, 723, 783, 697, 685, 833, 833, 655, 833]}, {"inputs": [[39, 21, 5, 58, 11, 73, 93, 87, 4, 63, 66, 64, 77, 60, 24, 2, 6, 82, 97, 94, 100, 92, 67, 52, 82, 97, 9, 99, 29, 31, 100, 67, 56, 28, 8, 81, 41, 18, 63, 43, 22, 60, 96, 91, 33, 22, 92, 16, 89], [82, 99, 21, 5, 91, 97, 85, 67, 33, 87, 92, 67, 33, 22, 64, 81, 44, 63, 43, 31, 56, 74, 62, 4, 57, 20, 9, 32, 30, 63, 39, 92, 6, 16, 92, 89, 60, 73, 38, 81, 56, 2, 39, 22, 63, 67, 1, 97, 66, 9, 37, 2, 32, 88, 2, 21, 2, 78, 87, 33, 9, 92, 96, 88, 92, 16, 41, 60, 32, 82, 67, 28, 99, 67, 19, 4, 45, 59, 100, 91]], "output": [1630, 2145, 1901, 2473, 1849, 2059, 1699, 1405, 1637, 1745, 1878, 1405, 1637, 1872, 1382, 1611, 1490, 1377, 1499, 1671, 1390, 1498, 1376, 2518, 1385, 1932, 2309, 1654, 1690, 1377, 1547, 1878, 2430, 2060, 1878, 1795, 1374, 1483, 1562, 1611, 1390, 2612, 1547, 1872, 1377, 1405, 2661, 2059, 1396, 2309, 1577, 2612, 1654, 1770, 2612, 1901, 2612, 1560, 1745, 1637, 2309, 1878, 2020, 1770, 1878, 2060, 1521, 1374, 1654, 1630, 1405, 1730, 2145, 1405, 1963, 2518, 1481, 1377, 2190, 1849]}, {"inputs": [[67, 53, 67, 35, 88, 76, 92, 99, 12, 80, 78, 11, 59, 49, 52, 50, 10, 89, 46, 100, 74, 90, 7, 76, 34, 78, 85, 74, 38, 12, 75, 46, 60, 43, 88, 32, 5, 61, 53, 99, 13, 82, 11, 75, 83, 80, 53, 98, 46, 95, 67, 70, 90, 21, 10, 23, 43, 80, 22, 23, 62, 74, 78, 4, 50, 47, 39, 82, 90, 73, 34, 47, 78, 89, 99, 76, 45, 64, 58, 14, 3, 57, 30, 21, 73, 32, 11, 76, 46], [59, 60, 14, 62, 61, 83, 45, 73, 45, 76, 73, 12, 50, 11, 55, 92, 22, 74, 73, 23, 32, 80, 73, 84, 92, 76, 82, 43, 22, 62, 80, 22, 53, 46, 82, 79, 75, 53, 76, 5, 51, 83, 77, 3, 50, 76, 98, 78, 49, 76, 19, 9, 6, 5, 27, 42, 41, 90, 52, 53, 75, 67, 76, 97, 49, 32, 76, 78, 99, 83, 23, 21, 72, 10, 73, 35, 25, 34, 34, 60, 66, 88, 13, 46, 49, 73, 38, 34, 78, 12, 99, 82, 89, 74, 14, 85, 47]], "output": [2139, 2140, 3852, 2148, 2143, 2699, 2309, 2285, 2309, 2364, 2285, 3984, 2200, 4055, 2153, 3284, 3352, 2306, 2285, 3295, 2822, 2536, 2285, 2758, 3284, 2364, 2642, 2375, 3352, 2148, 2536, 3352, 2163, 2278, 2642, 2489, 2333, 2163, 2364, 4541, 2187, 2699, 2403, 4713, 2200, 2364, 3752, 2442, 2217, 2364, 3537, 4213, 4458, 4541, 3083, 2412, 2449, 3134, 2174, 2163, 2333, 2189, 2364, 3673, 2217, 2822, 2364, 2442, 3833, 2699, 3295, 3411, 2268, 4132, 2285, 2685, 3189, 2728, 2728, 2140, 2180, 3000, 3917, 2278, 2217, 2285, 2562, 2728, 2442, 3984, 3833, 2642, 3065, 2306, 3852, 2817, 2255]}, {"inputs": [[58, 5, 26, 89, 15, 48, 13, 1, 29, 3, 46, 64, 70, 63, 47, 43, 74, 24, 19, 55, 15, 89, 91, 8, 51, 3], [1, 50, 48, 3, 89, 15, 34, 64, 61, 8, 47, 3, 47, 14, 89, 46, 3, 1, 5, 15, 58, 20, 89, 87, 81, 7, 51, 64, 40, 51, 63, 3, 52, 58, 46, 19, 3, 15, 20, 69, 63, 56, 47, 29, 49, 56, 12, 29, 40, 10, 15, 49, 49, 7, 55, 46, 54, 75, 47, 18, 57, 63, 63, 1, 89, 26, 47, 4, 48, 63, 69, 46, 1, 27, 48, 1, 56, 27, 32, 3, 51, 47, 1, 15, 79, 38, 21, 1, 46, 79, 1, 89]], "output": [1023, 659, 647, 975, 1269, 773, 659, 801, 763, 881, 643, 975, 643, 787, 1269, 641, 975, 1023, 935, 773, 727, 725, 1269, 1229, 1109, 899, 665, 801, 647, 665, 787, 975, 673, 727, 641, 733, 975, 773, 725, 881, 787, 707, 643, 669, 653, 707, 817, 669, 647, 849, 773, 653, 653, 899, 697, 641, 689, 989, 643, 743, 717, 787, 787, 1023, 1269, 681, 643, 955, 647, 787, 881, 641, 1023, 677, 647, 1023, 707, 677, 663, 975, 665, 643, 1023, 773, 1069, 651, 717, 1023, 641, 1069, 1023, 1269]}, {"inputs": [[54, 61, 55, 94, 47, 14, 87, 43, 44, 7, 40, 79, 67, 76, 77, 56, 33, 93, 100, 8, 63, 47, 92, 28, 13, 31, 40, 55, 8, 47, 43, 20, 45, 98, 81, 10, 47, 88, 79, 14, 12, 33, 24, 72, 21, 30, 74, 48, 55, 61, 51, 19, 67, 64, 72, 87, 49, 55, 66, 81, 85, 89, 43, 98, 44, 29, 99, 40, 98, 56, 31, 99, 6, 75, 3, 88, 7, 99, 89, 10, 40, 53, 94, 74, 21, 50, 76, 92], [88, 8, 93, 98, 55, 94, 81, 93, 7, 68, 44, 79, 30]], "output": [3135, 4127, 3455, 3821, 2119, 3525, 2775, 3455, 4207, 2325, 2227, 2683, 2765]}, {"inputs": [[59, 38, 85, 19, 76, 77, 41, 56, 98, 51, 99, 2, 83, 3, 23, 80, 51, 51, 55, 3, 95, 80, 24, 69, 94, 88, 3, 85, 100, 69, 45, 80, 95, 27, 17, 65, 91, 56, 11, 6, 94, 81, 85, 35, 13, 3, 43, 90, 39, 21, 24, 40, 68, 30, 64, 22, 77, 93, 43, 28, 16, 61, 93, 40, 69, 91, 36, 21, 17, 25, 83, 37, 67, 72, 96, 58, 52], [69, 69, 68, 91, 96, 18, 66, 3, 94, 36, 37, 95, 98, 91, 69, 17, 58, 12, 35, 43, 16, 91, 52, 3, 29, 70, 58, 3, 69, 3, 30, 44, 58, 54, 86, 85, 21, 99, 37, 21, 82, 62, 95, 91, 84, 96, 37, 1, 59, 79]], "output": [2132, 2132, 2115, 2924, 3233, 2999, 2087, 3948, 3099, 2275, 2246, 3164, 3375, 2924, 2132, 3054, 2017, 3359, 2306, 2118, 3113, 2924, 2021, 3948, 2506, 2155, 2017, 3948, 2132, 3948, 2471, 2105, 2017, 2015, 2671, 2622, 2838, 3448, 2246, 2838, 2497, 2045, 3164, 2924, 2579, 3233, 2246, 4100, 2022, 2390]}, {"inputs": [[91, 57, 64, 59, 38, 47, 4, 8, 51, 92, 42, 28, 21, 84, 30, 57, 67, 52, 74, 39, 59, 100, 72, 22, 12, 64, 79, 20, 100, 65, 100, 38, 15, 52, 62, 87, 32, 90, 40, 82], [39, 34, 53, 57, 45, 15, 64, 62, 32, 27, 71, 92, 89]], "output": [1036, 1132, 908, 900, 968, 1638, 938, 922, 1172, 1290, 1042, 1532, 1442]}, {"inputs": [[73, 52, 37, 8, 27, 36, 100, 46, 6, 81, 81, 83, 55, 98, 29, 2, 39, 62, 65, 82, 42, 10], [37, 15, 46, 67, 78, 44, 1, 9, 32, 65, 76, 82, 4, 42, 92, 2, 42, 81, 2, 55, 43, 2, 81, 80, 28, 8, 64, 9, 6, 46, 41, 61, 43, 9, 81, 7, 62, 10, 19, 47, 62, 54, 37, 82, 72, 37, 58, 54, 62, 81, 32, 82, 54, 81, 81, 32, 36, 62, 38, 67, 44, 10, 81, 29, 65, 47, 39, 62, 88, 45, 65, 52, 63, 10, 73, 6, 27, 36, 46, 12, 36, 37, 29, 55, 36, 43, 63, 37, 82]], "output": [582, 852, 550, 618, 716, 554, 1092, 938, 630, 602, 696, 760, 1030, 558, 938, 1070, 558, 746, 1070, 556, 556, 1070, 746, 736, 672, 954, 596, 938, 990, 550, 562, 580, 556, 938, 746, 972, 584, 922, 796, 550, 584, 554, 582, 760, 658, 582, 568, 554, 584, 746, 630, 760, 554, 746, 746, 630, 590, 584, 576, 618, 554, 922, 746, 660, 602, 550, 570, 584, 866, 552, 602, 550, 590, 922, 666, 990, 684, 590, 550, 894, 590, 582, 660, 556, 590, 556, 590, 582, 760]}, {"inputs": [[24, 87, 38, 16, 87, 42, 53, 17, 92, 91, 43, 44, 67, 54, 25, 65, 94, 65, 90, 79, 62, 5, 7, 68, 45, 39, 62, 98, 55, 72, 46, 52, 77, 27, 84, 67, 67, 30, 15, 33, 6, 35, 54, 6, 67, 80, 63, 67, 44, 22, 3, 57, 45, 52, 21, 34, 51], [43, 26, 15, 61, 76, 68, 7, 21, 45, 67, 5, 26, 67, 54, 15, 51, 17, 45, 17, 81, 84, 6, 44, 46, 42, 88, 67, 67, 51, 91, 94, 6, 92, 33, 59, 63, 55, 36, 55, 34, 21, 67, 79, 38, 75, 17, 67, 43, 38, 62, 33, 38, 81, 3, 25, 80, 11, 80, 63, 53, 3, 55, 54, 33, 43, 53, 67, 77, 6, 92, 23, 77, 25, 7, 77, 17, 52, 82, 29]], "output": [1270, 1699, 2132, 1282, 1687, 1415, 2508, 1880, 1244, 1384, 2610, 1699, 1384, 1213, 2132, 1212, 2044, 1244, 2044, 1876, 1999, 2557, 1255, 1237, 1287, 2175, 1384, 1384, 1212, 2318, 2475, 2557, 2369, 1486, 1260, 1308, 1220, 1411, 1220, 1459, 1880, 1384, 1796, 1365, 1652, 2044, 1384, 1270, 1365, 1293, 1486, 1365, 1876, 2720, 1732, 1835, 2320, 1835, 1308, 1210, 2720, 1220, 1213, 1486, 1270, 1210, 1384, 1722, 2557, 2369, 1804, 1722, 1732, 2508, 1722, 2044, 1209, 1917, 1604]}, {"inputs": [[8, 98, 26, 17, 45, 64, 68, 82, 58, 29, 58, 7, 40, 6, 16, 62, 46, 85, 64, 9, 72, 28, 34, 77, 5, 53, 9, 92, 39, 15, 95, 7, 41, 73, 27, 48, 44, 76, 6, 59, 59, 54, 55, 20, 86, 96, 69, 11, 86, 42, 83, 27, 94, 36, 64, 97, 24, 33, 50, 42, 52, 17, 5, 27, 76, 63, 30, 34, 62, 3, 36, 47], [64, 73, 9, 7, 73, 45, 64, 42, 86, 86, 94, 20, 54, 40, 1, 5, 8, 48, 27, 64, 77, 42, 29, 9, 76, 41, 27, 29, 77, 90, 76, 76, 58, 72, 16, 25, 42, 7, 62, 11, 48, 97, 65, 76, 54]], "output": [1946, 2290, 2770, 2884, 2290, 1678, 1946, 1688, 2936, 2936, 3420, 2246, 1734, 1706, 3296, 3012, 2826, 1684, 1974, 1946, 2470, 1688, 1916, 2770, 2422, 1696, 1974, 1916, 2470, 3176, 2422, 2422, 1796, 2248, 2418, 2048, 1688, 2884, 1888, 2666, 1684, 3618, 1982, 2422, 1734]}, {"inputs": [[5], [6, 5, 3, 1]], "output": [1, 0, 2, 4]}, {"inputs": [[769, 739, 249, 737, 380, 851, 222, 216, 38, 619, 475, 272, 547, 85, 160, 783, 737, 576, 138, 816, 273, 165, 667, 380, 7, 570, 597, 416, 36, 433, 995, 93, 126, 743, 861, 645, 270, 400, 267, 522, 505, 402, 378, 950, 261, 248, 861, 246, 192, 495, 879, 347, 96, 670, 321, 248, 199, 29, 829, 511, 834, 61, 617, 514, 263, 956, 330, 28, 511, 402, 109, 550, 896, 571, 798, 130, 441, 857, 921, 92, 734, 19, 468, 822, 249, 923, 66, 519, 278, 107, 610, 776, 378, 830, 678, 495, 717, 309, 468, 623, 603, 487, 164, 628, 35, 288, 549, 86, 657, 121, 449, 190, 306, 152, 880, 329, 384, 905, 446, 941, 322, 237, 334, 232, 216, 862, 397, 810, 714, 370, 589, 997, 686, 324, 614, 428, 620, 306, 256, 905, 835, 527, 970, 125, 595, 675, 682, 370, 240, 469, 820, 267, 176, 666, 147, 464, 442], [198, 794, 948, 830, 887, 623, 666, 912, 95, 225, 121, 155, 672, 531, 874, 241, 238, 531, 716, 247, 495, 663, 38, 619, 520, 122, 383, 272, 620, 975, 526, 260, 610, 216, 137, 866, 314, 380, 879, 834, 622, 465, 151, 458, 521, 278, 769, 442, 488, 330, 812, 581, 255, 264, 830, 111, 401, 754, 398, 86, 511, 246, 370, 125, 157, 199, 96, 274, 739, 669, 954, 107, 678, 810, 596, 689, 365, 323, 442, 880, 778, 143, 176, 272, 380, 370, 625, 380, 808, 905, 792, 105, 344, 66, 306, 830, 165, 805, 322, 270, 230, 240, 547, 434, 573, 807, 249, 165, 370, 814, 669, 7, 956, 122, 987, 270, 801, 703, 514, 837, 380, 302, 334, 603, 469, 798, 234, 893, 378, 93, 411, 862, 487, 964, 520, 98, 150, 662, 248, 36, 426, 240, 789, 861, 288, 143, 921, 903, 93, 286, 233, 775, 221, 147, 418, 862, 38, 667, 861, 667, 975, 856, 236, 476, 616, 728, 127, 176, 267, 671, 446, 12, 368, 861, 879, 442, 647, 905, 511, 905, 469, 330, 123, 917, 306, 482, 273, 61, 249, 371, 5, 272, 511, 216, 85, 736, 157, 36, 384, 96, 81, 348, 377, 549, 126, 468, 323, 861, 543, 322, 879, 380, 94, 549, 306, 549, 898, 252, 87, 338, 460, 402, 108, 438, 215, 306, 144, 575, 29, 380, 147, 85, 190, 238, 23, 587, 451, 308, 947, 686, 370, 956, 267, 241, 881, 861, 249, 247, 804, 614, 598, 383, 857, 717, 330, 201, 208, 511, 323, 905, 680, 949, 312, 9, 35, 416, 953, 864, 826, 574, 646, 696, 921, 511, 831, 861, 135, 973, 618, 522, 380, 165, 21, 370, 586, 195, 370, 494, 331, 623, 380, 861, 697, 822, 378, 248, 825, 340, 160, 401, 814, 126, 738, 271, 511, 905, 133, 36, 861, 83, 199, 468, 379, 678, 156, 117, 226, 329, 950, 682, 947, 862, 378, 797, 861, 739, 723, 609, 330, 323, 714, 1, 273, 221, 835, 820, 820, 609, 649, 442, 393, 740, 231, 123, 897, 628, 176, 627, 686, 920, 842, 249, 627, 290, 380, 95, 827, 511, 511, 861, 553, 147, 471, 4, 675, 306, 477, 952, 36, 737, 306, 234, 636, 88, 222, 158, 694, 267, 270, 726, 35, 126, 683, 627, 833, 93, 862, 378, 824, 513, 941, 805, 616, 115, 861, 519, 619, 436, 222, 461, 527, 58, 164, 468, 641, 337, 249, 615, 682, 227, 682, 495, 133, 861, 609, 834, 661, 829, 522, 756, 511, 172, 678, 381, 862, 154, 675, 137, 164, 622, 861, 194, 393, 576, 338, 812, 380, 509, 742, 933, 378, 571, 21, 851, 673, 173, 304, 308, 620, 742, 742, 494, 820, 151, 683, 140, 861, 300, 816, 571, 382, 797, 513, 246, 244, 85, 380, 152, 378, 375, 442, 821, 921, 324, 246, 38, 340, 723, 325, 861, 513, 834, 857, 29, 585, 606, 861, 678, 470, 923, 946, 894, 509, 29, 993, 216, 617, 272, 742, 812, 90, 514, 328, 739, 412, 578, 197, 822, 719, 255, 686, 984, 370, 313, 126, 156, 516, 666, 61, 835, 358, 276, 905, 736, 620, 787, 308, 832, 65, 327, 62, 813, 386, 620, 7, 861, 343, 6, 325, 35, 18, 465, 547, 321, 519, 619, 82, 858, 323, 95, 156, 516, 671, 736, 85, 270, 677, 248, 381, 89, 151, 107, 109, 857, 721, 521, 879, 522, 36, 749, 379, 260, 499, 406, 523, 960, 716, 381, 572, 617, 623, 322, 28, 270, 611, 263, 330, 575, 678, 126, 905, 65, 307, 452, 287, 248, 276, 664, 860, 307, 953, 970, 474, 92, 77, 656, 67, 204, 249, 378, 905, 248, 632, 505, 249, 31, 90, 717, 497, 330, 717, 862, 173, 852, 130, 216, 380, 834, 379, 880, 121, 380, 420, 823, 446, 855, 267, 248, 615, 954, 265, 511, 602, 107, 780, 2, 86, 164, 94, 737, 475, 123, 128, 667, 321, 828, 755, 21, 249, 613, 620, 549, 872, 378, 309, 246, 378, 122, 734, 626, 814, 106, 685, 730, 265, 670, 657, 269, 468, 380, 862, 306, 402, 854, 622, 861, 119, 109, 152, 130, 512, 623, 822, 837, 273, 483, 874, 389, 922, 736, 92, 905, 232, 115, 494, 108, 278, 821, 24, 322, 723, 951, 333, 666, 63, 859, 321, 783, 388, 468, 608, 674, 402, 93, 28, 735, 248, 107, 248, 684, 262, 672, 572, 296, 278, 630, 306, 737, 820, 192, 334, 380, 442, 193, 628, 446, 862, 944, 449, 461, 522, 739, 28, 324, 552, 254, 722, 611, 165, 670, 202, 102, 438, 270, 184, 163, 233, 443, 248, 33, 617, 93, 222, 511, 832, 289, 267, 563, 292, 36, 597, 252, 956, 141, 261, 113, 905, 959, 33, 879, 822, 483, 273, 505, 445, 516, 329, 5, 818, 275, 787, 547, 322, 647, 619, 104, 574, 330, 246, 935, 93, 810, 271, 830, 572, 267, 273, 619, 667, 487, 391, 549, 267, 596, 468, 667, 528, 861, 714, 513, 984, 615, 923, 384, 171, 896, 858, 525, 503, 617, 64, 468, 214, 619, 515, 447, 875, 430, 840, 716, 400, 337, 862, 669, 673, 309, 419, 126, 826, 243, 442, 240, 861, 822, 621, 398, 682, 619, 288, 946, 111, 511, 779, 677, 678, 507, 317, 373, 468, 954, 330, 489, 879, 868, 468, 63, 510, 713, 623, 775, 547, 721, 834, 830]], "output": [48233, 55609, 75311, 59487, 66682, 41282, 44127, 70117, 59986, 45654, 56682, 52724, 44567, 37394, 64949, 44226, 44485, 37394, 48157, 43718, 36566, 43920, 67963, 41040, 37071, 56559, 37064, 41927, 41099, 79378, 37241, 42739, 40549, 46485, 54774, 63901, 39613, 37133, 65604, 59955, 41221, 36260, 53170, 36251, 37098, 41571, 53076, 36257, 36475, 38877, 57495, 39190, 43106, 42455, 59487, 57932, 36694, 51621, 36749, 61191, 36850, 43801, 37435, 56190, 52502, 48134, 59855, 41807, 50174, 44344, 76201, 58436, 45023, 57281, 39851, 45912, 37610, 39178, 36257, 65737, 53971, 54082, 50471, 41927, 37133, 37435, 41408, 37133, 57071, 69130, 55403, 58694, 38351, 63969, 40011, 59487, 51626, 56756, 39223, 42053, 45199, 44311, 37890, 36311, 38852, 56966, 43556, 51626, 37435, 57709, 44344, 72682, 76499, 56559, 81214, 42053, 56336, 47074, 36919, 60316, 37133, 40231, 38721, 40192, 36276, 56021, 44839, 67492, 37187, 60248, 36560, 63377, 36462, 77707, 37071, 59597, 53283, 43851, 43635, 68253, 36385, 44311, 55094, 63248, 41001, 54082, 71386, 68856, 60248, 41115, 44928, 53670, 46020, 53622, 36473, 63377, 67963, 44198, 63248, 44198, 79378, 62625, 44661, 36341, 40871, 49199, 55950, 50471, 42248, 44492, 36245, 71907, 37505, 63248, 65604, 36257, 42836, 69130, 36850, 69130, 36276, 38877, 56436, 70822, 40011, 36407, 41866, 64674, 43556, 37404, 72996, 41927, 36850, 46485, 61328, 49899, 52502, 68253, 37041, 59855, 61884, 38205, 37218, 37956, 56069, 36269, 39178, 63248, 37766, 39223, 65604, 37133, 60117, 37956, 40011, 37956, 68171, 43331, 61056, 38573, 36253, 36677, 58309, 36283, 46582, 40011, 53967, 38934, 69294, 37133, 53622, 61328, 49029, 44485, 70210, 39448, 36244, 39909, 75164, 45663, 37435, 76499, 42248, 44226, 65872, 63248, 43556, 43718, 56651, 40761, 39947, 37064, 62748, 48242, 38877, 47940, 47261, 36850, 39178, 69130, 45181, 75458, 39711, 72372, 68400, 36495, 76052, 63639, 59033, 38893, 42769, 46493, 71386, 36850, 59604, 63248, 55008, 79072, 40983, 37125, 37133, 51626, 70516, 37435, 39405, 48530, 37435, 36553, 38838, 41282, 37133, 63248, 46576, 58581, 37187, 43635, 58920, 38499, 52169, 36694, 57709, 56069, 50081, 41990, 36850, 69130, 55242, 68253, 63248, 61606, 48134, 36269, 37160, 45023, 52613, 57182, 45563, 38918, 75605, 45339, 75164, 63377, 37187, 55918, 63248, 50174, 48764, 40498, 38877, 39178, 47987, 73624, 41866, 46020, 60074, 58359, 58359, 40498, 42970, 36257, 36852, 50269, 45108, 56436, 68034, 41597, 50471, 41534, 45663, 71245, 60921, 43556, 41534, 40891, 37133, 59986, 59146, 36850, 36850, 63248, 38102, 53622, 36294, 73153, 44792, 40011, 36352, 75903, 68253, 49988, 40011, 44839, 42117, 60921, 45927, 52391, 46327, 42248, 42053, 49025, 68400, 56069, 45420, 41534, 59838, 60248, 63377, 37187, 58807, 36896, 74282, 56756, 40871, 57432, 63248, 37044, 41040, 36297, 45927, 36254, 37270, 65103, 51733, 36269, 42442, 38610, 43556, 40816, 45339, 45472, 45339, 36566, 55242, 63248, 40498, 59955, 43782, 59372, 37125, 51815, 36850, 50891, 45023, 37110, 63377, 52835, 44792, 54774, 51733, 41221, 63248, 48629, 36852, 38975, 38573, 57495, 37133, 36812, 50459, 73122, 37187, 38770, 70516, 62010, 44642, 50786, 40121, 39909, 41099, 50459, 50459, 36553, 58359, 53170, 45420, 54427, 63248, 40341, 57923, 38770, 37087, 55918, 36896, 43801, 43971, 61328, 37133, 53057, 37187, 37280, 36257, 58470, 71386, 39133, 43801, 67963, 38499, 48764, 39090, 63248, 36896, 59955, 62748, 69294, 39362, 40345, 63248, 45023, 36285, 71672, 75017, 67627, 36812, 69294, 82132, 46485, 40926, 41927, 50459, 57495, 60651, 36919, 38961, 50174, 36547, 39061, 48332, 58581, 48416, 43106, 45663, 80755, 37435, 39662, 56069, 52613, 36969, 44127, 64674, 60074, 37855, 41689, 69130, 49899, 41099, 54888, 39909, 59721, 64110, 39004, 64533, 57602, 36999, 41099, 72682, 63248, 38388, 72839, 39090, 68400, 70977, 36260, 37890, 39270, 37044, 41040, 61745, 62873, 39178, 59986, 52613, 36969, 44492, 49899, 61328, 42053, 44946, 43635, 37110, 60786, 53170, 58436, 58182, 62748, 48590, 37098, 65604, 37125, 68253, 51136, 37160, 42739, 36634, 36625, 37154, 77103, 48157, 37110, 38811, 40926, 41282, 39223, 69445, 42053, 40602, 42524, 38877, 38934, 45023, 56069, 69130, 64110, 39960, 36245, 41058, 43635, 41689, 43989, 63123, 39960, 76052, 78613, 36321, 60381, 62440, 43439, 63830, 47649, 43556, 37187, 69130, 43635, 41857, 36736, 43556, 68996, 60651, 48242, 36600, 38877, 48242, 63377, 50786, 62133, 55593, 46485, 37133, 59955, 37160, 65737, 56682, 37133, 36451, 58694, 36245, 62502, 42248, 43635, 40816, 76201, 42386, 36850, 40143, 58436, 54173, 73467, 61191, 51733, 60117, 49988, 36330, 56436, 55831, 44198, 39270, 59259, 51718, 70516, 43556, 40708, 41099, 37956, 64687, 37187, 39858, 43801, 37187, 56559, 49721, 41471, 57709, 58565, 45582, 49373, 42386, 44417, 43506, 42118, 36269, 37133, 63377, 40011, 36677, 62379, 41221, 63248, 56932, 58182, 53057, 55593, 36873, 41282, 58581, 60316, 41866, 36418, 64949, 36936, 71529, 49899, 60381, 69130, 45017, 57432, 36553, 58309, 41571, 58470, 70057, 39223, 48764, 75754, 38760, 44127, 64392, 62998, 39270, 54476, 36957, 36269, 40447, 44717, 36677, 60248, 69445, 49810, 43635, 58436, 43635, 45501, 42595, 44567, 38811, 40561, 41571, 41727, 40011, 49988, 58359, 48827, 38721, 37133, 36257, 48728, 41597, 36245, 63377, 74723, 36242, 36254, 37125, 50174, 69445, 39133, 38065, 43181, 48677, 40602, 51626, 44417, 47843, 59081, 36283, 42053, 49647, 51842, 44928, 36254, 43635, 68698, 40926, 60248, 45927, 36850, 59721, 40946, 42248, 38472, 40781, 68253, 39898, 43331, 76499, 54312, 42666, 57682, 69130, 76952, 68698, 65604, 58581, 36418, 41866, 36736, 36248, 36969, 38918, 72996, 58141, 41748, 54888, 37890, 39223, 42836, 41040, 58823, 38893, 38877, 43801, 73412, 60248, 57281, 41990, 59487, 38811, 42248, 41866, 41040, 44198, 36462, 36894, 37956, 42248, 39851, 36269, 44198, 37301, 63248, 47987, 36896, 80755, 40816, 71672, 37041, 50996, 67897, 62873, 37212, 36702, 40926, 64251, 36269, 46679, 41040, 36944, 36244, 65080, 36345, 60679, 48157, 36711, 38610, 63377, 44344, 44642, 39858, 36462, 56069, 59033, 44056, 36257, 44311, 63248, 58581, 41160, 36749, 45339, 41040, 41001, 75017, 57932, 36850, 54072, 44946, 45023, 36774, 39466, 37342, 36269, 76201, 38877, 36488, 65604, 64163, 36269, 64392, 36831, 47904, 41282, 53670, 37890, 48590, 59955, 59487]}, {"inputs": [[544, 178, 526, 934, 40, 8, 560, 787, 695, 22, 542, 550, 11, 506, 858, 257, 370, 313, 405, 379, 580, 581, 736, 449, 835, 174, 442, 226, 256, 812, 685, 671, 287, 277, 639, 173, 576, 912, 150, 135, 425, 961, 520, 276, 21, 5, 932, 583, 200, 957, 213, 409, 572, 861, 975, 867, 504, 631, 875, 625, 829, 409, 719, 257, 567, 258, 592, 828, 833, 513, 551, 156, 481, 782, 856, 613, 4, 534, 280, 967, 95, 958, 234, 240, 71, 302, 401, 193, 435, 85, 258, 414, 629, 122, 518, 273, 514, 91, 981, 260, 213, 681, 746, 256, 689, 49, 370, 692, 447, 566, 196, 26, 621, 809, 740, 523, 312, 16, 185, 299, 232, 72, 831, 342, 74, 478, 736, 459, 978, 510, 240, 127, 568, 56, 284, 715, 674, 511, 670, 873, 338, 633, 786, 856, 541, 108, 390, 515, 21, 968, 458, 779, 767, 140, 517, 2, 743, 481, 123, 592, 733, 124, 139, 811, 174, 615, 63, 49, 670, 608, 492, 119, 687, 120, 380, 978, 723, 934, 404, 544, 980, 901, 195, 280, 542, 568, 332, 500, 422, 780, 77, 252, 625, 362, 686, 877, 574, 442, 842, 846, 665, 366, 310, 733, 169, 590, 910, 769, 15, 499, 520, 350, 25, 857, 779, 641, 216, 629, 632, 181, 738, 208, 101, 149, 827, 374, 517, 411, 127, 770, 603, 62, 872, 83, 714, 414, 610, 962, 888, 469, 411, 140, 593, 394, 807, 748, 28, 15, 899, 483, 168, 500, 363, 227, 133, 329, 114, 97, 792, 694, 917, 245, 895, 822, 186, 341, 169, 587, 288, 43, 618, 645, 987, 859, 251, 591, 193, 428, 150, 531, 732, 21, 260, 691, 105, 559, 97, 141, 889, 692, 128, 972, 195, 172, 57, 836, 880, 223, 918, 209, 334, 224, 447, 17, 408, 452, 81, 690, 433, 1000, 241, 114, 272, 777, 462, 716, 389, 371, 572, 609, 256, 8, 354, 329, 264, 354, 952, 751, 392, 43, 950, 846, 916, 493, 777, 264, 953, 355, 471, 993, 12, 27, 267, 770, 821, 44, 792, 777, 829, 839, 42, 267, 72, 963, 193, 939, 203, 834, 756, 64, 520, 609, 337, 402, 815, 73, 337, 203, 131, 671, 684, 493, 659, 526, 211, 537, 385, 28, 456, 834, 453, 475, 415, 454, 559, 843, 91, 114, 485, 560, 341, 249, 483, 702, 673, 135, 336, 231, 479, 136, 106, 659, 155, 884, 839, 376, 226, 636, 760, 479, 911, 647, 792, 692, 810, 8, 169, 106, 511, 353, 253, 634, 9, 90, 825, 451, 614, 335, 777, 839, 595, 836, 638, 380, 403, 412, 859, 464, 628, 985, 287, 758, 746, 232, 738, 715, 670, 840, 316, 917, 646, 415, 623, 958, 570, 78, 729, 129, 409, 205, 871, 189, 758, 149, 930, 936, 733, 535, 993, 955, 717, 843, 30, 756, 390, 395, 868, 603, 258, 280, 355, 233, 601, 771, 38, 749, 966, 890, 157, 627, 974, 685, 234, 524, 865, 156, 402, 48, 989, 234, 925, 268, 149, 635, 354, 553, 61, 610, 988, 741, 401, 445, 751, 682, 951, 776, 477, 732, 963, 641, 983, 421, 416, 934, 588, 978, 332, 399, 85, 575, 139, 974, 942, 159, 251, 652, 973, 457, 310, 511, 13, 419, 194, 348, 24, 770, 860, 453, 40, 80, 929, 253, 393, 224, 265, 864, 862, 184, 807, 770, 251, 508, 560, 105, 883, 114, 840, 199, 611, 685, 408, 383, 4, 845, 215, 464, 614, 14, 306, 114, 876, 562, 407, 765, 883, 600, 903, 269, 733, 99, 499, 662, 678, 153, 625, 996, 707, 21, 148, 873, 765, 438, 558, 393, 394, 213, 64, 471, 405, 882, 710, 989, 529, 948, 471, 512, 733, 364, 889, 802, 151, 873, 564, 31, 190, 132, 781, 818, 173, 573, 490, 457, 809, 749, 604, 302, 775, 765, 809, 882, 166, 791, 494, 395, 390, 519, 551, 465, 110, 178, 245, 506, 354, 485, 135, 152, 477, 728, 2, 350, 980, 887, 733, 821, 147, 197, 601, 503, 759, 419, 407, 869, 947, 664, 992, 714, 425, 480, 537, 169, 431, 737, 653, 799, 145, 515, 390, 854, 950, 674, 823, 573, 904, 434, 339, 371, 741, 581, 346, 373, 985, 806, 335, 568, 16, 850, 936, 722, 527, 89, 261, 462, 516, 500, 321, 355, 94, 572, 248, 179, 525, 901, 540, 521, 603, 816, 547, 572, 358, 443, 873, 415, 388, 67, 745, 171, 876, 425, 149, 352, 228, 873, 467, 627, 879, 152, 152, 740, 867, 126, 801, 170, 185, 453, 235, 654, 736, 299, 747, 389], [188, 551, 629, 252, 408, 685, 606, 633, 780, 17, 659, 207, 124, 228, 641, 446, 740, 901, 520, 140, 234, 515, 686, 73, 258, 748, 471, 21, 587, 572, 588, 43, 654, 733, 541, 434, 310, 277, 11, 952, 415, 490, 412, 287, 475, 953, 941, 462, 686, 935, 573, 491, 515, 174, 70, 889, 656, 447, 694, 821, 105, 366, 349, 874, 980, 235, 421, 390, 529, 453, 674, 135, 374, 517, 28, 44, 980, 843, 575, 168, 411, 952, 67, 416, 739, 592, 985, 834, 174, 475, 749, 21, 514, 371, 592, 335, 168, 258, 411, 507, 934, 350, 16, 865, 262, 553, 106, 529, 941, 114, 156, 226, 14, 821, 795, 354, 505, 419, 21, 148, 481, 411, 465, 147, 404, 258, 267, 614, 355, 79, 535, 364, 147, 503, 873, 980, 224, 21, 135, 152, 692, 2, 301, 702, 936, 521, 777, 207, 674, 779, 841, 777, 962, 568, 918, 462, 133, 355, 402, 551, 895, 401, 958, 637, 740, 551, 521, 674, 664, 973, 258, 682, 200, 26, 500, 168, 816, 958, 718, 899, 746, 836, 411, 733, 79, 740, 816, 74, 716, 85, 736, 458, 572, 57, 471, 827, 884, 257, 987, 936, 524, 756, 689, 433, 499, 871, 373, 335, 801, 609, 747, 586, 56, 151, 514, 506, 890, 506, 963, 106, 955, 953, 390, 114, 879, 85, 515, 213, 21, 747, 733, 273, 807, 213, 153, 646, 14, 213, 178, 765, 810, 253, 568, 965, 155, 506, 685, 89, 139, 782, 843, 203, 122, 765, 717, 953, 105, 208, 404, 149, 833, 363, 80, 251, 467, 642, 105, 810, 714, 510, 736, 447, 9, 156, 402, 807, 58, 45, 88, 581, 936, 695, 568, 809, 729, 520, 770, 144, 867, 606, 978, 220, 370, 468, 397, 711, 114, 241, 784, 728, 912, 184, 73, 733, 918, 769, 354, 28, 434, 258, 401, 14, 702, 306, 354, 81, 890, 197, 195, 49, 72, 573, 900, 925, 465, 560, 415, 633, 208, 49, 775, 91, 240, 798, 477, 882, 572, 621, 978, 193, 889, 687, 511, 56, 211, 105, 171, 350, 241, 335, 567, 519, 341, 645, 917, 524, 97, 517, 480, 888, 97, 329, 15, 759, 131, 361, 613, 132, 603, 250, 957, 347, 611, 407, 54, 393, 701, 240, 953, 4, 170, 258, 733, 352, 526, 515, 665, 91, 873, 334, 518, 526, 692, 684, 811, 457, 300, 392, 251, 520, 651, 13, 114, 731, 440, 150, 673, 845, 862, 714, 462, 671, 128, 587, 273, 749, 483, 198, 228, 408, 759, 90, 156, 717, 361, 390, 388, 49, 156, 740, 654, 883, 733, 159, 409, 779, 158, 816, 354, 415, 394, 276, 647, 310, 120, 690, 917, 389, 64, 789, 537, 684, 485, 140, 865, 760, 169, 685, 752, 12, 654, 90, 8, 613, 433, 225, 614, 716, 236, 694, 875, 296, 62, 720, 568, 596, 947, 950, 174, 729, 749, 71, 13, 287, 736, 757, 927, 98, 129, 615, 114, 827, 558, 645, 271, 233, 173, 279, 482, 79, 777, 395, 415, 170, 265, 733, 453, 462, 734, 59, 746, 433, 156, 139, 685, 190, 667, 196, 105, 963, 590, 156, 547, 572, 786, 685, 264, 637, 771, 958, 159, 471, 846, 468, 258, 916, 97, 106, 485, 641, 592, 884, 917, 982, 166, 544, 749, 452, 846, 523, 869, 827, 127, 64, 127, 493, 392, 743, 131, 710, 152, 442, 287, 926, 253, 520, 765, 172, 603, 232, 733, 605, 464, 415, 354, 410, 796, 979, 224, 575, 342, 190, 976, 862, 288, 576, 654, 81, 650, 21, 257, 321, 560, 533, 449, 936, 516, 390, 520, 149, 537, 544, 846, 260, 40, 402]], "output": [260783, 187893, 200175, 233673, 191639, 214601, 195551, 201077, 249071, 364757, 207469, 252135, 294505, 243141, 202963, 187405, 232677, 314077, 185651, 285345, 240685, 185455, 214897, 326237, 231465, 235739, 185789, 361861, 192369, 190185, 192523, 346425, 206189, 230119, 187019, 188543, 214703, 225009, 369161, 347765, 190679, 185283, 191077, 221797, 185629, 348455, 340281, 186241, 214897, 336237, 190319, 185271, 185455, 267519, 328215, 306503, 206701, 187317, 217331, 268419, 305915, 199715, 203753, 297323, 367619, 240287, 189953, 194683, 186163, 186827, 211469, 288153, 197953, 185525, 356881, 345739, 367619, 279817, 190597, 270517, 191213, 347765, 330201, 190555, 232305, 193153, 371301, 275037, 267519, 185629, 236131, 361861, 185425, 198599, 193153, 207447, 270517, 231465, 191213, 185283, 335567, 203497, 365483, 292069, 230059, 188085, 305301, 186163, 340281, 300441, 276689, 243971, 366947, 268419, 255935, 202495, 185259, 190189, 361861, 280935, 185433, 191213, 186077, 281483, 192255, 231465, 228335, 197063, 202255, 322329, 186569, 200167, 281483, 185241, 296725, 367619, 244811, 361861, 288153, 278785, 216707, 375903, 217435, 219857, 336907, 185701, 247735, 252135, 211469, 248623, 278739, 247735, 354725, 189685, 325031, 186241, 289293, 202255, 192577, 187893, 310281, 192743, 351923, 202009, 232677, 187893, 185701, 211469, 208773, 362547, 231465, 213735, 255251, 358295, 185223, 270517, 265943, 351923, 225017, 312809, 234961, 276083, 191213, 230119, 322329, 232677, 265943, 325583, 224351, 318463, 231199, 186483, 190185, 336899, 185789, 271441, 303397, 231825, 372785, 336907, 185859, 238923, 215795, 188645, 185223, 295551, 198167, 207447, 258735, 196099, 235349, 192217, 337575, 279317, 185425, 185269, 307131, 185269, 355429, 305301, 349839, 348455, 194683, 300441, 300337, 318463, 185455, 249505, 361861, 235349, 230119, 226327, 261567, 249505, 278259, 204185, 366947, 249505, 265567, 242609, 263007, 233299, 189685, 356845, 277211, 185269, 214601, 315911, 285903, 249973, 279817, 253907, 295683, 242609, 224683, 348455, 305915, 251693, 192255, 280389, 274519, 200395, 321681, 234049, 185977, 203207, 305915, 263007, 223695, 185329, 231199, 187317, 370645, 276689, 192577, 261567, 336225, 345055, 316549, 191461, 336907, 217645, 189685, 262523, 228739, 185651, 244707, 283135, 293221, 195551, 366159, 246513, 198819, 185929, 193427, 222729, 300441, 237915, 250881, 228397, 321135, 262679, 326237, 230119, 325031, 244285, 202495, 356881, 188543, 231465, 192743, 366947, 219857, 215911, 202495, 321035, 307131, 256605, 257515, 342321, 326893, 190319, 313443, 329623, 186077, 188779, 190679, 201077, 251693, 342321, 246865, 314641, 238307, 257333, 185553, 302165, 190185, 198481, 366159, 258437, 306503, 215195, 185347, 337575, 250377, 305915, 269005, 203497, 237915, 207447, 189567, 185607, 205827, 203939, 324377, 185859, 310871, 185525, 185459, 305879, 310871, 209149, 366213, 240139, 290439, 200857, 196867, 289865, 195007, 234431, 351227, 204267, 196479, 191789, 338931, 194127, 219541, 238307, 348455, 374391, 269505, 231465, 230119, 202993, 185973, 185455, 209037, 314641, 296725, 207727, 185565, 185973, 216707, 214311, 263493, 186547, 217743, 194311, 234049, 185651, 205433, 367683, 300441, 229427, 187957, 279851, 211191, 280905, 290351, 223695, 186241, 210639, 292169, 192369, 226327, 236131, 185389, 256153, 243141, 191639, 240139, 315275, 276689, 224683, 200857, 194683, 195075, 342321, 276689, 232677, 206189, 302779, 230119, 275139, 191493, 248623, 275655, 265943, 202495, 190679, 193947, 225337, 204433, 214703, 296867, 216097, 324377, 194877, 332193, 253161, 186713, 214311, 185353, 285345, 292069, 240549, 270007, 214601, 237323, 368421, 206189, 315275, 371389, 196867, 188645, 244391, 197063, 224351, 239891, 217331, 297921, 218987, 333531, 225687, 189685, 193817, 344347, 346391, 267519, 228739, 236131, 327553, 367683, 221797, 231199, 239327, 330939, 310249, 291591, 197263, 300441, 271441, 188575, 203939, 226993, 241089, 268011, 224357, 185411, 322329, 247735, 193771, 190679, 269505, 229019, 230119, 186827, 186241, 230479, 335551, 234961, 188645, 276689, 285903, 214601, 259841, 209569, 257059, 305915, 355429, 192835, 276689, 187531, 190185, 251789, 214601, 229363, 202009, 245137, 351923, 275139, 185789, 281451, 185929, 231465, 323727, 310871, 305301, 185353, 202963, 193153, 303397, 324377, 369089, 271541, 187267, 236131, 186905, 281451, 185805, 294383, 271441, 292749, 332193, 292749, 185249, 194311, 233813, 290439, 222407, 278785, 187765, 221797, 330281, 233299, 185651, 242609, 268507, 195007, 241495, 230119, 195369, 186129, 190679, 202495, 191353, 256401, 366889, 244811, 190597, 205565, 259841, 364711, 290351, 221483, 190739, 206189, 321035, 205183, 361861, 231825, 211469, 188779, 186431, 187149, 336907, 185489, 194683, 185651, 280389, 186713, 187267, 281451, 230757, 348499, 192577]}, {"inputs": [[718, 452, 864, 128, 794, 314, 518, 420, 799, 238, 682, 27, 335, 626, 849, 483, 223, 476, 535, 825, 178, 828, 830, 835, 341, 235, 871, 377, 950, 16, 187, 994, 860, 89, 307, 756, 194, 779, 877, 214, 51, 840, 389, 844, 271, 968, 948, 487, 734, 538, 826, 340, 919, 706, 259, 355, 398, 159, 395, 520, 246, 722, 994, 175, 419, 512, 925, 947, 884, 596, 531, 487, 476, 283, 430, 488, 342, 322, 80, 101, 767, 543, 503, 422, 460, 41, 885, 798, 969, 679, 26, 238, 296, 828, 408, 48, 341, 957, 654, 980, 982, 507, 966, 656, 867, 839, 16, 633, 109, 673, 79, 530, 769, 11, 811, 783, 166, 884, 720, 926, 142, 534, 570, 250, 534, 567, 141, 131, 200, 341, 854, 921, 721, 606, 67, 238, 598, 716, 743, 307, 806, 121, 537, 755, 331, 210, 377, 571, 916, 521, 904, 316, 60, 875, 514, 307, 824, 944, 220, 97, 919, 447, 544, 365, 118, 891, 351, 913, 831, 662, 692, 407, 222, 52, 17, 256, 32, 142, 228, 228, 204, 321, 628, 755, 906, 682, 120, 903, 460, 928, 728, 520, 858, 215, 689, 976, 819, 995, 702, 6, 364, 822, 655, 709, 1000, 872, 109, 51, 539, 993, 316, 360, 618, 908, 446, 680, 192, 876, 437, 9, 790, 378, 451, 966, 989, 523, 59, 232, 864, 323, 230, 626, 235, 887, 759, 376, 10, 350, 588, 235, 772, 659, 747, 352, 827, 804, 145, 279, 579, 473, 296, 806, 489, 89, 925, 653, 898, 734, 767, 861, 281, 611, 268, 33, 451, 810, 606, 508, 243, 24, 680, 234, 938, 478, 783, 686, 296, 984, 576, 654, 632, 645, 98, 346, 262, 937, 899, 873, 589, 440, 604, 397, 300, 67, 206, 150, 508, 271, 745, 924, 862, 922, 665, 737, 907, 372, 599, 389, 31, 566, 230, 445, 895, 357, 610, 88, 654, 78, 295, 157, 671, 631, 693, 842, 623, 689, 449, 122, 770, 176, 241, 1000, 111, 277, 234, 248, 870, 896, 494, 988, 412, 68, 183, 531, 103, 755, 752, 730, 364, 927, 934, 265, 485, 207, 536, 395, 321, 371, 463, 729, 206, 903, 775, 394, 225, 740], [984, 628, 88, 103, 123, 922, 234, 54, 1000, 238, 876, 233, 683, 153, 543, 785, 861, 770, 271, 661, 268, 674, 234, 588, 67, 414, 628, 340, 914, 332, 497, 610, 534, 809, 877, 420, 531, 91, 800, 680, 476, 571, 424, 460, 829, 271, 142, 682, 356, 341, 38, 452, 937, 924, 244, 729, 473, 598, 321, 896, 956, 928, 949, 421, 538, 729, 819, 296, 308, 1000, 682, 456, 307, 243, 110, 806, 477, 262, 48, 791, 230, 571, 781, 873, 88, 871, 632, 203, 859, 79, 654, 877, 734, 464, 722, 408, 631, 672, 335, 823, 299, 991, 738, 223, 460, 447, 476, 831, 922, 109, 529, 806, 776, 512, 869, 321, 926, 250, 509, 594, 695, 995, 477, 206, 394, 929, 193, 968, 846, 386, 908, 78, 712, 59, 714, 602, 262, 985, 225, 215, 667, 922, 314, 265, 893, 903, 175, 523, 827, 321, 234, 925, 371, 49, 839, 993, 770, 896, 670, 196, 587, 21, 390, 142, 446, 452, 214, 408, 487, 597, 536, 910, 119, 243, 279, 884, 395, 692, 296, 487, 296, 641, 234, 26, 439, 296, 626, 611, 79, 241, 482, 680, 867, 657, 718, 631, 131, 537, 586, 357, 154, 770, 321, 366, 640, 51, 364, 719, 806, 734, 938, 234, 512, 532, 460, 708, 228, 990, 220, 825, 78, 7, 389, 907, 745, 359, 234, 2, 142, 531, 937, 368, 828, 539, 656, 205, 207, 296, 349, 822, 925, 300, 377, 689, 488, 418, 570, 78, 576, 279, 11, 839, 721, 595, 222, 606, 230, 534, 925, 780, 540, 885, 122, 629, 247, 296, 534, 734, 121, 862, 987, 341, 757, 598, 412, 611, 307, 938, 783, 32, 568, 659, 861, 553, 537, 514, 176, 895, 119, 568, 452, 516, 258, 601, 364, 307, 867, 525, 821, 24, 530, 142, 831, 875, 707, 857, 895, 24, 680, 618, 248, 737, 341, 120, 489, 307, 136, 802, 627, 685, 234, 100, 414, 568, 855, 605, 271, 406, 371, 804, 507, 925, 912, 142, 587, 925, 235, 629, 314, 225, 307, 850, 54, 283, 885, 721, 745, 606, 263, 473, 847, 341, 825, 296, 860, 705, 945, 341, 10, 280, 938, 228, 309, 462, 891, 356, 350, 827, 446, 861, 89, 919, 981, 994, 230, 532, 247, 350, 983, 508, 148, 903, 268, 503, 927, 904, 173, 865, 109, 350, 582, 68, 606, 596, 419, 937, 828, 534, 904, 487, 78, 871, 588, 521, 250, 451, 606, 307, 632, 452, 881, 519, 925, 480, 859, 862, 536, 824, 932, 895, 680, 171, 350, 675, 88, 830, 79, 16, 210, 235, 241, 411, 471, 26, 772, 51, 885, 906, 796, 729, 913, 918, 570, 297, 831, 222, 568, 903, 724, 206, 912, 740, 372, 567, 966, 355, 10, 771, 654, 885, 238, 998, 465, 686, 17, 23, 536, 872, 731, 365, 802, 842, 246, 740, 218, 523, 720, 238, 828, 518, 556, 159, 49, 654, 452, 923, 51, 716, 228, 230, 89, 533, 846, 233, 176, 67, 261, 654, 3, 413, 361, 570, 865, 81, 764, 988, 819, 876, 815, 232, 68, 235, 292, 215, 461, 947, 235, 875, 566, 92, 184, 101, 728, 799, 316, 994, 645, 48, 488, 485, 764, 967, 537, 985, 832, 923, 530, 332, 919, 207, 530, 99, 980, 156, 25, 444, 316, 150, 922, 801, 244, 350, 356, 192, 352, 830, 903, 102, 842, 24, 997, 287, 944, 821, 238, 865, 966, 645, 389, 10, 277, 806, 389, 346, 395, 858, 187, 408, 632, 395, 342, 827, 352, 537, 983, 159, 235, 459, 951, 377, 101, 238, 487, 207, 229, 682, 892, 529, 493, 755, 903, 925, 246, 875, 377, 333, 542, 520, 67, 289, 121, 266, 521, 419, 345, 638, 482, 905, 567, 754, 149, 16, 507, 882, 483, 626, 68, 101, 766, 655, 133, 563, 26, 599, 748, 806, 829, 871, 213, 26, 543, 508, 963, 994, 238, 999, 861, 389, 822, 146, 448, 806, 947, 323, 207, 223, 223, 673, 218, 955, 944, 941, 907, 738, 653, 994, 995, 950, 24, 29, 876, 375, 936, 719, 449, 281, 29, 755, 443, 570, 283, 895, 17, 921, 628, 995, 350, 968, 257, 589, 777, 826, 29, 660, 281, 307, 845, 515, 995, 915, 585, 781, 898, 97, 819, 689, 843, 147, 238, 821, 536, 411, 680, 728, 300, 283, 873, 794, 5, 177, 235, 222, 144, 576, 92, 770, 682, 872, 503, 130, 904, 770, 541, 365, 506, 307, 230, 779, 693, 831, 273, 154, 767, 67, 79, 408, 313, 567, 876, 520, 969, 534, 492, 21, 414, 36, 654, 296, 200, 89, 961, 430, 867, 775, 206, 887, 689, 571, 855, 200, 397, 680, 472, 877, 985, 862, 565, 194, 840, 913, 32, 925, 19, 690, 900, 119, 174, 274, 22, 459, 977, 721, 51, 9, 243, 558, 515, 598, 825, 622, 741, 112, 357, 922, 341, 430, 50, 855, 507, 335, 980, 408, 447, 505]], "output": [168809, 96351, 161747, 157149, 151251, 148343, 122525, 172675, 174503, 121687, 135397, 122743, 101011, 142855, 92881, 115633, 131635, 112957, 115365, 98885, 115911, 100105, 122525, 94247, 168415, 97113, 96351, 104517, 145949, 105611, 92993, 95271, 92713, 120181, 135659, 96671, 92689, 160819, 118431, 100695, 93579, 93627, 96395, 94251, 124281, 115365, 145869, 100903, 102543, 104383, 178061, 94635, 153073, 148955, 120483, 106609, 93699, 94669, 107155, 140775, 159297, 150205, 156975, 96601, 92773, 106609, 122195, 111045, 109123, 174503, 100903, 94443, 109277, 120681, 155053, 119587, 93543, 117021, 174675, 116739, 123401, 93627, 114905, 134621, 161747, 134111, 96625, 129787, 131157, 164575, 98271, 135659, 107307, 94077, 105669, 97565, 96555, 99911, 105197, 123013, 110559, 171269, 107885, 124993, 94251, 94905, 93579, 124719, 148343, 155349, 92683, 119587, 114011, 92737, 133609, 107155, 149575, 119307, 92773, 94497, 102359, 172693, 93543, 129041, 98701, 150523, 132303, 163311, 128109, 99433, 144183, 164893, 104403, 171025, 104651, 94859, 117021, 169159, 124533, 126873, 99439, 148343, 108199, 116463, 139951, 142739, 136957, 92671, 123849, 107155, 122525, 149263, 100893, 174339, 126503, 171977, 112957, 140775, 99721, 131545, 94209, 183935, 99061, 145869, 94963, 94635, 127111, 97565, 93213, 94625, 92739, 144771, 152407, 120681, 113945, 137507, 98613, 102007, 111045, 93213, 111045, 97289, 122525, 182179, 95397, 111045, 96219, 95327, 164575, 121081, 93371, 100695, 133109, 98529, 105151, 96555, 148969, 92755, 94171, 102427, 142583, 112957, 107155, 101423, 97215, 173667, 101637, 105279, 119587, 107307, 153395, 122525, 92737, 92697, 94251, 103909, 123849, 170915, 125693, 123427, 164893, 188937, 99151, 143891, 108921, 102199, 122525, 190765, 145869, 92689, 153073, 101211, 124063, 92793, 98441, 129289, 128797, 111045, 103379, 122807, 149263, 110397, 100281, 101665, 93187, 96817, 93595, 164893, 93797, 113945, 187487, 126503, 105537, 94539, 125225, 95055, 123401, 92713, 149263, 114725, 92815, 137775, 151537, 96419, 119891, 111045, 92713, 107307, 151825, 131877, 169859, 104383, 110789, 94669, 97261, 95327, 109277, 153395, 115265, 180103, 93535, 98705, 131635, 93139, 92755, 92717, 136693, 140499, 152407, 93535, 94635, 92701, 117775, 94811, 101637, 109277, 133109, 92675, 122603, 182879, 92685, 145869, 124719, 135137, 103787, 130683, 140499, 182879, 100695, 95733, 119695, 107739, 104383, 152115, 93163, 109277, 147559, 118815, 96285, 101227, 122525, 158057, 97113, 93535, 130211, 95005, 115365, 97723, 100893, 119199, 92801, 149263, 145359, 145869, 94209, 149263, 122311, 96419, 108199, 124533, 109277, 129039, 172675, 113253, 137775, 105537, 108921, 95055, 116835, 93699, 128341, 104383, 123427, 111045, 131395, 103545, 155665, 104383, 187847, 113771, 153395, 123849, 108969, 94163, 139403, 102543, 103255, 123849, 94963, 131635, 161435, 147435, 167767, 172333, 123401, 92697, 119891, 103255, 168461, 92785, 144219, 142739, 115911, 92873, 149889, 143025, 137489, 132613, 155349, 103255, 94019, 168093, 95055, 94581, 96743, 153073, 124063, 92713, 143025, 93213, 164893, 134111, 94247, 92671, 119307, 94685, 95055, 109277, 96625, 94635, 136715, 92679, 149263, 93439, 131157, 131877, 92739, 123219, 151477, 140499, 100695, 138021, 103255, 100203, 161747, 124499, 164575, 185697, 128071, 122311, 121081, 97337, 93783, 182179, 113305, 173667, 137775, 143601, 117673, 106609, 145653, 147137, 93595, 110883, 124719, 125225, 93535, 142739, 105937, 129041, 145359, 108177, 100789, 93505, 162635, 102659, 187847, 113131, 98271, 137775, 121687, 173779, 94035, 101335, 185343, 183231, 92739, 134365, 106887, 101529, 118815, 127185, 120087, 108177, 126165, 92671, 105407, 121687, 124063, 92685, 93217, 141227, 174339, 98271, 94635, 148649, 173667, 104899, 123849, 123401, 161435, 92705, 128109, 122743, 136693, 168415, 117209, 98271, 190399, 97187, 101973, 93595, 132613, 163945, 111947, 170209, 122195, 135397, 121387, 122961, 168093, 122311, 111723, 126873, 94207, 156317, 122311, 135137, 93477, 160511, 134611, 157753, 106473, 118239, 107895, 172333, 97585, 174675, 93187, 93273, 111947, 162973, 92755, 169159, 124941, 148649, 92685, 105611, 147435, 128797, 92685, 158361, 167421, 142039, 182529, 95085, 107895, 143671, 148343, 118623, 120483, 103255, 102543, 132557, 103013, 124499, 142739, 157451, 127185, 182879, 173417, 112573, 155339, 122603, 121687, 132613, 162635, 97585, 99151, 187847, 114297, 119587, 99151, 103751, 98613, 130919, 133837, 97565, 96625, 98613, 104255, 123849, 103013, 92755, 168461, 141227, 122311, 94299, 157637, 100281, 157753, 121687, 93213, 128797, 123625, 100903, 139677, 92683, 93075, 110463, 142739, 149263, 120087, 135137, 100281, 105473, 92859, 92673, 168415, 112233, 151825, 116279, 92671, 96743, 103877, 97067, 93371, 143313, 93505, 110307, 143945, 185697, 92801, 136979, 93337, 96219, 168093, 157753, 112279, 98355, 148405, 93399, 182179, 94715, 109379, 119587, 124281, 134111, 127351, 182179, 92881, 92785, 161633, 172333, 121687, 174141, 131635, 99151, 122807, 144767, 94849, 119587, 156317, 106869, 128797, 124993, 124993, 100007, 126165, 158965, 155339, 154367, 143891, 107885, 98193, 172333, 172693, 157305, 182879, 181139, 135397, 100483, 152753, 105279, 94793, 113597, 181139, 110463, 95147, 93595, 113253, 140499, 185343, 148039, 96351, 172693, 103255, 163311, 117965, 94287, 114189, 123637, 181139, 98795, 113597, 109277, 127877, 92709, 172693, 146245, 94133, 114905, 141331, 158971, 122195, 101665, 127415, 144493, 121687, 122603, 92739, 97337, 100695, 106473, 110397, 113253, 134621, 117297, 189667, 136431, 122311, 125225, 145317, 93797, 160511, 112957, 100903, 134365, 92873, 149253, 143025, 112957, 92837, 101529, 92819, 109277, 123401, 114545, 102123, 124719, 115009, 142583, 112445, 168415, 164575, 97565, 108353, 93505, 135397, 92673, 163651, 92713, 93097, 183935, 97113, 178741, 98271, 111045, 130537, 161435, 160965, 95987, 133109, 113833, 129041, 138315, 101665, 93627, 130211, 130537, 98445, 100695, 93741, 135659, 169159, 131877, 93451, 132049, 126729, 145653, 180103, 149263, 184639, 101779, 141893, 152407, 137223, 114831, 183583, 94299, 166389, 105537, 173667, 188209, 120681, 93269, 92709, 94669, 123427, 95973, 108325, 154463, 102427, 148343, 104383, 95987, 174003, 130211, 92801, 105197, 167421, 97565, 94905, 92837]}, {"inputs": [[665, 448, 939, 151, 12, 470, 33, 709, 310, 974, 341, 62, 295, 9, 883, 79, 1, 181, 241, 974, 910, 198, 664, 277, 258, 77, 107, 417, 911, 385, 323, 614, 954, 41, 388, 457, 301, 778, 154, 715, 293, 703, 907, 830, 466, 553, 949, 262, 824, 709, 899, 469, 658, 379, 439, 479, 123, 989, 910, 567, 656, 111, 583, 746, 684, 205, 720, 345, 730, 131, 731, 264, 735, 708, 276, 943, 548, 89, 806, 917, 343, 141, 883, 947, 724, 161, 280, 900, 468, 968, 287, 96, 701, 193, 964, 225, 569, 686, 635, 151, 769, 676, 683, 585, 846, 857, 160, 607, 427, 678, 8, 27, 346, 790, 780, 291, 500, 782, 357, 186, 843, 152, 571, 740, 471, 857, 218, 75, 15, 377, 446, 750, 970, 227, 890, 298, 578, 275, 166, 247, 169, 454, 700, 106, 834, 200, 413, 347, 411, 434, 528, 394, 504, 153, 580, 278, 608, 602, 456, 968, 148, 928, 824, 19, 952, 135, 937, 807, 748, 702, 372, 215, 187, 111, 372, 395, 976, 101, 32, 797, 916, 20, 899, 142, 499, 893, 375, 280, 698, 866, 730, 820, 948, 166, 773, 711, 108, 280, 805, 173, 596, 228, 106, 695, 755, 979, 771, 936, 877, 839, 342, 151, 607, 290, 400, 399, 575, 938, 565, 35, 356, 297, 110, 9, 513, 184, 493, 962, 591, 36, 775, 417, 287, 771, 752], [17, 468, 243, 323, 280, 152, 665, 678, 825, 692, 343, 85, 33, 805, 746, 151, 731, 824, 829, 746, 468, 397, 656, 343, 335, 153, 297, 762, 807, 151, 417, 936, 231, 890, 964, 345, 348, 428, 703, 103, 709, 199, 913, 899, 782, 342, 750, 769, 698, 51, 426, 976, 930, 295, 216, 8, 177, 111, 470, 166, 974, 225, 33, 969, 444, 151, 860, 836, 195, 99, 906, 280, 617, 820, 824, 976, 858, 280, 704, 503, 833, 607, 937, 979, 448, 502, 900, 508, 891, 108, 730, 949, 900, 293, 730, 678, 5, 87, 345, 106, 126, 734, 893, 470, 32, 293, 773, 153, 953, 133, 280, 31, 979, 287, 937, 107, 616, 377, 394, 219, 529, 276, 288, 912, 779, 964, 976, 778, 259, 857, 974, 673, 172, 200, 142, 377, 937, 443, 568, 346, 707, 961, 468, 730, 287, 454, 751, 771, 780, 968, 750, 910, 979, 857, 911, 166, 415, 468, 166, 779, 903, 106, 964, 151, 399, 683, 899, 683, 701, 151, 702, 937, 298, 446, 184, 910, 750, 39, 404, 942, 345, 776, 477, 910, 610, 243, 145, 225, 617, 341, 965, 35, 839, 596, 778, 15, 698, 899, 824, 974, 700, 227, 665, 574, 608, 70, 699, 637, 659, 779, 695, 857, 849, 388, 910, 769, 730, 394, 604, 715, 428, 830, 911, 585, 644, 707, 166, 68, 375, 399, 85, 305, 910, 952, 244, 300, 186, 265, 352, 434, 626, 110, 892, 891, 34, 153, 551, 185, 287, 607, 702, 591, 708, 150, 108, 166, 36, 280, 917, 683, 434, 280, 867, 658, 937, 968, 346, 869, 703, 475, 289, 778, 579, 746, 577, 85, 968, 831, 19, 211, 772, 151, 397, 287, 150, 383, 538, 978, 280, 1, 486, 107, 276, 334, 908, 35, 911, 499, 457, 9, 665, 76, 166, 27, 35, 111, 591, 583, 750, 857, 153, 602, 165, 736, 698, 457, 711, 822, 278, 734, 198, 9, 771, 607, 151, 731, 917, 635, 892, 960, 25, 160, 772, 242, 280, 254, 782, 972, 579, 154, 576, 607, 10, 108, 748, 954, 748, 166, 217, 378, 976, 947, 700, 280, 215, 295, 894, 676, 828, 583, 287, 685, 695, 279, 566, 740, 709, 863, 594, 29, 10, 931, 227, 771, 493, 707, 974, 528, 280, 8, 709, 395, 968, 950, 583, 280, 949, 280, 948, 895, 264, 343, 587, 470, 460, 710, 720, 249, 607, 456, 296, 264, 568, 490, 949, 108, 470, 713, 278, 910, 248, 198, 129, 777, 934, 794, 974, 964, 135, 145, 442, 948, 170, 785, 215, 645, 553, 730, 910, 228, 35, 9, 792, 579, 504, 499, 730, 711, 949, 77, 863, 185, 321, 711, 280, 979, 504, 108, 596, 284, 797, 685, 161, 399, 684, 683, 967, 834, 738, 418, 935, 597, 860, 280, 37, 805, 276, 99, 45, 916, 489, 686, 744, 408, 297, 412, 76, 844, 964, 90, 727, 938, 867, 805, 19, 771, 107, 200, 280, 118, 341, 357, 748, 456, 899, 631, 357, 153, 560, 947, 723, 720, 110, 899, 824, 278, 571, 894, 654, 79, 111, 151, 166, 747, 80, 549, 342, 445, 164, 179, 300, 19, 413, 175, 205, 680, 74, 193, 280, 157, 278, 650, 974, 875, 949, 679, 938, 713, 35, 778, 298, 846, 748, 343, 159, 1, 754, 236, 709, 907, 124, 781, 470, 891, 153, 657, 752, 372, 217, 311, 33, 962, 344, 444, 607, 183, 816, 976, 413, 402, 280, 487, 183, 343, 24, 565, 581, 776, 412, 501, 9, 746, 771, 657, 457, 820, 938, 470, 735, 290, 379, 275, 396, 820, 479, 295, 457, 658, 399, 761, 747, 824, 36, 111, 351, 917, 910, 357, 429, 973, 883, 375, 780, 411, 947, 506, 771, 585, 133, 896, 342, 356, 702, 704, 938, 151, 225, 180, 291, 155, 552, 948, 153, 924, 797, 791, 703, 806, 275, 830, 188, 189, 166, 526, 950, 940, 821, 700, 327, 201, 290, 858, 588, 899, 13, 289, 832, 419, 777, 469, 652, 166, 823, 417, 944, 106, 290, 948, 35, 13, 607, 508, 397, 444, 226, 52, 771, 827, 976, 701, 805, 730, 966, 33, 806, 702, 839, 740, 582, 299, 468, 417, 301, 98, 476, 448, 116, 406, 698, 176, 974, 709, 379, 664, 730, 708, 821, 153, 153, 228, 102, 568, 9, 290, 683, 949, 28, 702, 613, 750, 280, 275, 280, 346, 835, 110, 151, 280, 379, 398, 387, 279, 364, 21, 715, 789, 771, 731, 420, 458, 133, 835, 341, 399, 701, 110, 607, 202, 401, 170, 356, 752, 583, 343, 752, 278, 414, 607, 430, 344, 264, 947, 342, 126, 936, 721, 781, 738, 595, 280, 607, 954, 824, 798, 36, 565, 399, 342, 582, 242, 772, 976, 607, 718, 592, 236, 841, 357, 699, 450, 413, 228, 606, 735, 386, 857, 939, 607, 262, 842, 1, 585, 456, 347, 290, 417, 630, 228, 432, 736, 578, 503, 352, 151, 742, 35, 192, 776, 730, 266, 76, 550, 695, 359, 567, 954, 390, 181, 727, 280, 448, 9, 128, 778, 276, 805, 395, 778, 440, 782, 839, 157, 781, 48, 857, 582, 968, 832, 604, 230, 469, 33, 36, 7, 883, 108, 635, 466, 499, 691, 962, 976, 883, 538, 187, 936, 228, 586, 700, 38, 812, 938, 947, 607, 301, 160, 387, 883, 896, 141, 398, 395, 890, 885, 12, 498, 683, 111, 656, 967, 142, 513, 937, 720, 79, 198, 967, 108, 949, 6, 970, 478, 537, 775, 375, 786, 434, 121, 372, 579, 346, 591, 107, 870, 74, 702, 700, 2, 161, 227, 166, 569, 264, 596, 412, 111, 287, 151, 133, 974, 297, 824, 111, 735, 293, 111, 446, 382, 948, 287, 111, 788, 824, 377, 664, 172, 423, 732, 301, 679, 910, 771, 824, 357, 911, 278, 938, 78, 15, 723, 608, 152, 960, 277, 15, 18, 287]], "output": [113622, 61851, 75076, 67590, 71027, 87233, 67350, 68147, 84328, 69103, 66176, 99426, 110122, 81460, 74071, 87394, 72492, 84179, 84924, 74071, 61851, 63406, 66839, 66176, 66738, 87074, 69524, 75901, 81740, 87394, 62756, 103333, 76476, 94763, 109191, 66046, 65863, 62483, 69922, 95890, 70422, 80470, 98892, 96332, 78355, 66243, 74511, 76720, 69535, 106370, 62531, 111871, 102163, 69686, 78299, 115655, 83486, 94382, 61843, 85079, 111413, 77188, 110122, 110290, 62145, 87394, 89771, 85983, 81000, 96666, 97597, 71027, 64808, 83599, 84179, 111871, 89445, 71027, 70005, 61956, 85526, 64314, 103530, 112564, 62073, 61947, 96511, 62009, 94936, 94935, 72391, 105978, 96511, 69852, 72391, 68147, 116354, 99028, 66046, 95311, 91703, 72801, 95282, 61843, 110337, 69852, 77204, 87074, 106824, 90468, 71027, 110554, 112564, 70376, 103530, 95122, 64757, 64258, 63519, 77926, 62274, 71429, 70287, 98703, 77964, 109191, 111871, 77835, 73262, 89282, 111413, 67838, 84203, 80339, 88909, 64258, 103530, 62164, 62937, 65983, 70254, 108542, 61851, 72391, 70376, 61983, 74624, 76958, 78093, 110067, 74511, 98327, 112564, 89282, 98514, 85079, 62814, 61851, 85079, 77964, 97054, 95311, 109191, 87394, 63332, 68472, 96332, 68472, 69762, 87394, 69841, 103530, 69445, 62107, 82491, 98327, 74511, 108858, 63165, 104539, 66046, 77581, 61848, 98327, 64459, 75076, 88402, 77188, 64808, 66312, 109410, 109696, 86442, 63853, 77835, 114068, 69535, 96332, 84179, 111413, 69685, 76946, 67350, 63091, 64361, 102453, 69610, 65832, 67006, 77964, 69316, 89282, 88010, 63765, 98327, 76720, 72391, 63519, 64185, 70964, 62483, 85073, 98514, 63436, 66203, 70254, 85079, 102863, 64356, 63332, 99426, 68914, 98327, 106611, 74961, 69291, 82213, 72604, 65627, 62345, 65267, 94565, 95109, 94936, 109909, 87074, 62610, 82352, 70376, 64314, 69841, 63658, 70337, 87561, 94935, 85079, 109485, 71027, 99650, 68472, 62345, 71027, 90914, 66949, 103530, 110067, 65983, 91244, 69922, 61846, 70198, 77835, 63236, 74071, 63176, 99426, 110067, 85224, 113176, 78932, 77081, 87394, 63406, 70376, 87561, 63984, 62409, 112333, 71027, 117286, 61871, 95122, 71429, 66809, 97961, 109696, 98514, 61922, 61946, 115424, 67350, 101225, 85079, 111422, 109696, 94382, 63658, 63366, 74511, 89282, 87074, 64099, 85230, 73009, 69535, 61946, 70600, 83889, 71225, 72801, 80601, 115424, 76958, 64314, 87394, 72492, 99650, 65726, 95109, 108327, 111860, 85987, 77081, 75191, 71027, 73825, 78355, 110963, 63236, 86917, 63147, 64314, 115197, 94935, 74289, 107037, 74289, 85079, 78174, 64211, 111871, 105562, 69685, 71027, 78424, 69686, 95457, 68021, 84775, 63366, 70376, 68608, 69316, 71126, 62893, 73429, 70422, 90260, 63775, 110988, 115197, 102358, 76946, 76958, 61892, 70254, 111413, 62259, 71027, 115655, 70422, 63480, 110067, 106189, 63366, 71027, 105978, 71027, 105769, 95632, 72711, 66176, 63510, 61843, 61919, 70511, 71429, 74390, 64314, 61957, 69605, 72711, 62937, 61883, 105978, 94935, 61843, 70782, 71225, 98327, 74503, 80601, 91172, 77708, 102943, 79959, 111413, 109191, 90118, 88402, 62183, 105769, 84493, 78754, 78424, 66256, 62644, 72391, 98327, 76827, 109696, 115424, 79689, 63236, 61965, 61922, 72391, 70600, 105978, 101022, 90260, 82352, 67736, 70600, 71027, 112564, 61965, 94935, 63853, 70655, 80364, 68608, 85834, 63332, 68539, 68472, 109848, 85677, 73219, 62731, 103138, 63894, 89771, 71027, 109276, 81460, 71429, 96666, 107612, 99459, 61880, 68677, 73857, 63033, 69524, 62903, 101225, 87219, 109191, 98433, 72100, 103729, 90914, 81460, 113176, 76958, 95122, 80339, 71027, 93129, 66312, 65334, 74289, 61957, 96332, 65522, 65334, 87074, 62777, 105562, 71714, 71429, 94565, 96332, 84179, 71225, 63010, 95457, 66733, 100620, 94382, 87394, 85079, 74180, 100421, 62576, 66243, 62126, 85381, 83200, 69291, 113176, 62872, 83772, 79694, 68277, 101633, 81266, 71027, 86452, 71225, 66521, 111413, 92234, 105978, 68212, 103729, 70782, 109696, 77835, 69445, 87533, 74289, 66176, 86142, 117286, 74967, 75891, 70422, 97778, 92057, 78224, 61843, 94936, 87074, 66894, 74737, 64509, 78174, 68466, 110122, 108757, 66111, 62145, 64314, 82632, 83027, 111871, 62872, 63231, 71027, 61874, 82632, 66176, 112079, 62872, 63300, 77581, 62903, 61938, 115424, 74071, 76958, 66894, 61946, 83599, 103729, 61843, 72904, 70109, 64164, 71534, 63443, 83599, 61850, 69686, 61946, 66949, 63332, 75784, 74180, 84179, 109485, 94382, 65686, 99650, 98327, 65334, 62460, 111188, 93566, 64356, 78093, 62934, 105562, 61987, 76958, 63436, 90468, 95807, 66243, 65391, 69841, 70005, 103729, 87394, 77188, 83057, 70022, 86762, 62627, 105769, 87074, 101001, 80364, 79554, 69922, 81599, 71534, 85073, 81941, 81806, 85079, 62233, 106189, 104133, 83744, 69685, 67306, 80210, 70109, 89445, 63547, 96332, 114518, 70198, 85375, 62706, 77708, 61846, 66627, 85079, 84034, 62756, 104947, 95311, 70109, 105769, 109696, 114518, 64314, 62009, 63406, 62145, 77067, 106163, 76958, 84626, 111871, 69762, 81460, 72391, 109629, 110122, 81599, 69841, 86442, 73429, 63333, 69368, 61851, 62756, 69214, 96861, 61847, 62073, 93487, 63099, 69535, 83629, 111413, 70422, 64164, 67291, 72391, 70337, 83744, 87074, 87074, 76827, 96083, 62937, 115424, 70109, 68472, 105978, 111205, 69841, 64606, 74511, 71027, 71534, 71027, 65983, 85830, 94565, 87394, 71027, 64164, 63369, 63808, 71126, 64949, 112736, 70964, 79286, 76958, 72492, 62681, 61937, 90468, 85830, 66312, 63332, 69762, 94565, 64314, 80081, 63264, 84493, 65391, 74737, 63366, 66176, 74737, 71225, 62843, 64314, 62437, 66111, 72711, 105562, 66243, 91703, 103333, 71524, 78224, 73219, 63814, 71027, 64314, 107037, 84179, 80501, 109485, 62872, 63332, 66243, 63333, 75191, 77081, 111871, 64314, 71243, 63697, 75891, 86752, 65334, 69610, 62043, 62872, 76827, 64271, 72904, 63851, 89282, 103930, 64314, 72929, 86907, 117286, 63436, 61957, 65922, 70109, 62756, 65471, 76827, 62391, 73009, 63205, 61956, 65627, 87394, 73643, 109696, 81401, 77581, 72391, 72497, 101225, 62593, 69316, 65224, 62914, 107037, 63683, 82914, 72100, 71027, 62073, 115424, 91349, 77835, 71429, 81460, 63480, 77835, 62221, 78355, 86442, 86452, 78224, 106991, 89282, 63333, 110067, 85375, 64185, 76593, 61846, 110122, 109485, 115888, 93566, 94935, 65726, 61865, 61922, 69032, 108757, 111871, 93566, 62409, 82076, 103333, 76827, 63473, 69685, 109067, 82455, 103729, 105562, 64314, 69214, 85987, 63808, 93566, 95807, 89080, 63369, 63480, 94763, 93908, 114743, 61917, 68472, 94382, 66839, 109848, 88909, 62064, 103530, 71429, 100620, 80601, 109848, 94935, 105978, 116121, 110513, 61849, 62394, 77454, 64356, 78887, 62345, 92592, 64509, 63236, 65983, 63658, 95122, 91409, 101633, 69841, 69685, 117053, 85834, 76946, 85079, 62960, 72711, 63853, 62903, 94382, 70376, 87394, 90468, 111413, 69524, 84179, 94382, 72904, 69852, 94382, 62107, 64029, 105769, 70376, 94382, 79153, 84179, 64258, 67291, 84203, 62606, 72595, 69214, 68212, 98327, 76958, 84179, 65334, 98514, 71225, 103729, 100821, 114068, 71714, 64361, 87233, 108327, 71326, 114068, 113399, 70376]}, {"inputs": [[737, 374, 744, 485, 468, 529, 167, 53, 785, 350, 389, 176, 367, 931, 787, 326, 533, 607, 488, 780, 41, 74, 532, 314, 406, 733, 547, 849, 869, 896, 553, 843, 367, 236, 473, 880, 445, 171, 320, 378, 532, 297, 178, 728, 585, 633, 418, 910, 59, 326, 465, 416, 369, 774, 126, 877, 571, 135, 252, 180, 273, 12, 900, 91, 432, 952, 506, 293, 779, 879, 740, 190, 145, 144, 507, 759, 565, 912, 15, 340, 178, 771, 10, 447, 536, 4, 261, 163, 245, 727, 770, 185, 769, 178, 668, 623, 975, 619, 391, 470, 75, 709, 138, 537, 127, 453, 156, 677, 448, 961, 578, 141, 150, 701, 269, 759, 216, 213, 740, 679, 610, 250, 534, 575, 608, 767, 214, 538, 855, 207, 465, 18, 664, 415, 186, 122, 915, 809, 340, 18, 571, 12, 199, 781, 295, 721, 526, 490, 184, 708, 643, 726, 181, 547, 621, 818, 392, 958, 850, 860, 386, 51, 905, 476, 945, 747, 444, 129, 417, 135, 46, 816, 782, 646, 766, 96, 679, 385, 547, 88, 912, 369, 764, 347, 720, 394, 378, 757, 99, 833, 439, 167, 515, 861, 727, 488, 830, 228, 768, 128, 643, 340, 809, 465, 977, 847, 815, 4, 77, 487, 637, 135, 852, 428, 130, 117, 31, 121, 105, 887, 895, 940, 787, 611, 731, 826, 374, 210, 173, 596, 187, 362, 647, 917, 98, 343, 89, 663, 773, 634, 404, 699, 989, 565, 711, 410, 938, 733, 476, 759, 187, 187, 541, 923, 167, 230, 295, 927, 26, 837, 37, 242, 664, 955, 86, 929, 88, 123, 235, 537, 359, 815, 113, 452, 945, 131, 387, 558, 380, 713, 868, 199, 870, 744, 876, 643, 880, 394, 5, 139, 114, 134, 152, 779, 425, 640, 544, 395, 975, 392, 366, 21, 569, 680, 890, 681, 734, 640, 666, 434, 755, 268, 949, 517, 838, 670, 797, 257, 461, 984, 550, 702, 20, 210, 686, 140, 57, 161, 869, 294, 152, 979, 340, 853, 722, 279, 326, 617, 476, 567, 666, 541, 581, 946, 644, 872], [177, 359, 579, 590, 367, 815, 927, 850, 542, 297, 975, 516, 57, 215, 515, 664, 479, 698, 663, 488, 380, 785, 738, 171, 729, 919, 412, 882, 326, 547, 769, 295, 854, 541, 892, 721, 610, 879, 294, 75, 130, 680, 341, 380, 455, 549, 849, 643, 952, 896, 931, 769, 809, 955, 581, 167, 764, 218, 100, 340, 128, 943, 720, 86, 532, 75, 868, 448, 547, 31, 67, 181, 475, 711, 474, 95, 476, 394, 294, 476, 270, 252, 391, 816, 711, 529, 837, 395, 701, 666, 368, 145, 272, 569, 95, 575, 408, 515, 428, 635, 131, 912, 868, 296, 893, 448, 130, 708, 417, 720, 374, 435, 139, 385, 135, 77, 293, 185, 286, 664, 125, 199, 833, 348, 828, 172, 445, 153, 272, 86, 609, 88, 348, 852, 759, 558, 910, 476, 326, 88, 326, 721, 361, 547, 229, 49, 834, 50, 869, 215, 251, 697, 837, 485, 135, 386, 869, 421, 664, 825, 940, 12, 711, 935, 88, 340, 59, 12, 532, 951, 128, 150, 445, 613, 599, 326, 710, 726, 769, 607, 767, 434, 97, 350, 340, 31, 871, 152, 178, 4, 326, 745, 611, 671, 167, 417, 532, 809, 643, 171, 517, 756, 124, 809, 369, 388, 837, 494, 681, 880, 869, 187, 295]], "output": [120765, 92675, 87459, 88147, 91807, 120031, 150327, 128477, 85793, 100515, 165909, 85463, 152981, 113497, 85459, 94321, 85583, 98517, 94215, 85483, 90557, 113319, 104397, 122063, 102931, 147871, 88203, 137023, 96607, 85949, 109999, 100791, 129499, 85763, 139877, 101717, 89465, 136175, 100933, 147471, 131787, 96191, 94725, 90557, 86161, 86025, 128225, 92151, 158263, 141031, 151571, 109999, 118663, 159247, 87579, 122943, 109037, 112973, 140097, 94843, 132313, 155355, 101571, 144167, 85575, 147471, 133167, 86403, 85949, 161187, 149917, 119929, 85637, 100279, 85655, 141533, 85619, 89397, 100933, 85619, 104459, 107253, 89623, 120263, 100279, 85545, 125259, 89327, 98911, 94541, 91705, 128043, 104159, 86897, 141533, 87225, 88455, 85459, 87309, 91439, 131527, 145745, 133167, 100653, 140165, 86403, 131787, 99861, 87899, 101571, 91113, 86967, 129499, 90117, 130497, 146867, 101077, 119115, 102099, 94321, 133117, 116431, 124291, 93911, 123095, 121845, 86521, 126149, 104159, 144167, 89395, 143571, 93911, 128985, 108097, 86393, 145149, 85619, 96607, 143571, 96607, 101717, 92455, 85949, 111061, 155473, 124533, 155159, 133433, 113497, 107413, 98387, 125259, 85511, 130497, 90031, 133433, 87681, 94321, 122383, 154401, 167397, 100279, 152827, 143571, 94843, 152365, 167397, 85575, 157937, 132313, 126853, 86521, 89685, 88729, 96607, 100139, 102465, 109999, 89257, 109609, 87013, 140955, 93683, 94843, 161187, 133975, 126381, 120551, 170115, 96607, 105597, 89537, 95119, 122943, 87899, 85575, 118663, 92151, 122063, 85467, 107553, 133387, 118663, 91603, 89865, 125259, 85467, 96317, 136455, 133433, 118717, 100791]}, {"inputs": [[460, 585, 596, 504, 988, 704, 987, 629, 209, 712, 294, 293, 515, 452, 436, 439, 274, 361, 919, 231, 959, 140, 463, 799, 444, 828, 403, 758, 329, 424, 969, 744, 555, 217, 567, 148, 69, 477, 870, 699, 870, 175, 209, 433, 798, 8, 520, 318, 776, 876, 987, 983, 365, 89, 847, 769, 743, 386, 43, 128, 968, 756, 667, 375, 543, 409, 68, 884, 310, 501, 306, 958, 947, 384, 522, 138, 921, 439, 427, 474, 889, 479, 651, 413, 41, 606, 434, 305, 983, 675, 584, 468, 328, 672, 638, 576, 320, 461, 865, 996, 325, 58, 659, 531, 528, 41, 241, 32, 477, 170, 143, 796, 698, 688, 821, 171, 527, 727, 438, 603, 586, 520, 628, 328, 558, 244, 864, 752, 279, 130, 192, 242, 670, 403, 622, 467, 299, 789, 535, 40, 426, 102, 43, 997, 313, 280, 875, 731, 57, 789, 939, 311, 332, 309, 830, 92, 865, 845, 662, 768, 636, 211, 605, 747, 152, 758, 607, 261, 603, 689, 761, 27, 240, 822, 873, 95, 441, 39, 543, 865, 44, 853, 198, 512, 275, 302, 91, 881, 820, 246, 125, 535, 230, 872, 94, 144, 160, 483, 896, 663, 146, 127, 186, 837, 257, 828, 670, 873, 292, 850, 235, 735, 317, 455, 666, 779, 792, 125, 900, 818, 883, 770, 242, 114, 331, 103, 438, 661, 744, 896, 596, 274, 957, 770, 176, 583, 41, 471, 755, 833, 202, 578, 273, 338, 934, 507, 60, 500, 314, 897, 966, 521, 260, 909, 26, 232, 767, 979, 736, 165, 844, 184, 365, 405, 627, 93, 39, 815, 920, 905, 478, 852, 3, 480, 161, 640, 927, 81, 101, 440, 997, 853, 565, 571, 419, 498, 9, 430, 999, 829, 416, 528, 261, 803, 254, 836, 402, 501, 470, 859, 363, 104, 900, 517, 896, 776, 814, 457, 12, 147, 49, 529, 531, 1000, 57, 834, 834, 298, 212, 495, 360, 435, 943, 212, 549, 193, 937, 408, 815, 907, 896, 160, 842, 943, 522, 332, 255, 630, 863, 206, 973, 827, 633, 719, 456, 770, 511, 242, 59, 543, 461, 436, 261, 537, 57, 375, 835, 255, 328, 540, 628, 627, 260, 686, 15, 569, 75, 308, 332, 12, 675, 991, 327, 693, 141, 35, 634, 641, 679, 134, 636, 633, 948, 149, 649, 958, 49, 760, 294, 452, 438, 291, 438, 398, 819, 919, 324, 86, 582, 928, 32, 812, 401, 786, 200, 933, 602, 507, 569, 999, 382, 775, 999, 417, 872, 11, 402, 6, 322, 910, 791, 332, 467, 356, 65, 117, 400, 462, 743, 129, 189, 895, 974, 465, 83, 501, 979, 18, 508, 328, 770, 1, 127, 666, 99, 933, 152, 553, 956, 566, 327, 149, 86, 964, 19, 959, 139, 664, 89, 996, 496, 888, 177, 140, 780, 538, 791, 669, 615, 224, 496, 139, 208, 286, 714, 700, 604, 18, 661, 925, 951, 307, 108, 905, 990, 128, 739, 292, 824, 904, 251, 54, 210, 804, 595, 683, 141, 321, 440, 4, 176, 878, 191, 935, 647, 519, 261, 239, 989, 494, 721, 808, 704, 366, 744, 544, 554, 507, 169, 645, 344, 133, 247, 859, 570, 312, 333, 85, 249, 466, 3, 86, 862, 815, 853, 429, 606], [313, 144, 176, 896, 456, 703, 471, 628, 854, 582, 518, 232, 743, 935, 91, 853, 18, 889, 760, 797, 9, 834, 859, 959, 89, 312, 242, 242, 756, 50, 138, 915, 361, 515, 318, 896, 152, 565, 847, 383, 570, 86, 442, 415, 306, 815, 583, 596, 744, 323, 71, 926, 203, 722, 132, 498, 242, 474, 687, 242, 403, 744, 7, 143, 15, 883, 987, 637, 820, 943, 815, 744, 329, 94, 895, 365, 57, 461, 58, 466, 897, 60, 57, 199, 670, 981, 18, 328, 883, 247, 479, 104, 926, 876, 919, 95, 85, 915, 739, 329, 776, 425, 176, 312, 99, 905, 191, 735, 828, 364, 672, 437, 496, 306, 144, 567, 141, 682, 643, 439, 85, 461, 878, 834, 212, 846, 522, 331, 311, 966, 776, 94, 596, 483, 3, 528, 41, 670, 989, 75, 760, 86, 471, 669, 293, 815, 152, 779, 659, 596, 622, 125, 32, 700, 418, 744, 442, 427, 155, 462, 280, 799, 853, 496, 926, 117, 117, 900, 569, 493, 520, 186, 169, 73, 356, 847, 873, 478, 527, 832, 446, 895, 957, 42, 645, 576, 139, 250, 375, 549, 933, 281, 495, 242, 959, 670, 407, 161, 440, 117, 609, 133, 416, 176, 628, 294, 605, 937, 317, 431, 139, 149, 523, 224, 836, 95, 10, 275, 521, 677, 937, 993, 999, 242, 292, 900, 807, 569, 499, 139, 852, 430, 579, 896, 207, 702, 209, 595, 987, 452, 897, 667, 163, 522, 361, 313, 504, 480, 169, 251, 327, 872, 306, 43, 255, 94, 117, 937, 146, 498, 943, 630, 272, 58, 474, 987, 328, 324, 332, 968, 823, 823, 501, 18, 261, 86, 987, 853, 295, 169, 709, 18, 872, 399, 772, 1, 583, 169, 933, 993, 405, 549, 430, 57, 400, 632, 434, 564, 538, 440, 687, 537, 735, 171, 324, 850, 254, 86, 663, 967, 128, 235, 244, 561, 864, 770, 241, 473, 529, 666, 85, 791, 832, 934, 208, 543, 94, 519, 432, 128, 899, 261, 855, 101, 636, 404, 628, 10, 177, 194, 770, 790, 641, 321, 195, 666, 942, 468, 507, 909, 467, 859, 625, 841, 819, 439, 578, 292, 735, 261, 149, 18, 209, 829, 465, 149, 293, 405, 328, 261, 332, 692, 210, 168, 198, 776, 43, 210, 628, 261, 404, 480, 853, 427, 734, 647, 935, 481, 212, 804, 851, 966, 676, 460, 423, 582, 896, 584, 758, 667, 40, 322, 43, 567, 361, 438, 988, 919, 675, 308, 309, 651, 292, 528, 605, 504, 274, 544, 875, 242, 900, 999, 482, 879, 496, 996, 872, 511, 40, 674, 314, 743, 569, 776, 661, 607, 95, 834, 640, 19, 438, 306, 177, 39, 209, 72, 524, 964, 704, 756, 501, 967, 210, 828, 718, 583, 915, 338, 450, 365, 569, 294, 544, 877, 712, 744, 627, 401, 937, 231, 744, 919, 365, 675, 331, 44, 479, 895, 477, 41, 160, 948, 8, 438, 629, 228, 872, 661, 477, 954, 888, 528, 149, 633, 452, 138, 764, 595, 909, 209, 328, 495, 422, 996, 438, 475, 795, 320, 550, 774, 669, 501, 169, 792, 293, 192, 770, 873, 758, 981, 833, 761, 554, 460]], "output": [155225, 204796, 193328, 216914, 136690, 158185, 136035, 144946, 200362, 139708, 135736, 175458, 167087, 234149, 226575, 199993, 261334, 214021, 171280, 181539, 265997, 193260, 202207, 245485, 227453, 155428, 172534, 172534, 170268, 245402, 207092, 225147, 147135, 135677, 154230, 216914, 201838, 138253, 197831, 144037, 138646, 228782, 137558, 140079, 156688, 187019, 139801, 141104, 167324, 153267, 235597, 230050, 184357, 162310, 209456, 135550, 172534, 135948, 154899, 172534, 141433, 167324, 267049, 205173, 262879, 211567, 259441, 146217, 188610, 237873, 187019, 167324, 152167, 225270, 216499, 146543, 242069, 136425, 241600, 136206, 217337, 240668, 242069, 185649, 151616, 256395, 261334, 152340, 211567, 171137, 135823, 221000, 230050, 208746, 226911, 224839, 229231, 225147, 166155, 152167, 175520, 139037, 193328, 155428, 223123, 220759, 188269, 165233, 191230, 146690, 151990, 137919, 135564, 156688, 204796, 138405, 205931, 153914, 147131, 137761, 229231, 136425, 209548, 193260, 181506, 197474, 135836, 151825, 155633, 248912, 175520, 225270, 141104, 135753, 269165, 136036, 249741, 151616, 260469, 233769, 171280, 228782, 136035, 151433, 159577, 187019, 201838, 176357, 149699, 141104, 144180, 212273, 254228, 157552, 139758, 167324, 137558, 138837, 200755, 136378, 162662, 182135, 199993, 135564, 230050, 215577, 215577, 218612, 138563, 135603, 135780, 189940, 195761, 234683, 147898, 197831, 207553, 135844, 136001, 192580, 137302, 216499, 244519, 249254, 147441, 139166, 206701, 170314, 145131, 137133, 233229, 162423, 135575, 172534, 245485, 151616, 140969, 198593, 137690, 215577, 142567, 209059, 139970, 193328, 144946, 159348, 142083, 235075, 154427, 138455, 206701, 202933, 135869, 177860, 193952, 224839, 265474, 163875, 135807, 152943, 235075, 262547, 265693, 172534, 159808, 218612, 184557, 138563, 135545, 206701, 199630, 138548, 139435, 216914, 183075, 157974, 182439, 141001, 259441, 136924, 217337, 151071, 197883, 135836, 147135, 155225, 135546, 135804, 195761, 170041, 152521, 207160, 156688, 248767, 168959, 225270, 215577, 235075, 204046, 135550, 237873, 145218, 164620, 241600, 135948, 259441, 152340, 153078, 151656, 249898, 189585, 189585, 135537, 261334, 167381, 228782, 259441, 199993, 159123, 195761, 159471, 261334, 207160, 141935, 174426, 270235, 139801, 195761, 233229, 262547, 141199, 137133, 138548, 242069, 141806, 145496, 138178, 138180, 136486, 137690, 154899, 136435, 165233, 195061, 153078, 198908, 169228, 228782, 150369, 249405, 211050, 174573, 171972, 137961, 204078, 173880, 172821, 135977, 136075, 150892, 229231, 179769, 192580, 233688, 182756, 136757, 225270, 135757, 138362, 211050, 218187, 167381, 200731, 222269, 146068, 141316, 144946, 265474, 192987, 187282, 173880, 179480, 146821, 153647, 186955, 150892, 237406, 136132, 135561, 222503, 136167, 202207, 144561, 195705, 188289, 137761, 139344, 159808, 165233, 167381, 202933, 261334, 182439, 191565, 136247, 202933, 159577, 141199, 152340, 167381, 151656, 155908, 182126, 196114, 185974, 175520, 248767, 182126, 144946, 167381, 141316, 135804, 199993, 138837, 165006, 147755, 234149, 135787, 181506, 183642, 199269, 248912, 152750, 136476, 139241, 139708, 216914, 139896, 170770, 151071, 250234, 153456, 248767, 138405, 147135, 137836, 259954, 226911, 152557, 156260, 156049, 148395, 159808, 136036, 142083, 135546, 164120, 136818, 208347, 172534, 218612, 265693, 135770, 209951, 135564, 264110, 207160, 135611, 250234, 152368, 155024, 167087, 138563, 175520, 150029, 142321, 224839, 193260, 146668, 260823, 137836, 156688, 192987, 250729, 182439, 235140, 135902, 247930, 158396, 170268, 135537, 249405, 182126, 191230, 161426, 139801, 225147, 150700, 137050, 146543, 138563, 159348, 136818, 209147, 160116, 167324, 144815, 141679, 235075, 175755, 167324, 226911, 146543, 152557, 151825, 248284, 135823, 216499, 135867, 249741, 198950, 240230, 266522, 137836, 145081, 176656, 207160, 150029, 135867, 243086, 213610, 136036, 202933, 145635, 136924, 207092, 172314, 141001, 222503, 182439, 152340, 135575, 139344, 264110, 137836, 135921, 180947, 153840, 137198, 174972, 151433, 135537, 195761, 180062, 159577, 187938, 173880, 207553, 170770, 256395, 192919, 171537, 137460, 136476]}, {"inputs": [[308, 371, 776, 732, 673, 897, 457, 147, 301, 923, 890, 966, 775, 122, 79, 225, 253, 120, 564, 396, 292, 311, 652, 568, 445, 792, 620, 44, 599, 15, 669, 653, 84, 58, 865, 259, 188, 771, 18, 961, 885, 801, 516, 709, 219, 244, 744, 764, 856, 887, 611, 9, 993, 337, 626, 494, 944, 977, 640, 77, 322, 740, 539, 739, 589, 239, 825, 761, 538, 880, 339, 993, 773, 394, 851, 425, 230, 171, 995, 343, 216, 167, 3, 298, 142, 747, 505, 162, 456, 831, 673, 374, 300, 917, 729, 543, 420, 665, 17, 981, 895, 537, 594, 924, 780, 184, 554, 738, 558, 207, 854, 851, 244, 916, 730, 22, 986, 597, 578, 395, 730, 786, 774, 925, 671, 846, 836, 908, 41, 82, 999, 361, 96, 375, 849, 210, 729, 181, 341, 490, 297, 774, 864, 814, 415, 59, 439, 196, 912, 776, 940, 440, 486, 904, 259, 847, 293, 79, 8, 546, 13, 973, 594, 181, 134, 202, 217, 820, 283, 763, 584, 795, 902, 856, 391, 710, 425, 778, 421, 994, 668, 499, 715, 966, 718, 60, 613, 505, 297, 921, 133, 286, 745, 917, 1000, 573, 583, 840, 276, 271, 863, 51, 598, 574, 773, 288, 560, 183, 400, 793, 373, 476, 554, 720, 407, 557, 969, 115, 842, 871, 916, 31, 149, 381, 65, 340, 29, 398, 617, 887, 77, 362, 526, 66, 274, 425, 864, 424, 645, 409, 699, 288, 753, 699, 867, 616, 698, 725, 52, 939, 627, 875, 240, 627, 593, 497, 277, 311, 211, 555, 181, 94, 521, 201, 918, 496, 2, 653, 447, 281, 582, 387, 414, 930, 30, 54, 420, 83, 71, 683, 676, 210, 825, 56, 560, 405, 996, 151, 115, 180, 477, 807, 55, 147, 683, 844, 513, 64, 433, 251, 416, 996, 612, 772, 905, 392, 609, 570, 349, 743, 456, 876, 4, 478, 208, 479, 73, 537, 369, 794, 255, 846, 757, 694, 335, 334, 748, 868, 552, 219, 257, 733, 850, 66, 119, 943, 997, 316, 670, 197, 31, 37, 318, 266, 620, 688, 94, 37, 665, 942, 604, 958, 965, 613, 102, 592, 712, 651, 363, 472, 561, 874, 675, 527, 526, 42, 793, 23, 875, 483, 906, 816, 514, 621, 617, 733, 95, 640, 848, 103, 76, 125, 960, 990, 742, 179, 225, 533, 931, 750, 233, 546, 403, 907, 947, 939, 505, 554, 476, 860, 314, 899, 953, 193, 884, 952, 906, 413, 808, 625, 154, 821, 223, 240, 28, 91, 253, 104, 688, 319, 167, 921, 615, 841, 609, 83, 451, 87, 37, 358, 164, 439, 958, 144, 568, 977, 691, 210, 991, 516, 622, 407, 588, 79, 851, 32, 426, 993, 245, 160, 779, 573, 363, 445, 265, 857, 943, 694, 176, 324, 9, 499, 784, 685, 425, 735, 466, 569, 178, 835, 565, 612, 462, 444, 762, 9, 122, 251, 323, 979, 866, 34, 949, 9, 770, 447, 995, 63, 55, 844, 297, 276, 676, 329, 372, 152, 384, 429, 158, 466, 435, 286, 319, 12, 901, 465, 641, 187, 19, 171, 566, 35, 69, 702, 165, 787, 437, 66, 528, 497, 885, 114, 690, 506, 492, 409, 445, 20, 249, 64, 246, 404, 865, 857, 437, 362, 159, 807, 513, 197, 262, 553, 745, 363, 255, 971, 958, 322, 25, 65, 535, 387, 918, 224, 881, 55, 501, 71, 206, 78, 858, 443, 327, 883, 289, 493, 98, 564, 308, 996, 534, 251, 156, 462, 714, 583, 971, 569, 453, 846, 7, 909, 735, 511, 667, 938, 797, 652, 960, 686, 379, 689, 362, 894, 734, 476, 422, 448, 121, 568, 113, 342, 639, 945, 903, 405, 594, 809, 995, 699, 518, 266, 752, 229, 590, 753, 755, 568, 399, 925, 319, 731, 10, 669, 935, 692, 490, 24, 738, 586, 65, 952, 529, 700, 703, 477, 26, 119, 559, 839, 746, 263, 78, 73, 691, 191, 496, 956, 812, 308, 476, 470, 384, 313, 890, 630, 201, 546, 193, 617, 557, 776, 782, 375, 535, 589, 909, 734, 653, 438, 946, 426, 562, 639, 983, 148, 897, 282, 703, 428, 566, 87, 122, 390, 825, 202, 730, 495, 71, 685, 740, 31, 910, 517, 339, 228, 121, 447, 79, 492, 794, 744, 508, 964, 278, 697, 561, 722, 585, 559, 126, 234, 877, 8, 705, 513, 176, 447, 999, 155, 238, 144, 663, 318, 669, 648, 172, 975, 976, 145, 37, 590, 186, 678, 475, 591, 906, 634, 301, 585, 56, 681, 546, 893, 34, 943, 149, 703, 287, 667, 682, 906, 615, 897, 146, 916, 105, 224, 842, 799, 635, 219, 545, 80, 143, 924, 18], [161, 134, 718, 843, 144, 314, 392, 159, 318, 652, 339, 704, 933, 3, 121, 437, 208, 890, 851, 864, 734, 193, 120, 971, 908, 996, 626, 517, 916, 409, 887, 897, 611, 898, 858, 392, 96, 181, 746, 906, 251, 993, 794, 893, 2, 569, 146, 835, 145, 80, 399, 653, 587, 653, 425, 715, 864, 162, 138, 952, 144, 58, 2, 883, 494, 715, 466, 120, 193, 149, 262, 942, 588, 116, 196, 885, 917, 382, 323, 228, 669, 546, 568, 561, 665, 764, 773, 271, 210, 701, 865, 210, 542, 318, 876, 224, 335, 865, 321, 560, 761, 418, 816, 37, 340, 265, 239, 58, 825, 201, 730, 959, 425, 773, 738, 663, 492, 875, 96, 797, 734, 377, 685, 864, 219, 812, 405, 202, 230, 106, 580, 995, 688, 916, 275, 564, 317]], "output": [288357, 302760, 225914, 277891, 297276, 226756, 207344, 289381, 225580, 208430, 219827, 221558, 329805, 387535, 309971, 199705, 265898, 303216, 281913, 288736, 231146, 272717, 310538, 355831, 313874, 374120, 203312, 194077, 318842, 204083, 301491, 307287, 200777, 307878, 285552, 207344, 324496, 278387, 235450, 312650, 248123, 371875, 254996, 304953, 388300, 195669, 296196, 274007, 296735, 334144, 205949, 208643, 197483, 208643, 201403, 224963, 288736, 287846, 300564, 342520, 297276, 348324, 388300, 299217, 194688, 224963, 196600, 310538, 272717, 294595, 244018, 335738, 197598, 312826, 271328, 300349, 319471, 209456, 224163, 257318, 212185, 194394, 195582, 195071, 211275, 242406, 246009, 240781, 265012, 220657, 289273, 265012, 194286, 225580, 295296, 258982, 220891, 289273, 224725, 195008, 241221, 202536, 265008, 362681, 219566, 242927, 252837, 348324, 269229, 269039, 229792, 347353, 201403, 246009, 232546, 210833, 194788, 294741, 324496, 256335, 231146, 210553, 216175, 288736, 261105, 263152, 204807, 268586, 256494, 318622, 196734, 373367, 216974, 318842, 239363, 195276, 225873]}]}} +{"id": "LeetCode/2659", "content": "# Number of Even and Odd Bits\n\nYou are given a **positive** integer `n`.\n\n\nLet `even` denote the number of even indices in the binary representation of `n` (**0-indexed**) with value `1`.\n\n\nLet `odd` denote the number of odd indices in the binary representation of `n` (**0-indexed**) with value `1`.\n\n\nReturn *an integer array* `answer` *where* `answer = [even, odd]`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 17\n**Output:** [2,0]\n**Explanation:** The binary representation of 17 is 10001. \nIt contains 1 on the 0th and 4th indices. \nThere are 2 even and 0 odd indices.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 2\n**Output:** [0,1]\n**Explanation:** The binary representation of 2 is 10.\nIt contains 1 on the 1st index. \nThere are 0 even and 1 odd indices.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 1000`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def evenOddBit(self, n: int) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.evenOddBit(**[17]) == [2, 0]\nassert my_solution.evenOddBit(**[2]) == [0, 1]\nassert my_solution.evenOddBit(**[1]) == [1, 0]\nassert my_solution.evenOddBit(**[3]) == [1, 1]\nassert my_solution.evenOddBit(**[4]) == [1, 0]\nassert my_solution.evenOddBit(**[5]) == [2, 0]\nassert my_solution.evenOddBit(**[6]) == [1, 1]\nassert my_solution.evenOddBit(**[7]) == [2, 1]\nassert my_solution.evenOddBit(**[8]) == [0, 1]\nassert my_solution.evenOddBit(**[9]) == [1, 1]\nassert my_solution.evenOddBit(**[10]) == [0, 2]\nassert my_solution.evenOddBit(**[11]) == [1, 2]\nassert my_solution.evenOddBit(**[12]) == [1, 1]\nassert my_solution.evenOddBit(**[13]) == [2, 1]\nassert my_solution.evenOddBit(**[14]) == [1, 2]\nassert my_solution.evenOddBit(**[15]) == [2, 2]\nassert my_solution.evenOddBit(**[16]) == [1, 0]\nassert my_solution.evenOddBit(**[18]) == [1, 1]\nassert my_solution.evenOddBit(**[19]) == [2, 1]\nassert my_solution.evenOddBit(**[20]) == [2, 0]\n"}, "labels": {"questionId": "2659", "questionFrontendId": "2595", "questionTitle": "Number of Even and Odd Bits", "stats": {"totalAccepted": "11K", "totalSubmission": "15.1K", "totalAcceptedRaw": 11049, "totalSubmissionRaw": 15084, "acRate": "73.2%"}, "probedCases": [{"inputs": [17], "output": [2, 0]}, {"inputs": [2], "output": [0, 1]}, {"inputs": [1], "output": [1, 0]}, {"inputs": [3], "output": [1, 1]}, {"inputs": [4], "output": [1, 0]}, {"inputs": [5], "output": [2, 0]}, {"inputs": [6], "output": [1, 1]}, {"inputs": [7], "output": [2, 1]}, {"inputs": [8], "output": [0, 1]}, {"inputs": [9], "output": [1, 1]}, {"inputs": [10], "output": [0, 2]}, {"inputs": [11], "output": [1, 2]}, {"inputs": [12], "output": [1, 1]}, {"inputs": [13], "output": [2, 1]}, {"inputs": [14], "output": [1, 2]}, {"inputs": [15], "output": [2, 2]}, {"inputs": [16], "output": [1, 0]}, {"inputs": [18], "output": [1, 1]}, {"inputs": [19], "output": [2, 1]}, {"inputs": [20], "output": [2, 0]}]}} +{"id": "LeetCode/2696", "content": "# The Number of Beautiful Subsets\n\nYou are given an array `nums` of positive integers and a **positive** integer `k`.\n\n\nA subset of `nums` is **beautiful** if it does not contain two integers with an absolute difference equal to `k`.\n\n\nReturn *the number of **non-empty beautiful** subsets of the array* `nums`.\n\n\nA **subset** of `nums` is an array that can be obtained by deleting some (possibly none) elements from `nums`. Two subsets are different if and only if the chosen indices to delete are different.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,4,6], k = 2\n**Output:** 4\n**Explanation:** The beautiful subsets of the array nums are: [2], [4], [6], [2, 6].\nIt can be proved that there are only 4 beautiful subsets in the array [2,4,6].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1], k = 1\n**Output:** 1\n**Explanation:** The beautiful subset of the array nums is [1].\nIt can be proved that there is only 1 beautiful subset in the array [1].\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 20`\n* `1 <= nums[i], k <= 1000`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def beautifulSubsets(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.beautifulSubsets(**[[2, 4, 6], 2]) == 4\nassert my_solution.beautifulSubsets(**[[1], 1]) == 1\nassert my_solution.beautifulSubsets(**[[4, 2, 5, 9, 10, 3], 1]) == 23\nassert my_solution.beautifulSubsets(**[[10, 4, 5, 7, 2, 1], 3]) == 23\nassert my_solution.beautifulSubsets(**[[9, 5, 7, 10, 6, 2], 9]) == 63\nassert my_solution.beautifulSubsets(**[[10, 1, 4, 3, 5], 1]) == 19\nassert my_solution.beautifulSubsets(**[[10, 2, 6, 4, 5, 7, 3, 9, 1, 8], 3]) == 199\nassert my_solution.beautifulSubsets(**[[30, 22, 15, 25, 7, 23, 27], 14]) == 127\nassert my_solution.beautifulSubsets(**[[3, 6, 7, 5, 23, 19, 16, 13, 17, 2], 5]) == 767\nassert my_solution.beautifulSubsets(**[[26, 28, 8, 4, 11], 12]) == 31\nassert my_solution.beautifulSubsets(**[[17, 11, 3, 19, 29], 19]) == 31\nassert my_solution.beautifulSubsets(**[[7, 24, 12, 22, 5, 8, 27, 1, 2, 6], 15]) == 575\nassert my_solution.beautifulSubsets(**[[7, 19, 6, 29], 28]) == 15\nassert my_solution.beautifulSubsets(**[[24, 21, 25, 18, 9], 6]) == 23\nassert my_solution.beautifulSubsets(**[[20, 21, 8, 24, 14], 19]) == 31\nassert my_solution.beautifulSubsets(**[[24, 28, 27, 13, 21, 1, 23], 13]) == 127\nassert my_solution.beautifulSubsets(**[[29, 24, 18, 7, 15, 26, 2, 12, 22, 11], 28]) == 1023\nassert my_solution.beautifulSubsets(**[[16, 6, 1, 14, 12, 18, 8, 10, 3, 11, 7, 19, 20], 19]) == 6143\nassert my_solution.beautifulSubsets(**[[1, 14, 16, 13, 11, 19, 8, 2, 18, 15, 9, 3], 5]) == 959\nassert my_solution.beautifulSubsets(**[[9, 12, 2, 4, 10, 5, 14, 8, 19, 15], 8]) == 575\n"}, "labels": {"questionId": "2696", "questionFrontendId": "2597", "questionTitle": "The Number of Beautiful Subsets", "stats": {"totalAccepted": "7.6K", "totalSubmission": "21.3K", "totalAcceptedRaw": 7576, "totalSubmissionRaw": 21275, "acRate": "35.6%"}, "probedCases": [{"inputs": [[2, 4, 6], 2], "output": 4}, {"inputs": [[1], 1], "output": 1}, {"inputs": [[4, 2, 5, 9, 10, 3], 1], "output": 23}, {"inputs": [[10, 4, 5, 7, 2, 1], 3], "output": 23}, {"inputs": [[9, 5, 7, 10, 6, 2], 9], "output": 63}, {"inputs": [[10, 1, 4, 3, 5], 1], "output": 19}, {"inputs": [[10, 2, 6, 4, 5, 7, 3, 9, 1, 8], 3], "output": 199}, {"inputs": [[30, 22, 15, 25, 7, 23, 27], 14], "output": 127}, {"inputs": [[3, 6, 7, 5, 23, 19, 16, 13, 17, 2], 5], "output": 767}, {"inputs": [[26, 28, 8, 4, 11], 12], "output": 31}, {"inputs": [[17, 11, 3, 19, 29], 19], "output": 31}, {"inputs": [[7, 24, 12, 22, 5, 8, 27, 1, 2, 6], 15], "output": 575}, {"inputs": [[7, 19, 6, 29], 28], "output": 15}, {"inputs": [[24, 21, 25, 18, 9], 6], "output": 23}, {"inputs": [[20, 21, 8, 24, 14], 19], "output": 31}, {"inputs": [[24, 28, 27, 13, 21, 1, 23], 13], "output": 127}, {"inputs": [[29, 24, 18, 7, 15, 26, 2, 12, 22, 11], 28], "output": 1023}, {"inputs": [[16, 6, 1, 14, 12, 18, 8, 10, 3, 11, 7, 19, 20], 19], "output": 6143}, {"inputs": [[1, 14, 16, 13, 11, 19, 8, 2, 18, 15, 9, 3], 5], "output": 959}, {"inputs": [[9, 12, 2, 4, 10, 5, 14, 8, 19, 15], 8], "output": 575}]}} +{"id": "LeetCode/2661", "content": "# Smallest Missing Non-negative Integer After Operations\n\nYou are given a **0-indexed** integer array `nums` and an integer `value`.\n\n\nIn one operation, you can add or subtract `value` from any element of `nums`.\n\n\n* For example, if `nums = [1,2,3]` and `value = 2`, you can choose to subtract `value` from `nums[0]` to make `nums = [-1,2,3]`.\n\n\nThe MEX (minimum excluded) of an array is the smallest missing **non-negative** integer in it.\n\n\n* For example, the MEX of `[-1,2,3]` is `0` while the MEX of `[1,0,3]` is `2`.\n\n\nReturn *the maximum MEX of* `nums` *after applying the mentioned operation **any number of times***.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,-10,7,13,6,8], value = 5\n**Output:** 4\n**Explanation:** One can achieve this result by applying the following operations:\n- Add value to nums[1] twice to make nums = [1,**0**,7,13,6,8]\n- Subtract value from nums[2] once to make nums = [1,0,**2**,13,6,8]\n- Subtract value from nums[3] twice to make nums = [1,0,2,**3**,6,8]\nThe MEX of nums is 4. It can be shown that 4 is the maximum MEX we can achieve.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,-10,7,13,6,8], value = 7\n**Output:** 2\n**Explanation:** One can achieve this result by applying the following operation:\n- subtract value from nums[2] once to make nums = [1,-10,**0**,13,6,8]\nThe MEX of nums is 2. It can be shown that 2 is the maximum MEX we can achieve.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length, value <= 105`\n* `-109 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findSmallestInteger(self, nums: List[int], value: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findSmallestInteger(**[[1, -10, 7, 13, 6, 8], 5]) == 4\nassert my_solution.findSmallestInteger(**[[1, -10, 7, 13, 6, 8], 7]) == 2\nassert my_solution.findSmallestInteger(**[[1, 3, 5, 7], 2]) == 0\nassert my_solution.findSmallestInteger(**[[3, 0, 3, 2, 4, 2, 1, 1, 0, 4], 5]) == 10\nassert my_solution.findSmallestInteger(**[[3, 2, 3, 1, 0, 1, 4, 2, 3, 1, 4, 1, 3], 5]) == 5\nassert my_solution.findSmallestInteger(**[[0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1], 2]) == 15\nassert my_solution.findSmallestInteger(**[[0, 3, 1, 1, 2, 2, 0, 0, 2, 2, 3, 2], 4]) == 9\nassert my_solution.findSmallestInteger(**[[2, 2, 2, 3, 3, 2, 0, 2, 3, 0, 3, 2, 3, 1, 2, 0], 4]) == 5\nassert my_solution.findSmallestInteger(**[[0, 0, 1, 0, 0, 0, 1, 0], 2]) == 5\nassert my_solution.findSmallestInteger(**[[1, 0, 4, 2, 4, 3, 3, 1, 4], 5]) == 5\nassert my_solution.findSmallestInteger(**[[2, 1, 0, 0, 1, 1, 1, 0, 2, 1, 0, 1, 1], 3]) == 8\nassert my_solution.findSmallestInteger(**[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 1]) == 19\nassert my_solution.findSmallestInteger(**[[0, 3, 2, 2, 0, 3, 3, 0, 2, 1, 1, 2, 1, 0, 1, 0, 3], 4]) == 17\nassert my_solution.findSmallestInteger(**[[2, 2, 1, 2, 0, 1, 2, 0, 0, 0, 1, 2, 2, 1, 0, 1, 2], 3]) == 15\nassert my_solution.findSmallestInteger(**[[0, 3, 3, 2, 0, 1, 0, 3, 2, 3, 0, 4, 3, 1, 4, 4, 4, 2, 1, 1, 0, 4, 2, 4, 1, 2, 4, 0, 4, 1, 2, 1, 2, 3, 3, 4], 5]) == 30\nassert my_solution.findSmallestInteger(**[[0, 2, 2, 3, 1, 2, 1, 0, 1, 3, 2, 2, 3, 2, 1, 1, 2, 1, 0, 1, 3, 1], 4]) == 12\nassert my_solution.findSmallestInteger(**[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 1]) == 34\nassert my_solution.findSmallestInteger(**[[4, 1, 0, 1, 1, 1, 1, 3, 2, 3, 1, 2, 4], 5]) == 5\nassert my_solution.findSmallestInteger(**[[1, 1, 2, 1, 2, 1, 0, 2, 2, 2, 1, 1, 1, 2, 1, 1, 2, 2, 0, 1, 0, 1, 1, 2, 1, 2, 2, 1, 2], 3]) == 9\nassert my_solution.findSmallestInteger(**[[0, -3], 4]) == 2\n"}, "labels": {"questionId": "2661", "questionFrontendId": "2598", "questionTitle": "Smallest Missing Non-negative Integer After Operations", "stats": {"totalAccepted": "5.7K", "totalSubmission": "14.5K", "totalAcceptedRaw": 5739, "totalSubmissionRaw": 14510, "acRate": "39.6%"}, "probedCases": [{"inputs": [[1, -10, 7, 13, 6, 8], 5], "output": 4}, {"inputs": [[1, -10, 7, 13, 6, 8], 7], "output": 2}, {"inputs": [[1, 3, 5, 7], 2], "output": 0}, {"inputs": [[3, 0, 3, 2, 4, 2, 1, 1, 0, 4], 5], "output": 10}, {"inputs": [[3, 2, 3, 1, 0, 1, 4, 2, 3, 1, 4, 1, 3], 5], "output": 5}, {"inputs": [[0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1], 2], "output": 15}, {"inputs": [[0, 3, 1, 1, 2, 2, 0, 0, 2, 2, 3, 2], 4], "output": 9}, {"inputs": [[2, 2, 2, 3, 3, 2, 0, 2, 3, 0, 3, 2, 3, 1, 2, 0], 4], "output": 5}, {"inputs": [[0, 0, 1, 0, 0, 0, 1, 0], 2], "output": 5}, {"inputs": [[1, 0, 4, 2, 4, 3, 3, 1, 4], 5], "output": 5}, {"inputs": [[2, 1, 0, 0, 1, 1, 1, 0, 2, 1, 0, 1, 1], 3], "output": 8}, {"inputs": [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 1], "output": 19}, {"inputs": [[0, 3, 2, 2, 0, 3, 3, 0, 2, 1, 1, 2, 1, 0, 1, 0, 3], 4], "output": 17}, {"inputs": [[2, 2, 1, 2, 0, 1, 2, 0, 0, 0, 1, 2, 2, 1, 0, 1, 2], 3], "output": 15}, {"inputs": [[0, 3, 3, 2, 0, 1, 0, 3, 2, 3, 0, 4, 3, 1, 4, 4, 4, 2, 1, 1, 0, 4, 2, 4, 1, 2, 4, 0, 4, 1, 2, 1, 2, 3, 3, 4], 5], "output": 30}, {"inputs": [[0, 2, 2, 3, 1, 2, 1, 0, 1, 3, 2, 2, 3, 2, 1, 1, 2, 1, 0, 1, 3, 1], 4], "output": 12}, {"inputs": [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 1], "output": 34}, {"inputs": [[4, 1, 0, 1, 1, 1, 1, 3, 2, 3, 1, 2, 4], 5], "output": 5}, {"inputs": [[1, 1, 2, 1, 2, 1, 0, 2, 2, 2, 1, 1, 1, 2, 1, 1, 2, 2, 0, 1, 0, 1, 1, 2, 1, 2, 2, 1, 2], 3], "output": 9}, {"inputs": [[0, -3], 4], "output": 2}]}} +{"id": "LeetCode/2663", "content": "# Distribute Money to Maximum Children\n\nYou are given an integer `money` denoting the amount of money (in dollars) that you have and another integer `children` denoting the number of children that you must distribute the money to.\n\n\nYou have to distribute the money according to the following rules:\n\n\n* All money must be distributed.\n* Everyone must receive at least `1` dollar.\n* Nobody receives `4` dollars.\n\n\nReturn *the **maximum** number of children who may receive **exactly*** `8` *dollars if you distribute the money according to the aforementioned rules*. If there is no way to distribute the money, return `-1`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** money = 20, children = 3\n**Output:** 1\n**Explanation:** \nThe maximum number of children with 8 dollars will be 1. One of the ways to distribute the money is:\n- 8 dollars to the first child.\n- 9 dollars to the second child. \n- 3 dollars to the third child.\nIt can be proven that no distribution exists such that number of children getting 8 dollars is greater than 1.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** money = 16, children = 2\n**Output:** 2\n**Explanation:** Each child can be given 8 dollars.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= money <= 200`\n* `2 <= children <= 30`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def distMoney(self, money: int, children: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.distMoney(**[20, 3]) == 1\nassert my_solution.distMoney(**[16, 2]) == 2\nassert my_solution.distMoney(**[1, 2]) == -1\nassert my_solution.distMoney(**[1, 3]) == -1\nassert my_solution.distMoney(**[1, 4]) == -1\nassert my_solution.distMoney(**[1, 5]) == -1\nassert my_solution.distMoney(**[1, 6]) == -1\nassert my_solution.distMoney(**[1, 7]) == -1\nassert my_solution.distMoney(**[1, 8]) == -1\nassert my_solution.distMoney(**[1, 9]) == -1\nassert my_solution.distMoney(**[1, 10]) == -1\nassert my_solution.distMoney(**[1, 11]) == -1\nassert my_solution.distMoney(**[1, 12]) == -1\nassert my_solution.distMoney(**[1, 13]) == -1\nassert my_solution.distMoney(**[1, 14]) == -1\nassert my_solution.distMoney(**[1, 15]) == -1\nassert my_solution.distMoney(**[1, 16]) == -1\nassert my_solution.distMoney(**[1, 17]) == -1\nassert my_solution.distMoney(**[1, 18]) == -1\nassert my_solution.distMoney(**[1, 19]) == -1\n"}, "labels": {"questionId": "2663", "questionFrontendId": "2591", "questionTitle": "Distribute Money to Maximum Children", "stats": {"totalAccepted": "29.8K", "totalSubmission": "111.1K", "totalAcceptedRaw": 29794, "totalSubmissionRaw": 111088, "acRate": "26.8%"}, "probedCases": [{"inputs": [20, 3], "output": 1}, {"inputs": [16, 2], "output": 2}, {"inputs": [1, 2], "output": -1}, {"inputs": [1, 3], "output": -1}, {"inputs": [1, 4], "output": -1}, {"inputs": [1, 5], "output": -1}, {"inputs": [1, 6], "output": -1}, {"inputs": [1, 7], "output": -1}, {"inputs": [1, 8], "output": -1}, {"inputs": [1, 9], "output": -1}, {"inputs": [1, 10], "output": -1}, {"inputs": [1, 11], "output": -1}, {"inputs": [1, 12], "output": -1}, {"inputs": [1, 13], "output": -1}, {"inputs": [1, 14], "output": -1}, {"inputs": [1, 15], "output": -1}, {"inputs": [1, 16], "output": -1}, {"inputs": [1, 17], "output": -1}, {"inputs": [1, 18], "output": -1}, {"inputs": [1, 19], "output": -1}]}} +{"id": "LeetCode/2664", "content": "# Maximize Greatness of an Array\n\nYou are given a 0-indexed integer array `nums`. You are allowed to permute `nums` into a new array `perm` of your choosing.\n\n\nWe define the **greatness** of `nums` be the number of indices `0 <= i < nums.length` for which `perm[i] > nums[i]`.\n\n\nReturn *the **maximum** possible greatness you can achieve after permuting* `nums`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,3,5,2,1,3,1]\n**Output:** 4\n**Explanation:** One of the optimal rearrangements is perm = [2,5,1,3,3,1,1].\nAt indices = 0, 1, 3, and 4, perm[i] > nums[i]. Hence, we return 4.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4]\n**Output:** 3\n**Explanation:** We can prove the optimal perm is [2,3,4,1].\nAt indices = 0, 1, and 2, perm[i] > nums[i]. Hence, we return 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `0 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximizeGreatness(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximizeGreatness(**[[1, 3, 5, 2, 1, 3, 1]]) == 4\nassert my_solution.maximizeGreatness(**[[1, 2, 3, 4]]) == 3\nassert my_solution.maximizeGreatness(**[[31, 25, 72, 79]]) == 3\nassert my_solution.maximizeGreatness(**[[65, 84, 91, 18, 59, 27, 9, 81, 33, 17]]) == 9\nassert my_solution.maximizeGreatness(**[[42, 8, 75, 28, 35, 21, 13, 21]]) == 6\nassert my_solution.maximizeGreatness(**[[35, 52, 74, 92, 25, 65, 77, 1, 73]]) == 8\nassert my_solution.maximizeGreatness(**[[43, 68, 8, 100]]) == 3\nassert my_solution.maximizeGreatness(**[[14, 88, 42, 53, 98, 69, 64, 40, 60, 23]]) == 9\nassert my_solution.maximizeGreatness(**[[21]]) == 0\nassert my_solution.maximizeGreatness(**[[34, 99, 63, 23, 70, 18, 64, 12, 21, 21]]) == 8\nassert my_solution.maximizeGreatness(**[[36, 58, 88, 58, 99, 26, 92, 91, 53, 10]]) == 8\nassert my_solution.maximizeGreatness(**[[25, 20, 92]]) == 2\nassert my_solution.maximizeGreatness(**[[63, 51, 65, 87, 6, 17, 32, 14, 42, 46]]) == 9\nassert my_solution.maximizeGreatness(**[[43, 9, 75, 76, 25, 96, 46, 85, 19]]) == 8\nassert my_solution.maximizeGreatness(**[[88, 2, 5, 24]]) == 3\nassert my_solution.maximizeGreatness(**[[26, 76, 24, 96, 82, 97, 97, 72]]) == 6\nassert my_solution.maximizeGreatness(**[[21, 77, 82, 30, 94]]) == 4\nassert my_solution.maximizeGreatness(**[[76, 94, 51, 82, 3, 89, 52]]) == 6\nassert my_solution.maximizeGreatness(**[[27, 59, 57, 97, 6, 46, 88, 41, 52]]) == 8\nassert my_solution.maximizeGreatness(**[[4, 17, 2, 95, 6, 62]]) == 5\n"}, "labels": {"questionId": "2664", "questionFrontendId": "2592", "questionTitle": "Maximize Greatness of an Array", "stats": {"totalAccepted": "5.8K", "totalSubmission": "9.8K", "totalAcceptedRaw": 5752, "totalSubmissionRaw": 9827, "acRate": "58.5%"}, "probedCases": [{"inputs": [[1, 3, 5, 2, 1, 3, 1]], "output": 4}, {"inputs": [[1, 2, 3, 4]], "output": 3}, {"inputs": [[31, 25, 72, 79]], "output": 3}, {"inputs": [[65, 84, 91, 18, 59, 27, 9, 81, 33, 17]], "output": 9}, {"inputs": [[42, 8, 75, 28, 35, 21, 13, 21]], "output": 6}, {"inputs": [[35, 52, 74, 92, 25, 65, 77, 1, 73]], "output": 8}, {"inputs": [[43, 68, 8, 100]], "output": 3}, {"inputs": [[14, 88, 42, 53, 98, 69, 64, 40, 60, 23]], "output": 9}, {"inputs": [[21]], "output": 0}, {"inputs": [[34, 99, 63, 23, 70, 18, 64, 12, 21, 21]], "output": 8}, {"inputs": [[36, 58, 88, 58, 99, 26, 92, 91, 53, 10]], "output": 8}, {"inputs": [[25, 20, 92]], "output": 2}, {"inputs": [[63, 51, 65, 87, 6, 17, 32, 14, 42, 46]], "output": 9}, {"inputs": [[43, 9, 75, 76, 25, 96, 46, 85, 19]], "output": 8}, {"inputs": [[88, 2, 5, 24]], "output": 3}, {"inputs": [[26, 76, 24, 96, 82, 97, 97, 72]], "output": 6}, {"inputs": [[21, 77, 82, 30, 94]], "output": 4}, {"inputs": [[76, 94, 51, 82, 3, 89, 52]], "output": 6}, {"inputs": [[27, 59, 57, 97, 6, 46, 88, 41, 52]], "output": 8}, {"inputs": [[4, 17, 2, 95, 6, 62]], "output": 5}]}} +{"id": "LeetCode/2695", "content": "# Find Score of an Array After Marking All Elements\n\nYou are given an array `nums` consisting of positive integers.\n\n\nStarting with `score = 0`, apply the following algorithm:\n\n\n* Choose the smallest integer of the array that is not marked. If there is a tie, choose the one with the smallest index.\n* Add the value of the chosen integer to `score`.\n* Mark **the chosen element and its two adjacent elements if they exist**.\n* Repeat until all the array elements are marked.\n\n\nReturn *the score you get after applying the above algorithm*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,1,3,4,5,2]\n**Output:** 7\n**Explanation:** We mark the elements as follows:\n- 1 is the smallest unmarked element, so we mark it and its two adjacent elements: [2,1,3,4,5,2].\n- 2 is the smallest unmarked element, so we mark it and its left adjacent element: [2,1,3,4,5,2].\n- 4 is the only remaining unmarked element, so we mark it: [2,1,3,4,5,2].\nOur score is 1 + 2 + 4 = 7.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,3,5,1,3,2]\n**Output:** 5\n**Explanation:** We mark the elements as follows:\n- 1 is the smallest unmarked element, so we mark it and its two adjacent elements: [2,3,5,1,3,2].\n- 2 is the smallest unmarked element, since there are two of them, we choose the left-most one, so we mark the one at index 0 and its right adjacent element: [2,3,5,1,3,2].\n- 2 is the only remaining unmarked element, so we mark it: [2,3,5,1,3,2].\nOur score is 1 + 2 + 2 = 5.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findScore(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findScore(**[[2, 1, 3, 4, 5, 2]]) == 7\nassert my_solution.findScore(**[[2, 3, 5, 1, 3, 2]]) == 5\nassert my_solution.findScore(**[[10, 44, 10, 8, 48, 30, 17, 38, 41, 27, 16, 33, 45, 45, 34, 30, 22, 3, 42, 42]]) == 212\nassert my_solution.findScore(**[[29, 20, 36, 39, 50, 42, 46, 34, 47]]) == 135\nassert my_solution.findScore(**[[26, 18, 27, 13, 42, 14, 50, 34, 45, 22, 47, 50, 9, 43, 30, 9, 24, 6, 25, 43]]) == 168\nassert my_solution.findScore(**[[46, 21, 7, 33]]) == 53\nassert my_solution.findScore(**[[2, 4, 25, 12, 25, 18, 32, 50, 1, 43, 28]]) == 61\nassert my_solution.findScore(**[[22, 32, 3, 40, 33, 49]]) == 58\nassert my_solution.findScore(**[[44, 7, 20, 27, 15, 8, 17, 20, 2, 30, 24]]) == 68\nassert my_solution.findScore(**[[3, 28]]) == 3\nassert my_solution.findScore(**[[39, 43, 12, 15, 6]]) == 57\nassert my_solution.findScore(**[[48, 43, 2, 16, 39, 8, 34, 12, 42, 26, 33]]) == 96\nassert my_solution.findScore(**[[46, 777, 1916, 780, 1857, 1523, 1016, 389, 117, 934, 1121, 191, 471, 399, 949, 763, 517, 928, 463, 438, 1496, 1490, 1552, 211, 280, 122, 200, 1980, 1437, 1496, 879, 866, 609, 1923, 836, 1482, 460, 1080, 1135, 756, 1870, 30, 1841, 1860, 1812, 1121, 1715, 1930, 1997, 1531, 1939, 1674, 346]]) == 17122\nassert my_solution.findScore(**[[1247, 1847, 259, 184, 637, 805, 1364, 643, 1129, 1008, 1378, 554, 371, 765, 1386, 1419, 1023, 1826, 845, 1941, 244, 246, 1118, 981, 1779, 148, 1662, 1991, 212, 1255, 47, 604, 1642, 1273, 1422, 152, 1093, 4, 348, 1224, 277, 126, 1551, 353, 249, 1482, 56, 1590, 256, 1950, 1765, 1980, 1864, 27, 77, 1520, 838, 1383, 1388, 448, 870, 208, 1951, 431, 411, 824, 1325, 1823, 35, 3, 1330, 619]]) == 18128\nassert my_solution.findScore(**[[137, 1063, 1697, 491, 329, 901, 1224, 931, 1493, 1869, 183, 727, 1114, 1647, 1828, 1321, 1926, 1356, 927, 1436, 98, 456, 322, 797, 811, 598, 1807, 660, 525, 1239, 362, 1726, 1276, 1895, 1634, 732, 937, 1966, 402, 321, 218, 990, 653, 727, 1756, 1792, 1687, 534, 1011, 1183, 570, 1431, 882, 1709, 1142, 201, 1699, 149, 791, 1605, 266, 1340, 347, 1383, 1479, 1297, 1812, 1195, 450, 1648, 995, 1148, 1828, 117, 1835, 586, 607, 1705, 426, 39, 1608, 646, 1702, 1009, 873, 1729, 540]]) == 23778\nassert my_solution.findScore(**[[1463, 37, 1728, 1698, 1223, 337, 1821, 232, 70, 613, 1665, 1896, 1509, 1282, 79, 983, 1186, 1164, 886, 723, 1668, 1956, 628, 392, 1397, 788, 304, 1803, 1046, 384, 820, 1804, 504, 1411, 1364, 412, 1136, 922, 1638, 1302, 1799, 1730, 345, 1254, 1897, 1861, 1223, 1356, 355, 1905, 740, 108, 360, 1965, 46, 36, 1691, 1716, 1272, 171, 684, 542, 1455, 54, 1651, 931, 910, 253, 1265, 950, 1981, 142, 190, 440, 886]]) == 24586\nassert my_solution.findScore(**[[1123, 987, 1152, 1366, 1193, 62, 1577, 1117, 791, 896, 728, 442, 1105, 1038, 1907, 1028, 1188, 704, 1841, 1216, 1657, 759, 1624, 845, 1278, 1339, 1842, 1491, 536, 452, 490, 1785, 1942, 939, 789, 1837, 1621, 80]]) == 15174\nassert my_solution.findScore(**[[1242, 423, 1330, 1474, 237, 1574, 79, 962, 1518, 1583, 1332, 930, 69, 1712, 1329, 1388, 747, 584, 410, 1647, 107, 13, 428, 594, 1380, 1389, 749, 426, 414, 653, 1786, 1260]]) == 9174\nassert my_solution.findScore(**[[730, 1721, 1993, 1532, 962, 519, 1365, 1307, 1992, 1623, 1579, 1735, 1015, 1579, 1003, 1277, 1255, 1254, 810, 1767, 206, 1837, 920, 1203, 1876, 521, 625, 483, 572, 922, 1936, 1014, 1835, 694, 19, 209, 1438, 127, 1716, 1272, 444, 1739, 148, 1580, 802, 1093, 1543, 452, 257, 103, 877, 749, 1418, 348, 1555, 1552, 818, 555, 1628, 547, 553, 1742, 1062, 1199, 1987, 818, 491, 1211]]) == 23202\nassert my_solution.findScore(**[[687, 607, 641, 698, 368, 758, 1563, 476, 42, 1977, 770, 1254, 2, 149, 378, 1385, 755, 1258, 1082, 20, 603, 889, 102]]) == 4607\n"}, "labels": {"questionId": "2695", "questionFrontendId": "2593", "questionTitle": "Find Score of an Array After Marking All Elements", "stats": {"totalAccepted": "4.8K", "totalSubmission": "9.1K", "totalAcceptedRaw": 4759, "totalSubmissionRaw": 9090, "acRate": "52.4%"}, "probedCases": [{"inputs": [[2, 1, 3, 4, 5, 2]], "output": 7}, {"inputs": [[2, 3, 5, 1, 3, 2]], "output": 5}, {"inputs": [[10, 44, 10, 8, 48, 30, 17, 38, 41, 27, 16, 33, 45, 45, 34, 30, 22, 3, 42, 42]], "output": 212}, {"inputs": [[29, 20, 36, 39, 50, 42, 46, 34, 47]], "output": 135}, {"inputs": [[26, 18, 27, 13, 42, 14, 50, 34, 45, 22, 47, 50, 9, 43, 30, 9, 24, 6, 25, 43]], "output": 168}, {"inputs": [[46, 21, 7, 33]], "output": 53}, {"inputs": [[2, 4, 25, 12, 25, 18, 32, 50, 1, 43, 28]], "output": 61}, {"inputs": [[22, 32, 3, 40, 33, 49]], "output": 58}, {"inputs": [[44, 7, 20, 27, 15, 8, 17, 20, 2, 30, 24]], "output": 68}, {"inputs": [[3, 28]], "output": 3}, {"inputs": [[39, 43, 12, 15, 6]], "output": 57}, {"inputs": [[48, 43, 2, 16, 39, 8, 34, 12, 42, 26, 33]], "output": 96}, {"inputs": [[46, 777, 1916, 780, 1857, 1523, 1016, 389, 117, 934, 1121, 191, 471, 399, 949, 763, 517, 928, 463, 438, 1496, 1490, 1552, 211, 280, 122, 200, 1980, 1437, 1496, 879, 866, 609, 1923, 836, 1482, 460, 1080, 1135, 756, 1870, 30, 1841, 1860, 1812, 1121, 1715, 1930, 1997, 1531, 1939, 1674, 346]], "output": 17122}, {"inputs": [[1247, 1847, 259, 184, 637, 805, 1364, 643, 1129, 1008, 1378, 554, 371, 765, 1386, 1419, 1023, 1826, 845, 1941, 244, 246, 1118, 981, 1779, 148, 1662, 1991, 212, 1255, 47, 604, 1642, 1273, 1422, 152, 1093, 4, 348, 1224, 277, 126, 1551, 353, 249, 1482, 56, 1590, 256, 1950, 1765, 1980, 1864, 27, 77, 1520, 838, 1383, 1388, 448, 870, 208, 1951, 431, 411, 824, 1325, 1823, 35, 3, 1330, 619]], "output": 18128}, {"inputs": [[137, 1063, 1697, 491, 329, 901, 1224, 931, 1493, 1869, 183, 727, 1114, 1647, 1828, 1321, 1926, 1356, 927, 1436, 98, 456, 322, 797, 811, 598, 1807, 660, 525, 1239, 362, 1726, 1276, 1895, 1634, 732, 937, 1966, 402, 321, 218, 990, 653, 727, 1756, 1792, 1687, 534, 1011, 1183, 570, 1431, 882, 1709, 1142, 201, 1699, 149, 791, 1605, 266, 1340, 347, 1383, 1479, 1297, 1812, 1195, 450, 1648, 995, 1148, 1828, 117, 1835, 586, 607, 1705, 426, 39, 1608, 646, 1702, 1009, 873, 1729, 540]], "output": 23778}, {"inputs": [[1463, 37, 1728, 1698, 1223, 337, 1821, 232, 70, 613, 1665, 1896, 1509, 1282, 79, 983, 1186, 1164, 886, 723, 1668, 1956, 628, 392, 1397, 788, 304, 1803, 1046, 384, 820, 1804, 504, 1411, 1364, 412, 1136, 922, 1638, 1302, 1799, 1730, 345, 1254, 1897, 1861, 1223, 1356, 355, 1905, 740, 108, 360, 1965, 46, 36, 1691, 1716, 1272, 171, 684, 542, 1455, 54, 1651, 931, 910, 253, 1265, 950, 1981, 142, 190, 440, 886]], "output": 24586}, {"inputs": [[1123, 987, 1152, 1366, 1193, 62, 1577, 1117, 791, 896, 728, 442, 1105, 1038, 1907, 1028, 1188, 704, 1841, 1216, 1657, 759, 1624, 845, 1278, 1339, 1842, 1491, 536, 452, 490, 1785, 1942, 939, 789, 1837, 1621, 80]], "output": 15174}, {"inputs": [[1242, 423, 1330, 1474, 237, 1574, 79, 962, 1518, 1583, 1332, 930, 69, 1712, 1329, 1388, 747, 584, 410, 1647, 107, 13, 428, 594, 1380, 1389, 749, 426, 414, 653, 1786, 1260]], "output": 9174}, {"inputs": [[730, 1721, 1993, 1532, 962, 519, 1365, 1307, 1992, 1623, 1579, 1735, 1015, 1579, 1003, 1277, 1255, 1254, 810, 1767, 206, 1837, 920, 1203, 1876, 521, 625, 483, 572, 922, 1936, 1014, 1835, 694, 19, 209, 1438, 127, 1716, 1272, 444, 1739, 148, 1580, 802, 1093, 1543, 452, 257, 103, 877, 749, 1418, 348, 1555, 1552, 818, 555, 1628, 547, 553, 1742, 1062, 1199, 1987, 818, 491, 1211]], "output": 23202}, {"inputs": [[687, 607, 641, 698, 368, 758, 1563, 476, 42, 1977, 770, 1254, 2, 149, 378, 1385, 755, 1258, 1082, 20, 603, 889, 102]], "output": 4607}]}} +{"id": "LeetCode/2665", "content": "# Minimum Time to Repair Cars\n\nYou are given an integer array `ranks` representing the **ranks** of some mechanics. ranksi is the rank of the ith mechanic. A mechanic with a rank `r` can repair n cars in `r * n2` minutes.\n\n\nYou are also given an integer `cars` representing the total number of cars waiting in the garage to be repaired.\n\n\nReturn *the **minimum** time taken to repair all the cars.*\n\n\n**Note:** All the mechanics can repair the cars simultaneously.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** ranks = [4,2,3,1], cars = 10\n**Output:** 16\n**Explanation:** \n- The first mechanic will repair two cars. The time required is 4 * 2 * 2 = 16 minutes.\n- The second mechanic will repair two cars. The time required is 2 * 2 * 2 = 8 minutes.\n- The third mechanic will repair two cars. The time required is 3 * 2 * 2 = 12 minutes.\n- The fourth mechanic will repair four cars. The time required is 1 * 4 * 4 = 16 minutes.\nIt can be proved that the cars cannot be repaired in less than 16 minutes.​​​​​\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** ranks = [5,1,8], cars = 6\n**Output:** 16\n**Explanation:** \n- The first mechanic will repair one car. The time required is 5 * 1 * 1 = 5 minutes.\n- The second mechanic will repair four cars. The time required is 1 * 4 * 4 = 16 minutes.\n- The third mechanic will repair one car. The time required is 8 * 1 * 1 = 8 minutes.\nIt can be proved that the cars cannot be repaired in less than 16 minutes.​​​​​\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= ranks.length <= 105`\n* `1 <= ranks[i] <= 100`\n* `1 <= cars <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def repairCars(self, ranks: List[int], cars: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.repairCars(**[[4, 2, 3, 1], 10]) == 16\nassert my_solution.repairCars(**[[5, 1, 8], 6]) == 16\nassert my_solution.repairCars(**[[1, 1, 3, 3], 74]) == 576\nassert my_solution.repairCars(**[[3, 3, 1, 2, 1, 1, 3, 2, 1], 58]) == 75\nassert my_solution.repairCars(**[[1, 3, 1, 2, 1, 1], 21]) == 18\nassert my_solution.repairCars(**[[2, 2, 3, 3, 1, 3, 3, 1, 3], 32]) == 32\nassert my_solution.repairCars(**[[3, 1, 3, 3, 1, 3], 42]) == 108\nassert my_solution.repairCars(**[[3, 2, 2, 2, 1, 3, 1], 21]) == 18\nassert my_solution.repairCars(**[[2, 2, 1, 3, 1, 2, 1, 1, 1, 3], 36]) == 25\nassert my_solution.repairCars(**[[3, 2, 1, 3, 3, 2, 1, 1], 25]) == 25\nassert my_solution.repairCars(**[[3, 3, 2], 51]) == 768\nassert my_solution.repairCars(**[[3, 1, 1, 1, 1, 2, 2, 3, 2], 9]) == 3\nassert my_solution.repairCars(**[[3, 1, 3, 2, 3, 1, 1, 3, 1, 1], 24]) == 12\nassert my_solution.repairCars(**[[1, 3, 1, 3, 3, 3, 2, 1], 77]) == 192\nassert my_solution.repairCars(**[[3, 2, 3, 3], 51]) == 450\nassert my_solution.repairCars(**[[3], 52]) == 8112\nassert my_solution.repairCars(**[[1, 2, 2, 1, 2, 3, 2, 2, 2], 4]) == 2\nassert my_solution.repairCars(**[[1, 3, 1], 62]) == 588\nassert my_solution.repairCars(**[[1, 2, 1, 1, 3, 2, 2, 1, 2], 78]) == 121\nassert my_solution.repairCars(**[[3, 2, 3], 77]) == 1728\n"}, "labels": {"questionId": "2665", "questionFrontendId": "2594", "questionTitle": "Minimum Time to Repair Cars", "stats": {"totalAccepted": "27.8K", "totalSubmission": "55.6K", "totalAcceptedRaw": 27803, "totalSubmissionRaw": 55558, "acRate": "50.0%"}, "probedCases": [{"inputs": [[4, 2, 3, 1], 10], "output": 16}, {"inputs": [[5, 1, 8], 6], "output": 16}, {"inputs": [[1, 1, 3, 3], 74], "output": 576}, {"inputs": [[3, 3, 1, 2, 1, 1, 3, 2, 1], 58], "output": 75}, {"inputs": [[1, 3, 1, 2, 1, 1], 21], "output": 18}, {"inputs": [[2, 2, 3, 3, 1, 3, 3, 1, 3], 32], "output": 32}, {"inputs": [[3, 1, 3, 3, 1, 3], 42], "output": 108}, {"inputs": [[3, 2, 2, 2, 1, 3, 1], 21], "output": 18}, {"inputs": [[2, 2, 1, 3, 1, 2, 1, 1, 1, 3], 36], "output": 25}, {"inputs": [[3, 2, 1, 3, 3, 2, 1, 1], 25], "output": 25}, {"inputs": [[3, 3, 2], 51], "output": 768}, {"inputs": [[3, 1, 1, 1, 1, 2, 2, 3, 2], 9], "output": 3}, {"inputs": [[3, 1, 3, 2, 3, 1, 1, 3, 1, 1], 24], "output": 12}, {"inputs": [[1, 3, 1, 3, 3, 3, 2, 1], 77], "output": 192}, {"inputs": [[3, 2, 3, 3], 51], "output": 450}, {"inputs": [[3], 52], "output": 8112}, {"inputs": [[1, 2, 2, 1, 2, 3, 2, 2, 2], 4], "output": 2}, {"inputs": [[1, 3, 1], 62], "output": 588}, {"inputs": [[1, 2, 1, 1, 3, 2, 2, 1, 2], 78], "output": 121}, {"inputs": [[3, 2, 3], 77], "output": 1728}]}} +{"id": "LeetCode/2654", "content": "# Count the Number of Vowel Strings in Range\n\nYou are given a **0-indexed** array of string `words` and two integers `left` and `right`.\n\n\nA string is called a **vowel string** if it starts with a vowel character and ends with a vowel character where vowel characters are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`.\n\n\nReturn *the number of vowel strings* `words[i]` *where* `i` *belongs to the inclusive range* `[left, right]`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** words = [\"are\",\"amy\",\"u\"], left = 0, right = 2\n**Output:** 2\n**Explanation:** \n- \"are\" is a vowel string because it starts with 'a' and ends with 'e'.\n- \"amy\" is not a vowel string because it does not end with a vowel.\n- \"u\" is a vowel string because it starts with 'u' and ends with 'u'.\nThe number of vowel strings in the mentioned range is 2.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** words = [\"hey\",\"aeo\",\"mu\",\"ooo\",\"artro\"], left = 1, right = 4\n**Output:** 3\n**Explanation:** \n- \"aeo\" is a vowel string because it starts with 'a' and ends with 'o'.\n- \"mu\" is not a vowel string because it does not start with a vowel.\n- \"ooo\" is a vowel string because it starts with 'o' and ends with 'o'.\n- \"artro\" is a vowel string because it starts with 'a' and ends with 'o'.\nThe number of vowel strings in the mentioned range is 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= words.length <= 1000`\n* `1 <= words[i].length <= 10`\n* `words[i]` consists of only lowercase English letters.\n* `0 <= left <= right < words.length`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def vowelStrings(self, words: List[str], left: int, right: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.vowelStrings(**[['are', 'amy', 'u'], 0, 2]) == 2\nassert my_solution.vowelStrings(**[['hey', 'aeo', 'mu', 'ooo', 'artro'], 1, 4]) == 3\nassert my_solution.vowelStrings(**[['si'], 0, 0]) == 0\nassert my_solution.vowelStrings(**[['ce', 'ai'], 1, 1]) == 1\nassert my_solution.vowelStrings(**[['n', 'a', 'o'], 0, 2]) == 2\nassert my_solution.vowelStrings(**[['v', 'ab', 'fu', 'nu'], 1, 3]) == 0\nassert my_solution.vowelStrings(**[['vo', 'j', 'i', 's', 'i'], 0, 3]) == 1\nassert my_solution.vowelStrings(**[['o'], 0, 0]) == 1\nassert my_solution.vowelStrings(**[['e', 'ey'], 0, 1]) == 1\nassert my_solution.vowelStrings(**[['m', 'qi', 'ae'], 1, 1]) == 0\nassert my_solution.vowelStrings(**[['p', 'o', 'ud', 'eq'], 0, 0]) == 0\nassert my_solution.vowelStrings(**[['e', 'a', 'o', 'i', 'u'], 0, 0]) == 1\nassert my_solution.vowelStrings(**[['f'], 0, 0]) == 0\nassert my_solution.vowelStrings(**[['i', 'cz'], 0, 1]) == 1\nassert my_solution.vowelStrings(**[['a', 'ui', 'ap'], 1, 2]) == 1\nassert my_solution.vowelStrings(**[['r', 'sa', 'oa', 'v'], 2, 3]) == 1\nassert my_solution.vowelStrings(**[['ez', 'i', 'z', 'ka', 'oi'], 0, 2]) == 1\nassert my_solution.vowelStrings(**[['p', 'b'], 0, 1]) == 0\nassert my_solution.vowelStrings(**[['gs', 'dt', 'v'], 0, 2]) == 0\nassert my_solution.vowelStrings(**[['i', 'or', 'au', 'ii'], 1, 3]) == 2\n"}, "labels": {"questionId": "2654", "questionFrontendId": "2586", "questionTitle": "Count the Number of Vowel Strings in Range", "stats": {"totalAccepted": "39.6K", "totalSubmission": "48.4K", "totalAcceptedRaw": 39625, "totalSubmissionRaw": 48412, "acRate": "81.8%"}, "probedCases": [{"inputs": [["are", "amy", "u"], 0, 2], "output": 2}, {"inputs": [["hey", "aeo", "mu", "ooo", "artro"], 1, 4], "output": 3}, {"inputs": [["si"], 0, 0], "output": 0}, {"inputs": [["ce", "ai"], 1, 1], "output": 1}, {"inputs": [["n", "a", "o"], 0, 2], "output": 2}, {"inputs": [["v", "ab", "fu", "nu"], 1, 3], "output": 0}, {"inputs": [["vo", "j", "i", "s", "i"], 0, 3], "output": 1}, {"inputs": [["o"], 0, 0], "output": 1}, {"inputs": [["e", "ey"], 0, 1], "output": 1}, {"inputs": [["m", "qi", "ae"], 1, 1], "output": 0}, {"inputs": [["p", "o", "ud", "eq"], 0, 0], "output": 0}, {"inputs": [["e", "a", "o", "i", "u"], 0, 0], "output": 1}, {"inputs": [["f"], 0, 0], "output": 0}, {"inputs": [["i", "cz"], 0, 1], "output": 1}, {"inputs": [["a", "ui", "ap"], 1, 2], "output": 1}, {"inputs": [["r", "sa", "oa", "v"], 2, 3], "output": 1}, {"inputs": [["ez", "i", "z", "ka", "oi"], 0, 2], "output": 1}, {"inputs": [["p", "b"], 0, 1], "output": 0}, {"inputs": [["gs", "dt", "v"], 0, 2], "output": 0}, {"inputs": [["i", "or", "au", "ii"], 1, 3], "output": 2}]}} +{"id": "LeetCode/2655", "content": "# Rearrange Array to Maximize Prefix Score\n\nYou are given a **0-indexed** integer array `nums`. You can rearrange the elements of `nums` to **any order** (including the given order).\n\n\nLet `prefix` be the array containing the prefix sums of `nums` after rearranging it. In other words, `prefix[i]` is the sum of the elements from `0` to `i` in `nums` after rearranging it. The **score** of `nums` is the number of positive integers in the array `prefix`.\n\n\nReturn *the maximum score you can achieve*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,-1,0,1,-3,3,-3]\n**Output:** 6\n**Explanation:** We can rearrange the array into nums = [2,3,1,-1,-3,0,-3].\nprefix = [2,5,6,5,2,2,-1], so the score is 6.\nIt can be shown that 6 is the maximum score we can obtain.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [-2,-3,0]\n**Output:** 0\n**Explanation:** Any rearrangement of the array will result in a score of 0.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `-106 <= nums[i] <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxScore(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxScore(**[[2, -1, 0, 1, -3, 3, -3]]) == 6\nassert my_solution.maxScore(**[[-2, -3, 0]]) == 0\nassert my_solution.maxScore(**[[-687767, -860350, 950296, 52109, 510127, 545329, -291223, -966728, 852403, 828596, 456730, -483632, -529386, 356766, 147293, 572374, 243605, 931468, 641668, 494446]]) == 20\nassert my_solution.maxScore(**[[-559492, 799439, 655260]]) == 3\nassert my_solution.maxScore(**[[-32495, -144584, -270506, -394309, -298138, 922535]]) == 5\nassert my_solution.maxScore(**[[19255, -795874]]) == 1\nassert my_solution.maxScore(**[[402297, -972364, 550108, 139600, 462523, -622496, -195119, 382696, 450472, -255760, 566176, -715438, -232452, 20399, -752064, 188167, 171099, -34126, -574516]]) == 17\nassert my_solution.maxScore(**[[76072, -874872]]) == 1\nassert my_solution.maxScore(**[[26445, 216889, -662096, -545708, -95063, -107719, -808691, -963708, -576067, -465421, 796622, 564374, 531351, 873749]]) == 12\nassert my_solution.maxScore(**[[-556429, 958202, -585868, -840382, 160199, -321739, 955106, -125110, 925159, -9335, 183114, 871457, -435389, -983556, 578458, -365256]]) == 16\nassert my_solution.maxScore(**[[507561, 686087, 380177, -941153, 673790]]) == 5\nassert my_solution.maxScore(**[[-494490, -8984, -868661, 147531, 973998, -946445, -996960, -902835, 135589, 834698, -65960, -10607, -69236, 30873, -905917, -269506, -745174]]) == 12\nassert my_solution.maxScore(**[[-547292, 503919, 956932, 832139, 962781, 930310, 939467, -732808, 222521, 683985, 656751, 937193, -973807, 121691, -75951, 347150, 855122, -836690]]) == 18\nassert my_solution.maxScore(**[[478824, 525321, 408041, 979757, 700602]]) == 5\nassert my_solution.maxScore(**[[-431190, -16946, 152579, -62949]]) == 3\nassert my_solution.maxScore(**[[818792, -366549, -43247, -531702, -226092, 324899, 236120, 155626, -426275, 787361, 982561, -552774, 845275, -302657, -57884, -588883, -914924, 361090, 915994]]) == 19\nassert my_solution.maxScore(**[[919006, -700914, 718735, 241311, 790580]]) == 5\nassert my_solution.maxScore(**[[714687, 274598, -617855, -685869, -996786, 55913, -928553, -804311, -369895, 644737, -507147, -325202, -264518, 445920, -70261, -355051, -880350, 966955, 415314]]) == 15\nassert my_solution.maxScore(**[[854423, -835856, 715142, 639640, -363213, -465280, 829204, 895133, -93827, 213544, 651653, 204731, 812218, -910592, -598457, -143040, 379233]]) == 17\nassert my_solution.maxScore(**[[772991, 157519, -577994, 346632, 43816, 138949, 543121, 555515, -826000, -867924]]) == 10\n"}, "labels": {"questionId": "2655", "questionFrontendId": "2587", "questionTitle": "Rearrange Array to Maximize Prefix Score", "stats": {"totalAccepted": "9K", "totalSubmission": "21.9K", "totalAcceptedRaw": 9030, "totalSubmissionRaw": 21872, "acRate": "41.3%"}, "probedCases": [{"inputs": [[2, -1, 0, 1, -3, 3, -3]], "output": 6}, {"inputs": [[-2, -3, 0]], "output": 0}, {"inputs": [[-687767, -860350, 950296, 52109, 510127, 545329, -291223, -966728, 852403, 828596, 456730, -483632, -529386, 356766, 147293, 572374, 243605, 931468, 641668, 494446]], "output": 20}, {"inputs": [[-559492, 799439, 655260]], "output": 3}, {"inputs": [[-32495, -144584, -270506, -394309, -298138, 922535]], "output": 5}, {"inputs": [[19255, -795874]], "output": 1}, {"inputs": [[402297, -972364, 550108, 139600, 462523, -622496, -195119, 382696, 450472, -255760, 566176, -715438, -232452, 20399, -752064, 188167, 171099, -34126, -574516]], "output": 17}, {"inputs": [[76072, -874872]], "output": 1}, {"inputs": [[26445, 216889, -662096, -545708, -95063, -107719, -808691, -963708, -576067, -465421, 796622, 564374, 531351, 873749]], "output": 12}, {"inputs": [[-556429, 958202, -585868, -840382, 160199, -321739, 955106, -125110, 925159, -9335, 183114, 871457, -435389, -983556, 578458, -365256]], "output": 16}, {"inputs": [[507561, 686087, 380177, -941153, 673790]], "output": 5}, {"inputs": [[-494490, -8984, -868661, 147531, 973998, -946445, -996960, -902835, 135589, 834698, -65960, -10607, -69236, 30873, -905917, -269506, -745174]], "output": 12}, {"inputs": [[-547292, 503919, 956932, 832139, 962781, 930310, 939467, -732808, 222521, 683985, 656751, 937193, -973807, 121691, -75951, 347150, 855122, -836690]], "output": 18}, {"inputs": [[478824, 525321, 408041, 979757, 700602]], "output": 5}, {"inputs": [[-431190, -16946, 152579, -62949]], "output": 3}, {"inputs": [[818792, -366549, -43247, -531702, -226092, 324899, 236120, 155626, -426275, 787361, 982561, -552774, 845275, -302657, -57884, -588883, -914924, 361090, 915994]], "output": 19}, {"inputs": [[919006, -700914, 718735, 241311, 790580]], "output": 5}, {"inputs": [[714687, 274598, -617855, -685869, -996786, 55913, -928553, -804311, -369895, 644737, -507147, -325202, -264518, 445920, -70261, -355051, -880350, 966955, 415314]], "output": 15}, {"inputs": [[854423, -835856, 715142, 639640, -363213, -465280, 829204, 895133, -93827, 213544, 651653, 204731, 812218, -910592, -598457, -143040, 379233]], "output": 17}, {"inputs": [[772991, 157519, -577994, 346632, 43816, 138949, 543121, 555515, -826000, -867924]], "output": 10}]}} +{"id": "LeetCode/2656", "content": "# Count the Number of Beautiful Subarrays\n\nYou are given a **0-indexed** integer array `nums`. In one operation, you can:\n\n\n* Choose two different indices `i` and `j` such that `0 <= i, j < nums.length`.\n* Choose a non-negative integer `k` such that the `kth` bit (**0-indexed**) in the binary representation of `nums[i]` and `nums[j]` is `1`.\n* Subtract `2k` from `nums[i]` and `nums[j]`.\n\n\nA subarray is **beautiful** if it is possible to make all of its elements equal to `0` after applying the above operation any number of times.\n\n\nReturn *the number of **beautiful subarrays** in the array* `nums`.\n\n\nA subarray is a contiguous **non-empty** sequence of elements within an array.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [4,3,1,2,4]\n**Output:** 2\n**Explanation:** There are 2 beautiful subarrays in nums: [4,3,1,2,4] and [4,3,1,2,4].\n- We can make all elements in the subarray [3,1,2] equal to 0 in the following way:\n - Choose [3, 1, 2] and k = 1. Subtract 21 from both numbers. The subarray becomes [1, 1, 0].\n - Choose [1, 1, 0] and k = 0. Subtract 20 from both numbers. The subarray becomes [0, 0, 0].\n- We can make all elements in the subarray [4,3,1,2,4] equal to 0 in the following way:\n - Choose [4, 3, 1, 2, 4] and k = 2. Subtract 22 from both numbers. The subarray becomes [0, 3, 1, 2, 0].\n - Choose [0, 3, 1, 2, 0] and k = 0. Subtract 20 from both numbers. The subarray becomes [0, 2, 0, 2, 0].\n - Choose [0, 2, 0, 2, 0] and k = 1. Subtract 21 from both numbers. The subarray becomes [0, 0, 0, 0, 0].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,10,4]\n**Output:** 0\n**Explanation:** There are no beautiful subarrays in nums.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `0 <= nums[i] <= 106`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def beautifulSubarrays(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.beautifulSubarrays(**[[4, 3, 1, 2, 4]]) == 2\nassert my_solution.beautifulSubarrays(**[[1, 10, 4]]) == 0\nassert my_solution.beautifulSubarrays(**[[0]]) == 1\nassert my_solution.beautifulSubarrays(**[[1]]) == 0\nassert my_solution.beautifulSubarrays(**[[0, 0]]) == 3\nassert my_solution.beautifulSubarrays(**[[0, 1]]) == 1\nassert my_solution.beautifulSubarrays(**[[1, 0]]) == 1\nassert my_solution.beautifulSubarrays(**[[1, 1]]) == 1\nassert my_solution.beautifulSubarrays(**[[0, 0, 0]]) == 6\nassert my_solution.beautifulSubarrays(**[[1, 0, 0]]) == 3\nassert my_solution.beautifulSubarrays(**[[0, 1, 0]]) == 2\nassert my_solution.beautifulSubarrays(**[[1, 1, 0]]) == 3\nassert my_solution.beautifulSubarrays(**[[0, 0, 1]]) == 3\nassert my_solution.beautifulSubarrays(**[[1, 0, 1]]) == 2\nassert my_solution.beautifulSubarrays(**[[0, 1, 1]]) == 3\nassert my_solution.beautifulSubarrays(**[[1, 1, 1]]) == 2\nassert my_solution.beautifulSubarrays(**[[0, 0, 0, 0]]) == 10\nassert my_solution.beautifulSubarrays(**[[1, 0, 0, 0]]) == 6\nassert my_solution.beautifulSubarrays(**[[0, 1, 0, 0]]) == 4\nassert my_solution.beautifulSubarrays(**[[1, 1, 0, 0]]) == 6\n"}, "labels": {"questionId": "2656", "questionFrontendId": "2588", "questionTitle": "Count the Number of Beautiful Subarrays", "stats": {"totalAccepted": "6.6K", "totalSubmission": "15.4K", "totalAcceptedRaw": 6587, "totalSubmissionRaw": 15386, "acRate": "42.8%"}, "probedCases": [{"inputs": [[4, 3, 1, 2, 4]], "output": 2}, {"inputs": [[1, 10, 4]], "output": 0}, {"inputs": [[0]], "output": 1}, {"inputs": [[1]], "output": 0}, {"inputs": [[0, 0]], "output": 3}, {"inputs": [[0, 1]], "output": 1}, {"inputs": [[1, 0]], "output": 1}, {"inputs": [[1, 1]], "output": 1}, {"inputs": [[0, 0, 0]], "output": 6}, {"inputs": [[1, 0, 0]], "output": 3}, {"inputs": [[0, 1, 0]], "output": 2}, {"inputs": [[1, 1, 0]], "output": 3}, {"inputs": [[0, 0, 1]], "output": 3}, {"inputs": [[1, 0, 1]], "output": 2}, {"inputs": [[0, 1, 1]], "output": 3}, {"inputs": [[1, 1, 1]], "output": 2}, {"inputs": [[0, 0, 0, 0]], "output": 10}, {"inputs": [[1, 0, 0, 0]], "output": 6}, {"inputs": [[0, 1, 0, 0]], "output": 4}, {"inputs": [[1, 1, 0, 0]], "output": 6}]}} +{"id": "LeetCode/2657", "content": "# Minimum Time to Complete All Tasks\n\nThere is a computer that can run an unlimited number of tasks **at the same time**. You are given a 2D integer array `tasks` where `tasks[i] = [starti, endi, durationi]` indicates that the `ith` task should run for a total of `durationi` seconds (not necessarily continuous) within the **inclusive** time range `[starti, endi]`.\n\n\nYou may turn on the computer only when it needs to run a task. You can also turn it off if it is idle.\n\n\nReturn *the minimum time during which the computer should be turned on to complete all tasks*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** tasks = [[2,3,1],[4,5,1],[1,5,2]]\n**Output:** 2\n**Explanation:** \n- The first task can be run in the inclusive time range [2, 2].\n- The second task can be run in the inclusive time range [5, 5].\n- The third task can be run in the two inclusive time ranges [2, 2] and [5, 5].\nThe computer will be on for a total of 2 seconds.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** tasks = [[1,3,2],[2,5,3],[5,6,2]]\n**Output:** 4\n**Explanation:** \n- The first task can be run in the inclusive time range [2, 3].\n- The second task can be run in the inclusive time ranges [2, 3] and [5, 5].\n- The third task can be run in the two inclusive time range [5, 6].\nThe computer will be on for a total of 4 seconds.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= tasks.length <= 2000`\n* `tasks[i].length == 3`\n* `1 <= starti, endi <= 2000`\n* `1 <= durationi <= endi - starti + 1`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findMinimumTime(self, tasks: List[List[int]]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findMinimumTime(**[[[2, 3, 1], [4, 5, 1], [1, 5, 2]]]) == 2\nassert my_solution.findMinimumTime(**[[[1, 3, 2], [2, 5, 3], [5, 6, 2]]]) == 4\nassert my_solution.findMinimumTime(**[[[1, 1, 1]]]) == 1\nassert my_solution.findMinimumTime(**[[[2000, 2000, 1]]]) == 1\nassert my_solution.findMinimumTime(**[[[1, 2000, 1]]]) == 1\nassert my_solution.findMinimumTime(**[[[1, 2000, 2000]]]) == 2000\nassert my_solution.findMinimumTime(**[[[3, 16, 2]]]) == 2\nassert my_solution.findMinimumTime(**[[[1, 18, 5], [3, 15, 1]]]) == 5\nassert my_solution.findMinimumTime(**[[[2, 13, 2], [6, 18, 5], [2, 13, 3]]]) == 5\nassert my_solution.findMinimumTime(**[[[14, 20, 5], [2, 18, 7], [6, 14, 1], [3, 16, 3]]]) == 7\nassert my_solution.findMinimumTime(**[[[8, 19, 6]]]) == 6\nassert my_solution.findMinimumTime(**[[[7, 18, 1], [4, 19, 5]]]) == 5\nassert my_solution.findMinimumTime(**[[[6, 15, 4], [3, 7, 1], [4, 20, 4]]]) == 4\nassert my_solution.findMinimumTime(**[[[8, 19, 1], [3, 20, 1], [1, 20, 2], [6, 13, 3]]]) == 3\nassert my_solution.findMinimumTime(**[[[4, 20, 10]]]) == 10\nassert my_solution.findMinimumTime(**[[[1, 14, 7], [6, 17, 2]]]) == 7\nassert my_solution.findMinimumTime(**[[[10, 18, 2], [1, 8, 1], [10, 20, 8]]]) == 9\nassert my_solution.findMinimumTime(**[[[3, 15, 9], [1, 18, 9], [4, 16, 4], [2, 20, 10]]]) == 10\nassert my_solution.findMinimumTime(**[[[13, 18, 5]]]) == 5\nassert my_solution.findMinimumTime(**[[[3, 17, 2], [3, 20, 1]]]) == 2\n"}, "labels": {"questionId": "2657", "questionFrontendId": "2589", "questionTitle": "Minimum Time to Complete All Tasks", "stats": {"totalAccepted": "4.2K", "totalSubmission": "9.8K", "totalAcceptedRaw": 4227, "totalSubmissionRaw": 9764, "acRate": "43.3%"}, "probedCases": [{"inputs": [[[2, 3, 1], [4, 5, 1], [1, 5, 2]]], "output": 2}, {"inputs": [[[1, 3, 2], [2, 5, 3], [5, 6, 2]]], "output": 4}, {"inputs": [[[1, 1, 1]]], "output": 1}, {"inputs": [[[2000, 2000, 1]]], "output": 1}, {"inputs": [[[1, 2000, 1]]], "output": 1}, {"inputs": [[[1, 2000, 2000]]], "output": 2000}, {"inputs": [[[3, 16, 2]]], "output": 2}, {"inputs": [[[1, 18, 5], [3, 15, 1]]], "output": 5}, {"inputs": [[[2, 13, 2], [6, 18, 5], [2, 13, 3]]], "output": 5}, {"inputs": [[[14, 20, 5], [2, 18, 7], [6, 14, 1], [3, 16, 3]]], "output": 7}, {"inputs": [[[8, 19, 6]]], "output": 6}, {"inputs": [[[7, 18, 1], [4, 19, 5]]], "output": 5}, {"inputs": [[[6, 15, 4], [3, 7, 1], [4, 20, 4]]], "output": 4}, {"inputs": [[[8, 19, 1], [3, 20, 1], [1, 20, 2], [6, 13, 3]]], "output": 3}, {"inputs": [[[4, 20, 10]]], "output": 10}, {"inputs": [[[1, 14, 7], [6, 17, 2]]], "output": 7}, {"inputs": [[[10, 18, 2], [1, 8, 1], [10, 20, 8]]], "output": 9}, {"inputs": [[[3, 15, 9], [1, 18, 9], [4, 16, 4], [2, 20, 10]]], "output": 10}, {"inputs": [[[13, 18, 5]]], "output": 5}, {"inputs": [[[3, 17, 2], [3, 20, 1]]], "output": 2}]}} +{"id": "LeetCode/2645", "content": "# Pass the Pillow\n\nThere are `n` people standing in a line labeled from `1` to `n`. The first person in the line is holding a pillow initially. Every second, the person holding the pillow passes it to the next person standing in the line. Once the pillow reaches the end of the line, the direction changes, and people continue passing the pillow in the opposite direction.\n\n\n* For example, once the pillow reaches the `nth` person they pass it to the `n - 1th` person, then to the `n - 2th` person and so on.\n\n\nGiven the two positive integers `n` and `time`, return *the index of the person holding the pillow after* `time` *seconds*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 4, time = 5\n**Output:** 2\n**Explanation:** People pass the pillow in the following way: 1 -> 2 -> 3 -> 4 -> 3 -> 2.\nAfer five seconds, the pillow is given to the 2nd person.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 3, time = 2\n**Output:** 3\n**Explanation:** People pass the pillow in the following way: 1 -> 2 -> 3.\nAfer two seconds, the pillow is given to the 3rd person.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `2 <= n <= 1000`\n* `1 <= time <= 1000`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def passThePillow(self, n: int, time: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.passThePillow(**[4, 5]) == 2\nassert my_solution.passThePillow(**[3, 2]) == 3\nassert my_solution.passThePillow(**[9, 4]) == 5\nassert my_solution.passThePillow(**[8, 9]) == 6\nassert my_solution.passThePillow(**[20, 9]) == 10\nassert my_solution.passThePillow(**[6, 8]) == 3\nassert my_solution.passThePillow(**[8, 2]) == 3\nassert my_solution.passThePillow(**[82, 26]) == 27\nassert my_solution.passThePillow(**[18, 38]) == 5\nassert my_solution.passThePillow(**[43, 13]) == 14\nassert my_solution.passThePillow(**[76, 23]) == 24\nassert my_solution.passThePillow(**[36, 20]) == 21\nassert my_solution.passThePillow(**[14, 20]) == 7\nassert my_solution.passThePillow(**[73, 27]) == 28\nassert my_solution.passThePillow(**[53, 46]) == 47\nassert my_solution.passThePillow(**[93, 22]) == 23\nassert my_solution.passThePillow(**[66, 48]) == 49\nassert my_solution.passThePillow(**[2, 341]) == 2\nassert my_solution.passThePillow(**[33, 218]) == 27\nassert my_solution.passThePillow(**[69, 81]) == 56\n"}, "labels": {"questionId": "2645", "questionFrontendId": "2582", "questionTitle": "Pass the Pillow", "stats": {"totalAccepted": "36.1K", "totalSubmission": "61.8K", "totalAcceptedRaw": 36114, "totalSubmissionRaw": 61773, "acRate": "58.5%"}, "probedCases": [{"inputs": [4, 5], "output": 2}, {"inputs": [3, 2], "output": 3}, {"inputs": [9, 4], "output": 5}, {"inputs": [8, 9], "output": 6}, {"inputs": [20, 9], "output": 10}, {"inputs": [6, 8], "output": 3}, {"inputs": [8, 2], "output": 3}, {"inputs": [82, 26], "output": 27}, {"inputs": [18, 38], "output": 5}, {"inputs": [43, 13], "output": 14}, {"inputs": [76, 23], "output": 24}, {"inputs": [36, 20], "output": 21}, {"inputs": [14, 20], "output": 7}, {"inputs": [73, 27], "output": 28}, {"inputs": [53, 46], "output": 47}, {"inputs": [93, 22], "output": 23}, {"inputs": [66, 48], "output": 49}, {"inputs": [2, 341], "output": 2}, {"inputs": [33, 218], "output": 27}, {"inputs": [69, 81], "output": 56}]}} +{"id": "LeetCode/2648", "content": "# Number of Ways to Earn Points\n\nThere is a test that has `n` types of questions. You are given an integer `target` and a **0-indexed** 2D integer array `types` where `types[i] = [counti, marksi]` indicates that there are `counti` questions of the `ith` type, and each one of them is worth `marksi` points.\n\n\n\n\nReturn *the number of ways you can earn **exactly*** `target` *points in the exam*. Since the answer may be too large, return it **modulo** `109 + 7`.\n\n\n**Note** that questions of the same type are indistinguishable.\n\n\n* For example, if there are `3` questions of the same type, then solving the `1st` and `2nd` questions is the same as solving the `1st` and `3rd` questions, or the `2nd` and `3rd` questions.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** target = 6, types = [[6,1],[3,2],[2,3]]\n**Output:** 7\n**Explanation:** You can earn 6 points in one of the seven ways:\n- Solve 6 questions of the 0th type: 1 + 1 + 1 + 1 + 1 + 1 = 6\n- Solve 4 questions of the 0th type and 1 question of the 1st type: 1 + 1 + 1 + 1 + 2 = 6\n- Solve 2 questions of the 0th type and 2 questions of the 1st type: 1 + 1 + 2 + 2 = 6\n- Solve 3 questions of the 0th type and 1 question of the 2nd type: 1 + 1 + 1 + 3 = 6\n- Solve 1 question of the 0th type, 1 question of the 1st type and 1 question of the 2nd type: 1 + 2 + 3 = 6\n- Solve 3 questions of the 1st type: 2 + 2 + 2 = 6\n- Solve 2 questions of the 2nd type: 3 + 3 = 6\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** target = 5, types = [[50,1],[50,2],[50,5]]\n**Output:** 4\n**Explanation:** You can earn 5 points in one of the four ways:\n- Solve 5 questions of the 0th type: 1 + 1 + 1 + 1 + 1 = 5\n- Solve 3 questions of the 0th type and 1 question of the 1st type: 1 + 1 + 1 + 2 = 5\n- Solve 1 questions of the 0th type and 2 questions of the 1st type: 1 + 2 + 2 = 5\n- Solve 1 question of the 2nd type: 5\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** target = 18, types = [[6,1],[3,2],[2,3]]\n**Output:** 1\n**Explanation:** You can only earn 18 points by answering all questions.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= target <= 1000`\n* `n == types.length`\n* `1 <= n <= 50`\n* `types[i].length == 2`\n* `1 <= counti, marksi <= 50`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def waysToReachTarget(self, target: int, types: List[List[int]]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.waysToReachTarget(**[6, [[6, 1], [3, 2], [2, 3]]]) == 7\nassert my_solution.waysToReachTarget(**[5, [[50, 1], [50, 2], [50, 5]]]) == 4\nassert my_solution.waysToReachTarget(**[18, [[6, 1], [3, 2], [2, 3]]]) == 1\nassert my_solution.waysToReachTarget(**[6, [[6, 1], [6, 1]]]) == 7\nassert my_solution.waysToReachTarget(**[6, [[1, 6], [1, 6]]]) == 2\nassert my_solution.waysToReachTarget(**[12, [[6, 6], [6, 6]]]) == 3\nassert my_solution.waysToReachTarget(**[494, [[50, 13], [50, 26], [50, 39]]]) == 140\nassert my_solution.waysToReachTarget(**[495, [[50, 13], [50, 26], [50, 39]]]) == 0\nassert my_solution.waysToReachTarget(**[493, [[50, 13], [50, 26], [50, 39]]]) == 0\nassert my_solution.waysToReachTarget(**[500, [[6, 1], [49, 2], [33, 3], [26, 4], [28, 5], [45, 6], [4, 7], [23, 8], [46, 9], [39, 10], [12, 11], [28, 12], [37, 13], [18, 14], [10, 15], [27, 16], [26, 17], [10, 18], [34, 19], [11, 20], [35, 21], [5, 22], [47, 23], [19, 24], [15, 25], [27, 26], [50, 27], [3, 28], [24, 29], [18, 30], [49, 31], [32, 32], [18, 33], [5, 34], [34, 35]]]) == 342808744\nassert my_solution.waysToReachTarget(**[500, [[50, 1], [50, 2], [50, 3], [50, 4], [50, 5], [50, 6], [50, 7], [50, 8], [50, 9], [50, 10], [50, 11], [50, 12], [50, 13], [50, 14], [50, 15], [50, 16], [50, 17], [50, 18], [50, 19], [50, 20], [50, 21], [50, 22], [50, 23], [50, 24], [50, 25], [50, 26], [50, 27], [50, 28], [50, 29], [50, 30], [50, 31], [50, 32], [50, 33], [50, 34], [50, 35]]]) == 556513829\nassert my_solution.waysToReachTarget(**[500, [[26, 1], [10, 2], [42, 3], [8, 4], [6, 5], [27, 6], [20, 7], [34, 8], [42, 9], [22, 10], [1, 11], [22, 12], [28, 13], [35, 14], [39, 15], [21, 16], [45, 17], [24, 18], [19, 19], [33, 20], [39, 21], [12, 22], [22, 23], [32, 24], [10, 25], [31, 26], [14, 27], [36, 28], [33, 29], [9, 30], [22, 31], [31, 32], [23, 33], [5, 34], [12, 35], [48, 36]]]) == 342947153\nassert my_solution.waysToReachTarget(**[500, [[50, 1], [50, 2], [50, 3], [50, 4], [50, 5], [50, 6], [50, 7], [50, 8], [50, 9], [50, 10], [50, 11], [50, 12], [50, 13], [50, 14], [50, 15], [50, 16], [50, 17], [50, 18], [50, 19], [50, 20], [50, 21], [50, 22], [50, 23], [50, 24], [50, 25], [50, 26], [50, 27], [50, 28], [50, 29], [50, 30], [50, 31], [50, 32], [50, 33], [50, 34], [50, 35], [50, 36]]]) == 446917244\nassert my_solution.waysToReachTarget(**[500, [[33, 1], [29, 2], [30, 3], [29, 4], [30, 5], [29, 6], [45, 7], [38, 8], [37, 9], [25, 10], [13, 11], [24, 12], [22, 13], [36, 14], [22, 15], [8, 16], [6, 17], [38, 18], [19, 19], [20, 20], [39, 21], [13, 22], [9, 23], [45, 24], [35, 25], [19, 26], [19, 27], [32, 28], [18, 29], [35, 30], [9, 31], [36, 32], [42, 33], [22, 34], [33, 35], [7, 36], [24, 37]]]) == 803934613\nassert my_solution.waysToReachTarget(**[500, [[50, 1], [50, 2], [50, 3], [50, 4], [50, 5], [50, 6], [50, 7], [50, 8], [50, 9], [50, 10], [50, 11], [50, 12], [50, 13], [50, 14], [50, 15], [50, 16], [50, 17], [50, 18], [50, 19], [50, 20], [50, 21], [50, 22], [50, 23], [50, 24], [50, 25], [50, 26], [50, 27], [50, 28], [50, 29], [50, 30], [50, 31], [50, 32], [50, 33], [50, 34], [50, 35], [50, 36], [50, 37]]]) == 664430727\nassert my_solution.waysToReachTarget(**[500, [[37, 1], [8, 2], [6, 3], [48, 4], [7, 5], [36, 6], [9, 7], [14, 8], [37, 9], [6, 10], [6, 11], [41, 12], [2, 13], [18, 14], [30, 15], [22, 16], [45, 17], [1, 18], [11, 19], [6, 20], [7, 21], [27, 22], [8, 23], [18, 24], [3, 25], [23, 26], [42, 27], [6, 28], [8, 29], [26, 30], [5, 31], [3, 32], [32, 33], [50, 34], [44, 35], [1, 36], [33, 37], [35, 38]]]) == 162497610\nassert my_solution.waysToReachTarget(**[500, [[50, 1], [50, 2], [50, 3], [50, 4], [50, 5], [50, 6], [50, 7], [50, 8], [50, 9], [50, 10], [50, 11], [50, 12], [50, 13], [50, 14], [50, 15], [50, 16], [50, 17], [50, 18], [50, 19], [50, 20], [50, 21], [50, 22], [50, 23], [50, 24], [50, 25], [50, 26], [50, 27], [50, 28], [50, 29], [50, 30], [50, 31], [50, 32], [50, 33], [50, 34], [50, 35], [50, 36], [50, 37], [50, 38]]]) == 86818393\nassert my_solution.waysToReachTarget(**[500, [[5, 1], [35, 2], [3, 3], [8, 4], [27, 5], [15, 6], [7, 7], [25, 8], [11, 9], [18, 10], [8, 11], [39, 12], [50, 13], [4, 14], [49, 15], [13, 16], [34, 17], [24, 18], [21, 19], [48, 20], [1, 21], [12, 22], [22, 23], [17, 24], [19, 25], [29, 26], [18, 27], [25, 28], [35, 29], [24, 30], [24, 31], [7, 32], [8, 33], [25, 34], [21, 35], [34, 36], [48, 37], [36, 38], [16, 39]]]) == 943634728\nassert my_solution.waysToReachTarget(**[500, [[50, 1], [50, 2], [50, 3], [50, 4], [50, 5], [50, 6], [50, 7], [50, 8], [50, 9], [50, 10], [50, 11], [50, 12], [50, 13], [50, 14], [50, 15], [50, 16], [50, 17], [50, 18], [50, 19], [50, 20], [50, 21], [50, 22], [50, 23], [50, 24], [50, 25], [50, 26], [50, 27], [50, 28], [50, 29], [50, 30], [50, 31], [50, 32], [50, 33], [50, 34], [50, 35], [50, 36], [50, 37], [50, 38], [50, 39]]]) == 632112070\nassert my_solution.waysToReachTarget(**[500, [[24, 1], [31, 2], [12, 3], [2, 4], [29, 5], [6, 6], [18, 7], [34, 8], [50, 9], [3, 10], [14, 11], [5, 12], [5, 13], [1, 14], [34, 15], [23, 16], [10, 17], [48, 18], [50, 19], [25, 20], [9, 21], [9, 22], [32, 23], [35, 24], [43, 25], [39, 26], [23, 27], [28, 28], [12, 29], [15, 30], [15, 31], [40, 32], [20, 33], [20, 34], [15, 35], [49, 36], [32, 37], [8, 38], [20, 39], [38, 40]]]) == 141097726\n"}, "labels": {"questionId": "2648", "questionFrontendId": "2585", "questionTitle": "Number of Ways to Earn Points", "stats": {"totalAccepted": "6.1K", "totalSubmission": "9.3K", "totalAcceptedRaw": 6103, "totalSubmissionRaw": 9316, "acRate": "65.5%"}, "probedCases": [{"inputs": [6, [[6, 1], [3, 2], [2, 3]]], "output": 7}, {"inputs": [5, [[50, 1], [50, 2], [50, 5]]], "output": 4}, {"inputs": [18, [[6, 1], [3, 2], [2, 3]]], "output": 1}, {"inputs": [6, [[6, 1], [6, 1]]], "output": 7}, {"inputs": [6, [[1, 6], [1, 6]]], "output": 2}, {"inputs": [12, [[6, 6], [6, 6]]], "output": 3}, {"inputs": [494, [[50, 13], [50, 26], [50, 39]]], "output": 140}, {"inputs": [495, [[50, 13], [50, 26], [50, 39]]], "output": 0}, {"inputs": [493, [[50, 13], [50, 26], [50, 39]]], "output": 0}, {"inputs": [500, [[6, 1], [49, 2], [33, 3], [26, 4], [28, 5], [45, 6], [4, 7], [23, 8], [46, 9], [39, 10], [12, 11], [28, 12], [37, 13], [18, 14], [10, 15], [27, 16], [26, 17], [10, 18], [34, 19], [11, 20], [35, 21], [5, 22], [47, 23], [19, 24], [15, 25], [27, 26], [50, 27], [3, 28], [24, 29], [18, 30], [49, 31], [32, 32], [18, 33], [5, 34], [34, 35]]], "output": 342808744}, {"inputs": [500, [[50, 1], [50, 2], [50, 3], [50, 4], [50, 5], [50, 6], [50, 7], [50, 8], [50, 9], [50, 10], [50, 11], [50, 12], [50, 13], [50, 14], [50, 15], [50, 16], [50, 17], [50, 18], [50, 19], [50, 20], [50, 21], [50, 22], [50, 23], [50, 24], [50, 25], [50, 26], [50, 27], [50, 28], [50, 29], [50, 30], [50, 31], [50, 32], [50, 33], [50, 34], [50, 35]]], "output": 556513829}, {"inputs": [500, [[26, 1], [10, 2], [42, 3], [8, 4], [6, 5], [27, 6], [20, 7], [34, 8], [42, 9], [22, 10], [1, 11], [22, 12], [28, 13], [35, 14], [39, 15], [21, 16], [45, 17], [24, 18], [19, 19], [33, 20], [39, 21], [12, 22], [22, 23], [32, 24], [10, 25], [31, 26], [14, 27], [36, 28], [33, 29], [9, 30], [22, 31], [31, 32], [23, 33], [5, 34], [12, 35], [48, 36]]], "output": 342947153}, {"inputs": [500, [[50, 1], [50, 2], [50, 3], [50, 4], [50, 5], [50, 6], [50, 7], [50, 8], [50, 9], [50, 10], [50, 11], [50, 12], [50, 13], [50, 14], [50, 15], [50, 16], [50, 17], [50, 18], [50, 19], [50, 20], [50, 21], [50, 22], [50, 23], [50, 24], [50, 25], [50, 26], [50, 27], [50, 28], [50, 29], [50, 30], [50, 31], [50, 32], [50, 33], [50, 34], [50, 35], [50, 36]]], "output": 446917244}, {"inputs": [500, [[33, 1], [29, 2], [30, 3], [29, 4], [30, 5], [29, 6], [45, 7], [38, 8], [37, 9], [25, 10], [13, 11], [24, 12], [22, 13], [36, 14], [22, 15], [8, 16], [6, 17], [38, 18], [19, 19], [20, 20], [39, 21], [13, 22], [9, 23], [45, 24], [35, 25], [19, 26], [19, 27], [32, 28], [18, 29], [35, 30], [9, 31], [36, 32], [42, 33], [22, 34], [33, 35], [7, 36], [24, 37]]], "output": 803934613}, {"inputs": [500, [[50, 1], [50, 2], [50, 3], [50, 4], [50, 5], [50, 6], [50, 7], [50, 8], [50, 9], [50, 10], [50, 11], [50, 12], [50, 13], [50, 14], [50, 15], [50, 16], [50, 17], [50, 18], [50, 19], [50, 20], [50, 21], [50, 22], [50, 23], [50, 24], [50, 25], [50, 26], [50, 27], [50, 28], [50, 29], [50, 30], [50, 31], [50, 32], [50, 33], [50, 34], [50, 35], [50, 36], [50, 37]]], "output": 664430727}, {"inputs": [500, [[37, 1], [8, 2], [6, 3], [48, 4], [7, 5], [36, 6], [9, 7], [14, 8], [37, 9], [6, 10], [6, 11], [41, 12], [2, 13], [18, 14], [30, 15], [22, 16], [45, 17], [1, 18], [11, 19], [6, 20], [7, 21], [27, 22], [8, 23], [18, 24], [3, 25], [23, 26], [42, 27], [6, 28], [8, 29], [26, 30], [5, 31], [3, 32], [32, 33], [50, 34], [44, 35], [1, 36], [33, 37], [35, 38]]], "output": 162497610}, {"inputs": [500, [[50, 1], [50, 2], [50, 3], [50, 4], [50, 5], [50, 6], [50, 7], [50, 8], [50, 9], [50, 10], [50, 11], [50, 12], [50, 13], [50, 14], [50, 15], [50, 16], [50, 17], [50, 18], [50, 19], [50, 20], [50, 21], [50, 22], [50, 23], [50, 24], [50, 25], [50, 26], [50, 27], [50, 28], [50, 29], [50, 30], [50, 31], [50, 32], [50, 33], [50, 34], [50, 35], [50, 36], [50, 37], [50, 38]]], "output": 86818393}, {"inputs": [500, [[5, 1], [35, 2], [3, 3], [8, 4], [27, 5], [15, 6], [7, 7], [25, 8], [11, 9], [18, 10], [8, 11], [39, 12], [50, 13], [4, 14], [49, 15], [13, 16], [34, 17], [24, 18], [21, 19], [48, 20], [1, 21], [12, 22], [22, 23], [17, 24], [19, 25], [29, 26], [18, 27], [25, 28], [35, 29], [24, 30], [24, 31], [7, 32], [8, 33], [25, 34], [21, 35], [34, 36], [48, 37], [36, 38], [16, 39]]], "output": 943634728}, {"inputs": [500, [[50, 1], [50, 2], [50, 3], [50, 4], [50, 5], [50, 6], [50, 7], [50, 8], [50, 9], [50, 10], [50, 11], [50, 12], [50, 13], [50, 14], [50, 15], [50, 16], [50, 17], [50, 18], [50, 19], [50, 20], [50, 21], [50, 22], [50, 23], [50, 24], [50, 25], [50, 26], [50, 27], [50, 28], [50, 29], [50, 30], [50, 31], [50, 32], [50, 33], [50, 34], [50, 35], [50, 36], [50, 37], [50, 38], [50, 39]]], "output": 632112070}, {"inputs": [500, [[24, 1], [31, 2], [12, 3], [2, 4], [29, 5], [6, 6], [18, 7], [34, 8], [50, 9], [3, 10], [14, 11], [5, 12], [5, 13], [1, 14], [34, 15], [23, 16], [10, 17], [48, 18], [50, 19], [25, 20], [9, 21], [9, 22], [32, 23], [35, 24], [43, 25], [39, 26], [23, 27], [28, 28], [12, 29], [15, 30], [15, 31], [40, 32], [20, 33], [20, 34], [15, 35], [49, 36], [32, 37], [8, 38], [20, 39], [38, 40]]], "output": 141097726}]}} +{"id": "LeetCode/2650", "content": "# Split With Minimum Sum\n\nGiven a positive integer `num`, split it into two non-negative integers `num1` and `num2` such that:\n\n\n* The concatenation of `num1` and `num2` is a permutation of `num`.\n\t+ In other words, the sum of the number of occurrences of each digit in `num1` and `num2` is equal to the number of occurrences of that digit in `num`.\n* `num1` and `num2` can contain leading zeros.\n\n\nReturn *the **minimum** possible sum of* `num1` *and* `num2`.\n\n\n**Notes:**\n\n\n* It is guaranteed that `num` does not contain any leading zeros.\n* The order of occurrence of the digits in `num1` and `num2` may differ from the order of occurrence of `num`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** num = 4325\n**Output:** 59\n**Explanation:** We can split 4325 so that num1 is 24 and num2 is 35, giving a sum of 59. We can prove that 59 is indeed the minimal possible sum.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** num = 687\n**Output:** 75\n**Explanation:** We can split 687 so that num1 is 68 and num2 is 7, which would give an optimal sum of 75.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `10 <= num <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def splitNum(self, num: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.splitNum(**[4325]) == 59\nassert my_solution.splitNum(**[687]) == 75\nassert my_solution.splitNum(**[10]) == 1\nassert my_solution.splitNum(**[11]) == 2\nassert my_solution.splitNum(**[12]) == 3\nassert my_solution.splitNum(**[13]) == 4\nassert my_solution.splitNum(**[14]) == 5\nassert my_solution.splitNum(**[15]) == 6\nassert my_solution.splitNum(**[16]) == 7\nassert my_solution.splitNum(**[17]) == 8\nassert my_solution.splitNum(**[18]) == 9\nassert my_solution.splitNum(**[19]) == 10\nassert my_solution.splitNum(**[20]) == 2\nassert my_solution.splitNum(**[21]) == 3\nassert my_solution.splitNum(**[22]) == 4\nassert my_solution.splitNum(**[23]) == 5\nassert my_solution.splitNum(**[24]) == 6\nassert my_solution.splitNum(**[25]) == 7\nassert my_solution.splitNum(**[26]) == 8\nassert my_solution.splitNum(**[27]) == 9\n"}, "labels": {"questionId": "2650", "questionFrontendId": "2578", "questionTitle": "Split With Minimum Sum", "stats": {"totalAccepted": "30.8K", "totalSubmission": "37.8K", "totalAcceptedRaw": 30786, "totalSubmissionRaw": 37771, "acRate": "81.5%"}, "probedCases": [{"inputs": [4325], "output": 59}, {"inputs": [687], "output": 75}, {"inputs": [10], "output": 1}, {"inputs": [11], "output": 2}, {"inputs": [12], "output": 3}, {"inputs": [13], "output": 4}, {"inputs": [14], "output": 5}, {"inputs": [15], "output": 6}, {"inputs": [16], "output": 7}, {"inputs": [17], "output": 8}, {"inputs": [18], "output": 9}, {"inputs": [19], "output": 10}, {"inputs": [20], "output": 2}, {"inputs": [21], "output": 3}, {"inputs": [22], "output": 4}, {"inputs": [23], "output": 5}, {"inputs": [24], "output": 6}, {"inputs": [25], "output": 7}, {"inputs": [26], "output": 8}, {"inputs": [27], "output": 9}]}} +{"id": "LeetCode/2651", "content": "# Count Ways to Group Overlapping Ranges\n\nYou are given a 2D integer array `ranges` where `ranges[i] = [starti, endi]` denotes that all integers between `starti` and `endi` (both **inclusive**) are contained in the `ith` range.\n\n\nYou are to split `ranges` into **two** (possibly empty) groups such that:\n\n\n* Each range belongs to exactly one group.\n* Any two **overlapping** ranges must belong to the **same** group.\n\n\nTwo ranges are said to be **overlapping** if there exists at least **one** integer that is present in both ranges.\n\n\n* For example, `[1, 3]` and `[2, 5]` are overlapping because `2` and `3` occur in both ranges.\n\n\nReturn *the **total number** of ways to split* `ranges` *into two groups*. Since the answer may be very large, return it **modulo** `109 + 7`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** ranges = [[6,10],[5,15]]\n**Output:** 2\n**Explanation:** \nThe two ranges are overlapping, so they must be in the same group.\nThus, there are two possible ways:\n- Put both the ranges together in group 1.\n- Put both the ranges together in group 2.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** ranges = [[1,3],[10,20],[2,5],[4,8]]\n**Output:** 4\n**Explanation:** \nRanges [1,3], and [2,5] are overlapping. So, they must be in the same group.\nAgain, ranges [2,5] and [4,8] are also overlapping. So, they must also be in the same group. \nThus, there are four possible ways to group them:\n- All the ranges in group 1.\n- All the ranges in group 2.\n- Ranges [1,3], [2,5], and [4,8] in group 1 and [10,20] in group 2.\n- Ranges [1,3], [2,5], and [4,8] in group 2 and [10,20] in group 1.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= ranges.length <= 105`\n* `ranges[i].length == 2`\n* `0 <= starti <= endi <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countWays(self, ranges: List[List[int]]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countWays(**[[[6, 10], [5, 15]]]) == 2\nassert my_solution.countWays(**[[[1, 3], [10, 20], [2, 5], [4, 8]]]) == 4\nassert my_solution.countWays(**[[[0, 1]]]) == 2\nassert my_solution.countWays(**[[[0, 2], [2, 3]]]) == 2\nassert my_solution.countWays(**[[[1, 2], [1, 1], [0, 4]]]) == 2\nassert my_solution.countWays(**[[[0, 0], [8, 9], [12, 13], [1, 3]]]) == 16\nassert my_solution.countWays(**[[[5, 11], [20, 22], [1, 3], [21, 22], [11, 11]]]) == 8\nassert my_solution.countWays(**[[[4, 5], [10, 15], [21, 25], [27, 32], [6, 7], [11, 15]]]) == 32\nassert my_solution.countWays(**[[[5, 12], [16, 28], [32, 41], [7, 15], [17, 26], [41, 46], [1, 12]]]) == 8\nassert my_solution.countWays(**[[[34, 56], [28, 29], [12, 16], [11, 48], [28, 54], [22, 55], [28, 41], [41, 44]]]) == 2\nassert my_solution.countWays(**[[[6, 6], [20, 37], [53, 56], [60, 62], [6, 19], [32, 37], [55, 57], [70, 71], [0, 19]]]) == 32\nassert my_solution.countWays(**[[[3, 10], [15, 19], [22, 28], [34, 40], [54, 54], [55, 56], [77, 77], [77, 88], [97, 98], [2, 7]]]) == 256\nassert my_solution.countWays(**[[[0, 1], [28, 30], [37, 47], [66, 67], [70, 71], [90, 99], [113, 114], [10, 16], [28, 34], [40, 51], [59, 62]]]) == 512\nassert my_solution.countWays(**[[[30, 54], [74, 79], [29, 37], [126, 127], [36, 56], [116, 133], [15, 36], [82, 113], [7, 30], [89, 137], [22, 51], [74, 129]]]) == 4\nassert my_solution.countWays(**[[[10, 11], [25, 28], [29, 34], [49, 51], [58, 66], [77, 84], [91, 91], [100, 104], [120, 121], [127, 128], [151, 151], [156, 168], [0, 8]]]) == 8192\nassert my_solution.countWays(**[[[8, 10], [25, 28], [40, 45], [56, 57], [67, 75], [75, 89], [91, 96], [109, 110], [122, 127], [146, 148], [157, 157], [166, 177], [189, 190], [11, 11]]]) == 8192\nassert my_solution.countWays(**[[[17, 22], [30, 43], [54, 55], [69, 85], [97, 110], [112, 125], [147, 151], [167, 173], [181, 183], [206, 212], [7, 15], [41, 42], [45, 61], [69, 86], [100, 100]]]) == 2048\nassert my_solution.countWays(**[[[1, 15], [20, 34], [36, 44], [52, 55], [75, 83], [87, 99], [110, 117], [120, 125], [148, 148], [155, 157], [181, 186], [187, 189], [210, 213], [230, 232], [240, 254], [13, 15]]]) == 32768\nassert my_solution.countWays(**[[[6, 29], [63, 65], [85, 98], [134, 156], [184, 200], [206, 208], [268, 276], [3, 35], [48, 77], [84, 119], [161, 162], [165, 190], [225, 229], [262, 282], [8, 38], [42, 57], [90, 120]]]) == 512\nassert my_solution.countWays(**[[[21, 22], [27, 36], [54, 80], [93, 108], [113, 119], [137, 149], [173, 183], [210, 211], [233, 241], [257, 267], [271, 284], [300, 309], [10, 23], [49, 51], [68, 77], [97, 99], [128, 132], [142, 146]]]) == 16384\n"}, "labels": {"questionId": "2651", "questionFrontendId": "2580", "questionTitle": "Count Ways to Group Overlapping Ranges", "stats": {"totalAccepted": "5.4K", "totalSubmission": "14.8K", "totalAcceptedRaw": 5381, "totalSubmissionRaw": 14834, "acRate": "36.3%"}, "probedCases": [{"inputs": [[[6, 10], [5, 15]]], "output": 2}, {"inputs": [[[1, 3], [10, 20], [2, 5], [4, 8]]], "output": 4}, {"inputs": [[[0, 1]]], "output": 2}, {"inputs": [[[0, 2], [2, 3]]], "output": 2}, {"inputs": [[[1, 2], [1, 1], [0, 4]]], "output": 2}, {"inputs": [[[0, 0], [8, 9], [12, 13], [1, 3]]], "output": 16}, {"inputs": [[[5, 11], [20, 22], [1, 3], [21, 22], [11, 11]]], "output": 8}, {"inputs": [[[4, 5], [10, 15], [21, 25], [27, 32], [6, 7], [11, 15]]], "output": 32}, {"inputs": [[[5, 12], [16, 28], [32, 41], [7, 15], [17, 26], [41, 46], [1, 12]]], "output": 8}, {"inputs": [[[34, 56], [28, 29], [12, 16], [11, 48], [28, 54], [22, 55], [28, 41], [41, 44]]], "output": 2}, {"inputs": [[[6, 6], [20, 37], [53, 56], [60, 62], [6, 19], [32, 37], [55, 57], [70, 71], [0, 19]]], "output": 32}, {"inputs": [[[3, 10], [15, 19], [22, 28], [34, 40], [54, 54], [55, 56], [77, 77], [77, 88], [97, 98], [2, 7]]], "output": 256}, {"inputs": [[[0, 1], [28, 30], [37, 47], [66, 67], [70, 71], [90, 99], [113, 114], [10, 16], [28, 34], [40, 51], [59, 62]]], "output": 512}, {"inputs": [[[30, 54], [74, 79], [29, 37], [126, 127], [36, 56], [116, 133], [15, 36], [82, 113], [7, 30], [89, 137], [22, 51], [74, 129]]], "output": 4}, {"inputs": [[[10, 11], [25, 28], [29, 34], [49, 51], [58, 66], [77, 84], [91, 91], [100, 104], [120, 121], [127, 128], [151, 151], [156, 168], [0, 8]]], "output": 8192}, {"inputs": [[[8, 10], [25, 28], [40, 45], [56, 57], [67, 75], [75, 89], [91, 96], [109, 110], [122, 127], [146, 148], [157, 157], [166, 177], [189, 190], [11, 11]]], "output": 8192}, {"inputs": [[[17, 22], [30, 43], [54, 55], [69, 85], [97, 110], [112, 125], [147, 151], [167, 173], [181, 183], [206, 212], [7, 15], [41, 42], [45, 61], [69, 86], [100, 100]]], "output": 2048}, {"inputs": [[[1, 15], [20, 34], [36, 44], [52, 55], [75, 83], [87, 99], [110, 117], [120, 125], [148, 148], [155, 157], [181, 186], [187, 189], [210, 213], [230, 232], [240, 254], [13, 15]]], "output": 32768}, {"inputs": [[[6, 29], [63, 65], [85, 98], [134, 156], [184, 200], [206, 208], [268, 276], [3, 35], [48, 77], [84, 119], [161, 162], [165, 190], [225, 229], [262, 282], [8, 38], [42, 57], [90, 120]]], "output": 512}, {"inputs": [[[21, 22], [27, 36], [54, 80], [93, 108], [113, 119], [137, 149], [173, 183], [210, 211], [233, 241], [257, 267], [271, 284], [300, 309], [10, 23], [49, 51], [68, 77], [97, 99], [128, 132], [142, 146]]], "output": 16384}]}} +{"id": "LeetCode/2714", "content": "# Left and Right Sum Differences\n\nGiven a **0-indexed** integer array `nums`, find a **0-indexed** integer array `answer` where:\n\n\n* `answer.length == nums.length`.\n* `answer[i] = |leftSum[i] - rightSum[i]|`.\n\n\nWhere:\n\n\n* `leftSum[i]` is the sum of elements to the left of the index `i` in the array `nums`. If there is no such element, `leftSum[i] = 0`.\n* `rightSum[i]` is the sum of elements to the right of the index `i` in the array `nums`. If there is no such element, `rightSum[i] = 0`.\n\n\nReturn *the array* `answer`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [10,4,8,3]\n**Output:** [15,1,11,22]\n**Explanation:** The array leftSum is [0,10,14,22] and the array rightSum is [15,11,3,0].\nThe array answer is [|0 - 15|,|10 - 11|,|14 - 3|,|22 - 0|] = [15,1,11,22].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1]\n**Output:** [0]\n**Explanation:** The array leftSum is [0] and the array rightSum is [0].\nThe array answer is [|0 - 0|] = [0].\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 1000`\n* `1 <= nums[i] <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def leftRightDifference(self, nums: List[int]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.leftRightDifference(**[[10, 4, 8, 3]]) == [15, 1, 11, 22]\nassert my_solution.leftRightDifference(**[[1]]) == [0]\nassert my_solution.leftRightDifference(**[[7, 3, 21, 31]]) == [55, 45, 21, 31]\nassert my_solution.leftRightDifference(**[[33, 17, 58, 42]]) == [117, 67, 8, 108]\nassert my_solution.leftRightDifference(**[[8, 28, 35, 21, 13, 21, 72, 35, 52, 74]]) == [351, 315, 252, 196, 162, 128, 35, 72, 159, 285]\nassert my_solution.leftRightDifference(**[[25, 65, 77, 1, 73, 32, 43, 68, 8]]) == [367, 277, 135, 57, 17, 122, 197, 308, 384]\nassert my_solution.leftRightDifference(**[[50, 57, 42]]) == [99, 8, 107]\nassert my_solution.leftRightDifference(**[[70, 18, 64, 12, 21, 21, 78, 36, 58, 88, 58, 99, 26, 92, 91, 53, 10, 24, 25, 20, 107, 92, 73, 63, 51, 65, 87, 6, 17, 103, 111, 32, 14, 42, 46, 65, 43, 9, 75, 76, 25, 96, 46, 85, 19, 29, 88, 2, 5, 24, 60, 26, 76, 24, 110, 96, 82, 97, 97, 72, 35, 21, 77, 82, 30, 94, 55, 76, 94, 112, 105, 51, 82, 3, 89, 52, 96, 72, 27, 59, 57, 97, 6, 46, 88, 112, 41, 110, 52]]) == [5151, 5063, 4981, 4905, 4872, 4830, 4731, 4617, 4523, 4377, 4231, 4074, 3949, 3831, 3648, 3504, 3441, 3407, 3358, 3313, 3186, 2987, 2822, 2686, 2572, 2456, 2304, 2211, 2188, 2068, 1854, 1711, 1665, 1609, 1521, 1410, 1302, 1250, 1166, 1015, 914, 793, 651, 520, 416, 368, 251, 161, 154, 125, 41, 45, 147, 247, 381, 587, 765, 944, 1138, 1307, 1414, 1470, 1568, 1727, 1839, 1963, 2112, 2243, 2413, 2619, 2836, 2992, 3125, 3210, 3302, 3443, 3591, 3759, 3858, 3944, 4060, 4214, 4317, 4369, 4503, 4703, 4856, 5007, 5169]\nassert my_solution.leftRightDifference(**[[182, 15, 65, 7, 21, 247, 274, 38, 250, 94, 4, 282, 219, 182, 16, 241, 312, 81, 207, 330, 306, 166, 82, 290, 7, 317, 218, 251, 198, 171, 247, 56, 330, 240, 261, 67, 65, 138, 181, 308, 26, 59, 150, 137, 244, 136, 116, 272, 138, 34, 72, 328, 312, 159, 32, 283, 6, 234, 280, 46, 289, 48, 218, 234, 284, 195, 188, 181, 259, 145, 96, 298, 322, 213, 154, 278, 292, 315, 191, 177, 228, 291, 204, 310, 266, 309, 178, 7, 327, 319, 295, 136, 215, 260, 259, 35, 248]]) == [18112, 17915, 17835, 17763, 17735, 17467, 16946, 16634, 16346, 16002, 15904, 15618, 15117, 14716, 14518, 14261, 13708, 13315, 13027, 12490, 11854, 11382, 11134, 10762, 10465, 10141, 9606, 9137, 8688, 8319, 7901, 7598, 7212, 6642, 6141, 5813, 5681, 5478, 5159, 4670, 4336, 4251, 4042, 3755, 3374, 2994, 2742, 2354, 1944, 1772, 1666, 1266, 626, 155, 36, 351, 640, 880, 1394, 1720, 2055, 2392, 2658, 3110, 3628, 4107, 4490, 4859, 5299, 5703, 5944, 6338, 6958, 7493, 7860, 8292, 8862, 9469, 9975, 10343, 10748, 11267, 11762, 12276, 12852, 13427, 13914, 14099, 14433, 15079, 15693, 16124, 16475, 16950, 17469, 17763, 18046]\nassert my_solution.leftRightDifference(**[[680, 753, 287, 496, 166, 300, 126, 96, 537, 394, 634, 270, 72, 688, 158, 534, 746, 520, 649, 318, 632, 592, 732, 670, 291, 151, 128, 680, 158, 631, 196, 707, 439, 534, 666, 22, 626, 299, 121, 346, 11, 426, 459, 748, 551, 561, 110, 192, 103, 165, 111, 138, 665, 289, 12, 99, 201, 432, 653, 239, 418, 575]]) == [23523, 22090, 21050, 20267, 19605, 19139, 18713, 18491, 17858, 16927, 15899, 14995, 14653, 13893, 13047, 12355, 11075, 9809, 8640, 7673, 6723, 5499, 4175, 2773, 1812, 1370, 1091, 283, 555, 1344, 2171, 3074, 4220, 5193, 6393, 7081, 7729, 8654, 9074, 9541, 9898, 10335, 11220, 12427, 13726, 14838, 15509, 15811, 16106, 16374, 16650, 16899, 17702, 18656, 18957, 19068, 19368, 20001, 21086, 21978, 22635, 23628]\nassert my_solution.leftRightDifference(**[[441, 751, 571, 815, 535, 818, 301, 106, 633, 734, 836, 515, 673, 559, 464, 644, 305, 337, 242, 421, 342, 690, 152, 739, 816, 901, 529, 851, 213, 90, 640, 301, 747, 735, 536, 428, 816, 442, 156, 660, 680, 617, 659, 676, 791, 673, 569, 414, 254, 185, 42, 21, 708, 798, 22, 40, 18, 433, 743, 6, 103, 697, 372, 824, 382, 365, 500, 725, 441, 839, 22, 439, 320, 738, 769, 290, 243, 247]]) == [37709, 36517, 35195, 33809, 32459, 31106, 29987, 29580, 28841, 27474, 25904, 24553, 23365, 22133, 21110, 20002, 19053, 18411, 17832, 17169, 16406, 15374, 14532, 13641, 12086, 10369, 8939, 7559, 6495, 6192, 5462, 4521, 3473, 1991, 720, 244, 1488, 2746, 3344, 4160, 5500, 6797, 8073, 9408, 10875, 12339, 13581, 14564, 15232, 15671, 15898, 15961, 16690, 18196, 19016, 19078, 19136, 19587, 20763, 21512, 21621, 22421, 23490, 24686, 25892, 26639, 27504, 28729, 29895, 31175, 32036, 32497, 33256, 34314, 35821, 36880, 37413, 37903]\nassert my_solution.leftRightDifference(**[[147, 231, 162, 37, 293, 160, 68, 232, 232, 130, 309, 211, 4, 58, 175, 296, 222, 161, 190, 283, 137, 227, 284, 134, 170, 13, 275, 113, 148, 198, 33, 260, 6, 154, 166, 234, 175, 301, 24, 205, 115, 4, 40, 105, 311, 221, 247, 34, 190, 23, 289, 16, 129, 68, 12, 32, 111, 49, 287, 168, 111, 222, 20, 212, 140, 307, 4, 262, 228, 161, 200, 108, 206]]) == [11343, 10965, 10572, 10373, 10043, 9590, 9362, 9062, 8598, 8236, 7797, 7277, 7062, 7000, 6767, 6296, 5778, 5395, 5044, 4571, 4151, 3787, 3276, 2858, 2554, 2371, 2083, 1695, 1434, 1088, 857, 564, 298, 138, 182, 582, 991, 1467, 1792, 2021, 2341, 2460, 2504, 2649, 3065, 3597, 4065, 4346, 4570, 4783, 5095, 5400, 5545, 5742, 5822, 5866, 6009, 6169, 6505, 6960, 7239, 7572, 7814, 8046, 8398, 8845, 9156, 9422, 9912, 10301, 10662, 10970, 11284]\nassert my_solution.leftRightDifference(**[[140, 133, 120, 129, 97, 167, 164, 61, 90, 123, 90, 64, 141, 122, 122, 122, 46, 94, 67, 42, 11, 129, 50, 39, 119, 42, 21, 109, 44, 165, 124, 23, 125, 82, 66, 183, 26, 183, 115, 170, 121, 10, 91, 52, 49, 71, 53, 23, 60, 25, 103, 59, 32, 87, 44, 113, 65, 51, 152, 27, 133, 48, 179, 144, 74, 59, 166, 24, 87]]) == [6022, 5749, 5496, 5247, 5021, 4757, 4426, 4201, 4050, 3837, 3624, 3470, 3265, 3002, 2758, 2514, 2346, 2206, 2045, 1936, 1883, 1743, 1564, 1475, 1317, 1156, 1093, 963, 810, 601, 312, 165, 17, 190, 338, 587, 796, 1005, 1303, 1588, 1879, 2010, 2111, 2254, 2355, 2475, 2599, 2675, 2758, 2843, 2971, 3133, 3224, 3343, 3474, 3631, 3809, 3925, 4128, 4307, 4467, 4648, 4875, 5198, 5416, 5549, 5774, 5964, 6075]\nassert my_solution.leftRightDifference(**[[8, 19, 10, 6, 26, 4, 2, 29, 34, 26, 18, 3, 29, 24, 31, 24, 26, 1, 24, 8, 5, 6, 30, 21, 6, 30, 35, 32, 11, 14, 18, 8, 14, 21, 11, 22, 16, 32, 1, 7, 24, 36, 23, 37, 16, 21, 9, 11, 20, 11, 6, 19, 32, 29, 12, 29, 17, 9, 1, 29, 30, 36, 5, 31, 26, 18, 6, 12, 7, 27, 17, 29, 3, 26, 14, 37, 37, 24, 15, 12, 1, 37, 19, 11, 18, 33, 6, 37, 15, 23, 12, 18]]) == [1717, 1690, 1661, 1645, 1613, 1583, 1577, 1546, 1483, 1423, 1379, 1358, 1326, 1273, 1218, 1163, 1113, 1086, 1061, 1029, 1016, 1005, 969, 918, 891, 855, 790, 723, 680, 655, 623, 597, 575, 540, 508, 475, 437, 389, 356, 348, 317, 257, 198, 138, 85, 48, 18, 2, 33, 64, 81, 106, 157, 218, 259, 300, 346, 372, 382, 412, 471, 537, 578, 614, 671, 715, 739, 757, 776, 810, 854, 900, 932, 961, 1001, 1052, 1126, 1187, 1226, 1253, 1266, 1304, 1360, 1390, 1419, 1470, 1509, 1552, 1604, 1642, 1677, 1707]\nassert my_solution.leftRightDifference(**[[420, 510, 361, 432, 509, 379, 416, 591, 376, 418, 402, 226, 244, 411, 92, 75, 137, 351, 224, 450, 219, 326, 199, 154, 23, 248, 219, 467, 403, 1]]) == [8863, 7933, 7062, 6269, 5328, 4440, 3645, 2638, 1671, 877, 57, 571, 1041, 1696, 2199, 2366, 2578, 3066, 3641, 4315, 4984, 5529, 6054, 6407, 6584, 6855, 7322, 8008, 8878, 9282]\nassert my_solution.leftRightDifference(**[[777, 582, 830, 666, 84, 797, 798, 600, 841, 469, 605, 12, 205, 391, 877, 622, 287, 13, 553, 506, 192, 271, 501, 816, 889, 162, 390, 342, 279, 145, 3, 168, 84, 469, 304, 372, 7, 276, 587, 459, 441, 890, 852]]) == [18637, 17278, 15866, 14370, 13620, 12739, 11144, 9746, 8305, 6995, 5921, 5304, 5087, 4491, 3223, 1724, 815, 515, 51, 1110, 1808, 2271, 3043, 4360, 6065, 7116, 7668, 8400, 9021, 9445, 9593, 9764, 10016, 10569, 11342, 12018, 12397, 12680, 13543, 14589, 15489, 16820, 18562]\nassert my_solution.leftRightDifference(**[[108, 150, 12, 40, 97, 39, 183, 26, 59, 63, 177, 97, 20, 71, 73, 100, 50, 129, 81, 61, 28, 40, 118, 84, 86, 114, 145, 90, 59, 154, 33, 76, 39, 21, 34, 130, 109, 169, 148, 63, 168, 62, 122, 156, 29, 104, 130, 128, 15, 122, 33, 6, 143, 16, 179, 110, 109, 45, 88, 173, 67, 37, 59, 88, 25, 53, 162, 2, 124, 35, 141, 174]]) == [6173, 5915, 5753, 5701, 5564, 5428, 5206, 4997, 4912, 4790, 4550, 4276, 4159, 4068, 3924, 3751, 3601, 3422, 3212, 3070, 2981, 2913, 2755, 2553, 2383, 2183, 1924, 1689, 1540, 1327, 1140, 1031, 916, 856, 801, 637, 398, 120, 197, 408, 639, 869, 1053, 1331, 1516, 1649, 1883, 2141, 2284, 2421, 2576, 2615, 2764, 2923, 3118, 3407, 3626, 3780, 3913, 4174, 4414, 4518, 4614, 4761, 4874, 4952, 5167, 5331, 5457, 5616, 5792, 6107]\nassert my_solution.leftRightDifference(**[[18, 632, 942, 231, 247, 267, 741, 320, 844, 276, 578, 659, 96, 697, 801, 892, 752, 948, 176, 92, 469, 595, 642, 686, 729, 872, 547, 443, 50, 746, 13, 102, 548, 158, 155, 73, 114, 77, 204, 544, 484, 565, 190, 310, 210, 726, 347, 2, 665, 800, 749, 751, 600, 580, 942, 198, 886, 15, 607, 439, 725, 279, 345, 183, 104, 696, 699, 631, 562, 654, 79, 518, 77, 469, 806, 525, 487, 84, 707, 880, 21, 463, 696, 212, 877, 697, 538, 207, 832, 793, 906, 666, 376, 745, 906, 650, 861, 804, 113, 403, 541, 37, 891, 756, 612, 378, 623, 414, 729, 737, 132, 891, 526, 876, 93, 513, 633, 441, 583, 771, 616, 880, 713]]) == [62686, 62036, 60462, 59289, 58811, 58297, 57289, 56228, 55064, 53944, 53090, 51853, 51098, 50305, 48807, 47114, 45470, 43770, 42646, 42378, 41817, 40753, 39516, 38188, 36773, 35172, 33753, 32763, 32270, 31474, 30715, 30600, 29950, 29244, 28931, 28703, 28516, 28325, 28044, 27296, 26268, 25219, 24464, 23964, 23444, 22508, 21435, 21086, 20419, 18954, 17405, 15905, 14554, 13374, 11852, 10712, 9628, 8727, 8105, 7059, 5895, 4891, 4267, 3739, 3452, 2652, 1257, 73, 1266, 2482, 3215, 3812, 4407, 4953, 6228, 7559, 8571, 9142, 9933, 11520, 12421, 12905, 14064, 14972, 16061, 17635, 18870, 19615, 20654, 22279, 23978, 25550, 26592, 27713, 29364, 30920, 32431, 34096, 35013, 35529, 36473, 37051, 37979, 39626, 40994, 41984, 42985, 44022, 45165, 46631, 47500, 48523, 49940, 51342, 52311, 52917, 54063, 55137, 56161, 57515, 58902, 60398, 61991]\nassert my_solution.leftRightDifference(**[[14, 13, 17, 14, 12, 15, 6, 32, 11, 14, 17, 23, 33, 8, 27, 19, 7, 10, 12, 14, 14, 24, 18, 15, 9, 14, 19, 18, 15, 20, 18, 9, 26, 29, 26, 21, 7, 13, 3, 10, 9, 15, 12, 30, 18, 31, 10, 23, 1, 32, 26, 5, 30, 25, 2, 17, 26, 17, 20, 19, 24, 31, 24, 1, 18, 25, 29, 17, 9, 3, 29, 23, 17, 18, 18, 18, 30, 8, 33, 19, 19, 24, 26, 25, 9, 31, 1, 29, 29, 29, 19, 4, 11, 7, 24, 12, 24, 14, 30, 28, 11, 11, 29, 18, 2, 6, 32, 27, 12, 17, 3, 31, 15, 18, 18, 2, 27, 24, 6, 21, 30, 29, 8, 23, 18, 6, 14, 21, 2, 32, 32, 33, 16, 29, 28, 17, 20, 6, 26, 6, 23, 27, 17, 16, 4, 28, 5, 27, 13, 7, 23, 27, 11, 5, 16, 20, 16, 27, 5, 12, 24, 7, 13, 13, 2, 4, 25, 9, 19, 33, 23, 13, 26, 22, 24, 13, 20, 6, 16, 8, 26, 8, 1, 1, 2, 25, 7, 4, 31, 5, 30, 1, 9, 27, 14, 23, 3, 28, 19, 6, 3, 28, 31, 5, 2, 19, 26, 27, 3, 23, 10, 20, 33, 8, 6, 28, 12, 30, 6, 21, 14, 31, 11, 14, 6, 12, 17, 17, 2, 27, 30, 28, 24, 20, 4, 15, 22, 13, 23, 31, 25, 3, 17, 9, 14, 4, 7, 15, 10, 25, 7, 6, 4, 9, 14, 17, 10, 28, 10, 18, 18, 3, 24, 14, 11, 13, 32, 31, 32, 12, 24, 9, 32, 8, 20, 33, 5, 30, 20, 26, 30, 30, 32, 31, 33, 23, 4, 29, 22, 8, 8, 11, 21, 9, 2, 19, 30, 27, 10, 27, 22, 23, 14, 18, 7, 31, 3, 32, 25, 21, 22, 26, 14, 1, 21, 29, 31, 28, 2, 4, 16, 33, 3, 6, 22, 15, 24, 32, 14, 18, 23, 27, 8, 27, 25, 32, 9, 18, 2, 26, 15, 3, 2, 33, 6, 11, 27, 7, 5, 7, 26, 13, 8, 32, 30, 23, 2, 12, 12, 19, 20, 28, 8, 24, 14, 2, 22, 26, 1, 14, 27, 22, 26, 25, 21, 21, 16, 21, 32, 5, 10, 29, 33, 11, 33, 19, 29, 20, 8, 12, 13, 28, 9, 12, 3, 1, 17, 22, 1, 27, 18, 31, 9, 6, 14, 32, 28, 19, 24, 32, 16, 12, 16, 21, 14, 26, 5, 22, 6, 15, 20, 16, 15, 32, 27, 19, 12, 22, 9, 33, 17, 4, 4, 32, 11, 12, 20, 33, 1, 13, 32, 19, 33, 30, 32, 8, 10, 1, 23, 6, 28, 19, 20, 12, 10, 20, 22, 29, 5, 7]]) == [8034, 8007, 7977, 7946, 7920, 7893, 7872, 7834, 7791, 7766, 7735, 7695, 7639, 7598, 7563, 7517, 7491, 7474, 7452, 7426, 7398, 7360, 7318, 7285, 7261, 7238, 7205, 7168, 7135, 7100, 7062, 7035, 7000, 6945, 6890, 6843, 6815, 6795, 6779, 6766, 6747, 6723, 6696, 6654, 6606, 6557, 6516, 6483, 6459, 6426, 6368, 6337, 6302, 6247, 6220, 6201, 6158, 6115, 6078, 6039, 5996, 5941, 5886, 5861, 5842, 5799, 5745, 5699, 5673, 5661, 5629, 5577, 5537, 5502, 5466, 5430, 5382, 5344, 5303, 5251, 5213, 5170, 5120, 5069, 5035, 4995, 4963, 4933, 4875, 4817, 4769, 4746, 4731, 4713, 4682, 4646, 4610, 4572, 4528, 4470, 4431, 4409, 4369, 4322, 4302, 4294, 4256, 4197, 4158, 4129, 4109, 4075, 4029, 3996, 3960, 3940, 3911, 3860, 3830, 3803, 3752, 3693, 3656, 3625, 3584, 3560, 3540, 3505, 3482, 3448, 3384, 3319, 3270, 3225, 3168, 3123, 3086, 3060, 3028, 2996, 2967, 2917, 2873, 2840, 2820, 2788, 2755, 2723, 2683, 2663, 2633, 2583, 2545, 2529, 2508, 2472, 2436, 2393, 2361, 2344, 2308, 2277, 2257, 2231, 2216, 2210, 2181, 2147, 2119, 2067, 2011, 1975, 1936, 1888, 1842, 1805, 1772, 1746, 1724, 1700, 1666, 1632, 1623, 1621, 1618, 1591, 1559, 1548, 1513, 1477, 1442, 1411, 1401, 1365, 1324, 1287, 1261, 1230, 1183, 1158, 1149, 1118, 1059, 1023, 1016, 995, 950, 897, 867, 841, 808, 778, 725, 684, 670, 636, 596, 554, 518, 491, 456, 411, 369, 344, 324, 306, 277, 243, 224, 195, 138, 80, 28, 16, 40, 59, 96, 131, 167, 221, 277, 305, 325, 351, 374, 392, 403, 425, 450, 485, 517, 530, 540, 553, 576, 607, 634, 672, 710, 738, 774, 795, 822, 860, 885, 909, 954, 1017, 1080, 1124, 1160, 1193, 1234, 1274, 1302, 1355, 1393, 1428, 1478, 1524, 1580, 1640, 1702, 1765, 1829, 1885, 1912, 1945, 1996, 2026, 2042, 2061, 2093, 2123, 2134, 2155, 2204, 2261, 2298, 2335, 2384, 2429, 2466, 2498, 2523, 2561, 2595, 2630, 2687, 2733, 2776, 2824, 2864, 2879, 2901, 2951, 3011, 3070, 3100, 3106, 3126, 3175, 3211, 3220, 3248, 3285, 3324, 3380, 3426, 3458, 3499, 3549, 3584, 3619, 3671, 3728, 3769, 3796, 3816, 3844, 3885, 3903, 3908, 3943, 3982, 3999, 4037, 4071, 4083, 4095, 4128, 4167, 4188, 4228, 4290, 4343, 4368, 4382, 4406, 4437, 4476, 4524, 4560, 4592, 4630, 4646, 4670, 4718, 4745, 4760, 4801, 4850, 4898, 4949, 4995, 5037, 5074, 5111, 5164, 5201, 5216, 5255, 5317, 5361, 5405, 5457, 5505, 5554, 5582, 5602, 5627, 5668, 5705, 5726, 5741, 5745, 5763, 5802, 5825, 5853, 5898, 5947, 5987, 6002, 6022, 6068, 6128, 6175, 6218, 6274, 6322, 6350, 6378, 6415, 6450, 6490, 6521, 6548, 6576, 6597, 6632, 6668, 6699, 6746, 6805, 6851, 6882, 6916, 6947, 6989, 7039, 7060, 7068, 7104, 7147, 7170, 7202, 7255, 7289, 7303, 7348, 7399, 7451, 7514, 7576, 7616, 7634, 7645, 7669, 7698, 7732, 7779, 7818, 7850, 7872, 7902, 7944, 7995, 8029, 8041]\nassert my_solution.leftRightDifference(**[[1, 8, 20, 25, 11, 1, 26, 19, 11, 25, 8, 14, 26, 24, 27, 23, 14, 22, 17, 11, 17, 15, 9, 3, 9, 10, 1, 12, 11, 18, 19, 13, 17, 19, 17, 20, 2, 14, 11, 7, 17, 10, 14, 15, 18, 22, 25, 13, 4, 26, 22, 20, 27, 13, 17, 19, 24, 20, 1, 15, 1, 19, 21, 18, 5, 23, 10, 24, 26, 12, 22, 12, 2, 26, 16, 7, 25, 17, 12, 22, 27, 4, 26, 5, 17, 25, 20, 12, 15, 14, 6, 12, 1, 16, 27, 12, 15, 23, 17, 5, 6, 23, 25, 28, 14, 21, 14, 23, 10, 22, 5, 6, 21, 20, 24, 17, 25, 18, 5, 12, 15, 28, 14, 28, 9, 15, 17, 26, 6, 19, 20, 24, 28, 19, 4, 22, 2, 17, 13, 15, 3, 26, 6, 7, 24, 16, 27, 7, 9, 23, 17, 10, 4, 3, 12, 9, 13, 2, 23, 9, 17, 26, 21, 25, 13, 25, 15, 1, 23, 24, 1, 2, 20, 16, 10, 26, 26, 22, 15, 15, 13, 11, 10, 6, 12, 19, 28, 15, 18, 9, 8, 9, 18, 22, 17, 3, 16, 9, 1, 21, 18, 13, 16, 7]]) == [3129, 3120, 3092, 3047, 3011, 2999, 2972, 2927, 2897, 2861, 2828, 2806, 2766, 2716, 2665, 2615, 2578, 2542, 2503, 2475, 2447, 2415, 2391, 2379, 2367, 2348, 2337, 2324, 2301, 2272, 2235, 2203, 2173, 2137, 2101, 2064, 2042, 2026, 2001, 1983, 1959, 1932, 1908, 1879, 1846, 1806, 1759, 1721, 1704, 1674, 1626, 1584, 1537, 1497, 1467, 1431, 1388, 1344, 1323, 1307, 1291, 1271, 1231, 1192, 1169, 1141, 1108, 1074, 1024, 986, 952, 918, 904, 876, 834, 811, 779, 737, 708, 674, 625, 594, 564, 533, 511, 469, 424, 392, 365, 336, 316, 298, 285, 268, 225, 186, 159, 121, 81, 59, 48, 19, 29, 82, 124, 159, 194, 231, 264, 296, 323, 334, 361, 402, 446, 487, 529, 572, 595, 612, 639, 682, 724, 766, 803, 827, 859, 902, 934, 959, 998, 1042, 1094, 1141, 1164, 1190, 1214, 1233, 1263, 1291, 1309, 1338, 1370, 1383, 1414, 1454, 1497, 1531, 1547, 1579, 1619, 1646, 1660, 1667, 1682, 1703, 1725, 1740, 1765, 1797, 1823, 1866, 1913, 1959, 1997, 2035, 2075, 2091, 2115, 2162, 2187, 2190, 2212, 2248, 2274, 2310, 2362, 2410, 2447, 2477, 2505, 2529, 2550, 2566, 2584, 2615, 2662, 2705, 2738, 2765, 2782, 2799, 2826, 2866, 2905, 2925, 2944, 2969, 2979, 3001, 3040, 3071, 3100, 3123]\n"}, "labels": {"questionId": "2714", "questionFrontendId": "2574", "questionTitle": "Left and Right Sum Differences", "stats": {"totalAccepted": "13.6K", "totalSubmission": "16.2K", "totalAcceptedRaw": 13571, "totalSubmissionRaw": 16194, "acRate": "83.8%"}, "probedCases": [{"inputs": [[10, 4, 8, 3]], "output": [15, 1, 11, 22]}, {"inputs": [[1]], "output": [0]}, {"inputs": [[7, 3, 21, 31]], "output": [55, 45, 21, 31]}, {"inputs": [[33, 17, 58, 42]], "output": [117, 67, 8, 108]}, {"inputs": [[8, 28, 35, 21, 13, 21, 72, 35, 52, 74]], "output": [351, 315, 252, 196, 162, 128, 35, 72, 159, 285]}, {"inputs": [[25, 65, 77, 1, 73, 32, 43, 68, 8]], "output": [367, 277, 135, 57, 17, 122, 197, 308, 384]}, {"inputs": [[50, 57, 42]], "output": [99, 8, 107]}, {"inputs": [[70, 18, 64, 12, 21, 21, 78, 36, 58, 88, 58, 99, 26, 92, 91, 53, 10, 24, 25, 20, 107, 92, 73, 63, 51, 65, 87, 6, 17, 103, 111, 32, 14, 42, 46, 65, 43, 9, 75, 76, 25, 96, 46, 85, 19, 29, 88, 2, 5, 24, 60, 26, 76, 24, 110, 96, 82, 97, 97, 72, 35, 21, 77, 82, 30, 94, 55, 76, 94, 112, 105, 51, 82, 3, 89, 52, 96, 72, 27, 59, 57, 97, 6, 46, 88, 112, 41, 110, 52]], "output": [5151, 5063, 4981, 4905, 4872, 4830, 4731, 4617, 4523, 4377, 4231, 4074, 3949, 3831, 3648, 3504, 3441, 3407, 3358, 3313, 3186, 2987, 2822, 2686, 2572, 2456, 2304, 2211, 2188, 2068, 1854, 1711, 1665, 1609, 1521, 1410, 1302, 1250, 1166, 1015, 914, 793, 651, 520, 416, 368, 251, 161, 154, 125, 41, 45, 147, 247, 381, 587, 765, 944, 1138, 1307, 1414, 1470, 1568, 1727, 1839, 1963, 2112, 2243, 2413, 2619, 2836, 2992, 3125, 3210, 3302, 3443, 3591, 3759, 3858, 3944, 4060, 4214, 4317, 4369, 4503, 4703, 4856, 5007, 5169]}, {"inputs": [[182, 15, 65, 7, 21, 247, 274, 38, 250, 94, 4, 282, 219, 182, 16, 241, 312, 81, 207, 330, 306, 166, 82, 290, 7, 317, 218, 251, 198, 171, 247, 56, 330, 240, 261, 67, 65, 138, 181, 308, 26, 59, 150, 137, 244, 136, 116, 272, 138, 34, 72, 328, 312, 159, 32, 283, 6, 234, 280, 46, 289, 48, 218, 234, 284, 195, 188, 181, 259, 145, 96, 298, 322, 213, 154, 278, 292, 315, 191, 177, 228, 291, 204, 310, 266, 309, 178, 7, 327, 319, 295, 136, 215, 260, 259, 35, 248]], "output": [18112, 17915, 17835, 17763, 17735, 17467, 16946, 16634, 16346, 16002, 15904, 15618, 15117, 14716, 14518, 14261, 13708, 13315, 13027, 12490, 11854, 11382, 11134, 10762, 10465, 10141, 9606, 9137, 8688, 8319, 7901, 7598, 7212, 6642, 6141, 5813, 5681, 5478, 5159, 4670, 4336, 4251, 4042, 3755, 3374, 2994, 2742, 2354, 1944, 1772, 1666, 1266, 626, 155, 36, 351, 640, 880, 1394, 1720, 2055, 2392, 2658, 3110, 3628, 4107, 4490, 4859, 5299, 5703, 5944, 6338, 6958, 7493, 7860, 8292, 8862, 9469, 9975, 10343, 10748, 11267, 11762, 12276, 12852, 13427, 13914, 14099, 14433, 15079, 15693, 16124, 16475, 16950, 17469, 17763, 18046]}, {"inputs": [[680, 753, 287, 496, 166, 300, 126, 96, 537, 394, 634, 270, 72, 688, 158, 534, 746, 520, 649, 318, 632, 592, 732, 670, 291, 151, 128, 680, 158, 631, 196, 707, 439, 534, 666, 22, 626, 299, 121, 346, 11, 426, 459, 748, 551, 561, 110, 192, 103, 165, 111, 138, 665, 289, 12, 99, 201, 432, 653, 239, 418, 575]], "output": [23523, 22090, 21050, 20267, 19605, 19139, 18713, 18491, 17858, 16927, 15899, 14995, 14653, 13893, 13047, 12355, 11075, 9809, 8640, 7673, 6723, 5499, 4175, 2773, 1812, 1370, 1091, 283, 555, 1344, 2171, 3074, 4220, 5193, 6393, 7081, 7729, 8654, 9074, 9541, 9898, 10335, 11220, 12427, 13726, 14838, 15509, 15811, 16106, 16374, 16650, 16899, 17702, 18656, 18957, 19068, 19368, 20001, 21086, 21978, 22635, 23628]}, {"inputs": [[441, 751, 571, 815, 535, 818, 301, 106, 633, 734, 836, 515, 673, 559, 464, 644, 305, 337, 242, 421, 342, 690, 152, 739, 816, 901, 529, 851, 213, 90, 640, 301, 747, 735, 536, 428, 816, 442, 156, 660, 680, 617, 659, 676, 791, 673, 569, 414, 254, 185, 42, 21, 708, 798, 22, 40, 18, 433, 743, 6, 103, 697, 372, 824, 382, 365, 500, 725, 441, 839, 22, 439, 320, 738, 769, 290, 243, 247]], "output": [37709, 36517, 35195, 33809, 32459, 31106, 29987, 29580, 28841, 27474, 25904, 24553, 23365, 22133, 21110, 20002, 19053, 18411, 17832, 17169, 16406, 15374, 14532, 13641, 12086, 10369, 8939, 7559, 6495, 6192, 5462, 4521, 3473, 1991, 720, 244, 1488, 2746, 3344, 4160, 5500, 6797, 8073, 9408, 10875, 12339, 13581, 14564, 15232, 15671, 15898, 15961, 16690, 18196, 19016, 19078, 19136, 19587, 20763, 21512, 21621, 22421, 23490, 24686, 25892, 26639, 27504, 28729, 29895, 31175, 32036, 32497, 33256, 34314, 35821, 36880, 37413, 37903]}, {"inputs": [[147, 231, 162, 37, 293, 160, 68, 232, 232, 130, 309, 211, 4, 58, 175, 296, 222, 161, 190, 283, 137, 227, 284, 134, 170, 13, 275, 113, 148, 198, 33, 260, 6, 154, 166, 234, 175, 301, 24, 205, 115, 4, 40, 105, 311, 221, 247, 34, 190, 23, 289, 16, 129, 68, 12, 32, 111, 49, 287, 168, 111, 222, 20, 212, 140, 307, 4, 262, 228, 161, 200, 108, 206]], "output": [11343, 10965, 10572, 10373, 10043, 9590, 9362, 9062, 8598, 8236, 7797, 7277, 7062, 7000, 6767, 6296, 5778, 5395, 5044, 4571, 4151, 3787, 3276, 2858, 2554, 2371, 2083, 1695, 1434, 1088, 857, 564, 298, 138, 182, 582, 991, 1467, 1792, 2021, 2341, 2460, 2504, 2649, 3065, 3597, 4065, 4346, 4570, 4783, 5095, 5400, 5545, 5742, 5822, 5866, 6009, 6169, 6505, 6960, 7239, 7572, 7814, 8046, 8398, 8845, 9156, 9422, 9912, 10301, 10662, 10970, 11284]}, {"inputs": [[140, 133, 120, 129, 97, 167, 164, 61, 90, 123, 90, 64, 141, 122, 122, 122, 46, 94, 67, 42, 11, 129, 50, 39, 119, 42, 21, 109, 44, 165, 124, 23, 125, 82, 66, 183, 26, 183, 115, 170, 121, 10, 91, 52, 49, 71, 53, 23, 60, 25, 103, 59, 32, 87, 44, 113, 65, 51, 152, 27, 133, 48, 179, 144, 74, 59, 166, 24, 87]], "output": [6022, 5749, 5496, 5247, 5021, 4757, 4426, 4201, 4050, 3837, 3624, 3470, 3265, 3002, 2758, 2514, 2346, 2206, 2045, 1936, 1883, 1743, 1564, 1475, 1317, 1156, 1093, 963, 810, 601, 312, 165, 17, 190, 338, 587, 796, 1005, 1303, 1588, 1879, 2010, 2111, 2254, 2355, 2475, 2599, 2675, 2758, 2843, 2971, 3133, 3224, 3343, 3474, 3631, 3809, 3925, 4128, 4307, 4467, 4648, 4875, 5198, 5416, 5549, 5774, 5964, 6075]}, {"inputs": [[8, 19, 10, 6, 26, 4, 2, 29, 34, 26, 18, 3, 29, 24, 31, 24, 26, 1, 24, 8, 5, 6, 30, 21, 6, 30, 35, 32, 11, 14, 18, 8, 14, 21, 11, 22, 16, 32, 1, 7, 24, 36, 23, 37, 16, 21, 9, 11, 20, 11, 6, 19, 32, 29, 12, 29, 17, 9, 1, 29, 30, 36, 5, 31, 26, 18, 6, 12, 7, 27, 17, 29, 3, 26, 14, 37, 37, 24, 15, 12, 1, 37, 19, 11, 18, 33, 6, 37, 15, 23, 12, 18]], "output": [1717, 1690, 1661, 1645, 1613, 1583, 1577, 1546, 1483, 1423, 1379, 1358, 1326, 1273, 1218, 1163, 1113, 1086, 1061, 1029, 1016, 1005, 969, 918, 891, 855, 790, 723, 680, 655, 623, 597, 575, 540, 508, 475, 437, 389, 356, 348, 317, 257, 198, 138, 85, 48, 18, 2, 33, 64, 81, 106, 157, 218, 259, 300, 346, 372, 382, 412, 471, 537, 578, 614, 671, 715, 739, 757, 776, 810, 854, 900, 932, 961, 1001, 1052, 1126, 1187, 1226, 1253, 1266, 1304, 1360, 1390, 1419, 1470, 1509, 1552, 1604, 1642, 1677, 1707]}, {"inputs": [[420, 510, 361, 432, 509, 379, 416, 591, 376, 418, 402, 226, 244, 411, 92, 75, 137, 351, 224, 450, 219, 326, 199, 154, 23, 248, 219, 467, 403, 1]], "output": [8863, 7933, 7062, 6269, 5328, 4440, 3645, 2638, 1671, 877, 57, 571, 1041, 1696, 2199, 2366, 2578, 3066, 3641, 4315, 4984, 5529, 6054, 6407, 6584, 6855, 7322, 8008, 8878, 9282]}, {"inputs": [[777, 582, 830, 666, 84, 797, 798, 600, 841, 469, 605, 12, 205, 391, 877, 622, 287, 13, 553, 506, 192, 271, 501, 816, 889, 162, 390, 342, 279, 145, 3, 168, 84, 469, 304, 372, 7, 276, 587, 459, 441, 890, 852]], "output": [18637, 17278, 15866, 14370, 13620, 12739, 11144, 9746, 8305, 6995, 5921, 5304, 5087, 4491, 3223, 1724, 815, 515, 51, 1110, 1808, 2271, 3043, 4360, 6065, 7116, 7668, 8400, 9021, 9445, 9593, 9764, 10016, 10569, 11342, 12018, 12397, 12680, 13543, 14589, 15489, 16820, 18562]}, {"inputs": [[108, 150, 12, 40, 97, 39, 183, 26, 59, 63, 177, 97, 20, 71, 73, 100, 50, 129, 81, 61, 28, 40, 118, 84, 86, 114, 145, 90, 59, 154, 33, 76, 39, 21, 34, 130, 109, 169, 148, 63, 168, 62, 122, 156, 29, 104, 130, 128, 15, 122, 33, 6, 143, 16, 179, 110, 109, 45, 88, 173, 67, 37, 59, 88, 25, 53, 162, 2, 124, 35, 141, 174]], "output": [6173, 5915, 5753, 5701, 5564, 5428, 5206, 4997, 4912, 4790, 4550, 4276, 4159, 4068, 3924, 3751, 3601, 3422, 3212, 3070, 2981, 2913, 2755, 2553, 2383, 2183, 1924, 1689, 1540, 1327, 1140, 1031, 916, 856, 801, 637, 398, 120, 197, 408, 639, 869, 1053, 1331, 1516, 1649, 1883, 2141, 2284, 2421, 2576, 2615, 2764, 2923, 3118, 3407, 3626, 3780, 3913, 4174, 4414, 4518, 4614, 4761, 4874, 4952, 5167, 5331, 5457, 5616, 5792, 6107]}, {"inputs": [[18, 632, 942, 231, 247, 267, 741, 320, 844, 276, 578, 659, 96, 697, 801, 892, 752, 948, 176, 92, 469, 595, 642, 686, 729, 872, 547, 443, 50, 746, 13, 102, 548, 158, 155, 73, 114, 77, 204, 544, 484, 565, 190, 310, 210, 726, 347, 2, 665, 800, 749, 751, 600, 580, 942, 198, 886, 15, 607, 439, 725, 279, 345, 183, 104, 696, 699, 631, 562, 654, 79, 518, 77, 469, 806, 525, 487, 84, 707, 880, 21, 463, 696, 212, 877, 697, 538, 207, 832, 793, 906, 666, 376, 745, 906, 650, 861, 804, 113, 403, 541, 37, 891, 756, 612, 378, 623, 414, 729, 737, 132, 891, 526, 876, 93, 513, 633, 441, 583, 771, 616, 880, 713]], "output": [62686, 62036, 60462, 59289, 58811, 58297, 57289, 56228, 55064, 53944, 53090, 51853, 51098, 50305, 48807, 47114, 45470, 43770, 42646, 42378, 41817, 40753, 39516, 38188, 36773, 35172, 33753, 32763, 32270, 31474, 30715, 30600, 29950, 29244, 28931, 28703, 28516, 28325, 28044, 27296, 26268, 25219, 24464, 23964, 23444, 22508, 21435, 21086, 20419, 18954, 17405, 15905, 14554, 13374, 11852, 10712, 9628, 8727, 8105, 7059, 5895, 4891, 4267, 3739, 3452, 2652, 1257, 73, 1266, 2482, 3215, 3812, 4407, 4953, 6228, 7559, 8571, 9142, 9933, 11520, 12421, 12905, 14064, 14972, 16061, 17635, 18870, 19615, 20654, 22279, 23978, 25550, 26592, 27713, 29364, 30920, 32431, 34096, 35013, 35529, 36473, 37051, 37979, 39626, 40994, 41984, 42985, 44022, 45165, 46631, 47500, 48523, 49940, 51342, 52311, 52917, 54063, 55137, 56161, 57515, 58902, 60398, 61991]}, {"inputs": [[14, 13, 17, 14, 12, 15, 6, 32, 11, 14, 17, 23, 33, 8, 27, 19, 7, 10, 12, 14, 14, 24, 18, 15, 9, 14, 19, 18, 15, 20, 18, 9, 26, 29, 26, 21, 7, 13, 3, 10, 9, 15, 12, 30, 18, 31, 10, 23, 1, 32, 26, 5, 30, 25, 2, 17, 26, 17, 20, 19, 24, 31, 24, 1, 18, 25, 29, 17, 9, 3, 29, 23, 17, 18, 18, 18, 30, 8, 33, 19, 19, 24, 26, 25, 9, 31, 1, 29, 29, 29, 19, 4, 11, 7, 24, 12, 24, 14, 30, 28, 11, 11, 29, 18, 2, 6, 32, 27, 12, 17, 3, 31, 15, 18, 18, 2, 27, 24, 6, 21, 30, 29, 8, 23, 18, 6, 14, 21, 2, 32, 32, 33, 16, 29, 28, 17, 20, 6, 26, 6, 23, 27, 17, 16, 4, 28, 5, 27, 13, 7, 23, 27, 11, 5, 16, 20, 16, 27, 5, 12, 24, 7, 13, 13, 2, 4, 25, 9, 19, 33, 23, 13, 26, 22, 24, 13, 20, 6, 16, 8, 26, 8, 1, 1, 2, 25, 7, 4, 31, 5, 30, 1, 9, 27, 14, 23, 3, 28, 19, 6, 3, 28, 31, 5, 2, 19, 26, 27, 3, 23, 10, 20, 33, 8, 6, 28, 12, 30, 6, 21, 14, 31, 11, 14, 6, 12, 17, 17, 2, 27, 30, 28, 24, 20, 4, 15, 22, 13, 23, 31, 25, 3, 17, 9, 14, 4, 7, 15, 10, 25, 7, 6, 4, 9, 14, 17, 10, 28, 10, 18, 18, 3, 24, 14, 11, 13, 32, 31, 32, 12, 24, 9, 32, 8, 20, 33, 5, 30, 20, 26, 30, 30, 32, 31, 33, 23, 4, 29, 22, 8, 8, 11, 21, 9, 2, 19, 30, 27, 10, 27, 22, 23, 14, 18, 7, 31, 3, 32, 25, 21, 22, 26, 14, 1, 21, 29, 31, 28, 2, 4, 16, 33, 3, 6, 22, 15, 24, 32, 14, 18, 23, 27, 8, 27, 25, 32, 9, 18, 2, 26, 15, 3, 2, 33, 6, 11, 27, 7, 5, 7, 26, 13, 8, 32, 30, 23, 2, 12, 12, 19, 20, 28, 8, 24, 14, 2, 22, 26, 1, 14, 27, 22, 26, 25, 21, 21, 16, 21, 32, 5, 10, 29, 33, 11, 33, 19, 29, 20, 8, 12, 13, 28, 9, 12, 3, 1, 17, 22, 1, 27, 18, 31, 9, 6, 14, 32, 28, 19, 24, 32, 16, 12, 16, 21, 14, 26, 5, 22, 6, 15, 20, 16, 15, 32, 27, 19, 12, 22, 9, 33, 17, 4, 4, 32, 11, 12, 20, 33, 1, 13, 32, 19, 33, 30, 32, 8, 10, 1, 23, 6, 28, 19, 20, 12, 10, 20, 22, 29, 5, 7]], "output": [8034, 8007, 7977, 7946, 7920, 7893, 7872, 7834, 7791, 7766, 7735, 7695, 7639, 7598, 7563, 7517, 7491, 7474, 7452, 7426, 7398, 7360, 7318, 7285, 7261, 7238, 7205, 7168, 7135, 7100, 7062, 7035, 7000, 6945, 6890, 6843, 6815, 6795, 6779, 6766, 6747, 6723, 6696, 6654, 6606, 6557, 6516, 6483, 6459, 6426, 6368, 6337, 6302, 6247, 6220, 6201, 6158, 6115, 6078, 6039, 5996, 5941, 5886, 5861, 5842, 5799, 5745, 5699, 5673, 5661, 5629, 5577, 5537, 5502, 5466, 5430, 5382, 5344, 5303, 5251, 5213, 5170, 5120, 5069, 5035, 4995, 4963, 4933, 4875, 4817, 4769, 4746, 4731, 4713, 4682, 4646, 4610, 4572, 4528, 4470, 4431, 4409, 4369, 4322, 4302, 4294, 4256, 4197, 4158, 4129, 4109, 4075, 4029, 3996, 3960, 3940, 3911, 3860, 3830, 3803, 3752, 3693, 3656, 3625, 3584, 3560, 3540, 3505, 3482, 3448, 3384, 3319, 3270, 3225, 3168, 3123, 3086, 3060, 3028, 2996, 2967, 2917, 2873, 2840, 2820, 2788, 2755, 2723, 2683, 2663, 2633, 2583, 2545, 2529, 2508, 2472, 2436, 2393, 2361, 2344, 2308, 2277, 2257, 2231, 2216, 2210, 2181, 2147, 2119, 2067, 2011, 1975, 1936, 1888, 1842, 1805, 1772, 1746, 1724, 1700, 1666, 1632, 1623, 1621, 1618, 1591, 1559, 1548, 1513, 1477, 1442, 1411, 1401, 1365, 1324, 1287, 1261, 1230, 1183, 1158, 1149, 1118, 1059, 1023, 1016, 995, 950, 897, 867, 841, 808, 778, 725, 684, 670, 636, 596, 554, 518, 491, 456, 411, 369, 344, 324, 306, 277, 243, 224, 195, 138, 80, 28, 16, 40, 59, 96, 131, 167, 221, 277, 305, 325, 351, 374, 392, 403, 425, 450, 485, 517, 530, 540, 553, 576, 607, 634, 672, 710, 738, 774, 795, 822, 860, 885, 909, 954, 1017, 1080, 1124, 1160, 1193, 1234, 1274, 1302, 1355, 1393, 1428, 1478, 1524, 1580, 1640, 1702, 1765, 1829, 1885, 1912, 1945, 1996, 2026, 2042, 2061, 2093, 2123, 2134, 2155, 2204, 2261, 2298, 2335, 2384, 2429, 2466, 2498, 2523, 2561, 2595, 2630, 2687, 2733, 2776, 2824, 2864, 2879, 2901, 2951, 3011, 3070, 3100, 3106, 3126, 3175, 3211, 3220, 3248, 3285, 3324, 3380, 3426, 3458, 3499, 3549, 3584, 3619, 3671, 3728, 3769, 3796, 3816, 3844, 3885, 3903, 3908, 3943, 3982, 3999, 4037, 4071, 4083, 4095, 4128, 4167, 4188, 4228, 4290, 4343, 4368, 4382, 4406, 4437, 4476, 4524, 4560, 4592, 4630, 4646, 4670, 4718, 4745, 4760, 4801, 4850, 4898, 4949, 4995, 5037, 5074, 5111, 5164, 5201, 5216, 5255, 5317, 5361, 5405, 5457, 5505, 5554, 5582, 5602, 5627, 5668, 5705, 5726, 5741, 5745, 5763, 5802, 5825, 5853, 5898, 5947, 5987, 6002, 6022, 6068, 6128, 6175, 6218, 6274, 6322, 6350, 6378, 6415, 6450, 6490, 6521, 6548, 6576, 6597, 6632, 6668, 6699, 6746, 6805, 6851, 6882, 6916, 6947, 6989, 7039, 7060, 7068, 7104, 7147, 7170, 7202, 7255, 7289, 7303, 7348, 7399, 7451, 7514, 7576, 7616, 7634, 7645, 7669, 7698, 7732, 7779, 7818, 7850, 7872, 7902, 7944, 7995, 8029, 8041]}, {"inputs": [[1, 8, 20, 25, 11, 1, 26, 19, 11, 25, 8, 14, 26, 24, 27, 23, 14, 22, 17, 11, 17, 15, 9, 3, 9, 10, 1, 12, 11, 18, 19, 13, 17, 19, 17, 20, 2, 14, 11, 7, 17, 10, 14, 15, 18, 22, 25, 13, 4, 26, 22, 20, 27, 13, 17, 19, 24, 20, 1, 15, 1, 19, 21, 18, 5, 23, 10, 24, 26, 12, 22, 12, 2, 26, 16, 7, 25, 17, 12, 22, 27, 4, 26, 5, 17, 25, 20, 12, 15, 14, 6, 12, 1, 16, 27, 12, 15, 23, 17, 5, 6, 23, 25, 28, 14, 21, 14, 23, 10, 22, 5, 6, 21, 20, 24, 17, 25, 18, 5, 12, 15, 28, 14, 28, 9, 15, 17, 26, 6, 19, 20, 24, 28, 19, 4, 22, 2, 17, 13, 15, 3, 26, 6, 7, 24, 16, 27, 7, 9, 23, 17, 10, 4, 3, 12, 9, 13, 2, 23, 9, 17, 26, 21, 25, 13, 25, 15, 1, 23, 24, 1, 2, 20, 16, 10, 26, 26, 22, 15, 15, 13, 11, 10, 6, 12, 19, 28, 15, 18, 9, 8, 9, 18, 22, 17, 3, 16, 9, 1, 21, 18, 13, 16, 7]], "output": [3129, 3120, 3092, 3047, 3011, 2999, 2972, 2927, 2897, 2861, 2828, 2806, 2766, 2716, 2665, 2615, 2578, 2542, 2503, 2475, 2447, 2415, 2391, 2379, 2367, 2348, 2337, 2324, 2301, 2272, 2235, 2203, 2173, 2137, 2101, 2064, 2042, 2026, 2001, 1983, 1959, 1932, 1908, 1879, 1846, 1806, 1759, 1721, 1704, 1674, 1626, 1584, 1537, 1497, 1467, 1431, 1388, 1344, 1323, 1307, 1291, 1271, 1231, 1192, 1169, 1141, 1108, 1074, 1024, 986, 952, 918, 904, 876, 834, 811, 779, 737, 708, 674, 625, 594, 564, 533, 511, 469, 424, 392, 365, 336, 316, 298, 285, 268, 225, 186, 159, 121, 81, 59, 48, 19, 29, 82, 124, 159, 194, 231, 264, 296, 323, 334, 361, 402, 446, 487, 529, 572, 595, 612, 639, 682, 724, 766, 803, 827, 859, 902, 934, 959, 998, 1042, 1094, 1141, 1164, 1190, 1214, 1233, 1263, 1291, 1309, 1338, 1370, 1383, 1414, 1454, 1497, 1531, 1547, 1579, 1619, 1646, 1660, 1667, 1682, 1703, 1725, 1740, 1765, 1797, 1823, 1866, 1913, 1959, 1997, 2035, 2075, 2091, 2115, 2162, 2187, 2190, 2212, 2248, 2274, 2310, 2362, 2410, 2447, 2477, 2505, 2529, 2550, 2566, 2584, 2615, 2662, 2705, 2738, 2765, 2782, 2799, 2826, 2866, 2905, 2925, 2944, 2969, 2979, 3001, 3040, 3071, 3100, 3123]}]}} +{"id": "LeetCode/2713", "content": "# Find the Divisibility Array of a String\n\nYou are given a **0-indexed** string `word` of length `n` consisting of digits, and a positive integer `m`.\n\n\nThe **divisibility array** `div` of `word` is an integer array of length `n` such that:\n\n\n* `div[i] = 1` if the **numeric value** of `word[0,...,i]` is divisible by `m`, or\n* `div[i] = 0` otherwise.\n\n\nReturn *the divisibility array of*`word`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** word = \"998244353\", m = 3\n**Output:** [1,1,0,0,0,1,1,0,0]\n**Explanation:** There are only 4 prefixes that are divisible by 3: \"9\", \"99\", \"998244\", and \"9982443\".\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** word = \"1010\", m = 10\n**Output:** [0,1,0,1]\n**Explanation:** There are only 2 prefixes that are divisible by 10: \"10\", and \"1010\".\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 105`\n* `word.length == n`\n* `word` consists of digits from `0` to `9`\n* `1 <= m <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def divisibilityArray(self, word: str, m: int) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.divisibilityArray(**['998244353', 3]) == [1, 1, 0, 0, 0, 1, 1, 0, 0]\nassert my_solution.divisibilityArray(**['1010', 10]) == [0, 1, 0, 1]\nassert my_solution.divisibilityArray(**['529282143571', 4]) == [0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.divisibilityArray(**['86217457695827338571', 8]) == [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.divisibilityArray(**['557935154', 5]) == [1, 1, 0, 0, 0, 1, 0, 1, 0]\nassert my_solution.divisibilityArray(**['4868438856666666', 6]) == [0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]\nassert my_solution.divisibilityArray(**['50133106238031313', 3]) == [0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0]\nassert my_solution.divisibilityArray(**['18954947', 9]) == [0, 1, 1, 0, 1, 1, 0, 0]\nassert my_solution.divisibilityArray(**['18585981675', 9]) == [0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1]\nassert my_solution.divisibilityArray(**['8917171717276217174131', 17]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.divisibilityArray(**['91221181269244172125025075166510211202115152121212341281327', 21]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\nassert my_solution.divisibilityArray(**['7868205589194669874752725752302277383438913984791442994468197914214982419363653138241991147060048767', 7]) == [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0]\nassert my_solution.divisibilityArray(**['1846144763121714446244534222231', 4]) == [0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.divisibilityArray(**['1616412162147459716167458879161697161616161616169716', 16]) == [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0]\nassert my_solution.divisibilityArray(**['99279188694541449102636980112687808869272736870543', 9]) == [1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1]\nassert my_solution.divisibilityArray(**['4065582576255570359135118255554163128235573295923545700491253287387', 5]) == [0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.divisibilityArray(**['913171304401315412211278171271512225417127194015111276212919174061222302198217122291222212122252190131501919127664122251380201229125461341250019170171512', 2]) == [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]\nassert my_solution.divisibilityArray(**['641770318471366266679729826266679777211350732329811266679745308703298458572010861577626667968134562136326667976028761918809582469329982666796698426667978152666797884951266679774262666797857121803678266679750689', 266679793]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.divisibilityArray(**['576800583845489999997103018935926636901851801756528499999965070034732345369623399999997028720306907497957049999996947980048974057753028962619575676872761308199357299999954163688537365570631382714715664981969999996128389999997629868330', 999999781]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.divisibilityArray(**['6224816282262828286517286222831242828284024282620288020281720226282828127407172828282842478132828691328282828622721622924643671528283520127352028820282828282142128288202872132528282828721365001472192828212528282822695142521286222262828273166228695422282042462272142419117288202872128424226289192872128522128523919287021127282828282828289198515285075882334894340535652528127281819577189883523424491528461828284242828283252818441172194152891962228205212841481122628282', 28]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n"}, "labels": {"questionId": "2713", "questionFrontendId": "2575", "questionTitle": "Find the Divisibility Array of a String", "stats": {"totalAccepted": "8.5K", "totalSubmission": "25.5K", "totalAcceptedRaw": 8520, "totalSubmissionRaw": 25479, "acRate": "33.4%"}, "probedCases": [{"inputs": ["998244353", 3], "output": [1, 1, 0, 0, 0, 1, 1, 0, 0]}, {"inputs": ["1010", 10], "output": [0, 1, 0, 1]}, {"inputs": ["529282143571", 4], "output": [0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": ["86217457695827338571", 8], "output": [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": ["557935154", 5], "output": [1, 1, 0, 0, 0, 1, 0, 1, 0]}, {"inputs": ["4868438856666666", 6], "output": [0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]}, {"inputs": ["50133106238031313", 3], "output": [0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0]}, {"inputs": ["18954947", 9], "output": [0, 1, 1, 0, 1, 1, 0, 0]}, {"inputs": ["18585981675", 9], "output": [0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1]}, {"inputs": ["8917171717276217174131", 17], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": ["91221181269244172125025075166510211202115152121212341281327", 21], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]}, {"inputs": ["7868205589194669874752725752302277383438913984791442994468197914214982419363653138241991147060048767", 7], "output": [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0]}, {"inputs": ["1846144763121714446244534222231", 4], "output": [0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": ["1616412162147459716167458879161697161616161616169716", 16], "output": [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0]}, {"inputs": ["99279188694541449102636980112687808869272736870543", 9], "output": [1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1]}, {"inputs": ["4065582576255570359135118255554163128235573295923545700491253287387", 5], "output": [0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": ["913171304401315412211278171271512225417127194015111276212919174061222302198217122291222212122252190131501919127664122251380201229125461341250019170171512", 2], "output": [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]}, {"inputs": ["641770318471366266679729826266679777211350732329811266679745308703298458572010861577626667968134562136326667976028761918809582469329982666796698426667978152666797884951266679774262666797857121803678266679750689", 266679793], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": ["576800583845489999997103018935926636901851801756528499999965070034732345369623399999997028720306907497957049999996947980048974057753028962619575676872761308199357299999954163688537365570631382714715664981969999996128389999997629868330", 999999781], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": ["6224816282262828286517286222831242828284024282620288020281720226282828127407172828282842478132828691328282828622721622924643671528283520127352028820282828282142128288202872132528282828721365001472192828212528282822695142521286222262828273166228695422282042462272142419117288202872128424226289192872128522128523919287021127282828282828289198515285075882334894340535652528127281819577189883523424491528461828284242828283252818441172194152891962228205212841481122628282", 28], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}]}} +{"id": "LeetCode/2712", "content": "# Find the Maximum Number of Marked Indices\n\nYou are given a **0-indexed** integer array `nums`.\n\n\nInitially, all of the indices are unmarked. You are allowed to make this operation any number of times:\n\n\n* Pick two **different unmarked** indices `i` and `j` such that `2 * nums[i] <= nums[j]`, then mark `i` and `j`.\n\n\nReturn *the maximum possible number of marked indices in `nums` using the above operation any number of times*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [3,5,2,4]\n**Output:** 2\n**Explanation:** In the first operation: pick i = 2 and j = 1, the operation is allowed because 2 * nums[2] <= nums[1]. Then mark index 2 and 1.\nIt can be shown that there's no other valid operation so the answer is 2.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [9,2,5,4]\n**Output:** 4\n**Explanation:** In the first operation: pick i = 3 and j = 0, the operation is allowed because 2 * nums[3] <= nums[0]. Then mark index 3 and 0.\nIn the second operation: pick i = 1 and j = 2, the operation is allowed because 2 * nums[1] <= nums[2]. Then mark index 1 and 2.\nSince there is no other operation, the answer is 4.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** nums = [7,6,8]\n**Output:** 0\n**Explanation:** There is no valid operation to do, so the answer is 0.\n\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n \n\n\n.spoilerbutton {display:block; border:dashed; padding: 0px 0px; margin:10px 0px; font-size:150%; font-weight: bold; color:#000000; background-color:cyan; outline:0; \n}\n.spoiler {overflow:hidden;}\n.spoiler > div {-webkit-transition: all 0s ease;-moz-transition: margin 0s ease;-o-transition: all 0s ease;transition: margin 0s ease;}\n.spoilerbutton[value=\"Show Message\"] + .spoiler > div {margin-top:-500%;}\n.spoilerbutton[value=\"Hide Message\"] + .spoiler {padding:5px;}\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxNumOfMarkedIndices(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxNumOfMarkedIndices(**[[3, 5, 2, 4]]) == 2\nassert my_solution.maxNumOfMarkedIndices(**[[9, 2, 5, 4]]) == 4\nassert my_solution.maxNumOfMarkedIndices(**[[7, 6, 8]]) == 0\nassert my_solution.maxNumOfMarkedIndices(**[[1, 78, 27, 48, 14, 86, 79, 68, 77, 20, 57, 21, 18, 67, 5, 51, 70, 85, 47, 56, 22, 79, 41, 8, 39, 81, 59, 74, 14, 45, 49, 15, 10, 28, 16, 77, 22, 65, 8, 36, 79, 94, 44, 80, 72, 8, 96, 78, 39, 92, 69, 55, 9, 44, 26, 76, 40, 77, 16, 69, 40, 64, 12, 48, 66, 7, 59, 10]]) == 64\nassert my_solution.maxNumOfMarkedIndices(**[[72, 97, 60, 79, 68, 25, 63, 82, 88, 60, 37, 60, 44, 14, 62, 36, 52, 73, 26, 98, 86, 50, 74, 68, 53, 80, 90, 60, 78, 56, 53, 84, 2]]) == 14\nassert my_solution.maxNumOfMarkedIndices(**[[42, 83, 48, 10, 24, 55, 9, 100, 10, 17, 17, 99, 51, 32, 16, 98, 99, 31, 28, 68, 71, 14, 64, 29, 15, 40]]) == 26\nassert my_solution.maxNumOfMarkedIndices(**[[57, 40, 57, 51, 90, 51, 68, 100, 24, 39, 11, 85, 2, 22, 67, 29, 74, 82, 10, 96, 14, 35, 25, 76, 26, 54, 29, 44, 63, 49, 73, 50, 95, 89, 43, 62, 24, 88, 88, 36, 6, 16, 14, 2, 42, 42, 60, 25, 4, 58, 23, 22, 27, 26, 3, 79, 64, 20, 92]]) == 58\nassert my_solution.maxNumOfMarkedIndices(**[[56, 92, 98, 34, 47, 91, 91, 23, 88, 43, 53, 29, 70, 23, 77, 24, 22, 4, 79, 38, 13, 36, 94, 19, 91, 44, 8, 56, 97, 77, 93, 55, 59, 77, 8, 95, 48, 50, 59, 32, 76, 78, 31, 3, 81, 44, 5, 52, 53, 88, 86, 87, 92, 69, 58, 82, 50, 82, 34, 72, 56, 46, 35]]) == 50\nassert my_solution.maxNumOfMarkedIndices(**[[4, 16, 58, 52, 51, 53, 67, 29, 12, 42, 67, 76, 95, 51, 31, 49, 9, 72, 83, 84, 12, 85, 78, 73, 3, 48, 22, 59, 99, 63, 10, 21, 43, 77, 43, 74, 75, 27, 13, 29, 73, 13, 20, 6, 56, 75, 83, 26, 24, 53, 56, 61, 96, 57, 33, 89, 99, 93, 81, 28, 49, 80, 88, 29, 51, 26, 95, 35, 61, 31, 96, 15, 65, 87, 12, 15, 81, 38, 96, 58, 23, 85, 5, 81, 26]]) == 76\nassert my_solution.maxNumOfMarkedIndices(**[[66, 53, 92, 87, 23, 29, 53, 83, 63, 63, 25, 25, 72, 47, 34, 24, 63, 8, 43, 100, 80, 17, 72, 69, 7, 7, 32, 80, 8, 58, 70, 81, 79, 67, 66, 24, 64, 66, 9, 67, 33, 11, 62, 86, 5, 84, 78, 85, 69, 3, 92, 14, 67, 90, 31, 40, 54, 63, 99, 88, 28, 100, 5, 72, 89, 60, 90, 71, 97, 16, 7, 60, 6, 57, 73, 84, 17, 8, 77, 60, 7, 74, 74, 24, 52, 43, 94, 48, 9, 99, 84, 89, 96, 40, 15, 29, 80, 19]]) == 78\nassert my_solution.maxNumOfMarkedIndices(**[[75, 49, 27, 87, 95, 22, 28, 54, 66, 55, 99, 17, 75, 39, 90, 47, 14, 9, 63, 18, 51, 15, 50, 24, 86, 30, 44, 51, 13, 91, 95, 52, 50, 99, 38, 74, 67, 34, 75, 31, 91, 47, 6, 37, 62, 72, 42, 85, 95, 10, 8, 43, 21, 63]]) == 52\nassert my_solution.maxNumOfMarkedIndices(**[[45, 23, 69, 16, 99, 92, 5, 97, 69, 33, 44, 8, 33, 38, 60, 60, 52, 18, 97, 28, 61, 77, 27, 68, 57, 26]]) == 26\nassert my_solution.maxNumOfMarkedIndices(**[[90, 37, 51, 92, 50, 50, 93, 49, 34, 53, 3, 32, 3, 95, 80, 79, 76, 39, 35, 35, 83, 100, 84, 24, 6, 50, 97, 82, 67, 31, 99, 94, 19]]) == 28\nassert my_solution.maxNumOfMarkedIndices(**[[1, 69, 22, 35, 3, 56, 81, 80, 37, 28, 34, 59, 92, 31, 34, 19, 96, 6, 58, 98, 14, 94, 4, 95, 41, 23, 98, 26, 69, 35, 52, 92, 26, 32, 61, 60, 19, 43, 22, 59, 96, 40, 42, 59, 48, 36, 41, 14, 100, 68, 63, 42, 55, 93, 4, 55, 57, 32, 81, 75, 34, 59, 11, 98, 41, 40, 78, 21, 41, 40, 75, 3, 10, 91, 10, 3, 48, 3]]) == 78\nassert my_solution.maxNumOfMarkedIndices(**[[100, 5, 97, 36, 93, 81, 29, 80, 14, 6, 20, 95, 33, 37, 9, 49, 94, 80, 1, 33, 2, 18, 68, 97, 78, 52, 62, 63, 48, 15, 78, 35, 13, 14, 94, 4, 95, 62, 4, 74, 78, 43, 57, 1, 17, 30, 23, 98, 13, 26, 64, 72, 69, 7, 1, 30, 32, 92, 26, 84, 30, 15, 20, 40, 92, 85, 28, 54, 67, 27, 59, 74, 2, 51, 12, 46, 39, 97, 13, 76, 91, 63, 92, 40, 17, 54, 74, 52, 30, 50, 5, 41, 23, 46, 23, 15]]) == 96\nassert my_solution.maxNumOfMarkedIndices(**[[36]]) == 0\nassert my_solution.maxNumOfMarkedIndices(**[[40]]) == 0\nassert my_solution.maxNumOfMarkedIndices(**[[36, 22, 53, 86, 95, 84]]) == 4\nassert my_solution.maxNumOfMarkedIndices(**[[58, 57, 42, 83, 24, 73, 63, 76, 44, 30, 11, 16, 71, 87, 10, 49, 32, 72, 53, 89, 96, 93, 27, 49, 20, 53, 30, 70, 70, 79, 100, 99, 96, 58, 51, 21, 22, 39, 33, 27, 44, 46, 47, 41, 73, 20, 75, 36, 48, 19, 54, 47]]) == 50\nassert my_solution.maxNumOfMarkedIndices(**[[48, 20, 34, 88, 74, 64, 38, 20, 73, 59, 27, 12, 74, 12, 19, 98, 59, 23, 8, 43, 70, 54, 33, 5, 33, 98, 55, 11, 92, 76, 17, 34, 35, 20, 22, 5, 58, 75, 90, 54, 58, 32, 49, 46, 31, 53, 14, 41, 47, 61, 1, 73, 37, 72, 37, 4, 78, 73, 3, 89, 52, 53, 29, 92, 31]]) == 64\n"}, "labels": {"questionId": "2712", "questionFrontendId": "2576", "questionTitle": "Find the Maximum Number of Marked Indices", "stats": {"totalAccepted": "7.6K", "totalSubmission": "20K", "totalAcceptedRaw": 7618, "totalSubmissionRaw": 19969, "acRate": "38.1%"}, "probedCases": [{"inputs": [[3, 5, 2, 4]], "output": 2}, {"inputs": [[9, 2, 5, 4]], "output": 4}, {"inputs": [[7, 6, 8]], "output": 0}, {"inputs": [[1, 78, 27, 48, 14, 86, 79, 68, 77, 20, 57, 21, 18, 67, 5, 51, 70, 85, 47, 56, 22, 79, 41, 8, 39, 81, 59, 74, 14, 45, 49, 15, 10, 28, 16, 77, 22, 65, 8, 36, 79, 94, 44, 80, 72, 8, 96, 78, 39, 92, 69, 55, 9, 44, 26, 76, 40, 77, 16, 69, 40, 64, 12, 48, 66, 7, 59, 10]], "output": 64}, {"inputs": [[72, 97, 60, 79, 68, 25, 63, 82, 88, 60, 37, 60, 44, 14, 62, 36, 52, 73, 26, 98, 86, 50, 74, 68, 53, 80, 90, 60, 78, 56, 53, 84, 2]], "output": 14}, {"inputs": [[42, 83, 48, 10, 24, 55, 9, 100, 10, 17, 17, 99, 51, 32, 16, 98, 99, 31, 28, 68, 71, 14, 64, 29, 15, 40]], "output": 26}, {"inputs": [[57, 40, 57, 51, 90, 51, 68, 100, 24, 39, 11, 85, 2, 22, 67, 29, 74, 82, 10, 96, 14, 35, 25, 76, 26, 54, 29, 44, 63, 49, 73, 50, 95, 89, 43, 62, 24, 88, 88, 36, 6, 16, 14, 2, 42, 42, 60, 25, 4, 58, 23, 22, 27, 26, 3, 79, 64, 20, 92]], "output": 58}, {"inputs": [[56, 92, 98, 34, 47, 91, 91, 23, 88, 43, 53, 29, 70, 23, 77, 24, 22, 4, 79, 38, 13, 36, 94, 19, 91, 44, 8, 56, 97, 77, 93, 55, 59, 77, 8, 95, 48, 50, 59, 32, 76, 78, 31, 3, 81, 44, 5, 52, 53, 88, 86, 87, 92, 69, 58, 82, 50, 82, 34, 72, 56, 46, 35]], "output": 50}, {"inputs": [[4, 16, 58, 52, 51, 53, 67, 29, 12, 42, 67, 76, 95, 51, 31, 49, 9, 72, 83, 84, 12, 85, 78, 73, 3, 48, 22, 59, 99, 63, 10, 21, 43, 77, 43, 74, 75, 27, 13, 29, 73, 13, 20, 6, 56, 75, 83, 26, 24, 53, 56, 61, 96, 57, 33, 89, 99, 93, 81, 28, 49, 80, 88, 29, 51, 26, 95, 35, 61, 31, 96, 15, 65, 87, 12, 15, 81, 38, 96, 58, 23, 85, 5, 81, 26]], "output": 76}, {"inputs": [[66, 53, 92, 87, 23, 29, 53, 83, 63, 63, 25, 25, 72, 47, 34, 24, 63, 8, 43, 100, 80, 17, 72, 69, 7, 7, 32, 80, 8, 58, 70, 81, 79, 67, 66, 24, 64, 66, 9, 67, 33, 11, 62, 86, 5, 84, 78, 85, 69, 3, 92, 14, 67, 90, 31, 40, 54, 63, 99, 88, 28, 100, 5, 72, 89, 60, 90, 71, 97, 16, 7, 60, 6, 57, 73, 84, 17, 8, 77, 60, 7, 74, 74, 24, 52, 43, 94, 48, 9, 99, 84, 89, 96, 40, 15, 29, 80, 19]], "output": 78}, {"inputs": [[75, 49, 27, 87, 95, 22, 28, 54, 66, 55, 99, 17, 75, 39, 90, 47, 14, 9, 63, 18, 51, 15, 50, 24, 86, 30, 44, 51, 13, 91, 95, 52, 50, 99, 38, 74, 67, 34, 75, 31, 91, 47, 6, 37, 62, 72, 42, 85, 95, 10, 8, 43, 21, 63]], "output": 52}, {"inputs": [[45, 23, 69, 16, 99, 92, 5, 97, 69, 33, 44, 8, 33, 38, 60, 60, 52, 18, 97, 28, 61, 77, 27, 68, 57, 26]], "output": 26}, {"inputs": [[90, 37, 51, 92, 50, 50, 93, 49, 34, 53, 3, 32, 3, 95, 80, 79, 76, 39, 35, 35, 83, 100, 84, 24, 6, 50, 97, 82, 67, 31, 99, 94, 19]], "output": 28}, {"inputs": [[1, 69, 22, 35, 3, 56, 81, 80, 37, 28, 34, 59, 92, 31, 34, 19, 96, 6, 58, 98, 14, 94, 4, 95, 41, 23, 98, 26, 69, 35, 52, 92, 26, 32, 61, 60, 19, 43, 22, 59, 96, 40, 42, 59, 48, 36, 41, 14, 100, 68, 63, 42, 55, 93, 4, 55, 57, 32, 81, 75, 34, 59, 11, 98, 41, 40, 78, 21, 41, 40, 75, 3, 10, 91, 10, 3, 48, 3]], "output": 78}, {"inputs": [[100, 5, 97, 36, 93, 81, 29, 80, 14, 6, 20, 95, 33, 37, 9, 49, 94, 80, 1, 33, 2, 18, 68, 97, 78, 52, 62, 63, 48, 15, 78, 35, 13, 14, 94, 4, 95, 62, 4, 74, 78, 43, 57, 1, 17, 30, 23, 98, 13, 26, 64, 72, 69, 7, 1, 30, 32, 92, 26, 84, 30, 15, 20, 40, 92, 85, 28, 54, 67, 27, 59, 74, 2, 51, 12, 46, 39, 97, 13, 76, 91, 63, 92, 40, 17, 54, 74, 52, 30, 50, 5, 41, 23, 46, 23, 15]], "output": 96}, {"inputs": [[36]], "output": 0}, {"inputs": [[40]], "output": 0}, {"inputs": [[36, 22, 53, 86, 95, 84]], "output": 4}, {"inputs": [[58, 57, 42, 83, 24, 73, 63, 76, 44, 30, 11, 16, 71, 87, 10, 49, 32, 72, 53, 89, 96, 93, 27, 49, 20, 53, 30, 70, 70, 79, 100, 99, 96, 58, 51, 21, 22, 39, 33, 27, 44, 46, 47, 41, 73, 20, 75, 36, 48, 19, 54, 47]], "output": 50}, {"inputs": [[48, 20, 34, 88, 74, 64, 38, 20, 73, 59, 27, 12, 74, 12, 19, 98, 59, 23, 8, 43, 70, 54, 33, 5, 33, 98, 55, 11, 92, 76, 17, 34, 35, 20, 22, 5, 58, 75, 90, 54, 58, 32, 49, 46, 31, 53, 14, 41, 47, 61, 1, 73, 37, 72, 37, 4, 78, 73, 3, 89, 52, 53, 29, 92, 31]], "output": 64}]}} +{"id": "LeetCode/2707", "content": "# Merge Two 2D Arrays by Summing Values\n\nYou are given two **2D** integer arrays `nums1` and `nums2.`\n\n\n* `nums1[i] = [idi, vali]` indicate that the number with the id `idi` has a value equal to `vali`.\n* `nums2[i] = [idi, vali]` indicate that the number with the id `idi` has a value equal to `vali`.\n\n\nEach array contains **unique** ids and is sorted in **ascending** order by id.\n\n\nMerge the two arrays into one array that is sorted in ascending order by id, respecting the following conditions:\n\n\n* Only ids that appear in at least one of the two arrays should be included in the resulting array.\n* Each id should be included **only once** and its value should be the sum of the values of this id in the two arrays. If the id does not exist in one of the two arrays then its value in that array is considered to be `0`.\n\n\nReturn *the resulting array*. The returned array must be sorted in ascending order by id.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums1 = [[1,2],[2,3],[4,5]], nums2 = [[1,4],[3,2],[4,1]]\n**Output:** [[1,6],[2,3],[3,2],[4,6]]\n**Explanation:** The resulting array contains the following:\n- id = 1, the value of this id is 2 + 4 = 6.\n- id = 2, the value of this id is 3.\n- id = 3, the value of this id is 2.\n- id = 4, the value of this id is 5 + 1 = 6.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums1 = [[2,4],[3,6],[5,5]], nums2 = [[1,3],[4,3]]\n**Output:** [[1,3],[2,4],[3,6],[4,3],[5,5]]\n**Explanation:** There are no common ids, so we just include each id with its value in the resulting list.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums1.length, nums2.length <= 200`\n* `nums1[i].length == nums2[j].length == 2`\n* `1 <= idi, vali <= 1000`\n* Both arrays contain unique ids.\n* Both arrays are in strictly ascending order by id.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def mergeArrays(self, nums1: List[List[int]], nums2: List[List[int]]) -> List[List[int]]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.mergeArrays(**[[[1, 2], [2, 3], [4, 5]], [[1, 4], [3, 2], [4, 1]]]) == [[1, 6], [2, 3], [3, 2], [4, 6]]\nassert my_solution.mergeArrays(**[[[2, 4], [3, 6], [5, 5]], [[1, 3], [4, 3]]]) == [[1, 3], [2, 4], [3, 6], [4, 3], [5, 5]]\nassert my_solution.mergeArrays(**[[[148, 597], [165, 623], [306, 359], [349, 566], [403, 646], [420, 381], [566, 543], [730, 209], [757, 875], [788, 208], [932, 695]], [[74, 669], [87, 399], [89, 165], [99, 749], [122, 401], [138, 16], [144, 714], [148, 206], [177, 948], [211, 653], [285, 775], [309, 289], [349, 396], [386, 831], [403, 318], [405, 119], [420, 153], [468, 433], [504, 101], [566, 128], [603, 688], [618, 628], [622, 586], [641, 46], [653, 922], [672, 772], [691, 823], [693, 900], [756, 878], [757, 952], [770, 795], [806, 118], [813, 88], [919, 501], [935, 253], [982, 385]]]) == [[74, 669], [87, 399], [89, 165], [99, 749], [122, 401], [138, 16], [144, 714], [148, 803], [165, 623], [177, 948], [211, 653], [285, 775], [306, 359], [309, 289], [349, 962], [386, 831], [403, 964], [405, 119], [420, 534], [468, 433], [504, 101], [566, 671], [603, 688], [618, 628], [622, 586], [641, 46], [653, 922], [672, 772], [691, 823], [693, 900], [730, 209], [756, 878], [757, 1827], [770, 795], [788, 208], [806, 118], [813, 88], [919, 501], [932, 695], [935, 253], [982, 385]]\nassert my_solution.mergeArrays(**[[[7, 571], [63, 743], [149, 42], [278, 622], [361, 276], [554, 608], [616, 28], [719, 955], [778, 377], [1000, 853]], [[278, 784], [891, 546]]]) == [[7, 571], [63, 743], [149, 42], [278, 1406], [361, 276], [554, 608], [616, 28], [719, 955], [778, 377], [891, 546], [1000, 853]]\nassert my_solution.mergeArrays(**[[[13, 43], [52, 654], [81, 634], [135, 661], [148, 164], [171, 646], [185, 785], [220, 205], [234, 183], [279, 546], [285, 2], [287, 158], [311, 71], [364, 480], [370, 903], [450, 968], [471, 63], [502, 679], [510, 256], [546, 51], [573, 932], [579, 445], [599, 919], [666, 836], [699, 222], [705, 568], [707, 141], [719, 978], [747, 160], [753, 818], [758, 266], [806, 33], [818, 508], [828, 412], [851, 44], [906, 833], [940, 575], [960, 105]], [[159, 982], [171, 221], [311, 610], [364, 620], [471, 233], [510, 207], [573, 909], [599, 925], [707, 478], [719, 788], [747, 178], [828, 528]]]) == [[13, 43], [52, 654], [81, 634], [135, 661], [148, 164], [159, 982], [171, 867], [185, 785], [220, 205], [234, 183], [279, 546], [285, 2], [287, 158], [311, 681], [364, 1100], [370, 903], [450, 968], [471, 296], [502, 679], [510, 463], [546, 51], [573, 1841], [579, 445], [599, 1844], [666, 836], [699, 222], [705, 568], [707, 619], [719, 1766], [747, 338], [753, 818], [758, 266], [806, 33], [818, 508], [828, 940], [851, 44], [906, 833], [940, 575], [960, 105]]\nassert my_solution.mergeArrays(**[[[182, 108], [184, 211], [253, 162], [428, 279], [430, 645]], [[27, 775], [79, 228], [113, 107], [121, 440], [132, 156], [155, 382], [182, 381], [184, 546], [188, 909], [204, 882], [208, 290], [225, 866], [253, 590], [273, 175], [285, 401], [295, 248], [300, 552], [311, 628], [361, 357], [369, 482], [381, 505], [398, 584], [428, 676], [430, 485], [434, 316], [437, 824], [529, 459], [549, 481], [566, 219], [590, 710], [677, 883], [741, 40], [765, 761], [783, 664], [784, 560], [786, 303], [797, 492], [811, 110], [836, 94], [885, 980], [888, 415], [899, 310], [922, 960], [933, 56], [970, 649], [978, 346]]]) == [[27, 775], [79, 228], [113, 107], [121, 440], [132, 156], [155, 382], [182, 489], [184, 757], [188, 909], [204, 882], [208, 290], [225, 866], [253, 752], [273, 175], [285, 401], [295, 248], [300, 552], [311, 628], [361, 357], [369, 482], [381, 505], [398, 584], [428, 955], [430, 1130], [434, 316], [437, 824], [529, 459], [549, 481], [566, 219], [590, 710], [677, 883], [741, 40], [765, 761], [783, 664], [784, 560], [786, 303], [797, 492], [811, 110], [836, 94], [885, 980], [888, 415], [899, 310], [922, 960], [933, 56], [970, 649], [978, 346]]\nassert my_solution.mergeArrays(**[[[52, 966], [53, 511], [69, 965], [96, 222], [133, 663], [136, 733], [168, 385], [213, 978], [220, 44], [253, 333], [315, 598], [335, 438], [362, 770], [373, 266], [391, 927], [424, 107], [538, 949], [556, 678], [574, 334], [756, 978], [909, 973], [918, 685], [944, 794], [969, 492], [970, 753]], [[69, 699], [96, 926], [168, 908], [315, 84], [424, 736], [756, 1], [909, 126], [969, 358], [970, 801]]]) == [[52, 966], [53, 511], [69, 1664], [96, 1148], [133, 663], [136, 733], [168, 1293], [213, 978], [220, 44], [253, 333], [315, 682], [335, 438], [362, 770], [373, 266], [391, 927], [424, 843], [538, 949], [556, 678], [574, 334], [756, 979], [909, 1099], [918, 685], [944, 794], [969, 850], [970, 1554]]\nassert my_solution.mergeArrays(**[[[66, 301], [104, 426], [161, 161], [165, 612], [213, 549], [257, 737], [281, 631], [285, 415], [316, 46], [321, 98], [339, 382], [370, 225], [379, 102], [450, 823], [459, 71], [473, 538], [482, 409], [485, 433], [503, 854], [513, 930], [533, 354], [645, 274], [659, 395], [689, 468], [696, 914], [712, 762], [727, 835], [746, 881], [751, 915], [758, 287], [771, 231], [818, 883], [862, 802], [864, 299], [919, 473], [979, 811], [998, 851]], [[66, 649], [165, 463], [213, 732], [228, 798], [245, 755], [251, 908], [314, 913], [342, 648], [379, 131], [426, 184], [459, 464], [469, 546], [471, 856], [473, 832], [503, 268], [506, 916], [515, 915], [533, 406], [562, 626], [603, 834], [606, 595], [653, 139], [689, 649], [697, 351], [712, 873], [724, 996], [727, 656], [728, 438], [756, 940], [758, 574], [818, 163], [829, 411], [860, 778], [886, 59], [922, 412], [979, 660], [998, 319]]]) == [[66, 950], [104, 426], [161, 161], [165, 1075], [213, 1281], [228, 798], [245, 755], [251, 908], [257, 737], [281, 631], [285, 415], [314, 913], [316, 46], [321, 98], [339, 382], [342, 648], [370, 225], [379, 233], [426, 184], [450, 823], [459, 535], [469, 546], [471, 856], [473, 1370], [482, 409], [485, 433], [503, 1122], [506, 916], [513, 930], [515, 915], [533, 760], [562, 626], [603, 834], [606, 595], [645, 274], [653, 139], [659, 395], [689, 1117], [696, 914], [697, 351], [712, 1635], [724, 996], [727, 1491], [728, 438], [746, 881], [751, 915], [756, 940], [758, 861], [771, 231], [818, 1046], [829, 411], [860, 778], [862, 802], [864, 299], [886, 59], [919, 473], [922, 412], [979, 1471], [998, 1170]]\nassert my_solution.mergeArrays(**[[[29, 870], [74, 501], [118, 505], [122, 916], [188, 531], [318, 724], [329, 394], [330, 98], [334, 158], [475, 692], [575, 893], [585, 953], [587, 630], [647, 840], [679, 477], [687, 1], [717, 278], [745, 77], [763, 18], [866, 195], [937, 141], [985, 165]], [[5, 815], [29, 15], [53, 32], [113, 290], [118, 437], [122, 918], [134, 282], [161, 728], [188, 471], [248, 25], [275, 992], [301, 101], [318, 730], [334, 722], [387, 687], [477, 553], [502, 403], [548, 681], [561, 618], [575, 382], [587, 164], [647, 705], [654, 86], [687, 209], [717, 333], [753, 43], [763, 413], [776, 310], [801, 115], [828, 809], [861, 610], [926, 435], [937, 902]]]) == [[5, 815], [29, 885], [53, 32], [74, 501], [113, 290], [118, 942], [122, 1834], [134, 282], [161, 728], [188, 1002], [248, 25], [275, 992], [301, 101], [318, 1454], [329, 394], [330, 98], [334, 880], [387, 687], [475, 692], [477, 553], [502, 403], [548, 681], [561, 618], [575, 1275], [585, 953], [587, 794], [647, 1545], [654, 86], [679, 477], [687, 210], [717, 611], [745, 77], [753, 43], [763, 431], [776, 310], [801, 115], [828, 809], [861, 610], [866, 195], [926, 435], [937, 1043], [985, 165]]\nassert my_solution.mergeArrays(**[[[18, 68], [152, 947], [158, 199], [169, 45], [222, 33], [256, 185], [353, 217], [418, 32], [419, 846], [457, 593], [461, 135], [462, 766], [529, 425], [536, 300], [565, 339], [621, 854], [625, 316], [736, 309], [858, 660], [935, 169], [939, 764], [962, 230], [967, 261]], [[158, 771], [457, 152], [967, 69]]]) == [[18, 68], [152, 947], [158, 970], [169, 45], [222, 33], [256, 185], [353, 217], [418, 32], [419, 846], [457, 745], [461, 135], [462, 766], [529, 425], [536, 300], [565, 339], [621, 854], [625, 316], [736, 309], [858, 660], [935, 169], [939, 764], [962, 230], [967, 330]]\nassert my_solution.mergeArrays(**[[[17, 458], [56, 457], [77, 384], [90, 886], [138, 658], [143, 745], [147, 700], [186, 456], [274, 389], [308, 810], [374, 986], [439, 770], [451, 89], [633, 382], [675, 972], [683, 605], [704, 949], [786, 362], [806, 789], [821, 503], [844, 937], [922, 873], [925, 934], [964, 490], [988, 89]], [[90, 886], [147, 300], [633, 538], [683, 319], [786, 200], [789, 342], [795, 995], [844, 551]]]) == [[17, 458], [56, 457], [77, 384], [90, 1772], [138, 658], [143, 745], [147, 1000], [186, 456], [274, 389], [308, 810], [374, 986], [439, 770], [451, 89], [633, 920], [675, 972], [683, 924], [704, 949], [786, 562], [789, 342], [795, 995], [806, 789], [821, 503], [844, 1488], [922, 873], [925, 934], [964, 490], [988, 89]]\nassert my_solution.mergeArrays(**[[[11, 629], [44, 221], [171, 139], [200, 833], [240, 840], [310, 175], [373, 938], [495, 902], [600, 452], [676, 395], [697, 670], [711, 83], [743, 583], [808, 565], [839, 656], [863, 813], [950, 902]], [[278, 210], [365, 1000], [373, 909], [944, 824]]]) == [[11, 629], [44, 221], [171, 139], [200, 833], [240, 840], [278, 210], [310, 175], [365, 1000], [373, 1847], [495, 902], [600, 452], [676, 395], [697, 670], [711, 83], [743, 583], [808, 565], [839, 656], [863, 813], [944, 824], [950, 902]]\nassert my_solution.mergeArrays(**[[[29, 422], [36, 578], [75, 654], [79, 887], [106, 814], [150, 863], [224, 211], [280, 708], [314, 961], [332, 546], [352, 557], [389, 926], [424, 870], [482, 771], [539, 997], [561, 968], [565, 204], [567, 17], [613, 91], [710, 448], [715, 406], [720, 611], [745, 954], [769, 951], [790, 150], [797, 98], [806, 258], [812, 32], [880, 678], [889, 208], [901, 422], [928, 849], [955, 349], [960, 64], [993, 22]], [[29, 615], [75, 184], [150, 353], [224, 776], [332, 743], [482, 891], [769, 700], [955, 128], [993, 445]]]) == [[29, 1037], [36, 578], [75, 838], [79, 887], [106, 814], [150, 1216], [224, 987], [280, 708], [314, 961], [332, 1289], [352, 557], [389, 926], [424, 870], [482, 1662], [539, 997], [561, 968], [565, 204], [567, 17], [613, 91], [710, 448], [715, 406], [720, 611], [745, 954], [769, 1651], [790, 150], [797, 98], [806, 258], [812, 32], [880, 678], [889, 208], [901, 422], [928, 849], [955, 477], [960, 64], [993, 467]]\nassert my_solution.mergeArrays(**[[[15, 522], [165, 873], [190, 322], [249, 196], [368, 672], [511, 219], [539, 152], [558, 102], [563, 495], [565, 588], [602, 711], [608, 900], [667, 968], [712, 420], [755, 901], [808, 574], [900, 340], [971, 585], [973, 666], [999, 862]], [[15, 464], [83, 161], [89, 867], [119, 255], [165, 689], [180, 104], [190, 154], [236, 420], [301, 92], [324, 305], [334, 335], [368, 627], [379, 559], [396, 627], [459, 636], [506, 903], [511, 641], [534, 298], [536, 295], [592, 951], [602, 351], [608, 938], [618, 841], [667, 877], [684, 730], [711, 382], [712, 523], [741, 439], [751, 345], [755, 446], [795, 616], [808, 60], [843, 854], [869, 293], [872, 448], [895, 995], [917, 229], [935, 212], [955, 226], [971, 970], [973, 514], [978, 732]]]) == [[15, 986], [83, 161], [89, 867], [119, 255], [165, 1562], [180, 104], [190, 476], [236, 420], [249, 196], [301, 92], [324, 305], [334, 335], [368, 1299], [379, 559], [396, 627], [459, 636], [506, 903], [511, 860], [534, 298], [536, 295], [539, 152], [558, 102], [563, 495], [565, 588], [592, 951], [602, 1062], [608, 1838], [618, 841], [667, 1845], [684, 730], [711, 382], [712, 943], [741, 439], [751, 345], [755, 1347], [795, 616], [808, 634], [843, 854], [869, 293], [872, 448], [895, 995], [900, 340], [917, 229], [935, 212], [955, 226], [971, 1555], [973, 1180], [978, 732], [999, 862]]\nassert my_solution.mergeArrays(**[[[27, 409], [46, 589], [77, 299], [81, 268], [98, 98], [123, 7], [148, 946], [174, 215], [199, 863], [274, 768], [289, 360], [320, 472], [356, 914], [370, 364], [383, 950], [394, 690], [403, 336], [407, 972], [431, 43], [446, 423], [484, 177], [518, 419], [557, 501], [562, 481], [585, 409], [604, 161], [634, 365], [664, 50], [683, 549], [691, 228], [706, 800], [710, 986], [746, 880], [752, 305], [772, 877], [820, 424], [827, 347], [845, 886], [868, 957], [879, 86], [889, 723], [910, 810], [924, 775], [935, 106], [955, 367], [962, 335], [992, 207], [993, 564], [994, 846]], [[27, 248], [256, 894], [274, 9], [289, 858], [338, 676], [356, 868], [377, 776], [389, 637], [394, 573], [416, 685], [446, 524], [460, 264], [475, 119], [506, 656], [562, 481], [702, 157], [706, 804], [724, 821], [746, 701], [772, 43], [799, 298], [845, 983], [847, 305], [889, 368], [920, 709], [935, 346], [955, 970], [962, 79], [992, 163], [994, 200]]]) == [[27, 657], [46, 589], [77, 299], [81, 268], [98, 98], [123, 7], [148, 946], [174, 215], [199, 863], [256, 894], [274, 777], [289, 1218], [320, 472], [338, 676], [356, 1782], [370, 364], [377, 776], [383, 950], [389, 637], [394, 1263], [403, 336], [407, 972], [416, 685], [431, 43], [446, 947], [460, 264], [475, 119], [484, 177], [506, 656], [518, 419], [557, 501], [562, 962], [585, 409], [604, 161], [634, 365], [664, 50], [683, 549], [691, 228], [702, 157], [706, 1604], [710, 986], [724, 821], [746, 1581], [752, 305], [772, 920], [799, 298], [820, 424], [827, 347], [845, 1869], [847, 305], [868, 957], [879, 86], [889, 1091], [910, 810], [920, 709], [924, 775], [935, 452], [955, 1337], [962, 414], [992, 370], [993, 564], [994, 1046]]\nassert my_solution.mergeArrays(**[[[30, 573], [47, 797], [58, 951], [102, 571], [106, 201], [148, 89], [176, 428], [179, 595], [189, 637], [201, 152], [202, 772], [247, 836], [253, 647], [283, 776], [332, 988], [359, 470], [364, 348], [386, 913], [562, 667], [573, 699], [574, 184], [584, 264], [610, 979], [613, 568], [664, 828], [665, 911], [682, 15], [709, 919], [734, 492], [737, 647], [740, 324], [758, 842], [763, 320], [768, 836], [779, 764], [797, 232], [800, 79], [801, 858], [832, 438], [898, 82], [928, 581], [933, 802], [945, 103], [956, 147], [962, 803], [967, 291]], [[47, 366], [58, 612], [132, 579], [179, 697], [201, 214], [658, 732]]]) == [[30, 573], [47, 1163], [58, 1563], [102, 571], [106, 201], [132, 579], [148, 89], [176, 428], [179, 1292], [189, 637], [201, 366], [202, 772], [247, 836], [253, 647], [283, 776], [332, 988], [359, 470], [364, 348], [386, 913], [562, 667], [573, 699], [574, 184], [584, 264], [610, 979], [613, 568], [658, 732], [664, 828], [665, 911], [682, 15], [709, 919], [734, 492], [737, 647], [740, 324], [758, 842], [763, 320], [768, 836], [779, 764], [797, 232], [800, 79], [801, 858], [832, 438], [898, 82], [928, 581], [933, 802], [945, 103], [956, 147], [962, 803], [967, 291]]\nassert my_solution.mergeArrays(**[[[2, 914], [17, 827], [51, 986], [61, 494], [92, 43], [131, 430], [134, 606], [153, 172], [165, 735], [232, 695], [347, 722], [349, 870], [367, 331], [389, 279], [396, 472], [402, 279], [415, 206], [419, 758], [420, 646], [447, 351], [460, 262], [475, 659], [525, 798], [547, 376], [585, 947], [638, 411], [650, 648], [651, 889], [673, 886], [708, 747], [728, 614], [742, 404], [752, 108], [757, 340], [776, 459], [791, 930], [866, 950], [887, 8], [891, 597], [917, 568], [924, 798], [931, 151], [936, 706], [950, 814], [955, 265], [960, 60], [971, 777], [986, 364], [992, 308], [998, 772]], [[26, 959], [92, 171], [154, 510], [174, 744], [232, 641], [447, 864], [533, 437], [547, 829], [752, 945], [776, 953], [789, 921], [791, 603], [866, 995], [891, 729], [906, 613], [971, 847]]]) == [[2, 914], [17, 827], [26, 959], [51, 986], [61, 494], [92, 214], [131, 430], [134, 606], [153, 172], [154, 510], [165, 735], [174, 744], [232, 1336], [347, 722], [349, 870], [367, 331], [389, 279], [396, 472], [402, 279], [415, 206], [419, 758], [420, 646], [447, 1215], [460, 262], [475, 659], [525, 798], [533, 437], [547, 1205], [585, 947], [638, 411], [650, 648], [651, 889], [673, 886], [708, 747], [728, 614], [742, 404], [752, 1053], [757, 340], [776, 1412], [789, 921], [791, 1533], [866, 1945], [887, 8], [891, 1326], [906, 613], [917, 568], [924, 798], [931, 151], [936, 706], [950, 814], [955, 265], [960, 60], [971, 1624], [986, 364], [992, 308], [998, 772]]\nassert my_solution.mergeArrays(**[[[15, 134], [17, 740], [66, 6], [73, 988], [75, 6], [76, 962], [82, 197], [92, 275], [149, 350], [159, 822], [166, 840], [181, 528], [195, 167], [206, 340], [209, 400], [210, 9], [213, 848], [235, 970], [244, 373], [261, 701], [274, 662], [279, 244], [285, 352], [298, 240], [300, 191], [314, 276], [342, 436], [400, 322], [440, 907], [453, 5], [476, 756], [482, 858], [497, 810], [499, 520], [507, 508], [508, 906], [510, 402], [534, 232], [542, 438], [555, 664], [565, 188], [597, 314], [600, 587], [606, 415], [628, 859], [682, 671], [687, 735], [702, 267], [724, 325], [726, 216], [752, 359], [755, 485], [778, 516], [792, 533], [801, 946], [803, 784], [818, 621], [833, 379], [842, 425], [853, 843], [856, 644], [863, 268], [864, 926], [880, 738], [882, 225], [887, 55], [961, 105], [978, 48], [993, 740], [994, 449], [997, 63]], [[1, 802], [15, 809], [16, 449], [17, 153], [24, 749], [66, 942], [73, 845], [82, 386], [149, 943], [158, 892], [159, 642], [160, 160], [166, 718], [181, 234], [195, 840], [211, 586], [257, 815], [342, 703], [400, 67], [453, 429], [461, 182], [497, 703], [507, 861], [523, 630], [534, 260], [535, 341], [539, 217], [546, 653], [555, 238], [565, 350], [589, 477], [597, 446], [606, 681], [628, 733], [643, 609], [682, 988], [687, 370], [692, 779], [726, 747], [752, 8], [755, 705], [760, 962], [778, 985], [833, 19], [842, 185], [844, 502], [845, 702], [860, 806], [864, 739], [883, 76], [997, 752]]]) == [[1, 802], [15, 943], [16, 449], [17, 893], [24, 749], [66, 948], [73, 1833], [75, 6], [76, 962], [82, 583], [92, 275], [149, 1293], [158, 892], [159, 1464], [160, 160], [166, 1558], [181, 762], [195, 1007], [206, 340], [209, 400], [210, 9], [211, 586], [213, 848], [235, 970], [244, 373], [257, 815], [261, 701], [274, 662], [279, 244], [285, 352], [298, 240], [300, 191], [314, 276], [342, 1139], [400, 389], [440, 907], [453, 434], [461, 182], [476, 756], [482, 858], [497, 1513], [499, 520], [507, 1369], [508, 906], [510, 402], [523, 630], [534, 492], [535, 341], [539, 217], [542, 438], [546, 653], [555, 902], [565, 538], [589, 477], [597, 760], [600, 587], [606, 1096], [628, 1592], [643, 609], [682, 1659], [687, 1105], [692, 779], [702, 267], [724, 325], [726, 963], [752, 367], [755, 1190], [760, 962], [778, 1501], [792, 533], [801, 946], [803, 784], [818, 621], [833, 398], [842, 610], [844, 502], [845, 702], [853, 843], [856, 644], [860, 806], [863, 268], [864, 1665], [880, 738], [882, 225], [883, 76], [887, 55], [961, 105], [978, 48], [993, 740], [994, 449], [997, 815]]\nassert my_solution.mergeArrays(**[[[2, 941], [11, 218], [35, 747], [44, 455], [61, 383], [77, 135], [79, 312], [88, 80], [92, 453], [95, 916], [102, 461], [106, 500], [118, 478], [121, 900], [127, 322], [132, 186], [147, 544], [171, 321], [197, 301], [229, 854], [231, 886], [242, 416], [265, 680], [269, 745], [277, 555], [285, 627], [315, 820], [322, 276], [325, 239], [334, 668], [338, 103], [358, 821], [361, 762], [407, 221], [411, 624], [445, 53], [453, 638], [469, 64], [478, 578], [491, 735], [494, 347], [520, 553], [531, 716], [536, 463], [539, 186], [540, 573], [574, 518], [601, 347], [604, 884], [620, 799], [626, 671], [628, 986], [634, 650], [637, 741], [638, 124], [658, 102], [673, 315], [685, 683], [687, 964], [718, 864], [727, 373], [728, 849], [735, 115], [736, 454], [738, 921], [740, 414], [757, 635], [782, 586], [783, 130], [800, 740], [812, 877], [861, 407], [876, 989], [884, 859], [891, 924], [895, 635], [908, 174], [931, 301], [940, 960], [943, 897], [949, 824], [958, 755], [963, 755], [965, 723], [966, 923], [967, 136], [988, 507], [1000, 985]], [[9, 53], [15, 617], [33, 261], [35, 76], [44, 968], [48, 940], [54, 145], [57, 436], [61, 390], [72, 616], [88, 306], [91, 753], [95, 63], [106, 638], [118, 910], [121, 423], [127, 37], [132, 569], [142, 782], [147, 237], [196, 176], [215, 818], [229, 727], [237, 625], [259, 350], [285, 914], [289, 433], [299, 189], [315, 128], [317, 132], [322, 636], [361, 618], [393, 743], [407, 317], [410, 320], [414, 848], [418, 439], [424, 413], [428, 615], [440, 660], [455, 771], [459, 665], [465, 302], [478, 967], [491, 875], [504, 819], [515, 657], [531, 443], [539, 472], [540, 807], [555, 575], [574, 578], [591, 727], [606, 130], [621, 559], [628, 802], [633, 979], [637, 476], [648, 36], [654, 924], [673, 551], [685, 125], [687, 914], [689, 954], [718, 621], [735, 318], [738, 346], [740, 726], [782, 804], [789, 448], [800, 933], [803, 373], [828, 180], [838, 350], [841, 432], [861, 492], [876, 686], [882, 994], [884, 91], [891, 953], [895, 398], [903, 449], [908, 223], [940, 269], [943, 462], [963, 201], [965, 679], [967, 353], [983, 420], [1000, 480]]]) == [[2, 941], [9, 53], [11, 218], [15, 617], [33, 261], [35, 823], [44, 1423], [48, 940], [54, 145], [57, 436], [61, 773], [72, 616], [77, 135], [79, 312], [88, 386], [91, 753], [92, 453], [95, 979], [102, 461], [106, 1138], [118, 1388], [121, 1323], [127, 359], [132, 755], [142, 782], [147, 781], [171, 321], [196, 176], [197, 301], [215, 818], [229, 1581], [231, 886], [237, 625], [242, 416], [259, 350], [265, 680], [269, 745], [277, 555], [285, 1541], [289, 433], [299, 189], [315, 948], [317, 132], [322, 912], [325, 239], [334, 668], [338, 103], [358, 821], [361, 1380], [393, 743], [407, 538], [410, 320], [411, 624], [414, 848], [418, 439], [424, 413], [428, 615], [440, 660], [445, 53], [453, 638], [455, 771], [459, 665], [465, 302], [469, 64], [478, 1545], [491, 1610], [494, 347], [504, 819], [515, 657], [520, 553], [531, 1159], [536, 463], [539, 658], [540, 1380], [555, 575], [574, 1096], [591, 727], [601, 347], [604, 884], [606, 130], [620, 799], [621, 559], [626, 671], [628, 1788], [633, 979], [634, 650], [637, 1217], [638, 124], [648, 36], [654, 924], [658, 102], [673, 866], [685, 808], [687, 1878], [689, 954], [718, 1485], [727, 373], [728, 849], [735, 433], [736, 454], [738, 1267], [740, 1140], [757, 635], [782, 1390], [783, 130], [789, 448], [800, 1673], [803, 373], [812, 877], [828, 180], [838, 350], [841, 432], [861, 899], [876, 1675], [882, 994], [884, 950], [891, 1877], [895, 1033], [903, 449], [908, 397], [931, 301], [940, 1229], [943, 1359], [949, 824], [958, 755], [963, 956], [965, 1402], [966, 923], [967, 489], [983, 420], [988, 507], [1000, 1465]]\nassert my_solution.mergeArrays(**[[[12, 447], [19, 270], [28, 181], [29, 102], [33, 34], [51, 404], [56, 798], [84, 551], [107, 672], [108, 453], [121, 694], [129, 105], [130, 640], [131, 880], [147, 629], [150, 921], [185, 454], [188, 926], [232, 504], [253, 459], [279, 944], [340, 374], [409, 987], [435, 116], [440, 222], [464, 427], [482, 226], [491, 153], [502, 856], [504, 234], [506, 253], [519, 548], [536, 845], [553, 556], [571, 459], [587, 383], [596, 804], [622, 172], [677, 566], [680, 105], [698, 867], [699, 317], [727, 962], [734, 473], [735, 173], [743, 836], [747, 336], [757, 689], [775, 200], [776, 554], [789, 878], [818, 9], [821, 102], [832, 806], [841, 924], [850, 514], [858, 539], [886, 442], [897, 236], [901, 57], [903, 711], [906, 288], [913, 735], [922, 865], [928, 919], [932, 512], [945, 49], [964, 702], [968, 368]], [[12, 979], [33, 674], [51, 162], [56, 482], [73, 783], [84, 822], [110, 470], [121, 217], [129, 382], [130, 257], [144, 367], [160, 969], [168, 150], [171, 731], [173, 666], [175, 72], [206, 199], [209, 946], [235, 503], [237, 431], [246, 710], [250, 684], [251, 105], [253, 759], [267, 232], [278, 177], [279, 808], [290, 408], [299, 707], [311, 852], [327, 681], [333, 771], [368, 937], [385, 19], [386, 587], [404, 770], [407, 463], [409, 347], [419, 311], [430, 420], [440, 962], [474, 104], [484, 429], [496, 592], [502, 794], [512, 385], [519, 567], [535, 526], [536, 610], [545, 498], [547, 980], [553, 623], [587, 280], [596, 766], [600, 678], [615, 626], [650, 370], [653, 168], [654, 743], [680, 617], [698, 195], [699, 923], [705, 464], [707, 737], [743, 648], [747, 53], [757, 191], [762, 466], [770, 434], [775, 126], [776, 772], [800, 784], [801, 940], [818, 312], [821, 363], [832, 101], [841, 506], [842, 74], [845, 738], [869, 543], [877, 75], [899, 166], [906, 518], [921, 422], [922, 256], [928, 974], [951, 419], [961, 1000], [977, 251]]]) == [[12, 1426], [19, 270], [28, 181], [29, 102], [33, 708], [51, 566], [56, 1280], [73, 783], [84, 1373], [107, 672], [108, 453], [110, 470], [121, 911], [129, 487], [130, 897], [131, 880], [144, 367], [147, 629], [150, 921], [160, 969], [168, 150], [171, 731], [173, 666], [175, 72], [185, 454], [188, 926], [206, 199], [209, 946], [232, 504], [235, 503], [237, 431], [246, 710], [250, 684], [251, 105], [253, 1218], [267, 232], [278, 177], [279, 1752], [290, 408], [299, 707], [311, 852], [327, 681], [333, 771], [340, 374], [368, 937], [385, 19], [386, 587], [404, 770], [407, 463], [409, 1334], [419, 311], [430, 420], [435, 116], [440, 1184], [464, 427], [474, 104], [482, 226], [484, 429], [491, 153], [496, 592], [502, 1650], [504, 234], [506, 253], [512, 385], [519, 1115], [535, 526], [536, 1455], [545, 498], [547, 980], [553, 1179], [571, 459], [587, 663], [596, 1570], [600, 678], [615, 626], [622, 172], [650, 370], [653, 168], [654, 743], [677, 566], [680, 722], [698, 1062], [699, 1240], [705, 464], [707, 737], [727, 962], [734, 473], [735, 173], [743, 1484], [747, 389], [757, 880], [762, 466], [770, 434], [775, 326], [776, 1326], [789, 878], [800, 784], [801, 940], [818, 321], [821, 465], [832, 907], [841, 1430], [842, 74], [845, 738], [850, 514], [858, 539], [869, 543], [877, 75], [886, 442], [897, 236], [899, 166], [901, 57], [903, 711], [906, 806], [913, 735], [921, 422], [922, 1121], [928, 1893], [932, 512], [945, 49], [951, 419], [961, 1000], [964, 702], [968, 368], [977, 251]]\n"}, "labels": {"questionId": "2707", "questionFrontendId": "2570", "questionTitle": "Merge Two 2D Arrays by Summing Values", "stats": {"totalAccepted": "9.6K", "totalSubmission": "13.8K", "totalAcceptedRaw": 9604, "totalSubmissionRaw": 13795, "acRate": "69.6%"}, "probedCases": [{"inputs": [[[1, 2], [2, 3], [4, 5]], [[1, 4], [3, 2], [4, 1]]], "output": [[1, 6], [2, 3], [3, 2], [4, 6]]}, {"inputs": [[[2, 4], [3, 6], [5, 5]], [[1, 3], [4, 3]]], "output": [[1, 3], [2, 4], [3, 6], [4, 3], [5, 5]]}, {"inputs": [[[148, 597], [165, 623], [306, 359], [349, 566], [403, 646], [420, 381], [566, 543], [730, 209], [757, 875], [788, 208], [932, 695]], [[74, 669], [87, 399], [89, 165], [99, 749], [122, 401], [138, 16], [144, 714], [148, 206], [177, 948], [211, 653], [285, 775], [309, 289], [349, 396], [386, 831], [403, 318], [405, 119], [420, 153], [468, 433], [504, 101], [566, 128], [603, 688], [618, 628], [622, 586], [641, 46], [653, 922], [672, 772], [691, 823], [693, 900], [756, 878], [757, 952], [770, 795], [806, 118], [813, 88], [919, 501], [935, 253], [982, 385]]], "output": [[74, 669], [87, 399], [89, 165], [99, 749], [122, 401], [138, 16], [144, 714], [148, 803], [165, 623], [177, 948], [211, 653], [285, 775], [306, 359], [309, 289], [349, 962], [386, 831], [403, 964], [405, 119], [420, 534], [468, 433], [504, 101], [566, 671], [603, 688], [618, 628], [622, 586], [641, 46], [653, 922], [672, 772], [691, 823], [693, 900], [730, 209], [756, 878], [757, 1827], [770, 795], [788, 208], [806, 118], [813, 88], [919, 501], [932, 695], [935, 253], [982, 385]]}, {"inputs": [[[7, 571], [63, 743], [149, 42], [278, 622], [361, 276], [554, 608], [616, 28], [719, 955], [778, 377], [1000, 853]], [[278, 784], [891, 546]]], "output": [[7, 571], [63, 743], [149, 42], [278, 1406], [361, 276], [554, 608], [616, 28], [719, 955], [778, 377], [891, 546], [1000, 853]]}, {"inputs": [[[13, 43], [52, 654], [81, 634], [135, 661], [148, 164], [171, 646], [185, 785], [220, 205], [234, 183], [279, 546], [285, 2], [287, 158], [311, 71], [364, 480], [370, 903], [450, 968], [471, 63], [502, 679], [510, 256], [546, 51], [573, 932], [579, 445], [599, 919], [666, 836], [699, 222], [705, 568], [707, 141], [719, 978], [747, 160], [753, 818], [758, 266], [806, 33], [818, 508], [828, 412], [851, 44], [906, 833], [940, 575], [960, 105]], [[159, 982], [171, 221], [311, 610], [364, 620], [471, 233], [510, 207], [573, 909], [599, 925], [707, 478], [719, 788], [747, 178], [828, 528]]], "output": [[13, 43], [52, 654], [81, 634], [135, 661], [148, 164], [159, 982], [171, 867], [185, 785], [220, 205], [234, 183], [279, 546], [285, 2], [287, 158], [311, 681], [364, 1100], [370, 903], [450, 968], [471, 296], [502, 679], [510, 463], [546, 51], [573, 1841], [579, 445], [599, 1844], [666, 836], [699, 222], [705, 568], [707, 619], [719, 1766], [747, 338], [753, 818], [758, 266], [806, 33], [818, 508], [828, 940], [851, 44], [906, 833], [940, 575], [960, 105]]}, {"inputs": [[[182, 108], [184, 211], [253, 162], [428, 279], [430, 645]], [[27, 775], [79, 228], [113, 107], [121, 440], [132, 156], [155, 382], [182, 381], [184, 546], [188, 909], [204, 882], [208, 290], [225, 866], [253, 590], [273, 175], [285, 401], [295, 248], [300, 552], [311, 628], [361, 357], [369, 482], [381, 505], [398, 584], [428, 676], [430, 485], [434, 316], [437, 824], [529, 459], [549, 481], [566, 219], [590, 710], [677, 883], [741, 40], [765, 761], [783, 664], [784, 560], [786, 303], [797, 492], [811, 110], [836, 94], [885, 980], [888, 415], [899, 310], [922, 960], [933, 56], [970, 649], [978, 346]]], "output": [[27, 775], [79, 228], [113, 107], [121, 440], [132, 156], [155, 382], [182, 489], [184, 757], [188, 909], [204, 882], [208, 290], [225, 866], [253, 752], [273, 175], [285, 401], [295, 248], [300, 552], [311, 628], [361, 357], [369, 482], [381, 505], [398, 584], [428, 955], [430, 1130], [434, 316], [437, 824], [529, 459], [549, 481], [566, 219], [590, 710], [677, 883], [741, 40], [765, 761], [783, 664], [784, 560], [786, 303], [797, 492], [811, 110], [836, 94], [885, 980], [888, 415], [899, 310], [922, 960], [933, 56], [970, 649], [978, 346]]}, {"inputs": [[[52, 966], [53, 511], [69, 965], [96, 222], [133, 663], [136, 733], [168, 385], [213, 978], [220, 44], [253, 333], [315, 598], [335, 438], [362, 770], [373, 266], [391, 927], [424, 107], [538, 949], [556, 678], [574, 334], [756, 978], [909, 973], [918, 685], [944, 794], [969, 492], [970, 753]], [[69, 699], [96, 926], [168, 908], [315, 84], [424, 736], [756, 1], [909, 126], [969, 358], [970, 801]]], "output": [[52, 966], [53, 511], [69, 1664], [96, 1148], [133, 663], [136, 733], [168, 1293], [213, 978], [220, 44], [253, 333], [315, 682], [335, 438], [362, 770], [373, 266], [391, 927], [424, 843], [538, 949], [556, 678], [574, 334], [756, 979], [909, 1099], [918, 685], [944, 794], [969, 850], [970, 1554]]}, {"inputs": [[[66, 301], [104, 426], [161, 161], [165, 612], [213, 549], [257, 737], [281, 631], [285, 415], [316, 46], [321, 98], [339, 382], [370, 225], [379, 102], [450, 823], [459, 71], [473, 538], [482, 409], [485, 433], [503, 854], [513, 930], [533, 354], [645, 274], [659, 395], [689, 468], [696, 914], [712, 762], [727, 835], [746, 881], [751, 915], [758, 287], [771, 231], [818, 883], [862, 802], [864, 299], [919, 473], [979, 811], [998, 851]], [[66, 649], [165, 463], [213, 732], [228, 798], [245, 755], [251, 908], [314, 913], [342, 648], [379, 131], [426, 184], [459, 464], [469, 546], [471, 856], [473, 832], [503, 268], [506, 916], [515, 915], [533, 406], [562, 626], [603, 834], [606, 595], [653, 139], [689, 649], [697, 351], [712, 873], [724, 996], [727, 656], [728, 438], [756, 940], [758, 574], [818, 163], [829, 411], [860, 778], [886, 59], [922, 412], [979, 660], [998, 319]]], "output": [[66, 950], [104, 426], [161, 161], [165, 1075], [213, 1281], [228, 798], [245, 755], [251, 908], [257, 737], [281, 631], [285, 415], [314, 913], [316, 46], [321, 98], [339, 382], [342, 648], [370, 225], [379, 233], [426, 184], [450, 823], [459, 535], [469, 546], [471, 856], [473, 1370], [482, 409], [485, 433], [503, 1122], [506, 916], [513, 930], [515, 915], [533, 760], [562, 626], [603, 834], [606, 595], [645, 274], [653, 139], [659, 395], [689, 1117], [696, 914], [697, 351], [712, 1635], [724, 996], [727, 1491], [728, 438], [746, 881], [751, 915], [756, 940], [758, 861], [771, 231], [818, 1046], [829, 411], [860, 778], [862, 802], [864, 299], [886, 59], [919, 473], [922, 412], [979, 1471], [998, 1170]]}, {"inputs": [[[29, 870], [74, 501], [118, 505], [122, 916], [188, 531], [318, 724], [329, 394], [330, 98], [334, 158], [475, 692], [575, 893], [585, 953], [587, 630], [647, 840], [679, 477], [687, 1], [717, 278], [745, 77], [763, 18], [866, 195], [937, 141], [985, 165]], [[5, 815], [29, 15], [53, 32], [113, 290], [118, 437], [122, 918], [134, 282], [161, 728], [188, 471], [248, 25], [275, 992], [301, 101], [318, 730], [334, 722], [387, 687], [477, 553], [502, 403], [548, 681], [561, 618], [575, 382], [587, 164], [647, 705], [654, 86], [687, 209], [717, 333], [753, 43], [763, 413], [776, 310], [801, 115], [828, 809], [861, 610], [926, 435], [937, 902]]], "output": [[5, 815], [29, 885], [53, 32], [74, 501], [113, 290], [118, 942], [122, 1834], [134, 282], [161, 728], [188, 1002], [248, 25], [275, 992], [301, 101], [318, 1454], [329, 394], [330, 98], [334, 880], [387, 687], [475, 692], [477, 553], [502, 403], [548, 681], [561, 618], [575, 1275], [585, 953], [587, 794], [647, 1545], [654, 86], [679, 477], [687, 210], [717, 611], [745, 77], [753, 43], [763, 431], [776, 310], [801, 115], [828, 809], [861, 610], [866, 195], [926, 435], [937, 1043], [985, 165]]}, {"inputs": [[[18, 68], [152, 947], [158, 199], [169, 45], [222, 33], [256, 185], [353, 217], [418, 32], [419, 846], [457, 593], [461, 135], [462, 766], [529, 425], [536, 300], [565, 339], [621, 854], [625, 316], [736, 309], [858, 660], [935, 169], [939, 764], [962, 230], [967, 261]], [[158, 771], [457, 152], [967, 69]]], "output": [[18, 68], [152, 947], [158, 970], [169, 45], [222, 33], [256, 185], [353, 217], [418, 32], [419, 846], [457, 745], [461, 135], [462, 766], [529, 425], [536, 300], [565, 339], [621, 854], [625, 316], [736, 309], [858, 660], [935, 169], [939, 764], [962, 230], [967, 330]]}, {"inputs": [[[17, 458], [56, 457], [77, 384], [90, 886], [138, 658], [143, 745], [147, 700], [186, 456], [274, 389], [308, 810], [374, 986], [439, 770], [451, 89], [633, 382], [675, 972], [683, 605], [704, 949], [786, 362], [806, 789], [821, 503], [844, 937], [922, 873], [925, 934], [964, 490], [988, 89]], [[90, 886], [147, 300], [633, 538], [683, 319], [786, 200], [789, 342], [795, 995], [844, 551]]], "output": [[17, 458], [56, 457], [77, 384], [90, 1772], [138, 658], [143, 745], [147, 1000], [186, 456], [274, 389], [308, 810], [374, 986], [439, 770], [451, 89], [633, 920], [675, 972], [683, 924], [704, 949], [786, 562], [789, 342], [795, 995], [806, 789], [821, 503], [844, 1488], [922, 873], [925, 934], [964, 490], [988, 89]]}, {"inputs": [[[11, 629], [44, 221], [171, 139], [200, 833], [240, 840], [310, 175], [373, 938], [495, 902], [600, 452], [676, 395], [697, 670], [711, 83], [743, 583], [808, 565], [839, 656], [863, 813], [950, 902]], [[278, 210], [365, 1000], [373, 909], [944, 824]]], "output": [[11, 629], [44, 221], [171, 139], [200, 833], [240, 840], [278, 210], [310, 175], [365, 1000], [373, 1847], [495, 902], [600, 452], [676, 395], [697, 670], [711, 83], [743, 583], [808, 565], [839, 656], [863, 813], [944, 824], [950, 902]]}, {"inputs": [[[29, 422], [36, 578], [75, 654], [79, 887], [106, 814], [150, 863], [224, 211], [280, 708], [314, 961], [332, 546], [352, 557], [389, 926], [424, 870], [482, 771], [539, 997], [561, 968], [565, 204], [567, 17], [613, 91], [710, 448], [715, 406], [720, 611], [745, 954], [769, 951], [790, 150], [797, 98], [806, 258], [812, 32], [880, 678], [889, 208], [901, 422], [928, 849], [955, 349], [960, 64], [993, 22]], [[29, 615], [75, 184], [150, 353], [224, 776], [332, 743], [482, 891], [769, 700], [955, 128], [993, 445]]], "output": [[29, 1037], [36, 578], [75, 838], [79, 887], [106, 814], [150, 1216], [224, 987], [280, 708], [314, 961], [332, 1289], [352, 557], [389, 926], [424, 870], [482, 1662], [539, 997], [561, 968], [565, 204], [567, 17], [613, 91], [710, 448], [715, 406], [720, 611], [745, 954], [769, 1651], [790, 150], [797, 98], [806, 258], [812, 32], [880, 678], [889, 208], [901, 422], [928, 849], [955, 477], [960, 64], [993, 467]]}, {"inputs": [[[15, 522], [165, 873], [190, 322], [249, 196], [368, 672], [511, 219], [539, 152], [558, 102], [563, 495], [565, 588], [602, 711], [608, 900], [667, 968], [712, 420], [755, 901], [808, 574], [900, 340], [971, 585], [973, 666], [999, 862]], [[15, 464], [83, 161], [89, 867], [119, 255], [165, 689], [180, 104], [190, 154], [236, 420], [301, 92], [324, 305], [334, 335], [368, 627], [379, 559], [396, 627], [459, 636], [506, 903], [511, 641], [534, 298], [536, 295], [592, 951], [602, 351], [608, 938], [618, 841], [667, 877], [684, 730], [711, 382], [712, 523], [741, 439], [751, 345], [755, 446], [795, 616], [808, 60], [843, 854], [869, 293], [872, 448], [895, 995], [917, 229], [935, 212], [955, 226], [971, 970], [973, 514], [978, 732]]], "output": [[15, 986], [83, 161], [89, 867], [119, 255], [165, 1562], [180, 104], [190, 476], [236, 420], [249, 196], [301, 92], [324, 305], [334, 335], [368, 1299], [379, 559], [396, 627], [459, 636], [506, 903], [511, 860], [534, 298], [536, 295], [539, 152], [558, 102], [563, 495], [565, 588], [592, 951], [602, 1062], [608, 1838], [618, 841], [667, 1845], [684, 730], [711, 382], [712, 943], [741, 439], [751, 345], [755, 1347], [795, 616], [808, 634], [843, 854], [869, 293], [872, 448], [895, 995], [900, 340], [917, 229], [935, 212], [955, 226], [971, 1555], [973, 1180], [978, 732], [999, 862]]}, {"inputs": [[[27, 409], [46, 589], [77, 299], [81, 268], [98, 98], [123, 7], [148, 946], [174, 215], [199, 863], [274, 768], [289, 360], [320, 472], [356, 914], [370, 364], [383, 950], [394, 690], [403, 336], [407, 972], [431, 43], [446, 423], [484, 177], [518, 419], [557, 501], [562, 481], [585, 409], [604, 161], [634, 365], [664, 50], [683, 549], [691, 228], [706, 800], [710, 986], [746, 880], [752, 305], [772, 877], [820, 424], [827, 347], [845, 886], [868, 957], [879, 86], [889, 723], [910, 810], [924, 775], [935, 106], [955, 367], [962, 335], [992, 207], [993, 564], [994, 846]], [[27, 248], [256, 894], [274, 9], [289, 858], [338, 676], [356, 868], [377, 776], [389, 637], [394, 573], [416, 685], [446, 524], [460, 264], [475, 119], [506, 656], [562, 481], [702, 157], [706, 804], [724, 821], [746, 701], [772, 43], [799, 298], [845, 983], [847, 305], [889, 368], [920, 709], [935, 346], [955, 970], [962, 79], [992, 163], [994, 200]]], "output": [[27, 657], [46, 589], [77, 299], [81, 268], [98, 98], [123, 7], [148, 946], [174, 215], [199, 863], [256, 894], [274, 777], [289, 1218], [320, 472], [338, 676], [356, 1782], [370, 364], [377, 776], [383, 950], [389, 637], [394, 1263], [403, 336], [407, 972], [416, 685], [431, 43], [446, 947], [460, 264], [475, 119], [484, 177], [506, 656], [518, 419], [557, 501], [562, 962], [585, 409], [604, 161], [634, 365], [664, 50], [683, 549], [691, 228], [702, 157], [706, 1604], [710, 986], [724, 821], [746, 1581], [752, 305], [772, 920], [799, 298], [820, 424], [827, 347], [845, 1869], [847, 305], [868, 957], [879, 86], [889, 1091], [910, 810], [920, 709], [924, 775], [935, 452], [955, 1337], [962, 414], [992, 370], [993, 564], [994, 1046]]}, {"inputs": [[[30, 573], [47, 797], [58, 951], [102, 571], [106, 201], [148, 89], [176, 428], [179, 595], [189, 637], [201, 152], [202, 772], [247, 836], [253, 647], [283, 776], [332, 988], [359, 470], [364, 348], [386, 913], [562, 667], [573, 699], [574, 184], [584, 264], [610, 979], [613, 568], [664, 828], [665, 911], [682, 15], [709, 919], [734, 492], [737, 647], [740, 324], [758, 842], [763, 320], [768, 836], [779, 764], [797, 232], [800, 79], [801, 858], [832, 438], [898, 82], [928, 581], [933, 802], [945, 103], [956, 147], [962, 803], [967, 291]], [[47, 366], [58, 612], [132, 579], [179, 697], [201, 214], [658, 732]]], "output": [[30, 573], [47, 1163], [58, 1563], [102, 571], [106, 201], [132, 579], [148, 89], [176, 428], [179, 1292], [189, 637], [201, 366], [202, 772], [247, 836], [253, 647], [283, 776], [332, 988], [359, 470], [364, 348], [386, 913], [562, 667], [573, 699], [574, 184], [584, 264], [610, 979], [613, 568], [658, 732], [664, 828], [665, 911], [682, 15], [709, 919], [734, 492], [737, 647], [740, 324], [758, 842], [763, 320], [768, 836], [779, 764], [797, 232], [800, 79], [801, 858], [832, 438], [898, 82], [928, 581], [933, 802], [945, 103], [956, 147], [962, 803], [967, 291]]}, {"inputs": [[[2, 914], [17, 827], [51, 986], [61, 494], [92, 43], [131, 430], [134, 606], [153, 172], [165, 735], [232, 695], [347, 722], [349, 870], [367, 331], [389, 279], [396, 472], [402, 279], [415, 206], [419, 758], [420, 646], [447, 351], [460, 262], [475, 659], [525, 798], [547, 376], [585, 947], [638, 411], [650, 648], [651, 889], [673, 886], [708, 747], [728, 614], [742, 404], [752, 108], [757, 340], [776, 459], [791, 930], [866, 950], [887, 8], [891, 597], [917, 568], [924, 798], [931, 151], [936, 706], [950, 814], [955, 265], [960, 60], [971, 777], [986, 364], [992, 308], [998, 772]], [[26, 959], [92, 171], [154, 510], [174, 744], [232, 641], [447, 864], [533, 437], [547, 829], [752, 945], [776, 953], [789, 921], [791, 603], [866, 995], [891, 729], [906, 613], [971, 847]]], "output": [[2, 914], [17, 827], [26, 959], [51, 986], [61, 494], [92, 214], [131, 430], [134, 606], [153, 172], [154, 510], [165, 735], [174, 744], [232, 1336], [347, 722], [349, 870], [367, 331], [389, 279], [396, 472], [402, 279], [415, 206], [419, 758], [420, 646], [447, 1215], [460, 262], [475, 659], [525, 798], [533, 437], [547, 1205], [585, 947], [638, 411], [650, 648], [651, 889], [673, 886], [708, 747], [728, 614], [742, 404], [752, 1053], [757, 340], [776, 1412], [789, 921], [791, 1533], [866, 1945], [887, 8], [891, 1326], [906, 613], [917, 568], [924, 798], [931, 151], [936, 706], [950, 814], [955, 265], [960, 60], [971, 1624], [986, 364], [992, 308], [998, 772]]}, {"inputs": [[[15, 134], [17, 740], [66, 6], [73, 988], [75, 6], [76, 962], [82, 197], [92, 275], [149, 350], [159, 822], [166, 840], [181, 528], [195, 167], [206, 340], [209, 400], [210, 9], [213, 848], [235, 970], [244, 373], [261, 701], [274, 662], [279, 244], [285, 352], [298, 240], [300, 191], [314, 276], [342, 436], [400, 322], [440, 907], [453, 5], [476, 756], [482, 858], [497, 810], [499, 520], [507, 508], [508, 906], [510, 402], [534, 232], [542, 438], [555, 664], [565, 188], [597, 314], [600, 587], [606, 415], [628, 859], [682, 671], [687, 735], [702, 267], [724, 325], [726, 216], [752, 359], [755, 485], [778, 516], [792, 533], [801, 946], [803, 784], [818, 621], [833, 379], [842, 425], [853, 843], [856, 644], [863, 268], [864, 926], [880, 738], [882, 225], [887, 55], [961, 105], [978, 48], [993, 740], [994, 449], [997, 63]], [[1, 802], [15, 809], [16, 449], [17, 153], [24, 749], [66, 942], [73, 845], [82, 386], [149, 943], [158, 892], [159, 642], [160, 160], [166, 718], [181, 234], [195, 840], [211, 586], [257, 815], [342, 703], [400, 67], [453, 429], [461, 182], [497, 703], [507, 861], [523, 630], [534, 260], [535, 341], [539, 217], [546, 653], [555, 238], [565, 350], [589, 477], [597, 446], [606, 681], [628, 733], [643, 609], [682, 988], [687, 370], [692, 779], [726, 747], [752, 8], [755, 705], [760, 962], [778, 985], [833, 19], [842, 185], [844, 502], [845, 702], [860, 806], [864, 739], [883, 76], [997, 752]]], "output": [[1, 802], [15, 943], [16, 449], [17, 893], [24, 749], [66, 948], [73, 1833], [75, 6], [76, 962], [82, 583], [92, 275], [149, 1293], [158, 892], [159, 1464], [160, 160], [166, 1558], [181, 762], [195, 1007], [206, 340], [209, 400], [210, 9], [211, 586], [213, 848], [235, 970], [244, 373], [257, 815], [261, 701], [274, 662], [279, 244], [285, 352], [298, 240], [300, 191], [314, 276], [342, 1139], [400, 389], [440, 907], [453, 434], [461, 182], [476, 756], [482, 858], [497, 1513], [499, 520], [507, 1369], [508, 906], [510, 402], [523, 630], [534, 492], [535, 341], [539, 217], [542, 438], [546, 653], [555, 902], [565, 538], [589, 477], [597, 760], [600, 587], [606, 1096], [628, 1592], [643, 609], [682, 1659], [687, 1105], [692, 779], [702, 267], [724, 325], [726, 963], [752, 367], [755, 1190], [760, 962], [778, 1501], [792, 533], [801, 946], [803, 784], [818, 621], [833, 398], [842, 610], [844, 502], [845, 702], [853, 843], [856, 644], [860, 806], [863, 268], [864, 1665], [880, 738], [882, 225], [883, 76], [887, 55], [961, 105], [978, 48], [993, 740], [994, 449], [997, 815]]}, {"inputs": [[[2, 941], [11, 218], [35, 747], [44, 455], [61, 383], [77, 135], [79, 312], [88, 80], [92, 453], [95, 916], [102, 461], [106, 500], [118, 478], [121, 900], [127, 322], [132, 186], [147, 544], [171, 321], [197, 301], [229, 854], [231, 886], [242, 416], [265, 680], [269, 745], [277, 555], [285, 627], [315, 820], [322, 276], [325, 239], [334, 668], [338, 103], [358, 821], [361, 762], [407, 221], [411, 624], [445, 53], [453, 638], [469, 64], [478, 578], [491, 735], [494, 347], [520, 553], [531, 716], [536, 463], [539, 186], [540, 573], [574, 518], [601, 347], [604, 884], [620, 799], [626, 671], [628, 986], [634, 650], [637, 741], [638, 124], [658, 102], [673, 315], [685, 683], [687, 964], [718, 864], [727, 373], [728, 849], [735, 115], [736, 454], [738, 921], [740, 414], [757, 635], [782, 586], [783, 130], [800, 740], [812, 877], [861, 407], [876, 989], [884, 859], [891, 924], [895, 635], [908, 174], [931, 301], [940, 960], [943, 897], [949, 824], [958, 755], [963, 755], [965, 723], [966, 923], [967, 136], [988, 507], [1000, 985]], [[9, 53], [15, 617], [33, 261], [35, 76], [44, 968], [48, 940], [54, 145], [57, 436], [61, 390], [72, 616], [88, 306], [91, 753], [95, 63], [106, 638], [118, 910], [121, 423], [127, 37], [132, 569], [142, 782], [147, 237], [196, 176], [215, 818], [229, 727], [237, 625], [259, 350], [285, 914], [289, 433], [299, 189], [315, 128], [317, 132], [322, 636], [361, 618], [393, 743], [407, 317], [410, 320], [414, 848], [418, 439], [424, 413], [428, 615], [440, 660], [455, 771], [459, 665], [465, 302], [478, 967], [491, 875], [504, 819], [515, 657], [531, 443], [539, 472], [540, 807], [555, 575], [574, 578], [591, 727], [606, 130], [621, 559], [628, 802], [633, 979], [637, 476], [648, 36], [654, 924], [673, 551], [685, 125], [687, 914], [689, 954], [718, 621], [735, 318], [738, 346], [740, 726], [782, 804], [789, 448], [800, 933], [803, 373], [828, 180], [838, 350], [841, 432], [861, 492], [876, 686], [882, 994], [884, 91], [891, 953], [895, 398], [903, 449], [908, 223], [940, 269], [943, 462], [963, 201], [965, 679], [967, 353], [983, 420], [1000, 480]]], "output": [[2, 941], [9, 53], [11, 218], [15, 617], [33, 261], [35, 823], [44, 1423], [48, 940], [54, 145], [57, 436], [61, 773], [72, 616], [77, 135], [79, 312], [88, 386], [91, 753], [92, 453], [95, 979], [102, 461], [106, 1138], [118, 1388], [121, 1323], [127, 359], [132, 755], [142, 782], [147, 781], [171, 321], [196, 176], [197, 301], [215, 818], [229, 1581], [231, 886], [237, 625], [242, 416], [259, 350], [265, 680], [269, 745], [277, 555], [285, 1541], [289, 433], [299, 189], [315, 948], [317, 132], [322, 912], [325, 239], [334, 668], [338, 103], [358, 821], [361, 1380], [393, 743], [407, 538], [410, 320], [411, 624], [414, 848], [418, 439], [424, 413], [428, 615], [440, 660], [445, 53], [453, 638], [455, 771], [459, 665], [465, 302], [469, 64], [478, 1545], [491, 1610], [494, 347], [504, 819], [515, 657], [520, 553], [531, 1159], [536, 463], [539, 658], [540, 1380], [555, 575], [574, 1096], [591, 727], [601, 347], [604, 884], [606, 130], [620, 799], [621, 559], [626, 671], [628, 1788], [633, 979], [634, 650], [637, 1217], [638, 124], [648, 36], [654, 924], [658, 102], [673, 866], [685, 808], [687, 1878], [689, 954], [718, 1485], [727, 373], [728, 849], [735, 433], [736, 454], [738, 1267], [740, 1140], [757, 635], [782, 1390], [783, 130], [789, 448], [800, 1673], [803, 373], [812, 877], [828, 180], [838, 350], [841, 432], [861, 899], [876, 1675], [882, 994], [884, 950], [891, 1877], [895, 1033], [903, 449], [908, 397], [931, 301], [940, 1229], [943, 1359], [949, 824], [958, 755], [963, 956], [965, 1402], [966, 923], [967, 489], [983, 420], [988, 507], [1000, 1465]]}, {"inputs": [[[12, 447], [19, 270], [28, 181], [29, 102], [33, 34], [51, 404], [56, 798], [84, 551], [107, 672], [108, 453], [121, 694], [129, 105], [130, 640], [131, 880], [147, 629], [150, 921], [185, 454], [188, 926], [232, 504], [253, 459], [279, 944], [340, 374], [409, 987], [435, 116], [440, 222], [464, 427], [482, 226], [491, 153], [502, 856], [504, 234], [506, 253], [519, 548], [536, 845], [553, 556], [571, 459], [587, 383], [596, 804], [622, 172], [677, 566], [680, 105], [698, 867], [699, 317], [727, 962], [734, 473], [735, 173], [743, 836], [747, 336], [757, 689], [775, 200], [776, 554], [789, 878], [818, 9], [821, 102], [832, 806], [841, 924], [850, 514], [858, 539], [886, 442], [897, 236], [901, 57], [903, 711], [906, 288], [913, 735], [922, 865], [928, 919], [932, 512], [945, 49], [964, 702], [968, 368]], [[12, 979], [33, 674], [51, 162], [56, 482], [73, 783], [84, 822], [110, 470], [121, 217], [129, 382], [130, 257], [144, 367], [160, 969], [168, 150], [171, 731], [173, 666], [175, 72], [206, 199], [209, 946], [235, 503], [237, 431], [246, 710], [250, 684], [251, 105], [253, 759], [267, 232], [278, 177], [279, 808], [290, 408], [299, 707], [311, 852], [327, 681], [333, 771], [368, 937], [385, 19], [386, 587], [404, 770], [407, 463], [409, 347], [419, 311], [430, 420], [440, 962], [474, 104], [484, 429], [496, 592], [502, 794], [512, 385], [519, 567], [535, 526], [536, 610], [545, 498], [547, 980], [553, 623], [587, 280], [596, 766], [600, 678], [615, 626], [650, 370], [653, 168], [654, 743], [680, 617], [698, 195], [699, 923], [705, 464], [707, 737], [743, 648], [747, 53], [757, 191], [762, 466], [770, 434], [775, 126], [776, 772], [800, 784], [801, 940], [818, 312], [821, 363], [832, 101], [841, 506], [842, 74], [845, 738], [869, 543], [877, 75], [899, 166], [906, 518], [921, 422], [922, 256], [928, 974], [951, 419], [961, 1000], [977, 251]]], "output": [[12, 1426], [19, 270], [28, 181], [29, 102], [33, 708], [51, 566], [56, 1280], [73, 783], [84, 1373], [107, 672], [108, 453], [110, 470], [121, 911], [129, 487], [130, 897], [131, 880], [144, 367], [147, 629], [150, 921], [160, 969], [168, 150], [171, 731], [173, 666], [175, 72], [185, 454], [188, 926], [206, 199], [209, 946], [232, 504], [235, 503], [237, 431], [246, 710], [250, 684], [251, 105], [253, 1218], [267, 232], [278, 177], [279, 1752], [290, 408], [299, 707], [311, 852], [327, 681], [333, 771], [340, 374], [368, 937], [385, 19], [386, 587], [404, 770], [407, 463], [409, 1334], [419, 311], [430, 420], [435, 116], [440, 1184], [464, 427], [474, 104], [482, 226], [484, 429], [491, 153], [496, 592], [502, 1650], [504, 234], [506, 253], [512, 385], [519, 1115], [535, 526], [536, 1455], [545, 498], [547, 980], [553, 1179], [571, 459], [587, 663], [596, 1570], [600, 678], [615, 626], [622, 172], [650, 370], [653, 168], [654, 743], [677, 566], [680, 722], [698, 1062], [699, 1240], [705, 464], [707, 737], [727, 962], [734, 473], [735, 173], [743, 1484], [747, 389], [757, 880], [762, 466], [770, 434], [775, 326], [776, 1326], [789, 878], [800, 784], [801, 940], [818, 321], [821, 465], [832, 907], [841, 1430], [842, 74], [845, 738], [850, 514], [858, 539], [869, 543], [877, 75], [886, 442], [897, 236], [899, 166], [901, 57], [903, 711], [906, 806], [913, 735], [921, 422], [922, 1121], [928, 1893], [932, 512], [945, 49], [951, 419], [961, 1000], [964, 702], [968, 368], [977, 251]]}]}} +{"id": "LeetCode/2710", "content": "# Minimum Operations to Reduce an Integer to 0\n\nYou are given a positive integer `n`, you can do the following operation **any** number of times:\n\n\n* Add or subtract a **power** of `2` from `n`.\n\n\nReturn *the **minimum** number of operations to make* `n` *equal to* `0`.\n\n\nA number `x` is power of `2` if `x == 2i` where `i >= 0`*.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 39\n**Output:** 3\n**Explanation:** We can do the following operations:\n- Add 20 = 1 to n, so now n = 40.\n- Subtract 23 = 8 from n, so now n = 32.\n- Subtract 25 = 32 from n, so now n = 0.\nIt can be shown that 3 is the minimum number of operations we need to make n equal to 0.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 54\n**Output:** 3\n**Explanation:** We can do the following operations:\n- Add 21 = 2 to n, so now n = 56.\n- Add 23 = 8 to n, so now n = 64.\n- Subtract 26 = 64 from n, so now n = 0.\nSo the minimum number of operations is 3.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minOperations(self, n: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minOperations(**[39]) == 3\nassert my_solution.minOperations(**[54]) == 3\nassert my_solution.minOperations(**[38]) == 3\nassert my_solution.minOperations(**[70]) == 3\nassert my_solution.minOperations(**[26]) == 3\nassert my_solution.minOperations(**[27]) == 3\nassert my_solution.minOperations(**[1]) == 1\nassert my_solution.minOperations(**[71]) == 3\nassert my_solution.minOperations(**[15]) == 2\nassert my_solution.minOperations(**[25]) == 3\nassert my_solution.minOperations(**[33]) == 2\nassert my_solution.minOperations(**[84]) == 3\nassert my_solution.minOperations(**[30]) == 2\nassert my_solution.minOperations(**[82]) == 3\nassert my_solution.minOperations(**[16]) == 1\nassert my_solution.minOperations(**[88]) == 3\nassert my_solution.minOperations(**[533]) == 4\nassert my_solution.minOperations(**[580]) == 3\nassert my_solution.minOperations(**[668]) == 4\nassert my_solution.minOperations(**[404]) == 4\n"}, "labels": {"questionId": "2710", "questionFrontendId": "2571", "questionTitle": "Minimum Operations to Reduce an Integer to 0", "stats": {"totalAccepted": "8K", "totalSubmission": "14.5K", "totalAcceptedRaw": 8047, "totalSubmissionRaw": 14516, "acRate": "55.4%"}, "probedCases": [{"inputs": [39], "output": 3}, {"inputs": [54], "output": 3}, {"inputs": [38], "output": 3}, {"inputs": [70], "output": 3}, {"inputs": [26], "output": 3}, {"inputs": [27], "output": 3}, {"inputs": [1], "output": 1}, {"inputs": [71], "output": 3}, {"inputs": [15], "output": 2}, {"inputs": [25], "output": 3}, {"inputs": [33], "output": 2}, {"inputs": [84], "output": 3}, {"inputs": [30], "output": 2}, {"inputs": [82], "output": 3}, {"inputs": [16], "output": 1}, {"inputs": [88], "output": 3}, {"inputs": [533], "output": 4}, {"inputs": [580], "output": 3}, {"inputs": [668], "output": 4}, {"inputs": [404], "output": 4}]}} +{"id": "LeetCode/2709", "content": "# Count the Number of Square-Free Subsets\n\nYou are given a positive integer **0-indexed** array `nums`.\n\n\nA subset of the array `nums` is **square-free** if the product of its elements is a **square-free integer**.\n\n\nA **square-free integer** is an integer that is divisible by no square number other than `1`.\n\n\nReturn *the number of square-free non-empty subsets of the array* **nums**. Since the answer may be too large, return it **modulo** `109 + 7`.\n\n\nA **non-empty** **subset** of `nums` is an array that can be obtained by deleting some (possibly none but not all) elements from `nums`. Two subsets are different if and only if the chosen indices to delete are different.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [3,4,4,5]\n**Output:** 3\n**Explanation:** There are 3 square-free subsets in this example:\n- The subset consisting of the 0th element [3]. The product of its elements is 3, which is a square-free integer.\n- The subset consisting of the 3rd element [5]. The product of its elements is 5, which is a square-free integer.\n- The subset consisting of 0th and 3rd elements [3,5]. The product of its elements is 15, which is a square-free integer.\nIt can be proven that there are no more than 3 square-free subsets in the given array.\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1]\n**Output:** 1\n**Explanation:** There is 1 square-free subset in this example:\n- The subset consisting of the 0th element [1]. The product of its elements is 1, which is a square-free integer.\nIt can be proven that there is no more than 1 square-free subset in the given array.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 1000`\n* `1 <= nums[i] <= 30`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def squareFreeSubsets(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.squareFreeSubsets(**[[3, 4, 4, 5]]) == 3\nassert my_solution.squareFreeSubsets(**[[1]]) == 1\nassert my_solution.squareFreeSubsets(**[[11, 2, 19, 7, 9, 27]]) == 15\nassert my_solution.squareFreeSubsets(**[[26, 6, 4, 27, 6, 18]]) == 3\nassert my_solution.squareFreeSubsets(**[[9, 13, 19, 23, 7, 27]]) == 15\nassert my_solution.squareFreeSubsets(**[[17, 27, 20, 1, 19]]) == 7\nassert my_solution.squareFreeSubsets(**[[8, 11, 17, 2, 25, 29, 21, 20, 4, 22]]) == 39\nassert my_solution.squareFreeSubsets(**[[11, 14, 25, 18, 29, 16]]) == 7\nassert my_solution.squareFreeSubsets(**[[10, 15, 6, 25]]) == 3\nassert my_solution.squareFreeSubsets(**[[26, 21, 2, 6, 19, 9, 29]]) == 27\nassert my_solution.squareFreeSubsets(**[[25, 16, 6, 18, 5]]) == 3\nassert my_solution.squareFreeSubsets(**[[16, 3, 6, 6, 20, 9, 15, 30, 22, 15]]) == 10\nassert my_solution.squareFreeSubsets(**[[22, 2, 5, 26, 28, 8, 4, 11, 12, 17, 11, 3, 19, 29, 19, 7, 24, 12, 22, 5, 8, 22]]) == 1727\nassert my_solution.squareFreeSubsets(**[[1, 2, 6, 15, 7, 19, 6, 29, 28, 24, 21, 25, 25, 18, 9, 6, 20, 21, 8, 24, 14, 19, 24, 28, 30, 27, 13, 21, 1, 23, 13, 29, 24, 29, 18, 7]]) == 9215\nassert my_solution.squareFreeSubsets(**[[15, 15, 25, 2, 12, 22, 28, 11, 28, 13, 26, 12, 1, 5]]) == 95\nassert my_solution.squareFreeSubsets(**[[1, 24, 2, 16, 18, 3, 26, 29, 16, 6, 1, 28, 18, 14, 12, 1, 16, 20, 27, 6, 22]]) == 191\nassert my_solution.squareFreeSubsets(**[[13, 21, 20, 11, 6, 19, 1, 20, 27, 25, 25, 23, 14, 24, 16, 13, 11, 27, 16, 4, 21, 30]]) == 431\nassert my_solution.squareFreeSubsets(**[[23, 15, 17, 5, 5, 9, 12, 20, 2, 4, 10, 9, 27, 16, 23, 9, 8, 17, 9]]) == 80\nassert my_solution.squareFreeSubsets(**[[3, 5, 21, 20, 10, 2, 29, 18, 28, 1, 29, 15, 18, 3, 22, 19, 3, 14, 22, 15, 18, 13, 12, 26, 12, 26, 17, 10, 6, 19, 21, 14, 10, 26, 18, 19, 20, 28, 12, 12, 15, 28, 19, 13, 20, 17]]) == 31589\nassert my_solution.squareFreeSubsets(**[[20, 12, 1, 21, 20, 19, 9, 14, 17, 17, 27, 28, 3, 16, 29, 22, 24, 9, 16, 6, 10, 4, 30, 3, 17, 13, 20, 9, 3, 22, 5, 30, 17, 24, 17, 21, 10, 20, 19, 23, 21]]) == 19583\n"}, "labels": {"questionId": "2709", "questionFrontendId": "2572", "questionTitle": "Count the Number of Square-Free Subsets", "stats": {"totalAccepted": "4K", "totalSubmission": "13K", "totalAcceptedRaw": 4016, "totalSubmissionRaw": 12968, "acRate": "31.0%"}, "probedCases": [{"inputs": [[3, 4, 4, 5]], "output": 3}, {"inputs": [[1]], "output": 1}, {"inputs": [[11, 2, 19, 7, 9, 27]], "output": 15}, {"inputs": [[26, 6, 4, 27, 6, 18]], "output": 3}, {"inputs": [[9, 13, 19, 23, 7, 27]], "output": 15}, {"inputs": [[17, 27, 20, 1, 19]], "output": 7}, {"inputs": [[8, 11, 17, 2, 25, 29, 21, 20, 4, 22]], "output": 39}, {"inputs": [[11, 14, 25, 18, 29, 16]], "output": 7}, {"inputs": [[10, 15, 6, 25]], "output": 3}, {"inputs": [[26, 21, 2, 6, 19, 9, 29]], "output": 27}, {"inputs": [[25, 16, 6, 18, 5]], "output": 3}, {"inputs": [[16, 3, 6, 6, 20, 9, 15, 30, 22, 15]], "output": 10}, {"inputs": [[22, 2, 5, 26, 28, 8, 4, 11, 12, 17, 11, 3, 19, 29, 19, 7, 24, 12, 22, 5, 8, 22]], "output": 1727}, {"inputs": [[1, 2, 6, 15, 7, 19, 6, 29, 28, 24, 21, 25, 25, 18, 9, 6, 20, 21, 8, 24, 14, 19, 24, 28, 30, 27, 13, 21, 1, 23, 13, 29, 24, 29, 18, 7]], "output": 9215}, {"inputs": [[15, 15, 25, 2, 12, 22, 28, 11, 28, 13, 26, 12, 1, 5]], "output": 95}, {"inputs": [[1, 24, 2, 16, 18, 3, 26, 29, 16, 6, 1, 28, 18, 14, 12, 1, 16, 20, 27, 6, 22]], "output": 191}, {"inputs": [[13, 21, 20, 11, 6, 19, 1, 20, 27, 25, 25, 23, 14, 24, 16, 13, 11, 27, 16, 4, 21, 30]], "output": 431}, {"inputs": [[23, 15, 17, 5, 5, 9, 12, 20, 2, 4, 10, 9, 27, 16, 23, 9, 8, 17, 9]], "output": 80}, {"inputs": [[3, 5, 21, 20, 10, 2, 29, 18, 28, 1, 29, 15, 18, 3, 22, 19, 3, 14, 22, 15, 18, 13, 12, 26, 12, 26, 17, 10, 6, 19, 21, 14, 10, 26, 18, 19, 20, 28, 12, 12, 15, 28, 19, 13, 20, 17]], "output": 31589}, {"inputs": [[20, 12, 1, 21, 20, 19, 9, 14, 17, 17, 27, 28, 3, 16, 29, 22, 24, 9, 16, 6, 10, 4, 30, 3, 17, 13, 20, 9, 3, 22, 5, 30, 17, 24, 17, 21, 10, 20, 19, 23, 21]], "output": 19583}]}} +{"id": "LeetCode/2708", "content": "# Find the String with LCP\n\nWe define the `lcp` matrix of any **0-indexed** string `word` of `n` lowercase English letters as an `n x n` grid such that:\n\n\n* `lcp[i][j]` is equal to the length of the **longest common prefix** between the substrings `word[i,n-1]` and `word[j,n-1]`.\n\n\nGiven an `n x n` matrix `lcp`, return the alphabetically smallest string `word` that corresponds to `lcp`. If there is no such string, return an empty string.\n\n\nA string `a` is lexicographically smaller than a string `b` (of the same length) if in the first position where `a` and `b` differ, string `a` has a letter that appears earlier in the alphabet than the corresponding letter in `b`. For example, `\"aabd\"` is lexicographically smaller than `\"aaca\"` because the first position they differ is at the third letter, and `'b'` comes before `'c'`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** lcp = [[4,0,2,0],[0,3,0,1],[2,0,2,0],[0,1,0,1]]\n**Output:** \"abab\"\n**Explanation:** lcp corresponds to any 4 letter string with two alternating letters. The lexicographically smallest of them is \"abab\".\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** lcp = [[4,3,2,1],[3,3,2,1],[2,2,2,1],[1,1,1,1]]\n**Output:** \"aaaa\"\n**Explanation:** lcp corresponds to any 4 letter string with a single distinct letter. The lexicographically smallest of them is \"aaaa\". \n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** lcp = [[4,3,2,1],[3,3,2,1],[2,2,2,1],[1,1,1,3]]\n**Output:** \"\"\n**Explanation:** lcp[3][3] cannot be equal to 3 since word[3,...,3] consists of only a single letter; Thus, no answer exists.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n ==``lcp.length ==` `lcp[i].length` `<= 1000`\n* `0 <= lcp[i][j] <= n`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findTheString(self, lcp: List[List[int]]) -> str:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findTheString(**[[[4, 0, 2, 0], [0, 3, 0, 1], [2, 0, 2, 0], [0, 1, 0, 1]]]) == abab\nassert my_solution.findTheString(**[[[4, 3, 2, 1], [3, 3, 2, 1], [2, 2, 2, 1], [1, 1, 1, 1]]]) == aaaa\nassert my_solution.findTheString(**[[[4, 3, 2, 1], [3, 3, 2, 1], [2, 2, 2, 1], [1, 1, 1, 3]]]) == \nassert my_solution.findTheString(**[[[1]]]) == a\nassert my_solution.findTheString(**[[[0]]]) == \nassert my_solution.findTheString(**[[[2, 0], [0, 1]]]) == ab\nassert my_solution.findTheString(**[[[2, 0], [1, 1]]]) == \nassert my_solution.findTheString(**[[[2, 0], [2, 1]]]) == \nassert my_solution.findTheString(**[[[2, 1], [0, 1]]]) == \nassert my_solution.findTheString(**[[[2, 1], [1, 1]]]) == aa\nassert my_solution.findTheString(**[[[2, 1], [2, 1]]]) == \nassert my_solution.findTheString(**[[[2, 2], [0, 1]]]) == \nassert my_solution.findTheString(**[[[2, 2], [1, 1]]]) == \nassert my_solution.findTheString(**[[[2, 2], [2, 1]]]) == \nassert my_solution.findTheString(**[[[4, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]]) == \nassert my_solution.findTheString(**[[[4, 1, 1, 1], [1, 3, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]]) == \nassert my_solution.findTheString(**[[[4, 1, 1, 1], [1, 3, 1, 1], [1, 1, 2, 1], [1, 1, 1, 1]]]) == \nassert my_solution.findTheString(**[[[8, 0, 0, 0, 0, 1, 2, 0], [0, 7, 0, 1, 1, 0, 0, 1], [0, 0, 6, 0, 0, 0, 0, 0], [0, 1, 0, 5, 1, 0, 0, 1], [0, 1, 0, 1, 4, 0, 0, 1], [1, 0, 0, 0, 0, 3, 1, 0], [2, 0, 0, 0, 0, 1, 2, 0], [0, 1, 0, 1, 1, 0, 0, 1]]]) == abcbbaab\nassert my_solution.findTheString(**[[[9, 1, 0, 1, 0, 1, 0, 0, 1], [1, 8, 0, 4, 0, 2, 0, 0, 1], [0, 0, 7, 0, 3, 0, 1, 2, 0], [1, 4, 0, 6, 0, 2, 0, 0, 1], [0, 0, 3, 0, 5, 0, 1, 2, 0], [1, 2, 0, 2, 0, 4, 0, 0, 1], [0, 0, 1, 0, 1, 0, 3, 1, 0], [0, 0, 2, 0, 2, 0, 1, 2, 0], [1, 1, 0, 1, 0, 1, 0, 0, 1]]]) == aabababba\nassert my_solution.findTheString(**[[[14, 2, 1, 0, 0, 0, 1, 0, 0, 0, 2, 1, 0, 0], [2, 13, 1, 0, 0, 0, 1, 0, 0, 0, 4, 1, 0, 0], [1, 1, 12, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0, 0], [0, 0, 0, 11, 1, 0, 0, 0, 2, 1, 0, 0, 2, 1], [0, 0, 0, 1, 10, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 9, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 8, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 7, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2, 1, 0, 0, 0, 6, 1, 0, 0, 2, 1], [0, 0, 0, 1, 1, 0, 0, 0, 1, 5, 0, 0, 1, 1], [2, 4, 1, 0, 0, 0, 1, 0, 0, 0, 4, 1, 0, 0], [1, 1, 3, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0, 0], [0, 0, 0, 2, 1, 0, 0, 0, 2, 1, 0, 0, 2, 1], [0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1]]]) == aaabbcacbbaabb\n"}, "labels": {"questionId": "2708", "questionFrontendId": "2573", "questionTitle": "Find the String with LCP", "stats": {"totalAccepted": "2K", "totalSubmission": "5.5K", "totalAcceptedRaw": 1972, "totalSubmissionRaw": 5511, "acRate": "35.8%"}, "probedCases": [{"inputs": [[[4, 0, 2, 0], [0, 3, 0, 1], [2, 0, 2, 0], [0, 1, 0, 1]]], "output": "abab"}, {"inputs": [[[4, 3, 2, 1], [3, 3, 2, 1], [2, 2, 2, 1], [1, 1, 1, 1]]], "output": "aaaa"}, {"inputs": [[[4, 3, 2, 1], [3, 3, 2, 1], [2, 2, 2, 1], [1, 1, 1, 3]]], "output": ""}, {"inputs": [[[1]]], "output": "a"}, {"inputs": [[[0]]], "output": ""}, {"inputs": [[[2, 0], [0, 1]]], "output": "ab"}, {"inputs": [[[2, 0], [1, 1]]], "output": ""}, {"inputs": [[[2, 0], [2, 1]]], "output": ""}, {"inputs": [[[2, 1], [0, 1]]], "output": ""}, {"inputs": [[[2, 1], [1, 1]]], "output": "aa"}, {"inputs": [[[2, 1], [2, 1]]], "output": ""}, {"inputs": [[[2, 2], [0, 1]]], "output": ""}, {"inputs": [[[2, 2], [1, 1]]], "output": ""}, {"inputs": [[[2, 2], [2, 1]]], "output": ""}, {"inputs": [[[4, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]], "output": ""}, {"inputs": [[[4, 1, 1, 1], [1, 3, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]], "output": ""}, {"inputs": [[[4, 1, 1, 1], [1, 3, 1, 1], [1, 1, 2, 1], [1, 1, 1, 1]]], "output": ""}, {"inputs": [[[8, 0, 0, 0, 0, 1, 2, 0], [0, 7, 0, 1, 1, 0, 0, 1], [0, 0, 6, 0, 0, 0, 0, 0], [0, 1, 0, 5, 1, 0, 0, 1], [0, 1, 0, 1, 4, 0, 0, 1], [1, 0, 0, 0, 0, 3, 1, 0], [2, 0, 0, 0, 0, 1, 2, 0], [0, 1, 0, 1, 1, 0, 0, 1]]], "output": "abcbbaab"}, {"inputs": [[[9, 1, 0, 1, 0, 1, 0, 0, 1], [1, 8, 0, 4, 0, 2, 0, 0, 1], [0, 0, 7, 0, 3, 0, 1, 2, 0], [1, 4, 0, 6, 0, 2, 0, 0, 1], [0, 0, 3, 0, 5, 0, 1, 2, 0], [1, 2, 0, 2, 0, 4, 0, 0, 1], [0, 0, 1, 0, 1, 0, 3, 1, 0], [0, 0, 2, 0, 2, 0, 1, 2, 0], [1, 1, 0, 1, 0, 1, 0, 0, 1]]], "output": "aabababba"}, {"inputs": [[[14, 2, 1, 0, 0, 0, 1, 0, 0, 0, 2, 1, 0, 0], [2, 13, 1, 0, 0, 0, 1, 0, 0, 0, 4, 1, 0, 0], [1, 1, 12, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0, 0], [0, 0, 0, 11, 1, 0, 0, 0, 2, 1, 0, 0, 2, 1], [0, 0, 0, 1, 10, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 9, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 8, 0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 7, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2, 1, 0, 0, 0, 6, 1, 0, 0, 2, 1], [0, 0, 0, 1, 1, 0, 0, 0, 1, 5, 0, 0, 1, 1], [2, 4, 1, 0, 0, 0, 1, 0, 0, 0, 4, 1, 0, 0], [1, 1, 3, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0, 0], [0, 0, 0, 2, 1, 0, 0, 0, 2, 1, 0, 0, 2, 1], [0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1]]], "output": "aaabbcacbbaabb"}]}} +{"id": "LeetCode/2704", "content": "# Maximum Difference by Remapping a Digit\n\nYou are given an integer `num`. You know that Bob will sneakily **remap** one of the `10` possible digits (`0` to `9`) to another digit.\n\n\nReturn *the difference between the maximum and minimum values Bob can make by remapping **exactly** **one** digit in* `num`.\n\n\n**Notes:**\n\n\n* When Bob remaps a digit d1 to another digit d2, Bob replaces all occurrences of `d1` in `num` with `d2`.\n* Bob can remap a digit to itself, in which case `num` does not change.\n* Bob can remap different digits for obtaining minimum and maximum values respectively.\n* The resulting number after remapping can contain leading zeroes.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** num = 11891\n**Output:** 99009\n**Explanation:** \nTo achieve the maximum value, Bob can remap the digit 1 to the digit 9 to yield 99899.\nTo achieve the minimum value, Bob can remap the digit 1 to the digit 0, yielding 890.\nThe difference between these two numbers is 99009.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** num = 90\n**Output:** 99\n**Explanation:**\nThe maximum value that can be returned by the function is 99 (if 0 is replaced by 9) and the minimum value that can be returned by the function is 0 (if 9 is replaced by 0).\nThus, we return 99.\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= num <= 108`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minMaxDifference(self, num: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minMaxDifference(**[11891]) == 99009\nassert my_solution.minMaxDifference(**[90]) == 99\nassert my_solution.minMaxDifference(**[22222]) == 99999\nassert my_solution.minMaxDifference(**[99999]) == 99999\nassert my_solution.minMaxDifference(**[456]) == 900\nassert my_solution.minMaxDifference(**[999]) == 999\nassert my_solution.minMaxDifference(**[909]) == 999\nassert my_solution.minMaxDifference(**[900]) == 999\nassert my_solution.minMaxDifference(**[199]) == 900\nassert my_solution.minMaxDifference(**[911]) == 988\nassert my_solution.minMaxDifference(**[867]) == 900\nassert my_solution.minMaxDifference(**[100000000]) == 900000000\nassert my_solution.minMaxDifference(**[95334529]) == 94000409\nassert my_solution.minMaxDifference(**[70682999]) == 90000000\nassert my_solution.minMaxDifference(**[90693669]) == 99090009\nassert my_solution.minMaxDifference(**[97746064]) == 92200000\nassert my_solution.minMaxDifference(**[72792650]) == 90900000\nassert my_solution.minMaxDifference(**[51734886]) == 90000000\nassert my_solution.minMaxDifference(**[39004871]) == 90000000\nassert my_solution.minMaxDifference(**[77448854]) == 99000000\n"}, "labels": {"questionId": "2704", "questionFrontendId": "2566", "questionTitle": "Maximum Difference by Remapping a Digit", "stats": {"totalAccepted": "6.1K", "totalSubmission": "9.6K", "totalAcceptedRaw": 6136, "totalSubmissionRaw": 9620, "acRate": "63.8%"}, "probedCases": [{"inputs": [11891], "output": 99009}, {"inputs": [90], "output": 99}, {"inputs": [22222], "output": 99999}, {"inputs": [99999], "output": 99999}, {"inputs": [456], "output": 900}, {"inputs": [999], "output": 999}, {"inputs": [909], "output": 999}, {"inputs": [900], "output": 999}, {"inputs": [199], "output": 900}, {"inputs": [911], "output": 988}, {"inputs": [867], "output": 900}, {"inputs": [100000000], "output": 900000000}, {"inputs": [95334529], "output": 94000409}, {"inputs": [70682999], "output": 90000000}, {"inputs": [90693669], "output": 99090009}, {"inputs": [97746064], "output": 92200000}, {"inputs": [72792650], "output": 90900000}, {"inputs": [51734886], "output": 90000000}, {"inputs": [39004871], "output": 90000000}, {"inputs": [77448854], "output": 99000000}]}} +{"id": "LeetCode/2706", "content": "# Minimum Score by Changing Two Elements\n\nYou are given a **0-indexed** integer array `nums`.\n\n\n* The **low** score of `nums` is the minimum value of `|nums[i] - nums[j]|` over all `0 <= i < j < nums.length`.\n* The **high** score of `nums` is the maximum value of `|nums[i] - nums[j]|` over all `0 <= i < j < nums.length`.\n* The **score** of `nums` is the sum of the **high** and **low** scores of nums.\n\n\nTo minimize the score of `nums`, we can change the value of **at most two** elements of `nums`.\n\n\nReturn *the **minimum** possible **score** after changing the value of **at most two** elements o*f `nums`.\n\n\nNote that `|x|` denotes the absolute value of `x`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,4,3]\n**Output:** 0\n**Explanation:** Change value of nums[1] and nums[2] to 1 so that nums becomes [1,1,1]. Now, the value of |nums[i] - nums[j]| is always equal to 0, so we return 0 + 0 = 0.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,4,7,8,5]\n**Output:** 3\n**Explanation:** Change nums[0] and nums[1] to be 6. Now nums becomes [6,6,7,8,5].\nOur low score is achieved when i = 0 and j = 1, in which case |nums[i] - nums[j]| = |6 - 6| = 0.\nOur high score is achieved when i = 3 and j = 4, in which case |nums[i] - nums[j]| = |8 - 5| = 3.\nThe sum of our high and low score is 3, which we can prove to be minimal.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `3 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimizeSum(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimizeSum(**[[1, 4, 3]]) == 0\nassert my_solution.minimizeSum(**[[1, 4, 7, 8, 5]]) == 3\nassert my_solution.minimizeSum(**[[31, 25, 72, 79, 74, 65]]) == 14\nassert my_solution.minimizeSum(**[[59, 27, 9, 81, 33]]) == 24\nassert my_solution.minimizeSum(**[[58, 42, 8, 75, 28]]) == 30\nassert my_solution.minimizeSum(**[[21, 13, 21, 72, 35, 52, 74]]) == 39\nassert my_solution.minimizeSum(**[[65, 77, 1, 73, 32, 43]]) == 34\nassert my_solution.minimizeSum(**[[100, 84, 80]]) == 0\nassert my_solution.minimizeSum(**[[88, 42, 53, 98]]) == 10\nassert my_solution.minimizeSum(**[[40, 60, 23, 99, 83, 5, 21, 76, 34, 99]]) == 76\nassert my_solution.minimizeSum(**[[23, 70, 18, 64, 12, 21, 21, 78, 36, 58]]) == 52\nassert my_solution.minimizeSum(**[[99, 26, 92, 91, 53, 10, 24, 25, 20, 92]]) == 72\nassert my_solution.minimizeSum(**[[51, 65, 87, 6, 17, 32, 14, 42, 46, 65]]) == 51\nassert my_solution.minimizeSum(**[[9, 75, 76, 25, 96, 46, 85, 19]]) == 66\nassert my_solution.minimizeSum(**[[88, 2, 5, 24, 60, 26]]) == 24\nassert my_solution.minimizeSum(**[[96, 82, 97, 97, 72]]) == 1\nassert my_solution.minimizeSum(**[[21, 77, 82, 30, 94, 55, 76]]) == 39\nassert my_solution.minimizeSum(**[[82, 3, 89, 52, 96, 72, 27, 59, 57]]) == 44\nassert my_solution.minimizeSum(**[[46, 88, 41]]) == 0\nassert my_solution.minimizeSum(**[[46, 4, 17, 2, 95, 6, 62, 69, 10]]) == 60\n"}, "labels": {"questionId": "2706", "questionFrontendId": "2567", "questionTitle": "Minimum Score by Changing Two Elements", "stats": {"totalAccepted": "4.5K", "totalSubmission": "8.4K", "totalAcceptedRaw": 4464, "totalSubmissionRaw": 8441, "acRate": "52.9%"}, "probedCases": [{"inputs": [[1, 4, 3]], "output": 0}, {"inputs": [[1, 4, 7, 8, 5]], "output": 3}, {"inputs": [[31, 25, 72, 79, 74, 65]], "output": 14}, {"inputs": [[59, 27, 9, 81, 33]], "output": 24}, {"inputs": [[58, 42, 8, 75, 28]], "output": 30}, {"inputs": [[21, 13, 21, 72, 35, 52, 74]], "output": 39}, {"inputs": [[65, 77, 1, 73, 32, 43]], "output": 34}, {"inputs": [[100, 84, 80]], "output": 0}, {"inputs": [[88, 42, 53, 98]], "output": 10}, {"inputs": [[40, 60, 23, 99, 83, 5, 21, 76, 34, 99]], "output": 76}, {"inputs": [[23, 70, 18, 64, 12, 21, 21, 78, 36, 58]], "output": 52}, {"inputs": [[99, 26, 92, 91, 53, 10, 24, 25, 20, 92]], "output": 72}, {"inputs": [[51, 65, 87, 6, 17, 32, 14, 42, 46, 65]], "output": 51}, {"inputs": [[9, 75, 76, 25, 96, 46, 85, 19]], "output": 66}, {"inputs": [[88, 2, 5, 24, 60, 26]], "output": 24}, {"inputs": [[96, 82, 97, 97, 72]], "output": 1}, {"inputs": [[21, 77, 82, 30, 94, 55, 76]], "output": 39}, {"inputs": [[82, 3, 89, 52, 96, 72, 27, 59, 57]], "output": 44}, {"inputs": [[46, 88, 41]], "output": 0}, {"inputs": [[46, 4, 17, 2, 95, 6, 62, 69, 10]], "output": 60}]}} +{"id": "LeetCode/2705", "content": "# Minimum Impossible OR\n\nYou are given a **0-indexed** integer array `nums`.\n\n\nWe say that an integer x is **expressible** from `nums` if there exist some integers `0 <= index1 < index2 < ... < indexk < nums.length` for which `nums[index1] | nums[index2] | ... | nums[indexk] = x`. In other words, an integer is expressible if it can be written as the bitwise OR of some subsequence of `nums`.\n\n\nReturn *the minimum **positive non-zero integer** that is not* *expressible from* `nums`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,1]\n**Output:** 4\n**Explanation:** 1 and 2 are already present in the array. We know that 3 is expressible, since nums[0] | nums[1] = 2 | 1 = 3. Since 4 is not expressible, we return 4.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,3,2]\n**Output:** 1\n**Explanation:** We can show that 1 is the smallest number that is not expressible.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minImpossibleOR(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minImpossibleOR(**[[2, 1]]) == 4\nassert my_solution.minImpossibleOR(**[[5, 3, 2]]) == 1\nassert my_solution.minImpossibleOR(**[[1, 25, 2, 72]]) == 4\nassert my_solution.minImpossibleOR(**[[4, 32, 16, 8, 8, 75, 1, 2]]) == 64\nassert my_solution.minImpossibleOR(**[[25, 2, 1, 92, 8, 4, 16]]) == 32\nassert my_solution.minImpossibleOR(**[[4, 1, 2, 8, 8, 16]]) == 32\nassert my_solution.minImpossibleOR(**[[2, 64, 1, 32, 4, 8, 16]]) == 128\nassert my_solution.minImpossibleOR(**[[1, 4, 2]]) == 8\nassert my_solution.minImpossibleOR(**[[4, 2, 1]]) == 8\nassert my_solution.minImpossibleOR(**[[21, 1]]) == 2\nassert my_solution.minImpossibleOR(**[[2, 4, 16, 1, 128, 64, 32, 8]]) == 256\nassert my_solution.minImpossibleOR(**[[1, 2, 4]]) == 8\nassert my_solution.minImpossibleOR(**[[4, 2, 8, 1, 87, 16, 6]]) == 32\nassert my_solution.minImpossibleOR(**[[96, 1]]) == 2\nassert my_solution.minImpossibleOR(**[[2, 1, 88]]) == 4\nassert my_solution.minImpossibleOR(**[[76, 2, 96, 82, 4, 8, 24, 1]]) == 16\nassert my_solution.minImpossibleOR(**[[1]]) == 2\nassert my_solution.minImpossibleOR(**[[6, 8, 46, 57, 59, 97, 4, 2, 1]]) == 16\nassert my_solution.minImpossibleOR(**[[2, 46, 1, 1, 24, 55, 71, 63]]) == 4\nassert my_solution.minImpossibleOR(**[[2, 8, 32, 1, 4, 16, 43, 64]]) == 128\n"}, "labels": {"questionId": "2705", "questionFrontendId": "2568", "questionTitle": "Minimum Impossible OR", "stats": {"totalAccepted": "4.1K", "totalSubmission": "6.8K", "totalAcceptedRaw": 4147, "totalSubmissionRaw": 6761, "acRate": "61.3%"}, "probedCases": [{"inputs": [[2, 1]], "output": 4}, {"inputs": [[5, 3, 2]], "output": 1}, {"inputs": [[1, 25, 2, 72]], "output": 4}, {"inputs": [[4, 32, 16, 8, 8, 75, 1, 2]], "output": 64}, {"inputs": [[25, 2, 1, 92, 8, 4, 16]], "output": 32}, {"inputs": [[4, 1, 2, 8, 8, 16]], "output": 32}, {"inputs": [[2, 64, 1, 32, 4, 8, 16]], "output": 128}, {"inputs": [[1, 4, 2]], "output": 8}, {"inputs": [[4, 2, 1]], "output": 8}, {"inputs": [[21, 1]], "output": 2}, {"inputs": [[2, 4, 16, 1, 128, 64, 32, 8]], "output": 256}, {"inputs": [[1, 2, 4]], "output": 8}, {"inputs": [[4, 2, 8, 1, 87, 16, 6]], "output": 32}, {"inputs": [[96, 1]], "output": 2}, {"inputs": [[2, 1, 88]], "output": 4}, {"inputs": [[76, 2, 96, 82, 4, 8, 24, 1]], "output": 16}, {"inputs": [[1]], "output": 2}, {"inputs": [[6, 8, 46, 57, 59, 97, 4, 2, 1]], "output": 16}, {"inputs": [[2, 46, 1, 1, 24, 55, 71, 63]], "output": 4}, {"inputs": [[2, 8, 32, 1, 4, 16, 43, 64]], "output": 128}]}} +{"id": "LeetCode/2703", "content": "# Handling Sum Queries After Update\n\nYou are given two **0-indexed** arrays `nums1` and `nums2` and a 2D array `queries` of queries. There are three types of queries:\n\n\n1. For a query of type 1, `queries[i] = [1, l, r]`. Flip the values from `0` to `1` and from `1` to `0` in `nums1` from index `l` to index `r`. Both `l` and `r` are **0-indexed**.\n2. For a query of type 2, `queries[i] = [2, p, 0]`. For every index `0 <= i < n`, set `nums2[i] = nums2[i] + nums1[i] * p`.\n3. For a query of type 3, `queries[i] = [3, 0, 0]`. Find the sum of the elements in `nums2`.\n\n\nReturn *an array containing all the answers to the third type queries.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums1 = [1,0,1], nums2 = [0,0,0], queries = [[1,1,1],[2,1,0],[3,0,0]]\n**Output:** [3]\n**Explanation:** After the first query nums1 becomes [1,1,1]. After the second query, nums2 becomes [1,1,1], so the answer to the third query is 3. Thus, [3] is returned.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums1 = [1], nums2 = [5], queries = [[2,0,0],[3,0,0]]\n**Output:** [5]\n**Explanation:** After the first query, nums2 remains [5], so the answer to the second query is 5. Thus, [5] is returned.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums1.length,nums2.length <= 105`\n* `nums1.length = nums2.length`\n* `1 <= queries.length <= 105`\n* `queries[i].length = 3`\n* `0 <= l <= r <= nums1.length - 1`\n* `0 <= p <= 106`\n* `0 <= nums1[i] <= 1`\n* `0 <= nums2[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def handleQuery(self, nums1: List[int], nums2: List[int], queries: List[List[int]]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.handleQuery(**[[1, 0, 1], [0, 0, 0], [[1, 1, 1], [2, 1, 0], [3, 0, 0]]]) == [3]\nassert my_solution.handleQuery(**[[1], [5], [[2, 0, 0], [3, 0, 0]]]) == [5]\nassert my_solution.handleQuery(**[[1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0], [48, 2, 32, 25, 30, 37, 32, 18, 48, 39, 34, 19, 46, 43, 30, 22, 20, 35, 28, 3, 5, 45, 39, 21, 46, 45, 12, 15], [[3, 0, 0], [2, 3, 0], [1, 10, 26], [2, 4, 0], [2, 18, 0]]]) == [819]\nassert my_solution.handleQuery(**[[0, 1, 0, 1, 0, 1, 0, 0, 0, 1], [35, 34, 38, 28, 38, 20, 18, 12, 2, 30], [[1, 2, 4], [1, 1, 9], [3, 0, 0]]]) == [255]\nassert my_solution.handleQuery(**[[1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0], [33, 13, 37, 28, 42, 5, 39, 31, 12, 1, 7, 23, 21], [[1, 1, 3], [3, 0, 0], [1, 0, 9], [3, 0, 0], [3, 0, 0], [3, 0, 0], [3, 0, 0], [1, 0, 1], [3, 0, 0], [1, 9, 9], [2, 3, 0], [2, 27, 0], [1, 0, 9], [1, 3, 5]]]) == [292, 292, 292, 292, 292, 292]\nassert my_solution.handleQuery(**[[0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1], [30, 46, 43, 34, 39, 16, 14, 41, 22, 11, 32, 2, 44, 12, 22, 36, 44, 49, 50, 10, 33, 7, 42], [[1, 15, 21], [3, 0, 0], [3, 0, 0], [2, 21, 0], [2, 13, 0], [3, 0, 0]]]) == [679, 679, 1053]\nassert my_solution.handleQuery(**[[0, 0, 0, 0, 1, 0, 1, 1, 1], [35, 29, 21, 34, 8, 48, 22, 43, 37], [[1, 4, 7], [3, 0, 0], [2, 27, 0], [3, 0, 0], [1, 0, 3], [3, 0, 0], [2, 6, 0], [1, 3, 8], [2, 13, 0], [3, 0, 0], [3, 0, 0], [3, 0, 0], [2, 2, 0], [2, 28, 0], [3, 0, 0], [3, 0, 0], [2, 25, 0], [3, 0, 0], [3, 0, 0], [1, 2, 5]]]) == [277, 331, 331, 445, 445, 445, 625, 625, 775, 775]\nassert my_solution.handleQuery(**[[1, 0, 1], [44, 28, 35], [[1, 0, 1], [2, 10, 0], [2, 2, 0], [2, 7, 0], [3, 0, 0], [3, 0, 0], [1, 2, 2], [1, 1, 2], [2, 1, 0], [1, 0, 2], [1, 2, 2], [1, 0, 2], [3, 0, 0], [1, 1, 2], [3, 0, 0], [1, 0, 1], [2, 21, 0], [1, 0, 1], [2, 26, 0], [1, 1, 1]]]) == [145, 145, 146, 146]\nassert my_solution.handleQuery(**[[1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0], [7, 17, 2, 13, 35, 23, 47, 45, 40, 23, 13, 37, 0, 9, 21, 50, 45, 21, 2, 10, 37], [[2, 13, 0], [3, 0, 0], [1, 9, 10], [2, 24, 0], [1, 1, 10], [1, 16, 16], [2, 13, 0], [2, 10, 0], [2, 4, 0], [1, 17, 20]]]) == [653]\nassert my_solution.handleQuery(**[[1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0], [21, 30, 44, 27, 19, 47, 10, 40, 4, 12, 3, 0, 25, 28, 50, 27], [[2, 8, 0], [2, 19, 0], [1, 13, 13]]]) == []\nassert my_solution.handleQuery(**[[0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1], [4, 33, 48, 7, 25, 13, 13, 6, 29, 23, 6, 9], [[2, 21, 0], [3, 0, 0], [2, 29, 0], [3, 0, 0], [2, 22, 0], [2, 27, 0], [2, 16, 0], [3, 0, 0], [3, 0, 0], [1, 8, 9], [1, 5, 10], [3, 0, 0], [2, 27, 0], [2, 2, 0], [3, 0, 0], [1, 4, 6], [2, 19, 0], [2, 23, 0], [3, 0, 0]]]) == [321, 466, 791, 791, 791, 994, 1246]\nassert my_solution.handleQuery(**[[1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0], [4, 33, 4, 8, 19, 48, 21, 9, 23, 33, 36, 43, 47, 48, 18, 30, 38, 1, 47, 19, 21, 31, 19, 24, 3, 41], [[1, 9, 19], [1, 1, 16], [2, 5, 0], [2, 29, 0], [3, 0, 0]]]) == [1280]\nassert my_solution.handleQuery(**[[0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1], [43, 22, 2, 24, 3, 30, 1, 38, 40, 6, 12, 50, 7, 39, 39, 41, 43, 50, 24, 47, 33, 2, 28], [[1, 14, 19], [3, 0, 0], [1, 1, 2], [2, 9, 0], [1, 16, 21], [3, 0, 0], [3, 0, 0], [1, 7, 9], [3, 0, 0], [3, 0, 0], [3, 0, 0], [3, 0, 0]]]) == [624, 714, 714, 714, 714, 714, 714]\nassert my_solution.handleQuery(**[[1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0], [7, 27, 5, 26, 6, 49, 46, 50, 27, 1, 20, 5, 4, 22], [[2, 12, 0]]]) == []\nassert my_solution.handleQuery(**[[0, 1, 0, 0, 0, 0], [14, 4, 13, 13, 47, 18], [[3, 0, 0], [1, 4, 4], [1, 1, 4], [1, 3, 4], [3, 0, 0], [2, 5, 0], [1, 1, 3], [2, 16, 0], [2, 10, 0], [3, 0, 0], [3, 0, 0], [2, 6, 0]]]) == [109, 109, 197, 197]\nassert my_solution.handleQuery(**[[0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1], [6, 10, 9, 14, 32, 15, 18, 26, 8, 25, 44, 8, 19, 47, 37, 19, 5, 28, 40], [[1, 12, 15], [1, 13, 18], [2, 15, 0], [1, 11, 15], [2, 3, 0], [1, 3, 11], [1, 17, 17], [3, 0, 0], [2, 30, 0], [2, 6, 0], [2, 14, 0], [1, 7, 14], [2, 30, 0], [3, 0, 0], [1, 11, 18], [3, 0, 0], [3, 0, 0]]]) == [539, 1279, 1279, 1279]\nassert my_solution.handleQuery(**[[1, 0, 0], [48, 18, 44], [[3, 0, 0], [2, 1, 0], [1, 1, 1], [3, 0, 0], [2, 18, 0], [3, 0, 0], [1, 1, 2], [1, 2, 2], [1, 2, 2], [2, 21, 0], [1, 0, 1], [3, 0, 0], [1, 0, 1], [2, 17, 0], [3, 0, 0]]]) == [110, 111, 147, 189, 223]\nassert my_solution.handleQuery(**[[1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1], [28, 47, 22, 48, 38, 2, 50, 19, 7, 48, 4, 18, 33, 36, 34, 26, 47, 18, 23, 10, 44, 24, 37], [[1, 17, 22], [2, 12, 0], [3, 0, 0], [2, 24, 0], [2, 7, 0], [2, 16, 0], [3, 0, 0], [3, 0, 0], [2, 16, 0], [3, 0, 0], [1, 14, 18], [1, 15, 15], [3, 0, 0], [1, 0, 11], [2, 13, 0]]]) == [795, 1312, 1312, 1488, 1488]\nassert my_solution.handleQuery(**[[0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [33, 43, 43, 0, 2, 39, 17, 46, 9, 12, 27, 45, 24, 21, 41, 9, 45, 33, 8, 11, 22, 27, 24, 50, 28, 37, 24, 14, 11], [[1, 23, 28], [3, 0, 0], [1, 7, 26], [2, 20, 0], [1, 22, 28], [3, 0, 0], [2, 25, 0], [2, 14, 0], [2, 2, 0], [3, 0, 0], [3, 0, 0], [3, 0, 0]]]) == [745, 925, 1417, 1417, 1417]\nassert my_solution.handleQuery(**[[1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0], [37, 31, 45, 13, 17, 2, 10, 0, 41, 8, 50, 43, 38, 35, 29, 21, 38, 50, 20, 20, 1, 12], [[1, 6, 17], [1, 6, 14], [3, 0, 0], [3, 0, 0], [3, 0, 0], [2, 10, 0], [3, 0, 0], [2, 9, 0], [2, 12, 0], [3, 0, 0], [1, 1, 10], [3, 0, 0]]]) == [561, 561, 561, 711, 1026, 1026]\n"}, "labels": {"questionId": "2703", "questionFrontendId": "2569", "questionTitle": "Handling Sum Queries After Update", "stats": {"totalAccepted": "13.1K", "totalSubmission": "30.9K", "totalAcceptedRaw": 13094, "totalSubmissionRaw": 30870, "acRate": "42.4%"}, "probedCases": [{"inputs": [[1, 0, 1], [0, 0, 0], [[1, 1, 1], [2, 1, 0], [3, 0, 0]]], "output": [3]}, {"inputs": [[1], [5], [[2, 0, 0], [3, 0, 0]]], "output": [5]}, {"inputs": [[1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0], [48, 2, 32, 25, 30, 37, 32, 18, 48, 39, 34, 19, 46, 43, 30, 22, 20, 35, 28, 3, 5, 45, 39, 21, 46, 45, 12, 15], [[3, 0, 0], [2, 3, 0], [1, 10, 26], [2, 4, 0], [2, 18, 0]]], "output": [819]}, {"inputs": [[0, 1, 0, 1, 0, 1, 0, 0, 0, 1], [35, 34, 38, 28, 38, 20, 18, 12, 2, 30], [[1, 2, 4], [1, 1, 9], [3, 0, 0]]], "output": [255]}, {"inputs": [[1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0], [33, 13, 37, 28, 42, 5, 39, 31, 12, 1, 7, 23, 21], [[1, 1, 3], [3, 0, 0], [1, 0, 9], [3, 0, 0], [3, 0, 0], [3, 0, 0], [3, 0, 0], [1, 0, 1], [3, 0, 0], [1, 9, 9], [2, 3, 0], [2, 27, 0], [1, 0, 9], [1, 3, 5]]], "output": [292, 292, 292, 292, 292, 292]}, {"inputs": [[0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1], [30, 46, 43, 34, 39, 16, 14, 41, 22, 11, 32, 2, 44, 12, 22, 36, 44, 49, 50, 10, 33, 7, 42], [[1, 15, 21], [3, 0, 0], [3, 0, 0], [2, 21, 0], [2, 13, 0], [3, 0, 0]]], "output": [679, 679, 1053]}, {"inputs": [[0, 0, 0, 0, 1, 0, 1, 1, 1], [35, 29, 21, 34, 8, 48, 22, 43, 37], [[1, 4, 7], [3, 0, 0], [2, 27, 0], [3, 0, 0], [1, 0, 3], [3, 0, 0], [2, 6, 0], [1, 3, 8], [2, 13, 0], [3, 0, 0], [3, 0, 0], [3, 0, 0], [2, 2, 0], [2, 28, 0], [3, 0, 0], [3, 0, 0], [2, 25, 0], [3, 0, 0], [3, 0, 0], [1, 2, 5]]], "output": [277, 331, 331, 445, 445, 445, 625, 625, 775, 775]}, {"inputs": [[1, 0, 1], [44, 28, 35], [[1, 0, 1], [2, 10, 0], [2, 2, 0], [2, 7, 0], [3, 0, 0], [3, 0, 0], [1, 2, 2], [1, 1, 2], [2, 1, 0], [1, 0, 2], [1, 2, 2], [1, 0, 2], [3, 0, 0], [1, 1, 2], [3, 0, 0], [1, 0, 1], [2, 21, 0], [1, 0, 1], [2, 26, 0], [1, 1, 1]]], "output": [145, 145, 146, 146]}, {"inputs": [[1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0], [7, 17, 2, 13, 35, 23, 47, 45, 40, 23, 13, 37, 0, 9, 21, 50, 45, 21, 2, 10, 37], [[2, 13, 0], [3, 0, 0], [1, 9, 10], [2, 24, 0], [1, 1, 10], [1, 16, 16], [2, 13, 0], [2, 10, 0], [2, 4, 0], [1, 17, 20]]], "output": [653]}, {"inputs": [[1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0], [21, 30, 44, 27, 19, 47, 10, 40, 4, 12, 3, 0, 25, 28, 50, 27], [[2, 8, 0], [2, 19, 0], [1, 13, 13]]], "output": []}, {"inputs": [[0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1], [4, 33, 48, 7, 25, 13, 13, 6, 29, 23, 6, 9], [[2, 21, 0], [3, 0, 0], [2, 29, 0], [3, 0, 0], [2, 22, 0], [2, 27, 0], [2, 16, 0], [3, 0, 0], [3, 0, 0], [1, 8, 9], [1, 5, 10], [3, 0, 0], [2, 27, 0], [2, 2, 0], [3, 0, 0], [1, 4, 6], [2, 19, 0], [2, 23, 0], [3, 0, 0]]], "output": [321, 466, 791, 791, 791, 994, 1246]}, {"inputs": [[1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0], [4, 33, 4, 8, 19, 48, 21, 9, 23, 33, 36, 43, 47, 48, 18, 30, 38, 1, 47, 19, 21, 31, 19, 24, 3, 41], [[1, 9, 19], [1, 1, 16], [2, 5, 0], [2, 29, 0], [3, 0, 0]]], "output": [1280]}, {"inputs": [[0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1], [43, 22, 2, 24, 3, 30, 1, 38, 40, 6, 12, 50, 7, 39, 39, 41, 43, 50, 24, 47, 33, 2, 28], [[1, 14, 19], [3, 0, 0], [1, 1, 2], [2, 9, 0], [1, 16, 21], [3, 0, 0], [3, 0, 0], [1, 7, 9], [3, 0, 0], [3, 0, 0], [3, 0, 0], [3, 0, 0]]], "output": [624, 714, 714, 714, 714, 714, 714]}, {"inputs": [[1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0], [7, 27, 5, 26, 6, 49, 46, 50, 27, 1, 20, 5, 4, 22], [[2, 12, 0]]], "output": []}, {"inputs": [[0, 1, 0, 0, 0, 0], [14, 4, 13, 13, 47, 18], [[3, 0, 0], [1, 4, 4], [1, 1, 4], [1, 3, 4], [3, 0, 0], [2, 5, 0], [1, 1, 3], [2, 16, 0], [2, 10, 0], [3, 0, 0], [3, 0, 0], [2, 6, 0]]], "output": [109, 109, 197, 197]}, {"inputs": [[0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1], [6, 10, 9, 14, 32, 15, 18, 26, 8, 25, 44, 8, 19, 47, 37, 19, 5, 28, 40], [[1, 12, 15], [1, 13, 18], [2, 15, 0], [1, 11, 15], [2, 3, 0], [1, 3, 11], [1, 17, 17], [3, 0, 0], [2, 30, 0], [2, 6, 0], [2, 14, 0], [1, 7, 14], [2, 30, 0], [3, 0, 0], [1, 11, 18], [3, 0, 0], [3, 0, 0]]], "output": [539, 1279, 1279, 1279]}, {"inputs": [[1, 0, 0], [48, 18, 44], [[3, 0, 0], [2, 1, 0], [1, 1, 1], [3, 0, 0], [2, 18, 0], [3, 0, 0], [1, 1, 2], [1, 2, 2], [1, 2, 2], [2, 21, 0], [1, 0, 1], [3, 0, 0], [1, 0, 1], [2, 17, 0], [3, 0, 0]]], "output": [110, 111, 147, 189, 223]}, {"inputs": [[1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1], [28, 47, 22, 48, 38, 2, 50, 19, 7, 48, 4, 18, 33, 36, 34, 26, 47, 18, 23, 10, 44, 24, 37], [[1, 17, 22], [2, 12, 0], [3, 0, 0], [2, 24, 0], [2, 7, 0], [2, 16, 0], [3, 0, 0], [3, 0, 0], [2, 16, 0], [3, 0, 0], [1, 14, 18], [1, 15, 15], [3, 0, 0], [1, 0, 11], [2, 13, 0]]], "output": [795, 1312, 1312, 1488, 1488]}, {"inputs": [[0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], [33, 43, 43, 0, 2, 39, 17, 46, 9, 12, 27, 45, 24, 21, 41, 9, 45, 33, 8, 11, 22, 27, 24, 50, 28, 37, 24, 14, 11], [[1, 23, 28], [3, 0, 0], [1, 7, 26], [2, 20, 0], [1, 22, 28], [3, 0, 0], [2, 25, 0], [2, 14, 0], [2, 2, 0], [3, 0, 0], [3, 0, 0], [3, 0, 0]]], "output": [745, 925, 1417, 1417, 1417]}, {"inputs": [[1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0], [37, 31, 45, 13, 17, 2, 10, 0, 41, 8, 50, 43, 38, 35, 29, 21, 38, 50, 20, 20, 1, 12], [[1, 6, 17], [1, 6, 14], [3, 0, 0], [3, 0, 0], [3, 0, 0], [2, 10, 0], [3, 0, 0], [2, 9, 0], [2, 12, 0], [3, 0, 0], [1, 1, 10], [3, 0, 0]]], "output": [561, 561, 561, 711, 1026, 1026]}]}} +{"id": "LeetCode/2698", "content": "# Find the Array Concatenation Value\n\nYou are given a **0-indexed** integer array `nums`.\n\n\nThe **concatenation** of two numbers is the number formed by concatenating their numerals.\n\n\n* For example, the concatenation of `15`, `49` is `1549`.\n\n\nThe **concatenation value** of `nums` is initially equal to `0`. Perform this operation until `nums` becomes empty:\n\n\n* If there exists more than one number in `nums`, pick the first element and last element in `nums` respectively and add the value of their concatenation to the **concatenation value** of `nums`, then delete the first and last element from `nums`.\n* If one element exists, add its value to the **concatenation value** of `nums`, then delete it.\n\n\nReturn *the concatenation value of the `nums`*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [7,52,2,4]\n**Output:** 596\n**Explanation:** Before performing any operation, nums is [7,52,2,4] and concatenation value is 0.\n - In the first operation:\nWe pick the first element, 7, and the last element, 4.\nTheir concatenation is 74, and we add it to the concatenation value, so it becomes equal to 74.\nThen we delete them from nums, so nums becomes equal to [52,2].\n - In the second operation:\nWe pick the first element, 52, and the last element, 2.\nTheir concatenation is 522, and we add it to the concatenation value, so it becomes equal to 596.\nThen we delete them from the nums, so nums becomes empty.\nSince the concatenation value is 596 so the answer is 596.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [5,14,13,8,12]\n**Output:** 673\n**Explanation:** Before performing any operation, nums is [5,14,13,8,12] and concatenation value is 0.\n - In the first operation:\nWe pick the first element, 5, and the last element, 12.\nTheir concatenation is 512, and we add it to the concatenation value, so it becomes equal to 512.\nThen we delete them from the nums, so nums becomes equal to [14,13,8].\n - In the second operation:\nWe pick the first element, 14, and the last element, 8.\nTheir concatenation is 148, and we add it to the concatenation value, so it becomes equal to 660.\nThen we delete them from the nums, so nums becomes equal to [13].\n - In the third operation:\nnums has only one element, so we pick 13 and add it to the concatenation value, so it becomes equal to 673.\nThen we delete it from nums, so nums become empty.\nSince the concatenation value is 673 so the answer is 673.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 1000`\n* `1 <= nums[i] <= 104`\n\n\n \n\n\n.spoilerbutton {display:block; border:dashed; padding: 0px 0px; margin:10px 0px; font-size:150%; font-weight: bold; color:#000000; background-color:cyan; outline:0; \n}\n.spoiler {overflow:hidden;}\n.spoiler > div {-webkit-transition: all 0s ease;-moz-transition: margin 0s ease;-o-transition: all 0s ease;transition: margin 0s ease;}\n.spoilerbutton[value=\"Show Message\"] + .spoiler > div {margin-top:-500%;}\n.spoilerbutton[value=\"Hide Message\"] + .spoiler {padding:5px;}\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def findTheArrayConcVal(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.findTheArrayConcVal(**[[7, 52, 2, 4]]) == 596\nassert my_solution.findTheArrayConcVal(**[[5, 14, 13, 8, 12]]) == 673\nassert my_solution.findTheArrayConcVal(**[[1, 78, 27, 48, 14, 86, 79, 68, 77, 20, 57, 21, 18, 67, 5, 51, 70, 85, 47, 56, 22, 79, 41, 8, 39, 81, 59, 74, 14, 45, 49, 15, 10, 28]]) == 74322\nassert my_solution.findTheArrayConcVal(**[[77, 22, 65, 8, 36, 79, 94, 44]]) == 17453\nassert my_solution.findTheArrayConcVal(**[[72, 8, 96, 78, 39, 92, 69, 55, 9, 44, 26, 76, 40, 77, 16, 69, 40, 64, 12, 48, 66, 7, 59, 10, 33, 72, 97, 60, 79, 68, 25, 63, 82, 88, 60, 37, 60, 44, 14, 62]]) == 103006\nassert my_solution.findTheArrayConcVal(**[[52, 73, 26, 98, 86, 50, 74, 68, 53, 80, 90, 60, 78, 56, 53, 84, 2, 26]]) == 51959\nassert my_solution.findTheArrayConcVal(**[[83, 48, 10, 24, 55, 9, 100, 10, 17, 17, 99, 51, 32, 16, 98, 99, 31, 28, 68, 71, 14]]) == 37907\nassert my_solution.findTheArrayConcVal(**[[29, 15, 40, 59, 57, 40, 57, 51, 90, 51, 68, 100, 24, 39, 11, 85, 2, 22, 67, 29, 74, 82, 10, 96, 14, 35, 25, 76, 26, 54, 29, 44]]) == 74635\nassert my_solution.findTheArrayConcVal(**[[49, 73, 50, 95, 89, 43, 62, 24, 88, 88, 36, 6, 16, 14, 2, 42, 42, 60, 25, 4, 58, 23, 22, 27, 26, 3, 79, 64, 20, 92, 63, 56]]) == 71344\nassert my_solution.findTheArrayConcVal(**[[98, 34, 47, 91, 91, 23, 88, 43, 53, 29, 70, 23, 77, 24, 22, 4, 79, 38, 13, 36, 94, 19, 91, 44, 8, 56, 97, 77, 93, 55, 59, 77, 8, 95, 48, 50, 59, 32, 76, 78, 31, 3, 81, 44, 5, 52]]) == 104808\nassert my_solution.findTheArrayConcVal(**[[88, 86, 87, 92, 69, 58, 82, 50, 82, 34, 72, 56, 46, 35, 85, 4, 16, 58, 52, 51, 53, 67, 29, 12, 42, 67, 76]]) == 85807\nassert my_solution.findTheArrayConcVal(**[[51, 31, 49, 9, 72, 83, 84, 12, 85, 78, 73, 3, 48, 22, 59, 99, 63, 10, 21, 43, 77, 43, 74, 75, 27, 13, 29, 73, 13, 20, 6, 56, 75, 83, 26, 24, 53, 56, 61, 96, 57, 33, 89, 99, 93, 81, 28, 49]]) == 126740\nassert my_solution.findTheArrayConcVal(**[[88, 29, 51, 26, 95, 35, 61, 31, 96, 15, 65, 87, 12, 15, 81, 38, 96, 58, 23, 85, 5, 81, 26, 98, 66, 53, 92, 87, 23, 29, 53, 83, 63, 63, 25, 25, 72, 47, 34, 24]]) == 102099\nassert my_solution.findTheArrayConcVal(**[[8, 43, 100, 80, 17, 72, 69, 7, 7, 32, 80, 8, 58, 70, 81, 79, 67, 66, 24, 64, 66, 9, 67, 33, 11, 62, 86, 5, 84, 78, 85, 69]]) == 73246\nassert my_solution.findTheArrayConcVal(**[[92, 14]]) == 9214\nassert my_solution.findTheArrayConcVal(**[[90, 31, 40, 54, 63, 99, 88, 28, 100, 5, 72, 89, 60, 90, 71, 97, 16, 7, 60, 6, 57, 73, 84, 17, 8, 77, 60, 7, 74, 74, 24, 52, 43, 94]]) == 93917\nassert my_solution.findTheArrayConcVal(**[[9, 99, 84, 89, 96, 40, 15, 29, 80, 19, 54, 75, 49, 27, 87, 95, 22, 28, 54, 66, 55, 99, 17, 75]]) == 69574\nassert my_solution.findTheArrayConcVal(**[[90, 47, 14, 9, 63, 18, 51, 15, 50, 24, 86, 30, 44, 51, 13, 91, 95, 52, 50, 99]]) == 38711\nassert my_solution.findTheArrayConcVal(**[[74, 67, 34, 75, 31, 91, 47, 6, 37, 62, 72, 42, 85, 95, 10, 8, 43, 21, 63]]) == 39951\nassert my_solution.findTheArrayConcVal(**[[45, 23, 69, 16, 99, 92, 5, 97, 69, 33, 44, 8, 33]]) == 32619\n"}, "labels": {"questionId": "2698", "questionFrontendId": "2562", "questionTitle": "Find the Array Concatenation Value", "stats": {"totalAccepted": "34.8K", "totalSubmission": "46.1K", "totalAcceptedRaw": 34830, "totalSubmissionRaw": 46076, "acRate": "75.6%"}, "probedCases": [{"inputs": [[7, 52, 2, 4]], "output": 596}, {"inputs": [[5, 14, 13, 8, 12]], "output": 673}, {"inputs": [[1, 78, 27, 48, 14, 86, 79, 68, 77, 20, 57, 21, 18, 67, 5, 51, 70, 85, 47, 56, 22, 79, 41, 8, 39, 81, 59, 74, 14, 45, 49, 15, 10, 28]], "output": 74322}, {"inputs": [[77, 22, 65, 8, 36, 79, 94, 44]], "output": 17453}, {"inputs": [[72, 8, 96, 78, 39, 92, 69, 55, 9, 44, 26, 76, 40, 77, 16, 69, 40, 64, 12, 48, 66, 7, 59, 10, 33, 72, 97, 60, 79, 68, 25, 63, 82, 88, 60, 37, 60, 44, 14, 62]], "output": 103006}, {"inputs": [[52, 73, 26, 98, 86, 50, 74, 68, 53, 80, 90, 60, 78, 56, 53, 84, 2, 26]], "output": 51959}, {"inputs": [[83, 48, 10, 24, 55, 9, 100, 10, 17, 17, 99, 51, 32, 16, 98, 99, 31, 28, 68, 71, 14]], "output": 37907}, {"inputs": [[29, 15, 40, 59, 57, 40, 57, 51, 90, 51, 68, 100, 24, 39, 11, 85, 2, 22, 67, 29, 74, 82, 10, 96, 14, 35, 25, 76, 26, 54, 29, 44]], "output": 74635}, {"inputs": [[49, 73, 50, 95, 89, 43, 62, 24, 88, 88, 36, 6, 16, 14, 2, 42, 42, 60, 25, 4, 58, 23, 22, 27, 26, 3, 79, 64, 20, 92, 63, 56]], "output": 71344}, {"inputs": [[98, 34, 47, 91, 91, 23, 88, 43, 53, 29, 70, 23, 77, 24, 22, 4, 79, 38, 13, 36, 94, 19, 91, 44, 8, 56, 97, 77, 93, 55, 59, 77, 8, 95, 48, 50, 59, 32, 76, 78, 31, 3, 81, 44, 5, 52]], "output": 104808}, {"inputs": [[88, 86, 87, 92, 69, 58, 82, 50, 82, 34, 72, 56, 46, 35, 85, 4, 16, 58, 52, 51, 53, 67, 29, 12, 42, 67, 76]], "output": 85807}, {"inputs": [[51, 31, 49, 9, 72, 83, 84, 12, 85, 78, 73, 3, 48, 22, 59, 99, 63, 10, 21, 43, 77, 43, 74, 75, 27, 13, 29, 73, 13, 20, 6, 56, 75, 83, 26, 24, 53, 56, 61, 96, 57, 33, 89, 99, 93, 81, 28, 49]], "output": 126740}, {"inputs": [[88, 29, 51, 26, 95, 35, 61, 31, 96, 15, 65, 87, 12, 15, 81, 38, 96, 58, 23, 85, 5, 81, 26, 98, 66, 53, 92, 87, 23, 29, 53, 83, 63, 63, 25, 25, 72, 47, 34, 24]], "output": 102099}, {"inputs": [[8, 43, 100, 80, 17, 72, 69, 7, 7, 32, 80, 8, 58, 70, 81, 79, 67, 66, 24, 64, 66, 9, 67, 33, 11, 62, 86, 5, 84, 78, 85, 69]], "output": 73246}, {"inputs": [[92, 14]], "output": 9214}, {"inputs": [[90, 31, 40, 54, 63, 99, 88, 28, 100, 5, 72, 89, 60, 90, 71, 97, 16, 7, 60, 6, 57, 73, 84, 17, 8, 77, 60, 7, 74, 74, 24, 52, 43, 94]], "output": 93917}, {"inputs": [[9, 99, 84, 89, 96, 40, 15, 29, 80, 19, 54, 75, 49, 27, 87, 95, 22, 28, 54, 66, 55, 99, 17, 75]], "output": 69574}, {"inputs": [[90, 47, 14, 9, 63, 18, 51, 15, 50, 24, 86, 30, 44, 51, 13, 91, 95, 52, 50, 99]], "output": 38711}, {"inputs": [[74, 67, 34, 75, 31, 91, 47, 6, 37, 62, 72, 42, 85, 95, 10, 8, 43, 21, 63]], "output": 39951}, {"inputs": [[45, 23, 69, 16, 99, 92, 5, 97, 69, 33, 44, 8, 33]], "output": 32619}]}} +{"id": "LeetCode/2699", "content": "# Count the Number of Fair Pairs\n\nGiven a **0-indexed** integer array `nums` of size `n` and two integers `lower` and `upper`, return *the number of fair pairs*.\n\n\nA pair `(i, j)` is **fair** if:\n\n\n* `0 <= i < j < n`, and\n* `lower <= nums[i] + nums[j] <= upper`\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [0,1,7,4,4,5], lower = 3, upper = 6\n**Output:** 6\n**Explanation:** There are 6 fair pairs: (0,3), (0,4), (0,5), (1,3), (1,4), and (1,5).\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,7,9,2,5], lower = 11, upper = 11\n**Output:** 1\n**Explanation:** There is a single fair pair: (2,3).\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `nums.length == n`\n* `-109 <= nums[i] <= 109`\n* `-109 <= lower <= upper <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countFairPairs(self, nums: List[int], lower: int, upper: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countFairPairs(**[[0, 1, 7, 4, 4, 5], 3, 6]) == 6\nassert my_solution.countFairPairs(**[[1, 7, 9, 2, 5], 11, 11]) == 1\nassert my_solution.countFairPairs(**[[-1, 0], 1, 1]) == 0\nassert my_solution.countFairPairs(**[[-1, -1, 0, 0], 1, 1]) == 0\nassert my_solution.countFairPairs(**[[0, 0, 0, 0, 0, 0], 0, 0]) == 15\nassert my_solution.countFairPairs(**[[0, 0, 0, 0, 0, 0], -1000000000, 1000000000]) == 15\nassert my_solution.countFairPairs(**[[6, 5, 10, 2, 4, 9, 0, 7], 20, 20]) == 0\nassert my_solution.countFairPairs(**[[6, 9, 4, 2, 7, 5, 10, 3], 13, 13]) == 3\nassert my_solution.countFairPairs(**[[5, 7, 5, 7, 5], 12, 12]) == 6\nassert my_solution.countFairPairs(**[[-5, -7, -5, -7, -5], -12, -12]) == 6\nassert my_solution.countFairPairs(**[[7, 9, 8, 6, -1000000000, -1000000000, -1000000000, -1000000000], -14, 11]) == 0\nassert my_solution.countFairPairs(**[[-2, -6, 4, 0, -1000000000, -1000000000, -1000000000, -1000000000], -15, 15]) == 6\nassert my_solution.countFairPairs(**[[7, -2, 2, 8, -1000000000, -1000000000, -1000000000, -1000000000], -15, 11]) == 5\nassert my_solution.countFairPairs(**[[-3, 0, 6, -9, 10, 9, -7, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000], -15, 14]) == 17\nassert my_solution.countFairPairs(**[[10, -9, -5, 8, -2, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000], -12, 11]) == 8\nassert my_solution.countFairPairs(**[[9, -2, 4, -1000000000, -1000000000, -1000000000], -14, 11]) == 2\nassert my_solution.countFairPairs(**[[3, -8, -5, -4, -1000000000, -1000000000, -1000000000, -1000000000], -10, 15]) == 4\nassert my_solution.countFairPairs(**[[-9, -6, -3, -7, 0, 1, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000], -11, 15]) == 11\nassert my_solution.countFairPairs(**[[-3, -10, -9, -5, 4, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000], -10, 11]) == 5\nassert my_solution.countFairPairs(**[[10, -3, 3, 8, 2, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000], -14, 14]) == 9\n"}, "labels": {"questionId": "2699", "questionFrontendId": "2563", "questionTitle": "Count the Number of Fair Pairs", "stats": {"totalAccepted": "8.5K", "totalSubmission": "24.2K", "totalAcceptedRaw": 8511, "totalSubmissionRaw": 24223, "acRate": "35.1%"}, "probedCases": [{"inputs": [[0, 1, 7, 4, 4, 5], 3, 6], "output": 6}, {"inputs": [[1, 7, 9, 2, 5], 11, 11], "output": 1}, {"inputs": [[-1, 0], 1, 1], "output": 0}, {"inputs": [[-1, -1, 0, 0], 1, 1], "output": 0}, {"inputs": [[0, 0, 0, 0, 0, 0], 0, 0], "output": 15}, {"inputs": [[0, 0, 0, 0, 0, 0], -1000000000, 1000000000], "output": 15}, {"inputs": [[6, 5, 10, 2, 4, 9, 0, 7], 20, 20], "output": 0}, {"inputs": [[6, 9, 4, 2, 7, 5, 10, 3], 13, 13], "output": 3}, {"inputs": [[5, 7, 5, 7, 5], 12, 12], "output": 6}, {"inputs": [[-5, -7, -5, -7, -5], -12, -12], "output": 6}, {"inputs": [[7, 9, 8, 6, -1000000000, -1000000000, -1000000000, -1000000000], -14, 11], "output": 0}, {"inputs": [[-2, -6, 4, 0, -1000000000, -1000000000, -1000000000, -1000000000], -15, 15], "output": 6}, {"inputs": [[7, -2, 2, 8, -1000000000, -1000000000, -1000000000, -1000000000], -15, 11], "output": 5}, {"inputs": [[-3, 0, 6, -9, 10, 9, -7, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000], -15, 14], "output": 17}, {"inputs": [[10, -9, -5, 8, -2, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000], -12, 11], "output": 8}, {"inputs": [[9, -2, 4, -1000000000, -1000000000, -1000000000], -14, 11], "output": 2}, {"inputs": [[3, -8, -5, -4, -1000000000, -1000000000, -1000000000, -1000000000], -10, 15], "output": 4}, {"inputs": [[-9, -6, -3, -7, 0, 1, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000], -11, 15], "output": 11}, {"inputs": [[-3, -10, -9, -5, 4, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000], -10, 11], "output": 5}, {"inputs": [[10, -3, 3, 8, 2, -1000000000, -1000000000, -1000000000, -1000000000, -1000000000], -14, 14], "output": 9}]}} +{"id": "LeetCode/2700", "content": "# Substring XOR Queries\n\nYou are given a **binary string** `s`, and a **2D** integer array `queries` where `queries[i] = [firsti, secondi]`.\n\n\nFor the `ith` query, find the **shortest substring** of `s` whose **decimal value**, `val`, yields `secondi` when **bitwise XORed** with `firsti`. In other words, `val ^ firsti == secondi`.\n\n\nThe answer to the `ith` query is the endpoints (**0-indexed**) of the substring `[lefti, righti]` or `[-1, -1]` if no such substring exists. If there are multiple answers, choose the one with the **minimum** `lefti`.\n\n\n*Return an array* `ans` *where* `ans[i] = [lefti, righti]` *is the answer to the* `ith` *query.*\n\n\nA **substring** is a contiguous non-empty sequence of characters within a string.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"101101\", queries = [[0,5],[1,2]]\n**Output:** [[0,2],[2,3]]\n**Explanation:** For the first query the substring in range [0,2] is **\"101\"** which has a decimal value of **`5`**, and **`5 ^ 0 = 5`**, hence the answer to the first query is [0,2]. In the second query, the substring in range [2,3] is **\"11\",** and has a decimal value of **3**, and **3 `^ 1 = 2`**. So, [2,3] is returned for the second query. \n\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"0101\", queries = [[12,8]]\n**Output:** [[-1,-1]]\n**Explanation:** In this example there is no substring that answers the query, hence [-1,-1] is returned.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** s = \"1\", queries = [[4,5]]\n**Output:** [[0,0]]\n**Explanation:** For this example, the substring in range [0,0] has a decimal value of **`1`**, and **`1 ^ 4 = 5`**. So, the answer is [0,0].\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length <= 104`\n* `s[i]` is either `'0'` or `'1'`.\n* `1 <= queries.length <= 105`\n* `0 <= firsti, secondi <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def substringXorQueries(self, s: str, queries: List[List[int]]) -> List[List[int]]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.substringXorQueries(**['101101', [[0, 5], [1, 2]]]) == [[0, 2], [2, 3]]\nassert my_solution.substringXorQueries(**['0101', [[12, 8]]]) == [[-1, -1]]\nassert my_solution.substringXorQueries(**['1', [[4, 5]]]) == [[0, 0]]\nassert my_solution.substringXorQueries(**['001', [[1, 0], [1, 0], [9, 8], [1, 0], [4, 5], [9, 8], [3, 2], [2, 3], [5, 4], [6, 7], [2, 3], [2, 3], [2, 3], [4, 5]]]) == [[2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]]\nassert my_solution.substringXorQueries(**['111010110', [[4, 2], [3, 3], [6, 4], [9, 9], [10, 28], [0, 470], [5, 83], [10, 28], [8, 15], [6, 464], [0, 3], [5, 8], [7, 7], [8, 8], [6, 208], [9, 15], [2, 2], [9, 95]]]) == [[1, 3], [3, 3], [2, 3], [3, 3], [4, 8], [0, 8], [2, 8], [4, 8], [0, 2], [0, 8], [0, 1], [1, 4], [3, 3], [3, 3], [1, 8], [1, 3], [3, 3], [2, 8]]\nassert my_solution.substringXorQueries(**['11101010111', [[4, 19], [9, 30], [4, 19], [2, 853], [4, 3], [9, 94], [10, 861], [7, 18], [8, 1887], [0, 3], [2, 5], [5, 4], [0, 87], [2, 21], [4, 5], [4, 15], [0, 7], [5, 4]]]) == [[6, 10], [6, 10], [6, 10], [1, 10], [0, 2], [4, 10], [1, 10], [2, 6], [0, 10], [0, 1], [0, 2], [0, 0], [4, 10], [6, 10], [0, 0], [6, 9], [0, 2], [0, 0]]\nassert my_solution.substringXorQueries(**['0000001111101001010', [[0, 3914], [2, 4], [2, 2], [3, 8009], [4, 3918], [7, 26]]]) == [[7, 18], [9, 11], [0, 0], [6, 18], [7, 18], [8, 12]]\nassert my_solution.substringXorQueries(**['1001101111001110001010', [[2, 0], [9, 899], [6, 5004], [6, 7], [10, 4992], [10, 10], [9, 899], [9, 899], [1, 1]]]) == [[0, 1], [12, 21], [9, 21], [0, 0], [9, 21], [1, 1], [12, 21], [12, 21], [1, 1]]\nassert my_solution.substringXorQueries(**['1110100011011111110011', [[8, 59], [10, 11], [3, 112], [3, 2], [5, 502], [9, 3573]]]) == [[16, 21], [0, 0], [15, 21], [0, 0], [13, 21], [8, 19]]\nassert my_solution.substringXorQueries(**['01110001101000011000010', [[0, 49], [6, 577732], [9, 11], [6, 68], [4, 1076], [2, 53440], [7, 5], [2, 0]]]) == [[2, 7], [3, 22], [3, 4], [16, 22], [10, 20], [7, 22], [3, 4], [3, 4]]\nassert my_solution.substringXorQueries(**['0001001110111101100101100', [[10, 10], [3, 7663], [7, 43], [1, 45], [7, 3], [3, 15], [9, 37], [9, 148], [4, 4], [6, 48528], [8, 9], [7, 15147], [10, 61295], [9, 485], [4, 0], [9, 37], [8, 8]]]) == [[0, 0], [6, 18], [13, 18], [13, 18], [3, 5], [15, 18], [13, 18], [3, 10], [0, 0], [8, 23], [3, 3], [11, 24], [6, 21], [10, 18], [3, 5], [13, 18], [0, 0]]\nassert my_solution.substringXorQueries(**['111100000011011100010000111', [[2, 14469], [9, 142], [4, 789952], [5, 491965], [1, 6], [9, 14], [9, 747], [2, 4], [8, 14], [0, 3], [1, 56386], [9, 120], [9, 142], [3, 7685]]]) == [[13, 26], [19, 26], [2, 21], [0, 18], [0, 2], [0, 2], [11, 20], [2, 4], [2, 4], [0, 1], [10, 25], [13, 19], [19, 26], [0, 12]]\nassert my_solution.substringXorQueries(**['01010011000111011011100010111', [[2, 1], [10, 11], [1, 0], [6, 243473], [2, 2340629], [4, 787], [5, 3801]]]) == [[6, 7], [1, 1], [1, 1], [11, 28], [7, 28], [19, 28], [11, 22]]\nassert my_solution.substringXorQueries(**['101111010010100100111101111111', [[1, 20350], [9, 8], [2, 3], [6, 27], [7, 38041], [1, 60], [10, 675701], [2, 675709], [0, 895], [8, 20343], [10, 9], [7, 6], [8, 11], [8, 20343], [9, 675702], [5, 3962], [2, 168925], [5, 20346], [4, 6]]]) == [[15, 29], [0, 0], [0, 0], [3, 7], [7, 22], [2, 7], [10, 29], [10, 29], [20, 29], [15, 29], [2, 3], [0, 0], [2, 3], [15, 29], [10, 29], [18, 29], [10, 27], [15, 29], [0, 1]]\nassert my_solution.substringXorQueries(**['11111111011010011101000110010111110', [[1, 63], [4, 186], [3, 5]]]) == [[3, 8], [27, 34], [6, 8]]\nassert my_solution.substringXorQueries(**['001000010111100100000100011100110010', [[5, 18231], [6, 132], [4, 54], [5, 2363849], [1, 3088527], [3, 126895921]]]) == [[21, 35], [15, 22], [11, 16], [12, 33], [7, 28], [9, 35]]\nassert my_solution.substringXorQueries(**['00000001010101001110000100010001111010', [[2, 13], [2, 639521], [7, 22339862], [9, 17523], [0, 4], [10, 1136], [4, 1150], [3, 9], [0, 2], [4, 5], [5, 7], [1, 3], [6, 1148], [0, 43632], [2, 4380], [9, 9], [2, 626]]]) == [[31, 34], [13, 32], [7, 31], [23, 37], [13, 15], [27, 37], [27, 37], [7, 10], [7, 8], [7, 7], [7, 8], [7, 8], [27, 37], [7, 22], [23, 35], [0, 0], [13, 22]]\nassert my_solution.substringXorQueries(**['00010100110111000001011110110010110000111000', [[10, 10], [4, 5], [8, 12070765], [5, 61], [8, 56], [9, 230143], [7, 63], [3, 11323], [10, 1436], [4, 6], [4, 185], [1, 47]]]) == [[0, 0], [3, 3], [9, 32], [11, 16], [12, 17], [11, 28], [11, 16], [30, 43], [24, 34], [3, 4], [19, 26], [9, 14]]\nassert my_solution.substringXorQueries(**['01110111011100111001110010111010000110010011', [[3, 15656762], [2, 13360], [0, 403], [5, 9]]]) == [[1, 24], [27, 40], [35, 43], [10, 13]]\nassert my_solution.substringXorQueries(**['01111111001011010011100101000010011100101100', [[6, 165091], [0, 1021596], [3, 720], [2, 510796], [9, 1665475], [2, 1320750], [0, 26486572], [6, 272170], [3, 3886], [2, 12], [7, 272171], [0, 1320748], [2, 55464094], [6, 42], [10, 46319], [6, 14], [1, 151], [10, 10022], [4, 13243282]]]) == [[23, 40], [3, 22], [10, 19], [3, 21], [6, 26], [23, 43], [19, 43], [25, 43], [4, 15], [5, 8], [25, 43], [23, 43], [12, 37], [38, 43], [10, 25], [25, 28], [7, 14], [30, 43], [19, 42]]\n"}, "labels": {"questionId": "2700", "questionFrontendId": "2564", "questionTitle": "Substring XOR Queries", "stats": {"totalAccepted": "5.3K", "totalSubmission": "14K", "totalAcceptedRaw": 5265, "totalSubmissionRaw": 14030, "acRate": "37.5%"}, "probedCases": [{"inputs": ["101101", [[0, 5], [1, 2]]], "output": [[0, 2], [2, 3]]}, {"inputs": ["0101", [[12, 8]]], "output": [[-1, -1]]}, {"inputs": ["1", [[4, 5]]], "output": [[0, 0]]}, {"inputs": ["001", [[1, 0], [1, 0], [9, 8], [1, 0], [4, 5], [9, 8], [3, 2], [2, 3], [5, 4], [6, 7], [2, 3], [2, 3], [2, 3], [4, 5]]], "output": [[2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]]}, {"inputs": ["111010110", [[4, 2], [3, 3], [6, 4], [9, 9], [10, 28], [0, 470], [5, 83], [10, 28], [8, 15], [6, 464], [0, 3], [5, 8], [7, 7], [8, 8], [6, 208], [9, 15], [2, 2], [9, 95]]], "output": [[1, 3], [3, 3], [2, 3], [3, 3], [4, 8], [0, 8], [2, 8], [4, 8], [0, 2], [0, 8], [0, 1], [1, 4], [3, 3], [3, 3], [1, 8], [1, 3], [3, 3], [2, 8]]}, {"inputs": ["11101010111", [[4, 19], [9, 30], [4, 19], [2, 853], [4, 3], [9, 94], [10, 861], [7, 18], [8, 1887], [0, 3], [2, 5], [5, 4], [0, 87], [2, 21], [4, 5], [4, 15], [0, 7], [5, 4]]], "output": [[6, 10], [6, 10], [6, 10], [1, 10], [0, 2], [4, 10], [1, 10], [2, 6], [0, 10], [0, 1], [0, 2], [0, 0], [4, 10], [6, 10], [0, 0], [6, 9], [0, 2], [0, 0]]}, {"inputs": ["0000001111101001010", [[0, 3914], [2, 4], [2, 2], [3, 8009], [4, 3918], [7, 26]]], "output": [[7, 18], [9, 11], [0, 0], [6, 18], [7, 18], [8, 12]]}, {"inputs": ["1001101111001110001010", [[2, 0], [9, 899], [6, 5004], [6, 7], [10, 4992], [10, 10], [9, 899], [9, 899], [1, 1]]], "output": [[0, 1], [12, 21], [9, 21], [0, 0], [9, 21], [1, 1], [12, 21], [12, 21], [1, 1]]}, {"inputs": ["1110100011011111110011", [[8, 59], [10, 11], [3, 112], [3, 2], [5, 502], [9, 3573]]], "output": [[16, 21], [0, 0], [15, 21], [0, 0], [13, 21], [8, 19]]}, {"inputs": ["01110001101000011000010", [[0, 49], [6, 577732], [9, 11], [6, 68], [4, 1076], [2, 53440], [7, 5], [2, 0]]], "output": [[2, 7], [3, 22], [3, 4], [16, 22], [10, 20], [7, 22], [3, 4], [3, 4]]}, {"inputs": ["0001001110111101100101100", [[10, 10], [3, 7663], [7, 43], [1, 45], [7, 3], [3, 15], [9, 37], [9, 148], [4, 4], [6, 48528], [8, 9], [7, 15147], [10, 61295], [9, 485], [4, 0], [9, 37], [8, 8]]], "output": [[0, 0], [6, 18], [13, 18], [13, 18], [3, 5], [15, 18], [13, 18], [3, 10], [0, 0], [8, 23], [3, 3], [11, 24], [6, 21], [10, 18], [3, 5], [13, 18], [0, 0]]}, {"inputs": ["111100000011011100010000111", [[2, 14469], [9, 142], [4, 789952], [5, 491965], [1, 6], [9, 14], [9, 747], [2, 4], [8, 14], [0, 3], [1, 56386], [9, 120], [9, 142], [3, 7685]]], "output": [[13, 26], [19, 26], [2, 21], [0, 18], [0, 2], [0, 2], [11, 20], [2, 4], [2, 4], [0, 1], [10, 25], [13, 19], [19, 26], [0, 12]]}, {"inputs": ["01010011000111011011100010111", [[2, 1], [10, 11], [1, 0], [6, 243473], [2, 2340629], [4, 787], [5, 3801]]], "output": [[6, 7], [1, 1], [1, 1], [11, 28], [7, 28], [19, 28], [11, 22]]}, {"inputs": ["101111010010100100111101111111", [[1, 20350], [9, 8], [2, 3], [6, 27], [7, 38041], [1, 60], [10, 675701], [2, 675709], [0, 895], [8, 20343], [10, 9], [7, 6], [8, 11], [8, 20343], [9, 675702], [5, 3962], [2, 168925], [5, 20346], [4, 6]]], "output": [[15, 29], [0, 0], [0, 0], [3, 7], [7, 22], [2, 7], [10, 29], [10, 29], [20, 29], [15, 29], [2, 3], [0, 0], [2, 3], [15, 29], [10, 29], [18, 29], [10, 27], [15, 29], [0, 1]]}, {"inputs": ["11111111011010011101000110010111110", [[1, 63], [4, 186], [3, 5]]], "output": [[3, 8], [27, 34], [6, 8]]}, {"inputs": ["001000010111100100000100011100110010", [[5, 18231], [6, 132], [4, 54], [5, 2363849], [1, 3088527], [3, 126895921]]], "output": [[21, 35], [15, 22], [11, 16], [12, 33], [7, 28], [9, 35]]}, {"inputs": ["00000001010101001110000100010001111010", [[2, 13], [2, 639521], [7, 22339862], [9, 17523], [0, 4], [10, 1136], [4, 1150], [3, 9], [0, 2], [4, 5], [5, 7], [1, 3], [6, 1148], [0, 43632], [2, 4380], [9, 9], [2, 626]]], "output": [[31, 34], [13, 32], [7, 31], [23, 37], [13, 15], [27, 37], [27, 37], [7, 10], [7, 8], [7, 7], [7, 8], [7, 8], [27, 37], [7, 22], [23, 35], [0, 0], [13, 22]]}, {"inputs": ["00010100110111000001011110110010110000111000", [[10, 10], [4, 5], [8, 12070765], [5, 61], [8, 56], [9, 230143], [7, 63], [3, 11323], [10, 1436], [4, 6], [4, 185], [1, 47]]], "output": [[0, 0], [3, 3], [9, 32], [11, 16], [12, 17], [11, 28], [11, 16], [30, 43], [24, 34], [3, 4], [19, 26], [9, 14]]}, {"inputs": ["01110111011100111001110010111010000110010011", [[3, 15656762], [2, 13360], [0, 403], [5, 9]]], "output": [[1, 24], [27, 40], [35, 43], [10, 13]]}, {"inputs": ["01111111001011010011100101000010011100101100", [[6, 165091], [0, 1021596], [3, 720], [2, 510796], [9, 1665475], [2, 1320750], [0, 26486572], [6, 272170], [3, 3886], [2, 12], [7, 272171], [0, 1320748], [2, 55464094], [6, 42], [10, 46319], [6, 14], [1, 151], [10, 10022], [4, 13243282]]], "output": [[23, 40], [3, 22], [10, 19], [3, 21], [6, 26], [23, 43], [19, 43], [25, 43], [4, 15], [5, 8], [25, 43], [23, 43], [12, 37], [38, 43], [10, 25], [25, 28], [7, 14], [30, 43], [19, 42]]}]}} +{"id": "LeetCode/2701", "content": "# Subsequence With the Minimum Score\n\nYou are given two strings `s` and `t`.\n\n\nYou are allowed to remove any number of characters from the string `t`.\n\n\nThe score of the string is `0` if no characters are removed from the string `t`, otherwise:\n\n\n* Let `left` be the minimum index among all removed characters.\n* Let `right` be the maximum index among all removed characters.\n\n\nThen the score of the string is `right - left + 1`.\n\n\nReturn *the minimum possible score to make* `t`*a subsequence of* `s`*.*\n\n\nA **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., `\"ace\"` is a subsequence of `\"abcde\"` while `\"aec\"` is not).\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** s = \"abacaba\", t = \"bzaa\"\n**Output:** 1\n**Explanation:** In this example, we remove the character \"z\" at index 1 (0-indexed).\nThe string t becomes \"baa\" which is a subsequence of the string \"abacaba\" and the score is 1 - 1 + 1 = 1.\nIt can be proven that 1 is the minimum score that we can achieve.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** s = \"cde\", t = \"xyz\"\n**Output:** 3\n**Explanation:** In this example, we remove characters \"x\", \"y\" and \"z\" at indices 0, 1, and 2 (0-indexed).\nThe string t becomes \"\" which is a subsequence of the string \"cde\" and the score is 2 - 0 + 1 = 3.\nIt can be proven that 3 is the minimum score that we can achieve.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= s.length, t.length <= 105`\n* `s` and `t` consist of only lowercase English letters.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minimumScore(self, s: str, t: str) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minimumScore(**['abacaba', 'bzaa']) == 1\nassert my_solution.minimumScore(**['cde', 'xyz']) == 3\nassert my_solution.minimumScore(**['abecdebe', 'eaebceae']) == 6\nassert my_solution.minimumScore(**['acdedcdbabecdbebda', 'bbecddb']) == 1\nassert my_solution.minimumScore(**['dabbbeddeabbaccecaee', 'bcbbaabdbebecbebded']) == 16\nassert my_solution.minimumScore(**['adebddaccdcabaade', 'adbae']) == 0\nassert my_solution.minimumScore(**['dcadebdecbeaedd', 'dcdadeb']) == 1\nassert my_solution.minimumScore(**['bcceaaccd', 'cbe']) == 1\nassert my_solution.minimumScore(**['cabecaeadeaeadd', 'edcce']) == 2\nassert my_solution.minimumScore(**['cbedceeeccd', 'ed']) == 0\nassert my_solution.minimumScore(**['eeecaeecdeeadcdbcaa', 'edecabe']) == 2\nassert my_solution.minimumScore(**['eceecbabe', 'bdeaec']) == 4\nassert my_solution.minimumScore(**['caaa', 'aaa']) == 0\nassert my_solution.minimumScore(**['cbaa', 'a']) == 0\nassert my_solution.minimumScore(**['bcabcbcccbacccc', 'cbcbb']) == 0\nassert my_solution.minimumScore(**['eddbeedbbaaaaadaacccddadccbbcdc', 'aecbddcedaaced']) == 12\nassert my_solution.minimumScore(**['ccecdeccaebcdaeaccdceadbaabeddacaeacbaabaec', 'bdadc']) == 0\nassert my_solution.minimumScore(**['eaedcdbdeededbcdcbedddbccbaebbdbadbdadccaddacbbcbabadbacbdcbeaebecbacacbadaadedcadcdcdaceaaad', 'cadedebbcabecbcbd']) == 1\nassert my_solution.minimumScore(**['aacecebcbbcbacddbdcbaddeadd', 'cab']) == 0\nassert my_solution.minimumScore(**['adcdaedbeeecbbaecebceaebcbcddecddcedecddbbdaabcbdbcbbabbddaeaedeabdecaedbcdbdccb', 'abadccaced']) == 0\n"}, "labels": {"questionId": "2701", "questionFrontendId": "2565", "questionTitle": "Subsequence With the Minimum Score", "stats": {"totalAccepted": "3.2K", "totalSubmission": "8.8K", "totalAcceptedRaw": 3211, "totalSubmissionRaw": 8792, "acRate": "36.5%"}, "probedCases": [{"inputs": ["abacaba", "bzaa"], "output": 1}, {"inputs": ["cde", "xyz"], "output": 3}, {"inputs": ["abecdebe", "eaebceae"], "output": 6}, {"inputs": ["acdedcdbabecdbebda", "bbecddb"], "output": 1}, {"inputs": ["dabbbeddeabbaccecaee", "bcbbaabdbebecbebded"], "output": 16}, {"inputs": ["adebddaccdcabaade", "adbae"], "output": 0}, {"inputs": ["dcadebdecbeaedd", "dcdadeb"], "output": 1}, {"inputs": ["bcceaaccd", "cbe"], "output": 1}, {"inputs": ["cabecaeadeaeadd", "edcce"], "output": 2}, {"inputs": ["cbedceeeccd", "ed"], "output": 0}, {"inputs": ["eeecaeecdeeadcdbcaa", "edecabe"], "output": 2}, {"inputs": ["eceecbabe", "bdeaec"], "output": 4}, {"inputs": ["caaa", "aaa"], "output": 0}, {"inputs": ["cbaa", "a"], "output": 0}, {"inputs": ["bcabcbcccbacccc", "cbcbb"], "output": 0}, {"inputs": ["eddbeedbbaaaaadaacccddadccbbcdc", "aecbddcedaaced"], "output": 12}, {"inputs": ["ccecdeccaebcdaeaccdceadbaabeddacaeacbaabaec", "bdadc"], "output": 0}, {"inputs": ["eaedcdbdeededbcdcbedddbccbaebbdbadbdadccaddacbbcbabadbacbdcbeaebecbacacbadaadedcadcdcdaceaaad", "cadedebbcabecbcbd"], "output": 1}, {"inputs": ["aacecebcbbcbacddbdcbaddeadd", "cab"], "output": 0}, {"inputs": ["adcdaedbeeecbbaecebceaebcbcddecddcedecddbbdaabcbdbcbbabbddaeaedeabdecaedbcdbdccb", "abadccaced"], "output": 0}]}} +{"id": "LeetCode/2692", "content": "# Take Gifts From the Richest Pile\n\nYou are given an integer array `gifts` denoting the number of gifts in various piles. Every second, you do the following:\n\n\n* Choose the pile with the maximum number of gifts.\n* If there is more than one pile with the maximum number of gifts, choose any.\n* Leave behind the floor of the square root of the number of gifts in the pile. Take the rest of the gifts.\n\n\nReturn *the number of gifts remaining after* `k` *seconds.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** gifts = [25,64,9,4,100], k = 4\n**Output:** 29\n**Explanation:** \nThe gifts are taken in the following way:\n- In the first second, the last pile is chosen and 10 gifts are left behind.\n- Then the second pile is chosen and 8 gifts are left behind.\n- After that the first pile is chosen and 5 gifts are left behind.\n- Finally, the last pile is chosen again and 3 gifts are left behind.\nThe final remaining gifts are [5,8,9,4,3], so the total number of gifts remaining is 29.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** gifts = [1,1,1,1], k = 4\n**Output:** 4\n**Explanation:** \nIn this case, regardless which pile you choose, you have to leave behind 1 gift in each pile. \nThat is, you can't take any pile with you. \nSo, the total gifts remaining are 4.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= gifts.length <= 103`\n* `1 <= gifts[i] <= 109`\n* `1 <= k <= 103`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def pickGifts(self, gifts: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.pickGifts(**[[25, 64, 9, 4, 100], 4]) == 29\nassert my_solution.pickGifts(**[[1, 1, 1, 1], 4]) == 4\nassert my_solution.pickGifts(**[[54, 6, 34, 66, 63, 52, 39, 62, 46, 75, 28, 65, 18, 37, 18, 13, 33, 69, 19, 40, 13, 10, 43, 61, 72], 7]) == 618\nassert my_solution.pickGifts(**[[56, 41, 27, 71, 62, 57, 67, 34, 8, 71, 2, 12, 52, 1, 64, 43, 32, 42, 9, 25, 73, 29, 31], 52]) == 32\nassert my_solution.pickGifts(**[[70, 58, 12, 11, 41, 66, 63, 14, 39, 71], 19]) == 19\nassert my_solution.pickGifts(**[[71, 43, 70, 27, 71, 37, 57, 12], 39]) == 8\nassert my_solution.pickGifts(**[[41, 74, 31, 38, 24, 25, 24, 5, 34, 61, 9, 12, 17, 20, 5, 11, 70, 51, 68, 36, 67, 31, 28, 54, 75], 18]) == 191\nassert my_solution.pickGifts(**[[64, 46, 11, 42, 15, 63, 43, 25, 32, 3, 35, 15, 29, 48, 22, 43, 55, 8, 13, 19, 29, 6, 74, 69, 10, 4, 16, 25, 74], 8]) == 503\nassert my_solution.pickGifts(**[[12, 48, 15, 5, 3, 25, 24, 16, 62, 27, 8, 3, 70, 55, 13, 34, 9, 29, 10, 39, 45, 56, 24, 8, 65, 60], 3]) == 591\nassert my_solution.pickGifts(**[[13, 51, 26, 34, 46, 61, 73, 22, 27, 8, 21, 21, 44, 68, 33, 16, 57, 23, 2, 61, 53, 73, 66, 40, 46, 50, 33, 20, 72, 2, 59, 11, 43, 6, 70, 36, 18, 31, 62], 23]) == 422\nassert my_solution.pickGifts(**[[37, 46, 17, 40, 50, 54, 11, 1, 25, 43, 21, 31, 29, 58, 49, 73, 54, 5, 52, 73, 54, 6, 22, 58, 9, 34, 21, 58, 68, 63, 72, 1, 5, 64, 42, 40, 60, 7, 54, 25], 36]) == 220\nassert my_solution.pickGifts(**[[17, 2, 52, 54, 41, 1], 14]) == 6\nassert my_solution.pickGifts(**[[1], 53]) == 1\nassert my_solution.pickGifts(**[[13, 25, 16, 26, 39, 36, 24, 13, 61, 51, 11, 3, 36, 58, 15, 33, 18, 67, 45, 15, 20, 36, 3, 6, 6, 27, 34, 72, 41, 47, 73, 6, 64, 59], 41]) == 122\nassert my_solution.pickGifts(**[[48, 69, 23, 27, 49, 38, 2, 18, 20, 35, 43, 44, 48, 12, 44, 5, 6, 35, 21, 20, 75, 38, 47, 51, 71, 17, 38, 15], 31]) == 118\nassert my_solution.pickGifts(**[[7, 40, 23, 67, 10, 39, 52, 43, 39, 54, 14, 13, 72, 62, 61, 44], 54]) == 16\nassert my_solution.pickGifts(**[[16, 62, 15, 64, 55, 5, 39, 43, 20, 22, 73, 49, 12, 9, 11, 26, 29, 8, 50, 2, 13, 51], 36]) == 47\nassert my_solution.pickGifts(**[[38, 58, 63, 75, 28, 55, 11, 48, 29, 34, 75, 22, 56, 25, 46, 15, 9, 4, 68, 58, 26, 16, 64, 51, 33, 27, 6, 28, 19, 14, 26, 59, 49, 47], 35]) == 173\nassert my_solution.pickGifts(**[[14, 63, 19, 73, 52, 55, 67, 64, 42, 64], 32]) == 10\nassert my_solution.pickGifts(**[[70, 29, 2, 44, 41, 42, 5, 68, 19, 33, 20, 49, 75], 19]) == 36\n"}, "labels": {"questionId": "2692", "questionFrontendId": "2558", "questionTitle": "Take Gifts From the Richest Pile", "stats": {"totalAccepted": "29.7K", "totalSubmission": "41.5K", "totalAcceptedRaw": 29699, "totalSubmissionRaw": 41520, "acRate": "71.5%"}, "probedCases": [{"inputs": [[25, 64, 9, 4, 100], 4], "output": 29}, {"inputs": [[1, 1, 1, 1], 4], "output": 4}, {"inputs": [[54, 6, 34, 66, 63, 52, 39, 62, 46, 75, 28, 65, 18, 37, 18, 13, 33, 69, 19, 40, 13, 10, 43, 61, 72], 7], "output": 618}, {"inputs": [[56, 41, 27, 71, 62, 57, 67, 34, 8, 71, 2, 12, 52, 1, 64, 43, 32, 42, 9, 25, 73, 29, 31], 52], "output": 32}, {"inputs": [[70, 58, 12, 11, 41, 66, 63, 14, 39, 71], 19], "output": 19}, {"inputs": [[71, 43, 70, 27, 71, 37, 57, 12], 39], "output": 8}, {"inputs": [[41, 74, 31, 38, 24, 25, 24, 5, 34, 61, 9, 12, 17, 20, 5, 11, 70, 51, 68, 36, 67, 31, 28, 54, 75], 18], "output": 191}, {"inputs": [[64, 46, 11, 42, 15, 63, 43, 25, 32, 3, 35, 15, 29, 48, 22, 43, 55, 8, 13, 19, 29, 6, 74, 69, 10, 4, 16, 25, 74], 8], "output": 503}, {"inputs": [[12, 48, 15, 5, 3, 25, 24, 16, 62, 27, 8, 3, 70, 55, 13, 34, 9, 29, 10, 39, 45, 56, 24, 8, 65, 60], 3], "output": 591}, {"inputs": [[13, 51, 26, 34, 46, 61, 73, 22, 27, 8, 21, 21, 44, 68, 33, 16, 57, 23, 2, 61, 53, 73, 66, 40, 46, 50, 33, 20, 72, 2, 59, 11, 43, 6, 70, 36, 18, 31, 62], 23], "output": 422}, {"inputs": [[37, 46, 17, 40, 50, 54, 11, 1, 25, 43, 21, 31, 29, 58, 49, 73, 54, 5, 52, 73, 54, 6, 22, 58, 9, 34, 21, 58, 68, 63, 72, 1, 5, 64, 42, 40, 60, 7, 54, 25], 36], "output": 220}, {"inputs": [[17, 2, 52, 54, 41, 1], 14], "output": 6}, {"inputs": [[1], 53], "output": 1}, {"inputs": [[13, 25, 16, 26, 39, 36, 24, 13, 61, 51, 11, 3, 36, 58, 15, 33, 18, 67, 45, 15, 20, 36, 3, 6, 6, 27, 34, 72, 41, 47, 73, 6, 64, 59], 41], "output": 122}, {"inputs": [[48, 69, 23, 27, 49, 38, 2, 18, 20, 35, 43, 44, 48, 12, 44, 5, 6, 35, 21, 20, 75, 38, 47, 51, 71, 17, 38, 15], 31], "output": 118}, {"inputs": [[7, 40, 23, 67, 10, 39, 52, 43, 39, 54, 14, 13, 72, 62, 61, 44], 54], "output": 16}, {"inputs": [[16, 62, 15, 64, 55, 5, 39, 43, 20, 22, 73, 49, 12, 9, 11, 26, 29, 8, 50, 2, 13, 51], 36], "output": 47}, {"inputs": [[38, 58, 63, 75, 28, 55, 11, 48, 29, 34, 75, 22, 56, 25, 46, 15, 9, 4, 68, 58, 26, 16, 64, 51, 33, 27, 6, 28, 19, 14, 26, 59, 49, 47], 35], "output": 173}, {"inputs": [[14, 63, 19, 73, 52, 55, 67, 64, 42, 64], 32], "output": 10}, {"inputs": [[70, 29, 2, 44, 41, 42, 5, 68, 19, 33, 20, 49, 75], 19], "output": 36}]}} +{"id": "LeetCode/2691", "content": "# Count Vowel Strings in Ranges\n\nYou are given a **0-indexed** array of strings `words` and a 2D array of integers `queries`.\n\n\nEach query `queries[i] = [li, ri]` asks us to find the number of strings present in the range `li` to `ri` (both **inclusive**) of `words` that start and end with a vowel.\n\n\nReturn *an array* `ans` *of size* `queries.length`*, where* `ans[i]` *is the answer to the* `i`th *query*.\n\n\n**Note** that the vowel letters are `'a'`, `'e'`, `'i'`, `'o'`, and `'u'`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** words = [\"aba\",\"bcb\",\"ece\",\"aa\",\"e\"], queries = [[0,2],[1,4],[1,1]]\n**Output:** [2,3,0]\n**Explanation:** The strings starting and ending with a vowel are \"aba\", \"ece\", \"aa\" and \"e\".\nThe answer to the query [0,2] is 2 (strings \"aba\" and \"ece\").\nto query [1,4] is 3 (strings \"ece\", \"aa\", \"e\").\nto query [1,1] is 0.\nWe return [2,3,0].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** words = [\"a\",\"e\",\"i\"], queries = [[0,2],[0,1],[2,2]]\n**Output:** [3,2,1]\n**Explanation:** Every string satisfies the conditions, so we return [3,2,1].\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= words.length <= 105`\n* `1 <= words[i].length <= 40`\n* `words[i]` consists only of lowercase English letters.\n* `sum(words[i].length) <= 3 * 105`\n* `1 <= queries.length <= 105`\n* `0 <= li <= ri < words.length`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def vowelStrings(self, words: List[str], queries: List[List[int]]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.vowelStrings(**[['aba', 'bcb', 'ece', 'aa', 'e'], [[0, 2], [1, 4], [1, 1]]]) == [2, 3, 0]\nassert my_solution.vowelStrings(**[['a', 'e', 'i'], [[0, 2], [0, 1], [2, 2]]]) == [3, 2, 1]\nassert my_solution.vowelStrings(**[['bzmxvzjxfddcuznspdcbwiojiqf', 'mwguoaskvramwgiweogzulcinycosovozppl', 'uigevazgbrddbcsvrvnngfrvkhmqszjicpieahs', 'uivcdsboxnraqpokjzaayedf', 'yalc', 'bbhlbmpskgxmxosft', 'vigplemkoni', 'krdrlctodtmprpxwditvcps', 'gqjwokkskrb', 'bslxxpabivbvzkozzvdaykaatzrpe', 'qwhzcwkchluwdnqjwhabroyyxbtsrsxqjnfpadi', 'siqbezhkohmgbenbkikcxmvz', 'ddmaireeouzcvffkcohxus', 'kjzguljbwsxlrd', 'gqzuqcljvcpmoqlnrxvzqwoyas', 'vadguvpsubcwbfbaviedr', 'nxnorutztxfnpvmukpwuraen', 'imgvujjeygsiymdxp', 'rdzkpk', 'cuap', 'qcojjumwp', 'pyqzshwykhtyzdwzakjejqyxbganow', 'cvxuskhcloxykcu', 'ul', 'axzscbjajazvbxffrydajapweci'], [[4, 4], [6, 17], [10, 17], [9, 18], [17, 22], [5, 23], [2, 5], [17, 21], [5, 17], [4, 8], [7, 17], [16, 19], [7, 12], [9, 20], [13, 23], [1, 5], [19, 19]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.vowelStrings(**[['sdhky', 'kqcljybkksifhmyuhorulktlglydmqmfasqaht', 'oesmrtgthzdwbgnpkcgh', 'pauhingxekhno', 'nkqkuuhjqesjpd', 'jmkmsiqbhtbqamxanbwr', 'abqzwssfthcliekxllsndxluku', 'sulfsxaqwjtrghcwtuwkbsrqo', 'pmsfgbeardurzkxlicwuiliabjfn', 'vgshnkmwghoam', 'bvzldcctkxlcltvbemdwyilohofhl', 'mqhapsekfwzanlbkhzofsohtxbhijmpdanjqvwe', 'nbtuuosftvtj', 'dmxqapmiyoewvtoscdkeihyfitgwrrfieaobqj', 'qabfrbbzkxfljeiztjkgntrmbxkkadwn', 'cgveyyxtvo', 'lwcqsp', 'gut', 'qx', 'chdgjtkhmkixozuogrlskmatarpuhrfn', 'kvgdzuygrnwewdwvpbeihh', 'upzadbdyymyvuteolyeerecnuptghlzs', 'nozeuuvteryojyokp', 'xjzefjsatogetko', 'tlnusyeyyqygwupc', 'mt'], [[24, 25], [12, 18], [24, 25], [22, 22], [18, 25], [11, 24], [18, 20], [18, 22], [10, 10], [12, 19], [16, 18], [1, 3], [18, 23]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.vowelStrings(**[['b', 'rmivyakd', 'kddwnexxssssnvrske', 'vceguisunlxtldqenxiyfupvnsxdubcnaucpoi', 'nzwdiataxfkbikbtsjvcbjxtr', 'wlelgybcaakrxiutsmwnkuyanvcjczenuyaiy', 'eueryyiayq', 'bghegfwmwdoayakuzavnaucpur', 'ukorsxjfkdojcxgjxgmxbghno', 'pmgbiuzcwbsakwkyspeikpzhnyiqtqtfyephqhl', 'gsjdpelkbsruooeffnvjwtsidzw', 'ugeqzndjtogxjkmhkkczdpqzwcu', 'ppngtecadjsirj', 'rvfeoxunxaqezkrlr', 'adkxoxycpinlmcvmq', 'gfjhpxlzmokcmvhjcrbrpfakspscmju', 'rgmzhaj', 'ychktzwdhfuruhpvdjwfsqjhztshcxdey', 'yifrzmmyzvfk', 'mircixfzzobcficujgbj', 'd', 'pxcmwnqknyfkmafzbyajjildngccadudfziknos', 'dxmlikjoivggmyasaktllgmfhqpyznc', 'yqdbiiqexkemebyuitve'], [[5, 21], [17, 22], [19, 23], [13, 15], [20, 23], [21, 23], [6, 20], [1, 8], [15, 20], [17, 22], [6, 6], [1, 2], [4, 11], [14, 23], [7, 10], [16, 22], [20, 22], [21, 22], [15, 18], [5, 16], [17, 23]]]) == [2, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 2, 0]\nassert my_solution.vowelStrings(**[['kzizbfceyysfjbkckouoqyrnxiobp', 'tfqjcavpwpyjmclwzjtyfpybipmynlkw', 'lrztxdla', 'gdhqqtobnaxvqgdzco', 'gcbzd', 'nuj', 'vferffslesxzofmidouariwuicauehfowcnv', 'czzeglsa', 'q', 'bzizqhugxngbkhfyxn', 'slebsmaccedlxjknmglsyexnfduue', 'oewsysetdvrtnuuws', 'su', 'benfnmdcavczz', 'lhkiksxegfbwnbllutdqnadrjz', 'qgauywpihdvysiwpkkxhvoglgedptnxvq', 'ghxnufgrapwzyvfxqxrpgr', 'ax', 'vivkmjjpust', 'p', 'jfxfeerpnpywxbxaqy', 'ciqqvebziztmmxhqltxnoklrpkdryupce', 'hsrlhcjvuapzyxkumaqdsqtffxxbudt'], [[13, 19], [17, 17], [14, 22], [4, 21], [4, 10], [18, 19], [2, 20], [15, 19], [8, 12], [6, 18], [21, 21], [20, 20], [16, 22], [2, 2], [20, 21], [4, 8], [16, 17], [3, 13], [0, 10], [4, 14]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.vowelStrings(**[['cflrm', 'cijkmlbfqvndbejornojrskvtxmiuajzin', 'omjtganzobjimtwk', 'rmsiuvsxtmryvsrp', 'xszpzelpzowqnk', 'jgggpyjlpqdgvgespxlfejgu', 'mfknjktbypeocnrkirywkwcbztpoixwmfrs', 'narnyv', 'xgbcyiv', 'suoypywheeydwgudqfdvkyfpjr', 'ttcsqrhpf', 'vtrkdonyrl', 'gqtrejhozfobjyxcwsxlkxnteblin', 'vksousorhltzffzcknmqagc', 'kxonfcycdfoqlkqguqpaitfqz', 'frvdlchqktyxhrpvjqcwkwwmdvjrd', 'isjveznlsjalhrnvmedog', 'delwleatorqcmn', 'wr', 'cvtgojgdvyuemygfsrwwzwvpeccqpgkbbvljgk', 'zq', 'updwfiwtknzssr', 'yhlqgqxhjlkqbuhqlponeackg', 'wgkpgwsfgsvrlisfkyzdjsmevlljccud', 'y', 'wkmkskrhehdrizaiiwgwogelaaifonhcoh', 'gvrl', 'mxslvajycct', 'gjmpojlupzphnm', 'wsghewxiamusracsvevypoakmylaob', 'rssykhcam', 'taqvwukssbbiqjqtuhzoqq', 'erlzszzvppmjkxqeallbfijqevmbcyaq', 'anxrrekineex', 'mtthkpgt', 'bqvfy', 'ofwlbyjhbabwwmcdyoub', 'prfcm'], [[7, 22], [28, 36], [10, 27], [6, 14], [23, 34], [27, 35]]]) == [0, 0, 0, 0, 0, 0]\nassert my_solution.vowelStrings(**[['qysocu', 'xnisoxgsdkujhjjadtsqddmmd', 'vwervizcudgedrguu', 'uzoaikzkhuxbzszqar', 'rzvuejyncmwpbhs', 'gap', 'ekpvxaowewrpzzjdukewfr', 'tawetkkelzvtqfbyxaxtceegx', 'ismdpgsjnmqyfhrkaaoyhvarkno'], [[7, 8], [2, 8], [0, 5], [3, 5], [6, 6], [3, 3], [2, 8], [7, 7], [7, 8], [7, 7], [7, 8], [7, 8], [8, 8], [0, 5], [8, 8], [6, 8], [1, 5], [2, 6], [2, 3], [1, 6], [3, 3], [0, 7], [7, 7], [8, 8], [2, 7], [7, 7], [4, 4], [4, 6], [2, 5], [5, 5], [5, 5], [1, 2], [4, 6], [5, 6]]]) == [1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.vowelStrings(**[['kqcwylmjlflugvmjulgldifenpserey'], [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.vowelStrings(**[['ebnnporwiufimntatuaoadwbxrtrt', 'xjjqnrjkkbto', 'tkubqyxihhxikigwlnkikxhsfxmhl', 'xeezqycyn', 'ewrdylevbatctcydoqjcmixffplhdvcxy', 'erhrezicc', 'b', 'lgildbphjsiechluqedoor', 'vsuvhhkaxvdvipmlpxkawyuektwwyq', 'xvirozecg', 'mxzreujgplnza', 'lvwtmnpkswiyoheshvyjjhgzvwayv', 'ykbonftzsuuv', 'tpbyufbbqpe', 'nozcjouwqrxup', 'o', 'bzvicojsvpvaglmveonqabc', 'jefoabkhvaikfnjgamzbvisoff', 'tihdokbjutzwmuukkol', 'rjbqfnmoccwhidzzqekaudnsrhkybggicvmvbgch'], [[7, 10], [6, 9], [12, 13], [17, 18], [5, 10], [12, 12], [17, 19], [1, 18], [13, 18], [3, 11], [6, 14], [9, 10], [3, 19], [13, 18], [17, 18], [5, 7], [3, 12], [9, 11], [15, 17], [7, 15], [18, 18], [2, 17]]]) == [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1]\nassert my_solution.vowelStrings(**[['lyyzudvjdyltipmhkumetwg', 'lqphoab', 'nfueqyndjnldpwzeradnpgtxzcr', 'pxmiqfqknizxgusbvuacyhtgatqvszxsfk', 'nkpowilcdroztjzcflqshbhyfsleaorbjbffgo', 'tnzumynvbdfgdbopspllaqqq', 'sfporptloygrtvozznlcp', 'ibliaczsvcfrayatcrat', 'wnugyklmitopphickg', 'hxytsolgcyzoujwjjizwbni', 'tqbvvvvexhgaejgwbl', 'qpaaazfectkbcbgnupuipggtg', 'srjbzftoatzdsoollejrwtqfawtydzioau'], [[9, 10], [1, 3], [2, 10], [2, 8], [6, 6], [5, 9], [5, 5], [3, 12], [0, 5], [12, 12], [5, 6]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.vowelStrings(**[['jkjygdvedvucpoqqjmlkjigu', 'lcugrvkfelprpgadlzozvz', 'qfasfpmypzybewinlok', 'gylumjtiv', 'shjwqyfawpdgypouxkvwymxvmsdtkviu', 'ygspumyfetltvknrlie', 'hefpubdyohbovc', 'ipngcoobilmirudkr', 'zgtiszbdvvjipxvpoxcqfiodwcajwoqkicsuhy', 'fwlwankuyct', 'wqiggpoorgquciqzcwhocmxf', 'dsbmolgqcehlfqgm', 'rpvklkdpmupiwhhwzffpavltauoab', 'yhiaochtubjutdrwwncoofpvcew', 'gmpgfnmbfkylgwzewmgvooskstvbhprpuiqn', 'hngyz', 'gnhuiivfchcknikmwhyk', 'pmrzq', 'vgkfpukilsbyroacdqoewidhtmqhqgaslh', 'amqueewnjziywsgzbwyefcocfuwwyigpir', 'xxypvelajleseetxyw', 'hypbatrjgvshn', 'zblctzekosqgwauyykzcvkut', 'vdtkoalhcqlxxpourbftqkoafhfbjs', 'dfhfhblraeckwgkjecfbkthzn', 'oouufeegcgkqapsx', 'ohj', 'rrclfpujlehcawpwmmosnyealwqsyeoziqsrkezn', 'yprmmsrjmbitzmldrxbqfdrhcswp', 'yumevxlhbxblzczmfgambaylzevgfoaumdb', 'bbfwtgagyocsqwzwrwqfnhgebhwnncydzebyahr', 'zygayauiqvqshmzcghupstxojxgjbhzjwamfb', 'nbeqvcynubjmoznxzxjwiss', 'qwaxtqckjdxyysxssefuvebvyqxcpqjemiyhitz', 'rdoqiaxdj', 'dxjbswzwpamgfx', 'fjhhribecrxxdlzrijcmagbcjkwoxoawafeezla'], [[2, 34], [30, 33], [24, 28], [29, 34], [34, 36], [6, 30], [10, 28], [2, 30], [31, 34], [17, 30], [14, 15], [2, 22], [24, 31], [15, 34], [1, 35], [12, 30], [21, 27], [9, 34], [18, 35], [34, 36], [11, 24], [6, 28], [16, 28], [13, 15], [23, 36], [25, 27], [26, 34], [31, 31], [16, 29], [22, 34], [23, 36], [25, 30], [26, 36], [16, 16], [13, 27], [23, 26], [5, 25], [0, 24], [26, 29], [27, 30], [26, 31], [7, 7], [13, 33], [19, 21], [13, 22], [5, 18], [10, 17], [36, 36], [20, 29], [10, 17]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.vowelStrings(**[['adqbhlgnodwriduksjmkpftqvmiumqij', 'xzvwhwqvxqzjlqokjauapypfsznnp', 'rndbibrunaqupg', 'pnrhgzytzzhixsduff', 'pvwmhcttsfbclijfonpxikdzxqppkjgddydgrqry', 'oytsussafuarpocczkhfmqxph', 'mzcxatlnbyevzxqdpryreaujijxvumzpxzp', 'mhimrruswxpjxpeiwimjiysvjiwfktolmebema', 'eftrwex', 'jdwnflcfczy', 'qaygln', 'irvofhdtmi', 'gtxmbeuhvldxh', 'allmhrsmiwrwp', 'lslagyvtishaksgziqccupckqullwpu', 'edipbgtxzdcgxfgbcdzwgdcfqgdfwqcjoaqo', 'xssysowxy', 'qvyuzrmofvavwto', 'tyhnfacslpyaphcpxwydbgsyvzvpuqipumnrpmvh', 'ajveebaxuovdzsvgaptydfpvhkscmgajhxoghnzh', 'mskzezrfwqzllqufowcfmytva', 'rsgoq', 'nchmwboowjmrfqlggprhk', 'iplkgjvlzygdsafhglymienafnw', 'ugfqtbjhhqayydxaspqhrema', 'piogsxjuvdhmlffmueflhfqmdllsxbot', 'obqyapxbaiahkjttsvgwlwilzdothqd', 'zgntkotwmcdgwugjrfyg', 'znf', 'vemfljhfnmkwhctqfnbetdgfajmyiicq', 'rmqij', 'ctrdougcchjvmtgszkwbcbwvtwhu', 'wsfniovdljzsctyzjiiqlxvzqatuliygdibzldn', 'cwgzlkzobxhkdzqxqwwytyrty'], [[0, 15], [7, 9], [2, 14], [15, 19], [13, 23], [26, 32], [5, 16]]]) == [2, 0, 1, 1, 1, 0, 2]\nassert my_solution.vowelStrings(**[['iudibb', 'suejjertqtckmzloneax', 'adwocnu', 'idwstzyhpmhbasdag', 'qfsnlums', 'zokfvsjeualkidcbydbcsdjypacppoueoghpvevp', 'cddephdgmufwpllzfockd', 'vqowwarakfflbsmwhzzjedbb', 'jmlukjrjrlokgypqhqopogrcihlafwuapnctjjj', 'sjfyacnqqcifisjiciuvqqwkkpfylxuyybgirds', 'hyfi', 'gmktyoc', 'dhvpwwzz', 'kwjxwvigcukmcbvoeejgdaylrosxira', 'elxdlsqtarlhpmcwjyv', 'mloiczxrlxmqyetykoiy', 'emejlyduwciherxfmohukc', 'ojhlfmgaalhbvcivtltgkviu', 'gqrhceguhccfbrnbpmxerfpyvxaw', 'wmhn', 'euxnspekzbtqomdpynwreveyekvj', 'kkfkksflarmaiuzzqoxtwnbbhehgcyehgnyadgls', 'txjfymocufymepgcmnsxfvldtkoagpadnfsxej', 'kftsm', 'hevhskgwskqdztvfviirwrhvdys', 'vjyfdernzdabdvwrjmundmviwmwdsqjibfrt', 'c', 'ufiimkekbmaffinctkexccpbkht', 'prntvrqrighrajmjxetxnpehllfvsrdhm', 'd', 'sbawxagjpqzhkjvfxrmsfbw', 'zetmyxgyadthxkzpgsycjin', 'spswgaestqizviowilhgn', 'zvilwxo', 'vgegoiydmpkgbpiorwxyupyklrvhdaftbci', 'udcfeffnwnruzhyffucxxs', 'gpvavrxaqumtqnivftptnebmmpgtawq', 'zbraiomlywxufrjxi'], [[21, 25], [21, 25], [7, 30], [22, 24], [17, 28], [25, 26], [20, 24], [24, 32], [18, 26], [22, 27], [36, 36], [7, 13], [30, 31], [20, 27], [16, 30], [10, 23], [13, 30], [33, 37], [29, 31], [31, 36], [8, 23], [30, 35], [32, 37], [2, 15], [10, 12], [20, 32], [31, 34], [33, 36], [2, 22], [9, 14], [16, 36], [10, 28], [10, 37], [29, 30], [22, 29], [34, 37], [20, 24], [37, 37], [33, 33]]]) == [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 2, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0]\nassert my_solution.vowelStrings(**[['hlruqkczmlttszvqdvnpofomx', 'znh', 'umlxgbo', 'tpirloqwbffqqznekgctaimdxjtzhjr', 'rmiwygiizotiitvdwqhfynlhrax', 'vwzznjjcuwvaduywibpgdupqplitrmdagcbyxkjn', 'e', 'iateezlzmsuqjealljagxzfuji', 'ku', 'qexhvripjpuspsujfrfrtift', 'twmgcdhudzboonemwgjhkpnymhahvzom', 'rspdilnfcddjnmpzyerkfaqjr', 'wceobkpgwcufvrtnvetag', 'ahujky', 'qfa', 'fnkkic', 'iqeusnplnnihjcat', 'ihtxbe', 'gnytogf', 'wtbwxm', 'mjbdcikaxkemmjqurfvbwcezgu', 'zrcmqaeqbsdluqfosfbe', 'f', 'uutsamkutlsewbmivkdrexstiykgqvyktcya', 'msoqjyngxfgyglhadmoorxmpowascvoodoq', 'udrgpxvlhrfsfvbuwpfx'], [[25, 25], [16, 25], [22, 22], [15, 19], [17, 20], [0, 11], [12, 18], [14, 22], [11, 17], [22, 24], [8, 25], [9, 19], [18, 22], [0, 23], [0, 11]]]) == [0, 2, 0, 1, 1, 3, 1, 1, 1, 1, 2, 1, 0, 5, 3]\nassert my_solution.vowelStrings(**[['vjpusoeapvzdxxhmsfbdfjxvr', 'mqgzkybbvfrzv', 'nwlkndumbxbaaoibbmbftiayyqtyi', 'bwlx', 'bxaebmuznbldybexxcrsinqlo', 'btmrhswpavfmckxm', 'lmhrfxvgnywckjwzuqgglksk', 'xxwoxpk'], [[0, 5], [2, 5], [4, 4], [5, 7], [0, 0], [0, 3], [5, 5], [1, 2], [0, 3], [2, 4], [4, 7], [1, 6], [7, 7], [6, 6], [5, 5], [7, 7], [0, 0], [4, 5], [2, 7], [6, 7], [7, 7], [3, 5], [7, 7], [6, 7], [6, 7], [4, 7], [1, 6], [0, 0], [4, 7], [6, 6], [0, 6], [0, 5], [7, 7], [5, 7], [5, 7], [0, 0], [3, 6], [6, 7], [4, 6], [1, 1], [4, 4], [1, 2], [5, 5], [2, 5], [6, 6], [5, 5]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.vowelStrings(**[['wdvyujkiyn', 'irvzenhcktzis', 'jpzrjaysvgvhrolgt', 'jnjfwbjunncftitpshkwebuwevfurmkwfpeyc', 'xzsyajnoawddbxfqxsrvcrksqi', 'ocrgxkdwtfythbqkhyakaohajoqtmucbkgvac'], [[1, 2], [3, 4], [4, 5], [5, 5], [5, 5], [3, 4], [3, 5], [3, 4], [2, 3], [0, 1], [1, 4], [3, 3], [5, 5], [2, 2], [3, 4], [1, 1], [3, 4], [1, 1], [5, 5], [5, 5], [3, 5], [2, 4], [1, 2], [4, 4], [3, 3], [3, 5], [4, 4], [5, 5], [0, 1], [4, 5], [2, 4], [4, 5], [4, 5], [5, 5], [1, 3], [0, 1], [2, 4], [1, 1], [2, 2], [2, 4], [4, 4], [0, 2], [1, 4], [2, 4], [0, 4], [0, 4], [1, 5], [0, 0]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nassert my_solution.vowelStrings(**[['pdxrcutvvjgmsgwt', 'ffmgaughzdiowcipurh', 'hac', 'rlkqpncvlhmxswxzc', 'gkdkdnxffhhlxpihsmazaschnqxzy', 'nygcjswlauemfjudmmeirevblnltlnrchpymee', 'li', 'ceihxcoiqwdiughaguqqf', 'yalknuszrrmhlfscjcswkiumidhsadwoipkfi', 'ewhtfuuurkrdvlrcaifvr', 'ejfxswzxa', 'pdh', 'zfchnrrsnxipbmoysqlpguuoopvbpkxfilpzmvo', 'wkseztelfyrrkykjhh', 'jxetnjyabr', 'vosuxnmawelsdhnueewzdoxfkmqnblsv', 'dzbarfcdrnbht', 'ulpjo', 'vpu', 'essppvxi', 'rmhmbguhgrzfzzwqgwvxneueo', 'rlxufbdtulwnvowykgirsbpcwbibkhkinpbh', 'mvqbsfphbs', 'lepcbeiicqjywasvpqpdcuvxrolvlmitrmfim', 'dhwicdpbtmigvmcuaqkpkpbchpv', 'sjejysvtolgzqlgcsaq', 'ubheniqoibiczmvwphovghr', 'aqmrtaaejmoukyuzvtmzjewmwmvcbmvvcdre', 'abjdkpcfweakdqsdyrkdnspcvcbriecdfwroc', 'yrimnyqjx', 'rsj', 'gphyqsyuydgwwtswmcsgpo', 'fuyegcewpwkkgovcclhmzkkka', 'ibiicovpcghiskbsfza', 'pvfgucxmattwuljiudqatfvltqznwupxr'], [[12, 24], [15, 18], [26, 26], [4, 30], [20, 25], [19, 24], [8, 27], [1, 16], [5, 14], [2, 16], [11, 24], [26, 31], [7, 22], [4, 25], [24, 34], [30, 34], [3, 9], [10, 25], [26, 30], [13, 26], [19, 24], [5, 8], [29, 34], [1, 19], [10, 30], [8, 20], [9, 16], [7, 19], [9, 15], [10, 25], [23, 32], [6, 6], [24, 24], [26, 30], [16, 26], [32, 34], [5, 11], [22, 33], [4, 15], [2, 17], [32, 34], [25, 26], [4, 20], [4, 23], [19, 20], [24, 24]]]) == [2, 1, 0, 4, 0, 1, 4, 1, 1, 1, 2, 1, 3, 3, 2, 1, 0, 3, 1, 2, 1, 0, 1, 3, 4, 3, 1, 3, 1, 3, 1, 0, 0, 1, 2, 1, 1, 2, 1, 2, 1, 0, 3, 3, 1, 0]\nassert my_solution.vowelStrings(**[['kviyfwtuuaedglemhgtkbqonjpcxhfxpf', 'efggogoqurtmaiqmxealfvosqgkvgyun', 'rsjtjmvamgxfmhcszrobrbdqwnunopbyjtu', 'cn', 'pvillikmtlogezdjqyrtxhbljpjqfjefki', 'juwrtyovdwbafuswixvlwipfhtxavvzrdyxtn', 'ztekbrpjewjqqsxtjpwnvguraaprxyddgudgn', 'teixnqgthpnoyjadurcglmqkajlhika', 'vdmptwozbiufklndtzqsgfjh', 'wcvkgdegzackpuubsxerrqelhuz', 'chwlshuqziggmwvcsermnujnpplihttv', 'cxldnlucddylmvikzhsruv', 'o', 'rshlmadebgajfnhnp', 'qkrxxqdppuocvl', 'mpbedbdiasfdcjxuwqphvlwijynfqdwrvdhtbv', 'jqgoadfjplly', 'qjzdodolhsbpkijomlyjkekgialocibhfwch', 'xucbiycgvbeqtqtegzolabqiwjkgvfomrzw', 'nhsdnztyzbvmflepneus', 'me', 'qpxks', 'akexnubpemhodpapyeturvpsixsrirpl', 'frajkqquvzsdmwxhoouysuhuczdlnzbnvgtf', 'curpeaveeopbexkwrteqonhdrwdeuevjlg', 'ktqhnczjxgixyqpcszoyfzorcusop', 'kmbtclpivdhrydenqmdflowfgrefgmrnhjdezg', 'hhfdalmqdilceommorakayfrxeuqdpyjpgupqolm', 'tqefxcuieylvekwbnzeqrrzijgexvpcgfnhrk', 'yipyqncxpsbriz', 'skqkkpdtjbevqjnyjzxfdeczsgkanpa', 'meovymx', 'wtgtjwnbsnljnbltm', 'vwpquradseboueebizzoqziseamgatfuy', 'nsfffwyaclpnrzautsgcsatwefijzuighjavk', 'godevqgrgwlbsnz', 'rgqapallbkvojducfojxfsqz'], [[8, 17], [17, 22], [2, 6], [24, 27], [4, 17], [24, 36], [28, 28], [1, 25], [16, 22], [4, 10], [36, 36], [6, 20], [27, 32], [13, 30], [24, 29], [2, 29], [0, 27], [32, 36], [0, 3], [0, 14], [18, 24], [1, 20], [7, 28], [14, 27], [15, 24], [35, 36], [31, 34], [23, 34], [0, 1], [4, 21], [18, 31], [33, 34], [28, 34], [25, 29], [16, 16], [16, 27], [11, 21]]]) == [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1]\nassert my_solution.vowelStrings(**[['joltuyuheoekaqmggmpdkynngneisl', 'zjvisze', 'kllebi', 'zijkcvimjrwmdxgzrogrejzyfhr', 'euecxiecok', 'zppcflaeswvcnugnqshkkhwaw', 'gsmopobusefrlzapu', 'btpeighitnayhmczlmak', 'akzyvnit', 'nnvudmufjhzsamyqnjsuiwjukwbxkbspqrqlvcu', 'vpaanntn', 'buxwhpxxwwsyxwjcdqbuzrx', 'vdfenhnaklyufjxgmiohhacgwhprzqklpb', 'qitvikjxygnxmrxkctxwziyfovcnk', 'jmhsaanfrndkvkrdepfqvnat', 'mqgdrvjigubizrfdkz', 'odvkaneairirvtqivzyongekboggbkbfkzmdwcut', 'bycedgrirsygqncdgiemfmr', 'jazjyhvcaeoejhbvsxlnbcofdpare', 'ododnsrx', 'hm', 'wyj'], [[20, 20], [2, 8], [16, 17], [15, 16], [17, 17], [3, 17], [4, 4], [18, 19], [6, 14], [9, 12], [15, 19], [10, 14], [4, 6], [12, 12], [16, 19], [7, 19], [1, 2], [21, 21], [2, 20], [19, 20], [16, 18], [21, 21], [11, 16], [6, 7], [20, 20], [6, 16], [10, 20]]]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n"}, "labels": {"questionId": "2691", "questionFrontendId": "2559", "questionTitle": "Count Vowel Strings in Ranges", "stats": {"totalAccepted": "24.7K", "totalSubmission": "38.8K", "totalAcceptedRaw": 24661, "totalSubmissionRaw": 38794, "acRate": "63.6%"}, "probedCases": [{"inputs": [["aba", "bcb", "ece", "aa", "e"], [[0, 2], [1, 4], [1, 1]]], "output": [2, 3, 0]}, {"inputs": [["a", "e", "i"], [[0, 2], [0, 1], [2, 2]]], "output": [3, 2, 1]}, {"inputs": [["bzmxvzjxfddcuznspdcbwiojiqf", "mwguoaskvramwgiweogzulcinycosovozppl", "uigevazgbrddbcsvrvnngfrvkhmqszjicpieahs", "uivcdsboxnraqpokjzaayedf", "yalc", "bbhlbmpskgxmxosft", "vigplemkoni", "krdrlctodtmprpxwditvcps", "gqjwokkskrb", "bslxxpabivbvzkozzvdaykaatzrpe", "qwhzcwkchluwdnqjwhabroyyxbtsrsxqjnfpadi", "siqbezhkohmgbenbkikcxmvz", "ddmaireeouzcvffkcohxus", "kjzguljbwsxlrd", "gqzuqcljvcpmoqlnrxvzqwoyas", "vadguvpsubcwbfbaviedr", "nxnorutztxfnpvmukpwuraen", "imgvujjeygsiymdxp", "rdzkpk", "cuap", "qcojjumwp", "pyqzshwykhtyzdwzakjejqyxbganow", "cvxuskhcloxykcu", "ul", "axzscbjajazvbxffrydajapweci"], [[4, 4], [6, 17], [10, 17], [9, 18], [17, 22], [5, 23], [2, 5], [17, 21], [5, 17], [4, 8], [7, 17], [16, 19], [7, 12], [9, 20], [13, 23], [1, 5], [19, 19]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [["sdhky", "kqcljybkksifhmyuhorulktlglydmqmfasqaht", "oesmrtgthzdwbgnpkcgh", "pauhingxekhno", "nkqkuuhjqesjpd", "jmkmsiqbhtbqamxanbwr", "abqzwssfthcliekxllsndxluku", "sulfsxaqwjtrghcwtuwkbsrqo", "pmsfgbeardurzkxlicwuiliabjfn", "vgshnkmwghoam", "bvzldcctkxlcltvbemdwyilohofhl", "mqhapsekfwzanlbkhzofsohtxbhijmpdanjqvwe", "nbtuuosftvtj", "dmxqapmiyoewvtoscdkeihyfitgwrrfieaobqj", "qabfrbbzkxfljeiztjkgntrmbxkkadwn", "cgveyyxtvo", "lwcqsp", "gut", "qx", "chdgjtkhmkixozuogrlskmatarpuhrfn", "kvgdzuygrnwewdwvpbeihh", "upzadbdyymyvuteolyeerecnuptghlzs", "nozeuuvteryojyokp", "xjzefjsatogetko", "tlnusyeyyqygwupc", "mt"], [[24, 25], [12, 18], [24, 25], [22, 22], [18, 25], [11, 24], [18, 20], [18, 22], [10, 10], [12, 19], [16, 18], [1, 3], [18, 23]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [["b", "rmivyakd", "kddwnexxssssnvrske", "vceguisunlxtldqenxiyfupvnsxdubcnaucpoi", "nzwdiataxfkbikbtsjvcbjxtr", "wlelgybcaakrxiutsmwnkuyanvcjczenuyaiy", "eueryyiayq", "bghegfwmwdoayakuzavnaucpur", "ukorsxjfkdojcxgjxgmxbghno", "pmgbiuzcwbsakwkyspeikpzhnyiqtqtfyephqhl", "gsjdpelkbsruooeffnvjwtsidzw", "ugeqzndjtogxjkmhkkczdpqzwcu", "ppngtecadjsirj", "rvfeoxunxaqezkrlr", "adkxoxycpinlmcvmq", "gfjhpxlzmokcmvhjcrbrpfakspscmju", "rgmzhaj", "ychktzwdhfuruhpvdjwfsqjhztshcxdey", "yifrzmmyzvfk", "mircixfzzobcficujgbj", "d", "pxcmwnqknyfkmafzbyajjildngccadudfziknos", "dxmlikjoivggmyasaktllgmfhqpyznc", "yqdbiiqexkemebyuitve"], [[5, 21], [17, 22], [19, 23], [13, 15], [20, 23], [21, 23], [6, 20], [1, 8], [15, 20], [17, 22], [6, 6], [1, 2], [4, 11], [14, 23], [7, 10], [16, 22], [20, 22], [21, 22], [15, 18], [5, 16], [17, 23]]], "output": [2, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 2, 0]}, {"inputs": [["kzizbfceyysfjbkckouoqyrnxiobp", "tfqjcavpwpyjmclwzjtyfpybipmynlkw", "lrztxdla", "gdhqqtobnaxvqgdzco", "gcbzd", "nuj", "vferffslesxzofmidouariwuicauehfowcnv", "czzeglsa", "q", "bzizqhugxngbkhfyxn", "slebsmaccedlxjknmglsyexnfduue", "oewsysetdvrtnuuws", "su", "benfnmdcavczz", "lhkiksxegfbwnbllutdqnadrjz", "qgauywpihdvysiwpkkxhvoglgedptnxvq", "ghxnufgrapwzyvfxqxrpgr", "ax", "vivkmjjpust", "p", "jfxfeerpnpywxbxaqy", "ciqqvebziztmmxhqltxnoklrpkdryupce", "hsrlhcjvuapzyxkumaqdsqtffxxbudt"], [[13, 19], [17, 17], [14, 22], [4, 21], [4, 10], [18, 19], [2, 20], [15, 19], [8, 12], [6, 18], [21, 21], [20, 20], [16, 22], [2, 2], [20, 21], [4, 8], [16, 17], [3, 13], [0, 10], [4, 14]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [["cflrm", "cijkmlbfqvndbejornojrskvtxmiuajzin", "omjtganzobjimtwk", "rmsiuvsxtmryvsrp", "xszpzelpzowqnk", "jgggpyjlpqdgvgespxlfejgu", "mfknjktbypeocnrkirywkwcbztpoixwmfrs", "narnyv", "xgbcyiv", "suoypywheeydwgudqfdvkyfpjr", "ttcsqrhpf", "vtrkdonyrl", "gqtrejhozfobjyxcwsxlkxnteblin", "vksousorhltzffzcknmqagc", "kxonfcycdfoqlkqguqpaitfqz", "frvdlchqktyxhrpvjqcwkwwmdvjrd", "isjveznlsjalhrnvmedog", "delwleatorqcmn", "wr", "cvtgojgdvyuemygfsrwwzwvpeccqpgkbbvljgk", "zq", "updwfiwtknzssr", "yhlqgqxhjlkqbuhqlponeackg", "wgkpgwsfgsvrlisfkyzdjsmevlljccud", "y", "wkmkskrhehdrizaiiwgwogelaaifonhcoh", "gvrl", "mxslvajycct", "gjmpojlupzphnm", "wsghewxiamusracsvevypoakmylaob", "rssykhcam", "taqvwukssbbiqjqtuhzoqq", "erlzszzvppmjkxqeallbfijqevmbcyaq", "anxrrekineex", "mtthkpgt", "bqvfy", "ofwlbyjhbabwwmcdyoub", "prfcm"], [[7, 22], [28, 36], [10, 27], [6, 14], [23, 34], [27, 35]]], "output": [0, 0, 0, 0, 0, 0]}, {"inputs": [["qysocu", "xnisoxgsdkujhjjadtsqddmmd", "vwervizcudgedrguu", "uzoaikzkhuxbzszqar", "rzvuejyncmwpbhs", "gap", "ekpvxaowewrpzzjdukewfr", "tawetkkelzvtqfbyxaxtceegx", "ismdpgsjnmqyfhrkaaoyhvarkno"], [[7, 8], [2, 8], [0, 5], [3, 5], [6, 6], [3, 3], [2, 8], [7, 7], [7, 8], [7, 7], [7, 8], [7, 8], [8, 8], [0, 5], [8, 8], [6, 8], [1, 5], [2, 6], [2, 3], [1, 6], [3, 3], [0, 7], [7, 7], [8, 8], [2, 7], [7, 7], [4, 4], [4, 6], [2, 5], [5, 5], [5, 5], [1, 2], [4, 6], [5, 6]]], "output": [1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [["kqcwylmjlflugvmjulgldifenpserey"], [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [["ebnnporwiufimntatuaoadwbxrtrt", "xjjqnrjkkbto", "tkubqyxihhxikigwlnkikxhsfxmhl", "xeezqycyn", "ewrdylevbatctcydoqjcmixffplhdvcxy", "erhrezicc", "b", "lgildbphjsiechluqedoor", "vsuvhhkaxvdvipmlpxkawyuektwwyq", "xvirozecg", "mxzreujgplnza", "lvwtmnpkswiyoheshvyjjhgzvwayv", "ykbonftzsuuv", "tpbyufbbqpe", "nozcjouwqrxup", "o", "bzvicojsvpvaglmveonqabc", "jefoabkhvaikfnjgamzbvisoff", "tihdokbjutzwmuukkol", "rjbqfnmoccwhidzzqekaudnsrhkybggicvmvbgch"], [[7, 10], [6, 9], [12, 13], [17, 18], [5, 10], [12, 12], [17, 19], [1, 18], [13, 18], [3, 11], [6, 14], [9, 10], [3, 19], [13, 18], [17, 18], [5, 7], [3, 12], [9, 11], [15, 17], [7, 15], [18, 18], [2, 17]]], "output": [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1]}, {"inputs": [["lyyzudvjdyltipmhkumetwg", "lqphoab", "nfueqyndjnldpwzeradnpgtxzcr", "pxmiqfqknizxgusbvuacyhtgatqvszxsfk", "nkpowilcdroztjzcflqshbhyfsleaorbjbffgo", "tnzumynvbdfgdbopspllaqqq", "sfporptloygrtvozznlcp", "ibliaczsvcfrayatcrat", "wnugyklmitopphickg", "hxytsolgcyzoujwjjizwbni", "tqbvvvvexhgaejgwbl", "qpaaazfectkbcbgnupuipggtg", "srjbzftoatzdsoollejrwtqfawtydzioau"], [[9, 10], [1, 3], [2, 10], [2, 8], [6, 6], [5, 9], [5, 5], [3, 12], [0, 5], [12, 12], [5, 6]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [["jkjygdvedvucpoqqjmlkjigu", "lcugrvkfelprpgadlzozvz", "qfasfpmypzybewinlok", "gylumjtiv", "shjwqyfawpdgypouxkvwymxvmsdtkviu", "ygspumyfetltvknrlie", "hefpubdyohbovc", "ipngcoobilmirudkr", "zgtiszbdvvjipxvpoxcqfiodwcajwoqkicsuhy", "fwlwankuyct", "wqiggpoorgquciqzcwhocmxf", "dsbmolgqcehlfqgm", "rpvklkdpmupiwhhwzffpavltauoab", "yhiaochtubjutdrwwncoofpvcew", "gmpgfnmbfkylgwzewmgvooskstvbhprpuiqn", "hngyz", "gnhuiivfchcknikmwhyk", "pmrzq", "vgkfpukilsbyroacdqoewidhtmqhqgaslh", "amqueewnjziywsgzbwyefcocfuwwyigpir", "xxypvelajleseetxyw", "hypbatrjgvshn", "zblctzekosqgwauyykzcvkut", "vdtkoalhcqlxxpourbftqkoafhfbjs", "dfhfhblraeckwgkjecfbkthzn", "oouufeegcgkqapsx", "ohj", "rrclfpujlehcawpwmmosnyealwqsyeoziqsrkezn", "yprmmsrjmbitzmldrxbqfdrhcswp", "yumevxlhbxblzczmfgambaylzevgfoaumdb", "bbfwtgagyocsqwzwrwqfnhgebhwnncydzebyahr", "zygayauiqvqshmzcghupstxojxgjbhzjwamfb", "nbeqvcynubjmoznxzxjwiss", "qwaxtqckjdxyysxssefuvebvyqxcpqjemiyhitz", "rdoqiaxdj", "dxjbswzwpamgfx", "fjhhribecrxxdlzrijcmagbcjkwoxoawafeezla"], [[2, 34], [30, 33], [24, 28], [29, 34], [34, 36], [6, 30], [10, 28], [2, 30], [31, 34], [17, 30], [14, 15], [2, 22], [24, 31], [15, 34], [1, 35], [12, 30], [21, 27], [9, 34], [18, 35], [34, 36], [11, 24], [6, 28], [16, 28], [13, 15], [23, 36], [25, 27], [26, 34], [31, 31], [16, 29], [22, 34], [23, 36], [25, 30], [26, 36], [16, 16], [13, 27], [23, 26], [5, 25], [0, 24], [26, 29], [27, 30], [26, 31], [7, 7], [13, 33], [19, 21], [13, 22], [5, 18], [10, 17], [36, 36], [20, 29], [10, 17]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [["adqbhlgnodwriduksjmkpftqvmiumqij", "xzvwhwqvxqzjlqokjauapypfsznnp", "rndbibrunaqupg", "pnrhgzytzzhixsduff", "pvwmhcttsfbclijfonpxikdzxqppkjgddydgrqry", "oytsussafuarpocczkhfmqxph", "mzcxatlnbyevzxqdpryreaujijxvumzpxzp", "mhimrruswxpjxpeiwimjiysvjiwfktolmebema", "eftrwex", "jdwnflcfczy", "qaygln", "irvofhdtmi", "gtxmbeuhvldxh", "allmhrsmiwrwp", "lslagyvtishaksgziqccupckqullwpu", "edipbgtxzdcgxfgbcdzwgdcfqgdfwqcjoaqo", "xssysowxy", "qvyuzrmofvavwto", "tyhnfacslpyaphcpxwydbgsyvzvpuqipumnrpmvh", "ajveebaxuovdzsvgaptydfpvhkscmgajhxoghnzh", "mskzezrfwqzllqufowcfmytva", "rsgoq", "nchmwboowjmrfqlggprhk", "iplkgjvlzygdsafhglymienafnw", "ugfqtbjhhqayydxaspqhrema", "piogsxjuvdhmlffmueflhfqmdllsxbot", "obqyapxbaiahkjttsvgwlwilzdothqd", "zgntkotwmcdgwugjrfyg", "znf", "vemfljhfnmkwhctqfnbetdgfajmyiicq", "rmqij", "ctrdougcchjvmtgszkwbcbwvtwhu", "wsfniovdljzsctyzjiiqlxvzqatuliygdibzldn", "cwgzlkzobxhkdzqxqwwytyrty"], [[0, 15], [7, 9], [2, 14], [15, 19], [13, 23], [26, 32], [5, 16]]], "output": [2, 0, 1, 1, 1, 0, 2]}, {"inputs": [["iudibb", "suejjertqtckmzloneax", "adwocnu", "idwstzyhpmhbasdag", "qfsnlums", "zokfvsjeualkidcbydbcsdjypacppoueoghpvevp", "cddephdgmufwpllzfockd", "vqowwarakfflbsmwhzzjedbb", "jmlukjrjrlokgypqhqopogrcihlafwuapnctjjj", "sjfyacnqqcifisjiciuvqqwkkpfylxuyybgirds", "hyfi", "gmktyoc", "dhvpwwzz", "kwjxwvigcukmcbvoeejgdaylrosxira", "elxdlsqtarlhpmcwjyv", "mloiczxrlxmqyetykoiy", "emejlyduwciherxfmohukc", "ojhlfmgaalhbvcivtltgkviu", "gqrhceguhccfbrnbpmxerfpyvxaw", "wmhn", "euxnspekzbtqomdpynwreveyekvj", "kkfkksflarmaiuzzqoxtwnbbhehgcyehgnyadgls", "txjfymocufymepgcmnsxfvldtkoagpadnfsxej", "kftsm", "hevhskgwskqdztvfviirwrhvdys", "vjyfdernzdabdvwrjmundmviwmwdsqjibfrt", "c", "ufiimkekbmaffinctkexccpbkht", "prntvrqrighrajmjxetxnpehllfvsrdhm", "d", "sbawxagjpqzhkjvfxrmsfbw", "zetmyxgyadthxkzpgsycjin", "spswgaestqizviowilhgn", "zvilwxo", "vgegoiydmpkgbpiorwxyupyklrvhdaftbci", "udcfeffnwnruzhyffucxxs", "gpvavrxaqumtqnivftptnebmmpgtawq", "zbraiomlywxufrjxi"], [[21, 25], [21, 25], [7, 30], [22, 24], [17, 28], [25, 26], [20, 24], [24, 32], [18, 26], [22, 27], [36, 36], [7, 13], [30, 31], [20, 27], [16, 30], [10, 23], [13, 30], [33, 37], [29, 31], [31, 36], [8, 23], [30, 35], [32, 37], [2, 15], [10, 12], [20, 32], [31, 34], [33, 36], [2, 22], [9, 14], [16, 36], [10, 28], [10, 37], [29, 30], [22, 29], [34, 37], [20, 24], [37, 37], [33, 33]]], "output": [0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 2, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0]}, {"inputs": [["hlruqkczmlttszvqdvnpofomx", "znh", "umlxgbo", "tpirloqwbffqqznekgctaimdxjtzhjr", "rmiwygiizotiitvdwqhfynlhrax", "vwzznjjcuwvaduywibpgdupqplitrmdagcbyxkjn", "e", "iateezlzmsuqjealljagxzfuji", "ku", "qexhvripjpuspsujfrfrtift", "twmgcdhudzboonemwgjhkpnymhahvzom", "rspdilnfcddjnmpzyerkfaqjr", "wceobkpgwcufvrtnvetag", "ahujky", "qfa", "fnkkic", "iqeusnplnnihjcat", "ihtxbe", "gnytogf", "wtbwxm", "mjbdcikaxkemmjqurfvbwcezgu", "zrcmqaeqbsdluqfosfbe", "f", "uutsamkutlsewbmivkdrexstiykgqvyktcya", "msoqjyngxfgyglhadmoorxmpowascvoodoq", "udrgpxvlhrfsfvbuwpfx"], [[25, 25], [16, 25], [22, 22], [15, 19], [17, 20], [0, 11], [12, 18], [14, 22], [11, 17], [22, 24], [8, 25], [9, 19], [18, 22], [0, 23], [0, 11]]], "output": [0, 2, 0, 1, 1, 3, 1, 1, 1, 1, 2, 1, 0, 5, 3]}, {"inputs": [["vjpusoeapvzdxxhmsfbdfjxvr", "mqgzkybbvfrzv", "nwlkndumbxbaaoibbmbftiayyqtyi", "bwlx", "bxaebmuznbldybexxcrsinqlo", "btmrhswpavfmckxm", "lmhrfxvgnywckjwzuqgglksk", "xxwoxpk"], [[0, 5], [2, 5], [4, 4], [5, 7], [0, 0], [0, 3], [5, 5], [1, 2], [0, 3], [2, 4], [4, 7], [1, 6], [7, 7], [6, 6], [5, 5], [7, 7], [0, 0], [4, 5], [2, 7], [6, 7], [7, 7], [3, 5], [7, 7], [6, 7], [6, 7], [4, 7], [1, 6], [0, 0], [4, 7], [6, 6], [0, 6], [0, 5], [7, 7], [5, 7], [5, 7], [0, 0], [3, 6], [6, 7], [4, 6], [1, 1], [4, 4], [1, 2], [5, 5], [2, 5], [6, 6], [5, 5]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [["wdvyujkiyn", "irvzenhcktzis", "jpzrjaysvgvhrolgt", "jnjfwbjunncftitpshkwebuwevfurmkwfpeyc", "xzsyajnoawddbxfqxsrvcrksqi", "ocrgxkdwtfythbqkhyakaohajoqtmucbkgvac"], [[1, 2], [3, 4], [4, 5], [5, 5], [5, 5], [3, 4], [3, 5], [3, 4], [2, 3], [0, 1], [1, 4], [3, 3], [5, 5], [2, 2], [3, 4], [1, 1], [3, 4], [1, 1], [5, 5], [5, 5], [3, 5], [2, 4], [1, 2], [4, 4], [3, 3], [3, 5], [4, 4], [5, 5], [0, 1], [4, 5], [2, 4], [4, 5], [4, 5], [5, 5], [1, 3], [0, 1], [2, 4], [1, 1], [2, 2], [2, 4], [4, 4], [0, 2], [1, 4], [2, 4], [0, 4], [0, 4], [1, 5], [0, 0]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, {"inputs": [["pdxrcutvvjgmsgwt", "ffmgaughzdiowcipurh", "hac", "rlkqpncvlhmxswxzc", "gkdkdnxffhhlxpihsmazaschnqxzy", "nygcjswlauemfjudmmeirevblnltlnrchpymee", "li", "ceihxcoiqwdiughaguqqf", "yalknuszrrmhlfscjcswkiumidhsadwoipkfi", "ewhtfuuurkrdvlrcaifvr", "ejfxswzxa", "pdh", "zfchnrrsnxipbmoysqlpguuoopvbpkxfilpzmvo", "wkseztelfyrrkykjhh", "jxetnjyabr", "vosuxnmawelsdhnueewzdoxfkmqnblsv", "dzbarfcdrnbht", "ulpjo", "vpu", "essppvxi", "rmhmbguhgrzfzzwqgwvxneueo", "rlxufbdtulwnvowykgirsbpcwbibkhkinpbh", "mvqbsfphbs", "lepcbeiicqjywasvpqpdcuvxrolvlmitrmfim", "dhwicdpbtmigvmcuaqkpkpbchpv", "sjejysvtolgzqlgcsaq", "ubheniqoibiczmvwphovghr", "aqmrtaaejmoukyuzvtmzjewmwmvcbmvvcdre", "abjdkpcfweakdqsdyrkdnspcvcbriecdfwroc", "yrimnyqjx", "rsj", "gphyqsyuydgwwtswmcsgpo", "fuyegcewpwkkgovcclhmzkkka", "ibiicovpcghiskbsfza", "pvfgucxmattwuljiudqatfvltqznwupxr"], [[12, 24], [15, 18], [26, 26], [4, 30], [20, 25], [19, 24], [8, 27], [1, 16], [5, 14], [2, 16], [11, 24], [26, 31], [7, 22], [4, 25], [24, 34], [30, 34], [3, 9], [10, 25], [26, 30], [13, 26], [19, 24], [5, 8], [29, 34], [1, 19], [10, 30], [8, 20], [9, 16], [7, 19], [9, 15], [10, 25], [23, 32], [6, 6], [24, 24], [26, 30], [16, 26], [32, 34], [5, 11], [22, 33], [4, 15], [2, 17], [32, 34], [25, 26], [4, 20], [4, 23], [19, 20], [24, 24]]], "output": [2, 1, 0, 4, 0, 1, 4, 1, 1, 1, 2, 1, 3, 3, 2, 1, 0, 3, 1, 2, 1, 0, 1, 3, 4, 3, 1, 3, 1, 3, 1, 0, 0, 1, 2, 1, 1, 2, 1, 2, 1, 0, 3, 3, 1, 0]}, {"inputs": [["kviyfwtuuaedglemhgtkbqonjpcxhfxpf", "efggogoqurtmaiqmxealfvosqgkvgyun", "rsjtjmvamgxfmhcszrobrbdqwnunopbyjtu", "cn", "pvillikmtlogezdjqyrtxhbljpjqfjefki", "juwrtyovdwbafuswixvlwipfhtxavvzrdyxtn", "ztekbrpjewjqqsxtjpwnvguraaprxyddgudgn", "teixnqgthpnoyjadurcglmqkajlhika", "vdmptwozbiufklndtzqsgfjh", "wcvkgdegzackpuubsxerrqelhuz", "chwlshuqziggmwvcsermnujnpplihttv", "cxldnlucddylmvikzhsruv", "o", "rshlmadebgajfnhnp", "qkrxxqdppuocvl", "mpbedbdiasfdcjxuwqphvlwijynfqdwrvdhtbv", "jqgoadfjplly", "qjzdodolhsbpkijomlyjkekgialocibhfwch", "xucbiycgvbeqtqtegzolabqiwjkgvfomrzw", "nhsdnztyzbvmflepneus", "me", "qpxks", "akexnubpemhodpapyeturvpsixsrirpl", "frajkqquvzsdmwxhoouysuhuczdlnzbnvgtf", "curpeaveeopbexkwrteqonhdrwdeuevjlg", "ktqhnczjxgixyqpcszoyfzorcusop", "kmbtclpivdhrydenqmdflowfgrefgmrnhjdezg", "hhfdalmqdilceommorakayfrxeuqdpyjpgupqolm", "tqefxcuieylvekwbnzeqrrzijgexvpcgfnhrk", "yipyqncxpsbriz", "skqkkpdtjbevqjnyjzxfdeczsgkanpa", "meovymx", "wtgtjwnbsnljnbltm", "vwpquradseboueebizzoqziseamgatfuy", "nsfffwyaclpnrzautsgcsatwefijzuighjavk", "godevqgrgwlbsnz", "rgqapallbkvojducfojxfsqz"], [[8, 17], [17, 22], [2, 6], [24, 27], [4, 17], [24, 36], [28, 28], [1, 25], [16, 22], [4, 10], [36, 36], [6, 20], [27, 32], [13, 30], [24, 29], [2, 29], [0, 27], [32, 36], [0, 3], [0, 14], [18, 24], [1, 20], [7, 28], [14, 27], [15, 24], [35, 36], [31, 34], [23, 34], [0, 1], [4, 21], [18, 31], [33, 34], [28, 34], [25, 29], [16, 16], [16, 27], [11, 21]]], "output": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1]}, {"inputs": [["joltuyuheoekaqmggmpdkynngneisl", "zjvisze", "kllebi", "zijkcvimjrwmdxgzrogrejzyfhr", "euecxiecok", "zppcflaeswvcnugnqshkkhwaw", "gsmopobusefrlzapu", "btpeighitnayhmczlmak", "akzyvnit", "nnvudmufjhzsamyqnjsuiwjukwbxkbspqrqlvcu", "vpaanntn", "buxwhpxxwwsyxwjcdqbuzrx", "vdfenhnaklyufjxgmiohhacgwhprzqklpb", "qitvikjxygnxmrxkctxwziyfovcnk", "jmhsaanfrndkvkrdepfqvnat", "mqgdrvjigubizrfdkz", "odvkaneairirvtqivzyongekboggbkbfkzmdwcut", "bycedgrirsygqncdgiemfmr", "jazjyhvcaeoejhbvsxlnbcofdpare", "ododnsrx", "hm", "wyj"], [[20, 20], [2, 8], [16, 17], [15, 16], [17, 17], [3, 17], [4, 4], [18, 19], [6, 14], [9, 12], [15, 19], [10, 14], [4, 6], [12, 12], [16, 19], [7, 19], [1, 2], [21, 21], [2, 20], [19, 20], [16, 18], [21, 21], [11, 16], [6, 7], [20, 20], [6, 16], [10, 20]]], "output": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}]}} +{"id": "LeetCode/2690", "content": "# House Robber IV\n\nThere are several consecutive houses along a street, each of which has some money inside. There is also a robber, who wants to steal money from the homes, but he **refuses to steal from adjacent homes**.\n\n\nThe **capability** of the robber is the maximum amount of money he steals from one house of all the houses he robbed.\n\n\nYou are given an integer array `nums` representing how much money is stashed in each house. More formally, the `ith` house from the left has `nums[i]` dollars.\n\n\nYou are also given an integer `k`, representing the **minimum** number of houses the robber will steal from. It is always possible to steal at least `k` houses.\n\n\nReturn *the **minimum** capability of the robber out of all the possible ways to steal at least* `k` *houses*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [2,3,5,9], k = 2\n**Output:** 5\n**Explanation:** \nThere are three ways to rob at least 2 houses:\n- Rob the houses at indices 0 and 2. Capability is max(nums[0], nums[2]) = 5.\n- Rob the houses at indices 0 and 3. Capability is max(nums[0], nums[3]) = 9.\n- Rob the houses at indices 1 and 3. Capability is max(nums[1], nums[3]) = 9.\nTherefore, we return min(5, 9, 9) = 5.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [2,7,9,3,1], k = 2\n**Output:** 2\n**Explanation:** There are 7 ways to rob the houses. The way which leads to minimum capability is to rob the house at index 0 and 4. Return max(nums[0], nums[4]) = 2.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 105`\n* `1 <= nums[i] <= 109`\n* `1 <= k <= (nums.length + 1)/2`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minCapability(self, nums: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minCapability(**[[2, 3, 5, 9], 2]) == 5\nassert my_solution.minCapability(**[[2, 7, 9, 3, 1], 2]) == 2\nassert my_solution.minCapability(**[[2, 2], 1]) == 2\nassert my_solution.minCapability(**[[7, 3, 9, 5], 2]) == 5\nassert my_solution.minCapability(**[[1, 4, 5], 1]) == 1\nassert my_solution.minCapability(**[[1], 1]) == 1\nassert my_solution.minCapability(**[[7, 1, 8, 11], 1]) == 1\nassert my_solution.minCapability(**[[4, 22, 11, 14, 25], 3]) == 25\nassert my_solution.minCapability(**[[10, 15, 6, 2], 1]) == 2\nassert my_solution.minCapability(**[[9, 25, 16, 6, 18], 1]) == 6\nassert my_solution.minCapability(**[[3, 6, 6, 9], 2]) == 6\nassert my_solution.minCapability(**[[7, 14, 3, 6], 1]) == 3\nassert my_solution.minCapability(**[[4, 4], 1]) == 4\nassert my_solution.minCapability(**[[2, 1], 1]) == 1\nassert my_solution.minCapability(**[[9, 6, 2], 1]) == 2\nassert my_solution.minCapability(**[[3, 4, 1], 1]) == 1\nassert my_solution.minCapability(**[[4, 2], 1]) == 2\nassert my_solution.minCapability(**[[9, 6, 20, 21, 8], 3]) == 20\nassert my_solution.minCapability(**[[13, 1, 13, 7], 2]) == 7\nassert my_solution.minCapability(**[[2, 12, 11, 13], 2]) == 11\n"}, "labels": {"questionId": "2690", "questionFrontendId": "2560", "questionTitle": "House Robber IV", "stats": {"totalAccepted": "24.8K", "totalSubmission": "41.2K", "totalAcceptedRaw": 24797, "totalSubmissionRaw": 41152, "acRate": "60.3%"}, "probedCases": [{"inputs": [[2, 3, 5, 9], 2], "output": 5}, {"inputs": [[2, 7, 9, 3, 1], 2], "output": 2}, {"inputs": [[2, 2], 1], "output": 2}, {"inputs": [[7, 3, 9, 5], 2], "output": 5}, {"inputs": [[1, 4, 5], 1], "output": 1}, {"inputs": [[1], 1], "output": 1}, {"inputs": [[7, 1, 8, 11], 1], "output": 1}, {"inputs": [[4, 22, 11, 14, 25], 3], "output": 25}, {"inputs": [[10, 15, 6, 2], 1], "output": 2}, {"inputs": [[9, 25, 16, 6, 18], 1], "output": 6}, {"inputs": [[3, 6, 6, 9], 2], "output": 6}, {"inputs": [[7, 14, 3, 6], 1], "output": 3}, {"inputs": [[4, 4], 1], "output": 4}, {"inputs": [[2, 1], 1], "output": 1}, {"inputs": [[9, 6, 2], 1], "output": 2}, {"inputs": [[3, 4, 1], 1], "output": 1}, {"inputs": [[4, 2], 1], "output": 2}, {"inputs": [[9, 6, 20, 21, 8], 3], "output": 20}, {"inputs": [[13, 1, 13, 7], 2], "output": 7}, {"inputs": [[2, 12, 11, 13], 2], "output": 11}]}} +{"id": "LeetCode/2689", "content": "# Rearranging Fruits\n\nYou have two fruit baskets containing `n` fruits each. You are given two **0-indexed** integer arrays `basket1` and `basket2` representing the cost of fruit in each basket. You want to make both baskets **equal**. To do so, you can use the following operation as many times as you want:\n\n\n* Chose two indices `i` and `j`, and swap the `ith`fruit of `basket1` with the `jth` fruit of `basket2`.\n* The cost of the swap is `min(basket1[i],basket2[j])`.\n\n\nTwo baskets are considered equal if sorting them according to the fruit cost makes them exactly the same baskets.\n\n\nReturn *the minimum cost to make both the baskets equal or* `-1` *if impossible.*\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** basket1 = [4,2,2,2], basket2 = [1,4,1,2]\n**Output:** 1\n**Explanation:** Swap index 1 of basket1 with index 0 of basket2, which has cost 1. Now basket1 = [4,1,2,2] and basket2 = [2,4,1,2]. Rearranging both the arrays makes them equal.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** basket1 = [2,3,4,1], basket2 = [3,2,5,1]\n**Output:** -1\n**Explanation:** It can be shown that it is impossible to make both the baskets equal.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `basket1.length == basket2.length`\n* `1 <= basket1.length <= 105`\n* `1 <= basket1[i],basket2[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def minCost(self, basket1: List[int], basket2: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.minCost(**[[4, 2, 2, 2], [1, 4, 1, 2]]) == 1\nassert my_solution.minCost(**[[2, 3, 4, 1], [3, 2, 5, 1]]) == -1\nassert my_solution.minCost(**[[4, 4, 4, 4, 3], [5, 5, 5, 5, 3]]) == 8\nassert my_solution.minCost(**[[5, 8, 15, 7], [5, 7, 8, 15]]) == 0\nassert my_solution.minCost(**[[1], [1]]) == 0\nassert my_solution.minCost(**[[3, 2, 9], [3, 2, 9]]) == 0\nassert my_solution.minCost(**[[84, 80, 43, 8, 80, 88, 43, 14, 100, 88], [32, 32, 42, 68, 68, 100, 42, 84, 14, 8]]) == 48\nassert my_solution.minCost(**[[8, 8, 8], [5, 5, 8]]) == 5\nassert my_solution.minCost(**[[183, 259, 304, 201, 128, 68, 289, 346, 257, 259, 300, 167, 167, 289, 33, 304, 382, 21, 183, 252], [97, 128, 169, 21, 382, 169, 201, 68, 365, 183, 346, 97, 300, 257, 56, 183, 252, 365, 33, 56]]) == 168\nassert my_solution.minCost(**[[3350, 1104, 2004, 1577, 1365, 2088, 2249, 1948, 2621, 750, 31, 2004, 1749, 3365, 3350, 3843, 3365, 1656, 3168, 3106, 2820, 3557, 1095, 2446, 573, 2464, 2172, 1326, 2712, 467, 1104, 1446, 1577, 53, 2492, 2638, 1200, 2997, 3454, 2492, 1926, 1452, 2712, 446, 2997, 2820, 750, 2529, 3847, 656, 272, 3873, 530, 1749, 1743, 251, 3847, 31, 251, 515, 2858, 126, 2491], [530, 1920, 2529, 2317, 1969, 2317, 1095, 2249, 2858, 2636, 3772, 53, 3106, 2638, 1267, 1926, 2882, 515, 3772, 1969, 3454, 2446, 656, 2621, 1365, 1743, 3557, 1656, 3447, 446, 1098, 1446, 467, 2636, 1088, 1098, 2882, 1088, 1326, 644, 3873, 3843, 3926, 1920, 2464, 2088, 205, 1200, 1267, 272, 925, 925, 2172, 2491, 3168, 644, 1452, 573, 1948, 3926, 205, 126, 3447]]) == 837\nassert my_solution.minCost(**[[3697, 172, 5406, 5644, 5588, 4541, 2078, 172, 6492, 6152, 4545, 5660, 3310, 4525, 1971, 6655, 6562, 1793, 5938, 2317, 3459, 6889, 5799, 5237, 2027, 4545, 203, 3681, 6587, 3031, 3710, 6152, 578, 818, 3370, 5381, 88, 4525, 1971, 4157, 5439, 2078, 2590, 6712, 2786, 3681, 3618, 4396, 5268, 3459, 5570, 2916, 4396, 3525, 1085, 3618, 3525, 4934, 5406, 2707, 3995, 64, 5938, 3161, 2364, 2590, 527, 1943, 6587, 2184, 6383, 5268, 6492, 922, 3697, 578, 2184, 3710, 6889, 1473, 6712, 4674, 3995], [2317, 3053, 2916, 6655, 6325, 3511, 4929, 3161, 5660, 2027, 2557, 2343, 2563, 5588, 6562, 5466, 5570, 5572, 314, 331, 922, 6504, 2559, 1793, 6504, 6086, 2563, 818, 3031, 2559, 2975, 2557, 2454, 4721, 2143, 5572, 3511, 2143, 3549, 331, 4674, 176, 2454, 5237, 6383, 1943, 527, 3370, 140, 88, 176, 1085, 2364, 4541, 2975, 1473, 2707, 4721, 5439, 3053, 64, 314, 5381, 5904, 6086, 3310, 3549, 4157, 166, 140, 2343, 5799, 203, 4934, 44, 4929, 2786, 44, 166, 5644, 6325, 5904, 5466]]) == 2068\nassert my_solution.minCost(**[[4, 114, 114, 116, 144, 18, 128, 4, 34, 34, 144, 118], [75, 66, 18, 113, 118, 128, 47, 66, 113, 116, 75, 47]]) == 28\nassert my_solution.minCost(**[[6374, 1232, 3450, 4041, 5, 1748, 184, 2291, 7043, 4912, 1977, 670, 3222, 5669, 6638, 6724, 3128, 6829, 3730, 1746, 5598, 1636, 4912, 2607, 768, 735, 6786, 6063, 1591, 4041, 92, 1452, 5676, 1804, 1452, 3593, 2886, 100, 5131, 3730, 3214, 1535, 670, 6962, 1788, 5669, 6910, 1860, 6374, 2291, 5753, 6830, 6830, 100, 4850, 5995, 1788, 3750, 5598, 3593, 2607, 6037, 6962, 1535, 6063, 1977, 3214, 7009, 2164, 5324, 1952, 768, 4077, 4725, 2807, 2238, 1232, 3450, 5, 4976, 6786, 6450, 3354, 4725], [3284, 4067, 3342, 4141, 599, 3030, 2904, 599, 1860, 6530, 3750, 4141, 3006, 3030, 2904, 4652, 6381, 1591, 1746, 6530, 4976, 6993, 6037, 5357, 4833, 2807, 3006, 92, 2189, 5643, 6638, 1804, 5131, 184, 6714, 2886, 7009, 6714, 4727, 1096, 3326, 5643, 4067, 4727, 4423, 2164, 1636, 4652, 3326, 3222, 4423, 1096, 6993, 4850, 4833, 6724, 5995, 4797, 6210, 1748, 6910, 3284, 3354, 735, 2238, 5324, 6829, 6450, 5357, 6210, 6381, 7035, 7043, 3128, 3342, 5753, 6595, 2189, 1952, 4797, 7035, 4077, 5676, 6595]]) == 245\nassert my_solution.minCost(**[[2781, 848, 2788, 2152, 826, 3325, 3172, 2661, 1504, 2980, 2598, 3213, 452, 1611, 2163, 146, 3023, 2447, 1510, 2492, 1656, 2913, 2948, 528, 2101, 372, 2052, 2529, 1763, 2331, 3082, 2462, 2852, 835, 786, 2511, 1057, 848, 2484, 714, 933, 353, 2035, 3233, 2210, 2887, 3183, 2206, 671, 839, 2798, 1067, 2863, 1445, 2162, 2064, 472, 1692], [1208, 394, 618, 728, 877, 3186, 2873, 862, 1536, 1131, 918, 567, 3222, 870, 2415, 1196, 1139, 945, 1275, 2718, 1112, 569, 2786, 1621, 1856, 1658, 1297, 396, 2544, 2307, 2802, 820, 149, 614, 518, 926, 750, 3323, 1867, 1110, 1966, 633, 1472, 2288, 3176, 60, 2019, 3066, 2246, 1653, 257, 1889, 3362, 1600, 71, 1038, 1640, 2458]]) == -1\nassert my_solution.minCost(**[[2781, 848, 2788, 2152, 826, 3325, 3172, 2661, 1504, 2980, 2598, 3213, 452, 1611, 2163, 146, 3023, 2447, 1510, 2492, 1656, 2913, 2948, 528, 2101, 372, 2052, 2529, 1763, 2331, 3082, 2462, 2852, 835, 786, 2511, 1057, 848, 2484, 714, 933, 353, 2035, 3233, 2210, 2887, 3183, 2206, 671, 839, 2798, 1067, 2863, 1445, 2162, 2064, 472, 1692], [2781, 848, 2788, 2152, 826, 3325, 3172, 2661, 1504, 2980, 2598, 3213, 452, 1611, 2163, 146, 3023, 2447, 1510, 2492, 1656, 2913, 2948, 528, 2101, 372, 2052, 2529, 1763, 2331, 3082, 2462, 2852, 835, 786, 2511, 1057, 848, 2484, 714, 933, 353, 2035, 3233, 2210, 2887, 3183, 2206, 671, 839, 2798, 1067, 2863, 1445, 2162, 2064, 472, 1692]]) == 0\nassert my_solution.minCost(**[[1086, 635, 593, 737, 989, 758, 3, 566, 793, 926, 542, 263, 79, 903, 731, 538, 551, 566, 1126, 562, 943, 228, 1030, 605, 608, 763, 803, 797, 1135, 282, 976, 28, 903, 918], [927, 1151, 604, 102, 347, 193, 750, 1073, 382, 739, 418, 956, 884, 1103, 341, 336, 1119, 919, 570, 35, 192, 1024, 839, 366, 533, 79, 982, 464, 555, 554, 38, 838, 767, 170]]) == -1\nassert my_solution.minCost(**[[1086, 635, 593, 737, 989, 758, 3, 566, 793, 926, 542, 263, 79, 903, 731, 538, 551, 566, 1126, 562, 943, 228, 1030, 605, 608, 763, 803, 797, 1135, 282, 976, 28, 903, 918], [1086, 635, 593, 737, 989, 758, 3, 566, 793, 926, 542, 263, 79, 903, 731, 538, 551, 566, 1126, 562, 943, 228, 1030, 605, 608, 763, 803, 797, 1135, 282, 976, 28, 903, 918]]) == 0\nassert my_solution.minCost(**[[4446, 2662, 3739, 3585, 935, 2825, 4378, 4882, 4706, 2264, 699, 1775, 2677, 4800, 239, 4032, 4067, 4236, 4155, 4540, 2018, 3622, 4295, 3509, 2067, 2466, 714, 3265, 661, 2865, 4721, 3437, 2094, 4475, 1941, 420, 3574, 637, 3345, 1579, 874, 2914, 3449, 1304, 612, 5017, 1951, 2520, 4849, 2021, 3415, 543, 4753, 1520, 2996, 894, 1575, 4853, 1611, 4253, 4826, 4695, 142, 452, 3102, 1149, 2383, 4212, 2922, 1632, 3208], [2812, 2971, 1552, 2487, 742, 1988, 962, 3224, 1011, 9, 113, 218, 3157, 887, 454, 3945, 581, 3821, 69, 1106, 3406, 1769, 2849, 304, 4617, 3508, 2341, 4524, 721, 373, 3549, 3849, 4490, 514, 4977, 4633, 175, 2344, 4503, 3261, 3416, 340, 2843, 1228, 2485, 4103, 971, 4947, 650, 3508, 4713, 4267, 1500, 3793, 4456, 763, 2619, 4828, 1745, 3939, 1325, 1712, 733, 1468, 4361, 2087, 2175, 189, 3369, 4308, 3824]]) == -1\nassert my_solution.minCost(**[[4446, 2662, 3739, 3585, 935, 2825, 4378, 4882, 4706, 2264, 699, 1775, 2677, 4800, 239, 4032, 4067, 4236, 4155, 4540, 2018, 3622, 4295, 3509, 2067, 2466, 714, 3265, 661, 2865, 4721, 3437, 2094, 4475, 1941, 420, 3574, 637, 3345, 1579, 874, 2914, 3449, 1304, 612, 5017, 1951, 2520, 4849, 2021, 3415, 543, 4753, 1520, 2996, 894, 1575, 4853, 1611, 4253, 4826, 4695, 142, 452, 3102, 1149, 2383, 4212, 2922, 1632, 3208], [4446, 2662, 3739, 3585, 935, 2825, 4378, 4882, 4706, 2264, 699, 1775, 2677, 4800, 239, 4032, 4067, 4236, 4155, 4540, 2018, 3622, 4295, 3509, 2067, 2466, 714, 3265, 661, 2865, 4721, 3437, 2094, 4475, 1941, 420, 3574, 637, 3345, 1579, 874, 2914, 3449, 1304, 612, 5017, 1951, 2520, 4849, 2021, 3415, 543, 4753, 1520, 2996, 894, 1575, 4853, 1611, 4253, 4826, 4695, 142, 452, 3102, 1149, 2383, 4212, 2922, 1632, 3208]]) == 0\nassert my_solution.minCost(**[[2845, 1522, 1261, 215, 904, 2673, 3050, 1372, 2280, 2977, 827, 1409, 1976, 2562, 1575, 176, 2770, 1085, 2365, 543, 847, 2327, 211, 2750, 393, 944, 2412, 592, 1581, 445, 2330, 363, 2691, 214, 547, 869, 2294, 2191, 2262, 2762, 1054, 612, 2812, 2917, 2837, 1742, 619, 1147, 1138, 189, 2681, 1519, 838, 691, 815, 2026], [2360, 1938, 2026, 767, 2423, 2795, 1522, 2648, 557, 2026, 2560, 466, 1247, 2886, 2487, 2052, 273, 2639, 1880, 1269, 2339, 1625, 2382, 1917, 1860, 2000, 2472, 1935, 2095, 2590, 1439, 229, 1808, 2779, 1401, 453, 475, 644, 1283, 525, 99, 2345, 1159, 1907, 2354, 1673, 640, 2336, 2702, 1679, 3019, 1352, 1454, 2314, 3087, 2877]]) == -1\n"}, "labels": {"questionId": "2689", "questionFrontendId": "2561", "questionTitle": "Rearranging Fruits", "stats": {"totalAccepted": "3.4K", "totalSubmission": "9.1K", "totalAcceptedRaw": 3428, "totalSubmissionRaw": 9076, "acRate": "37.8%"}, "probedCases": [{"inputs": [[4, 2, 2, 2], [1, 4, 1, 2]], "output": 1}, {"inputs": [[2, 3, 4, 1], [3, 2, 5, 1]], "output": -1}, {"inputs": [[4, 4, 4, 4, 3], [5, 5, 5, 5, 3]], "output": 8}, {"inputs": [[5, 8, 15, 7], [5, 7, 8, 15]], "output": 0}, {"inputs": [[1], [1]], "output": 0}, {"inputs": [[3, 2, 9], [3, 2, 9]], "output": 0}, {"inputs": [[84, 80, 43, 8, 80, 88, 43, 14, 100, 88], [32, 32, 42, 68, 68, 100, 42, 84, 14, 8]], "output": 48}, {"inputs": [[8, 8, 8], [5, 5, 8]], "output": 5}, {"inputs": [[183, 259, 304, 201, 128, 68, 289, 346, 257, 259, 300, 167, 167, 289, 33, 304, 382, 21, 183, 252], [97, 128, 169, 21, 382, 169, 201, 68, 365, 183, 346, 97, 300, 257, 56, 183, 252, 365, 33, 56]], "output": 168}, {"inputs": [[3350, 1104, 2004, 1577, 1365, 2088, 2249, 1948, 2621, 750, 31, 2004, 1749, 3365, 3350, 3843, 3365, 1656, 3168, 3106, 2820, 3557, 1095, 2446, 573, 2464, 2172, 1326, 2712, 467, 1104, 1446, 1577, 53, 2492, 2638, 1200, 2997, 3454, 2492, 1926, 1452, 2712, 446, 2997, 2820, 750, 2529, 3847, 656, 272, 3873, 530, 1749, 1743, 251, 3847, 31, 251, 515, 2858, 126, 2491], [530, 1920, 2529, 2317, 1969, 2317, 1095, 2249, 2858, 2636, 3772, 53, 3106, 2638, 1267, 1926, 2882, 515, 3772, 1969, 3454, 2446, 656, 2621, 1365, 1743, 3557, 1656, 3447, 446, 1098, 1446, 467, 2636, 1088, 1098, 2882, 1088, 1326, 644, 3873, 3843, 3926, 1920, 2464, 2088, 205, 1200, 1267, 272, 925, 925, 2172, 2491, 3168, 644, 1452, 573, 1948, 3926, 205, 126, 3447]], "output": 837}, {"inputs": [[3697, 172, 5406, 5644, 5588, 4541, 2078, 172, 6492, 6152, 4545, 5660, 3310, 4525, 1971, 6655, 6562, 1793, 5938, 2317, 3459, 6889, 5799, 5237, 2027, 4545, 203, 3681, 6587, 3031, 3710, 6152, 578, 818, 3370, 5381, 88, 4525, 1971, 4157, 5439, 2078, 2590, 6712, 2786, 3681, 3618, 4396, 5268, 3459, 5570, 2916, 4396, 3525, 1085, 3618, 3525, 4934, 5406, 2707, 3995, 64, 5938, 3161, 2364, 2590, 527, 1943, 6587, 2184, 6383, 5268, 6492, 922, 3697, 578, 2184, 3710, 6889, 1473, 6712, 4674, 3995], [2317, 3053, 2916, 6655, 6325, 3511, 4929, 3161, 5660, 2027, 2557, 2343, 2563, 5588, 6562, 5466, 5570, 5572, 314, 331, 922, 6504, 2559, 1793, 6504, 6086, 2563, 818, 3031, 2559, 2975, 2557, 2454, 4721, 2143, 5572, 3511, 2143, 3549, 331, 4674, 176, 2454, 5237, 6383, 1943, 527, 3370, 140, 88, 176, 1085, 2364, 4541, 2975, 1473, 2707, 4721, 5439, 3053, 64, 314, 5381, 5904, 6086, 3310, 3549, 4157, 166, 140, 2343, 5799, 203, 4934, 44, 4929, 2786, 44, 166, 5644, 6325, 5904, 5466]], "output": 2068}, {"inputs": [[4, 114, 114, 116, 144, 18, 128, 4, 34, 34, 144, 118], [75, 66, 18, 113, 118, 128, 47, 66, 113, 116, 75, 47]], "output": 28}, {"inputs": [[6374, 1232, 3450, 4041, 5, 1748, 184, 2291, 7043, 4912, 1977, 670, 3222, 5669, 6638, 6724, 3128, 6829, 3730, 1746, 5598, 1636, 4912, 2607, 768, 735, 6786, 6063, 1591, 4041, 92, 1452, 5676, 1804, 1452, 3593, 2886, 100, 5131, 3730, 3214, 1535, 670, 6962, 1788, 5669, 6910, 1860, 6374, 2291, 5753, 6830, 6830, 100, 4850, 5995, 1788, 3750, 5598, 3593, 2607, 6037, 6962, 1535, 6063, 1977, 3214, 7009, 2164, 5324, 1952, 768, 4077, 4725, 2807, 2238, 1232, 3450, 5, 4976, 6786, 6450, 3354, 4725], [3284, 4067, 3342, 4141, 599, 3030, 2904, 599, 1860, 6530, 3750, 4141, 3006, 3030, 2904, 4652, 6381, 1591, 1746, 6530, 4976, 6993, 6037, 5357, 4833, 2807, 3006, 92, 2189, 5643, 6638, 1804, 5131, 184, 6714, 2886, 7009, 6714, 4727, 1096, 3326, 5643, 4067, 4727, 4423, 2164, 1636, 4652, 3326, 3222, 4423, 1096, 6993, 4850, 4833, 6724, 5995, 4797, 6210, 1748, 6910, 3284, 3354, 735, 2238, 5324, 6829, 6450, 5357, 6210, 6381, 7035, 7043, 3128, 3342, 5753, 6595, 2189, 1952, 4797, 7035, 4077, 5676, 6595]], "output": 245}, {"inputs": [[2781, 848, 2788, 2152, 826, 3325, 3172, 2661, 1504, 2980, 2598, 3213, 452, 1611, 2163, 146, 3023, 2447, 1510, 2492, 1656, 2913, 2948, 528, 2101, 372, 2052, 2529, 1763, 2331, 3082, 2462, 2852, 835, 786, 2511, 1057, 848, 2484, 714, 933, 353, 2035, 3233, 2210, 2887, 3183, 2206, 671, 839, 2798, 1067, 2863, 1445, 2162, 2064, 472, 1692], [1208, 394, 618, 728, 877, 3186, 2873, 862, 1536, 1131, 918, 567, 3222, 870, 2415, 1196, 1139, 945, 1275, 2718, 1112, 569, 2786, 1621, 1856, 1658, 1297, 396, 2544, 2307, 2802, 820, 149, 614, 518, 926, 750, 3323, 1867, 1110, 1966, 633, 1472, 2288, 3176, 60, 2019, 3066, 2246, 1653, 257, 1889, 3362, 1600, 71, 1038, 1640, 2458]], "output": -1}, {"inputs": [[2781, 848, 2788, 2152, 826, 3325, 3172, 2661, 1504, 2980, 2598, 3213, 452, 1611, 2163, 146, 3023, 2447, 1510, 2492, 1656, 2913, 2948, 528, 2101, 372, 2052, 2529, 1763, 2331, 3082, 2462, 2852, 835, 786, 2511, 1057, 848, 2484, 714, 933, 353, 2035, 3233, 2210, 2887, 3183, 2206, 671, 839, 2798, 1067, 2863, 1445, 2162, 2064, 472, 1692], [2781, 848, 2788, 2152, 826, 3325, 3172, 2661, 1504, 2980, 2598, 3213, 452, 1611, 2163, 146, 3023, 2447, 1510, 2492, 1656, 2913, 2948, 528, 2101, 372, 2052, 2529, 1763, 2331, 3082, 2462, 2852, 835, 786, 2511, 1057, 848, 2484, 714, 933, 353, 2035, 3233, 2210, 2887, 3183, 2206, 671, 839, 2798, 1067, 2863, 1445, 2162, 2064, 472, 1692]], "output": 0}, {"inputs": [[1086, 635, 593, 737, 989, 758, 3, 566, 793, 926, 542, 263, 79, 903, 731, 538, 551, 566, 1126, 562, 943, 228, 1030, 605, 608, 763, 803, 797, 1135, 282, 976, 28, 903, 918], [927, 1151, 604, 102, 347, 193, 750, 1073, 382, 739, 418, 956, 884, 1103, 341, 336, 1119, 919, 570, 35, 192, 1024, 839, 366, 533, 79, 982, 464, 555, 554, 38, 838, 767, 170]], "output": -1}, {"inputs": [[1086, 635, 593, 737, 989, 758, 3, 566, 793, 926, 542, 263, 79, 903, 731, 538, 551, 566, 1126, 562, 943, 228, 1030, 605, 608, 763, 803, 797, 1135, 282, 976, 28, 903, 918], [1086, 635, 593, 737, 989, 758, 3, 566, 793, 926, 542, 263, 79, 903, 731, 538, 551, 566, 1126, 562, 943, 228, 1030, 605, 608, 763, 803, 797, 1135, 282, 976, 28, 903, 918]], "output": 0}, {"inputs": [[4446, 2662, 3739, 3585, 935, 2825, 4378, 4882, 4706, 2264, 699, 1775, 2677, 4800, 239, 4032, 4067, 4236, 4155, 4540, 2018, 3622, 4295, 3509, 2067, 2466, 714, 3265, 661, 2865, 4721, 3437, 2094, 4475, 1941, 420, 3574, 637, 3345, 1579, 874, 2914, 3449, 1304, 612, 5017, 1951, 2520, 4849, 2021, 3415, 543, 4753, 1520, 2996, 894, 1575, 4853, 1611, 4253, 4826, 4695, 142, 452, 3102, 1149, 2383, 4212, 2922, 1632, 3208], [2812, 2971, 1552, 2487, 742, 1988, 962, 3224, 1011, 9, 113, 218, 3157, 887, 454, 3945, 581, 3821, 69, 1106, 3406, 1769, 2849, 304, 4617, 3508, 2341, 4524, 721, 373, 3549, 3849, 4490, 514, 4977, 4633, 175, 2344, 4503, 3261, 3416, 340, 2843, 1228, 2485, 4103, 971, 4947, 650, 3508, 4713, 4267, 1500, 3793, 4456, 763, 2619, 4828, 1745, 3939, 1325, 1712, 733, 1468, 4361, 2087, 2175, 189, 3369, 4308, 3824]], "output": -1}, {"inputs": [[4446, 2662, 3739, 3585, 935, 2825, 4378, 4882, 4706, 2264, 699, 1775, 2677, 4800, 239, 4032, 4067, 4236, 4155, 4540, 2018, 3622, 4295, 3509, 2067, 2466, 714, 3265, 661, 2865, 4721, 3437, 2094, 4475, 1941, 420, 3574, 637, 3345, 1579, 874, 2914, 3449, 1304, 612, 5017, 1951, 2520, 4849, 2021, 3415, 543, 4753, 1520, 2996, 894, 1575, 4853, 1611, 4253, 4826, 4695, 142, 452, 3102, 1149, 2383, 4212, 2922, 1632, 3208], [4446, 2662, 3739, 3585, 935, 2825, 4378, 4882, 4706, 2264, 699, 1775, 2677, 4800, 239, 4032, 4067, 4236, 4155, 4540, 2018, 3622, 4295, 3509, 2067, 2466, 714, 3265, 661, 2865, 4721, 3437, 2094, 4475, 1941, 420, 3574, 637, 3345, 1579, 874, 2914, 3449, 1304, 612, 5017, 1951, 2520, 4849, 2021, 3415, 543, 4753, 1520, 2996, 894, 1575, 4853, 1611, 4253, 4826, 4695, 142, 452, 3102, 1149, 2383, 4212, 2922, 1632, 3208]], "output": 0}, {"inputs": [[2845, 1522, 1261, 215, 904, 2673, 3050, 1372, 2280, 2977, 827, 1409, 1976, 2562, 1575, 176, 2770, 1085, 2365, 543, 847, 2327, 211, 2750, 393, 944, 2412, 592, 1581, 445, 2330, 363, 2691, 214, 547, 869, 2294, 2191, 2262, 2762, 1054, 612, 2812, 2917, 2837, 1742, 619, 1147, 1138, 189, 2681, 1519, 838, 691, 815, 2026], [2360, 1938, 2026, 767, 2423, 2795, 1522, 2648, 557, 2026, 2560, 466, 1247, 2886, 2487, 2052, 273, 2639, 1880, 1269, 2339, 1625, 2382, 1917, 1860, 2000, 2472, 1935, 2095, 2590, 1439, 229, 1808, 2779, 1401, 453, 475, 644, 1283, 525, 99, 2345, 1159, 1907, 2354, 1673, 640, 2336, 2702, 1679, 3019, 1352, 1454, 2314, 3087, 2877]], "output": -1}]}} +{"id": "LeetCode/2639", "content": "# Separate the Digits in an Array\n\nGiven an array of positive integers `nums`, return *an array* `answer` *that consists of the digits of each integer in* `nums` *after separating them in **the same order** they appear in* `nums`.\n\n\nTo separate the digits of an integer is to get all the digits it has in the same order.\n\n\n* For example, for the integer `10921`, the separation of its digits is `[1,0,9,2,1]`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [13,25,83,77]\n**Output:** [1,3,2,5,8,3,7,7]\n**Explanation:** \n- The separation of 13 is [1,3].\n- The separation of 25 is [2,5].\n- The separation of 83 is [8,3].\n- The separation of 77 is [7,7].\nanswer = [1,3,2,5,8,3,7,7]. Note that answer contains the separations in the same order.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [7,1,3,9]\n**Output:** [7,1,3,9]\n**Explanation:** The separation of each integer in nums is itself.\nanswer = [7,1,3,9].\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= nums.length <= 1000`\n* `1 <= nums[i] <= 105`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def separateDigits(self, nums: List[int]) -> List[int]:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.separateDigits(**[[13, 25, 83, 77]]) == [1, 3, 2, 5, 8, 3, 7, 7]\nassert my_solution.separateDigits(**[[7, 1, 3, 9]]) == [7, 1, 3, 9]\nassert my_solution.separateDigits(**[[9, 81, 33, 17, 58, 42, 8, 75]]) == [9, 8, 1, 3, 3, 1, 7, 5, 8, 4, 2, 8, 7, 5]\nassert my_solution.separateDigits(**[[28, 35, 21, 13, 21, 72, 35, 52]]) == [2, 8, 3, 5, 2, 1, 1, 3, 2, 1, 7, 2, 3, 5, 5, 2]\nassert my_solution.separateDigits(**[[74, 92, 25, 65, 77, 1, 73]]) == [7, 4, 9, 2, 2, 5, 6, 5, 7, 7, 1, 7, 3]\nassert my_solution.separateDigits(**[[32, 43, 68, 8, 100, 84, 80, 14, 88, 42, 53, 98, 69, 64, 40, 60, 23, 99]]) == [3, 2, 4, 3, 6, 8, 8, 1, 0, 0, 8, 4, 8, 0, 1, 4, 8, 8, 4, 2, 5, 3, 9, 8, 6, 9, 6, 4, 4, 0, 6, 0, 2, 3, 9, 9]\nassert my_solution.separateDigits(**[[83, 5, 21, 76, 34, 99, 63, 23, 70, 18, 64, 12, 21, 21, 78, 36, 58, 88, 58, 99]]) == [8, 3, 5, 2, 1, 7, 6, 3, 4, 9, 9, 6, 3, 2, 3, 7, 0, 1, 8, 6, 4, 1, 2, 2, 1, 2, 1, 7, 8, 3, 6, 5, 8, 8, 8, 5, 8, 9, 9]\nassert my_solution.separateDigits(**[[26, 92, 91, 53, 10, 24, 25, 20, 92, 73, 63, 51, 65, 87, 6, 17, 32, 14, 42]]) == [2, 6, 9, 2, 9, 1, 5, 3, 1, 0, 2, 4, 2, 5, 2, 0, 9, 2, 7, 3, 6, 3, 5, 1, 6, 5, 8, 7, 6, 1, 7, 3, 2, 1, 4, 4, 2]\nassert my_solution.separateDigits(**[[46, 65, 43, 9, 75, 76, 25, 96, 46, 85, 19, 29, 88, 2, 5, 24, 60]]) == [4, 6, 6, 5, 4, 3, 9, 7, 5, 7, 6, 2, 5, 9, 6, 4, 6, 8, 5, 1, 9, 2, 9, 8, 8, 2, 5, 2, 4, 6, 0]\nassert my_solution.separateDigits(**[[26, 76, 24, 96, 82]]) == [2, 6, 7, 6, 2, 4, 9, 6, 8, 2]\nassert my_solution.separateDigits(**[[97, 97, 72, 35, 21, 77, 82, 30, 94, 55, 76, 94, 51, 82, 3]]) == [9, 7, 9, 7, 7, 2, 3, 5, 2, 1, 7, 7, 8, 2, 3, 0, 9, 4, 5, 5, 7, 6, 9, 4, 5, 1, 8, 2, 3]\nassert my_solution.separateDigits(**[[89, 52, 96, 72, 27, 59, 57]]) == [8, 9, 5, 2, 9, 6, 7, 2, 2, 7, 5, 9, 5, 7]\nassert my_solution.separateDigits(**[[30, 130, 14, 754, 41, 494, 548, 76, 825, 899, 499, 188, 982, 8, 890, 563, 438, 363, 32, 482, 623, 864, 161, 962, 678, 414, 659, 612, 332, 164, 580, 14, 633, 842, 969, 792, 777, 705, 436, 750, 501, 395, 342, 838]]) == [3, 0, 1, 3, 0, 1, 4, 7, 5, 4, 4, 1, 4, 9, 4, 5, 4, 8, 7, 6, 8, 2, 5, 8, 9, 9, 4, 9, 9, 1, 8, 8, 9, 8, 2, 8, 8, 9, 0, 5, 6, 3, 4, 3, 8, 3, 6, 3, 3, 2, 4, 8, 2, 6, 2, 3, 8, 6, 4, 1, 6, 1, 9, 6, 2, 6, 7, 8, 4, 1, 4, 6, 5, 9, 6, 1, 2, 3, 3, 2, 1, 6, 4, 5, 8, 0, 1, 4, 6, 3, 3, 8, 4, 2, 9, 6, 9, 7, 9, 2, 7, 7, 7, 7, 0, 5, 4, 3, 6, 7, 5, 0, 5, 0, 1, 3, 9, 5, 3, 4, 2, 8, 3, 8]\nassert my_solution.separateDigits(**[[493, 998, 112, 660, 961, 943, 721, 480, 522, 133, 129, 276, 362, 616, 52, 117, 300, 274, 862, 487, 715]]) == [4, 9, 3, 9, 9, 8, 1, 1, 2, 6, 6, 0, 9, 6, 1, 9, 4, 3, 7, 2, 1, 4, 8, 0, 5, 2, 2, 1, 3, 3, 1, 2, 9, 2, 7, 6, 3, 6, 2, 6, 1, 6, 5, 2, 1, 1, 7, 3, 0, 0, 2, 7, 4, 8, 6, 2, 4, 8, 7, 7, 1, 5]\nassert my_solution.separateDigits(**[[272, 232, 543, 275, 68, 144, 656, 623, 317, 63, 908, 565, 880, 12, 920, 467, 559, 91, 698, 577, 95, 436, 700, 467, 568, 389, 376, 830, 361, 818, 517]]) == [2, 7, 2, 2, 3, 2, 5, 4, 3, 2, 7, 5, 6, 8, 1, 4, 4, 6, 5, 6, 6, 2, 3, 3, 1, 7, 6, 3, 9, 0, 8, 5, 6, 5, 8, 8, 0, 1, 2, 9, 2, 0, 4, 6, 7, 5, 5, 9, 9, 1, 6, 9, 8, 5, 7, 7, 9, 5, 4, 3, 6, 7, 0, 0, 4, 6, 7, 5, 6, 8, 3, 8, 9, 3, 7, 6, 8, 3, 0, 3, 6, 1, 8, 1, 8, 5, 1, 7]\nassert my_solution.separateDigits(**[[290, 191, 596, 644, 425, 308, 825, 555, 583, 996, 630, 886, 382, 354, 455, 883, 581, 408, 619, 531, 618, 355, 14, 653, 638, 589, 271, 430, 519, 517, 851, 875, 69, 496, 924, 680, 753, 287, 496, 166, 300]]) == [2, 9, 0, 1, 9, 1, 5, 9, 6, 6, 4, 4, 4, 2, 5, 3, 0, 8, 8, 2, 5, 5, 5, 5, 5, 8, 3, 9, 9, 6, 6, 3, 0, 8, 8, 6, 3, 8, 2, 3, 5, 4, 4, 5, 5, 8, 8, 3, 5, 8, 1, 4, 0, 8, 6, 1, 9, 5, 3, 1, 6, 1, 8, 3, 5, 5, 1, 4, 6, 5, 3, 6, 3, 8, 5, 8, 9, 2, 7, 1, 4, 3, 0, 5, 1, 9, 5, 1, 7, 8, 5, 1, 8, 7, 5, 6, 9, 4, 9, 6, 9, 2, 4, 6, 8, 0, 7, 5, 3, 2, 8, 7, 4, 9, 6, 1, 6, 6, 3, 0, 0]\nassert my_solution.separateDigits(**[[126, 935, 96, 537, 394, 634, 270, 72, 688, 158, 930, 534, 746, 520, 649, 318, 632, 592, 732, 670, 291, 151, 128, 841, 680, 158, 631, 196, 707, 439, 534, 666, 22, 626, 299, 121, 346, 11, 426, 827, 459, 748, 551, 561, 110, 192, 103]]) == [1, 2, 6, 9, 3, 5, 9, 6, 5, 3, 7, 3, 9, 4, 6, 3, 4, 2, 7, 0, 7, 2, 6, 8, 8, 1, 5, 8, 9, 3, 0, 5, 3, 4, 7, 4, 6, 5, 2, 0, 6, 4, 9, 3, 1, 8, 6, 3, 2, 5, 9, 2, 7, 3, 2, 6, 7, 0, 2, 9, 1, 1, 5, 1, 1, 2, 8, 8, 4, 1, 6, 8, 0, 1, 5, 8, 6, 3, 1, 1, 9, 6, 7, 0, 7, 4, 3, 9, 5, 3, 4, 6, 6, 6, 2, 2, 6, 2, 6, 2, 9, 9, 1, 2, 1, 3, 4, 6, 1, 1, 4, 2, 6, 8, 2, 7, 4, 5, 9, 7, 4, 8, 5, 5, 1, 5, 6, 1, 1, 1, 0, 1, 9, 2, 1, 0, 3]\nassert my_solution.separateDigits(**[[165, 111, 798, 138, 665, 289, 874, 12, 99, 201, 432, 653, 239, 418, 941, 575, 441, 751, 571, 815, 535, 818, 301, 914, 106, 633, 734, 836, 931, 515]]) == [1, 6, 5, 1, 1, 1, 7, 9, 8, 1, 3, 8, 6, 6, 5, 2, 8, 9, 8, 7, 4, 1, 2, 9, 9, 2, 0, 1, 4, 3, 2, 6, 5, 3, 2, 3, 9, 4, 1, 8, 9, 4, 1, 5, 7, 5, 4, 4, 1, 7, 5, 1, 5, 7, 1, 8, 1, 5, 5, 3, 5, 8, 1, 8, 3, 0, 1, 9, 1, 4, 1, 0, 6, 6, 3, 3, 7, 3, 4, 8, 3, 6, 9, 3, 1, 5, 1, 5]\nassert my_solution.separateDigits(**[[673, 559, 464, 644, 305, 337, 242, 421, 342, 690, 152, 739, 816, 974, 901, 529, 851, 213, 90, 640, 301, 747, 735, 536, 428, 816, 442, 156, 660, 680, 617, 659, 676, 914, 791, 673, 569, 414, 254, 185, 42, 21, 708, 798, 22, 40, 18]]) == [6, 7, 3, 5, 5, 9, 4, 6, 4, 6, 4, 4, 3, 0, 5, 3, 3, 7, 2, 4, 2, 4, 2, 1, 3, 4, 2, 6, 9, 0, 1, 5, 2, 7, 3, 9, 8, 1, 6, 9, 7, 4, 9, 0, 1, 5, 2, 9, 8, 5, 1, 2, 1, 3, 9, 0, 6, 4, 0, 3, 0, 1, 7, 4, 7, 7, 3, 5, 5, 3, 6, 4, 2, 8, 8, 1, 6, 4, 4, 2, 1, 5, 6, 6, 6, 0, 6, 8, 0, 6, 1, 7, 6, 5, 9, 6, 7, 6, 9, 1, 4, 7, 9, 1, 6, 7, 3, 5, 6, 9, 4, 1, 4, 2, 5, 4, 1, 8, 5, 4, 2, 2, 1, 7, 0, 8, 7, 9, 8, 2, 2, 4, 0, 1, 8]\nassert my_solution.separateDigits(**[[433, 975, 743, 6, 103, 697, 372, 824, 382, 365, 500, 725, 441, 839, 22, 439, 320, 738, 769, 290, 243, 247, 821, 812, 293, 461, 324, 73, 923, 974, 909, 585]]) == [4, 3, 3, 9, 7, 5, 7, 4, 3, 6, 1, 0, 3, 6, 9, 7, 3, 7, 2, 8, 2, 4, 3, 8, 2, 3, 6, 5, 5, 0, 0, 7, 2, 5, 4, 4, 1, 8, 3, 9, 2, 2, 4, 3, 9, 3, 2, 0, 7, 3, 8, 7, 6, 9, 2, 9, 0, 2, 4, 3, 2, 4, 7, 8, 2, 1, 8, 1, 2, 2, 9, 3, 4, 6, 1, 3, 2, 4, 7, 3, 9, 2, 3, 9, 7, 4, 9, 0, 9, 5, 8, 5]\n"}, "labels": {"questionId": "2639", "questionFrontendId": "2553", "questionTitle": "Separate the Digits in an Array", "stats": {"totalAccepted": "7.6K", "totalSubmission": "9.6K", "totalAcceptedRaw": 7627, "totalSubmissionRaw": 9605, "acRate": "79.4%"}, "probedCases": [{"inputs": [[13, 25, 83, 77]], "output": [1, 3, 2, 5, 8, 3, 7, 7]}, {"inputs": [[7, 1, 3, 9]], "output": [7, 1, 3, 9]}, {"inputs": [[9, 81, 33, 17, 58, 42, 8, 75]], "output": [9, 8, 1, 3, 3, 1, 7, 5, 8, 4, 2, 8, 7, 5]}, {"inputs": [[28, 35, 21, 13, 21, 72, 35, 52]], "output": [2, 8, 3, 5, 2, 1, 1, 3, 2, 1, 7, 2, 3, 5, 5, 2]}, {"inputs": [[74, 92, 25, 65, 77, 1, 73]], "output": [7, 4, 9, 2, 2, 5, 6, 5, 7, 7, 1, 7, 3]}, {"inputs": [[32, 43, 68, 8, 100, 84, 80, 14, 88, 42, 53, 98, 69, 64, 40, 60, 23, 99]], "output": [3, 2, 4, 3, 6, 8, 8, 1, 0, 0, 8, 4, 8, 0, 1, 4, 8, 8, 4, 2, 5, 3, 9, 8, 6, 9, 6, 4, 4, 0, 6, 0, 2, 3, 9, 9]}, {"inputs": [[83, 5, 21, 76, 34, 99, 63, 23, 70, 18, 64, 12, 21, 21, 78, 36, 58, 88, 58, 99]], "output": [8, 3, 5, 2, 1, 7, 6, 3, 4, 9, 9, 6, 3, 2, 3, 7, 0, 1, 8, 6, 4, 1, 2, 2, 1, 2, 1, 7, 8, 3, 6, 5, 8, 8, 8, 5, 8, 9, 9]}, {"inputs": [[26, 92, 91, 53, 10, 24, 25, 20, 92, 73, 63, 51, 65, 87, 6, 17, 32, 14, 42]], "output": [2, 6, 9, 2, 9, 1, 5, 3, 1, 0, 2, 4, 2, 5, 2, 0, 9, 2, 7, 3, 6, 3, 5, 1, 6, 5, 8, 7, 6, 1, 7, 3, 2, 1, 4, 4, 2]}, {"inputs": [[46, 65, 43, 9, 75, 76, 25, 96, 46, 85, 19, 29, 88, 2, 5, 24, 60]], "output": [4, 6, 6, 5, 4, 3, 9, 7, 5, 7, 6, 2, 5, 9, 6, 4, 6, 8, 5, 1, 9, 2, 9, 8, 8, 2, 5, 2, 4, 6, 0]}, {"inputs": [[26, 76, 24, 96, 82]], "output": [2, 6, 7, 6, 2, 4, 9, 6, 8, 2]}, {"inputs": [[97, 97, 72, 35, 21, 77, 82, 30, 94, 55, 76, 94, 51, 82, 3]], "output": [9, 7, 9, 7, 7, 2, 3, 5, 2, 1, 7, 7, 8, 2, 3, 0, 9, 4, 5, 5, 7, 6, 9, 4, 5, 1, 8, 2, 3]}, {"inputs": [[89, 52, 96, 72, 27, 59, 57]], "output": [8, 9, 5, 2, 9, 6, 7, 2, 2, 7, 5, 9, 5, 7]}, {"inputs": [[30, 130, 14, 754, 41, 494, 548, 76, 825, 899, 499, 188, 982, 8, 890, 563, 438, 363, 32, 482, 623, 864, 161, 962, 678, 414, 659, 612, 332, 164, 580, 14, 633, 842, 969, 792, 777, 705, 436, 750, 501, 395, 342, 838]], "output": [3, 0, 1, 3, 0, 1, 4, 7, 5, 4, 4, 1, 4, 9, 4, 5, 4, 8, 7, 6, 8, 2, 5, 8, 9, 9, 4, 9, 9, 1, 8, 8, 9, 8, 2, 8, 8, 9, 0, 5, 6, 3, 4, 3, 8, 3, 6, 3, 3, 2, 4, 8, 2, 6, 2, 3, 8, 6, 4, 1, 6, 1, 9, 6, 2, 6, 7, 8, 4, 1, 4, 6, 5, 9, 6, 1, 2, 3, 3, 2, 1, 6, 4, 5, 8, 0, 1, 4, 6, 3, 3, 8, 4, 2, 9, 6, 9, 7, 9, 2, 7, 7, 7, 7, 0, 5, 4, 3, 6, 7, 5, 0, 5, 0, 1, 3, 9, 5, 3, 4, 2, 8, 3, 8]}, {"inputs": [[493, 998, 112, 660, 961, 943, 721, 480, 522, 133, 129, 276, 362, 616, 52, 117, 300, 274, 862, 487, 715]], "output": [4, 9, 3, 9, 9, 8, 1, 1, 2, 6, 6, 0, 9, 6, 1, 9, 4, 3, 7, 2, 1, 4, 8, 0, 5, 2, 2, 1, 3, 3, 1, 2, 9, 2, 7, 6, 3, 6, 2, 6, 1, 6, 5, 2, 1, 1, 7, 3, 0, 0, 2, 7, 4, 8, 6, 2, 4, 8, 7, 7, 1, 5]}, {"inputs": [[272, 232, 543, 275, 68, 144, 656, 623, 317, 63, 908, 565, 880, 12, 920, 467, 559, 91, 698, 577, 95, 436, 700, 467, 568, 389, 376, 830, 361, 818, 517]], "output": [2, 7, 2, 2, 3, 2, 5, 4, 3, 2, 7, 5, 6, 8, 1, 4, 4, 6, 5, 6, 6, 2, 3, 3, 1, 7, 6, 3, 9, 0, 8, 5, 6, 5, 8, 8, 0, 1, 2, 9, 2, 0, 4, 6, 7, 5, 5, 9, 9, 1, 6, 9, 8, 5, 7, 7, 9, 5, 4, 3, 6, 7, 0, 0, 4, 6, 7, 5, 6, 8, 3, 8, 9, 3, 7, 6, 8, 3, 0, 3, 6, 1, 8, 1, 8, 5, 1, 7]}, {"inputs": [[290, 191, 596, 644, 425, 308, 825, 555, 583, 996, 630, 886, 382, 354, 455, 883, 581, 408, 619, 531, 618, 355, 14, 653, 638, 589, 271, 430, 519, 517, 851, 875, 69, 496, 924, 680, 753, 287, 496, 166, 300]], "output": [2, 9, 0, 1, 9, 1, 5, 9, 6, 6, 4, 4, 4, 2, 5, 3, 0, 8, 8, 2, 5, 5, 5, 5, 5, 8, 3, 9, 9, 6, 6, 3, 0, 8, 8, 6, 3, 8, 2, 3, 5, 4, 4, 5, 5, 8, 8, 3, 5, 8, 1, 4, 0, 8, 6, 1, 9, 5, 3, 1, 6, 1, 8, 3, 5, 5, 1, 4, 6, 5, 3, 6, 3, 8, 5, 8, 9, 2, 7, 1, 4, 3, 0, 5, 1, 9, 5, 1, 7, 8, 5, 1, 8, 7, 5, 6, 9, 4, 9, 6, 9, 2, 4, 6, 8, 0, 7, 5, 3, 2, 8, 7, 4, 9, 6, 1, 6, 6, 3, 0, 0]}, {"inputs": [[126, 935, 96, 537, 394, 634, 270, 72, 688, 158, 930, 534, 746, 520, 649, 318, 632, 592, 732, 670, 291, 151, 128, 841, 680, 158, 631, 196, 707, 439, 534, 666, 22, 626, 299, 121, 346, 11, 426, 827, 459, 748, 551, 561, 110, 192, 103]], "output": [1, 2, 6, 9, 3, 5, 9, 6, 5, 3, 7, 3, 9, 4, 6, 3, 4, 2, 7, 0, 7, 2, 6, 8, 8, 1, 5, 8, 9, 3, 0, 5, 3, 4, 7, 4, 6, 5, 2, 0, 6, 4, 9, 3, 1, 8, 6, 3, 2, 5, 9, 2, 7, 3, 2, 6, 7, 0, 2, 9, 1, 1, 5, 1, 1, 2, 8, 8, 4, 1, 6, 8, 0, 1, 5, 8, 6, 3, 1, 1, 9, 6, 7, 0, 7, 4, 3, 9, 5, 3, 4, 6, 6, 6, 2, 2, 6, 2, 6, 2, 9, 9, 1, 2, 1, 3, 4, 6, 1, 1, 4, 2, 6, 8, 2, 7, 4, 5, 9, 7, 4, 8, 5, 5, 1, 5, 6, 1, 1, 1, 0, 1, 9, 2, 1, 0, 3]}, {"inputs": [[165, 111, 798, 138, 665, 289, 874, 12, 99, 201, 432, 653, 239, 418, 941, 575, 441, 751, 571, 815, 535, 818, 301, 914, 106, 633, 734, 836, 931, 515]], "output": [1, 6, 5, 1, 1, 1, 7, 9, 8, 1, 3, 8, 6, 6, 5, 2, 8, 9, 8, 7, 4, 1, 2, 9, 9, 2, 0, 1, 4, 3, 2, 6, 5, 3, 2, 3, 9, 4, 1, 8, 9, 4, 1, 5, 7, 5, 4, 4, 1, 7, 5, 1, 5, 7, 1, 8, 1, 5, 5, 3, 5, 8, 1, 8, 3, 0, 1, 9, 1, 4, 1, 0, 6, 6, 3, 3, 7, 3, 4, 8, 3, 6, 9, 3, 1, 5, 1, 5]}, {"inputs": [[673, 559, 464, 644, 305, 337, 242, 421, 342, 690, 152, 739, 816, 974, 901, 529, 851, 213, 90, 640, 301, 747, 735, 536, 428, 816, 442, 156, 660, 680, 617, 659, 676, 914, 791, 673, 569, 414, 254, 185, 42, 21, 708, 798, 22, 40, 18]], "output": [6, 7, 3, 5, 5, 9, 4, 6, 4, 6, 4, 4, 3, 0, 5, 3, 3, 7, 2, 4, 2, 4, 2, 1, 3, 4, 2, 6, 9, 0, 1, 5, 2, 7, 3, 9, 8, 1, 6, 9, 7, 4, 9, 0, 1, 5, 2, 9, 8, 5, 1, 2, 1, 3, 9, 0, 6, 4, 0, 3, 0, 1, 7, 4, 7, 7, 3, 5, 5, 3, 6, 4, 2, 8, 8, 1, 6, 4, 4, 2, 1, 5, 6, 6, 6, 0, 6, 8, 0, 6, 1, 7, 6, 5, 9, 6, 7, 6, 9, 1, 4, 7, 9, 1, 6, 7, 3, 5, 6, 9, 4, 1, 4, 2, 5, 4, 1, 8, 5, 4, 2, 2, 1, 7, 0, 8, 7, 9, 8, 2, 2, 4, 0, 1, 8]}, {"inputs": [[433, 975, 743, 6, 103, 697, 372, 824, 382, 365, 500, 725, 441, 839, 22, 439, 320, 738, 769, 290, 243, 247, 821, 812, 293, 461, 324, 73, 923, 974, 909, 585]], "output": [4, 3, 3, 9, 7, 5, 7, 4, 3, 6, 1, 0, 3, 6, 9, 7, 3, 7, 2, 8, 2, 4, 3, 8, 2, 3, 6, 5, 5, 0, 0, 7, 2, 5, 4, 4, 1, 8, 3, 9, 2, 2, 4, 3, 9, 3, 2, 0, 7, 3, 8, 7, 6, 9, 2, 9, 0, 2, 4, 3, 2, 4, 7, 8, 2, 1, 8, 1, 2, 2, 9, 3, 4, 6, 1, 3, 2, 4, 7, 3, 9, 2, 3, 9, 7, 4, 9, 0, 9, 5, 8, 5]}]}} +{"id": "LeetCode/2640", "content": "# Maximum Number of Integers to Choose From a Range I\n\nYou are given an integer array `banned` and two integers `n` and `maxSum`. You are choosing some number of integers following the below rules:\n\n\n* The chosen integers have to be in the range `[1, n]`.\n* Each integer can be chosen **at most once**.\n* The chosen integers should not be in the array `banned`.\n* The sum of the chosen integers should not exceed `maxSum`.\n\n\nReturn *the **maximum** number of integers you can choose following the mentioned rules*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** banned = [1,6,5], n = 5, maxSum = 6\n**Output:** 2\n**Explanation:** You can choose the integers 2 and 4.\n2 and 4 are from the range [1, 5], both did not appear in banned, and their sum is 6, which did not exceed maxSum.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** banned = [1,2,3,4,5,6,7], n = 8, maxSum = 1\n**Output:** 0\n**Explanation:** You cannot choose any integer while following the mentioned conditions.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** banned = [11], n = 7, maxSum = 50\n**Output:** 7\n**Explanation:** You can choose the integers 1, 2, 3, 4, 5, 6, and 7.\nThey are from the range [1, 7], all did not appear in banned, and their sum is 28, which did not exceed maxSum.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= banned.length <= 104`\n* `1 <= banned[i], n <= 104`\n* `1 <= maxSum <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maxCount(self, banned: List[int], n: int, maxSum: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maxCount(**[[1, 6, 5], 5, 6]) == 2\nassert my_solution.maxCount(**[[1, 2, 3, 4, 5, 6, 7], 8, 1]) == 0\nassert my_solution.maxCount(**[[11], 7, 50]) == 7\nassert my_solution.maxCount(**[[176, 36, 104, 125, 188, 152, 101, 47, 51, 65, 39, 174, 29, 55, 13, 138, 79, 81, 175, 178, 42, 108, 24, 80, 183, 190, 123, 20, 139, 22, 140, 62, 58, 137, 68, 148, 172, 76, 173, 189, 151, 186, 153, 57, 142, 105, 133, 114, 165, 118, 56, 59, 124, 82, 49, 94, 8, 146, 109, 14, 85, 44, 60, 181, 95, 23, 150, 97, 28, 182, 157, 46, 160, 155, 12, 67, 135, 117, 2, 25, 74, 91, 71, 98, 127, 120, 130, 107, 168, 18, 69, 110, 61, 147, 145, 38], 3016, 240]) == 17\nassert my_solution.maxCount(**[[87, 193, 85, 55, 14, 69, 26, 133, 171, 180, 4, 8, 29, 121, 182, 78, 157, 53, 26, 7, 117, 138, 57, 167, 8, 103, 32, 110, 15, 190, 139, 16, 49, 138, 68, 69, 92, 89, 140, 149, 107, 104, 2, 135, 193, 87, 21, 194, 192, 9, 161, 188, 73, 84, 83, 31, 86, 33, 138, 63, 127, 73, 114, 32, 66, 64, 19, 175, 108, 80, 176, 52, 124, 94, 33, 55, 130, 147, 39, 76, 22, 112, 113, 136, 100, 134, 155, 40, 170, 144, 37, 43, 151, 137, 82, 127, 73], 1079, 87]) == 9\nassert my_solution.maxCount(**[[78, 121, 219, 281, 165, 277, 227, 257, 66, 148, 125, 254, 129, 258, 98, 191, 4, 63, 172, 253, 40, 221, 45, 264, 194, 332, 88, 37, 152, 38, 333, 174, 237, 338, 77, 308, 137, 158, 197, 167, 295, 319, 74, 224, 54, 132, 122, 111, 110, 279, 190, 299, 193, 139, 41, 305, 208, 105, 162, 7, 19, 31, 181, 252, 207, 217, 133, 155, 231, 84, 213, 294, 97, 107, 186, 101, 118, 195, 315, 234, 102, 182, 335, 65, 248, 336, 320, 34, 61, 225, 112, 304, 267, 59, 176, 103, 270, 317, 86, 340, 291, 178, 204, 62, 273, 99, 55, 220, 256, 127, 3, 296, 26, 285, 242, 303, 124, 230, 48, 128, 8, 68, 341, 255, 51, 288, 334, 313, 10, 32, 75, 113, 14, 23, 76, 157, 166, 67, 306, 80, 206, 246, 276, 321, 145, 9, 202, 222, 261, 138, 73, 240, 278, 282, 280, 15, 71, 286, 287, 90, 226, 236, 330, 28, 12, 96, 177, 123, 115, 85, 233], 3600, 117]) == 10\nassert my_solution.maxCount(**[[179, 266, 77, 196, 59, 313, 286, 41, 21, 201, 57, 237, 74, 333, 101, 281, 227, 25, 138, 10, 304, 55, 50, 72, 244, 113, 159, 330, 154, 156, 311, 170, 283, 9, 224, 46, 197, 2, 325, 237, 54, 168, 275, 166, 236, 30, 250, 48, 274, 331, 240, 153, 312, 63, 303, 342, 79, 37, 165, 20, 79, 293, 103, 152, 215, 44, 56, 196, 29, 251, 264, 210, 212, 135, 296, 123, 289, 257, 208, 309, 67, 114, 170, 119, 337, 163, 242, 162, 109, 318, 51, 105, 272, 240, 107, 226, 224, 188, 224, 317, 27, 102, 63, 128, 3, 133, 27, 134, 186, 220, 198, 24, 274, 287, 267, 8, 13, 322, 278, 166, 304, 165, 342, 89, 184, 300, 312, 339, 163, 307, 123, 137, 293, 227, 229, 57, 66, 13, 71, 233, 260, 79, 228, 301, 4, 4, 89, 196, 193, 337, 205, 51, 144, 99, 104, 73, 10, 311, 240, 168, 77, 244, 114, 217, 186, 134, 229, 241, 46, 89, 54, 127], 4085, 109718563]) == 3953\nassert my_solution.maxCount(**[[266, 530, 595, 264, 331, 462, 268, 521, 401, 9, 464, 275, 166, 527, 218, 219, 107, 34, 367, 117, 42, 193, 363, 335, 233, 215, 519, 180, 167, 10, 501, 591, 471, 421, 425, 344, 533, 555, 477, 59, 28, 92, 66, 172, 291, 392, 35, 160, 294, 192, 342, 168, 349, 328, 578, 240, 470, 301, 574, 222, 173, 438, 318, 476, 546, 64, 542, 339, 137, 585, 39, 5, 312, 103, 87, 372, 589, 513, 217, 90, 379, 161, 506, 487, 326, 139, 452, 525, 223, 232, 429, 31, 245, 198, 76, 423, 255, 243, 141, 303, 150, 273, 529, 176, 231, 73, 337, 165, 494, 400, 136, 142, 33, 495, 369, 430, 511, 498, 465, 582, 199, 409, 347, 537, 602, 395, 83, 209, 346, 548, 485, 109, 333, 382, 30, 248, 146, 63, 315, 415, 325, 327, 186, 490, 133, 262, 187, 360, 155, 356, 532, 17, 127, 13, 512, 37, 386, 220, 422, 457, 202, 545, 373, 178, 442, 428, 552, 417, 113, 522, 310, 330, 491, 140, 260, 147, 292, 507, 441, 517, 3, 132, 324, 469, 188, 7, 461, 299, 376, 115, 284, 68, 480, 229, 19, 162, 46, 444, 394, 305, 189, 18, 535, 154, 263, 427, 288, 420, 570, 404, 478, 190, 607, 49, 135, 381, 343, 371, 560, 144, 524, 283, 259, 431, 196, 278, 298, 112, 316, 80, 405, 29, 432, 354, 86, 234, 411, 447, 157, 58, 85, 48, 27, 104, 365, 120, 397, 267, 433, 253, 1, 562, 221, 276, 489, 575, 350, 368, 52, 391, 170, 252, 448, 272, 443, 608, 210, 446, 101, 314, 16, 60, 455, 138, 580, 541, 99, 93, 295, 601, 102, 515, 62, 539, 111, 364, 598, 70, 466, 274, 75, 399, 370, 44, 45, 473, 378, 282, 481, 216, 171, 551, 323, 317], 124, 292541445]) == 63\nassert my_solution.maxCount(**[[397, 305, 171, 199, 412, 556, 348, 229, 274, 18, 200, 350, 541, 367, 302, 477, 381, 410, 541, 415, 281, 166, 224, 40, 272, 585, 583, 417, 353, 243, 167, 335, 565, 494, 52, 253, 178, 198, 221, 99, 126, 529, 433, 322, 63, 252, 131, 524, 148, 355, 257, 23, 224, 353, 426, 593, 95, 262, 332, 81, 431, 359, 381, 245, 219, 330, 150, 488, 442, 36, 57, 173, 432, 55, 61, 589, 68, 350, 540, 424, 174, 593, 378, 364, 286, 35, 27, 446, 504, 523, 179, 25, 333, 231, 137, 81, 176, 516, 64, 440, 484, 254, 54, 337, 76, 233, 26, 23, 8, 601, 147, 591, 93, 352, 211, 336, 553, 32, 61, 492, 132, 179, 148, 434, 69, 526, 57, 345, 234, 334, 205, 286, 586, 501, 574, 196, 563, 218, 253, 462, 139, 138, 436, 468, 508, 416, 103, 103, 408, 176, 278, 299, 124, 60, 204, 162, 529, 19, 420, 163, 188, 142, 163, 382, 361, 58, 315, 397, 268, 33, 268, 589, 505, 309, 559, 186, 534, 253, 521, 82, 38, 595, 592, 533, 288, 368, 510, 433, 424, 185, 60, 251, 509, 45, 491, 271, 54, 85, 295, 569, 559, 385, 182, 314, 62, 116, 547, 472, 214, 95, 538, 538, 447, 266, 323, 16, 372, 361, 503, 556, 3, 316, 439, 394, 306, 128, 163, 258, 519, 228, 233, 389, 518, 326, 130, 152, 326, 86, 87, 347, 170, 155, 349, 537, 300, 433, 206, 214, 392, 101, 401, 1, 504, 473, 567, 283, 412, 509, 150, 388, 306, 488, 327, 54, 309, 255, 218, 550, 584, 55, 91, 430, 446, 417, 279, 546, 203, 281, 407, 237, 443, 211, 553, 225, 525, 591, 431, 156, 335, 203, 166, 471, 208, 60, 487, 358, 178, 314, 290, 581, 337, 224, 471, 38, 176], 7362, 911846577]) == 7121\nassert my_solution.maxCount(**[[152, 227, 518, 324, 508, 446, 203, 16, 278, 385, 312, 22, 425, 130, 293, 233, 365, 199, 87, 613, 280, 589, 479, 297, 207, 523, 428, 448, 25, 298, 103, 649, 104, 17, 608, 139, 474, 77, 254, 464, 376, 629, 602, 487, 512, 496, 119, 70, 165, 52, 82, 94, 378, 422, 476, 93, 596, 406, 272, 630, 309, 565, 285, 266, 495, 101, 361, 314, 442, 432, 594, 621, 106, 37, 294, 536, 517, 11, 140, 478, 457, 550, 645, 423, 451, 8, 163, 531, 230, 235, 341, 267, 362, 527, 234, 609, 444, 323, 336, 411, 169, 292, 19, 50, 569, 501, 632, 279, 459, 225, 595, 261, 325, 71, 436, 84, 216, 342, 241, 206, 269, 556, 315, 99, 543, 405, 56, 503, 20, 123, 410, 4, 379, 452, 164, 27, 528, 310, 524, 640, 525, 218, 299, 370, 322, 514, 244, 289, 219, 350, 245, 372, 409, 33, 153, 126, 340, 122, 2, 223, 72, 347, 424, 270, 186, 188, 367, 577, 461, 626, 623, 317, 386, 213, 149, 29, 477, 345, 319, 229, 9, 147, 606, 113, 58, 39, 120, 548, 15, 526, 32, 288, 502, 209, 567, 416, 443, 198, 412, 639, 511, 408, 537, 148, 150, 374, 21, 45, 546, 296, 580, 417, 36, 55, 86, 42, 538, 473, 90, 529, 211, 196, 193, 175, 391, 472, 619, 490, 23, 593, 313, 352, 562, 585, 554, 445, 283, 301, 190, 403, 530, 157, 469, 540, 83, 111, 364, 506, 208, 48, 250, 371, 489, 363, 275, 381, 108, 204, 41, 246, 605, 492, 185, 114, 603, 329, 320, 136, 573, 338, 276, 18, 344, 507, 256, 271, 485, 467, 81, 652, 162, 351, 239, 404, 89, 57, 505, 458, 366, 328, 238, 125, 295, 463, 610, 615, 237, 586, 141, 308, 460, 648, 80, 318, 437, 429, 497, 560, 121, 160, 311, 273, 158, 534, 583, 221, 545, 98, 286, 105, 182, 291, 633, 588, 635, 255], 312, 608]) == 23\nassert my_solution.maxCount(**[[541, 194, 109, 373, 569, 564, 523, 475, 598, 386, 202, 250, 173, 476, 350, 443, 389, 192, 448, 353, 320, 20, 531, 408, 79, 598, 175, 262, 363, 540, 256, 562, 143, 506, 277, 431, 316, 214, 388, 30, 518, 158, 152, 448, 188, 133, 636, 139, 518, 63, 502, 19, 362, 383, 311, 428, 313, 528, 609, 407, 182, 646, 588, 157, 11, 289, 466, 178, 498, 426, 363, 389, 85, 47, 145, 601, 120, 278, 544, 653, 92, 189, 452, 515, 93, 398, 380, 532, 178, 368, 472, 304, 63, 369, 270, 80, 373, 46, 134, 380, 507, 364, 224, 221, 180, 328, 4, 162, 330, 197, 241, 527, 359, 68, 349, 224, 644, 532, 369, 37, 373, 225, 636, 335, 508, 390, 634, 357, 531, 307, 504, 253, 109, 628, 6, 255, 420, 274, 112, 79, 343, 587, 99, 147, 445, 210, 284, 58, 546, 218, 355, 274, 23, 286, 160, 151, 9, 324, 251, 243, 500, 525, 28, 1, 619, 354, 480, 557, 429, 405, 23, 71, 563, 297, 234, 202, 616, 597, 620, 78, 467, 485, 197, 625, 38, 108, 552, 15, 111, 319, 444, 260, 497, 622, 530, 435, 154, 362, 77, 554, 639, 83, 565, 525, 406, 504, 202, 567, 16, 189, 497, 95, 348, 367, 641, 438, 609, 12, 250, 577, 540, 71, 592, 176, 257, 42, 181, 85, 645, 649, 86, 168, 457, 600, 118, 131, 463, 642, 233, 294, 597, 646, 98, 374, 361, 292, 411, 502, 131, 540, 474, 15, 307, 58, 481, 213, 47, 87, 440, 394, 437, 204, 548, 286, 42, 579, 445, 602, 168, 116, 575, 245, 165, 445, 156, 168, 398, 224, 86, 643, 430, 214, 440, 13, 480, 560, 306, 131, 17, 629, 269, 463, 590, 163, 2, 130, 127, 560, 46, 243, 32, 253, 637, 247, 66, 46, 50, 323, 56, 131, 127, 25, 371, 251, 225, 470, 131, 176, 200, 551, 497, 583, 33, 300, 236, 176, 478], 7913, 317]) == 16\nassert my_solution.maxCount(**[[512, 233, 22, 699, 458, 74, 482, 16, 455, 560, 389, 301, 4, 291, 145, 501, 333, 660, 538, 444, 496, 602, 509, 591, 124, 659, 336, 120, 475, 445, 36, 416, 192, 67, 341, 44, 399, 154, 630, 628, 140, 51, 626, 549, 187, 361, 388, 694, 421, 554, 411, 600, 105, 526, 102, 182, 479, 49, 125, 682, 258, 403, 417, 93, 309, 183, 32, 412, 170, 261, 159, 546, 569, 460, 661, 438, 179, 668, 338, 645, 566, 202, 35, 222, 275, 487, 313, 352, 163, 56, 252, 282, 259, 225, 109, 223, 690, 292, 502, 375, 299, 95, 316, 335, 307, 398, 293, 238, 190, 208, 382, 85, 436, 290, 21, 273, 675, 181, 138, 337, 63, 688, 485, 45, 563, 117, 197, 101, 99, 29, 8, 624, 242, 461, 524, 177, 46, 667, 494, 255, 243, 358, 405, 576, 98, 114, 593, 60, 315, 483, 543, 195, 664, 196, 47, 191, 545, 251, 26, 390, 507, 324, 695, 62, 303, 583, 466, 540, 52, 91, 369, 394, 305, 59, 622, 579, 110, 294, 635, 226, 146, 380, 123, 42, 269, 227, 86, 55, 158, 119, 489, 448, 199, 548, 520, 634, 20, 651, 378, 534, 328, 557, 700, 544, 592, 329, 564, 447, 141, 433, 497, 107, 677, 153, 621, 623, 642, 116, 96, 679, 221, 401, 6, 266, 267, 137, 268, 532, 601, 274, 72, 609, 250, 156, 257, 180, 353, 304, 212, 311, 671, 53, 652, 37, 94, 547, 348, 696, 325, 332, 373, 611, 678, 139, 142, 559, 449, 342, 504, 476, 536, 355, 278, 302, 528, 103, 3, 539, 201, 435, 219, 368, 427, 240, 452, 641, 350, 347, 615, 408, 648, 393, 13, 446, 568, 326, 80, 97, 283, 5, 24, 414, 473, 666, 171, 597, 54, 672, 616, 367, 83, 204, 456, 104, 537, 402, 314, 12, 147, 58, 468, 595, 206, 429, 577, 43, 638, 558, 284, 649, 587, 573, 131, 620, 30, 28, 450, 306, 572, 387, 371, 541, 143, 627, 586, 256, 135, 617, 319, 321, 614, 308, 334, 230, 518, 470, 64, 339, 270, 157], 8045, 300738886]) == 7695\nassert my_solution.maxCount(**[[104, 351, 540, 301, 565, 429, 569, 598, 475, 337, 383, 496, 524, 324, 689, 167, 528, 383, 209, 166, 498, 699, 345, 102, 410, 160, 149, 587, 315, 268, 208, 427, 364, 4, 553, 663, 453, 8, 358, 194, 415, 653, 274, 249, 552, 34, 193, 58, 178, 295, 621, 90, 249, 593, 624, 76, 373, 568, 657, 600, 452, 607, 97, 310, 442, 430, 257, 607, 690, 371, 205, 160, 39, 350, 406, 375, 172, 482, 578, 195, 256, 376, 637, 661, 510, 544, 253, 487, 603, 308, 138, 224, 446, 273, 277, 488, 431, 553, 481, 535, 272, 697, 228, 605, 123, 607, 559, 554, 450, 104, 22, 285, 580, 328, 646, 128, 658, 167, 695, 174, 273, 551, 173, 700, 116, 600, 85, 24, 568, 219, 279, 55, 572, 528, 655, 347, 519, 606, 453, 380, 435, 688, 74, 663, 553, 371, 293, 326, 395, 696, 32, 321, 422, 496, 392, 114, 555, 310, 669, 222, 211, 457, 364, 298, 550, 324, 269, 649, 287, 425, 578, 82, 276, 594, 601, 535, 336, 292, 596, 698, 517, 589, 202, 85, 41, 222, 333, 463, 686, 555, 40, 398, 637, 232, 121, 325, 67, 680, 528, 199, 186, 116, 78, 354, 672, 88, 340, 218, 198, 44, 193, 156, 508, 402, 123, 419, 140, 630, 104, 231, 279, 336, 107, 111, 8, 88, 508, 230, 650, 701, 680, 386, 528, 550, 657, 499, 16, 360, 519, 596, 206, 650, 36, 536, 383, 344, 194, 313, 579, 359, 467, 194, 151, 615, 593, 362, 105, 152, 691, 248, 621, 297, 278, 333, 411, 4, 491, 144, 552, 610, 428, 226, 230, 243, 263, 416, 345, 322, 160, 120, 40, 13, 95, 12, 444, 671, 270, 27, 612, 450, 47, 1, 92, 437, 255, 87, 425, 504, 594, 579, 344, 452, 479, 328, 468, 574, 682, 351, 256, 70, 47, 542, 69, 423, 177, 28, 625, 515, 660, 377, 387, 53, 486, 476, 92, 302, 654, 420, 257, 495, 162, 539, 512, 421, 296, 284, 664, 253, 376, 596, 139, 557, 518, 460, 310, 27, 637, 375, 435, 438, 483], 77, 512050749]) == 51\nassert my_solution.maxCount(**[[812, 748, 455, 510, 326, 370, 409, 703, 401, 296, 166, 686, 73, 532, 475, 165, 589, 110, 414, 162, 425, 277, 778, 842, 528, 216, 838, 38, 444, 697, 49, 172, 637, 744, 784, 480, 218, 342, 514, 493, 385, 549, 394, 288, 499, 285, 245, 369, 48, 826, 583, 609, 7, 898, 66, 390, 81, 114, 226, 723, 837, 416, 177, 80, 352, 708, 814, 711, 448, 434, 761, 782, 470, 365, 681, 264, 615, 541, 438, 521, 456, 458, 695, 608, 330, 238, 866, 642, 353, 557, 108, 125, 806, 215, 727, 757, 313, 11, 482, 887, 798, 90, 432, 529, 849, 303, 175, 37, 556, 196, 466, 23, 811, 700, 813, 758, 1, 411, 696, 717, 16, 747, 452, 450, 77, 674, 547, 95, 539, 121, 658, 173, 746, 702, 612, 606, 854, 348, 661, 531, 698, 567, 368, 124, 687, 13, 354, 39, 624, 704, 882, 722, 199, 513, 640, 607, 194, 291, 821, 764, 341, 185, 233, 740, 195, 684, 244, 875, 631, 357, 792, 633, 231, 823, 664, 749, 610, 388, 904, 133, 469, 107, 873, 588, 707, 332, 25, 691, 871, 305, 33, 52, 570, 148, 656, 573, 815, 347, 685, 793, 62, 51, 693, 361, 188, 336, 40, 122, 406, 240, 404, 726, 542, 350, 266, 339, 525, 801, 471, 257, 349, 645, 213, 620, 618, 140, 263, 771, 442, 836, 246, 130, 862, 267, 132, 109, 592, 191, 159, 492, 560, 300, 262, 209, 169, 417, 189, 334, 270, 276, 451, 554, 886, 562, 509, 79, 310, 709, 859, 461, 36, 672, 268, 712, 905, 102, 78, 204, 496, 791, 104, 657, 682, 337, 611, 808, 293, 4, 530, 164, 797, 534, 533, 317, 464, 511, 380, 22, 116, 254, 830, 768, 765, 364, 259, 183, 568, 234, 228, 193, 396, 894, 180, 273, 2, 5, 88, 308, 430, 360, 271, 841, 229, 580, 561, 431, 663, 729, 870, 688, 713, 161, 74, 225, 142, 572, 860, 643, 803, 280, 619, 594, 399, 86, 787, 34, 785, 477, 374, 20, 487, 181, 627, 512, 780, 731, 445, 897, 834, 314, 418, 76, 616, 70, 12, 340, 151, 331, 412, 176, 96, 585, 617, 65, 322, 805, 804, 468, 454, 802, 868, 230, 767, 855, 888, 501, 555, 255, 31, 224, 667, 58, 29, 311, 197, 602, 408, 221, 595, 719, 774, 675, 641, 460, 644, 153, 752, 179, 865, 467, 318, 488, 375, 111, 219, 328, 575, 772, 45, 710, 621, 120, 538, 678, 422, 333, 536, 47, 287, 154, 320, 835, 41, 590, 32, 395, 650, 828, 443, 93, 692, 433, 203, 558, 879, 202, 630, 441, 628, 734, 825, 220, 182, 574, 437, 569, 850, 158, 474, 278, 893, 524, 295], 1029, 1253]) == 34\nassert my_solution.maxCount(**[[43, 272, 161, 404, 343, 614, 250, 739, 57, 800, 302, 869, 831, 827, 202, 746, 626, 673, 259, 827, 600, 532, 768, 266, 409, 67, 473, 845, 874, 854, 803, 571, 546, 421, 681, 623, 107, 561, 536, 318, 602, 839, 693, 633, 13, 632, 295, 564, 670, 804, 813, 681, 734, 663, 18, 739, 3, 230, 723, 772, 97, 424, 592, 634, 778, 175, 586, 247, 309, 274, 889, 615, 301, 717, 681, 624, 382, 611, 384, 611, 162, 324, 726, 779, 369, 142, 712, 128, 117, 867, 144, 498, 408, 634, 196, 452, 559, 137, 565, 295, 804, 6, 72, 81, 466, 834, 476, 4, 219, 718, 175, 351, 640, 32, 759, 656, 600, 92, 639, 644, 737, 482, 568, 710, 371, 614, 807, 201, 634, 544, 205, 399, 661, 664, 58, 419, 489, 106, 163, 297, 701, 784, 598, 902, 628, 702, 871, 462, 686, 620, 47, 404, 58, 684, 436, 907, 651, 240, 803, 371, 766, 175, 374, 813, 684, 634, 514, 244, 458, 385, 556, 857, 296, 486, 233, 127, 3, 301, 52, 379, 318, 246, 876, 244, 876, 354, 55, 444, 453, 380, 608, 488, 297, 614, 815, 291, 25, 299, 168, 630, 157, 600, 183, 578, 97, 92, 126, 203, 387, 575, 271, 731, 489, 734, 312, 281, 171, 776, 838, 523, 23, 865, 174, 226, 192, 557, 94, 869, 611, 798, 207, 836, 134, 103, 829, 207, 615, 601, 845, 398, 41, 533, 296, 333, 473, 95, 609, 591, 876, 685, 7, 387, 878, 117, 374, 304, 15, 359, 184, 60, 476, 186, 567, 843, 109, 282, 885, 235, 3, 837, 141, 319, 395, 89, 162, 830, 894, 738, 99, 1, 376, 836, 716, 454, 873, 699, 430, 575, 77, 79, 338, 540, 723, 89, 861, 13, 519, 574, 315, 720, 430, 831, 527, 816, 181, 716, 224, 115, 48, 505, 157, 831, 604, 553, 641, 252, 251, 32, 258, 553, 693, 620, 58, 767, 207, 339, 600, 813, 713, 124, 530, 825, 631, 481, 590, 88, 779, 311, 501, 734, 106, 893, 495, 875, 763, 742, 828, 709, 365, 454, 613, 332, 515, 889, 132, 625, 811, 172, 366, 842, 599, 114, 375, 725, 750, 526, 610, 462, 161, 535, 25, 819, 673, 692, 403, 389, 334, 823, 454, 65, 40, 91, 433, 763, 401, 82, 878, 98, 271, 697, 339, 186, 371, 644, 604, 581, 619, 31, 575, 127, 492, 590, 46, 807, 856, 155, 779, 288, 797, 829, 120, 298, 722, 454, 550, 222, 249, 156, 18, 370, 782, 644, 715, 211, 761, 430, 151, 567, 565, 228, 753, 422, 142, 613, 469, 280, 303, 54, 661, 480, 568, 589, 299, 558, 444, 892, 861, 251, 259, 383, 735, 895, 357, 781], 2794, 891214307]) == 2443\nassert my_solution.maxCount(**[[1474, 239, 389, 366, 989, 1289, 1583, 1421, 687, 158, 932, 367, 4, 498, 926, 504, 274, 438, 1411, 870, 879, 544, 656, 850, 955, 230, 353, 1657, 1598, 1182, 684, 1459, 1195, 285, 483, 1091, 1654, 924, 429, 1669, 1492, 930, 1418, 1565, 1429, 263, 1451, 726, 969, 944, 361, 883, 354, 90, 538, 1264, 1060, 1197, 589, 1269, 976, 1651, 812, 562, 321, 1170, 569, 77, 1498, 1019, 1171, 229, 1278, 733, 416, 287, 686, 823, 1514, 66, 1035, 941, 182, 72, 540, 34, 1178, 566, 1095, 826, 207, 1022, 133, 626, 1107, 55, 198, 695, 1537, 1131, 911, 1025, 1196, 964, 1164, 334, 306, 1323, 1570, 1244, 789, 1275, 738, 214, 1329, 1040, 61, 1632, 456, 171, 1428, 1199, 307, 1191, 1457, 979, 746, 1559, 953, 327, 442, 335, 413, 1063, 910, 1074, 1294, 800, 199, 100, 1016, 1440, 339, 233, 501, 784, 387, 1322, 947, 876, 332, 467, 1296, 218, 375, 1397, 405, 720, 673, 1213, 1341, 86, 1475, 928, 854, 283, 881, 844, 903, 1085, 815, 706, 853, 1031, 873, 165, 1058, 1018, 245, 169, 919, 545, 68, 935, 867, 409, 669, 104, 803, 1566, 314, 1515, 205, 443, 134, 957, 1655, 1641, 1441, 1377, 744, 277, 588, 19, 412, 1314, 662, 1417, 1614, 1477, 216, 1579, 958, 1030, 965, 308, 770, 1206, 1455, 1473, 9, 1163, 582, 1042, 301, 449, 1036, 788, 627, 729, 1099, 916, 85, 918, 468, 635, 1255, 847, 1208, 1460, 246, 1276, 1300, 1159, 621, 888, 115, 1249, 914, 1502, 871, 139, 1354, 1005, 69, 486, 1154, 475, 1521, 782, 1260, 356, 1100, 1078, 176, 658, 1553, 1072, 848, 360, 683, 1437, 164, 260, 811, 765, 95, 647, 1588, 209, 570, 672, 1326, 345, 869, 664, 1263, 725, 1070, 1369, 1117, 1517, 455, 715, 457, 272, 1424, 226, 605, 559, 805, 1083, 1034, 730, 896, 1549, 1649, 264, 615, 1463, 648, 1628, 1087, 974, 649, 962, 160, 406, 1303, 836, 995, 1210, 1050, 1419, 1415, 1204, 1350, 1624, 548, 162, 364, 749, 1591, 934, 739, 1073, 1121, 289, 1646, 822, 244, 337, 148, 1599, 973, 494, 1311, 152, 596, 142, 188, 440, 1507, 269, 806, 1597, 1265, 875, 988, 140, 882, 292, 1242, 1293, 15, 892, 874, 1538, 795, 1088, 488, 960, 1548, 1399, 1601, 830, 1190, 755, 1223, 1186, 105, 689, 446, 1576, 708, 1364, 1033, 753, 97, 818, 347, 82, 404, 313, 453, 1408, 563, 190, 304, 1262, 943, 1123, 518, 1004, 234, 505, 516, 963, 1094, 1533, 638, 791, 998, 1067, 611, 1240, 71, 1333, 210, 1557, 997, 439, 533, 863, 1506, 773, 116, 62, 1481, 478, 655, 1608, 485, 295, 1315, 838, 203, 925, 106, 670, 992, 659, 1633, 379, 125, 1219, 1286, 1287, 580, 1647, 644, 1021, 1349, 1003, 967, 395, 479, 297, 680, 1272, 1258, 1068, 942, 1642, 1024, 267, 1443, 909, 328, 1409, 543, 690, 1542, 837, 1643, 178, 1051, 1396, 1580, 1125, 1002, 1187, 801, 1089, 752, 174, 1177, 143, 1513, 278, 1023, 275, 392, 1351, 121, 900, 933, 1518, 1610, 187, 1052, 1143, 89, 1217, 206, 427, 369, 981, 217, 766, 424, 451, 528, 243, 1348, 1613, 1464, 1007, 1545, 678, 76, 541, 471, 1148, 902, 1243, 460, 1525, 1000, 425, 208, 1279, 29, 628, 1500, 1032, 435, 1162, 530, 1015, 1009, 1198, 1461, 391, 1423, 1527, 1550, 1180, 865, 1184, 717, 820, 64, 1406, 372, 341, 1319, 575, 940, 102, 537, 781, 286, 156, 574, 294, 107, 1225, 637, 567, 52, 780, 804, 952, 1640, 634, 1547, 532, 231, 1469, 1246, 1118, 1098, 448, 653, 889, 1603, 351, 757, 718, 642, 65, 1491, 96, 1064, 1487, 1558, 529, 1653, 1482, 324, 929, 606, 242, 573, 101, 112, 1066, 625, 1555, 1427, 948, 774, 1490, 1609, 1422, 810, 291, 693, 1627, 472, 1358, 400, 1345, 1173, 316, 1535, 474, 1038, 1606, 737, 785, 745, 1511, 1065, 1433, 722, 872, 1232, 459, 1167, 1147, 1560, 325, 702, 1384, 748, 1523, 895, 1110, 1371, 236, 1363, 1194, 698, 1, 768, 1472, 1619, 1526, 685, 868, 1478, 1626, 60, 110, 716, 1268, 390, 1372, 1238, 1413, 549, 584, 1142, 179, 1248, 1214, 476, 1256, 1008, 1168, 359, 330, 694, 931, 618, 1193, 122, 817, 30, 1667, 591, 1288, 1343, 147, 1192, 502, 241, 1664, 660, 450, 1600, 821, 572, 1308, 630, 303, 1467, 252, 1621, 14, 949, 1120, 1516, 1339, 991, 1228, 1386, 88, 1672, 576, 223, 721, 368, 1298, 999, 489, 1090, 535, 211, 80, 1102, 447, 846, 839, 346, 904, 511, 1084, 1586, 124, 917, 1582, 491, 1468, 786, 1592, 342, 39, 1230, 279, 28, 1446, 743, 767, 1101, 114, 302, 793, 1639, 1092, 99, 808, 1045, 280, 554, 1662, 138, 1226, 487, 700, 996, 1006, 1281, 1114, 764, 849, 215, 1237, 1494, 1105, 676, 23, 154, 47, 1330, 922, 257, 1373, 546, 365, 1615, 613, 763, 856, 709, 524, 1540, 645, 1505, 454, 1233, 1325, 1551, 1245, 671, 1205, 796, 1499, 350, 1401, 1160, 127, 1041, 123, 1438, 250, 1554, 651, 507, 411, 469, 542, 1014, 237, 758, 1053, 1485, 1328, 742, 381, 1462, 797, 802, 312], 7716, 1060]) == 38\nassert my_solution.maxCount(**[[1516, 561, 494, 894, 1285, 1196, 1311, 783, 906, 964, 617, 350, 779, 876, 184, 345, 145, 524, 337, 1486, 1050, 1155, 851, 1561, 1162, 1599, 1567, 1356, 1064, 1286, 154, 194, 501, 756, 272, 1153, 812, 1597, 156, 511, 325, 1553, 987, 1303, 800, 13, 1510, 1517, 350, 1672, 105, 350, 1606, 589, 516, 1401, 1351, 760, 26, 1632, 389, 1181, 445, 457, 955, 344, 877, 1223, 1038, 1398, 1605, 85, 1002, 959, 661, 442, 823, 386, 1403, 13, 1207, 843, 309, 294, 188, 792, 1100, 1328, 987, 1441, 1365, 996, 423, 1261, 438, 1128, 1171, 607, 217, 1269, 403, 326, 735, 942, 1080, 802, 1206, 1402, 869, 1276, 514, 89, 1300, 1234, 1048, 750, 1412, 374, 405, 691, 1530, 956, 571, 1009, 315, 1064, 287, 309, 430, 362, 1245, 1453, 917, 938, 229, 1581, 562, 952, 1531, 1662, 160, 1431, 1673, 1616, 1438, 872, 1487, 1110, 1390, 1661, 747, 201, 979, 1571, 1656, 1605, 208, 137, 1319, 542, 268, 1150, 1390, 1111, 627, 1183, 84, 1106, 443, 1568, 1503, 1306, 719, 986, 37, 784, 60, 118, 1248, 412, 245, 1584, 265, 362, 671, 797, 18, 749, 1124, 651, 1480, 1295, 732, 488, 1431, 1536, 1615, 201, 977, 1258, 1569, 611, 517, 381, 1050, 679, 1466, 1303, 143, 1301, 1435, 73, 518, 105, 1259, 485, 413, 25, 1214, 706, 799, 847, 327, 399, 1200, 1360, 896, 51, 1115, 159, 943, 1241, 244, 874, 1604, 1403, 771, 794, 1044, 1118, 1112, 1387, 1573, 911, 1164, 37, 682, 1218, 1456, 205, 637, 816, 612, 644, 25, 122, 968, 1295, 589, 708, 960, 1160, 723, 1156, 863, 829, 400, 1521, 31, 272, 1080, 1645, 1470, 170, 767, 985, 254, 759, 375, 1575, 980, 512, 1357, 620, 507, 1034, 1265, 1526, 1594, 210, 1168, 209, 1281, 703, 1603, 334, 1477, 415, 783, 331, 1012, 1298, 1320, 1416, 1422, 461, 847, 260, 680, 1291, 806, 1434, 148, 101, 901, 1223, 552, 1227, 1598, 1208, 130, 910, 742, 831, 786, 83, 730, 1120, 874, 390, 1299, 682, 540, 19, 894, 1300, 758, 79, 65, 1198, 1316, 337, 750, 941, 306, 512, 830, 1210, 336, 989, 1190, 280, 1592, 1539, 18, 1637, 755, 1421, 599, 244, 492, 1215, 929, 680, 274, 136, 1203, 1432, 1627, 1064, 1639, 178, 1368, 1221, 818, 1522, 353, 1595, 610, 1183, 316, 333, 1633, 761, 1288, 712, 818, 661, 671, 606, 1405, 1288, 521, 375, 1523, 378, 1538, 1529, 1330, 7, 222, 91, 961, 433, 637, 351, 467, 647, 153, 1639, 1405, 92, 1345, 293, 676, 376, 305, 298, 1331, 1518, 513, 1484, 576, 492, 243, 69, 6, 1403, 406, 782, 1380, 106, 1426, 1050, 131, 509, 158, 1513, 476, 766, 896, 216, 451, 230, 1271, 73, 1027, 826, 1593, 1261, 357, 338, 1035, 724, 1144, 1669, 1302, 1669, 1202, 529, 276, 1190, 1014, 909, 1503, 1117, 1543, 269, 969, 1629, 1181, 362, 1264, 558, 103, 840, 1338, 148, 1597, 1162, 1425, 351, 253, 583, 795, 1382, 1665, 981, 427, 730, 279, 93, 1355, 723, 1375, 1497, 1143, 1381, 1105, 939, 1626, 1392, 1604, 814, 1167, 1641, 992, 1205, 428, 1435, 1175, 1395, 42, 886, 441, 516, 1482, 1152, 1264, 850, 809, 36, 440, 114, 1193, 625, 631, 206, 681, 284, 1522, 962, 1528, 1599, 1517, 118, 1248, 639, 1109, 580, 861, 324, 1275, 1108, 1185, 1245, 113, 499, 895, 459, 52, 1071, 637, 730, 187, 507, 1018, 1024, 121, 391, 448, 1404, 791, 216, 1122, 1257, 34, 4, 507, 1232, 1502, 1175, 60, 931, 914, 905, 704, 1591, 870, 492, 643, 468, 1436, 34, 501, 1302, 373, 676, 1232, 45, 19, 767, 1348, 311, 1126, 806, 1198, 939, 1027, 629, 747, 1177, 1428, 1030, 36, 271, 259, 477, 121, 755, 411, 339, 385, 1488, 277, 442, 627, 162, 349, 1431, 1395, 91, 1069, 158, 175, 1634, 720, 504, 1454, 1268, 920, 487, 233, 349, 325, 1529, 1133, 1477, 1070, 1378, 1237, 1498, 1513, 279, 896, 853, 282, 1580, 205, 756, 1172, 1598, 1506, 1668, 103, 13, 463, 66, 697, 735, 1535, 522, 313, 82, 680, 84, 775, 1215, 190, 1261, 488, 1594, 112, 323, 613, 1007, 146, 1022, 686, 580, 1274, 1107, 776, 1439, 1222, 1622, 179, 16, 383, 872, 228, 843, 1395, 590, 1047, 952, 1170, 551, 737, 971, 567, 1015, 1260, 1181, 970, 156, 557, 1281, 1473, 538, 450, 296, 1602, 844, 55, 1594, 1015, 1092, 752, 616, 1072, 106, 731, 495, 515, 961, 1498, 1578, 178, 1393, 951, 1178, 357, 435, 885, 499, 1642, 904, 668, 1611, 116, 95, 871, 1124, 254, 1135, 244, 1268, 908, 1509, 1589, 112, 149, 581, 355, 301, 723, 335, 1409, 1569, 1291, 573, 1120, 1234, 1525, 1035, 1105, 155, 1551, 1450, 1459, 882, 1315, 215, 995, 1371, 1380, 287, 997, 631, 425, 1563, 600, 1467, 113, 800, 351, 1008, 658, 1254, 658, 235, 514, 18, 626, 444, 70, 134, 685, 1356, 919, 1622, 1240, 247, 1257, 1204, 963, 459, 803, 1186, 693, 50, 1197, 508, 436, 48, 1432, 783, 706, 1317, 1381, 128, 223, 315, 639, 118, 1236, 765, 1259, 1504, 1202, 820, 170, 866, 551, 1256, 838], 2472, 603420949]) == 1806\nassert my_solution.maxCount(**[[1468, 690, 617, 437, 151, 679, 555, 1430, 445, 1607, 1168, 58, 1535, 825, 395, 943, 1284, 816, 1071, 315, 1597, 815, 984, 944, 897, 447, 683, 1134, 1079, 292, 1136, 715, 685, 753, 1385, 108, 307, 1057, 302, 780, 725, 823, 375, 895, 392, 1442, 525, 485, 1306, 428, 160, 1458, 36, 1264, 696, 818, 878, 1573, 752, 244, 117, 1241, 1440, 104, 1562, 318, 454, 740, 969, 290, 438, 1379, 1387, 1065, 410, 1551, 762, 578, 1163, 201, 1275, 1467, 757, 1464, 1239, 803, 713, 626, 747, 233, 1278, 957, 1526, 1469, 20, 227, 902, 935, 390, 777, 1642, 414, 914, 529, 304, 868, 910, 929, 450, 228, 1328, 70, 127, 90, 1062, 1049, 510, 1293, 558, 956, 456, 1360, 378, 1623, 1336, 997, 866, 1611, 791, 339, 1104, 547, 128, 1413, 1285, 1497, 258, 1018, 161, 1572, 875, 981, 1030, 283, 774, 1489, 1682, 624, 355, 465, 607, 1150, 1388, 1273, 1017, 772, 418, 1550, 323, 1257, 370, 689, 1146, 1634, 812, 604, 462, 1077, 1427, 1258, 265, 1558, 1395, 446, 1472, 1008, 1226, 970, 313, 314, 1359, 796, 1598, 1471, 286, 1357, 1680, 917, 405, 1063, 1004, 648, 785, 361, 988, 585, 150, 693, 573, 1658, 664, 60, 870, 495, 1340, 482, 942, 1191, 985, 1243, 1318, 91, 1281, 844, 620, 980, 836, 8, 49, 274, 1368, 116, 865, 1308, 469, 668, 1202, 599, 1656, 1024, 1415, 799, 771, 1109, 1223, 517, 565, 430, 279, 135, 516, 587, 1674, 770, 1547, 1300, 221, 346, 496, 1240, 1488, 386, 347, 271, 1279, 1412, 1422, 1494, 1310, 767, 294, 1298, 686, 670, 513, 333, 1630, 421, 319, 926, 182, 1463, 709, 1544, 1446, 194, 1182, 1374, 904, 1311, 32, 1207, 1644, 705, 843, 6, 1673, 1372, 1075, 986, 758, 1228, 1174, 1114, 1392, 1425, 1564, 15, 630, 1252, 1287, 368, 542, 1434, 1217, 1219, 1052, 765, 1164, 1122, 1432, 971, 337, 1280, 1476, 775, 1358, 536, 661, 560, 551, 311, 1626, 180, 1429, 695, 287, 1070, 584, 471, 1633, 248, 1361, 26, 623, 380, 1481, 330, 759, 798, 1184, 1162, 1236, 1543, 263, 964, 1158, 1012, 1269, 1003, 18, 119, 534, 977, 1613, 853, 618, 1319, 1443, 122, 1060, 1083, 10, 778, 1491, 1511, 967, 1230, 923, 407, 1483, 595, 817, 1670, 1151, 1394, 1087, 214, 44, 1681, 1297, 1402, 795, 927, 1455, 1177, 1524, 1586, 644, 1337, 467, 1576, 539, 52, 1375, 1294, 394, 431, 152, 737, 750, 281, 298, 158, 133, 1303, 1500, 1007, 276, 880, 1214, 1145, 1180, 179, 828, 484, 1647, 1101, 1396, 954, 537, 1272, 1355, 225, 1465, 591, 1645, 521, 1679, 494, 1330, 351, 1617, 1091, 393, 84, 105, 1453, 22, 611, 1559, 266, 1021, 353, 1516, 1220, 1133, 1365, 1054, 385, 720, 348, 1663, 185, 919, 186, 191, 1580, 1192, 1548, 892, 176, 25, 1321, 1107, 697, 1144, 1638, 1199, 1428, 921, 792, 1045, 1408, 1100, 1518, 1307, 1405, 612, 1664, 738, 781, 1404, 358, 162, 1056, 1651, 736, 994, 582, 261, 387, 183, 739, 303, 676, 232, 729, 996, 384, 1588, 449, 17, 65, 436, 655, 656, 678, 1616, 1451, 1246, 706, 871, 716, 1614, 1000, 979, 391, 851, 1010, 72, 958, 486, 1502, 982, 532, 1067, 148, 131, 100, 544, 877, 1643, 354, 1378, 1342, 493, 1585, 915, 269, 1416, 250, 321, 1612, 717, 1400, 1493, 1042, 847, 89, 592, 383, 1234, 1218, 1554, 172, 882, 328, 209, 178, 1449, 600, 82, 790, 864, 1437, 1457, 557, 12, 1265, 1250, 946, 1267, 130, 616, 841, 316, 247, 461, 1454, 1059, 1166, 474, 1157, 960, 562, 400, 826, 707, 1225, 830, 850, 229, 1604, 295, 1106, 208, 256, 1561, 813, 654, 388, 1332, 1011, 1462, 535, 434, 1529, 955, 784, 645, 1313, 4, 1574, 663, 631, 972, 643, 563, 838, 417, 741, 237, 1055, 215, 1584, 842, 1507, 788, 1622, 723, 987, 806, 1433, 508, 464, 476, 1073, 1477, 589, 1655, 413, 746, 300, 1143, 856, 721, 356, 1155, 588, 546, 246, 918, 114, 1589, 527, 1590, 949, 193, 285, 312, 499, 641, 1563, 1382, 1602, 1110, 867, 703, 687, 1560, 763, 364, 574, 1040, 1620, 522, 1460, 455, 640, 1130, 783, 609, 54, 1324, 1147, 59, 156, 1193, 579, 1423, 601, 1201, 1046, 452, 711, 137, 1051, 1304, 597, 1259, 1061, 1621, 350, 787, 1386, 1251, 30, 76, 712, 1625, 506, 324, 702, 241, 53, 999, 224, 1605, 1480, 789, 196, 132, 175, 653, 724, 199, 169, 1390, 1020, 1556, 1537, 657, 745, 1212, 1520, 651, 1376, 1487, 543, 835, 704, 1452, 342, 908, 782, 1232, 500, 548, 1094, 1053, 586, 1501, 299, 1102, 155, 520, 398, 1154, 107, 31, 1640, 1253, 786, 1499, 773, 603, 1575, 742, 139, 1648, 1383, 28, 1276, 857, 41, 1013, 1023, 1568, 637, 1266, 1203, 688, 1466, 379, 1095, 933, 1019, 367, 833, 1606, 1533, 1183, 282, 170, 681, 1363, 939, 1176, 515, 1474, 147, 125, 329, 1002, 13, 968, 1553, 827, 74, 671, 397, 426, 1076, 280, 523, 27, 429, 1198, 167, 1513, 1050, 1282, 422, 415, 920, 492, 1111, 480, 1009, 776, 14, 1411, 1631, 338, 1505, 748, 991, 291, 1175, 530], 5279, 275588926]) == 4438\nassert my_solution.maxCount(**[[1410, 91, 226, 1098, 1182, 1554, 1247, 1064, 1540, 1087, 922, 1221, 1431, 572, 705, 379, 1184, 1560, 1540, 1170, 754, 524, 790, 1288, 1126, 885, 192, 955, 1008, 1434, 68, 1597, 1002, 1400, 1279, 1111, 139, 1425, 257, 285, 1323, 974, 1019, 760, 1450, 976, 1228, 255, 70, 1483, 1148, 863, 1573, 1372, 1066, 536, 695, 729, 108, 84, 1668, 1342, 354, 362, 1400, 364, 662, 1517, 1121, 70, 261, 708, 148, 477, 1543, 282, 67, 813, 1145, 215, 620, 405, 1632, 101, 1316, 1083, 970, 1636, 382, 79, 192, 863, 1078, 1206, 1301, 59, 515, 429, 834, 781, 200, 276, 1135, 1599, 1129, 974, 370, 1585, 857, 1474, 1278, 1161, 1527, 867, 504, 731, 1218, 1377, 1299, 208, 934, 59, 910, 916, 655, 964, 477, 988, 1059, 895, 1629, 625, 583, 414, 340, 22, 917, 541, 1514, 600, 1167, 1169, 522, 792, 968, 1131, 1205, 1200, 319, 1607, 840, 1538, 1482, 409, 962, 1364, 52, 75, 1647, 620, 1201, 1582, 502, 1144, 267, 737, 1547, 1325, 555, 1047, 664, 1027, 1201, 171, 167, 1501, 1625, 334, 793, 1079, 1635, 410, 656, 165, 45, 1533, 1279, 1058, 1337, 1398, 780, 1307, 320, 1345, 838, 1027, 1352, 618, 1497, 354, 303, 1664, 408, 566, 556, 178, 882, 1079, 216, 1653, 979, 138, 1555, 1514, 1271, 98, 530, 456, 1401, 342, 735, 590, 742, 1226, 207, 1275, 603, 342, 505, 1516, 804, 704, 1517, 1659, 190, 1, 1270, 29, 1404, 455, 205, 1283, 1490, 56, 410, 192, 184, 629, 1280, 1490, 1145, 834, 1286, 232, 208, 1153, 513, 424, 900, 727, 391, 133, 1577, 1635, 1674, 958, 908, 124, 1641, 1527, 1081, 1548, 879, 755, 1609, 1319, 1404, 415, 345, 535, 1329, 554, 598, 1173, 573, 465, 760, 1406, 120, 1255, 474, 1293, 395, 728, 914, 891, 114, 936, 442, 1479, 1097, 837, 1068, 1422, 694, 301, 724, 1671, 1635, 259, 1201, 481, 152, 1323, 1070, 1342, 269, 694, 509, 681, 445, 1379, 837, 277, 1435, 951, 469, 389, 1204, 1237, 1004, 979, 1305, 1558, 642, 889, 719, 1620, 544, 486, 158, 1409, 1431, 1022, 1598, 219, 1519, 1186, 536, 603, 702, 444, 70, 635, 653, 1564, 1285, 1646, 1614, 68, 137, 281, 741, 533, 987, 1023, 1278, 338, 230, 1666, 525, 254, 1223, 1231, 1037, 809, 326, 703, 374, 1436, 506, 72, 736, 307, 511, 641, 285, 1191, 475, 808, 1318, 1437, 474, 35, 714, 1216, 1051, 378, 463, 577, 551, 1305, 162, 821, 1317, 1177, 536, 1319, 1008, 579, 790, 1428, 1566, 490, 1088, 1026, 502, 873, 1109, 60, 355, 1257, 771, 12, 849, 1665, 358, 675, 1597, 146, 306, 1297, 548, 1301, 531, 666, 1548, 1158, 965, 206, 883, 1668, 273, 340, 396, 1083, 1228, 247, 1169, 377, 448, 88, 587, 1682, 367, 827, 520, 1086, 612, 646, 1664, 951, 131, 306, 1671, 1526, 1355, 744, 857, 686, 108, 1518, 250, 1105, 1357, 1443, 777, 912, 1610, 1528, 327, 50, 680, 928, 794, 1673, 88, 891, 86, 188, 81, 645, 1414, 1187, 459, 56, 550, 31, 1053, 641, 1613, 757, 1545, 998, 333, 1074, 672, 300, 1547, 885, 1681, 140, 851, 488, 1166, 336, 405, 899, 324, 440, 138, 1354, 875, 68, 1477, 193, 1619, 688, 1039, 923, 642, 911, 1586, 135, 475, 1123, 204, 908, 622, 1490, 1176, 359, 317, 1593, 167, 1443, 1622, 1011, 895, 845, 967, 1183, 680, 810, 1081, 627, 525, 1616, 868, 1532, 744, 764, 526, 1683, 643, 381, 488, 428, 1409, 1099, 1643, 1276, 747, 473, 962, 1001, 1644, 841, 817, 868, 1583, 998, 1259, 1188, 1518, 7, 1327, 162, 1642, 1396, 92, 1017, 405, 241, 1248, 1295, 344, 1436, 1320, 1507, 401, 308, 1544, 1338, 1551, 1512, 648, 1584, 678, 239, 258, 211, 1352, 163, 338, 332, 1558, 898, 206, 643, 1259, 122, 1058, 468, 1325, 1047, 493, 377, 339, 1529, 1091, 360, 1286, 63, 1111, 455, 1277, 690, 998, 1053, 366, 1417, 1244, 1520, 1594, 590, 465, 716, 504, 1176, 1496, 501, 426, 1003, 1622, 476, 770, 454, 1209, 1355, 1148, 615, 1061, 1517, 1147, 408, 1193, 646, 109, 380, 1566, 1395, 798, 125, 1107, 175, 476, 35, 1444, 681, 672, 682, 875, 1342, 1304, 880, 681, 686, 614, 1217, 548, 235, 1054, 734, 718, 1506, 1385, 1600, 7, 20, 133, 594, 1234, 1507, 1542, 1619, 387, 1392, 1666, 1117, 282, 523, 1085, 287, 1148, 971, 247, 195, 1368, 969, 1383, 1509, 1514, 902, 1396, 1441, 1172, 666, 152, 1004, 667, 621, 257, 733, 38, 1465, 846, 1676, 652, 1335, 1089, 219, 544, 380, 1172, 405, 694, 490, 1649, 136, 1007, 95, 167, 1510, 1356, 147, 472, 522, 406, 615, 1050, 461, 1264, 211, 1229, 683, 1402, 77, 567, 1575, 1114, 149, 878, 1558, 694, 1263, 1394, 1611, 1333, 1311, 198, 1476, 1269, 1416, 569, 550, 478, 144, 388, 1437, 935, 459, 1477, 582, 367, 877, 398, 834, 123, 254, 349, 1242, 342, 1207, 1547, 1465, 188, 1187, 816, 1540, 480, 1550, 501, 800, 1625, 568, 514, 1472, 1136, 772, 1253, 147, 939, 622, 255, 32, 1472, 5, 1133, 167, 221, 933, 1351, 1268, 1574, 214, 1421, 1331, 1642, 1098, 1302, 1163], 6608, 146437394]) == 5941\nassert my_solution.maxCount(**[[320, 304, 115, 281, 1339, 1503, 1673, 191, 371, 389, 1344, 911, 227, 1269, 188, 1687, 908, 890, 755, 334, 1283, 1258, 977, 774, 1029, 857, 663, 127, 967, 1440, 120, 831, 798, 433, 20, 945, 850, 1345, 1425, 1372, 483, 1359, 408, 226, 357, 1535, 856, 1398, 403, 522, 1509, 36, 792, 470, 1331, 1265, 1287, 962, 1357, 909, 269, 424, 1167, 468, 198, 382, 1516, 280, 667, 1358, 1178, 60, 98, 1712, 1689, 1600, 62, 953, 551, 392, 1112, 1267, 355, 420, 741, 1608, 954, 1588, 1520, 1080, 103, 1255, 1573, 1693, 544, 790, 399, 1128, 528, 1243, 1191, 618, 21, 1507, 24, 866, 916, 421, 1338, 185, 1059, 1102, 1085, 100, 1193, 579, 1454, 370, 162, 648, 1465, 140, 1134, 175, 1361, 260, 913, 585, 1300, 926, 882, 1692, 1460, 372, 637, 1562, 318, 887, 283, 1356, 1194, 333, 1117, 1218, 493, 1168, 524, 864, 1586, 567, 305, 412, 446, 1426, 1422, 1179, 1702, 1697, 753, 635, 1594, 1230, 89, 1306, 192, 1278, 366, 1521, 1026, 1171, 1456, 879, 959, 1672, 321, 781, 706, 1631, 268, 1635, 1217, 1488, 259, 1067, 393, 837, 1560, 1421, 1017, 673, 1508, 886, 426, 337, 323, 427, 422, 932, 616, 1523, 531, 1391, 1640, 845, 1543, 636, 1527, 1532, 1090, 14, 915, 1140, 553, 1199, 452, 1575, 555, 43, 609, 1554, 109, 1645, 1609, 1006, 799, 1455, 219, 1061, 1065, 56, 682, 416, 1281, 1176, 984, 1568, 1227, 306, 443, 1066, 1084, 1259, 1021, 1094, 5, 1580, 1504, 213, 41, 460, 247, 775, 614, 11, 341, 61, 873, 299, 1485, 1058, 829, 587, 898, 872, 291, 367, 249, 1461, 70, 1224, 1473, 878, 1376, 156, 27, 1131, 847, 1012, 787, 1192, 1113, 462, 116, 184, 1261, 995, 824, 45, 1246, 699, 186, 786, 611, 526, 360, 1262, 387, 1393, 1643, 1353, 2, 548, 183, 1328, 657, 490, 670, 743, 1185, 581, 1129, 1116, 1566, 214, 1220, 1389, 1536, 925, 1498, 331, 1321, 571, 796, 1164, 1522, 1088, 533, 497, 1617, 978, 445, 938, 1581, 1466, 451, 1695, 80, 439, 638, 1305, 1500, 1699, 876, 599, 1680, 1247, 1053, 1370, 860, 106, 1083, 1196, 477, 695, 509, 665, 960, 1232, 652, 776, 608, 621, 1438, 617, 1122, 1624, 1430, 1627, 434, 646, 797, 1519, 738, 1049, 1674, 1679, 600, 623, 1431, 1027, 986, 1072, 292, 1381, 347, 66, 901, 1040, 968, 1289, 381, 1584, 1340, 1055, 1175, 364, 68, 973, 1415, 696, 376, 1451, 989, 1124, 1698, 1182, 243, 595, 751, 818, 1161, 95, 933, 224, 459, 125, 1174, 1157, 756, 1501, 411, 1234, 1655, 998, 1019, 992, 46, 880, 474, 1347, 1354, 160, 1685, 1630, 1505, 1311, 272, 1228, 233, 1475, 1642, 924, 1188, 119, 502, 1497, 1014, 1133, 723, 1181, 114, 1264, 714, 500, 1544, 112, 1183, 1449, 352, 1069, 1569, 1382, 1020, 645, 1453, 454, 823, 1263, 523, 58, 812, 993, 842, 1481, 1279, 991, 942, 1385, 294, 486, 921, 1688, 71, 1480, 1097, 990, 42, 1242, 1545, 349, 30, 1591, 179, 1518, 52, 235, 822, 889, 328, 999, 8, 215, 687, 918, 1169, 1316, 1681, 760, 1325, 1469, 578, 1550, 1634, 1204, 1301, 961, 1016, 335, 712, 1367, 859, 1045, 37, 23, 313, 819, 205, 851, 1511, 161, 329, 1155, 1043, 134, 809, 1318, 1308, 1092, 1628, 1557, 1644, 79, 110, 345, 862, 237, 971, 1335, 1009, 1420, 597, 1213, 521, 562, 251, 1641, 1395, 1682, 1214, 83, 124, 1215, 368, 29, 414, 1156, 1446, 1479, 514, 296, 782, 1173, 1075, 492, 1063, 1474, 1282, 867, 1303, 662, 166, 770, 1000, 505, 1417, 1309, 123, 750, 1337, 1079, 569, 1406, 1700, 982, 1041, 1529, 931, 327, 34, 1115, 316, 858, 267, 319, 300, 572, 1121, 1515, 1548, 164, 619, 1057, 1254, 409, 1716, 1106, 713, 545, 330, 538, 1656, 1296, 718, 947, 997, 361, 1257, 703, 1317, 152, 835, 75, 1034, 1087, 1603, 605, 401, 163, 1703, 33, 588, 1028, 444, 369, 1659, 875, 1229, 1374, 1590, 1407, 1060, 1074, 817, 1401, 613, 1056, 473, 81, 1696, 1033, 1658, 293, 1253, 1615, 893, 1510, 516, 512, 633, 928, 966, 332, 208, 1540, 814, 1145, 732, 351, 496, 668, 806, 1621, 240, 295, 169, 664, 69, 1412, 1606, 1433, 417, 165, 1272, 232, 1369, 1070, 1030, 1323, 1525, 461, 1147, 1670, 1032, 203, 821, 1678, 568, 138, 4, 1038, 1365, 1375, 431, 1236, 1714, 263, 458, 1432, 432, 1648, 647, 1314, 1666, 22, 582, 1383, 199, 1118, 936, 170, 1268, 981, 189, 1411, 659, 1491, 1711, 705, 1036, 811, 1533, 996, 1429, 1284, 717, 1216, 150, 136, 958, 1572, 574, 946, 1150, 350, 1252, 900, 525, 543, 402, 1483, 1015, 885, 671, 1636, 1154, 1098, 1646, 407, 1341, 241, 1111, 1593, 577, 1428, 290, 904, 952, 97, 1276, 49, 591, 563, 1101, 722, 317, 540, 1159, 685, 1620, 1163, 841, 693, 839, 788, 378, 282, 789, 1551, 1616, 1684, 87, 491, 1332, 390, 702, 536, 530, 679, 1471, 220, 16, 761, 88, 1565, 1315, 359, 1710, 1002, 31, 810, 1008, 200, 238, 1614, 1713, 1363, 1260, 239, 479, 194, 615, 286, 807, 276, 1445, 222, 988, 1293, 719, 1482, 7, 539, 1219, 1441, 612, 1078, 1360, 1048, 948, 1237, 658, 1310, 1184, 1512, 737, 325, 728, 1277], 465, 508292145]) == 239\n"}, "labels": {"questionId": "2640", "questionFrontendId": "2554", "questionTitle": "Maximum Number of Integers to Choose From a Range I", "stats": {"totalAccepted": "5.1K", "totalSubmission": "8.8K", "totalAcceptedRaw": 5051, "totalSubmissionRaw": 8817, "acRate": "57.3%"}, "probedCases": [{"inputs": [[1, 6, 5], 5, 6], "output": 2}, {"inputs": [[1, 2, 3, 4, 5, 6, 7], 8, 1], "output": 0}, {"inputs": [[11], 7, 50], "output": 7}, {"inputs": [[176, 36, 104, 125, 188, 152, 101, 47, 51, 65, 39, 174, 29, 55, 13, 138, 79, 81, 175, 178, 42, 108, 24, 80, 183, 190, 123, 20, 139, 22, 140, 62, 58, 137, 68, 148, 172, 76, 173, 189, 151, 186, 153, 57, 142, 105, 133, 114, 165, 118, 56, 59, 124, 82, 49, 94, 8, 146, 109, 14, 85, 44, 60, 181, 95, 23, 150, 97, 28, 182, 157, 46, 160, 155, 12, 67, 135, 117, 2, 25, 74, 91, 71, 98, 127, 120, 130, 107, 168, 18, 69, 110, 61, 147, 145, 38], 3016, 240], "output": 17}, {"inputs": [[87, 193, 85, 55, 14, 69, 26, 133, 171, 180, 4, 8, 29, 121, 182, 78, 157, 53, 26, 7, 117, 138, 57, 167, 8, 103, 32, 110, 15, 190, 139, 16, 49, 138, 68, 69, 92, 89, 140, 149, 107, 104, 2, 135, 193, 87, 21, 194, 192, 9, 161, 188, 73, 84, 83, 31, 86, 33, 138, 63, 127, 73, 114, 32, 66, 64, 19, 175, 108, 80, 176, 52, 124, 94, 33, 55, 130, 147, 39, 76, 22, 112, 113, 136, 100, 134, 155, 40, 170, 144, 37, 43, 151, 137, 82, 127, 73], 1079, 87], "output": 9}, {"inputs": [[78, 121, 219, 281, 165, 277, 227, 257, 66, 148, 125, 254, 129, 258, 98, 191, 4, 63, 172, 253, 40, 221, 45, 264, 194, 332, 88, 37, 152, 38, 333, 174, 237, 338, 77, 308, 137, 158, 197, 167, 295, 319, 74, 224, 54, 132, 122, 111, 110, 279, 190, 299, 193, 139, 41, 305, 208, 105, 162, 7, 19, 31, 181, 252, 207, 217, 133, 155, 231, 84, 213, 294, 97, 107, 186, 101, 118, 195, 315, 234, 102, 182, 335, 65, 248, 336, 320, 34, 61, 225, 112, 304, 267, 59, 176, 103, 270, 317, 86, 340, 291, 178, 204, 62, 273, 99, 55, 220, 256, 127, 3, 296, 26, 285, 242, 303, 124, 230, 48, 128, 8, 68, 341, 255, 51, 288, 334, 313, 10, 32, 75, 113, 14, 23, 76, 157, 166, 67, 306, 80, 206, 246, 276, 321, 145, 9, 202, 222, 261, 138, 73, 240, 278, 282, 280, 15, 71, 286, 287, 90, 226, 236, 330, 28, 12, 96, 177, 123, 115, 85, 233], 3600, 117], "output": 10}, {"inputs": [[179, 266, 77, 196, 59, 313, 286, 41, 21, 201, 57, 237, 74, 333, 101, 281, 227, 25, 138, 10, 304, 55, 50, 72, 244, 113, 159, 330, 154, 156, 311, 170, 283, 9, 224, 46, 197, 2, 325, 237, 54, 168, 275, 166, 236, 30, 250, 48, 274, 331, 240, 153, 312, 63, 303, 342, 79, 37, 165, 20, 79, 293, 103, 152, 215, 44, 56, 196, 29, 251, 264, 210, 212, 135, 296, 123, 289, 257, 208, 309, 67, 114, 170, 119, 337, 163, 242, 162, 109, 318, 51, 105, 272, 240, 107, 226, 224, 188, 224, 317, 27, 102, 63, 128, 3, 133, 27, 134, 186, 220, 198, 24, 274, 287, 267, 8, 13, 322, 278, 166, 304, 165, 342, 89, 184, 300, 312, 339, 163, 307, 123, 137, 293, 227, 229, 57, 66, 13, 71, 233, 260, 79, 228, 301, 4, 4, 89, 196, 193, 337, 205, 51, 144, 99, 104, 73, 10, 311, 240, 168, 77, 244, 114, 217, 186, 134, 229, 241, 46, 89, 54, 127], 4085, 109718563], "output": 3953}, {"inputs": [[266, 530, 595, 264, 331, 462, 268, 521, 401, 9, 464, 275, 166, 527, 218, 219, 107, 34, 367, 117, 42, 193, 363, 335, 233, 215, 519, 180, 167, 10, 501, 591, 471, 421, 425, 344, 533, 555, 477, 59, 28, 92, 66, 172, 291, 392, 35, 160, 294, 192, 342, 168, 349, 328, 578, 240, 470, 301, 574, 222, 173, 438, 318, 476, 546, 64, 542, 339, 137, 585, 39, 5, 312, 103, 87, 372, 589, 513, 217, 90, 379, 161, 506, 487, 326, 139, 452, 525, 223, 232, 429, 31, 245, 198, 76, 423, 255, 243, 141, 303, 150, 273, 529, 176, 231, 73, 337, 165, 494, 400, 136, 142, 33, 495, 369, 430, 511, 498, 465, 582, 199, 409, 347, 537, 602, 395, 83, 209, 346, 548, 485, 109, 333, 382, 30, 248, 146, 63, 315, 415, 325, 327, 186, 490, 133, 262, 187, 360, 155, 356, 532, 17, 127, 13, 512, 37, 386, 220, 422, 457, 202, 545, 373, 178, 442, 428, 552, 417, 113, 522, 310, 330, 491, 140, 260, 147, 292, 507, 441, 517, 3, 132, 324, 469, 188, 7, 461, 299, 376, 115, 284, 68, 480, 229, 19, 162, 46, 444, 394, 305, 189, 18, 535, 154, 263, 427, 288, 420, 570, 404, 478, 190, 607, 49, 135, 381, 343, 371, 560, 144, 524, 283, 259, 431, 196, 278, 298, 112, 316, 80, 405, 29, 432, 354, 86, 234, 411, 447, 157, 58, 85, 48, 27, 104, 365, 120, 397, 267, 433, 253, 1, 562, 221, 276, 489, 575, 350, 368, 52, 391, 170, 252, 448, 272, 443, 608, 210, 446, 101, 314, 16, 60, 455, 138, 580, 541, 99, 93, 295, 601, 102, 515, 62, 539, 111, 364, 598, 70, 466, 274, 75, 399, 370, 44, 45, 473, 378, 282, 481, 216, 171, 551, 323, 317], 124, 292541445], "output": 63}, {"inputs": [[397, 305, 171, 199, 412, 556, 348, 229, 274, 18, 200, 350, 541, 367, 302, 477, 381, 410, 541, 415, 281, 166, 224, 40, 272, 585, 583, 417, 353, 243, 167, 335, 565, 494, 52, 253, 178, 198, 221, 99, 126, 529, 433, 322, 63, 252, 131, 524, 148, 355, 257, 23, 224, 353, 426, 593, 95, 262, 332, 81, 431, 359, 381, 245, 219, 330, 150, 488, 442, 36, 57, 173, 432, 55, 61, 589, 68, 350, 540, 424, 174, 593, 378, 364, 286, 35, 27, 446, 504, 523, 179, 25, 333, 231, 137, 81, 176, 516, 64, 440, 484, 254, 54, 337, 76, 233, 26, 23, 8, 601, 147, 591, 93, 352, 211, 336, 553, 32, 61, 492, 132, 179, 148, 434, 69, 526, 57, 345, 234, 334, 205, 286, 586, 501, 574, 196, 563, 218, 253, 462, 139, 138, 436, 468, 508, 416, 103, 103, 408, 176, 278, 299, 124, 60, 204, 162, 529, 19, 420, 163, 188, 142, 163, 382, 361, 58, 315, 397, 268, 33, 268, 589, 505, 309, 559, 186, 534, 253, 521, 82, 38, 595, 592, 533, 288, 368, 510, 433, 424, 185, 60, 251, 509, 45, 491, 271, 54, 85, 295, 569, 559, 385, 182, 314, 62, 116, 547, 472, 214, 95, 538, 538, 447, 266, 323, 16, 372, 361, 503, 556, 3, 316, 439, 394, 306, 128, 163, 258, 519, 228, 233, 389, 518, 326, 130, 152, 326, 86, 87, 347, 170, 155, 349, 537, 300, 433, 206, 214, 392, 101, 401, 1, 504, 473, 567, 283, 412, 509, 150, 388, 306, 488, 327, 54, 309, 255, 218, 550, 584, 55, 91, 430, 446, 417, 279, 546, 203, 281, 407, 237, 443, 211, 553, 225, 525, 591, 431, 156, 335, 203, 166, 471, 208, 60, 487, 358, 178, 314, 290, 581, 337, 224, 471, 38, 176], 7362, 911846577], "output": 7121}, {"inputs": [[152, 227, 518, 324, 508, 446, 203, 16, 278, 385, 312, 22, 425, 130, 293, 233, 365, 199, 87, 613, 280, 589, 479, 297, 207, 523, 428, 448, 25, 298, 103, 649, 104, 17, 608, 139, 474, 77, 254, 464, 376, 629, 602, 487, 512, 496, 119, 70, 165, 52, 82, 94, 378, 422, 476, 93, 596, 406, 272, 630, 309, 565, 285, 266, 495, 101, 361, 314, 442, 432, 594, 621, 106, 37, 294, 536, 517, 11, 140, 478, 457, 550, 645, 423, 451, 8, 163, 531, 230, 235, 341, 267, 362, 527, 234, 609, 444, 323, 336, 411, 169, 292, 19, 50, 569, 501, 632, 279, 459, 225, 595, 261, 325, 71, 436, 84, 216, 342, 241, 206, 269, 556, 315, 99, 543, 405, 56, 503, 20, 123, 410, 4, 379, 452, 164, 27, 528, 310, 524, 640, 525, 218, 299, 370, 322, 514, 244, 289, 219, 350, 245, 372, 409, 33, 153, 126, 340, 122, 2, 223, 72, 347, 424, 270, 186, 188, 367, 577, 461, 626, 623, 317, 386, 213, 149, 29, 477, 345, 319, 229, 9, 147, 606, 113, 58, 39, 120, 548, 15, 526, 32, 288, 502, 209, 567, 416, 443, 198, 412, 639, 511, 408, 537, 148, 150, 374, 21, 45, 546, 296, 580, 417, 36, 55, 86, 42, 538, 473, 90, 529, 211, 196, 193, 175, 391, 472, 619, 490, 23, 593, 313, 352, 562, 585, 554, 445, 283, 301, 190, 403, 530, 157, 469, 540, 83, 111, 364, 506, 208, 48, 250, 371, 489, 363, 275, 381, 108, 204, 41, 246, 605, 492, 185, 114, 603, 329, 320, 136, 573, 338, 276, 18, 344, 507, 256, 271, 485, 467, 81, 652, 162, 351, 239, 404, 89, 57, 505, 458, 366, 328, 238, 125, 295, 463, 610, 615, 237, 586, 141, 308, 460, 648, 80, 318, 437, 429, 497, 560, 121, 160, 311, 273, 158, 534, 583, 221, 545, 98, 286, 105, 182, 291, 633, 588, 635, 255], 312, 608], "output": 23}, {"inputs": [[541, 194, 109, 373, 569, 564, 523, 475, 598, 386, 202, 250, 173, 476, 350, 443, 389, 192, 448, 353, 320, 20, 531, 408, 79, 598, 175, 262, 363, 540, 256, 562, 143, 506, 277, 431, 316, 214, 388, 30, 518, 158, 152, 448, 188, 133, 636, 139, 518, 63, 502, 19, 362, 383, 311, 428, 313, 528, 609, 407, 182, 646, 588, 157, 11, 289, 466, 178, 498, 426, 363, 389, 85, 47, 145, 601, 120, 278, 544, 653, 92, 189, 452, 515, 93, 398, 380, 532, 178, 368, 472, 304, 63, 369, 270, 80, 373, 46, 134, 380, 507, 364, 224, 221, 180, 328, 4, 162, 330, 197, 241, 527, 359, 68, 349, 224, 644, 532, 369, 37, 373, 225, 636, 335, 508, 390, 634, 357, 531, 307, 504, 253, 109, 628, 6, 255, 420, 274, 112, 79, 343, 587, 99, 147, 445, 210, 284, 58, 546, 218, 355, 274, 23, 286, 160, 151, 9, 324, 251, 243, 500, 525, 28, 1, 619, 354, 480, 557, 429, 405, 23, 71, 563, 297, 234, 202, 616, 597, 620, 78, 467, 485, 197, 625, 38, 108, 552, 15, 111, 319, 444, 260, 497, 622, 530, 435, 154, 362, 77, 554, 639, 83, 565, 525, 406, 504, 202, 567, 16, 189, 497, 95, 348, 367, 641, 438, 609, 12, 250, 577, 540, 71, 592, 176, 257, 42, 181, 85, 645, 649, 86, 168, 457, 600, 118, 131, 463, 642, 233, 294, 597, 646, 98, 374, 361, 292, 411, 502, 131, 540, 474, 15, 307, 58, 481, 213, 47, 87, 440, 394, 437, 204, 548, 286, 42, 579, 445, 602, 168, 116, 575, 245, 165, 445, 156, 168, 398, 224, 86, 643, 430, 214, 440, 13, 480, 560, 306, 131, 17, 629, 269, 463, 590, 163, 2, 130, 127, 560, 46, 243, 32, 253, 637, 247, 66, 46, 50, 323, 56, 131, 127, 25, 371, 251, 225, 470, 131, 176, 200, 551, 497, 583, 33, 300, 236, 176, 478], 7913, 317], "output": 16}, {"inputs": [[512, 233, 22, 699, 458, 74, 482, 16, 455, 560, 389, 301, 4, 291, 145, 501, 333, 660, 538, 444, 496, 602, 509, 591, 124, 659, 336, 120, 475, 445, 36, 416, 192, 67, 341, 44, 399, 154, 630, 628, 140, 51, 626, 549, 187, 361, 388, 694, 421, 554, 411, 600, 105, 526, 102, 182, 479, 49, 125, 682, 258, 403, 417, 93, 309, 183, 32, 412, 170, 261, 159, 546, 569, 460, 661, 438, 179, 668, 338, 645, 566, 202, 35, 222, 275, 487, 313, 352, 163, 56, 252, 282, 259, 225, 109, 223, 690, 292, 502, 375, 299, 95, 316, 335, 307, 398, 293, 238, 190, 208, 382, 85, 436, 290, 21, 273, 675, 181, 138, 337, 63, 688, 485, 45, 563, 117, 197, 101, 99, 29, 8, 624, 242, 461, 524, 177, 46, 667, 494, 255, 243, 358, 405, 576, 98, 114, 593, 60, 315, 483, 543, 195, 664, 196, 47, 191, 545, 251, 26, 390, 507, 324, 695, 62, 303, 583, 466, 540, 52, 91, 369, 394, 305, 59, 622, 579, 110, 294, 635, 226, 146, 380, 123, 42, 269, 227, 86, 55, 158, 119, 489, 448, 199, 548, 520, 634, 20, 651, 378, 534, 328, 557, 700, 544, 592, 329, 564, 447, 141, 433, 497, 107, 677, 153, 621, 623, 642, 116, 96, 679, 221, 401, 6, 266, 267, 137, 268, 532, 601, 274, 72, 609, 250, 156, 257, 180, 353, 304, 212, 311, 671, 53, 652, 37, 94, 547, 348, 696, 325, 332, 373, 611, 678, 139, 142, 559, 449, 342, 504, 476, 536, 355, 278, 302, 528, 103, 3, 539, 201, 435, 219, 368, 427, 240, 452, 641, 350, 347, 615, 408, 648, 393, 13, 446, 568, 326, 80, 97, 283, 5, 24, 414, 473, 666, 171, 597, 54, 672, 616, 367, 83, 204, 456, 104, 537, 402, 314, 12, 147, 58, 468, 595, 206, 429, 577, 43, 638, 558, 284, 649, 587, 573, 131, 620, 30, 28, 450, 306, 572, 387, 371, 541, 143, 627, 586, 256, 135, 617, 319, 321, 614, 308, 334, 230, 518, 470, 64, 339, 270, 157], 8045, 300738886], "output": 7695}, {"inputs": [[104, 351, 540, 301, 565, 429, 569, 598, 475, 337, 383, 496, 524, 324, 689, 167, 528, 383, 209, 166, 498, 699, 345, 102, 410, 160, 149, 587, 315, 268, 208, 427, 364, 4, 553, 663, 453, 8, 358, 194, 415, 653, 274, 249, 552, 34, 193, 58, 178, 295, 621, 90, 249, 593, 624, 76, 373, 568, 657, 600, 452, 607, 97, 310, 442, 430, 257, 607, 690, 371, 205, 160, 39, 350, 406, 375, 172, 482, 578, 195, 256, 376, 637, 661, 510, 544, 253, 487, 603, 308, 138, 224, 446, 273, 277, 488, 431, 553, 481, 535, 272, 697, 228, 605, 123, 607, 559, 554, 450, 104, 22, 285, 580, 328, 646, 128, 658, 167, 695, 174, 273, 551, 173, 700, 116, 600, 85, 24, 568, 219, 279, 55, 572, 528, 655, 347, 519, 606, 453, 380, 435, 688, 74, 663, 553, 371, 293, 326, 395, 696, 32, 321, 422, 496, 392, 114, 555, 310, 669, 222, 211, 457, 364, 298, 550, 324, 269, 649, 287, 425, 578, 82, 276, 594, 601, 535, 336, 292, 596, 698, 517, 589, 202, 85, 41, 222, 333, 463, 686, 555, 40, 398, 637, 232, 121, 325, 67, 680, 528, 199, 186, 116, 78, 354, 672, 88, 340, 218, 198, 44, 193, 156, 508, 402, 123, 419, 140, 630, 104, 231, 279, 336, 107, 111, 8, 88, 508, 230, 650, 701, 680, 386, 528, 550, 657, 499, 16, 360, 519, 596, 206, 650, 36, 536, 383, 344, 194, 313, 579, 359, 467, 194, 151, 615, 593, 362, 105, 152, 691, 248, 621, 297, 278, 333, 411, 4, 491, 144, 552, 610, 428, 226, 230, 243, 263, 416, 345, 322, 160, 120, 40, 13, 95, 12, 444, 671, 270, 27, 612, 450, 47, 1, 92, 437, 255, 87, 425, 504, 594, 579, 344, 452, 479, 328, 468, 574, 682, 351, 256, 70, 47, 542, 69, 423, 177, 28, 625, 515, 660, 377, 387, 53, 486, 476, 92, 302, 654, 420, 257, 495, 162, 539, 512, 421, 296, 284, 664, 253, 376, 596, 139, 557, 518, 460, 310, 27, 637, 375, 435, 438, 483], 77, 512050749], "output": 51}, {"inputs": [[812, 748, 455, 510, 326, 370, 409, 703, 401, 296, 166, 686, 73, 532, 475, 165, 589, 110, 414, 162, 425, 277, 778, 842, 528, 216, 838, 38, 444, 697, 49, 172, 637, 744, 784, 480, 218, 342, 514, 493, 385, 549, 394, 288, 499, 285, 245, 369, 48, 826, 583, 609, 7, 898, 66, 390, 81, 114, 226, 723, 837, 416, 177, 80, 352, 708, 814, 711, 448, 434, 761, 782, 470, 365, 681, 264, 615, 541, 438, 521, 456, 458, 695, 608, 330, 238, 866, 642, 353, 557, 108, 125, 806, 215, 727, 757, 313, 11, 482, 887, 798, 90, 432, 529, 849, 303, 175, 37, 556, 196, 466, 23, 811, 700, 813, 758, 1, 411, 696, 717, 16, 747, 452, 450, 77, 674, 547, 95, 539, 121, 658, 173, 746, 702, 612, 606, 854, 348, 661, 531, 698, 567, 368, 124, 687, 13, 354, 39, 624, 704, 882, 722, 199, 513, 640, 607, 194, 291, 821, 764, 341, 185, 233, 740, 195, 684, 244, 875, 631, 357, 792, 633, 231, 823, 664, 749, 610, 388, 904, 133, 469, 107, 873, 588, 707, 332, 25, 691, 871, 305, 33, 52, 570, 148, 656, 573, 815, 347, 685, 793, 62, 51, 693, 361, 188, 336, 40, 122, 406, 240, 404, 726, 542, 350, 266, 339, 525, 801, 471, 257, 349, 645, 213, 620, 618, 140, 263, 771, 442, 836, 246, 130, 862, 267, 132, 109, 592, 191, 159, 492, 560, 300, 262, 209, 169, 417, 189, 334, 270, 276, 451, 554, 886, 562, 509, 79, 310, 709, 859, 461, 36, 672, 268, 712, 905, 102, 78, 204, 496, 791, 104, 657, 682, 337, 611, 808, 293, 4, 530, 164, 797, 534, 533, 317, 464, 511, 380, 22, 116, 254, 830, 768, 765, 364, 259, 183, 568, 234, 228, 193, 396, 894, 180, 273, 2, 5, 88, 308, 430, 360, 271, 841, 229, 580, 561, 431, 663, 729, 870, 688, 713, 161, 74, 225, 142, 572, 860, 643, 803, 280, 619, 594, 399, 86, 787, 34, 785, 477, 374, 20, 487, 181, 627, 512, 780, 731, 445, 897, 834, 314, 418, 76, 616, 70, 12, 340, 151, 331, 412, 176, 96, 585, 617, 65, 322, 805, 804, 468, 454, 802, 868, 230, 767, 855, 888, 501, 555, 255, 31, 224, 667, 58, 29, 311, 197, 602, 408, 221, 595, 719, 774, 675, 641, 460, 644, 153, 752, 179, 865, 467, 318, 488, 375, 111, 219, 328, 575, 772, 45, 710, 621, 120, 538, 678, 422, 333, 536, 47, 287, 154, 320, 835, 41, 590, 32, 395, 650, 828, 443, 93, 692, 433, 203, 558, 879, 202, 630, 441, 628, 734, 825, 220, 182, 574, 437, 569, 850, 158, 474, 278, 893, 524, 295], 1029, 1253], "output": 34}, {"inputs": [[43, 272, 161, 404, 343, 614, 250, 739, 57, 800, 302, 869, 831, 827, 202, 746, 626, 673, 259, 827, 600, 532, 768, 266, 409, 67, 473, 845, 874, 854, 803, 571, 546, 421, 681, 623, 107, 561, 536, 318, 602, 839, 693, 633, 13, 632, 295, 564, 670, 804, 813, 681, 734, 663, 18, 739, 3, 230, 723, 772, 97, 424, 592, 634, 778, 175, 586, 247, 309, 274, 889, 615, 301, 717, 681, 624, 382, 611, 384, 611, 162, 324, 726, 779, 369, 142, 712, 128, 117, 867, 144, 498, 408, 634, 196, 452, 559, 137, 565, 295, 804, 6, 72, 81, 466, 834, 476, 4, 219, 718, 175, 351, 640, 32, 759, 656, 600, 92, 639, 644, 737, 482, 568, 710, 371, 614, 807, 201, 634, 544, 205, 399, 661, 664, 58, 419, 489, 106, 163, 297, 701, 784, 598, 902, 628, 702, 871, 462, 686, 620, 47, 404, 58, 684, 436, 907, 651, 240, 803, 371, 766, 175, 374, 813, 684, 634, 514, 244, 458, 385, 556, 857, 296, 486, 233, 127, 3, 301, 52, 379, 318, 246, 876, 244, 876, 354, 55, 444, 453, 380, 608, 488, 297, 614, 815, 291, 25, 299, 168, 630, 157, 600, 183, 578, 97, 92, 126, 203, 387, 575, 271, 731, 489, 734, 312, 281, 171, 776, 838, 523, 23, 865, 174, 226, 192, 557, 94, 869, 611, 798, 207, 836, 134, 103, 829, 207, 615, 601, 845, 398, 41, 533, 296, 333, 473, 95, 609, 591, 876, 685, 7, 387, 878, 117, 374, 304, 15, 359, 184, 60, 476, 186, 567, 843, 109, 282, 885, 235, 3, 837, 141, 319, 395, 89, 162, 830, 894, 738, 99, 1, 376, 836, 716, 454, 873, 699, 430, 575, 77, 79, 338, 540, 723, 89, 861, 13, 519, 574, 315, 720, 430, 831, 527, 816, 181, 716, 224, 115, 48, 505, 157, 831, 604, 553, 641, 252, 251, 32, 258, 553, 693, 620, 58, 767, 207, 339, 600, 813, 713, 124, 530, 825, 631, 481, 590, 88, 779, 311, 501, 734, 106, 893, 495, 875, 763, 742, 828, 709, 365, 454, 613, 332, 515, 889, 132, 625, 811, 172, 366, 842, 599, 114, 375, 725, 750, 526, 610, 462, 161, 535, 25, 819, 673, 692, 403, 389, 334, 823, 454, 65, 40, 91, 433, 763, 401, 82, 878, 98, 271, 697, 339, 186, 371, 644, 604, 581, 619, 31, 575, 127, 492, 590, 46, 807, 856, 155, 779, 288, 797, 829, 120, 298, 722, 454, 550, 222, 249, 156, 18, 370, 782, 644, 715, 211, 761, 430, 151, 567, 565, 228, 753, 422, 142, 613, 469, 280, 303, 54, 661, 480, 568, 589, 299, 558, 444, 892, 861, 251, 259, 383, 735, 895, 357, 781], 2794, 891214307], "output": 2443}, {"inputs": [[1474, 239, 389, 366, 989, 1289, 1583, 1421, 687, 158, 932, 367, 4, 498, 926, 504, 274, 438, 1411, 870, 879, 544, 656, 850, 955, 230, 353, 1657, 1598, 1182, 684, 1459, 1195, 285, 483, 1091, 1654, 924, 429, 1669, 1492, 930, 1418, 1565, 1429, 263, 1451, 726, 969, 944, 361, 883, 354, 90, 538, 1264, 1060, 1197, 589, 1269, 976, 1651, 812, 562, 321, 1170, 569, 77, 1498, 1019, 1171, 229, 1278, 733, 416, 287, 686, 823, 1514, 66, 1035, 941, 182, 72, 540, 34, 1178, 566, 1095, 826, 207, 1022, 133, 626, 1107, 55, 198, 695, 1537, 1131, 911, 1025, 1196, 964, 1164, 334, 306, 1323, 1570, 1244, 789, 1275, 738, 214, 1329, 1040, 61, 1632, 456, 171, 1428, 1199, 307, 1191, 1457, 979, 746, 1559, 953, 327, 442, 335, 413, 1063, 910, 1074, 1294, 800, 199, 100, 1016, 1440, 339, 233, 501, 784, 387, 1322, 947, 876, 332, 467, 1296, 218, 375, 1397, 405, 720, 673, 1213, 1341, 86, 1475, 928, 854, 283, 881, 844, 903, 1085, 815, 706, 853, 1031, 873, 165, 1058, 1018, 245, 169, 919, 545, 68, 935, 867, 409, 669, 104, 803, 1566, 314, 1515, 205, 443, 134, 957, 1655, 1641, 1441, 1377, 744, 277, 588, 19, 412, 1314, 662, 1417, 1614, 1477, 216, 1579, 958, 1030, 965, 308, 770, 1206, 1455, 1473, 9, 1163, 582, 1042, 301, 449, 1036, 788, 627, 729, 1099, 916, 85, 918, 468, 635, 1255, 847, 1208, 1460, 246, 1276, 1300, 1159, 621, 888, 115, 1249, 914, 1502, 871, 139, 1354, 1005, 69, 486, 1154, 475, 1521, 782, 1260, 356, 1100, 1078, 176, 658, 1553, 1072, 848, 360, 683, 1437, 164, 260, 811, 765, 95, 647, 1588, 209, 570, 672, 1326, 345, 869, 664, 1263, 725, 1070, 1369, 1117, 1517, 455, 715, 457, 272, 1424, 226, 605, 559, 805, 1083, 1034, 730, 896, 1549, 1649, 264, 615, 1463, 648, 1628, 1087, 974, 649, 962, 160, 406, 1303, 836, 995, 1210, 1050, 1419, 1415, 1204, 1350, 1624, 548, 162, 364, 749, 1591, 934, 739, 1073, 1121, 289, 1646, 822, 244, 337, 148, 1599, 973, 494, 1311, 152, 596, 142, 188, 440, 1507, 269, 806, 1597, 1265, 875, 988, 140, 882, 292, 1242, 1293, 15, 892, 874, 1538, 795, 1088, 488, 960, 1548, 1399, 1601, 830, 1190, 755, 1223, 1186, 105, 689, 446, 1576, 708, 1364, 1033, 753, 97, 818, 347, 82, 404, 313, 453, 1408, 563, 190, 304, 1262, 943, 1123, 518, 1004, 234, 505, 516, 963, 1094, 1533, 638, 791, 998, 1067, 611, 1240, 71, 1333, 210, 1557, 997, 439, 533, 863, 1506, 773, 116, 62, 1481, 478, 655, 1608, 485, 295, 1315, 838, 203, 925, 106, 670, 992, 659, 1633, 379, 125, 1219, 1286, 1287, 580, 1647, 644, 1021, 1349, 1003, 967, 395, 479, 297, 680, 1272, 1258, 1068, 942, 1642, 1024, 267, 1443, 909, 328, 1409, 543, 690, 1542, 837, 1643, 178, 1051, 1396, 1580, 1125, 1002, 1187, 801, 1089, 752, 174, 1177, 143, 1513, 278, 1023, 275, 392, 1351, 121, 900, 933, 1518, 1610, 187, 1052, 1143, 89, 1217, 206, 427, 369, 981, 217, 766, 424, 451, 528, 243, 1348, 1613, 1464, 1007, 1545, 678, 76, 541, 471, 1148, 902, 1243, 460, 1525, 1000, 425, 208, 1279, 29, 628, 1500, 1032, 435, 1162, 530, 1015, 1009, 1198, 1461, 391, 1423, 1527, 1550, 1180, 865, 1184, 717, 820, 64, 1406, 372, 341, 1319, 575, 940, 102, 537, 781, 286, 156, 574, 294, 107, 1225, 637, 567, 52, 780, 804, 952, 1640, 634, 1547, 532, 231, 1469, 1246, 1118, 1098, 448, 653, 889, 1603, 351, 757, 718, 642, 65, 1491, 96, 1064, 1487, 1558, 529, 1653, 1482, 324, 929, 606, 242, 573, 101, 112, 1066, 625, 1555, 1427, 948, 774, 1490, 1609, 1422, 810, 291, 693, 1627, 472, 1358, 400, 1345, 1173, 316, 1535, 474, 1038, 1606, 737, 785, 745, 1511, 1065, 1433, 722, 872, 1232, 459, 1167, 1147, 1560, 325, 702, 1384, 748, 1523, 895, 1110, 1371, 236, 1363, 1194, 698, 1, 768, 1472, 1619, 1526, 685, 868, 1478, 1626, 60, 110, 716, 1268, 390, 1372, 1238, 1413, 549, 584, 1142, 179, 1248, 1214, 476, 1256, 1008, 1168, 359, 330, 694, 931, 618, 1193, 122, 817, 30, 1667, 591, 1288, 1343, 147, 1192, 502, 241, 1664, 660, 450, 1600, 821, 572, 1308, 630, 303, 1467, 252, 1621, 14, 949, 1120, 1516, 1339, 991, 1228, 1386, 88, 1672, 576, 223, 721, 368, 1298, 999, 489, 1090, 535, 211, 80, 1102, 447, 846, 839, 346, 904, 511, 1084, 1586, 124, 917, 1582, 491, 1468, 786, 1592, 342, 39, 1230, 279, 28, 1446, 743, 767, 1101, 114, 302, 793, 1639, 1092, 99, 808, 1045, 280, 554, 1662, 138, 1226, 487, 700, 996, 1006, 1281, 1114, 764, 849, 215, 1237, 1494, 1105, 676, 23, 154, 47, 1330, 922, 257, 1373, 546, 365, 1615, 613, 763, 856, 709, 524, 1540, 645, 1505, 454, 1233, 1325, 1551, 1245, 671, 1205, 796, 1499, 350, 1401, 1160, 127, 1041, 123, 1438, 250, 1554, 651, 507, 411, 469, 542, 1014, 237, 758, 1053, 1485, 1328, 742, 381, 1462, 797, 802, 312], 7716, 1060], "output": 38}, {"inputs": [[1516, 561, 494, 894, 1285, 1196, 1311, 783, 906, 964, 617, 350, 779, 876, 184, 345, 145, 524, 337, 1486, 1050, 1155, 851, 1561, 1162, 1599, 1567, 1356, 1064, 1286, 154, 194, 501, 756, 272, 1153, 812, 1597, 156, 511, 325, 1553, 987, 1303, 800, 13, 1510, 1517, 350, 1672, 105, 350, 1606, 589, 516, 1401, 1351, 760, 26, 1632, 389, 1181, 445, 457, 955, 344, 877, 1223, 1038, 1398, 1605, 85, 1002, 959, 661, 442, 823, 386, 1403, 13, 1207, 843, 309, 294, 188, 792, 1100, 1328, 987, 1441, 1365, 996, 423, 1261, 438, 1128, 1171, 607, 217, 1269, 403, 326, 735, 942, 1080, 802, 1206, 1402, 869, 1276, 514, 89, 1300, 1234, 1048, 750, 1412, 374, 405, 691, 1530, 956, 571, 1009, 315, 1064, 287, 309, 430, 362, 1245, 1453, 917, 938, 229, 1581, 562, 952, 1531, 1662, 160, 1431, 1673, 1616, 1438, 872, 1487, 1110, 1390, 1661, 747, 201, 979, 1571, 1656, 1605, 208, 137, 1319, 542, 268, 1150, 1390, 1111, 627, 1183, 84, 1106, 443, 1568, 1503, 1306, 719, 986, 37, 784, 60, 118, 1248, 412, 245, 1584, 265, 362, 671, 797, 18, 749, 1124, 651, 1480, 1295, 732, 488, 1431, 1536, 1615, 201, 977, 1258, 1569, 611, 517, 381, 1050, 679, 1466, 1303, 143, 1301, 1435, 73, 518, 105, 1259, 485, 413, 25, 1214, 706, 799, 847, 327, 399, 1200, 1360, 896, 51, 1115, 159, 943, 1241, 244, 874, 1604, 1403, 771, 794, 1044, 1118, 1112, 1387, 1573, 911, 1164, 37, 682, 1218, 1456, 205, 637, 816, 612, 644, 25, 122, 968, 1295, 589, 708, 960, 1160, 723, 1156, 863, 829, 400, 1521, 31, 272, 1080, 1645, 1470, 170, 767, 985, 254, 759, 375, 1575, 980, 512, 1357, 620, 507, 1034, 1265, 1526, 1594, 210, 1168, 209, 1281, 703, 1603, 334, 1477, 415, 783, 331, 1012, 1298, 1320, 1416, 1422, 461, 847, 260, 680, 1291, 806, 1434, 148, 101, 901, 1223, 552, 1227, 1598, 1208, 130, 910, 742, 831, 786, 83, 730, 1120, 874, 390, 1299, 682, 540, 19, 894, 1300, 758, 79, 65, 1198, 1316, 337, 750, 941, 306, 512, 830, 1210, 336, 989, 1190, 280, 1592, 1539, 18, 1637, 755, 1421, 599, 244, 492, 1215, 929, 680, 274, 136, 1203, 1432, 1627, 1064, 1639, 178, 1368, 1221, 818, 1522, 353, 1595, 610, 1183, 316, 333, 1633, 761, 1288, 712, 818, 661, 671, 606, 1405, 1288, 521, 375, 1523, 378, 1538, 1529, 1330, 7, 222, 91, 961, 433, 637, 351, 467, 647, 153, 1639, 1405, 92, 1345, 293, 676, 376, 305, 298, 1331, 1518, 513, 1484, 576, 492, 243, 69, 6, 1403, 406, 782, 1380, 106, 1426, 1050, 131, 509, 158, 1513, 476, 766, 896, 216, 451, 230, 1271, 73, 1027, 826, 1593, 1261, 357, 338, 1035, 724, 1144, 1669, 1302, 1669, 1202, 529, 276, 1190, 1014, 909, 1503, 1117, 1543, 269, 969, 1629, 1181, 362, 1264, 558, 103, 840, 1338, 148, 1597, 1162, 1425, 351, 253, 583, 795, 1382, 1665, 981, 427, 730, 279, 93, 1355, 723, 1375, 1497, 1143, 1381, 1105, 939, 1626, 1392, 1604, 814, 1167, 1641, 992, 1205, 428, 1435, 1175, 1395, 42, 886, 441, 516, 1482, 1152, 1264, 850, 809, 36, 440, 114, 1193, 625, 631, 206, 681, 284, 1522, 962, 1528, 1599, 1517, 118, 1248, 639, 1109, 580, 861, 324, 1275, 1108, 1185, 1245, 113, 499, 895, 459, 52, 1071, 637, 730, 187, 507, 1018, 1024, 121, 391, 448, 1404, 791, 216, 1122, 1257, 34, 4, 507, 1232, 1502, 1175, 60, 931, 914, 905, 704, 1591, 870, 492, 643, 468, 1436, 34, 501, 1302, 373, 676, 1232, 45, 19, 767, 1348, 311, 1126, 806, 1198, 939, 1027, 629, 747, 1177, 1428, 1030, 36, 271, 259, 477, 121, 755, 411, 339, 385, 1488, 277, 442, 627, 162, 349, 1431, 1395, 91, 1069, 158, 175, 1634, 720, 504, 1454, 1268, 920, 487, 233, 349, 325, 1529, 1133, 1477, 1070, 1378, 1237, 1498, 1513, 279, 896, 853, 282, 1580, 205, 756, 1172, 1598, 1506, 1668, 103, 13, 463, 66, 697, 735, 1535, 522, 313, 82, 680, 84, 775, 1215, 190, 1261, 488, 1594, 112, 323, 613, 1007, 146, 1022, 686, 580, 1274, 1107, 776, 1439, 1222, 1622, 179, 16, 383, 872, 228, 843, 1395, 590, 1047, 952, 1170, 551, 737, 971, 567, 1015, 1260, 1181, 970, 156, 557, 1281, 1473, 538, 450, 296, 1602, 844, 55, 1594, 1015, 1092, 752, 616, 1072, 106, 731, 495, 515, 961, 1498, 1578, 178, 1393, 951, 1178, 357, 435, 885, 499, 1642, 904, 668, 1611, 116, 95, 871, 1124, 254, 1135, 244, 1268, 908, 1509, 1589, 112, 149, 581, 355, 301, 723, 335, 1409, 1569, 1291, 573, 1120, 1234, 1525, 1035, 1105, 155, 1551, 1450, 1459, 882, 1315, 215, 995, 1371, 1380, 287, 997, 631, 425, 1563, 600, 1467, 113, 800, 351, 1008, 658, 1254, 658, 235, 514, 18, 626, 444, 70, 134, 685, 1356, 919, 1622, 1240, 247, 1257, 1204, 963, 459, 803, 1186, 693, 50, 1197, 508, 436, 48, 1432, 783, 706, 1317, 1381, 128, 223, 315, 639, 118, 1236, 765, 1259, 1504, 1202, 820, 170, 866, 551, 1256, 838], 2472, 603420949], "output": 1806}, {"inputs": [[1468, 690, 617, 437, 151, 679, 555, 1430, 445, 1607, 1168, 58, 1535, 825, 395, 943, 1284, 816, 1071, 315, 1597, 815, 984, 944, 897, 447, 683, 1134, 1079, 292, 1136, 715, 685, 753, 1385, 108, 307, 1057, 302, 780, 725, 823, 375, 895, 392, 1442, 525, 485, 1306, 428, 160, 1458, 36, 1264, 696, 818, 878, 1573, 752, 244, 117, 1241, 1440, 104, 1562, 318, 454, 740, 969, 290, 438, 1379, 1387, 1065, 410, 1551, 762, 578, 1163, 201, 1275, 1467, 757, 1464, 1239, 803, 713, 626, 747, 233, 1278, 957, 1526, 1469, 20, 227, 902, 935, 390, 777, 1642, 414, 914, 529, 304, 868, 910, 929, 450, 228, 1328, 70, 127, 90, 1062, 1049, 510, 1293, 558, 956, 456, 1360, 378, 1623, 1336, 997, 866, 1611, 791, 339, 1104, 547, 128, 1413, 1285, 1497, 258, 1018, 161, 1572, 875, 981, 1030, 283, 774, 1489, 1682, 624, 355, 465, 607, 1150, 1388, 1273, 1017, 772, 418, 1550, 323, 1257, 370, 689, 1146, 1634, 812, 604, 462, 1077, 1427, 1258, 265, 1558, 1395, 446, 1472, 1008, 1226, 970, 313, 314, 1359, 796, 1598, 1471, 286, 1357, 1680, 917, 405, 1063, 1004, 648, 785, 361, 988, 585, 150, 693, 573, 1658, 664, 60, 870, 495, 1340, 482, 942, 1191, 985, 1243, 1318, 91, 1281, 844, 620, 980, 836, 8, 49, 274, 1368, 116, 865, 1308, 469, 668, 1202, 599, 1656, 1024, 1415, 799, 771, 1109, 1223, 517, 565, 430, 279, 135, 516, 587, 1674, 770, 1547, 1300, 221, 346, 496, 1240, 1488, 386, 347, 271, 1279, 1412, 1422, 1494, 1310, 767, 294, 1298, 686, 670, 513, 333, 1630, 421, 319, 926, 182, 1463, 709, 1544, 1446, 194, 1182, 1374, 904, 1311, 32, 1207, 1644, 705, 843, 6, 1673, 1372, 1075, 986, 758, 1228, 1174, 1114, 1392, 1425, 1564, 15, 630, 1252, 1287, 368, 542, 1434, 1217, 1219, 1052, 765, 1164, 1122, 1432, 971, 337, 1280, 1476, 775, 1358, 536, 661, 560, 551, 311, 1626, 180, 1429, 695, 287, 1070, 584, 471, 1633, 248, 1361, 26, 623, 380, 1481, 330, 759, 798, 1184, 1162, 1236, 1543, 263, 964, 1158, 1012, 1269, 1003, 18, 119, 534, 977, 1613, 853, 618, 1319, 1443, 122, 1060, 1083, 10, 778, 1491, 1511, 967, 1230, 923, 407, 1483, 595, 817, 1670, 1151, 1394, 1087, 214, 44, 1681, 1297, 1402, 795, 927, 1455, 1177, 1524, 1586, 644, 1337, 467, 1576, 539, 52, 1375, 1294, 394, 431, 152, 737, 750, 281, 298, 158, 133, 1303, 1500, 1007, 276, 880, 1214, 1145, 1180, 179, 828, 484, 1647, 1101, 1396, 954, 537, 1272, 1355, 225, 1465, 591, 1645, 521, 1679, 494, 1330, 351, 1617, 1091, 393, 84, 105, 1453, 22, 611, 1559, 266, 1021, 353, 1516, 1220, 1133, 1365, 1054, 385, 720, 348, 1663, 185, 919, 186, 191, 1580, 1192, 1548, 892, 176, 25, 1321, 1107, 697, 1144, 1638, 1199, 1428, 921, 792, 1045, 1408, 1100, 1518, 1307, 1405, 612, 1664, 738, 781, 1404, 358, 162, 1056, 1651, 736, 994, 582, 261, 387, 183, 739, 303, 676, 232, 729, 996, 384, 1588, 449, 17, 65, 436, 655, 656, 678, 1616, 1451, 1246, 706, 871, 716, 1614, 1000, 979, 391, 851, 1010, 72, 958, 486, 1502, 982, 532, 1067, 148, 131, 100, 544, 877, 1643, 354, 1378, 1342, 493, 1585, 915, 269, 1416, 250, 321, 1612, 717, 1400, 1493, 1042, 847, 89, 592, 383, 1234, 1218, 1554, 172, 882, 328, 209, 178, 1449, 600, 82, 790, 864, 1437, 1457, 557, 12, 1265, 1250, 946, 1267, 130, 616, 841, 316, 247, 461, 1454, 1059, 1166, 474, 1157, 960, 562, 400, 826, 707, 1225, 830, 850, 229, 1604, 295, 1106, 208, 256, 1561, 813, 654, 388, 1332, 1011, 1462, 535, 434, 1529, 955, 784, 645, 1313, 4, 1574, 663, 631, 972, 643, 563, 838, 417, 741, 237, 1055, 215, 1584, 842, 1507, 788, 1622, 723, 987, 806, 1433, 508, 464, 476, 1073, 1477, 589, 1655, 413, 746, 300, 1143, 856, 721, 356, 1155, 588, 546, 246, 918, 114, 1589, 527, 1590, 949, 193, 285, 312, 499, 641, 1563, 1382, 1602, 1110, 867, 703, 687, 1560, 763, 364, 574, 1040, 1620, 522, 1460, 455, 640, 1130, 783, 609, 54, 1324, 1147, 59, 156, 1193, 579, 1423, 601, 1201, 1046, 452, 711, 137, 1051, 1304, 597, 1259, 1061, 1621, 350, 787, 1386, 1251, 30, 76, 712, 1625, 506, 324, 702, 241, 53, 999, 224, 1605, 1480, 789, 196, 132, 175, 653, 724, 199, 169, 1390, 1020, 1556, 1537, 657, 745, 1212, 1520, 651, 1376, 1487, 543, 835, 704, 1452, 342, 908, 782, 1232, 500, 548, 1094, 1053, 586, 1501, 299, 1102, 155, 520, 398, 1154, 107, 31, 1640, 1253, 786, 1499, 773, 603, 1575, 742, 139, 1648, 1383, 28, 1276, 857, 41, 1013, 1023, 1568, 637, 1266, 1203, 688, 1466, 379, 1095, 933, 1019, 367, 833, 1606, 1533, 1183, 282, 170, 681, 1363, 939, 1176, 515, 1474, 147, 125, 329, 1002, 13, 968, 1553, 827, 74, 671, 397, 426, 1076, 280, 523, 27, 429, 1198, 167, 1513, 1050, 1282, 422, 415, 920, 492, 1111, 480, 1009, 776, 14, 1411, 1631, 338, 1505, 748, 991, 291, 1175, 530], 5279, 275588926], "output": 4438}, {"inputs": [[1410, 91, 226, 1098, 1182, 1554, 1247, 1064, 1540, 1087, 922, 1221, 1431, 572, 705, 379, 1184, 1560, 1540, 1170, 754, 524, 790, 1288, 1126, 885, 192, 955, 1008, 1434, 68, 1597, 1002, 1400, 1279, 1111, 139, 1425, 257, 285, 1323, 974, 1019, 760, 1450, 976, 1228, 255, 70, 1483, 1148, 863, 1573, 1372, 1066, 536, 695, 729, 108, 84, 1668, 1342, 354, 362, 1400, 364, 662, 1517, 1121, 70, 261, 708, 148, 477, 1543, 282, 67, 813, 1145, 215, 620, 405, 1632, 101, 1316, 1083, 970, 1636, 382, 79, 192, 863, 1078, 1206, 1301, 59, 515, 429, 834, 781, 200, 276, 1135, 1599, 1129, 974, 370, 1585, 857, 1474, 1278, 1161, 1527, 867, 504, 731, 1218, 1377, 1299, 208, 934, 59, 910, 916, 655, 964, 477, 988, 1059, 895, 1629, 625, 583, 414, 340, 22, 917, 541, 1514, 600, 1167, 1169, 522, 792, 968, 1131, 1205, 1200, 319, 1607, 840, 1538, 1482, 409, 962, 1364, 52, 75, 1647, 620, 1201, 1582, 502, 1144, 267, 737, 1547, 1325, 555, 1047, 664, 1027, 1201, 171, 167, 1501, 1625, 334, 793, 1079, 1635, 410, 656, 165, 45, 1533, 1279, 1058, 1337, 1398, 780, 1307, 320, 1345, 838, 1027, 1352, 618, 1497, 354, 303, 1664, 408, 566, 556, 178, 882, 1079, 216, 1653, 979, 138, 1555, 1514, 1271, 98, 530, 456, 1401, 342, 735, 590, 742, 1226, 207, 1275, 603, 342, 505, 1516, 804, 704, 1517, 1659, 190, 1, 1270, 29, 1404, 455, 205, 1283, 1490, 56, 410, 192, 184, 629, 1280, 1490, 1145, 834, 1286, 232, 208, 1153, 513, 424, 900, 727, 391, 133, 1577, 1635, 1674, 958, 908, 124, 1641, 1527, 1081, 1548, 879, 755, 1609, 1319, 1404, 415, 345, 535, 1329, 554, 598, 1173, 573, 465, 760, 1406, 120, 1255, 474, 1293, 395, 728, 914, 891, 114, 936, 442, 1479, 1097, 837, 1068, 1422, 694, 301, 724, 1671, 1635, 259, 1201, 481, 152, 1323, 1070, 1342, 269, 694, 509, 681, 445, 1379, 837, 277, 1435, 951, 469, 389, 1204, 1237, 1004, 979, 1305, 1558, 642, 889, 719, 1620, 544, 486, 158, 1409, 1431, 1022, 1598, 219, 1519, 1186, 536, 603, 702, 444, 70, 635, 653, 1564, 1285, 1646, 1614, 68, 137, 281, 741, 533, 987, 1023, 1278, 338, 230, 1666, 525, 254, 1223, 1231, 1037, 809, 326, 703, 374, 1436, 506, 72, 736, 307, 511, 641, 285, 1191, 475, 808, 1318, 1437, 474, 35, 714, 1216, 1051, 378, 463, 577, 551, 1305, 162, 821, 1317, 1177, 536, 1319, 1008, 579, 790, 1428, 1566, 490, 1088, 1026, 502, 873, 1109, 60, 355, 1257, 771, 12, 849, 1665, 358, 675, 1597, 146, 306, 1297, 548, 1301, 531, 666, 1548, 1158, 965, 206, 883, 1668, 273, 340, 396, 1083, 1228, 247, 1169, 377, 448, 88, 587, 1682, 367, 827, 520, 1086, 612, 646, 1664, 951, 131, 306, 1671, 1526, 1355, 744, 857, 686, 108, 1518, 250, 1105, 1357, 1443, 777, 912, 1610, 1528, 327, 50, 680, 928, 794, 1673, 88, 891, 86, 188, 81, 645, 1414, 1187, 459, 56, 550, 31, 1053, 641, 1613, 757, 1545, 998, 333, 1074, 672, 300, 1547, 885, 1681, 140, 851, 488, 1166, 336, 405, 899, 324, 440, 138, 1354, 875, 68, 1477, 193, 1619, 688, 1039, 923, 642, 911, 1586, 135, 475, 1123, 204, 908, 622, 1490, 1176, 359, 317, 1593, 167, 1443, 1622, 1011, 895, 845, 967, 1183, 680, 810, 1081, 627, 525, 1616, 868, 1532, 744, 764, 526, 1683, 643, 381, 488, 428, 1409, 1099, 1643, 1276, 747, 473, 962, 1001, 1644, 841, 817, 868, 1583, 998, 1259, 1188, 1518, 7, 1327, 162, 1642, 1396, 92, 1017, 405, 241, 1248, 1295, 344, 1436, 1320, 1507, 401, 308, 1544, 1338, 1551, 1512, 648, 1584, 678, 239, 258, 211, 1352, 163, 338, 332, 1558, 898, 206, 643, 1259, 122, 1058, 468, 1325, 1047, 493, 377, 339, 1529, 1091, 360, 1286, 63, 1111, 455, 1277, 690, 998, 1053, 366, 1417, 1244, 1520, 1594, 590, 465, 716, 504, 1176, 1496, 501, 426, 1003, 1622, 476, 770, 454, 1209, 1355, 1148, 615, 1061, 1517, 1147, 408, 1193, 646, 109, 380, 1566, 1395, 798, 125, 1107, 175, 476, 35, 1444, 681, 672, 682, 875, 1342, 1304, 880, 681, 686, 614, 1217, 548, 235, 1054, 734, 718, 1506, 1385, 1600, 7, 20, 133, 594, 1234, 1507, 1542, 1619, 387, 1392, 1666, 1117, 282, 523, 1085, 287, 1148, 971, 247, 195, 1368, 969, 1383, 1509, 1514, 902, 1396, 1441, 1172, 666, 152, 1004, 667, 621, 257, 733, 38, 1465, 846, 1676, 652, 1335, 1089, 219, 544, 380, 1172, 405, 694, 490, 1649, 136, 1007, 95, 167, 1510, 1356, 147, 472, 522, 406, 615, 1050, 461, 1264, 211, 1229, 683, 1402, 77, 567, 1575, 1114, 149, 878, 1558, 694, 1263, 1394, 1611, 1333, 1311, 198, 1476, 1269, 1416, 569, 550, 478, 144, 388, 1437, 935, 459, 1477, 582, 367, 877, 398, 834, 123, 254, 349, 1242, 342, 1207, 1547, 1465, 188, 1187, 816, 1540, 480, 1550, 501, 800, 1625, 568, 514, 1472, 1136, 772, 1253, 147, 939, 622, 255, 32, 1472, 5, 1133, 167, 221, 933, 1351, 1268, 1574, 214, 1421, 1331, 1642, 1098, 1302, 1163], 6608, 146437394], "output": 5941}, {"inputs": [[320, 304, 115, 281, 1339, 1503, 1673, 191, 371, 389, 1344, 911, 227, 1269, 188, 1687, 908, 890, 755, 334, 1283, 1258, 977, 774, 1029, 857, 663, 127, 967, 1440, 120, 831, 798, 433, 20, 945, 850, 1345, 1425, 1372, 483, 1359, 408, 226, 357, 1535, 856, 1398, 403, 522, 1509, 36, 792, 470, 1331, 1265, 1287, 962, 1357, 909, 269, 424, 1167, 468, 198, 382, 1516, 280, 667, 1358, 1178, 60, 98, 1712, 1689, 1600, 62, 953, 551, 392, 1112, 1267, 355, 420, 741, 1608, 954, 1588, 1520, 1080, 103, 1255, 1573, 1693, 544, 790, 399, 1128, 528, 1243, 1191, 618, 21, 1507, 24, 866, 916, 421, 1338, 185, 1059, 1102, 1085, 100, 1193, 579, 1454, 370, 162, 648, 1465, 140, 1134, 175, 1361, 260, 913, 585, 1300, 926, 882, 1692, 1460, 372, 637, 1562, 318, 887, 283, 1356, 1194, 333, 1117, 1218, 493, 1168, 524, 864, 1586, 567, 305, 412, 446, 1426, 1422, 1179, 1702, 1697, 753, 635, 1594, 1230, 89, 1306, 192, 1278, 366, 1521, 1026, 1171, 1456, 879, 959, 1672, 321, 781, 706, 1631, 268, 1635, 1217, 1488, 259, 1067, 393, 837, 1560, 1421, 1017, 673, 1508, 886, 426, 337, 323, 427, 422, 932, 616, 1523, 531, 1391, 1640, 845, 1543, 636, 1527, 1532, 1090, 14, 915, 1140, 553, 1199, 452, 1575, 555, 43, 609, 1554, 109, 1645, 1609, 1006, 799, 1455, 219, 1061, 1065, 56, 682, 416, 1281, 1176, 984, 1568, 1227, 306, 443, 1066, 1084, 1259, 1021, 1094, 5, 1580, 1504, 213, 41, 460, 247, 775, 614, 11, 341, 61, 873, 299, 1485, 1058, 829, 587, 898, 872, 291, 367, 249, 1461, 70, 1224, 1473, 878, 1376, 156, 27, 1131, 847, 1012, 787, 1192, 1113, 462, 116, 184, 1261, 995, 824, 45, 1246, 699, 186, 786, 611, 526, 360, 1262, 387, 1393, 1643, 1353, 2, 548, 183, 1328, 657, 490, 670, 743, 1185, 581, 1129, 1116, 1566, 214, 1220, 1389, 1536, 925, 1498, 331, 1321, 571, 796, 1164, 1522, 1088, 533, 497, 1617, 978, 445, 938, 1581, 1466, 451, 1695, 80, 439, 638, 1305, 1500, 1699, 876, 599, 1680, 1247, 1053, 1370, 860, 106, 1083, 1196, 477, 695, 509, 665, 960, 1232, 652, 776, 608, 621, 1438, 617, 1122, 1624, 1430, 1627, 434, 646, 797, 1519, 738, 1049, 1674, 1679, 600, 623, 1431, 1027, 986, 1072, 292, 1381, 347, 66, 901, 1040, 968, 1289, 381, 1584, 1340, 1055, 1175, 364, 68, 973, 1415, 696, 376, 1451, 989, 1124, 1698, 1182, 243, 595, 751, 818, 1161, 95, 933, 224, 459, 125, 1174, 1157, 756, 1501, 411, 1234, 1655, 998, 1019, 992, 46, 880, 474, 1347, 1354, 160, 1685, 1630, 1505, 1311, 272, 1228, 233, 1475, 1642, 924, 1188, 119, 502, 1497, 1014, 1133, 723, 1181, 114, 1264, 714, 500, 1544, 112, 1183, 1449, 352, 1069, 1569, 1382, 1020, 645, 1453, 454, 823, 1263, 523, 58, 812, 993, 842, 1481, 1279, 991, 942, 1385, 294, 486, 921, 1688, 71, 1480, 1097, 990, 42, 1242, 1545, 349, 30, 1591, 179, 1518, 52, 235, 822, 889, 328, 999, 8, 215, 687, 918, 1169, 1316, 1681, 760, 1325, 1469, 578, 1550, 1634, 1204, 1301, 961, 1016, 335, 712, 1367, 859, 1045, 37, 23, 313, 819, 205, 851, 1511, 161, 329, 1155, 1043, 134, 809, 1318, 1308, 1092, 1628, 1557, 1644, 79, 110, 345, 862, 237, 971, 1335, 1009, 1420, 597, 1213, 521, 562, 251, 1641, 1395, 1682, 1214, 83, 124, 1215, 368, 29, 414, 1156, 1446, 1479, 514, 296, 782, 1173, 1075, 492, 1063, 1474, 1282, 867, 1303, 662, 166, 770, 1000, 505, 1417, 1309, 123, 750, 1337, 1079, 569, 1406, 1700, 982, 1041, 1529, 931, 327, 34, 1115, 316, 858, 267, 319, 300, 572, 1121, 1515, 1548, 164, 619, 1057, 1254, 409, 1716, 1106, 713, 545, 330, 538, 1656, 1296, 718, 947, 997, 361, 1257, 703, 1317, 152, 835, 75, 1034, 1087, 1603, 605, 401, 163, 1703, 33, 588, 1028, 444, 369, 1659, 875, 1229, 1374, 1590, 1407, 1060, 1074, 817, 1401, 613, 1056, 473, 81, 1696, 1033, 1658, 293, 1253, 1615, 893, 1510, 516, 512, 633, 928, 966, 332, 208, 1540, 814, 1145, 732, 351, 496, 668, 806, 1621, 240, 295, 169, 664, 69, 1412, 1606, 1433, 417, 165, 1272, 232, 1369, 1070, 1030, 1323, 1525, 461, 1147, 1670, 1032, 203, 821, 1678, 568, 138, 4, 1038, 1365, 1375, 431, 1236, 1714, 263, 458, 1432, 432, 1648, 647, 1314, 1666, 22, 582, 1383, 199, 1118, 936, 170, 1268, 981, 189, 1411, 659, 1491, 1711, 705, 1036, 811, 1533, 996, 1429, 1284, 717, 1216, 150, 136, 958, 1572, 574, 946, 1150, 350, 1252, 900, 525, 543, 402, 1483, 1015, 885, 671, 1636, 1154, 1098, 1646, 407, 1341, 241, 1111, 1593, 577, 1428, 290, 904, 952, 97, 1276, 49, 591, 563, 1101, 722, 317, 540, 1159, 685, 1620, 1163, 841, 693, 839, 788, 378, 282, 789, 1551, 1616, 1684, 87, 491, 1332, 390, 702, 536, 530, 679, 1471, 220, 16, 761, 88, 1565, 1315, 359, 1710, 1002, 31, 810, 1008, 200, 238, 1614, 1713, 1363, 1260, 239, 479, 194, 615, 286, 807, 276, 1445, 222, 988, 1293, 719, 1482, 7, 539, 1219, 1441, 612, 1078, 1360, 1048, 948, 1237, 658, 1310, 1184, 1512, 737, 325, 728, 1277], 465, 508292145], "output": 239}]}} +{"id": "LeetCode/2673", "content": "# Maximize Win From Two Segments\n\nThere are some prizes on the **X-axis**. You are given an integer array `prizePositions` that is **sorted in non-decreasing order**, where `prizePositions[i]` is the position of the `ith` prize. There could be different prizes at the same position on the line. You are also given an integer `k`.\n\n\nYou are allowed to select two segments with integer endpoints. The length of each segment must be `k`. You will collect all prizes whose position falls within at least one of the two selected segments (including the endpoints of the segments). The two selected segments may intersect.\n\n\n* For example if `k = 2`, you can choose segments `[1, 3]` and `[2, 4]`, and you will win any prize i that satisfies `1 <= prizePositions[i] <= 3` or `2 <= prizePositions[i] <= 4`.\n\n\nReturn *the **maximum** number of prizes you can win if you choose the two segments optimally*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** prizePositions = [1,1,2,2,3,3,5], k = 2\n**Output:** 7\n**Explanation:** In this example, you can win all 7 prizes by selecting two segments [1, 3] and [3, 5].\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** prizePositions = [1,2,3,4], k = 0\n**Output:** 2\n**Explanation:** For this example, **one choice** for the segments is [3, 3] and [4, 4], and you will be able to get 2 prizes. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= prizePositions.length <= 105`\n* `1 <= prizePositions[i] <= 109`\n* `0 <= k <= 109`\n* `prizePositions` is sorted in non-decreasing order.\n\n\n \n\n\n.spoilerbutton {display:block; border:dashed; padding: 0px 0px; margin:10px 0px; font-size:150%; font-weight: bold; color:#000000; background-color:cyan; outline:0; \n}\n.spoiler {overflow:hidden;}\n.spoiler > div {-webkit-transition: all 0s ease;-moz-transition: margin 0s ease;-o-transition: all 0s ease;transition: margin 0s ease;}\n.spoilerbutton[value=\"Show Message\"] + .spoiler > div {margin-top:-500%;}\n.spoilerbutton[value=\"Hide Message\"] + .spoiler {padding:5px;}\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def maximizeWin(self, prizePositions: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.maximizeWin(**[[1, 1, 2, 2, 3, 3, 5], 2]) == 7\nassert my_solution.maximizeWin(**[[1, 2, 3, 4], 0]) == 2\nassert my_solution.maximizeWin(**[[1, 2, 3, 4, 5], 1]) == 4\nassert my_solution.maximizeWin(**[[2616, 2618, 2620, 2621, 2626, 2635, 2657, 2662, 2662, 2669, 2671, 2693, 2702, 2713, 2714, 2718, 2730, 2731, 2750, 2756, 2772, 2773, 2775, 2785, 2795, 2805, 2811, 2813, 2816, 2823, 2824, 2824, 2826, 2830, 2833, 2857, 2885, 2898, 2910, 2919, 2928, 2941, 2942, 2944, 2965, 2967, 2970, 2973, 2974, 2975, 2977, 3002, 3007, 3012, 3042, 3049, 3078, 3084, 3089, 3090, 3094, 3097, 3114, 3124, 3125, 3125, 3144, 3147, 3148, 3174, 3197, 3255, 3262, 3288, 3291, 3316, 3320, 3322, 3331, 3342, 3378, 3412, 3412, 3416, 3420, 3427, 3428, 3446, 3452, 3472, 3479, 3483, 3488, 3500, 3516, 3522, 3531, 3532, 3540, 3540, 3544, 3557, 3570, 3580, 3592, 3597, 3597, 3601, 3615, 3631, 3640, 3645, 3673, 3677, 3681, 3683, 3685, 3718, 3738, 3746, 3758, 3769, 3797, 3802, 3815, 3832, 3839, 3851, 3864, 3888, 3889, 3901, 3902, 3910, 3913, 3933, 3940, 3961, 3974, 3988, 4003, 4013, 4019, 4023, 4026, 4047, 4060, 4065, 4072, 4073, 4082, 4084, 4109, 4132, 4139, 4143, 4145, 4146, 4155], 6641]) == 159\nassert my_solution.maximizeWin(**[[3937, 3938, 3939, 3951, 3951, 3959, 3975, 3988, 3993, 4010, 4031, 4033, 4036, 4038, 4039, 4041, 4047, 4058, 4059, 4064, 4072, 4081, 4084, 4084, 4089, 4094, 4098, 4112, 4114, 4116, 4123, 4123, 4127, 4130, 4135, 4143, 4149, 4152, 4163, 4164, 4176, 4178, 4180, 4198, 4216, 4224, 4233, 4240, 4253, 4259, 4273, 4286, 4305, 4322, 4335, 4350, 4364, 4378, 4396, 4397, 4398, 4404, 4415, 4421, 4430, 4469, 4476, 4490, 4492, 4497, 4504, 4519, 4519, 4525, 4526, 4530, 4530, 4540, 4550, 4554, 4563, 4571, 4571, 4595, 4595, 4606, 4639, 4639, 4660, 4663, 4676, 4678, 4680, 4695, 4697, 4709, 4709, 4711, 4724, 4751, 4781, 4786, 4786, 4794, 4797, 4801, 4807, 4808, 4817, 4822, 4824, 4825, 4840, 4851, 4887, 4889, 4891, 4910, 4917, 4927, 4931, 4932, 4951, 4959, 4964, 4993, 4997, 5003, 5003, 5006, 5006, 5022, 5029, 5035, 5043, 5045, 5045, 5046, 5059, 5060, 5079, 5084, 5105, 5109, 5109, 5112, 5120, 5126, 5130, 5142, 5143, 5151, 5152, 5154, 5156, 5168, 5189, 5213, 5214, 5223, 5226, 5235, 5247, 5259, 5272, 5289, 5303, 5309, 5317, 5322, 5344, 5347, 5352, 5374, 5379, 5380, 5383, 5385, 5391, 5418, 5425, 5429, 5432, 5479, 5486, 5490, 5502, 5502, 5505, 5506, 5509, 5515, 5518, 5519, 5521, 5526, 5528, 5533, 5536, 5536, 5538, 5555, 5556, 5557, 5557, 5566, 5571, 5580, 5585, 5596, 5604, 5619, 5634, 5649, 5668, 5694, 5696, 5699, 5701, 5704, 5709, 5732, 5745, 5745, 5746, 5749, 5762, 5766, 5766, 5770, 5773, 5796, 5810, 5817, 5823, 5838, 5843, 5846, 5860, 5869, 5872, 5877, 5880, 5896, 5899, 5902, 5905, 5910, 5913, 5913, 5915, 5923], 220]) == 74\nassert my_solution.maximizeWin(**[[415288, 416336, 416780, 417164, 419922, 420866, 421399, 421501, 423010, 423524, 423709, 423948, 425094, 425754, 426119, 426709, 426735, 426765, 427996, 428353, 429030, 429288, 429866, 430018, 432194, 432463, 432595, 433785, 436041, 438907, 439684, 440741, 443014, 443041, 443714, 444384, 444816, 445584, 446750, 447461, 448391, 448908, 449019, 449040, 449058, 451322, 451575, 451725, 452221, 452292, 452832, 453051, 453542, 454620, 457091, 459311, 459844, 460931, 462022, 462375, 462687, 464670, 465424, 465930, 467740, 468158, 469906, 470861, 471421, 472771, 472930, 473042, 473383, 473751, 476165, 476779, 478436, 479490, 481215, 481781, 482147, 484372, 485161, 488039, 488728, 489591, 490259, 492542, 492866, 495823, 496729, 498602, 501398, 501560, 502157, 502458, 502486, 503315, 503679, 504090, 505532, 506787, 506858, 506873, 507416, 507708, 507735, 508035, 509557, 510743, 511784, 512680, 512985, 513468, 514010, 514230, 514905, 515129, 515415, 515959, 516080, 519872, 523531, 523844, 524656, 525478, 525674, 525938, 526351, 526410, 526657, 526700, 526975, 527299, 527501, 527684, 527941, 529840, 530232, 530454, 531248, 532176, 532228, 532976, 534579, 534720, 535615, 536452, 537848, 538315, 538390, 539558, 539711, 542729, 543041, 544991, 545040, 545385, 545692, 545713, 546174, 546631, 547431, 547866, 549373, 549463, 549799, 551368, 551554, 552213, 553636, 554369, 555124, 556077, 558142, 558149, 558588, 559580, 560429, 561470, 564174, 565686, 566368, 566820, 567304, 568791, 568981, 570008, 570073, 571549, 571952, 572272, 573747, 579507, 581030, 581348, 582148, 583708, 585240, 586386, 587014, 587196, 587916, 588043, 588794, 589803, 592156, 594703, 594739, 595673, 598887, 598967, 599759, 600214, 601251, 601509, 603597, 604002, 604662, 605317, 605851, 605888, 607114, 608043, 608746, 610284, 612061, 615398, 615959, 616251, 616568, 618018, 618297, 618882, 622423, 624707, 624769, 626565, 627656, 627717, 628485, 629337, 629954, 631681, 633092, 633667, 634093, 635001, 635704, 636342, 638816, 639012, 640721, 640757, 641568, 642249, 643159, 643660, 645912, 646279, 647791, 648050, 648719, 648762, 649006, 651763, 652282, 653361, 653733, 654377, 656288, 657280, 659153, 659527, 662296, 662573, 665248, 668896, 669184, 669589, 670676, 671884, 672214, 672552, 674550, 675950, 678704, 679612, 681171, 681467, 681883, 682258, 682696, 682875, 685080, 685380, 685578, 686223, 687383, 687902, 690306, 690701, 691816, 691941, 692039, 692119, 692318, 693286, 696521, 697180, 699595, 699718, 699751], 481169]) == 313\nassert my_solution.maximizeWin(**[[42, 53, 114, 116, 134, 181, 225, 271, 287, 292, 330, 363, 368, 371, 402, 429, 431, 432, 443, 479, 484, 493, 499, 500, 560, 579, 594, 597, 607, 607, 706, 728, 734, 750, 751, 768, 774, 791, 798, 813, 822, 836, 839, 857, 860, 861, 865, 888, 926, 939, 942, 950, 954, 986, 1010, 1012, 1019, 1043, 1045, 1056, 1066, 1084, 1155, 1159, 1192, 1210, 1244, 1258, 1264, 1284, 1291, 1295, 1311, 1316, 1320, 1324, 1361, 1380, 1406, 1408, 1424, 1433, 1442, 1449, 1464, 1468, 1472, 1476, 1487, 1502, 1554, 1581, 1618, 1619, 1629, 1682, 1701, 1704, 1705, 1742, 1751, 1768, 1778, 1783, 1803, 1809, 1811, 1822, 1829, 1832, 1846, 1872, 1878, 1891, 2021, 2032, 2049, 2101, 2166, 2181, 2198, 2202, 2225, 2235, 2237, 2262, 2262, 2266, 2274, 2294, 2357, 2361, 2386, 2389, 2397, 2413, 2443, 2455, 2470, 2528, 2546, 2560, 2595, 2609, 2626, 2652, 2724, 2758, 2765, 2788, 2800, 2843, 2847, 2876, 2878, 2882, 2884, 2902, 2908, 2947, 2947, 2952, 2975, 2983, 2991, 3010, 3020, 3029, 3040, 3062, 3063, 3088, 3118, 3122, 3151, 3157, 3193, 3198, 3226, 3247, 3263, 3270, 3292, 3320, 3326, 3326, 3329, 3330, 3358, 3382, 3402, 3412, 3418, 3438, 3462, 3469, 3470, 3486, 3541, 3580, 3627, 3632, 3639, 3676, 3679, 3680, 3681, 3726, 3728, 3728, 3733, 3754, 3758, 3773, 3776, 3783, 3826, 3903, 3912, 3956, 3977, 4006, 4015, 4015, 4018, 4021, 4051, 4070, 4075, 4104, 4138, 4147, 4158, 4188, 4189, 4190, 4220, 4222, 4222, 4242, 4285, 4287, 4300, 4324, 4354, 4358, 4387, 4434, 4449, 4450, 4459, 4464, 4494, 4534, 4538, 4553, 4554, 4627, 4632, 4637, 4644, 4686, 4688, 4772, 4786, 4798, 4859, 4893, 4899, 4954, 4990, 5023, 5056, 5089, 5093, 5102, 5118, 5121, 5154, 5156, 5259, 5266, 5268, 5272, 5272, 5280, 5288, 5324, 5374, 5416, 5420, 5439, 5483, 5510, 5512, 5557, 5567, 5586, 5623, 5632, 5642, 5665, 5670, 5682, 5683, 5699, 5715, 5747, 5766, 5771, 5773, 5845, 5865, 5884, 5886, 5927, 5953, 5963, 6033, 6046, 6072, 6073, 6101, 6125, 6125, 6131, 6150, 6152, 6155, 6160, 6165, 6169, 6169, 6180, 6246, 6321, 6328, 6330, 6331, 6346, 6367, 6424, 6461, 6475, 6477, 6481, 6509, 6566, 6566, 6598, 6620, 6654, 6684, 6697, 6732, 6732, 6752, 6757, 6765, 6767, 6799, 6805, 6830, 6877, 6886, 6938, 6938, 6941, 6978, 7002, 7003, 7102, 7132, 7136, 7155, 7176, 7188, 7198, 7200, 7230, 7266, 7284, 7313, 7322, 7322, 7345, 7362, 7387, 7388, 7400, 7404, 7447, 7450, 7462, 7467, 7480, 7493, 7497, 7516, 7560, 7584, 7590, 7600, 7646, 7652, 7652, 7664, 7669, 7688, 7697, 7709, 7720, 7725, 7783, 7807, 7811, 7812, 7843, 7843, 7845, 7859, 7876, 7884, 7900, 7901, 7911, 7920, 7927, 7968, 7974, 7987, 8000, 8007, 8027, 8054, 8092, 8093, 8105, 8114, 8217, 8217, 8226, 8227, 8235, 8303, 8313, 8315, 8341, 8348], 8550]) == 449\nassert my_solution.maximizeWin(**[[305, 305, 305, 305, 305, 306, 306, 306, 306, 306, 306, 307, 307, 307, 307, 308, 308, 309, 309, 309, 309, 310, 310, 310, 310, 311, 311, 311, 311, 311, 312, 312, 312, 312, 312, 312, 312, 312, 312, 313, 313, 314, 314, 314, 314, 314, 315, 315, 315, 315, 316, 316, 316, 316, 317, 317, 317, 317, 317, 318, 318, 319, 319, 319, 319, 320, 321, 321, 321, 321, 321, 321, 322, 322, 322, 322, 322, 323, 323, 323, 323, 323, 323, 324, 324, 324, 324, 325, 325, 325, 325, 325, 326, 326, 327, 327, 327, 329, 329, 329, 329, 329, 330, 330, 330, 330, 330, 330, 331, 331, 331, 331, 331, 331, 332, 332, 332, 332, 332, 333, 333, 333, 334, 334, 335, 335, 335, 335, 336, 336, 336, 336, 336, 336, 336, 336, 336, 337, 337, 337, 337, 338, 338, 338, 338, 338, 338, 338, 339, 339, 339, 339, 340, 340, 340, 340, 340, 340, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 342, 342, 342, 342, 342, 342, 342, 343, 343, 344, 344, 344, 345, 345, 345, 347, 347, 347, 347, 347, 348, 348, 348, 348, 348, 349, 349, 349, 349, 349, 350, 350, 350, 350, 350, 351, 352, 352, 352, 352, 353, 353, 353, 353, 353, 353, 354, 354, 354, 354, 354, 354, 355, 355, 355, 355, 355, 356, 356, 356, 356, 357, 357, 357, 357, 358, 358, 358, 359, 359, 359, 359, 359, 360, 360, 361, 361, 361, 362, 362, 362, 362, 362, 363, 363, 363, 363, 364, 364, 364, 364, 365, 365, 366, 366, 367, 367, 367, 367, 367, 367, 367, 367, 367, 368, 368, 368, 368, 368, 368, 368, 368, 369, 369, 369, 370, 370, 370, 370, 370, 370, 370, 370, 371, 371, 371, 371, 371, 372, 372, 372, 372, 373, 374, 374, 374, 375, 376, 376, 377, 377, 377, 377, 377, 377, 377, 378, 378, 378, 379, 379, 379, 379, 379, 379, 380, 381, 382, 382, 382, 382, 382, 383, 383, 384, 384, 385, 385, 385, 386, 386, 386, 387, 387, 387, 387, 388, 388, 388, 388, 389, 389, 389, 389, 389, 389, 389, 390, 391, 391, 391, 392, 392, 392, 393, 393, 393, 393, 393, 393, 394, 394, 394, 394, 394, 395, 395, 395, 395, 395, 395, 395, 395, 396, 396, 396, 396, 396, 396, 397, 397, 398, 398, 398, 398, 398, 398, 399, 399, 399, 400, 400, 400, 400, 401, 401, 401, 402, 402, 402, 402, 402, 402, 402, 403, 403, 403, 403, 404, 404, 404, 404, 404, 404, 405, 405, 405, 405, 405, 405, 406, 406, 406, 406, 406, 406, 406, 406, 407, 407, 407, 407, 407, 407, 408, 408, 408, 409, 409, 409, 409, 409, 409, 410, 410, 410, 410, 410, 410, 411, 411, 411, 411, 412, 412, 413, 413, 413, 413, 413, 414, 414, 414, 414, 415, 415, 415, 415, 416, 416, 416, 417, 417, 417, 418, 418, 418, 418, 418, 418, 419, 419, 419, 419, 419, 419, 419, 419, 419, 420, 420, 420, 420, 420, 420, 422, 422, 422, 422, 422, 423, 424, 424, 424, 424, 424, 424, 425, 425, 425, 425, 425, 425, 426, 426, 427, 428, 428, 428, 428, 428, 428, 428, 429, 429, 429, 429, 430, 430, 430, 430, 431, 431, 432, 432, 432, 432, 432, 432, 433, 433, 433, 433], 324]) == 553\nassert my_solution.maximizeWin(**[[81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94], 82]) == 896\nassert my_solution.maximizeWin(**[[41680, 41688, 41709, 41716, 41742, 41744, 41753, 41778, 41783, 41791, 41796, 41833, 41840, 41867, 41874, 41888, 41897, 41904, 41977, 41982, 42008, 42022, 42039, 42042, 42046, 42088, 42128, 42138, 42148, 42150, 42194, 42244, 42263, 42280, 42288, 42301, 42330, 42384, 42385, 42389, 42390, 42415, 42427, 42459, 42480, 42486, 42551, 42577, 42588, 42591, 42610, 42611, 42637, 42639, 42653, 42672, 42689, 42702, 42756, 42764, 42792, 42796, 42800, 42841, 42858, 42862, 42871, 42914, 42915, 42921, 42932, 42956, 43070, 43157, 43192, 43198, 43251, 43265, 43358, 43384, 43394, 43403, 43414, 43442, 43453, 43465, 43484, 43505, 43546, 43595, 43623, 43637, 43647, 43717, 43734, 43744, 43754, 43756, 43855, 43864, 43896, 43994, 43995, 44017, 44039, 44055, 44082, 44098, 44121, 44159, 44167, 44219, 44243, 44286, 44290, 44340, 44351, 44396, 44456, 44464, 44530, 44530, 44646, 44664, 44668, 44676, 44710, 44715, 44719, 44721, 44729, 44734, 44793, 44803, 44822, 44842, 44843, 44860, 44890, 44891, 44943, 44959, 44973, 44992, 45008, 45028, 45059, 45060, 45074, 45081, 45082, 45095, 45099, 45101, 45105, 45107, 45117, 45121, 45132, 45145, 45146, 45151, 45191, 45239, 45256, 45266, 45270, 45300, 45330, 45337, 45374, 45396, 45413, 45437, 45437, 45467, 45470, 45481, 45490, 45497, 45508, 45667, 45680, 45691, 45721, 45727, 45732, 45805, 45814, 45832, 45840, 45861, 45861, 45864, 45878, 45883, 45895, 45897, 45932, 45969, 46007, 46029, 46081, 46086, 46120, 46125, 46156, 46169, 46180, 46184, 46256, 46308, 46315, 46317, 46322, 46344, 46363, 46366, 46378, 46414, 46419, 46426, 46429, 46504, 46505, 46506, 46508, 46513, 46533, 46565, 46575, 46576, 46598, 46599, 46654, 46717, 46719, 46728, 46736, 46756, 46758, 46767, 46788, 46811, 46835, 46845, 46864, 46916, 46975, 47013, 47062, 47063, 47069, 47087, 47090, 47093, 47111, 47119, 47127, 47132, 47156, 47188, 47209, 47213, 47275, 47279, 47317, 47343, 47355, 47368, 47392, 47392, 47415, 47434, 47442, 47484, 47531, 47575, 47575, 47577, 47631, 47635, 47669, 47710, 47716, 47730, 47732, 47770, 47833, 47843, 47857, 47926, 47941, 47947, 47962, 47963, 47976, 48005, 48016, 48081, 48090, 48100, 48111, 48175, 48176, 48189, 48201, 48201, 48267, 48404, 48490, 48519, 48530, 48624, 48667, 48736, 48805, 48844, 48885, 48893, 48906, 48927, 48929, 48941, 48984, 48990, 49045, 49057, 49070, 49144, 49222, 49274, 49276, 49286, 49301, 49318, 49337, 49340, 49377, 49407, 49413, 49417, 49419, 49436, 49478, 49492, 49535, 49566, 49646, 49711, 49744, 49747, 49788, 49795, 49824, 49829, 49873, 49922, 49947, 49989, 50005, 50022, 50036, 50093, 50148, 50161, 50178, 50192, 50194, 50208, 50218, 50231, 50238, 50254, 50261, 50278, 50291, 50304, 50307, 50363, 50365, 50367, 50398, 50418, 50456, 50467, 50469, 50474, 50501, 50538, 50556, 50568, 50573, 50577, 50640, 50652, 50685, 50693, 50700, 50706, 50725, 50746, 50766, 50768, 50781, 50834, 50850, 50850, 50881, 50890, 51006, 51020, 51026, 51031, 51046, 51051, 51074, 51082, 51106, 51122, 51138, 51143, 51190, 51206, 51218, 51243, 51338, 51343, 51356, 51370, 51371, 51418, 51440, 51462, 51479, 51487, 51488, 51496, 51549, 51607, 51642, 51672, 51687, 51688, 51700, 51705, 51771, 51771, 51782, 51824, 51837, 51850, 51860, 51867, 51892, 51908, 51918, 51985, 52001, 52005, 52030, 52051, 52064, 52132, 52161, 52207, 52217, 52240, 52309, 52332, 52363, 52368, 52421, 52484, 52553, 52571, 52594, 52675, 52687, 52719, 52724, 52799, 52808, 52987, 53000, 53010, 53111, 53133, 53135, 53153, 53164, 53185, 53229, 53263, 53269, 53283, 53286, 53297, 53310, 53315, 53372, 53377, 53380, 53402, 53438, 53443, 53506, 53509, 53546, 53599, 53612, 53644, 53693, 53718, 53721, 53735, 53746, 53787, 53827, 53896, 53911, 53922, 53939, 53961, 53972, 53989, 54033, 54041, 54047, 54072, 54077, 54089, 54106, 54112, 54133, 54185, 54197, 54201, 54209, 54224, 54254, 54309, 54342, 54348, 54364, 54369, 54369, 54397, 54419, 54430, 54467, 54545, 54559, 54617, 54623, 54724, 54735, 54736, 54780, 54781, 54785, 54792, 54793, 54830, 54882, 54896, 54972, 55007, 55020, 55034, 55090, 55092, 55148, 55200, 55202, 55219, 55221, 55222, 55274, 55276, 55287, 55316, 55324, 55343, 55379, 55390, 55394, 55434, 55435, 55443, 55464, 55549, 55553, 55556, 55586, 55620, 55622, 55639, 55643, 55676, 55676, 55683, 55748, 55778, 55812, 55815, 55957, 55958, 55986, 55996, 56013, 56016, 56025, 56054, 56074, 56076, 56087, 56120, 56122, 56129, 56148, 56150, 56160, 56207, 56209, 56284, 56342, 56369, 56438, 56466, 56477, 56493, 56509, 56521, 56542, 56557, 56579, 56605, 56637, 56640, 56694, 56705, 56731, 56745, 56747, 56771, 56783, 56797, 56811, 56841, 56864, 56904, 56921, 56944, 56967, 56995, 57046, 57072, 57107, 57112, 57113, 57115, 57148, 57215, 57235, 57236, 57258, 57272, 57277, 57280, 57282, 57285, 57302, 57309, 57331, 57334, 57370, 57377, 57440, 57442, 57443, 57538, 57589, 57609, 57611, 57621, 57623, 57655, 57681, 57690, 57703, 57730, 57758, 57769, 57788, 57830, 57831, 57847, 57863, 57872, 57880, 57885, 57896, 57921, 58005, 58008, 58011, 58040, 58061, 58086, 58100, 58138, 58185, 58225, 58228, 58241, 58260, 58275, 58330, 58338, 58388, 58390, 58410, 58441, 58484, 58490, 58575, 58621, 58627, 58670, 58716, 58724, 58728, 58742, 58743, 58745, 58771, 58813, 58830, 58838, 58848, 58852, 58862, 58930, 58934, 59009, 59053, 59053, 59079, 59098, 59112, 59129, 59148, 59207, 59208, 59227, 59257, 59457, 59468, 59498, 59506, 59517, 59517, 59552, 59554, 59556, 59600, 59600, 59645, 59681, 59685, 59686, 59740, 59761, 59774, 59799, 59802, 59833, 59876, 59905, 59962, 59972, 60022, 60027, 60036, 60075, 60083, 60105, 60144, 60160, 60171, 60173, 60194, 60220, 60264, 60273, 60280, 60299, 60302, 60336, 60342, 60361, 60366, 60377, 60524, 60532, 60567, 60568, 60574, 60575, 60609, 60610, 60618, 60626, 60629, 60641, 60666, 60680, 60693, 60693, 60728, 60731, 60734, 60794, 60804, 60866, 60881, 60907, 60922, 60954, 60955, 60987, 61074, 61075, 61089, 61101, 61101, 61147, 61215, 61225, 61280, 61300, 61328, 61351, 61358, 61389, 61406, 61410, 61417, 61431, 61446, 61448, 61461, 61471, 61490, 61498, 61510, 61512, 61550, 61551, 61569, 61579, 61620, 61647, 61684, 61731, 61754, 61764, 61811, 61818, 61878, 61880, 61881, 61901, 61950, 61983, 62012, 62017, 62024, 62025, 62081, 62139, 62148, 62204, 62212, 62250, 62251, 62272, 62297, 62334, 62336, 62337, 62363, 62375, 62382, 62403, 62412, 62425, 62450, 62461, 62473, 62503, 62530, 62539, 62555, 62566, 62568, 62580, 62586, 62590, 62599, 62645, 62659, 62665, 62686, 62729, 62750, 62760, 62768, 62772, 62796, 62838, 62890, 62904, 62935, 62964, 63019, 63021, 63021, 63069, 63086, 63099, 63099, 63107, 63154], 904]) == 111\nassert my_solution.maximizeWin(**[[375344743, 375811382, 376205354, 376583225, 377326584, 377528242, 377556486, 377561264, 377747991, 377749793, 377838108, 377905270, 378225612, 378389478, 378638215, 379501835, 379550808, 380108794, 380146950, 380691791, 381393652, 382408980, 382670758, 383132819, 384531606, 384601605, 384619910, 384848369, 385221568, 385231233, 385753380, 385949112, 386833113, 387371507, 387648433, 387669754, 387712024, 387960080, 388599148, 388931923, 389889842, 390466891, 390628019, 390915526, 391471142, 391481330, 391883528, 392131052, 392170820, 392873875, 392948257, 393200244, 393217847, 393227344, 393548051, 393564034, 394717709, 396648759, 397290396, 397473501, 398172233, 398431650, 398509186, 398829475, 398890185, 399201278, 399598370, 400335640, 400886541, 401423147, 401596279, 402068593, 402900993, 403027769, 403515881, 404956177, 405354937, 406036459, 406682171, 406818231, 407126246, 407374429, 408011409, 408535761, 408642304, 408894488, 409787453, 409807299, 410313373, 410614153, 410808004, 412195139, 412641197, 413922900, 414109622, 414287986, 414382334, 414693905, 414876837, 414976334, 415371268, 415716409, 416429736, 417258167, 417426100, 417635786, 418804503, 419050297, 419773033, 419878382, 420064412, 420497879, 421027960, 421424811, 422087830, 422107655, 423025413, 423083263, 423112230, 423298825, 423787582, 423961843, 424292689, 424939243, 425056934, 426223721, 426295609, 426567665, 426787636, 426941716, 427947471, 428503139, 428511729, 428520675, 428605077, 428794088, 429514626, 429804206, 430098631, 430158655, 430187406, 431583883, 431785301, 431926967, 432049526, 432306436, 432312542, 432313473, 432578851, 432655672, 432730640, 432869346, 432891421, 433292749, 433420800, 433969706, 434257007, 434430199, 435164434, 435602256, 435627677, 435930182, 436132585, 436349199, 437135467, 437454940, 437774216, 438159481, 438169635, 438664688, 439265721, 439715813, 440271155, 441010442, 441166897, 441192055, 441526923, 441602630, 442143100, 442983517, 443071496, 443328899, 444772683, 444879199, 445810350, 445917622, 445978681, 446227097, 446309463, 446647098, 446660098, 446962967, 446983709, 447278253, 447387622, 447975621, 448104047, 448134985, 449126767, 449355419, 450508025, 450608498, 450820492, 451893936, 452096442, 452687744, 453609510, 453829020, 454334559, 454382390, 454694452, 454779520, 455125333, 455286585, 456080969, 456618332, 456657407, 456706375, 457622753, 457948197, 458337647, 458510749, 458953193, 459062696, 459084205, 459219347, 459311702, 459548662, 459549465, 459825411, 460486502, 460809812, 461672674, 461736577, 462144905, 462163457, 462705146, 462799115, 462978062, 463075675, 463405864, 464150809, 464381247, 464468421, 464610198, 465077145, 465264285, 465490378, 465892133, 466142165, 466383208, 466589265, 466623751, 466642223, 466849580, 467392187, 467473187, 467737515, 467770346, 468391734, 468396254, 468597025, 468706659, 469545260, 469548802, 470531856, 470542741, 471253163, 471465840, 471737215, 471830132, 471986170, 472111291, 472895883, 473190408, 473759623, 473819369, 474476756, 474721682, 475025035, 476043766, 476571257, 476949002, 477983505, 477995897, 478330583, 478443218, 478544130, 478654201, 479212071, 479478225, 479514198, 479651156, 479722039, 479850621, 479962461, 480240876, 480739017, 480849313, 481243652, 481535682, 482141304, 482672032, 483057639, 483090707, 483303439, 483522540, 483863060, 484020556, 484447303, 484555767, 484891807, 484930678, 485791276, 486086663, 486481282, 487117636, 487339158, 488195829, 488425064, 488614205, 488865762, 489011683, 489415853, 489698506, 490623722, 491078678, 491155152, 491486345, 491578202, 491838937, 492031953, 492970749, 493351260, 493457725, 494074574, 494269621, 494789844, 494946902, 495248135, 495386431, 495957495, 496763514, 497038953, 497294685, 498395649, 498621425, 499151628, 499908505, 500235558, 500249429, 501009330, 501968415, 502462284, 502705458, 502850996, 502975948, 502996862, 503229333, 503305824, 503476011, 503694479, 504502392, 504572661, 505026750, 505598419, 505860413, 505947985, 506033217, 506379896, 506814214, 507063145, 507229613, 507484911, 507509670, 508076993, 508356875, 508391331, 508545177, 508904924, 509051708, 509426866, 510149081, 510550051, 511307779, 511617039, 512319546, 512559298, 512588607, 512705920, 512911566, 513030763, 513065181, 513341070, 513845222, 513935530, 513974837, 515145391, 515431408, 515532844, 515556141, 516178966, 516923647, 517363175, 517610088, 517753193, 518129924, 518251104, 519053349, 519178507, 519586386, 519631377, 519815449, 520861973, 521061436, 521390965, 521845209, 522627131, 523923949, 524275138, 524313650, 524706243, 524800064, 525328862, 525525500, 525705965, 526221370, 526791616, 526847612, 526915034, 527578210, 528211713, 528265211, 528372502, 528880170, 528938383, 529446502, 529528273, 530317143, 530415876, 531202886, 532006161, 532162179, 532308455, 532612053, 533497184, 533741102, 534317878, 534529892, 535452515, 535494236, 535833656, 536481616, 537282762, 537606885, 537653689, 537672732, 537672816, 537822499, 537835973, 538592250, 538987852, 541700470, 541925452, 542048479, 542316513, 543350704, 543721539, 543784778, 544022143, 544328076, 544580127, 545419317, 545652938, 546444569, 546605041, 547495534, 547508819, 548398765, 548453243, 548471005, 549074107, 549115921, 549565220, 549609045, 549691959, 550521237, 551256123, 551765796, 551836039, 552190804, 552208151, 552555907, 552577264, 552631110, 552772714, 553645105, 554255016, 554439844, 554517304, 554991642, 555126826, 555177263, 555776402, 555936697, 555995953, 556063912, 556209379, 557827557, 559259489, 559337656, 559518477, 562653900, 562722644, 566137440, 566334015, 566479511, 566545447, 567244640, 567805121, 567862874, 567866338, 567962873, 568000243, 568254541, 568520531, 568582931, 568781617, 569284645, 570023442, 570864078, 571430710, 571700363, 572288554, 572958785, 573342488, 574241106, 574396274, 575692079, 575759636, 575934276, 576030593, 576099190, 576381414, 576597305, 576735021, 577128503, 577549056, 578198224, 578604209, 578879551, 579297101, 579327915, 579328534, 579436584, 579690565, 580161662, 580465749, 580555114, 580607032, 580869317, 581015151, 581054006, 581740778, 582049879, 582707046, 582791911, 582932696, 583849788, 583888998, 583930305, 583950123, 584953605, 585065301, 585210530, 585211547, 585636106, 585685042, 585695842, 585979096, 586410456, 586544943, 586854190, 587389470, 588902969, 589110813, 589172115, 589442181, 589491893, 589627942, 589717284, 590226577, 591062097, 591498207, 591515537, 591961646, 592014281, 592148740, 592286436, 592310300, 593246141, 593256206, 593380442, 593463818, 594781426, 594824070, 594831879, 594931949, 595368996, 596616057, 596716001, 596766017, 597704640, 598207133, 598404617, 599014207, 600293385, 600893195, 601355588, 601401383, 601870213, 602179061, 602386885, 603285355, 603673352, 603814135, 603889490, 604160860, 604312475, 604457867, 604587468, 605534418, 606022456, 606182373, 606483037, 606543133, 606620572, 606680214, 606754278, 606861176, 607638574, 607970824, 608629492, 609078120, 609518013, 609543374, 609721759, 609815688, 610025373, 610341639, 610601058, 610915945, 611205241, 611398319, 611424055, 611560824, 612067602, 612361884, 613177111, 613268532, 613316638, 613360679, 613481599, 613540965, 613576196, 613662913, 614781590, 615234975, 615772253, 615839466, 616519630, 616566216, 617672222, 618287514, 618331620, 619228897, 619790029, 620639284, 621011016, 621204960, 621554920, 621656884, 621713132, 621746466, 622014189, 622077255, 622105397, 623545203, 623741987, 623986256, 624053130, 624056468, 624617896, 624919921, 625587862, 625995770, 626489644, 626949220, 627095975, 627223355, 627599604, 628221303, 628449345, 628533427, 628616044, 628676847, 628723633, 629309297, 629995345, 630602404, 630718176, 631094359, 631165472, 631482602, 631865374, 631908049, 632337805, 632384667, 632562050, 632937752, 632944941, 633949052, 634216296, 634312014, 634497021, 635035374, 635334368, 635437514, 635844654, 636487908, 636509466, 636544329, 636635063, 636733046, 637404075, 637485348, 637761723, 638353788, 639557577, 640338772, 641132684, 641179240, 641291929, 641581172, 641929244, 642104635, 642242207, 642719168, 642733046, 643020637, 643287367, 643306171, 643511443, 645013995, 645601298, 646723775, 647025401, 647091716, 647549737, 647602032, 647745368, 648195732, 648239529, 648291198, 648492767, 648628349, 648938617, 649232505, 649542291, 649920714, 649992363, 650066607, 651391427, 651852353, 652217492, 653360977, 653363896, 654667280, 654812987, 654875840, 655303201, 655716834, 655833352, 655875258, 656629940, 656687292, 656691516, 656768575, 657118644, 657519771, 657755248, 658727856, 659290820, 659683824, 659947222, 661023468, 661799735, 663011594, 663361297, 664668990, 665107775, 665157395, 665204395, 665268199, 666226327, 666566906, 667469150, 667561265, 667845206, 668204698, 668925972, 669141092, 669951127, 670017909, 670482257, 670623785, 670636197, 671570168, 671684871, 671930196, 672671805, 673027659, 673119830, 673162196, 673234493, 673316493, 673329275, 673432596, 673544316, 673738935, 673939103, 674061518, 674757718, 675159973, 675220679, 675436537, 675513175, 676290230, 676353888, 676975711, 677248545, 677651077, 678210480, 678281195, 678469486, 679350651, 679440193, 679712384, 679794445, 679995747, 680027679, 680126827, 680258571, 680483943, 681092177, 681460555, 681500685, 681928438, 681934149, 682058541, 682084906, 682184253, 682263189, 682756635, 682918460, 682970775, 683411383, 684438392, 684512200, 684796193, 684907127, 684991420, 685024043, 685151132, 685357964, 685466175, 685542727, 685628248, 686199513, 686393669, 686667810, 687151730, 687573563, 687767688, 688315254, 689097050, 689669555, 690075664, 690195821, 690883841, 691044829, 691387338, 691410157, 692029721, 692208321, 692475807, 692525097, 692622968, 692642614, 693725449, 694012046, 694105886, 695248149, 695422111, 696120578, 696517217, 696797852, 697455884, 697929593, 698208231, 698291130, 698325785, 698897587, 699124433, 699140763, 699203146, 699590753, 700210933, 700632895, 700746471, 700768506, 700773482, 701435056, 701490549, 702167169, 702408048, 702594727, 702601892, 702930476, 703149836, 703770797, 704035508, 704301769, 705318460, 705367634, 705374889, 705680362, 705779949, 705865549, 706062106, 706785041, 707085704, 708318577, 708630436, 708698070, 709363760, 709656921, 709718208, 710177558, 710180281, 710680888, 710947453, 710955794, 711047125, 711199046, 712103764, 712297542, 712441530, 712448521, 712968765, 712998917, 713385290, 713585051, 713820360, 714237341, 714320431, 714663700, 715239638, 715492814, 715681817, 715757996, 716457187, 716492672, 716509274, 716745700, 716907444, 717911595, 718326366, 718725158, 719711744, 719773658, 720200365, 720304182, 721080555, 721375707, 721672298, 721816769, 722352866, 722525382, 723569379, 724190317, 724282107, 724312445, 726082999, 726386683, 726953107, 727096456, 727613551, 729390276, 729396314, 729937239, 730636535, 730798866, 731192263, 731286811, 731762769, 732023214, 732425138, 732652337, 732937629, 733192730, 733417087, 733988673, 734667968, 735186603, 735732733, 735904246, 735946124, 736819009, 737076557, 737378851, 737809387, 738332574, 739197874, 740379255, 741213342, 741230007, 741419762, 741680130, 741792699, 742324623, 743638624, 743719025, 743817400, 745334876, 745341428, 745538266, 745539016, 745736581, 746260981, 746359496, 746689829, 747153988, 747834409, 748492938, 748897793, 749073992, 749865861, 751189892, 751287234, 751810001, 751920224, 752330766, 752497265, 752697708, 753138045, 753518988, 754270893, 754703161], 172]) == 3\nassert my_solution.maximizeWin(**[[5626, 5627, 5630, 5631, 5633, 5634, 5638, 5639, 5639, 5643, 5651, 5653, 5653, 5653, 5653, 5656, 5657, 5657, 5661, 5673, 5674, 5679, 5685, 5690, 5692, 5694, 5695, 5699, 5700, 5705, 5705, 5711, 5711, 5713, 5714, 5715, 5716, 5717, 5717, 5717, 5720, 5720, 5721, 5724, 5725, 5728, 5729, 5731, 5731, 5731, 5732, 5736, 5738, 5739, 5740, 5742, 5742, 5743, 5747, 5752, 5752, 5759, 5764, 5766, 5767, 5769, 5771, 5773, 5776, 5777, 5779, 5781, 5784, 5788, 5790, 5796, 5799, 5803, 5805, 5806, 5809, 5810, 5815, 5820, 5822, 5822, 5827, 5829, 5832, 5833, 5834, 5839, 5839, 5845, 5846, 5847, 5849, 5850, 5851, 5852, 5855, 5859, 5864, 5865, 5869, 5869, 5875, 5879, 5884, 5885, 5891, 5894, 5895, 5895, 5896, 5896, 5897, 5897, 5900, 5905, 5911, 5913, 5916, 5917, 5921, 5922, 5924, 5926, 5932, 5934, 5935, 5945, 5946, 5951, 5953, 5955, 5956, 5956, 5957, 5958, 5958, 5967, 5967, 5967, 5968, 5969, 5973, 5975, 5976, 5980, 5980, 5982, 5987, 5989, 5994, 5996, 5998, 6002, 6003, 6005, 6014, 6019, 6023, 6027, 6030, 6035, 6036, 6039, 6039, 6043, 6043, 6051, 6051, 6051, 6053, 6054, 6055, 6061, 6064, 6066, 6066, 6068, 6068, 6069, 6072, 6072, 6075, 6075, 6075, 6075, 6077, 6077, 6078, 6079, 6080, 6086, 6088, 6092, 6094, 6095, 6096, 6102, 6109, 6110, 6110, 6111, 6111, 6111, 6116, 6116, 6117, 6122, 6127, 6131, 6133, 6136, 6136, 6137, 6142, 6142, 6142, 6146, 6147, 6148, 6149, 6154, 6154, 6163, 6172, 6175, 6176, 6182, 6183, 6185, 6186, 6190, 6193, 6194, 6201, 6202, 6203, 6208, 6209, 6219, 6220, 6221, 6222, 6224, 6225, 6225, 6225, 6227, 6227, 6230, 6235, 6240, 6243, 6244, 6245, 6246, 6247, 6251, 6254, 6255, 6256, 6260, 6261, 6264, 6265, 6266, 6266, 6267, 6268, 6269, 6270, 6271, 6273, 6279, 6280, 6281, 6282, 6286, 6287, 6287, 6287, 6288, 6289, 6289, 6290, 6291, 6292, 6298, 6300, 6303, 6305, 6313, 6316, 6317, 6318, 6320, 6322, 6328, 6331, 6331, 6334, 6334, 6336, 6336, 6337, 6340, 6347, 6347, 6352, 6355, 6355, 6357, 6361, 6361, 6363, 6366, 6371, 6373, 6374, 6375, 6377, 6380, 6385, 6395, 6395, 6401, 6407, 6413, 6416, 6418, 6419, 6419, 6419, 6420, 6430, 6433, 6435, 6437, 6440, 6440, 6445, 6446, 6449, 6450, 6452, 6452, 6452, 6454, 6455, 6456, 6458, 6462, 6465, 6467, 6469, 6477, 6478, 6483, 6492, 6493, 6494, 6495, 6496, 6497, 6497, 6497, 6498, 6499, 6501, 6503, 6507, 6509, 6510, 6510, 6511, 6511, 6513, 6515, 6518, 6518, 6519, 6519, 6524, 6525, 6526, 6527, 6529, 6535, 6536, 6536, 6543, 6546, 6548, 6552, 6553, 6554, 6555, 6560, 6564, 6565, 6566, 6572, 6574, 6579, 6580, 6583, 6586, 6591, 6599, 6599, 6600, 6605, 6610, 6614, 6614, 6616, 6628, 6630, 6633, 6640, 6641, 6644, 6646, 6646, 6650, 6651, 6652, 6653, 6654, 6655, 6659, 6659, 6660, 6663, 6663, 6664, 6665, 6668, 6671, 6671, 6673, 6673, 6674, 6681, 6685, 6686, 6686, 6690, 6693, 6696, 6697, 6699, 6701, 6703, 6704, 6707, 6708, 6708, 6711, 6714, 6715, 6717, 6718, 6724, 6726, 6727, 6728, 6732, 6743, 6743, 6743, 6744, 6746, 6747, 6752, 6752, 6753, 6754, 6754, 6754, 6758, 6760, 6760, 6764, 6765, 6782, 6783, 6791, 6792, 6794, 6796, 6796, 6803, 6804, 6804, 6808, 6815, 6817, 6819, 6819, 6822, 6822, 6826, 6827, 6835, 6837, 6837, 6837, 6837, 6840, 6841, 6844, 6847, 6850, 6850, 6852, 6852, 6852, 6855, 6856, 6860, 6860, 6861, 6861, 6868, 6868, 6870, 6872, 6874, 6876, 6878, 6879, 6880, 6882, 6886, 6889, 6890, 6892, 6897, 6897, 6898, 6900, 6900, 6903, 6903, 6905, 6905, 6905, 6907, 6912, 6917, 6917, 6917, 6923, 6924, 6924, 6927, 6931, 6935, 6935, 6941, 6943, 6944, 6945, 6946, 6953, 6958, 6959, 6966, 6967, 6968, 6970, 6974, 6978, 6981, 6982, 6983, 6987, 6987, 6987, 6988, 6989, 6989, 6992, 6992, 6993, 6993, 6998, 7000, 7000, 7002, 7003, 7008, 7009, 7010, 7012, 7014, 7016, 7018, 7019, 7022, 7023, 7026, 7026, 7027, 7032, 7037, 7037, 7041, 7042, 7045, 7053, 7053, 7054, 7055, 7057, 7060, 7061, 7061, 7064, 7066, 7069, 7070, 7072, 7072, 7079, 7081, 7097, 7098, 7099, 7106, 7106, 7106, 7110, 7110, 7112, 7112, 7117, 7120, 7120, 7122, 7126, 7129, 7134, 7137, 7146, 7147, 7149, 7160, 7160, 7160, 7162, 7165, 7165, 7172, 7176, 7176, 7177, 7177, 7178, 7179, 7187, 7189, 7190, 7191, 7197, 7197, 7197, 7201, 7206, 7208, 7214, 7217, 7218, 7222, 7225, 7229, 7230, 7234, 7235, 7236, 7236, 7242, 7245, 7246, 7252, 7254, 7256, 7257, 7257, 7258, 7263, 7264, 7265, 7271, 7277, 7282, 7285, 7288, 7292, 7294, 7295, 7296, 7300, 7301, 7304, 7304, 7306, 7307, 7309, 7310, 7311, 7312, 7313, 7314, 7322, 7322, 7336, 7337, 7342, 7346, 7347, 7348, 7350, 7358, 7358, 7359, 7366, 7368, 7370, 7374, 7375, 7378, 7379, 7379, 7380, 7380, 7383, 7383, 7390, 7390, 7391, 7393, 7395, 7401, 7403, 7409, 7410, 7419, 7422, 7423, 7425, 7427, 7429, 7440, 7441, 7448, 7452, 7453, 7453, 7456, 7457, 7458, 7459, 7462, 7462, 7467, 7467, 7469, 7471, 7471, 7472, 7473, 7476, 7476, 7478, 7478, 7481, 7481, 7482, 7483, 7483, 7490, 7491, 7495, 7499, 7500, 7502, 7508, 7512, 7512, 7516, 7516, 7517, 7519, 7530, 7531, 7535, 7536, 7545, 7547, 7549, 7549, 7550, 7550, 7560, 7571, 7578, 7578, 7582, 7582, 7592, 7596, 7597, 7597, 7600, 7604, 7605, 7607, 7615, 7617, 7618, 7619, 7619, 7619, 7621, 7622, 7623, 7624, 7626, 7629, 7636, 7637, 7644, 7645, 7646, 7649, 7649, 7649, 7654, 7655, 7657, 7662, 7666, 7667, 7673, 7673, 7676, 7679, 7679, 7683, 7683, 7687, 7693, 7695, 7698, 7699, 7706, 7707, 7708, 7711, 7712, 7713, 7716, 7717, 7718, 7720, 7724, 7730, 7739, 7739, 7741, 7741, 7743, 7745, 7746, 7748, 7748, 7748, 7750, 7756, 7758, 7765, 7767, 7768, 7772, 7777, 7788, 7789, 7797, 7797, 7801, 7801, 7807, 7811, 7811, 7812, 7813, 7819, 7825, 7827, 7829, 7843, 7844, 7850, 7852, 7852, 7854, 7854, 7855, 7861, 7865, 7869, 7870, 7872, 7875, 7878, 7878, 7886, 7889, 7890, 7893, 7895, 7897, 7900, 7902, 7903, 7905, 7906, 7907, 7911, 7916, 7920, 7922, 7924, 7926, 7930, 7932, 7942, 7947, 7947, 7949, 7949, 7952, 7958, 7959, 7963, 7967, 7968, 7973, 7973, 7977, 7978, 7981, 7992, 7994, 7995, 7999, 8003, 8004, 8005, 8006, 8009, 8009, 8010, 8011, 8012, 8012, 8014, 8015, 8017, 8024, 8025, 8034, 8035, 8036, 8038, 8039, 8040, 8051, 8051, 8059, 8065, 8066, 8069, 8072, 8073, 8073, 8076, 8079, 8084, 8086, 8091, 8093, 8093, 8094, 8095, 8095, 8096, 8096, 8099, 8102, 8107, 8111, 8114, 8115, 8118, 8119, 8127, 8129, 8130, 8136, 8139, 8144, 8147, 8151, 8151, 8153, 8154, 8162, 8162, 8163, 8166, 8167, 8167, 8167, 8167, 8168, 8170, 8174, 8176, 8183, 8185, 8187, 8188, 8190, 8194, 8195, 8196, 8196, 8200, 8204, 8204, 8205, 8205, 8208, 8213, 8219, 8221, 8223, 8229, 8231, 8239, 8240, 8240, 8240, 8241, 8245, 8246, 8254, 8256, 8260, 8272, 8272, 8272, 8274, 8281, 8281, 8282, 8291, 8298, 8299, 8301, 8301, 8302, 8306, 8307, 8308, 8309, 8310, 8314, 8318, 8318, 8320, 8322, 8322, 8327, 8327, 8333, 8336, 8338, 8340, 8348, 8349, 8357, 8359, 8371, 8379, 8381, 8381, 8382, 8385, 8385, 8385, 8387, 8388, 8389, 8390, 8394, 8402, 8403, 8406, 8406, 8408, 8408, 8410, 8411, 8412, 8413, 8414, 8414, 8419, 8420, 8420, 8424, 8427, 8431], 879]) == 758\nassert my_solution.maximizeWin(**[[7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9], 503]) == 1678\nassert my_solution.maximizeWin(**[[885752020, 885756956, 885807567, 885837743, 885849450, 885894531, 885929312, 885931662, 886058747, 886096971, 886098826, 886120215, 886167102, 886177838, 886232776, 886241031, 886317479, 886319136, 886373787, 886425727, 886443885, 886502351, 886528719, 886535215, 886574039, 886694251, 886762584, 886773426, 886851074, 886930648, 886994977, 887015963, 887125310, 887172809, 887179116, 887199570, 887204341, 887259587, 887365552, 887369051, 887388776, 887410802, 887430459, 887639522, 887814793, 887848113, 887885779, 887899803, 887922670, 887925062, 887927740, 887971712, 887991599, 888024510, 888243760, 888412144, 888441363, 888502940, 888584827, 888592967, 888600329, 888659678, 888669167, 888823550, 888848241, 888934798, 889004387, 889005122, 889023885, 889063783, 889099179, 889133952, 889147323, 889155008, 889226960, 889300563, 889318442, 889331082, 889367599, 889386482, 889442314, 889454347, 889559593, 889596842, 889609538, 889618399, 889717143, 889765571, 889774902, 889808753, 889831804, 889854902, 889872341, 889873977, 889953507, 890020487, 890121488, 890128004, 890214509, 890217040, 890237124, 890241467, 890354356, 890357664, 890478911, 890504023, 890519526, 890523404, 890536167, 890551394, 890687973, 890694979, 890736459, 890750311, 890751891, 890797648, 890880095, 890887592, 890935346, 890941951, 890988758, 890989303, 891038158, 891040619, 891083710, 891118452, 891148823, 891198421, 891206147, 891229171, 891256198, 891266698, 891280594, 891294330, 891396115, 891427135, 891559939, 891591606, 891677971, 891743304, 891771621, 891937736, 892053301, 892070749, 892199049, 892212910, 892232351, 892281898, 892332295, 892351921, 892424027, 892504898, 892602753, 892614793, 892643121, 892691659, 892707482, 892748391, 892778295, 892805275, 892854149, 892890917, 892941223, 892951872, 892964249, 893111214, 893114456, 893165501, 893203480, 893227798, 893336889, 893349306, 893471654, 893563639, 893603924, 893653251, 893661583, 893695841, 893909062, 893913990, 893959740, 894050390, 894065170, 894195066, 894208740, 894262982, 894263921, 894292677, 894343226, 894393267, 894413940, 894415595, 894447171, 894515583, 894558271, 894576980, 894638350, 894692046, 894710518, 894771749, 894815685, 894863384, 894934988, 894978618, 894979220, 895082052, 895100380, 895149432, 895164985, 895193712, 895324160, 895338164, 895419047, 895575054, 895627695, 895634795, 895648728, 895675173, 895693733, 895827822, 895830238, 895954063, 895981360, 895989961, 896005111, 896057976, 896131778, 896137527, 896151511, 896167880, 896202337, 896221722, 896229153, 896240871, 896246029, 896253564, 896257536, 896311684, 896334011, 896347083, 896363352, 896393975, 896435687, 896468487, 896484101, 896495175, 896504657, 896519376, 896532916, 896566321, 896624755, 896656491, 896686290, 896714973, 896752164, 896763868, 896767885, 896773908, 896779834, 896865966, 896928558, 896945836, 896951207, 897007668, 897064841, 897103899, 897110002, 897179773, 897180491, 897213842, 897239881, 897260677, 897273770, 897459365, 897500381, 897606938, 897616752, 897659799, 897682854, 897756148, 897793043, 897796327, 897881832, 897935928, 897974183, 898011569, 898043140, 898053569, 898108818, 898110700, 898118802, 898228260, 898241784, 898251713, 898287826, 898389877, 898397527, 898427016, 898508934, 898586522, 898594921, 898685371, 898700830, 898731039, 898786339, 898949398, 899049118, 899084985, 899113667, 899121589, 899126650, 899156102, 899207726, 899235729, 899252228, 899288938, 899305933, 899367011, 899385109, 899389743, 899396959, 899451940, 899526199, 899526480, 899591287, 899597678, 899649922, 899681211, 899728171, 899754770, 899824849, 899901082, 899964042, 900012605, 900050742, 900073302, 900104936, 900143586, 900155157, 900160895, 900187010, 900297482, 900412219, 900419723, 900451263, 900452095, 900459023, 900463060, 900465811, 900486904, 900513936, 900535028, 900569281, 900648948, 900720309, 900728518, 900748601, 900760827, 900941853, 900967362, 901024593, 901031803, 901104362, 901133402, 901135278, 901177644, 901238628, 901243357, 901288919, 901293431, 901316603, 901509450, 901574581, 901603032, 901639345, 901644220, 901685278, 901720934, 901724800, 901845006, 901860154, 901867797, 901881290, 901890263, 901906482, 901920157, 902055632, 902105996, 902121503, 902175964, 902196777, 902252853, 902471569, 902523984, 902613688, 902634003, 902715419, 902721607, 902743132, 902821955, 902837482, 902990701, 903012296, 903185054, 903228000, 903232003, 903338344, 903363015, 903375477, 903382988, 903458416, 903616653, 903636582, 903668376, 903765452, 903789282, 903798681, 903807623, 903834924, 903846120, 903965668, 903968547, 904012323, 904081756, 904102704, 904157836, 904161886, 904173739, 904308497, 904389536, 904393272, 904409136, 904420522, 904515995, 904535708, 904579131, 904599003, 904657608, 904694169, 904760291, 904895047, 904895693, 904897528, 904910751, 904914631, 904966138, 905079374, 905112633, 905114717, 905122699, 905155084, 905198877, 905211287, 905215241, 905302435, 905327308, 905424182, 905489190, 905606452, 905655607, 905661965, 905680995, 905729167, 905733501, 905763749, 905772227, 905900916, 905937795, 905968990, 905980241, 906019298, 906104217, 906172343, 906180788, 906257151, 906428033, 906551474, 906564007, 906647677, 906675716, 906685872, 906721234, 906756260, 906778826, 906788054, 906791057, 906845420, 906846745, 906857991, 906862864, 906880356, 906917087, 907082308, 907091069, 907116378, 907197980, 907246805, 907304616, 907325663, 907330492, 907417925, 907435781, 907451666, 907462997, 907528172, 907563885, 907621682, 907629814, 907686931, 907780713, 907806295, 907819178, 907845405, 907908815, 907963997, 908001236, 908010184, 908059395, 908114113, 908303506, 908332823, 908500229, 908528633, 908595885, 908743697, 908800311, 908804755, 908875023, 908896208, 908950841, 908955176, 908998088, 909011529, 909028916, 909029646, 909085990, 909121615, 909163088, 909175626, 909211868, 909247771, 909261964, 909322461, 909396742, 909403653, 909494232, 909531021, 909538065, 909603367, 909790410, 909821552, 909856262, 909856569, 910045065, 910177718, 910183200, 910241686, 910286100, 910325394, 910328516, 910359825, 910365627, 910382755, 910383375, 910441300, 910536852, 910568439, 910576859, 910580280, 910611777, 910634826, 910636932, 910654955, 910706955, 910709267, 910723867, 910778780, 910789721, 910827418, 910846822, 910886981, 910951879, 911125706, 911141103, 911181933, 911229901, 911271813, 911349009, 911420119, 911493270, 911494711, 911499380, 911533401, 911539361, 911550421, 911561281, 911610955, 911633467, 911726920, 911758304, 911782600, 911803087, 911885174, 911902866, 911930465, 911931497, 911945327, 911958742, 912067782, 912072503, 912304868, 912341806, 912403978, 912427565, 912469547, 912475235, 912544600, 912562406, 912624366, 912641821, 912771019, 912797291, 912809177, 912859513, 912904171, 912925478, 912959073, 913010117, 913011254, 913041719, 913062216, 913088658, 913119970, 913211625, 913338786, 913339437, 913340779, 913363592, 913499490, 913545339, 913600947, 913617578, 913618276, 913666735, 913714098, 913731401, 913769732, 913789164, 913867399, 913874572, 913875057, 913906192, 913927851, 913968866, 914066196, 914072588, 914090585, 914092433, 914141696, 914224394, 914261215, 914326063, 914337121, 914345521, 914351012, 914355151, 914355268, 914373227, 914447670, 914541341, 914570604, 914609161, 914621801, 914653725, 914689329, 914704687, 914724377, 914724615, 914797150, 914803132, 914847707, 914870063, 914879953, 914906176, 914908803, 914923649, 914975937, 915002011, 915036371, 915048077, 915157375, 915226475, 915226505, 915247188, 915276506, 915291794, 915375879, 915491292, 915705722, 915707858, 915726035, 915742359, 915758701, 915784179, 915802131, 915854514, 915912165, 915921258, 915925342, 915928196, 915932909, 915995644, 916000622, 916134602, 916172761, 916197889, 916207744, 916283249, 916364012, 916393882, 916420563, 916515544, 916593964, 916599655, 916617681, 916703027, 916929441, 916941581, 916958532, 916963243, 916982497, 916989302, 917001229, 917002511, 917015268, 917075763, 917108532, 917141920, 917154596, 917196423, 917238709, 917245924, 917275534, 917287857, 917304670, 917399069, 917498491, 917503317, 917612266, 917718640, 917783730, 917789183, 917838907, 917863423, 917902517, 917908370, 917925057, 918057565, 918168825, 918208645, 918222738, 918279297, 918319040, 918376560, 918388917, 918495081, 918532204, 918564598, 918578214, 918823248, 918853926, 918881773, 918897735, 918901473, 918932699, 918949514, 919003868, 919060418, 919077274, 919149520, 919157064, 919210036, 919295204, 919633663, 919669405, 919679624, 919724392, 919801564, 919842866, 919941113, 919980509, 920026040, 920089401, 920134226, 920143666, 920241874, 920273011, 920355813, 920402440, 920428298, 920485582, 920524750, 920642004, 920731036, 920743704, 920783584, 920830353, 920839454, 920887451, 920899647, 921013584, 921017295, 921151550, 921184422, 921313976, 921323065, 921323317, 921417645, 921496452, 921511164, 921541145, 921552665, 921577330, 921591344, 921680399, 921691335, 921738142, 921745633, 921802419, 921820715, 921910904, 921930737, 921938297, 922006063, 922008681, 922010884, 922042774, 922053273, 922113416, 922116871, 922150578, 922156302, 922233956, 922261552, 922366770, 922401895, 922420269, 922433019, 922454995, 922484134, 922597648, 922632980, 922637038, 922642878, 922649542, 922672101, 922708707, 922754099, 922867483, 922924740, 923078411, 923131023, 923159217, 923209836, 923216018, 923256689, 923256693, 923297415, 923374286, 923386158, 923448786, 923476278, 923585411, 923631661, 923641967, 923664695, 923665684, 923669094, 923691628, 923825156, 923864819, 923896181, 923920623, 923938199, 923967993, 924038915, 924074350, 924099618, 924207604, 924208362, 924211720, 924234752, 924287686, 924292391, 924381075, 924428356, 924469530, 924498593, 924520708, 924531996, 924581108, 924599480, 924622322, 924629272, 924677888, 924684365, 924688805, 924748139, 924766845, 924775355, 924854505, 924947297, 924948016, 924995209, 925029013, 925057457, 925194276, 925291215, 925378480, 925452038, 925485646, 925584551, 925589920, 925674618, 925678734, 925679768, 925724537, 925732689, 925768233, 925770116, 925836603, 925927259, 925995628, 926079388, 926096820, 926150415, 926152577, 926197922, 926322413, 926339121, 926349035, 926402146, 926421206, 926450385, 926453606, 926539950, 926598692, 926690289, 926692093, 926712647, 926767449, 926777027, 926813810, 926832178, 926898923, 926913237, 926986890, 927029335, 927047747, 927055369, 927078132, 927155621, 927185770, 927188463, 927242993, 927309566, 927326650, 927345926, 927411035, 927458654, 927551832, 927572051, 927642651, 927685554, 927703422, 927710554, 927788110, 927804687, 927814967, 927825029, 927828995, 927876009, 927886334, 927915250, 927943725, 928025555, 928029328, 928104107, 928132440, 928149213, 928271208, 928301735, 928305765, 928336990, 928339041, 928388192, 928482743, 928632124, 928790430, 928877371, 928934277, 928962181, 929054931, 929098045, 929106345, 929119486, 929196392, 929242264, 929349375, 929351001, 929363117, 929390949, 929520567, 929703031, 929789933, 929862142, 929934969, 929963778, 929965296, 929984188, 930003909, 930015112, 930020338, 930035035, 930051476, 930195616, 930258865, 930348307, 930350266, 930352952, 930361192, 930433442, 930463793, 930511211, 930514899, 930600344, 930620548, 930720157, 930755838, 930765097, 930813598, 930820920, 930878167, 930958498, 930972051, 930993148, 931047015, 931111268, 931180147, 931230825, 931247434, 931257404, 931440207, 931460631, 931618227, 931626981, 931675942, 931680416, 931815273, 931895070, 931936362, 932036360, 932046191, 932094432, 932151670, 932168081, 932220732, 932272602, 932274716, 932305706, 932342597, 932368267, 932405552, 932407488, 932477883, 932507825, 932510840, 932540870, 932628635, 932669909, 932691361, 932699651, 932723795, 932730693, 932769404, 932775157, 932811466, 932812005, 932830303, 932869948, 932876711, 932901124, 932941925, 932949494, 932969412, 932996041, 933006428, 933095902, 933117608, 933283696, 933321619, 933331527, 933382602, 933413421, 933415000, 933436793, 933438909, 933440192, 933478635, 933495550, 933557189, 933560114, 933697103, 933717600, 933813835, 933961068, 934006740, 934033001, 934158763, 934160514, 934175228, 934226266, 934241956, 934250494, 934292994, 934305281, 934381979, 934387437, 934461963, 934486453, 934488021, 934603690, 934612512, 934641297, 934738520, 934793840, 934808969, 934890917, 934894936, 934916580, 934948547, 934965186, 934993944, 934995473, 935028318, 935045283, 935099823, 935102947, 935129564, 935132707, 935142451, 935262885, 935278906, 935299274, 935509892, 935550382, 935555621, 935604759, 935605963, 935613249, 935782587, 935832403, 935890980, 935897820, 935909952, 935915084, 935917009, 935937923, 935944864, 935955811, 935967277, 936047276, 936087192, 936174945, 936182595, 936184661, 936213376, 936253233, 936351960, 936386523, 936401794, 936448165, 936571816, 936619977, 936620909, 936657523, 936695275, 936730782, 936746893, 936811348, 936842583, 936897722, 936968949, 937003834, 937042508, 937139865, 937165333, 937196860, 937202877, 937229184, 937305816, 937350156, 937352002, 937357704, 937380228, 937387766, 937510251, 937515871, 937516362, 937525015, 937695488, 937745878, 937769128, 937770387, 937773554, 937778902, 937841158, 937911558, 938003243, 938044103, 938054850, 938139682, 938289891, 938332540, 938391953, 938418407, 938418995, 938437894, 938486620, 938589012, 938602618, 938765512, 938799115, 938813642, 938832356, 938840616, 938997149, 939079588, 939083324, 939124866, 939136248, 939198411, 939339152, 939361372, 939503228, 939514809, 939578324, 939646221, 939676578, 939853918, 939873584, 939876717, 939895827, 939923423, 939993674, 940058884, 940066032, 940107816, 940135068, 940172109, 940204810, 940236224, 940238255, 940257049, 940285145, 940286551, 940301857, 940327131, 940445983, 940465854, 940512337, 940655924, 940680806, 940687232, 940726061, 940742727, 940748232, 940779768, 940830976, 940860449, 940872932, 940880710, 940894484, 940905197, 940953214, 940959336, 941007703, 941175305, 941216758, 941265705, 941286485, 941294662, 941344325, 941353855, 941384134, 941394441, 941490346, 941572568, 941574288, 941585600, 941628015, 941635027, 941643956, 941656112, 941681906, 941784890, 941990488, 942102963, 942123556, 942149778, 942158556, 942176952, 942179521, 942271873, 942390975, 942465891, 942522571, 942593291, 942680533, 942703575, 942704940, 942746852, 942806857, 942857787, 942857857, 942858752, 942974098, 942986191, 943106080, 943144330, 943220705, 943270203, 943365543, 943379867, 943385426, 943386428, 943462490, 943496550, 943559420, 943563820, 943624192, 943673519, 943692764, 943695150, 943785022, 943805619, 943825946, 943860637, 943869797, 943887743, 943986637, 943989203, 944015659, 944036506, 944054726, 944074351, 944079183, 944089340, 944099557, 944133981, 944156454, 944170523, 944176219, 944212017, 944222706, 944240053, 944283665, 944286315, 944302276, 944342900, 944357713, 944379912, 944420426, 944430250, 944432577, 944508222, 944515139, 944578579, 944578786, 944639735, 944640668, 944686802, 944690669, 944717138, 944829965, 944960010, 944966917, 944991271, 944999357, 945044694, 945096350, 945129179, 945194731, 945282221, 945291986, 945343237, 945459392, 945490078, 945491450, 945493203, 945494762, 945520429, 945551573, 945628754, 945945665, 945981448, 946024590, 946052640, 946055531, 946061184, 946119026, 946141511, 946356934, 946448995, 946495417, 946510645, 946521203, 946568646, 946598011, 946644577, 946668713, 946701117, 946754777, 946780981, 946810407, 946862628, 946930991, 946943433, 946991433, 947010598, 947039171, 947151016, 947194232, 947230519, 947270962, 947359807, 947382981, 947436700, 947441480, 947445077, 947462864, 947493349, 947602492, 947657166, 947673161, 947673427, 947682770, 947709694, 947752500, 947792870, 947830369, 947936260, 947975542, 948069883, 948124233, 948133505, 948176881, 948198842, 948219655, 948269132, 948368323, 948459722, 948498849, 948522012, 948693513, 948695883, 948711656, 948760086, 948819135, 948854283, 948927225, 949072826, 949087547, 949090126, 949233069, 949292617, 949341566, 949359158, 949384850, 949483677, 949487583, 949526375, 949594555, 949620085, 949678632, 949720117, 949757849, 949815081, 949823497, 949827185, 949924172, 950025229, 950079791, 950117677, 950172466, 950221827, 950279417, 950292900, 950350985, 950381006, 950407144, 950430357, 950435045, 950469032, 950520087, 950555015, 950571704, 950601825, 950621576, 950633352, 950637939, 950641075, 950685960, 950702923, 950725971, 950754607, 950821265, 950839051, 950896324, 951010005, 951118317, 951171533, 951176669, 951185181, 951295873, 951302471, 951348359, 951420599, 951536089, 951545762, 951695277, 951715592, 951792597, 951810601, 951870103, 952090923, 952092787, 952139512, 952180158, 952216273, 952246640, 952255167, 952256377, 952291070, 952301248, 952397984, 952410137, 952431730, 952447485, 952475447, 952531121, 952589003, 952594281, 952635531, 952812617, 952888096, 952901548, 952959007, 952974561, 953023373, 953073700, 953083170, 953149225, 953250865, 953262780, 953354386, 953363783, 953380284, 953461845, 953482771, 953483910, 953505946, 953512355, 953606199, 953631218, 953660870, 953694872, 953770909, 953853825, 953884918, 953901248, 953931176, 953991688, 953995139, 954004482, 954034039, 954118964, 954192058, 954201352, 954255045, 954267248, 954333395, 954349500, 954401042, 954427987, 954547363, 954563226, 954789043, 954966904, 954995201, 955075890, 955114752, 955198151, 955201698, 955229698, 955235232, 955244709, 955246817, 955361817, 955407246, 955415021, 955458840, 955521834, 955527767, 955537789, 955658150, 955711929, 955734125, 955740492, 955744570, 955753163, 955757085, 955838910, 955853855, 955917961, 955987474, 956010469, 956064505, 956093788, 956157813, 956177012, 956188914, 956256222, 956301288, 956312747, 956356184, 956389890, 956402330, 956436117, 956444875, 956473902, 956477025, 956489554, 956552406, 956553025, 956569845, 956591981, 956686933, 956702474, 956721097, 956848768, 956894891, 956958368, 956988505, 957056609, 957080917, 957184243, 957200421, 957288103, 957314549, 957341142, 957367145, 957566138, 957579005, 957687199, 957740004, 957749731, 957798688, 957811362, 957907851, 957967007, 958014373, 958014976, 958066229, 958316942, 958415123, 958436502, 958696420, 958737090, 958742784, 958754987, 958760031, 958881563, 958994100, 959084840, 959215315, 959275819, 959314868, 959368666, 959378579, 959409043, 959555827, 959557757, 959573975, 959583198, 959664858, 959749562, 959988321, 960001921, 960020589, 960225850, 960334010, 960348360, 960465641, 960471063, 960505261, 960528944, 960632803, 960866994, 960874069, 960904923, 960942512, 961039970, 961091361, 961165683, 961172319, 961175739, 961207714, 961247983, 961258520, 961283936, 961288224, 961305006, 961340043, 961373603, 961418322, 961425842, 961449175, 961512220, 961528501, 961571278, 961642003, 961791929, 961924219, 961947094, 961971794, 962025855, 962030691, 962045389, 962081337, 962151701, 962217316, 962219518, 962288528, 962308692, 962333208, 962358282, 962376345, 962575891, 962605715, 962609511, 962669606, 962684301, 962711521, 962719204, 962781121, 962839240, 962959870, 962962196, 962970039, 963050135, 963072525, 963107698, 963114182, 963118701, 963119937, 963192571, 963228082, 963411476, 963472006, 963545479, 963550930, 963622035, 963634123, 963694127, 963839955, 963846910, 963886316, 964000215, 964033744, 964078470, 964221848, 964347439, 964379023, 964418268, 964431040, 964450252, 964483745, 964578054, 964609036, 964633249, 964683052, 964694690, 964723250, 964792762, 964812601, 964819397, 964918156, 964922066, 964959965, 965014565, 965030949, 965049924, 965062703, 965123149, 965247998, 965367243, 965406176, 965406754, 965502564, 965600557, 965677139, 965754412, 965791994, 965870062, 965870594, 965930685, 965997872, 966016415, 966018167, 966018275, 966033585, 966067437, 966100042, 966196439, 966253098, 966279845, 966319673, 966330923, 966499750, 966519297, 966533286, 966549759, 966621885, 966681061, 966689899, 966711727, 966727879, 966740585, 966747993, 966850145, 966957103, 966999375, 967004794, 967073002, 967146720, 967151755, 967157829, 967162847, 967185444, 967193244, 967253229, 967283247, 967294547, 967301345, 967311187, 967338599, 967355941, 967386525, 967448030, 967647882, 967666320, 967674869, 967715016, 967725485, 967752825, 967779801, 967788007, 967888130, 967906066, 967915065, 967915603, 967932359, 967978727, 968089176, 968121219, 968140074, 968174117, 968186775, 968230806, 968317287, 968476397, 968477983, 968484231, 968485353, 968494994, 968519164, 968521527, 968538486, 968571755, 968585868, 968688914, 968731622, 968746117, 968750087, 968774935, 968809717, 968921134, 968933226, 968943554, 968945215, 969011385, 969063548, 969089863, 969135973, 969144615, 969268202, 969276894, 969278933], 401]) == 4\nassert my_solution.maximizeWin(**[[692, 692, 692, 692, 692, 692, 692, 692, 692, 692, 693, 693, 693, 693, 693, 693, 693, 693, 693, 693, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 695, 695, 695, 695, 695, 695, 695, 695, 696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 699, 699, 699, 700, 700, 700, 700, 700, 700, 700, 700, 700, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 702, 702, 702, 702, 702, 702, 702, 702, 702, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 706, 706, 706, 706, 706, 706, 706, 706, 706, 706, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 708, 708, 708, 708, 708, 708, 708, 708, 708, 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, 710, 710, 710, 710, 710, 710, 710, 710, 710, 710, 710, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 712, 712, 712, 712, 712, 712, 712, 712, 712, 712, 712, 712, 712, 713, 713, 713, 713, 713, 713, 713, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 715, 715, 715, 715, 715, 715, 715, 715, 715, 716, 716, 716, 716, 716, 716, 716, 716, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 719, 719, 719, 719, 719, 719, 719, 719, 720, 720, 720, 720, 720, 720, 720, 720, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 723, 723, 723, 723, 723, 723, 723, 723, 724, 724, 724, 724, 724, 724, 724, 724, 724, 724, 724, 724, 725, 725, 725, 725, 725, 726, 726, 726, 726, 726, 726, 726, 726, 726, 727, 727, 727, 727, 727, 727, 727, 727, 728, 728, 728, 728, 728, 728, 728, 728, 728, 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, 730, 730, 730, 730, 730, 730, 731, 731, 731, 731, 731, 731, 731, 731, 732, 732, 732, 732, 732, 733, 733, 733, 733, 733, 733, 733, 733, 733, 733, 733, 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, 735, 735, 735, 735, 735, 735, 735, 736, 736, 736, 736, 736, 736, 736, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 739, 739, 739, 739, 739, 739, 739, 739, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 741, 741, 741, 741, 741, 741, 741, 741, 742, 742, 742, 742, 742, 742, 742, 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, 744, 744, 744, 744, 744, 744, 744, 744, 744, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 746, 746, 746, 746, 746, 746, 746, 746, 746, 746, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 748, 748, 748, 748, 748, 748, 748, 748, 749, 749, 749, 749, 749, 749, 749, 749, 749, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 751, 751, 751, 751, 751, 751, 751, 751, 751, 751, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 753, 753, 753, 753, 753, 753, 753, 753, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 755, 755, 755, 755, 755, 755, 755, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 757, 757, 757, 757, 757, 757, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 759, 759, 759, 759, 759, 759, 759, 759, 759, 759, 760, 760, 760, 760, 760, 760, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, 763, 763, 763, 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, 765, 765, 765, 765, 765, 765, 765, 765, 765, 765, 765, 766, 766, 766, 766, 766, 766, 766, 766, 766, 766, 766, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 770, 770, 770, 770, 770, 770, 770, 770, 770, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 774, 774, 774, 774, 774, 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, 776, 776, 776, 776, 776, 776, 776, 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 780, 780, 780, 780, 780, 780, 780, 780, 780, 781, 781, 781, 781, 781, 781, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 785, 785, 785, 785, 785, 785, 785, 785, 785, 785, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 787, 787, 787, 787, 787, 787, 787, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 789, 789, 789, 790, 790, 790, 790, 790, 790, 790, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, 796, 796, 796, 796, 796, 796, 796, 796, 796, 796, 796, 796, 796, 797, 797, 797, 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, 799, 799, 799, 799, 799, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 801, 801, 801, 801, 801, 801, 801, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 803, 803, 803, 803, 803, 803, 804, 804, 804, 804, 804, 804, 804, 804, 804, 805, 805, 805, 805, 805, 805, 805, 805, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 807, 807, 807, 807, 807, 807, 807, 807, 807, 808, 808, 808, 808, 808, 809, 809, 810, 810, 810, 810, 810, 810, 810, 810, 811, 811, 811, 811, 811, 812, 812, 812, 812, 812, 812, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 814, 814, 814, 814, 814, 814, 814, 814, 814, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 817, 817, 817, 817, 817, 817, 817, 817, 817, 817, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 819, 819, 819, 819, 819, 819, 819, 819, 819, 820, 820, 820, 820, 820, 820, 820, 820, 820, 820, 820, 820, 820, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 823, 823, 823, 823, 823, 823, 823, 824, 824, 824, 824, 824, 825, 825, 825, 825, 826, 826, 826, 826, 826, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 834, 834, 834, 834, 834, 834, 834, 834, 834, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 836, 836, 836, 836, 836, 836, 836, 836, 836, 836, 836, 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, 838, 838, 838, 838, 838, 838, 839, 839, 839, 839, 839, 839, 839, 839, 839, 840, 840, 840, 840, 840, 840, 840, 840, 840, 840, 841, 841, 841, 841, 841, 841, 841, 841, 841, 842, 842, 842, 842, 842, 842, 842, 842, 842, 842, 842, 842, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 844, 844, 844, 844, 844, 844, 844, 844, 844, 844, 844, 844, 845, 845, 845, 845, 845, 845, 845, 845, 845, 845, 845, 845, 846, 846, 846, 846, 846, 846, 846, 846, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 848, 848, 848, 848, 848, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 852, 852, 852, 852, 852, 852, 852, 852, 852, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 854, 854, 854, 854, 854, 854, 854, 854, 854, 854, 854, 854, 854, 854, 855, 855, 855, 855, 855, 855, 855, 855, 855, 856, 856, 856, 856, 856, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 858, 858, 858, 858, 858, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 860, 860, 860, 860, 860, 860, 860, 860, 861, 861, 861, 861, 861, 861, 861, 861, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 863, 863, 863, 863, 863, 863, 864, 864, 864, 864, 864, 864, 864, 865, 865, 865, 865, 865, 865, 865, 865, 865, 865, 865, 865, 866, 866, 866, 866, 866, 866, 866, 866, 866, 867, 867, 867, 867, 867, 867, 867, 868, 868, 868, 868, 868, 868, 868, 869, 869, 869, 869, 869, 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, 871, 871, 871, 871, 871, 871, 872, 872, 872, 872, 872, 872, 872, 873, 873, 873, 873, 873, 873, 873, 873, 873, 873, 873, 873, 873, 873, 874, 874, 874, 874, 874, 874, 874, 874, 874, 874, 874, 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, 876, 876, 876, 876, 876, 877, 877, 877, 877, 877, 877, 877, 877, 877, 877, 877, 878, 878, 878, 878, 878, 878, 878, 878, 878, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 880, 880, 880, 880, 880, 880, 880, 880, 880, 881, 881, 881, 881, 881, 881, 881, 881, 881, 881, 882, 882, 882, 882, 882, 882, 882, 882, 882, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 884, 884, 884, 884, 884, 884, 884, 884, 884, 884, 884, 884, 885, 885, 885, 885, 885, 885, 885, 885, 885, 885, 885, 886, 886, 886, 886, 886, 886, 887, 887, 887, 887, 887, 887, 887, 887, 887, 887, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 890, 890, 890, 890, 890, 890, 890, 890, 890, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, 895, 895, 895, 895, 895, 895, 895, 895, 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, 897, 897, 897, 897, 897, 897, 897, 897, 897], 1455]) == 2094\nassert my_solution.maximizeWin(**[[1051376, 1051414, 1052293, 1052600, 1053062, 1053212, 1054098, 1054109, 1054257, 1054288, 1054514, 1054610, 1054630, 1054956, 1055390, 1055462, 1055554, 1055578, 1055767, 1056065, 1056408, 1056706, 1057088, 1057618, 1057876, 1058039, 1058475, 1058501, 1059276, 1059854, 1060149, 1060483, 1060591, 1061379, 1061446, 1061536, 1062025, 1062389, 1062521, 1062700, 1062984, 1063020, 1063227, 1063409, 1063727, 1063727, 1064128, 1064224, 1064456, 1064920, 1065042, 1065175, 1065456, 1066212, 1066297, 1066614, 1067414, 1067503, 1067627, 1067744, 1067974, 1068182, 1068229, 1068615, 1069163, 1069219, 1069336, 1069345, 1069681, 1069840, 1070241, 1070508, 1070566, 1071304, 1071471, 1071670, 1071794, 1071941, 1072006, 1072431, 1073033, 1073109, 1073152, 1073536, 1073719, 1073781, 1073873, 1073915, 1073938, 1074395, 1074676, 1074862, 1075041, 1075182, 1075209, 1075797, 1076127, 1076876, 1076921, 1076929, 1077080, 1077131, 1077182, 1077449, 1077480, 1077889, 1077953, 1078122, 1078318, 1078382, 1078572, 1078576, 1078912, 1079179, 1079330, 1079662, 1079832, 1079886, 1079929, 1079984, 1080029, 1081060, 1081094, 1081145, 1081336, 1081357, 1081416, 1081549, 1081762, 1082088, 1082171, 1082632, 1082662, 1082998, 1083179, 1083183, 1083328, 1083458, 1083677, 1083685, 1083755, 1083759, 1084166, 1084294, 1084930, 1085331, 1085633, 1085796, 1085835, 1085953, 1086623, 1086663, 1086735, 1086939, 1087089, 1087459, 1087975, 1088029, 1088712, 1088797, 1089209, 1089545, 1089667, 1089754, 1089765, 1090152, 1090276, 1090408, 1090513, 1090705, 1091011, 1091022, 1091073, 1091309, 1091371, 1091737, 1091827, 1091990, 1092400, 1092528, 1092538, 1092612, 1092833, 1092840, 1092882, 1092961, 1093018, 1093187, 1093327, 1093577, 1093719, 1093721, 1093771, 1094508, 1094722, 1094809, 1095914, 1096087, 1096221, 1096390, 1096659, 1096997, 1097125, 1097207, 1098439, 1099159, 1099171, 1099192, 1099507, 1099753, 1099944, 1099988, 1100344, 1100715, 1101367, 1101727, 1102367, 1102372, 1102578, 1102886, 1103058, 1103070, 1103117, 1103446, 1103839, 1104013, 1104327, 1104730, 1104798, 1106120, 1106218, 1106270, 1106928, 1107849, 1107869, 1107895, 1108156, 1108256, 1108321, 1108362, 1108384, 1108804, 1108835, 1108908, 1108918, 1108919, 1109056, 1109109, 1109517, 1109563, 1109587, 1109699, 1109993, 1110051, 1110135, 1110767, 1110781, 1111411, 1111454, 1111473, 1111481, 1112079, 1112155, 1112326, 1112601, 1112643, 1112736, 1113029, 1113069, 1113163, 1113363, 1113580, 1113743, 1114003, 1114055, 1114076, 1114129, 1114208, 1114220, 1115333, 1116509, 1116524, 1116967, 1117046, 1117237, 1117466, 1117635, 1117977, 1118077, 1118279, 1118369, 1118495, 1118497, 1118645, 1118883, 1118891, 1119185, 1119353, 1119557, 1120106, 1120256, 1120757, 1120808, 1120917, 1120935, 1121167, 1121658, 1122111, 1122696, 1122795, 1122979, 1123794, 1123934, 1124109, 1124141, 1124642, 1124942, 1125298, 1125338, 1125436, 1126068, 1126319, 1126890, 1126939, 1127194, 1127354, 1127483, 1127497, 1127506, 1127774, 1128039, 1128072, 1128211, 1128476, 1128693, 1128712, 1128939, 1128968, 1129493, 1129599, 1129830, 1130120, 1130289, 1131301, 1131499, 1131542, 1131714, 1131951, 1132024, 1132042, 1132393, 1132808, 1133004, 1133024, 1133091, 1133395, 1133905, 1134102, 1134195, 1134197, 1134298, 1134421, 1134525, 1134633, 1135159, 1135294, 1136376, 1136600, 1136684, 1136885, 1137093, 1137158, 1137406, 1137452, 1138090, 1138218, 1138260, 1138739, 1139035, 1139132, 1139193, 1139255, 1139385, 1139506, 1139851, 1139920, 1140039, 1140160, 1140238, 1140276, 1140611, 1140810, 1140956, 1141198, 1141654, 1141821, 1142499, 1142521, 1142550, 1142851, 1143182, 1143354, 1143727, 1143798, 1144011, 1144233, 1144244, 1144266, 1144392, 1144464, 1144499, 1144552, 1144904, 1145033, 1145286, 1145502, 1145770, 1146190, 1146402, 1146815, 1146883, 1147143, 1147342, 1147342, 1147815, 1148053, 1148756, 1148794, 1149095, 1149163, 1149291, 1149485, 1149717, 1150308, 1150862, 1151029, 1152665, 1152826, 1153232, 1153269, 1153312, 1153913, 1154182, 1154245, 1154627, 1155951, 1156019, 1156483, 1156550, 1156792, 1157674, 1157805, 1157839, 1157925, 1158216, 1158840, 1159090, 1159588, 1159892, 1159969, 1160389, 1160642, 1160964, 1161377, 1161490, 1161581, 1161582, 1161655, 1161771, 1161872, 1162194, 1162434, 1162537, 1163006, 1163129, 1163146, 1163281, 1163672, 1164281, 1164466, 1164606, 1165384, 1165474, 1165643, 1165659, 1165874, 1166013, 1166119, 1166290, 1166302, 1166372, 1166391, 1166426, 1166710, 1167241, 1167459, 1167834, 1167839, 1168895, 1168943, 1169150, 1169376, 1169469, 1169965, 1170034, 1170475, 1170571, 1171414, 1171849, 1172009, 1172239, 1172345, 1172742, 1173155, 1173254, 1173320, 1173552, 1173872, 1173997, 1174597, 1174672, 1174891, 1175043, 1175344, 1175458, 1175611, 1175853, 1176086, 1176206, 1176313, 1176765, 1177167, 1177201, 1177267, 1177412, 1177576, 1177736, 1177916, 1178056, 1178284, 1179053, 1179173, 1179422, 1179577, 1180041, 1180328, 1180428, 1181041, 1181327, 1181887, 1181993, 1182103, 1182281, 1182337, 1182543, 1183037, 1184101, 1184370, 1185640, 1186191, 1186554, 1186662, 1186683, 1186896, 1187044, 1187072, 1187625, 1187984, 1188157, 1188604, 1188624, 1188797, 1188871, 1189314, 1189391, 1189401, 1189498, 1189808, 1190216, 1190266, 1190390, 1190840, 1190864, 1190984, 1191255, 1191689, 1191915, 1192375, 1192618, 1192754, 1192873, 1193098, 1193235, 1193292, 1194659, 1194791, 1195009, 1195178, 1195249, 1195661, 1196061, 1196225, 1196401, 1196653, 1196680, 1196804, 1196947, 1198789, 1199110, 1199141, 1199239, 1199247, 1200423, 1200758, 1200770, 1201014, 1201068, 1201211, 1201236, 1201360, 1201485, 1201551, 1202042, 1202087, 1202239, 1203031, 1203219, 1203520, 1203575, 1204590, 1204638, 1204796, 1205472, 1205791, 1205839, 1206369, 1206521, 1206659, 1206760, 1206908, 1207242, 1207307, 1207462, 1207849, 1208436, 1208492, 1209067, 1209146, 1209735, 1209917, 1210142, 1210295, 1210411, 1210530, 1211039, 1211191, 1211512, 1211574, 1211671, 1212644, 1212731, 1212976, 1213053, 1213288, 1213426, 1213433, 1213785, 1213991, 1214127, 1214378, 1214842, 1214863, 1215742, 1215808, 1215859, 1216057, 1216552, 1216933, 1216976, 1217237, 1217329, 1217420, 1217646, 1217791, 1218094, 1218096, 1218302, 1218361, 1218372, 1218914, 1218925, 1219193, 1219568, 1219863, 1219874, 1219992, 1220102, 1220656, 1220805, 1220861, 1220949, 1220974, 1221001, 1221005, 1221032, 1221183, 1222354, 1222395, 1223141, 1223603, 1223676, 1223689, 1224478, 1224517, 1224546, 1224555, 1224837, 1225097, 1225178, 1225472, 1225617, 1225666, 1225753, 1226204, 1226339, 1226737, 1226756, 1227072, 1227532, 1227845, 1227926, 1228635, 1228901, 1229110, 1229122, 1229821, 1230089, 1230511, 1230901, 1231440, 1231795, 1231797, 1231911, 1232612, 1232761, 1232767, 1233117, 1233129, 1233135, 1233143, 1234334, 1234361, 1234749, 1235053, 1235578, 1236074, 1236926, 1237046, 1237091, 1237156, 1237312, 1237459, 1237772, 1237823, 1237837, 1237869, 1238227, 1238705, 1238761, 1238860, 1239045, 1239619, 1239692, 1239768, 1239924, 1239967, 1240019, 1240119, 1240478, 1240702, 1240799, 1240846, 1241099, 1241129, 1241570, 1241903, 1241924, 1242502, 1242546, 1242554, 1242968, 1242987, 1243218, 1243539, 1243568, 1243989, 1244139, 1244711, 1244782, 1245017, 1245061, 1245315, 1245408, 1245568, 1245724, 1246168, 1246266, 1246538, 1246747, 1246847, 1246938, 1247060, 1247200, 1247206, 1247253, 1247663, 1247881, 1248915, 1248940, 1249000, 1249121, 1249257, 1249439, 1249641, 1249984, 1250277, 1250406, 1250615, 1250716, 1250756, 1251095, 1251164, 1251403, 1251575, 1251762, 1252505, 1252742, 1252767, 1252782, 1252846, 1252883, 1252936, 1253044, 1253223, 1253279, 1253368, 1253747, 1253760, 1253843, 1254343, 1254353, 1254591, 1254703, 1254952, 1255279, 1255303, 1255537, 1255995, 1256664, 1256730, 1256754, 1257081, 1257191, 1257196, 1257228, 1257324, 1257408, 1257563, 1257644, 1258431, 1258471, 1258652, 1258686, 1258862, 1259348, 1259469, 1259548, 1259599, 1259825, 1259833, 1259994, 1260251, 1260426, 1260553, 1260570, 1260609, 1260809, 1260972, 1261237, 1261652, 1261853, 1262025, 1262376, 1262465, 1262494, 1262841, 1263200, 1263231, 1263239, 1263515, 1263593, 1263854, 1264258, 1264319, 1264486, 1264517, 1264824, 1265182, 1265247, 1265683, 1265899, 1266226, 1266292, 1266327, 1266410, 1266977, 1267302, 1268001, 1268295, 1268945, 1269118, 1269502, 1269963, 1270365, 1270488, 1270572, 1271173, 1271452, 1271534, 1271684, 1272047, 1272506, 1272556, 1272691, 1272721, 1272754, 1272984, 1273270, 1273920, 1274075, 1274189, 1274328, 1274337, 1275040, 1275322, 1275522, 1275610, 1275646, 1275903, 1276026, 1276173, 1276377, 1277068, 1277482, 1278062, 1278082, 1278331, 1278463, 1278580, 1278625, 1279188, 1279674, 1279747, 1279884, 1281058, 1281058, 1281218, 1281313, 1281474, 1281484, 1281821, 1282266, 1282330, 1282685, 1282923, 1282967, 1283219, 1283287, 1284711, 1284808, 1285687, 1286398, 1286684, 1287116, 1287327, 1287676, 1287970, 1288246, 1288713, 1289664, 1289666, 1290055, 1290150, 1290285, 1290567, 1291199, 1291367, 1291474, 1291535, 1291639, 1291746, 1291786, 1291948, 1292136, 1292172, 1292208, 1292396, 1292459, 1292504, 1292573, 1293068, 1293421, 1293495, 1293554, 1293860, 1293901, 1294289, 1295216, 1295303, 1295727, 1295815, 1296264, 1296532, 1297035, 1297697, 1297851, 1297892, 1298292, 1298547, 1298924, 1298993, 1299081, 1299162, 1299413, 1299894, 1300196, 1300695, 1300864, 1300952, 1301012, 1301178, 1301179, 1301729, 1301864, 1301901, 1302789, 1303014, 1303402, 1303614, 1303703, 1303834, 1303941, 1304457, 1304546, 1305460, 1305526, 1305788, 1305924, 1306559, 1306585, 1306707, 1306745, 1306772, 1307314, 1307499, 1307563, 1307644, 1307872, 1308038, 1308630, 1308779, 1308830, 1308837, 1308887, 1308932, 1309094, 1309156, 1309547, 1309646, 1309665, 1309862, 1310137, 1310175, 1310398, 1310559, 1310900, 1311001, 1311178, 1311217, 1311723, 1311788, 1311793, 1311887, 1312032, 1312062, 1312082, 1312148, 1312208, 1312287, 1312410, 1312758, 1313051, 1313057, 1313147, 1313454, 1313468, 1314603, 1314697, 1314845, 1314872, 1314926, 1315735, 1315886, 1315911, 1315983, 1316203, 1316275, 1316363, 1316941, 1317869, 1318123, 1318215, 1318368, 1318718, 1318733, 1318767, 1318838, 1319012, 1319436, 1319524, 1319644, 1319766, 1320300, 1320685, 1320822, 1320866, 1321120, 1321316, 1321389, 1321829, 1322285, 1322365, 1322472, 1322504, 1322775, 1322872, 1322964, 1323023, 1323264, 1323706, 1324188, 1324781, 1324874, 1325453, 1325561, 1325633, 1325757, 1326079, 1326085, 1326172, 1326258, 1326381, 1326497, 1326679, 1326969, 1327091, 1327555, 1327681, 1327833, 1328017, 1328159, 1328210, 1328289, 1328372, 1328379, 1328738, 1328827, 1329039, 1329519, 1330007, 1330072, 1330257, 1330260, 1330701, 1330937, 1331234, 1331366, 1332610, 1333018, 1333153, 1333617, 1333822, 1333922, 1333960, 1334473, 1334579, 1334620, 1334713, 1334745, 1335188, 1335731, 1336277, 1336651, 1336758, 1336782, 1337603, 1337722, 1337758, 1338223, 1338704, 1338845, 1338858, 1339092, 1339360, 1339485, 1339760, 1339996, 1340058, 1340547, 1341601, 1341656, 1341815, 1342568, 1342605, 1342696, 1342786, 1342913, 1343432, 1343621, 1343732, 1343782, 1344417, 1344864, 1345089, 1345396, 1345910, 1346192, 1346218, 1346624, 1346930, 1347208, 1347350, 1347486, 1348270, 1348963, 1349055, 1349144, 1349491, 1349588, 1349642, 1349696, 1349739, 1349883, 1349966, 1350011, 1350592, 1350642, 1350808, 1350824, 1350919, 1351327, 1351982, 1352011, 1352141, 1352566, 1352712, 1352866, 1353038, 1353062, 1353075, 1353638, 1353813, 1354128, 1354293, 1354337, 1354574, 1354598, 1354614, 1354775, 1354999, 1355115, 1355248, 1355285, 1355320, 1355574, 1356901, 1356904, 1357147, 1357198, 1357601, 1357683, 1357717, 1357843, 1357884, 1358068, 1358118, 1358277, 1358391, 1358513, 1359271, 1359751, 1359754, 1360390, 1360519, 1360544, 1360692, 1360714, 1360866, 1361136, 1361357, 1361631, 1362038, 1362378, 1362428, 1362459, 1362707, 1363270, 1363339, 1363440, 1363495, 1363579, 1363623, 1363739, 1363883, 1364429, 1364651, 1365067, 1365358, 1365456, 1365770, 1365812, 1365883, 1366060, 1366295, 1366553, 1366869, 1366983, 1366983, 1367047, 1367334, 1367366, 1367851, 1367957, 1367993, 1368028, 1368176, 1368182, 1368306, 1368500, 1368737, 1368933, 1369098, 1369746, 1369814, 1369947, 1370717, 1370765, 1370781, 1371058, 1371079, 1371086, 1371163, 1371315, 1371341, 1372336, 1372424, 1372435, 1372632, 1372842, 1372934, 1373057, 1373336, 1374228, 1374325, 1374594, 1374855, 1375287, 1375436, 1375565, 1375702, 1375778, 1375931, 1376141, 1376627, 1376855, 1376891, 1377011, 1377515, 1377718, 1377957, 1378045, 1378127, 1378145, 1378289, 1378448, 1379116, 1379184, 1379323, 1379638, 1379713, 1379719, 1380122, 1380307, 1380328, 1380404, 1380642, 1380917, 1380985, 1381730, 1381869, 1381964, 1382101, 1382186, 1382438, 1382510, 1383035, 1383095, 1383336, 1383459, 1383592, 1384840, 1385753, 1386020, 1386352, 1386790, 1386943, 1387145, 1387152, 1387241, 1388441, 1388581, 1388734, 1389080, 1389189, 1389543, 1389849, 1389871, 1390152, 1390193, 1390989, 1391066, 1391139, 1391145, 1391475, 1391580, 1391779, 1392062, 1392165, 1392519, 1393274, 1393361, 1393433, 1393448, 1393802, 1394444, 1394487, 1394634, 1394667, 1395104, 1395152, 1395434, 1395675, 1395839, 1395967, 1396353, 1396936, 1396966, 1397029, 1397081, 1397477, 1397498, 1397620, 1397785, 1398019, 1399133, 1399672, 1400009, 1400049, 1401107, 1401199, 1401289, 1401570, 1401880, 1402113, 1402191, 1402275, 1402440, 1402516, 1402545, 1402650, 1402836, 1402845, 1403089, 1403461, 1403514, 1403648, 1403686, 1403876, 1404062, 1404130, 1404365, 1404486, 1404855, 1405023, 1405690, 1405954, 1405986, 1406021, 1406482, 1406816, 1406851, 1407312, 1407804, 1408543, 1409082, 1409851, 1410258, 1410682, 1411026, 1411063, 1411162, 1411552, 1412580, 1412649, 1412990, 1413115, 1413177, 1413517, 1413564, 1413760, 1413837, 1413965, 1414219, 1414284, 1414477, 1414596, 1414775, 1414926, 1415171, 1415775, 1415878, 1416038, 1416115, 1416168, 1416628, 1416662, 1416738, 1416801, 1417202, 1417211, 1417270, 1417539, 1417546, 1417750, 1417810, 1417926, 1418241, 1418564, 1418802, 1418863, 1418943, 1418965, 1419035, 1419100, 1419228, 1419242, 1419268, 1419268, 1419615, 1420047, 1420130, 1420215, 1421478, 1421691, 1421966, 1422500, 1422647, 1423083, 1423443, 1423770, 1424030, 1424494, 1424728, 1424815, 1425082, 1425573, 1425801, 1426574, 1426605, 1426945, 1427336, 1427604, 1427669, 1427829, 1428323, 1428610, 1428864, 1428876, 1429160, 1429178, 1429441, 1429501, 1429656, 1429863, 1429912, 1429976, 1430221, 1430461, 1430648, 1430676, 1430737, 1431205, 1431337, 1431381, 1431628, 1431739, 1432271, 1433236, 1433542, 1433601, 1433654, 1433699, 1433706, 1433824, 1434042, 1434665, 1434724, 1435372, 1435550, 1436101, 1436106, 1436274, 1436312, 1436354, 1437228, 1437456, 1437637, 1437667, 1437669, 1437680, 1437681, 1437682, 1437871, 1437949, 1438003, 1438472, 1438960, 1439068, 1439554, 1439709, 1440134, 1440203, 1440355, 1440401, 1440515, 1440733, 1440743, 1440925, 1441095, 1441927, 1442186, 1442191, 1442193, 1442599, 1442805, 1442900, 1442931, 1442960, 1443112, 1443742, 1443768, 1443888, 1444087, 1444346, 1445208, 1445529, 1445541, 1445553, 1445750, 1446008, 1446362, 1446856, 1447253, 1447944, 1448526, 1448675, 1449056, 1449189, 1449262, 1449287, 1449329, 1449438, 1449504, 1449742, 1449770, 1449901, 1450187, 1450275, 1450544, 1450720, 1450732, 1450791, 1451760, 1451841, 1452553, 1453223, 1453407, 1454838, 1455115, 1455263, 1455431, 1455772, 1455936, 1456215, 1456508, 1456559, 1457290, 1457610, 1457641, 1457956, 1458057, 1458410, 1458787, 1458954, 1459355, 1459398, 1459468, 1459526, 1459686, 1460121, 1460329, 1460596, 1460619, 1460666, 1461124, 1461432, 1461435, 1461509, 1461641, 1461929, 1462450, 1462471, 1462624, 1462641, 1462701, 1462740, 1462898, 1462992, 1463189, 1463434, 1463772, 1463914, 1464240, 1464283, 1464348, 1464355, 1464692, 1464866, 1464876, 1464912, 1465729, 1465840, 1466023, 1466035, 1466384, 1467018, 1467168, 1467176, 1467316, 1467318, 1467665, 1467939, 1468331, 1468474, 1468562, 1468615, 1468810, 1468963, 1469098, 1469290, 1469531, 1469547, 1469883, 1470093, 1470364, 1470377, 1470417, 1470425, 1470438, 1470443, 1470523, 1470975, 1471728, 1471842, 1472094, 1472101, 1472238, 1472474, 1472593, 1472604, 1472617, 1472894, 1473255, 1473266, 1473280, 1473305, 1473499, 1474027, 1474093, 1474119, 1474732, 1474896, 1475005, 1475244, 1475379, 1475757, 1476081, 1476364, 1476431, 1476436, 1476500, 1476524, 1476592, 1476820, 1477033, 1477321, 1477332, 1477564, 1478151, 1478248, 1478546, 1478547, 1478887, 1479061, 1479338, 1479546, 1480168, 1480683, 1481065, 1481101, 1481208, 1481219, 1481314, 1481768, 1481777, 1481814, 1482304, 1482455, 1482947, 1482989, 1483064, 1483478, 1484141, 1484463, 1484522, 1484944, 1485475, 1485621, 1485627, 1485809, 1485817, 1485889, 1486199, 1486330, 1486393, 1486534, 1486581, 1486842, 1486854, 1487155, 1487250, 1487620, 1487691, 1487732, 1488108, 1488186, 1488358, 1488525, 1488828, 1489310, 1489317, 1489405, 1489491, 1490014, 1490073, 1490371, 1490376, 1490924, 1491304, 1491448, 1492012, 1492091, 1492248, 1492260, 1492371, 1492464, 1492741, 1492779, 1492911, 1493011, 1493062, 1493424, 1493827, 1493850, 1494122, 1494617, 1494794, 1495344, 1495471, 1495513, 1495984, 1497009, 1497036, 1497637, 1497694, 1497704, 1497778, 1497922, 1498125, 1498281, 1498408, 1498483, 1498534, 1498838, 1499021, 1499372, 1499376, 1499410, 1499847, 1500687, 1500900, 1500931, 1501657, 1501738, 1501956, 1502102, 1502269, 1502568, 1502705, 1503470, 1503508, 1503570, 1503847, 1504597, 1504605, 1504635, 1504807, 1504825, 1505308, 1505458, 1505772, 1505904, 1506260, 1506570, 1506902, 1507063, 1507127, 1507163, 1507256, 1507334, 1507413, 1507598, 1508022, 1508045, 1508302, 1509093, 1509256, 1509365, 1510410, 1510418, 1511032, 1511114, 1511154, 1511409, 1511821, 1512030, 1512254, 1512503, 1512568, 1513096, 1513127, 1513164, 1513558, 1513567, 1514129, 1514508, 1514711, 1514881, 1515302, 1515385, 1516001, 1516121, 1516232, 1516372, 1516700, 1517372, 1517374, 1517570, 1517695, 1518473, 1518858, 1518876, 1518997, 1519352, 1519504, 1520030, 1520104, 1520165, 1520512, 1521244, 1521652, 1521670, 1521674, 1521861, 1522051, 1522122, 1522126, 1522671, 1522814, 1522825, 1523137, 1523880, 1523894, 1524019, 1524024, 1524762, 1525007, 1525164, 1525304, 1525317, 1525471, 1525788, 1526017, 1526188, 1526466, 1526740, 1527130, 1527176, 1527886, 1528136, 1528249, 1528328, 1528372, 1528455, 1528833, 1529130, 1529218, 1529814, 1530306, 1530394, 1530398, 1530869, 1531376, 1531933, 1532139, 1532362, 1532476, 1532591, 1532625, 1533259, 1533327, 1533460, 1533556, 1533598, 1533928, 1534224, 1534488, 1534505, 1534602, 1534807, 1534939, 1534991, 1535066, 1535326, 1535517, 1535670, 1535809, 1535813, 1536406, 1536555, 1537155, 1537312, 1537376, 1537504, 1537770, 1538088, 1538108, 1538147, 1538273, 1538283, 1538411, 1538594, 1538604, 1539196, 1539801, 1539814, 1539905, 1539916, 1540248, 1540420, 1540477, 1540576, 1540809, 1541113, 1541184, 1541463, 1541473, 1541540, 1541542, 1541601, 1541842, 1542092, 1542235, 1542722, 1543347, 1543653, 1543730, 1543827, 1544065, 1544099, 1544912, 1545145, 1545191, 1545380, 1546132, 1546682, 1546724, 1546759, 1546973, 1547146, 1547622, 1547879, 1548044, 1549263, 1549307, 1550180, 1550290, 1550295, 1550369, 1550449, 1550506, 1550624, 1550817, 1550920, 1550964, 1551249, 1551378, 1551629, 1551874, 1552326, 1552601, 1552974, 1553288, 1553502, 1553861, 1553974, 1554637, 1554648, 1554999, 1555434, 1555606, 1555638, 1555780, 1556083, 1556378, 1556392, 1556441, 1556536, 1556718, 1557079, 1557172, 1557250, 1558124, 1558248, 1558274, 1558291, 1558335, 1558371, 1558430, 1559172, 1559184, 1559558, 1559966, 1560180, 1560587, 1560634, 1560735, 1561585, 1562317, 1562579, 1562688, 1563286, 1563429, 1563432, 1563595, 1563614, 1564043, 1564136, 1564218, 1565326, 1565405, 1565546, 1565570, 1565735, 1565874, 1565986, 1566061, 1566232, 1566271, 1567179, 1567369, 1567567, 1567581, 1567583, 1567649, 1568162, 1568216, 1568497, 1568829, 1568838, 1569124, 1569179, 1569403, 1569632, 1569678, 1569691, 1570496, 1571043, 1571144, 1571633, 1572005, 1572109, 1572311, 1572328, 1572671, 1573172, 1573375, 1573453, 1573864, 1574174, 1574222, 1574535, 1575048, 1575472, 1575488, 1575518, 1575603, 1575696, 1576323, 1576342, 1576880, 1577243, 1577255, 1577403, 1577499, 1577551, 1577560, 1578928, 1579070, 1579123, 1579373, 1579408, 1579428, 1579565, 1579718, 1580310, 1580319, 1580405, 1580856, 1580884, 1581084, 1581287, 1581506, 1582431, 1582575, 1583089, 1583567, 1583605, 1583641, 1583846, 1584554, 1585320, 1585383, 1585424, 1585952, 1585985, 1586102, 1586112, 1586514, 1586667, 1586923, 1587320, 1587433, 1587445, 1587893, 1587964, 1588346, 1588454, 1588524, 1589463, 1589483, 1589847, 1589888, 1589915, 1590262, 1590382, 1590515, 1590655, 1590872, 1590912, 1590972, 1591037, 1591418, 1591528, 1591538, 1591996, 1592200, 1592543, 1592709, 1592875, 1593135, 1593256, 1593331, 1593604, 1593782, 1593931, 1593995, 1594150, 1594629, 1594726, 1594771, 1594819, 1594888, 1594953, 1594963, 1595117, 1595189, 1595461, 1595538, 1595765, 1596413, 1596802, 1597069, 1597221, 1598008, 1598136, 1598350, 1598481, 1598640, 1598809, 1599085, 1599267, 1599388, 1599835, 1600198, 1600274, 1600277, 1600550, 1601091, 1601267, 1601268, 1601291, 1601817, 1601904, 1601955, 1602137, 1602226, 1602326, 1602841, 1603152, 1603360, 1603466, 1603484, 1603695, 1603899, 1604263, 1604345, 1604374, 1604709], 655]) == 20\nassert my_solution.maximizeWin(**[[781574104, 781585918, 781586427, 781607305, 781697607, 781741079, 781742265, 781745787, 781760186, 781828455, 781854971, 781871730, 781908989, 782078557, 782098848, 782102640, 782102687, 782207039, 782214340, 782284871, 782293674, 782313692, 782333204, 782421578, 782423174, 782463564, 782573772, 782586667, 782628953, 782657307, 782715661, 782766910, 782786305, 782820350, 782829344, 782946494, 783030188, 783054067, 783150041, 783201308, 783214820, 783222920, 783276872, 783383676, 783414336, 783425671, 783452705, 783459950, 783511244, 783522867, 783563395, 783600961, 783643342, 783661914, 783681312, 783720966, 783790324, 783898474, 783927827, 783937125, 783974146, 783980015, 784027670, 784036379, 784059233, 784080840, 784084793, 784133517, 784165714, 784194506, 784287695, 784370531, 784377025, 784395646, 784399931, 784410113, 784412415, 784423672, 784482059, 784505208, 784517911, 784556177, 784585827, 784634204, 784658855, 784660821, 784684120, 784751395, 784784947, 784832970, 784857232, 784877728, 784881364, 784900790, 784917187, 784938835, 784955876, 784985843, 784998666, 785199250, 785203928, 785255193, 785273832, 785351874, 785363872, 785363876, 785405785, 785586436, 785719587, 785723685, 785746482, 785781794, 785783325, 785785077, 785837663, 785852043, 785929648, 785949235, 785965502, 786057783, 786108457, 786108678, 786138172, 786158645, 786174481, 786189757, 786190932, 786244441, 786251419, 786266989, 786298115, 786304082, 786335998, 786402337, 786436987, 786464537, 786550367, 786603604, 786690331, 786714076, 786722133, 786922888, 786925937, 786928025, 786945336, 787052308, 787134603, 787169783, 787224423, 787229552, 787246785, 787257358, 787321040, 787350952, 787366420, 787454908, 787456808, 787525946, 787531018, 787555212, 787736296, 787789618, 787803811, 787828723, 787887476, 787900526, 787905931, 787910617, 787951801, 787954168, 787995531, 787996824, 788042603, 788055443, 788069676, 788089994, 788188665, 788197220, 788203987, 788220622, 788262969, 788299350, 788300298, 788383654, 788487283, 788531472, 788552688, 788617031, 788648826, 788652387, 788665485, 788677725, 788708071, 788711980, 788754171, 788803403, 788816909, 788884516, 788976834, 789052540, 789074188, 789080514, 789119516, 789139302, 789241640, 789258889, 789265441, 789281733, 789282900, 789422712, 789455544, 789468867, 789493466, 789504200, 789540389, 789585962, 789589391, 789605601, 789645676, 789696163, 789705442, 789737499, 789821421, 789838699, 789855046, 789898618, 789945874, 789956511, 789995973, 789996735, 790006567, 790025543, 790131415, 790159360, 790163727, 790239388, 790255720, 790442423, 790483647, 790484664, 790504412, 790546804, 790550057, 790566856, 790572939, 790646054, 790655582, 790657219, 790660457, 790739176, 790741680, 790746461, 790753245, 790763635, 790764458, 790777647, 790778677, 790972065, 791044089, 791068920, 791095383, 791110085, 791132345, 791133158, 791155944, 791232012, 791256442, 791276552, 791294044, 791313863, 791393200, 791435325, 791465423, 791494337, 791509815, 791564374, 791566595, 791647518, 791718950, 791750717, 791769154, 791769633, 791773998, 791782203, 791793772, 791825390, 791872864, 791874082, 791934527, 791980765, 791995328, 792025597, 792038617, 792051755, 792069099, 792082987, 792092593, 792104417, 792141505, 792158531, 792167568, 792180281, 792198319, 792208060, 792248533, 792253591, 792266966, 792267898, 792269813, 792300784, 792338118, 792363653, 792363801, 792398228, 792454428, 792548368, 792567104, 792587815, 792594392, 792684873, 792689709, 792729712, 792731954, 792764283, 792801879, 792851777, 792883704, 792894714, 792950146, 793009735, 793123445, 793132651, 793159805, 793197865, 793228763, 793238282, 793243674, 793267960, 793287479, 793308936, 793374057, 793404202, 793415455, 793506537, 793537341, 793592257, 793626297, 793628387, 793703602, 793711644, 793762243, 793902788, 793908554, 793933212, 794003012, 794018082, 794035896, 794112355, 794141876, 794144822, 794177672, 794248772, 794264878, 794307634, 794312215, 794328873, 794338015, 794395198, 794487732, 794501856, 794537046, 794661717, 794674325, 794727907, 794760715, 794783080, 794796485, 794796866, 794802500, 794818122, 794860651, 794868333, 794874618, 794895585, 795092685, 795111616, 795118350, 795174530, 795195863, 795235292, 795265122, 795271156, 795284135, 795389300, 795454494, 795483808, 795577927, 795611399, 795622232, 795638633, 795650568, 795654939, 795700845, 795701018, 795716387, 795723656, 795739201, 795765891, 795808938, 795985920, 795990042, 796078054, 796172951, 796196356, 796229778, 796252516, 796253254, 796256871, 796277048, 796304478, 796330917, 796387646, 796391484, 796391753, 796446098, 796477955, 796500051, 796552883, 796632305, 796659034, 796727074, 796794112, 796845286, 796861738, 796885476, 796898002, 796922096, 796994050, 797016418, 797043244, 797067974, 797072154, 797085908, 797086191, 797145988, 797175698, 797179343, 797223925, 797244469, 797309618, 797321314, 797389515, 797405767, 797410566, 797456719, 797463081, 797493111, 797520607, 797654233, 797770978, 797779468, 797822108, 797842662, 797867407, 797883301, 798037966, 798076742, 798138064, 798144452, 798205390, 798344630, 798362690, 798371397, 798376337, 798384005, 798388523, 798392620, 798418837, 798600000, 798620491, 798627133, 798645706, 798654047, 798687485, 798719250, 798764362, 798826713, 798832846, 798897737, 798909236, 798911360, 798913965, 798916878, 798922180, 798961615, 798997728, 799016352, 799080664, 799180867, 799210023, 799226154, 799247856, 799307179, 799354588, 799416310, 799516275, 799523679, 799603072, 799650686, 799674245, 799711679, 799714029, 799785708, 799794629, 799795109, 799813984, 799848842, 799878673, 799880707, 799934660, 800010844, 800014965, 800028099, 800044441, 800159324, 800205097, 800238959, 800251237, 800360677, 800389353, 800398078, 800403847, 800484043, 800528581, 800535809, 800589087, 800618746, 800646287, 800648945, 800662679, 800706895, 800791027, 800807864, 800811451, 800819591, 800887683, 800901563, 800911963, 800924053, 800952914, 800959653, 800961269, 800966437, 801011909, 801062652, 801082929, 801092456, 801144019, 801146879, 801196182, 801234181, 801253722, 801269904, 801292912, 801315519, 801322243, 801341454, 801350126, 801353398, 801394840, 801443826, 801461770, 801491001, 801492469, 801497668, 801586464, 801590775, 801632055, 801639181, 801675165, 801734444, 801789164, 801789770, 801813326, 801832801, 801834808, 801872226, 801890143, 801904953, 801935859, 801960421, 802036519, 802044398, 802059327, 802066356, 802084122, 802117036, 802207110, 802299819, 802320963, 802329190, 802379925, 802387237, 802396171, 802408222, 802418599, 802432638, 802486035, 802498742, 802523168, 802599350, 802617409, 802620551, 802637043, 802659543, 802659970, 802670766, 802728332, 802729956, 802733110, 802760349, 802774607, 802784132, 802832005, 802841584, 802888602, 802893048, 802910545, 802925752, 802943790, 802965298, 802972667, 802999938, 803071741, 803115917, 803141672, 803196648, 803216147, 803240889, 803259448, 803388254, 803391553, 803454954, 803470993, 803551739, 803684289, 803726676, 803731979, 803733368, 803746489, 803751202, 803772874, 803784796, 803792788, 803799290, 803857886, 803905496, 803913411, 803946229, 804063152, 804083695, 804158678, 804164140, 804193835, 804203996, 804272270, 804285248, 804353284, 804436106, 804452975, 804458532, 804470419, 804506998, 804554494, 804613344, 804641909, 804642527, 804719576, 804761620, 804783147, 804790299, 804827996, 804829556, 804838295, 804885774, 804891115, 804943429, 804990183, 804991442, 805003591, 805083316, 805083853, 805104506, 805137212, 805277972, 805290205, 805304570, 805372087, 805394907, 805413944, 805522742, 805585126, 805606010, 805613420, 805638644, 805640963, 805642698, 805659777, 805713390, 805754970, 805819478, 805861689, 805865245, 805918390, 806019907, 806087753, 806146361, 806181862, 806204364, 806244279, 806269486, 806275997, 806280858, 806302978, 806304604, 806329029, 806348773, 806376737, 806385753, 806421449, 806426718, 806495604, 806511175, 806532412, 806541445, 806570772, 806627364, 806640382, 806657682, 806661280, 806681443, 806740099, 806960897, 806972550, 807014162, 807159840, 807200536, 807224367, 807231040, 807282244, 807439756, 807518850, 807566657, 807579371, 807605362, 807671325, 807716250, 807800145, 807814802, 807830467, 807841276, 807940921, 807965397, 807966716, 807971346, 808023752, 808027086, 808040496, 808091334, 808098191, 808128767, 808159047, 808311942, 808357346, 808415577, 808485601, 808507534, 808513978, 808521262, 808534081, 808542024, 808552050, 808589971, 808598635, 808620351, 808656911, 808701509, 808765988, 808867165, 808922794, 808988000, 809012989, 809031842, 809034708, 809069665, 809087146, 809099305, 809122684, 809159694, 809179604, 809226873, 809234312, 809290278, 809309161, 809368425, 809419939, 809428550, 809490088, 809498372, 809575071, 809580174, 809583566, 809605612, 809622207, 809708592, 809744199, 809756716, 809782008, 809815801, 809879012, 809892228, 809901458, 809914871, 809936228, 809983957, 809991285, 810033161, 810039992, 810089440, 810105312, 810142477, 810145367, 810175177, 810191254, 810212742, 810256736, 810269783, 810272606, 810311322, 810313945, 810321694, 810349677, 810402126, 810411722, 810477198, 810484323, 810558584, 810592317, 810612942, 810641709, 810750077, 810768086, 810770063, 810776698, 810789295, 810790893, 810808497, 810892468, 810916926, 810949655, 811052741, 811058061, 811151347, 811172996, 811184539, 811239214, 811279239, 811293635, 811317456, 811320690, 811332285, 811333664, 811352142, 811401612, 811439105, 811462800, 811466563, 811476075, 811476586, 811478945, 811542788, 811595328, 811660388, 811709214, 811751203, 811758612, 811770419, 811784323, 811800916, 811923310, 811937633, 811945459, 811979408, 811991146, 812004581, 812033206, 812069153, 812079727, 812092070, 812102071, 812164843, 812189975, 812214348, 812221441, 812244217, 812295598, 812337884, 812388777, 812439934, 812455883, 812456548, 812485960, 812494633, 812516225, 812517484, 812539926, 812583635, 812628688, 812635192, 812689520, 812692411, 812693913, 812730977, 812736469, 812739367, 812762492, 812774846, 812791705, 812809919, 812814065, 812816778, 812936002, 812947744, 812951753, 813005012, 813016725, 813074859, 813130780, 813153118, 813165685, 813197381, 813255433, 813270302, 813293661, 813299150, 813337546, 813494121, 813495640, 813527418, 813547617, 813571449, 813629528, 813633976, 813638796, 813657471, 813697917, 813768941, 813790078, 813839214, 813866390, 813888259, 814045339, 814070356, 814114573, 814139108, 814179373, 814246673, 814270404, 814285020, 814287604, 814327898, 814438631, 814448439, 814451731, 814498902, 814555750, 814569247, 814591049, 814593474, 814700390, 814741447, 814763459, 814769853, 814779436, 814786299, 814801088, 814903176, 814912313, 815011002, 815070271, 815075897, 815108600, 815198781, 815228282, 815267255, 815282321, 815306637, 815349973, 815371024, 815396343, 815516798, 815524898, 815538493, 815551725, 815590483, 815590665, 815602009, 815641735, 815644536, 815663351, 815665623, 815674725, 815718022, 815723771, 815731375, 815736257, 815784322, 815794321, 815836099, 815890837, 815924845, 815953060, 815960060, 815987387, 815994225, 816039087, 816100428, 816207591, 816264732, 816277755, 816279820, 816283084, 816431505, 816450288, 816485288, 816495992, 816519353, 816576462, 816590782, 816598284, 816704557, 816807869, 816877448, 816928779, 816989370, 816993046, 817007404, 817029673, 817050573, 817086908, 817088891, 817112362, 817122459, 817133706, 817135026, 817279564, 817309680, 817382411, 817388795, 817390150, 817394199, 817440477, 817485948, 817523716, 817538917, 817556216, 817557901, 817580715, 817588348, 817589150, 817698310, 817719044, 817732683, 817859148, 817944384, 817972311, 818013761, 818024854, 818036886, 818071542, 818138459, 818200748, 818255971, 818294651, 818304981, 818314571, 818314602, 818348430, 818446443, 818548224, 818568163, 818633205, 818699342, 818768732, 818856427, 818870951, 818931201, 818933839, 818947576, 818971654, 818993337, 819009803, 819066333, 819089062, 819104054, 819131762, 819158717, 819170100, 819176497, 819233327, 819268299, 819275245, 819320295, 819370410, 819392906, 819411008, 819448870, 819490788, 819543947, 819570575, 819578458, 819586213, 819598334, 819607217, 819670790, 819672835, 819756603, 819772671, 819806923, 819820068, 819857360, 819875013, 819923935, 820043618, 820043725, 820065965, 820075140, 820077181, 820088267, 820090610, 820106922, 820108368, 820149735, 820156879, 820161670, 820168345, 820180064, 820215919, 820306449, 820358289, 820362023, 820370680, 820390855, 820451523, 820496688, 820500151, 820567882, 820579322, 820614381, 820672318, 820743603, 820787564, 820787641, 821000385, 821011218, 821101658, 821159072, 821218615, 821223189, 821243185, 821255589, 821296031, 821376616, 821382974, 821402406, 821406740, 821452702, 821472101, 821475585, 821507448, 821574946, 821605147, 821608940, 821629828, 821654335, 821760061, 821775279, 821889300, 821898309, 821980476, 821988741, 822023820, 822058780, 822078088, 822082678, 822082991, 822112366, 822131398, 822218072, 822242230, 822339269, 822339563, 822343649, 822360409, 822393757, 822396624, 822437918, 822465259, 822491457, 822510890, 822549825, 822585892, 822747589, 822749424, 822770805, 822851444, 822851977, 822875143, 822882586, 822920711, 822937373, 822956277, 822997377, 823008288, 823038433, 823059308, 823062724, 823160207, 823168520, 823176195, 823178193, 823194725, 823200848, 823240115, 823266791, 823310434, 823347672, 823381728, 823476189, 823550306, 823576357, 823588785, 823605601, 823639914, 823640924, 823663838, 823699250, 823709226, 823715688, 823720115, 823849350, 823866541, 823914053, 824018737, 824027986, 824057853, 824080019, 824087556, 824166924, 824252629, 824262679, 824278204, 824337944, 824351363, 824403845, 824412530, 824420201, 824498351, 824525473, 824555260, 824579016, 824651089, 824663359, 824665474, 824703677, 824749011, 824758769, 824771713, 824774410, 824844501, 824881267, 824886737, 824887511, 824909594, 824913823, 824975527, 824979080, 824988871, 825022595, 825092241, 825108830, 825123260, 825148476, 825195002, 825238179, 825325539, 825361340, 825365366, 825368928, 825407252, 825459879, 825499610, 825508488, 825533983, 825577604, 825664869, 825681186, 825696455, 825708387, 825748859, 825751056, 825755926, 825832261, 825857786, 825887524, 825908749, 825912824, 825944461, 825949297, 826084079, 826117925, 826229063, 826266738, 826277132, 826371630, 826390828, 826393770, 826409490, 826419876, 826451638, 826567107, 826570076, 826598287, 826639658, 826646493, 826668487, 826689065, 826704450, 826736263, 826741863, 826777323, 826785940, 826796051, 826804556, 826856786, 826870694, 826875900, 827004266, 827028866, 827056226, 827127714, 827158609, 827176157, 827256137, 827259306, 827284233, 827400382, 827444721, 827445495, 827585754, 827641416, 827792766, 827803093, 827840977, 827849417, 827858807, 827905051, 828030524, 828054866, 828062387, 828126453, 828200974, 828220113, 828221137, 828287258, 828303597, 828326681, 828329628, 828338549, 828365470, 828367139, 828376038, 828426590, 828467036, 828476492, 828477975, 828509709, 828598241, 828616308, 828669510, 828697249, 828747060, 828751590, 828796079, 828834000, 828835853, 828856316, 828881207, 828909833, 828930111, 828955291, 828997212, 829029120, 829069109, 829091177, 829101015, 829116734, 829124930, 829183134, 829186759, 829280830, 829450566, 829455664, 829477231, 829523761, 829599728, 829613768, 829706986, 829708673, 829712728, 829736785, 829750624, 829772190, 829806817, 829850094, 829886087, 829893256, 829925360, 829936884, 829983478, 830018587, 830023282, 830115036, 830196987, 830201959, 830287593, 830324092, 830370271, 830384094, 830428021, 830482153, 830495882, 830496310, 830509288, 830525054, 830532816, 830565732, 830586212, 830629793, 830636488, 830657479, 830663470, 830681401, 830729388, 830739646, 830775315, 830806990, 830849482, 830869391, 830938250, 830996253, 831064648, 831077242, 831095414, 831140051, 831141536, 831145089, 831196924, 831230725, 831270966, 831294848, 831474969, 831483178, 831488179, 831494695, 831503906, 831584768, 831600440, 831609072, 831692526, 831710436, 831719595, 831736197, 831769288, 831814459, 831842785, 831946826, 831976997, 831981942, 831996400, 832077645, 832146906, 832147393, 832181719, 832209070, 832215683, 832222240, 832268305, 832272397, 832382572, 832390395, 832422093, 832450482, 832451223, 832487838, 832504913, 832549339, 832681229, 832699017, 832721270, 832738471, 832800255, 832802744, 832816281, 832845352, 832845849, 832870415, 832917203, 832932435, 832976359, 833094105, 833187281, 833193414, 833194370, 833197835, 833210590, 833212402, 833252444, 833258161, 833258370, 833292097, 833336848, 833392557, 833394202, 833471198, 833476700, 833493790, 833567900, 833568015, 833605192, 833641793, 833651329, 833732629, 833777369, 833831300, 833843063, 833946490, 833963731, 833980395, 834007852, 834029587, 834036100, 834042931, 834093323, 834116860, 834132152, 834137123, 834176221, 834192717, 834233184, 834261306, 834264621, 834277493, 834391392, 834421870, 834423606, 834426377, 834433061, 834451037, 834519819, 834566641, 834656929, 834687689, 834693879, 834716806, 834724248, 834742177, 834797215, 834821999, 834879338, 834886902, 834892697, 834931490, 834968243, 834994524, 835001843, 835004911, 835037411, 835052430, 835146669, 835178897, 835182053, 835187466, 835199899, 835223517, 835276366, 835326333, 835401518, 835402094, 835432097, 835461910, 835487373, 835488043, 835504412, 835535282, 835654141, 835679808, 835681644, 835703846, 835739279, 835749947, 835752451, 835760856, 835824639, 835914514, 835948741, 835978782, 835982882, 836000260, 836081487, 836100592, 836105452, 836105633, 836170816, 836187243, 836245863, 836247644, 836249285, 836259287, 836265680, 836343805, 836443858, 836573963, 836668455, 836693359, 836724097, 836738744, 836782418, 836866858, 836879905, 836935258, 836981708, 836989893, 837021177, 837064278, 837081805, 837120523, 837123514, 837173373, 837224994, 837279085, 837285824, 837355410, 837462182, 837492033, 837527537, 837531557, 837560423, 837593852, 837623118, 837732296, 837757273, 837760325, 837760651, 837785744, 837789948, 837795117, 837800364, 837810215, 837847665, 837854320, 837859975, 837911360, 837980569, 838066063, 838069303, 838081681, 838147510, 838169263, 838190736, 838198681, 838212281, 838252169, 838325339, 838335738, 838364874, 838389126, 838420028, 838431581, 838448681, 838461674, 838491063, 838640717, 838697376, 838743400, 838782240, 838809626, 838814698, 838834885, 838837666, 838856662, 838940456, 838960372, 838987734, 839042144, 839103069, 839155387, 839159171, 839196727, 839213806, 839285330, 839316964, 839341069, 839377853, 839403251, 839405469, 839427088, 839443974, 839445425, 839524194, 839574501, 839660631, 839663657, 839708828, 839722603, 839753775, 839770335, 839773869, 839827072, 839855954, 839933551, 839946776, 839950208, 839953001, 840005212, 840027496, 840034219, 840044679, 840048862, 840058524, 840111213, 840125863, 840155728, 840214494, 840292315, 840317042, 840336087, 840362136, 840459775, 840469450, 840535190, 840542395, 840565874, 840578327, 840678508, 840734849, 840752139, 840809241, 840869342, 840881516, 840882577, 840960169, 841006668, 841089244, 841152986, 841215590, 841251159, 841260028, 841279115, 841310065, 841323174, 841354275, 841373803, 841384886, 841403505, 841497957, 841549948, 841555353, 841555401, 841595970, 841631960, 841645514, 841696581, 841752034, 841832077, 841840895, 841857638, 841864260, 841930972, 842011511, 842035921, 842056733, 842066969, 842069588, 842078328, 842109449, 842120545, 842152297, 842159970, 842193203, 842322215, 842390005, 842417000, 842431300, 842458913, 842484611, 842504497, 842586189, 842604450, 842682148, 842688274, 842688320, 842728837, 842733137, 842737422, 842752305, 842753447, 842790699, 842812639, 842813787, 842818213, 842925311, 842984798, 842993801, 843016503, 843032714, 843033164, 843074705, 843084447, 843086105, 843202433, 843204523, 843212853, 843215732, 843274263, 843281819, 843340584, 843380843, 843450130, 843459560, 843494696, 843561425, 843572222, 843604517, 843686500, 843710097, 843752757, 843795554, 843834482, 843835329, 843855093, 843874262, 843877426, 843886028, 843891885, 843898323, 843972381, 843974204, 844002153, 844071571, 844149357, 844249907, 844262584, 844307894, 844367003, 844384809, 844386548, 844492093, 844497944, 844511143, 844548770, 844598311, 844607340, 844609343, 844673134, 844684615, 844790353, 844796887, 844797184, 844824590, 844885749, 844886242, 845009188, 845023824, 845066067, 845158923, 845189654, 845232329, 845234188, 845235154, 845265936, 845275116, 845285879, 845344294, 845368908, 845378915, 845458262, 845471710, 845484285, 845491410, 845520578, 845534582, 845539109, 845571618, 845572803, 845579849, 845589926, 845596620, 845608904, 845612727, 845613317, 845621646, 845664712, 845691359, 845701396, 845791817, 845794863, 845827584, 845862922, 845884490, 845893947, 845902662, 845991498, 846004131, 846090380, 846114532, 846126457, 846127249, 846171465, 846212604, 846300660, 846399424, 846409854, 846423563, 846432577, 846476091, 846485795, 846497487, 846530792, 846551985, 846584060, 846683575, 846695089, 846744277, 846748854, 846770981, 846867639, 846913568, 846933767, 846964235, 846980403, 847029995, 847084590, 847118390, 847140428, 847145131, 847176269, 847198931, 847201257, 847268898, 847374824, 847420490, 847443126, 847444159, 847448926, 847498099, 847529766, 847622436, 847649006, 847672656, 847801555, 847888427, 847923019, 847928585, 847938161, 847957808, 848035990, 848092719, 848114785, 848133640, 848215541, 848240891, 848246400, 848274878, 848325286, 848366729, 848390725, 848451093, 848451870, 848455125, 848485920, 848496496, 848530719, 848597909, 848631994, 848679909, 848724658, 848778038, 848781748, 848813024, 848818892, 848870840, 848951552, 848990435, 849001806, 849040607, 849049534, 849063217, 849099085, 849107635, 849111839, 849112551, 849156769, 849179460, 849246889, 849247722, 849248010, 849266226, 849297770, 849315435, 849332975, 849335419, 849401766, 849423441, 849424557, 849467433, 849479034, 849495670, 849499351, 849569788, 849573717, 849587367, 849625759, 849692504, 849714334, 849729672, 849748305, 849752432, 849756169, 849759791, 849778894, 849797498, 849812725, 849839559, 849858404, 849892338, 849917550, 849922931, 849934464, 849971085, 849983137, 850013758, 850064893, 850318417, 850361311, 850374387, 850499667, 850560103, 850571512, 850572913, 850588465, 850608065, 850624467, 850658994, 850685861, 850711485, 850736717, 850762884, 850774640, 850783061, 850823700, 850892848, 850904496, 851003058, 851105715, 851156452, 851156907, 851166901, 851289830, 851311183, 851329974, 851354035, 851361153, 851403246, 851419249, 851491177, 851502001, 851509767, 851519168, 851566087, 851668916, 851691778, 851766765, 851772161, 851801209, 851862935, 851882553, 851883696, 851898233, 851934993, 851951984, 851976319, 852007395, 852046338, 852064012, 852075229, 852104177, 852124620, 852151302, 852155829, 852159971, 852174294, 852198141, 852220190, 852229676, 852232982, 852290328, 852304447, 852325165, 852337154, 852362214, 852401370, 852483962, 852497137, 852524844, 852548667, 852571963, 852605983, 852690503, 852744931, 852750986, 852778299, 852808785, 852837308, 852886784, 852916217, 852939051, 852978578, 852987550, 853002655, 853016050, 853078456, 853137056, 853197223, 853300525, 853313059, 853321076, 853355982, 853446210, 853494170, 853494308, 853529117, 853564774, 853573658, 853607610, 853624398, 853705660, 853721043, 853756343, 853797971, 853811365, 853857547, 853907679, 853926894, 853930454, 853954165, 853957309, 853992876, 854027509, 854046445, 854057197, 854069116, 854084777, 854155200, 854155289, 854204481, 854225082, 854298485, 854360924, 854414629, 854442217, 854464729, 854477793, 854509763, 854536765, 854588879, 854606190, 854613802, 854652574, 854666407, 854677707, 854712575, 854718983, 854740031, 854746999, 854779246, 854824765, 854854124, 854865377, 854887000, 854896031, 854932515, 854960984, 854965384, 854982397, 855030858, 855082150, 855089066, 855116919, 855126378, 855170518, 855209587, 855369286, 855404532, 855410615, 855416634, 855458888, 855488127, 855685199, 855695609, 855765097, 855779905, 855784554, 855796009, 855851567, 855869630, 855912205, 855966106, 856054205, 856060034, 856103929, 856121640, 856144070, 856155677, 856189531, 856236222, 856243054, 856291850, 856292246, 856312865, 856326457, 856345558, 856347332, 856485538, 856513790, 856516842, 856555120, 856571841, 856745556, 856749910, 856834322, 856876689, 856879495, 856887208, 856959201, 856995782, 856996775, 857071170, 857091492, 857101530, 857127150, 857208236, 857211100, 857230548, 857258912, 857300669, 857342234, 857344998, 857350580, 857392142, 857436388, 857492425, 857600366, 857649625, 857684159, 857684246, 857794911, 857806912, 857808493, 857819064, 857916408, 857962468, 857971959, 857973874, 858016157, 858037364, 858077003, 858134644, 858150753, 858155583, 858233482, 858250235, 858314241, 858342205, 858407315, 858468586, 858512018, 858513000, 858632738, 858656421, 858662044, 858663380, 858683592, 858719988, 858780291, 858787352, 858797355, 858797509, 858808908, 858894740, 858898281, 858913501, 858914594, 858972611, 859023911, 859067155, 859143891, 859245680, 859257803, 859345378, 859346593, 859347860, 859354609, 859359677, 859395117, 859453126, 859490328, 859529568, 859549142, 859561522, 859583151, 859583896, 859597792, 859656612, 859703929, 859705596, 859721292, 859783908, 859791923, 859861226, 859876894, 859905880, 859908764, 859942110, 859946396, 860020759, 860040551, 860075100, 860123168, 860170614, 860184092, 860192999, 860222729, 860225931, 860270763, 860311847, 860323953, 860370859, 860407350, 860450084, 860454937, 860509360, 860546069, 860602243, 860602408, 860881734, 860881989, 860892822, 860906713, 860919789, 860928172, 860964890, 861033584, 861124484, 861167195, 861170946, 861209872, 861245873, 861273328, 861295629, 861299085, 861312177, 861334968, 861335555, 861338524, 861353778, 861385193, 861409631, 861409839, 861428112, 861464821, 861467551, 861470704, 861490126, 861505704, 861512831, 861547501, 861554466, 861570925, 861615939, 861620812, 861678530, 861775169, 861798611, 861833148, 861844752, 861849132, 861886214, 861935041, 861965698, 861986080, 862095077, 862142662, 862149682, 862150270, 862154645, 862158944, 862234305, 862235546, 862264278, 862279020, 862316021, 862394722, 862540863, 862568246, 862614864, 862633410, 862716411, 862726837, 862798854, 862806354, 862808120, 862822950, 862828161, 862915462, 862925714, 862951633, 862959491, 862982471, 862984922, 863034459, 863175254, 863194829, 863225402, 863229562, 863267069, 863277042, 863372185, 863393707, 863457527, 863481030, 863495163, 863632023, 863657124, 863669387, 863730001, 863752541, 863798811, 863809863, 863848901, 863921053, 863936011, 863938920, 863940491, 864034597, 864041948, 864042741, 864177566, 864212544, 864215535, 864257569, 864270617, 864306292, 864318688, 864323001, 864379086, 864389693, 864406022, 864471922, 864521009, 864630317, 864636575, 864672096, 864723051, 864723926, 864750186, 864751393, 864805642, 864809554, 864815252, 864854617, 864901303, 864939008, 864956609, 864970265, 865041179, 865071369, 865076065, 865096944, 865112188, 865128298, 865142904, 865169427, 865230158, 865236597, 865247260, 865251605, 865335931, 865352595, 865368976, 865416486, 865448094, 865479888, 865501704, 865502539, 865513622, 865589213, 865630774, 865662131, 865678135, 865678381, 865691220, 865703381, 865712922, 865909955, 865921770, 865960003, 866039886, 866055545, 866144537, 866203129, 866245434, 866288169, 866333264, 866436732, 866438861, 866466166, 866501778, 866525639, 866594912, 866642265, 866692077, 866705801, 866745317, 866766633, 866870867, 866890796, 866896497, 866990506, 867081725, 867104130, 867165695, 867170311, 867179841, 867204904, 867234696, 867243510, 867329463, 867334577, 867380995, 867386803, 867485830, 867486396, 867488381, 867488824, 867494713, 867534725, 867548607, 867569336, 867589877, 867592920, 867640028, 867640775, 867656109, 867685808, 867737280, 867770468, 867795285, 868003898, 868036088, 868065396, 868065824, 868074817, 868082764, 868091327, 868098391, 868107983, 868167704, 868179583, 868206176, 868237580, 868283949, 868322256, 868335040, 868337707, 868357845, 868430631, 868435471, 868443709, 868464118, 868471312, 868473702, 868496318, 868501998, 868512754, 868517983, 868592266, 868625168, 868693186, 868698958, 868712781, 868733240, 868811735, 868863098, 868888149, 868891169, 868902360, 868946436, 868959966, 869046030, 869064375, 869114716, 869114965, 869130815, 869290984, 869298215, 869307874, 869308877, 869333403, 869345781, 869348077, 869381042, 869448646, 869471675, 869473058, 869476189, 869499439, 869527599, 869532871, 869559277, 869580248, 869584105, 869596145, 869608379, 869608586, 869658035, 869680729, 869711087, 869831178, 869880769, 869883011, 869976473, 870041589, 870043393, 870125776, 870138640, 870156732, 870221181, 870250482, 870269176, 870295212, 870297081, 870308765, 870310379, 870389308, 870400775, 870430661, 870485379, 870500657, 870609972, 870622141, 870654134, 870693906, 870739275, 870765887, 870783031, 870804887, 870877395, 870982412, 870994137, 871072207, 871072748, 871105921, 871112979, 871126093, 871179960, 871231456, 871263164, 871466744, 871476517, 871514691, 871556595, 871558570, 871623007, 871642733, 871663604, 871696224, 871703058, 871766289, 871807458, 871857631, 871898378, 871989094, 872049577, 872056388, 872057484, 872103032, 872129649, 872189881, 872210991, 872243867, 872264833, 872315554, 872348990, 872463074, 872531361, 872536766, 872571646, 872576834, 872643453, 872686924, 872765501, 872824239, 872896564, 873025028, 873031523, 873042683, 873049273, 873249363, 873257176, 873257717, 873271961, 873278948, 873294509, 873317211, 873325027, 873371889, 873382356, 873385044, 873441655, 873449574, 873463089, 873466992, 873530186, 873532174, 873653427, 873653727, 873678854, 873681548, 873685085, 873687440, 873720478, 873756251, 873769182, 873774992, 873787455, 873796093, 873914625, 873951576, 873957923, 873990174, 873991067, 874048397, 874053790, 874120409, 874153828, 874213059, 874235884, 874245030, 874272436, 874329512, 874336085, 874397810, 874486828, 874505493, 874508510, 874603712, 874614095, 874688349, 874731120, 874779997, 874784270, 874784271, 874818749, 874828589, 874888930, 874951700, 874964982, 875022028, 875087741, 875145663, 875169006, 875185981, 875238415, 875277423, 875332355, 875336920, 875345012, 875362595, 875394666, 875400678, 875404389, 875464109], 730]) == 4\n"}, "labels": {"questionId": "2673", "questionFrontendId": "2555", "questionTitle": "Maximize Win From Two Segments", "stats": {"totalAccepted": "3.6K", "totalSubmission": "8.7K", "totalAcceptedRaw": 3586, "totalSubmissionRaw": 8664, "acRate": "41.4%"}, "probedCases": [{"inputs": [[1, 1, 2, 2, 3, 3, 5], 2], "output": 7}, {"inputs": [[1, 2, 3, 4], 0], "output": 2}, {"inputs": [[1, 2, 3, 4, 5], 1], "output": 4}, {"inputs": [[2616, 2618, 2620, 2621, 2626, 2635, 2657, 2662, 2662, 2669, 2671, 2693, 2702, 2713, 2714, 2718, 2730, 2731, 2750, 2756, 2772, 2773, 2775, 2785, 2795, 2805, 2811, 2813, 2816, 2823, 2824, 2824, 2826, 2830, 2833, 2857, 2885, 2898, 2910, 2919, 2928, 2941, 2942, 2944, 2965, 2967, 2970, 2973, 2974, 2975, 2977, 3002, 3007, 3012, 3042, 3049, 3078, 3084, 3089, 3090, 3094, 3097, 3114, 3124, 3125, 3125, 3144, 3147, 3148, 3174, 3197, 3255, 3262, 3288, 3291, 3316, 3320, 3322, 3331, 3342, 3378, 3412, 3412, 3416, 3420, 3427, 3428, 3446, 3452, 3472, 3479, 3483, 3488, 3500, 3516, 3522, 3531, 3532, 3540, 3540, 3544, 3557, 3570, 3580, 3592, 3597, 3597, 3601, 3615, 3631, 3640, 3645, 3673, 3677, 3681, 3683, 3685, 3718, 3738, 3746, 3758, 3769, 3797, 3802, 3815, 3832, 3839, 3851, 3864, 3888, 3889, 3901, 3902, 3910, 3913, 3933, 3940, 3961, 3974, 3988, 4003, 4013, 4019, 4023, 4026, 4047, 4060, 4065, 4072, 4073, 4082, 4084, 4109, 4132, 4139, 4143, 4145, 4146, 4155], 6641], "output": 159}, {"inputs": [[3937, 3938, 3939, 3951, 3951, 3959, 3975, 3988, 3993, 4010, 4031, 4033, 4036, 4038, 4039, 4041, 4047, 4058, 4059, 4064, 4072, 4081, 4084, 4084, 4089, 4094, 4098, 4112, 4114, 4116, 4123, 4123, 4127, 4130, 4135, 4143, 4149, 4152, 4163, 4164, 4176, 4178, 4180, 4198, 4216, 4224, 4233, 4240, 4253, 4259, 4273, 4286, 4305, 4322, 4335, 4350, 4364, 4378, 4396, 4397, 4398, 4404, 4415, 4421, 4430, 4469, 4476, 4490, 4492, 4497, 4504, 4519, 4519, 4525, 4526, 4530, 4530, 4540, 4550, 4554, 4563, 4571, 4571, 4595, 4595, 4606, 4639, 4639, 4660, 4663, 4676, 4678, 4680, 4695, 4697, 4709, 4709, 4711, 4724, 4751, 4781, 4786, 4786, 4794, 4797, 4801, 4807, 4808, 4817, 4822, 4824, 4825, 4840, 4851, 4887, 4889, 4891, 4910, 4917, 4927, 4931, 4932, 4951, 4959, 4964, 4993, 4997, 5003, 5003, 5006, 5006, 5022, 5029, 5035, 5043, 5045, 5045, 5046, 5059, 5060, 5079, 5084, 5105, 5109, 5109, 5112, 5120, 5126, 5130, 5142, 5143, 5151, 5152, 5154, 5156, 5168, 5189, 5213, 5214, 5223, 5226, 5235, 5247, 5259, 5272, 5289, 5303, 5309, 5317, 5322, 5344, 5347, 5352, 5374, 5379, 5380, 5383, 5385, 5391, 5418, 5425, 5429, 5432, 5479, 5486, 5490, 5502, 5502, 5505, 5506, 5509, 5515, 5518, 5519, 5521, 5526, 5528, 5533, 5536, 5536, 5538, 5555, 5556, 5557, 5557, 5566, 5571, 5580, 5585, 5596, 5604, 5619, 5634, 5649, 5668, 5694, 5696, 5699, 5701, 5704, 5709, 5732, 5745, 5745, 5746, 5749, 5762, 5766, 5766, 5770, 5773, 5796, 5810, 5817, 5823, 5838, 5843, 5846, 5860, 5869, 5872, 5877, 5880, 5896, 5899, 5902, 5905, 5910, 5913, 5913, 5915, 5923], 220], "output": 74}, {"inputs": [[415288, 416336, 416780, 417164, 419922, 420866, 421399, 421501, 423010, 423524, 423709, 423948, 425094, 425754, 426119, 426709, 426735, 426765, 427996, 428353, 429030, 429288, 429866, 430018, 432194, 432463, 432595, 433785, 436041, 438907, 439684, 440741, 443014, 443041, 443714, 444384, 444816, 445584, 446750, 447461, 448391, 448908, 449019, 449040, 449058, 451322, 451575, 451725, 452221, 452292, 452832, 453051, 453542, 454620, 457091, 459311, 459844, 460931, 462022, 462375, 462687, 464670, 465424, 465930, 467740, 468158, 469906, 470861, 471421, 472771, 472930, 473042, 473383, 473751, 476165, 476779, 478436, 479490, 481215, 481781, 482147, 484372, 485161, 488039, 488728, 489591, 490259, 492542, 492866, 495823, 496729, 498602, 501398, 501560, 502157, 502458, 502486, 503315, 503679, 504090, 505532, 506787, 506858, 506873, 507416, 507708, 507735, 508035, 509557, 510743, 511784, 512680, 512985, 513468, 514010, 514230, 514905, 515129, 515415, 515959, 516080, 519872, 523531, 523844, 524656, 525478, 525674, 525938, 526351, 526410, 526657, 526700, 526975, 527299, 527501, 527684, 527941, 529840, 530232, 530454, 531248, 532176, 532228, 532976, 534579, 534720, 535615, 536452, 537848, 538315, 538390, 539558, 539711, 542729, 543041, 544991, 545040, 545385, 545692, 545713, 546174, 546631, 547431, 547866, 549373, 549463, 549799, 551368, 551554, 552213, 553636, 554369, 555124, 556077, 558142, 558149, 558588, 559580, 560429, 561470, 564174, 565686, 566368, 566820, 567304, 568791, 568981, 570008, 570073, 571549, 571952, 572272, 573747, 579507, 581030, 581348, 582148, 583708, 585240, 586386, 587014, 587196, 587916, 588043, 588794, 589803, 592156, 594703, 594739, 595673, 598887, 598967, 599759, 600214, 601251, 601509, 603597, 604002, 604662, 605317, 605851, 605888, 607114, 608043, 608746, 610284, 612061, 615398, 615959, 616251, 616568, 618018, 618297, 618882, 622423, 624707, 624769, 626565, 627656, 627717, 628485, 629337, 629954, 631681, 633092, 633667, 634093, 635001, 635704, 636342, 638816, 639012, 640721, 640757, 641568, 642249, 643159, 643660, 645912, 646279, 647791, 648050, 648719, 648762, 649006, 651763, 652282, 653361, 653733, 654377, 656288, 657280, 659153, 659527, 662296, 662573, 665248, 668896, 669184, 669589, 670676, 671884, 672214, 672552, 674550, 675950, 678704, 679612, 681171, 681467, 681883, 682258, 682696, 682875, 685080, 685380, 685578, 686223, 687383, 687902, 690306, 690701, 691816, 691941, 692039, 692119, 692318, 693286, 696521, 697180, 699595, 699718, 699751], 481169], "output": 313}, {"inputs": [[42, 53, 114, 116, 134, 181, 225, 271, 287, 292, 330, 363, 368, 371, 402, 429, 431, 432, 443, 479, 484, 493, 499, 500, 560, 579, 594, 597, 607, 607, 706, 728, 734, 750, 751, 768, 774, 791, 798, 813, 822, 836, 839, 857, 860, 861, 865, 888, 926, 939, 942, 950, 954, 986, 1010, 1012, 1019, 1043, 1045, 1056, 1066, 1084, 1155, 1159, 1192, 1210, 1244, 1258, 1264, 1284, 1291, 1295, 1311, 1316, 1320, 1324, 1361, 1380, 1406, 1408, 1424, 1433, 1442, 1449, 1464, 1468, 1472, 1476, 1487, 1502, 1554, 1581, 1618, 1619, 1629, 1682, 1701, 1704, 1705, 1742, 1751, 1768, 1778, 1783, 1803, 1809, 1811, 1822, 1829, 1832, 1846, 1872, 1878, 1891, 2021, 2032, 2049, 2101, 2166, 2181, 2198, 2202, 2225, 2235, 2237, 2262, 2262, 2266, 2274, 2294, 2357, 2361, 2386, 2389, 2397, 2413, 2443, 2455, 2470, 2528, 2546, 2560, 2595, 2609, 2626, 2652, 2724, 2758, 2765, 2788, 2800, 2843, 2847, 2876, 2878, 2882, 2884, 2902, 2908, 2947, 2947, 2952, 2975, 2983, 2991, 3010, 3020, 3029, 3040, 3062, 3063, 3088, 3118, 3122, 3151, 3157, 3193, 3198, 3226, 3247, 3263, 3270, 3292, 3320, 3326, 3326, 3329, 3330, 3358, 3382, 3402, 3412, 3418, 3438, 3462, 3469, 3470, 3486, 3541, 3580, 3627, 3632, 3639, 3676, 3679, 3680, 3681, 3726, 3728, 3728, 3733, 3754, 3758, 3773, 3776, 3783, 3826, 3903, 3912, 3956, 3977, 4006, 4015, 4015, 4018, 4021, 4051, 4070, 4075, 4104, 4138, 4147, 4158, 4188, 4189, 4190, 4220, 4222, 4222, 4242, 4285, 4287, 4300, 4324, 4354, 4358, 4387, 4434, 4449, 4450, 4459, 4464, 4494, 4534, 4538, 4553, 4554, 4627, 4632, 4637, 4644, 4686, 4688, 4772, 4786, 4798, 4859, 4893, 4899, 4954, 4990, 5023, 5056, 5089, 5093, 5102, 5118, 5121, 5154, 5156, 5259, 5266, 5268, 5272, 5272, 5280, 5288, 5324, 5374, 5416, 5420, 5439, 5483, 5510, 5512, 5557, 5567, 5586, 5623, 5632, 5642, 5665, 5670, 5682, 5683, 5699, 5715, 5747, 5766, 5771, 5773, 5845, 5865, 5884, 5886, 5927, 5953, 5963, 6033, 6046, 6072, 6073, 6101, 6125, 6125, 6131, 6150, 6152, 6155, 6160, 6165, 6169, 6169, 6180, 6246, 6321, 6328, 6330, 6331, 6346, 6367, 6424, 6461, 6475, 6477, 6481, 6509, 6566, 6566, 6598, 6620, 6654, 6684, 6697, 6732, 6732, 6752, 6757, 6765, 6767, 6799, 6805, 6830, 6877, 6886, 6938, 6938, 6941, 6978, 7002, 7003, 7102, 7132, 7136, 7155, 7176, 7188, 7198, 7200, 7230, 7266, 7284, 7313, 7322, 7322, 7345, 7362, 7387, 7388, 7400, 7404, 7447, 7450, 7462, 7467, 7480, 7493, 7497, 7516, 7560, 7584, 7590, 7600, 7646, 7652, 7652, 7664, 7669, 7688, 7697, 7709, 7720, 7725, 7783, 7807, 7811, 7812, 7843, 7843, 7845, 7859, 7876, 7884, 7900, 7901, 7911, 7920, 7927, 7968, 7974, 7987, 8000, 8007, 8027, 8054, 8092, 8093, 8105, 8114, 8217, 8217, 8226, 8227, 8235, 8303, 8313, 8315, 8341, 8348], 8550], "output": 449}, {"inputs": [[305, 305, 305, 305, 305, 306, 306, 306, 306, 306, 306, 307, 307, 307, 307, 308, 308, 309, 309, 309, 309, 310, 310, 310, 310, 311, 311, 311, 311, 311, 312, 312, 312, 312, 312, 312, 312, 312, 312, 313, 313, 314, 314, 314, 314, 314, 315, 315, 315, 315, 316, 316, 316, 316, 317, 317, 317, 317, 317, 318, 318, 319, 319, 319, 319, 320, 321, 321, 321, 321, 321, 321, 322, 322, 322, 322, 322, 323, 323, 323, 323, 323, 323, 324, 324, 324, 324, 325, 325, 325, 325, 325, 326, 326, 327, 327, 327, 329, 329, 329, 329, 329, 330, 330, 330, 330, 330, 330, 331, 331, 331, 331, 331, 331, 332, 332, 332, 332, 332, 333, 333, 333, 334, 334, 335, 335, 335, 335, 336, 336, 336, 336, 336, 336, 336, 336, 336, 337, 337, 337, 337, 338, 338, 338, 338, 338, 338, 338, 339, 339, 339, 339, 340, 340, 340, 340, 340, 340, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 342, 342, 342, 342, 342, 342, 342, 343, 343, 344, 344, 344, 345, 345, 345, 347, 347, 347, 347, 347, 348, 348, 348, 348, 348, 349, 349, 349, 349, 349, 350, 350, 350, 350, 350, 351, 352, 352, 352, 352, 353, 353, 353, 353, 353, 353, 354, 354, 354, 354, 354, 354, 355, 355, 355, 355, 355, 356, 356, 356, 356, 357, 357, 357, 357, 358, 358, 358, 359, 359, 359, 359, 359, 360, 360, 361, 361, 361, 362, 362, 362, 362, 362, 363, 363, 363, 363, 364, 364, 364, 364, 365, 365, 366, 366, 367, 367, 367, 367, 367, 367, 367, 367, 367, 368, 368, 368, 368, 368, 368, 368, 368, 369, 369, 369, 370, 370, 370, 370, 370, 370, 370, 370, 371, 371, 371, 371, 371, 372, 372, 372, 372, 373, 374, 374, 374, 375, 376, 376, 377, 377, 377, 377, 377, 377, 377, 378, 378, 378, 379, 379, 379, 379, 379, 379, 380, 381, 382, 382, 382, 382, 382, 383, 383, 384, 384, 385, 385, 385, 386, 386, 386, 387, 387, 387, 387, 388, 388, 388, 388, 389, 389, 389, 389, 389, 389, 389, 390, 391, 391, 391, 392, 392, 392, 393, 393, 393, 393, 393, 393, 394, 394, 394, 394, 394, 395, 395, 395, 395, 395, 395, 395, 395, 396, 396, 396, 396, 396, 396, 397, 397, 398, 398, 398, 398, 398, 398, 399, 399, 399, 400, 400, 400, 400, 401, 401, 401, 402, 402, 402, 402, 402, 402, 402, 403, 403, 403, 403, 404, 404, 404, 404, 404, 404, 405, 405, 405, 405, 405, 405, 406, 406, 406, 406, 406, 406, 406, 406, 407, 407, 407, 407, 407, 407, 408, 408, 408, 409, 409, 409, 409, 409, 409, 410, 410, 410, 410, 410, 410, 411, 411, 411, 411, 412, 412, 413, 413, 413, 413, 413, 414, 414, 414, 414, 415, 415, 415, 415, 416, 416, 416, 417, 417, 417, 418, 418, 418, 418, 418, 418, 419, 419, 419, 419, 419, 419, 419, 419, 419, 420, 420, 420, 420, 420, 420, 422, 422, 422, 422, 422, 423, 424, 424, 424, 424, 424, 424, 425, 425, 425, 425, 425, 425, 426, 426, 427, 428, 428, 428, 428, 428, 428, 428, 429, 429, 429, 429, 430, 430, 430, 430, 431, 431, 432, 432, 432, 432, 432, 432, 433, 433, 433, 433], 324], "output": 553}, {"inputs": [[81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94], 82], "output": 896}, {"inputs": [[41680, 41688, 41709, 41716, 41742, 41744, 41753, 41778, 41783, 41791, 41796, 41833, 41840, 41867, 41874, 41888, 41897, 41904, 41977, 41982, 42008, 42022, 42039, 42042, 42046, 42088, 42128, 42138, 42148, 42150, 42194, 42244, 42263, 42280, 42288, 42301, 42330, 42384, 42385, 42389, 42390, 42415, 42427, 42459, 42480, 42486, 42551, 42577, 42588, 42591, 42610, 42611, 42637, 42639, 42653, 42672, 42689, 42702, 42756, 42764, 42792, 42796, 42800, 42841, 42858, 42862, 42871, 42914, 42915, 42921, 42932, 42956, 43070, 43157, 43192, 43198, 43251, 43265, 43358, 43384, 43394, 43403, 43414, 43442, 43453, 43465, 43484, 43505, 43546, 43595, 43623, 43637, 43647, 43717, 43734, 43744, 43754, 43756, 43855, 43864, 43896, 43994, 43995, 44017, 44039, 44055, 44082, 44098, 44121, 44159, 44167, 44219, 44243, 44286, 44290, 44340, 44351, 44396, 44456, 44464, 44530, 44530, 44646, 44664, 44668, 44676, 44710, 44715, 44719, 44721, 44729, 44734, 44793, 44803, 44822, 44842, 44843, 44860, 44890, 44891, 44943, 44959, 44973, 44992, 45008, 45028, 45059, 45060, 45074, 45081, 45082, 45095, 45099, 45101, 45105, 45107, 45117, 45121, 45132, 45145, 45146, 45151, 45191, 45239, 45256, 45266, 45270, 45300, 45330, 45337, 45374, 45396, 45413, 45437, 45437, 45467, 45470, 45481, 45490, 45497, 45508, 45667, 45680, 45691, 45721, 45727, 45732, 45805, 45814, 45832, 45840, 45861, 45861, 45864, 45878, 45883, 45895, 45897, 45932, 45969, 46007, 46029, 46081, 46086, 46120, 46125, 46156, 46169, 46180, 46184, 46256, 46308, 46315, 46317, 46322, 46344, 46363, 46366, 46378, 46414, 46419, 46426, 46429, 46504, 46505, 46506, 46508, 46513, 46533, 46565, 46575, 46576, 46598, 46599, 46654, 46717, 46719, 46728, 46736, 46756, 46758, 46767, 46788, 46811, 46835, 46845, 46864, 46916, 46975, 47013, 47062, 47063, 47069, 47087, 47090, 47093, 47111, 47119, 47127, 47132, 47156, 47188, 47209, 47213, 47275, 47279, 47317, 47343, 47355, 47368, 47392, 47392, 47415, 47434, 47442, 47484, 47531, 47575, 47575, 47577, 47631, 47635, 47669, 47710, 47716, 47730, 47732, 47770, 47833, 47843, 47857, 47926, 47941, 47947, 47962, 47963, 47976, 48005, 48016, 48081, 48090, 48100, 48111, 48175, 48176, 48189, 48201, 48201, 48267, 48404, 48490, 48519, 48530, 48624, 48667, 48736, 48805, 48844, 48885, 48893, 48906, 48927, 48929, 48941, 48984, 48990, 49045, 49057, 49070, 49144, 49222, 49274, 49276, 49286, 49301, 49318, 49337, 49340, 49377, 49407, 49413, 49417, 49419, 49436, 49478, 49492, 49535, 49566, 49646, 49711, 49744, 49747, 49788, 49795, 49824, 49829, 49873, 49922, 49947, 49989, 50005, 50022, 50036, 50093, 50148, 50161, 50178, 50192, 50194, 50208, 50218, 50231, 50238, 50254, 50261, 50278, 50291, 50304, 50307, 50363, 50365, 50367, 50398, 50418, 50456, 50467, 50469, 50474, 50501, 50538, 50556, 50568, 50573, 50577, 50640, 50652, 50685, 50693, 50700, 50706, 50725, 50746, 50766, 50768, 50781, 50834, 50850, 50850, 50881, 50890, 51006, 51020, 51026, 51031, 51046, 51051, 51074, 51082, 51106, 51122, 51138, 51143, 51190, 51206, 51218, 51243, 51338, 51343, 51356, 51370, 51371, 51418, 51440, 51462, 51479, 51487, 51488, 51496, 51549, 51607, 51642, 51672, 51687, 51688, 51700, 51705, 51771, 51771, 51782, 51824, 51837, 51850, 51860, 51867, 51892, 51908, 51918, 51985, 52001, 52005, 52030, 52051, 52064, 52132, 52161, 52207, 52217, 52240, 52309, 52332, 52363, 52368, 52421, 52484, 52553, 52571, 52594, 52675, 52687, 52719, 52724, 52799, 52808, 52987, 53000, 53010, 53111, 53133, 53135, 53153, 53164, 53185, 53229, 53263, 53269, 53283, 53286, 53297, 53310, 53315, 53372, 53377, 53380, 53402, 53438, 53443, 53506, 53509, 53546, 53599, 53612, 53644, 53693, 53718, 53721, 53735, 53746, 53787, 53827, 53896, 53911, 53922, 53939, 53961, 53972, 53989, 54033, 54041, 54047, 54072, 54077, 54089, 54106, 54112, 54133, 54185, 54197, 54201, 54209, 54224, 54254, 54309, 54342, 54348, 54364, 54369, 54369, 54397, 54419, 54430, 54467, 54545, 54559, 54617, 54623, 54724, 54735, 54736, 54780, 54781, 54785, 54792, 54793, 54830, 54882, 54896, 54972, 55007, 55020, 55034, 55090, 55092, 55148, 55200, 55202, 55219, 55221, 55222, 55274, 55276, 55287, 55316, 55324, 55343, 55379, 55390, 55394, 55434, 55435, 55443, 55464, 55549, 55553, 55556, 55586, 55620, 55622, 55639, 55643, 55676, 55676, 55683, 55748, 55778, 55812, 55815, 55957, 55958, 55986, 55996, 56013, 56016, 56025, 56054, 56074, 56076, 56087, 56120, 56122, 56129, 56148, 56150, 56160, 56207, 56209, 56284, 56342, 56369, 56438, 56466, 56477, 56493, 56509, 56521, 56542, 56557, 56579, 56605, 56637, 56640, 56694, 56705, 56731, 56745, 56747, 56771, 56783, 56797, 56811, 56841, 56864, 56904, 56921, 56944, 56967, 56995, 57046, 57072, 57107, 57112, 57113, 57115, 57148, 57215, 57235, 57236, 57258, 57272, 57277, 57280, 57282, 57285, 57302, 57309, 57331, 57334, 57370, 57377, 57440, 57442, 57443, 57538, 57589, 57609, 57611, 57621, 57623, 57655, 57681, 57690, 57703, 57730, 57758, 57769, 57788, 57830, 57831, 57847, 57863, 57872, 57880, 57885, 57896, 57921, 58005, 58008, 58011, 58040, 58061, 58086, 58100, 58138, 58185, 58225, 58228, 58241, 58260, 58275, 58330, 58338, 58388, 58390, 58410, 58441, 58484, 58490, 58575, 58621, 58627, 58670, 58716, 58724, 58728, 58742, 58743, 58745, 58771, 58813, 58830, 58838, 58848, 58852, 58862, 58930, 58934, 59009, 59053, 59053, 59079, 59098, 59112, 59129, 59148, 59207, 59208, 59227, 59257, 59457, 59468, 59498, 59506, 59517, 59517, 59552, 59554, 59556, 59600, 59600, 59645, 59681, 59685, 59686, 59740, 59761, 59774, 59799, 59802, 59833, 59876, 59905, 59962, 59972, 60022, 60027, 60036, 60075, 60083, 60105, 60144, 60160, 60171, 60173, 60194, 60220, 60264, 60273, 60280, 60299, 60302, 60336, 60342, 60361, 60366, 60377, 60524, 60532, 60567, 60568, 60574, 60575, 60609, 60610, 60618, 60626, 60629, 60641, 60666, 60680, 60693, 60693, 60728, 60731, 60734, 60794, 60804, 60866, 60881, 60907, 60922, 60954, 60955, 60987, 61074, 61075, 61089, 61101, 61101, 61147, 61215, 61225, 61280, 61300, 61328, 61351, 61358, 61389, 61406, 61410, 61417, 61431, 61446, 61448, 61461, 61471, 61490, 61498, 61510, 61512, 61550, 61551, 61569, 61579, 61620, 61647, 61684, 61731, 61754, 61764, 61811, 61818, 61878, 61880, 61881, 61901, 61950, 61983, 62012, 62017, 62024, 62025, 62081, 62139, 62148, 62204, 62212, 62250, 62251, 62272, 62297, 62334, 62336, 62337, 62363, 62375, 62382, 62403, 62412, 62425, 62450, 62461, 62473, 62503, 62530, 62539, 62555, 62566, 62568, 62580, 62586, 62590, 62599, 62645, 62659, 62665, 62686, 62729, 62750, 62760, 62768, 62772, 62796, 62838, 62890, 62904, 62935, 62964, 63019, 63021, 63021, 63069, 63086, 63099, 63099, 63107, 63154], 904], "output": 111}, {"inputs": [[375344743, 375811382, 376205354, 376583225, 377326584, 377528242, 377556486, 377561264, 377747991, 377749793, 377838108, 377905270, 378225612, 378389478, 378638215, 379501835, 379550808, 380108794, 380146950, 380691791, 381393652, 382408980, 382670758, 383132819, 384531606, 384601605, 384619910, 384848369, 385221568, 385231233, 385753380, 385949112, 386833113, 387371507, 387648433, 387669754, 387712024, 387960080, 388599148, 388931923, 389889842, 390466891, 390628019, 390915526, 391471142, 391481330, 391883528, 392131052, 392170820, 392873875, 392948257, 393200244, 393217847, 393227344, 393548051, 393564034, 394717709, 396648759, 397290396, 397473501, 398172233, 398431650, 398509186, 398829475, 398890185, 399201278, 399598370, 400335640, 400886541, 401423147, 401596279, 402068593, 402900993, 403027769, 403515881, 404956177, 405354937, 406036459, 406682171, 406818231, 407126246, 407374429, 408011409, 408535761, 408642304, 408894488, 409787453, 409807299, 410313373, 410614153, 410808004, 412195139, 412641197, 413922900, 414109622, 414287986, 414382334, 414693905, 414876837, 414976334, 415371268, 415716409, 416429736, 417258167, 417426100, 417635786, 418804503, 419050297, 419773033, 419878382, 420064412, 420497879, 421027960, 421424811, 422087830, 422107655, 423025413, 423083263, 423112230, 423298825, 423787582, 423961843, 424292689, 424939243, 425056934, 426223721, 426295609, 426567665, 426787636, 426941716, 427947471, 428503139, 428511729, 428520675, 428605077, 428794088, 429514626, 429804206, 430098631, 430158655, 430187406, 431583883, 431785301, 431926967, 432049526, 432306436, 432312542, 432313473, 432578851, 432655672, 432730640, 432869346, 432891421, 433292749, 433420800, 433969706, 434257007, 434430199, 435164434, 435602256, 435627677, 435930182, 436132585, 436349199, 437135467, 437454940, 437774216, 438159481, 438169635, 438664688, 439265721, 439715813, 440271155, 441010442, 441166897, 441192055, 441526923, 441602630, 442143100, 442983517, 443071496, 443328899, 444772683, 444879199, 445810350, 445917622, 445978681, 446227097, 446309463, 446647098, 446660098, 446962967, 446983709, 447278253, 447387622, 447975621, 448104047, 448134985, 449126767, 449355419, 450508025, 450608498, 450820492, 451893936, 452096442, 452687744, 453609510, 453829020, 454334559, 454382390, 454694452, 454779520, 455125333, 455286585, 456080969, 456618332, 456657407, 456706375, 457622753, 457948197, 458337647, 458510749, 458953193, 459062696, 459084205, 459219347, 459311702, 459548662, 459549465, 459825411, 460486502, 460809812, 461672674, 461736577, 462144905, 462163457, 462705146, 462799115, 462978062, 463075675, 463405864, 464150809, 464381247, 464468421, 464610198, 465077145, 465264285, 465490378, 465892133, 466142165, 466383208, 466589265, 466623751, 466642223, 466849580, 467392187, 467473187, 467737515, 467770346, 468391734, 468396254, 468597025, 468706659, 469545260, 469548802, 470531856, 470542741, 471253163, 471465840, 471737215, 471830132, 471986170, 472111291, 472895883, 473190408, 473759623, 473819369, 474476756, 474721682, 475025035, 476043766, 476571257, 476949002, 477983505, 477995897, 478330583, 478443218, 478544130, 478654201, 479212071, 479478225, 479514198, 479651156, 479722039, 479850621, 479962461, 480240876, 480739017, 480849313, 481243652, 481535682, 482141304, 482672032, 483057639, 483090707, 483303439, 483522540, 483863060, 484020556, 484447303, 484555767, 484891807, 484930678, 485791276, 486086663, 486481282, 487117636, 487339158, 488195829, 488425064, 488614205, 488865762, 489011683, 489415853, 489698506, 490623722, 491078678, 491155152, 491486345, 491578202, 491838937, 492031953, 492970749, 493351260, 493457725, 494074574, 494269621, 494789844, 494946902, 495248135, 495386431, 495957495, 496763514, 497038953, 497294685, 498395649, 498621425, 499151628, 499908505, 500235558, 500249429, 501009330, 501968415, 502462284, 502705458, 502850996, 502975948, 502996862, 503229333, 503305824, 503476011, 503694479, 504502392, 504572661, 505026750, 505598419, 505860413, 505947985, 506033217, 506379896, 506814214, 507063145, 507229613, 507484911, 507509670, 508076993, 508356875, 508391331, 508545177, 508904924, 509051708, 509426866, 510149081, 510550051, 511307779, 511617039, 512319546, 512559298, 512588607, 512705920, 512911566, 513030763, 513065181, 513341070, 513845222, 513935530, 513974837, 515145391, 515431408, 515532844, 515556141, 516178966, 516923647, 517363175, 517610088, 517753193, 518129924, 518251104, 519053349, 519178507, 519586386, 519631377, 519815449, 520861973, 521061436, 521390965, 521845209, 522627131, 523923949, 524275138, 524313650, 524706243, 524800064, 525328862, 525525500, 525705965, 526221370, 526791616, 526847612, 526915034, 527578210, 528211713, 528265211, 528372502, 528880170, 528938383, 529446502, 529528273, 530317143, 530415876, 531202886, 532006161, 532162179, 532308455, 532612053, 533497184, 533741102, 534317878, 534529892, 535452515, 535494236, 535833656, 536481616, 537282762, 537606885, 537653689, 537672732, 537672816, 537822499, 537835973, 538592250, 538987852, 541700470, 541925452, 542048479, 542316513, 543350704, 543721539, 543784778, 544022143, 544328076, 544580127, 545419317, 545652938, 546444569, 546605041, 547495534, 547508819, 548398765, 548453243, 548471005, 549074107, 549115921, 549565220, 549609045, 549691959, 550521237, 551256123, 551765796, 551836039, 552190804, 552208151, 552555907, 552577264, 552631110, 552772714, 553645105, 554255016, 554439844, 554517304, 554991642, 555126826, 555177263, 555776402, 555936697, 555995953, 556063912, 556209379, 557827557, 559259489, 559337656, 559518477, 562653900, 562722644, 566137440, 566334015, 566479511, 566545447, 567244640, 567805121, 567862874, 567866338, 567962873, 568000243, 568254541, 568520531, 568582931, 568781617, 569284645, 570023442, 570864078, 571430710, 571700363, 572288554, 572958785, 573342488, 574241106, 574396274, 575692079, 575759636, 575934276, 576030593, 576099190, 576381414, 576597305, 576735021, 577128503, 577549056, 578198224, 578604209, 578879551, 579297101, 579327915, 579328534, 579436584, 579690565, 580161662, 580465749, 580555114, 580607032, 580869317, 581015151, 581054006, 581740778, 582049879, 582707046, 582791911, 582932696, 583849788, 583888998, 583930305, 583950123, 584953605, 585065301, 585210530, 585211547, 585636106, 585685042, 585695842, 585979096, 586410456, 586544943, 586854190, 587389470, 588902969, 589110813, 589172115, 589442181, 589491893, 589627942, 589717284, 590226577, 591062097, 591498207, 591515537, 591961646, 592014281, 592148740, 592286436, 592310300, 593246141, 593256206, 593380442, 593463818, 594781426, 594824070, 594831879, 594931949, 595368996, 596616057, 596716001, 596766017, 597704640, 598207133, 598404617, 599014207, 600293385, 600893195, 601355588, 601401383, 601870213, 602179061, 602386885, 603285355, 603673352, 603814135, 603889490, 604160860, 604312475, 604457867, 604587468, 605534418, 606022456, 606182373, 606483037, 606543133, 606620572, 606680214, 606754278, 606861176, 607638574, 607970824, 608629492, 609078120, 609518013, 609543374, 609721759, 609815688, 610025373, 610341639, 610601058, 610915945, 611205241, 611398319, 611424055, 611560824, 612067602, 612361884, 613177111, 613268532, 613316638, 613360679, 613481599, 613540965, 613576196, 613662913, 614781590, 615234975, 615772253, 615839466, 616519630, 616566216, 617672222, 618287514, 618331620, 619228897, 619790029, 620639284, 621011016, 621204960, 621554920, 621656884, 621713132, 621746466, 622014189, 622077255, 622105397, 623545203, 623741987, 623986256, 624053130, 624056468, 624617896, 624919921, 625587862, 625995770, 626489644, 626949220, 627095975, 627223355, 627599604, 628221303, 628449345, 628533427, 628616044, 628676847, 628723633, 629309297, 629995345, 630602404, 630718176, 631094359, 631165472, 631482602, 631865374, 631908049, 632337805, 632384667, 632562050, 632937752, 632944941, 633949052, 634216296, 634312014, 634497021, 635035374, 635334368, 635437514, 635844654, 636487908, 636509466, 636544329, 636635063, 636733046, 637404075, 637485348, 637761723, 638353788, 639557577, 640338772, 641132684, 641179240, 641291929, 641581172, 641929244, 642104635, 642242207, 642719168, 642733046, 643020637, 643287367, 643306171, 643511443, 645013995, 645601298, 646723775, 647025401, 647091716, 647549737, 647602032, 647745368, 648195732, 648239529, 648291198, 648492767, 648628349, 648938617, 649232505, 649542291, 649920714, 649992363, 650066607, 651391427, 651852353, 652217492, 653360977, 653363896, 654667280, 654812987, 654875840, 655303201, 655716834, 655833352, 655875258, 656629940, 656687292, 656691516, 656768575, 657118644, 657519771, 657755248, 658727856, 659290820, 659683824, 659947222, 661023468, 661799735, 663011594, 663361297, 664668990, 665107775, 665157395, 665204395, 665268199, 666226327, 666566906, 667469150, 667561265, 667845206, 668204698, 668925972, 669141092, 669951127, 670017909, 670482257, 670623785, 670636197, 671570168, 671684871, 671930196, 672671805, 673027659, 673119830, 673162196, 673234493, 673316493, 673329275, 673432596, 673544316, 673738935, 673939103, 674061518, 674757718, 675159973, 675220679, 675436537, 675513175, 676290230, 676353888, 676975711, 677248545, 677651077, 678210480, 678281195, 678469486, 679350651, 679440193, 679712384, 679794445, 679995747, 680027679, 680126827, 680258571, 680483943, 681092177, 681460555, 681500685, 681928438, 681934149, 682058541, 682084906, 682184253, 682263189, 682756635, 682918460, 682970775, 683411383, 684438392, 684512200, 684796193, 684907127, 684991420, 685024043, 685151132, 685357964, 685466175, 685542727, 685628248, 686199513, 686393669, 686667810, 687151730, 687573563, 687767688, 688315254, 689097050, 689669555, 690075664, 690195821, 690883841, 691044829, 691387338, 691410157, 692029721, 692208321, 692475807, 692525097, 692622968, 692642614, 693725449, 694012046, 694105886, 695248149, 695422111, 696120578, 696517217, 696797852, 697455884, 697929593, 698208231, 698291130, 698325785, 698897587, 699124433, 699140763, 699203146, 699590753, 700210933, 700632895, 700746471, 700768506, 700773482, 701435056, 701490549, 702167169, 702408048, 702594727, 702601892, 702930476, 703149836, 703770797, 704035508, 704301769, 705318460, 705367634, 705374889, 705680362, 705779949, 705865549, 706062106, 706785041, 707085704, 708318577, 708630436, 708698070, 709363760, 709656921, 709718208, 710177558, 710180281, 710680888, 710947453, 710955794, 711047125, 711199046, 712103764, 712297542, 712441530, 712448521, 712968765, 712998917, 713385290, 713585051, 713820360, 714237341, 714320431, 714663700, 715239638, 715492814, 715681817, 715757996, 716457187, 716492672, 716509274, 716745700, 716907444, 717911595, 718326366, 718725158, 719711744, 719773658, 720200365, 720304182, 721080555, 721375707, 721672298, 721816769, 722352866, 722525382, 723569379, 724190317, 724282107, 724312445, 726082999, 726386683, 726953107, 727096456, 727613551, 729390276, 729396314, 729937239, 730636535, 730798866, 731192263, 731286811, 731762769, 732023214, 732425138, 732652337, 732937629, 733192730, 733417087, 733988673, 734667968, 735186603, 735732733, 735904246, 735946124, 736819009, 737076557, 737378851, 737809387, 738332574, 739197874, 740379255, 741213342, 741230007, 741419762, 741680130, 741792699, 742324623, 743638624, 743719025, 743817400, 745334876, 745341428, 745538266, 745539016, 745736581, 746260981, 746359496, 746689829, 747153988, 747834409, 748492938, 748897793, 749073992, 749865861, 751189892, 751287234, 751810001, 751920224, 752330766, 752497265, 752697708, 753138045, 753518988, 754270893, 754703161], 172], "output": 3}, {"inputs": [[5626, 5627, 5630, 5631, 5633, 5634, 5638, 5639, 5639, 5643, 5651, 5653, 5653, 5653, 5653, 5656, 5657, 5657, 5661, 5673, 5674, 5679, 5685, 5690, 5692, 5694, 5695, 5699, 5700, 5705, 5705, 5711, 5711, 5713, 5714, 5715, 5716, 5717, 5717, 5717, 5720, 5720, 5721, 5724, 5725, 5728, 5729, 5731, 5731, 5731, 5732, 5736, 5738, 5739, 5740, 5742, 5742, 5743, 5747, 5752, 5752, 5759, 5764, 5766, 5767, 5769, 5771, 5773, 5776, 5777, 5779, 5781, 5784, 5788, 5790, 5796, 5799, 5803, 5805, 5806, 5809, 5810, 5815, 5820, 5822, 5822, 5827, 5829, 5832, 5833, 5834, 5839, 5839, 5845, 5846, 5847, 5849, 5850, 5851, 5852, 5855, 5859, 5864, 5865, 5869, 5869, 5875, 5879, 5884, 5885, 5891, 5894, 5895, 5895, 5896, 5896, 5897, 5897, 5900, 5905, 5911, 5913, 5916, 5917, 5921, 5922, 5924, 5926, 5932, 5934, 5935, 5945, 5946, 5951, 5953, 5955, 5956, 5956, 5957, 5958, 5958, 5967, 5967, 5967, 5968, 5969, 5973, 5975, 5976, 5980, 5980, 5982, 5987, 5989, 5994, 5996, 5998, 6002, 6003, 6005, 6014, 6019, 6023, 6027, 6030, 6035, 6036, 6039, 6039, 6043, 6043, 6051, 6051, 6051, 6053, 6054, 6055, 6061, 6064, 6066, 6066, 6068, 6068, 6069, 6072, 6072, 6075, 6075, 6075, 6075, 6077, 6077, 6078, 6079, 6080, 6086, 6088, 6092, 6094, 6095, 6096, 6102, 6109, 6110, 6110, 6111, 6111, 6111, 6116, 6116, 6117, 6122, 6127, 6131, 6133, 6136, 6136, 6137, 6142, 6142, 6142, 6146, 6147, 6148, 6149, 6154, 6154, 6163, 6172, 6175, 6176, 6182, 6183, 6185, 6186, 6190, 6193, 6194, 6201, 6202, 6203, 6208, 6209, 6219, 6220, 6221, 6222, 6224, 6225, 6225, 6225, 6227, 6227, 6230, 6235, 6240, 6243, 6244, 6245, 6246, 6247, 6251, 6254, 6255, 6256, 6260, 6261, 6264, 6265, 6266, 6266, 6267, 6268, 6269, 6270, 6271, 6273, 6279, 6280, 6281, 6282, 6286, 6287, 6287, 6287, 6288, 6289, 6289, 6290, 6291, 6292, 6298, 6300, 6303, 6305, 6313, 6316, 6317, 6318, 6320, 6322, 6328, 6331, 6331, 6334, 6334, 6336, 6336, 6337, 6340, 6347, 6347, 6352, 6355, 6355, 6357, 6361, 6361, 6363, 6366, 6371, 6373, 6374, 6375, 6377, 6380, 6385, 6395, 6395, 6401, 6407, 6413, 6416, 6418, 6419, 6419, 6419, 6420, 6430, 6433, 6435, 6437, 6440, 6440, 6445, 6446, 6449, 6450, 6452, 6452, 6452, 6454, 6455, 6456, 6458, 6462, 6465, 6467, 6469, 6477, 6478, 6483, 6492, 6493, 6494, 6495, 6496, 6497, 6497, 6497, 6498, 6499, 6501, 6503, 6507, 6509, 6510, 6510, 6511, 6511, 6513, 6515, 6518, 6518, 6519, 6519, 6524, 6525, 6526, 6527, 6529, 6535, 6536, 6536, 6543, 6546, 6548, 6552, 6553, 6554, 6555, 6560, 6564, 6565, 6566, 6572, 6574, 6579, 6580, 6583, 6586, 6591, 6599, 6599, 6600, 6605, 6610, 6614, 6614, 6616, 6628, 6630, 6633, 6640, 6641, 6644, 6646, 6646, 6650, 6651, 6652, 6653, 6654, 6655, 6659, 6659, 6660, 6663, 6663, 6664, 6665, 6668, 6671, 6671, 6673, 6673, 6674, 6681, 6685, 6686, 6686, 6690, 6693, 6696, 6697, 6699, 6701, 6703, 6704, 6707, 6708, 6708, 6711, 6714, 6715, 6717, 6718, 6724, 6726, 6727, 6728, 6732, 6743, 6743, 6743, 6744, 6746, 6747, 6752, 6752, 6753, 6754, 6754, 6754, 6758, 6760, 6760, 6764, 6765, 6782, 6783, 6791, 6792, 6794, 6796, 6796, 6803, 6804, 6804, 6808, 6815, 6817, 6819, 6819, 6822, 6822, 6826, 6827, 6835, 6837, 6837, 6837, 6837, 6840, 6841, 6844, 6847, 6850, 6850, 6852, 6852, 6852, 6855, 6856, 6860, 6860, 6861, 6861, 6868, 6868, 6870, 6872, 6874, 6876, 6878, 6879, 6880, 6882, 6886, 6889, 6890, 6892, 6897, 6897, 6898, 6900, 6900, 6903, 6903, 6905, 6905, 6905, 6907, 6912, 6917, 6917, 6917, 6923, 6924, 6924, 6927, 6931, 6935, 6935, 6941, 6943, 6944, 6945, 6946, 6953, 6958, 6959, 6966, 6967, 6968, 6970, 6974, 6978, 6981, 6982, 6983, 6987, 6987, 6987, 6988, 6989, 6989, 6992, 6992, 6993, 6993, 6998, 7000, 7000, 7002, 7003, 7008, 7009, 7010, 7012, 7014, 7016, 7018, 7019, 7022, 7023, 7026, 7026, 7027, 7032, 7037, 7037, 7041, 7042, 7045, 7053, 7053, 7054, 7055, 7057, 7060, 7061, 7061, 7064, 7066, 7069, 7070, 7072, 7072, 7079, 7081, 7097, 7098, 7099, 7106, 7106, 7106, 7110, 7110, 7112, 7112, 7117, 7120, 7120, 7122, 7126, 7129, 7134, 7137, 7146, 7147, 7149, 7160, 7160, 7160, 7162, 7165, 7165, 7172, 7176, 7176, 7177, 7177, 7178, 7179, 7187, 7189, 7190, 7191, 7197, 7197, 7197, 7201, 7206, 7208, 7214, 7217, 7218, 7222, 7225, 7229, 7230, 7234, 7235, 7236, 7236, 7242, 7245, 7246, 7252, 7254, 7256, 7257, 7257, 7258, 7263, 7264, 7265, 7271, 7277, 7282, 7285, 7288, 7292, 7294, 7295, 7296, 7300, 7301, 7304, 7304, 7306, 7307, 7309, 7310, 7311, 7312, 7313, 7314, 7322, 7322, 7336, 7337, 7342, 7346, 7347, 7348, 7350, 7358, 7358, 7359, 7366, 7368, 7370, 7374, 7375, 7378, 7379, 7379, 7380, 7380, 7383, 7383, 7390, 7390, 7391, 7393, 7395, 7401, 7403, 7409, 7410, 7419, 7422, 7423, 7425, 7427, 7429, 7440, 7441, 7448, 7452, 7453, 7453, 7456, 7457, 7458, 7459, 7462, 7462, 7467, 7467, 7469, 7471, 7471, 7472, 7473, 7476, 7476, 7478, 7478, 7481, 7481, 7482, 7483, 7483, 7490, 7491, 7495, 7499, 7500, 7502, 7508, 7512, 7512, 7516, 7516, 7517, 7519, 7530, 7531, 7535, 7536, 7545, 7547, 7549, 7549, 7550, 7550, 7560, 7571, 7578, 7578, 7582, 7582, 7592, 7596, 7597, 7597, 7600, 7604, 7605, 7607, 7615, 7617, 7618, 7619, 7619, 7619, 7621, 7622, 7623, 7624, 7626, 7629, 7636, 7637, 7644, 7645, 7646, 7649, 7649, 7649, 7654, 7655, 7657, 7662, 7666, 7667, 7673, 7673, 7676, 7679, 7679, 7683, 7683, 7687, 7693, 7695, 7698, 7699, 7706, 7707, 7708, 7711, 7712, 7713, 7716, 7717, 7718, 7720, 7724, 7730, 7739, 7739, 7741, 7741, 7743, 7745, 7746, 7748, 7748, 7748, 7750, 7756, 7758, 7765, 7767, 7768, 7772, 7777, 7788, 7789, 7797, 7797, 7801, 7801, 7807, 7811, 7811, 7812, 7813, 7819, 7825, 7827, 7829, 7843, 7844, 7850, 7852, 7852, 7854, 7854, 7855, 7861, 7865, 7869, 7870, 7872, 7875, 7878, 7878, 7886, 7889, 7890, 7893, 7895, 7897, 7900, 7902, 7903, 7905, 7906, 7907, 7911, 7916, 7920, 7922, 7924, 7926, 7930, 7932, 7942, 7947, 7947, 7949, 7949, 7952, 7958, 7959, 7963, 7967, 7968, 7973, 7973, 7977, 7978, 7981, 7992, 7994, 7995, 7999, 8003, 8004, 8005, 8006, 8009, 8009, 8010, 8011, 8012, 8012, 8014, 8015, 8017, 8024, 8025, 8034, 8035, 8036, 8038, 8039, 8040, 8051, 8051, 8059, 8065, 8066, 8069, 8072, 8073, 8073, 8076, 8079, 8084, 8086, 8091, 8093, 8093, 8094, 8095, 8095, 8096, 8096, 8099, 8102, 8107, 8111, 8114, 8115, 8118, 8119, 8127, 8129, 8130, 8136, 8139, 8144, 8147, 8151, 8151, 8153, 8154, 8162, 8162, 8163, 8166, 8167, 8167, 8167, 8167, 8168, 8170, 8174, 8176, 8183, 8185, 8187, 8188, 8190, 8194, 8195, 8196, 8196, 8200, 8204, 8204, 8205, 8205, 8208, 8213, 8219, 8221, 8223, 8229, 8231, 8239, 8240, 8240, 8240, 8241, 8245, 8246, 8254, 8256, 8260, 8272, 8272, 8272, 8274, 8281, 8281, 8282, 8291, 8298, 8299, 8301, 8301, 8302, 8306, 8307, 8308, 8309, 8310, 8314, 8318, 8318, 8320, 8322, 8322, 8327, 8327, 8333, 8336, 8338, 8340, 8348, 8349, 8357, 8359, 8371, 8379, 8381, 8381, 8382, 8385, 8385, 8385, 8387, 8388, 8389, 8390, 8394, 8402, 8403, 8406, 8406, 8408, 8408, 8410, 8411, 8412, 8413, 8414, 8414, 8419, 8420, 8420, 8424, 8427, 8431], 879], "output": 758}, {"inputs": [[7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9], 503], "output": 1678}, {"inputs": [[885752020, 885756956, 885807567, 885837743, 885849450, 885894531, 885929312, 885931662, 886058747, 886096971, 886098826, 886120215, 886167102, 886177838, 886232776, 886241031, 886317479, 886319136, 886373787, 886425727, 886443885, 886502351, 886528719, 886535215, 886574039, 886694251, 886762584, 886773426, 886851074, 886930648, 886994977, 887015963, 887125310, 887172809, 887179116, 887199570, 887204341, 887259587, 887365552, 887369051, 887388776, 887410802, 887430459, 887639522, 887814793, 887848113, 887885779, 887899803, 887922670, 887925062, 887927740, 887971712, 887991599, 888024510, 888243760, 888412144, 888441363, 888502940, 888584827, 888592967, 888600329, 888659678, 888669167, 888823550, 888848241, 888934798, 889004387, 889005122, 889023885, 889063783, 889099179, 889133952, 889147323, 889155008, 889226960, 889300563, 889318442, 889331082, 889367599, 889386482, 889442314, 889454347, 889559593, 889596842, 889609538, 889618399, 889717143, 889765571, 889774902, 889808753, 889831804, 889854902, 889872341, 889873977, 889953507, 890020487, 890121488, 890128004, 890214509, 890217040, 890237124, 890241467, 890354356, 890357664, 890478911, 890504023, 890519526, 890523404, 890536167, 890551394, 890687973, 890694979, 890736459, 890750311, 890751891, 890797648, 890880095, 890887592, 890935346, 890941951, 890988758, 890989303, 891038158, 891040619, 891083710, 891118452, 891148823, 891198421, 891206147, 891229171, 891256198, 891266698, 891280594, 891294330, 891396115, 891427135, 891559939, 891591606, 891677971, 891743304, 891771621, 891937736, 892053301, 892070749, 892199049, 892212910, 892232351, 892281898, 892332295, 892351921, 892424027, 892504898, 892602753, 892614793, 892643121, 892691659, 892707482, 892748391, 892778295, 892805275, 892854149, 892890917, 892941223, 892951872, 892964249, 893111214, 893114456, 893165501, 893203480, 893227798, 893336889, 893349306, 893471654, 893563639, 893603924, 893653251, 893661583, 893695841, 893909062, 893913990, 893959740, 894050390, 894065170, 894195066, 894208740, 894262982, 894263921, 894292677, 894343226, 894393267, 894413940, 894415595, 894447171, 894515583, 894558271, 894576980, 894638350, 894692046, 894710518, 894771749, 894815685, 894863384, 894934988, 894978618, 894979220, 895082052, 895100380, 895149432, 895164985, 895193712, 895324160, 895338164, 895419047, 895575054, 895627695, 895634795, 895648728, 895675173, 895693733, 895827822, 895830238, 895954063, 895981360, 895989961, 896005111, 896057976, 896131778, 896137527, 896151511, 896167880, 896202337, 896221722, 896229153, 896240871, 896246029, 896253564, 896257536, 896311684, 896334011, 896347083, 896363352, 896393975, 896435687, 896468487, 896484101, 896495175, 896504657, 896519376, 896532916, 896566321, 896624755, 896656491, 896686290, 896714973, 896752164, 896763868, 896767885, 896773908, 896779834, 896865966, 896928558, 896945836, 896951207, 897007668, 897064841, 897103899, 897110002, 897179773, 897180491, 897213842, 897239881, 897260677, 897273770, 897459365, 897500381, 897606938, 897616752, 897659799, 897682854, 897756148, 897793043, 897796327, 897881832, 897935928, 897974183, 898011569, 898043140, 898053569, 898108818, 898110700, 898118802, 898228260, 898241784, 898251713, 898287826, 898389877, 898397527, 898427016, 898508934, 898586522, 898594921, 898685371, 898700830, 898731039, 898786339, 898949398, 899049118, 899084985, 899113667, 899121589, 899126650, 899156102, 899207726, 899235729, 899252228, 899288938, 899305933, 899367011, 899385109, 899389743, 899396959, 899451940, 899526199, 899526480, 899591287, 899597678, 899649922, 899681211, 899728171, 899754770, 899824849, 899901082, 899964042, 900012605, 900050742, 900073302, 900104936, 900143586, 900155157, 900160895, 900187010, 900297482, 900412219, 900419723, 900451263, 900452095, 900459023, 900463060, 900465811, 900486904, 900513936, 900535028, 900569281, 900648948, 900720309, 900728518, 900748601, 900760827, 900941853, 900967362, 901024593, 901031803, 901104362, 901133402, 901135278, 901177644, 901238628, 901243357, 901288919, 901293431, 901316603, 901509450, 901574581, 901603032, 901639345, 901644220, 901685278, 901720934, 901724800, 901845006, 901860154, 901867797, 901881290, 901890263, 901906482, 901920157, 902055632, 902105996, 902121503, 902175964, 902196777, 902252853, 902471569, 902523984, 902613688, 902634003, 902715419, 902721607, 902743132, 902821955, 902837482, 902990701, 903012296, 903185054, 903228000, 903232003, 903338344, 903363015, 903375477, 903382988, 903458416, 903616653, 903636582, 903668376, 903765452, 903789282, 903798681, 903807623, 903834924, 903846120, 903965668, 903968547, 904012323, 904081756, 904102704, 904157836, 904161886, 904173739, 904308497, 904389536, 904393272, 904409136, 904420522, 904515995, 904535708, 904579131, 904599003, 904657608, 904694169, 904760291, 904895047, 904895693, 904897528, 904910751, 904914631, 904966138, 905079374, 905112633, 905114717, 905122699, 905155084, 905198877, 905211287, 905215241, 905302435, 905327308, 905424182, 905489190, 905606452, 905655607, 905661965, 905680995, 905729167, 905733501, 905763749, 905772227, 905900916, 905937795, 905968990, 905980241, 906019298, 906104217, 906172343, 906180788, 906257151, 906428033, 906551474, 906564007, 906647677, 906675716, 906685872, 906721234, 906756260, 906778826, 906788054, 906791057, 906845420, 906846745, 906857991, 906862864, 906880356, 906917087, 907082308, 907091069, 907116378, 907197980, 907246805, 907304616, 907325663, 907330492, 907417925, 907435781, 907451666, 907462997, 907528172, 907563885, 907621682, 907629814, 907686931, 907780713, 907806295, 907819178, 907845405, 907908815, 907963997, 908001236, 908010184, 908059395, 908114113, 908303506, 908332823, 908500229, 908528633, 908595885, 908743697, 908800311, 908804755, 908875023, 908896208, 908950841, 908955176, 908998088, 909011529, 909028916, 909029646, 909085990, 909121615, 909163088, 909175626, 909211868, 909247771, 909261964, 909322461, 909396742, 909403653, 909494232, 909531021, 909538065, 909603367, 909790410, 909821552, 909856262, 909856569, 910045065, 910177718, 910183200, 910241686, 910286100, 910325394, 910328516, 910359825, 910365627, 910382755, 910383375, 910441300, 910536852, 910568439, 910576859, 910580280, 910611777, 910634826, 910636932, 910654955, 910706955, 910709267, 910723867, 910778780, 910789721, 910827418, 910846822, 910886981, 910951879, 911125706, 911141103, 911181933, 911229901, 911271813, 911349009, 911420119, 911493270, 911494711, 911499380, 911533401, 911539361, 911550421, 911561281, 911610955, 911633467, 911726920, 911758304, 911782600, 911803087, 911885174, 911902866, 911930465, 911931497, 911945327, 911958742, 912067782, 912072503, 912304868, 912341806, 912403978, 912427565, 912469547, 912475235, 912544600, 912562406, 912624366, 912641821, 912771019, 912797291, 912809177, 912859513, 912904171, 912925478, 912959073, 913010117, 913011254, 913041719, 913062216, 913088658, 913119970, 913211625, 913338786, 913339437, 913340779, 913363592, 913499490, 913545339, 913600947, 913617578, 913618276, 913666735, 913714098, 913731401, 913769732, 913789164, 913867399, 913874572, 913875057, 913906192, 913927851, 913968866, 914066196, 914072588, 914090585, 914092433, 914141696, 914224394, 914261215, 914326063, 914337121, 914345521, 914351012, 914355151, 914355268, 914373227, 914447670, 914541341, 914570604, 914609161, 914621801, 914653725, 914689329, 914704687, 914724377, 914724615, 914797150, 914803132, 914847707, 914870063, 914879953, 914906176, 914908803, 914923649, 914975937, 915002011, 915036371, 915048077, 915157375, 915226475, 915226505, 915247188, 915276506, 915291794, 915375879, 915491292, 915705722, 915707858, 915726035, 915742359, 915758701, 915784179, 915802131, 915854514, 915912165, 915921258, 915925342, 915928196, 915932909, 915995644, 916000622, 916134602, 916172761, 916197889, 916207744, 916283249, 916364012, 916393882, 916420563, 916515544, 916593964, 916599655, 916617681, 916703027, 916929441, 916941581, 916958532, 916963243, 916982497, 916989302, 917001229, 917002511, 917015268, 917075763, 917108532, 917141920, 917154596, 917196423, 917238709, 917245924, 917275534, 917287857, 917304670, 917399069, 917498491, 917503317, 917612266, 917718640, 917783730, 917789183, 917838907, 917863423, 917902517, 917908370, 917925057, 918057565, 918168825, 918208645, 918222738, 918279297, 918319040, 918376560, 918388917, 918495081, 918532204, 918564598, 918578214, 918823248, 918853926, 918881773, 918897735, 918901473, 918932699, 918949514, 919003868, 919060418, 919077274, 919149520, 919157064, 919210036, 919295204, 919633663, 919669405, 919679624, 919724392, 919801564, 919842866, 919941113, 919980509, 920026040, 920089401, 920134226, 920143666, 920241874, 920273011, 920355813, 920402440, 920428298, 920485582, 920524750, 920642004, 920731036, 920743704, 920783584, 920830353, 920839454, 920887451, 920899647, 921013584, 921017295, 921151550, 921184422, 921313976, 921323065, 921323317, 921417645, 921496452, 921511164, 921541145, 921552665, 921577330, 921591344, 921680399, 921691335, 921738142, 921745633, 921802419, 921820715, 921910904, 921930737, 921938297, 922006063, 922008681, 922010884, 922042774, 922053273, 922113416, 922116871, 922150578, 922156302, 922233956, 922261552, 922366770, 922401895, 922420269, 922433019, 922454995, 922484134, 922597648, 922632980, 922637038, 922642878, 922649542, 922672101, 922708707, 922754099, 922867483, 922924740, 923078411, 923131023, 923159217, 923209836, 923216018, 923256689, 923256693, 923297415, 923374286, 923386158, 923448786, 923476278, 923585411, 923631661, 923641967, 923664695, 923665684, 923669094, 923691628, 923825156, 923864819, 923896181, 923920623, 923938199, 923967993, 924038915, 924074350, 924099618, 924207604, 924208362, 924211720, 924234752, 924287686, 924292391, 924381075, 924428356, 924469530, 924498593, 924520708, 924531996, 924581108, 924599480, 924622322, 924629272, 924677888, 924684365, 924688805, 924748139, 924766845, 924775355, 924854505, 924947297, 924948016, 924995209, 925029013, 925057457, 925194276, 925291215, 925378480, 925452038, 925485646, 925584551, 925589920, 925674618, 925678734, 925679768, 925724537, 925732689, 925768233, 925770116, 925836603, 925927259, 925995628, 926079388, 926096820, 926150415, 926152577, 926197922, 926322413, 926339121, 926349035, 926402146, 926421206, 926450385, 926453606, 926539950, 926598692, 926690289, 926692093, 926712647, 926767449, 926777027, 926813810, 926832178, 926898923, 926913237, 926986890, 927029335, 927047747, 927055369, 927078132, 927155621, 927185770, 927188463, 927242993, 927309566, 927326650, 927345926, 927411035, 927458654, 927551832, 927572051, 927642651, 927685554, 927703422, 927710554, 927788110, 927804687, 927814967, 927825029, 927828995, 927876009, 927886334, 927915250, 927943725, 928025555, 928029328, 928104107, 928132440, 928149213, 928271208, 928301735, 928305765, 928336990, 928339041, 928388192, 928482743, 928632124, 928790430, 928877371, 928934277, 928962181, 929054931, 929098045, 929106345, 929119486, 929196392, 929242264, 929349375, 929351001, 929363117, 929390949, 929520567, 929703031, 929789933, 929862142, 929934969, 929963778, 929965296, 929984188, 930003909, 930015112, 930020338, 930035035, 930051476, 930195616, 930258865, 930348307, 930350266, 930352952, 930361192, 930433442, 930463793, 930511211, 930514899, 930600344, 930620548, 930720157, 930755838, 930765097, 930813598, 930820920, 930878167, 930958498, 930972051, 930993148, 931047015, 931111268, 931180147, 931230825, 931247434, 931257404, 931440207, 931460631, 931618227, 931626981, 931675942, 931680416, 931815273, 931895070, 931936362, 932036360, 932046191, 932094432, 932151670, 932168081, 932220732, 932272602, 932274716, 932305706, 932342597, 932368267, 932405552, 932407488, 932477883, 932507825, 932510840, 932540870, 932628635, 932669909, 932691361, 932699651, 932723795, 932730693, 932769404, 932775157, 932811466, 932812005, 932830303, 932869948, 932876711, 932901124, 932941925, 932949494, 932969412, 932996041, 933006428, 933095902, 933117608, 933283696, 933321619, 933331527, 933382602, 933413421, 933415000, 933436793, 933438909, 933440192, 933478635, 933495550, 933557189, 933560114, 933697103, 933717600, 933813835, 933961068, 934006740, 934033001, 934158763, 934160514, 934175228, 934226266, 934241956, 934250494, 934292994, 934305281, 934381979, 934387437, 934461963, 934486453, 934488021, 934603690, 934612512, 934641297, 934738520, 934793840, 934808969, 934890917, 934894936, 934916580, 934948547, 934965186, 934993944, 934995473, 935028318, 935045283, 935099823, 935102947, 935129564, 935132707, 935142451, 935262885, 935278906, 935299274, 935509892, 935550382, 935555621, 935604759, 935605963, 935613249, 935782587, 935832403, 935890980, 935897820, 935909952, 935915084, 935917009, 935937923, 935944864, 935955811, 935967277, 936047276, 936087192, 936174945, 936182595, 936184661, 936213376, 936253233, 936351960, 936386523, 936401794, 936448165, 936571816, 936619977, 936620909, 936657523, 936695275, 936730782, 936746893, 936811348, 936842583, 936897722, 936968949, 937003834, 937042508, 937139865, 937165333, 937196860, 937202877, 937229184, 937305816, 937350156, 937352002, 937357704, 937380228, 937387766, 937510251, 937515871, 937516362, 937525015, 937695488, 937745878, 937769128, 937770387, 937773554, 937778902, 937841158, 937911558, 938003243, 938044103, 938054850, 938139682, 938289891, 938332540, 938391953, 938418407, 938418995, 938437894, 938486620, 938589012, 938602618, 938765512, 938799115, 938813642, 938832356, 938840616, 938997149, 939079588, 939083324, 939124866, 939136248, 939198411, 939339152, 939361372, 939503228, 939514809, 939578324, 939646221, 939676578, 939853918, 939873584, 939876717, 939895827, 939923423, 939993674, 940058884, 940066032, 940107816, 940135068, 940172109, 940204810, 940236224, 940238255, 940257049, 940285145, 940286551, 940301857, 940327131, 940445983, 940465854, 940512337, 940655924, 940680806, 940687232, 940726061, 940742727, 940748232, 940779768, 940830976, 940860449, 940872932, 940880710, 940894484, 940905197, 940953214, 940959336, 941007703, 941175305, 941216758, 941265705, 941286485, 941294662, 941344325, 941353855, 941384134, 941394441, 941490346, 941572568, 941574288, 941585600, 941628015, 941635027, 941643956, 941656112, 941681906, 941784890, 941990488, 942102963, 942123556, 942149778, 942158556, 942176952, 942179521, 942271873, 942390975, 942465891, 942522571, 942593291, 942680533, 942703575, 942704940, 942746852, 942806857, 942857787, 942857857, 942858752, 942974098, 942986191, 943106080, 943144330, 943220705, 943270203, 943365543, 943379867, 943385426, 943386428, 943462490, 943496550, 943559420, 943563820, 943624192, 943673519, 943692764, 943695150, 943785022, 943805619, 943825946, 943860637, 943869797, 943887743, 943986637, 943989203, 944015659, 944036506, 944054726, 944074351, 944079183, 944089340, 944099557, 944133981, 944156454, 944170523, 944176219, 944212017, 944222706, 944240053, 944283665, 944286315, 944302276, 944342900, 944357713, 944379912, 944420426, 944430250, 944432577, 944508222, 944515139, 944578579, 944578786, 944639735, 944640668, 944686802, 944690669, 944717138, 944829965, 944960010, 944966917, 944991271, 944999357, 945044694, 945096350, 945129179, 945194731, 945282221, 945291986, 945343237, 945459392, 945490078, 945491450, 945493203, 945494762, 945520429, 945551573, 945628754, 945945665, 945981448, 946024590, 946052640, 946055531, 946061184, 946119026, 946141511, 946356934, 946448995, 946495417, 946510645, 946521203, 946568646, 946598011, 946644577, 946668713, 946701117, 946754777, 946780981, 946810407, 946862628, 946930991, 946943433, 946991433, 947010598, 947039171, 947151016, 947194232, 947230519, 947270962, 947359807, 947382981, 947436700, 947441480, 947445077, 947462864, 947493349, 947602492, 947657166, 947673161, 947673427, 947682770, 947709694, 947752500, 947792870, 947830369, 947936260, 947975542, 948069883, 948124233, 948133505, 948176881, 948198842, 948219655, 948269132, 948368323, 948459722, 948498849, 948522012, 948693513, 948695883, 948711656, 948760086, 948819135, 948854283, 948927225, 949072826, 949087547, 949090126, 949233069, 949292617, 949341566, 949359158, 949384850, 949483677, 949487583, 949526375, 949594555, 949620085, 949678632, 949720117, 949757849, 949815081, 949823497, 949827185, 949924172, 950025229, 950079791, 950117677, 950172466, 950221827, 950279417, 950292900, 950350985, 950381006, 950407144, 950430357, 950435045, 950469032, 950520087, 950555015, 950571704, 950601825, 950621576, 950633352, 950637939, 950641075, 950685960, 950702923, 950725971, 950754607, 950821265, 950839051, 950896324, 951010005, 951118317, 951171533, 951176669, 951185181, 951295873, 951302471, 951348359, 951420599, 951536089, 951545762, 951695277, 951715592, 951792597, 951810601, 951870103, 952090923, 952092787, 952139512, 952180158, 952216273, 952246640, 952255167, 952256377, 952291070, 952301248, 952397984, 952410137, 952431730, 952447485, 952475447, 952531121, 952589003, 952594281, 952635531, 952812617, 952888096, 952901548, 952959007, 952974561, 953023373, 953073700, 953083170, 953149225, 953250865, 953262780, 953354386, 953363783, 953380284, 953461845, 953482771, 953483910, 953505946, 953512355, 953606199, 953631218, 953660870, 953694872, 953770909, 953853825, 953884918, 953901248, 953931176, 953991688, 953995139, 954004482, 954034039, 954118964, 954192058, 954201352, 954255045, 954267248, 954333395, 954349500, 954401042, 954427987, 954547363, 954563226, 954789043, 954966904, 954995201, 955075890, 955114752, 955198151, 955201698, 955229698, 955235232, 955244709, 955246817, 955361817, 955407246, 955415021, 955458840, 955521834, 955527767, 955537789, 955658150, 955711929, 955734125, 955740492, 955744570, 955753163, 955757085, 955838910, 955853855, 955917961, 955987474, 956010469, 956064505, 956093788, 956157813, 956177012, 956188914, 956256222, 956301288, 956312747, 956356184, 956389890, 956402330, 956436117, 956444875, 956473902, 956477025, 956489554, 956552406, 956553025, 956569845, 956591981, 956686933, 956702474, 956721097, 956848768, 956894891, 956958368, 956988505, 957056609, 957080917, 957184243, 957200421, 957288103, 957314549, 957341142, 957367145, 957566138, 957579005, 957687199, 957740004, 957749731, 957798688, 957811362, 957907851, 957967007, 958014373, 958014976, 958066229, 958316942, 958415123, 958436502, 958696420, 958737090, 958742784, 958754987, 958760031, 958881563, 958994100, 959084840, 959215315, 959275819, 959314868, 959368666, 959378579, 959409043, 959555827, 959557757, 959573975, 959583198, 959664858, 959749562, 959988321, 960001921, 960020589, 960225850, 960334010, 960348360, 960465641, 960471063, 960505261, 960528944, 960632803, 960866994, 960874069, 960904923, 960942512, 961039970, 961091361, 961165683, 961172319, 961175739, 961207714, 961247983, 961258520, 961283936, 961288224, 961305006, 961340043, 961373603, 961418322, 961425842, 961449175, 961512220, 961528501, 961571278, 961642003, 961791929, 961924219, 961947094, 961971794, 962025855, 962030691, 962045389, 962081337, 962151701, 962217316, 962219518, 962288528, 962308692, 962333208, 962358282, 962376345, 962575891, 962605715, 962609511, 962669606, 962684301, 962711521, 962719204, 962781121, 962839240, 962959870, 962962196, 962970039, 963050135, 963072525, 963107698, 963114182, 963118701, 963119937, 963192571, 963228082, 963411476, 963472006, 963545479, 963550930, 963622035, 963634123, 963694127, 963839955, 963846910, 963886316, 964000215, 964033744, 964078470, 964221848, 964347439, 964379023, 964418268, 964431040, 964450252, 964483745, 964578054, 964609036, 964633249, 964683052, 964694690, 964723250, 964792762, 964812601, 964819397, 964918156, 964922066, 964959965, 965014565, 965030949, 965049924, 965062703, 965123149, 965247998, 965367243, 965406176, 965406754, 965502564, 965600557, 965677139, 965754412, 965791994, 965870062, 965870594, 965930685, 965997872, 966016415, 966018167, 966018275, 966033585, 966067437, 966100042, 966196439, 966253098, 966279845, 966319673, 966330923, 966499750, 966519297, 966533286, 966549759, 966621885, 966681061, 966689899, 966711727, 966727879, 966740585, 966747993, 966850145, 966957103, 966999375, 967004794, 967073002, 967146720, 967151755, 967157829, 967162847, 967185444, 967193244, 967253229, 967283247, 967294547, 967301345, 967311187, 967338599, 967355941, 967386525, 967448030, 967647882, 967666320, 967674869, 967715016, 967725485, 967752825, 967779801, 967788007, 967888130, 967906066, 967915065, 967915603, 967932359, 967978727, 968089176, 968121219, 968140074, 968174117, 968186775, 968230806, 968317287, 968476397, 968477983, 968484231, 968485353, 968494994, 968519164, 968521527, 968538486, 968571755, 968585868, 968688914, 968731622, 968746117, 968750087, 968774935, 968809717, 968921134, 968933226, 968943554, 968945215, 969011385, 969063548, 969089863, 969135973, 969144615, 969268202, 969276894, 969278933], 401], "output": 4}, {"inputs": [[692, 692, 692, 692, 692, 692, 692, 692, 692, 692, 693, 693, 693, 693, 693, 693, 693, 693, 693, 693, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 695, 695, 695, 695, 695, 695, 695, 695, 696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, 699, 699, 699, 700, 700, 700, 700, 700, 700, 700, 700, 700, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 702, 702, 702, 702, 702, 702, 702, 702, 702, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 706, 706, 706, 706, 706, 706, 706, 706, 706, 706, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 708, 708, 708, 708, 708, 708, 708, 708, 708, 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, 710, 710, 710, 710, 710, 710, 710, 710, 710, 710, 710, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 712, 712, 712, 712, 712, 712, 712, 712, 712, 712, 712, 712, 712, 713, 713, 713, 713, 713, 713, 713, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 715, 715, 715, 715, 715, 715, 715, 715, 715, 716, 716, 716, 716, 716, 716, 716, 716, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, 719, 719, 719, 719, 719, 719, 719, 719, 720, 720, 720, 720, 720, 720, 720, 720, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 723, 723, 723, 723, 723, 723, 723, 723, 724, 724, 724, 724, 724, 724, 724, 724, 724, 724, 724, 724, 725, 725, 725, 725, 725, 726, 726, 726, 726, 726, 726, 726, 726, 726, 727, 727, 727, 727, 727, 727, 727, 727, 728, 728, 728, 728, 728, 728, 728, 728, 728, 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, 729, 730, 730, 730, 730, 730, 730, 731, 731, 731, 731, 731, 731, 731, 731, 732, 732, 732, 732, 732, 733, 733, 733, 733, 733, 733, 733, 733, 733, 733, 733, 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, 735, 735, 735, 735, 735, 735, 735, 736, 736, 736, 736, 736, 736, 736, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 739, 739, 739, 739, 739, 739, 739, 739, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 741, 741, 741, 741, 741, 741, 741, 741, 742, 742, 742, 742, 742, 742, 742, 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, 744, 744, 744, 744, 744, 744, 744, 744, 744, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 746, 746, 746, 746, 746, 746, 746, 746, 746, 746, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 748, 748, 748, 748, 748, 748, 748, 748, 749, 749, 749, 749, 749, 749, 749, 749, 749, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 751, 751, 751, 751, 751, 751, 751, 751, 751, 751, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 753, 753, 753, 753, 753, 753, 753, 753, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 755, 755, 755, 755, 755, 755, 755, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 756, 757, 757, 757, 757, 757, 757, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 759, 759, 759, 759, 759, 759, 759, 759, 759, 759, 760, 760, 760, 760, 760, 760, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, 763, 763, 763, 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, 765, 765, 765, 765, 765, 765, 765, 765, 765, 765, 765, 766, 766, 766, 766, 766, 766, 766, 766, 766, 766, 766, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 770, 770, 770, 770, 770, 770, 770, 770, 770, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 774, 774, 774, 774, 774, 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, 776, 776, 776, 776, 776, 776, 776, 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 780, 780, 780, 780, 780, 780, 780, 780, 780, 781, 781, 781, 781, 781, 781, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 785, 785, 785, 785, 785, 785, 785, 785, 785, 785, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 787, 787, 787, 787, 787, 787, 787, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 789, 789, 789, 790, 790, 790, 790, 790, 790, 790, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, 796, 796, 796, 796, 796, 796, 796, 796, 796, 796, 796, 796, 796, 797, 797, 797, 798, 798, 798, 798, 798, 798, 798, 798, 798, 798, 799, 799, 799, 799, 799, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 801, 801, 801, 801, 801, 801, 801, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 803, 803, 803, 803, 803, 803, 804, 804, 804, 804, 804, 804, 804, 804, 804, 805, 805, 805, 805, 805, 805, 805, 805, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 807, 807, 807, 807, 807, 807, 807, 807, 807, 808, 808, 808, 808, 808, 809, 809, 810, 810, 810, 810, 810, 810, 810, 810, 811, 811, 811, 811, 811, 812, 812, 812, 812, 812, 812, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 814, 814, 814, 814, 814, 814, 814, 814, 814, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 817, 817, 817, 817, 817, 817, 817, 817, 817, 817, 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, 819, 819, 819, 819, 819, 819, 819, 819, 819, 820, 820, 820, 820, 820, 820, 820, 820, 820, 820, 820, 820, 820, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 823, 823, 823, 823, 823, 823, 823, 824, 824, 824, 824, 824, 825, 825, 825, 825, 826, 826, 826, 826, 826, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 829, 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 834, 834, 834, 834, 834, 834, 834, 834, 834, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 836, 836, 836, 836, 836, 836, 836, 836, 836, 836, 836, 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, 838, 838, 838, 838, 838, 838, 839, 839, 839, 839, 839, 839, 839, 839, 839, 840, 840, 840, 840, 840, 840, 840, 840, 840, 840, 841, 841, 841, 841, 841, 841, 841, 841, 841, 842, 842, 842, 842, 842, 842, 842, 842, 842, 842, 842, 842, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 844, 844, 844, 844, 844, 844, 844, 844, 844, 844, 844, 844, 845, 845, 845, 845, 845, 845, 845, 845, 845, 845, 845, 845, 846, 846, 846, 846, 846, 846, 846, 846, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 848, 848, 848, 848, 848, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 852, 852, 852, 852, 852, 852, 852, 852, 852, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 854, 854, 854, 854, 854, 854, 854, 854, 854, 854, 854, 854, 854, 854, 855, 855, 855, 855, 855, 855, 855, 855, 855, 856, 856, 856, 856, 856, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 858, 858, 858, 858, 858, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 860, 860, 860, 860, 860, 860, 860, 860, 861, 861, 861, 861, 861, 861, 861, 861, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 863, 863, 863, 863, 863, 863, 864, 864, 864, 864, 864, 864, 864, 865, 865, 865, 865, 865, 865, 865, 865, 865, 865, 865, 865, 866, 866, 866, 866, 866, 866, 866, 866, 866, 867, 867, 867, 867, 867, 867, 867, 868, 868, 868, 868, 868, 868, 868, 869, 869, 869, 869, 869, 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, 871, 871, 871, 871, 871, 871, 872, 872, 872, 872, 872, 872, 872, 873, 873, 873, 873, 873, 873, 873, 873, 873, 873, 873, 873, 873, 873, 874, 874, 874, 874, 874, 874, 874, 874, 874, 874, 874, 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, 876, 876, 876, 876, 876, 877, 877, 877, 877, 877, 877, 877, 877, 877, 877, 877, 878, 878, 878, 878, 878, 878, 878, 878, 878, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 880, 880, 880, 880, 880, 880, 880, 880, 880, 881, 881, 881, 881, 881, 881, 881, 881, 881, 881, 882, 882, 882, 882, 882, 882, 882, 882, 882, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, 884, 884, 884, 884, 884, 884, 884, 884, 884, 884, 884, 884, 885, 885, 885, 885, 885, 885, 885, 885, 885, 885, 885, 886, 886, 886, 886, 886, 886, 887, 887, 887, 887, 887, 887, 887, 887, 887, 887, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 890, 890, 890, 890, 890, 890, 890, 890, 890, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, 895, 895, 895, 895, 895, 895, 895, 895, 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, 897, 897, 897, 897, 897, 897, 897, 897, 897], 1455], "output": 2094}, {"inputs": [[1051376, 1051414, 1052293, 1052600, 1053062, 1053212, 1054098, 1054109, 1054257, 1054288, 1054514, 1054610, 1054630, 1054956, 1055390, 1055462, 1055554, 1055578, 1055767, 1056065, 1056408, 1056706, 1057088, 1057618, 1057876, 1058039, 1058475, 1058501, 1059276, 1059854, 1060149, 1060483, 1060591, 1061379, 1061446, 1061536, 1062025, 1062389, 1062521, 1062700, 1062984, 1063020, 1063227, 1063409, 1063727, 1063727, 1064128, 1064224, 1064456, 1064920, 1065042, 1065175, 1065456, 1066212, 1066297, 1066614, 1067414, 1067503, 1067627, 1067744, 1067974, 1068182, 1068229, 1068615, 1069163, 1069219, 1069336, 1069345, 1069681, 1069840, 1070241, 1070508, 1070566, 1071304, 1071471, 1071670, 1071794, 1071941, 1072006, 1072431, 1073033, 1073109, 1073152, 1073536, 1073719, 1073781, 1073873, 1073915, 1073938, 1074395, 1074676, 1074862, 1075041, 1075182, 1075209, 1075797, 1076127, 1076876, 1076921, 1076929, 1077080, 1077131, 1077182, 1077449, 1077480, 1077889, 1077953, 1078122, 1078318, 1078382, 1078572, 1078576, 1078912, 1079179, 1079330, 1079662, 1079832, 1079886, 1079929, 1079984, 1080029, 1081060, 1081094, 1081145, 1081336, 1081357, 1081416, 1081549, 1081762, 1082088, 1082171, 1082632, 1082662, 1082998, 1083179, 1083183, 1083328, 1083458, 1083677, 1083685, 1083755, 1083759, 1084166, 1084294, 1084930, 1085331, 1085633, 1085796, 1085835, 1085953, 1086623, 1086663, 1086735, 1086939, 1087089, 1087459, 1087975, 1088029, 1088712, 1088797, 1089209, 1089545, 1089667, 1089754, 1089765, 1090152, 1090276, 1090408, 1090513, 1090705, 1091011, 1091022, 1091073, 1091309, 1091371, 1091737, 1091827, 1091990, 1092400, 1092528, 1092538, 1092612, 1092833, 1092840, 1092882, 1092961, 1093018, 1093187, 1093327, 1093577, 1093719, 1093721, 1093771, 1094508, 1094722, 1094809, 1095914, 1096087, 1096221, 1096390, 1096659, 1096997, 1097125, 1097207, 1098439, 1099159, 1099171, 1099192, 1099507, 1099753, 1099944, 1099988, 1100344, 1100715, 1101367, 1101727, 1102367, 1102372, 1102578, 1102886, 1103058, 1103070, 1103117, 1103446, 1103839, 1104013, 1104327, 1104730, 1104798, 1106120, 1106218, 1106270, 1106928, 1107849, 1107869, 1107895, 1108156, 1108256, 1108321, 1108362, 1108384, 1108804, 1108835, 1108908, 1108918, 1108919, 1109056, 1109109, 1109517, 1109563, 1109587, 1109699, 1109993, 1110051, 1110135, 1110767, 1110781, 1111411, 1111454, 1111473, 1111481, 1112079, 1112155, 1112326, 1112601, 1112643, 1112736, 1113029, 1113069, 1113163, 1113363, 1113580, 1113743, 1114003, 1114055, 1114076, 1114129, 1114208, 1114220, 1115333, 1116509, 1116524, 1116967, 1117046, 1117237, 1117466, 1117635, 1117977, 1118077, 1118279, 1118369, 1118495, 1118497, 1118645, 1118883, 1118891, 1119185, 1119353, 1119557, 1120106, 1120256, 1120757, 1120808, 1120917, 1120935, 1121167, 1121658, 1122111, 1122696, 1122795, 1122979, 1123794, 1123934, 1124109, 1124141, 1124642, 1124942, 1125298, 1125338, 1125436, 1126068, 1126319, 1126890, 1126939, 1127194, 1127354, 1127483, 1127497, 1127506, 1127774, 1128039, 1128072, 1128211, 1128476, 1128693, 1128712, 1128939, 1128968, 1129493, 1129599, 1129830, 1130120, 1130289, 1131301, 1131499, 1131542, 1131714, 1131951, 1132024, 1132042, 1132393, 1132808, 1133004, 1133024, 1133091, 1133395, 1133905, 1134102, 1134195, 1134197, 1134298, 1134421, 1134525, 1134633, 1135159, 1135294, 1136376, 1136600, 1136684, 1136885, 1137093, 1137158, 1137406, 1137452, 1138090, 1138218, 1138260, 1138739, 1139035, 1139132, 1139193, 1139255, 1139385, 1139506, 1139851, 1139920, 1140039, 1140160, 1140238, 1140276, 1140611, 1140810, 1140956, 1141198, 1141654, 1141821, 1142499, 1142521, 1142550, 1142851, 1143182, 1143354, 1143727, 1143798, 1144011, 1144233, 1144244, 1144266, 1144392, 1144464, 1144499, 1144552, 1144904, 1145033, 1145286, 1145502, 1145770, 1146190, 1146402, 1146815, 1146883, 1147143, 1147342, 1147342, 1147815, 1148053, 1148756, 1148794, 1149095, 1149163, 1149291, 1149485, 1149717, 1150308, 1150862, 1151029, 1152665, 1152826, 1153232, 1153269, 1153312, 1153913, 1154182, 1154245, 1154627, 1155951, 1156019, 1156483, 1156550, 1156792, 1157674, 1157805, 1157839, 1157925, 1158216, 1158840, 1159090, 1159588, 1159892, 1159969, 1160389, 1160642, 1160964, 1161377, 1161490, 1161581, 1161582, 1161655, 1161771, 1161872, 1162194, 1162434, 1162537, 1163006, 1163129, 1163146, 1163281, 1163672, 1164281, 1164466, 1164606, 1165384, 1165474, 1165643, 1165659, 1165874, 1166013, 1166119, 1166290, 1166302, 1166372, 1166391, 1166426, 1166710, 1167241, 1167459, 1167834, 1167839, 1168895, 1168943, 1169150, 1169376, 1169469, 1169965, 1170034, 1170475, 1170571, 1171414, 1171849, 1172009, 1172239, 1172345, 1172742, 1173155, 1173254, 1173320, 1173552, 1173872, 1173997, 1174597, 1174672, 1174891, 1175043, 1175344, 1175458, 1175611, 1175853, 1176086, 1176206, 1176313, 1176765, 1177167, 1177201, 1177267, 1177412, 1177576, 1177736, 1177916, 1178056, 1178284, 1179053, 1179173, 1179422, 1179577, 1180041, 1180328, 1180428, 1181041, 1181327, 1181887, 1181993, 1182103, 1182281, 1182337, 1182543, 1183037, 1184101, 1184370, 1185640, 1186191, 1186554, 1186662, 1186683, 1186896, 1187044, 1187072, 1187625, 1187984, 1188157, 1188604, 1188624, 1188797, 1188871, 1189314, 1189391, 1189401, 1189498, 1189808, 1190216, 1190266, 1190390, 1190840, 1190864, 1190984, 1191255, 1191689, 1191915, 1192375, 1192618, 1192754, 1192873, 1193098, 1193235, 1193292, 1194659, 1194791, 1195009, 1195178, 1195249, 1195661, 1196061, 1196225, 1196401, 1196653, 1196680, 1196804, 1196947, 1198789, 1199110, 1199141, 1199239, 1199247, 1200423, 1200758, 1200770, 1201014, 1201068, 1201211, 1201236, 1201360, 1201485, 1201551, 1202042, 1202087, 1202239, 1203031, 1203219, 1203520, 1203575, 1204590, 1204638, 1204796, 1205472, 1205791, 1205839, 1206369, 1206521, 1206659, 1206760, 1206908, 1207242, 1207307, 1207462, 1207849, 1208436, 1208492, 1209067, 1209146, 1209735, 1209917, 1210142, 1210295, 1210411, 1210530, 1211039, 1211191, 1211512, 1211574, 1211671, 1212644, 1212731, 1212976, 1213053, 1213288, 1213426, 1213433, 1213785, 1213991, 1214127, 1214378, 1214842, 1214863, 1215742, 1215808, 1215859, 1216057, 1216552, 1216933, 1216976, 1217237, 1217329, 1217420, 1217646, 1217791, 1218094, 1218096, 1218302, 1218361, 1218372, 1218914, 1218925, 1219193, 1219568, 1219863, 1219874, 1219992, 1220102, 1220656, 1220805, 1220861, 1220949, 1220974, 1221001, 1221005, 1221032, 1221183, 1222354, 1222395, 1223141, 1223603, 1223676, 1223689, 1224478, 1224517, 1224546, 1224555, 1224837, 1225097, 1225178, 1225472, 1225617, 1225666, 1225753, 1226204, 1226339, 1226737, 1226756, 1227072, 1227532, 1227845, 1227926, 1228635, 1228901, 1229110, 1229122, 1229821, 1230089, 1230511, 1230901, 1231440, 1231795, 1231797, 1231911, 1232612, 1232761, 1232767, 1233117, 1233129, 1233135, 1233143, 1234334, 1234361, 1234749, 1235053, 1235578, 1236074, 1236926, 1237046, 1237091, 1237156, 1237312, 1237459, 1237772, 1237823, 1237837, 1237869, 1238227, 1238705, 1238761, 1238860, 1239045, 1239619, 1239692, 1239768, 1239924, 1239967, 1240019, 1240119, 1240478, 1240702, 1240799, 1240846, 1241099, 1241129, 1241570, 1241903, 1241924, 1242502, 1242546, 1242554, 1242968, 1242987, 1243218, 1243539, 1243568, 1243989, 1244139, 1244711, 1244782, 1245017, 1245061, 1245315, 1245408, 1245568, 1245724, 1246168, 1246266, 1246538, 1246747, 1246847, 1246938, 1247060, 1247200, 1247206, 1247253, 1247663, 1247881, 1248915, 1248940, 1249000, 1249121, 1249257, 1249439, 1249641, 1249984, 1250277, 1250406, 1250615, 1250716, 1250756, 1251095, 1251164, 1251403, 1251575, 1251762, 1252505, 1252742, 1252767, 1252782, 1252846, 1252883, 1252936, 1253044, 1253223, 1253279, 1253368, 1253747, 1253760, 1253843, 1254343, 1254353, 1254591, 1254703, 1254952, 1255279, 1255303, 1255537, 1255995, 1256664, 1256730, 1256754, 1257081, 1257191, 1257196, 1257228, 1257324, 1257408, 1257563, 1257644, 1258431, 1258471, 1258652, 1258686, 1258862, 1259348, 1259469, 1259548, 1259599, 1259825, 1259833, 1259994, 1260251, 1260426, 1260553, 1260570, 1260609, 1260809, 1260972, 1261237, 1261652, 1261853, 1262025, 1262376, 1262465, 1262494, 1262841, 1263200, 1263231, 1263239, 1263515, 1263593, 1263854, 1264258, 1264319, 1264486, 1264517, 1264824, 1265182, 1265247, 1265683, 1265899, 1266226, 1266292, 1266327, 1266410, 1266977, 1267302, 1268001, 1268295, 1268945, 1269118, 1269502, 1269963, 1270365, 1270488, 1270572, 1271173, 1271452, 1271534, 1271684, 1272047, 1272506, 1272556, 1272691, 1272721, 1272754, 1272984, 1273270, 1273920, 1274075, 1274189, 1274328, 1274337, 1275040, 1275322, 1275522, 1275610, 1275646, 1275903, 1276026, 1276173, 1276377, 1277068, 1277482, 1278062, 1278082, 1278331, 1278463, 1278580, 1278625, 1279188, 1279674, 1279747, 1279884, 1281058, 1281058, 1281218, 1281313, 1281474, 1281484, 1281821, 1282266, 1282330, 1282685, 1282923, 1282967, 1283219, 1283287, 1284711, 1284808, 1285687, 1286398, 1286684, 1287116, 1287327, 1287676, 1287970, 1288246, 1288713, 1289664, 1289666, 1290055, 1290150, 1290285, 1290567, 1291199, 1291367, 1291474, 1291535, 1291639, 1291746, 1291786, 1291948, 1292136, 1292172, 1292208, 1292396, 1292459, 1292504, 1292573, 1293068, 1293421, 1293495, 1293554, 1293860, 1293901, 1294289, 1295216, 1295303, 1295727, 1295815, 1296264, 1296532, 1297035, 1297697, 1297851, 1297892, 1298292, 1298547, 1298924, 1298993, 1299081, 1299162, 1299413, 1299894, 1300196, 1300695, 1300864, 1300952, 1301012, 1301178, 1301179, 1301729, 1301864, 1301901, 1302789, 1303014, 1303402, 1303614, 1303703, 1303834, 1303941, 1304457, 1304546, 1305460, 1305526, 1305788, 1305924, 1306559, 1306585, 1306707, 1306745, 1306772, 1307314, 1307499, 1307563, 1307644, 1307872, 1308038, 1308630, 1308779, 1308830, 1308837, 1308887, 1308932, 1309094, 1309156, 1309547, 1309646, 1309665, 1309862, 1310137, 1310175, 1310398, 1310559, 1310900, 1311001, 1311178, 1311217, 1311723, 1311788, 1311793, 1311887, 1312032, 1312062, 1312082, 1312148, 1312208, 1312287, 1312410, 1312758, 1313051, 1313057, 1313147, 1313454, 1313468, 1314603, 1314697, 1314845, 1314872, 1314926, 1315735, 1315886, 1315911, 1315983, 1316203, 1316275, 1316363, 1316941, 1317869, 1318123, 1318215, 1318368, 1318718, 1318733, 1318767, 1318838, 1319012, 1319436, 1319524, 1319644, 1319766, 1320300, 1320685, 1320822, 1320866, 1321120, 1321316, 1321389, 1321829, 1322285, 1322365, 1322472, 1322504, 1322775, 1322872, 1322964, 1323023, 1323264, 1323706, 1324188, 1324781, 1324874, 1325453, 1325561, 1325633, 1325757, 1326079, 1326085, 1326172, 1326258, 1326381, 1326497, 1326679, 1326969, 1327091, 1327555, 1327681, 1327833, 1328017, 1328159, 1328210, 1328289, 1328372, 1328379, 1328738, 1328827, 1329039, 1329519, 1330007, 1330072, 1330257, 1330260, 1330701, 1330937, 1331234, 1331366, 1332610, 1333018, 1333153, 1333617, 1333822, 1333922, 1333960, 1334473, 1334579, 1334620, 1334713, 1334745, 1335188, 1335731, 1336277, 1336651, 1336758, 1336782, 1337603, 1337722, 1337758, 1338223, 1338704, 1338845, 1338858, 1339092, 1339360, 1339485, 1339760, 1339996, 1340058, 1340547, 1341601, 1341656, 1341815, 1342568, 1342605, 1342696, 1342786, 1342913, 1343432, 1343621, 1343732, 1343782, 1344417, 1344864, 1345089, 1345396, 1345910, 1346192, 1346218, 1346624, 1346930, 1347208, 1347350, 1347486, 1348270, 1348963, 1349055, 1349144, 1349491, 1349588, 1349642, 1349696, 1349739, 1349883, 1349966, 1350011, 1350592, 1350642, 1350808, 1350824, 1350919, 1351327, 1351982, 1352011, 1352141, 1352566, 1352712, 1352866, 1353038, 1353062, 1353075, 1353638, 1353813, 1354128, 1354293, 1354337, 1354574, 1354598, 1354614, 1354775, 1354999, 1355115, 1355248, 1355285, 1355320, 1355574, 1356901, 1356904, 1357147, 1357198, 1357601, 1357683, 1357717, 1357843, 1357884, 1358068, 1358118, 1358277, 1358391, 1358513, 1359271, 1359751, 1359754, 1360390, 1360519, 1360544, 1360692, 1360714, 1360866, 1361136, 1361357, 1361631, 1362038, 1362378, 1362428, 1362459, 1362707, 1363270, 1363339, 1363440, 1363495, 1363579, 1363623, 1363739, 1363883, 1364429, 1364651, 1365067, 1365358, 1365456, 1365770, 1365812, 1365883, 1366060, 1366295, 1366553, 1366869, 1366983, 1366983, 1367047, 1367334, 1367366, 1367851, 1367957, 1367993, 1368028, 1368176, 1368182, 1368306, 1368500, 1368737, 1368933, 1369098, 1369746, 1369814, 1369947, 1370717, 1370765, 1370781, 1371058, 1371079, 1371086, 1371163, 1371315, 1371341, 1372336, 1372424, 1372435, 1372632, 1372842, 1372934, 1373057, 1373336, 1374228, 1374325, 1374594, 1374855, 1375287, 1375436, 1375565, 1375702, 1375778, 1375931, 1376141, 1376627, 1376855, 1376891, 1377011, 1377515, 1377718, 1377957, 1378045, 1378127, 1378145, 1378289, 1378448, 1379116, 1379184, 1379323, 1379638, 1379713, 1379719, 1380122, 1380307, 1380328, 1380404, 1380642, 1380917, 1380985, 1381730, 1381869, 1381964, 1382101, 1382186, 1382438, 1382510, 1383035, 1383095, 1383336, 1383459, 1383592, 1384840, 1385753, 1386020, 1386352, 1386790, 1386943, 1387145, 1387152, 1387241, 1388441, 1388581, 1388734, 1389080, 1389189, 1389543, 1389849, 1389871, 1390152, 1390193, 1390989, 1391066, 1391139, 1391145, 1391475, 1391580, 1391779, 1392062, 1392165, 1392519, 1393274, 1393361, 1393433, 1393448, 1393802, 1394444, 1394487, 1394634, 1394667, 1395104, 1395152, 1395434, 1395675, 1395839, 1395967, 1396353, 1396936, 1396966, 1397029, 1397081, 1397477, 1397498, 1397620, 1397785, 1398019, 1399133, 1399672, 1400009, 1400049, 1401107, 1401199, 1401289, 1401570, 1401880, 1402113, 1402191, 1402275, 1402440, 1402516, 1402545, 1402650, 1402836, 1402845, 1403089, 1403461, 1403514, 1403648, 1403686, 1403876, 1404062, 1404130, 1404365, 1404486, 1404855, 1405023, 1405690, 1405954, 1405986, 1406021, 1406482, 1406816, 1406851, 1407312, 1407804, 1408543, 1409082, 1409851, 1410258, 1410682, 1411026, 1411063, 1411162, 1411552, 1412580, 1412649, 1412990, 1413115, 1413177, 1413517, 1413564, 1413760, 1413837, 1413965, 1414219, 1414284, 1414477, 1414596, 1414775, 1414926, 1415171, 1415775, 1415878, 1416038, 1416115, 1416168, 1416628, 1416662, 1416738, 1416801, 1417202, 1417211, 1417270, 1417539, 1417546, 1417750, 1417810, 1417926, 1418241, 1418564, 1418802, 1418863, 1418943, 1418965, 1419035, 1419100, 1419228, 1419242, 1419268, 1419268, 1419615, 1420047, 1420130, 1420215, 1421478, 1421691, 1421966, 1422500, 1422647, 1423083, 1423443, 1423770, 1424030, 1424494, 1424728, 1424815, 1425082, 1425573, 1425801, 1426574, 1426605, 1426945, 1427336, 1427604, 1427669, 1427829, 1428323, 1428610, 1428864, 1428876, 1429160, 1429178, 1429441, 1429501, 1429656, 1429863, 1429912, 1429976, 1430221, 1430461, 1430648, 1430676, 1430737, 1431205, 1431337, 1431381, 1431628, 1431739, 1432271, 1433236, 1433542, 1433601, 1433654, 1433699, 1433706, 1433824, 1434042, 1434665, 1434724, 1435372, 1435550, 1436101, 1436106, 1436274, 1436312, 1436354, 1437228, 1437456, 1437637, 1437667, 1437669, 1437680, 1437681, 1437682, 1437871, 1437949, 1438003, 1438472, 1438960, 1439068, 1439554, 1439709, 1440134, 1440203, 1440355, 1440401, 1440515, 1440733, 1440743, 1440925, 1441095, 1441927, 1442186, 1442191, 1442193, 1442599, 1442805, 1442900, 1442931, 1442960, 1443112, 1443742, 1443768, 1443888, 1444087, 1444346, 1445208, 1445529, 1445541, 1445553, 1445750, 1446008, 1446362, 1446856, 1447253, 1447944, 1448526, 1448675, 1449056, 1449189, 1449262, 1449287, 1449329, 1449438, 1449504, 1449742, 1449770, 1449901, 1450187, 1450275, 1450544, 1450720, 1450732, 1450791, 1451760, 1451841, 1452553, 1453223, 1453407, 1454838, 1455115, 1455263, 1455431, 1455772, 1455936, 1456215, 1456508, 1456559, 1457290, 1457610, 1457641, 1457956, 1458057, 1458410, 1458787, 1458954, 1459355, 1459398, 1459468, 1459526, 1459686, 1460121, 1460329, 1460596, 1460619, 1460666, 1461124, 1461432, 1461435, 1461509, 1461641, 1461929, 1462450, 1462471, 1462624, 1462641, 1462701, 1462740, 1462898, 1462992, 1463189, 1463434, 1463772, 1463914, 1464240, 1464283, 1464348, 1464355, 1464692, 1464866, 1464876, 1464912, 1465729, 1465840, 1466023, 1466035, 1466384, 1467018, 1467168, 1467176, 1467316, 1467318, 1467665, 1467939, 1468331, 1468474, 1468562, 1468615, 1468810, 1468963, 1469098, 1469290, 1469531, 1469547, 1469883, 1470093, 1470364, 1470377, 1470417, 1470425, 1470438, 1470443, 1470523, 1470975, 1471728, 1471842, 1472094, 1472101, 1472238, 1472474, 1472593, 1472604, 1472617, 1472894, 1473255, 1473266, 1473280, 1473305, 1473499, 1474027, 1474093, 1474119, 1474732, 1474896, 1475005, 1475244, 1475379, 1475757, 1476081, 1476364, 1476431, 1476436, 1476500, 1476524, 1476592, 1476820, 1477033, 1477321, 1477332, 1477564, 1478151, 1478248, 1478546, 1478547, 1478887, 1479061, 1479338, 1479546, 1480168, 1480683, 1481065, 1481101, 1481208, 1481219, 1481314, 1481768, 1481777, 1481814, 1482304, 1482455, 1482947, 1482989, 1483064, 1483478, 1484141, 1484463, 1484522, 1484944, 1485475, 1485621, 1485627, 1485809, 1485817, 1485889, 1486199, 1486330, 1486393, 1486534, 1486581, 1486842, 1486854, 1487155, 1487250, 1487620, 1487691, 1487732, 1488108, 1488186, 1488358, 1488525, 1488828, 1489310, 1489317, 1489405, 1489491, 1490014, 1490073, 1490371, 1490376, 1490924, 1491304, 1491448, 1492012, 1492091, 1492248, 1492260, 1492371, 1492464, 1492741, 1492779, 1492911, 1493011, 1493062, 1493424, 1493827, 1493850, 1494122, 1494617, 1494794, 1495344, 1495471, 1495513, 1495984, 1497009, 1497036, 1497637, 1497694, 1497704, 1497778, 1497922, 1498125, 1498281, 1498408, 1498483, 1498534, 1498838, 1499021, 1499372, 1499376, 1499410, 1499847, 1500687, 1500900, 1500931, 1501657, 1501738, 1501956, 1502102, 1502269, 1502568, 1502705, 1503470, 1503508, 1503570, 1503847, 1504597, 1504605, 1504635, 1504807, 1504825, 1505308, 1505458, 1505772, 1505904, 1506260, 1506570, 1506902, 1507063, 1507127, 1507163, 1507256, 1507334, 1507413, 1507598, 1508022, 1508045, 1508302, 1509093, 1509256, 1509365, 1510410, 1510418, 1511032, 1511114, 1511154, 1511409, 1511821, 1512030, 1512254, 1512503, 1512568, 1513096, 1513127, 1513164, 1513558, 1513567, 1514129, 1514508, 1514711, 1514881, 1515302, 1515385, 1516001, 1516121, 1516232, 1516372, 1516700, 1517372, 1517374, 1517570, 1517695, 1518473, 1518858, 1518876, 1518997, 1519352, 1519504, 1520030, 1520104, 1520165, 1520512, 1521244, 1521652, 1521670, 1521674, 1521861, 1522051, 1522122, 1522126, 1522671, 1522814, 1522825, 1523137, 1523880, 1523894, 1524019, 1524024, 1524762, 1525007, 1525164, 1525304, 1525317, 1525471, 1525788, 1526017, 1526188, 1526466, 1526740, 1527130, 1527176, 1527886, 1528136, 1528249, 1528328, 1528372, 1528455, 1528833, 1529130, 1529218, 1529814, 1530306, 1530394, 1530398, 1530869, 1531376, 1531933, 1532139, 1532362, 1532476, 1532591, 1532625, 1533259, 1533327, 1533460, 1533556, 1533598, 1533928, 1534224, 1534488, 1534505, 1534602, 1534807, 1534939, 1534991, 1535066, 1535326, 1535517, 1535670, 1535809, 1535813, 1536406, 1536555, 1537155, 1537312, 1537376, 1537504, 1537770, 1538088, 1538108, 1538147, 1538273, 1538283, 1538411, 1538594, 1538604, 1539196, 1539801, 1539814, 1539905, 1539916, 1540248, 1540420, 1540477, 1540576, 1540809, 1541113, 1541184, 1541463, 1541473, 1541540, 1541542, 1541601, 1541842, 1542092, 1542235, 1542722, 1543347, 1543653, 1543730, 1543827, 1544065, 1544099, 1544912, 1545145, 1545191, 1545380, 1546132, 1546682, 1546724, 1546759, 1546973, 1547146, 1547622, 1547879, 1548044, 1549263, 1549307, 1550180, 1550290, 1550295, 1550369, 1550449, 1550506, 1550624, 1550817, 1550920, 1550964, 1551249, 1551378, 1551629, 1551874, 1552326, 1552601, 1552974, 1553288, 1553502, 1553861, 1553974, 1554637, 1554648, 1554999, 1555434, 1555606, 1555638, 1555780, 1556083, 1556378, 1556392, 1556441, 1556536, 1556718, 1557079, 1557172, 1557250, 1558124, 1558248, 1558274, 1558291, 1558335, 1558371, 1558430, 1559172, 1559184, 1559558, 1559966, 1560180, 1560587, 1560634, 1560735, 1561585, 1562317, 1562579, 1562688, 1563286, 1563429, 1563432, 1563595, 1563614, 1564043, 1564136, 1564218, 1565326, 1565405, 1565546, 1565570, 1565735, 1565874, 1565986, 1566061, 1566232, 1566271, 1567179, 1567369, 1567567, 1567581, 1567583, 1567649, 1568162, 1568216, 1568497, 1568829, 1568838, 1569124, 1569179, 1569403, 1569632, 1569678, 1569691, 1570496, 1571043, 1571144, 1571633, 1572005, 1572109, 1572311, 1572328, 1572671, 1573172, 1573375, 1573453, 1573864, 1574174, 1574222, 1574535, 1575048, 1575472, 1575488, 1575518, 1575603, 1575696, 1576323, 1576342, 1576880, 1577243, 1577255, 1577403, 1577499, 1577551, 1577560, 1578928, 1579070, 1579123, 1579373, 1579408, 1579428, 1579565, 1579718, 1580310, 1580319, 1580405, 1580856, 1580884, 1581084, 1581287, 1581506, 1582431, 1582575, 1583089, 1583567, 1583605, 1583641, 1583846, 1584554, 1585320, 1585383, 1585424, 1585952, 1585985, 1586102, 1586112, 1586514, 1586667, 1586923, 1587320, 1587433, 1587445, 1587893, 1587964, 1588346, 1588454, 1588524, 1589463, 1589483, 1589847, 1589888, 1589915, 1590262, 1590382, 1590515, 1590655, 1590872, 1590912, 1590972, 1591037, 1591418, 1591528, 1591538, 1591996, 1592200, 1592543, 1592709, 1592875, 1593135, 1593256, 1593331, 1593604, 1593782, 1593931, 1593995, 1594150, 1594629, 1594726, 1594771, 1594819, 1594888, 1594953, 1594963, 1595117, 1595189, 1595461, 1595538, 1595765, 1596413, 1596802, 1597069, 1597221, 1598008, 1598136, 1598350, 1598481, 1598640, 1598809, 1599085, 1599267, 1599388, 1599835, 1600198, 1600274, 1600277, 1600550, 1601091, 1601267, 1601268, 1601291, 1601817, 1601904, 1601955, 1602137, 1602226, 1602326, 1602841, 1603152, 1603360, 1603466, 1603484, 1603695, 1603899, 1604263, 1604345, 1604374, 1604709], 655], "output": 20}, {"inputs": [[781574104, 781585918, 781586427, 781607305, 781697607, 781741079, 781742265, 781745787, 781760186, 781828455, 781854971, 781871730, 781908989, 782078557, 782098848, 782102640, 782102687, 782207039, 782214340, 782284871, 782293674, 782313692, 782333204, 782421578, 782423174, 782463564, 782573772, 782586667, 782628953, 782657307, 782715661, 782766910, 782786305, 782820350, 782829344, 782946494, 783030188, 783054067, 783150041, 783201308, 783214820, 783222920, 783276872, 783383676, 783414336, 783425671, 783452705, 783459950, 783511244, 783522867, 783563395, 783600961, 783643342, 783661914, 783681312, 783720966, 783790324, 783898474, 783927827, 783937125, 783974146, 783980015, 784027670, 784036379, 784059233, 784080840, 784084793, 784133517, 784165714, 784194506, 784287695, 784370531, 784377025, 784395646, 784399931, 784410113, 784412415, 784423672, 784482059, 784505208, 784517911, 784556177, 784585827, 784634204, 784658855, 784660821, 784684120, 784751395, 784784947, 784832970, 784857232, 784877728, 784881364, 784900790, 784917187, 784938835, 784955876, 784985843, 784998666, 785199250, 785203928, 785255193, 785273832, 785351874, 785363872, 785363876, 785405785, 785586436, 785719587, 785723685, 785746482, 785781794, 785783325, 785785077, 785837663, 785852043, 785929648, 785949235, 785965502, 786057783, 786108457, 786108678, 786138172, 786158645, 786174481, 786189757, 786190932, 786244441, 786251419, 786266989, 786298115, 786304082, 786335998, 786402337, 786436987, 786464537, 786550367, 786603604, 786690331, 786714076, 786722133, 786922888, 786925937, 786928025, 786945336, 787052308, 787134603, 787169783, 787224423, 787229552, 787246785, 787257358, 787321040, 787350952, 787366420, 787454908, 787456808, 787525946, 787531018, 787555212, 787736296, 787789618, 787803811, 787828723, 787887476, 787900526, 787905931, 787910617, 787951801, 787954168, 787995531, 787996824, 788042603, 788055443, 788069676, 788089994, 788188665, 788197220, 788203987, 788220622, 788262969, 788299350, 788300298, 788383654, 788487283, 788531472, 788552688, 788617031, 788648826, 788652387, 788665485, 788677725, 788708071, 788711980, 788754171, 788803403, 788816909, 788884516, 788976834, 789052540, 789074188, 789080514, 789119516, 789139302, 789241640, 789258889, 789265441, 789281733, 789282900, 789422712, 789455544, 789468867, 789493466, 789504200, 789540389, 789585962, 789589391, 789605601, 789645676, 789696163, 789705442, 789737499, 789821421, 789838699, 789855046, 789898618, 789945874, 789956511, 789995973, 789996735, 790006567, 790025543, 790131415, 790159360, 790163727, 790239388, 790255720, 790442423, 790483647, 790484664, 790504412, 790546804, 790550057, 790566856, 790572939, 790646054, 790655582, 790657219, 790660457, 790739176, 790741680, 790746461, 790753245, 790763635, 790764458, 790777647, 790778677, 790972065, 791044089, 791068920, 791095383, 791110085, 791132345, 791133158, 791155944, 791232012, 791256442, 791276552, 791294044, 791313863, 791393200, 791435325, 791465423, 791494337, 791509815, 791564374, 791566595, 791647518, 791718950, 791750717, 791769154, 791769633, 791773998, 791782203, 791793772, 791825390, 791872864, 791874082, 791934527, 791980765, 791995328, 792025597, 792038617, 792051755, 792069099, 792082987, 792092593, 792104417, 792141505, 792158531, 792167568, 792180281, 792198319, 792208060, 792248533, 792253591, 792266966, 792267898, 792269813, 792300784, 792338118, 792363653, 792363801, 792398228, 792454428, 792548368, 792567104, 792587815, 792594392, 792684873, 792689709, 792729712, 792731954, 792764283, 792801879, 792851777, 792883704, 792894714, 792950146, 793009735, 793123445, 793132651, 793159805, 793197865, 793228763, 793238282, 793243674, 793267960, 793287479, 793308936, 793374057, 793404202, 793415455, 793506537, 793537341, 793592257, 793626297, 793628387, 793703602, 793711644, 793762243, 793902788, 793908554, 793933212, 794003012, 794018082, 794035896, 794112355, 794141876, 794144822, 794177672, 794248772, 794264878, 794307634, 794312215, 794328873, 794338015, 794395198, 794487732, 794501856, 794537046, 794661717, 794674325, 794727907, 794760715, 794783080, 794796485, 794796866, 794802500, 794818122, 794860651, 794868333, 794874618, 794895585, 795092685, 795111616, 795118350, 795174530, 795195863, 795235292, 795265122, 795271156, 795284135, 795389300, 795454494, 795483808, 795577927, 795611399, 795622232, 795638633, 795650568, 795654939, 795700845, 795701018, 795716387, 795723656, 795739201, 795765891, 795808938, 795985920, 795990042, 796078054, 796172951, 796196356, 796229778, 796252516, 796253254, 796256871, 796277048, 796304478, 796330917, 796387646, 796391484, 796391753, 796446098, 796477955, 796500051, 796552883, 796632305, 796659034, 796727074, 796794112, 796845286, 796861738, 796885476, 796898002, 796922096, 796994050, 797016418, 797043244, 797067974, 797072154, 797085908, 797086191, 797145988, 797175698, 797179343, 797223925, 797244469, 797309618, 797321314, 797389515, 797405767, 797410566, 797456719, 797463081, 797493111, 797520607, 797654233, 797770978, 797779468, 797822108, 797842662, 797867407, 797883301, 798037966, 798076742, 798138064, 798144452, 798205390, 798344630, 798362690, 798371397, 798376337, 798384005, 798388523, 798392620, 798418837, 798600000, 798620491, 798627133, 798645706, 798654047, 798687485, 798719250, 798764362, 798826713, 798832846, 798897737, 798909236, 798911360, 798913965, 798916878, 798922180, 798961615, 798997728, 799016352, 799080664, 799180867, 799210023, 799226154, 799247856, 799307179, 799354588, 799416310, 799516275, 799523679, 799603072, 799650686, 799674245, 799711679, 799714029, 799785708, 799794629, 799795109, 799813984, 799848842, 799878673, 799880707, 799934660, 800010844, 800014965, 800028099, 800044441, 800159324, 800205097, 800238959, 800251237, 800360677, 800389353, 800398078, 800403847, 800484043, 800528581, 800535809, 800589087, 800618746, 800646287, 800648945, 800662679, 800706895, 800791027, 800807864, 800811451, 800819591, 800887683, 800901563, 800911963, 800924053, 800952914, 800959653, 800961269, 800966437, 801011909, 801062652, 801082929, 801092456, 801144019, 801146879, 801196182, 801234181, 801253722, 801269904, 801292912, 801315519, 801322243, 801341454, 801350126, 801353398, 801394840, 801443826, 801461770, 801491001, 801492469, 801497668, 801586464, 801590775, 801632055, 801639181, 801675165, 801734444, 801789164, 801789770, 801813326, 801832801, 801834808, 801872226, 801890143, 801904953, 801935859, 801960421, 802036519, 802044398, 802059327, 802066356, 802084122, 802117036, 802207110, 802299819, 802320963, 802329190, 802379925, 802387237, 802396171, 802408222, 802418599, 802432638, 802486035, 802498742, 802523168, 802599350, 802617409, 802620551, 802637043, 802659543, 802659970, 802670766, 802728332, 802729956, 802733110, 802760349, 802774607, 802784132, 802832005, 802841584, 802888602, 802893048, 802910545, 802925752, 802943790, 802965298, 802972667, 802999938, 803071741, 803115917, 803141672, 803196648, 803216147, 803240889, 803259448, 803388254, 803391553, 803454954, 803470993, 803551739, 803684289, 803726676, 803731979, 803733368, 803746489, 803751202, 803772874, 803784796, 803792788, 803799290, 803857886, 803905496, 803913411, 803946229, 804063152, 804083695, 804158678, 804164140, 804193835, 804203996, 804272270, 804285248, 804353284, 804436106, 804452975, 804458532, 804470419, 804506998, 804554494, 804613344, 804641909, 804642527, 804719576, 804761620, 804783147, 804790299, 804827996, 804829556, 804838295, 804885774, 804891115, 804943429, 804990183, 804991442, 805003591, 805083316, 805083853, 805104506, 805137212, 805277972, 805290205, 805304570, 805372087, 805394907, 805413944, 805522742, 805585126, 805606010, 805613420, 805638644, 805640963, 805642698, 805659777, 805713390, 805754970, 805819478, 805861689, 805865245, 805918390, 806019907, 806087753, 806146361, 806181862, 806204364, 806244279, 806269486, 806275997, 806280858, 806302978, 806304604, 806329029, 806348773, 806376737, 806385753, 806421449, 806426718, 806495604, 806511175, 806532412, 806541445, 806570772, 806627364, 806640382, 806657682, 806661280, 806681443, 806740099, 806960897, 806972550, 807014162, 807159840, 807200536, 807224367, 807231040, 807282244, 807439756, 807518850, 807566657, 807579371, 807605362, 807671325, 807716250, 807800145, 807814802, 807830467, 807841276, 807940921, 807965397, 807966716, 807971346, 808023752, 808027086, 808040496, 808091334, 808098191, 808128767, 808159047, 808311942, 808357346, 808415577, 808485601, 808507534, 808513978, 808521262, 808534081, 808542024, 808552050, 808589971, 808598635, 808620351, 808656911, 808701509, 808765988, 808867165, 808922794, 808988000, 809012989, 809031842, 809034708, 809069665, 809087146, 809099305, 809122684, 809159694, 809179604, 809226873, 809234312, 809290278, 809309161, 809368425, 809419939, 809428550, 809490088, 809498372, 809575071, 809580174, 809583566, 809605612, 809622207, 809708592, 809744199, 809756716, 809782008, 809815801, 809879012, 809892228, 809901458, 809914871, 809936228, 809983957, 809991285, 810033161, 810039992, 810089440, 810105312, 810142477, 810145367, 810175177, 810191254, 810212742, 810256736, 810269783, 810272606, 810311322, 810313945, 810321694, 810349677, 810402126, 810411722, 810477198, 810484323, 810558584, 810592317, 810612942, 810641709, 810750077, 810768086, 810770063, 810776698, 810789295, 810790893, 810808497, 810892468, 810916926, 810949655, 811052741, 811058061, 811151347, 811172996, 811184539, 811239214, 811279239, 811293635, 811317456, 811320690, 811332285, 811333664, 811352142, 811401612, 811439105, 811462800, 811466563, 811476075, 811476586, 811478945, 811542788, 811595328, 811660388, 811709214, 811751203, 811758612, 811770419, 811784323, 811800916, 811923310, 811937633, 811945459, 811979408, 811991146, 812004581, 812033206, 812069153, 812079727, 812092070, 812102071, 812164843, 812189975, 812214348, 812221441, 812244217, 812295598, 812337884, 812388777, 812439934, 812455883, 812456548, 812485960, 812494633, 812516225, 812517484, 812539926, 812583635, 812628688, 812635192, 812689520, 812692411, 812693913, 812730977, 812736469, 812739367, 812762492, 812774846, 812791705, 812809919, 812814065, 812816778, 812936002, 812947744, 812951753, 813005012, 813016725, 813074859, 813130780, 813153118, 813165685, 813197381, 813255433, 813270302, 813293661, 813299150, 813337546, 813494121, 813495640, 813527418, 813547617, 813571449, 813629528, 813633976, 813638796, 813657471, 813697917, 813768941, 813790078, 813839214, 813866390, 813888259, 814045339, 814070356, 814114573, 814139108, 814179373, 814246673, 814270404, 814285020, 814287604, 814327898, 814438631, 814448439, 814451731, 814498902, 814555750, 814569247, 814591049, 814593474, 814700390, 814741447, 814763459, 814769853, 814779436, 814786299, 814801088, 814903176, 814912313, 815011002, 815070271, 815075897, 815108600, 815198781, 815228282, 815267255, 815282321, 815306637, 815349973, 815371024, 815396343, 815516798, 815524898, 815538493, 815551725, 815590483, 815590665, 815602009, 815641735, 815644536, 815663351, 815665623, 815674725, 815718022, 815723771, 815731375, 815736257, 815784322, 815794321, 815836099, 815890837, 815924845, 815953060, 815960060, 815987387, 815994225, 816039087, 816100428, 816207591, 816264732, 816277755, 816279820, 816283084, 816431505, 816450288, 816485288, 816495992, 816519353, 816576462, 816590782, 816598284, 816704557, 816807869, 816877448, 816928779, 816989370, 816993046, 817007404, 817029673, 817050573, 817086908, 817088891, 817112362, 817122459, 817133706, 817135026, 817279564, 817309680, 817382411, 817388795, 817390150, 817394199, 817440477, 817485948, 817523716, 817538917, 817556216, 817557901, 817580715, 817588348, 817589150, 817698310, 817719044, 817732683, 817859148, 817944384, 817972311, 818013761, 818024854, 818036886, 818071542, 818138459, 818200748, 818255971, 818294651, 818304981, 818314571, 818314602, 818348430, 818446443, 818548224, 818568163, 818633205, 818699342, 818768732, 818856427, 818870951, 818931201, 818933839, 818947576, 818971654, 818993337, 819009803, 819066333, 819089062, 819104054, 819131762, 819158717, 819170100, 819176497, 819233327, 819268299, 819275245, 819320295, 819370410, 819392906, 819411008, 819448870, 819490788, 819543947, 819570575, 819578458, 819586213, 819598334, 819607217, 819670790, 819672835, 819756603, 819772671, 819806923, 819820068, 819857360, 819875013, 819923935, 820043618, 820043725, 820065965, 820075140, 820077181, 820088267, 820090610, 820106922, 820108368, 820149735, 820156879, 820161670, 820168345, 820180064, 820215919, 820306449, 820358289, 820362023, 820370680, 820390855, 820451523, 820496688, 820500151, 820567882, 820579322, 820614381, 820672318, 820743603, 820787564, 820787641, 821000385, 821011218, 821101658, 821159072, 821218615, 821223189, 821243185, 821255589, 821296031, 821376616, 821382974, 821402406, 821406740, 821452702, 821472101, 821475585, 821507448, 821574946, 821605147, 821608940, 821629828, 821654335, 821760061, 821775279, 821889300, 821898309, 821980476, 821988741, 822023820, 822058780, 822078088, 822082678, 822082991, 822112366, 822131398, 822218072, 822242230, 822339269, 822339563, 822343649, 822360409, 822393757, 822396624, 822437918, 822465259, 822491457, 822510890, 822549825, 822585892, 822747589, 822749424, 822770805, 822851444, 822851977, 822875143, 822882586, 822920711, 822937373, 822956277, 822997377, 823008288, 823038433, 823059308, 823062724, 823160207, 823168520, 823176195, 823178193, 823194725, 823200848, 823240115, 823266791, 823310434, 823347672, 823381728, 823476189, 823550306, 823576357, 823588785, 823605601, 823639914, 823640924, 823663838, 823699250, 823709226, 823715688, 823720115, 823849350, 823866541, 823914053, 824018737, 824027986, 824057853, 824080019, 824087556, 824166924, 824252629, 824262679, 824278204, 824337944, 824351363, 824403845, 824412530, 824420201, 824498351, 824525473, 824555260, 824579016, 824651089, 824663359, 824665474, 824703677, 824749011, 824758769, 824771713, 824774410, 824844501, 824881267, 824886737, 824887511, 824909594, 824913823, 824975527, 824979080, 824988871, 825022595, 825092241, 825108830, 825123260, 825148476, 825195002, 825238179, 825325539, 825361340, 825365366, 825368928, 825407252, 825459879, 825499610, 825508488, 825533983, 825577604, 825664869, 825681186, 825696455, 825708387, 825748859, 825751056, 825755926, 825832261, 825857786, 825887524, 825908749, 825912824, 825944461, 825949297, 826084079, 826117925, 826229063, 826266738, 826277132, 826371630, 826390828, 826393770, 826409490, 826419876, 826451638, 826567107, 826570076, 826598287, 826639658, 826646493, 826668487, 826689065, 826704450, 826736263, 826741863, 826777323, 826785940, 826796051, 826804556, 826856786, 826870694, 826875900, 827004266, 827028866, 827056226, 827127714, 827158609, 827176157, 827256137, 827259306, 827284233, 827400382, 827444721, 827445495, 827585754, 827641416, 827792766, 827803093, 827840977, 827849417, 827858807, 827905051, 828030524, 828054866, 828062387, 828126453, 828200974, 828220113, 828221137, 828287258, 828303597, 828326681, 828329628, 828338549, 828365470, 828367139, 828376038, 828426590, 828467036, 828476492, 828477975, 828509709, 828598241, 828616308, 828669510, 828697249, 828747060, 828751590, 828796079, 828834000, 828835853, 828856316, 828881207, 828909833, 828930111, 828955291, 828997212, 829029120, 829069109, 829091177, 829101015, 829116734, 829124930, 829183134, 829186759, 829280830, 829450566, 829455664, 829477231, 829523761, 829599728, 829613768, 829706986, 829708673, 829712728, 829736785, 829750624, 829772190, 829806817, 829850094, 829886087, 829893256, 829925360, 829936884, 829983478, 830018587, 830023282, 830115036, 830196987, 830201959, 830287593, 830324092, 830370271, 830384094, 830428021, 830482153, 830495882, 830496310, 830509288, 830525054, 830532816, 830565732, 830586212, 830629793, 830636488, 830657479, 830663470, 830681401, 830729388, 830739646, 830775315, 830806990, 830849482, 830869391, 830938250, 830996253, 831064648, 831077242, 831095414, 831140051, 831141536, 831145089, 831196924, 831230725, 831270966, 831294848, 831474969, 831483178, 831488179, 831494695, 831503906, 831584768, 831600440, 831609072, 831692526, 831710436, 831719595, 831736197, 831769288, 831814459, 831842785, 831946826, 831976997, 831981942, 831996400, 832077645, 832146906, 832147393, 832181719, 832209070, 832215683, 832222240, 832268305, 832272397, 832382572, 832390395, 832422093, 832450482, 832451223, 832487838, 832504913, 832549339, 832681229, 832699017, 832721270, 832738471, 832800255, 832802744, 832816281, 832845352, 832845849, 832870415, 832917203, 832932435, 832976359, 833094105, 833187281, 833193414, 833194370, 833197835, 833210590, 833212402, 833252444, 833258161, 833258370, 833292097, 833336848, 833392557, 833394202, 833471198, 833476700, 833493790, 833567900, 833568015, 833605192, 833641793, 833651329, 833732629, 833777369, 833831300, 833843063, 833946490, 833963731, 833980395, 834007852, 834029587, 834036100, 834042931, 834093323, 834116860, 834132152, 834137123, 834176221, 834192717, 834233184, 834261306, 834264621, 834277493, 834391392, 834421870, 834423606, 834426377, 834433061, 834451037, 834519819, 834566641, 834656929, 834687689, 834693879, 834716806, 834724248, 834742177, 834797215, 834821999, 834879338, 834886902, 834892697, 834931490, 834968243, 834994524, 835001843, 835004911, 835037411, 835052430, 835146669, 835178897, 835182053, 835187466, 835199899, 835223517, 835276366, 835326333, 835401518, 835402094, 835432097, 835461910, 835487373, 835488043, 835504412, 835535282, 835654141, 835679808, 835681644, 835703846, 835739279, 835749947, 835752451, 835760856, 835824639, 835914514, 835948741, 835978782, 835982882, 836000260, 836081487, 836100592, 836105452, 836105633, 836170816, 836187243, 836245863, 836247644, 836249285, 836259287, 836265680, 836343805, 836443858, 836573963, 836668455, 836693359, 836724097, 836738744, 836782418, 836866858, 836879905, 836935258, 836981708, 836989893, 837021177, 837064278, 837081805, 837120523, 837123514, 837173373, 837224994, 837279085, 837285824, 837355410, 837462182, 837492033, 837527537, 837531557, 837560423, 837593852, 837623118, 837732296, 837757273, 837760325, 837760651, 837785744, 837789948, 837795117, 837800364, 837810215, 837847665, 837854320, 837859975, 837911360, 837980569, 838066063, 838069303, 838081681, 838147510, 838169263, 838190736, 838198681, 838212281, 838252169, 838325339, 838335738, 838364874, 838389126, 838420028, 838431581, 838448681, 838461674, 838491063, 838640717, 838697376, 838743400, 838782240, 838809626, 838814698, 838834885, 838837666, 838856662, 838940456, 838960372, 838987734, 839042144, 839103069, 839155387, 839159171, 839196727, 839213806, 839285330, 839316964, 839341069, 839377853, 839403251, 839405469, 839427088, 839443974, 839445425, 839524194, 839574501, 839660631, 839663657, 839708828, 839722603, 839753775, 839770335, 839773869, 839827072, 839855954, 839933551, 839946776, 839950208, 839953001, 840005212, 840027496, 840034219, 840044679, 840048862, 840058524, 840111213, 840125863, 840155728, 840214494, 840292315, 840317042, 840336087, 840362136, 840459775, 840469450, 840535190, 840542395, 840565874, 840578327, 840678508, 840734849, 840752139, 840809241, 840869342, 840881516, 840882577, 840960169, 841006668, 841089244, 841152986, 841215590, 841251159, 841260028, 841279115, 841310065, 841323174, 841354275, 841373803, 841384886, 841403505, 841497957, 841549948, 841555353, 841555401, 841595970, 841631960, 841645514, 841696581, 841752034, 841832077, 841840895, 841857638, 841864260, 841930972, 842011511, 842035921, 842056733, 842066969, 842069588, 842078328, 842109449, 842120545, 842152297, 842159970, 842193203, 842322215, 842390005, 842417000, 842431300, 842458913, 842484611, 842504497, 842586189, 842604450, 842682148, 842688274, 842688320, 842728837, 842733137, 842737422, 842752305, 842753447, 842790699, 842812639, 842813787, 842818213, 842925311, 842984798, 842993801, 843016503, 843032714, 843033164, 843074705, 843084447, 843086105, 843202433, 843204523, 843212853, 843215732, 843274263, 843281819, 843340584, 843380843, 843450130, 843459560, 843494696, 843561425, 843572222, 843604517, 843686500, 843710097, 843752757, 843795554, 843834482, 843835329, 843855093, 843874262, 843877426, 843886028, 843891885, 843898323, 843972381, 843974204, 844002153, 844071571, 844149357, 844249907, 844262584, 844307894, 844367003, 844384809, 844386548, 844492093, 844497944, 844511143, 844548770, 844598311, 844607340, 844609343, 844673134, 844684615, 844790353, 844796887, 844797184, 844824590, 844885749, 844886242, 845009188, 845023824, 845066067, 845158923, 845189654, 845232329, 845234188, 845235154, 845265936, 845275116, 845285879, 845344294, 845368908, 845378915, 845458262, 845471710, 845484285, 845491410, 845520578, 845534582, 845539109, 845571618, 845572803, 845579849, 845589926, 845596620, 845608904, 845612727, 845613317, 845621646, 845664712, 845691359, 845701396, 845791817, 845794863, 845827584, 845862922, 845884490, 845893947, 845902662, 845991498, 846004131, 846090380, 846114532, 846126457, 846127249, 846171465, 846212604, 846300660, 846399424, 846409854, 846423563, 846432577, 846476091, 846485795, 846497487, 846530792, 846551985, 846584060, 846683575, 846695089, 846744277, 846748854, 846770981, 846867639, 846913568, 846933767, 846964235, 846980403, 847029995, 847084590, 847118390, 847140428, 847145131, 847176269, 847198931, 847201257, 847268898, 847374824, 847420490, 847443126, 847444159, 847448926, 847498099, 847529766, 847622436, 847649006, 847672656, 847801555, 847888427, 847923019, 847928585, 847938161, 847957808, 848035990, 848092719, 848114785, 848133640, 848215541, 848240891, 848246400, 848274878, 848325286, 848366729, 848390725, 848451093, 848451870, 848455125, 848485920, 848496496, 848530719, 848597909, 848631994, 848679909, 848724658, 848778038, 848781748, 848813024, 848818892, 848870840, 848951552, 848990435, 849001806, 849040607, 849049534, 849063217, 849099085, 849107635, 849111839, 849112551, 849156769, 849179460, 849246889, 849247722, 849248010, 849266226, 849297770, 849315435, 849332975, 849335419, 849401766, 849423441, 849424557, 849467433, 849479034, 849495670, 849499351, 849569788, 849573717, 849587367, 849625759, 849692504, 849714334, 849729672, 849748305, 849752432, 849756169, 849759791, 849778894, 849797498, 849812725, 849839559, 849858404, 849892338, 849917550, 849922931, 849934464, 849971085, 849983137, 850013758, 850064893, 850318417, 850361311, 850374387, 850499667, 850560103, 850571512, 850572913, 850588465, 850608065, 850624467, 850658994, 850685861, 850711485, 850736717, 850762884, 850774640, 850783061, 850823700, 850892848, 850904496, 851003058, 851105715, 851156452, 851156907, 851166901, 851289830, 851311183, 851329974, 851354035, 851361153, 851403246, 851419249, 851491177, 851502001, 851509767, 851519168, 851566087, 851668916, 851691778, 851766765, 851772161, 851801209, 851862935, 851882553, 851883696, 851898233, 851934993, 851951984, 851976319, 852007395, 852046338, 852064012, 852075229, 852104177, 852124620, 852151302, 852155829, 852159971, 852174294, 852198141, 852220190, 852229676, 852232982, 852290328, 852304447, 852325165, 852337154, 852362214, 852401370, 852483962, 852497137, 852524844, 852548667, 852571963, 852605983, 852690503, 852744931, 852750986, 852778299, 852808785, 852837308, 852886784, 852916217, 852939051, 852978578, 852987550, 853002655, 853016050, 853078456, 853137056, 853197223, 853300525, 853313059, 853321076, 853355982, 853446210, 853494170, 853494308, 853529117, 853564774, 853573658, 853607610, 853624398, 853705660, 853721043, 853756343, 853797971, 853811365, 853857547, 853907679, 853926894, 853930454, 853954165, 853957309, 853992876, 854027509, 854046445, 854057197, 854069116, 854084777, 854155200, 854155289, 854204481, 854225082, 854298485, 854360924, 854414629, 854442217, 854464729, 854477793, 854509763, 854536765, 854588879, 854606190, 854613802, 854652574, 854666407, 854677707, 854712575, 854718983, 854740031, 854746999, 854779246, 854824765, 854854124, 854865377, 854887000, 854896031, 854932515, 854960984, 854965384, 854982397, 855030858, 855082150, 855089066, 855116919, 855126378, 855170518, 855209587, 855369286, 855404532, 855410615, 855416634, 855458888, 855488127, 855685199, 855695609, 855765097, 855779905, 855784554, 855796009, 855851567, 855869630, 855912205, 855966106, 856054205, 856060034, 856103929, 856121640, 856144070, 856155677, 856189531, 856236222, 856243054, 856291850, 856292246, 856312865, 856326457, 856345558, 856347332, 856485538, 856513790, 856516842, 856555120, 856571841, 856745556, 856749910, 856834322, 856876689, 856879495, 856887208, 856959201, 856995782, 856996775, 857071170, 857091492, 857101530, 857127150, 857208236, 857211100, 857230548, 857258912, 857300669, 857342234, 857344998, 857350580, 857392142, 857436388, 857492425, 857600366, 857649625, 857684159, 857684246, 857794911, 857806912, 857808493, 857819064, 857916408, 857962468, 857971959, 857973874, 858016157, 858037364, 858077003, 858134644, 858150753, 858155583, 858233482, 858250235, 858314241, 858342205, 858407315, 858468586, 858512018, 858513000, 858632738, 858656421, 858662044, 858663380, 858683592, 858719988, 858780291, 858787352, 858797355, 858797509, 858808908, 858894740, 858898281, 858913501, 858914594, 858972611, 859023911, 859067155, 859143891, 859245680, 859257803, 859345378, 859346593, 859347860, 859354609, 859359677, 859395117, 859453126, 859490328, 859529568, 859549142, 859561522, 859583151, 859583896, 859597792, 859656612, 859703929, 859705596, 859721292, 859783908, 859791923, 859861226, 859876894, 859905880, 859908764, 859942110, 859946396, 860020759, 860040551, 860075100, 860123168, 860170614, 860184092, 860192999, 860222729, 860225931, 860270763, 860311847, 860323953, 860370859, 860407350, 860450084, 860454937, 860509360, 860546069, 860602243, 860602408, 860881734, 860881989, 860892822, 860906713, 860919789, 860928172, 860964890, 861033584, 861124484, 861167195, 861170946, 861209872, 861245873, 861273328, 861295629, 861299085, 861312177, 861334968, 861335555, 861338524, 861353778, 861385193, 861409631, 861409839, 861428112, 861464821, 861467551, 861470704, 861490126, 861505704, 861512831, 861547501, 861554466, 861570925, 861615939, 861620812, 861678530, 861775169, 861798611, 861833148, 861844752, 861849132, 861886214, 861935041, 861965698, 861986080, 862095077, 862142662, 862149682, 862150270, 862154645, 862158944, 862234305, 862235546, 862264278, 862279020, 862316021, 862394722, 862540863, 862568246, 862614864, 862633410, 862716411, 862726837, 862798854, 862806354, 862808120, 862822950, 862828161, 862915462, 862925714, 862951633, 862959491, 862982471, 862984922, 863034459, 863175254, 863194829, 863225402, 863229562, 863267069, 863277042, 863372185, 863393707, 863457527, 863481030, 863495163, 863632023, 863657124, 863669387, 863730001, 863752541, 863798811, 863809863, 863848901, 863921053, 863936011, 863938920, 863940491, 864034597, 864041948, 864042741, 864177566, 864212544, 864215535, 864257569, 864270617, 864306292, 864318688, 864323001, 864379086, 864389693, 864406022, 864471922, 864521009, 864630317, 864636575, 864672096, 864723051, 864723926, 864750186, 864751393, 864805642, 864809554, 864815252, 864854617, 864901303, 864939008, 864956609, 864970265, 865041179, 865071369, 865076065, 865096944, 865112188, 865128298, 865142904, 865169427, 865230158, 865236597, 865247260, 865251605, 865335931, 865352595, 865368976, 865416486, 865448094, 865479888, 865501704, 865502539, 865513622, 865589213, 865630774, 865662131, 865678135, 865678381, 865691220, 865703381, 865712922, 865909955, 865921770, 865960003, 866039886, 866055545, 866144537, 866203129, 866245434, 866288169, 866333264, 866436732, 866438861, 866466166, 866501778, 866525639, 866594912, 866642265, 866692077, 866705801, 866745317, 866766633, 866870867, 866890796, 866896497, 866990506, 867081725, 867104130, 867165695, 867170311, 867179841, 867204904, 867234696, 867243510, 867329463, 867334577, 867380995, 867386803, 867485830, 867486396, 867488381, 867488824, 867494713, 867534725, 867548607, 867569336, 867589877, 867592920, 867640028, 867640775, 867656109, 867685808, 867737280, 867770468, 867795285, 868003898, 868036088, 868065396, 868065824, 868074817, 868082764, 868091327, 868098391, 868107983, 868167704, 868179583, 868206176, 868237580, 868283949, 868322256, 868335040, 868337707, 868357845, 868430631, 868435471, 868443709, 868464118, 868471312, 868473702, 868496318, 868501998, 868512754, 868517983, 868592266, 868625168, 868693186, 868698958, 868712781, 868733240, 868811735, 868863098, 868888149, 868891169, 868902360, 868946436, 868959966, 869046030, 869064375, 869114716, 869114965, 869130815, 869290984, 869298215, 869307874, 869308877, 869333403, 869345781, 869348077, 869381042, 869448646, 869471675, 869473058, 869476189, 869499439, 869527599, 869532871, 869559277, 869580248, 869584105, 869596145, 869608379, 869608586, 869658035, 869680729, 869711087, 869831178, 869880769, 869883011, 869976473, 870041589, 870043393, 870125776, 870138640, 870156732, 870221181, 870250482, 870269176, 870295212, 870297081, 870308765, 870310379, 870389308, 870400775, 870430661, 870485379, 870500657, 870609972, 870622141, 870654134, 870693906, 870739275, 870765887, 870783031, 870804887, 870877395, 870982412, 870994137, 871072207, 871072748, 871105921, 871112979, 871126093, 871179960, 871231456, 871263164, 871466744, 871476517, 871514691, 871556595, 871558570, 871623007, 871642733, 871663604, 871696224, 871703058, 871766289, 871807458, 871857631, 871898378, 871989094, 872049577, 872056388, 872057484, 872103032, 872129649, 872189881, 872210991, 872243867, 872264833, 872315554, 872348990, 872463074, 872531361, 872536766, 872571646, 872576834, 872643453, 872686924, 872765501, 872824239, 872896564, 873025028, 873031523, 873042683, 873049273, 873249363, 873257176, 873257717, 873271961, 873278948, 873294509, 873317211, 873325027, 873371889, 873382356, 873385044, 873441655, 873449574, 873463089, 873466992, 873530186, 873532174, 873653427, 873653727, 873678854, 873681548, 873685085, 873687440, 873720478, 873756251, 873769182, 873774992, 873787455, 873796093, 873914625, 873951576, 873957923, 873990174, 873991067, 874048397, 874053790, 874120409, 874153828, 874213059, 874235884, 874245030, 874272436, 874329512, 874336085, 874397810, 874486828, 874505493, 874508510, 874603712, 874614095, 874688349, 874731120, 874779997, 874784270, 874784271, 874818749, 874828589, 874888930, 874951700, 874964982, 875022028, 875087741, 875145663, 875169006, 875185981, 875238415, 875277423, 875332355, 875336920, 875345012, 875362595, 875394666, 875400678, 875404389, 875464109], 730], "output": 4}]}} +{"id": "LeetCode/2679", "content": "# Count Distinct Numbers on Board\n\nYou are given a positive integer `n`, that is initially placed on a board. Every day, for `109` days, you perform the following procedure:\n\n\n* For each number `x` present on the board, find all numbers `1 <= i <= n` such that `x % i == 1`.\n* Then, place those numbers on the board.\n\n\nReturn *the number of **distinct** integers present on the board after* `109` *days have elapsed*.\n\n\n**Note:**\n\n\n* Once a number is placed on the board, it will remain on it until the end.\n* `%` stands for the modulo operation. For example, `14 % 3` is `2`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 5\n**Output:** 4\n**Explanation:** Initially, 5 is present on the board. \nThe next day, 2 and 4 will be added since 5 % 2 == 1 and 5 % 4 == 1. \nAfter that day, 3 will be added to the board because 4 % 3 == 1. \nAt the end of a billion days, the distinct numbers on the board will be 2, 3, 4, and 5. \n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 3\n**Output:** 2\n**Explanation:** \nSince 3 % 2 == 1, 2 will be added to the board. \nAfter a billion days, the only two distinct numbers on the board are 2 and 3. \n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 100`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def distinctIntegers(self, n: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.distinctIntegers(**[5]) == 4\nassert my_solution.distinctIntegers(**[3]) == 2\nassert my_solution.distinctIntegers(**[1]) == 1\nassert my_solution.distinctIntegers(**[2]) == 1\nassert my_solution.distinctIntegers(**[4]) == 3\nassert my_solution.distinctIntegers(**[6]) == 5\nassert my_solution.distinctIntegers(**[7]) == 6\nassert my_solution.distinctIntegers(**[8]) == 7\nassert my_solution.distinctIntegers(**[9]) == 8\nassert my_solution.distinctIntegers(**[10]) == 9\nassert my_solution.distinctIntegers(**[11]) == 10\nassert my_solution.distinctIntegers(**[12]) == 11\nassert my_solution.distinctIntegers(**[13]) == 12\nassert my_solution.distinctIntegers(**[14]) == 13\nassert my_solution.distinctIntegers(**[15]) == 14\nassert my_solution.distinctIntegers(**[16]) == 15\nassert my_solution.distinctIntegers(**[17]) == 16\nassert my_solution.distinctIntegers(**[18]) == 17\nassert my_solution.distinctIntegers(**[19]) == 18\nassert my_solution.distinctIntegers(**[20]) == 19\n"}, "labels": {"questionId": "2679", "questionFrontendId": "2549", "questionTitle": "Count Distinct Numbers on Board", "stats": {"totalAccepted": "8.2K", "totalSubmission": "12.9K", "totalAcceptedRaw": 8160, "totalSubmissionRaw": 12868, "acRate": "63.4%"}, "probedCases": [{"inputs": [5], "output": 4}, {"inputs": [3], "output": 2}, {"inputs": [1], "output": 1}, {"inputs": [2], "output": 1}, {"inputs": [4], "output": 3}, {"inputs": [6], "output": 5}, {"inputs": [7], "output": 6}, {"inputs": [8], "output": 7}, {"inputs": [9], "output": 8}, {"inputs": [10], "output": 9}, {"inputs": [11], "output": 10}, {"inputs": [12], "output": 11}, {"inputs": [13], "output": 12}, {"inputs": [14], "output": 13}, {"inputs": [15], "output": 14}, {"inputs": [16], "output": 15}, {"inputs": [17], "output": 16}, {"inputs": [18], "output": 17}, {"inputs": [19], "output": 18}, {"inputs": [20], "output": 19}]}} +{"id": "LeetCode/2681", "content": "# Put Marbles in Bags\n\nYou have `k` bags. You are given a **0-indexed** integer array `weights` where `weights[i]` is the weight of the `ith` marble. You are also given the integer `k.`\n\n\nDivide the marbles into the `k` bags according to the following rules:\n\n\n* No bag is empty.\n* If the `ith` marble and `jth` marble are in a bag, then all marbles with an index between the `ith` and `jth` indices should also be in that same bag.\n* If a bag consists of all the marbles with an index from `i` to `j` inclusively, then the cost of the bag is `weights[i] + weights[j]`.\n\n\nThe **score** after distributing the marbles is the sum of the costs of all the `k` bags.\n\n\nReturn *the **difference** between the **maximum** and **minimum** scores among marble distributions*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** weights = [1,3,5,1], k = 2\n**Output:** 4\n**Explanation:** \nThe distribution [1],[3,5,1] results in the minimal score of (1+1) + (3+1) = 6. \nThe distribution [1,3],[5,1], results in the maximal score of (1+3) + (5+1) = 10. \nThus, we return their difference 10 - 6 = 4.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** weights = [1, 3], k = 2\n**Output:** 0\n**Explanation:** The only distribution possible is [1],[3]. \nSince both the maximal and minimal score are the same, we return 0.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= k <= weights.length <= 105`\n* `1 <= weights[i] <= 109`\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def putMarbles(self, weights: List[int], k: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.putMarbles(**[[1, 3, 5, 1], 2]) == 4\nassert my_solution.putMarbles(**[[1, 3], 2]) == 0\nassert my_solution.putMarbles(**[[1, 4, 2, 5, 2], 3]) == 3\nassert my_solution.putMarbles(**[[54, 6, 34, 66, 63, 52, 39, 62, 46, 75, 28, 65, 18, 37, 18, 13, 33, 69, 19, 40, 13, 10, 43, 61, 72], 4]) == 289\nassert my_solution.putMarbles(**[[56, 41, 27, 71, 62, 57, 67, 34, 8, 71, 2, 12, 52, 1, 64, 43, 32, 42, 9, 25, 73, 29, 31], 5]) == 342\nassert my_solution.putMarbles(**[[58, 12, 11, 41, 66, 63, 14, 39, 71, 38, 16, 71, 43, 70, 27, 71, 37, 57, 12, 50, 41, 74, 31, 38, 24, 25, 24, 5, 34, 61, 9, 12, 17, 20, 5], 6]) == 454\nassert my_solution.putMarbles(**[[51, 68, 36, 67, 31, 28, 54, 75, 36, 58, 64, 46, 11, 42, 15, 63, 43, 25, 32, 3, 35, 15, 29, 48, 22, 43, 55, 8, 13, 19, 29, 6, 74, 69, 10], 2]) == 122\nassert my_solution.putMarbles(**[[25, 74, 16, 51, 12, 48, 15, 5], 1]) == 0\nassert my_solution.putMarbles(**[[24, 16, 62, 27, 8, 3, 70, 55, 13, 34, 9, 29, 10], 11]) == 168\nassert my_solution.putMarbles(**[[45, 56, 24, 8, 65, 60, 6, 13, 51, 26, 34, 46, 61, 73, 22, 27, 8, 21, 21, 44], 17]) == 286\nassert my_solution.putMarbles(**[[16, 57, 23, 2, 61, 53, 73, 66, 40, 46, 50, 33, 20, 72, 2, 59, 11], 11]) == 328\nassert my_solution.putMarbles(**[[70, 36, 18], 1]) == 0\nassert my_solution.putMarbles(**[[46, 37, 46, 17, 40, 50, 54, 11, 1, 25, 43, 21, 31, 29, 58, 49, 73, 54, 5, 52, 73, 54, 6, 22, 58, 9, 34, 21, 58, 68, 63], 30]) == 119\nassert my_solution.putMarbles(**[[1, 5, 64, 42, 40, 60, 7, 54, 25, 71, 11, 17, 2, 52, 54, 41, 1, 28, 2, 1, 68, 13, 25, 16, 26, 39, 36, 24, 13, 61, 51, 11, 3, 36, 58, 15], 17]) == 850\nassert my_solution.putMarbles(**[[67, 45, 15, 20, 36, 3, 6, 6, 27], 5]) == 178\nassert my_solution.putMarbles(**[[41, 47, 73, 6, 64, 59, 56, 48, 69, 23, 27, 49, 38, 2, 18, 20, 35, 43, 44, 48, 12, 44, 5, 6, 35, 21, 20, 75, 38, 47, 51, 71, 17, 38, 15, 62], 16]) == 846\nassert my_solution.putMarbles(**[[40, 23, 67, 10], 3]) == 27\nassert my_solution.putMarbles(**[[43, 39, 54, 14, 13, 72, 62, 61, 44, 44, 16, 62, 15, 64, 55, 5, 39, 43, 20, 22, 73, 49, 12, 9, 11, 26], 24]) == 216\nassert my_solution.putMarbles(**[[8, 50, 2, 13, 51, 72, 67, 38, 58, 63, 75, 28, 55, 11, 48], 4]) == 275\nassert my_solution.putMarbles(**[[75, 22, 56, 25, 46, 15, 9, 4, 68, 58, 26, 16, 64, 51, 33, 27, 6], 7]) == 354\n"}, "labels": {"questionId": "2681", "questionFrontendId": "2551", "questionTitle": "Put Marbles in Bags", "stats": {"totalAccepted": "4.2K", "totalSubmission": "7.5K", "totalAcceptedRaw": 4199, "totalSubmissionRaw": 7548, "acRate": "55.6%"}, "probedCases": [{"inputs": [[1, 3, 5, 1], 2], "output": 4}, {"inputs": [[1, 3], 2], "output": 0}, {"inputs": [[1, 4, 2, 5, 2], 3], "output": 3}, {"inputs": [[54, 6, 34, 66, 63, 52, 39, 62, 46, 75, 28, 65, 18, 37, 18, 13, 33, 69, 19, 40, 13, 10, 43, 61, 72], 4], "output": 289}, {"inputs": [[56, 41, 27, 71, 62, 57, 67, 34, 8, 71, 2, 12, 52, 1, 64, 43, 32, 42, 9, 25, 73, 29, 31], 5], "output": 342}, {"inputs": [[58, 12, 11, 41, 66, 63, 14, 39, 71, 38, 16, 71, 43, 70, 27, 71, 37, 57, 12, 50, 41, 74, 31, 38, 24, 25, 24, 5, 34, 61, 9, 12, 17, 20, 5], 6], "output": 454}, {"inputs": [[51, 68, 36, 67, 31, 28, 54, 75, 36, 58, 64, 46, 11, 42, 15, 63, 43, 25, 32, 3, 35, 15, 29, 48, 22, 43, 55, 8, 13, 19, 29, 6, 74, 69, 10], 2], "output": 122}, {"inputs": [[25, 74, 16, 51, 12, 48, 15, 5], 1], "output": 0}, {"inputs": [[24, 16, 62, 27, 8, 3, 70, 55, 13, 34, 9, 29, 10], 11], "output": 168}, {"inputs": [[45, 56, 24, 8, 65, 60, 6, 13, 51, 26, 34, 46, 61, 73, 22, 27, 8, 21, 21, 44], 17], "output": 286}, {"inputs": [[16, 57, 23, 2, 61, 53, 73, 66, 40, 46, 50, 33, 20, 72, 2, 59, 11], 11], "output": 328}, {"inputs": [[70, 36, 18], 1], "output": 0}, {"inputs": [[46, 37, 46, 17, 40, 50, 54, 11, 1, 25, 43, 21, 31, 29, 58, 49, 73, 54, 5, 52, 73, 54, 6, 22, 58, 9, 34, 21, 58, 68, 63], 30], "output": 119}, {"inputs": [[1, 5, 64, 42, 40, 60, 7, 54, 25, 71, 11, 17, 2, 52, 54, 41, 1, 28, 2, 1, 68, 13, 25, 16, 26, 39, 36, 24, 13, 61, 51, 11, 3, 36, 58, 15], 17], "output": 850}, {"inputs": [[67, 45, 15, 20, 36, 3, 6, 6, 27], 5], "output": 178}, {"inputs": [[41, 47, 73, 6, 64, 59, 56, 48, 69, 23, 27, 49, 38, 2, 18, 20, 35, 43, 44, 48, 12, 44, 5, 6, 35, 21, 20, 75, 38, 47, 51, 71, 17, 38, 15, 62], 16], "output": 846}, {"inputs": [[40, 23, 67, 10], 3], "output": 27}, {"inputs": [[43, 39, 54, 14, 13, 72, 62, 61, 44, 44, 16, 62, 15, 64, 55, 5, 39, 43, 20, 22, 73, 49, 12, 9, 11, 26], 24], "output": 216}, {"inputs": [[8, 50, 2, 13, 51, 72, 67, 38, 58, 63, 75, 28, 55, 11, 48], 4], "output": 275}, {"inputs": [[75, 22, 56, 25, 46, 15, 9, 4, 68, 58, 26, 16, 64, 51, 33, 27, 6], 7], "output": 354}]}} +{"id": "LeetCode/2682", "content": "# Count Increasing Quadruplets\n\nGiven a **0-indexed** integer array `nums` of size `n` containing all numbers from `1` to `n`, return *the number of increasing quadruplets*.\n\n\nA quadruplet `(i, j, k, l)` is increasing if:\n\n\n* `0 <= i < j < k < l < n`, and\n* `nums[i] < nums[k] < nums[j] < nums[l]`.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** nums = [1,3,2,4,5]\n**Output:** 2\n**Explanation:** \n- When i = 0, j = 1, k = 2, and l = 3, nums[i] < nums[k] < nums[j] < nums[l].\n- When i = 0, j = 1, k = 2, and l = 4, nums[i] < nums[k] < nums[j] < nums[l]. \nThere are no other quadruplets, so we return 2.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** nums = [1,2,3,4]\n**Output:** 0\n**Explanation:** There exists only one quadruplet with i = 0, j = 1, k = 2, l = 3, but since nums[j] < nums[k], we return 0.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `4 <= nums.length <= 4000`\n* `1 <= nums[i] <= nums.length`\n* All the integers of `nums` are **unique**. `nums` is a permutation.\n\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def countQuadruplets(self, nums: List[int]) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.countQuadruplets(**[[1, 3, 2, 4, 5]]) == 2\nassert my_solution.countQuadruplets(**[[1, 2, 3, 4]]) == 0\nassert my_solution.countQuadruplets(**[[2, 5, 3, 1, 4]]) == 0\nassert my_solution.countQuadruplets(**[[1, 3, 5, 2, 4]]) == 1\nassert my_solution.countQuadruplets(**[[2, 4, 1, 3]]) == 0\nassert my_solution.countQuadruplets(**[[3, 9, 5, 4, 8, 2, 1, 10, 7, 6]]) == 7\nassert my_solution.countQuadruplets(**[[1, 7, 6, 5, 8, 3, 2, 4]]) == 4\nassert my_solution.countQuadruplets(**[[9, 8, 5, 4, 2, 1, 6, 3, 7, 10]]) == 4\nassert my_solution.countQuadruplets(**[[5, 2, 4, 1, 3]]) == 0\nassert my_solution.countQuadruplets(**[[5, 3, 2, 4, 1]]) == 0\nassert my_solution.countQuadruplets(**[[7, 2, 8, 9, 6, 4, 5, 1, 3]]) == 0\nassert my_solution.countQuadruplets(**[[4, 2, 6, 3, 5, 7, 1, 8, 10, 9]]) == 12\nassert my_solution.countQuadruplets(**[[3, 4, 6, 1, 7, 2, 8, 5, 9]]) == 11\nassert my_solution.countQuadruplets(**[[9, 5, 3, 10, 6, 2, 4, 8, 7, 1]]) == 2\nassert my_solution.countQuadruplets(**[[7, 4, 8, 9, 1, 3, 6, 2, 5]]) == 1\nassert my_solution.countQuadruplets(**[[6, 1, 3, 9, 10, 7, 4, 8, 5, 2]]) == 2\nassert my_solution.countQuadruplets(**[[1, 4, 2, 5, 3]]) == 1\nassert my_solution.countQuadruplets(**[[3, 6, 4, 5, 8, 1, 7, 2]]) == 4\nassert my_solution.countQuadruplets(**[[8, 7, 3, 4, 1, 6, 9, 5, 2]]) == 0\nassert my_solution.countQuadruplets(**[[3, 5, 1, 4, 2, 6]]) == 2\n"}, "labels": {"questionId": "2682", "questionFrontendId": "2552", "questionTitle": "Count Increasing Quadruplets", "stats": {"totalAccepted": "4.3K", "totalSubmission": "10.9K", "totalAcceptedRaw": 4350, "totalSubmissionRaw": 10863, "acRate": "40.0%"}, "probedCases": [{"inputs": [[1, 3, 2, 4, 5]], "output": 2}, {"inputs": [[1, 2, 3, 4]], "output": 0}, {"inputs": [[2, 5, 3, 1, 4]], "output": 0}, {"inputs": [[1, 3, 5, 2, 4]], "output": 1}, {"inputs": [[2, 4, 1, 3]], "output": 0}, {"inputs": [[3, 9, 5, 4, 8, 2, 1, 10, 7, 6]], "output": 7}, {"inputs": [[1, 7, 6, 5, 8, 3, 2, 4]], "output": 4}, {"inputs": [[9, 8, 5, 4, 2, 1, 6, 3, 7, 10]], "output": 4}, {"inputs": [[5, 2, 4, 1, 3]], "output": 0}, {"inputs": [[5, 3, 2, 4, 1]], "output": 0}, {"inputs": [[7, 2, 8, 9, 6, 4, 5, 1, 3]], "output": 0}, {"inputs": [[4, 2, 6, 3, 5, 7, 1, 8, 10, 9]], "output": 12}, {"inputs": [[3, 4, 6, 1, 7, 2, 8, 5, 9]], "output": 11}, {"inputs": [[9, 5, 3, 10, 6, 2, 4, 8, 7, 1]], "output": 2}, {"inputs": [[7, 4, 8, 9, 1, 3, 6, 2, 5]], "output": 1}, {"inputs": [[6, 1, 3, 9, 10, 7, 4, 8, 5, 2]], "output": 2}, {"inputs": [[1, 4, 2, 5, 3]], "output": 1}, {"inputs": [[3, 6, 4, 5, 8, 1, 7, 2]], "output": 4}, {"inputs": [[8, 7, 3, 4, 1, 6, 9, 5, 2]], "output": 0}, {"inputs": [[3, 5, 1, 4, 2, 6]], "output": 2}]}} +{"id": "LeetCode/2630", "content": "# Alternating Digit Sum\n\nYou are given a positive integer `n`. Each digit of `n` has a sign according to the following rules:\n\n\n* The **most significant digit** is assigned a **positive** sign.\n* Each other digit has an opposite sign to its adjacent digits.\n\n\nReturn *the sum of all digits with their corresponding sign*.\n\n\n \n\n\n**Example 1:**\n\n\n\n```\n\n**Input:** n = 521\n**Output:** 4\n**Explanation:** (+5) + (-2) + (+1) = 4.\n\n```\n\n**Example 2:**\n\n\n\n```\n\n**Input:** n = 111\n**Output:** 1\n**Explanation:** (+1) + (-1) + (+1) = 1.\n\n```\n\n**Example 3:**\n\n\n\n```\n\n**Input:** n = 886996\n**Output:** 0\n**Explanation:** (+8) + (-8) + (+6) + (-9) + (+9) + (-6) = 0.\n\n```\n\n \n\n\n**Constraints:**\n\n\n* `1 <= n <= 109`\n\n\n \n\n\n.spoilerbutton {display:block; border:dashed; padding: 0px 0px; margin:10px 0px; font-size:150%; font-weight: bold; color:#000000; background-color:cyan; outline:0; \n}\n.spoiler {overflow:hidden;}\n.spoiler > div {-webkit-transition: all 0s ease;-moz-transition: margin 0s ease;-o-transition: all 0s ease;transition: margin 0s ease;}\n.spoilerbutton[value=\"Show Message\"] + .spoiler > div {margin-top:-500%;}\n.spoilerbutton[value=\"Hide Message\"] + .spoiler {padding:5px;}\n\n\n\nPlease make sure your answer follows the type signature below:\n\n```python3\nclass Solution:\n def alternateDigitSum(self, n: int) -> int:\n```\n", "test": {"code": "\nmy_solution = Solution()\n\nassert my_solution.alternateDigitSum(**[521]) == 4\nassert my_solution.alternateDigitSum(**[111]) == 1\nassert my_solution.alternateDigitSum(**[886996]) == 0\nassert my_solution.alternateDigitSum(**[4]) == 4\nassert my_solution.alternateDigitSum(**[2]) == 2\nassert my_solution.alternateDigitSum(**[7]) == 7\nassert my_solution.alternateDigitSum(**[8]) == 8\nassert my_solution.alternateDigitSum(**[10]) == 1\nassert my_solution.alternateDigitSum(**[1]) == 1\nassert my_solution.alternateDigitSum(**[5]) == 5\nassert my_solution.alternateDigitSum(**[72]) == 5\nassert my_solution.alternateDigitSum(**[64]) == 2\nassert my_solution.alternateDigitSum(**[25]) == -3\nassert my_solution.alternateDigitSum(**[56]) == -1\nassert my_solution.alternateDigitSum(**[18]) == -7\nassert my_solution.alternateDigitSum(**[81]) == 7\nassert my_solution.alternateDigitSum(**[26]) == -4\nassert my_solution.alternateDigitSum(**[40]) == 4\nassert my_solution.alternateDigitSum(**[58]) == -3\nassert my_solution.alternateDigitSum(**[97]) == 2\n"}, "labels": {"questionId": "2630", "questionFrontendId": "2544", "questionTitle": "Alternating Digit Sum", "stats": {"totalAccepted": "33.5K", "totalSubmission": "42.2K", "totalAcceptedRaw": 33487, "totalSubmissionRaw": 42171, "acRate": "79.4%"}, "probedCases": [{"inputs": [521], "output": 4}, {"inputs": [111], "output": 1}, {"inputs": [886996], "output": 0}, {"inputs": [4], "output": 4}, {"inputs": [2], "output": 2}, {"inputs": [7], "output": 7}, {"inputs": [8], "output": 8}, {"inputs": [10], "output": 1}, {"inputs": [1], "output": 1}, {"inputs": [5], "output": 5}, {"inputs": [72], "output": 5}, {"inputs": [64], "output": 2}, {"inputs": [25], "output": -3}, {"inputs": [56], "output": -1}, {"inputs": [18], "output": -7}, {"inputs": [81], "output": 7}, {"inputs": [26], "output": -4}, {"inputs": [40], "output": 4}, {"inputs": [58], "output": -3}, {"inputs": [97], "output": 2}]}} \ No newline at end of file