diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index 19d2358b18d..03c8f701ce0 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -78,11 +78,6 @@ jobs:
           python3 -m pip install --upgrade pip
           python3 -m pip install -r LeetFlow/requirements.txt
 
-      - name: Append item_number custom sort to MkDocs-Material tags plugin
-        run: |
-          FILE_PATH=$(python3 -c "import material.plugins.tags; print(material.plugins.tags.__file__)") && \
-          echo -e '\n\ndef item_number(mapping: Mapping):\n  return int(mapping.item.title.split(".")[0])' >> "$FILE_PATH"
-
       - name: Build LeetFlow/mkdocs to LeetFlow/site
         run: mkdocs build -f LeetFlow/mkdocs/mkdocs.yml
 
diff --git a/README.md b/README.md
index b0b5efef87c..ff297d74ef6 100644
--- a/README.md
+++ b/README.md
@@ -1,26 +1,14 @@
 <div align="center">
-<a href="https://walkccc.me/LeetCode/"><img src="https://i.imgur.com/IsS5xkZ.png" width=70 height=70 title="LeetCode" alt="LeetCode" loading="lazy"></a>
+<a href="https://walkccc.github.io/LeetCode/"><img src="https://i.imgur.com/IsS5xkZ.png" width=80 height=80 title="LeetCode" alt="LeetCode"></a>
 <h1>LeetCode Solutions</h1>
-
-<p>
-💡 <i>Solutions to <a href="https://leetcode.com/problemset/all/">LeetCode</a> in C++23, Java, Python, MySQL, and TypeScript.
-This repository aims to provide code with <strong>good readability</strong> and <strong>consistent style</strong> over various topics
-and embraces new standards.</i>
-</p>
-
-![LeetCode Progress](https://img.shields.io/badge/Solved-3563%2F3647%20(97.70%25)-323232?style=flat-square&logo=leetcode)
-<br/>
-![Easy](https://img.shields.io/badge/Easy-878%2F890-5CB85C?style=flat-square)
-![Medium](https://img.shields.io/badge/Medium-1847%2F1897-F0AD4E?style=flat-square)
-![Hard](https://img.shields.io/badge/Hard-838%2F860-D9534F?style=flat-square)
+<span>💡 <i>Solutions to <a href="https://leetcode.com/problemset/all/">LeetCode</a> in C++20, Java, Python, MySQL, and TypeScript. This repository aims to provide code with <strong>good readability</strong> and <strong>consistent style</strong> over various topics and embraces new standards.</i></span>
 <br/>
 <br/>
-![C++](https://img.shields.io/badge/C%2B%2B23-3495%20solutions-7DD3FC?style=flat-square&logo=cplusplus)
-![Java](https://img.shields.io/badge/Java-3371%20solutions-4298E2?style=flat-square&logo=java)
-![Python](https://img.shields.io/badge/Python%203-3169%20solutions-60A4FB?style=flat-square&logo=python)
+<img src="https://img.shields.io/badge/Solved-3238/3246%20=%2099.75%25-blue.svg?style=flat-square" alt="Solved Percentage" />
 <br/>
-![TypeScript](https://img.shields.io/badge/TypeScript-69%20solutions-93C5FD?style=flat-square&logo=typescript)
-![MySQL](https://img.shields.io/badge/MySQL-307%20solutions-BAE6FD?style=flat-square&logo=mysql)
+<img src="https://img.shields.io/badge/Easy-814/817-5CB85C.svg?style=flat-square" alt="Easy AC Count" />
+<img src="https://img.shields.io/badge/Medium-1700/1703-F0AD4E.svg?style=flat-square" alt="Medium AC Count" />
+<img src="https://img.shields.io/badge/Hard-724/726-D9534F.svg?style=flat-square" alt="Hard AC Count" />
 </div>
 
 ## Getting Started
@@ -37,7 +25,7 @@ Please see the [style guide](https://walkccc.me/LeetCode/styleguide/).
 | ---------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
 | C++        | [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html) | [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)       | [`.clang-format`](https://github.com/walkccc/LeetCode/blob/main/.clang-format) |
 | Java       | [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html) | [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html)     | [`.clang-format`](https://github.com/walkccc/LeetCode/blob/main/.clang-format) |
-| Python     | [`autopep8`](https://pypi.org/project/autopep8)             | [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html)     | Passing `--indent-size=2` for a better viewing experience in mobile devices.   |
+| Python     | [`autopep8`](https://pypi.org/project/autopep8)             | [PEP 8 – Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/)  | Passing `--indent-size=2` for a better viewing experience in mobile devices.   |
 | TypeScript | [Prettier](https://prettier.io)                             | [Google TypeScript Style Guide](https://google.github.io/styleguide/tsguide.html) | [`.prettierrc`](https://github.com/walkccc/LeetCode/blob/main/.prettierrc)     |
 | MySQL      | N/A                                                         | N/A                                                                               | N/A                                                                            |
 
@@ -45,15 +33,9 @@ Please see the [style guide](https://walkccc.me/LeetCode/styleguide/).
 
 This website went live on February 23, 2019.
 
-## Contributing
-
-This repository is a personal project and does not accept pull requests to
-maintain consistency in coding style and solutions. However, feel free to fork
-the repository and modify it as needed!
-
 ## License
 
-Licensed under the MIT License, Copyright © 2019-2025
+Licensed under the MIT License, Copyright © 2019-2024
 [P.-Y. Chen](https://github.com/walkccc).
 
 <div align="center">
diff --git a/STYLEGUIDE.md b/STYLEGUIDE.md
index 0de29aaaa2b..f018354bbcb 100644
--- a/STYLEGUIDE.md
+++ b/STYLEGUIDE.md
@@ -6,1004 +6,511 @@
 > For further reading, please see the definition of
 > [Convention over configuration in Wikipedia](https://en.wikipedia.org/wiki/Convention_over_configuration).
 
-## Introduction
-
-This style guide is specifically for LeetCode and is based on Google style
-guides with adjustments specific to LeetCode. It aims to maintain consistency
-across different programming languages while adhering to LeetCode's conventions.
-
-## Language-Specific Guidelines
-
-### General Rules
-
-1. Use `lowerCamelCase` for both functions and variables. While this may deviate
-   from the rules laid out in the
-   [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html#General_Naming_Rules)
-   and
-   [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html),
-   it is done to maintain consistency with the LeetCode OJ system, which employs
-   `lowerCamelCase` for over 99% of the time. Remember, the most important thing
-   is to be consistent at all times.
-1. Import statements and brackets `()` may be omitted for better viewing
-   experience on mobile devices, but they should be retained in real-world
-   coding situations for clarity and maintainability.
+## Disclaimer
+
+### General
+
+- In our coding convention, we use `lowerCamelCase` for both functions and
+  variables. While this may deviate from the rules laid out in the
+  [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html#General_Naming_Rules)
+  and
+  [PEP 8 -- Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/#naming-conventions),
+  it is done to maintain consistency with the LeetCode OJ system, which employs
+  `lowerCamelCase` for over 99% of the time. Remember, the most important thing
+  is to be consistent at all times.
+- In code snippets, import statements and brackets may be omitted for brevity
+  (arguably), but they should be retained in real-world coding situations for
+  clarity and maintainability.
 
 ### C++
 
-1. The code is only for demonstration and cannot be compiled.
-1. `#include` statements are omitted in code snippets for brevity.
-1. Understanding the difference between `size_t` and `int` is crucial when
-   traversing arrays in practical applications, as it can affect the outcome.
-1. Qualifying with `std::` prefix when accessing standard libraries is
-   recommended in real-world, as it clearly indicates the source of the
-   identifier being used and avoid name conflicts.
+- The code is only for demonstration and cannot be compiled.
+- Explicitly declaring types such as `int`, `char`, and `string` is often
+  preferable over using the `auto` keyword introduced in C++ 11.
+- `#include` statements are omitted in code snippets for brevity.
+- Understanding the difference between `size_t` and `int` is crucial when
+  traversing arrays in practical applications, as it can affect the outcome.
+- Qualifying with `std::` prefix when accessing standard libraries is
+  recommended for readability and maintainability in real-world coding
+  situations, as it clearly indicates the source of the identifier being used.
 
 ### Java
 
-1. The code is only for demonstration and cannot be compiled.
-1. `import` statements are omitted in code snippets for brevity.
+- The code is only for demonstration and cannot be compiled.
+- Explicitly declaring types such as `int`, `char`, and `String` is often
+  preferable over using the `var` keyword introduced Java 10.
+- `import` statements are omitted in code snippets for brevity.
 
 ### Python
 
-1. Private functions are prefixed with `_`, which may seem tedious. However, in
-   the real world, we use tools like [Mypy](https://github.com/python/mypy),
-   [Pytype](https://github.com/google/pytype), and
-   [Pyre](https://github.com/facebook/pyre-check) for static type checking.
-1. We pass the argument `--indent-size=2` to
-   [autopep8](https://pypi.org/project/autopep8/) for a better viewing
-   experience on mobile devices.
-1. `import` statements are omitted in code snippets for brevity.
-1. Variables like `next` and `hash` are reserved keywords. For consistency with
-   C++ and Java naming conventions, we'll use them. However, in practice, using
-   reserved keywords as variable names can cause confusion and issues. It's
-   better to choose names that avoid such conflicts.
+- Private functions are prefixed with `_`, which may seem tedious. However, in
+  the real world, we use tools like [Mypy](https://github.com/python/mypy),
+  [Pytype](https://github.com/google/pytype), and
+  [Pyre](https://github.com/facebook/pyre-check) for static type checking.
+- We pass the argument `--indent-size=2` to
+  [autopep8](https://pypi.org/project/autopep8/) for a better viewing
+  experience.
+- `import` statements are omitted in code snippets for brevity.
 
 ### SQL
 
-1. The naming of LeetCode is quite a mess and inconsistently uses plurals and
-   singulars together. I'll use my best judgment to name tables in
-   `UpperCamelCase` in the plural form and fields in `lower_snake_case`.
-1. Proper indentation will be taken care of and treated seriously.
-1. No puzzling table abbreviation.
+- The naming of LeetCode is quite a mess and inconsistently uses plurals and
+  singulars together. I'll use my best judgment to name tables in
+  `UpperCamelCase` in the plural form and fields in `lower_snake_case`.
+- Proper indentation will be taken care of and treated seriously.
+- No puzzling table abbreviation.
 
-## Naming Conventions
+## Naming Cases
 
-- **Class:** `UpperCamelCase`
-- **Function:** `lowerCamelCase`
-- **Variable:** `lowerCamelCase`
-- **Constant:** `kUpperCamelCase`
+### Rules
 
-### Examples
+- **Class**: `UpperCamelCase`
+- **Function**: `lowerCamelCase`
+- **Variable**: `lowerCamelCase`
+- **Constant**: `kUpperCamelCase`
 
-=== "C++"
+### Examples in C++
 
-    ```cpp
-    // Class
-    class MyClass { ... }
+```cpp
+// Class
+class MyClass { ... }
 
-    // Function
-    void myFunction(int param) { ... }
+// Function
+function myFunction() { ... }
 
-    // Variable
-    int myVariable = 0;
+// Variable
+int myVariable;
 
-    // Constant
-    constexpr int kMod = 1'000'000'007;
-    ```
+// Constant
+constexpr int kMod = 1'000'000'007;
+```
 
-=== "Java"
+## Template
 
-    ```java
-    // Class
-    class MyClass { ... }
+> We use C++ to demonstrate the idea, and the same concepts apply to Java and
+> Python.
 
-    // Function
-    void myFunction(int param) { ... }
+### Rules
 
-    // Variable
-    int myVariable = 0;
+- Declare the variables in the proper scope as slow as possible.
 
-    // Constant
-    final int kMod = 1_000_000_007;
-    ```
+  - Declare `constexprt` as soon as possible.
+  - Declare `const` variables as soon as possible.
+  - Declare `ans` as soon as possible.
+  - Since LeetCode is just an online judge system rather than a big project, we
+    don't scatter all variables in different sections. However, we still sort
+    the variables based on the time we first use each of them.
 
-=== "Python"
+- Code section (there should be one blank line between each sections.)
 
-    ```python
-    # Class
-    class MyClass:
-      pass
+  - `public`
 
-    # Function
-    def myFunction(param: int) -> None:
-      pass
+    1. boundary conditions
+    1. initial variables
+    1. There may be many kernels separated with one blank line, but there
+       shouldn't be any blank line in each kernel.
+    1. return
 
-    # Variable
-    myVariable = 0
+  - `private`
 
-    # Constant
-    kMod = 1_000_000_007
-    ```
+    1. private variables
+    1. private functions
 
-## Code Structure
+## Schematic Template
 
-### Rules
+> We use C++ to demonstrate the idea, and the same concepts apply to Java and
+> Python.
 
-- Declare the variables in the proper scope as slow as possible.
-- Declare the constants as soon as possible.
-- Declare `ans` as soon as possible.
 - No blank lines between variables initialization.
-- Blank one single line between each main section.
+- Blank one single line between each section. **However, if there's no sec 12**,
+  no blank line between **sec 11** and **sec 13**.
 - If the last statement is not a paragraph (`for` loop most of the case), then
   no blank lines between it and the `return` statement.
-- Since LeetCode is just an online judge system rather than a big project, we
-  don't scatter all variables in different sections. However, we still sort the
-  variables based on the time we first use each of them.
-
-### Template
-
-=== "C++"
-
-    ```cpp
-    class Solution {
-     public:
-      // public functions
-      int mainFunction() {
-        // (sec 0) boundary conditions
-
-        // (sec 1) variables initialization
-        //   (sec 10) constexpr/const (size/length)
-        //   (sec 11) ans
-        //   (sec 12) declaration & operation
-        //   (sec 13) purely declaration
-
-        // (sec 2) kernels
-
-        // (sec 3) modify original initial variables
-
-        // (sec 4) kernels
-
-        // (sec n) return
-      }
-
-    private:
-      // private variables
-      static constexpr int kMod = 1'000'000'007;
-
-      // private functions
-      void myHelper(int param) { ... }
-
-      string myAnotherHelper(const vector<string>& param) { ... }
-    };
-    ```
-
-=== "Java"
 
-    ```java
-    class Solution {
-      // public functions
-      public int mainFunction() {
-        // (sec 0) boundary conditions
+```cpp
+class Solution {
+ public:
+  func() {
+    // (sec 0) boundary conditions
 
-        // (sec 1) variables initialization
-        //   (sec 10) final (size/length)
-        //   (sec 11) ans
-        //   (sec 12) declaration & operation
-        //   (sec 13) purely declaration
+    // (sec 1) initial variables
+    //   (sec 10) constexpr/const (size/length)
+    //   (sec 11) ans
+    //   (sec 12) declaration & operation
+    //   (sec 13) purely declaration
 
-        // (sec 2) kernels
-
-        // (sec 3) modify original initial variables
-
-        // (sec 4) kernels
-
-        // (sec n) return
-      }
-
-      // private variables
-      private static final int kMod = 1_000_000_007;
-
-      // private functions
-      private void myHelper(int param) { ... }
-
-      private String myAnotherHelper(List<String> param) { ... }
-    }
-    ```
-
-=== "Python"
-
-    ```python
-    class Solution:
-      def __init__(self):
-        # private variables
-        self.kMod = 1_000_000_007
-
-      # public functions
-      def mainFunction(self) -> int:
-        pass
-        # (sec 0) boundary conditions
-
-        # (sec 1) variables initialization
-        #   (sec 10)
-        #   (sec 11) ans
-        #   (sec 12) declaration & operation
-        #   (sec 13) purely declaration
-
-        # (sec 2) kernels
-
-        # (sec 3) modify original initial variables
-
-        # (sec 4) kernels
-
-        # (sec n) return
-
-      # private functions
-      def _myHelper(self, param: int) -> None:
-        pass
-
-      def _myAnotherHelper(self, param: List[str]) -> str:
-        pass
-    ```
-
-## Data Structures and Algorithms
-
-### Two Pointers / Sliding Windows
-
-1. Always prefer to _one_ character to represent index variables.
-1. Use `i`, `j`, `k` in the loop, in that order.
-
-=== "C++"
-
-    ```cpp
-    int i = 0;
-    for (const int num : nums) { ... }
-    ```
-
-=== "Java"
-
-    ```java
-    int i = 0;
-    for (final int num : nums) { ... }
-    ```
-
-=== "Python"
-
-    ```python
-    i = 0
-    for num in nums:
-      pass
-    ```
-
----
-
-=== "C++"
-
-    ```cpp
-    for (int i = 0, j = 0; i < n; ++i) { ... }
-    ```
-
-=== "Java"
-
-    ```java
-    for (int i = 0, j = 0; i < n; ++i) { ... }
-    ```
-
-=== "Python"
-
-    ```python
-    j = 0
-    for i in range(n):
-      pass
-    ```
-
----
-
-=== "C++"
-
-    ```cpp
-    int k = 0;
-    for (int i = 0; i < n; ++i)
-      for (int j = i; j < n; ++j) { ... }
-    ```
-
-=== "Java"
-
-    ```java
-    int k = 0;
-    for (int i = 0; i < n; ++i)
-      for (int j = i; j < n; ++j) { ... }
-    ```
-
-=== "Python"
-
-    ```python
-    k = 0
-    for i in range(n):
-      for j in range(i, n):
-        pass
-    ```
-
-### Union Find
-
-> Demo the Path Compression and Union by Rank version, where the time complexity
-> of `unionByRank()` and `find` is $O(\alpha(n)) = O(\log^\* n)$.
-
-=== "C++"
-
-    ```cpp
-    class UnionFind {
-     public:
-      UnionFind(int n) : count(n), id(n), rank(n) {
-        iota(begin(id), end(id), 0);
-      }
-
-      void unionByRank(int u, int v) {
-        const int i = find(u);
-        const int j = find(v);
-        if (i == j)
-          return;
-        if (rank[i] < rank[j]) {
-          id[i] = id[j];
-        } else if (rank[i] > rank[j]) {
-          id[j] = id[i];
-        } else {
-          id[i] = id[j];
-          ++rank[j];
-        }
-        --count;
-      }
-
-      int getCount() const {
-        return count;
-      }
-
-    private:
-      int count;
-      vector<int> id;
-      vector<int> rank;
-
-      int find(int u) {
-        return id[u] == u ? u : id[u] = find(id[u]);
-      }
-    };
-    ```
-
-=== "Java"
-
-    ```java
-    class UnionFind {
-      public UnionFind(int n) {
-        count = n;
-        id = new int[n];
-        rank = new int[n];
-        for (int i = 0; i < n; ++i)
-          id[i] = i;
-      }
-
-      public void unionByRank(int u, int v) {
-        final int i = find(u);
-        final int j = find(v);
-        if (i == j)
-          return;
-        if (rank[i] < rank[j]) {
-          id[i] = j;
-        } else if (rank[i] > rank[j]) {
-          id[j] = i;
-        } else {
-          id[i] = j;
-          ++rank[j];
-        }
-        --count;
-      }
-
-      public int getCount() {
-        return count;
-      }
-
-      private int count;
-      private int[] id;
-      private int[] rank;
-
-      private int find(int u) {
-        return id[u] == u ? u : (id[u] = find(id[u]));
-      }
-    }
-    ```
-
-=== "Python"
-
-    ```python
-    class UnionFind:
-      def __init__(self, n: int):
-        self.count = n
-        self.id = list(range(n))
-        self.rank = [0] * n
-
-      def unionByRank(self, u: int, v: int) -> None:
-        i = self._find(u)
-        j = self._find(v)
-        if i == j:
-          return
-        if self.rank[i] < self.rank[j]:
-          self.id[i] = j
-        elif self.rank[i] > self.rank[j]:
-          self.id[j] = i
-        else:
-          self.id[i] = j
-          self.rank[j] += 1
-        self.count -= 1
-
-      def getCount(self) -> int:
-        return self.count
-
-      def _find(self, u: int) -> int:
-        if self.id[u] != u:
-          self.id[u] = self._find(self.id[u])
-        return self.id[u]
-    ```
-
-### Graph / Tree
-
-1. If a graph has a clear tree structure, we name it with `tree`. Otherwise, we
-   name it with `graph`.
-1. Always use `(u, v)` to represent an edge regardless what is stated in the
-   problem.
-
-=== "C++"
-
-    ```cpp
-    vector<vector<int>> graph(n);
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      graph[u].push_back(v);
-      graph[v].push_back(u);
-    }
-    ```
+    // (sec 2) kernels
 
-=== "Java"
+    // (sec 3) modify original initial variables
 
-    ```java
-    List<Integer>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+    // (sec 4) kernels
 
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      graph[u].add(v);
-      graph[v].add(u);
-    }
-    ```
+    // (sec n) return
+  }
 
-=== "Python"
+ private:
+  // private variables
 
-    ```python
-    graph = [[] for _ in range(n)]
+  // private functions
+  helper() { ... }
 
-    for u, v in edges:
-      tree[u].append(v)
-      tree[v].append(u)
-    ```
+  anotherHelper() { ... }
+};
+```
 
-### Dijkstra
+Example
+([873. Length of Longest Fibonacci Subsequence](https://leetcode.com/problems/length-of-longest-fibonacci-subsequence/)):
 
-=== "C++"
+- code:
 
-    ```cpp
-    int dijkstra(const vector<vector<pair<int, int>>>& graph, int src) {
-      vector<int> dist(graph.size(), INT_MAX);
+  ```cpp
+  class Solution {
+   public:
+    int lenLongestFibSubseq(vector<int>& arr) {
+      const int n = arr.size();
+      int ans = 0;
+      vector<vector<int>> dp(n, vector<int>(n, 2));
+      unordered_map<int, int> numToIndex;
 
-      dist[src] = 0;
-      using P = pair<int, int>;  // (d, u)
-      priority_queue<P, vector<P>, greater<>> minHeap;
-      minHeap.emplace(dist[src], src);
+      for (int i = 0; i < n; ++i)
+        numToIndex[arr[i]] = i;
 
-      while (!minHeap.empty()) {
-        const auto [d, u] = minHeap.top();
-        minHeap.pop();
-        if (d > dist[u])
-          continue;
-        for (const auto& [v, w] : graph[u])
-          if (d + w < dist[v]) {
-            dist[v] = d + w;
-            minHeap.emplace(dist[v], v);
+      for (int j = 0; j < n; ++j)
+        for (int k = j + 1; k < n; ++k) {
+          const int ai = arr[k] - arr[j];
+          if (ai < arr[j] && numToIndex.contains(ai)) {
+            const int i = numToIndex[ai];
+            dp[j][k] = dp[i][j] + 1;
+            ans = max(ans, dp[j][k]);
           }
-      }
+        }
 
-      const int maxDist = ranges::max(dist);
-      return maxDist == INT_MAX ? -1 : maxDist;
+      return ans;
     }
-    ```
-
-=== "Java"
-
-    ```java
-    private int dijkstra(List<Pair<Integer, Integer>>[] graph, int src) {
-      int[] dist = new int[graph.length];
-      Arrays.fill(dist, Integer.MAX_VALUE);
-
-      dist[src] = 0;
-      Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparing(Pair::getKey)) {
-          { offer(new Pair<>(dist[src], src)); } // (d, u)
-        };
-
-      while (!minHeap.isEmpty()) {
-        final int d = minHeap.peek().getKey();
-        final int u = minHeap.poll().getValue();
-        if (d > dist[u])
-          continue;
-        for (Pair<Integer, Integer> pair : graph[u]) {
-          final int v = pair.getKey();
-          final int w = pair.getValue();
-          if (d + w < dist[v]) {
-            dist[v] = d + w;
-            minHeap.offer(new Pair<>(dist[v], v));
+  };
+  ```
+
+- code (explanation):
+
+  ```cpp
+  class Solution {
+   public:
+    int lenLongestFibSubseq(vector<int>& arr) {
+      // Only get the value of size() or length() when we use it twice or more times.
+      // Remember to add `const` whenever possible.
+      const int n = arr.size();
+      int ans = 0;
+      vector<vector<int>> dp(n, vector<int>(n, 2));
+      unordered_map<int, int> numToIndex;
+
+      for (int i = 0; i < n; ++i)
+        numToIndex[arr[i]] = i;
+
+      for (int j = 0; j < n; ++j)
+        for (int k = j + 1; k < n; ++k) {
+          const int ai = arr[k] - arr[j];  // Add `const`.
+          if (ai < arr[j] && numToIndex.contains(ai)) {
+            const int i = numToIndex[ai];  // Add `const`.
+            dp[j][k] = dp[i][j] + 1;
+            ans = max(ans, dp[j][k]);
           }
         }
-      }
 
-      final int maxDist = Arrays.stream(dist).max().getAsInt();
-      return maxDist == Integer.MAX_VALUE ? -1 : maxDist;
+      return ans;
     }
-    ```
-
-=== "Python"
-
-    ```python
-    def _dijkstra(self, graph: list[list[tuple[int, int]]], src: int) -> int:
-      dist = [math.inf] * len(graph)
-
-      dist[src] = 0
-      minHeap = [(dist[src], src)]  # (d, u)
-
-      while minHeap:
-        d, u = heapq.heappop(minHeap)
-        if d > dist[u]:
-          continue
-        for v, w in graph[u]:
-          if d + w < dist[v]:
-            dist[v] = d + w
-            heapq.heappush(minHeap, (dist[v], v))
-
-      maxDist = max(dist)
-      return maxDist if maxDist != math.inf else -1
-    ```
-
-### Binary Search
+  };
+  ```
+
+## Boundary Conditions
+
+```cpp
+// Linked-List
+if (l1 == nullptr && l2 == nullptr) { ... }
+if (l1 != nullptr || l2 != nullptr) { ... }
+
+// String
+if (str.empty()) { ... }
+if (str.length() <= 2) { ... }
+
+// Vector
+if (vec.size() <= 2) { ... }
+```
+
+## Return Value
+
+```cpp
+return ans;
+return {};
+```
+
+## Data Structures
+
+```cpp
+// C++
+unordered_set<string> seen;
+unordered_map<char, int> count;
+vector<int> count;
+stack<char> stack;
+queue<TreeNode*> q;
+deque<TreeNode*> minQ;
+auto compare = [](const ListNode* a, const ListNode* b) {
+  return a->val > b->val;
+};
+priority_queue<ListNode*, vector<ListNode*>, decltype(compare)> minHeap(compare);
+```
+
+```java
+// Java
+Set<String> seen = new HashSet<>();
+Map<Character, Integer> count = new HashMap<>();
+int[] count = new int[n];
+Deque<Character> stack = new ArrayDeque<>(); // Do not use `Stack`.
+Queue<Integer> q = new LinkedList<>();
+Deque<Integer> minQ = new ArrayDeque<>();
+Queue<ListNode> minHeap = new PriorityQueue<>((a, b) -> a.val - b.val);
+```
+
+```python
+# Python
+seen = set()
+count = {}
+count = collections.defaultdict(int)
+count = collections.defaultdict(list)
+count = collections.Counter()
+minQ = collections.deque([root])
+stack = []
+minHeap = []
+```
+
+## Two Pointers / Sliding Windows
 
 1. Always prefer to _one_ character to represent index variables.
-1. Always prefer to use `[l, r)` pattern.
-
-=== "C++"
-
-    ```cpp
-    int l = 1;
-    int r = nums.size();
-
-    while (l < r) {
-      const int m = l + (r - l) / 2;
-      if (f(m))
-        l = m + 1;  // new range [m + 1, r)
-      else
-        r = m;  // new range [l, m)
-    }
-
-    return l;
-    ```
-
-=== "Java"
-
-    ```java
-    int l = 1;
-    int r = nums.length;
+1. Use `i`, `j`, `k` in the loop, in that order.
 
-    while (l < r) {
-      final int m = l + (r - l) / 2;
-      if (f(m))
-        l = m + 1;  // new range [m + 1, r)
-      else
-        r = m;  // new range [l, m)
+```cpp
+int i = 0;
+for (const int num : nums) { ... }
+```
+
+```cpp
+for (int i = 0, j = 0; i < n; ++i) { ... }
+```
+
+```cpp
+int k = 0;
+for (int i = 0; i < n; ++i)
+  for (int j = i; j < n; ++j) { ... }
+```
+
+```cpp
+int l = 0;
+int r = nums.size() - 1;
+```
+
+## Union Find
+
+```cpp
+class UnionFind {
+ public:
+  UnionFind(int n) : count(n), id(n), rank(n) {
+    iota(begin(id), end(id), 0);
+  }
+
+  void unionByRank(int u, int v) {
+    const int i = find(u);
+    const int j = find(v);
+    if (i == j)
+      return;
+    if (rank[i] < rank[j]) {
+      id[i] = id[j];
+    } else if (rank[i] > rank[j]) {
+      id[j] = id[i];
+    } else {
+      id[i] = id[j];
+      ++rank[j];
     }
+    --count;
+  }
+
+  int getCount() const {
+    return count;
+  }
+
+ private:
+  int count;
+  vector<int> id;
+  vector<int> rank;
+
+  int find(int u) {
+    return id[u] == u ? u : id[u] = find(id[u]);
+  }
+};
+```
+
+## Graph / Tree
+
+- If a graph has a clear tree structure, we name it a `tree`. Otherwise, we name
+  it a `graph`.
+- Always use `(u, v)` to represent an edge regardless what is stated in the
+  problem.
+
+```cpp
+vector<vector<int>> graph(n);
+
+for (const vector<int>& edge : edges) {
+  const int u = edge[0];
+  const int v = edge[1];
+  graph[u].push_back(v);
+  graph[v].push_back(u);
+}
+```
+
+## Dijkstra
+
+```cpp
+void dijkstra(const vector<vector<pair<int, int>>>& graph, int src) {
+  vector<int> dist(graph.size(), INT_MAX);
+  using P = pair<int, int>;  // (d, u)
+  priority_queue<P, vector<P>, greater<>> minHeap;
+
+  dist[src] = 0;
+  minHeap.emplace(0, src);
+
+  while (!minHeap.empty()) {
+    const auto [d, u] = minHeap.top();
+    minHeap.pop();
+    for (const auto& [v, w] : graph[u])
+      if (d + w < dist[v]) {
+        dist[v] = d + w;
+        minHeap.emplace(dist[v], v);
+      }
+  }
+}
+```
 
-    return l;
-    ```
-
-=== "Python"
-
-    ```python
-    bisect.bisect_left(range(1, len(nums)), True,
-                      key=lambda m: f(m)) + 1
-    ```
-
-## Common Patterns
-
-### Built-in Types
-
-=== "C++"
-
-    ```cpp
-    unordered_set<string> seen;
-    unordered_map<char, int> count;
-    vector<int> count;
-    stack<char> stack;
-    queue<TreeNode*> q;
-    deque<TreeNode*> minQ;
-    auto compare = [](const ListNode* a, const ListNode* b) {
-      return a->val > b->val;
-    };
-    priority_queue<ListNode*, vector<ListNode*>, decltype(compare)> minHeap(compare);
-    ```
-
-=== "Java"
-
-    ```java
-    Set<String> seen = new HashSet<>();
-    Map<Character, Integer> count = new HashMap<>();
-    int[] count = new int[n];
-    Deque<Character> stack = new ArrayDeque<>(); // Do not use `Stack`.
-    Queue<Integer> q = new LinkedList<>();
-    Deque<Integer> minQ = new ArrayDeque<>();
-    Queue<ListNode> minHeap = new PriorityQueue<>(Comparator.comparing((ListNode a) -> a.val));
-    ```
-
-=== "Python"
-
-    ```python
-    seen = set()
-    count = {}
-    count = collections.defaultdict(int)
-    count = collections.defaultdict(list)
-    count = collections.Counter()
-    minQ = collections.deque([root])
-    stack = []
-    minHeap = []
-    ```
-
-### Boundary Conditions
-
-=== "C++"
-
-    ```cpp
-    // Linked-List
-    if (l1 == nullptr && l2 == nullptr) { ... }
-    if (l1 != nullptr || l2 != nullptr) { ... }
-
-    // String
-    if (s.empty()) { ... }
-    if (s.length() <= 2) { ... }
-
-    // Vector
-    if (nums.size() <= 2) { ... }
-    ```
-
-=== "Java"
-
-    ```java
-    // Linked-List
-    if (l1 == null && l2 == null) { ... }
-    if (l1 != null || l2 != null) { ... }
-
-    // String
-    if (s.isEmpty()) { ... }
-    if (s.length() <= 2) { ... }
-
-    // Array
-    if (nums.length <= 2) { ... }
-
-    // List
-    if (nums.size() <= 2) { ... }
-    ```
-
-=== "Python"
-
-    ```python
-    # Linked-List
-    if not l1 and not l2:
-      pass
-    if l1 or l2:
-      pass
-
-    # String
-    if not s:
-      pass
-    if len(s) <= 2:
-      pass
-
-    # List
-    if len(nums) <= 2:
-      pass
-    ```
-
-### ListNode
-
-=== "C++"
-
-    ```cpp
-    // Allocate the memory on the stack instead of the heap.
-    ListNode dummy(0);
-
-    ListNode* curr = nullptr;
-    ListNode* prev = nullptr;
-    ListNode* next = nullptr;
-
-    ListNode* slow = nullptr;
-    ListNode* fast = nullptr;
-
-    ListNode* head = nullptr;
-    ListNode* tail = nullptr;
-
-    ListNode* l1 = nullptr;
-    ListNode* l2 = nullptr;
-    ```
-
-=== "Java"
-
-    ```java
-    ListNode dummy = new ListNode(0);
-
-    ListNode curr = null;
-    ListNode prev = null;
-    ListNode next = null;
-
-    ListNode slow = null;
-    ListNode fast = null;
-
-    ListNode head = null;
-    ListNode tail = null;
-
-    ListNode l1 = null;
-    ListNode l2 = null;
-    ```
-
-=== "Python"
-
-    ```python
-    dummy = ListNode(0)
-
-    curr = None
-    prev = None
-    next = None
-
-    slow = None
-    fast = None
-
-    head = None
-    tail = None
-
-    l1 = None
-    l2 = None
-    ```
-
-### 2D Vector/Array/List and 2 Strings
-
-=== "C++"
-
-    ```cpp
-    // 2D Vector
-    const int m = matrix.size();
-    const int n = matrix[0].size();
-
-    // If there're two strings.
-    const int m = s1.length();
-    const int n = s2.length();
-
-    // If there's only a string.
-    const int n = s.length();
-    ```
-
-=== "Java"
-
-    ```java
-    // 2D Array
-    final int m = matrix.length;
-    final int n = matrix[0].length;
-
-    // If there're two strings.
-    final int m = s1.length();
-    final int n = s2.length();
-
-    // If there's only a string.
-    final int n = s.length();
-    ```
-
-=== "Python"
-
-    ```python
-    # 2D List
-    m = len(matrix)
-    n = len(matrix[0])
-
-    # If there're two strings.
-    m = len(s1)
-    n = len(s2)
-
-    # If there's only a string.
-    n = len(s)
-    ```
-
-### Traversing
-
-=== "C++"
-
-    ```cpp
-    // vector<int> nums;
-    for (int i = 0; i < nums.size(); ++i) { ... }
-    for (const int num : nums) { ... }
-
-    // vector<string> words;
-    for (const string& word : words) { ... }
-
-    // string str;
-    for (int i = 0; i < str.length(); ++i) { ... }
-    for (const char c : str) { ... }
-
-    // unordered_set<int> numsSet;
-    for (const int num : numsSet) { ... }
-
-    // unordered_map<char, int> lookup;
-    for (const auto& [key, value] : lookup) { ... }
-
-    // ListNode* head;
-    for (ListNode* curr = head; curr != nullptr; curr = curr->next) { ... }
-    ```
-
-=== "Java"
-
-    ```java
-    // int[] nums;
-    for (int i = 0; i < nums.length; ++i) { ... }
-    for (final int num : nums) { ... }
-
-    // List<String> words;
-    for (const string& word : words) { ... }
-
-    // String s;
-    for (int i = 0; i < s.length(); ++i) { ... }
-    for (final char c : s.toCharArray()) { ... }
-
-    // Set<Integer> numsSet;
-    for (final int num : numsSet) { ... }
+## Binary Search
 
-    // Map<Character, Integer> lookup;
-    for (Map.Entry<Character, Integer> entry : lookup) {
-      final char key = entry.getKey();
-      final int value = entry.getValue();
-      ...
-    }
+1. Always prefer to _one_ character to represent index variables.
+2. Always prefer to use `[l, r)` pattern.
 
-    // ListNode head;
-    for (ListNode curr = head; curr != null; curr = curr.next) { ... }
-    ```
+```cpp
+int l = 0;
+int r = nums.size();
 
-=== "Python"
+while (l < r) {
+  const int m = l + (r - l) / 2;
+  if (f(m))
+    l = m + 1;  // new range [m + 1, r)
+  else
+    r = m;  // new range [l, m)
+}
 
-    ```python
-    # nums: list[int]
-    for i in range(nums):
-      pass
-    for num in nums:
-      pass
-    for i, num in enumerate(nums):
-      pass
+return l;
+```
 
-    # words: List[str]
-    for word in words:
-      pass
+## ListNode
 
-    # s: str
-    for i in range(len(s)):
-      pass
-    for c in s:
-      pass
-    for i, c in enumerate(s):
-      pass
+```cpp
+// Allocate the memory on the stack instead of the heap.
+ListNode dummy(0);
+
+ListNode* curr;
+ListNode* prev;
+ListNode* next;
+
+ListNode* slow;
+ListNode* fast;
+
+ListNode* head;
+ListNode* tail;
+
+ListNode* l1;
+ListNode* l2;
+```
+
+## 2D Vector / 2 Strings
+
+```cpp
+// 2D Vector
+const int m = matrix.size();
+const int n = matrix[0].size();
+
+// If there're two strings.
+const int m = str1.length();
+const int n = str2.length();
+
+// If there's only a string.
+const int n = str.length();
+```
+
+## Traversing
+
+```cpp
+// vector<int> nums;
+for (int i = 0; i < nums.size(); ++i) { ... }
+for (const int num : nums) { ... }
+
+// vector<string> words;
+for (const string& word : words) { ... }
+
+// string str;
+for (int i = 0; i < str.length(); ++i) { ... }
+for (const char c : str) { ... }
+
+// unordered_set<int> numsSet;
+for (const int num : numsSet) { ... }
+
+// structured binding in C++17
+// unordered_map<char, int> map;
+for (const auto& [key, value] : map) { ... }
+
+// ListNode* head;
+for (ListNode* curr = head; curr; curr = curr->next) { ... }
+```
+
+## Miscellaneous
+
+1. Always prefer to use `str.length()` over `str.size()`.
+1. Always use _camelCase_ nomenclature when not listed above.
+
+   ```cpp
+   // C++
+   int currNum;
+   int maxProfit;
+   TreeNode* currNode;
+   ```
+
+1. When there's confliction in expression and function or reserved key word:
+
+   ```cpp
+   // C++
+   mn, std::min()
+   mx, std::max()
+   ```
+
+   ```python
+   # Python
+   mn, min
+   mx, max
+   summ, sum
+   ```
+
+1. When there are two maps/stacks, use meaningful names.
 
-    # numsSet: set[int]
-    for num in numsSet:
-      pass
-
-    # lookup: dict[str, int]
-    for key, value in lookup.items():
-      pass
-
-    # head: ListNode
-    curr = head
-    while curr:
-      curr = curr.next
-    ```
-
-### Miscellaneous
-
-Always use _camelCase_ nomenclature when not listed above.
-
-=== "C++"
-
-    ```cpp
-    int currNum = 0;
-    int maxProfit = INT_MIN;
-    TreeNode* currNode = nullptr;
-    ```
-
-=== "Java"
-
-    ```java
-    int currNum = 0;
-    int maxProfit = Integer.MIN_VALUE;
-    TreeNode currNode = null;
-    ```
-
-=== "Python"
-
-    ```python
-    currNum = 0
-    maxProfit = math.inf
-    currNode = None
-    ```
-
-When there's confliction in expression and function or reserved key word:
-
-=== "C++"
-
-    ```cpp
-    mn, std::min()
-    mx, std::max()
-    ```
-
-=== "Java"
-
-    ```cpp
-    mn, Math.min()
-    mx, Math.max()
-    ```
-
-=== "Python"
-
-    ```python
-    mn, min
-    mx, max
-    summ, sum
-    ```
-
-When there are two maps/stacks, use meaningful names.
-
-=== "C++"
-
-    ```cpp
-    unordered_map<char, int> countA;
-    unordered_map<char, int> countB;
-    ```
-
-=== "Java"
-
-    ```java
-    Map<Character, Integer> countA = new HashMap<>();
-    Map<Character, Integer> countB = new HashMap<>();
-    ```
-
-=== "Python"
-
-    ```python
-    countA = collections.Counter()
-    countB = collections.Counter()
-    ```
-
-Others:
+   ```cpp
+   // C++
+   unordered_map<char, int> countA;
+   unordered_map<char, int> countB;
+   ```
 
-1. In C++, always prefer `str.length()` over `str.size()`.
-1. In C++, `constexpr` is used if possible.
-1. In C++ `const` is used if possible.
-1. In C++, `const auto` structured binding is used when we iterate through a
-   `unordered_map` or `map`.
-1. In C++, `&` is used whenever possible except `int` and `char` because
-   reference typically takes 4 bytes, while `int` takes 2/4 bytes and `char`
-   takes 1 byte.
-1. In C++, `std::ranges` is used where it enhances clarity and fits naturally
-   with the code.
-1. In C++ and Java, initialize a vector or an array with `0` or `false`
-   **implicitly**.
-1. In Java, `final` is used whenever makes sense.
+1. When we need to count something, use `sum`, `count` and `total`, in that
+   order.
+1. Initialize vector with `0` or `false` **implicitly**.
+1. `constexpr` is used if possible.
+1. `const` is used if possible.
+1. `const auto` is used when we iterate through a `unordered_map` or `map`.
+1. Use `&` whenever possible except `int` and `char` because reference typically
+   takes 4 bytes, while `int` takes 2/4 bytes and `char` takes 1 byte.
 1. Prefer to name variables in a "adjective + noun" order. For example,
    `maxLeft` is better than `leftMax`.
 1. If a block is really small, for example, before a `bfs()` call, sometimes we
diff --git a/solutions/.DS_Store b/solutions/.DS_Store
deleted file mode 100644
index b04f01044d3..00000000000
Binary files a/solutions/.DS_Store and /dev/null differ
diff --git a/solutions/1. Two Sum/1.py b/solutions/1. Two Sum/1.py
index 68843bead4c..4544ba0753a 100644
--- a/solutions/1. Two Sum/1.py	
+++ b/solutions/1. Two Sum/1.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def twoSum(self, nums: list[int], target: int) -> list[int]:
+  def twoSum(self, nums: List[int], target: int) -> List[int]:
     numToIndex = {}
 
     for i, num in enumerate(nums):
diff --git a/solutions/100. Same Tree/100.py b/solutions/100. Same Tree/100.py
index e5760a2eed5..157630466bb 100644
--- a/solutions/100. Same Tree/100.py	
+++ b/solutions/100. Same Tree/100.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def isSameTree(self, p: TreeNode | None, q: TreeNode | None) -> bool:
+  def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool:
     if not p or not q:
       return p == q
-    return (p.val == q.val and
-            self.isSameTree(p.left, q.left) and
-            self.isSameTree(p.right, q.right))
+    return p.val == q.val and \
+        self.isSameTree(p.left, q.left) and \
+        self.isSameTree(p.right, q.right)
diff --git a/solutions/1000. Minimum Cost to Merge Stones/1000-2.java b/solutions/1000. Minimum Cost to Merge Stones/1000-2.java
index a31ddba4b97..4b772c120bf 100644
--- a/solutions/1000. Minimum Cost to Merge Stones/1000-2.java	
+++ b/solutions/1000. Minimum Cost to Merge Stones/1000-2.java	
@@ -4,10 +4,11 @@ public int mergeStones(int[] stones, int K) {
     if ((n - 1) % (K - 1) != 0)
       return -1;
 
-    final int MAX = 1_000_000_000;
+    final int kMax = 1_000_000_000;
     // dp[i][j][k] := the minimum cost to merge stones[i..j] into k piles
     int[][][] dp = new int[n][n][K + 1];
-    Arrays.stream(dp).forEach(A -> Arrays.stream(A).forEach(B -> Arrays.fill(B, MAX)));
+    for (int[][] A : dp)
+      Arrays.stream(A).forEach(a -> Arrays.fill(a, kMax));
     int[] prefix = new int[n + 1];
 
     for (int i = 0; i < n; ++i)
diff --git a/solutions/1000. Minimum Cost to Merge Stones/1000-3.java b/solutions/1000. Minimum Cost to Merge Stones/1000-3.java
index eba067e98cc..7c8d2e003e4 100644
--- a/solutions/1000. Minimum Cost to Merge Stones/1000-3.java	
+++ b/solutions/1000. Minimum Cost to Merge Stones/1000-3.java	
@@ -7,22 +7,22 @@ public int mergeStones(int[] stones, int k) {
     int[][] mem = new int[n][n];
     int[] prefix = new int[n + 1];
 
-    Arrays.stream(mem).forEach(A -> Arrays.fill(A, MAX));
+    Arrays.stream(mem).forEach(A -> Arrays.fill(A, kMax));
 
     for (int i = 0; i < n; ++i)
       prefix[i + 1] = prefix[i] + stones[i];
 
     final int cost = mergeStones(stones, 0, n - 1, k, prefix, mem);
-    return cost == MAX ? -1 : cost;
+    return cost == kMax ? -1 : cost;
   }
 
-  private static final int MAX = 1_000_000_000;
+  private static final int kMax = 1_000_000_000;
 
   // Returns the minimum cost to merge stones[i..j].
   private int mergeStones(final int[] stones, int i, int j, int k, int[] prefix, int[][] mem) {
     if (j - i + 1 < k)
       return 0;
-    if (mem[i][j] != MAX)
+    if (mem[i][j] != kMax)
       return mem[i][j];
 
     for (int m = i; m < j; m += k - 1)
diff --git a/solutions/1000. Minimum Cost to Merge Stones/1000-4.java b/solutions/1000. Minimum Cost to Merge Stones/1000-4.java
index 0bd511bc7c0..8561fc4bff9 100644
--- a/solutions/1000. Minimum Cost to Merge Stones/1000-4.java	
+++ b/solutions/1000. Minimum Cost to Merge Stones/1000-4.java	
@@ -4,11 +4,11 @@ public int mergeStones(int[] stones, int K) {
     if ((n - 1) % (K - 1) != 0)
       return -1;
 
-    final int MAX = 1_000_000_000;
+    final int kMax = 1_000_000_000;
 
     // dp[i][j] := the minimum cost to merge stones[i..j]
     int[][] dp = new int[n][n];
-    Arrays.stream(dp).forEach(A -> Arrays.fill(A, MAX));
+    Arrays.stream(dp).forEach(A -> Arrays.fill(A, kMax));
     int[] prefix = new int[n + 1];
 
     for (int i = 0; i < n; ++i)
diff --git a/solutions/1000. Minimum Cost to Merge Stones/1000.java b/solutions/1000. Minimum Cost to Merge Stones/1000.java
index 3d2464b33b2..d3e559d0305 100644
--- a/solutions/1000. Minimum Cost to Merge Stones/1000.java	
+++ b/solutions/1000. Minimum Cost to Merge Stones/1000.java	
@@ -4,25 +4,26 @@ public int mergeStones(int[] stones, int K) {
     int[][][] mem = new int[n][n][K + 1];
     int[] prefix = new int[n + 1];
 
-    Arrays.stream(mem).forEach(A -> Arrays.stream(A).forEach(B -> Arrays.fill(B, MAX)));
+    for (int[][] A : mem)
+      Arrays.stream(A).forEach(a -> Arrays.fill(a, kMax));
 
     for (int i = 0; i < n; ++i)
       prefix[i + 1] = prefix[i] + stones[i];
 
     final int cost = mergeStones(stones, 0, n - 1, 1, K, prefix, mem);
-    return cost == MAX ? -1 : cost;
+    return cost == kMax ? -1 : cost;
   }
 
-  private static final int MAX = 1_000_000_000;
+  private static final int kMax = 1_000_000_000;
 
   // Returns the minimum cost to merge stones[i..j] into k piles.
   private int mergeStones(final int[] stones, int i, int j, int k, int K, int[] prefix,
                           int[][][] mem) {
     if ((j - i + 1 - k) % (K - 1) != 0)
-      return MAX;
+      return kMax;
     if (i == j)
-      return k == 1 ? 0 : MAX;
-    if (mem[i][j][k] != MAX)
+      return k == 1 ? 0 : kMax;
+    if (mem[i][j][k] != kMax)
       return mem[i][j][k];
     if (k == 1)
       return mem[i][j][k] =
diff --git a/solutions/1001. Grid Illumination/1001.cpp b/solutions/1001. Grid Illumination/1001.cpp
index 888a06ef5e8..3a66c1ec833 100644
--- a/solutions/1001. Grid Illumination/1001.cpp	
+++ b/solutions/1001. Grid Illumination/1001.cpp	
@@ -9,9 +9,9 @@ class Solution {
     unordered_map<int, int> diag2;
     unordered_set<pair<int, int>, PairHash> lampsSet;
 
-    for (const vector<int>& lamp : lamps) {
-      const int i = lamp[0];
-      const int j = lamp[1];
+    for (vector<int>& lamp : lamps) {
+      int i = lamp[0];
+      int j = lamp[1];
       if (lampsSet.insert({i, j}).second) {
         ++rows[i];
         ++cols[j];
@@ -21,8 +21,8 @@ class Solution {
     }
 
     for (const vector<int>& query : queries) {
-      const int i = query[0];
-      const int j = query[1];
+      int i = query[0];
+      int j = query[1];
       if (rows[i] || cols[j] || diag1[i + j] || diag2[i - j]) {
         ans.push_back(1);
         for (int y = max(0, i - 1); y < min(n, i + 2); ++y)
diff --git a/solutions/1001. Grid Illumination/1001.py b/solutions/1001. Grid Illumination/1001.py
index 81c7e33be86..fbfe26ccaac 100644
--- a/solutions/1001. Grid Illumination/1001.py	
+++ b/solutions/1001. Grid Illumination/1001.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def gridIllumination(
-      self,
-      n: int,
-      lamps: list[list[int]],
-      queries: list[list[int]],
-  ) -> list[int]:
+  def gridIllumination(self, n: int, lamps: List[List[int]], queries: List[List[int]]) -> List[int]:
     ans = []
     rows = collections.Counter()
     cols = collections.Counter()
diff --git a/solutions/1002. Find Common Characters/1002.py b/solutions/1002. Find Common Characters/1002.py
index 29053a30f4c..3f9c549a874 100644
--- a/solutions/1002. Find Common Characters/1002.py	
+++ b/solutions/1002. Find Common Characters/1002.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def commonChars(self, words: list[str]) -> list[str]:
+  def commonChars(self, words: List[str]) -> List[str]:
     return functools.reduce(lambda a, b: a & b,
                             map(collections.Counter, words)).elements()
diff --git a/solutions/1004. Max Consecutive Ones III/1004.py b/solutions/1004. Max Consecutive Ones III/1004.py
index 37cc5efcb70..3aa427dc212 100644
--- a/solutions/1004. Max Consecutive Ones III/1004.py	
+++ b/solutions/1004. Max Consecutive Ones III/1004.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestOnes(self, nums: list[int], k: int) -> int:
+  def longestOnes(self, nums: List[int], k: int) -> int:
     ans = 0
 
     l = 0
diff --git a/solutions/1005. Maximize Sum Of Array After K Negations/1005.py b/solutions/1005. Maximize Sum Of Array After K Negations/1005.py
index aef4ac5459a..b9d740d444a 100644
--- a/solutions/1005. Maximize Sum Of Array After K Negations/1005.py	
+++ b/solutions/1005. Maximize Sum Of Array After K Negations/1005.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestSumAfterKNegations(self, nums: list[int], k: int) -> int:
+  def largestSumAfterKNegations(self, nums: List[int], k: int) -> int:
     nums.sort()
 
     for i, num in enumerate(nums):
diff --git a/solutions/1007. Minimum Domino Rotations For Equal Row/1007.py b/solutions/1007. Minimum Domino Rotations For Equal Row/1007.py
index 9d067db2edc..4b44b265450 100644
--- a/solutions/1007. Minimum Domino Rotations For Equal Row/1007.py	
+++ b/solutions/1007. Minimum Domino Rotations For Equal Row/1007.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minDominoRotations(self, tops: list[int], bottoms: list[int]) -> int:
+  def minDominoRotations(self, tops: List[int], bottoms: List[int]) -> int:
     for num in range(1, 7):
       if all(num in pair for pair in zip(tops, bottoms)):
         return len(tops) - max(tops.count(num), bottoms.count(num))
diff --git a/solutions/1008. Construct Binary Search Tree from Preorder Traversal/1008.java b/solutions/1008. Construct Binary Search Tree from Preorder Traversal/1008.java
index ec5b177457f..50c6972d3dd 100644
--- a/solutions/1008. Construct Binary Search Tree from Preorder Traversal/1008.java	
+++ b/solutions/1008. Construct Binary Search Tree from Preorder Traversal/1008.java	
@@ -1,7 +1,7 @@
 class Solution {
   public TreeNode bstFromPreorder(int[] preorder) {
     TreeNode root = new TreeNode(preorder[0]);
-    Deque<TreeNode> stack = new ArrayDeque<>(List.of(root));
+    Deque<TreeNode> stack = new ArrayDeque<>(Arrays.asList(root));
 
     for (int i = 1; i < preorder.length; ++i) {
       TreeNode parent = stack.peek();
diff --git a/solutions/1008. Construct Binary Search Tree from Preorder Traversal/1008.py b/solutions/1008. Construct Binary Search Tree from Preorder Traversal/1008.py
index f95b38133c5..766437a3806 100644
--- a/solutions/1008. Construct Binary Search Tree from Preorder Traversal/1008.py	
+++ b/solutions/1008. Construct Binary Search Tree from Preorder Traversal/1008.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def bstFromPreorder(self, preorder: list[int]) -> TreeNode | None:
+  def bstFromPreorder(self, preorder: List[int]) -> Optional[TreeNode]:
     root = TreeNode(preorder[0])
     stack = [root]
 
diff --git a/solutions/101. Symmetric Tree/101.py b/solutions/101. Symmetric Tree/101.py
index 3960dad9f06..9d92fa66278 100644
--- a/solutions/101. Symmetric Tree/101.py	
+++ b/solutions/101. Symmetric Tree/101.py	
@@ -1,10 +1,11 @@
 class Solution:
-  def isSymmetric(self, root: TreeNode | None) -> bool:
-    def isSymmetric(p: TreeNode | None, q: TreeNode | None) -> bool:
+  def isSymmetric(self, root: Optional[TreeNode]) -> bool:
+    def isSymmetric(p: Optional[TreeNode], q: Optional[TreeNode]) -> bool:
       if not p or not q:
         return p == q
-      return (p.val == q.val and
-              isSymmetric(p.left, q.right) and
-              isSymmetric(p.right, q.left))
+
+      return p.val == q.val and \
+          isSymmetric(p.left, q.right) and \
+          isSymmetric(p.right, q.left)
 
     return isSymmetric(root, root)
diff --git a/solutions/1010. Pairs of Songs With Total Durations Divisible by 60/1010.py b/solutions/1010. Pairs of Songs With Total Durations Divisible by 60/1010.py
index 4eb0805aa3d..b53c41434ff 100644
--- a/solutions/1010. Pairs of Songs With Total Durations Divisible by 60/1010.py	
+++ b/solutions/1010. Pairs of Songs With Total Durations Divisible by 60/1010.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numPairsDivisibleBy60(self, time: list[int]) -> int:
+  def numPairsDivisibleBy60(self, time: List[int]) -> int:
     ans = 0
     count = [0] * 60
 
diff --git a/solutions/1011. Capacity To Ship Packages Within D Days/1011.py b/solutions/1011. Capacity To Ship Packages Within D Days/1011.py
index b8c531d1ee9..c14932dd758 100644
--- a/solutions/1011. Capacity To Ship Packages Within D Days/1011.py	
+++ b/solutions/1011. Capacity To Ship Packages Within D Days/1011.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def shipWithinDays(self, weights: list[int], days: int) -> int:
-    def shipDays(shipCapacity: int) -> int:
+  def shipWithinDays(self, weights: List[int], days: int) -> int:
+    def canShip(shipCapacity: int) -> bool:
       shipDays = 1
       capacity = 0
       for weight in weights:
@@ -9,9 +9,9 @@ def shipDays(shipCapacity: int) -> int:
           capacity = weight
         else:
           capacity += weight
-      return shipDays
+      return shipDays <= days
 
     l = max(weights)
     r = sum(weights)
     return bisect.bisect_left(range(l, r), True,
-                              key=lambda m: shipDays(m) <= days) + l
+                              key=lambda m: canShip(m)) + l
diff --git a/solutions/1012. Numbers With Repeated Digits/1012.cpp b/solutions/1012. Numbers With Repeated Digits/1012.cpp
index 411cf98822a..b7dc0860bcc 100644
--- a/solutions/1012. Numbers With Repeated Digits/1012.cpp	
+++ b/solutions/1012. Numbers With Repeated Digits/1012.cpp	
@@ -15,30 +15,30 @@ class Solution {
 
  private:
   // Returns the number of special integers, considering the i-th digit, where
-  // `used` is the bitmask of the used digits, and `tight` indicates if the
+  // `used` is the bitmask of the used digits, and `isTight` indicates if the
   // current digit is tightly bound.
-  int count(const string& s, int i, int used, bool tight,
+  int count(const string& s, int i, int used, bool isTight,
             vector<vector<vector<int>>>& mem) {
     if (i == s.length())
       return 1;
-    if (mem[i][used][tight] != -1)
-      return mem[i][used][tight];
+    if (mem[i][used][isTight] != -1)
+      return mem[i][used][isTight];
 
     int res = 0;
-    const int maxDigit = tight ? s[i] - '0' : 9;
 
+    const int maxDigit = isTight ? s[i] - '0' : 9;
     for (int d = 0; d <= maxDigit; ++d) {
       // `d` is used.
       if (used >> d & 1)
         continue;
       // Use `d` now.
-      const bool nextTight = tight && (d == maxDigit);
+      const bool nextIsTight = isTight && (d == maxDigit);
       if (used == 0 && d == 0)  // Don't count leading 0s as used.
-        res += count(s, i + 1, used, nextTight, mem);
+        res += count(s, i + 1, used, nextIsTight, mem);
       else
-        res += count(s, i + 1, used | 1 << d, nextTight, mem);
+        res += count(s, i + 1, used | 1 << d, nextIsTight, mem);
     }
 
-    return mem[i][used][tight] = res;
+    return mem[i][used][isTight] = res;
   }
 };
diff --git a/solutions/1012. Numbers With Repeated Digits/1012.java b/solutions/1012. Numbers With Repeated Digits/1012.java
index 6f20d510d6e..0877b2b9839 100644
--- a/solutions/1012. Numbers With Repeated Digits/1012.java	
+++ b/solutions/1012. Numbers With Repeated Digits/1012.java	
@@ -11,29 +11,29 @@ private int countSpecialNumbers(int n) {
   }
 
   // Returns the number of special integers, considering the i-th digit, where
-  // `used` is the bitmask of the used digits, and `tight` indicates if the
+  // `used` is the bitmask of the used digits, and `isTight` indicates if the
   // current digit is tightly bound.
-  private int count(final String s, int i, int used, boolean tight, Integer[][][] mem) {
+  private int count(final String s, int i, int used, boolean isTight, Integer[][][] mem) {
     if (i == s.length())
       return 1;
-    if (mem[i][used][tight ? 1 : 0] != null)
-      return mem[i][used][tight ? 1 : 0];
+    if (mem[i][used][isTight ? 1 : 0] != null)
+      return mem[i][used][isTight ? 1 : 0];
 
     int res = 0;
-    final int maxDigit = tight ? s.charAt(i) - '0' : 9;
 
+    final int maxDigit = isTight ? s.charAt(i) - '0' : 9;
     for (int d = 0; d <= maxDigit; ++d) {
       // `d` is used.
       if ((used >> d & 1) == 1)
         continue;
       // Use `d` now.
-      final boolean nextTight = tight && (d == maxDigit);
+      final boolean nextIsTight = isTight && (d == maxDigit);
       if (used == 0 && d == 0) // Don't count leading 0s as used.
-        res += count(s, i + 1, used, nextTight, mem);
+        res += count(s, i + 1, used, nextIsTight, mem);
       else
-        res += count(s, i + 1, used | 1 << d, nextTight, mem);
+        res += count(s, i + 1, used | 1 << d, nextIsTight, mem);
     }
 
-    return mem[i][used][tight ? 1 : 0] = res;
+    return mem[i][used][isTight ? 1 : 0] = res;
   }
 }
diff --git a/solutions/1012. Numbers With Repeated Digits/1012.py b/solutions/1012. Numbers With Repeated Digits/1012.py
index a8f7d2d5816..70717a5d3df 100644
--- a/solutions/1012. Numbers With Repeated Digits/1012.py	
+++ b/solutions/1012. Numbers With Repeated Digits/1012.py	
@@ -7,28 +7,28 @@ def _countSpecialNumbers(self, n: int) -> int:
     s = str(n)
 
     @functools.lru_cache(None)
-    def dp(i: int, used: int, tight: bool) -> int:
+    def dp(i: int, used: int, isTight: bool) -> int:
       """
       Returns the number of special integers, considering the i-th digit, where
-      `used` is the bitmask of the used digits, and `tight` indicates if the
+      `used` is the bitmask of the used digits, and `isTight` indicates if the
       current digit is tightly bound.
       """
       if i == len(s):
         return 1
 
       res = 0
-      maxDigit = int(s[i]) if tight else 9
 
+      maxDigit = int(s[i]) if isTight else 9
       for d in range(maxDigit + 1):
         # `d` is used.
         if used >> d & 1:
           continue
         # Use `d` now.
-        nextTight = tight and (d == maxDigit)
+        nextIsTight = isTight and (d == maxDigit)
         if used == 0 and d == 0:  # Don't count leading 0s as used.
-          res += dp(i + 1, used, nextTight)
+          res += dp(i + 1, used, nextIsTight)
         else:
-          res += dp(i + 1, used | 1 << d, nextTight)
+          res += dp(i + 1, used | 1 << d, nextIsTight)
 
       return res
 
diff --git a/solutions/1013. Partition Array Into Three Parts With Equal Sum/1013.py b/solutions/1013. Partition Array Into Three Parts With Equal Sum/1013.py
index fe44b8f5341..97136ec0a4b 100644
--- a/solutions/1013. Partition Array Into Three Parts With Equal Sum/1013.py	
+++ b/solutions/1013. Partition Array Into Three Parts With Equal Sum/1013.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canThreePartsEqualSum(self, arr: list[int]) -> bool:
+  def canThreePartsEqualSum(self, arr: List[int]) -> bool:
     summ = sum(arr)
     if summ % 3 != 0:
       return False
diff --git a/solutions/1014. Best Sightseeing Pair/1014.py b/solutions/1014. Best Sightseeing Pair/1014.py
index 33e4b6fd050..5e94ad14073 100644
--- a/solutions/1014. Best Sightseeing Pair/1014.py	
+++ b/solutions/1014. Best Sightseeing Pair/1014.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxScoreSightseeingPair(self, values: list[int]) -> int:
+  def maxScoreSightseeingPair(self, values: List[int]) -> int:
     ans = 0
     bestPrev = 0
 
diff --git a/solutions/1018. Binary Prefix Divisible By 5/1018.py b/solutions/1018. Binary Prefix Divisible By 5/1018.py
index e0401f681ab..e7af7ea538b 100644
--- a/solutions/1018. Binary Prefix Divisible By 5/1018.py	
+++ b/solutions/1018. Binary Prefix Divisible By 5/1018.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def prefixesDivBy5(self, nums: list[int]) -> list[bool]:
+  def prefixesDivBy5(self, nums: List[int]) -> List[bool]:
     ans = []
     curr = 0
 
diff --git a/solutions/1019. Next Greater Node In Linked List/1019.py b/solutions/1019. Next Greater Node In Linked List/1019.py
index 41d556921c6..2b2a9fb0fc6 100644
--- a/solutions/1019. Next Greater Node In Linked List/1019.py	
+++ b/solutions/1019. Next Greater Node In Linked List/1019.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def nextLargerNodes(self, head: ListNode) -> list[int]:
+  def nextLargerNodes(self, head: ListNode) -> List[int]:
     ans = []
     stack = []
 
diff --git a/solutions/102. Binary Tree Level Order Traversal/102.java b/solutions/102. Binary Tree Level Order Traversal/102.java
index 4e2641f23e2..08903d5ca84 100644
--- a/solutions/102. Binary Tree Level Order Traversal/102.java	
+++ b/solutions/102. Binary Tree Level Order Traversal/102.java	
@@ -4,7 +4,7 @@ public List<List<Integer>> levelOrder(TreeNode root) {
       return new ArrayList<>();
 
     List<List<Integer>> ans = new ArrayList<>();
-    Queue<TreeNode> q = new ArrayDeque<>(List.of(root));
+    Queue<TreeNode> q = new ArrayDeque<>(Arrays.asList(root));
 
     while (!q.isEmpty()) {
       List<Integer> currLevel = new ArrayList<>();
diff --git a/solutions/102. Binary Tree Level Order Traversal/102.py b/solutions/102. Binary Tree Level Order Traversal/102.py
index a5da85bff09..e7efbc0b093 100644
--- a/solutions/102. Binary Tree Level Order Traversal/102.py	
+++ b/solutions/102. Binary Tree Level Order Traversal/102.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def levelOrder(self, root: TreeNode | None) -> list[list[int]]:
+  def levelOrder(self, root: Optional[TreeNode]) -> List[List[int]]:
     if not root:
       return []
 
diff --git a/solutions/1020. Number of Enclaves/1020.cpp b/solutions/1020. Number of Enclaves/1020.cpp
index 60e801ec9c3..c823a370532 100644
--- a/solutions/1020. Number of Enclaves/1020.cpp	
+++ b/solutions/1020. Number of Enclaves/1020.cpp	
@@ -12,8 +12,8 @@ class Solution {
             dfs(grid, i, j);
 
     return accumulate(grid.begin(), grid.end(), 0,
-                      [](int acc, const vector<int>& row) {
-      return acc + ranges::count(row, 1);
+                      [](int subtotal, vector<int>& row) {
+      return subtotal + accumulate(row.begin(), row.end(), 0);
     });
   }
 
diff --git a/solutions/1022. Sum of Root To Leaf Binary Numbers/1022.py b/solutions/1022. Sum of Root To Leaf Binary Numbers/1022.py
index 71dcdfc22d2..25d34027885 100644
--- a/solutions/1022. Sum of Root To Leaf Binary Numbers/1022.py	
+++ b/solutions/1022. Sum of Root To Leaf Binary Numbers/1022.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def sumRootToLeaf(self, root: TreeNode | None) -> int:
+  def sumRootToLeaf(self, root: Optional[TreeNode]) -> int:
     ans = 0
 
-    def dfs(root: TreeNode | None, val: int) -> None:
+    def dfs(root: Optional[TreeNode], val: int) -> None:
       nonlocal ans
       if not root:
         return
diff --git a/solutions/1023. Camelcase Matching/1023.java b/solutions/1023. Camelcase Matching/1023.java
index 48ec2e1920c..896007bdfb8 100644
--- a/solutions/1023. Camelcase Matching/1023.java	
+++ b/solutions/1023. Camelcase Matching/1023.java	
@@ -1,8 +1,8 @@
 class Solution {
   public List<Boolean> camelMatch(String[] queries, String pattern) {
     List<Boolean> ans = new ArrayList<>();
-    for (final String query : queries)
-      ans.add(isMatch(query, pattern));
+    for (final String q : queries)
+      ans.add(isMatch(q, pattern));
     return ans;
   }
 
diff --git a/solutions/1023. Camelcase Matching/1023.py b/solutions/1023. Camelcase Matching/1023.py
index a419a4717f8..d30fc5273d6 100644
--- a/solutions/1023. Camelcase Matching/1023.py	
+++ b/solutions/1023. Camelcase Matching/1023.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def camelMatch(self, queries: list[str], pattern: str) -> list[bool]:
+  def camelMatch(self, queries: List[str], pattern: str) -> List[bool]:
     def isMatch(query: str) -> bool:
       j = 0
       for c in query:
diff --git a/solutions/1024. Video Stitching/1024.cpp b/solutions/1024. Video Stitching/1024.cpp
index 39404ff3de3..3f0fa40418a 100644
--- a/solutions/1024. Video Stitching/1024.cpp	
+++ b/solutions/1024. Video Stitching/1024.cpp	
@@ -5,7 +5,7 @@ class Solution {
     int end = 0;
     int farthest = 0;
 
-    ranges::sort(clips);
+    sort(std::clips.begin(), std::end(clips));
 
     int i = 0;
     while (farthest < time) {
diff --git a/solutions/1024. Video Stitching/1024.java b/solutions/1024. Video Stitching/1024.java
index b8127350c99..833c49d8e32 100644
--- a/solutions/1024. Video Stitching/1024.java	
+++ b/solutions/1024. Video Stitching/1024.java	
@@ -4,7 +4,7 @@ public int videoStitching(int[][] clips, int time) {
     int end = 0;
     int farthest = 0;
 
-    Arrays.sort(clips, Comparator.comparingInt(clip -> clip[0]));
+    Arrays.sort(clips, (a, b) -> a[0] - b[0]);
 
     int i = 0;
     while (farthest < time) {
diff --git a/solutions/1024. Video Stitching/1024.py b/solutions/1024. Video Stitching/1024.py
index 79ed755be78..36393638541 100644
--- a/solutions/1024. Video Stitching/1024.py	
+++ b/solutions/1024. Video Stitching/1024.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def videoStitching(self, clips: list[list[int]], time: int) -> int:
+  def videoStitching(self, clips: List[List[int]], time: int) -> int:
     ans = 0
     end = 0
     farthest = 0
diff --git a/solutions/1027. Longest Arithmetic Subsequence/1027.py b/solutions/1027. Longest Arithmetic Subsequence/1027.py
index e6a3c49b39e..4ea42217d1d 100644
--- a/solutions/1027. Longest Arithmetic Subsequence/1027.py	
+++ b/solutions/1027. Longest Arithmetic Subsequence/1027.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestArithSeqLength(self, nums: list[int]) -> int:
+  def longestArithSeqLength(self, nums: List[int]) -> int:
     n = len(nums)
     ans = 0
     # dp[i][k] := the length of the longest arithmetic subsequence of nums[0..i]
diff --git a/solutions/1028. Recover a Tree From Preorder Traversal/1028.py b/solutions/1028. Recover a Tree From Preorder Traversal/1028.py
index 15c9620a692..17623fff395 100644
--- a/solutions/1028. Recover a Tree From Preorder Traversal/1028.py	
+++ b/solutions/1028. Recover a Tree From Preorder Traversal/1028.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def recoverFromPreorder(self, traversal: str) -> TreeNode | None:
+  def recoverFromPreorder(self, traversal: str) -> Optional[TreeNode]:
     i = 0
 
-    def recoverFromPreorder(depth: int) -> TreeNode | None:
+    def recoverFromPreorder(depth: int) -> Optional[TreeNode]:
       nonlocal i
       nDashes = 0
       while i + nDashes < len(traversal) and traversal[i + nDashes] == '-':
diff --git a/solutions/1029. Two City Scheduling/1029.cpp b/solutions/1029. Two City Scheduling/1029.cpp
index 7d3cedfddac..32b05626d24 100644
--- a/solutions/1029. Two City Scheduling/1029.cpp	
+++ b/solutions/1029. Two City Scheduling/1029.cpp	
@@ -8,11 +8,11 @@ class Solution {
     // To save money, we should
     //   1. Fly the person with the maximum saving to A.
     //   2. Fly the person with the minimum saving to B.
-
-    // Sort `costs` in ascending order by the money saved if we fly a person to
-    // B instead of A.
-    ranges::sort(costs, ranges::less{},
-                 [](const vector<int>& cost) { return cost[0] - cost[1]; });
+    ranges::sort(costs, [](const vector<int>& a, const vector<int>& b) {
+      // Sort `costs` in descending order by the money saved if we fly a person
+      // to A instead of B.
+      return a[1] - a[0] > b[1] - b[0];
+    });
 
     for (int i = 0; i < n; ++i)
       ans += costs[i][0] + costs[i + n][1];
diff --git a/solutions/1029. Two City Scheduling/1029.java b/solutions/1029. Two City Scheduling/1029.java
index 40eb24898b5..99634dab9af 100644
--- a/solutions/1029. Two City Scheduling/1029.java	
+++ b/solutions/1029. Two City Scheduling/1029.java	
@@ -8,9 +8,9 @@ public int twoCitySchedCost(int[][] costs) {
     //   1. Fly the person with the maximum saving to A.
     //   2. Fly the person with the minimum saving to B.
 
-    // Sort `costs` in ascending order by the money saved if we fly a person to
-    // B instead of A.
-    Arrays.sort(costs, Comparator.comparingInt(cost -> cost[0] - cost[1]));
+    // Sort `costs` in descending order by the money saved if we fly a person to
+    // A instead of B.
+    Arrays.sort(costs, (a, b) -> (b[1] - b[0]) - (a[1] - a[0]));
 
     for (int i = 0; i < n; ++i)
       ans += costs[i][0] + costs[i + n][1];
diff --git a/solutions/1029. Two City Scheduling/1029.py b/solutions/1029. Two City Scheduling/1029.py
index f1bddbcaffd..7e313555b1e 100644
--- a/solutions/1029. Two City Scheduling/1029.py	
+++ b/solutions/1029. Two City Scheduling/1029.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def twoCitySchedCost(self, costs: list[list[int]]) -> int:
+  def twoCitySchedCost(self, costs: List[List[int]]) -> int:
     n = len(costs) // 2
 
     # How much money can we save if we fly a person to A instead of B?
@@ -7,7 +7,7 @@ def twoCitySchedCost(self, costs: list[list[int]]) -> int:
     #   1. Fly the person with the maximum saving to A.
     #   2. Fly the person with the minimum saving to B.
 
-    # Sort `costs` in ascending order by the money saved if we fly a person to
-    # B instead of A.
+    # Sort `costs` in descending order by the money saved if we fly a person
+    # to A instead of B.
     costs.sort(key=lambda x: x[0] - x[1])
     return sum(costs[i][0] + costs[i + n][1] for i in range(n))
diff --git a/solutions/103. Binary Tree Zigzag Level Order Traversal/103-2.java b/solutions/103. Binary Tree Zigzag Level Order Traversal/103-2.java
index 7a43e00f52c..87c39bfe609 100644
--- a/solutions/103. Binary Tree Zigzag Level Order Traversal/103-2.java	
+++ b/solutions/103. Binary Tree Zigzag Level Order Traversal/103-2.java	
@@ -4,7 +4,7 @@ public List<List<Integer>> zigzagLevelOrder(TreeNode root) {
       return new ArrayList<>();
 
     List<List<Integer>> ans = new ArrayList<>();
-    Deque<TreeNode> q = new ArrayDeque<>(List.of(root));
+    Deque<TreeNode> q = new ArrayDeque<>(Arrays.asList(root));
     boolean isLeftToRight = true;
 
     while (!q.isEmpty()) {
diff --git a/solutions/103. Binary Tree Zigzag Level Order Traversal/103-2.py b/solutions/103. Binary Tree Zigzag Level Order Traversal/103-2.py
index ce2d869b6ec..6ff7f47248d 100644
--- a/solutions/103. Binary Tree Zigzag Level Order Traversal/103-2.py	
+++ b/solutions/103. Binary Tree Zigzag Level Order Traversal/103-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def zigzagLevelOrder(self, root: TreeNode | None) -> list[list[int]]:
+  def zigzagLevelOrder(self, root: Optional[TreeNode]) -> List[List[int]]:
     if not root:
       return []
 
diff --git a/solutions/103. Binary Tree Zigzag Level Order Traversal/103.java b/solutions/103. Binary Tree Zigzag Level Order Traversal/103.java
index 694625436ef..ac25ae136f4 100644
--- a/solutions/103. Binary Tree Zigzag Level Order Traversal/103.java	
+++ b/solutions/103. Binary Tree Zigzag Level Order Traversal/103.java	
@@ -4,7 +4,7 @@ public List<List<Integer>> zigzagLevelOrder(TreeNode root) {
       return new ArrayList<>();
 
     List<List<Integer>> ans = new ArrayList<>();
-    Deque<TreeNode> dq = new ArrayDeque<>(List.of(root));
+    Deque<TreeNode> dq = new ArrayDeque<>(Arrays.asList(root));
     boolean isLeftToRight = true;
 
     while (!dq.isEmpty()) {
@@ -14,16 +14,16 @@ public List<List<Integer>> zigzagLevelOrder(TreeNode root) {
           TreeNode node = dq.pollFirst();
           currLevel.add(node.val);
           if (node.left != null)
-            dq.offerLast(node.left);
+            dq.addLast(node.left);
           if (node.right != null)
-            dq.offerLast(node.right);
+            dq.addLast(node.right);
         } else {
           TreeNode node = dq.pollLast();
           currLevel.add(node.val);
           if (node.right != null)
-            dq.offerFirst(node.right);
+            dq.addFirst(node.right);
           if (node.left != null)
-            dq.offerFirst(node.left);
+            dq.addFirst(node.left);
         }
       ans.add(currLevel);
       isLeftToRight = !isLeftToRight;
diff --git a/solutions/103. Binary Tree Zigzag Level Order Traversal/103.py b/solutions/103. Binary Tree Zigzag Level Order Traversal/103.py
index cc266f993b3..0a3cf3e4fb5 100644
--- a/solutions/103. Binary Tree Zigzag Level Order Traversal/103.py	
+++ b/solutions/103. Binary Tree Zigzag Level Order Traversal/103.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def zigzagLevelOrder(self, root: TreeNode | None) -> list[list[int]]:
+  def zigzagLevelOrder(self, root: Optional[TreeNode]) -> List[List[int]]:
     if not root:
       return []
 
diff --git a/solutions/1030. Matrix Cells in Distance Order/1030.cpp b/solutions/1030. Matrix Cells in Distance Order/1030.cpp
index 6973206351d..b8cefed67cf 100644
--- a/solutions/1030. Matrix Cells in Distance Order/1030.cpp	
+++ b/solutions/1030. Matrix Cells in Distance Order/1030.cpp	
@@ -2,7 +2,7 @@ class Solution {
  public:
   vector<vector<int>> allCellsDistOrder(int rows, int cols, int rCenter,
                                         int cCenter) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     vector<vector<int>> ans;
     vector<vector<int>> seen(rows, vector<int>(cols));
     queue<pair<int, int>> q{{{rCenter, cCenter}}};
@@ -12,7 +12,7 @@ class Solution {
       const auto [i, j] = q.front();
       q.pop();
       ans.push_back({i, j});
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == rows || y < 0 || y == cols)
diff --git a/solutions/1030. Matrix Cells in Distance Order/1030.java b/solutions/1030. Matrix Cells in Distance Order/1030.java
index 37c1b54e91c..3b7585e0dc7 100644
--- a/solutions/1030. Matrix Cells in Distance Order/1030.java	
+++ b/solutions/1030. Matrix Cells in Distance Order/1030.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int[][] allCellsDistOrder(int rows, int cols, int rCenter, int cCenter) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     List<int[]> ans = new ArrayList<>();
     boolean[][] seen = new boolean[rows][cols];
     Queue<Pair<Integer, Integer>> q = new LinkedList<>(Arrays.asList(new Pair<>(rCenter, cCenter)));
@@ -10,7 +10,7 @@ public int[][] allCellsDistOrder(int rows, int cols, int rCenter, int cCenter) {
       final int i = q.peek().getKey();
       final int j = q.poll().getValue();
       ans.add(new int[] {i, j});
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == rows || y < 0 || y == cols)
diff --git a/solutions/1030. Matrix Cells in Distance Order/1030.py b/solutions/1030. Matrix Cells in Distance Order/1030.py
index 96abe1dba24..184392ef3a7 100644
--- a/solutions/1030. Matrix Cells in Distance Order/1030.py	
+++ b/solutions/1030. Matrix Cells in Distance Order/1030.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def allCellsDistOrder(self, rows: int, cols: int, rCenter: int, cCenter: int) -> list[list[int]]:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def allCellsDistOrder(self, rows: int, cols: int, rCenter: int, cCenter: int) -> List[List[int]]:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     ans = []
     q = collections.deque([(rCenter, cCenter)])
     seen = {(rCenter, cCenter)}
@@ -8,7 +8,7 @@ def allCellsDistOrder(self, rows: int, cols: int, rCenter: int, cCenter: int) ->
     while q:
       i, j = q.popleft()
       ans.append([i, j])
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == rows or y < 0 or y == cols:
diff --git a/solutions/1031. Maximum Sum of Two Non-Overlapping Subarrays/1031.cpp b/solutions/1031. Maximum Sum of Two Non-Overlapping Subarrays/1031.cpp
index 4b3791f30c4..e385c61e9e8 100644
--- a/solutions/1031. Maximum Sum of Two Non-Overlapping Subarrays/1031.cpp	
+++ b/solutions/1031. Maximum Sum of Two Non-Overlapping Subarrays/1031.cpp	
@@ -6,15 +6,15 @@ class Solution {
   }
 
  private:
-  int helper(vector<int>& nums, int l, int r) {
-    const int n = nums.size();
+  int helper(vector<int>& A, int l, int r) {
+    const int n = A.size();
     vector<int> left(n);
     int sum = 0;
 
     for (int i = 0; i < n; ++i) {
-      sum += nums[i];
+      sum += A[i];
       if (i >= l)
-        sum -= nums[i - l];
+        sum -= A[i - l];
       if (i >= l - 1)
         left[i] = i > 0 ? max(left[i - 1], sum) : sum;
     }
@@ -23,9 +23,9 @@ class Solution {
     sum = 0;
 
     for (int i = n - 1; i >= 0; --i) {
-      sum += nums[i];
+      sum += A[i];
       if (i <= n - r - 1)
-        sum -= nums[i + r];
+        sum -= A[i + r];
       if (i <= n - r)
         right[i] = i < n - 1 ? max(right[i + 1], sum) : sum;
     }
diff --git a/solutions/1031. Maximum Sum of Two Non-Overlapping Subarrays/1031.java b/solutions/1031. Maximum Sum of Two Non-Overlapping Subarrays/1031.java
index 2c0f679fbc6..a24082facfb 100644
--- a/solutions/1031. Maximum Sum of Two Non-Overlapping Subarrays/1031.java	
+++ b/solutions/1031. Maximum Sum of Two Non-Overlapping Subarrays/1031.java	
@@ -3,15 +3,15 @@ public int maxSumTwoNoOverlap(int[] nums, int firstLen, int secondLen) {
     return Math.max(helper(nums, firstLen, secondLen), helper(nums, secondLen, firstLen));
   }
 
-  private int helper(int[] nums, int l, int r) {
-    final int n = nums.length;
+  private int helper(int[] A, int l, int r) {
+    final int n = A.length;
     int[] left = new int[n];
     int sum = 0;
 
     for (int i = 0; i < n; ++i) {
-      sum += nums[i];
+      sum += A[i];
       if (i >= l)
-        sum -= nums[i - l];
+        sum -= A[i - l];
       if (i >= l - 1)
         left[i] = i > 0 ? Math.max(left[i - 1], sum) : sum;
     }
@@ -20,9 +20,9 @@ private int helper(int[] nums, int l, int r) {
     sum = 0;
 
     for (int i = n - 1; i >= 0; --i) {
-      sum += nums[i];
+      sum += A[i];
       if (i <= n - r - 1)
-        sum -= nums[i + r];
+        sum -= A[i + r];
       if (i <= n - r)
         right[i] = i < n - 1 ? Math.max(right[i + 1], sum) : sum;
     }
diff --git a/solutions/1031. Maximum Sum of Two Non-Overlapping Subarrays/1031.py b/solutions/1031. Maximum Sum of Two Non-Overlapping Subarrays/1031.py
index 4cc6ca96c08..fa5ea1a7103 100644
--- a/solutions/1031. Maximum Sum of Two Non-Overlapping Subarrays/1031.py	
+++ b/solutions/1031. Maximum Sum of Two Non-Overlapping Subarrays/1031.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def maxSumTwoNoOverlap(
-      self,
-      nums: list[int],
-      firstLen: int,
-      secondLen: int,
-  ) -> int:
+  def maxSumTwoNoOverlap(self, nums: List[int], firstLen: int, secondLen: int) -> int:
     def helper(l: int, r: int) -> int:
       n = len(nums)
       left = [0] * n
diff --git a/solutions/1032. Stream of Characters/1032.py b/solutions/1032. Stream of Characters/1032.py
index 9698f997f21..ac85e2f3394 100644
--- a/solutions/1032. Stream of Characters/1032.py	
+++ b/solutions/1032. Stream of Characters/1032.py	
@@ -1,13 +1,14 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
     self.isWord = False
 
 
 class StreamChecker:
-  def __init__(self, words: list[str]):
+  def __init__(self, words: List[str]):
     self.root = TrieNode()
     self.letters = []
+
     for word in words:
       self._insert(word)
 
diff --git a/solutions/1033. Moving Stones Until Consecutive/1033.py b/solutions/1033. Moving Stones Until Consecutive/1033.py
index c0908e5163a..7a13f75e200 100644
--- a/solutions/1033. Moving Stones Until Consecutive/1033.py	
+++ b/solutions/1033. Moving Stones Until Consecutive/1033.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numMovesStones(self, a: int, b: int, c: int) -> list[int]:
+  def numMovesStones(self, a: int, b: int, c: int) -> List[int]:
     nums = sorted([a, b, c])
 
     if nums[2] - nums[0] == 2:
diff --git a/solutions/1034. Coloring A Border/1034.py b/solutions/1034. Coloring A Border/1034.py
index 977f3ad5a83..921ce37e229 100644
--- a/solutions/1034. Coloring A Border/1034.py	
+++ b/solutions/1034. Coloring A Border/1034.py	
@@ -1,38 +1,27 @@
 class Solution:
-  def colorBorder(
-      self,
-      grid: list[list[int]],
-      r0: int,
-      c0: int,
-      color: int
-  ) -> list[list[int]]:
-    def dfs(i: int, j: int, startColor: int) -> None:
-      if i < 0 or i == len(grid) or j < 0 or j == len(grid[0]):
+  def colorBorder(self, grid: List[List[int]], r0: int, c0: int, color: int) -> List[List[int]]:
+    def dfs(i: int, j: int, originalColor: int) -> None:
+      if not 0 <= i < len(grid) or not 0 <= j < len(grid[0]) or grid[i][j] != originalColor:
         return
-      if grid[i][j] != startColor:
-        return
-
-      grid[i][j] = -startColor
-      dfs(i + 1, j, startColor)
-      dfs(i - 1, j, startColor)
-      dfs(i, j + 1, startColor)
-      dfs(i, j - 1, startColor)
 
-      # If this cell is already on the boarder, it must be painted later.
-      if i == 0 or i == len(grid) - 1 or j == 0 or j == len(grid[0]) - 1:
-        return
+      grid[i][j] = -originalColor
+      dfs(i + 1, j, originalColor)
+      dfs(i - 1, j, originalColor)
+      dfs(i, j + 1, originalColor)
+      dfs(i, j - 1, originalColor)
 
-      if (abs(grid[i + 1][j]) == startColor and
-          abs(grid[i - 1][j]) == startColor and
-          abs(grid[i][j + 1]) == startColor and
-              abs(grid[i][j - 1]) == startColor):
-        grid[i][j] = startColor
+      if 0 < i < len(grid) - 1 and 0 < j < len(grid[0]) - 1 and \
+              abs(grid[i + 1][j]) == originalColor and \
+              abs(grid[i - 1][j]) == originalColor and \
+              abs(grid[i][j + 1]) == originalColor and \
+              abs(grid[i][j - 1]) == originalColor:
+        grid[i][j] = originalColor
 
     dfs(r0, c0, grid[r0][c0])
 
-    for i, row in enumerate(grid):
-      for j, num in enumerate(row):
-        if num < 0:
+    for i in range(len(grid)):
+      for j in range(len(grid[0])):
+        if grid[i][j] < 0:
           grid[i][j] = color
 
     return grid
diff --git a/solutions/1035. Uncrossed Lines/1035.py b/solutions/1035. Uncrossed Lines/1035.py
index 3127cf3f518..37cf775c4db 100644
--- a/solutions/1035. Uncrossed Lines/1035.py	
+++ b/solutions/1035. Uncrossed Lines/1035.py	
@@ -1,13 +1,13 @@
 class Solution:
-  def maxUncrossedLines(self, nums1: list[int], nums2: list[int]) -> int:
+  def maxUncrossedLines(self, nums1: List[int], nums2: List[int]) -> int:
     m = len(nums1)
     n = len(nums2)
     dp = [[0] * (n + 1) for _ in range(m + 1)]
 
     for i in range(1, m + 1):
       for j in range(1, n + 1):
-        dp[i][j] = (dp[i - 1][j - 1] + 1
-                    if nums1[i - 1] == nums2[j - 1]
-                    else max(dp[i - 1][j], dp[i][j - 1]))
+        dp[i][j] = dp[i - 1][j - 1] + 1 \
+            if nums1[i - 1] == nums2[j - 1] \
+            else max(dp[i - 1][j], dp[i][j - 1])
 
     return dp[m][n]
diff --git a/solutions/1036. Escape a Large Maze/1036.cpp b/solutions/1036. Escape a Large Maze/1036.cpp
index 1c22a5fd032..284cd9fd8c8 100644
--- a/solutions/1036. Escape a Large Maze/1036.cpp	
+++ b/solutions/1036. Escape a Large Maze/1036.cpp	
@@ -14,18 +14,18 @@ class Solution {
 
  private:
   bool dfs(unordered_set<long>& blockedSet, int i, int j, long target,
-           unordered_set<long>&& seen) {
-    if (i < 0 || i >= 1'000'000 || j < 0 || j >= 1'000'000 ||
-        blockedSet.contains(hash(i, j)) || seen.contains(hash(i, j)))
+           unordered_set<long>&& visited) {
+    if (i < 0 || i >= 1e6 || j < 0 || j >= 1e6 ||
+        blockedSet.contains(hash(i, j)) || visited.contains(hash(i, j)))
       return false;
 
-    seen.insert(hash(i, j));
-    if (seen.size() > (1 + 199) * 199 / 2 || hash(i, j) == target)
+    visited.insert(hash(i, j));
+    if (visited.size() > (1 + 199) * 199 / 2 || hash(i, j) == target)
       return true;
-    return dfs(blockedSet, i + 1, j, target, std::move(seen)) ||
-           dfs(blockedSet, i - 1, j, target, std::move(seen)) ||
-           dfs(blockedSet, i, j + 1, target, std::move(seen)) ||
-           dfs(blockedSet, i, j - 1, target, std::move(seen));
+    return dfs(blockedSet, i + 1, j, target, move(visited)) ||
+           dfs(blockedSet, i - 1, j, target, move(visited)) ||
+           dfs(blockedSet, i, j + 1, target, move(visited)) ||
+           dfs(blockedSet, i, j - 1, target, move(visited));
   }
 
   long hash(int i, int j) {
diff --git a/solutions/1036. Escape a Large Maze/1036.java b/solutions/1036. Escape a Large Maze/1036.java
index 5367fa7e444..c01b2ae3ed3 100644
--- a/solutions/1036. Escape a Large Maze/1036.java	
+++ b/solutions/1036. Escape a Large Maze/1036.java	
@@ -8,20 +8,20 @@ public boolean isEscapePossible(int[][] blocked, int[] source, int[] target) {
         dfs(blockedSet, target[0], target[1], hash(source[0], source[1]), new HashSet<>());
   }
 
-  private boolean dfs(Set<Long> blockedSet, int i, int j, long target, Set<Long> seen) {
+  private boolean dfs(Set<Long> blockedSet, int i, int j, long target, Set<Long> visited) {
     if (i < 0 || i >= 1e6 || j < 0 || j >= 1e6 || blockedSet.contains(hash(i, j)) ||
-        seen.contains(hash(i, j)))
+        visited.contains(hash(i, j)))
       return false;
 
-    seen.add(hash(i, j));
-    if (seen.size() > (1 + 199) * 199 / 2 || hash(i, j) == target)
+    visited.add(hash(i, j));
+    if (visited.size() > (1 + 199) * 199 / 2 || hash(i, j) == target)
       return true;
 
-    return                                         //
-        dfs(blockedSet, i + 1, j, target, seen) || //
-        dfs(blockedSet, i - 1, j, target, seen) || //
-        dfs(blockedSet, i, j + 1, target, seen) || //
-        dfs(blockedSet, i, j - 1, target, seen);
+    return                                            //
+        dfs(blockedSet, i + 1, j, target, visited) || //
+        dfs(blockedSet, i - 1, j, target, visited) || //
+        dfs(blockedSet, i, j + 1, target, visited) || //
+        dfs(blockedSet, i, j - 1, target, visited);
   }
 
   private long hash(int i, int j) {
diff --git a/solutions/1036. Escape a Large Maze/1036.py b/solutions/1036. Escape a Large Maze/1036.py
index 1b32ab7495b..1243bc4fd9b 100644
--- a/solutions/1036. Escape a Large Maze/1036.py	
+++ b/solutions/1036. Escape a Large Maze/1036.py	
@@ -1,22 +1,16 @@
 class Solution:
-  def isEscapePossible(
-      self,
-      blocked: list[list[int]],
-      source: list[int],
-      target: list[int]
-  ) -> bool:
-    def dfs(i: int, j: int, target: list[int], seen: set) -> bool:
-      if i < 0 or i >= 10**6 or j < 0 or j >= 10**6:
+  def isEscapePossible(self, blocked: List[List[int]], source: List[int], target: List[int]) -> bool:
+    def dfs(i: int, j: int, target: List[int], visited: set) -> bool:
+      if not 0 <= i < 10**6 or not 0 <= j < 10**6 or (i, j) in blocked or (i, j) in visited:
         return False
-      if (i, j) in blocked or (i, j) in seen:
-        return False
-      seen.add((i, j))
-      return (len(seen) > (1 + 199) * 199 // 2 or [i, j] == target or
-              dfs(i + 1, j, target, seen) or
-              dfs(i - 1, j, target, seen) or
-              dfs(i, j + 1, target, seen) or
-              dfs(i, j - 1, target, seen))
+
+      visited.add((i, j))
+      if len(visited) > (1 + 199) * 199 // 2 or [i, j] == target:
+        return True
+      return dfs(i + 1, j, target, visited) or \
+          dfs(i - 1, j, target, visited) or \
+          dfs(i, j + 1, target, visited) or \
+          dfs(i, j - 1, target, visited)
 
     blocked = set(tuple(b) for b in blocked)
-    return (dfs(source[0], source[1], target, set()) and
-            dfs(target[0], target[1], source, set()))
+    return dfs(source[0], source[1], target, set()) and dfs(target[0], target[1], source, set())
diff --git a/solutions/1037. Valid Boomerang/1037.py b/solutions/1037. Valid Boomerang/1037.py
index 204ac277c16..04545149387 100644
--- a/solutions/1037. Valid Boomerang/1037.py	
+++ b/solutions/1037. Valid Boomerang/1037.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def isBoomerang(self, points: list[list[int]]) -> bool:
-    return ((points[1][0] - points[0][0]) * (points[2][1] - points[1][1]) !=
-            (points[1][1] - points[0][1]) * (points[2][0] - points[1][0]))
+  def isBoomerang(self, points: List[List[int]]) -> bool:
+    return (points[1][0] - points[0][0]) * (points[2][1] - points[1][1]) != \
+        (points[1][1] - points[0][1]) * (points[2][0] - points[1][0])
diff --git a/solutions/1039. Minimum Score Triangulation of Polygon/1039.py b/solutions/1039. Minimum Score Triangulation of Polygon/1039.py
index 34a38b1c917..0e96217226f 100644
--- a/solutions/1039. Minimum Score Triangulation of Polygon/1039.py	
+++ b/solutions/1039. Minimum Score Triangulation of Polygon/1039.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minScoreTriangulation(self, values: list[int]) -> int:
+  def minScoreTriangulation(self, values: List[int]) -> int:
     n = len(values)
     dp = [[0] * n for _ in range(n)]
 
@@ -7,7 +7,7 @@ def minScoreTriangulation(self, values: list[int]) -> int:
       for i in range(j - 2, -1, -1):
         dp[i][j] = math.inf
         for k in range(i + 1, j):
-          dp[i][j] = min(dp[i][j], dp[i][k] + values[i]
-                         * values[k] * values[j] + dp[k][j])
+          dp[i][j] = min(dp[i][j],
+                         dp[i][k] + values[i] * values[k] * values[j] + dp[k][j])
 
     return dp[0][n - 1]
diff --git a/solutions/104. Maximum Depth of Binary Tree/104.py b/solutions/104. Maximum Depth of Binary Tree/104.py
index c46fa2a2702..811c922b64f 100644
--- a/solutions/104. Maximum Depth of Binary Tree/104.py	
+++ b/solutions/104. Maximum Depth of Binary Tree/104.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxDepth(self, root: TreeNode | None) -> int:
+  def maxDepth(self, root: Optional[TreeNode]) -> int:
     if not root:
       return 0
     return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right))
diff --git a/solutions/1040. Moving Stones Until Consecutive II/1040.py b/solutions/1040. Moving Stones Until Consecutive II/1040.py
index 409b677f66e..1388c6806a1 100644
--- a/solutions/1040. Moving Stones Until Consecutive II/1040.py	
+++ b/solutions/1040. Moving Stones Until Consecutive II/1040.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numMovesStonesII(self, stones: list[int]) -> list[int]:
+  def numMovesStonesII(self, stones: List[int]) -> List[int]:
     n = len(stones)
     minMoves = n
 
diff --git a/solutions/1042. Flower Planting With No Adjacent/1042.cpp b/solutions/1042. Flower Planting With No Adjacent/1042.cpp
index 5a285d081e4..210eeb777f7 100644
--- a/solutions/1042. Flower Planting With No Adjacent/1042.cpp	
+++ b/solutions/1042. Flower Planting With No Adjacent/1042.cpp	
@@ -4,28 +4,24 @@ class Solution {
     vector<int> ans(n);  // ans[i] := 1, 2, 3, or 4
     vector<vector<int>> graph(n);
 
-    for (const vector<int>& path : paths) {
-      const int u = path[0] - 1;
-      const int v = path[1] - 1;
+    for (const vector<int>& p : paths) {
+      const int u = p[0] - 1;
+      const int v = p[1] - 1;
       graph[u].push_back(v);
       graph[v].push_back(u);
     }
 
-    for (int u = 0; u < n; ++u) {
-      int used = 0;
-      for (const int v : graph[u])
-        used |= 1 << ans[v];
-      ans[u] = getFirstUnusedType(used);
+    for (int i = 0; i < n; ++i) {
+      vector<bool> used(5);
+      for (const int v : graph[i])
+        used[ans[v]] = true;
+      for (int type = 1; type < 5; ++type)
+        if (!used[type]) {
+          ans[i] = type;
+          break;
+        }
     }
 
     return ans;
   }
-
- private:
-  int getFirstUnusedType(int used) {
-    for (int type = 1; type <= 4; ++type)
-      if ((used >> type & 1) == 0)
-        return type;
-    throw;
-  }
 };
diff --git a/solutions/1042. Flower Planting With No Adjacent/1042.java b/solutions/1042. Flower Planting With No Adjacent/1042.java
index 5b55b8e0d78..12f5e2d7104 100644
--- a/solutions/1042. Flower Planting With No Adjacent/1042.java	
+++ b/solutions/1042. Flower Planting With No Adjacent/1042.java	
@@ -2,29 +2,28 @@ class Solution {
   public int[] gardenNoAdj(int n, int[][] paths) {
     int[] ans = new int[n]; // ans[i] := 1, 2, 3, or 4
     List<Integer>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
 
-    for (int[] path : paths) {
-      final int u = path[0] - 1;
-      final int v = path[1] - 1;
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
+
+    for (int[] p : paths) {
+      final int u = p[0] - 1;
+      final int v = p[1] - 1;
       graph[u].add(v);
       graph[v].add(u);
     }
 
-    for (int u = 0; u < n; ++u) {
-      int used = 0;
-      for (final int v : graph[u])
-        used |= 1 << ans[v];
-      ans[u] = getFirstUnusedType(used);
+    for (int i = 0; i < n; ++i) {
+      boolean[] used = new boolean[5];
+      for (final int v : graph[i])
+        used[ans[v]] = true;
+      for (int type = 1; type < 5; ++type)
+        if (!used[type]) {
+          ans[i] = type;
+          break;
+        }
     }
 
     return ans;
   }
-
-  private int getFirstUnusedType(int used) {
-    for (int type = 1; type <= 4; ++type)
-      if ((used >> type & 1) == 0)
-        return type;
-    throw new IllegalArgumentException();
-  }
 }
diff --git a/solutions/1042. Flower Planting With No Adjacent/1042.py b/solutions/1042. Flower Planting With No Adjacent/1042.py
index 41f54b568c7..5b179e494b1 100644
--- a/solutions/1042. Flower Planting With No Adjacent/1042.py	
+++ b/solutions/1042. Flower Planting With No Adjacent/1042.py	
@@ -1,18 +1,21 @@
 class Solution:
-  def gardenNoAdj(self, n: int, paths: list[list[int]]) -> list[int]:
+  def gardenNoAdj(self, n: int, paths: List[List[int]]) -> List[int]:
     ans = [0] * n  # ans[i] := 1, 2, 3, or 4
     graph = [[] for _ in range(n)]
 
-    for x, y in paths:
-      u = x - 1
-      v = y - 1
+    for a, b in paths:
+      u = a - 1
+      v = b - 1
       graph[u].append(v)
       graph[v].append(u)
 
-    for u in range(n):
-      used = functools.reduce(operator.or_, (1 << ans[v] for v in graph[u]), 0)
-      ans[u] = next(type_
-                    for type_ in range(1, 5)
-                    if not (used >> type_ & 1))
+    for i in range(n):
+      used = [False] * 5
+      for v in graph[i]:
+        used[ans[v]] = True
+      for type in range(1, 5):
+        if not used[type]:
+          ans[i] = type
+          break
 
     return ans
diff --git a/solutions/1043. Partition Array for Maximum Sum/1043.py b/solutions/1043. Partition Array for Maximum Sum/1043.py
index f748a04d66a..59c1f83147f 100644
--- a/solutions/1043. Partition Array for Maximum Sum/1043.py	
+++ b/solutions/1043. Partition Array for Maximum Sum/1043.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSumAfterPartitioning(self, arr: list[int], k: int) -> int:
+  def maxSumAfterPartitioning(self, arr: List[int], k: int) -> int:
     n = len(arr)
     dp = [0] * (n + 1)
 
diff --git a/solutions/1044. Longest Duplicate Substring/1044.cpp b/solutions/1044. Longest Duplicate Substring/1044.cpp
index 8124f2dff50..f7f35ae2f3f 100644
--- a/solutions/1044. Longest Duplicate Substring/1044.cpp	
+++ b/solutions/1044. Longest Duplicate Substring/1044.cpp	
@@ -1,6 +1,7 @@
 class Solution {
  public:
   string longestDupSubstring(string s) {
+    constexpr int kMod = 1'000'000'007;
     const int n = s.length();
     vector<int> pows(n, 1);
     int bestStart = -1;
@@ -8,11 +9,11 @@ class Solution {
     int r = n;
 
     for (int i = 1; i < n; ++i)
-      pows[i] = pows[i - 1] * kBase % kHash;
+      pows[i] = (pows[i - 1] * 26L) % kMod;
 
     while (l < r) {
       const int m = (l + r) / 2;
-      const int start = getStart(s, m, pows);
+      const int start = getStart(s, m, pows, kMod);
       if (start == -1) {
         r = m;
       } else {
@@ -23,36 +24,29 @@ class Solution {
 
     if (bestStart == -1)
       return "";
-    if (getStart(s, l, pows) == -1)
+    if (getStart(s, l, pows, kMod) == -1)
       return s.substr(bestStart, l - 1);
     return s.substr(bestStart, l);
   }
 
  private:
-  static constexpr long kBase = 26;
-  static constexpr int kHash = 1'000'000'007;
-
-  static constexpr int val(char c) {
-    return c - 'a';
-  }
-
   // k := the length of the substring to be hashed
-  int getStart(const string& s, int k, const vector<int>& pows) {
+  int getStart(const string& s, int k, const vector<int>& pows,
+               const int& kMod) {
     unordered_map<int, vector<int>> hashToStarts;
     long h = 0;
 
     // Compute the hash value of s[:k].
     for (int i = 0; i < k; ++i)
-      h = (h * kBase % kHash + val(s[i])) % kHash;
+      h = ((h * 26) % kMod + val(s[i])) % kMod;
     hashToStarts[h].push_back(0);
 
     // Compute the rolling hash by Rabin Karp.
     for (int i = k; i < s.length(); ++i) {
       const int startIndex = i - k + 1;
-      h = ((h - static_cast<long>(pows[k - 1]) * val(s[i - k])) % kHash +
-           kHash) %
-          kHash;
-      h = (h * kBase + val(s[i])) % kHash;
+      h = ((h - static_cast<long>(pows[k - 1]) * val(s[i - k])) % kMod + kMod) %
+          kMod;
+      h = (h * 26 + val(s[i])) % kMod;
       if (const auto it = hashToStarts.find(h); it != hashToStarts.cend()) {
         const string currSub = s.substr(startIndex, k);
         for (const int start : it->second)
@@ -64,4 +58,8 @@ class Solution {
 
     return -1;
   }
+
+  constexpr int val(char c) {
+    return c - 'a';
+  }
 };
diff --git a/solutions/1044. Longest Duplicate Substring/1044.java b/solutions/1044. Longest Duplicate Substring/1044.java
index 20a406b097a..7cbe005bd59 100644
--- a/solutions/1044. Longest Duplicate Substring/1044.java	
+++ b/solutions/1044. Longest Duplicate Substring/1044.java	
@@ -1,5 +1,6 @@
 class Solution {
   public String longestDupSubstring(String s) {
+    final int kMod = 1_000_000_007;
     final int n = s.length();
     int[] pows = new int[n];
     int bestStart = -1;
@@ -8,11 +9,11 @@ public String longestDupSubstring(String s) {
 
     pows[0] = 1;
     for (int i = 1; i < n; ++i)
-      pows[i] = (int) (pows[i - 1] * BASE % HASH);
+      pows[i] = (int) ((pows[i - 1] * 26L) % (long) kMod);
 
     while (l < r) {
       final int m = (l + r) / 2;
-      final int start = getStart(s, m, pows);
+      final int start = getStart(s, m, pows, kMod);
       if (start == -1) {
         r = m;
       } else {
@@ -23,34 +24,27 @@ public String longestDupSubstring(String s) {
 
     if (bestStart == -1)
       return "";
-    if (getStart(s, l, pows) == -1)
+    if (getStart(s, l, pows, kMod) == -1)
       return s.substring(bestStart, bestStart + l - 1);
     return s.substring(bestStart, bestStart + l);
   }
 
-  private static final long BASE = 26;
-  private static final long HASH = 1_000_000_007;
-
-  private static int val(char c) {
-    return c - 'a';
-  }
-
   // k := the length of the substring to be hashed
-  private int getStart(final String s, int k, int[] pows) {
+  private int getStart(final String s, int k, int[] pows, int kMod) {
     Map<Long, List<Integer>> hashToStarts = new HashMap<>();
     long h = 0;
 
     // Compute the hash value of s[:k].
     for (int i = 0; i < k; ++i)
-      h = (h * BASE % HASH + val(s.charAt(i))) % HASH;
+      h = ((h * 26) % kMod + val(s.charAt(i))) % kMod;
     hashToStarts.put(h, new ArrayList<>());
     hashToStarts.get(h).add(0);
 
     // Compute the rolling hash by Rabin Karp.
     for (int i = k; i < s.length(); ++i) {
       final int startIndex = i - k + 1;
-      h = ((h - (long) (pows[k - 1]) * val(s.charAt(i - k))) % HASH + HASH) % HASH;
-      h = (h * BASE + val(s.charAt(i))) % HASH;
+      h = ((h - (long) (pows[k - 1]) * val(s.charAt(i - k))) % kMod + kMod) % kMod;
+      h = (h * 26 + val(s.charAt(i))) % kMod;
       if (hashToStarts.containsKey(h)) {
         final String currSub = s.substring(startIndex, startIndex + k);
         for (final int start : hashToStarts.get(h))
@@ -63,4 +57,8 @@ private int getStart(final String s, int k, int[] pows) {
 
     return -1;
   }
+
+  private int val(char c) {
+    return c - 'a';
+  }
 }
diff --git a/solutions/1044. Longest Duplicate Substring/1044.py b/solutions/1044. Longest Duplicate Substring/1044.py
index 13a39e9147d..ec45f22de10 100644
--- a/solutions/1044. Longest Duplicate Substring/1044.py	
+++ b/solutions/1044. Longest Duplicate Substring/1044.py	
@@ -1,7 +1,6 @@
 class Solution:
   def longestDupSubstring(self, s: str) -> str:
-    BASE = 26
-    HASH = 1_000_000_007
+    kMod = 1_000_000_007
     bestStart = -1
     l = 1
     r = len(s)
@@ -10,21 +9,21 @@ def val(c: str) -> int:
       return ord(c) - ord('a')
 
     # k := the length of the substring to be hashed
-    def getStart(k: int) -> int | None:
-      maxPow = pow(BASE, k - 1, HASH)
+    def getStart(k: int) -> Optional[int]:
+      maxPow = pow(26, k - 1, kMod)
       hashToStart = collections.defaultdict(list)
       h = 0
 
       # Compute the hash value of s[:k].
       for i in range(k):
-        h = (h * BASE + val(s[i])) % HASH
+        h = (h * 26 + val(s[i])) % kMod
       hashToStart[h].append(0)
 
       # Compute the rolling hash by Rabin Karp.
       for i in range(k, len(s)):
         startIndex = i - k + 1
-        h = (h - maxPow * val(s[i - k])) % HASH
-        h = (h * BASE + val(s[i])) % HASH
+        h = (h - maxPow * val(s[i - k])) % kMod
+        h = (h * 26 + val(s[i])) % kMod
         if h in hashToStart:
           currSub = s[startIndex:startIndex + k]
           for start in hashToStart[h]:
@@ -34,7 +33,7 @@ def getStart(k: int) -> int | None:
 
     while l < r:
       m = (l + r) // 2
-      start: int | None = getStart(m)
+      start: Optional[int] = getStart(m)
       if start:
         bestStart = start
         l = m + 1
diff --git a/solutions/1046. Last Stone Weight/1046.py b/solutions/1046. Last Stone Weight/1046.py
index f523eab833b..687ca4532ef 100644
--- a/solutions/1046. Last Stone Weight/1046.py	
+++ b/solutions/1046. Last Stone Weight/1046.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def lastStoneWeight(self, stones: list[int]) -> int:
+  def lastStoneWeight(self, stones: List[int]) -> int:
     pq = [-stone for stone in stones]
     heapq.heapify(pq)
 
diff --git a/solutions/1048. Longest String Chain/1048-2.cpp b/solutions/1048. Longest String Chain/1048-2.cpp
index d3b636ab358..41b15e7ac7d 100644
--- a/solutions/1048. Longest String Chain/1048-2.cpp	
+++ b/solutions/1048. Longest String Chain/1048-2.cpp	
@@ -5,8 +5,9 @@ class Solution {
     // dp[s] := the longest string chain, where s is the last word
     unordered_map<string, int> dp;
 
-    ranges::sort(words, ranges::less{},
-                 [](const string& word) { return word.length(); });
+    ranges::sort(words, [](const string& a, const string& b) {
+      return a.length() < b.length();
+    });
 
     for (const string& word : words) {
       for (int i = 0; i < word.length(); ++i) {
diff --git a/solutions/1048. Longest String Chain/1048-2.java b/solutions/1048. Longest String Chain/1048-2.java
index fe7e2ac99f6..bbd2bad1ca7 100644
--- a/solutions/1048. Longest String Chain/1048-2.java	
+++ b/solutions/1048. Longest String Chain/1048-2.java	
@@ -3,7 +3,7 @@ public int longestStrChain(String[] words) {
     int ans = 0;
     Map<String, Integer> dp = new HashMap<>();
 
-    Arrays.sort(words, Comparator.comparingInt(String::length));
+    Arrays.sort(words, (a, b) -> a.length() - b.length());
 
     for (final String word : words) {
       int bestLength = 0;
diff --git a/solutions/1048. Longest String Chain/1048-2.py b/solutions/1048. Longest String Chain/1048-2.py
index 1afbbff5512..3dbcbbab0f1 100644
--- a/solutions/1048. Longest String Chain/1048-2.py	
+++ b/solutions/1048. Longest String Chain/1048-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestStrChain(self, words: list[str]) -> int:
+  def longestStrChain(self, words: List[str]) -> int:
     dp = {}
 
     for word in sorted(words, key=len):
diff --git a/solutions/1048. Longest String Chain/1048.py b/solutions/1048. Longest String Chain/1048.py
index cad5e1c6679..971e83cfdde 100644
--- a/solutions/1048. Longest String Chain/1048.py	
+++ b/solutions/1048. Longest String Chain/1048.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestStrChain(self, words: list[str]) -> int:
+  def longestStrChain(self, words: List[str]) -> int:
     wordsSet = set(words)
 
     @functools.lru_cache(None)
diff --git a/solutions/1049. Last Stone Weight II/1049.py b/solutions/1049. Last Stone Weight II/1049.py
index c2346ac6a85..c98bee7c197 100644
--- a/solutions/1049. Last Stone Weight II/1049.py	
+++ b/solutions/1049. Last Stone Weight II/1049.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def lastStoneWeightII(self, stones: list[int]) -> int:
+  def lastStoneWeightII(self, stones: List[int]) -> int:
     summ = sum(stones)
     s = 0
     dp = [True] + [False] * summ
diff --git a/solutions/105. Construct Binary Tree from Preorder and Inorder Traversal/105.py b/solutions/105. Construct Binary Tree from Preorder and Inorder Traversal/105.py
index 84cc8f3ae44..05ac355377c 100644
--- a/solutions/105. Construct Binary Tree from Preorder and Inorder Traversal/105.py	
+++ b/solutions/105. Construct Binary Tree from Preorder and Inorder Traversal/105.py	
@@ -1,17 +1,8 @@
 class Solution:
-  def buildTree(
-      self,
-      preorder: list[int],
-      inorder: list[int],
-  ) -> TreeNode | None:
+  def buildTree(self, preorder: List[int], inorder: List[int]) -> Optional[TreeNode]:
     inToIndex = {num: i for i, num in enumerate(inorder)}
 
-    def build(
-        preStart: int,
-        preEnd: int,
-        inStart: int,
-        inEnd: int,
-    ) -> TreeNode | None:
+    def build(preStart: int, preEnd: int, inStart: int, inEnd: int) -> Optional[TreeNode]:
       if preStart > preEnd:
         return None
 
diff --git a/solutions/1051. Height Checker/1051.py b/solutions/1051. Height Checker/1051.py
index 11eb4df89a8..c4aad17a37d 100644
--- a/solutions/1051. Height Checker/1051.py	
+++ b/solutions/1051. Height Checker/1051.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def heightChecker(self, heights: list[int]) -> int:
+  def heightChecker(self, heights: List[int]) -> int:
     ans = 0
     currentHeight = 1
     count = [0] * 101
diff --git a/solutions/1052. Grumpy Bookstore Owner/1052.py b/solutions/1052. Grumpy Bookstore Owner/1052.py
index 92a3d2b7442..d7a25881b22 100644
--- a/solutions/1052. Grumpy Bookstore Owner/1052.py	
+++ b/solutions/1052. Grumpy Bookstore Owner/1052.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def maxSatisfied(
-      self,
-      customers: list[int],
-      grumpy: list[int],
-      X: int,
-  ) -> int:
+  def maxSatisfied(self, customers: List[int], grumpy: List[int], X: int) -> int:
     satisfied = sum(c for i, c in enumerate(customers) if grumpy[i] == 0)
     madeSatisfied = 0
     windowSatisfied = 0
diff --git a/solutions/1053. Previous Permutation With One Swap/1053.py b/solutions/1053. Previous Permutation With One Swap/1053.py
index b0e3bbff2d9..30040585b73 100644
--- a/solutions/1053. Previous Permutation With One Swap/1053.py	
+++ b/solutions/1053. Previous Permutation With One Swap/1053.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def prevPermOpt1(self, arr: list[int]) -> list[int]:
+  def prevPermOpt1(self, arr: List[int]) -> List[int]:
     n = len(arr)
     l = n - 2
     r = n - 1
diff --git a/solutions/1054. Distant Barcodes/1054.py b/solutions/1054. Distant Barcodes/1054.py
index e679f845849..6d4d4be61bd 100644
--- a/solutions/1054. Distant Barcodes/1054.py	
+++ b/solutions/1054. Distant Barcodes/1054.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def rearrangeBarcodes(self, barcodes: list[int]) -> list[int]:
+  def rearrangeBarcodes(self, barcodes: List[int]) -> List[int]:
     ans = [0] * len(barcodes)
     count = collections.Counter(barcodes)
     i = 0  # ans' index
diff --git a/solutions/1055. Shortest Way to Form String/1055.cpp b/solutions/1055. Shortest Way to Form String/1055.cpp
index c0ce101e595..1ece99ef1f9 100644
--- a/solutions/1055. Shortest Way to Form String/1055.cpp	
+++ b/solutions/1055. Shortest Way to Form String/1055.cpp	
@@ -8,7 +8,7 @@ class Solution {
       for (int j = 0; j < source.length(); ++j)
         if (i < target.length() && source[j] == target[i])
           ++i;
-      // All chars in source didn't match target[i].
+      // All chars in source didn't match target[i]
       if (i == prevIndex)
         return -1;
       ++ans;
diff --git a/solutions/1055. Shortest Way to Form String/1055.java b/solutions/1055. Shortest Way to Form String/1055.java
index eab4d63a19c..5be57d567c0 100644
--- a/solutions/1055. Shortest Way to Form String/1055.java	
+++ b/solutions/1055. Shortest Way to Form String/1055.java	
@@ -7,7 +7,7 @@ public int shortestWay(String source, String target) {
       for (int j = 0; j < source.length(); ++j)
         if (i < target.length() && source.charAt(j) == target.charAt(i))
           ++i;
-      // All chars in source didn't match target[i].
+      // All chars in source didn't match target[i]
       if (i == prevIndex)
         return -1;
       ++ans;
diff --git a/solutions/1057. Campus Bikes/1057.py b/solutions/1057. Campus Bikes/1057.py
index 5cb8be749ab..4a07222a3e2 100644
--- a/solutions/1057. Campus Bikes/1057.py	
+++ b/solutions/1057. Campus Bikes/1057.py	
@@ -1,15 +1,11 @@
 class Solution:
-  def assignBikes(
-      self,
-      workers: list[list[int]],
-      bikes: list[list[int]],
-  ) -> list[int]:
+  def assignBikes(self, workers: List[List[int]], bikes: List[List[int]]) -> List[int]:
     ans = [-1] * len(workers)
     usedBikes = [False] * len(bikes)
     # buckets[k] := (i, j), where k = dist(workers[i], bikes[j])
     buckets = [[] for _ in range(2001)]
 
-    def dist(p1: list[int], p2: list[int]) -> int:
+    def dist(p1: List[int], p2: List[int]) -> int:
       return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])
 
     for i, worker in enumerate(workers):
diff --git a/solutions/1058. Minimize Rounding Error to Meet Target/1058.py b/solutions/1058. Minimize Rounding Error to Meet Target/1058.py
index 05da3729a96..00725e8aeb3 100644
--- a/solutions/1058. Minimize Rounding Error to Meet Target/1058.py	
+++ b/solutions/1058. Minimize Rounding Error to Meet Target/1058.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimizeError(self, prices: list[str], target: int) -> str:
+  def minimizeError(self, prices: List[str], target: int) -> str:
     # A[i] := (costCeil - costFloor, costCeil, costFloor)
     # The lower the costCeil - costFloor is, the cheaper to ceil it.
     A = []
diff --git a/solutions/1059. All Paths from Source Lead to Destination/1059.cpp b/solutions/1059. All Paths from Source Lead to Destination/1059.cpp
index 7d2f28eb07e..0c2bb4f5c1f 100644
--- a/solutions/1059. All Paths from Source Lead to Destination/1059.cpp	
+++ b/solutions/1059. All Paths from Source Lead to Destination/1059.cpp	
@@ -7,11 +7,8 @@ class Solution {
     vector<vector<int>> graph(n);
     vector<State> states(n);
 
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      graph[u].push_back(v);
-    }
+    for (const vector<int>& edge : edges)
+      graph[e[0]].push_back(e[1]);
 
     return acyclic(graph, source, destination, states);
   }
diff --git a/solutions/1059. All Paths from Source Lead to Destination/1059.java b/solutions/1059. All Paths from Source Lead to Destination/1059.java
index c8915a189bb..2a94aa5130c 100644
--- a/solutions/1059. All Paths from Source Lead to Destination/1059.java	
+++ b/solutions/1059. All Paths from Source Lead to Destination/1059.java	
@@ -1,16 +1,15 @@
-enum State { INIT, VISITING, VISITED }
+enum State { kInit, kVisiting, kVisited }
 
 class Solution {
   public boolean leadsToDestination(int n, int[][] edges, int source, int destination) {
     List<Integer>[] graph = new List[n];
     State[] states = new State[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
 
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      graph[u].add(v);
-    }
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
+
+    for (int[] edge : edges)
+      graph[e[0]].add(e[1]);
 
     return acyclic(graph, source, destination, states);
   }
@@ -18,16 +17,16 @@ public boolean leadsToDestination(int n, int[][] edges, int source, int destinat
   private boolean acyclic(List<Integer>[] graph, int u, int dest, State[] states) {
     if (graph[u].isEmpty())
       return u == dest;
-    if (states[u] == State.VISITING)
+    if (states[u] == State.kVisiting)
       return false;
-    if (states[u] == State.VISITED)
+    if (states[u] == State.kVisited)
       return true;
 
-    states[u] = State.VISITING;
+    states[u] = State.kVisiting;
     for (final int v : graph[u])
       if (!acyclic(graph, v, dest, states))
         return false;
-    states[u] = State.VISITED;
+    states[u] = State.kVisited;
 
     return true;
   }
diff --git a/solutions/106. Construct Binary Tree from Inorder and Postorder Traversal/106.py b/solutions/106. Construct Binary Tree from Inorder and Postorder Traversal/106.py
index 4b574c7e54d..fe647cbc246 100644
--- a/solutions/106. Construct Binary Tree from Inorder and Postorder Traversal/106.py	
+++ b/solutions/106. Construct Binary Tree from Inorder and Postorder Traversal/106.py	
@@ -1,17 +1,8 @@
 class Solution:
-  def buildTree(
-      self,
-      inorder: list[int],
-      postorder: list[int],
-  ) -> TreeNode | None:
+  def buildTree(self, inorder: List[int], postorder: List[int]) -> Optional[TreeNode]:
     inToIndex = {num: i for i, num in enumerate(inorder)}
 
-    def build(
-        inStart: int,
-        inEnd: int,
-        postStart: int,
-        postEnd: int,
-    ) -> TreeNode | None:
+    def build(inStart: int, inEnd: int, postStart: int, postEnd: int) -> Optional[TreeNode]:
       if inStart > inEnd:
         return None
 
diff --git a/solutions/1062. Longest Repeating Substring/1062.java b/solutions/1062. Longest Repeating Substring/1062.java
index 4023c9f1b35..094fcc25283 100644
--- a/solutions/1062. Longest Repeating Substring/1062.java	
+++ b/solutions/1062. Longest Repeating Substring/1062.java	
@@ -7,7 +7,7 @@ public int longestRepeatingSubstring(String s) {
 
     for (int i = 1; i <= n; ++i)
       for (int j = i + 1; j <= n; ++j)
-        if (s.charAt(i - 1) == s.charAt(j - 1)) {
+        if (S.charAt(i - 1) == s.charAt(j - 1)) {
           dp[i][j] = 1 + dp[i - 1][j - 1];
           ans = Math.max(ans, dp[i][j]);
         }
diff --git a/solutions/1063. Number of Valid Subarrays/1063.py b/solutions/1063. Number of Valid Subarrays/1063.py
index dfa9bd7c9ce..ce7222d6f36 100644
--- a/solutions/1063. Number of Valid Subarrays/1063.py	
+++ b/solutions/1063. Number of Valid Subarrays/1063.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def validSubarrays(self, nums: list[int]) -> int:
+  def validSubarrays(self, nums: List[int]) -> int:
     # For each `num` in `nums`, each element x in the stack can be the leftmost
     # element s.t. [x, num] forms a valid subarray, so the size of the stack is
     # the number of valid subarrays ending in the current number.
diff --git a/solutions/1064. Fixed Point/1064.py b/solutions/1064. Fixed Point/1064.py
index b33d35b45f5..4b48613e5f6 100644
--- a/solutions/1064. Fixed Point/1064.py	
+++ b/solutions/1064. Fixed Point/1064.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def fixedPoint(self, arr: list[int]) -> int:
+  def fixedPoint(self, arr: List[int]) -> int:
     l = 0
     r = len(arr) - 1
 
diff --git a/solutions/1065. Index Pairs of a String/1065.py b/solutions/1065. Index Pairs of a String/1065.py
index 11974378478..6aa141ce954 100644
--- a/solutions/1065. Index Pairs of a String/1065.py	
+++ b/solutions/1065. Index Pairs of a String/1065.py	
@@ -1,11 +1,11 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = collections.defaultdict(TrieNode)
     self.isWord = False
 
 
 class Solution:
-  def indexPairs(self, text: str, words: list[str]) -> list[list[int]]:
+  def indexPairs(self, text: str, words: List[str]) -> List[List[int]]:
     ans = []
     root = TrieNode()
 
diff --git a/solutions/1066. Campus Bikes II/1066.py b/solutions/1066. Campus Bikes II/1066.py
index 64fab480991..9a17633029e 100644
--- a/solutions/1066. Campus Bikes II/1066.py	
+++ b/solutions/1066. Campus Bikes II/1066.py	
@@ -1,10 +1,6 @@
 class Solution:
-  def assignBikes(
-      self,
-      workers: list[list[int]],
-      bikes: list[list[int]],
-  ) -> int:
-    def dist(p1: list[int], p2: list[int]) -> int:
+  def assignBikes(self, workers: List[List[int]], bikes: List[List[int]]) -> int:
+    def dist(p1: List[int], p2: List[int]) -> int:
       return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])
 
     @functools.lru_cache(None)
@@ -15,10 +11,8 @@ def dp(workerIndex: int, used: int) -> int:
       """
       if workerIndex == len(workers):
         return 0
-      return min(
-          (dist(workers[workerIndex],
-                bike) + dp(workerIndex + 1, used | 1 << i) for i,
-           bike in enumerate(bikes) if not used >> i & 1),
-          default=math.inf)
+      return min((dist(workers[workerIndex], bike) + dp(workerIndex + 1, used | 1 << i)
+                  for i, bike in enumerate(bikes)
+                  if not used >> i & 1), default=math.inf)
 
     return dp(0, 0)
diff --git a/solutions/107. Binary Tree Level Order Traversal II/107.cpp b/solutions/107. Binary Tree Level Order Traversal II/107.cpp
index adee464cd5c..344ad4fad16 100644
--- a/solutions/107. Binary Tree Level Order Traversal II/107.cpp	
+++ b/solutions/107. Binary Tree Level Order Traversal II/107.cpp	
@@ -21,7 +21,7 @@ class Solution {
       ans.push_back(currLevel);
     }
 
-    ranges::reverse(ans);
+    reverse(ans.begin(), ans.end());
     return ans;
   }
 };
diff --git a/solutions/107. Binary Tree Level Order Traversal II/107.java b/solutions/107. Binary Tree Level Order Traversal II/107.java
index 55fb6719fb3..1c3f3ebe1a7 100644
--- a/solutions/107. Binary Tree Level Order Traversal II/107.java	
+++ b/solutions/107. Binary Tree Level Order Traversal II/107.java	
@@ -4,7 +4,7 @@ public List<List<Integer>> levelOrderBottom(TreeNode root) {
       return new ArrayList<>();
 
     List<List<Integer>> ans = new ArrayList<>();
-    Queue<TreeNode> q = new ArrayDeque<>(List.of(root));
+    Queue<TreeNode> q = new ArrayDeque<>(Arrays.asList(root));
 
     while (!q.isEmpty()) {
       List<Integer> currLevel = new ArrayList<>();
diff --git a/solutions/107. Binary Tree Level Order Traversal II/107.py b/solutions/107. Binary Tree Level Order Traversal II/107.py
index db943ef96f2..57842296a16 100644
--- a/solutions/107. Binary Tree Level Order Traversal II/107.py	
+++ b/solutions/107. Binary Tree Level Order Traversal II/107.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def levelOrderBottom(self, root: TreeNode | None) -> list[list[int]]:
+  def levelOrderBottom(self, root: Optional[TreeNode]) -> List[List[int]]:
     if not root:
       return []
 
diff --git a/solutions/1071. Greatest Common Divisor of Strings/1071-2.cpp b/solutions/1071. Greatest Common Divisor of Strings/1071-2.cpp
deleted file mode 100644
index f2458ec05a2..00000000000
--- a/solutions/1071. Greatest Common Divisor of Strings/1071-2.cpp	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution {
- public:
-  string gcdOfStrings(string str1, string str2) {
-    if (str1 + str2 != str2 + str1)
-      return "";
-    const int g = gcd(str1.length(), str2.length());
-    return str1.substr(0, g);
-  }
-};
diff --git a/solutions/1071. Greatest Common Divisor of Strings/1071-2.java b/solutions/1071. Greatest Common Divisor of Strings/1071-2.java
deleted file mode 100644
index 9daa51bec42..00000000000
--- a/solutions/1071. Greatest Common Divisor of Strings/1071-2.java	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution {
-  public String gcdOfStrings(String str1, String str2) {
-    if (!(str1 + str2).equals(str2 + str1))
-      return "";
-    final int g = gcd(str1.length(), str2.length());
-    return str1.substring(0, g);
-  }
-
-  private int gcd(int a, int b) {
-    return b == 0 ? a : gcd(b, a % b);
-  }
-}
diff --git a/solutions/1071. Greatest Common Divisor of Strings/1071-2.py b/solutions/1071. Greatest Common Divisor of Strings/1071-2.py
deleted file mode 100644
index b92acdc4af6..00000000000
--- a/solutions/1071. Greatest Common Divisor of Strings/1071-2.py	
+++ /dev/null
@@ -1,6 +0,0 @@
-class Solution:
-  def gcdOfStrings(self, str1: str, str2: str) -> str:
-    if str1 + str2 != str2 + str1:
-      return ''
-    g = math.gcd(len(str1), len(str2))
-    return str1[:g]
diff --git a/solutions/1071. Greatest Common Divisor of Strings/1071.cpp b/solutions/1071. Greatest Common Divisor of Strings/1071.cpp
index 6b3c5b92ffd..b3a9decd887 100644
--- a/solutions/1071. Greatest Common Divisor of Strings/1071.cpp	
+++ b/solutions/1071. Greatest Common Divisor of Strings/1071.cpp	
@@ -1,26 +1,19 @@
 class Solution {
  public:
   string gcdOfStrings(string str1, string str2) {
-    for (int sz = min(str1.length(), str2.length()); sz > 0; --sz)
-      if (isDivisible(str1, str2, sz))
-        return str1.substr(0, sz);
-    return "";
+    if (str1.length() < str2.length())
+      return gcdOfStrings(str2, str1);
+    if (str1.find(str2) == string::npos)
+      return "";
+    if (str2.empty())
+      return str1;
+    return gcdOfStrings(str2, mod(str1, str2));
   }
 
  private:
-  // Returns true if str1 and str2 are divisible by str1[0..sz).
-  bool isDivisible(const string& str1, const string& str2, int sz) {
-    if (str1.length() % sz > 0 || str2.length() % sz > 0)
-      return false;
-    const string gcd = str1.substr(0, sz);
-    return str1 == repeat(gcd, str1.length() / sz) &&
-           str2 == repeat(gcd, str2.length() / sz);
-  }
-
-  string repeat(const string& s, int n) {
-    string res;
-    for (int i = 0; i < n; ++i)
-      res += s;
-    return res;
+  string mod(string& s1, const string& s2) {
+    while (s1.find(s2) == 0)
+      s1 = s1.substr(s2.length());
+    return s1;
   }
 };
diff --git a/solutions/1071. Greatest Common Divisor of Strings/1071.java b/solutions/1071. Greatest Common Divisor of Strings/1071.java
index d611b5a6316..1a1814638ae 100644
--- a/solutions/1071. Greatest Common Divisor of Strings/1071.java	
+++ b/solutions/1071. Greatest Common Divisor of Strings/1071.java	
@@ -1,16 +1,17 @@
 class Solution {
   public String gcdOfStrings(String str1, String str2) {
-    for (int sz = Math.min(str1.length(), str2.length()); sz > 0; --sz)
-      if (isDivisible(str1, str2, sz))
-        return str1.substring(0, sz);
-    return "";
+    if (str1.length() < str2.length())
+      return gcdOfStrings(str2, str1);
+    if (!str1.startsWith(str2))
+      return "";
+    if (str2.isEmpty())
+      return str1;
+    return gcdOfStrings(str2, mod(str1, str2));
   }
 
-  // Returns true if str1 and str2 are divisible by str1[0..sz).
-  private boolean isDivisible(final String str1, final String str2, int sz) {
-    if (str1.length() % sz > 0 || str2.length() % sz > 0)
-      return false;
-    final String gcd = str1.substring(0, sz);
-    return str1.replace(gcd, "").isEmpty() && str2.replace(gcd, "").isEmpty();
+  private String mod(String s1, final String s2) {
+    while (s1.startsWith(s2))
+      s1 = s1.substring(s2.length());
+    return s1;
   }
 }
diff --git a/solutions/1071. Greatest Common Divisor of Strings/1071.py b/solutions/1071. Greatest Common Divisor of Strings/1071.py
index c190ee96647..9a3314f5ef4 100644
--- a/solutions/1071. Greatest Common Divisor of Strings/1071.py	
+++ b/solutions/1071. Greatest Common Divisor of Strings/1071.py	
@@ -1,13 +1,14 @@
 class Solution:
   def gcdOfStrings(self, str1: str, str2: str) -> str:
-    for sz in range(min(len(str1), len(str2)), 0, -1):
-      if self._isDivisible(str1, str2, sz):
-        return str1[:sz]
-    return ''
+    def mod(s1: str, s2: str) -> str:
+      while s1.startswith(s2):
+        s1 = s1[len(s2):]
+      return s1
 
-  def _isDivisible(self, str1: str, str2: str, sz: int) -> bool:
-    """Returns True if str1 and str2 are divisible by str1[0..sz)."""
-    if len(str1) % sz > 0 or len(str2) % sz > 0:
-      return False
-    gcd = str1[:sz]
-    return str1.replace(gcd, '') == '' and str2.replace(gcd, '') == ''
+    if len(str1) < len(str2):
+      return self.gcdOfStrings(str2, str1)
+    if not str1.startswith(str2):
+      return ''
+    if not str2:
+      return str1
+    return self.gcdOfStrings(str2, mod(str1, str2))
diff --git a/solutions/1072. Flip Columns For Maximum Number of Equal Rows/1072.py b/solutions/1072. Flip Columns For Maximum Number of Equal Rows/1072.py
index ace8d195152..d43a58f61a4 100644
--- a/solutions/1072. Flip Columns For Maximum Number of Equal Rows/1072.py	
+++ b/solutions/1072. Flip Columns For Maximum Number of Equal Rows/1072.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def maxEqualRowsAfterFlips(self, matrix: list[list[int]]) -> int:
+  def maxEqualRowsAfterFlips(self, matrix: List[List[int]]) -> int:
     patterns = [tuple(a ^ row[0] for a in row) for row in matrix]
     return max(Counter(patterns).values())
diff --git a/solutions/1073. Adding Two Negabinary Numbers/1073.py b/solutions/1073. Adding Two Negabinary Numbers/1073.py
index f0246ddd81b..a6c83ff0c8b 100644
--- a/solutions/1073. Adding Two Negabinary Numbers/1073.py	
+++ b/solutions/1073. Adding Two Negabinary Numbers/1073.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def addNegabinary(self, arr1: list[int], arr2: list[int]) -> list[int]:
+  def addNegabinary(self, arr1: List[int], arr2: List[int]) -> List[int]:
     ans = []
     carry = 0
 
diff --git a/solutions/1074. Number of Submatrices That Sum to Target/1074.py b/solutions/1074. Number of Submatrices That Sum to Target/1074.py
index 3572650cb01..56b619ce305 100644
--- a/solutions/1074. Number of Submatrices That Sum to Target/1074.py	
+++ b/solutions/1074. Number of Submatrices That Sum to Target/1074.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numSubmatrixSumTarget(self, matrix: list[list[int]], target: int) -> int:
+  def numSubmatrixSumTarget(self, matrix: List[List[int]], target: int) -> int:
     m = len(matrix)
     n = len(matrix[0])
     ans = 0
diff --git a/solutions/1078. Occurrences After Bigram/1078.py b/solutions/1078. Occurrences After Bigram/1078.py
index e30b3232c9f..0eb5502a90d 100644
--- a/solutions/1078. Occurrences After Bigram/1078.py	
+++ b/solutions/1078. Occurrences After Bigram/1078.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def findOcurrences(self, text: str, first: str, second: str) -> list[str]:
+  def findOcurrences(self, text: str, first: str, second: str) -> List[str]:
     words = text.split()
     return [c for a, b, c in zip(words, words[1:], words[2:]) if a == first and b == second]
diff --git a/solutions/1079. Letter Tile Possibilities/1079.py b/solutions/1079. Letter Tile Possibilities/1079.py
index 4891efd4ed8..b103df464c2 100644
--- a/solutions/1079. Letter Tile Possibilities/1079.py	
+++ b/solutions/1079. Letter Tile Possibilities/1079.py	
@@ -2,7 +2,7 @@ class Solution:
   def numTilePossibilities(self, tiles: str) -> int:
     count = collections.Counter(tiles)
 
-    def dfs(count: dict[int, int]) -> int:
+    def dfs(count: Dict[int, int]) -> int:
       possibleSequences = 0
 
       for k, v in count.items():
diff --git a/solutions/108. Convert Sorted Array to Binary Search Tree/108.py b/solutions/108. Convert Sorted Array to Binary Search Tree/108.py
index 748cb77976f..49923961e60 100644
--- a/solutions/108. Convert Sorted Array to Binary Search Tree/108.py	
+++ b/solutions/108. Convert Sorted Array to Binary Search Tree/108.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def sortedArrayToBST(self, nums: list[int]) -> TreeNode | None:
-    def build(l: int, r: int) -> TreeNode | None:
+  def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]:
+    def build(l: int, r: int) -> Optional[TreeNode]:
       if l > r:
         return None
       m = (l + r) // 2
diff --git a/solutions/1080. Insufficient Nodes in Root to Leaf Paths/1080.py b/solutions/1080. Insufficient Nodes in Root to Leaf Paths/1080.py
index 1e521a12e46..e65b027fcbe 100644
--- a/solutions/1080. Insufficient Nodes in Root to Leaf Paths/1080.py	
+++ b/solutions/1080. Insufficient Nodes in Root to Leaf Paths/1080.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def sufficientSubset(
-      self,
-      root: TreeNode | None,
-      limit: int
-  ) -> TreeNode | None:
+  def sufficientSubset(self, root: Optional[TreeNode], limit: int) -> Optional[TreeNode]:
     if not root:
       return None
     if not root.left and not root.right:
diff --git a/solutions/1085. Sum of Digits in the Minimum Number/1085.py b/solutions/1085. Sum of Digits in the Minimum Number/1085.py
index 512eda0384f..88d4b80e278 100644
--- a/solutions/1085. Sum of Digits in the Minimum Number/1085.py	
+++ b/solutions/1085. Sum of Digits in the Minimum Number/1085.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def sumOfDigits(self, nums: list[int]) -> int:
+  def sumOfDigits(self, nums: List[int]) -> int:
     return sum(int(d) for d in str(min(nums))) & 1 ^ 1
diff --git a/solutions/1086. High Five/1086.py b/solutions/1086. High Five/1086.py
index 53cc321fe82..074d553ec2b 100644
--- a/solutions/1086. High Five/1086.py	
+++ b/solutions/1086. High Five/1086.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def highFive(self, items: list[list[int]]) -> list[list[int]]:
+  def highFive(self, items: List[List[int]]) -> List[List[int]]:
     idToScores = collections.defaultdict(list)
 
     for id, score in items:
diff --git a/solutions/1087. Brace Expansion/1087.py b/solutions/1087. Brace Expansion/1087.py
index a148807a488..2870a70fa58 100644
--- a/solutions/1087. Brace Expansion/1087.py	
+++ b/solutions/1087. Brace Expansion/1087.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def expand(self, s: str) -> list[str]:
+  def expand(self, s: str) -> List[str]:
     ans = []
 
-    def dfs(i: int, path: list[str]) -> None:
+    def dfs(i: int, path: List[str]) -> None:
       if i == len(s):
         ans.append(''.join(path))
         return
diff --git a/solutions/1089. Duplicate Zeros/1089.py b/solutions/1089. Duplicate Zeros/1089.py
index 6c59a9937c5..1294ace2e0b 100644
--- a/solutions/1089. Duplicate Zeros/1089.py	
+++ b/solutions/1089. Duplicate Zeros/1089.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def duplicateZeros(self, arr: list[int]) -> None:
+  def duplicateZeros(self, arr: List[int]) -> None:
     zeros = arr.count(0)
     i = len(arr) - 1
     j = len(arr) + zeros - 1
diff --git a/solutions/109. Convert Sorted List to Binary Search Tree/109-2.cpp b/solutions/109. Convert Sorted List to Binary Search Tree/109-2.cpp
index be7b0f818fb..14236bda325 100644
--- a/solutions/109. Convert Sorted List to Binary Search Tree/109-2.cpp	
+++ b/solutions/109. Convert Sorted List to Binary Search Tree/109-2.cpp	
@@ -1,23 +1,24 @@
 class Solution {
  public:
   TreeNode* sortedListToBST(ListNode* head) {
-    vector<int> arr;
+    vector<int> A;
 
     // Construct the array.
     for (ListNode* curr = head; curr; curr = curr->next)
-      arr.push_back(curr->val);
+      A.push_back(curr->val);
 
-    return helper(arr, 0, arr.size() - 1);
+    return helper(A, 0, A.size() - 1);
   }
 
  private:
-  TreeNode* helper(const vector<int>& arr, int l, int r) {
+  TreeNode* helper(const vector<int>& A, int l, int r) {
     if (l > r)
       return nullptr;
+
     const int m = (l + r) / 2;
-    TreeNode* root = new TreeNode(arr[m]);
-    root->left = helper(arr, l, m - 1);
-    root->right = helper(arr, m + 1, r);
+    TreeNode* root = new TreeNode(A[m]);
+    root->left = helper(A, l, m - 1);
+    root->right = helper(A, m + 1, r);
     return root;
   }
 };
diff --git a/solutions/109. Convert Sorted List to Binary Search Tree/109-2.java b/solutions/109. Convert Sorted List to Binary Search Tree/109-2.java
index 870cfba2aa0..d0213610bd6 100644
--- a/solutions/109. Convert Sorted List to Binary Search Tree/109-2.java	
+++ b/solutions/109. Convert Sorted List to Binary Search Tree/109-2.java	
@@ -1,21 +1,22 @@
 class Solution {
   public TreeNode sortedListToBST(ListNode head) {
-    List<Integer> arr = new ArrayList<>();
+    List<Integer> A = new ArrayList<>();
 
     // Construct the array.
     for (ListNode curr = head; curr != null; curr = curr.next)
-      arr.add(curr.val);
+      A.add(curr.val);
 
-    return helper(arr, 0, arr.size() - 1);
+    return helper(A, 0, A.size() - 1);
   }
 
-  private TreeNode helper(List<Integer> arr, int l, int r) {
+  private TreeNode helper(List<Integer> A, int l, int r) {
     if (l > r)
       return null;
+
     final int m = (l + r) / 2;
-    TreeNode root = new TreeNode(arr.get(m));
-    root.left = helper(arr, l, m - 1);
-    root.right = helper(arr, m + 1, r);
+    TreeNode root = new TreeNode(A.get(m));
+    root.left = helper(A, l, m - 1);
+    root.right = helper(A, m + 1, r);
     return root;
   }
 }
diff --git a/solutions/109. Convert Sorted List to Binary Search Tree/109-2.py b/solutions/109. Convert Sorted List to Binary Search Tree/109-2.py
index e10075dd422..05ce272278c 100644
--- a/solutions/109. Convert Sorted List to Binary Search Tree/109-2.py	
+++ b/solutions/109. Convert Sorted List to Binary Search Tree/109-2.py	
@@ -1,20 +1,21 @@
 class Solution:
-  def sortedListToBST(self, head: ListNode | None) -> TreeNode | None:
-    arr = []
+  def sortedListToBST(self, head: Optional[ListNode]) -> Optional[TreeNode]:
+    A = []
 
     # Construct the array.
     curr = head
     while curr:
-      arr.append(curr.val)
+      A.append(curr.val)
       curr = curr.next
 
-    def helper(l: int, r: int) -> TreeNode | None:
+    def helper(l: int, r: int) -> Optional[TreeNode]:
       if l > r:
         return None
+
       m = (l + r) // 2
-      root = TreeNode(arr[m])
+      root = TreeNode(A[m])
       root.left = helper(l, m - 1)
       root.right = helper(m + 1, r)
       return root
 
-    return helper(0, len(arr) - 1)
+    return helper(0, len(A) - 1)
diff --git a/solutions/109. Convert Sorted List to Binary Search Tree/109-3.py b/solutions/109. Convert Sorted List to Binary Search Tree/109-3.py
index 15c5bb3597f..03cd2f4bec8 100644
--- a/solutions/109. Convert Sorted List to Binary Search Tree/109-3.py	
+++ b/solutions/109. Convert Sorted List to Binary Search Tree/109-3.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def sortedListToBST(self, head: ListNode | None) -> TreeNode | None:
-    def helper(l: int, r: int) -> TreeNode | None:
+  def sortedListToBST(self, head: Optional[ListNode]) -> Optional[TreeNode]:
+    def helper(l: int, r: int) -> Optional[TreeNode]:
       nonlocal head
       if l > r:
         return None
@@ -23,7 +23,7 @@ def helper(l: int, r: int) -> TreeNode | None:
 
     return helper(0, self._getLength(head) - 1)
 
-  def _getLength(self, head: ListNode | None) -> int:
+  def _getLength(self, head: Optional[ListNode]) -> int:
     length = 0
     curr = head
     while curr:
diff --git a/solutions/109. Convert Sorted List to Binary Search Tree/109.cpp b/solutions/109. Convert Sorted List to Binary Search Tree/109.cpp
index aa7ed37076c..2ebcada53e1 100644
--- a/solutions/109. Convert Sorted List to Binary Search Tree/109.cpp	
+++ b/solutions/109. Convert Sorted List to Binary Search Tree/109.cpp	
@@ -10,6 +10,7 @@ class Solution {
     TreeNode* root = new TreeNode(mid->val);
     root->left = sortedListToBST(head);
     root->right = sortedListToBST(mid->next);
+
     return root;
   }
 
diff --git a/solutions/109. Convert Sorted List to Binary Search Tree/109.java b/solutions/109. Convert Sorted List to Binary Search Tree/109.java
index 51ec47ce7f8..a4fc009de05 100644
--- a/solutions/109. Convert Sorted List to Binary Search Tree/109.java	
+++ b/solutions/109. Convert Sorted List to Binary Search Tree/109.java	
@@ -9,6 +9,7 @@ public TreeNode sortedListToBST(ListNode head) {
     TreeNode root = new TreeNode(mid.val);
     root.left = sortedListToBST(head);
     root.right = sortedListToBST(mid.next);
+
     return root;
   }
 
diff --git a/solutions/109. Convert Sorted List to Binary Search Tree/109.py b/solutions/109. Convert Sorted List to Binary Search Tree/109.py
index da78b8804cb..40bbdf9b971 100644
--- a/solutions/109. Convert Sorted List to Binary Search Tree/109.py	
+++ b/solutions/109. Convert Sorted List to Binary Search Tree/109.py	
@@ -22,4 +22,5 @@ def findMid(head: ListNode) -> ListNode:
     root = TreeNode(mid.val)
     root.left = self.sortedListToBST(head)
     root.right = self.sortedListToBST(mid.next)
+
     return root
diff --git a/solutions/1090. Largest Values From Labels/1090.cpp b/solutions/1090. Largest Values From Labels/1090.cpp
index 1cece8272c0..8e8b8ddbad1 100644
--- a/solutions/1090. Largest Values From Labels/1090.cpp	
+++ b/solutions/1090. Largest Values From Labels/1090.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int largestValsFromLabels(vector<int>& values, vector<int>& labels,
-                            int numWanted, int useLimit) {
+                            int num_wanted, int use_limit) {
     const int n = values.size();
     int ans = 0;
     vector<pair<int, int>> items;
@@ -10,16 +10,17 @@ class Solution {
     for (int i = 0; i < n; ++i)
       items.emplace_back(values[i], labels[i]);
 
-    ranges::sort(items, ranges::greater{},
-                 [](const pair<int, int>& item) { return item.first; });
+    ranges::sort(
+        items, [](const auto& a, const auto& b) { return a.first > b.first; });
 
-    for (const auto& [value, label] : items)
-      if (labelsUsed[label] < useLimit) {
+    for (const auto& [value, label] : items) {
+      if (labelsUsed[label] < use_limit) {
         ans += value;
         ++labelsUsed[label];
-        if (--numWanted == 0)
+        if (--num_wanted == 0)
           break;
       }
+    }
 
     return ans;
   }
diff --git a/solutions/1091. Shortest Path in Binary Matrix/1091.cpp b/solutions/1091. Shortest Path in Binary Matrix/1091.cpp
index 804a38b1a84..b8fb99934e5 100644
--- a/solutions/1091. Shortest Path in Binary Matrix/1091.cpp	
+++ b/solutions/1091. Shortest Path in Binary Matrix/1091.cpp	
@@ -7,17 +7,20 @@ class Solution {
     if (grid[0][0] == 1 || grid.back().back() == 1)
       return -1;
 
-    constexpr int kDirs[8][2] = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1},
-                                 {0, 1},   {1, -1}, {1, 0},  {1, 1}};
+    const vector<pair<int, int>> dirs{{-1, -1}, {-1, 0}, {-1, 1}, {0, -1},
+                                      {0, 1},   {1, -1}, {1, 0},  {1, 1}};
+
+    int ans = 0;
     queue<pair<int, int>> q{{{0, 0}}};
     vector<vector<bool>> seen(n, vector<bool>(n));
     seen[0][0] = true;
 
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == n || y < 0 || y == n)
@@ -25,11 +28,12 @@ class Solution {
           if (grid[x][y] != 0 || seen[x][y])
             continue;
           if (x == n - 1 && y == n - 1)
-            return step + 1;
+            return ans + 1;
           q.emplace(x, y);
           seen[x][y] = true;
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/1091. Shortest Path in Binary Matrix/1091.java b/solutions/1091. Shortest Path in Binary Matrix/1091.java
index 35b89f7c636..0fa871a2dc0 100644
--- a/solutions/1091. Shortest Path in Binary Matrix/1091.java	
+++ b/solutions/1091. Shortest Path in Binary Matrix/1091.java	
@@ -6,16 +6,20 @@ public int shortestPathBinaryMatrix(int[][] grid) {
     if (grid[0][0] == 1 || grid[n - 1][n - 1] == 1)
       return -1;
 
-    final int[][] DIRS = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}};
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(0, 0)));
+    final int[][] dirs = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}};
+
+    int ans = 0;
+    Queue<int[]> q = new ArrayDeque<>();
+    q.offer(new int[] {0, 0});
     boolean[][] seen = new boolean[n][n];
     seen[0][0] = true;
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
-        final int i = q.peek().getKey();
-        final int j = q.poll().getValue();
-        for (int[] dir : DIRS) {
+        final int i = q.peek()[0];
+        final int j = q.poll()[1];
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == n || y < 0 || y == n)
@@ -23,11 +27,12 @@ public int shortestPathBinaryMatrix(int[][] grid) {
           if (grid[x][y] != 0 || seen[x][y])
             continue;
           if (x == n - 1 && y == n - 1)
-            return step + 1;
-          q.offer(new Pair<>(x, y));
+            return ans + 1;
+          q.offer(new int[] {x, y});
           seen[x][y] = true;
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/1093. Statistics from a Large Sample/1093.py b/solutions/1093. Statistics from a Large Sample/1093.py
index 6846b760baf..7ee3123099e 100644
--- a/solutions/1093. Statistics from a Large Sample/1093.py	
+++ b/solutions/1093. Statistics from a Large Sample/1093.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sampleStats(self, count: list[int]) -> list[float]:
+  def sampleStats(self, count: List[int]) -> List[float]:
     minimum = next((i for i, num in enumerate(count) if num), None)
     maximum = next((i for i, num in reversed(
         list(enumerate(count))) if num), None)
diff --git a/solutions/1095. Find in Mountain Array/1095.py b/solutions/1095. Find in Mountain Array/1095.py
index 3ba9bca9e71..9dddd864fe0 100644
--- a/solutions/1095. Find in Mountain Array/1095.py	
+++ b/solutions/1095. Find in Mountain Array/1095.py	
@@ -7,11 +7,7 @@
 #   def length(self) -> int:
 
 class Solution:
-  def findInMountainArray(
-      self,
-      target: int,
-      mountain_arr: 'MountainArray',
-  ) -> int:
+  def findInMountainArray(self, target: int, mountain_arr: 'MountainArray') -> int:
     n = mountain_arr.length()
     peakIndex = self.peakIndexInMountainArray(mountain_arr, 0, n - 1)
 
diff --git a/solutions/1096. Brace Expansion II/1096.java b/solutions/1096. Brace Expansion II/1096.java
index 7065cea81e0..983e58d3fc9 100644
--- a/solutions/1096. Brace Expansion II/1096.java	
+++ b/solutions/1096. Brace Expansion II/1096.java	
@@ -18,7 +18,7 @@ else if (expression.charAt(i) == '}' && --layer == 0)
       else if (expression.charAt(i) == ',' && layer == 0)
         groups.add(new ArrayList<>());
       else if (layer == 0)
-        merge(groups, new ArrayList<>(List.of(String.valueOf(expression.charAt(i)))));
+        merge(groups, new ArrayList<>(Arrays.asList(String.valueOf(expression.charAt(i)))));
 
     for (final List<String> group : groups)
       for (final String word : group)
diff --git a/solutions/1096. Brace Expansion II/1096.py b/solutions/1096. Brace Expansion II/1096.py
index a727748d8d5..38a9bd00c60 100644
--- a/solutions/1096. Brace Expansion II/1096.py	
+++ b/solutions/1096. Brace Expansion II/1096.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def braceExpansionII(self, expression: str) -> list[str]:
-    def merge(groups: list[list[str]], group: list[str]) -> None:
+  def braceExpansionII(self, expression: str) -> List[str]:
+    def merge(groups: List[List[str]], group: List[str]) -> None:
       if not groups[-1]:
         groups[-1] = group
         return
@@ -8,7 +8,7 @@ def merge(groups: list[list[str]], group: list[str]) -> None:
       groups[-1] = [word1 + word2 for word1 in groups[-1]
                     for word2 in group]
 
-    def dfs(s: int, e: int) -> list[str]:
+    def dfs(s: int, e: int) -> List[str]:
       groups = [[]]
       layer = 0
 
diff --git a/solutions/1099. Two Sum Less Than K/1099.java b/solutions/1099. Two Sum Less Than K/1099.java
index 795fe3cb2ec..b7ceaf724c2 100644
--- a/solutions/1099. Two Sum Less Than K/1099.java	
+++ b/solutions/1099. Two Sum Less Than K/1099.java	
@@ -7,7 +7,7 @@ public int twoSumLessThanK(int[] nums, int k) {
     int l = 0;
     int r = nums.length - 1;
 
-    Arrays.sort(nums);
+    numsrrays.sort(nums);
 
     while (l < r)
       if (nums[l] + nums[r] < k) {
diff --git a/solutions/1099. Two Sum Less Than K/1099.py b/solutions/1099. Two Sum Less Than K/1099.py
index d169b80ce31..c0dc1b3cf91 100644
--- a/solutions/1099. Two Sum Less Than K/1099.py	
+++ b/solutions/1099. Two Sum Less Than K/1099.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def twoSumLessThanK(self, nums: list[int], k: int) -> int:
+  def twoSumLessThanK(self, nums: List[int], k: int) -> int:
     if len(nums) < 2:
       return -1
 
diff --git a/solutions/11. Container With Most Water/11.py b/solutions/11. Container With Most Water/11.py
index fdd51393755..201f1941fb5 100644
--- a/solutions/11. Container With Most Water/11.py	
+++ b/solutions/11. Container With Most Water/11.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxArea(self, height: list[int]) -> int:
+  def maxArea(self, height: List[int]) -> int:
     ans = 0
     l = 0
     r = len(height) - 1
diff --git a/solutions/110. Balanced Binary Tree/110-2.py b/solutions/110. Balanced Binary Tree/110-2.py
index d6855ff8d74..06f0dbe6b53 100644
--- a/solutions/110. Balanced Binary Tree/110-2.py	
+++ b/solutions/110. Balanced Binary Tree/110-2.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def isBalanced(self, root: TreeNode | None) -> bool:
+  def isBalanced(self, root: Optional[TreeNode]) -> bool:
     ans = True
 
-    def maxDepth(root: TreeNode | None) -> int:
+    def maxDepth(root: Optional[TreeNode]) -> int:
       """Returns the height of root and sets ans to false if root unbalanced."""
       nonlocal ans
       if not root or not ans:
diff --git a/solutions/110. Balanced Binary Tree/110-3.py b/solutions/110. Balanced Binary Tree/110-3.py
index cc5c0486a08..946b1c588b6 100644
--- a/solutions/110. Balanced Binary Tree/110-3.py	
+++ b/solutions/110. Balanced Binary Tree/110-3.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def isBalanced(self, root: TreeNode | None) -> bool:
-    def maxDepth(root: TreeNode | None) -> int:
+  def isBalanced(self, root: Optional[TreeNode]) -> bool:
+    def maxDepth(root: Optional[TreeNode]) -> int:
       """Returns the height of root if root is balanced; otherwise, returns -1."""
       if not root:
         return 0
diff --git a/solutions/110. Balanced Binary Tree/110.py b/solutions/110. Balanced Binary Tree/110.py
index 9505ea4bde2..e9b36f5af0a 100644
--- a/solutions/110. Balanced Binary Tree/110.py	
+++ b/solutions/110. Balanced Binary Tree/110.py	
@@ -1,13 +1,12 @@
 class Solution:
-  def isBalanced(self, root: TreeNode | None) -> bool:
+  def isBalanced(self, root: Optional[TreeNode]) -> bool:
     if not root:
       return True
 
-    def maxDepth(root: TreeNode | None) -> int:
+    def maxDepth(root: Optional[TreeNode]) -> int:
       if not root:
         return 0
       return 1 + max(maxDepth(root.left), maxDepth(root.right))
 
-    return (abs(maxDepth(root.left) - maxDepth(root.right)) <= 1 and
-            self.isBalanced(root.left) and
-            self.isBalanced(root.right))
+    return abs(maxDepth(root.left) - maxDepth(root.right)) <= 1 and \
+        self.isBalanced(root.left) and self.isBalanced(root.right)
diff --git a/solutions/1101. The Earliest Moment When Everyone Become Friends/1101.cpp b/solutions/1101. The Earliest Moment When Everyone Become Friends/1101.cpp
index fa76d51b7a6..e09a5e848e6 100644
--- a/solutions/1101. The Earliest Moment When Everyone Become Friends/1101.cpp	
+++ b/solutions/1101. The Earliest Moment When Everyone Become Friends/1101.cpp	
@@ -40,8 +40,9 @@ class Solution {
     UnionFind uf(n);
 
     // Sort `logs` by timestamp.
-    ranges::sort(logs, ranges::less{},
-                 [](const vector<int>& log) { return log[0]; });
+    sort(
+        logs.begin(), logs.end(),
+        [](const vector<int>& a, const vector<int>& b) { return a[0] < b[0]; });
 
     for (const vector<int>& log : logs) {
       const int timestamp = log[0];
diff --git a/solutions/1101. The Earliest Moment When Everyone Become Friends/1101.java b/solutions/1101. The Earliest Moment When Everyone Become Friends/1101.java
index fec47738bfb..bc75a0eb510 100644
--- a/solutions/1101. The Earliest Moment When Everyone Become Friends/1101.java	
+++ b/solutions/1101. The Earliest Moment When Everyone Become Friends/1101.java	
@@ -41,7 +41,7 @@ public int earliestAcq(int[][] logs, int n) {
     UnionFind uf = new UnionFind(n);
 
     // Sort `logs` by timestamp.
-    Arrays.sort(logs, Comparator.comparingInt(log -> log[0]));
+    Arrays.sort(logs, (a, b) -> a[0] - b[0]);
 
     for (int[] log : logs) {
       final int timestamp = log[0];
diff --git a/solutions/1101. The Earliest Moment When Everyone Become Friends/1101.py b/solutions/1101. The Earliest Moment When Everyone Become Friends/1101.py
index b99167bb4f7..bd1bb6f4716 100644
--- a/solutions/1101. The Earliest Moment When Everyone Become Friends/1101.py	
+++ b/solutions/1101. The Earliest Moment When Everyone Become Friends/1101.py	
@@ -28,12 +28,12 @@ def _find(self, u: int) -> int:
 
 
 class Solution:
-  def earliestAcq(self, logs: list[list[int]], n: int) -> int:
+  def earliestAcq(self, logs: List[List[int]], n: int) -> int:
     uf = UnionFind(n)
 
-    # Sort `logs` by timestamp.
     logs.sort(key=lambda x: x[0])
 
+    # Sort `logs` by timestamp.
     for timestamp, x, y in logs:
       uf.unionByRank(x, y)
       if uf.getCount() == 1:
diff --git a/solutions/1102. Path With Maximum Minimum Value/1102.cpp b/solutions/1102. Path With Maximum Minimum Value/1102.cpp
index ee42ab72192..ff8a5ac48bf 100644
--- a/solutions/1102. Path With Maximum Minimum Value/1102.cpp	
+++ b/solutions/1102. Path With Maximum Minimum Value/1102.cpp	
@@ -2,12 +2,13 @@ struct T {
   int i;
   int j;
   int val;
+  T(int i, int j, int val) : i(i), j(j), val(val) {}
 };
 
 class Solution {
  public:
   int maximumMinimumPath(vector<vector<int>>& grid) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = grid.size();
     const int n = grid[0].size();
     int ans = grid[0][0];
@@ -24,7 +25,7 @@ class Solution {
       if (i == m - 1 && j == n - 1)
         return ans;
       seen[i][j] = true;
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1102. Path With Maximum Minimum Value/1102.java b/solutions/1102. Path With Maximum Minimum Value/1102.java
index 2bcf17f7157..26f4f1dcc09 100644
--- a/solutions/1102. Path With Maximum Minimum Value/1102.java	
+++ b/solutions/1102. Path With Maximum Minimum Value/1102.java	
@@ -1,14 +1,24 @@
+class T {
+  public int i;
+  public int j;
+  public int val;
+  public T(int i, int j, int val) {
+    this.i = i;
+    this.j = j;
+    this.val = val;
+  }
+}
+
 class Solution {
   public int maximumMinimumPath(int[][] grid) {
-    record T(int i, int j, int val) {}
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = grid.length;
     final int n = grid[0].length;
     int ans = grid[0][0];
     boolean[][] seen = new boolean[m][n];
-    Queue<T> maxHeap = new PriorityQueue<>(Comparator.comparingInt(T::val).reversed()) {
-      { offer(new T(0, 0, grid[0][0])); }
-    };
+    Queue<T> maxHeap = new PriorityQueue<>((a, b) -> b.val - a.val);
+
+    maxHeap.offer(new T(0, 0, grid[0][0]));
 
     while (!maxHeap.isEmpty()) {
       final int i = maxHeap.peek().i;
@@ -18,7 +28,7 @@ record T(int i, int j, int val) {}
       if (i == m - 1 && j == n - 1)
         return ans;
       seen[i][j] = true;
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1103. Distribute Candies to People/1103.py b/solutions/1103. Distribute Candies to People/1103.py
index 878d4d6818b..af808a47b33 100644
--- a/solutions/1103. Distribute Candies to People/1103.py	
+++ b/solutions/1103. Distribute Candies to People/1103.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def distributeCandies(self, candies: int, n: int) -> list[int]:
+  def distributeCandies(self, candies: int, n: int) -> List[int]:
     ans = [0] * n
     rows = int((-n + (n**2 + 8 * n**2 * candies)**0.5) / (2 * n**2))
     accumN = rows * (rows - 1) * n // 2
diff --git a/solutions/1104. Path In Zigzag Labelled Binary Tree/1104.py b/solutions/1104. Path In Zigzag Labelled Binary Tree/1104.py
index 1922c61bd4e..a9fc5560639 100644
--- a/solutions/1104. Path In Zigzag Labelled Binary Tree/1104.py	
+++ b/solutions/1104. Path In Zigzag Labelled Binary Tree/1104.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def pathInZigZagTree(self, label: int) -> list[int]:
+  def pathInZigZagTree(self, label: int) -> List[int]:
     def boundarySum(level: int):
       return 2**level + 2**(level + 1) - 1
 
diff --git a/solutions/1105. Filling Bookcase Shelves/1105.py b/solutions/1105. Filling Bookcase Shelves/1105.py
index 5066542f646..0cb3838a675 100644
--- a/solutions/1105. Filling Bookcase Shelves/1105.py	
+++ b/solutions/1105. Filling Bookcase Shelves/1105.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minHeightShelves(self, books: list[list[int]], shelfWidth: int) -> int:
+  def minHeightShelves(self, books: List[List[int]], shelfWidth: int) -> int:
     # dp[i] := the minimum height to place the first i books
     dp = [0] + [math.inf] * len(books)
 
diff --git a/solutions/1106. Parsing A Boolean Expression/1106.py b/solutions/1106. Parsing A Boolean Expression/1106.py
index 8275d6455d0..c0e5c198129 100644
--- a/solutions/1106. Parsing A Boolean Expression/1106.py	
+++ b/solutions/1106. Parsing A Boolean Expression/1106.py	
@@ -1,6 +1,6 @@
 class Solution:
   def parseBoolExpr(self, expression: str) -> bool:
-    def dfs(s: int, e: int) -> list[str]:
+    def dfs(s: int, e: int) -> List[str]:
       if s == e:
         return True if expression[s] == 't' else False
 
diff --git a/solutions/1109. Corporate Flight Bookings/1109.py b/solutions/1109. Corporate Flight Bookings/1109.py
index d332c177875..62d09fa469f 100644
--- a/solutions/1109. Corporate Flight Bookings/1109.py	
+++ b/solutions/1109. Corporate Flight Bookings/1109.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def corpFlightBookings(self, bookings: list[list[int]], n: int) -> list[int]:
+  def corpFlightBookings(self, bookings: List[List[int]], n: int) -> List[int]:
     ans = [0] * n
 
     for booking in bookings:
diff --git a/solutions/111. Minimum Depth of Binary Tree/111-2.cpp b/solutions/111. Minimum Depth of Binary Tree/111-2.cpp
index a86b29bda5e..a0f9af879fd 100644
--- a/solutions/111. Minimum Depth of Binary Tree/111-2.cpp	
+++ b/solutions/111. Minimum Depth of Binary Tree/111-2.cpp	
@@ -4,19 +4,22 @@ class Solution {
     if (root == nullptr)
       return 0;
 
+    int ans = 0;
     queue<TreeNode*> q{{root}};
 
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         TreeNode* node = q.front();
         q.pop();
         if (node->left == nullptr && node->right == nullptr)
-          return step;
+          return ans;
         if (node->left)
           q.push(node->left);
         if (node->right)
           q.push(node->right);
       }
+    }
 
     throw;
   }
diff --git a/solutions/111. Minimum Depth of Binary Tree/111-2.java b/solutions/111. Minimum Depth of Binary Tree/111-2.java
index 86cd419dd1c..e7da421c7b7 100644
--- a/solutions/111. Minimum Depth of Binary Tree/111-2.java	
+++ b/solutions/111. Minimum Depth of Binary Tree/111-2.java	
@@ -3,18 +3,21 @@ public int minDepth(TreeNode root) {
     if (root == null)
       return 0;
 
-    Queue<TreeNode> q = new ArrayDeque<>(List.of(root));
+    int ans = 0;
+    Queue<TreeNode> q = new ArrayDeque<>(Arrays.asList(root));
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         TreeNode node = q.poll();
         if (node.left == null && node.right == null)
-          return step;
+          return ans;
         if (node.left != null)
           q.offer(node.left);
         if (node.right != null)
           q.offer(node.right);
       }
+    }
 
     throw new IllegalArgumentException();
   }
diff --git a/solutions/111. Minimum Depth of Binary Tree/111-2.py b/solutions/111. Minimum Depth of Binary Tree/111-2.py
index 91d9d22776b..805d04d28f2 100644
--- a/solutions/111. Minimum Depth of Binary Tree/111-2.py	
+++ b/solutions/111. Minimum Depth of Binary Tree/111-2.py	
@@ -1,18 +1,18 @@
 class Solution:
-  def minDepth(self, root: TreeNode | None) -> int:
+  def minDepth(self, root: Optional[TreeNode]) -> int:
     if not root:
       return 0
 
+    ans = 0
     q = collections.deque([root])
 
-    step = 1
     while q:
+      ans += 1
       for _ in range(len(q)):
         node = q.popleft()
         if not node.left and not node.right:
-          return step
+          return ans
         if node.left:
           q.append(node.left)
         if node.right:
           q.append(node.right)
-      step += 1
diff --git a/solutions/111. Minimum Depth of Binary Tree/111.py b/solutions/111. Minimum Depth of Binary Tree/111.py
index 874f6869a15..8af7f5f8320 100644
--- a/solutions/111. Minimum Depth of Binary Tree/111.py	
+++ b/solutions/111. Minimum Depth of Binary Tree/111.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minDepth(self, root: TreeNode | None) -> int:
+  def minDepth(self, root: Optional[TreeNode]) -> int:
     if not root:
       return 0
     if not root.left:
diff --git a/solutions/1110. Delete Nodes And Return Forest/1110.cpp b/solutions/1110. Delete Nodes And Return Forest/1110.cpp
index ea5cc35b097..78805e956ff 100644
--- a/solutions/1110. Delete Nodes And Return Forest/1110.cpp	
+++ b/solutions/1110. Delete Nodes And Return Forest/1110.cpp	
@@ -17,8 +17,8 @@ class Solution {
       ans.push_back(root);
 
     // If root is deleted, both children have the possibility to be a new root
-    root->left = dfs(root->left, std::move(toDeleteSet), deleted, ans);
-    root->right = dfs(root->right, std::move(toDeleteSet), deleted, ans);
+    root->left = dfs(root->left, move(toDeleteSet), deleted, ans);
+    root->right = dfs(root->right, move(toDeleteSet), deleted, ans);
     return deleted ? nullptr : root;
   }
 };
diff --git a/solutions/1110. Delete Nodes And Return Forest/1110.py b/solutions/1110. Delete Nodes And Return Forest/1110.py
index dcc64f29fd4..95147ee761c 100644
--- a/solutions/1110. Delete Nodes And Return Forest/1110.py	
+++ b/solutions/1110. Delete Nodes And Return Forest/1110.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def delNodes(self, root: TreeNode, to_delete: list[int]) -> list[TreeNode]:
+  def delNodes(self, root: TreeNode, to_delete: List[int]) -> List[TreeNode]:
     ans = []
     toDeleteSet = set(to_delete)
 
diff --git a/solutions/1111. Maximum Nesting Depth of Two Valid Parentheses Strings/1111.py b/solutions/1111. Maximum Nesting Depth of Two Valid Parentheses Strings/1111.py
index 0e2a59a8509..aa360f7b598 100644
--- a/solutions/1111. Maximum Nesting Depth of Two Valid Parentheses Strings/1111.py	
+++ b/solutions/1111. Maximum Nesting Depth of Two Valid Parentheses Strings/1111.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxDepthAfterSplit(self, seq: str) -> list[int]:
+  def maxDepthAfterSplit(self, seq: str) -> List[int]:
     ans = []
     depth = 1
 
diff --git a/solutions/1118. Number of Days in a Month/1118.py b/solutions/1118. Number of Days in a Month/1118.py
index b55f996ddbc..5458b4bec24 100644
--- a/solutions/1118. Number of Days in a Month/1118.py	
+++ b/solutions/1118. Number of Days in a Month/1118.py	
@@ -1,7 +1,6 @@
 class Solution:
   def numberOfDays(self, year: int, month: int) -> int:
     days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
-
     def isLeapYear(year: int) -> bool:
       return year % 4 == 0 and year % 100 != 0 or year % 400 == 0
     return 29 if month == 2 and isLeapYear(year) else days[month]
diff --git a/solutions/112. Path Sum/112.py b/solutions/112. Path Sum/112.py
index fe762d4d427..9daea69c67f 100644
--- a/solutions/112. Path Sum/112.py	
+++ b/solutions/112. Path Sum/112.py	
@@ -4,5 +4,5 @@ def hasPathSum(self, root: TreeNode, summ: int) -> bool:
       return False
     if root.val == summ and not root.left and not root.right:
       return True
-    return (self.hasPathSum(root.left, summ - root.val) or
-            self.hasPathSum(root.right, summ - root.val))
+    return self.hasPathSum(root.left, summ - root.val) or \
+        self.hasPathSum(root.right, summ - root.val)
diff --git a/solutions/1120. Maximum Average Subtree/1120.java b/solutions/1120. Maximum Average Subtree/1120.java
index 6ed0533cfcc..ff219891c42 100644
--- a/solutions/1120. Maximum Average Subtree/1120.java	
+++ b/solutions/1120. Maximum Average Subtree/1120.java	
@@ -1,10 +1,19 @@
+class T {
+  public int sum;
+  public int count;
+  public double maxAverage;
+  public T(int sum, int count, double maxAverage) {
+    this.sum = sum;
+    this.count = count;
+    this.maxAverage = maxAverage;
+  }
+}
+
 class Solution {
   public double maximumAverageSubtree(TreeNode root) {
     return maximumAverage(root).maxAverage;
   }
 
-  private record T(int sum, int count, double maxAverage) {}
-
   private T maximumAverage(TreeNode root) {
     if (root == null)
       return new T(0, 0, 0.0);
diff --git a/solutions/1120. Maximum Average Subtree/1120.py b/solutions/1120. Maximum Average Subtree/1120.py
index e36287193ff..20739ba768f 100644
--- a/solutions/1120. Maximum Average Subtree/1120.py	
+++ b/solutions/1120. Maximum Average Subtree/1120.py	
@@ -1,16 +1,13 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
 class T:
-  summ: int
-  count: int
-  maxAverage: int
+  def __init__(self, summ: int, count: int, maxAverage: float):
+    self.summ = summ
+    self.count = count
+    self.maxAverage = maxAverage
 
 
 class Solution:
-  def maximumAverageSubtree(self, root: TreeNode | None) -> float:
-    def maximumAverage(root: TreeNode | None) -> T:
+  def maximumAverageSubtree(self, root: Optional[TreeNode]) -> float:
+    def maximumAverage(root: Optional[TreeNode]) -> T:
       if not root:
         return T(0, 0, 0)
 
diff --git a/solutions/1121. Divide Array Into Increasing Sequences/1121.py b/solutions/1121. Divide Array Into Increasing Sequences/1121.py
index 5d6c0f269dd..a92d4e86ff1 100644
--- a/solutions/1121. Divide Array Into Increasing Sequences/1121.py	
+++ b/solutions/1121. Divide Array Into Increasing Sequences/1121.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canDivideIntoSubsequences(self, nums: list[int], k: int) -> bool:
+  def canDivideIntoSubsequences(self, nums: List[int], k: int) -> bool:
     # Find the number with the maxFreq, we need at least maxFreq * k elements
     # e.g. nums = [1, 2, 2, 3, 4], we have maxFreq = 2 (two 2s), so we have to
     # Split nums into two subsequences say k = 3, the minimum length of nums is 2 x
diff --git a/solutions/1122. Relative Sort Array/1122.py b/solutions/1122. Relative Sort Array/1122.py
index 3bf168833f8..ce356631f98 100644
--- a/solutions/1122. Relative Sort Array/1122.py	
+++ b/solutions/1122. Relative Sort Array/1122.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def relativeSortArray(self, arr1: list[int], arr2: list[int]) -> list[int]:
+  def relativeSortArray(self, arr1: List[int], arr2: List[int]) -> List[int]:
     ans = []
     count = [0] * 1001
 
diff --git a/solutions/1123. Lowest Common Ancestor of Deepest Leaves/1123.java b/solutions/1123. Lowest Common Ancestor of Deepest Leaves/1123.java
index 8b163831e08..e29ae6d8a57 100644
--- a/solutions/1123. Lowest Common Ancestor of Deepest Leaves/1123.java	
+++ b/solutions/1123. Lowest Common Ancestor of Deepest Leaves/1123.java	
@@ -1,15 +1,22 @@
+class T {
+  public TreeNode lca;
+  public int depth;
+  public T(TreeNode lca, int depth) {
+    this.lca = lca;
+    this.depth = depth;
+  }
+};
+
 class Solution {
   public TreeNode lcaDeepestLeaves(TreeNode root) {
     return dfs(root).lca;
   }
 
-  private record T(TreeNode lca, int depth) {}
-
   private T dfs(TreeNode root) {
     if (root == null)
       return new T(null, 0);
-    T left = dfs(root.left);
-    T right = dfs(root.right);
+    const T left = dfs(root.left);
+    const T right = dfs(root.right);
     if (left.depth > right.depth)
       return new T(left.lca, left.depth + 1);
     if (left.depth < right.depth)
diff --git a/solutions/1124. Longest Well-Performing Interval/1124.py b/solutions/1124. Longest Well-Performing Interval/1124.py
index 55deceb5566..1693410185e 100644
--- a/solutions/1124. Longest Well-Performing Interval/1124.py	
+++ b/solutions/1124. Longest Well-Performing Interval/1124.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestWPI(self, hours: list[int]) -> int:
+  def longestWPI(self, hours: List[int]) -> int:
     ans = 0
     prefix = 0
     dict = {}
diff --git a/solutions/1126. Active Businesses/1126.sql b/solutions/1126. Active Businesses/1126.sql
index a0cbd1b47fc..9ebafb0cdde 100644
--- a/solutions/1126. Active Businesses/1126.sql	
+++ b/solutions/1126. Active Businesses/1126.sql	
@@ -2,11 +2,11 @@ WITH
   AvgEvents AS (
     SELECT
       business_id,
-      AVG(occurrences) OVER(PARTITION BY event_type) AS event_avg_occurrences,
-      occurrences
+      AVG(occurences) OVER(PARTITION BY event_type) AS event_avg_occurences,
+      occurences
     FROM Events
   )
 SELECT business_id
 FROM AvgEvents
 GROUP BY 1
-HAVING SUM(IF(occurrences > event_avg_occurrences, 1, 0)) > 1;
+HAVING SUM(IF(occurences > event_avg_occurences, 1, 0)) > 1;
diff --git a/solutions/1128. Number of Equivalent Domino Pairs/1128.py b/solutions/1128. Number of Equivalent Domino Pairs/1128.py
index 4b01f86097d..475a7346e89 100644
--- a/solutions/1128. Number of Equivalent Domino Pairs/1128.py	
+++ b/solutions/1128. Number of Equivalent Domino Pairs/1128.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numEquivDominoPairs(self, dominoes: list[list[int]]) -> int:
+  def numEquivDominoPairs(self, dominoes: List[List[int]]) -> int:
     ans = 0
     count = collections.Counter()
 
diff --git a/solutions/1129. Shortest Path with Alternating Colors/1129.java b/solutions/1129. Shortest Path with Alternating Colors/1129.java
index f5a7f1f1aa5..0ecb56fe187 100644
--- a/solutions/1129. Shortest Path with Alternating Colors/1129.java	
+++ b/solutions/1129. Shortest Path with Alternating Colors/1129.java	
@@ -1,4 +1,4 @@
-enum Color { INIT, RED, BLUE }
+enum Color { kInit, kRed, kBlue }
 
 class Solution {
   public int[] shortestAlternatingPaths(int n, int[][] redEdges, int[][] blueEdges) {
@@ -7,19 +7,21 @@ public int[] shortestAlternatingPaths(int n, int[][] redEdges, int[][] blueEdges
     // graph[u] := [(v, edgeColor)]
     List<Pair<Integer, Color>>[] graph = new List[n];
     // [(u, prevColor)]
-    Queue<Pair<Integer, Color>> q = new ArrayDeque<>(List.of(new Pair<>(0, Color.INIT)));
-    Arrays.setAll(graph, i -> new ArrayList<>());
+    Queue<Pair<Integer, Color>> q = new ArrayDeque<>(Arrays.asList(new Pair<>(0, Color.kInit)));
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : redEdges) {
       final int u = edge[0];
       final int v = edge[1];
-      graph[u].add(new Pair<>(v, Color.RED));
+      graph[u].add(new Pair<>(v, Color.kRed));
     }
 
     for (int[] edge : blueEdges) {
       final int u = edge[0];
       final int v = edge[1];
-      graph[u].add(new Pair<>(v, Color.BLUE));
+      graph[u].add(new Pair<>(v, Color.kBlue));
     }
 
     for (int step = 0; !q.isEmpty(); ++step)
diff --git a/solutions/1129. Shortest Path with Alternating Colors/1129.py b/solutions/1129. Shortest Path with Alternating Colors/1129.py
index 770d53038ce..b2ddf64f644 100644
--- a/solutions/1129. Shortest Path with Alternating Colors/1129.py	
+++ b/solutions/1129. Shortest Path with Alternating Colors/1129.py	
@@ -2,27 +2,22 @@
 
 
 class Color(Enum):
-  INIT = 0
-  RED = 1
-  BLUE = 2
+  kInit = 0
+  kRed = 1
+  kBlue = 2
 
 
 class Solution:
-  def shortestAlternatingPaths(
-      self,
-      n: int,
-      redEdges: list[list[int]],
-      blueEdges: list[list[int]],
-  ) -> list[int]:
+  def shortestAlternatingPaths(self, n: int, redEdges: List[List[int]], blueEdges: List[List[int]]) -> List[int]:
     ans = [-1] * n
     graph = [[] for _ in range(n)]  # graph[u] := [(v, edgeColor)]
-    q = collections.deque([(0, Color.INIT)])  # [(u, prevColor)]
+    q = collections.deque([(0, Color.kInit)])  # [(u, prevColor)]
 
     for u, v in redEdges:
-      graph[u].append((v, Color.RED))
+      graph[u].append((v, Color.kRed))
 
     for u, v in blueEdges:
-      graph[u].append((v, Color.BLUE))
+      graph[u].append((v, Color.kBlue))
 
     step = 0
     while q:
diff --git a/solutions/113. Path Sum II/113.cpp b/solutions/113. Path Sum II/113.cpp
index b56944083cb..60ca8ad9ff9 100644
--- a/solutions/113. Path Sum II/113.cpp	
+++ b/solutions/113. Path Sum II/113.cpp	
@@ -19,8 +19,8 @@ class Solution {
     }
 
     path.push_back(root->val);
-    dfs(root->left, sum - root->val, std::move(path), ans);
-    dfs(root->right, sum - root->val, std::move(path), ans);
+    dfs(root->left, sum - root->val, move(path), ans);
+    dfs(root->right, sum - root->val, move(path), ans);
     path.pop_back();
   }
 };
diff --git a/solutions/113. Path Sum II/113.py b/solutions/113. Path Sum II/113.py
index c7850a90dc7..1040842ef5b 100644
--- a/solutions/113. Path Sum II/113.py	
+++ b/solutions/113. Path Sum II/113.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def pathSum(self, root: TreeNode, summ: int) -> list[list[int]]:
+  def pathSum(self, root: TreeNode, summ: int) -> List[List[int]]:
     ans = []
 
-    def dfs(root: TreeNode, summ: int, path: list[int]) -> None:
+    def dfs(root: TreeNode, summ: int, path: List[int]) -> None:
       if not root:
         return
       if root.val == summ and not root.left and not root.right:
diff --git a/solutions/1130. Minimum Cost Tree From Leaf Values/1130-2.py b/solutions/1130. Minimum Cost Tree From Leaf Values/1130-2.py
index 3ab084bdbad..f6762c6008f 100644
--- a/solutions/1130. Minimum Cost Tree From Leaf Values/1130-2.py	
+++ b/solutions/1130. Minimum Cost Tree From Leaf Values/1130-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def mctFromLeafValues(self, arr: list[int]) -> int:
+  def mctFromLeafValues(self, arr: List[int]) -> int:
     ans = 0
     stack = [math.inf]
 
diff --git a/solutions/1130. Minimum Cost Tree From Leaf Values/1130-3.py b/solutions/1130. Minimum Cost Tree From Leaf Values/1130-3.py
index 8021d363f56..65e569558e9 100644
--- a/solutions/1130. Minimum Cost Tree From Leaf Values/1130-3.py	
+++ b/solutions/1130. Minimum Cost Tree From Leaf Values/1130-3.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def mctFromLeafValues(self, arr: list[int]) -> int:
+  def mctFromLeafValues(self, arr: List[int]) -> int:
     ans = 0
 
     while len(arr) > 1:
diff --git a/solutions/1130. Minimum Cost Tree From Leaf Values/1130.py b/solutions/1130. Minimum Cost Tree From Leaf Values/1130.py
index cee048ccd73..56fd7cde2cb 100644
--- a/solutions/1130. Minimum Cost Tree From Leaf Values/1130.py	
+++ b/solutions/1130. Minimum Cost Tree From Leaf Values/1130.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def mctFromLeafValues(self, arr: list[int]) -> int:
+  def mctFromLeafValues(self, arr: List[int]) -> int:
     n = len(arr)
     # dp[i][j] := the minimum cost of arr[i..j]
     dp = [[0] * n for _ in range(n)]
diff --git a/solutions/1131. Maximum of Absolute Value Expression/1131.py b/solutions/1131. Maximum of Absolute Value Expression/1131.py
index d6a3d0d5b6d..ebab5c48ab6 100644
--- a/solutions/1131. Maximum of Absolute Value Expression/1131.py	
+++ b/solutions/1131. Maximum of Absolute Value Expression/1131.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxAbsValExpr(self, arr1: list[int], arr2: list[int]) -> int:
+  def maxAbsValExpr(self, arr1: List[int], arr2: List[int]) -> int:
     n = len(arr1)
     a = [arr1[i] + arr2[i] + i for i in range(n)]
     b = [arr1[i] + arr2[i] - i for i in range(n)]
diff --git a/solutions/1133. Largest Unique Number/1133.java b/solutions/1133. Largest Unique Number/1133.java
index 608ca7348ea..0e2149ac5c9 100644
--- a/solutions/1133. Largest Unique Number/1133.java	
+++ b/solutions/1133. Largest Unique Number/1133.java	
@@ -1,12 +1,12 @@
 class Solution {
   public int largestUniqueNumber(int[] nums) {
-    final int MAX = 1000;
-    int[] count = new int[MAX + 1];
+    final int kMax = 1000;
+    int[] count = new int[kMax + 1];
 
     for (final int num : nums)
       ++count[num];
 
-    for (int num = MAX; num >= 0; --num)
+    for (int num = kMax; num >= 0; --num)
       if (count[num] == 1)
         return num;
 
diff --git a/solutions/1133. Largest Unique Number/1133.py b/solutions/1133. Largest Unique Number/1133.py
index 4855acc0f29..0203c6e007a 100644
--- a/solutions/1133. Largest Unique Number/1133.py	
+++ b/solutions/1133. Largest Unique Number/1133.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def largestUniqueNumber(self, nums: list[int]) -> int:
+  def largestUniqueNumber(self, nums: List[int]) -> int:
     return max([num for num, freq in collections.Counter(nums).items()
                 if freq == 1], default=-1)
diff --git a/solutions/1135. Connecting Cities With Minimum Cost/1135.cpp b/solutions/1135. Connecting Cities With Minimum Cost/1135.cpp
index 45eea705d6d..bea058bc012 100644
--- a/solutions/1135. Connecting Cities With Minimum Cost/1135.cpp	
+++ b/solutions/1135. Connecting Cities With Minimum Cost/1135.cpp	
@@ -35,13 +35,14 @@ class Solution {
     UnionFind uf(n + 1);
 
     // Sort by cost.
-    ranges::sort(connections, ranges::less{},
-                 [](const vector<int>& connection) { return connection[2]; });
-
-    for (const vector<int>& connection : connections) {
-      const int u = connection[0];
-      const int v = connection[1];
-      const int cost = connection[2];
+    sort(
+        connections.begin(), connections.end(),
+        [](const vector<int>& a, const vector<int>& b) { return a[2] < b[2]; });
+
+    for (const vector<int>& c : connections) {
+      const int u = c[0];
+      const int v = c[1];
+      const int cost = c[2];
       if (uf.find(u) == uf.find(v))
         continue;
       uf.unionByRank(u, v);
diff --git a/solutions/1135. Connecting Cities With Minimum Cost/1135.java b/solutions/1135. Connecting Cities With Minimum Cost/1135.java
index 1ad8830c11e..adadf0a302d 100644
--- a/solutions/1135. Connecting Cities With Minimum Cost/1135.java	
+++ b/solutions/1135. Connecting Cities With Minimum Cost/1135.java	
@@ -35,12 +35,12 @@ public int minimumCost(int n, int[][] connections) {
     UnionFind uf = new UnionFind(n + 1);
 
     // Sort by cost.
-    Arrays.sort(connections, Comparator.comparingInt(connection -> connection[2]));
+    Arrays.sort(connections, (a, b) -> a[2] - b[2]);
 
-    for (int[] connection : connections) {
-      final int u = connection[0];
-      final int v = connection[1];
-      final int cost = connection[2];
+    for (int[] c : connections) {
+      final int u = c[0];
+      final int v = c[1];
+      final int cost = c[2];
       if (uf.find(u) == uf.find(v))
         continue;
       uf.unionByRank(u, v);
diff --git a/solutions/1135. Connecting Cities With Minimum Cost/1135.py b/solutions/1135. Connecting Cities With Minimum Cost/1135.py
index 4877955369a..3db4eaad18e 100644
--- a/solutions/1135. Connecting Cities With Minimum Cost/1135.py	
+++ b/solutions/1135. Connecting Cities With Minimum Cost/1135.py	
@@ -23,7 +23,7 @@ def find(self, u: int) -> int:
 
 
 class Solution:
-  def minimumCost(self, n: int, connections: list[list[int]]) -> int:
+  def minimumCost(self, n: int, connections: List[List[int]]) -> int:
     ans = 0
     uf = UnionFind(n + 1)
 
diff --git a/solutions/1136. Parallel Courses/1136-2.cpp b/solutions/1136. Parallel Courses/1136-2.cpp
index f5da035fe0d..e93e5a8cebd 100644
--- a/solutions/1136. Parallel Courses/1136-2.cpp	
+++ b/solutions/1136. Parallel Courses/1136-2.cpp	
@@ -1,6 +1,7 @@
 class Solution {
  public:
   int minimumSemesters(int n, vector<vector<int>>& relations) {
+    int ans = 0;
     vector<vector<int>> graph(n);
     vector<int> inDegrees(n);
     queue<int> q;
@@ -18,8 +19,7 @@ class Solution {
       if (inDegrees[i] == 0)
         q.push(i);
 
-    int step = 0;
-    for (; !q.empty(); ++step)
+    while (!q.empty()) {
       for (int sz = q.size(); sz > 0; --sz) {
         const int u = q.front();
         q.pop();
@@ -28,7 +28,9 @@ class Solution {
           if (--inDegrees[v] == 0)
             q.push(v);
       }
+      ++ans;
+    }
 
-    return n == 0 ? step : -1;
+    return n == 0 ? ans : -1;
   }
 };
diff --git a/solutions/1136. Parallel Courses/1136-2.java b/solutions/1136. Parallel Courses/1136-2.java
index 585d3ed0473..c9cb1dd3c7d 100644
--- a/solutions/1136. Parallel Courses/1136-2.java	
+++ b/solutions/1136. Parallel Courses/1136-2.java	
@@ -1,8 +1,11 @@
 class Solution {
   public int minimumSemesters(int n, int[][] relations) {
+    int ans = 0;
     List<Integer>[] graph = new List[n];
     int[] inDegrees = new int[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     // Build the graph.
     for (int[] relation : relations) {
@@ -18,8 +21,7 @@ public int minimumSemesters(int n, int[][] relations) {
                            .boxed()
                            .collect(Collectors.toCollection(ArrayDeque::new));
 
-    int step = 0;
-    for (; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
       for (int sz = q.size(); sz > 0; --sz) {
         final int u = q.poll();
         --n;
@@ -27,7 +29,9 @@ public int minimumSemesters(int n, int[][] relations) {
           if (--inDegrees[v] == 0)
             q.offer(v);
       }
+      ++ans;
+    }
 
-    return n == 0 ? step : -1;
+    return n == 0 ? ans : -1;
   }
 }
diff --git a/solutions/1136. Parallel Courses/1136-2.py b/solutions/1136. Parallel Courses/1136-2.py
index a219548353f..87c68f5d0b1 100644
--- a/solutions/1136. Parallel Courses/1136-2.py	
+++ b/solutions/1136. Parallel Courses/1136-2.py	
@@ -1,5 +1,6 @@
 class Solution:
-  def minimumSemesters(self, n: int, relations: list[list[int]]) -> int:
+  def minimumSemesters(self, n: int, relations: List[List[int]]) -> int:
+    ans = 0
     graph = [[] for _ in range(n)]
     inDegrees = [0] * n
 
@@ -11,7 +12,6 @@ def minimumSemesters(self, n: int, relations: list[list[int]]) -> int:
     # Perform topological sorting.
     q = collections.deque([i for i, d in enumerate(inDegrees) if d == 0])
 
-    step = 0
     while q:
       for _ in range(len(q)):
         u = q.popleft()
@@ -20,6 +20,6 @@ def minimumSemesters(self, n: int, relations: list[list[int]]) -> int:
           inDegrees[v] -= 1
           if inDegrees[v] == 0:
             q.append(v)
-      step += 1
+      ans += 1
 
-    return step if n == 0 else -1
+    return ans if n == 0 else -1
diff --git a/solutions/1136. Parallel Courses/1136.cpp b/solutions/1136. Parallel Courses/1136.cpp
index 165ee08a333..a5da7d5ca0c 100644
--- a/solutions/1136. Parallel Courses/1136.cpp	
+++ b/solutions/1136. Parallel Courses/1136.cpp	
@@ -27,6 +27,7 @@ class Solution {
       return true;
     if (states[u] == State::kVisited)
       return false;
+
     states[u] = State::kVisiting;
     for (const int v : graph[u]) {
       if (hasCycle(graph, v, states, depth))
@@ -34,6 +35,7 @@ class Solution {
       depth[u] = max(depth[u], 1 + depth[v]);
     }
     states[u] = State::kVisited;
+
     return false;
   }
 };
diff --git a/solutions/1136. Parallel Courses/1136.java b/solutions/1136. Parallel Courses/1136.java
index c6dbce84244..9b321e70cfa 100644
--- a/solutions/1136. Parallel Courses/1136.java	
+++ b/solutions/1136. Parallel Courses/1136.java	
@@ -1,4 +1,4 @@
-enum State { INIT, VISITING, VISITED }
+enum State { kInit, kVisiting, kVisited }
 
 class Solution {
   public int minimumSemesters(int n, int[][] relations) {
@@ -6,7 +6,9 @@ public int minimumSemesters(int n, int[][] relations) {
     State[] states = new State[n];
     int[] depth = new int[n];
     Arrays.fill(depth, 1);
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] relation : relations) {
       final int u = relation[0] - 1;
@@ -22,17 +24,19 @@ public int minimumSemesters(int n, int[][] relations) {
   }
 
   private boolean hasCycle(List<Integer>[] graph, int u, State[] states, int[] depth) {
-    if (states[u] == State.VISITING)
+    if (states[u] == State.kVisiting)
       return true;
-    if (states[u] == State.VISITED)
+    if (states[u] == State.kVisited)
       return false;
-    states[u] = State.VISITING;
+
+    states[u] = State.kVisiting;
     for (final int v : graph[u]) {
       if (hasCycle(graph, v, states, depth))
         return true;
       depth[u] = Math.max(depth[u], 1 + depth[v]);
     }
-    states[u] = State.VISITED;
+    states[u] = State.kVisited;
+
     return false;
   }
 }
diff --git a/solutions/1136. Parallel Courses/1136.py b/solutions/1136. Parallel Courses/1136.py
index 9478496ec61..f37e5b5d35f 100644
--- a/solutions/1136. Parallel Courses/1136.py	
+++ b/solutions/1136. Parallel Courses/1136.py	
@@ -2,31 +2,33 @@
 
 
 class State(Enum):
-  INIT = 0
-  VISITING = 1
-  VISITED = 2
+  kInit = 0
+  kVisiting = 1
+  kVisited = 2
 
 
 class Solution:
-  def minimumSemesters(self, n: int, relations: list[list[int]]) -> int:
+  def minimumSemesters(self, n: int, relations: List[List[int]]) -> int:
     graph = [[] for _ in range(n)]
-    states = [State.INIT] * n
+    states = [State.kInit] * n
     depth = [1] * n
 
     for u, v in relations:
       graph[u - 1].append(v - 1)
 
     def hasCycle(u: int) -> bool:
-      if states[u] == State.VISITING:
+      if states[u] == State.kVisiting:
         return True
-      if states[u] == State.VISITED:
+      if states[u] == State.kVisited:
         return False
-      states[u] = State.VISITING
+
+      states[u] = State.kVisiting
       for v in graph[u]:
         if hasCycle(v):
           return True
         depth[u] = max(depth[u], 1 + depth[v])
-      states[u] = State.VISITED
+      states[u] = State.kVisited
+
       return False
 
     if any(hasCycle(i) for i in range(n)):
diff --git a/solutions/1139. Largest 1-Bordered Square/1139.py b/solutions/1139. Largest 1-Bordered Square/1139.py
index 72bcd696859..ff8afedaaa2 100644
--- a/solutions/1139. Largest 1-Bordered Square/1139.py	
+++ b/solutions/1139. Largest 1-Bordered Square/1139.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largest1BorderedSquare(self, grid: list[list[int]]) -> int:
+  def largest1BorderedSquare(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
 
@@ -20,11 +20,7 @@ def largest1BorderedSquare(self, grid: list[list[int]]) -> int:
           x = i + sz - 1
           y = j + sz - 1
           # If grid[i..x][j..y] has all 1s on its border.
-          if min(
-                  leftOnes[i][y],
-                  leftOnes[x][y],
-                  topOnes[x][j],
-                  topOnes[x][y]) >= sz:
+          if min(leftOnes[i][y], leftOnes[x][y], topOnes[x][j], topOnes[x][y]) >= sz:
             return sz * sz
 
     return 0
diff --git a/solutions/114. Flatten Binary Tree to Linked List/114-2.py b/solutions/114. Flatten Binary Tree to Linked List/114-2.py
index 9703f0e57c1..384f9c0ef64 100644
--- a/solutions/114. Flatten Binary Tree to Linked List/114-2.py	
+++ b/solutions/114. Flatten Binary Tree to Linked List/114-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def flatten(self, root: TreeNode | None) -> None:
+  def flatten(self, root: Optional[TreeNode]) -> None:
     if not root:
       return
 
diff --git a/solutions/114. Flatten Binary Tree to Linked List/114-3.cpp b/solutions/114. Flatten Binary Tree to Linked List/114-3.cpp
index 5e56e34390b..6c3fc1b6ee9 100644
--- a/solutions/114. Flatten Binary Tree to Linked List/114-3.cpp	
+++ b/solutions/114. Flatten Binary Tree to Linked List/114-3.cpp	
@@ -4,11 +4,11 @@ class Solution {
     if (root == nullptr)
       return;
 
-    while (root != nullptr) {
-      if (root->left != nullptr) {
+    while (root) {
+      if (root->left) {
         // Find the rightmost root.
         TreeNode* rightmost = root->left;
-        while (rightmost->right != nullptr)
+        while (rightmost->right)
           rightmost = rightmost->right;
         // Rewire the connections.
         rightmost->right = root->right;
diff --git a/solutions/114. Flatten Binary Tree to Linked List/114-3.py b/solutions/114. Flatten Binary Tree to Linked List/114-3.py
index 4c31ac60510..765817547a9 100644
--- a/solutions/114. Flatten Binary Tree to Linked List/114-3.py	
+++ b/solutions/114. Flatten Binary Tree to Linked List/114-3.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def flatten(self, root: TreeNode | None) -> None:
+  def flatten(self, root: Optional[TreeNode]) -> None:
     if not root:
       return
 
diff --git a/solutions/114. Flatten Binary Tree to Linked List/114.cpp b/solutions/114. Flatten Binary Tree to Linked List/114.cpp
index e37ed718daf..d439c52f50f 100644
--- a/solutions/114. Flatten Binary Tree to Linked List/114.cpp	
+++ b/solutions/114. Flatten Binary Tree to Linked List/114.cpp	
@@ -15,7 +15,7 @@ class Solution {
 
     // Connect the original right subtree to the end of the new right subtree.
     TreeNode* rightmost = root;
-    while (rightmost->right != nullptr)
+    while (rightmost->right)
       rightmost = rightmost->right;
     rightmost->right = right;
   }
diff --git a/solutions/114. Flatten Binary Tree to Linked List/114.py b/solutions/114. Flatten Binary Tree to Linked List/114.py
index c3bcf26ad73..f2dc9c822b6 100644
--- a/solutions/114. Flatten Binary Tree to Linked List/114.py	
+++ b/solutions/114. Flatten Binary Tree to Linked List/114.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def flatten(self, root: TreeNode | None) -> None:
+  def flatten(self, root: Optional[TreeNode]) -> None:
     if not root:
       return
 
diff --git a/solutions/1143. Longest Common Subsequence/1143.py b/solutions/1143. Longest Common Subsequence/1143.py
index 7b5553407f7..9892c48f0b7 100644
--- a/solutions/1143. Longest Common Subsequence/1143.py	
+++ b/solutions/1143. Longest Common Subsequence/1143.py	
@@ -7,7 +7,8 @@ def longestCommonSubsequence(self, text1: str, text2: str) -> int:
 
     for i in range(m):
       for j in range(n):
-        dp[i + 1][j + 1] = (1 + dp[i][j] if text1[i] == text2[j]
-                            else max(dp[i][j + 1], dp[i + 1][j]))
+        dp[i + 1][j + 1] = \
+            1 + dp[i][j] if text1[i] == text2[j] \
+            else max(dp[i][j + 1], dp[i + 1][j])
 
     return dp[m][n]
diff --git a/solutions/1144. Decrease Elements To Make Array Zigzag/1144.py b/solutions/1144. Decrease Elements To Make Array Zigzag/1144.py
index 5e9bc58432d..685b67c1d84 100644
--- a/solutions/1144. Decrease Elements To Make Array Zigzag/1144.py	
+++ b/solutions/1144. Decrease Elements To Make Array Zigzag/1144.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def movesToMakeZigzag(self, nums: list[int]) -> int:
+  def movesToMakeZigzag(self, nums: List[int]) -> int:
     decreasing = [0] * 2
 
     for i, num in enumerate(nums):
diff --git a/solutions/1146. Snapshot Array/1146.cpp b/solutions/1146. Snapshot Array/1146.cpp
index c4920a670c9..a0e298d1dda 100644
--- a/solutions/1146. Snapshot Array/1146.cpp	
+++ b/solutions/1146. Snapshot Array/1146.cpp	
@@ -19,7 +19,7 @@ class SnapshotArray {
 
   int get(int index, int snap_id) {
     const vector<pair<int, int>>& snap = snaps[index];
-    auto it = ranges::lower_bound(snap, pair<int, int>{snap_id + 1, 0});
+    auto it = ranges::lower_bound(snap, make_pair(snap_id + 1, 0));
     return prev(it)->second;
   }
 
diff --git a/solutions/1146. Snapshot Array/1146.java b/solutions/1146. Snapshot Array/1146.java
index 7df7dac151d..d7370abb40f 100644
--- a/solutions/1146. Snapshot Array/1146.java	
+++ b/solutions/1146. Snapshot Array/1146.java	
@@ -21,7 +21,7 @@ public int snap() {
 
   public int get(int index, int snap_id) {
     int i = Collections.binarySearch(snaps[index], new int[] {snap_id, 0},
-                                     Comparator.comparingInt(snap -> snap[0]));
+                                     (a, b) -> Integer.compare(a[0], b[0]));
     if (i < 0)
       i = -i - 2;
     return snaps[index].get(i)[1];
diff --git a/solutions/1146. Snapshot Array/1146.py b/solutions/1146. Snapshot Array/1146.py
index 354ef2f82dd..68ff3d0b548 100644
--- a/solutions/1146. Snapshot Array/1146.py	
+++ b/solutions/1146. Snapshot Array/1146.py	
@@ -15,5 +15,5 @@ def snap(self) -> int:
     return self.snap_id - 1
 
   def get(self, index: int, snap_id: int) -> int:
-    i = bisect.bisect_left(self.snaps[index], [snap_id + 1]) - 1
+    i = bisect_left(self.snaps[index], [snap_id + 1]) - 1
     return self.snaps[index][i][1]
diff --git a/solutions/1150. Check If a Number Is Majority Element in a Sorted Array/1150.java b/solutions/1150. Check If a Number Is Majority Element in a Sorted Array/1150.java
index 3b6481e547c..12322141084 100644
--- a/solutions/1150. Check If a Number Is Majority Element in a Sorted Array/1150.java	
+++ b/solutions/1150. Check If a Number Is Majority Element in a Sorted Array/1150.java	
@@ -5,12 +5,12 @@ public boolean isMajorityElement(int[] nums, int target) {
     return i + n / 2 < n && nums[i + n / 2] == target;
   }
 
-  private int firstGreaterEqual(int[] arr, int target) {
+  private int firstGreaterEqual(int[] A, int target) {
     int l = 0;
-    int r = arr.length;
+    int r = A.length;
     while (l < r) {
       final int m = (l + r) / 2;
-      if (arr[m] >= target)
+      if (A[m] >= target)
         r = m;
       else
         l = m + 1;
diff --git a/solutions/1150. Check If a Number Is Majority Element in a Sorted Array/1150.py b/solutions/1150. Check If a Number Is Majority Element in a Sorted Array/1150.py
index e28c791393d..ffd7c97bff9 100644
--- a/solutions/1150. Check If a Number Is Majority Element in a Sorted Array/1150.py	
+++ b/solutions/1150. Check If a Number Is Majority Element in a Sorted Array/1150.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isMajorityElement(self, nums: list[int], target: int) -> bool:
+  def isMajorityElement(self, nums: List[int], target: int) -> bool:
     n = len(nums)
     i = bisect.bisect_left(nums, target)
     return i + n // 2 < n and nums[i + n // 2] == target
diff --git a/solutions/1151. Minimum Swaps to Group All 1's Together/1151.java b/solutions/1151. Minimum Swaps to Group All 1's Together/1151.java
index c832129e256..6a6b9406a41 100644
--- a/solutions/1151. Minimum Swaps to Group All 1's Together/1151.java	
+++ b/solutions/1151. Minimum Swaps to Group All 1's Together/1151.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int minSwaps(int[] data) {
     final int k = (int) Arrays.stream(data).filter(a -> a == 1).count();
-    int ones = 0;    // the number of ones in the window
+    int ones = 1;    // the number of ones in the window
     int maxOnes = 0; // the maximum number of ones in the window
 
     for (int i = 0; i < data.length; ++i) {
diff --git a/solutions/1151. Minimum Swaps to Group All 1's Together/1151.py b/solutions/1151. Minimum Swaps to Group All 1's Together/1151.py
index 5ffc30aed5d..9c371acd1cb 100644
--- a/solutions/1151. Minimum Swaps to Group All 1's Together/1151.py	
+++ b/solutions/1151. Minimum Swaps to Group All 1's Together/1151.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minSwaps(self, data: list[int]) -> int:
+  def minSwaps(self, data: List[int]) -> int:
     k = data.count(1)
     ones = 0  # the number of ones in the window
     maxOnes = 0  # the maximum number of ones in the window
diff --git a/solutions/1152. Analyze User Website Visit Pattern/1152.py b/solutions/1152. Analyze User Website Visit Pattern/1152.py
index e8ae38f0073..4263edb22f9 100644
--- a/solutions/1152. Analyze User Website Visit Pattern/1152.py	
+++ b/solutions/1152. Analyze User Website Visit Pattern/1152.py	
@@ -1,16 +1,9 @@
 class Solution:
-  def mostVisitedPattern(
-      self,
-      username: list[str],
-      timestamp: list[int],
-      website: list[str],
-  ) -> list[str]:
+  def mostVisitedPattern(self, username: List[str], timestamp: List[int], website: List[str]) -> List[str]:
     userToSites = collections.defaultdict(list)
 
     # Sort websites of each user by timestamp.
-    for user, _, site in sorted(
-            zip(username, timestamp, website),
-            key=lambda x: x[1]):
+    for user, _, site in sorted(zip(username, timestamp, website), key=lambda x: (x[1])):
       userToSites[user].append(site)
 
     # For each of three websites, count its frequency.
diff --git a/solutions/1155. Number of Dice Rolls With Target Sum/1155.cpp b/solutions/1155. Number of Dice Rolls With Target Sum/1155.cpp
index 153ff129e97..061dea3b6a0 100644
--- a/solutions/1155. Number of Dice Rolls With Target Sum/1155.cpp	
+++ b/solutions/1155. Number of Dice Rolls With Target Sum/1155.cpp	
@@ -12,7 +12,7 @@ class Solution {
           newDp[t] += dp[t - i];
           newDp[t] %= kMod;
         }
-      dp = std::move(newDp);
+      dp = move(newDp);
     }
 
     return dp[target];
diff --git a/solutions/1155. Number of Dice Rolls With Target Sum/1155.java b/solutions/1155. Number of Dice Rolls With Target Sum/1155.java
index f11568fd131..258cc519bfb 100644
--- a/solutions/1155. Number of Dice Rolls With Target Sum/1155.java	
+++ b/solutions/1155. Number of Dice Rolls With Target Sum/1155.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numRollsToTarget(int n, int k, int target) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int[] dp = new int[target + 1];
     dp[0] = 1;
 
@@ -9,7 +9,7 @@ public int numRollsToTarget(int n, int k, int target) {
       for (int i = 1; i <= k; ++i)          // numbers 1, 2, ..., f
         for (int t = i; t <= target; ++t) { // all the possible targets
           newDp[t] += dp[t - i];
-          newDp[t] %= MOD;
+          newDp[t] %= kMod;
         }
       dp = newDp;
     }
diff --git a/solutions/1155. Number of Dice Rolls With Target Sum/1155.py b/solutions/1155. Number of Dice Rolls With Target Sum/1155.py
index ebe9da0eb40..77aaad4d25b 100644
--- a/solutions/1155. Number of Dice Rolls With Target Sum/1155.py	
+++ b/solutions/1155. Number of Dice Rolls With Target Sum/1155.py	
@@ -1,6 +1,6 @@
 class Solution:
   def numRollsToTarget(self, n: int, k: int, target: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     dp = [1] + [0] * target
 
     for _ in range(n):  # n dices
@@ -8,7 +8,7 @@ def numRollsToTarget(self, n: int, k: int, target: int) -> int:
       for i in range(1, k + 1):  # numbers 1, 2, ..., f
         for t in range(i, target + 1):  # all the possible targets
           newDp[t] += dp[t - i]
-          newDp[t] %= MOD
+          newDp[t] %= kMod
       dp = newDp
 
     return dp[target]
diff --git a/solutions/1156. Swap For Longest Repeated Character Substring/1156.cpp b/solutions/1156. Swap For Longest Repeated Character Substring/1156.cpp
index 5cf9a0cb06c..51b7fc169dd 100644
--- a/solutions/1156. Swap For Longest Repeated Character Substring/1156.cpp	
+++ b/solutions/1156. Swap For Longest Repeated Character Substring/1156.cpp	
@@ -5,7 +5,7 @@ class Solution {
     vector<int> count(26);
     vector<pair<char, int>> groups{{text[0], 1}};
 
-    for (const char c : text)
+    for (char c : text)
       ++count[c - 'a'];
 
     for (int i = 1; i < text.length(); ++i)
diff --git a/solutions/1156. Swap For Longest Repeated Character Substring/1156.java b/solutions/1156. Swap For Longest Repeated Character Substring/1156.java
index 7d6bb1916af..bcf0a017747 100644
--- a/solutions/1156. Swap For Longest Repeated Character Substring/1156.java	
+++ b/solutions/1156. Swap For Longest Repeated Character Substring/1156.java	
@@ -4,7 +4,7 @@ public int maxRepOpt1(String text) {
     int[] count = new int[26];
     List<int[]> groups = new ArrayList<>();
 
-    for (final char c : text.toCharArray())
+    for (char c : text.toCharArray())
       ++count[c - 'a'];
 
     groups.add(new int[] {text.charAt(0), 1});
diff --git a/solutions/1156. Swap For Longest Repeated Character Substring/1156.py b/solutions/1156. Swap For Longest Repeated Character Substring/1156.py
index 19d51104850..03782c65440 100644
--- a/solutions/1156. Swap For Longest Repeated Character Substring/1156.py	
+++ b/solutions/1156. Swap For Longest Repeated Character Substring/1156.py	
@@ -8,8 +8,6 @@ def maxRepOpt1(self, text: str) -> int:
     for i in range(1, len(groups) - 1):
       if groups[i - 1][0] == groups[i + 1][0] and groups[i][1] == 1:
         ans = max(
-            ans,
-            min(groups[i - 1][1] + groups[i + 1][1] + 1, count
-                [groups[i - 1][0]]))
+            ans, min(groups[i - 1][1] + groups[i + 1][1] + 1, count[groups[i - 1][0]]))
 
     return ans
diff --git a/solutions/1157. Online Majority Element In Subarray/1157.java b/solutions/1157. Online Majority Element In Subarray/1157.java
index a5fdf04f67a..259d29112d0 100644
--- a/solutions/1157. Online Majority Element In Subarray/1157.java	
+++ b/solutions/1157. Online Majority Element In Subarray/1157.java	
@@ -9,7 +9,7 @@ public MajorityChecker(int[] arr) {
   }
 
   public int query(int left, int right, int threshold) {
-    for (int i = 0; i < TIMES; ++i) {
+    for (int i = 0; i < kTimes; ++i) {
       final int randIndex = rand.nextInt(right - left + 1) + left;
       final int num = arr[randIndex];
       List<Integer> indices = numToIndices.get(num);
@@ -22,7 +22,7 @@ public int query(int left, int right, int threshold) {
     return -1;
   }
 
-  private static final int TIMES = 20; // 2^TIMES >> |arr|
+  private static final int kTimes = 20; // 2^kTimes >> |arr|
   private int[] arr;
   private Map<Integer, List<Integer>> numToIndices = new HashMap<>();
   private Random rand = new Random();
diff --git a/solutions/1157. Online Majority Element In Subarray/1157.py b/solutions/1157. Online Majority Element In Subarray/1157.py
index 54f96dbc6aa..fcaac8c74a0 100644
--- a/solutions/1157. Online Majority Element In Subarray/1157.py	
+++ b/solutions/1157. Online Majority Element In Subarray/1157.py	
@@ -1,14 +1,14 @@
 class MajorityChecker:
-  def __init__(self, arr: list[int]):
+  def __init__(self, arr: List[int]):
     self.arr = arr
-    self.TIMES = 20  # 2^TIMES >> |arr|
+    self.kTimes = 20  # 2^kTimes >> |arr|
     self.numToIndices = collections.defaultdict(list)
 
     for i, a in enumerate(self.arr):
       self.numToIndices[a].append(i)
 
   def query(self, left: int, right: int, threshold: int) -> int:
-    for _ in range(self.TIMES):
+    for _ in range(self.kTimes):
       randIndex = random.randint(left, right)
       num = self.arr[randIndex]
       indices = self.numToIndices[num]
diff --git a/solutions/116. Populating Next Right Pointers in Each Node/116.py b/solutions/116. Populating Next Right Pointers in Each Node/116.py
index 61c60ce4c65..c47bb914ec6 100644
--- a/solutions/116. Populating Next Right Pointers in Each Node/116.py	
+++ b/solutions/116. Populating Next Right Pointers in Each Node/116.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def connect(self, root: 'Node | None') -> 'Node | None':
+  def connect(self, root: 'Optional[Node]') -> 'Optional[Node]':
     if not root:
       return None
 
diff --git a/solutions/1160. Find Words That Can Be Formed by Characters/1160.py b/solutions/1160. Find Words That Can Be Formed by Characters/1160.py
index ae2bde97964..f96053addc2 100644
--- a/solutions/1160. Find Words That Can Be Formed by Characters/1160.py	
+++ b/solutions/1160. Find Words That Can Be Formed by Characters/1160.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countCharacters(self, words: list[str], chars: str) -> int:
+  def countCharacters(self, words: List[str], chars: str) -> int:
     ans = 0
     count = collections.Counter(chars)
 
diff --git a/solutions/1161. Maximum Level Sum of a Binary Tree/1161-2.py b/solutions/1161. Maximum Level Sum of a Binary Tree/1161-2.py
index 7fee0116b8e..de8ae47646a 100644
--- a/solutions/1161. Maximum Level Sum of a Binary Tree/1161-2.py	
+++ b/solutions/1161. Maximum Level Sum of a Binary Tree/1161-2.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def maxLevelSum(self, root: TreeNode | None) -> int:
+  def maxLevelSum(self, root: Optional[TreeNode]) -> int:
     # levelSums[i] := the sum of level (i + 1) (1-indexed)
     levelSums = []
 
-    def dfs(root: TreeNode | None, level: int) -> None:
+    def dfs(root: Optional[TreeNode], level: int) -> None:
       if not root:
         return
       if len(levelSums) == level:
diff --git a/solutions/1161. Maximum Level Sum of a Binary Tree/1161.py b/solutions/1161. Maximum Level Sum of a Binary Tree/1161.py
index 91e8d6b51eb..f7e02b6b7ff 100644
--- a/solutions/1161. Maximum Level Sum of a Binary Tree/1161.py	
+++ b/solutions/1161. Maximum Level Sum of a Binary Tree/1161.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxLevelSum(self, root: TreeNode | None) -> int:
+  def maxLevelSum(self, root: Optional[TreeNode]) -> int:
     ans = 0
     maxLevelSum = -math.inf
     q = collections.deque([root])
diff --git a/solutions/1162. As Far from Land as Possible/1162.cpp b/solutions/1162. As Far from Land as Possible/1162.cpp
index 1f21dc1dc44..137629d8951 100644
--- a/solutions/1162. As Far from Land as Possible/1162.cpp	
+++ b/solutions/1162. As Far from Land as Possible/1162.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int maxDistance(vector<vector<int>>& grid) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = grid.size();
     const int n = grid[0].size();
     queue<pair<int, int>> q;
@@ -24,7 +24,7 @@ class Solution {
         const auto [i, j] = q.front();
         q.pop();
         ans = d;
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1162. As Far from Land as Possible/1162.java b/solutions/1162. As Far from Land as Possible/1162.java
index ed9f3090609..dafadc80db3 100644
--- a/solutions/1162. As Far from Land as Possible/1162.java	
+++ b/solutions/1162. As Far from Land as Possible/1162.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int maxDistance(int[][] grid) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = grid.length;
     final int n = grid[0].length;
     Queue<Pair<Integer, Integer>> q = new ArrayDeque<>();
@@ -24,7 +24,7 @@ public int maxDistance(int[][] grid) {
         final int i = pair.getKey();
         final int j = pair.getValue();
         ans = d;
-        for (int[] dir : DIRS) {
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1162. As Far from Land as Possible/1162.py b/solutions/1162. As Far from Land as Possible/1162.py
index a6a49ff4e86..91d8a0fec6a 100644
--- a/solutions/1162. As Far from Land as Possible/1162.py	
+++ b/solutions/1162. As Far from Land as Possible/1162.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def maxDistance(self, grid: list[list[int]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def maxDistance(self, grid: List[List[int]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
     q = collections.deque()
@@ -23,7 +23,7 @@ def maxDistance(self, grid: list[list[int]]) -> int:
       for _ in range(len(q)):
         i, j = q.popleft()
         ans = d
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/1163. Last Substring in Lexicographical Order/1163.cpp b/solutions/1163. Last Substring in Lexicographical Order/1163.cpp
index e3345069f6d..09edfe36f80 100644
--- a/solutions/1163. Last Substring in Lexicographical Order/1163.cpp	
+++ b/solutions/1163. Last Substring in Lexicographical Order/1163.cpp	
@@ -5,25 +5,22 @@ class Solution {
     int j = 1;
     int k = 0;  // the number of the same letters of s[i..n) and s[j..n)
 
-    while (j + k < s.length())
+    while (j + k < s.length()) {
       if (s[i + k] == s[j + k]) {
         ++k;
       } else if (s[i + k] > s[j + k]) {
-        // Skip s[j..j + k) and advance to s[j + k + 1] to find a possible
-        // lexicographically larger substring since s[i..i + k) == s[j..j + k)
-        // and s[i + k] > s[j + k).
-        j = j + k + 1;
+        // s[i..i + k] == s[j..j + k] and s[i + k] > s[j + k] means that we
+        // should start from s[j + k] to find a possible larger substring.
+        j += k + 1;
         k = 0;
       } else {
-        // Skip s[i..i + k) and advance to s[i + k + 1] or s[j] to find a
-        // possible lexicographically larger substring since
-        // s[i..i + k) == s[j..j + k) and s[i + k] < s[j + k).
-        // Note that it's unnecessary to explore s[i + k + 1..j) if
-        // i + k + 1 < j since they are already explored by j.
+        // s[i..i + k] == s[j..j + k] and s[i + k] < s[j + k] means that either
+        // starting from s[i + k + 1] or s[j] has a larger substring.
         i = max(i + k + 1, j);
         j = i + 1;
         k = 0;
       }
+    }
 
     return s.substr(i);
   }
diff --git a/solutions/1163. Last Substring in Lexicographical Order/1163.java b/solutions/1163. Last Substring in Lexicographical Order/1163.java
index f6302181545..72d10bd6217 100644
--- a/solutions/1163. Last Substring in Lexicographical Order/1163.java	
+++ b/solutions/1163. Last Substring in Lexicographical Order/1163.java	
@@ -4,25 +4,22 @@ public String lastSubstring(String s) {
     int j = 1;
     int k = 0; // the number of the same letters of s[i..n) and s[j..n)
 
-    while (j + k < s.length())
+    while (j + k < s.length()) {
       if (s.charAt(i + k) == s.charAt(j + k)) {
         ++k;
       } else if (s.charAt(i + k) > s.charAt(j + k)) {
-        // Skip s[j..j + k) and advance to s[j + k + 1] to find a possible
-        // lexicographically larger substring since s[i..i + k) == s[j..j + k)
-        // and s[i + k] > s[j + k).
-        j = j + k + 1;
+        // s[i..i + k] == s[j..j + k] and s[i + k] > s[j + k] means that we
+        // should start from s[j + k] to find a possible larger substring.
+        j += k + 1;
         k = 0;
       } else {
-        // Skip s[i..i + k) and advance to s[i + k + 1] or s[j] to find a
-        // possible lexicographically larger substring since
-        // s[i..i + k) == s[j..j + k) and s[i + k] < s[j + k).
-        // Note that it's unnecessary to explore s[i + k + 1..j) if
-        // i + k + 1 < j since they are already explored by j.
+        // s[i..i + k] == s[j..j + k] and s[i + k] < s[j + k] means that either
+        // starting from s[i + k + 1] or s[j] has a larger substring.
         i = Math.max(i + k + 1, j);
         j = i + 1;
         k = 0;
       }
+    }
 
     return s.substring(i);
   }
diff --git a/solutions/1163. Last Substring in Lexicographical Order/1163.py b/solutions/1163. Last Substring in Lexicographical Order/1163.py
index 1d690157506..2ef73f4b430 100644
--- a/solutions/1163. Last Substring in Lexicographical Order/1163.py	
+++ b/solutions/1163. Last Substring in Lexicographical Order/1163.py	
@@ -8,17 +8,13 @@ def lastSubstring(self, s: str) -> str:
       if s[i + k] == s[j + k]:
         k += 1
       elif s[i + k] > s[j + k]:
-        # Skip s[j..j + k) and advance to s[j + k + 1] to find a possible
-        # lexicographically larger substring since s[i..i + k) == s[j..j + k)
-        # and s[i + k] > s[j + k).
-        j = j + k + 1
+        # s[i..i + k] == s[j..j + k] and s[i + k] > s[j + k] means that we
+        # should start from s[j + k] to find a possible larger substring.
+        j += k + 1
         k = 0
       else:
-        # Skip s[i..i + k) and advance to s[i + k + 1] or s[j] to find a
-        # possible lexicographically larger substring since
-        # s[i..i + k) == s[j..j + k) and s[i + k] < s[j + k).
-        # Note that it's unnecessary to explore s[i + k + 1..j) if
-        # i + k + 1 < j since they are already explored by j.
+        # s[i..i + k] == s[j..j + k] and s[i + k] < s[j + k] means that either
+        # starting from s[i + k + 1] or s[j] has a larger substring
         i = max(i + k + 1, j)
         j = i + 1
         k = 0
diff --git a/solutions/1165. Single-Row Keyboard/1165.py b/solutions/1165. Single-Row Keyboard/1165.py
index 1a960ad5838..b7a9953d99c 100644
--- a/solutions/1165. Single-Row Keyboard/1165.py	
+++ b/solutions/1165. Single-Row Keyboard/1165.py	
@@ -1,6 +1,6 @@
 class Solution:
   def calculateTime(self, keyboard: str, word: str) -> int:
     letterToIndex = {c: i for i, c in enumerate(keyboard)}
-    return (letterToIndex[word[0]] +
-            sum(abs(letterToIndex[a] - letterToIndex[b])
-            for a, b in itertools.pairwise(word)))
+    return letterToIndex[word[0]] + \
+        sum(abs(letterToIndex[a] - letterToIndex[b])
+            for a, b in itertools.pairwise(word))
diff --git a/solutions/1166. Design File System/1166.cpp b/solutions/1166. Design File System/1166.cpp
index c8d80095224..55b55f2a689 100644
--- a/solutions/1166. Design File System/1166.cpp	
+++ b/solutions/1166. Design File System/1166.cpp	
@@ -24,13 +24,16 @@ class FileSystem {
   }
 
   int get(string path) {
+    const vector<string> subpaths = getSubpaths(path);
     shared_ptr<TrieNode> node = root;
+
     for (const string& subpath : getSubpaths(path)) {
       auto it = node->children.find(subpath);
       if (it == node->children.end())
         return -1;
       node = it->second;
     }
+
     return node->value;
   }
 
diff --git a/solutions/1166. Design File System/1166.java b/solutions/1166. Design File System/1166.java
index 6bd34c9158f..bb70ee97720 100644
--- a/solutions/1166. Design File System/1166.java	
+++ b/solutions/1166. Design File System/1166.java	
@@ -27,11 +27,13 @@ public boolean createPath(String path, int value) {
   public int get(String path) {
     final String[] subpaths = path.split("/");
     TrieNode node = root;
+
     for (int i = 1; i < subpaths.length; ++i) {
       if (!node.children.containsKey(subpaths[i]))
         return -1;
       node = node.children.get(subpaths[i]);
     }
+
     return node.value;
   }
 
diff --git a/solutions/1166. Design File System/1166.py b/solutions/1166. Design File System/1166.py
index 12bba88e74d..3fdc6c85528 100644
--- a/solutions/1166. Design File System/1166.py	
+++ b/solutions/1166. Design File System/1166.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self, value: int = 0):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
     self.value = value
 
 
@@ -24,8 +24,10 @@ def createPath(self, path: str, value: int) -> bool:
 
   def get(self, path: str) -> int:
     node: TrieNode = self.root
+
     for subpath in path.split('/')[1:]:
       if subpath not in node.children:
         return -1
       node = node.children[subpath]
+
     return node.value
diff --git a/solutions/1167. Minimum Cost to Connect Sticks/1167.py b/solutions/1167. Minimum Cost to Connect Sticks/1167.py
index 5ef77b4ed2f..c34a2e7589b 100644
--- a/solutions/1167. Minimum Cost to Connect Sticks/1167.py	
+++ b/solutions/1167. Minimum Cost to Connect Sticks/1167.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def connectSticks(self, sticks: list[int]) -> int:
+  def connectSticks(self, sticks: List[int]) -> int:
     ans = 0
     heapq.heapify(sticks)
 
diff --git a/solutions/1168. Optimize Water Distribution in a Village/1168.java b/solutions/1168. Optimize Water Distribution in a Village/1168.java
index 86d844dd8c2..6b6c40d2efd 100644
--- a/solutions/1168. Optimize Water Distribution in a Village/1168.java	
+++ b/solutions/1168. Optimize Water Distribution in a Village/1168.java	
@@ -3,7 +3,7 @@ public int minCostToSupplyWater(int n, int[] wells, int[][] pipes) {
     int ans = 0;
     List<Pair<Integer, Integer>>[] graph = new List[n + 1];
     Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey)); // (d, u)
+        new PriorityQueue<>(Comparator.comparing(Pair::getKey)); // (d, u)
 
     for (int i = 0; i <= n; ++i)
       graph[i] = new ArrayList<>();
@@ -25,8 +25,9 @@ public int minCostToSupplyWater(int n, int[] wells, int[][] pipes) {
     Set<Integer> mst = new HashSet<>(Arrays.asList(0));
 
     while (mst.size() < n + 1) {
-      final int d = minHeap.peek().getKey();
-      final int u = minHeap.poll().getValue();
+      Pair<Integer, Integer> pair = minHeap.poll();
+      final int d = pair.getKey();
+      final int u = pair.getValue();
       if (mst.contains(u))
         continue;
       // Add the new vertex.
diff --git a/solutions/1168. Optimize Water Distribution in a Village/1168.py b/solutions/1168. Optimize Water Distribution in a Village/1168.py
index 0a2e9eeb76c..373ac8f40c3 100644
--- a/solutions/1168. Optimize Water Distribution in a Village/1168.py	
+++ b/solutions/1168. Optimize Water Distribution in a Village/1168.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minCostToSupplyWater(
-      self,
-      n: int,
-      wells: list[int],
-      pipes: list[list[int]],
-  ) -> int:
+  def minCostToSupplyWater(self, n: int, wells: List[int], pipes: List[List[int]]) -> int:
     ans = 0
     graph = [[] for _ in range(n + 1)]
     minHeap = []  # (d, u)
diff --git a/solutions/1169. Invalid Transactions/1169.cpp b/solutions/1169. Invalid Transactions/1169.cpp
index 5f5926c2a18..b82b4cf1d47 100644
--- a/solutions/1169. Invalid Transactions/1169.cpp	
+++ b/solutions/1169. Invalid Transactions/1169.cpp	
@@ -1,4 +1,4 @@
-struct Transaction {
+struct Trans {
   string name;
   int time;
   int amount;
@@ -9,24 +9,24 @@ class Solution {
  public:
   vector<string> invalidTransactions(vector<string>& transactions) {
     vector<string> ans;
-    unordered_map<string, vector<Transaction>> nameToTransactions;
+    unordered_map<string, vector<Trans>> nameToTranses;
 
     for (const string& t : transactions) {
-      const Transaction transaction = getTransaction(t);
-      nameToTransactions[transaction.name].push_back(transaction);
+      const Trans trans = getTrans(t);
+      nameToTranses[trans.name].push_back(trans);
     }
 
     for (const string& t : transactions) {
-      const Transaction currTransaction = getTransaction(t);
-      if (currTransaction.amount > 1000) {
+      const Trans currTrans = getTrans(t);
+      if (currTrans.amount > 1000) {
         ans.push_back(t);
-      } else if (const auto it = nameToTransactions.find(currTransaction.name);
-                 it != nameToTransactions.cend()) {
+      } else if (const auto it = nameToTranses.find(currTrans.name);
+                 it != nameToTranses.cend()) {
         // Iterate through all the transactions with the same name, check if
         // they're within 60 minutes in a different city.
-        for (Transaction transaction : it->second)
-          if (abs(transaction.time - currTransaction.time) <= 60 &&
-              transaction.city != currTransaction.city) {
+        for (Trans trans : it->second)
+          if (abs(trans.time - currTrans.time) <= 60 &&
+              trans.city != currTrans.city) {
             ans.push_back(t);
             break;
           }
@@ -37,11 +37,11 @@ class Solution {
   }
 
  private:
-  Transaction getTransaction(const string& t) {
+  Trans getTrans(const string& t) {
     istringstream iss(t);
     vector<string> s(4, "");
     for (int i = 0; getline(iss, s[i++], ',');)
       ;
-    return {s[0], stoi(s[1]), stoi(s[2]), s[3]};  // [name, time, amount, city]
+    return {s[0], stoi(s[1]), stoi(s[2]), s[3]};
   }
 };
diff --git a/solutions/1169. Invalid Transactions/1169.java b/solutions/1169. Invalid Transactions/1169.java
index 0b6d8cf3713..d5f6d2fbe86 100644
--- a/solutions/1169. Invalid Transactions/1169.java	
+++ b/solutions/1169. Invalid Transactions/1169.java	
@@ -1,22 +1,35 @@
+class Trans {
+  public String name;
+  public int time;
+  public int amount;
+  public String city;
+  public Trans(String name, int time, int amount, String city) {
+    this.name = name;
+    this.time = time;
+    this.amount = amount;
+    this.city = city;
+  }
+}
+
 class Solution {
   public List<String> invalidTransactions(String[] transactions) {
     List<String> ans = new ArrayList<>();
-    Map<String, List<Trans>> nameToTrans = new HashMap<>();
+    Map<String, List<Trans>> nameToTranses = new HashMap<>();
 
     for (final String t : transactions) {
       Trans trans = getTrans(t);
-      nameToTrans.putIfAbsent(trans.name, new ArrayList<>());
-      nameToTrans.get(trans.name).add(trans);
+      nameToTranses.putIfAbsent(trans.name, new ArrayList<>());
+      nameToTranses.get(trans.name).add(trans);
     }
 
     for (final String t : transactions) {
       Trans currTrans = getTrans(t);
       if (currTrans.amount > 1000) {
         ans.add(t);
-      } else if (nameToTrans.containsKey(currTrans.name)) {
+      } else if (nameToTranses.containsKey(currTrans.name)) {
         // Iterate through all the transactions with the same name, check if
         // they're within 60 minutes in a different city.
-        for (Trans trans : nameToTrans.get(currTrans.name))
+        for (Trans trans : nameToTranses.get(currTrans.name))
           if (Math.abs(trans.time - currTrans.time) <= 60 && !trans.city.equals(currTrans.city)) {
             ans.add(t);
             break;
@@ -27,8 +40,6 @@ public List<String> invalidTransactions(String[] transactions) {
     return ans;
   }
 
-  private record Trans(String name, int time, int amount, String city) {}
-
   private Trans getTrans(final String t) {
     String[] s = t.split(","); // [name, time, amount, city]
     return new Trans(s[0], Integer.parseInt(s[1]), Integer.parseInt(s[2]), s[3]);
diff --git a/solutions/1169. Invalid Transactions/1169.py b/solutions/1169. Invalid Transactions/1169.py
index c624c66d443..076c2dc009f 100644
--- a/solutions/1169. Invalid Transactions/1169.py	
+++ b/solutions/1169. Invalid Transactions/1169.py	
@@ -1,20 +1,20 @@
 class Solution:
-  def invalidTransactions(self, transactions: list[str]) -> list[str]:
+  def invalidTransactions(self, transactions: List[str]) -> List[str]:
     ans = []
-    nameToTrans = collections.defaultdict(list)
+    nameToTranses = collections.defaultdict(list)
 
     for t in transactions:
       name, time, amount, city = t.split(',')
       time, amount = int(time), int(amount)
-      nameToTrans[name].append({'time': time, 'city': city})
+      nameToTranses[name].append({'time': time, 'city': city})
 
     for t in transactions:
       name, time, amount, city = t.split(',')
       time, amount = int(time), int(amount)
       if amount > 1000:
         ans.append(t)
-      elif name in nameToTrans:
-        for sameName in nameToTrans[name]:
+      elif name in nameToTranses:
+        for sameName in nameToTranses[name]:
           if abs(sameName['time'] - time) <= 60 and sameName['city'] != city:
             ans.append(t)
             break
diff --git a/solutions/117. Populating Next Right Pointers in Each Node II/117.cpp b/solutions/117. Populating Next Right Pointers in Each Node II/117.cpp
index e608b85ce72..aed2bf3a0d0 100644
--- a/solutions/117. Populating Next Right Pointers in Each Node II/117.cpp	
+++ b/solutions/117. Populating Next Right Pointers in Each Node II/117.cpp	
@@ -3,15 +3,15 @@ class Solution {
   Node* connect(Node* root) {
     Node* node = root;  // the node that is above the current needling
 
-    while (node != nullptr) {
+    while (node) {
       Node dummy(0);  // the dummy node before needling
       // Needle the children of the node.
       for (Node* needle = &dummy; node; node = node->next) {
-        if (node->left != nullptr) {  // Needle the left child.
+        if (node->left) {  // Needle the left child.
           needle->next = node->left;
           needle = needle->next;
         }
-        if (node->right != nullptr) {  // Needle the right child.
+        if (node->right) {  // Needle the right child.
           needle->next = node->right;
           needle = needle->next;
         }
diff --git a/solutions/1170. Compare Strings by Frequency of the Smallest Character/1170.py b/solutions/1170. Compare Strings by Frequency of the Smallest Character/1170.py
index e71b7fd2c2b..96d05199122 100644
--- a/solutions/1170. Compare Strings by Frequency of the Smallest Character/1170.py	
+++ b/solutions/1170. Compare Strings by Frequency of the Smallest Character/1170.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def numSmallerByFrequency(
-      self,
-      queries: list[str],
-      words: list[str],
-  ) -> list[int]:
+  def numSmallerByFrequency(self, queries: List[str], words: List[str]) -> List[int]:
     ans = []
     wordsFreq = sorted([word.count(min(word)) for word in words])
 
diff --git a/solutions/1175. Prime Arrangements/1175.cpp b/solutions/1175. Prime Arrangements/1175.cpp
index 2a7a28ae595..b0012b1be1a 100644
--- a/solutions/1175. Prime Arrangements/1175.cpp	
+++ b/solutions/1175. Prime Arrangements/1175.cpp	
@@ -1,28 +1,29 @@
 class Solution {
  public:
   int numPrimeArrangements(int n) {
+    constexpr int kMod = 1'000'000'007;
     const int count = countPrimes(n);
-    return factorial(count) * factorial(n - count) % kMod;
+    return (factorial(count, kMod) * factorial(n - count, kMod)) % kMod;
   }
 
  private:
-  static constexpr int kMod = 1'000'000'007;
-
   int countPrimes(int n) {
     vector<bool> prime(n + 1, true);
     prime[0] = false;
     prime[1] = false;
+
     for (int i = 0; i <= sqrt(n); ++i)
       if (prime[i])
         for (int j = i * i; j <= n; j += i)
           prime[j] = false;
+
     return ranges::count(prime, true);
   }
 
-  long factorial(int n) {
-    long res = 1;
-    for (int i = 2; i <= n; ++i)
-      res = res * i % kMod;
-    return res;
+  long factorial(int n, const int kMod) {
+    long fact = 1;
+    for (int i = 1; i <= n; ++i)
+      fact = fact * i % kMod;
+    return fact;
   }
 };
diff --git a/solutions/1175. Prime Arrangements/1175.java b/solutions/1175. Prime Arrangements/1175.java
index 1eaa7dabebf..4e69786805c 100644
--- a/solutions/1175. Prime Arrangements/1175.java	
+++ b/solutions/1175. Prime Arrangements/1175.java	
@@ -1,11 +1,10 @@
 class Solution {
   public int numPrimeArrangements(int n) {
+    final int kMod = 1_000_000_007;
     final int count = countPrimes(n);
-    return (int) (factorial(count) * factorial(n - count) % MOD);
+    return (int) ((factorial(count, kMod) * factorial(n - count, kMod)) % kMod);
   }
 
-  private static final int MOD = 1_000_000_007;
-
   private int countPrimes(int n) {
     boolean[] prime = new boolean[n + 1];
     Arrays.fill(prime, 2, n + 1, true);
@@ -24,10 +23,10 @@ private int countPrimes(int n) {
     return count;
   }
 
-  private long factorial(int n) {
-    long res = 1;
-    for (int i = 2; i <= n; ++i)
-      res = res * i % MOD;
-    return res;
+  long factorial(int n, final long kMod) {
+    long fact = 1;
+    for (int i = 1; i <= n; ++i)
+      fact = fact * i % kMod;
+    return fact;
   }
 }
diff --git a/solutions/1175. Prime Arrangements/1175.py b/solutions/1175. Prime Arrangements/1175.py
index e8bc40ea401..b97d1481f52 100644
--- a/solutions/1175. Prime Arrangements/1175.py	
+++ b/solutions/1175. Prime Arrangements/1175.py	
@@ -1,20 +1,24 @@
 class Solution:
   def numPrimeArrangements(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
+
+    def countPrimes(n: int) -> int:
+      isPrime = [False] * 2 + [True] * (n - 1)
+
+      for i in range(2, int(n**0.5) + 1):
+        if isPrime[i]:
+          for j in range(i * i, n + 1, i):
+            isPrime[j] = False
+
+      return sum(isPrime)
 
     def factorial(n: int) -> int:
       fact = 1
-      for i in range(2, n + 1):
-        fact = fact * i % MOD
-      return fact
 
-    count = self._countPrimes(n)
-    return factorial(count) * factorial(n - count) % MOD
+      for i in range(1, n + 1):
+        fact = fact * i % kMod
+
+      return fact
 
-  def _countPrimes(self, n: int) -> int:
-    isPrime = [False] * 2 + [True] * (n - 1)
-    for i in range(2, int(n**0.5) + 1):
-      if isPrime[i]:
-        for j in range(i * i, n + 1, i):
-          isPrime[j] = False
-    return sum(isPrime)
+    count = countPrimes(n)
+    return factorial(count) * factorial(n - count) % kMod
diff --git a/solutions/1176. Diet Plan Performance/1176.py b/solutions/1176. Diet Plan Performance/1176.py
index cde6c5f4a2a..fb904de55a8 100644
--- a/solutions/1176. Diet Plan Performance/1176.py	
+++ b/solutions/1176. Diet Plan Performance/1176.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def dietPlanPerformance(
-      self,
-      calories: list[int],
-      k: int,
-      lower: int,
-      upper: int,
-  ) -> int:
+  def dietPlanPerformance(self, calories: List[int], k: int, lower: int, upper: int) -> int:
     ans = 0
     summ = 0
 
diff --git a/solutions/1177. Can Make Palindrome from Substring/1177.py b/solutions/1177. Can Make Palindrome from Substring/1177.py
index ebdacec87a5..2abb5149279 100644
--- a/solutions/1177. Can Make Palindrome from Substring/1177.py	
+++ b/solutions/1177. Can Make Palindrome from Substring/1177.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canMakePaliQueries(self, s: str, queries: list[list[int]]) -> list[bool]:
+  def canMakePaliQueries(self, s: str, queries: List[List[int]]) -> List[bool]:
     dp = [0] * (len(s) + 1)
 
     for i in range(1, len(s) + 1):
diff --git a/solutions/1178. Number of Valid Words for Each Puzzle/1178.py b/solutions/1178. Number of Valid Words for Each Puzzle/1178.py
index 7283b7838d2..36602c6febd 100644
--- a/solutions/1178. Number of Valid Words for Each Puzzle/1178.py	
+++ b/solutions/1178. Number of Valid Words for Each Puzzle/1178.py	
@@ -1,16 +1,12 @@
 class Solution:
-  def findNumOfValidWords(
-      self,
-      words: list[str],
-      puzzles: list[str],
-  ) -> list[int]:
+  def findNumOfValidWords(self, words: List[str], puzzles: List[str]) -> List[int]:
     ans = []
     binaryCount = collections.Counter()
 
     for word in words:
       mask = 0
       for c in word:
-        mask |= 1 << ord(c) - ord('a')
+        mask |= 1 << (ord(c) - ord('a'))
       binaryCount[mask] += 1
 
     for puzzle in puzzles:
diff --git a/solutions/118. Pascal's Triangle/118.py b/solutions/118. Pascal's Triangle/118.py
index 718b5caf330..0504cffe2b3 100644
--- a/solutions/118. Pascal's Triangle/118.py	
+++ b/solutions/118. Pascal's Triangle/118.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def generate(self, numRows: int) -> list[list[int]]:
+  def generate(self, numRows: int) -> List[List[int]]:
     ans = []
 
     for i in range(numRows):
diff --git a/solutions/1182. Shortest Distance to Target Color/1182.java b/solutions/1182. Shortest Distance to Target Color/1182.java
index 41030c14a7d..d0d96ddbca6 100644
--- a/solutions/1182. Shortest Distance to Target Color/1182.java	
+++ b/solutions/1182. Shortest Distance to Target Color/1182.java	
@@ -1,24 +1,24 @@
 class Solution {
   public List<Integer> shortestDistanceColor(int[] colors, int[][] queries) {
-    final int NUM_COLOR = 3;
+    final int kNumColor = 3;
     final int n = colors.length;
     List<Integer> ans = new ArrayList<>();
     // left[i][c] := the closest index of color c in index i to the left
-    int[][] left = new int[n][NUM_COLOR + 1];
+    int[][] left = new int[n][kNumColor + 1];
     // right[i][c] := the closest index of color c in index i to the right
-    int[][] right = new int[n][NUM_COLOR + 1];
+    int[][] right = new int[n][kNumColor + 1];
 
     int[] colorToClosestIndex = {0, -1, -1, -1}; // 0-indexed, -1 := N/A
     for (int i = 0; i < n; ++i) {
       colorToClosestIndex[colors[i]] = i;
-      for (int c = 1; c <= NUM_COLOR; ++c)
+      for (int c = 1; c <= kNumColor; ++c)
         left[i][c] = colorToClosestIndex[c];
     }
 
-    colorToClosestIndex = new int[] {0, -1, -1, -1}; // Reset
+    colorToClosestIndex = {0, -1, -1, -1}; // Reset
     for (int i = n - 1; i >= 0; --i) {
       colorToClosestIndex[colors[i]] = i;
-      for (int c = 1; c <= NUM_COLOR; ++c)
+      for (int c = 1; c <= kNumColor; ++c)
         right[i][c] = colorToClosestIndex[c];
     }
 
diff --git a/solutions/1182. Shortest Distance to Target Color/1182.py b/solutions/1182. Shortest Distance to Target Color/1182.py
index 89a77d603a9..9bd5f2a04e1 100644
--- a/solutions/1182. Shortest Distance to Target Color/1182.py	
+++ b/solutions/1182. Shortest Distance to Target Color/1182.py	
@@ -1,27 +1,23 @@
 class Solution:
-  def shortestDistanceColor(
-      self,
-      colors: list[int],
-      queries: list[list[int]],
-  ) -> list[int]:
-    NUM_COLOR = 3
+  def shortestDistanceColor(self, colors: List[int], queries: List[List[int]]) -> List[int]:
+    kNumColor = 3
     n = len(colors)
     ans = []
     # left[i][c] := the closest index of color c in index i to the left
-    left = [[0] * (NUM_COLOR + 1) for _ in range(n)]
+    left = [[0] * (kNumColor + 1) for _ in range(n)]
     # right[i][c] := the closest index of color c in index i to the right
-    right = [[0] * (NUM_COLOR + 1) for _ in range(n)]
+    right = [[0] * (kNumColor + 1) for _ in range(n)]
 
     colorToLatestIndex = [0, -1, -1, -1]  # 0-indexed, -1 means N//A
     for i, color in enumerate(colors):
       colorToLatestIndex[color] = i
-      for c in range(1, NUM_COLOR + 1):
+      for c in range(1, kNumColor + 1):
         left[i][c] = colorToLatestIndex[c]
 
     colorToLatestIndex = [0, -1, -1, -1]  # Reset.
     for i in range(n - 1, -1, -1):
       colorToLatestIndex[colors[i]] = i
-      for c in range(1, NUM_COLOR + 1):
+      for c in range(1, kNumColor + 1):
         right[i][c] = colorToLatestIndex[c]
 
     for i, c in queries:
diff --git a/solutions/1183. Maximum Number of Ones/1183-2.cpp b/solutions/1183. Maximum Number of Ones/1183-2.cpp
index 4cc5d56bf0f..4cac519aa15 100644
--- a/solutions/1183. Maximum Number of Ones/1183-2.cpp	
+++ b/solutions/1183. Maximum Number of Ones/1183-2.cpp	
@@ -3,7 +3,7 @@ class Solution {
   int maximumNumberOfOnes(int width, int height, int sideLength, int maxOnes) {
     vector<int> subCount;
 
-    auto getCount = [sideLength](int length, int index) -> int {
+    auto getCount = [&](int length, int index) -> int {
       return (length - index - 1) / sideLength + 1;
     };
 
diff --git a/solutions/1183. Maximum Number of Ones/1183-2.py b/solutions/1183. Maximum Number of Ones/1183-2.py
index 9874ec2dbad..04ea3edfd8b 100644
--- a/solutions/1183. Maximum Number of Ones/1183-2.py	
+++ b/solutions/1183. Maximum Number of Ones/1183-2.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def maximumNumberOfOnes(
-      self,
-      width: int,
-      height: int,
-      sideLength: int,
-      maxOnes: int,
-  ) -> int:
+  def maximumNumberOfOnes(self, width: int, height: int, sideLength: int, maxOnes: int) -> int:
     subCount = []
 
     def getCount(length: int, index: int) -> int:
diff --git a/solutions/1183. Maximum Number of Ones/1183.py b/solutions/1183. Maximum Number of Ones/1183.py
index 5172b8f2ca3..2b5c6bbb8c3 100644
--- a/solutions/1183. Maximum Number of Ones/1183.py	
+++ b/solutions/1183. Maximum Number of Ones/1183.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def maximumNumberOfOnes(
-      self,
-      width: int,
-      height: int,
-      sideLength: int,
-      maxOnes: int,
-  ) -> int:
+  def maximumNumberOfOnes(self, width: int, height: int, sideLength: int, maxOnes: int) -> int:
     submatrix = [[0] * sideLength for _ in range(sideLength)]
 
     for i in range(width):
diff --git a/solutions/1184. Distance Between Bus Stops/1184.py b/solutions/1184. Distance Between Bus Stops/1184.py
index 361aadd2dfa..2b4d42a32a6 100644
--- a/solutions/1184. Distance Between Bus Stops/1184.py	
+++ b/solutions/1184. Distance Between Bus Stops/1184.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def distanceBetweenBusStops(
-      self,
-      distance: list[int],
-      start: int, destination: int,
-  ) -> int:
+  def distanceBetweenBusStops(self, distance: List[int], start: int, destination: int) -> int:
     clockwise = 0
     counterclockwise = 0
 
diff --git a/solutions/1186. Maximum Subarray Sum with One Deletion/1186-2.java b/solutions/1186. Maximum Subarray Sum with One Deletion/1186-2.java
index a7add59128a..d30f2a1a54a 100644
--- a/solutions/1186. Maximum Subarray Sum with One Deletion/1186-2.java	
+++ b/solutions/1186. Maximum Subarray Sum with One Deletion/1186-2.java	
@@ -1,10 +1,10 @@
 class Solution {
   // Similar to 53. Maximum Subarray
   public int maximumSum(int[] arr) {
-    final int MIN = Integer.MIN_VALUE / 2;
-    int ans = MIN;
-    int zero = MIN; // no deletion
-    int one = MIN;  // <= 1 deletion
+    final int kMin = Integer.MIN_VALUE / 2;
+    int ans = kMin;
+    int zero = kMin; // no deletion
+    int one = kMin;  // <= 1 deletion
 
     for (final int a : arr) {
       one = Math.max(a, Math.max(one + a, zero /*delete a*/));
diff --git a/solutions/1186. Maximum Subarray Sum with One Deletion/1186-2.py b/solutions/1186. Maximum Subarray Sum with One Deletion/1186-2.py
index 7986eb30600..bdb7c8571cc 100644
--- a/solutions/1186. Maximum Subarray Sum with One Deletion/1186-2.py	
+++ b/solutions/1186. Maximum Subarray Sum with One Deletion/1186-2.py	
@@ -1,6 +1,6 @@
 class Solution:
-  # Similar to 53. Maximum Subarray
-  def maximumSum(self, arr: list[int]) -> int:
+  # Very similar to 53. Maximum Subarray
+  def maximumSum(self, arr: List[int]) -> int:
     ans = -math.inf
     zero = -math.inf  # no deletion
     one = -math.inf   # <= 1 deletion
diff --git a/solutions/1186. Maximum Subarray Sum with One Deletion/1186.py b/solutions/1186. Maximum Subarray Sum with One Deletion/1186.py
index c3a32696f8f..591e45e36e2 100644
--- a/solutions/1186. Maximum Subarray Sum with One Deletion/1186.py	
+++ b/solutions/1186. Maximum Subarray Sum with One Deletion/1186.py	
@@ -1,6 +1,6 @@
 class Solution:
-  # Similar to 53. Maximum Subarray
-  def maximumSum(self, arr: list[int]) -> int:
+  # Very similar to 53. Maximum Subarray
+  def maximumSum(self, arr: List[int]) -> int:
     # dp[0][i] := the maximum sum subarray ending in i (no deletion)
     # dp[1][i] := the maximum sum subarray ending in i (at most 1 deletion)
     dp = [[0] * len(arr) for _ in range(2)]
diff --git a/solutions/1187. Make Array Strictly Increasing/1187.cpp b/solutions/1187. Make Array Strictly Increasing/1187.cpp
index 12102af4e8c..186b34425be 100644
--- a/solutions/1187. Make Array Strictly Increasing/1187.cpp	
+++ b/solutions/1187. Make Array Strictly Increasing/1187.cpp	
@@ -7,19 +7,19 @@ class Solution {
     ranges::sort(arr2);
 
     for (const int a : arr1) {
-      unordered_map<int, int> newDp;
+      unordered_map<int, int> nextDp;
       for (const auto& [val, steps] : dp) {
         // It's possible to use the value in the arr1.
         if (a > val)
-          newDp[a] = min(newDp.contains(a) ? newDp[a] : INT_MAX, steps);
+          nextDp[a] = min(nextDp.contains(a) ? nextDp[a] : INT_MAX, steps);
         // Also try the value in the arr2.
         if (const auto it = ranges::upper_bound(arr2, val); it != arr2.cend())
-          newDp[*it] =
-              min(newDp.contains(*it) ? newDp[*it] : INT_MAX, steps + 1);
+          nextDp[*it] =
+              min(nextDp.contains(*it) ? nextDp[*it] : INT_MAX, steps + 1);
       }
-      if (newDp.empty())
+      if (nextDp.empty())
         return -1;
-      dp = std::move(newDp);
+      dp = move(nextDp);
     }
 
     int ans = INT_MAX;
diff --git a/solutions/1187. Make Array Strictly Increasing/1187.java b/solutions/1187. Make Array Strictly Increasing/1187.java
index b521c40341a..f729cc98742 100644
--- a/solutions/1187. Make Array Strictly Increasing/1187.java	
+++ b/solutions/1187. Make Array Strictly Increasing/1187.java	
@@ -7,27 +7,27 @@ public int makeArrayIncreasing(int[] arr1, int[] arr2) {
     Arrays.sort(arr2);
 
     for (final int a : arr1) {
-      Map<Integer, Integer> newDp = new HashMap<>();
+      Map<Integer, Integer> nextDp = new HashMap<>();
       for (final int val : dp.keySet()) {
         final int steps = dp.get(val);
         // It's possible to use the value in the arr1.
         if (a > val)
-          newDp.put(a, Math.min(newDp.getOrDefault(a, Integer.MAX_VALUE), steps));
+          nextDp.put(a, Math.min(nextDp.getOrDefault(a, Integer.MAX_VALUE), steps));
         // Also try the value in the arr2.
         final int i = firstGreater(arr2, val);
         if (i < arr2.length)
-          newDp.put(arr2[i], Math.min(newDp.getOrDefault(arr2[i], Integer.MAX_VALUE), steps + 1));
+          nextDp.put(arr2[i], Math.min(nextDp.getOrDefault(arr2[i], Integer.MAX_VALUE), steps + 1));
       }
-      if (newDp.isEmpty())
+      if (nextDp.isEmpty())
         return -1;
-      dp = newDp;
+      dp = nextDp;
     }
 
     return Collections.min(dp.values());
   }
 
-  private int firstGreater(int[] arr, int target) {
-    final int i = Arrays.binarySearch(arr, target + 1);
+  private int firstGreater(int[] A, int target) {
+    final int i = Arrays.binarySearch(A, target + 1);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/1187. Make Array Strictly Increasing/1187.py b/solutions/1187. Make Array Strictly Increasing/1187.py
index 3d52f934e85..e253000e894 100644
--- a/solutions/1187. Make Array Strictly Increasing/1187.py	
+++ b/solutions/1187. Make Array Strictly Increasing/1187.py	
@@ -1,22 +1,22 @@
 class Solution:
-  def makeArrayIncreasing(self, arr1: list[int], arr2: list[int]) -> int:
+  def makeArrayIncreasing(self, arr1: List[int], arr2: List[int]) -> int:
     # dp[i] := the minimum steps to reach i at previous round
     dp = {-1: 0}
 
     arr2.sort()
 
     for a in arr1:
-      newDp = collections.defaultdict(lambda: math.inf)
+      nextDp = collections.defaultdict(lambda: math.inf)
       for val, steps in dp.items():
         # It's possible to use the value in the arr1.
         if a > val:
-          newDp[a] = min(newDp[a], steps)
+          nextDp[a] = min(nextDp[a], steps)
         # Also try the value in the arr2.
         i = bisect_right(arr2, val)
         if i < len(arr2):
-          newDp[arr2[i]] = min(newDp[arr2[i]], steps + 1)
-      if not newDp:
+          nextDp[arr2[i]] = min(nextDp[arr2[i]], steps + 1)
+      if not nextDp:
         return -1
-      dp = newDp
+      dp = nextDp
 
     return min(dp.values())
diff --git a/solutions/1189. Maximum Number of Balloons/1189.py b/solutions/1189. Maximum Number of Balloons/1189.py
index 090889ec376..39973734039 100644
--- a/solutions/1189. Maximum Number of Balloons/1189.py	
+++ b/solutions/1189. Maximum Number of Balloons/1189.py	
@@ -1,7 +1,4 @@
 class Solution:
   def maxNumberOfBalloons(self, text: str) -> int:
     count = collections.Counter(text)
-    return min(
-        count['b'],
-        count['a'],
-        count['l'] // 2, count['o'] // 2, count['n'])
+    return min(count['b'], count['a'], count['l'] // 2, count['o'] // 2, count['n'])
diff --git a/solutions/119. Pascal's Triangle II/119.py b/solutions/119. Pascal's Triangle II/119.py
index 1645af95381..849027306aa 100644
--- a/solutions/119. Pascal's Triangle II/119.py	
+++ b/solutions/119. Pascal's Triangle II/119.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getRow(self, rowIndex: int) -> list[int]:
+  def getRow(self, rowIndex: int) -> List[int]:
     ans = [1] * (rowIndex + 1)
 
     for i in range(2, rowIndex + 1):
diff --git a/solutions/1191. K-Concatenation Maximum Sum/1191.cpp b/solutions/1191. K-Concatenation Maximum Sum/1191.cpp
index ffb7a03a211..bfabfe97731 100644
--- a/solutions/1191. K-Concatenation Maximum Sum/1191.cpp	
+++ b/solutions/1191. K-Concatenation Maximum Sum/1191.cpp	
@@ -7,18 +7,17 @@ class Solution {
     // The concatenated array will be [arr1, arr2, ..., arrk].
     // If sum(arr) > 0 and k > 2, then arr2, ..., arr(k - 1) should be included.
     // Equivalently, maxSubarraySum is from arr1 and arrk.
-    return (sum > 0 && k > 2
-                ? kadane(arr, sz) + static_cast<long>(sum) * (k - 2)
-                : kadane(arr, sz)) %
+    return (sum > 0 && k > 2 ? kadane(arr, sz) + sum * static_cast<long>(k - 2)
+                             : kadane(arr, sz)) %
            kMod;
   }
 
  private:
-  int kadane(const vector<int>& arr, int sz) {
+  int kadane(const vector<int>& A, int sz) {
     int ans = 0;
     int sum = 0;
     for (int i = 0; i < sz; ++i) {
-      const int a = arr[i % arr.size()];
+      const int a = A[i % A.size()];
       sum = max(a, sum + a);
       ans = max(ans, sum);
     }
diff --git a/solutions/1191. K-Concatenation Maximum Sum/1191.java b/solutions/1191. K-Concatenation Maximum Sum/1191.java
index 92eeb02d105..4fc40760ec4 100644
--- a/solutions/1191. K-Concatenation Maximum Sum/1191.java	
+++ b/solutions/1191. K-Concatenation Maximum Sum/1191.java	
@@ -1,21 +1,21 @@
 class Solution {
   public int kConcatenationMaxSum(int[] arr, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int sz = arr.length * (k == 1 ? 1 : 2);
     final int sum = Arrays.stream(arr).sum();
     // The concatenated array will be [arr1, arr2, ..., arrk].
     // If sum(arr) > 0 and k > 2, then arr2, ..., arr(k - 1) should be included.
     // Equivalently, maxSubarraySum is from arr1 and arrk.
     if (sum > 0 && k > 2)
-      return (int) ((kadane(arr, sz) + sum * (long) (k - 2)) % MOD);
-    return kadane(arr, sz) % MOD;
+      return (int) ((kadane(arr, sz) + sum * (long) (k - 2)) % kMod);
+    return kadane(arr, sz) % kMod;
   }
 
-  private int kadane(int[] arr, int sz) {
+  private int kadane(int[] A, int sz) {
     int ans = 0;
     int sum = 0;
     for (int i = 0; i < sz; ++i) {
-      final int a = arr[i % arr.length];
+      final int a = A[i % A.length];
       sum = Math.max(a, sum + a);
       ans = Math.max(ans, sum);
     }
diff --git a/solutions/1191. K-Concatenation Maximum Sum/1191.py b/solutions/1191. K-Concatenation Maximum Sum/1191.py
index 3cb5f8753b4..2e1ae6d9754 100644
--- a/solutions/1191. K-Concatenation Maximum Sum/1191.py	
+++ b/solutions/1191. K-Concatenation Maximum Sum/1191.py	
@@ -1,20 +1,20 @@
 class Solution:
-  def kConcatenationMaxSum(self, arr: list[int], k: int) -> int:
-    MOD = 1_000_000_007
+  def kConcatenationMaxSum(self, arr: List[int], k: int) -> int:
+    kMod = 1_000_000_007
     sz = len(arr) * (1 if k == 1 else 2)
     summ = sum(arr)
     # The concatenated array will be [arr1, arr2, ..., arrk].
     # If sum(arr) > 0 and k > 2, then arr2, ..., arr(k - 1) should be included.
     # Equivalently, maxSubarraySum is from arr1 and arrk.
     if summ > 0 and k > 2:
-      return (self._kadane(arr, sz) + summ * (k - 2)) % MOD
-    return self._kadane(arr, sz) % MOD
+      return (self.kadane(arr, sz) + summ * (k - 2)) % kMod
+    return self.kadane(arr, sz) % kMod
 
-  def _kadane(self, arr: list[int], sz: int) -> int:
+  def kadane(self, A: List[int], sz: int) -> int:
     ans = 0
     summ = 0
     for i in range(sz):
-      a = arr[i % len(arr)]
+      a = A[i % len(A)]
       summ = max(a, summ + a)
       ans = max(ans, summ)
     return ans
diff --git a/solutions/1192. Critical Connections in a Network/1192.cpp b/solutions/1192. Critical Connections in a Network/1192.cpp
index 0f3be5bb5a6..c222c514d23 100644
--- a/solutions/1192. Critical Connections in a Network/1192.cpp	
+++ b/solutions/1192. Critical Connections in a Network/1192.cpp	
@@ -13,7 +13,7 @@ class Solution {
     }
 
     // rank[i] := the minimum node that node i can reach with forward edges
-    // Initialize with NO_RANK = -2 to indicate not visited.
+    // Initialize with NO_RANK = -2 to indicate not visited..
     getRank(graph, 0, 0, vector<int>(n, NO_RANK), ans);
     return ans;
   }
@@ -34,8 +34,7 @@ class Solution {
       // visited || parent (that's why NO_RANK = -2 instead of -1)
       if (rank[u] == rank.size() || rank[v] == currRank - 1)
         continue;
-      const int nextRank =
-          getRank(graph, v, currRank + 1, std::move(rank), ans);
+      const int nextRank = getRank(graph, v, currRank + 1, move(rank), ans);
       // (u, v) is the only way for u go to v.
       if (nextRank == currRank + 1)
         ans.push_back({u, v});
diff --git a/solutions/1192. Critical Connections in a Network/1192.java b/solutions/1192. Critical Connections in a Network/1192.java
index 5252479acc2..2fd0084c1e3 100644
--- a/solutions/1192. Critical Connections in a Network/1192.java	
+++ b/solutions/1192. Critical Connections in a Network/1192.java	
@@ -2,7 +2,9 @@ class Solution {
   public List<List<Integer>> criticalConnections(int n, List<List<Integer>> connections) {
     List<List<Integer>> ans = new ArrayList<>();
     List<Integer>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (List<Integer> connection : connections) {
       final int u = connection.get(0);
@@ -12,7 +14,7 @@ public List<List<Integer>> criticalConnections(int n, List<List<Integer>> connec
     }
 
     // rank[i] := the minimum node that node i can reach with forward edges
-    // Initialize with NO_RANK = -2 to indicate not visited.
+    // Initialize with NO_RANK = -2 to indicate not visited..
     int[] rank = new int[n];
     Arrays.fill(rank, NO_RANK);
     getRank(graph, 0, 0, rank, ans);
diff --git a/solutions/1196. How Many Apples Can You Put into the Basket/1196.py b/solutions/1196. How Many Apples Can You Put into the Basket/1196.py
index 9cbaa5cffb6..1bf7aae32c3 100644
--- a/solutions/1196. How Many Apples Can You Put into the Basket/1196.py	
+++ b/solutions/1196. How Many Apples Can You Put into the Basket/1196.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxNumberOfApples(self, weight: list[int]) -> int:
+  def maxNumberOfApples(self, weight: List[int]) -> int:
     summ = 0
 
     for i, w in enumerate(sorted(weight)):
diff --git a/solutions/1198. Find Smallest Common Element in All Rows/1198.java b/solutions/1198. Find Smallest Common Element in All Rows/1198.java
index 823940ccc71..a15c0b1bb86 100644
--- a/solutions/1198. Find Smallest Common Element in All Rows/1198.java	
+++ b/solutions/1198. Find Smallest Common Element in All Rows/1198.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int smallestCommonElement(int[][] mat) {
-    final int MAX = 10000;
-    int[] count = new int[MAX + 1];
+    final int kMax = 10000;
+    int[] count = new int[kMax + 1];
 
     for (int[] row : mat)
       for (final int a : row)
diff --git a/solutions/1198. Find Smallest Common Element in All Rows/1198.py b/solutions/1198. Find Smallest Common Element in All Rows/1198.py
index d4936984293..660e00027aa 100644
--- a/solutions/1198. Find Smallest Common Element in All Rows/1198.py	
+++ b/solutions/1198. Find Smallest Common Element in All Rows/1198.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def smallestCommonElement(self, mat: list[list[int]]) -> int:
-    MAX = 10000
-    count = [0] * (MAX + 1)
+  def smallestCommonElement(self, mat: List[List[int]]) -> int:
+    kMax = 10000
+    count = [0] * (kMax + 1)
 
     for row in mat:
       for a in row:
diff --git a/solutions/1199. Minimum Time to Build Blocks/1199.py b/solutions/1199. Minimum Time to Build Blocks/1199.py
index 3fc9f906bc7..823253140ad 100644
--- a/solutions/1199. Minimum Time to Build Blocks/1199.py	
+++ b/solutions/1199. Minimum Time to Build Blocks/1199.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minBuildTime(self, blocks: list[int], split: int) -> int:
+  def minBuildTime(self, blocks: List[int], split: int) -> int:
     minHeap = blocks.copy()
     heapify(minHeap)
 
diff --git a/solutions/120. Triangle/120.py b/solutions/120. Triangle/120.py
index 67af041188f..96c0773a51c 100644
--- a/solutions/120. Triangle/120.py	
+++ b/solutions/120. Triangle/120.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def minimumTotal(self, triangle: list[list[int]]) -> int:
-    for i in range(len(triangle) - 2, -1, -1):
+  def minimumTotal(self, triangle: List[List[int]]) -> int:
+    for i in reversed(range(len(triangle) - 1)):
       for j in range(i + 1):
         triangle[i][j] += min(triangle[i + 1][j],
                               triangle[i + 1][j + 1])
diff --git a/solutions/1200. Minimum Absolute Difference/1200.py b/solutions/1200. Minimum Absolute Difference/1200.py
index 52151c504b2..a298f4e2613 100644
--- a/solutions/1200. Minimum Absolute Difference/1200.py	
+++ b/solutions/1200. Minimum Absolute Difference/1200.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumAbsDifference(self, arr: list[int]) -> list[list[int]]:
+  def minimumAbsDifference(self, arr: List[int]) -> List[List[int]]:
     ans = []
     mn = math.inf
 
diff --git a/solutions/1201. Ugly Number III/1201.py b/solutions/1201. Ugly Number III/1201.py
index 3c6e52c9a0c..d3171bc1b40 100644
--- a/solutions/1201. Ugly Number III/1201.py	
+++ b/solutions/1201. Ugly Number III/1201.py	
@@ -4,7 +4,6 @@ def nthUglyNumber(self, n: int, a: int, b: int, c: int) -> int:
     ac = a * c // math.gcd(a, c)
     bc = b * c // math.gcd(b, c)
     abc = a * bc // math.gcd(a, bc)
-    return bisect.bisect_left(range(2 * 10**9), n,
-                              key=lambda m: m // a + m // b + m // c
-                              - m // ab - m // ac - m // bc
-                              + m // abc)
+    return bisect.bisect_left(
+        range(2 * 10**9), n,
+        key=lambda m: m // a + m // b + m // c - m // ab - m // ac - m // bc + m // abc)
diff --git a/solutions/1202. Smallest String With Swaps/1202.cpp b/solutions/1202. Smallest String With Swaps/1202.cpp
index 47acc197a6f..99222d65c72 100644
--- a/solutions/1202. Smallest String With Swaps/1202.cpp	
+++ b/solutions/1202. Smallest String With Swaps/1202.cpp	
@@ -33,20 +33,16 @@ class Solution {
   string smallestStringWithSwaps(string s, vector<vector<int>>& pairs) {
     string ans;
     UnionFind uf(s.length());
-    unordered_map<int, priority_queue<char, vector<char>, greater<>>>
-        indexToLetters;
+    unordered_map<int, priority_queue<char, vector<char>, greater<>>> map;
 
-    for (const vector<int>& pair : pairs) {
-      const int a = pair[0];
-      const int b = pair[1];
-      uf.unionByRank(a, b);
-    }
+    for (const vector<int>& pair : pairs)
+      uf.unionByRank(pair[0], pair[1]);
 
     for (int i = 0; i < s.length(); ++i)
-      indexToLetters[uf.find(i)].push(s[i]);
+      map[uf.find(i)].push(s[i]);
 
     for (int i = 0; i < s.length(); ++i)
-      ans += indexToLetters[uf.find(i)].top(), indexToLetters[uf.find(i)].pop();
+      ans += map[uf.find(i)].top(), map[uf.find(i)].pop();
 
     return ans;
   }
diff --git a/solutions/1202. Smallest String With Swaps/1202.java b/solutions/1202. Smallest String With Swaps/1202.java
index b0710a1d54b..0705482b68e 100644
--- a/solutions/1202. Smallest String With Swaps/1202.java	
+++ b/solutions/1202. Smallest String With Swaps/1202.java	
@@ -31,22 +31,19 @@ public int find(int u) {
 
 class Solution {
   public String smallestStringWithSwaps(String s, List<List<Integer>> pairs) {
-    StringBuilder sb = new StringBuilder();
+    StringBuilder ans = new StringBuilder();
     UnionFind uf = new UnionFind(s.length());
-    Map<Integer, Queue<Character>> indexToLetters = new HashMap<>();
+    Map<Integer, Queue<Character>> map = new HashMap<>();
 
-    for (List<Integer> pair : pairs) {
-      final int a = pair.get(0);
-      final int b = pair.get(1);
-      uf.unionByRank(a, b);
-    }
+    for (List<Integer> pair : pairs)
+      uf.unionByRank(pair.get(0), pair.get(1));
 
     for (int i = 0; i < s.length(); ++i)
-      indexToLetters.computeIfAbsent(uf.find(i), k -> new PriorityQueue<>()).offer(s.charAt(i));
+      map.computeIfAbsent(uf.find(i), k -> new PriorityQueue<>()).offer(s.charAt(i));
 
     for (int i = 0; i < s.length(); ++i)
-      sb.append(indexToLetters.get(uf.find(i)).poll());
+      ans.append(map.get(uf.find(i)).poll());
 
-    return sb.toString();
+    return ans.toString();
   }
 }
diff --git a/solutions/1202. Smallest String With Swaps/1202.py b/solutions/1202. Smallest String With Swaps/1202.py
index fbc6f992103..f40a140c78b 100644
--- a/solutions/1202. Smallest String With Swaps/1202.py	
+++ b/solutions/1202. Smallest String With Swaps/1202.py	
@@ -23,18 +23,21 @@ def find(self, u: int) -> int:
 
 
 class Solution:
-  def smallestStringWithSwaps(self, s: str, pairs: list[list[int]]) -> str:
+  def smallestStringWithSwaps(self, s: str, pairs: List[List[int]]) -> str:
+    ans = ''
     uf = UnionFind(len(s))
-    indexToLetters = collections.defaultdict(list)
+    map = collections.defaultdict(list)
 
     for a, b in pairs:
       uf.unionByRank(a, b)
 
     for i, c in enumerate(s):
-      indexToLetters[uf.find(i)].append(c)
+      map[uf.find(i)].append(c)
 
-    for key in indexToLetters.keys():
-      indexToLetters[key].sort(reverse=True)
+    for key in map.keys():
+      map[key].sort(reverse=True)
 
-    return ''.join(indexToLetters[uf.find(i)].pop()
-                   for i in range(len(s)))
+    for i in range(len(s)):
+      ans += map[uf.find(i)].pop()
+
+    return ans
diff --git a/solutions/1206. Design Skiplist/1206.cpp b/solutions/1206. Design Skiplist/1206.cpp
index 31f2f2ad7d0..78c8eaa6b3c 100644
--- a/solutions/1206. Design Skiplist/1206.cpp	
+++ b/solutions/1206. Design Skiplist/1206.cpp	
@@ -1,7 +1,10 @@
 struct Node {
-  int val = -1;
+  int val;
   shared_ptr<Node> next;
   shared_ptr<Node> down;
+  Node(int val = -1, shared_ptr<Node> next = nullptr,
+       shared_ptr<Node> down = nullptr)
+      : val(val), next(next), down(down) {}
 };
 
 class Skiplist {
diff --git a/solutions/1206. Design Skiplist/1206.py b/solutions/1206. Design Skiplist/1206.py
index f71b95eebbb..a46d77d9eca 100644
--- a/solutions/1206. Design Skiplist/1206.py	
+++ b/solutions/1206. Design Skiplist/1206.py	
@@ -1,11 +1,8 @@
-from dataclasses import dataclass
-
-
-@dataclass
 class Node:
-  val: int = -1
-  next: 'Node' = None
-  down: 'Node' = None
+  def __init__(self, val=-1, next=None, down=None):
+    self.val = val
+    self.next = next
+    self.down = down
 
 
 class Skiplist:
diff --git a/solutions/1207. Unique Number of Occurrences/1207.py b/solutions/1207. Unique Number of Occurrences/1207.py
index 75af1272512..0e95a4b5367 100644
--- a/solutions/1207. Unique Number of Occurrences/1207.py	
+++ b/solutions/1207. Unique Number of Occurrences/1207.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def uniqueOccurrences(self, arr: list[int]) -> bool:
+  def uniqueOccurrences(self, arr: List[int]) -> bool:
     count = collections.Counter(arr)
     occurrences = set()
 
diff --git a/solutions/1209. Remove All Adjacent Duplicates in String II/1209.java b/solutions/1209. Remove All Adjacent Duplicates in String II/1209.java
index 653fbf79abe..32baffbcbc7 100644
--- a/solutions/1209. Remove All Adjacent Duplicates in String II/1209.java	
+++ b/solutions/1209. Remove All Adjacent Duplicates in String II/1209.java	
@@ -1,6 +1,7 @@
 class Item {
-  public char c;
-  public int freq;
+  char c;
+  int freq;
+
   public Item(char c, int freq) {
     this.c = c;
     this.freq = freq;
diff --git a/solutions/121. Best Time to Buy and Sell Stock/121.py b/solutions/121. Best Time to Buy and Sell Stock/121.py
index 825f6950f55..22d80b40be1 100644
--- a/solutions/121. Best Time to Buy and Sell Stock/121.py	
+++ b/solutions/121. Best Time to Buy and Sell Stock/121.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxProfit(self, prices: list[int]) -> int:
+  def maxProfit(self, prices: List[int]) -> int:
     sellOne = 0
     holdOne = -math.inf
 
diff --git a/solutions/1210. Minimum Moves to Reach Target with Rotations/1210.cpp b/solutions/1210. Minimum Moves to Reach Target with Rotations/1210.cpp
index cb63aa6611c..5f81756f1ed 100644
--- a/solutions/1210. Minimum Moves to Reach Target with Rotations/1210.cpp	
+++ b/solutions/1210. Minimum Moves to Reach Target with Rotations/1210.cpp	
@@ -4,6 +4,9 @@ class Solution {
  public:
   int minimumMoves(vector<vector<int>>& grid) {
     const int n = grid.size();
+    int ans = 0;
+    // the state of (x, y, pos)
+    // pos := 0 (horizontal) / 1 (vertical)
     queue<tuple<int, int, Pos>> q{{{0, 0, Pos::kHorizontal}}};
     vector<vector<vector<bool>>> seen(n,
                                       vector<vector<bool>>(n, vector<bool>(2)));
@@ -31,12 +34,12 @@ class Solution {
              !grid[x][y + 1];
     };
 
-    for (int step = 0; !q.empty(); ++step)
+    while (!q.empty()) {
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [x, y, pos] = q.front();
         q.pop();
         if (x == n - 1 && y == n - 2 && pos == Pos::kHorizontal)
-          return step;
+          return ans;
         if (canMoveRight(x, y, pos) && !seen[x][y + 1][static_cast<int>(pos)]) {
           q.emplace(x, y + 1, pos);
           seen[x][y + 1][static_cast<int>(pos)] = true;
@@ -54,6 +57,8 @@ class Solution {
           seen[x][y][static_cast<int>(newPos)] = true;
         }
       }
+      ++ans;
+    }
 
     return -1;
   }
diff --git a/solutions/1210. Minimum Moves to Reach Target with Rotations/1210.java b/solutions/1210. Minimum Moves to Reach Target with Rotations/1210.java
index f778cf9de93..3a94c7f68c8 100644
--- a/solutions/1210. Minimum Moves to Reach Target with Rotations/1210.java	
+++ b/solutions/1210. Minimum Moves to Reach Target with Rotations/1210.java	
@@ -1,58 +1,63 @@
-enum Pos { HORIZONTAL, VERTICAL }
+enum Pos { kHorizontal, kVertical }
 
 class Solution {
   public int minimumMoves(int[][] grid) {
-    record T(int x, int y, Pos pos) {}
     final int n = grid.length;
-    Queue<T> q = new ArrayDeque<>(List.of(new T(0, 0, Pos.HORIZONTAL)));
+    int ans = 0;
+    // the state of (x, y, pos)
+    // pos := 0 (horizontal) / 1 (vertical)
+    Queue<int[]> q = new ArrayDeque<>(Arrays.asList(new int[] {0, 0, Pos.kHorizontal.ordinal()}));
     boolean[][][] seen = new boolean[n][n][2];
-    seen[0][0][Pos.HORIZONTAL.ordinal()] = true;
+    seen[0][0][Pos.kHorizontal.ordinal()] = true;
 
-    for (int step = 0; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
       for (int sz = q.size(); sz > 0; --sz) {
-        final int x = q.peek().x;
-        final int y = q.peek().y;
-        final Pos pos = q.poll().pos;
-        if (x == n - 1 && y == n - 2 && pos == Pos.HORIZONTAL)
-          return step;
-        if (canMoveRight(grid, x, y, pos) && !seen[x][y + 1][pos.ordinal()]) {
-          q.offer(new T(x, y + 1, pos));
-          seen[x][y + 1][pos.ordinal()] = true;
+        final int x = q.peek()[0];
+        final int y = q.peek()[1];
+        final int pos = q.poll()[2];
+        if (x == n - 1 && y == n - 2 && pos == Pos.kHorizontal.ordinal())
+          return ans;
+        if (canMoveRight(grid, x, y, pos) && !seen[x][y + 1][pos]) {
+          q.offer(new int[] {x, y + 1, pos});
+          seen[x][y + 1][pos] = true;
         }
-        if (canMoveDown(grid, x, y, pos) && !seen[x + 1][y][pos.ordinal()]) {
-          q.offer(new T(x + 1, y, pos));
-          seen[x + 1][y][pos.ordinal()] = true;
+        if (canMoveDown(grid, x, y, pos) && !seen[x + 1][y][pos]) {
+          q.offer(new int[] {x + 1, y, pos});
+          seen[x + 1][y][pos] = true;
         }
-        final Pos newPos = pos == Pos.HORIZONTAL ? Pos.VERTICAL : Pos.HORIZONTAL;
+        final int newPos =
+            pos == Pos.kHorizontal.ordinal() ? Pos.kVertical.ordinal() : Pos.kHorizontal.ordinal();
         if ((canRotateClockwise(grid, x, y, pos) || canRotateCounterclockwise(grid, x, y, pos)) &&
-            !seen[x][y][newPos.ordinal()]) {
-          q.offer(new T(x, y, newPos));
-          seen[x][y][newPos.ordinal()] = true;
+            !seen[x][y][newPos]) {
+          q.offer(new int[] {x, y, newPos});
+          seen[x][y][newPos] = true;
         }
       }
+      ++ans;
+    }
 
     return -1;
   }
 
-  private boolean canMoveRight(int[][] grid, int x, int y, Pos pos) {
-    if (pos == Pos.HORIZONTAL)
+  private boolean canMoveRight(int[][] grid, int x, int y, int pos) {
+    if (pos == Pos.kHorizontal.ordinal())
       return y + 2 < grid.length && grid[x][y + 2] == 0;
     return y + 1 < grid.length && grid[x][y + 1] == 0 && grid[x + 1][y + 1] == 0;
   }
 
-  private boolean canMoveDown(int[][] grid, int x, int y, Pos pos) {
-    if (pos == Pos.VERTICAL)
+  private boolean canMoveDown(int[][] grid, int x, int y, int pos) {
+    if (pos == Pos.kVertical.ordinal())
       return x + 2 < grid.length && grid[x + 2][y] == 0;
     return x + 1 < grid.length && grid[x + 1][y] == 0 && grid[x + 1][y + 1] == 0;
-  }
+  };
 
-  private boolean canRotateClockwise(int[][] grid, int x, int y, Pos pos) {
-    return pos == Pos.HORIZONTAL && x + 1 < grid.length && grid[x + 1][y + 1] == 0 &&
+  private boolean canRotateClockwise(int[][] grid, int x, int y, int pos) {
+    return pos == Pos.kHorizontal.ordinal() && x + 1 < grid.length && grid[x + 1][y + 1] == 0 &&
         grid[x + 1][y] == 0;
-  }
+  };
 
-  private boolean canRotateCounterclockwise(int[][] grid, int x, int y, Pos pos) {
-    return pos == Pos.VERTICAL && y + 1 < grid.length && grid[x + 1][y + 1] == 0 &&
+  private boolean canRotateCounterclockwise(int[][] grid, int x, int y, int pos) {
+    return pos == Pos.kVertical.ordinal() && y + 1 < grid.length && grid[x + 1][y + 1] == 0 &&
         grid[x][y + 1] == 0;
-  }
+  };
 }
diff --git a/solutions/1210. Minimum Moves to Reach Target with Rotations/1210.py b/solutions/1210. Minimum Moves to Reach Target with Rotations/1210.py
index 6558b23b828..9745ee0da71 100644
--- a/solutions/1210. Minimum Moves to Reach Target with Rotations/1210.py	
+++ b/solutions/1210. Minimum Moves to Reach Target with Rotations/1210.py	
@@ -2,41 +2,41 @@
 
 
 class Pos(IntEnum):
-  HORIZONTAL = 0
-  VERTICAL = 1
+  kHorizontal = 0
+  kVertical = 1
 
 
 class Solution:
-  def minimumMoves(self, grid: list[list[int]]) -> int:
+  def minimumMoves(self, grid: List[List[int]]) -> int:
     n = len(grid)
     ans = 0
     # the state of (x, y, pos)
     # pos := 0 (horizontal) / 1 (vertical)
-    q = collections.deque([(0, 0, Pos.HORIZONTAL)])
-    seen = {(0, 0, Pos.HORIZONTAL)}
+    q = collections.deque([(0, 0, Pos.kHorizontal)])
+    seen = {(0, 0, Pos.kHorizontal)}
 
     def canMoveRight(x: int, y: int, pos: Pos) -> bool:
-      if pos == Pos.HORIZONTAL:
+      if pos == Pos.kHorizontal:
         return y + 2 < n and not grid[x][y + 2]
       return y + 1 < n and not grid[x][y + 1] and not grid[x + 1][y + 1]
 
     def canMoveDown(x: int, y: int, pos: Pos) -> bool:
-      if pos == Pos.VERTICAL:
+      if pos == Pos.kVertical:
         return x + 2 < n and not grid[x + 2][y]
       return x + 1 < n and not grid[x + 1][y] and not grid[x + 1][y + 1]
 
     def canRotateClockwise(x: int, y: int, pos: Pos) -> bool:
-      return (pos == Pos.HORIZONTAL and x + 1 < n and
-              not grid[x + 1][y + 1] and not grid[x + 1][y])
+      return pos == Pos.kHorizontal and x + 1 < n and \
+          not grid[x + 1][y + 1] and not grid[x + 1][y]
 
     def canRotateCounterclockwise(x: int, y: int, pos: Pos) -> bool:
-      return (pos == Pos.VERTICAL and y + 1 < n and
-              not grid[x + 1][y + 1] and not grid[x][y + 1])
+      return pos == Pos.kVertical and y + 1 < n and \
+          not grid[x + 1][y + 1] and not grid[x][y + 1]
 
     while q:
       for _ in range(len(q)):
         x, y, pos = q.popleft()
-        if x == n - 1 and y == n - 2 and pos == Pos.HORIZONTAL:
+        if x == n - 1 and y == n - 2 and pos == Pos.kHorizontal:
           return ans
         if canMoveRight(x, y, pos) and (x, y + 1, pos) not in seen:
           q.append((x, y + 1, pos))
@@ -44,10 +44,9 @@ def canRotateCounterclockwise(x: int, y: int, pos: Pos) -> bool:
         if canMoveDown(x, y, pos) and (x + 1, y, pos) not in seen:
           q.append((x + 1, y, pos))
           seen.add((x + 1, y, pos))
-        newPos = Pos.VERTICAL if pos == Pos.HORIZONTAL else Pos.HORIZONTAL
-        if ((canRotateClockwise(x, y, pos) or
-             canRotateCounterclockwise(x, y, pos)) and
-                (x, y, newPos) not in seen):
+        newPos = Pos.kVertical if pos == Pos.kHorizontal else Pos.kHorizontal
+        if (canRotateClockwise(x, y, pos) or canRotateCounterclockwise(x, y, pos)) and \
+                (x, y, newPos) not in seen:
           q.append((x, y, newPos))
           seen.add((x, y, newPos))
       ans += 1
diff --git a/solutions/1214. Two Sum BSTs/1214.py b/solutions/1214. Two Sum BSTs/1214.py
index 6d8c0824b64..ba49d06958b 100644
--- a/solutions/1214. Two Sum BSTs/1214.py	
+++ b/solutions/1214. Two Sum BSTs/1214.py	
@@ -1,5 +1,5 @@
 class BSTIterator:
-  def __init__(self, root: TreeNode | None, leftToRight: bool):
+  def __init__(self, root: Optional[TreeNode], leftToRight: bool):
     self.stack = []
     self.leftToRight = leftToRight
     self._pushUntilNone(root)
@@ -15,19 +15,14 @@ def next(self) -> int:
       self._pushUntilNone(node.left)
     return node.val
 
-  def _pushUntilNone(self, root: TreeNode | None):
+  def _pushUntilNone(self, root: Optional[TreeNode]):
     while root:
       self.stack.append(root)
       root = root.left if self.leftToRight else root.right
 
 
 class Solution:
-  def twoSumBSTs(
-      self,
-      root1: TreeNode | None,
-      root2: TreeNode | None,
-      target: int,
-  ) -> bool:
+  def twoSumBSTs(self, root1: Optional[TreeNode], root2: Optional[TreeNode], target: int) -> bool:
     bst1 = BSTIterator(root1, True)
     bst2 = BSTIterator(root2, False)
 
diff --git a/solutions/1215. Stepping Numbers/1215-2.py b/solutions/1215. Stepping Numbers/1215-2.py
index 445393d7517..d7e089fe29d 100644
--- a/solutions/1215. Stepping Numbers/1215-2.py	
+++ b/solutions/1215. Stepping Numbers/1215-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countSteppingNumbers(self, low: int, high: int) -> list[int]:
+  def countSteppingNumbers(self, low: int, high: int) -> List[int]:
     ans = [0] if low == 0 else []
 
     def dfs(curr: int) -> None:
diff --git a/solutions/1215. Stepping Numbers/1215.py b/solutions/1215. Stepping Numbers/1215.py
index 9b71383311b..4821d1217f9 100644
--- a/solutions/1215. Stepping Numbers/1215.py	
+++ b/solutions/1215. Stepping Numbers/1215.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countSteppingNumbers(self, low: int, high: int) -> list[int]:
+  def countSteppingNumbers(self, low: int, high: int) -> List[int]:
     ans = [0] if low == 0 else []
     q = collections.deque(list(range(1, 10)))
 
diff --git a/solutions/1217. Play with Chips/1217.py b/solutions/1217. Play with Chips/1217.py
index 1620df9c47d..91c964fc7a1 100644
--- a/solutions/1217. Play with Chips/1217.py	
+++ b/solutions/1217. Play with Chips/1217.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def minCostToMoveChips(self, position: list[int]) -> int:
-    count = [0, 0]
+  def minCostToMoveChips(self, position: List[int]) -> int:
+    count = [0] * 2
     for p in position:
       count[p % 2] += 1
     return min(count[0], count[1])
diff --git a/solutions/1218. Longest Arithmetic Subsequence of Given Difference/1218.py b/solutions/1218. Longest Arithmetic Subsequence of Given Difference/1218.py
index d4298fd504f..f311e256f33 100644
--- a/solutions/1218. Longest Arithmetic Subsequence of Given Difference/1218.py	
+++ b/solutions/1218. Longest Arithmetic Subsequence of Given Difference/1218.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestSubsequence(self, arr: list[int], difference: int) -> int:
+  def longestSubsequence(self, arr: List[int], difference: int) -> int:
     ans = 0
     lengthAt = {}
 
diff --git a/solutions/1219. Path with Maximum Gold/1219.py b/solutions/1219. Path with Maximum Gold/1219.py
index 11251749b6d..b3301b8d8c7 100644
--- a/solutions/1219. Path with Maximum Gold/1219.py	
+++ b/solutions/1219. Path with Maximum Gold/1219.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getMaximumGold(self, grid: list[list[int]]) -> int:
+  def getMaximumGold(self, grid: List[List[int]]) -> int:
     def dfs(i: int, j: int) -> int:
       if i < 0 or j < 0 or i == len(grid) or j == len(grid[0]):
         return 0
diff --git a/solutions/122. Best Time to Buy and Sell Stock II/122.py b/solutions/122. Best Time to Buy and Sell Stock II/122.py
index c89e27395ee..1f18bd480ac 100644
--- a/solutions/122. Best Time to Buy and Sell Stock II/122.py	
+++ b/solutions/122. Best Time to Buy and Sell Stock II/122.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxProfit(self, prices: list[int]) -> int:
+  def maxProfit(self, prices: List[int]) -> int:
     sell = 0
     hold = -math.inf
 
diff --git a/solutions/1220. Count Vowels Permutation/1220.py b/solutions/1220. Count Vowels Permutation/1220.py
index cacb532e2c8..15dce6769f6 100644
--- a/solutions/1220. Count Vowels Permutation/1220.py	
+++ b/solutions/1220. Count Vowels Permutation/1220.py	
@@ -1,6 +1,6 @@
 class Solution:
   def countVowelPermutation(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     dp = {'a': 1, 'e': 1, 'i': 1, 'o': 1, 'u': 1}
 
     for _ in range(n - 1):
@@ -11,4 +11,4 @@ def countVowelPermutation(self, n: int) -> int:
                'u': dp['i'] + dp['o']}
       dp = newDp
 
-    return sum(dp.values()) % MOD
+    return sum(dp.values()) % kMod
diff --git a/solutions/1222. Queens That Can Attack the King/1222.py b/solutions/1222. Queens That Can Attack the King/1222.py
index 2debcad9aa6..147fefbc5b3 100644
--- a/solutions/1222. Queens That Can Attack the King/1222.py	
+++ b/solutions/1222. Queens That Can Attack the King/1222.py	
@@ -1,18 +1,9 @@
 class Solution:
-  def queensAttacktheKing(self, queens: list[list[int]],
-                          king: list[int]) -> list[list[int]]:
+  def queensAttacktheKing(self, queens: List[List[int]], king: List[int]) -> List[List[int]]:
     ans = []
     queens = {(i, j) for i, j in queens}
 
-    for d in [
-        [-1, -1],
-        [-1, 0],
-        [-1, 1],
-        [0, -1],
-        [0, 1],
-        [1, -1],
-        [1, 0],
-            [1, 1]]:
+    for d in [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]]:
       i = king[0] + d[0]
       j = king[1] + d[1]
       while 0 <= i < 8 and 0 <= j < 8:
diff --git a/solutions/1223. Dice Roll Simulation/1223.py b/solutions/1223. Dice Roll Simulation/1223.py
index 3d024a431e1..949602a944c 100644
--- a/solutions/1223. Dice Roll Simulation/1223.py	
+++ b/solutions/1223. Dice Roll Simulation/1223.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def dieSimulator(self, n: int, rollMax: list[int]) -> int:
-    MAX_ROLLS = 15
-    MOD = 1_000_000_007
+  def dieSimulator(self, n: int, rollMax: List[int]) -> int:
+    kMaxRolls = 15
+    kMod = 1_000_000_007
 
-    dp = [[[0] * (MAX_ROLLS + 1) for j in range(6)] for i in range(n + 1)]
+    dp = [[[0] * (kMaxRolls + 1) for j in range(6)] for i in range(n + 1)]
 
     for num in range(6):
       dp[1][num][1] = 1
@@ -14,7 +14,7 @@ def dieSimulator(self, n: int, rollMax: list[int]) -> int:
           for k in range(1, 15 + 1):
             if prevNum != currNum:
               dp[i][currNum][1] = (
-                  dp[i][currNum][1] + dp[i - 1][prevNum][k]) % MOD
+                  dp[i][currNum][1] + dp[i - 1][prevNum][k]) % kMod
             elif k < rollMax[currNum]:
               dp[i][currNum][k + 1] = dp[i - 1][currNum][k]
 
@@ -24,4 +24,4 @@ def dieSimulator(self, n: int, rollMax: list[int]) -> int:
       for k in range(1, 15 + 1):
         ans += dp[n][num][k]
 
-    return ans % MOD
+    return ans % kMod
diff --git a/solutions/1224. Maximum Equal Frequency/1224.py b/solutions/1224. Maximum Equal Frequency/1224.py
index bb4b12ca61f..df4de26f6ef 100644
--- a/solutions/1224. Maximum Equal Frequency/1224.py	
+++ b/solutions/1224. Maximum Equal Frequency/1224.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxEqualFreq(self, nums: list[int]) -> int:
+  def maxEqualFreq(self, nums: List[int]) -> int:
     ans = 0
     maxFreq = 0
     count = collections.Counter()
@@ -10,8 +10,7 @@ def maxEqualFreq(self, nums: list[int]) -> int:
       count[num] += 1
       freq[count[num]] += 1
       maxFreq = max(maxFreq, count[num])
-      if maxFreq == 1 or maxFreq * freq[maxFreq] == i or (maxFreq - 1) * (
-              freq[maxFreq - 1] + 1) == i:
+      if maxFreq == 1 or maxFreq * freq[maxFreq] == i or (maxFreq - 1) * (freq[maxFreq - 1] + 1) == i:
         ans = i + 1
 
     return ans
diff --git a/solutions/1228. Missing Number In Arithmetic Progression/1228.py b/solutions/1228. Missing Number In Arithmetic Progression/1228.py
index ef61cd4cc4c..19919c6528d 100644
--- a/solutions/1228. Missing Number In Arithmetic Progression/1228.py	
+++ b/solutions/1228. Missing Number In Arithmetic Progression/1228.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def missingNumber(self, arr: list[int]) -> int:
+  def missingNumber(self, arr: List[int]) -> int:
     n = len(arr)
     delta = (arr[-1] - arr[0]) // n
     l = 0
diff --git a/solutions/1229. Meeting Scheduler/1229.java b/solutions/1229. Meeting Scheduler/1229.java
index b72bb9764fe..403115b5852 100644
--- a/solutions/1229. Meeting Scheduler/1229.java	
+++ b/solutions/1229. Meeting Scheduler/1229.java	
@@ -1,7 +1,7 @@
 class Solution {
   public List<Integer> minAvailableDuration(int[][] slots1, int[][] slots2, int duration) {
-    Arrays.sort(slots1, Comparator.comparingInt(slot -> slot[0]));
-    Arrays.sort(slots2, Comparator.comparingInt(slot -> slot[0]));
+    Arrays.sort(slots1, (a, b) -> a[0] - b[0]);
+    Arrays.sort(slots2, (a, b) -> a[0] - b[0]);
 
     int i = 0; // slots1's index
     int j = 0; // slots2's index
diff --git a/solutions/1229. Meeting Scheduler/1229.py b/solutions/1229. Meeting Scheduler/1229.py
index 204debde96a..33cba0b5b77 100644
--- a/solutions/1229. Meeting Scheduler/1229.py	
+++ b/solutions/1229. Meeting Scheduler/1229.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minAvailableDuration(
-      self,
-      slots1: list[list[int]],
-      slots2: list[list[int]],
-      duration: int,
-  ) -> list[int]:
+  def minAvailableDuration(self, slots1: List[List[int]], slots2: List[List[int]], duration: int) -> List[int]:
     slots1.sort()
     slots2.sort()
 
diff --git a/solutions/123. Best Time to Buy and Sell Stock III/123.py b/solutions/123. Best Time to Buy and Sell Stock III/123.py
index e64e7a83e06..9b4c0ebd74b 100644
--- a/solutions/123. Best Time to Buy and Sell Stock III/123.py	
+++ b/solutions/123. Best Time to Buy and Sell Stock III/123.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxProfit(self, prices: list[int]) -> int:
+  def maxProfit(self, prices: List[int]) -> int:
     sellTwo = 0
     holdTwo = -math.inf
     sellOne = 0
diff --git a/solutions/1230. Toss Strange Coins/1230-2.py b/solutions/1230. Toss Strange Coins/1230-2.py
index 55c123c2588..0688b678bd3 100644
--- a/solutions/1230. Toss Strange Coins/1230-2.py	
+++ b/solutions/1230. Toss Strange Coins/1230-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def probabilityOfHeads(self, prob: list[float], target: int) -> float:
+  def probabilityOfHeads(self, prob: List[float], target: int) -> float:
     # dp[j] := the probability of tossing the coins so far with j heads
     dp = [1.0] + [0] * len(prob)
 
diff --git a/solutions/1230. Toss Strange Coins/1230.py b/solutions/1230. Toss Strange Coins/1230.py
index 334dc34f2fe..8754de022ec 100644
--- a/solutions/1230. Toss Strange Coins/1230.py	
+++ b/solutions/1230. Toss Strange Coins/1230.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def probabilityOfHeads(self, prob: list[float], target: int) -> float:
+  def probabilityOfHeads(self, prob: List[float], target: int) -> float:
     # dp[i][j] := the probability of tossing the first i coins with j heads
     dp = [[0] * (target + 1) for _ in range(len(prob) + 1)]
     dp[0][0] = 1.0
 
     for i in range(1, len(prob) + 1):
       for j in range(target + 1):
-        dp[i][j] = ((dp[i - 1][j - 1] * prob[i - 1] if j > 0 else 0) +
-                    dp[i - 1][j] * (1 - prob[i - 1]))
+        dp[i][j] = (dp[i - 1][j - 1] * prob[i - 1] if j > 0 else 0) + \
+            dp[i - 1][j] * (1 - prob[i - 1])
 
     return dp[len(prob)][target]
diff --git a/solutions/1231. Divide Chocolate/1231.py b/solutions/1231. Divide Chocolate/1231.py
index e21de6bac7f..014ae4e67ae 100644
--- a/solutions/1231. Divide Chocolate/1231.py	
+++ b/solutions/1231. Divide Chocolate/1231.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximizeSweetness(self, sweetness: list[int], k: int) -> int:
+  def maximizeSweetness(self, sweetness: List[int], k: int) -> int:
     l = len(sweetness) // (k + 1)
     r = sum(sweetness) // (k + 1)
 
diff --git a/solutions/1232. Check If It Is a Straight Line/1232.py b/solutions/1232. Check If It Is a Straight Line/1232.py
index 83ce6d1af1b..5073014d0a4 100644
--- a/solutions/1232. Check If It Is a Straight Line/1232.py	
+++ b/solutions/1232. Check If It Is a Straight Line/1232.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def checkStraightLine(self, coordinates: list[list[int]]) -> bool:
+  def checkStraightLine(self, coordinates: List[List[int]]) -> bool:
     x0, y0, x1, y1 = *coordinates[0], *coordinates[1]
     dx = x1 - x0
     dy = y1 - y0
diff --git a/solutions/1233. Remove Sub-Folders from the Filesystem/1233.py b/solutions/1233. Remove Sub-Folders from the Filesystem/1233.py
index 5e2893516d7..97dade92835 100644
--- a/solutions/1233. Remove Sub-Folders from the Filesystem/1233.py	
+++ b/solutions/1233. Remove Sub-Folders from the Filesystem/1233.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def removeSubfolders(self, folder: list[str]) -> list[str]:
+  def removeSubfolders(self, folder: List[str]) -> List[str]:
     ans = []
     prev = ""
 
diff --git a/solutions/1235. Maximum Profit in Job Scheduling/1235-2.cpp b/solutions/1235. Maximum Profit in Job Scheduling/1235-2.cpp
index 02b9006a6dd..5c9672f0e14 100644
--- a/solutions/1235. Maximum Profit in Job Scheduling/1235-2.cpp	
+++ b/solutions/1235. Maximum Profit in Job Scheduling/1235-2.cpp	
@@ -2,6 +2,8 @@ struct Job {
   int startTime;
   int endTime;
   int profit;
+  Job(int startTime, int endTime, int profit)
+      : startTime(startTime), endTime(endTime), profit(profit) {}
 };
 
 class Solution {
@@ -16,8 +18,9 @@ class Solution {
     for (int i = 0; i < n; ++i)
       jobs.emplace_back(startTime[i], endTime[i], profit[i]);
 
-    ranges::sort(jobs, ranges::less{},
-                 [](const Job& job) { return job.startTime; });
+    ranges::sort(jobs, [](const Job& a, const Job& b) {
+      return a.startTime < b.startTime;
+    });
 
     for (int i = 0; i < n; ++i)
       startTime[i] = jobs[i].startTime;
@@ -32,8 +35,7 @@ class Solution {
     return dp[0];
   }
 
-  int firstGreaterEqual(const vector<int>& arr, int startFrom, int target) {
-    return lower_bound(arr.begin() + startFrom, arr.end(), target) -
-           arr.begin();
+  int firstGreaterEqual(const vector<int>& A, int startFrom, int target) {
+    return lower_bound(A.begin() + startFrom, A.end(), target) - A.begin();
   }
 };
diff --git a/solutions/1235. Maximum Profit in Job Scheduling/1235-2.java b/solutions/1235. Maximum Profit in Job Scheduling/1235-2.java
index cff2c2e9507..010b389a243 100644
--- a/solutions/1235. Maximum Profit in Job Scheduling/1235-2.java	
+++ b/solutions/1235. Maximum Profit in Job Scheduling/1235-2.java	
@@ -1,6 +1,16 @@
+class Job {
+  public int startTime;
+  public int endTime;
+  public int profit;
+  public Job(int startTime, int endTime, int profit) {
+    this.startTime = startTime;
+    this.endTime = endTime;
+    this.profit = profit;
+  }
+}
+
 class Solution {
   public int jobScheduling(int[] startTime, int[] endTime, int[] profit) {
-    record Job(int startTime, int endTime, int profit) {}
     final int n = startTime.length;
     // dp[i] := the maximum profit to schedule jobs[i..n)
     int[] dp = new int[n + 1];
@@ -9,7 +19,7 @@ record Job(int startTime, int endTime, int profit) {}
     for (int i = 0; i < n; ++i)
       jobs[i] = new Job(startTime[i], endTime[i], profit[i]);
 
-    Arrays.sort(jobs, Comparator.comparingInt(Job::startTime));
+    Arrays.sort(jobs, (a, b) -> a.startTime - b.startTime);
 
     for (int i = 0; i < n; ++i)
       startTime[i] = jobs[i].startTime;
@@ -24,12 +34,12 @@ record Job(int startTime, int endTime, int profit) {}
     return dp[0];
   }
 
-  private int firstGreaterEqual(int[] arr, int startFrom, int target) {
+  private int firstGreaterEqual(int[] A, int startFrom, int target) {
     int l = startFrom;
-    int r = arr.length;
+    int r = A.length;
     while (l < r) {
       final int m = (l + r) / 2;
-      if (arr[m] >= target)
+      if (A[m] >= target)
         r = m;
       else
         l = m + 1;
diff --git a/solutions/1235. Maximum Profit in Job Scheduling/1235-2.py b/solutions/1235. Maximum Profit in Job Scheduling/1235-2.py
index 3d9d737d52b..ac42e92481b 100644
--- a/solutions/1235. Maximum Profit in Job Scheduling/1235-2.py	
+++ b/solutions/1235. Maximum Profit in Job Scheduling/1235-2.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def jobScheduling(
-      self,
-      startTime: list[int],
-      endTime: list[int],
-      profit: list[int],
-  ) -> int:
+  def jobScheduling(self, startTime: List[int], endTime: List[int], profit: List[int]) -> int:
     # dp[i] := the maximum profit to schedule jobs[i..n)
     dp = [0] * (len(startTime) + 1)
     jobs = sorted([(s, e, p) for s, e, p in zip(startTime, endTime, profit)])
diff --git a/solutions/1235. Maximum Profit in Job Scheduling/1235-3.cpp b/solutions/1235. Maximum Profit in Job Scheduling/1235-3.cpp
index 0e8be9a7ed3..b3caa492438 100644
--- a/solutions/1235. Maximum Profit in Job Scheduling/1235-3.cpp	
+++ b/solutions/1235. Maximum Profit in Job Scheduling/1235-3.cpp	
@@ -2,6 +2,8 @@ struct Job {
   int startTime;
   int endTime;
   int profit;
+  Job(int startTime, int endTime, int profit)
+      : startTime(startTime), endTime(endTime), profit(profit) {}
 };
 
 class Solution {
@@ -13,8 +15,9 @@ class Solution {
     for (int i = 0; i < startTime.size(); ++i)
       jobs.emplace_back(startTime[i], endTime[i], profit[i]);
 
-    ranges::sort(jobs, ranges::less{},
-                 [](const Job& job) { return job.startTime; });
+    ranges::sort(jobs, [](const Job& a, const Job& b) {
+      return a.startTime < b.startTime;
+    });
 
     return getMaxProfit(jobs);
   }
diff --git a/solutions/1235. Maximum Profit in Job Scheduling/1235-3.java b/solutions/1235. Maximum Profit in Job Scheduling/1235-3.java
index dadcf96f7bf..8ff84ebe1fe 100644
--- a/solutions/1235. Maximum Profit in Job Scheduling/1235-3.java	
+++ b/solutions/1235. Maximum Profit in Job Scheduling/1235-3.java	
@@ -1,12 +1,24 @@
+class Job {
+  public int startTime;
+  public int endTime;
+  public int profit;
+  public Job(int startTime, int endTime, int profit) {
+    this.startTime = startTime;
+    this.endTime = endTime;
+    this.profit = profit;
+  }
+}
+
 class Solution {
   public int jobScheduling(int[] startTime, int[] endTime, int[] profit) {
     final int n = startTime.length;
+
     Job[] jobs = new Job[n];
 
     for (int i = 0; i < n; ++i)
       jobs[i] = new Job(startTime[i], endTime[i], profit[i]);
 
-    Arrays.sort(jobs, Comparator.comparingInt(Job::startTime));
+    Arrays.sort(jobs, (a, b) -> a.startTime - b.startTime);
 
     // Will use binary search to find the first available startTime
     for (int i = 0; i < n; ++i)
@@ -15,11 +27,9 @@ public int jobScheduling(int[] startTime, int[] endTime, int[] profit) {
     return getMaxProfit(jobs);
   }
 
-  private record Job(int startTime, int endTime, int profit) {}
-
   private int getMaxProfit(Job[] jobs) {
     int maxProfit = 0;
-    Queue<Job> minHeap = new PriorityQueue<>(Comparator.comparingInt(Job::endTime));
+    Queue<Job> minHeap = new PriorityQueue<>((a, b) -> a.endTime - b.endTime);
 
     for (Job job : jobs) {
       while (!minHeap.isEmpty() && job.startTime >= minHeap.peek().endTime)
diff --git a/solutions/1235. Maximum Profit in Job Scheduling/1235-3.py b/solutions/1235. Maximum Profit in Job Scheduling/1235-3.py
index 61765e176c0..0b903cec241 100644
--- a/solutions/1235. Maximum Profit in Job Scheduling/1235-3.py	
+++ b/solutions/1235. Maximum Profit in Job Scheduling/1235-3.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def jobScheduling(
-      self,
-      startTime: list[int],
-      endTime: list[int],
-      profit: list[int],
-  ) -> int:
+  def jobScheduling(self, startTime: List[int], endTime: List[int], profit: List[int]) -> int:
     maxProfit = 0
     jobs = sorted([(s, e, p) for s, e, p in zip(startTime, endTime, profit)])
     minHeap = []  # (endTime, profit)
diff --git a/solutions/1235. Maximum Profit in Job Scheduling/1235.cpp b/solutions/1235. Maximum Profit in Job Scheduling/1235.cpp
index faedc717ba5..ca96c30347a 100644
--- a/solutions/1235. Maximum Profit in Job Scheduling/1235.cpp	
+++ b/solutions/1235. Maximum Profit in Job Scheduling/1235.cpp	
@@ -2,6 +2,8 @@ struct Job {
   int startTime;
   int endTime;
   int profit;
+  Job(int startTime, int endTime, int profit)
+      : startTime(startTime), endTime(endTime), profit(profit) {}
 };
 
 class Solution {
@@ -15,8 +17,9 @@ class Solution {
     for (int i = 0; i < n; ++i)
       jobs.emplace_back(startTime[i], endTime[i], profit[i]);
 
-    ranges::sort(jobs, ranges::less{},
-                 [](const Job& job) { return job.startTime; });
+    ranges::sort(jobs, [](const Job& a, const Job& b) {
+      return a.startTime < b.startTime;
+    });
 
     // Will use binary search to find the first available start time.
     for (int i = 0; i < n; ++i)
@@ -40,8 +43,7 @@ class Solution {
     return mem[i] = max(pick, skip);
   }
 
-  int firstGreaterEqual(const vector<int>& arr, int startFrom, int target) {
-    return lower_bound(arr.begin() + startFrom, arr.end(), target) -
-           arr.begin();
+  int firstGreaterEqual(const vector<int>& A, int startFrom, int target) {
+    return lower_bound(A.begin() + startFrom, A.end(), target) - A.begin();
   }
 };
diff --git a/solutions/1235. Maximum Profit in Job Scheduling/1235.java b/solutions/1235. Maximum Profit in Job Scheduling/1235.java
index 35f46728613..ffd28abb063 100644
--- a/solutions/1235. Maximum Profit in Job Scheduling/1235.java	
+++ b/solutions/1235. Maximum Profit in Job Scheduling/1235.java	
@@ -1,3 +1,14 @@
+class Job {
+  public int startTime;
+  public int endTime;
+  public int profit;
+  public Job(int startTime, int endTime, int profit) {
+    this.startTime = startTime;
+    this.endTime = endTime;
+    this.profit = profit;
+  }
+}
+
 class Solution {
   public int jobScheduling(int[] startTime, int[] endTime, int[] profit) {
     final int n = startTime.length;
@@ -7,7 +18,7 @@ public int jobScheduling(int[] startTime, int[] endTime, int[] profit) {
     for (int i = 0; i < n; ++i)
       jobs[i] = new Job(startTime[i], endTime[i], profit[i]);
 
-    Arrays.sort(jobs, Comparator.comparingInt(Job::startTime));
+    Arrays.sort(jobs, (a, b) -> a.startTime - b.startTime);
 
     // Will use binary search to find the first available start time.
     for (int i = 0; i < n; ++i)
@@ -16,8 +27,6 @@ public int jobScheduling(int[] startTime, int[] endTime, int[] profit) {
     return jobScheduling(jobs, startTime, 0, mem);
   }
 
-  private record Job(int startTime, int endTime, int profit) {}
-
   private int jobScheduling(Job[] jobs, int[] startTime, int i, int[] mem) {
     if (i == jobs.length)
       return 0;
@@ -30,12 +39,12 @@ private int jobScheduling(Job[] jobs, int[] startTime, int i, int[] mem) {
     return mem[i] = Math.max(pick, skip);
   }
 
-  private int firstGreaterEqual(int[] arr, int startFrom, int target) {
+  private int firstGreaterEqual(int[] A, int startFrom, int target) {
     int l = startFrom;
-    int r = arr.length;
+    int r = A.length;
     while (l < r) {
       final int m = (l + r) / 2;
-      if (arr[m] >= target)
+      if (A[m] >= target)
         r = m;
       else
         l = m + 1;
diff --git a/solutions/1235. Maximum Profit in Job Scheduling/1235.py b/solutions/1235. Maximum Profit in Job Scheduling/1235.py
index 6bb67efd43e..e27d4d84d0c 100644
--- a/solutions/1235. Maximum Profit in Job Scheduling/1235.py	
+++ b/solutions/1235. Maximum Profit in Job Scheduling/1235.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def jobScheduling(
-      self,
-      startTime: list[int],
-      endTime: list[int],
-      profit: list[int],
-  ) -> int:
+  def jobScheduling(self, startTime: List[int], endTime: List[int], profit: List[int]) -> int:
     jobs = sorted([(s, e, p) for s, e, p in zip(startTime, endTime, profit)])
 
     # Will use binary search to find the first available startTime
diff --git a/solutions/1236. Web Crawler/1236.java b/solutions/1236. Web Crawler/1236.java
index abffeb3fd6d..b366e9bc396 100644
--- a/solutions/1236. Web Crawler/1236.java	
+++ b/solutions/1236. Web Crawler/1236.java	
@@ -8,7 +8,7 @@
 
 class Solution {
   public List<String> crawl(String startUrl, HtmlParser htmlParser) {
-    Queue<String> q = new ArrayDeque<>(List.of(startUrl));
+    Queue<String> q = new ArrayDeque<>(Arrays.asList(startUrl));
     Set<String> seen = new HashSet<>(Arrays.asList(startUrl));
     final String hostname = startUrl.split("/")[2];
 
diff --git a/solutions/1236. Web Crawler/1236.py b/solutions/1236. Web Crawler/1236.py
index c88d431ef5b..2415e867553 100644
--- a/solutions/1236. Web Crawler/1236.py	
+++ b/solutions/1236. Web Crawler/1236.py	
@@ -3,10 +3,10 @@
 # You should not implement it, or speculate about its implementation
 # """
 # Class HtmlParser(object):
-#   def getUrls(self, url: str) -> list[str]:
+#   def getUrls(self, url: str) -> List[str]:
 
 class Solution:
-  def crawl(self, startUrl: str, htmlParser: 'HtmlParser') -> list[str]:
+  def crawl(self, startUrl: str, htmlParser: 'HtmlParser') -> List[str]:
     q = collections.deque([startUrl])
     seen = {startUrl}
     hostname = startUrl.split('/')[2]
diff --git a/solutions/1237. Find Positive Integer Solution for a Given Equation/1237.py b/solutions/1237. Find Positive Integer Solution for a Given Equation/1237.py
index cb2d2fa3acc..9939fc76295 100644
--- a/solutions/1237. Find Positive Integer Solution for a Given Equation/1237.py	
+++ b/solutions/1237. Find Positive Integer Solution for a Given Equation/1237.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findSolution(self, customfunction: 'CustomFunction', z: int) -> list[list[int]]:
+  def findSolution(self, customfunction: 'CustomFunction', z: int) -> List[List[int]]:
     ans = []
     x = 1
     y = 1000
diff --git a/solutions/1238. Circular Permutation in Binary Representation/1238.py b/solutions/1238. Circular Permutation in Binary Representation/1238.py
index 20ccc09117e..da3be8df28e 100644
--- a/solutions/1238. Circular Permutation in Binary Representation/1238.py	
+++ b/solutions/1238. Circular Permutation in Binary Representation/1238.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def circularPermutation(self, n: int, start: int) -> list[int]:
+  def circularPermutation(self, n: int, start: int) -> List[int]:
     return [start ^ i ^ i >> 1 for i in range(1 << n)]
diff --git a/solutions/124. Binary Tree Maximum Path Sum/124.py b/solutions/124. Binary Tree Maximum Path Sum/124.py
index 4f124172d78..ceb09132e06 100644
--- a/solutions/124. Binary Tree Maximum Path Sum/124.py	
+++ b/solutions/124. Binary Tree Maximum Path Sum/124.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def maxPathSum(self, root: TreeNode | None) -> int:
+  def maxPathSum(self, root: Optional[TreeNode]) -> int:
     ans = -math.inf
 
-    def maxPathSumDownFrom(root: TreeNode | None) -> int:
+    def maxPathSumDownFrom(root: Optional[TreeNode]) -> int:
       """
       Returns the maximum path sum starting from the current root, where
       root.val is always included.
diff --git a/solutions/1240. Tiling a Rectangle with the Fewest Squares/1240.cpp b/solutions/1240. Tiling a Rectangle with the Fewest Squares/1240.cpp
index 0341691fbf4..10ce55b1a12 100644
--- a/solutions/1240. Tiling a Rectangle with the Fewest Squares/1240.cpp	
+++ b/solutions/1240. Tiling a Rectangle with the Fewest Squares/1240.cpp	
@@ -28,8 +28,7 @@ class Solution {
       // Put a square of size `sz` to cover heights[start..start + sz).
       for (int i = start; i < start + sz; ++i)
         heights[i] += sz;
-      ans = min(ans,
-                tilingRectangle(n, m, hash(heights), std::move(heights), mem));
+      ans = min(ans, tilingRectangle(n, m, hash(heights), move(heights), mem));
       for (int i = start; i < start + sz; ++i)
         heights[i] -= sz;
     }
diff --git a/solutions/1240. Tiling a Rectangle with the Fewest Squares/1240.java b/solutions/1240. Tiling a Rectangle with the Fewest Squares/1240.java
index a995e9fbe08..2ea9c309217 100644
--- a/solutions/1240. Tiling a Rectangle with the Fewest Squares/1240.java	
+++ b/solutions/1240. Tiling a Rectangle with the Fewest Squares/1240.java	
@@ -3,7 +3,7 @@ public int tilingRectangle(int n, int m) {
     return tilingRectangle(n, m, 0, new int[m]);
   }
 
-  private static final int BASE = 13;
+  private static final int kBase = 13;
   private Map<Long, Integer> dp = new HashMap<>();
 
   private int tilingRectangle(int n, int m, long hashedHeights, int[] heights) {
@@ -43,7 +43,7 @@ private int tilingRectangle(int n, int m, long hashedHeights, int[] heights) {
   private long hash(int[] heights) {
     long hashed = 0;
     for (int i = heights.length - 1; i >= 0; --i)
-      hashed = hashed * BASE + heights[i];
+      hashed = hashed * kBase + heights[i];
     return hashed;
   }
 }
diff --git a/solutions/1240. Tiling a Rectangle with the Fewest Squares/1240.py b/solutions/1240. Tiling a Rectangle with the Fewest Squares/1240.py
index 5eb23dea348..ccdde2cca48 100644
--- a/solutions/1240. Tiling a Rectangle with the Fewest Squares/1240.py	
+++ b/solutions/1240. Tiling a Rectangle with the Fewest Squares/1240.py	
@@ -16,7 +16,7 @@ def dp(heights: int) -> int:
         if heights[start + sz - 1] != minHeight:
           break
         # Put a square of size `sz` to cover heights[start..start + sz).
-        heightslist[start:start + sz] = [minHeight + sz] * sz
+        heightsList[start:start + sz] = [minHeight + sz] * sz
         ans = min(ans, dp(tuple(heightsList)))
 
       return 1 + ans
diff --git a/solutions/1243. Array Transformation/1243.py b/solutions/1243. Array Transformation/1243.py
index 48719117c8f..7ce4a468619 100644
--- a/solutions/1243. Array Transformation/1243.py	
+++ b/solutions/1243. Array Transformation/1243.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def transformArray(self, arr: list[int]) -> list[int]:
+  def transformArray(self, arr: List[int]) -> List[int]:
     if len(arr) < 3:
       return arr
 
diff --git a/solutions/1245. Tree Diameter/1245.cpp b/solutions/1245. Tree Diameter/1245.cpp
index 6827161fd9a..d758b3f0f99 100644
--- a/solutions/1245. Tree Diameter/1245.cpp	
+++ b/solutions/1245. Tree Diameter/1245.cpp	
@@ -17,12 +17,12 @@ class Solution {
   }
 
  private:
-  int maxDepth(const vector<vector<int>>& tree, int u, int prev, int& ans) {
+  int maxDepth(const vector<vector<int>>& tree, int u, int parent, int& ans) {
     int maxDepth1 = 0;   // the maximum depth
     int maxDepth2 = -1;  // the second maximum depth
 
     for (const int v : tree[u]) {
-      if (v == prev)
+      if (v == parent)
         continue;
       const int depth = maxDepth(tree, v, u, ans);
       if (depth > maxDepth1) {
diff --git a/solutions/1245. Tree Diameter/1245.java b/solutions/1245. Tree Diameter/1245.java
index 45657e541ba..06e9e2a41f6 100644
--- a/solutions/1245. Tree Diameter/1245.java	
+++ b/solutions/1245. Tree Diameter/1245.java	
@@ -19,12 +19,12 @@ public int treeDiameter(int[][] edges) {
 
   private int ans = 0;
 
-  private int maxDepth(List<Integer>[] tree, int u, int prev) {
+  private int maxDepth(List<Integer>[] tree, int u, int parent) {
     int maxDepth1 = 0;  // the maximum depth
     int maxDepth2 = -1; // the second maximum depth
 
     for (final int v : tree[u]) {
-      if (v == prev)
+      if (v == parent)
         continue;
       final int depth = maxDepth(tree, v, u);
       if (depth > maxDepth1) {
diff --git a/solutions/1246. Palindrome Removal/1246.py b/solutions/1246. Palindrome Removal/1246.py
index 21efef9e10c..e64fa6c58cf 100644
--- a/solutions/1246. Palindrome Removal/1246.py	
+++ b/solutions/1246. Palindrome Removal/1246.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumMoves(self, arr: list[int]) -> int:
+  def minimumMoves(self, arr: List[int]) -> int:
     n = len(arr)
     # dp[i][j] := the minimum number of moves to remove all numbers from arr[i..j]
     dp = [[n] * n for _ in range(n)]
diff --git a/solutions/1248. Count Number of Nice Subarrays/1248.py b/solutions/1248. Count Number of Nice Subarrays/1248.py
index 484b0fc7012..8a55d6ecc8c 100644
--- a/solutions/1248. Count Number of Nice Subarrays/1248.py	
+++ b/solutions/1248. Count Number of Nice Subarrays/1248.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfSubarrays(self, nums: list[int], k: int) -> int:
+  def numberOfSubarrays(self, nums: List[int], k: int) -> int:
     def numberOfSubarraysAtMost(k: int) -> int:
       ans = 0
       l = 0
diff --git a/solutions/1252. Cells with Odd Values in a Matrix/1252-2.py b/solutions/1252. Cells with Odd Values in a Matrix/1252-2.py
index 55c734ecbe9..a066e0303ce 100644
--- a/solutions/1252. Cells with Odd Values in a Matrix/1252-2.py	
+++ b/solutions/1252. Cells with Odd Values in a Matrix/1252-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def oddCells(self, m: int, n: int, indices: list[list[int]]) -> int:
+  def oddCells(self, m: int, n: int, indices: List[List[int]]) -> int:
     # rows[i] and cols[i] :=
     #   1. True (flipped even times)
     #   2. False (flipped odd times)
diff --git a/solutions/1252. Cells with Odd Values in a Matrix/1252.py b/solutions/1252. Cells with Odd Values in a Matrix/1252.py
index dd7df2bc257..37440f444ca 100644
--- a/solutions/1252. Cells with Odd Values in a Matrix/1252.py	
+++ b/solutions/1252. Cells with Odd Values in a Matrix/1252.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def oddCells(self, m: int, n: int, indices: list[list[int]]) -> int:
+  def oddCells(self, m: int, n: int, indices: List[List[int]]) -> int:
     # rows[i] and cols[i] :=
     #   true (flipped even times) / false (flipped odd times)
     rows = [False] * m
diff --git a/solutions/1253. Reconstruct a 2-Row Binary Matrix/1253.py b/solutions/1253. Reconstruct a 2-Row Binary Matrix/1253.py
index b85bb5caa3b..5bbaa8d1f75 100644
--- a/solutions/1253. Reconstruct a 2-Row Binary Matrix/1253.py	
+++ b/solutions/1253. Reconstruct a 2-Row Binary Matrix/1253.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def reconstructMatrix(self, upper: int, lower: int, colsum: list[int]) -> list[list[int]]:
+  def reconstructMatrix(self, upper: int, lower: int, colsum: List[int]) -> List[List[int]]:
     if upper + lower != sum(colsum):
       return []
     if min(upper, lower) < colsum.count(2):
diff --git a/solutions/1254. Number of Closed Islands/1254.cpp b/solutions/1254. Number of Closed Islands/1254.cpp
index c675ab5b987..a3fafd8c768 100644
--- a/solutions/1254. Number of Closed Islands/1254.cpp	
+++ b/solutions/1254. Number of Closed Islands/1254.cpp	
@@ -30,6 +30,7 @@ class Solution {
       return;
     if (grid[i][j] == 1)
       return;
+
     grid[i][j] = 1;
     dfs(grid, i + 1, j);
     dfs(grid, i - 1, j);
diff --git a/solutions/1254. Number of Closed Islands/1254.java b/solutions/1254. Number of Closed Islands/1254.java
index 57918c39c46..bed40db3f93 100644
--- a/solutions/1254. Number of Closed Islands/1254.java	
+++ b/solutions/1254. Number of Closed Islands/1254.java	
@@ -28,6 +28,7 @@ private void dfs(int[][] grid, int i, int j) {
       return;
     if (grid[i][j] == 1)
       return;
+
     grid[i][j] = 1;
     dfs(grid, i + 1, j);
     dfs(grid, i - 1, j);
diff --git a/solutions/1254. Number of Closed Islands/1254.py b/solutions/1254. Number of Closed Islands/1254.py
index 2d07dc850ff..3171c4a1fe6 100644
--- a/solutions/1254. Number of Closed Islands/1254.py	
+++ b/solutions/1254. Number of Closed Islands/1254.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def closedIsland(self, grid: list[list[int]]) -> int:
+  def closedIsland(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
 
@@ -8,6 +8,7 @@ def dfs(i: int, j: int) -> None:
         return
       if grid[i][j] == 1:
         return
+
       grid[i][j] = 1
       dfs(i + 1, j)
       dfs(i - 1, j)
diff --git a/solutions/1255. Maximum Score Words Formed by Letters/1255.py b/solutions/1255. Maximum Score Words Formed by Letters/1255.py
index b6d0d4f6d42..c03cc8722c0 100644
--- a/solutions/1255. Maximum Score Words Formed by Letters/1255.py	
+++ b/solutions/1255. Maximum Score Words Formed by Letters/1255.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def maxScoreWords(
-      self,
-      words: list[str],
-      letters: list[str],
-      score: list[int],
-  ) -> int:
+  def maxScoreWords(self, words: List[str], letters: List[chr], score: List[int]) -> int:
     count = collections.Counter(letters)
 
     def useWord(i: int) -> int:
diff --git a/solutions/1258. Synonymous Sentences/1258.java b/solutions/1258. Synonymous Sentences/1258.java
index e0a423978ba..14157222990 100644
--- a/solutions/1258. Synonymous Sentences/1258.java	
+++ b/solutions/1258. Synonymous Sentences/1258.java	
@@ -2,7 +2,7 @@ class Solution {
   public List<String> generateSentences(List<List<String>> synonyms, String text) {
     Set<String> ans = new TreeSet<>();
     Map<String, List<String>> graph = new HashMap<>();
-    Queue<String> q = new ArrayDeque<>(List.of(text));
+    Queue<String> q = new ArrayDeque<>(Arrays.asList(text));
 
     for (List<String> synonym : synonyms) {
       final String s = synonym.get(0);
diff --git a/solutions/1258. Synonymous Sentences/1258.py b/solutions/1258. Synonymous Sentences/1258.py
index 79b6c2deba1..3c6ce56895f 100644
--- a/solutions/1258. Synonymous Sentences/1258.py	
+++ b/solutions/1258. Synonymous Sentences/1258.py	
@@ -2,11 +2,7 @@
 
 
 class Solution:
-  def generateSentences(
-      self,
-      synonyms: list[list[str]],
-      text: str,
-  ) -> list[str]:
+  def generateSentences(self, synonyms: List[List[str]], text: str) -> List[str]:
     ans = SortedSet()
     graph = collections.defaultdict(list)
     q = collections.deque([text])
diff --git a/solutions/1259. Handshakes That Don't Cross/1259.java b/solutions/1259. Handshakes That Don't Cross/1259.java
index 24a140ccb9d..3ef1b833aea 100644
--- a/solutions/1259. Handshakes That Don't Cross/1259.java	
+++ b/solutions/1259. Handshakes That Don't Cross/1259.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numberOfWays(int numPeople) {
-    final long MOD = 1_000_000_007;
+    final long kMod = 1_000_000_007;
     // dp[i] := the number of ways i handshakes could occure s.t. none of the
     // handshakes cross
     long[] dp = new long[numPeople / 2 + 1];
@@ -9,7 +9,7 @@ public int numberOfWays(int numPeople) {
     for (int i = 1; i <= numPeople / 2; ++i)
       for (int j = 0; j < i; ++j) {
         dp[i] += dp[j] * dp[i - 1 - j];
-        dp[i] %= MOD;
+        dp[i] %= kMod;
       }
 
     return (int) dp[numPeople / 2];
diff --git a/solutions/1259. Handshakes That Don't Cross/1259.py b/solutions/1259. Handshakes That Don't Cross/1259.py
index e6252a02ccc..a899c23cb18 100644
--- a/solutions/1259. Handshakes That Don't Cross/1259.py	
+++ b/solutions/1259. Handshakes That Don't Cross/1259.py	
@@ -1,6 +1,6 @@
 class Solution:
   def numberOfWays(self, numPeople: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # dp[i] := the number of ways i handshakes could occure s.t. none of the
     # handshakes cross
     dp = [1] + [0] * (numPeople // 2)
@@ -8,6 +8,6 @@ def numberOfWays(self, numPeople: int) -> int:
     for i in range(1, numPeople // 2 + 1):
       for j in range(i):
         dp[i] += dp[j] * dp[i - 1 - j]
-        dp[i] %= MOD
+        dp[i] %= kMod
 
     return dp[numPeople // 2]
diff --git a/solutions/126. Word Ladder II/126-2.cpp b/solutions/126. Word Ladder II/126-2.cpp
index a7e0c5585d4..cc4283e2feb 100644
--- a/solutions/126. Word Ladder II/126-2.cpp	
+++ b/solutions/126. Word Ladder II/126-2.cpp	
@@ -60,7 +60,7 @@ class Solution {
       }
       if (reachEndWord)
         return true;
-      forwardWords = std::move(nextLevelWords);
+      forwardWords = move(nextLevelWords);
     }
 
     return true;
@@ -99,7 +99,7 @@ class Solution {
 
     for (const string& child : graph.at(word)) {
       path.push_back(child);
-      dfs(graph, child, endWord, std::move(path), ans);
+      dfs(graph, child, endWord, move(path), ans);
       path.pop_back();
     }
   }
diff --git a/solutions/126. Word Ladder II/126-4.cpp b/solutions/126. Word Ladder II/126-4.cpp
index fc09f47d57b..62755e15b0e 100644
--- a/solutions/126. Word Ladder II/126-4.cpp	
+++ b/solutions/126. Word Ladder II/126-4.cpp	
@@ -83,7 +83,7 @@ class Solution {
     if (const auto it = childToParents.find(word); it != childToParents.cend())
       for (const string& parent : it->second) {
         path.push_back(parent);
-        dfs(childToParents, parent, beginWord, std::move(path), ans);
+        dfs(childToParents, parent, beginWord, move(path), ans);
         path.pop_back();
       }
   }
diff --git a/solutions/126. Word Ladder II/126-5.cpp b/solutions/126. Word Ladder II/126-5.cpp
index f087767ae4e..31de9df4aa3 100644
--- a/solutions/126. Word Ladder II/126-5.cpp	
+++ b/solutions/126. Word Ladder II/126-5.cpp	
@@ -55,7 +55,7 @@ class Solution {
       if (const auto it = distFromBeginWord.find(child);
           it != distFromBeginWord.cend() && it->second == currDist - 1) {
         path.push_back(child);
-        dfs(child, beginWord, distFromBeginWord, wordSet, std::move(path), ans);
+        dfs(child, beginWord, distFromBeginWord, wordSet, move(path), ans);
         path.pop_back();
       }
     }
diff --git a/solutions/126. Word Ladder II/126.cpp b/solutions/126. Word Ladder II/126.cpp
index 1d97c04bf05..0c2a223b452 100644
--- a/solutions/126. Word Ladder II/126.cpp	
+++ b/solutions/126. Word Ladder II/126.cpp	
@@ -43,7 +43,7 @@ class Solution {
       }
       if (reachEndWord)
         return true;
-      currentLevelWords = std::move(nextLevelWords);
+      currentLevelWords = move(nextLevelWords);
     }
 
     return false;
@@ -78,7 +78,7 @@ class Solution {
 
     for (const string& child : graph.at(word)) {
       path.push_back(child);
-      dfs(graph, child, endWord, std::move(path), ans);
+      dfs(graph, child, endWord, move(path), ans);
       path.pop_back();
     }
   }
diff --git a/solutions/126. Word Ladder II/126.java b/solutions/126. Word Ladder II/126.java
index 5a7175a5421..82f7f2ee157 100644
--- a/solutions/126. Word Ladder II/126.java	
+++ b/solutions/126. Word Ladder II/126.java	
@@ -12,7 +12,7 @@ public List<List<String>> findLadders(String beginWord, String endWord, List<Str
       return new ArrayList<>();
 
     List<List<String>> ans = new ArrayList<>();
-    List<String> path = new ArrayList<>(List.of(beginWord));
+    List<String> path = new ArrayList<>(Arrays.asList(beginWord));
     dfs(graph, beginWord, endWord, path, ans);
     return ans;
   }
diff --git a/solutions/126. Word Ladder II/126.py b/solutions/126. Word Ladder II/126.py
index 9433b102b25..974015dc807 100644
--- a/solutions/126. Word Ladder II/126.py	
+++ b/solutions/126. Word Ladder II/126.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def findLadders(self, beginWord: str, endWord: str, wordList: list[str]) -> list[list[str]]:
+  def findLadders(self, beginWord: str, endWord: str, wordList: List[str]) -> List[List[str]]:
     wordSet = set(wordList)
     if endWord not in wordList:
       return []
 
     # {"hit": ["hot"], "hot": ["dot", "lot"], ...}
-    graph: dict[str, list[str]] = collections.defaultdict(list)
+    graph: Dict[str, List[str]] = collections.defaultdict(list)
 
     # Build the graph from the beginWord to the endWord.
     if not self._bfs(beginWord, endWord, wordSet, graph):
@@ -15,13 +15,7 @@ def findLadders(self, beginWord: str, endWord: str, wordList: list[str]) -> list
     self._dfs(graph, beginWord, endWord, [beginWord], ans)
     return ans
 
-  def _bfs(
-      self,
-      beginWord: str,
-      endWord: str,
-      wordSet: set[str],
-      graph: dict[str, list[str]],
-  ) -> bool:
+  def _bfs(self, beginWord: str, endWord: str, wordSet: Set[str], graph: Dict[str, List[str]]) -> bool:
     currentLevelWords = {beginWord}
 
     while currentLevelWords:
@@ -42,7 +36,7 @@ def _bfs(
 
     return False
 
-  def _getChildren(self, parent: str, wordSet: set[str]) -> list[str]:
+  def _getChildren(self, parent: str, wordSet: Set[str]) -> List[str]:
     children = []
     s = list(parent)
 
@@ -58,14 +52,7 @@ def _getChildren(self, parent: str, wordSet: set[str]) -> list[str]:
 
     return children
 
-  def _dfs(
-      self,
-      graph: dict[str, list[str]],
-      word: str,
-      endWord: str,
-      path: list[str],
-      ans: list[list[str]],
-  ) -> None:
+  def _dfs(self, graph: Dict[str, List[str]], word: str, endWord: str, path: List[str], ans: List[List[str]]) -> None:
     if word == endWord:
       ans.append(path.copy())
       return
diff --git a/solutions/126. Word Ladder II/127-2.py b/solutions/126. Word Ladder II/127-2.py
index 1bf73fc07a3..744c531a5c8 100644
--- a/solutions/126. Word Ladder II/127-2.py	
+++ b/solutions/126. Word Ladder II/127-2.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def findLadders(self, beginWord: str, endWord: str, wordList: list[str]) -> list[list[str]]:
+  def findLadders(self, beginWord: str, endWord: str, wordList: List[str]) -> List[List[str]]:
     wordSet = set(wordList)
     if endWord not in wordList:
       return []
 
     # {"hit": ["hot"], "hot": ["dot", "lot"], ...}
-    graph: dict[str, list[str]] = collections.defaultdict(list)
+    graph: Dict[str, List[str]] = collections.defaultdict(list)
 
     # Build the graph from the beginWord to the endWord.
     if not self._bfs(beginWord, endWord, wordSet, graph):
@@ -16,13 +16,7 @@ def findLadders(self, beginWord: str, endWord: str, wordList: list[str]) -> list
     self._dfs(graph, beginWord, endWord, [beginWord], ans)
     return ans
 
-  def _bfs(
-      self,
-      beginWord: str,
-      endWord: str,
-      wordSet: set[str],
-      graph: dict[str, list[str]],
-  ) -> bool:
+  def _bfs(self, beginWord: str, endWord: str, wordSet: Set[str], graph: Dict[str, List[str]]) -> bool:
     q1 = {beginWord}
     q2 = {endWord}
     backward = False
@@ -54,7 +48,7 @@ def _bfs(
 
     return False
 
-  def _getChildren(self, parent: str, wordSet: set[str], q2) -> list[str]:
+  def _getChildren(self, parent: str, wordSet: Set[str], q2) -> List[str]:
     children = []
     s = list(parent)
 
@@ -70,14 +64,7 @@ def _getChildren(self, parent: str, wordSet: set[str], q2) -> list[str]:
 
     return children
 
-  def _dfs(
-      self,
-      graph: dict[str, list[str]],
-      word: str,
-      endWord: str,
-      path: list[str],
-      ans: list[list[str]],
-  ) -> None:
+  def _dfs(self, graph: Dict[str, List[str]], word: str, endWord: str, path: List[str], ans: List[List[str]]) -> None:
     if word == endWord:
       ans.append(path.copy())
       return
diff --git a/solutions/1260. Shift 2D Grid/1260.py b/solutions/1260. Shift 2D Grid/1260.py
index 477cfa9c979..e9732e8ac1d 100644
--- a/solutions/1260. Shift 2D Grid/1260.py	
+++ b/solutions/1260. Shift 2D Grid/1260.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def shiftGrid(self, grid: list[list[int]], k: int) -> list[list[int]]:
+  def shiftGrid(self, grid: List[List[int]], k: int) -> List[List[int]]:
     m = len(grid)
     n = len(grid[0])
     ans = [[0] * n for _ in range(m)]
diff --git a/solutions/1261. Find Elements in a Contaminated Binary Tree/1261.py b/solutions/1261. Find Elements in a Contaminated Binary Tree/1261.py
index 78b91604ca4..f46d4918f98 100644
--- a/solutions/1261. Find Elements in a Contaminated Binary Tree/1261.py	
+++ b/solutions/1261. Find Elements in a Contaminated Binary Tree/1261.py	
@@ -1,12 +1,12 @@
 class FindElements:
-  def __init__(self, root: TreeNode | None):
+  def __init__(self, root: Optional[TreeNode]):
     self.vals = set()
     self.dfs(root, 0)
 
   def find(self, target: int) -> bool:
     return target in self.vals
 
-  def dfs(self, root: TreeNode | None, val: int) -> None:
+  def dfs(self, root: Optional[TreeNode], val: int) -> None:
     if not root:
       return
 
diff --git a/solutions/1263. Minimum Moves to Move a Box to Their Target Location/1263.cpp b/solutions/1263. Minimum Moves to Move a Box to Their Target Location/1263.cpp
index b5ad0a3b523..bf7ac10b006 100644
--- a/solutions/1263. Minimum Moves to Move a Box to Their Target Location/1263.cpp	
+++ b/solutions/1263. Minimum Moves to Move a Box to Their Target Location/1263.cpp	
@@ -16,6 +16,7 @@ class Solution {
         else if (grid[i][j] == 'T')
           target = {i, j};
 
+    int ans = 0;
     // (boxX, boxY, playerX, playerY)
     queue<tuple<int, int, int, int>> q{
         {{box[0], box[1], player[0], player[1]}}};
@@ -24,21 +25,21 @@ class Solution {
                n, vector<vector<bool>>(m, vector<bool>(n))));
     seen[box[0]][box[1]][player[0]][player[1]] = true;
 
-    for (int step = 0; !q.empty(); ++step)
+    while (!q.empty()) {
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [boxX, boxY, playerX, playerY] = q.front();
         q.pop();
         if (boxX == target[0] && boxY == target[1])
-          return step;
-        for (int k = 0; k < 4; ++k) {
-          const int nextBoxX = boxX + kDirs[k % 4][0];
-          const int nextBoxY = boxY + kDirs[k % 4][1];
+          return ans;
+        for (const auto& [dx, dy] : dirs) {
+          const int nextBoxX = boxX + dx;
+          const int nextBoxY = boxY + dy;
           if (isInvalid(grid, nextBoxX, nextBoxY))
             continue;
           if (seen[nextBoxX][nextBoxY][boxX][boxY])
             continue;
-          const int fromX = boxX + kDirs[(k + 2) % 4][0];
-          const int fromY = boxY + kDirs[(k + 2) % 4][1];
+          const int fromX = boxX + dirs[(k + 2) % 4];
+          const int fromY = boxY + dirs[(k + 3) % 4];
           if (isInvalid(grid, fromX, fromY))
             continue;
           if (canGoTo(grid, playerX, playerY, fromX, fromY, boxX, boxY)) {
@@ -47,12 +48,14 @@ class Solution {
           }
         }
       }
+      ++ans;
+    }
 
     return -1;
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   // Returns true if (playerX, playerY) can go to (fromX, fromY).
   bool canGoTo(const vector<vector<char>>& grid, int playerX, int playerY,
@@ -66,7 +69,7 @@ class Solution {
       q.pop();
       if (i == fromX && j == fromY)
         return true;
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (isInvalid(grid, x, y))
diff --git a/solutions/1263. Minimum Moves to Move a Box to Their Target Location/1263.java b/solutions/1263. Minimum Moves to Move a Box to Their Target Location/1263.java
index 59064de428c..2f8454685a7 100644
--- a/solutions/1263. Minimum Moves to Move a Box to Their Target Location/1263.java	
+++ b/solutions/1263. Minimum Moves to Move a Box to Their Target Location/1263.java	
@@ -1,6 +1,5 @@
 class Solution {
   public int minPushBox(char[][] grid) {
-    record T(int boxX, int boxY, int playerX, int playerY) {}
     final int m = grid.length;
     final int n = grid[0].length;
     int[] box = {-1, -1};
@@ -16,45 +15,50 @@ else if (grid[i][j] == 'S')
         else if (grid[i][j] == 'T')
           target = new int[] {i, j};
 
-    Queue<T> q = new ArrayDeque<>(List.of(new T(box[0], box[1], player[0], player[1])));
+    int ans = 0;
+    // (boxX, boxY, playerX, playerY)
+    Queue<int[]> q =
+        new ArrayDeque<>(Arrays.asList(new int[] {box[0], box[1], player[0], player[1]}));
     boolean[][][][] seen = new boolean[m][n][m][n];
     seen[box[0]][box[1]][player[0]][player[1]] = true;
 
-    for (int step = 0; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
       for (int sz = q.size(); sz > 0; --sz) {
-        final int boxX = q.peek().boxX;
-        final int boxY = q.peek().boxY;
-        final int playerX = q.peek().playerX;
-        final int playerY = q.poll().playerY;
+        final int boxX = q.peek()[0];
+        final int boxY = q.peek()[1];
+        final int playerX = q.peek()[2];
+        final int playerY = q.poll()[3];
         if (boxX == target[0] && boxY == target[1])
-          return step;
-        for (int k = 0; k < 4; ++k) {
-          final int nextBoxX = boxX + DIRS[k][0];
-          final int nextBoxY = boxY + DIRS[k][1];
+          return ans;
+        for (int[] dir : dirs) {
+          final int nextBoxX = boxX + dir[0];
+          final int nextBoxY = boxY + dir[1];
           if (isInvalid(grid, nextBoxX, nextBoxY))
             continue;
           if (seen[nextBoxX][nextBoxY][boxX][boxY])
             continue;
-          final int fromX = boxX + DIRS[(k + 2) % 4][0];
-          final int fromY = boxY + DIRS[(k + 2) % 4][1];
+          final int fromX = boxX + dirs[(k + 2) % 4];
+          final int fromY = boxY + dirs[(k + 3) % 4];
           if (isInvalid(grid, fromX, fromY))
             continue;
           if (canGoTo(grid, playerX, playerY, fromX, fromY, boxX, boxY)) {
             seen[nextBoxX][nextBoxY][boxX][boxY] = true;
-            q.offer(new T(nextBoxX, nextBoxY, boxX, boxY));
+            q.offer(new int[] {nextBoxX, nextBoxY, boxX, boxY});
           }
         }
       }
+      ++ans;
+    }
 
     return -1;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   // Returns true if (playerX, playerY) can go to (fromX, fromY).
   private boolean canGoTo(char[][] grid, int playerX, int playerY, int fromX, int fromY, int boxX,
                           int boxY) {
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(playerX, playerY)));
+    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(Arrays.asList(new Pair<>(playerX, playerY)));
     boolean[][] seen = new boolean[grid.length][grid[0].length];
     seen[playerX][playerY] = true;
 
@@ -63,7 +67,7 @@ private boolean canGoTo(char[][] grid, int playerX, int playerY, int fromX, int
       final int j = q.poll().getValue();
       if (i == fromX && j == fromY)
         return true;
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (isInvalid(grid, x, y))
diff --git a/solutions/1263. Minimum Moves to Move a Box to Their Target Location/1263.py b/solutions/1263. Minimum Moves to Move a Box to Their Target Location/1263.py
index f955488229d..b9fadd9c0b8 100644
--- a/solutions/1263. Minimum Moves to Move a Box to Their Target Location/1263.py	
+++ b/solutions/1263. Minimum Moves to Move a Box to Their Target Location/1263.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def minPushBox(self, grid: list[list[str]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def minPushBox(self, grid: List[List[chr]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
 
@@ -14,17 +14,10 @@ def minPushBox(self, grid: list[list[str]]) -> int:
           target = (i, j)
 
     def isInvalid(playerX: int, playerY: int) -> bool:
-      return (playerX < 0 or playerX == m or playerY < 0 or playerY == n or
-              grid[playerX][playerY] == '#')
+      return playerX < 0 or playerX == m or playerY < 0 or playerY == n \
+          or grid[playerX][playerY] == '#'
 
-    def canGoTo(
-        playerX: int,
-        playerY: int,
-        fromX: int,
-        fromY: int,
-        boxX: int,
-        boxY: int
-    ) -> bool:
+    def canGoTo(playerX: int, playerY: int, fromX: int, fromY: int, boxX: int, boxY: int) -> bool:
       """Returns True if (playerX, playerY) can go to (fromX, fromY)."""
       q = collections.deque([(playerX, playerY)])
       seen = {(playerX, playerY)}
@@ -33,7 +26,7 @@ def canGoTo(
         i, j = q.popleft()
         if i == fromX and j == fromY:
           return True
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           x = i + dx
           y = j + dy
           if isInvalid(x, y):
@@ -47,30 +40,30 @@ def canGoTo(
 
       return False
 
+    ans = 0
     # (boxX, boxY, playerX, playerY)
     q = collections.deque([(box[0], box[1], player[0], player[1])])
     seen = {(box[0], box[1], player[0], player[1])}
 
-    step = 0
     while q:
       for _ in range(len(q)):
         boxX, boxY, playerX, playerY = q.popleft()
         if boxX == target[0] and boxY == target[1]:
-          return step
-        for k, (dx, dy) in enumerate(DIRS):
+          return ans
+        for dx, dy in dirs:
           nextBoxX = boxX + dx
           nextBoxY = boxY + dy
           if isInvalid(nextBoxX, nextBoxY):
             continue
           if (nextBoxX, nextBoxY, boxX, boxY) in seen:
             continue
-          fromX = boxX + DIRS[(k + 2) % 4][0]
-          fromY = boxY + DIRS[(k + 2) % 4][1]
+          fromX = boxX + dirs[(k + 2) % 4]
+          fromY = boxY + dirs[(k + 3) % 4]
           if isInvalid(fromX, fromY):
             continue
           if canGoTo(playerX, playerY, fromX, fromY, boxX, boxY):
             q.append((nextBoxX, nextBoxY, boxX, boxY))
             seen.add((nextBoxX, nextBoxY, boxX, boxY))
-      step += 1
+      ans += 1
 
     return -1
diff --git a/solutions/1265. Print Immutable Linked List in Reverse/1265-2.cpp b/solutions/1265. Print Immutable Linked List in Reverse/1265-2.cpp
index e6a992928fa..90506d3d218 100644
--- a/solutions/1265. Print Immutable Linked List in Reverse/1265-2.cpp	
+++ b/solutions/1265. Print Immutable Linked List in Reverse/1265-2.cpp	
@@ -13,7 +13,7 @@ class Solution {
   void printLinkedListInReverse(ImmutableListNode* head) {
     stack<ImmutableListNode*> stack;
 
-    while (head != nullptr) {
+    while (head) {
       stack.push(head);
       head = head->getNext();
     }
diff --git a/solutions/1266. Minimum Time Visiting All Points/1266.py b/solutions/1266. Minimum Time Visiting All Points/1266.py
index 14a8a4fb133..3f726dbbbf6 100644
--- a/solutions/1266. Minimum Time Visiting All Points/1266.py	
+++ b/solutions/1266. Minimum Time Visiting All Points/1266.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minTimeToVisitAllPoints(self, points: list[list[int]]) -> int:
+  def minTimeToVisitAllPoints(self, points: List[List[int]]) -> int:
     ans = 0
 
     for i in range(1, len(points)):
diff --git a/solutions/1267. Count Servers that Communicate/1267.py b/solutions/1267. Count Servers that Communicate/1267.py
index d377aa70fc4..55451c95443 100644
--- a/solutions/1267. Count Servers that Communicate/1267.py	
+++ b/solutions/1267. Count Servers that Communicate/1267.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countServers(self, grid: list[list[int]]) -> int:
+  def countServers(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
     ans = 0
diff --git a/solutions/1268. Search Suggestions System/1268.py b/solutions/1268. Search Suggestions System/1268.py
index 9cdedc29591..fd6bac6cd4e 100644
--- a/solutions/1268. Search Suggestions System/1268.py	
+++ b/solutions/1268. Search Suggestions System/1268.py	
@@ -1,15 +1,11 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
-    self.word: str | None = None
+    self.children: Dict[str, TrieNode] = {}
+    self.word: Optional[str] = None
 
 
 class Solution:
-  def suggestedProducts(
-      self,
-      products: list[str],
-      searchWord: str
-  ) -> list[list[str]]:
+  def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[str]]:
     ans = []
     root = TrieNode()
 
@@ -19,12 +15,12 @@ def insert(word: str) -> None:
         node = node.children.setdefault(c, TrieNode())
       node.word = word
 
-    def search(node: TrieNode | None) -> list[str]:
-      res: list[str] = []
+    def search(node: Optional[TrieNode]) -> List[str]:
+      res: List[str] = []
       dfs(node, res)
       return res
 
-    def dfs(node: TrieNode | None, res: list[str]) -> None:
+    def dfs(node: Optional[TrieNode], res: List[str]) -> None:
       if len(res) == 3:
         return
       if not node:
diff --git a/solutions/1269. Number of Ways to Stay in the Same Place After Some Steps/1269.cpp b/solutions/1269. Number of Ways to Stay in the Same Place After Some Steps/1269.cpp
index f61f9136c0c..c6bf0cb4b0b 100644
--- a/solutions/1269. Number of Ways to Stay in the Same Place After Some Steps/1269.cpp	
+++ b/solutions/1269. Number of Ways to Stay in the Same Place After Some Steps/1269.cpp	
@@ -7,7 +7,7 @@ class Solution {
     vector<long> dp(n);
     dp[0] = 1;
 
-    while (steps-- > 0) {
+    while (steps--) {
       vector<long> newDp(n);
       for (int i = 0; i < n; ++i) {
         newDp[i] = dp[i];
@@ -17,7 +17,7 @@ class Solution {
           newDp[i] += dp[i + 1];
         newDp[i] %= kMod;
       }
-      dp = std::move(newDp);
+      dp = move(newDp);
     }
 
     return dp[0];
diff --git a/solutions/1269. Number of Ways to Stay in the Same Place After Some Steps/1269.java b/solutions/1269. Number of Ways to Stay in the Same Place After Some Steps/1269.java
index f7ed272a31b..e893d055dd8 100644
--- a/solutions/1269. Number of Ways to Stay in the Same Place After Some Steps/1269.java	
+++ b/solutions/1269. Number of Ways to Stay in the Same Place After Some Steps/1269.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numWays(int steps, int arrLen) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = Math.min(arrLen, steps / 2 + 1);
     // dp[i] := the number of ways to stay at index i
     long[] dp = new long[n];
@@ -14,7 +14,7 @@ public int numWays(int steps, int arrLen) {
           newDp[i] += dp[i - 1];
         if (i + 1 < n)
           newDp[i] += dp[i + 1];
-        newDp[i] %= MOD;
+        newDp[i] %= kMod;
       }
       dp = newDp;
     }
diff --git a/solutions/1269. Number of Ways to Stay in the Same Place After Some Steps/1269.py b/solutions/1269. Number of Ways to Stay in the Same Place After Some Steps/1269.py
index 30f163488d6..47841c65545 100644
--- a/solutions/1269. Number of Ways to Stay in the Same Place After Some Steps/1269.py	
+++ b/solutions/1269. Number of Ways to Stay in the Same Place After Some Steps/1269.py	
@@ -1,6 +1,6 @@
 class Solution:
   def numWays(self, steps: int, arrLen: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # dp[i] := the number of ways to stay at index i
     dp = [0] * min(steps // 2 + 1, arrLen)
     dp[0] = 1
@@ -13,7 +13,7 @@ def numWays(self, steps: int, arrLen: int) -> int:
             nextIndex = i + dx
             if 0 <= nextIndex < len(dp):
               newDp[nextIndex] += ways
-              newDp[nextIndex] %= MOD
+              newDp[nextIndex] %= kMod
       dp = newDp
 
     return dp[0]
diff --git a/solutions/127. Word Ladder/127.cpp b/solutions/127. Word Ladder/127.cpp
index f9211c0f514..2d398428451 100644
--- a/solutions/127. Word Ladder/127.cpp	
+++ b/solutions/127. Word Ladder/127.cpp	
@@ -5,9 +5,11 @@ class Solution {
     if (!wordSet.contains(endWord))
       return 0;
 
+    int ans = 0;
     queue<string> q{{beginWord}};
 
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         string word = q.front();
         q.pop();
@@ -16,7 +18,7 @@ class Solution {
           for (char c = 'a'; c <= 'z'; ++c) {
             word[i] = c;
             if (word == endWord)
-              return step + 1;
+              return ans + 1;
             if (wordSet.contains(word)) {
               q.push(word);
               wordSet.erase(word);
@@ -25,6 +27,7 @@ class Solution {
           word[i] = cache;
         }
       }
+    }
 
     return 0;
   }
diff --git a/solutions/127. Word Ladder/127.java b/solutions/127. Word Ladder/127.java
index 98a02cb5b1f..f25d9ee4672 100644
--- a/solutions/127. Word Ladder/127.java	
+++ b/solutions/127. Word Ladder/127.java	
@@ -4,9 +4,11 @@ public int ladderLength(String beginWord, String endWord, List<String> wordList)
     if (!wordSet.contains(endWord))
       return 0;
 
-    Queue<String> q = new ArrayDeque<>(List.of(beginWord));
+    int ans = 0;
+    Queue<String> q = new ArrayDeque<>(Arrays.asList(beginWord));
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         StringBuilder sb = new StringBuilder(q.poll());
         for (int i = 0; i < sb.length(); ++i) {
@@ -15,7 +17,7 @@ public int ladderLength(String beginWord, String endWord, List<String> wordList)
             sb.setCharAt(i, c);
             final String word = sb.toString();
             if (word.equals(endWord))
-              return step + 1;
+              return ans + 1;
             if (wordSet.contains(word)) {
               q.offer(word);
               wordSet.remove(word);
@@ -24,6 +26,7 @@ public int ladderLength(String beginWord, String endWord, List<String> wordList)
           sb.setCharAt(i, cache);
         }
       }
+    }
 
     return 0;
   }
diff --git a/solutions/127. Word Ladder/127.py b/solutions/127. Word Ladder/127.py
index 1465a7e8500..5bf245bd061 100644
--- a/solutions/127. Word Ladder/127.py	
+++ b/solutions/127. Word Ladder/127.py	
@@ -1,18 +1,14 @@
 class Solution:
-  def ladderLength(
-      self,
-      beginWord: str,
-      endWord: str,
-      wordList: list[str],
-  ) -> int:
+  def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:
     wordSet = set(wordList)
     if endWord not in wordSet:
       return 0
 
+    ans = 0
     q = collections.deque([beginWord])
 
-    step = 1
     while q:
+      ans += 1
       for _ in range(len(q)):
         wordList = list(q.popleft())
         for i, cache in enumerate(wordList):
@@ -20,11 +16,10 @@ def ladderLength(
             wordList[i] = c
             word = ''.join(wordList)
             if word == endWord:
-              return step + 1
+              return ans + 1
             if word in wordSet:
               q.append(word)
               wordSet.remove(word)
           wordList[i] = cache
-      step += 1
 
     return 0
diff --git a/solutions/1272. Remove Interval/1272.py b/solutions/1272. Remove Interval/1272.py
index 01dd51cc84d..ccfea1f2d73 100644
--- a/solutions/1272. Remove Interval/1272.py	
+++ b/solutions/1272. Remove Interval/1272.py	
@@ -1,6 +1,5 @@
 class Solution:
-  def removeInterval(self, intervals: list[list[int]],
-                     toBeRemoved: list[int]) -> list[list[int]]:
+  def removeInterval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]:
     ans = []
 
     for a, b in intervals:
diff --git a/solutions/1273. Delete Tree Nodes/1273.java b/solutions/1273. Delete Tree Nodes/1273.java
index 7219d0d3a92..f358071ad93 100644
--- a/solutions/1273. Delete Tree Nodes/1273.java	
+++ b/solutions/1273. Delete Tree Nodes/1273.java	
@@ -1,3 +1,12 @@
+class T {
+  public int sum;
+  public int count;
+  public T(int sum, int count) {
+    this.sum = sum;
+    this.count = count;
+  }
+}
+
 class Solution {
   public int deleteTreeNodes(int nodes, int[] parent, int[] value) {
     List<Integer>[] tree = new List[nodes];
@@ -11,8 +20,6 @@ public int deleteTreeNodes(int nodes, int[] parent, int[] value) {
     return dfs(tree, 0, value).count;
   }
 
-  private record T(int sum, int count) {}
-
   private T dfs(List<Integer>[] tree, int u, int[] value) {
     int sum = value[u]; // the root value
     int count = 1;      // this root
diff --git a/solutions/1274. Number of Ships in a Rectangle/1274.py b/solutions/1274. Number of Ships in a Rectangle/1274.py
index f009943dfda..5e5a2e082ca 100644
--- a/solutions/1274. Number of Ships in a Rectangle/1274.py	
+++ b/solutions/1274. Number of Ships in a Rectangle/1274.py	
@@ -12,12 +12,7 @@
 # self.y = y
 
 class Solution(object):
-  def countShips(
-      self,
-      sea: 'Sea',
-      topRight: 'Point',
-      bottomLeft: 'Point',
-  ) -> int:
+  def countShips(self, sea: 'Sea', topRight: 'Point', bottomLeft: 'Point') -> int:
     if topRight.x < bottomLeft.x or topRight.y < bottomLeft.y:
       return 0
     if not sea.hasShips(topRight, bottomLeft):
diff --git a/solutions/1275. Find Winner on a Tic Tac Toe Game/1275.py b/solutions/1275. Find Winner on a Tic Tac Toe Game/1275.py
index 398278f297a..77fc116d1c9 100644
--- a/solutions/1275. Find Winner on a Tic Tac Toe Game/1275.py	
+++ b/solutions/1275. Find Winner on a Tic Tac Toe Game/1275.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def tictactoe(self, moves: list[list[int]]) -> str:
+  def tictactoe(self, moves: List[List[int]]) -> str:
     row = [[0] * 3 for _ in range(2)]
     col = [[0] * 3 for _ in range(2)]
     diag1 = [0] * 2
diff --git a/solutions/1276. Number of Burgers with No Waste of Ingredients/1276.java b/solutions/1276. Number of Burgers with No Waste of Ingredients/1276.java
index 7a3c217459f..178e6e1d3a6 100644
--- a/solutions/1276. Number of Burgers with No Waste of Ingredients/1276.java	
+++ b/solutions/1276. Number of Burgers with No Waste of Ingredients/1276.java	
@@ -5,6 +5,6 @@ public List<Integer> numOfBurgers(int tomatoSlices, int cheeseSlices) {
 
     int jumboBurgers = (tomatoSlices - 2 * cheeseSlices) / 2;
 
-    return List.of(jumboBurgers, cheeseSlices - jumboBurgers);
+    return new ArrayList<>(Arrays.asList(jumboBurgers, cheeseSlices - jumboBurgers));
   }
 }
diff --git a/solutions/1276. Number of Burgers with No Waste of Ingredients/1276.py b/solutions/1276. Number of Burgers with No Waste of Ingredients/1276.py
index d1b65431fc0..7dd4eebfba5 100644
--- a/solutions/1276. Number of Burgers with No Waste of Ingredients/1276.py	
+++ b/solutions/1276. Number of Burgers with No Waste of Ingredients/1276.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numOfBurgers(self, tomatoSlices: int, cheeseSlices: int) -> list[int]:
+  def numOfBurgers(self, tomatoSlices: int, cheeseSlices: int) -> List[int]:
     if tomatoSlices % 2 == 1 or tomatoSlices < 2 * cheeseSlices or tomatoSlices > cheeseSlices * 4:
       return []
 
diff --git a/solutions/1277. Count Square Submatrices with All Ones/1277.py b/solutions/1277. Count Square Submatrices with All Ones/1277.py
index db9f2b2cfa9..ad3def85c53 100644
--- a/solutions/1277. Count Square Submatrices with All Ones/1277.py	
+++ b/solutions/1277. Count Square Submatrices with All Ones/1277.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countSquares(self, matrix: list[list[int]]) -> int:
+  def countSquares(self, matrix: List[List[int]]) -> int:
     for i in range(len(matrix)):
       for j in range(len(matrix[0])):
         if matrix[i][j] == 1 and i > 0 and j > 0:
diff --git a/solutions/128. Longest Consecutive Sequence/128.cpp b/solutions/128. Longest Consecutive Sequence/128.cpp
index 72548958f3e..685d23e87c9 100644
--- a/solutions/128. Longest Consecutive Sequence/128.cpp	
+++ b/solutions/128. Longest Consecutive Sequence/128.cpp	
@@ -4,7 +4,7 @@ class Solution {
     int ans = 0;
     unordered_set<int> seen{nums.begin(), nums.end()};
 
-    for (int num : seen) {
+    for (int num : nums) {
       // `num` is the start of a sequence.
       if (seen.contains(num - 1))
         continue;
diff --git a/solutions/128. Longest Consecutive Sequence/128.java b/solutions/128. Longest Consecutive Sequence/128.java
index ee95a49026e..adab6407d4c 100644
--- a/solutions/128. Longest Consecutive Sequence/128.java	
+++ b/solutions/128. Longest Consecutive Sequence/128.java	
@@ -3,7 +3,7 @@ public int longestConsecutive(int[] nums) {
     int ans = 0;
     Set<Integer> seen = Arrays.stream(nums).boxed().collect(Collectors.toSet());
 
-    for (int num : seen) {
+    for (int num : nums) {
       // `num` is the start of a sequence.
       if (seen.contains(num - 1))
         continue;
diff --git a/solutions/128. Longest Consecutive Sequence/128.py b/solutions/128. Longest Consecutive Sequence/128.py
index afdf5628f10..80a134a966b 100644
--- a/solutions/128. Longest Consecutive Sequence/128.py	
+++ b/solutions/128. Longest Consecutive Sequence/128.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def longestConsecutive(self, nums: list[int]) -> int:
+  def longestConsecutive(self, nums: List[int]) -> int:
     ans = 0
     seen = set(nums)
 
-    for num in seen:
+    for num in nums:
       # `num` is the start of a sequence.
       if num - 1 in seen:
         continue
diff --git a/solutions/1282. Group the People Given the Group Size They Belong To/1282.py b/solutions/1282. Group the People Given the Group Size They Belong To/1282.py
index 2bdf21fea18..a4e6b24a068 100644
--- a/solutions/1282. Group the People Given the Group Size They Belong To/1282.py	
+++ b/solutions/1282. Group the People Given the Group Size They Belong To/1282.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def groupThePeople(self, groupSizes: list[int]) -> list[list[int]]:
+  def groupThePeople(self, groupSizes: List[int]) -> List[List[int]]:
     ans = []
     groupSizeToIndices = defaultdict(list)
 
diff --git a/solutions/1283. Find the Smallest Divisor Given a Threshold/1283.py b/solutions/1283. Find the Smallest Divisor Given a Threshold/1283.py
index ffd1e80a0fd..5ecb96b25cc 100644
--- a/solutions/1283. Find the Smallest Divisor Given a Threshold/1283.py	
+++ b/solutions/1283. Find the Smallest Divisor Given a Threshold/1283.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def smallestDivisor(self, nums: list[int], threshold: int) -> int:
+  def smallestDivisor(self, nums: List[int], threshold: int) -> int:
     l = 1
     r = max(nums)
 
diff --git a/solutions/1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix/1284.cpp b/solutions/1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix/1284.cpp
index 7bd20da7126..44d781c44b5 100644
--- a/solutions/1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix/1284.cpp	
+++ b/solutions/1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix/1284.cpp	
@@ -7,7 +7,7 @@ class Solution {
     if (hash == 0)
       return 0;
 
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     queue<int> q{{hash}};
     unordered_set<int> seen{hash};
 
@@ -19,7 +19,7 @@ class Solution {
           for (int j = 0; j < n; ++j) {
             int next = curr ^ 1 << (i * n + j);
             // Flie the four neighbors.
-            for (const auto& [dx, dy] : kDirs) {
+            for (const auto& [dx, dy] : dirs) {
               const int x = i + dx;
               const int y = j + dy;
               if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix/1284.java b/solutions/1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix/1284.java
index bc26fb4fe34..fcdd8025835 100644
--- a/solutions/1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix/1284.java	
+++ b/solutions/1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix/1284.java	
@@ -6,8 +6,8 @@ public int minFlips(int[][] mat) {
     if (hash == 0)
       return 0;
 
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-    Queue<Integer> q = new ArrayDeque<>(List.of(hash));
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(hash));
     Set<Integer> seen = new HashSet<>(Arrays.asList(hash));
 
     for (int step = 1; !q.isEmpty(); ++step) {
@@ -17,7 +17,7 @@ public int minFlips(int[][] mat) {
           for (int j = 0; j < n; ++j) {
             int next = curr ^ 1 << (i * n + j);
             // Flie the four neighbors.
-            for (int[] dir : DIRS) {
+            for (int[] dir : dirs) {
               final int x = i + dir[0];
               final int y = j + dir[1];
               if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix/1284.py b/solutions/1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix/1284.py
index 5285614436a..cb87c273227 100644
--- a/solutions/1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix/1284.py	
+++ b/solutions/1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix/1284.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def minFlips(self, mat: list[list[int]]) -> int:
+  def minFlips(self, mat: List[List[int]]) -> int:
     m = len(mat)
     n = len(mat[0])
     hash = self._getHash(mat, m, n)
     if hash == 0:
       return 0
 
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     step = 0
     q = collections.deque([hash])
     seen = {hash}
@@ -19,7 +19,7 @@ def minFlips(self, mat: list[list[int]]) -> int:
           for j in range(n):
             next = curr ^ 1 << (i * n + j)
             # Flie the four neighbors.
-            for dx, dy in DIRS:
+            for dx, dy in dirs:
               x = i + dx
               y = j + dy
               if x < 0 or x == m or y < 0 or y == n:
@@ -34,7 +34,7 @@ def minFlips(self, mat: list[list[int]]) -> int:
 
     return -1
 
-  def _getHash(self, mat: list[list[int]], m: int, n: int) -> int:
+  def _getHash(self, mat: List[List[int]], m: int, n: int) -> int:
     hash = 0
     for i in range(m):
       for j in range(n):
diff --git a/solutions/1287. Element Appearing More Than 25% In Sorted Array/1287.py b/solutions/1287. Element Appearing More Than 25% In Sorted Array/1287.py
index 4f705f85624..aa5426a25a1 100644
--- a/solutions/1287. Element Appearing More Than 25% In Sorted Array/1287.py	
+++ b/solutions/1287. Element Appearing More Than 25% In Sorted Array/1287.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findSpecialInteger(self, arr: list[int]) -> int:
+  def findSpecialInteger(self, arr: List[int]) -> int:
     n = len(arr)
     quarter = n // 4
 
diff --git a/solutions/1288. Remove Covered Intervals/1288.cpp b/solutions/1288. Remove Covered Intervals/1288.cpp
index 5460d26349e..cd415b154a5 100644
--- a/solutions/1288. Remove Covered Intervals/1288.cpp	
+++ b/solutions/1288. Remove Covered Intervals/1288.cpp	
@@ -1,20 +1,20 @@
 class Solution {
  public:
   int removeCoveredIntervals(vector<vector<int>>& intervals) {
-    ranges::sort(intervals, ranges::less{}, [](const vector<int>& interval) {
-      const int l = interval[0];
-      const int r = interval[1];
-      return pair<int, int>{l, -r};
+    // If the two intervals have the same `start`, put the one with a larger
+    // `end` first.
+    ranges::sort(intervals, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] == b[0] ? a[1] > b[1] : a[0] < b[0];
     });
 
     int ans = 0;
     int prevEnd = 0;
 
     for (const vector<int>& interval : intervals)
-      // The current interval is not covered by the previous one.
+      // Current interval is not covered by the previous one.
       if (prevEnd < interval[1]) {
-        prevEnd = interval[1];
         ++ans;
+        prevEnd = interval[1];
       }
 
     return ans;
diff --git a/solutions/1288. Remove Covered Intervals/1288.java b/solutions/1288. Remove Covered Intervals/1288.java
index 0dcf6577596..cca03079606 100644
--- a/solutions/1288. Remove Covered Intervals/1288.java	
+++ b/solutions/1288. Remove Covered Intervals/1288.java	
@@ -1,16 +1,17 @@
 class Solution {
   public int removeCoveredIntervals(int[][] intervals) {
-    Arrays.sort(intervals, Comparator.comparingInt((int[] interval) -> interval[0])
-                               .thenComparingInt((int[] interval) -> - interval[1]));
+    // If the two intervals have the same `start`, put the one with a larger
+    // `end` first.
+    Arrays.sort(intervals, (a, b) -> a[0] == b[0] ? b[1] - a[1] : a[0] - b[0]);
 
     int ans = 0;
     int prevEnd = 0;
 
     for (int[] interval : intervals)
-      // The current interval is not covered by the previous one.
+      // Current interval is not covered by the previous one.
       if (prevEnd < interval[1]) {
-        prevEnd = interval[1];
         ++ans;
+        prevEnd = interval[1];
       }
 
     return ans;
diff --git a/solutions/1288. Remove Covered Intervals/1288.py b/solutions/1288. Remove Covered Intervals/1288.py
index 46aeffb3e93..b14fa5e1357 100644
--- a/solutions/1288. Remove Covered Intervals/1288.py	
+++ b/solutions/1288. Remove Covered Intervals/1288.py	
@@ -1,12 +1,14 @@
 class Solution:
-  def removeCoveredIntervals(self, intervals: list[list[int]]) -> int:
+  def removeCoveredIntervals(self, intervals: List[List[int]]) -> int:
     ans = 0
     prevEnd = 0
 
+    # If the two intervals have the same `start`, put the one with a larger
+    # `end` first.
     for _, end in sorted(intervals, key=lambda x: (x[0], -x[1])):
-      # The current interval is not covered by the previous one.
+      # Current interval is not covered by the previous one.
       if prevEnd < end:
-        prevEnd = end
         ans += 1
+        prevEnd = end
 
     return ans
diff --git a/solutions/1289. Minimum Falling Path Sum II/1289.cpp b/solutions/1289. Minimum Falling Path Sum II/1289.cpp
index 7b197133701..1bb9f257126 100644
--- a/solutions/1289. Minimum Falling Path Sum II/1289.cpp	
+++ b/solutions/1289. Minimum Falling Path Sum II/1289.cpp	
@@ -21,8 +21,10 @@ class Solution {
  private:
   vector<pair<int, int>> getTwoMinNumAndIndexs(const vector<int>& A) {
     vector<pair<int, int>> numAndIndexs;
+
     for (int i = 0; i < A.size(); ++i)
       numAndIndexs.emplace_back(A[i], i);
+
     ranges::sort(numAndIndexs);
     return {numAndIndexs[0], numAndIndexs[1]};
   }
diff --git a/solutions/1289. Minimum Falling Path Sum II/1289.java b/solutions/1289. Minimum Falling Path Sum II/1289.java
index d926f1714ab..3e08a13847e 100644
--- a/solutions/1289. Minimum Falling Path Sum II/1289.java	
+++ b/solutions/1289. Minimum Falling Path Sum II/1289.java	
@@ -3,10 +3,10 @@ public int minFallingPathSum(int[][] grid) {
     final int n = grid.length;
 
     for (int i = 1; i < n; ++i) {
-      Pair<Integer, Integer>[] twoMinNumAndIndexes = getTwoMinNumAndIndexes(grid[i - 1]);
-      final int firstMinNum = twoMinNumAndIndexes[0].getKey();
-      final int firstMinIndex = twoMinNumAndIndexes[0].getValue();
-      final int secondMinNum = twoMinNumAndIndexes[1].getKey();
+      Pair<Integer, Integer>[] twoMinnumAndIndexes = getTwoMinnumAndIndexes(grid[i - 1]);
+      final int firstMinNum = twoMinnumAndIndexes[0].getKey();
+      final int firstMinIndex = twoMinnumAndIndexes[0].getValue();
+      final int secondMinNum = twoMinnumAndIndexes[1].getKey();
       for (int j = 0; j < n; ++j)
         if (j == firstMinIndex)
           grid[i][j] += secondMinNum;
@@ -17,11 +17,13 @@ public int minFallingPathSum(int[][] grid) {
     return Arrays.stream(grid[n - 1]).min().getAsInt();
   }
 
-  private Pair<Integer, Integer>[] getTwoMinNumAndIndexes(int[] arr) {
+  private Pair<Integer, Integer>[] getTwoMinnumAndIndexes(int[] A) {
     List<Pair<Integer, Integer>> numAndIndexes = new ArrayList<>();
-    for (int i = 0; i < arr.length; ++i)
-      numAndIndexes.add(new Pair<>(arr[i], i));
-    Collections.sort(numAndIndexes, Comparator.comparingInt(Pair::getKey));
+
+    for (int i = 0; i < A.length; ++i)
+      numAndIndexes.add(new Pair<>(A[i], i));
+
+    Collections.sort(numAndIndexes, (a, b) -> a.getKey() - b.getKey());
     return new Pair[] {numAndIndexes.get(0), numAndIndexes.get(1)};
   }
 }
diff --git a/solutions/1289. Minimum Falling Path Sum II/1289.py b/solutions/1289. Minimum Falling Path Sum II/1289.py
index 8fe6bfe63d7..14ddc6d883c 100644
--- a/solutions/1289. Minimum Falling Path Sum II/1289.py	
+++ b/solutions/1289. Minimum Falling Path Sum II/1289.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minFallingPathSum(self, grid: list[list[int]]) -> int:
+  def minFallingPathSum(self, grid: List[List[int]]) -> int:
     n = len(grid)
 
     for i in range(1, n):
diff --git a/solutions/129. Sum Root to Leaf Numbers/129.py b/solutions/129. Sum Root to Leaf Numbers/129.py
index 39bccae0059..8f55027c42b 100644
--- a/solutions/129. Sum Root to Leaf Numbers/129.py	
+++ b/solutions/129. Sum Root to Leaf Numbers/129.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def sumNumbers(self, root: TreeNode | None) -> int:
+  def sumNumbers(self, root: Optional[TreeNode]) -> int:
     ans = 0
 
-    def dfs(root: TreeNode | None, path: int) -> None:
+    def dfs(root: Optional[TreeNode], path: int) -> None:
       nonlocal ans
       if not root:
         return
diff --git a/solutions/1291. Sequential Digits/1291.java b/solutions/1291. Sequential Digits/1291.java
index edadb1d838e..eac3f00828b 100644
--- a/solutions/1291. Sequential Digits/1291.java	
+++ b/solutions/1291. Sequential Digits/1291.java	
@@ -1,7 +1,7 @@
 class Solution {
   public List<Integer> sequentialDigits(int low, int high) {
     List<Integer> ans = new ArrayList<>();
-    Queue<Integer> q = new ArrayDeque<>(List.of(1, 2, 3, 4, 5, 6, 7, 8, 9));
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9));
 
     while (!q.isEmpty()) {
       final int num = q.poll();
diff --git a/solutions/1291. Sequential Digits/1291.py b/solutions/1291. Sequential Digits/1291.py
index 472ba1bf665..7622d3bd3e9 100644
--- a/solutions/1291. Sequential Digits/1291.py	
+++ b/solutions/1291. Sequential Digits/1291.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sequentialDigits(self, low: int, high: int) -> list[int]:
+  def sequentialDigits(self, low: int, high: int) -> List[int]:
     ans = []
     q = collections.deque([num for num in range(1, 10)])
 
diff --git a/solutions/1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold/1292.py b/solutions/1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold/1292.py
index c2008d38f00..228c6ce09a7 100644
--- a/solutions/1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold/1292.py	
+++ b/solutions/1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold/1292.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSideLength(self, mat: list[list[int]], threshold: int) -> int:
+  def maxSideLength(self, mat: List[List[int]], threshold: int) -> int:
     m = len(mat)
     n = len(mat[0])
     ans = 0
@@ -7,8 +7,8 @@ def maxSideLength(self, mat: list[list[int]], threshold: int) -> int:
 
     for i in range(m):
       for j in range(n):
-        prefix[i + 1][j + 1] = (mat[i][j] + prefix[i][j + 1] +
-                                prefix[i + 1][j] - prefix[i][j])
+        prefix[i + 1][j + 1] = mat[i][j] + prefix[i][j + 1] + \
+            prefix[i + 1][j] - prefix[i][j]
 
     def squareSum(r1: int, c1: int, r2: int, c2: int) -> int:
       return prefix[r2 + 1][c2 + 1] - prefix[r1][c2 + 1] - prefix[r2 + 1][c1] + prefix[r1][c1]
diff --git a/solutions/1293. Shortest Path in a Grid with Obstacles Elimination/1293.cpp b/solutions/1293. Shortest Path in a Grid with Obstacles Elimination/1293.cpp
index 8bf7cac5b3d..1cb0ec7f2e0 100644
--- a/solutions/1293. Shortest Path in a Grid with Obstacles Elimination/1293.cpp	
+++ b/solutions/1293. Shortest Path in a Grid with Obstacles Elimination/1293.cpp	
@@ -6,23 +6,25 @@ class Solution {
     if (m == 1 && n == 1)
       return 0;
 
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    int steps = 0;
     queue<tuple<int, int, int>> q{{{0, 0, k}}};  // (i, j, eliminate)
     vector<vector<vector<bool>>> seen(
         m, vector<vector<bool>>(n, vector<bool>(k + 1)));
     seen[0][0][k] = true;
 
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++steps;
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j, eliminate] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
-          const int x = i + dx;
-          const int y = j + dy;
+        for (int l = 0; l < 4; ++l) {
+          const int x = i + dirs[l];
+          const int y = j + dirs[l + 1];
           if (x < 0 || x == m || y < 0 || y == n)
             continue;
           if (x == m - 1 && y == n - 1)
-            return step;
+            return steps;
           if (grid[x][y] == 1 && eliminate == 0)
             continue;
           const int newEliminate = eliminate - grid[x][y];
@@ -32,6 +34,7 @@ class Solution {
           seen[x][y][newEliminate] = true;
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/1293. Shortest Path in a Grid with Obstacles Elimination/1293.java b/solutions/1293. Shortest Path in a Grid with Obstacles Elimination/1293.java
index 0238c38c6dc..c196c97af7b 100644
--- a/solutions/1293. Shortest Path in a Grid with Obstacles Elimination/1293.java	
+++ b/solutions/1293. Shortest Path in a Grid with Obstacles Elimination/1293.java	
@@ -1,28 +1,41 @@
+class T {
+  public int i;
+  public int j;
+  public int eliminate;
+  public T(int i, int j, int eliminate) {
+    this.i = i;
+    this.j = j;
+    this.eliminate = eliminate;
+  }
+}
+
 class Solution {
   public int shortestPath(int[][] grid, int k) {
-    record T(int i, int j, int eliminate) {}
     final int m = grid.length;
     final int n = grid[0].length;
     if (m == 1 && n == 1)
       return 0;
 
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-    Queue<T> q = new ArrayDeque<>(List.of(new T(0, 0, k)));
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    int steps = 0;
+    Queue<T> q = new ArrayDeque<>();
+    q.offer(new T(0, 0, k));
     boolean[][][] seen = new boolean[m][n][k + 1];
     seen[0][0][k] = true;
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++steps;
       for (int sz = q.size(); sz > 0; --sz) {
         final int i = q.peek().i;
         final int j = q.peek().j;
         final int eliminate = q.poll().eliminate;
         for (int l = 0; l < 4; ++l) {
-          final int x = i + DIRS[l][0];
-          final int y = j + DIRS[l][1];
+          final int x = i + dirs[l];
+          final int y = j + dirs[l + 1];
           if (x < 0 || x == m || y < 0 || y == n)
             continue;
           if (x == m - 1 && y == n - 1)
-            return step;
+            return steps;
           if (grid[x][y] == 1 && eliminate == 0)
             continue;
           final int newEliminate = eliminate - grid[x][y];
@@ -32,6 +45,7 @@ record T(int i, int j, int eliminate) {}
           seen[x][y][newEliminate] = true;
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/1293. Shortest Path in a Grid with Obstacles Elimination/1293.py b/solutions/1293. Shortest Path in a Grid with Obstacles Elimination/1293.py
index 4d4283cfb4e..62826d1c4c8 100644
--- a/solutions/1293. Shortest Path in a Grid with Obstacles Elimination/1293.py	
+++ b/solutions/1293. Shortest Path in a Grid with Obstacles Elimination/1293.py	
@@ -1,26 +1,26 @@
 class Solution:
-  def shortestPath(self, grid: list[list[int]], k: int) -> int:
+  def shortestPath(self, grid: List[List[int]], k: int) -> int:
     m = len(grid)
     n = len(grid[0])
     if m == 1 and n == 1:
       return 0
 
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
+    steps = 0
     q = collections.deque([(0, 0, k)])
     seen = {(0, 0, k)}
 
-    step = 0
     while q:
-      step += 1
+      steps += 1
       for _ in range(len(q)):
         i, j, eliminate = q.popleft()
-        for dx, dy in DIRS:
-          x = i + dx
-          y = j + dy
+        for l in range(4):
+          x = i + dirs[l]
+          y = j + dirs[l + 1]
           if x < 0 or x == m or y < 0 or y == n:
             continue
           if x == m - 1 and y == n - 1:
-            return step
+            return steps
           if grid[x][y] == 1 and eliminate == 0:
             continue
           newEliminate = eliminate - grid[x][y]
diff --git a/solutions/1295. Find Numbers with Even Number of Digits/1295.py b/solutions/1295. Find Numbers with Even Number of Digits/1295.py
index 25203fe1ee8..428cc7f7b74 100644
--- a/solutions/1295. Find Numbers with Even Number of Digits/1295.py	
+++ b/solutions/1295. Find Numbers with Even Number of Digits/1295.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findNumbers(self, nums: list[int]) -> int:
+  def findNumbers(self, nums: List[int]) -> int:
     ans = 0
 
     for num in nums:
diff --git a/solutions/1296. Divide Array in Sets of K Consecutive Numbers/1296.py b/solutions/1296. Divide Array in Sets of K Consecutive Numbers/1296.py
index 58acfaf120b..6f7c3991600 100644
--- a/solutions/1296. Divide Array in Sets of K Consecutive Numbers/1296.py	
+++ b/solutions/1296. Divide Array in Sets of K Consecutive Numbers/1296.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isPossibleDivide(self, nums: list[int], k: int) -> bool:
+  def isPossibleDivide(self, nums: List[int], k: int) -> bool:
     count = collections.Counter(nums)
 
     for start in sorted(count):
diff --git a/solutions/1298. Maximum Candies You Can Get from Boxes/1298.py b/solutions/1298. Maximum Candies You Can Get from Boxes/1298.py
index f48e898a78e..593a1e3def5 100644
--- a/solutions/1298. Maximum Candies You Can Get from Boxes/1298.py	
+++ b/solutions/1298. Maximum Candies You Can Get from Boxes/1298.py	
@@ -1,17 +1,10 @@
 class Solution:
-  def maxCandies(
-      self,
-      status: list[int],
-      candies: list[int],
-      keys: list[list[int]],
-      containedBoxes: list[list[int]],
-      initialBoxes: list[int],
-  ) -> int:
+  def maxCandies(self, status: List[int], candies: List[int], keys: List[List[int]], containedBoxes: List[List[int]], initialBoxes: List[int]) -> int:
     ans = 0
     q = collections.deque()
     reachedClosedBoxes = [0] * len(status)
 
-    def pushBoxesIfPossible(boxes: list[int]) -> None:
+    def pushBoxesIfPossible(boxes: List[int]) -> None:
       for box in boxes:
         if status[box]:
           q.append(box)
diff --git a/solutions/1299. Replace Elements with Greatest Element on Right Side/1299.py b/solutions/1299. Replace Elements with Greatest Element on Right Side/1299.py
index c93736b1401..e3e035dad76 100644
--- a/solutions/1299. Replace Elements with Greatest Element on Right Side/1299.py	
+++ b/solutions/1299. Replace Elements with Greatest Element on Right Side/1299.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def replaceElements(self, arr: list[int]) -> list[int]:
+  def replaceElements(self, arr: List[int]) -> List[int]:
     maxOfRight = -1
     for i in reversed(range(len(arr))):
       arr[i], maxOfRight = maxOfRight, max(maxOfRight, arr[i])
diff --git a/solutions/130. Surrounded Regions/130-2.py b/solutions/130. Surrounded Regions/130-2.py
index 21bdfad080e..1ffde074cc9 100644
--- a/solutions/130. Surrounded Regions/130-2.py	
+++ b/solutions/130. Surrounded Regions/130-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def solve(self, board: list[list[str]]) -> None:
+  def solve(self, board: List[List[str]]) -> None:
     if not board:
       return
 
diff --git a/solutions/130. Surrounded Regions/130.cpp b/solutions/130. Surrounded Regions/130.cpp
index 1ced1517f0e..a655e8053b9 100644
--- a/solutions/130. Surrounded Regions/130.cpp	
+++ b/solutions/130. Surrounded Regions/130.cpp	
@@ -4,7 +4,7 @@ class Solution {
     if (board.empty())
       return;
 
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = board.size();
     const int n = board[0].size();
 
@@ -22,7 +22,7 @@ class Solution {
     while (!q.empty()) {
       const auto [i, j] = q.front();
       q.pop();
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/130. Surrounded Regions/130.java b/solutions/130. Surrounded Regions/130.java
index 4e849e26e33..e38e64a753f 100644
--- a/solutions/130. Surrounded Regions/130.java	
+++ b/solutions/130. Surrounded Regions/130.java	
@@ -3,31 +3,31 @@ public void solve(char[][] board) {
     if (board.length == 0)
       return;
 
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = board.length;
     final int n = board[0].length;
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>();
+    Queue<int[]> q = new ArrayDeque<>();
 
     for (int i = 0; i < m; ++i)
       for (int j = 0; j < n; ++j)
         if (i * j == 0 || i == m - 1 || j == n - 1)
           if (board[i][j] == 'O') {
-            q.offer(new Pair<>(i, j));
+            q.offer(new int[] {i, j});
             board[i][j] = '*';
           }
 
     // Mark the grids that stretch from the four sides with '*'.
     while (!q.isEmpty()) {
-      final int i = q.peek().getKey();
-      final int j = q.poll().getValue();
-      for (int[] dir : DIRS) {
+      final int i = q.peek()[0];
+      final int j = q.poll()[1];
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == m || y < 0 || y == n)
           continue;
         if (board[x][y] != 'O')
           continue;
-        q.offer(new Pair<>(x, y));
+        q.offer(new int[] {x, y});
         board[x][y] = '*';
       }
     }
diff --git a/solutions/130. Surrounded Regions/130.py b/solutions/130. Surrounded Regions/130.py
index bfc84a1ce12..152bf860089 100644
--- a/solutions/130. Surrounded Regions/130.py	
+++ b/solutions/130. Surrounded Regions/130.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def solve(self, board: list[list[str]]) -> None:
+  def solve(self, board: List[List[str]]) -> None:
     if not board:
       return
 
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(board)
     n = len(board[0])
     q = collections.deque()
@@ -18,7 +18,7 @@ def solve(self, board: list[list[str]]) -> None:
     # Mark the grids that stretch from the four sides with '*'.
     while q:
       i, j = q.popleft()
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/1300. Sum of Mutated Array Closest to Target/1300.py b/solutions/1300. Sum of Mutated Array Closest to Target/1300.py
index c9a585a6df3..0b2fc40439e 100644
--- a/solutions/1300. Sum of Mutated Array Closest to Target/1300.py	
+++ b/solutions/1300. Sum of Mutated Array Closest to Target/1300.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findBestValue(self, arr: list[int], target: int) -> int:
+  def findBestValue(self, arr: List[int], target: int) -> int:
     prefix = 0
 
     arr.sort()
diff --git a/solutions/1301. Number of Paths with Max Score/1301.cpp b/solutions/1301. Number of Paths with Max Score/1301.cpp
index a6533b1a2af..c4067625c0b 100644
--- a/solutions/1301. Number of Paths with Max Score/1301.cpp	
+++ b/solutions/1301. Number of Paths with Max Score/1301.cpp	
@@ -2,8 +2,8 @@ class Solution {
  public:
   vector<int> pathsWithMaxScore(vector<string>& board) {
     constexpr int kMod = 1'000'000'007;
-    constexpr int kDirs[3][2] = {{0, 1}, {1, 0}, {1, 1}};
     const int n = board.size();
+    const vector<pair<int, int>> dirs{{0, 1}, {1, 0}, {1, 1}};
     // dp[i][j] := the maximum sum from (n - 1, n - 1) to (i, j)
     vector<vector<int>> dp(n + 1, vector<int>(n + 1, -1));
     // count[i][j] := the number of paths to get dp[i][j] from (n - 1, n - 1) to
@@ -18,7 +18,7 @@ class Solution {
       for (int j = n - 1; j >= 0; --j) {
         if (board[i][j] == 'S' || board[i][j] == 'X')
           continue;
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (dp[i][j] < dp[x][y]) {
diff --git a/solutions/1301. Number of Paths with Max Score/1301.java b/solutions/1301. Number of Paths with Max Score/1301.java
index 660d3aa6dd4..1c05ff56e10 100644
--- a/solutions/1301. Number of Paths with Max Score/1301.java	
+++ b/solutions/1301. Number of Paths with Max Score/1301.java	
@@ -1,8 +1,8 @@
 class Solution {
   public int[] pathsWithMaxScore(List<String> board) {
-    final int MOD = 1_000_000_007;
-    final int[][] DIRS = {{0, 1}, {1, 0}, {1, 1}};
+    final int kMod = 1_000_000_007;
     final int n = board.size();
+    final int[][] dirs = {{0, 1}, {1, 0}, {1, 1}};
     // dp[i][j] := the maximum sum from (n - 1, n - 1) to (i, j)
     int[][] dp = new int[n + 1][n + 1];
     Arrays.stream(dp).forEach(A -> Arrays.fill(A, -1));
@@ -17,7 +17,7 @@ public int[] pathsWithMaxScore(List<String> board) {
       for (int j = n - 1; j >= 0; --j) {
         if (board.get(i).charAt(j) == 'S' || board.get(i).charAt(j) == 'X')
           continue;
-        for (int[] dir : DIRS) {
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (dp[i][j] < dp[x][y]) {
@@ -25,13 +25,13 @@ public int[] pathsWithMaxScore(List<String> board) {
             count[i][j] = count[x][y];
           } else if (dp[i][j] == dp[x][y]) {
             count[i][j] += count[x][y];
-            count[i][j] %= MOD;
+            count[i][j] %= kMod;
           }
         }
         // If there's path(s) from 'S' to (i, j) and the cell is not 'E'.
         if (dp[i][j] != -1 && board.get(i).charAt(j) != 'E') {
           dp[i][j] += board.get(i).charAt(j) - '0';
-          dp[i][j] %= MOD;
+          dp[i][j] %= kMod;
         }
       }
 
diff --git a/solutions/1301. Number of Paths with Max Score/1301.py b/solutions/1301. Number of Paths with Max Score/1301.py
index e1b04d04fa3..5ae3cc6fe0e 100644
--- a/solutions/1301. Number of Paths with Max Score/1301.py	
+++ b/solutions/1301. Number of Paths with Max Score/1301.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def pathsWithMaxScore(self, board: list[str]) -> list[int]:
-    MOD = 1_000_000_007
-    DIRS = ((0, 1), (1, 0), (1, 1))
+  def pathsWithMaxScore(self, board: List[str]) -> List[int]:
+    kMod = 1_000_000_007
     n = len(board)
+    dirs = ((0, 1), (1, 0), (1, 1))
     # dp[i][j] := the maximum sum from (n - 1, n - 1) to (i, j)
     dp = [[-1] * (n + 1) for _ in range(n + 1)]
     # count[i][j] := the number of paths to get dp[i][j] from (n - 1, n - 1) to
@@ -17,7 +17,7 @@ def pathsWithMaxScore(self, board: list[str]) -> list[int]:
       for j in reversed(range(n)):
         if board[i][j] == 'S' or board[i][j] == 'X':
           continue
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           x = i + dx
           y = j + dy
           if dp[i][j] < dp[x][y]:
@@ -25,11 +25,11 @@ def pathsWithMaxScore(self, board: list[str]) -> list[int]:
             count[i][j] = count[x][y]
           elif dp[i][j] == dp[x][y]:
             count[i][j] += count[x][y]
-            count[i][j] %= MOD
+            count[i][j] %= kMod
 
         # If there's path(s) from 'S' to (i, j) and the cell is not 'E'.
         if dp[i][j] != -1 and board[i][j] != 'E':
           dp[i][j] += int(board[i][j])
-          dp[i][j] %= MOD
+          dp[i][j] %= kMod
 
     return [dp[0][0], count[0][0]]
diff --git a/solutions/1302. Deepest Leaves Sum/1302.java b/solutions/1302. Deepest Leaves Sum/1302.java
index 2ae33e3cbf1..263b945764f 100644
--- a/solutions/1302. Deepest Leaves Sum/1302.java	
+++ b/solutions/1302. Deepest Leaves Sum/1302.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int deepestLeavesSum(TreeNode root) {
     int ans = 0;
-    Queue<TreeNode> q = new ArrayDeque<>(List.of(root));
+    Queue<TreeNode> q = new ArrayDeque<>(Arrays.asList(root));
 
     while (!q.isEmpty()) {
       ans = 0;
diff --git a/solutions/1304. Find N Unique Integers Sum up to Zero/1304.py b/solutions/1304. Find N Unique Integers Sum up to Zero/1304.py
index 9302fb29ad1..38cd1c38d79 100644
--- a/solutions/1304. Find N Unique Integers Sum up to Zero/1304.py	
+++ b/solutions/1304. Find N Unique Integers Sum up to Zero/1304.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def sumZero(self, n: int) -> list[int]:
+  def sumZero(self, n: int) -> List[int]:
     return list(range(1 - n, n, 2))
diff --git a/solutions/1305. All Elements in Two Binary Search Trees/1305.cpp b/solutions/1305. All Elements in Two Binary Search Trees/1305.cpp
index 29efd9c0f63..6456efbc71a 100644
--- a/solutions/1305. All Elements in Two Binary Search Trees/1305.cpp	
+++ b/solutions/1305. All Elements in Two Binary Search Trees/1305.cpp	
@@ -22,7 +22,7 @@ class BSTIterator {
   stack<TreeNode*> stack;
 
   void pushLeftsUntilNull(TreeNode* node) {
-    while (node != nullptr) {
+    while (node) {
       stack.push(node);
       node = node->left;
     }
diff --git a/solutions/1306. Jump Game III/1306-2.cpp b/solutions/1306. Jump Game III/1306-2.cpp
index db998e23e0e..65e3159ee04 100644
--- a/solutions/1306. Jump Game III/1306-2.cpp	
+++ b/solutions/1306. Jump Game III/1306-2.cpp	
@@ -5,15 +5,16 @@ class Solution {
   }
 
  private:
-  bool canReach(const vector<int>& arr, int node, vector<bool>&& seen) {
-    if (node < 0 || node >= arr.size())
+  bool canReach(const vector<int>& A, int node, vector<bool>&& seen) {
+    if (node < 0 || node >= A.size())
       return false;
     if (seen[node])
       return false;
-    if (arr[node] == 0)
+    if (A[node] == 0)
       return true;
+
     seen[node] = true;
-    return canReach(arr, node + arr[node], std::move(seen)) ||
-           canReach(arr, node - arr[node], std::move(seen));
+    return canReach(A, node + A[node], move(seen)) ||
+           canReach(A, node - A[node], move(seen));
   }
 };
diff --git a/solutions/1306. Jump Game III/1306-2.java b/solutions/1306. Jump Game III/1306-2.java
index 32bc080272c..db7fbdc75f1 100644
--- a/solutions/1306. Jump Game III/1306-2.java	
+++ b/solutions/1306. Jump Game III/1306-2.java	
@@ -3,14 +3,15 @@ public boolean canReach(int[] arr, int start) {
     return canReach(arr, start, new boolean[arr.length]);
   }
 
-  private boolean canReach(int[] arr, int node, boolean[] seen) {
-    if (node < 0 || node >= arr.length)
+  private boolean canReach(int[] A, int node, boolean[] seen) {
+    if (node < 0 || node >= A.length)
       return false;
     if (seen[node])
       return false;
-    if (arr[node] == 0)
+    if (A[node] == 0)
       return true;
+
     seen[node] = true;
-    return canReach(arr, node + arr[node], seen) || canReach(arr, node - arr[node], seen);
+    return canReach(A, node + A[node], seen) || canReach(A, node - A[node], seen);
   }
 }
diff --git a/solutions/1306. Jump Game III/1306.cpp b/solutions/1306. Jump Game III/1306.cpp
index da3b2e6a4a3..ee2bd2a870b 100644
--- a/solutions/1306. Jump Game III/1306.cpp	
+++ b/solutions/1306. Jump Game III/1306.cpp	
@@ -8,15 +8,18 @@ class Solution {
     while (!q.empty()) {
       const int node = q.front();
       q.pop();
+
       if (arr[node] == 0)
         return true;
       if (seen[node])
         continue;
+
       // Check the available next steps.
       if (node - arr[node] >= 0)
         q.push(node - arr[node]);
       if (node + arr[node] < n)
         q.push(node + arr[node]);
+
       seen[node] = true;
     }
 
diff --git a/solutions/1306. Jump Game III/1306.java b/solutions/1306. Jump Game III/1306.java
index cb3429dee52..ac3f9a40e0a 100644
--- a/solutions/1306. Jump Game III/1306.java	
+++ b/solutions/1306. Jump Game III/1306.java	
@@ -1,20 +1,23 @@
 class Solution {
   public boolean canReach(int[] arr, int start) {
     final int n = arr.length;
-    Queue<Integer> q = new ArrayDeque<>(List.of(start));
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(start));
     boolean[] seen = new boolean[n];
 
     while (!q.isEmpty()) {
       final int node = q.poll();
+
       if (arr[node] == 0)
         return true;
       if (seen[node])
         continue;
+
       // Check the available next steps.
       if (node - arr[node] >= 0)
         q.offer(node - arr[node]);
       if (node + arr[node] < n)
         q.offer(node + arr[node]);
+
       seen[node] = true;
     }
 
diff --git a/solutions/1307. Verbal Arithmetic Puzzle/1307.py b/solutions/1307. Verbal Arithmetic Puzzle/1307.py
index 0a81f4f6c17..9a3181ffe6c 100644
--- a/solutions/1307. Verbal Arithmetic Puzzle/1307.py	
+++ b/solutions/1307. Verbal Arithmetic Puzzle/1307.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isSolvable(self, words: list[str], result: str) -> bool:
+  def isSolvable(self, words: List[str], result: str) -> bool:
     words.append(result)
     rows = len(words)
     cols = max(map(len, words))
@@ -19,8 +19,7 @@ def dfs(row: int, col: int, summ: int) -> bool:
       letter = word[~col]
       sign = -1 if row == rows - 1 else 1
 
-      if letter in letterToDigit and (
-              letterToDigit[letter] > 0 or col < len(word) - 1):
+      if letter in letterToDigit and (letterToDigit[letter] > 0 or col < len(word) - 1):
         return dfs(row + 1, col, summ + sign * letterToDigit[letter])
 
       for digit, used in enumerate(usedDigit):
diff --git a/solutions/131. Palindrome Partitioning/131.cpp b/solutions/131. Palindrome Partitioning/131.cpp
index ae60ad0143a..117efc5b75d 100644
--- a/solutions/131. Palindrome Partitioning/131.cpp	
+++ b/solutions/131. Palindrome Partitioning/131.cpp	
@@ -17,7 +17,7 @@ class Solution {
     for (int i = start; i < s.length(); ++i)
       if (isPalindrome(s, start, i)) {
         path.push_back(s.substr(start, i - start + 1));
-        dfs(s, i + 1, std::move(path), ans);
+        dfs(s, i + 1, move(path), ans);
         path.pop_back();
       }
   }
diff --git a/solutions/131. Palindrome Partitioning/131.py b/solutions/131. Palindrome Partitioning/131.py
index a7176411704..599f8419dc1 100644
--- a/solutions/131. Palindrome Partitioning/131.py	
+++ b/solutions/131. Palindrome Partitioning/131.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def partition(self, s: str) -> list[list[str]]:
+  def partition(self, s: str) -> List[List[str]]:
     ans = []
 
     def isPalindrome(s: str) -> bool:
       return s == s[::-1]
 
-    def dfs(s: str, j: int, path: list[str], ans: list[list[str]]) -> None:
+    def dfs(s: str, j: int, path: List[str], ans: List[List[str]]) -> None:
       if j == len(s):
         ans.append(path)
         return
diff --git a/solutions/1310. XOR Queries of a Subarray/1310.py b/solutions/1310. XOR Queries of a Subarray/1310.py
index 16982e616d4..fbb40f9c56f 100644
--- a/solutions/1310. XOR Queries of a Subarray/1310.py	
+++ b/solutions/1310. XOR Queries of a Subarray/1310.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def xorQueries(self, arr: list[int], queries: list[list[int]]) -> list[int]:
+  def xorQueries(self, arr: List[int], queries: List[List[int]]) -> List[int]:
     ans = []
     xors = [0] * (len(arr) + 1)
 
diff --git a/solutions/1311. Get Watched Videos by Your Friends/1311.cpp b/solutions/1311. Get Watched Videos by Your Friends/1311.cpp
index 2c36826cc2d..c491fe5e245 100644
--- a/solutions/1311. Get Watched Videos by Your Friends/1311.cpp	
+++ b/solutions/1311. Get Watched Videos by Your Friends/1311.cpp	
@@ -4,26 +4,26 @@ class Solution {
                                         vector<vector<int>>& friends, int id,
                                         int level) {
     vector<string> ans;
-    queue<int> q{{id}};
-    vector<bool> seen(friends.size());
-    seen[id] = true;
+    vector<bool> visited(friends.size());
+    visited[id] = true;
+    queue<int> queue{{id}};
     unordered_map<string, int> count;
     set<pair<int, string>> freqAndVideo;
 
     for (int i = 0; i < level; ++i)
-      for (int sz = q.size(); sz > 0; --sz) {
-        for (const int friend_ : friends[q.front()])
-          if (!seen[friend_]) {
-            seen[friend_] = true;
-            q.push(friend_);
+      for (int j = queue.size(); j > 0; --j) {
+        for (int f : friends[queue.front()])
+          if (visited[f] == false) {
+            visited[f] = true;
+            queue.push(f);
           }
-        q.pop();
+        queue.pop();
       }
 
-    for (int i = q.size(); i > 0; --i) {
-      for (const string& video : watchedVideos[q.front()])
+    for (int i = queue.size(); i > 0; --i) {
+      for (const string& video : watchedVideos[queue.front()])
         ++count[video];
-      q.pop();
+      queue.pop();
     }
 
     for (const auto& [video, freq] : count)
diff --git a/solutions/1311. Get Watched Videos by Your Friends/1311.java b/solutions/1311. Get Watched Videos by Your Friends/1311.java
index 437a9a260d4..7afdb7bbfc2 100644
--- a/solutions/1311. Get Watched Videos by Your Friends/1311.java	
+++ b/solutions/1311. Get Watched Videos by Your Friends/1311.java	
@@ -1,29 +1,29 @@
 class Solution {
   public List<String> watchedVideosByFriends(List<List<String>> watchedVideos, int[][] friends,
                                              int id, int level) {
-    Queue<Integer> q = new ArrayDeque<>(List.of(id));
-    boolean[] seen = new boolean[friends.length];
-    seen[id] = true;
+    boolean[] visited = new boolean[friends.length];
+    visited[id] = true;
+    Queue<Integer> queue = new ArrayDeque<>(Arrays.asList(id));
     Map<String, Integer> count = new HashMap<>();
 
     for (int i = 0; i < level; ++i)
-      for (int sz = q.size(); sz > 0; --sz) {
-        for (final int friend : friends[q.peek()])
-          if (!seen[friend]) {
-            seen[friend] = true;
-            q.offer(friend);
+      for (int j = queue.size(); j > 0; --j) {
+        for (int friend : friends[queue.peek()])
+          if (visited[friend] == false) {
+            visited[friend] = true;
+            queue.add(friend);
           }
-        q.poll();
+        queue.poll();
       }
 
-    for (final int friend : q)
+    for (int friend : queue)
       for (final String video : watchedVideos.get(friend))
         count.merge(video, 1, Integer::sum);
 
     List<String> ans = new ArrayList<>(count.keySet());
-    ans.sort((a, b)
-                 -> count.get(a).equals(count.get(b)) ? a.compareTo(b)
-                                                      : count.get(a).compareTo(count.get(b)));
+
+    ans.sort((a, b) -> count.get(a) == count.get(b) ? a.compareTo(b) : count.get(a) - count.get(b));
+
     return ans;
   }
 }
diff --git a/solutions/1311. Get Watched Videos by Your Friends/1311.py b/solutions/1311. Get Watched Videos by Your Friends/1311.py
index 20ffe4166d6..87a83cbc4d3 100644
--- a/solutions/1311. Get Watched Videos by Your Friends/1311.py	
+++ b/solutions/1311. Get Watched Videos by Your Friends/1311.py	
@@ -1,13 +1,8 @@
 class Solution:
-  def watchedVideosByFriends(
-      self,
-      watchedVideos: list[list[str]],
-      friends: list[list[int]],
-      id: int,
-      level: int,
-  ) -> list[str]:
-    seen = [False] * 100
-    seen[id] = True
+  def watchedVideosByFriends(self, watchedVideos: List[List[str]], friends: List[List[int]],
+                             id: int, level: int) -> List[str]:
+    visited = [False] * 100
+    visited[id] = True
     q = collections.deque([id])
     count = collections.Counter()
 
@@ -15,12 +10,12 @@ def watchedVideosByFriends(
       for _ in range(len(q)):
         curr = q.popleft()
         for friend in friends[curr]:
-          if not seen[friend]:
-            seen[friend] = True
+          if not visited[friend]:
+            visited[friend] = True
             q.append(friend)
 
     for friend in q:
       for video in watchedVideos[friend]:
         count[video] += 1
 
-    return sorted(count, key=lambda video: (count[video], video))
+    return sorted(count.keys(), key=lambda video: (count[video], video))
diff --git a/solutions/1313. Decompress Run-Length Encoded List/1313.py b/solutions/1313. Decompress Run-Length Encoded List/1313.py
index 41ecf9b7f94..249eb9b0a34 100644
--- a/solutions/1313. Decompress Run-Length Encoded List/1313.py	
+++ b/solutions/1313. Decompress Run-Length Encoded List/1313.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def decompressRLElist(self, nums: list[int]) -> list[int]:
+  def decompressRLElist(self, nums: List[int]) -> List[int]:
     ans = []
 
     for i in range(0, len(nums), 2):
diff --git a/solutions/1314. Matrix Block Sum/1314.py b/solutions/1314. Matrix Block Sum/1314.py
index 3ee7df37687..37b6af03a4a 100644
--- a/solutions/1314. Matrix Block Sum/1314.py	
+++ b/solutions/1314. Matrix Block Sum/1314.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def matrixBlockSum(self, mat: list[list[int]], k: int) -> list[list[int]]:
+  def matrixBlockSum(self, mat: List[List[int]], k: int) -> List[List[int]]:
     m = len(mat)
     n = len(mat[0])
     ans = [[0] * n for _ in range(m)]
@@ -7,8 +7,8 @@ def matrixBlockSum(self, mat: list[list[int]], k: int) -> list[list[int]]:
 
     for i in range(m):
       for j in range(n):
-        prefix[i + 1][j + 1] = (mat[i][j] + prefix[i][j + 1] +
-                                prefix[i + 1][j] - prefix[i][j])
+        prefix[i + 1][j + 1] = mat[i][j] + \
+            prefix[i][j + 1] + prefix[i + 1][j] - prefix[i][j]
 
     for i in range(m):
       for j in range(n):
@@ -16,7 +16,7 @@ def matrixBlockSum(self, mat: list[list[int]], k: int) -> list[list[int]]:
         c1 = max(0, j - k) + 1
         r2 = min(m - 1, i + k) + 1
         c2 = min(n - 1, j + k) + 1
-        ans[i][j] = (prefix[r2][c2] - prefix[r2][c1 - 1] -
-                     prefix[r1 - 1][c2] + prefix[r1 - 1][c1 - 1])
+        ans[i][j] = prefix[r2][c2] - prefix[r2][c1 - 1] - \
+            prefix[r1 - 1][c2] + prefix[r1 - 1][c1 - 1]
 
     return ans
diff --git a/solutions/1317. Convert Integer to the Sum of Two No-Zero Integers/1317.py b/solutions/1317. Convert Integer to the Sum of Two No-Zero Integers/1317.py
index a2468ceefb6..c34db81f825 100644
--- a/solutions/1317. Convert Integer to the Sum of Two No-Zero Integers/1317.py	
+++ b/solutions/1317. Convert Integer to the Sum of Two No-Zero Integers/1317.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getNoZeroIntegers(self, n: int) -> list[int]:
+  def getNoZeroIntegers(self, n: int) -> List[int]:
     for A in range(n):
       B = n - A
       if '0' not in str(A) and '0' not in str(B):
diff --git a/solutions/1318. Minimum Flips to Make a OR b Equal to c/1318.java b/solutions/1318. Minimum Flips to Make a OR b Equal to c/1318.java
index 19b223f8409..570f9d5749b 100644
--- a/solutions/1318. Minimum Flips to Make a OR b Equal to c/1318.java	
+++ b/solutions/1318. Minimum Flips to Make a OR b Equal to c/1318.java	
@@ -1,9 +1,9 @@
 class Solution {
   public int minFlips(int a, int b, int c) {
-    final int MAX_BIT = 30;
+    final int kMaxBit = 30;
     int ans = 0;
 
-    for (int i = 0; i < MAX_BIT; ++i)
+    for (int i = 0; i < kMaxBit; ++i)
       if ((c >> i & 1) == 1)
         ans += ((a >> i & 1) == 0 && (b >> i & 1) == 0) ? 1 : 0;
       else // (c >> i & 1) == 0
diff --git a/solutions/1318. Minimum Flips to Make a OR b Equal to c/1318.py b/solutions/1318. Minimum Flips to Make a OR b Equal to c/1318.py
index 26e184c1350..df1f1084814 100644
--- a/solutions/1318. Minimum Flips to Make a OR b Equal to c/1318.py	
+++ b/solutions/1318. Minimum Flips to Make a OR b Equal to c/1318.py	
@@ -1,9 +1,9 @@
 class Solution:
   def minFlips(self, a: int, b: int, c: int) -> int:
-    MAX_BIT = 30
+    kMaxBit = 30
     ans = 0
 
-    for i in range(MAX_BIT):
+    for i in range(kMaxBit):
       if c >> i & 1:
         ans += (a >> i & 1) == 0 and (b >> i & 1) == 0
       else:  # (c >> i & 1) == 0
diff --git a/solutions/1319. Number of Operations to Make Network Connected/1319.java b/solutions/1319. Number of Operations to Make Network Connected/1319.java
index 5bf66a6900f..cfd8b4da4e2 100644
--- a/solutions/1319. Number of Operations to Make Network Connected/1319.java	
+++ b/solutions/1319. Number of Operations to Make Network Connected/1319.java	
@@ -7,7 +7,9 @@ public int makeConnected(int n, int[][] connections) {
     int numOfConnected = 0;
     List<Integer>[] graph = new List[n];
     Set<Integer> seen = new HashSet<>();
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] connection : connections) {
       final int u = connection[0];
diff --git a/solutions/1324. Print Words Vertically/1324.py b/solutions/1324. Print Words Vertically/1324.py
index f5dba315366..0b2d82941a0 100644
--- a/solutions/1324. Print Words Vertically/1324.py	
+++ b/solutions/1324. Print Words Vertically/1324.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def printVertically(self, s: str) -> list[str]:
+  def printVertically(self, s: str) -> List[str]:
     ans = []
     words = s.split()
     maxLength = max(len(word) for word in words)
diff --git a/solutions/1325. Delete Leaves With a Given Value/1325.py b/solutions/1325. Delete Leaves With a Given Value/1325.py
index 251b86f894f..376fcc8c7dd 100644
--- a/solutions/1325. Delete Leaves With a Given Value/1325.py	
+++ b/solutions/1325. Delete Leaves With a Given Value/1325.py	
@@ -1,14 +1,10 @@
 class Solution:
-  def removeLeafNodes(
-      self,
-      root: TreeNode | None,
-      target: int,
-  ) -> TreeNode | None:
+  def removeLeafNodes(self, root: Optional[TreeNode], target: int) -> Optional[TreeNode]:
     if not root:
       return None
     root.left = self.removeLeafNodes(root.left, target)
     root.right = self.removeLeafNodes(root.right, target)
     return None if self._isLeaf(root) and root.val == target else root
 
-  def _isLeaf(self, root: TreeNode | None) -> bool:
+  def _isLeaf(self, root: Optional[TreeNode]) -> bool:
     return not root.left and not root.right
diff --git a/solutions/1326. Minimum Number of Taps to Open to Water a Garden/1326.py b/solutions/1326. Minimum Number of Taps to Open to Water a Garden/1326.py
index 9ac089de242..b6cec105133 100644
--- a/solutions/1326. Minimum Number of Taps to Open to Water a Garden/1326.py	
+++ b/solutions/1326. Minimum Number of Taps to Open to Water a Garden/1326.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minTaps(self, n: int, ranges: list[int]) -> int:
+  def minTaps(self, n: int, ranges: List[int]) -> int:
     nums = [0] * (n + 1)
 
     for i, range_ in enumerate(ranges):
diff --git a/solutions/1329. Sort the Matrix Diagonally/1329.py b/solutions/1329. Sort the Matrix Diagonally/1329.py
index 0c5564a81e0..551c1a4d362 100644
--- a/solutions/1329. Sort the Matrix Diagonally/1329.py	
+++ b/solutions/1329. Sort the Matrix Diagonally/1329.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def diagonalSort(self, mat: list[list[int]]) -> list[list[int]]:
+  def diagonalSort(self, mat: List[List[int]]) -> List[List[int]]:
     m = len(mat)
     n = len(mat[0])
 
diff --git a/solutions/133. Clone Graph/133.java b/solutions/133. Clone Graph/133.java
index facacf631b7..ddc0647ee73 100644
--- a/solutions/133. Clone Graph/133.java	
+++ b/solutions/133. Clone Graph/133.java	
@@ -3,7 +3,7 @@ public Node cloneGraph(Node node) {
     if (node == null)
       return null;
 
-    Queue<Node> q = new ArrayDeque<>(List.of(node));
+    Queue<Node> q = new ArrayDeque<>(Arrays.asList(node));
     Map<Node, Node> map = new HashMap<>();
     map.put(node, new Node(node.val));
 
diff --git a/solutions/1330. Reverse Subarray To Maximize Array Value/1330.py b/solutions/1330. Reverse Subarray To Maximize Array Value/1330.py
index ddfcf4da0db..774ffcf0137 100644
--- a/solutions/1330. Reverse Subarray To Maximize Array Value/1330.py	
+++ b/solutions/1330. Reverse Subarray To Maximize Array Value/1330.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxValueAfterReverse(self, nums: list[int]) -> int:
+  def maxValueAfterReverse(self, nums: List[int]) -> int:
     mn = math.inf
     mx = -math.inf
 
diff --git a/solutions/1331. Rank Transform of an Array/1331.py b/solutions/1331. Rank Transform of an Array/1331.py
index 59d7319df4f..4d1139b7db8 100644
--- a/solutions/1331. Rank Transform of an Array/1331.py	
+++ b/solutions/1331. Rank Transform of an Array/1331.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def arrayRankTransform(self, arr: list[int]) -> list[int]:
+  def arrayRankTransform(self, arr: List[int]) -> List[int]:
     rank = {}
 
     for a in sorted(arr):
diff --git a/solutions/1333. Filter Restaurants by Vegan-Friendly, Price and Distance/1333.cpp b/solutions/1333. Filter Restaurants by Vegan-Friendly, Price and Distance/1333.cpp
index c84aef89dc8..367f77ca8a1 100644
--- a/solutions/1333. Filter Restaurants by Vegan-Friendly, Price and Distance/1333.cpp	
+++ b/solutions/1333. Filter Restaurants by Vegan-Friendly, Price and Distance/1333.cpp	
@@ -4,22 +4,19 @@ class Solution {
                                 int veganFriendly, int maxPrice,
                                 int maxDistance) {
     vector<int> ans;
-    vector<vector<int>> filteredRestaurants;
+    vector<vector<int>> filtered;
 
-    for (const vector<int>& restaurant : restaurants)
+    for (vector<int>& restaurant : restaurants)
       if (restaurant[2] >= veganFriendly && restaurant[3] <= maxPrice &&
           restaurant[4] <= maxDistance)
-        filteredRestaurants.push_back(restaurant);
+        filtered.push_back(restaurant);
 
-    ranges::sort(filteredRestaurants, ranges::less{},
-                 [](const vector<int>& restaurant) {
-      const int rating = restaurant[1];
-      const int id = restaurant[0];
-      return pair<int, int>{-rating, -id};
+    ranges::sort(filtered, [](const vector<int>& a, const vector<int>& b) {
+      return a[1] == b[1] ? a[0] > b[0] : a[1] > b[1];
     });
 
-    for (const vector<int>& restaurant : filteredRestaurants)
-      ans.push_back(restaurant[0]);
+    for (const vector<int>& f : filtered)
+      ans.push_back(f[0]);
 
     return ans;
   }
diff --git a/solutions/1333. Filter Restaurants by Vegan-Friendly, Price and Distance/1333.java b/solutions/1333. Filter Restaurants by Vegan-Friendly, Price and Distance/1333.java
index 88eb19aa677..6951bb21b93 100644
--- a/solutions/1333. Filter Restaurants by Vegan-Friendly, Price and Distance/1333.java	
+++ b/solutions/1333. Filter Restaurants by Vegan-Friendly, Price and Distance/1333.java	
@@ -3,8 +3,8 @@ public List<Integer> filterRestaurants(int[][] restaurants, int veganFriendly, i
                                          int maxDistance) {
     return Arrays.stream(restaurants)
         .filter(r -> r[2] >= veganFriendly && r[3] <= maxPrice && r[4] <= maxDistance)
-        .sorted(Comparator.comparingInt((int[] r) -> - r[1]).thenComparingInt((int[] r) -> - r[0]))
-        .map(r -> r[0])
+        .sorted((a, b) -> a[1] == b[1] ? b[0] - a[0] : b[1] - a[1])
+        .map(i -> i[0])
         .collect(Collectors.toList());
   }
 }
diff --git a/solutions/1333. Filter Restaurants by Vegan-Friendly, Price and Distance/1333.py b/solutions/1333. Filter Restaurants by Vegan-Friendly, Price and Distance/1333.py
index 308ea7ba7a8..ca670829e4e 100644
--- a/solutions/1333. Filter Restaurants by Vegan-Friendly, Price and Distance/1333.py	
+++ b/solutions/1333. Filter Restaurants by Vegan-Friendly, Price and Distance/1333.py	
@@ -1,11 +1,4 @@
 class Solution:
-  def filterRestaurants(
-      self,
-      restaurants: list[list[int]],
-      veganFriendly: int,
-      maxPrice: int,
-      maxDistance: int,
-  ) -> list[int]:
-    restaurants.sort(key=lambda x: (-x[1], -x[0]))
-    return [i for i, _, v, p, d in restaurants
-            if v >= veganFriendly and p <= maxPrice and d <= maxDistance]
+  def filterRestaurants(self, restaurants: List[List[int]], veganFriendly: int, maxPrice: int, maxDistance: int) -> List[int]:
+    restaurants.sort(key=lambda r: (-r[1], -r[0]))
+    return [i for i, _, v, p, d in restaurants if v >= veganFriendly and p <= maxPrice and d <= maxDistance]
diff --git a/solutions/1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance/1334.py b/solutions/1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance/1334.py
index a92b89f069f..548ad336145 100644
--- a/solutions/1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance/1334.py	
+++ b/solutions/1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance/1334.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def findTheCity(
-      self,
-      n: int,
-      edges: list[list[int]],
-      distanceThreshold: int,
-  ) -> int:
+  def findTheCity(self, n: int, edges: List[List[int]], distanceThreshold: int) -> int:
     ans = -1
     minCitiesCount = n
     dist = self._floydWarshall(n, edges, distanceThreshold)
@@ -17,12 +12,7 @@ def findTheCity(
 
     return ans
 
-  def _floydWarshall(
-      self,
-      n: int,
-      edges: list[list[int]],
-      distanceThreshold: int,
-  ) -> list[list[int]]:
+  def _floydWarshall(self, n: int, edges: List[List[int]], distanceThreshold: int) -> List[List[int]]:
     dist = [[distanceThreshold + 1] * n for _ in range(n)]
 
     for i in range(n):
diff --git a/solutions/1335. Minimum Difficulty of a Job Schedule/1335.py b/solutions/1335. Minimum Difficulty of a Job Schedule/1335.py
index e7ad331a105..e59806cf767 100644
--- a/solutions/1335. Minimum Difficulty of a Job Schedule/1335.py	
+++ b/solutions/1335. Minimum Difficulty of a Job Schedule/1335.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minDifficulty(self, jobDifficulty: list[int], d: int) -> int:
+  def minDifficulty(self, jobDifficulty: List[int], d: int) -> int:
     n = len(jobDifficulty)
     if d > n:
       return -1
diff --git a/solutions/1337. The K Weakest Rows in a Matrix/1337.cpp b/solutions/1337. The K Weakest Rows in a Matrix/1337.cpp
index 36de76a9b51..b1a69a30ca2 100644
--- a/solutions/1337. The K Weakest Rows in a Matrix/1337.cpp	
+++ b/solutions/1337. The K Weakest Rows in a Matrix/1337.cpp	
@@ -2,16 +2,17 @@ class Solution {
  public:
   vector<int> kWeakestRows(vector<vector<int>>& mat, int k) {
     vector<int> ans;
-    vector<pair<int, int>> rowSums;  // (sum(mat[i]), i)
+    vector<vector<int>> rowSum;
 
     for (int i = 0; i < mat.size(); ++i)
-      rowSums.emplace_back(accumulate(mat[i].begin(), mat[i].end(), 0), i);
+      rowSum.push_back({accumulate(mat[i].begin(), mat[i].end(), 0), i});
 
-    ranges::sort(rowSums, ranges::less{},
-                 [](const pair<int, int>& rowSum) { return rowSum; });
+    ranges::sort(rowSum, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] == b[0] ? a[1] < b[1] : a[0] < b[0];
+    });
 
     for (int i = 0; i < k; ++i)
-      ans.push_back(rowSums[i].second);
+      ans.push_back(rowSum[i][1]);
 
     return ans;
   }
diff --git a/solutions/1337. The K Weakest Rows in a Matrix/1337.java b/solutions/1337. The K Weakest Rows in a Matrix/1337.java
index 2c93e74a4ec..10232ec50f4 100644
--- a/solutions/1337. The K Weakest Rows in a Matrix/1337.java	
+++ b/solutions/1337. The K Weakest Rows in a Matrix/1337.java	
@@ -1,16 +1,17 @@
 class Solution {
   public int[] kWeakestRows(int[][] mat, int k) {
     int[] ans = new int[k];
-    Pair<Integer, Integer>[] rowSums = new Pair[mat.length];
+    int[][] candidates = new int[mat.length][2];
 
-    for (int i = 0; i < mat.length; ++i)
-      rowSums[i] = new Pair<>(Arrays.stream(mat[i]).sum(), i);
+    for (int i = 0; i < mat.length; ++i) {
+      candidates[i][0] = IntStream.of(mat[i]).sum();
+      candidates[i][1] = i;
+    }
 
-    Arrays.sort(rowSums, Comparator.comparingInt(Pair<Integer, Integer>::getKey)
-                             .thenComparingInt(Pair<Integer, Integer>::getValue));
+    Arrays.sort(candidates, (a, b) -> a[0] == b[0] ? a[1] - b[1] : a[0] - b[0]);
 
     for (int i = 0; i < k; ++i)
-      ans[i] = rowSums[i].getValue();
+      ans[i] = candidates[i][1];
 
     return ans;
   }
diff --git a/solutions/1337. The K Weakest Rows in a Matrix/1337.py b/solutions/1337. The K Weakest Rows in a Matrix/1337.py
index 1bacbbf5cb9..8e33b560c4d 100644
--- a/solutions/1337. The K Weakest Rows in a Matrix/1337.py	
+++ b/solutions/1337. The K Weakest Rows in a Matrix/1337.py	
@@ -1,4 +1,10 @@
 class Solution:
-  def kWeakestRows(self, mat: list[list[int]], k: int) -> list[int]:
-    rowSums = [(sum(row), i) for i, row in enumerate(mat)]
-    return [i for _, i in sorted(rowSums)[:k]]
+  def kWeakestRows(self, mat: List[List[int]], k: int) -> List[int]:
+    candidates = []
+
+    for i, row in enumerate(mat):
+      candidates.append([sum(row), i])
+
+    candidates.sort(key=lambda c: (c[0], c[1]))
+
+    return [i for _, i in candidates[:k]]
diff --git a/solutions/1338. Reduce Array Size to The Half/1338.cpp b/solutions/1338. Reduce Array Size to The Half/1338.cpp
index e91c63df17d..70faad60fcb 100644
--- a/solutions/1338. Reduce Array Size to The Half/1338.cpp	
+++ b/solutions/1338. Reduce Array Size to The Half/1338.cpp	
@@ -3,21 +3,21 @@ class Solution {
   int minSetSize(vector<int>& arr) {
     const int n = arr.size();
     int sum = 0;
-    unordered_map<int, int> count;
-    vector<pair<int, int>> numAndFreqs;
+    unordered_map<int, int> map;
+    vector<pair<int, int>> count;
 
     for (const int a : arr)
-      ++count[a];
+      ++map[a];
 
-    for (const auto& [a, freq] : count)
-      numAndFreqs.emplace_back(a, freq);
+    for (const auto& [a, freq] : map)
+      count.push_back(make_pair(a, freq));
 
-    ranges::sort(
-        numAndFreqs, ranges::greater{},
-        [](const pair<int, int>& numAndFreq) { return numAndFreq.second; });
+    ranges::sort(count, [](const pair<int, int>& a, const pair<int, int>& b) {
+      return a.second > b.second;
+    });
 
-    for (int i = 0; i < numAndFreqs.size(); ++i) {
-      sum += numAndFreqs[i].second;
+    for (int i = 0; i < count.size(); ++i) {
+      sum += count[i].second;
       if (sum >= n / 2)
         return i + 1;
     }
diff --git a/solutions/1338. Reduce Array Size to The Half/1338.java b/solutions/1338. Reduce Array Size to The Half/1338.java
index f0d2c1e993b..2464c1f371c 100644
--- a/solutions/1338. Reduce Array Size to The Half/1338.java	
+++ b/solutions/1338. Reduce Array Size to The Half/1338.java	
@@ -2,19 +2,23 @@ class Solution {
   public int minSetSize(int[] arr) {
     final int n = arr.length;
     int sum = 0;
-    Map<Integer, Integer> count = new HashMap<>();
-    List<Map.Entry<Integer, Integer>> numAndFreqs = new ArrayList<>();
+    Map<Integer, Integer> map = new HashMap<>();
 
     for (final int a : arr)
-      count.merge(a, 1, Integer::sum);
+      map.merge(a, 1, Integer::sum);
 
-    for (Map.Entry<Integer, Integer> entry : count.entrySet())
-      numAndFreqs.add(entry);
+    int[][] count = new int[map.size()][2];
+    int i = 0;
 
-    numAndFreqs.sort(Comparator.comparingInt(Map.Entry<Integer, Integer>::getValue).reversed());
+    for (final int key : map.keySet()) {
+      count[i][0] = key;
+      count[i++][1] = map.get(key);
+    }
+
+    Arrays.sort(count, (c1, c2) -> c2[1] - c1[1]);
 
-    for (int i = 0; i < numAndFreqs.size(); ++i) {
-      sum += numAndFreqs.get(i).getValue();
+    for (i = 0; i < count.length; ++i) {
+      sum += count[i][1];
       if (sum >= n / 2)
         return i + 1;
     }
diff --git a/solutions/1338. Reduce Array Size to The Half/1338.py b/solutions/1338. Reduce Array Size to The Half/1338.py
index 2bee043557a..4ac2c3c22b5 100644
--- a/solutions/1338. Reduce Array Size to The Half/1338.py	
+++ b/solutions/1338. Reduce Array Size to The Half/1338.py	
@@ -1,10 +1,12 @@
 class Solution:
-  def minSetSize(self, arr: list[int]) -> int:
+  def minSetSize(self, arr: List[int]) -> int:
+    n = len(arr)
+
     count = collections.Counter(arr).most_common()
-    count.sort(key=lambda x: -x[1])
+    count.sort(key=lambda c: -c[1])
 
     summ = 0
-    for i, (_, freq) in enumerate(count):
-      summ += freq
-      if summ >= len(arr) // 2:
+    for i, c in enumerate(count):
+      summ += c[1]
+      if summ >= n // 2:
         return i + 1
diff --git a/solutions/1339. Maximum Product of Splitted Binary Tree/1339.java b/solutions/1339. Maximum Product of Splitted Binary Tree/1339.java
index a123c62d002..b91bb38b9e8 100644
--- a/solutions/1339. Maximum Product of Splitted Binary Tree/1339.java	
+++ b/solutions/1339. Maximum Product of Splitted Binary Tree/1339.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int maxProduct(TreeNode root) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long ans = 0;
     List<Integer> allSums = new ArrayList<>();
     final long totalSum = treeSum(root, allSums);
@@ -8,7 +8,7 @@ public int maxProduct(TreeNode root) {
     for (final long sum : allSums)
       ans = Math.max(ans, sum * (totalSum - sum));
 
-    return (int) (ans % MOD);
+    return (int) (ans % kMod);
   }
 
   private int treeSum(TreeNode root, List<Integer> allSums) {
diff --git a/solutions/134. Gas Station/134.py b/solutions/134. Gas Station/134.py
index 76bed9258fe..2b6e3edf93d 100644
--- a/solutions/134. Gas Station/134.py	
+++ b/solutions/134. Gas Station/134.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canCompleteCircuit(self, gas: list[int], cost: list[int]) -> int:
+  def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:
     ans = 0
     net = 0
     summ = 0
diff --git a/solutions/1340. Jump Game V/1340.java b/solutions/1340. Jump Game V/1340.java
index 7755e7c5125..06bd5731f8e 100644
--- a/solutions/1340. Jump Game V/1340.java	
+++ b/solutions/1340. Jump Game V/1340.java	
@@ -8,7 +8,7 @@ public int maxJumps(int[] arr, int d) {
 
     for (int i = 0; i <= n; ++i) {
       while (!stack.isEmpty() && (i == n || arr[stack.peek()] < arr[i])) {
-        List<Integer> indices = new ArrayList<>(List.of(stack.pop()));
+        List<Integer> indices = new ArrayList<>(Arrays.asList(stack.pop()));
         while (!stack.isEmpty() && arr[stack.peek()] == arr[indices.get(0)])
           indices.add(stack.pop());
         for (final int j : indices) {
diff --git a/solutions/1340. Jump Game V/1340.py b/solutions/1340. Jump Game V/1340.py
index a2cdb7303c0..96cf02b3d12 100644
--- a/solutions/1340. Jump Game V/1340.py	
+++ b/solutions/1340. Jump Game V/1340.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxJumps(self, arr: list[int], d: int) -> int:
+  def maxJumps(self, arr: List[int], d: int) -> int:
     n = len(arr)
     # dp[i] := the maximum jumps starting from arr[i]
     dp = [1] * n
diff --git a/solutions/1342. Number of Steps to Reduce a Number to Zero/1342.java b/solutions/1342. Number of Steps to Reduce a Number to Zero/1342.java
index fbd559ebfe6..86b330d18b2 100644
--- a/solutions/1342. Number of Steps to Reduce a Number to Zero/1342.java	
+++ b/solutions/1342. Number of Steps to Reduce a Number to Zero/1342.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public int numberOfSteps(int num) {
     if (num == 0)
       return 0;
diff --git a/solutions/1343. Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold/1343.py b/solutions/1343. Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold/1343.py
index 4b9b712eaba..7f508e8e27c 100644
--- a/solutions/1343. Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold/1343.py	
+++ b/solutions/1343. Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold/1343.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numOfSubarrays(self, arr: list[int], k: int, threshold: int) -> int:
+  def numOfSubarrays(self, arr: List[int], k: int, threshold: int) -> int:
     ans = 0
     windowSum = 0
 
diff --git a/solutions/1345. Jump Game IV/1345.java b/solutions/1345. Jump Game IV/1345.java
index 096f3834446..b95218a2405 100644
--- a/solutions/1345. Jump Game IV/1345.java	
+++ b/solutions/1345. Jump Game IV/1345.java	
@@ -3,7 +3,7 @@ public int minJumps(int[] arr) {
     final int n = arr.length;
     // {a: indices}
     Map<Integer, List<Integer>> graph = new HashMap<>();
-    Queue<Integer> q = new ArrayDeque<>(List.of(0));
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(0));
     boolean[] seen = new boolean[n];
     seen[0] = true;
 
diff --git a/solutions/1345. Jump Game IV/1345.py b/solutions/1345. Jump Game IV/1345.py
index d3cef0483af..0e0ecb3b09f 100644
--- a/solutions/1345. Jump Game IV/1345.py	
+++ b/solutions/1345. Jump Game IV/1345.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minJumps(self, arr: list[int]) -> int:
+  def minJumps(self, arr: List[int]) -> int:
     n = len(arr)
     # {num: indices}
     graph = collections.defaultdict(list)
diff --git a/solutions/1346. Check If N and Its Double Exist/1346.py b/solutions/1346. Check If N and Its Double Exist/1346.py
index e34d818c63b..c228db861c2 100644
--- a/solutions/1346. Check If N and Its Double Exist/1346.py	
+++ b/solutions/1346. Check If N and Its Double Exist/1346.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def checkIfExist(self, arr: list[int]) -> bool:
+  def checkIfExist(self, arr: List[int]) -> bool:
     seen = set()
 
     for a in arr:
diff --git a/solutions/1347. Minimum Number of Steps to Make Two Strings Anagram/1347.cpp b/solutions/1347. Minimum Number of Steps to Make Two Strings Anagram/1347.cpp
index 6030f0db946..c74a87f2616 100644
--- a/solutions/1347. Minimum Number of Steps to Make Two Strings Anagram/1347.cpp	
+++ b/solutions/1347. Minimum Number of Steps to Make Two Strings Anagram/1347.cpp	
@@ -9,8 +9,8 @@ class Solution {
     for (const char c : t)
       --count[c - 'a'];
 
-    return accumulate(count.begin(), count.end(), 0, [](int acc, int c) {
-      return acc + abs(c);
+    return accumulate(count.begin(), count.end(), 0, [](int subtotal, int c) {
+      return subtotal + abs(c);
     }) / 2;
   }
 };
diff --git a/solutions/1348. Tweet Counts Per Frequency/1348.py b/solutions/1348. Tweet Counts Per Frequency/1348.py
index b9cf7e31ad2..3fd9220d9db 100644
--- a/solutions/1348. Tweet Counts Per Frequency/1348.py	
+++ b/solutions/1348. Tweet Counts Per Frequency/1348.py	
@@ -8,8 +8,7 @@ def __init__(self):
   def recordTweet(self, tweetName: str, time: int) -> None:
     self.tweetNameToTimes[tweetName].add(time)
 
-  def getTweetCountsPerFrequency(self, freq: str, tweetName: str,
-                                 startTime: int, endTime: int) -> list[int]:
+  def getTweetCountsPerFrequency(self, freq: str, tweetName: str, startTime: int, endTime: int) -> List[int]:
     counts = []
     times = self.tweetNameToTimes[tweetName]
     chunk = 60 if freq == 'minute' else 3600 if freq == 'hour' else 86400
diff --git a/solutions/1349. Maximum Students Taking Exam/1349.cpp b/solutions/1349. Maximum Students Taking Exam/1349.cpp
index 3d207053897..7fb306002ea 100644
--- a/solutions/1349. Maximum Students Taking Exam/1349.cpp	
+++ b/solutions/1349. Maximum Students Taking Exam/1349.cpp	
@@ -2,14 +2,14 @@ class Solution {
  public:
   int maxStudents(vector<vector<char>>& seats) {
     return accumulate(seats.begin(), seats.end(), 0,
-                      [&](int acc, const auto& seat) {
-      return acc + ranges::count(seat, '.');
+                      [&](int subtotal, const auto& seat) {
+      return subtotal + ranges::count(seat, '.');
     }) - hungarian(seats);
   }
 
  private:
-  static constexpr int kDirs[6][2] = {{-1, -1}, {0, -1}, {1, -1},
-                                      {-1, 1},  {0, 1},  {1, 1}};
+  const vector<pair<int, int>> dirs{{-1, -1}, {0, -1}, {1, -1},
+                                    {-1, 1},  {0, 1},  {1, 1}};
 
   int hungarian(const vector<vector<char>>& seats) {
     const int m = seats.size();
@@ -34,7 +34,7 @@ class Solution {
     const int m = seats.size();
     const int n = seats[0].size();
 
-    for (const auto& [dx, dy] : kDirs) {
+    for (const auto& [dx, dy] : dirs) {
       const int x = i + dx;
       const int y = j + dy;
       if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1349. Maximum Students Taking Exam/1349.java b/solutions/1349. Maximum Students Taking Exam/1349.java
index a9f6d99162e..b9585bd2dde 100644
--- a/solutions/1349. Maximum Students Taking Exam/1349.java	
+++ b/solutions/1349. Maximum Students Taking Exam/1349.java	
@@ -10,7 +10,7 @@ public int maxStudents(char[][] seats) {
     return studentsCount - hungarian(seats);
   }
 
-  private static final int[][] DIRS = {{-1, -1}, {0, -1}, {1, -1}, {-1, 1}, {0, 1}, {1, 1}};
+  private static final int[][] dirs = {{-1, -1}, {0, -1}, {1, -1}, {-1, 1}, {0, 1}, {1, 1}};
 
   private int hungarian(char[][] seats) {
     final int m = seats.length;
@@ -36,7 +36,7 @@ private boolean dfs(char[][] seats, int i, int j, int sessionId, int[][] seen, i
     final int m = seats.length;
     final int n = seats[0].length;
 
-    for (int[] dir : DIRS) {
+    for (int[] dir : dirs) {
       final int x = i + dir[0];
       final int y = j + dir[1];
       if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1349. Maximum Students Taking Exam/1349.py b/solutions/1349. Maximum Students Taking Exam/1349.py
index 9ad7bf38265..8fe950ff378 100644
--- a/solutions/1349. Maximum Students Taking Exam/1349.py	
+++ b/solutions/1349. Maximum Students Taking Exam/1349.py	
@@ -1,13 +1,13 @@
 class Solution:
-  def maxStudents(self, seats: list[list[str]]) -> int:
+  def maxStudents(self, seats: List[List[str]]) -> int:
     m = len(seats)
     n = len(seats[0])
-    DIRS = ((-1, -1), (0, -1), (1, -1), (-1, 1), (0, 1), (1, 1))
+    dirs = ((-1, -1), (0, -1), (1, -1), (-1, 1), (0, 1), (1, 1))
     seen = [[0] * n for _ in range(m)]
     match = [[-1] * n for _ in range(m)]
 
     def dfs(i: int, j: int, sessionId: int) -> int:
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/135. Candy/135.py b/solutions/135. Candy/135.py
index cb33083a0e0..0b2f1485632 100644
--- a/solutions/135. Candy/135.py	
+++ b/solutions/135. Candy/135.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def candy(self, ratings: list[int]) -> int:
+  def candy(self, ratings: List[int]) -> int:
     n = len(ratings)
 
     ans = 0
diff --git a/solutions/1351. Count Negative Numbers in a Sorted Matrix/1351.py b/solutions/1351. Count Negative Numbers in a Sorted Matrix/1351.py
index 092fc15e21a..910f8dd1645 100644
--- a/solutions/1351. Count Negative Numbers in a Sorted Matrix/1351.py	
+++ b/solutions/1351. Count Negative Numbers in a Sorted Matrix/1351.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countNegatives(self, grid: list[list[int]]) -> int:
+  def countNegatives(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
     ans = 0
diff --git a/solutions/1352. Product of the Last K Numbers/1352.java b/solutions/1352. Product of the Last K Numbers/1352.java
index fcffd6a0f8f..344b394a28c 100644
--- a/solutions/1352. Product of the Last K Numbers/1352.java	
+++ b/solutions/1352. Product of the Last K Numbers/1352.java	
@@ -1,11 +1,11 @@
 class ProductOfNumbers {
   public ProductOfNumbers() {
-    prefix = new ArrayList<>(List.of(1));
+    prefix = new ArrayList<>(Arrays.asList(1));
   }
 
   public void add(int num) {
     if (num == 0)
-      prefix = new ArrayList<>(List.of(1));
+      prefix = new ArrayList<>(Arrays.asList(1));
     else
       prefix.add(prefix.get(prefix.size() - 1) * num);
   }
diff --git a/solutions/1353. Maximum Number of Events That Can Be Attended/1353.java b/solutions/1353. Maximum Number of Events That Can Be Attended/1353.java
index ddb7ea3ebcb..b20f5099d97 100644
--- a/solutions/1353. Maximum Number of Events That Can Be Attended/1353.java	
+++ b/solutions/1353. Maximum Number of Events That Can Be Attended/1353.java	
@@ -5,7 +5,7 @@ public int maxEvents(int[][] events) {
     int i = 0; // events' index
     Queue<Integer> minHeap = new PriorityQueue<>();
 
-    Arrays.sort(events, Comparator.comparingInt(event -> event[0]));
+    Arrays.sort(events, (a, b) -> a[0] - b[0]);
 
     while (!minHeap.isEmpty() || i < events.length) {
       // If no events are available to attend today, let time flies to the next
diff --git a/solutions/1353. Maximum Number of Events That Can Be Attended/1353.py b/solutions/1353. Maximum Number of Events That Can Be Attended/1353.py
index d6d73214bff..cbc2b92a2c5 100644
--- a/solutions/1353. Maximum Number of Events That Can Be Attended/1353.py	
+++ b/solutions/1353. Maximum Number of Events That Can Be Attended/1353.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxEvents(self, events: list[list[int]]) -> int:
+  def maxEvents(self, events: List[List[int]]) -> int:
     ans = 0
     minHeap = []
     i = 0  # events' index
diff --git a/solutions/1354. Construct Target Array With Multiple Sums/1354.py b/solutions/1354. Construct Target Array With Multiple Sums/1354.py
index 13e636832e6..ca00f6b1573 100644
--- a/solutions/1354. Construct Target Array With Multiple Sums/1354.py	
+++ b/solutions/1354. Construct Target Array With Multiple Sums/1354.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isPossible(self, target: list[int]) -> bool:
+  def isPossible(self, target: List[int]) -> bool:
     if len(target) == 1:
       return target[0] == 1
 
diff --git a/solutions/1356. Sort Integers by The Number of 1 Bits/1356.cpp b/solutions/1356. Sort Integers by The Number of 1 Bits/1356.cpp
index 67c58d1103d..0f18ae83b98 100644
--- a/solutions/1356. Sort Integers by The Number of 1 Bits/1356.cpp	
+++ b/solutions/1356. Sort Integers by The Number of 1 Bits/1356.cpp	
@@ -1,9 +1,10 @@
 class Solution {
  public:
   vector<int> sortByBits(vector<int>& arr) {
-    ranges::sort(arr, ranges::less{}, [](const int a) {
-      const int bitCount = bitset<32>(a).count();
-      return pair<int, int>{bitCount, a};
+    ranges::sort(arr, [](const int a, int b) {
+      const int x = bitset<32>(a).contains();
+      const int y = bitset<32>(b).contains();
+      return x == y ? a < b : x < y;
     });
     return arr;
   }
diff --git a/solutions/1356. Sort Integers by The Number of 1 Bits/1356.java b/solutions/1356. Sort Integers by The Number of 1 Bits/1356.java
index 2851668aac3..c591f4160fc 100644
--- a/solutions/1356. Sort Integers by The Number of 1 Bits/1356.java	
+++ b/solutions/1356. Sort Integers by The Number of 1 Bits/1356.java	
@@ -1,9 +1,11 @@
 class Solution {
   public int[] sortByBits(int[] arr) {
-    return Arrays.stream(arr)
-        .boxed()
-        .sorted(Comparator.comparingInt(Integer::bitCount).thenComparingInt(a -> a))
-        .mapToInt(Integer::intValue)
-        .toArray();
+    Integer[] A = Arrays.stream(arr).boxed().toArray(Integer[] ::new);
+    Arrays.sort(A,
+                (a, b)
+                    -> Integer.bitCount(a) == Integer.bitCount(b)
+                           ? a - b
+                           : Integer.bitCount(a) - Integer.bitCount(b));
+    return Arrays.stream(A).mapToInt(Integer::intValue).toArray();
   }
 }
diff --git a/solutions/1356. Sort Integers by The Number of 1 Bits/1356.py b/solutions/1356. Sort Integers by The Number of 1 Bits/1356.py
deleted file mode 100644
index e90f131b016..00000000000
--- a/solutions/1356. Sort Integers by The Number of 1 Bits/1356.py	
+++ /dev/null
@@ -1,3 +0,0 @@
-class Solution:
-  def sortByBits(self, arr: list[int]) -> list[int]:
-    return sorted(arr, key=lambda x: (x.bit_count(), x))
diff --git a/solutions/1357. Apply Discount Every n Orders/1357.py b/solutions/1357. Apply Discount Every n Orders/1357.py
index c16f2cd924d..d6ba76b6161 100644
--- a/solutions/1357. Apply Discount Every n Orders/1357.py	
+++ b/solutions/1357. Apply Discount Every n Orders/1357.py	
@@ -1,17 +1,11 @@
 class Cashier:
-  def __init__(
-      self,
-      n: int,
-      discount: int,
-      products: list[int],
-      prices: list[int],
-  ):
+  def __init__(self, n: int, discount: int, products: List[int], prices: List[int]):
     self.n = n
     self.discount = discount
     self.productToPrice = dict(zip(products, prices))
     self.count = 0
 
-  def getBill(self, product: list[int], amount: list[int]) -> float:
+  def getBill(self, product: List[int], amount: List[int]) -> float:
     self.count += 1
     total = sum(self.productToPrice[p] * amount[i]
                 for i, p in enumerate(product))
diff --git a/solutions/1358. Number of Substrings Containing All Three Characters/1358-2.cpp b/solutions/1358. Number of Substrings Containing All Three Characters/1358-2.cpp
index 7fbe82b0547..9741ad654af 100644
--- a/solutions/1358. Number of Substrings Containing All Three Characters/1358-2.cpp	
+++ b/solutions/1358. Number of Substrings Containing All Three Characters/1358-2.cpp	
@@ -3,8 +3,8 @@ class Solution {
   // Similar to 3. Longest Substring Without Repeating Characters
   int numberOfSubstrings(string s) {
     int ans = 0;
-    // lastSeen[c] := the index of the last time c appeared
-    vector<int> lastSeen(3, -1);
+    vector<int> lastSeen(
+        3, -1);  // lastSeen[c] := the index of the last time c appeared
 
     for (int i = 0; i < s.length(); ++i) {
       lastSeen[s[i] - 'a'] = i;
diff --git a/solutions/1358. Number of Substrings Containing All Three Characters/1358-2.java b/solutions/1358. Number of Substrings Containing All Three Characters/1358-2.java
index a0e1aa72571..5d7155b1b4d 100644
--- a/solutions/1358. Number of Substrings Containing All Three Characters/1358-2.java	
+++ b/solutions/1358. Number of Substrings Containing All Three Characters/1358-2.java	
@@ -2,8 +2,7 @@ class Solution {
   // Similar to 3. Longest SubString Without Repeating Characters
   public int numberOfSubstrings(String s) {
     int ans = 0;
-    // lastSeen[c] := the index of the last time c appeared
-    int[] lastSeen = new int[3];
+    int[] lastSeen = new int[3]; // lastSeen[c] := the index of the last time c appeared
     Arrays.fill(lastSeen, -1);
 
     for (int i = 0; i < s.length(); ++i) {
diff --git a/solutions/1359. Count All Valid Pickup and Delivery Options/1359.java b/solutions/1359. Count All Valid Pickup and Delivery Options/1359.java
index 6bc85ab3ca6..330ec3c44de 100644
--- a/solutions/1359. Count All Valid Pickup and Delivery Options/1359.java	
+++ b/solutions/1359. Count All Valid Pickup and Delivery Options/1359.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int countOrders(int n) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long ans = 1;
 
     for (int i = 1; i <= n; ++i)
-      ans = ans * i * (i * 2 - 1) % MOD;
+      ans = ans * i * (i * 2 - 1) % kMod;
 
     return (int) ans;
   }
diff --git a/solutions/1359. Count All Valid Pickup and Delivery Options/1359.py b/solutions/1359. Count All Valid Pickup and Delivery Options/1359.py
index 96745109752..1901779ff83 100644
--- a/solutions/1359. Count All Valid Pickup and Delivery Options/1359.py	
+++ b/solutions/1359. Count All Valid Pickup and Delivery Options/1359.py	
@@ -1,9 +1,9 @@
 class Solution:
   def countOrders(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     ans = 1
 
     for i in range(1, n + 1):
-      ans = ans * i * (i * 2 - 1) % MOD
+      ans = ans * i * (i * 2 - 1) % kMod
 
     return ans
diff --git a/solutions/136. Single Number/136.py b/solutions/136. Single Number/136.py
index 6c46d715746..9e7e63986f7 100644
--- a/solutions/136. Single Number/136.py	
+++ b/solutions/136. Single Number/136.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def singleNumber(self, nums: list[int]) -> int:
+  def singleNumber(self, nums: List[int]) -> int:
     return functools.reduce(operator.xor, nums, 0)
diff --git a/solutions/1360. Number of Days Between Two Dates/1360.py b/solutions/1360. Number of Days Between Two Dates/1360.py
index 562e3880bf4..71a864bdecd 100644
--- a/solutions/1360. Number of Days Between Two Dates/1360.py	
+++ b/solutions/1360. Number of Days Between Two Dates/1360.py	
@@ -7,7 +7,7 @@ def isLeapYear(year: int) -> bool:
 
     def daysFrom1971(date: str) -> int:
       year, month, day = map(int, date.split('-'))
-      return (365 * (year - 1971) + sum(map(isLeapYear, range(1971, year))) +
-              sum(days[:month]) + day + (month > 2 and isLeapYear(year)))
+      return 365 * (year - 1971) + sum(map(isLeapYear, range(1971, year))) + \
+          sum(days[:month]) + day + (month > 2 and isLeapYear(year))
 
     return abs(daysFrom1971(date1) - daysFrom1971(date2))
diff --git a/solutions/1362. Closest Divisors/1362.py b/solutions/1362. Closest Divisors/1362.py
index c4713dfd661..16c566b6c1d 100644
--- a/solutions/1362. Closest Divisors/1362.py	
+++ b/solutions/1362. Closest Divisors/1362.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def closestDivisors(self, num: int) -> list[int]:
+  def closestDivisors(self, num: int) -> List[int]:
     for root in reversed(range(math.isqrt(num + 2) + 1)):
       for cand in [num + 1, num + 2]:
         if cand % root == 0:
diff --git a/solutions/1363. Largest Multiple of Three/1363.py b/solutions/1363. Largest Multiple of Three/1363.py
index 3aa0f20d97e..f308e9957df 100644
--- a/solutions/1363. Largest Multiple of Three/1363.py	
+++ b/solutions/1363. Largest Multiple of Three/1363.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestMultipleOfThree(self, digits: list[int]) -> str:
+  def largestMultipleOfThree(self, digits: List[int]) -> str:
     ans = ''
     mod1 = [1, 4, 7, 2, 5, 8]
     mod2 = [2, 5, 8, 1, 4, 7]
diff --git a/solutions/1365. How Many Numbers Are Smaller Than the Current Number/1365.java b/solutions/1365. How Many Numbers Are Smaller Than the Current Number/1365.java
index cd3abdaf47b..1fc169aad86 100644
--- a/solutions/1365. How Many Numbers Are Smaller Than the Current Number/1365.java	
+++ b/solutions/1365. How Many Numbers Are Smaller Than the Current Number/1365.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int[] smallerNumbersThanCurrent(int[] nums) {
-    final int MAX = 100;
+    final int kMax = 100;
     int[] ans = new int[nums.length];
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (final int num : nums)
       ++count[num];
 
-    for (int i = 1; i <= MAX; ++i)
+    for (int i = 1; i <= kMax; ++i)
       count[i] += count[i - 1];
 
     for (int i = 0; i < nums.length; ++i)
diff --git a/solutions/1365. How Many Numbers Are Smaller Than the Current Number/1365.py b/solutions/1365. How Many Numbers Are Smaller Than the Current Number/1365.py
index b5011455d32..d0b5e339fc3 100644
--- a/solutions/1365. How Many Numbers Are Smaller Than the Current Number/1365.py	
+++ b/solutions/1365. How Many Numbers Are Smaller Than the Current Number/1365.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def smallerNumbersThanCurrent(self, nums: list[int]) -> list[int]:
-    MAX = 100
+  def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
+    kMax = 100
     count = collections.Counter(nums)
 
-    for i in range(1, MAX + 1):
+    for i in range(1, kMax + 1):
       count[i] += count[i - 1]
 
     return [0 if num == 0 else count[num - 1]
diff --git a/solutions/1366. Rank Teams by Votes/1366.cpp b/solutions/1366. Rank Teams by Votes/1366.cpp
index 1610e2e40c7..dae16286027 100644
--- a/solutions/1366. Rank Teams by Votes/1366.cpp	
+++ b/solutions/1366. Rank Teams by Votes/1366.cpp	
@@ -18,8 +18,8 @@ class Solution {
       for (int i = 0; i < teamSize; ++i)
         ++teams[vote[i] - 'A'].rank[i];
 
-    ranges::sort(teams, ranges::greater{}, [](const Team& team) {
-      return pair<vector<int>, char>{team.rank, -team.name};
+    ranges::sort(teams, [](const Team& a, const Team& b) {
+      return a.rank == b.rank ? a.name < b.name : a.rank > b.rank;
     });
 
     for (int i = 0; i < teamSize; ++i)
diff --git a/solutions/1366. Rank Teams by Votes/1366.py b/solutions/1366. Rank Teams by Votes/1366.py
index 34d9ca65407..338d5dfade1 100644
--- a/solutions/1366. Rank Teams by Votes/1366.py	
+++ b/solutions/1366. Rank Teams by Votes/1366.py	
@@ -1,18 +1,11 @@
-from dataclasses import dataclass
-
-
-@dataclass
 class Team:
-  name: str
-  rank: list[int]
-
   def __init__(self, name: str, teamSize: int):
     self.name = name
     self.rank = [0] * teamSize
 
 
 class Solution:
-  def rankTeams(self, votes: list[str]) -> str:
+  def rankTeams(self, votes: List[str]) -> str:
     teamSize = len(votes[0])
     teams = [Team(chr(ord('A') + i), teamSize) for i in range(26)]
 
diff --git a/solutions/1367. Linked List in Binary Tree/1367.py b/solutions/1367. Linked List in Binary Tree/1367.py
index 79589cebf65..2533701aa1e 100644
--- a/solutions/1367. Linked List in Binary Tree/1367.py	
+++ b/solutions/1367. Linked List in Binary Tree/1367.py	
@@ -1,20 +1,16 @@
 class Solution:
-  def isSubPath(self, head: ListNode | None, root: TreeNode | None) -> bool:
+  def isSubPath(self, head: Optional[ListNode], root: Optional[TreeNode]) -> bool:
     if not root:
       return False
-    return (self._isContinuousSubPath(head, root) or
-            self.isSubPath(head, root.left) or
-            self.isSubPath(head, root.right))
+    return self._isContinuousSubPath(head, root) or \
+        self.isSubPath(head, root.left) or \
+        self.isSubPath(head, root.right)
 
-  def _isContinuousSubPath(
-      self,
-      head: ListNode | None,
-      root: TreeNode | None,
-  ) -> bool:
+  def _isContinuousSubPath(self, head: Optional[ListNode], root: Optional[TreeNode]) -> bool:
     if not head:
       return True
     if not root:
       return False
-    return (head.val == root.val and
-            (self._isContinuousSubPath(head.next, root.left) or
-             self._isContinuousSubPath(head.next, root.right)))
+    return head.val == root.val and \
+        (self._isContinuousSubPath(head.next, root.left)
+         or self._isContinuousSubPath(head.next, root.right))
diff --git a/solutions/1368. Minimum Cost to Make at Least One Valid Path in a Grid/1368.cpp b/solutions/1368. Minimum Cost to Make at Least One Valid Path in a Grid/1368.cpp
index 9251676f1c4..cf94ae8c6a7 100644
--- a/solutions/1368. Minimum Cost to Make at Least One Valid Path in a Grid/1368.cpp	
+++ b/solutions/1368. Minimum Cost to Make at Least One Valid Path in a Grid/1368.cpp	
@@ -12,7 +12,7 @@ class Solution {
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs)
+        for (const auto& [dx, dy] : dirs)
           dfs(grid, i + dx, j + dy, cost, q, mem);
       }
 
@@ -20,7 +20,7 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
+  const vector<pair<int, int>> dirs{{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
 
   void dfs(const vector<vector<int>>& grid, int i, int j, int cost,
            queue<pair<int, int>>& q, vector<vector<int>>& mem) {
@@ -31,7 +31,7 @@ class Solution {
 
     mem[i][j] = cost;
     q.emplace(i, j);
-    const auto& [dx, dy] = kDirs[grid[i][j] - 1];
+    const auto [dx, dy] = dirs[grid[i][j] - 1];
     dfs(grid, i + dx, j + dy, cost, q, mem);
   }
 };
diff --git a/solutions/1368. Minimum Cost to Make at Least One Valid Path in a Grid/1368.java b/solutions/1368. Minimum Cost to Make at Least One Valid Path in a Grid/1368.java
index c8e2f181dab..534643f6d5e 100644
--- a/solutions/1368. Minimum Cost to Make at Least One Valid Path in a Grid/1368.java	
+++ b/solutions/1368. Minimum Cost to Make at Least One Valid Path in a Grid/1368.java	
@@ -13,14 +13,14 @@ public int minCost(int[][] grid) {
         Pair<Integer, Integer> pair = q.poll();
         final int i = pair.getKey();
         final int j = pair.getValue();
-        for (int[] dir : DIRS)
+        for (int[] dir : dirs)
           dfs(grid, i + dir[0], j + dir[1], cost, q, mem);
       }
 
     return mem[m - 1][n - 1];
   }
 
-  private static final int[][] DIRS = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
 
   private void dfs(int[][] grid, int i, int j, int cost, Queue<Pair<Integer, Integer>> q,
                    int[][] mem) {
@@ -31,7 +31,7 @@ private void dfs(int[][] grid, int i, int j, int cost, Queue<Pair<Integer, Integ
 
     mem[i][j] = cost;
     q.add(new Pair<>(i, j));
-    int[] dir = DIRS[grid[i][j] - 1];
+    int[] dir = dirs[grid[i][j] - 1];
     dfs(grid, i + dir[0], j + dir[1], cost, q, mem);
   }
 }
diff --git a/solutions/1368. Minimum Cost to Make at Least One Valid Path in a Grid/1368.py b/solutions/1368. Minimum Cost to Make at Least One Valid Path in a Grid/1368.py
index cafed31f55d..2b7642ae653 100644
--- a/solutions/1368. Minimum Cost to Make at Least One Valid Path in a Grid/1368.py	
+++ b/solutions/1368. Minimum Cost to Make at Least One Valid Path in a Grid/1368.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def minCost(self, grid: list[list[int]]) -> int:
+  def minCost(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
-    DIRS = ((0, 1), (0, -1), (1, 0), (-1, 0))
+    dirs = ((0, 1), (0, -1), (1, 0), (-1, 0))
     dp = [[-1] * n for _ in range(m)]
     q = collections.deque()
 
@@ -11,9 +11,10 @@ def dfs(i: int, j: int, cost: int) -> None:
         return
       if dp[i][j] != -1:
         return
+
       dp[i][j] = cost
       q.append((i, j))
-      dx, dy = DIRS[grid[i][j] - 1]
+      dx, dy = dirs[grid[i][j] - 1]
       dfs(i + dx, j + dy, cost)
 
     dfs(0, 0, 0)
@@ -23,7 +24,7 @@ def dfs(i: int, j: int, cost: int) -> None:
       cost += 1
       for _ in range(len(q)):
         i, j = q.popleft()
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           dfs(i + dx, j + dy, cost)
 
     return dp[-1][-1]
diff --git a/solutions/137. Single Number II/137-2.py b/solutions/137. Single Number II/137-2.py
index f3e8bc44542..dbb7edf02ec 100644
--- a/solutions/137. Single Number II/137-2.py	
+++ b/solutions/137. Single Number II/137-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def singleNumber(self, nums: list[int]) -> int:
+  def singleNumber(self, nums: List[int]) -> int:
     ones = 0
     twos = 0
 
diff --git a/solutions/137. Single Number II/137.py b/solutions/137. Single Number II/137.py
index 157d9074e63..781e69552c7 100644
--- a/solutions/137. Single Number II/137.py	
+++ b/solutions/137. Single Number II/137.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def singleNumber(self, nums: list[int]) -> int:
+  def singleNumber(self, nums: List[int]) -> int:
     ones = 0
     twos = 0
 
diff --git a/solutions/1371. Find the Longest Substring Containing Vowels in Even Counts/1371.java b/solutions/1371. Find the Longest Substring Containing Vowels in Even Counts/1371.java
index 3e9da63bb0c..39fbcf78198 100644
--- a/solutions/1371. Find the Longest Substring Containing Vowels in Even Counts/1371.java	
+++ b/solutions/1371. Find the Longest Substring Containing Vowels in Even Counts/1371.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int findTheLongestSubstring(String s) {
-    final String VOWELS = "aeiou";
+    final String kVowels = "aeiou";
     int ans = 0;
     int prefix = 0; // the binary prefix
     Map<Integer, Integer> prefixToIndex = new HashMap<>();
     prefixToIndex.put(0, -1);
 
     for (int i = 0; i < s.length(); ++i) {
-      final int index = VOWELS.indexOf(s.charAt(i));
+      final int index = kVowels.indexOf(s.charAt(i));
       if (index != -1)
         prefix ^= 1 << index;
       prefixToIndex.putIfAbsent(prefix, i);
diff --git a/solutions/1371. Find the Longest Substring Containing Vowels in Even Counts/1371.py b/solutions/1371. Find the Longest Substring Containing Vowels in Even Counts/1371.py
index e8fc74a83d2..2266409ddf7 100644
--- a/solutions/1371. Find the Longest Substring Containing Vowels in Even Counts/1371.py	
+++ b/solutions/1371. Find the Longest Substring Containing Vowels in Even Counts/1371.py	
@@ -1,12 +1,12 @@
 class Solution:
   def findTheLongestSubstring(self, s: str) -> int:
-    VOWELS = 'aeiou'
+    kVowels = 'aeiou'
     ans = 0
     prefix = 0  # the binary prefix
     prefixToIndex = {0: -1}
 
     for i, c in enumerate(s):
-      index = VOWELS.find(c)
+      index = kVowels.find(c)
       if index != -1:
         prefix ^= 1 << index
       prefixToIndex.setdefault(prefix, i)
diff --git a/solutions/1372. Longest ZigZag Path in a Binary Tree/1372.java b/solutions/1372. Longest ZigZag Path in a Binary Tree/1372.java
index 0a2e4bec081..d76e170cda1 100644
--- a/solutions/1372. Longest ZigZag Path in a Binary Tree/1372.java	
+++ b/solutions/1372. Longest ZigZag Path in a Binary Tree/1372.java	
@@ -1,10 +1,20 @@
+class T {
+  public int leftMax;
+  public int rightMax;
+  public int subtreeMax;
+
+  public T(int leftMax, int rightMax, int subtreeMax) {
+    this.leftMax = leftMax;
+    this.rightMax = rightMax;
+    this.subtreeMax = subtreeMax;
+  }
+}
+
 class Solution {
   public int longestZigZag(TreeNode root) {
     return dfs(root).subtreeMax;
   }
 
-  private record T(int leftMax, int rightMax, int subtreeMax) {}
-
   private T dfs(TreeNode root) {
     if (root == null)
       return new T(-1, -1, -1);
diff --git a/solutions/1372. Longest ZigZag Path in a Binary Tree/1372.py b/solutions/1372. Longest ZigZag Path in a Binary Tree/1372.py
index 026a21a5b3a..28a30492fe0 100644
--- a/solutions/1372. Longest ZigZag Path in a Binary Tree/1372.py	
+++ b/solutions/1372. Longest ZigZag Path in a Binary Tree/1372.py	
@@ -1,16 +1,13 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
 class T:
-  leftMax: int
-  rightMax: int
-  subtreeMax: int
+  def __init__(self, leftMax: int, rightMax: int, subtreeMax: int):
+    self.leftMax = leftMax
+    self.rightMax = rightMax
+    self.subtreeMax = subtreeMax
 
 
 class Solution:
-  def longestZigZag(self, root: TreeNode | None) -> int:
-    def dfs(root: TreeNode | None) -> T:
+  def longestZigZag(self, root: Optional[TreeNode]) -> int:
+    def dfs(root: Optional[TreeNode]) -> T:
       if not root:
         return T(-1, -1, -1)
       left = dfs(root.left)
diff --git a/solutions/1373. Maximum Sum BST in Binary Tree/1373.cpp b/solutions/1373. Maximum Sum BST in Binary Tree/1373.cpp
index e9ac4f57226..d18a0f79820 100644
--- a/solutions/1373. Maximum Sum BST in Binary Tree/1373.cpp	
+++ b/solutions/1373. Maximum Sum BST in Binary Tree/1373.cpp	
@@ -1,8 +1,11 @@
 struct T {
-  bool isBST = false;
+  bool isBST;
   int mx;
   int mn;
   int sum;
+  T() : isBST(false) {}
+  T(bool isBST, int mx, int mn, int sum)
+      : isBST(isBST), mx(mx), mn(mn), sum(sum) {}
 };
 
 class Solution {
diff --git a/solutions/1373. Maximum Sum BST in Binary Tree/1373.java b/solutions/1373. Maximum Sum BST in Binary Tree/1373.java
index 039c75a58bf..2f0e5b2be70 100644
--- a/solutions/1373. Maximum Sum BST in Binary Tree/1373.java	
+++ b/solutions/1373. Maximum Sum BST in Binary Tree/1373.java	
@@ -1,11 +1,28 @@
+class T {
+  public boolean isBST;
+  public Integer mx;
+  public Integer mn;
+  public Integer sum;
+  public T() {
+    this.isBST = false;
+    this.mx = null;
+    this.mn = null;
+    this.sum = null;
+  }
+  public T(boolean isBST, int mx, int mn, int sum) {
+    this.isBST = isBST;
+    this.mx = mx;
+    this.mn = mn;
+    this.sum = sum;
+  }
+}
+
 class Solution {
   public int maxSumBST(TreeNode root) {
     traverse(root);
     return ans;
   }
 
-  private record T(boolean isBST, Integer mx, Integer mn, Integer sum) {}
-
   private int ans = 0;
 
   private T traverse(TreeNode root) {
@@ -16,9 +33,9 @@ private T traverse(TreeNode root) {
     T right = traverse(root.right);
 
     if (!left.isBST || !right.isBST)
-      return new T(false, null, null, null);
+      return new T();
     if (root.val <= left.mx || root.val >= right.mn)
-      return new T(false, null, null, null);
+      return new T();
 
     // The `root` is a valid BST.
     final int sum = root.val + left.sum + right.sum;
diff --git a/solutions/1373. Maximum Sum BST in Binary Tree/1373.py b/solutions/1373. Maximum Sum BST in Binary Tree/1373.py
index a62e01d37fd..b89a68a56f9 100644
--- a/solutions/1373. Maximum Sum BST in Binary Tree/1373.py	
+++ b/solutions/1373. Maximum Sum BST in Binary Tree/1373.py	
@@ -1,19 +1,19 @@
-from dataclasses import dataclass
-
-
-@dataclass
 class T:
-  isBST: bool | None = False
-  mx: int | None = None
-  mn: int | None = None
-  summ: int | None = None
+  def __init__(self, isBST: bool = False,
+               mx: Optional[int] = None,
+               mn: Optional[int] = None,
+               sum: Optional[int] = None):
+    self.isBST = isBST
+    self.mx = mx
+    self.mn = mn
+    self.sum = sum
 
 
 class Solution:
-  def maxSumBST(self, root: TreeNode | None) -> int:
+  def maxSumBST(self, root: Optional[TreeNode]) -> int:
     self.ans = 0
 
-    def traverse(root: TreeNode | None) -> T:
+    def traverse(root: Optional[TreeNode]) -> T:
       if not root:
         return T(True, -math.inf, math.inf, 0)
 
@@ -26,7 +26,7 @@ def traverse(root: TreeNode | None) -> T:
         return T()
 
       # The `root` is a valid BST.
-      summ = root.val + left.summ + right.summ
+      summ = root.val + left.sum + right.sum
       self.ans = max(self.ans, summ)
       return T(True, max(root.val, right.mx), min(root.val, left.mn), summ)
 
diff --git a/solutions/1375. Number of Times Binary String Is Prefix-Aligned/1375.py b/solutions/1375. Number of Times Binary String Is Prefix-Aligned/1375.py
index bcb4b79fb0a..8e6892a1259 100644
--- a/solutions/1375. Number of Times Binary String Is Prefix-Aligned/1375.py	
+++ b/solutions/1375. Number of Times Binary String Is Prefix-Aligned/1375.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numTimesAllBlue(self, flips: list[int]) -> int:
+  def numTimesAllBlue(self, flips: List[int]) -> int:
     ans = 0
     rightmost = 0
 
diff --git a/solutions/1376. Time Needed to Inform All Employees/1376.cpp b/solutions/1376. Time Needed to Inform All Employees/1376.cpp
index 558cadbf712..8c2e29861da 100644
--- a/solutions/1376. Time Needed to Inform All Employees/1376.cpp	
+++ b/solutions/1376. Time Needed to Inform All Employees/1376.cpp	
@@ -20,6 +20,6 @@ class Solution {
 
     const int parent = manager[i];
     return mem[i] = informTime[parent] +
-                    dfs(parent, headID, manager, informTime, std::move(mem));
+                    dfs(parent, headID, manager, informTime, move(mem));
   }
 };
diff --git a/solutions/1377. Frog Position After T Seconds/1377.java b/solutions/1377. Frog Position After T Seconds/1377.java
index 67133f29b1f..99d93afa81d 100644
--- a/solutions/1377. Frog Position After T Seconds/1377.java	
+++ b/solutions/1377. Frog Position After T Seconds/1377.java	
@@ -1,7 +1,7 @@
 class Solution {
   public double frogPosition(int n, int[][] edges, int t, int target) {
     List<Integer>[] tree = new List[n + 1];
-    Queue<Integer> q = new ArrayDeque<>(List.of(1));
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(1));
     boolean[] seen = new boolean[n + 1];
     double[] prob = new double[n + 1];
 
diff --git a/solutions/1377. Frog Position After T Seconds/1377.py b/solutions/1377. Frog Position After T Seconds/1377.py
index b88f1649ea9..093cc4431b7 100644
--- a/solutions/1377. Frog Position After T Seconds/1377.py	
+++ b/solutions/1377. Frog Position After T Seconds/1377.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def frogPosition(
-      self,
-      n: int,
-      edges: list[list[int]],
-      t: int,
-      target: int,
-  ) -> float:
+  def frogPosition(self, n: int, edges: List[List[int]], t: int, target: int) -> float:
     tree = [[] for _ in range(n + 1)]
     q = collections.deque([1])
     seen = [False] * (n + 1)
diff --git a/solutions/1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree/1379.py b/solutions/1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree/1379.py
index bc52ab80670..6abad18e063 100644
--- a/solutions/1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree/1379.py	
+++ b/solutions/1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree/1379.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def getTargetCopy(
-      self,
-      original: TreeNode,
-      cloned: TreeNode,
-      target: TreeNode,
-  ) -> TreeNode:
+  def getTargetCopy(self, original: TreeNode, cloned: TreeNode, target: TreeNode) -> TreeNode:
     ans = None
 
     def dfs(original: TreeNode, cloned: TreeNode) -> None:
diff --git a/solutions/1380. Lucky Numbers in a Matrix/1380.py b/solutions/1380. Lucky Numbers in a Matrix/1380.py
index 5df77aba6db..702b487e067 100644
--- a/solutions/1380. Lucky Numbers in a Matrix/1380.py	
+++ b/solutions/1380. Lucky Numbers in a Matrix/1380.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def luckyNumbers(self, matrix: list[list[int]]) -> list[int]:
+  def luckyNumbers(self, matrix: List[List[int]]) -> List[int]:
     for row in matrix:
       minIndex = row.index(min(row))
       if row[minIndex] == max(list(zip(*matrix))[minIndex]):
diff --git a/solutions/1382. Balance a Binary Search Tree/1382.py b/solutions/1382. Balance a Binary Search Tree/1382.py
index 55418a67fea..7e37e62ea13 100644
--- a/solutions/1382. Balance a Binary Search Tree/1382.py	
+++ b/solutions/1382. Balance a Binary Search Tree/1382.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def balanceBST(self, root: TreeNode | None) -> TreeNode | None:
+  def balanceBST(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
     nums = []
 
-    def inorder(root: TreeNode | None) -> None:
+    def inorder(root: Optional[TreeNode]) -> None:
       if not root:
         return
       inorder(root.left)
@@ -12,7 +12,7 @@ def inorder(root: TreeNode | None) -> None:
     inorder(root)
 
     # Same as 108. Convert Sorted Array to Binary Search Tree
-    def build(l: int, r: int) -> TreeNode | None:
+    def build(l: int, r: int) -> Optional[TreeNode]:
       if l > r:
         return None
       m = (l + r) // 2
diff --git a/solutions/1383. Maximum Performance of a Team/1383.java b/solutions/1383. Maximum Performance of a Team/1383.java
index a353e28cd70..ea219f7ce16 100644
--- a/solutions/1383. Maximum Performance of a Team/1383.java	
+++ b/solutions/1383. Maximum Performance of a Team/1383.java	
@@ -1,7 +1,7 @@
 class Solution {
   // Similar to 857. Minimum Cost to Hire K Workers
   public int maxPerformance(int n, int[] speed, int[] efficiency, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long ans = 0;
     long speedSum = 0;
     // (efficiency[i], speed[i]) sorted by efficiency[i] in descending order
@@ -11,7 +11,7 @@ public int maxPerformance(int n, int[] speed, int[] efficiency, int k) {
     for (int i = 0; i < n; ++i)
       A[i] = new Pair<>(efficiency[i], speed[i]);
 
-    Arrays.sort(A, Comparator.comparingInt(Pair::getKey).reversed());
+    Arrays.sort(A, (a, b) -> Integer.compare(b.getKey(), a.getKey()));
 
     for (Pair<Integer, Integer> a : A) {
       final int e = a.getKey();
@@ -23,6 +23,6 @@ public int maxPerformance(int n, int[] speed, int[] efficiency, int k) {
       ans = Math.max(ans, speedSum * e);
     }
 
-    return (int) (ans % MOD);
+    return (int) (ans % kMod);
   }
 }
diff --git a/solutions/1383. Maximum Performance of a Team/1383.py b/solutions/1383. Maximum Performance of a Team/1383.py
index f1e2d65d7f5..fb9f62b3954 100644
--- a/solutions/1383. Maximum Performance of a Team/1383.py	
+++ b/solutions/1383. Maximum Performance of a Team/1383.py	
@@ -1,13 +1,7 @@
 class Solution:
   # Similar to 857. Minimum Cost to Hire K Workers
-  def maxPerformance(
-      self,
-      n: int,
-      speed: list[int],
-      efficiency: list[int],
-      k: int,
-  ) -> int:
-    MOD = 1_000_000_007
+  def maxPerformance(self, n: int, speed: List[int], efficiency: List[int], k: int) -> int:
+    kMod = 1_000_000_007
     ans = 0
     speedSum = 0
     # (efficiency[i], speed[i]) sorted by efficiency[i] in descending order
@@ -21,4 +15,4 @@ def maxPerformance(
         speedSum -= heapq.heappop(minHeap)
       ans = max(ans, speedSum * e)
 
-    return ans % MOD
+    return ans % kMod
diff --git a/solutions/1385. Find the Distance Value Between Two Arrays/1385.py b/solutions/1385. Find the Distance Value Between Two Arrays/1385.py
index 6ed106955d4..6f411ba4e76 100644
--- a/solutions/1385. Find the Distance Value Between Two Arrays/1385.py	
+++ b/solutions/1385. Find the Distance Value Between Two Arrays/1385.py	
@@ -1,18 +1,12 @@
 class Solution:
-  def findTheDistanceValue(
-      self,
-      arr1: list[int],
-      arr2: list[int],
-      d: int,
-  ) -> int:
+  def findTheDistanceValue(self, arr1: List[int], arr2: List[int], d: int) -> int:
     ans = 0
 
     arr2.sort()
 
     for a in arr1:
       i = bisect.bisect_left(arr2, a)
-      if ((i == len(arr2) or arr2[i] - a > d) and
-              (i == 0 or a - arr2[i - 1] > d)):
+      if (i == len(arr2) or arr2[i] - a > d) and (i == 0 or a - arr2[i - 1] > d):
         ans += 1
 
     return ans
diff --git a/solutions/1386. Cinema Seat Allocation/1386.py b/solutions/1386. Cinema Seat Allocation/1386.py
index b0c513ea476..76eb48b45a4 100644
--- a/solutions/1386. Cinema Seat Allocation/1386.py	
+++ b/solutions/1386. Cinema Seat Allocation/1386.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxNumberOfFamilies(self, n: int, reservedSeats: list[list[int]]) -> int:
+  def maxNumberOfFamilies(self, n: int, reservedSeats: List[List[int]]) -> int:
     ans = 0
     rowToSeats = collections.Counter()
 
@@ -10,9 +10,9 @@ def maxNumberOfFamilies(self, n: int, reservedSeats: list[list[int]]) -> int:
       if (seats & 0b0111111110) == 0:
         # Can fit 2 four-person groups.
         ans += 2
-      elif ((seats & 0b0111100000) == 0 or
-            (seats & 0b0001111000) == 0 or
-            (seats & 0b0000011110) == 0):
+      elif (seats & 0b0111100000) == 0 \
+              or (seats & 0b0001111000) == 0 \
+              or (seats & 0b0000011110) == 0:
         # Can fit 1 four-person group.
         ans += 1
 
diff --git a/solutions/1387. Sort Integers by The Power Value/1387.java b/solutions/1387. Sort Integers by The Power Value/1387.java
index bfa7c018067..5ee5430ee62 100644
--- a/solutions/1387. Sort Integers by The Power Value/1387.java	
+++ b/solutions/1387. Sort Integers by The Power Value/1387.java	
@@ -5,7 +5,7 @@ public int getKth(int lo, int hi, int k) {
     for (int i = lo; i <= hi; ++i)
       powAndVals[i - lo] = new int[] {getPow(i), i};
 
-    Arrays.sort(powAndVals, Comparator.comparingInt(powAndVal -> powAndVal[0]));
+    Arrays.sort(powAndVals, (a, b) -> a[0] - b[0]);
     return powAndVals[k - 1][1];
   }
 
diff --git a/solutions/1388. Pizza With 3n Slices/1388.py b/solutions/1388. Pizza With 3n Slices/1388.py
index 2fe72dafee6..6feda68ec5a 100644
--- a/solutions/1388. Pizza With 3n Slices/1388.py	
+++ b/solutions/1388. Pizza With 3n Slices/1388.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSizeSlices(self, slices: list[int]) -> int:
+  def maxSizeSlices(self, slices: List[int]) -> int:
     @functools.lru_cache(None)
     def dp(i: int, j: int, k: int) -> int:
       """
diff --git a/solutions/139. Word Break/139-2.cpp b/solutions/139. Word Break/139-2.cpp
index 6c6a62d3210..a80344178c3 100644
--- a/solutions/139. Word Break/139-2.cpp	
+++ b/solutions/139. Word Break/139-2.cpp	
@@ -16,7 +16,7 @@ class Solution {
 
     for (int j = i + 1; j <= s.length(); ++j)
       if (wordSet.contains(s.substr(i, j - i)) &&
-          wordBreak(s, j, std::move(wordSet), std::move(mem)))
+          wordBreak(s, j, move(wordSet), move(mem)))
         return mem[i] = 1;
 
     return mem[i] = 0;
diff --git a/solutions/139. Word Break/139-2.py b/solutions/139. Word Break/139-2.py
index 57b55c567fd..7e04410425f 100644
--- a/solutions/139. Word Break/139-2.py	
+++ b/solutions/139. Word Break/139-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def wordBreak(self, s: str, wordDict: list[str]) -> bool:
+  def wordBreak(self, s: str, wordDict: List[str]) -> bool:
     wordSet = set(wordDict)
 
     @functools.lru_cache(None)
@@ -7,7 +7,6 @@ def wordBreak(i: int) -> bool:
       """Returns True if s[i..n) can be segmented."""
       if i == len(s):
         return True
-      return any(s[i:j] in wordSet and wordBreak(j)
-                 for j in range(i + 1, len(s) + 1))
+      return any(s[i:j] in wordSet and wordBreak(j) for j in range(i + 1, len(s) + 1))
 
     return wordBreak(0)
diff --git a/solutions/139. Word Break/139-3.py b/solutions/139. Word Break/139-3.py
index 52142beb242..db3afcee63c 100644
--- a/solutions/139. Word Break/139-3.py	
+++ b/solutions/139. Word Break/139-3.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def wordBreak(self, s: str, wordDict: list[str]) -> bool:
+  def wordBreak(self, s: str, wordDict: List[str]) -> bool:
     n = len(s)
     wordSet = set(wordDict)
     # dp[i] := True if s[0..i) can be segmented
diff --git a/solutions/139. Word Break/139-4.cpp b/solutions/139. Word Break/139-4.cpp
index 33404eeda0d..1c78f3f533e 100644
--- a/solutions/139. Word Break/139-4.cpp	
+++ b/solutions/139. Word Break/139-4.cpp	
@@ -25,9 +25,8 @@ class Solution {
 
  private:
   int getMaxLength(const vector<string>& wordDict) {
-    return ranges::max_element(wordDict, ranges::less{},
-                               [](const string& word) {
-      return word.length();
+    return ranges::max_element(wordDict, [](const string& a, const string& b) {
+      return a.length() < b.length();
     })->length();
   }
 };
diff --git a/solutions/139. Word Break/139-4.py b/solutions/139. Word Break/139-4.py
index f380ed30475..9d56f8e0e6c 100644
--- a/solutions/139. Word Break/139-4.py	
+++ b/solutions/139. Word Break/139-4.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def wordBreak(self, s: str, wordDict: list[str]) -> bool:
+  def wordBreak(self, s: str, wordDict: List[str]) -> bool:
     n = len(s)
     maxLength = len(max(wordDict, key=len))
     wordSet = set(wordDict)
@@ -7,7 +7,7 @@ def wordBreak(self, s: str, wordDict: list[str]) -> bool:
     dp = [True] + [False] * n
 
     for i in range(1, n + 1):
-      for j in range(i - 1, -1, -1):
+      for j in reversed(range(i)):
         if i - j > maxLength:
           break
         # s[0..j) can be segmented and s[j..i) is in the wordSet, so s[0..i)
diff --git a/solutions/139. Word Break/139.cpp b/solutions/139. Word Break/139.cpp
index 91dde94fbd2..9bf791c4a65 100644
--- a/solutions/139. Word Break/139.cpp	
+++ b/solutions/139. Word Break/139.cpp	
@@ -17,7 +17,7 @@ class Solution {
       const string& prefix = s.substr(0, i);
       const string& suffix = s.substr(i);
       if (wordSet.contains(prefix) &&
-          wordBreak(suffix, std::move(wordSet), std::move(mem)))
+          wordBreak(suffix, move(wordSet), move(mem)))
         return mem[s] = true;
     }
 
diff --git a/solutions/139. Word Break/139.py b/solutions/139. Word Break/139.py
index 8eadafd8008..9bdf82086ba 100644
--- a/solutions/139. Word Break/139.py	
+++ b/solutions/139. Word Break/139.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def wordBreak(self, s: str, wordDict: list[str]) -> bool:
+  def wordBreak(self, s: str, wordDict: List[str]) -> bool:
     wordSet = set(wordDict)
 
     @functools.lru_cache(None)
diff --git a/solutions/1390. Four Divisors/1390.py b/solutions/1390. Four Divisors/1390.py
index c34d3c72fd8..8b21976fa5d 100644
--- a/solutions/1390. Four Divisors/1390.py	
+++ b/solutions/1390. Four Divisors/1390.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sumFourDivisors(self, nums: list[int]) -> int:
+  def sumFourDivisors(self, nums: List[int]) -> int:
     ans = 0
 
     for num in nums:
diff --git a/solutions/1392. Longest Happy Prefix/1392.cpp b/solutions/1392. Longest Happy Prefix/1392.cpp
index 19139508797..d6772469755 100644
--- a/solutions/1392. Longest Happy Prefix/1392.cpp	
+++ b/solutions/1392. Longest Happy Prefix/1392.cpp	
@@ -2,8 +2,7 @@ class Solution {
  public:
   string longestPrefix(string s) {
     constexpr int kBase = 26;
-    constexpr long kHash = 8'417'508'174'513;
-
+    constexpr int kMod = 1'000'000'007;
     const int n = s.length();
     int maxLength = 0;
     long pow = 1;
@@ -11,9 +10,9 @@ class Solution {
     long suffixHash = 0;  // the hash of s[j..n)
 
     for (int i = 0, j = n - 1; i < n - 1; ++i, --j) {
-      prefixHash = (prefixHash * kBase + val(s[i])) % kHash;
-      suffixHash = (val(s[j]) * pow + suffixHash) % kHash;
-      pow = pow * kBase % kHash;
+      prefixHash = (prefixHash * kBase + val(s[i])) % kMod;
+      suffixHash = (val(s[j]) * pow + suffixHash) % kMod;
+      pow = pow * kBase % kMod;
       if (prefixHash == suffixHash)
         maxLength = i + 1;
     }
diff --git a/solutions/1392. Longest Happy Prefix/1392.java b/solutions/1392. Longest Happy Prefix/1392.java
index db6e4d2d9d9..d0f2a839a61 100644
--- a/solutions/1392. Longest Happy Prefix/1392.java	
+++ b/solutions/1392. Longest Happy Prefix/1392.java	
@@ -1,7 +1,7 @@
 class Solution {
   public String longestPrefix(String s) {
-    final int BASE = 26;
-    final long HASH = 8_417_508_174_513L;
+    final int kBase = 26;
+    final int kMod = 1_000_000_007;
     final int n = s.length();
     int maxLength = 0;
     long pow = 1;
@@ -9,9 +9,9 @@ public String longestPrefix(String s) {
     long suffixHash = 0; // the hash of s[j..n)
 
     for (int i = 0, j = n - 1; i < n - 1; ++i, --j) {
-      prefixHash = (prefixHash * BASE + val(s.charAt(i))) % HASH;
-      suffixHash = (val(s.charAt(j)) * pow + suffixHash) % HASH;
-      pow = pow * BASE % HASH;
+      prefixHash = (prefixHash * kBase + val(s.charAt(i))) % kMod;
+      suffixHash = (val(s.charAt(j)) * pow + suffixHash) % kMod;
+      pow = pow * kBase % kMod;
       if (prefixHash == suffixHash)
         maxLength = i + 1;
     }
diff --git a/solutions/1392. Longest Happy Prefix/1392.py b/solutions/1392. Longest Happy Prefix/1392.py
index 506c76bfd5c..4bd55c9f223 100644
--- a/solutions/1392. Longest Happy Prefix/1392.py	
+++ b/solutions/1392. Longest Happy Prefix/1392.py	
@@ -1,7 +1,7 @@
 class Solution:
   def longestPrefix(self, s: str) -> str:
-    BASE = 26
-    HASH = 8_417_508_174_513
+    kBase = 26
+    kMod = 1_000_000_007
     n = len(s)
     maxLength = 0
     pow = 1
@@ -13,9 +13,9 @@ def val(c: str) -> int:
 
     j = n - 1
     for i in range(n - 1):
-      prefixHash = (prefixHash * BASE + val(s[i])) % HASH
-      suffixHash = (val(s[j]) * pow + suffixHash) % HASH
-      pow = pow * BASE % HASH
+      prefixHash = (prefixHash * kBase + val(s[i])) % kMod
+      suffixHash = (val(s[j]) * pow + suffixHash) % kMod
+      pow = pow * kBase % kMod
       if prefixHash == suffixHash:
         maxLength = i + 1
       j -= 1
diff --git a/solutions/1394. Find Lucky Integer in an Array/1394.py b/solutions/1394. Find Lucky Integer in an Array/1394.py
index 0794bc1e51b..4d69cad83cc 100644
--- a/solutions/1394. Find Lucky Integer in an Array/1394.py	
+++ b/solutions/1394. Find Lucky Integer in an Array/1394.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLucky(self, arr: list[int]) -> int:
+  def findLucky(self, arr: List[int]) -> int:
     count = [0] * (len(arr) + 1)
 
     for a in arr:
diff --git a/solutions/1395. Count Number of Teams/1395.py b/solutions/1395. Count Number of Teams/1395.py
index 9de5227297d..9f2d99a239e 100644
--- a/solutions/1395. Count Number of Teams/1395.py	
+++ b/solutions/1395. Count Number of Teams/1395.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numTeams(self, rating: list[int]) -> int:
+  def numTeams(self, rating: List[int]) -> int:
     ans = 0
 
     for i in range(1, len(rating) - 1):
diff --git a/solutions/1397. Find All Good Strings/1397.java b/solutions/1397. Find All Good Strings/1397.java
index fd2af2d2a81..780c19ede49 100644
--- a/solutions/1397. Find All Good Strings/1397.java	
+++ b/solutions/1397. Find All Good Strings/1397.java	
@@ -7,7 +7,7 @@ public int findGoodStrings(int n, String s1, String s2, String evil) {
     return count(s1, s2, evil, 0, 0, true, true, getLPS(evil), nextMatchedCount, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of good strings for s[i..n), where there're j matches
   // with `evil`, `isS1Prefix` indicates if the current letter is tightly bound
@@ -35,7 +35,7 @@ private int count(final String s1, final String s2, final String evil, int i,
       mem[i][matchedEvilCount][k1][k2] +=
           count(s1, s2, evil, i + 1, nextMatchedEvilCount, isS1Prefix && c == s1.charAt(i),
                 isS2Prefix && c == s2.charAt(i), evilLPS, nextMatchedCount, mem);
-      mem[i][matchedEvilCount][k1][k2] %= MOD;
+      mem[i][matchedEvilCount][k1][k2] %= kMod;
     }
     return mem[i][matchedEvilCount][k1][k2];
   }
diff --git a/solutions/1397. Find All Good Strings/1397.py b/solutions/1397. Find All Good Strings/1397.py
index 019bdf214fd..6da2407b5ed 100644
--- a/solutions/1397. Find All Good Strings/1397.py	
+++ b/solutions/1397. Find All Good Strings/1397.py	
@@ -1,6 +1,6 @@
 class Solution:
   def findGoodStrings(self, n: int, s1: str, s2: str, evil: str) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     evilLPS = self._getLPS(evil)
 
     @functools.lru_cache(None)
@@ -36,12 +36,12 @@ def dp(i: int, matchedEvilCount: int, isS1Prefix: bool, isS2Prefix: bool) -> int
         ans += dp(i + 1, nextMatchedEvilCount,
                   isS1Prefix and c == s1[i],
                   isS2Prefix and c == s2[i])
-        ans %= MOD
+        ans %= kMod
       return ans
 
     return dp(0, 0, True, True)
 
-  def _getLPS(self, pattern: str) -> list[int]:
+  def _getLPS(self, pattern: str) -> List[int]:
     """
     Returns the lps array, where lps[i] is the length of the longest prefix of
     pattern[0..i] which is also a suffix of this substring.
diff --git a/solutions/14. Longest Common Prefix/14.py b/solutions/14. Longest Common Prefix/14.py
index 56a6e16848f..a17772d893d 100644
--- a/solutions/14. Longest Common Prefix/14.py	
+++ b/solutions/14. Longest Common Prefix/14.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestCommonPrefix(self, strs: list[str]) -> str:
+  def longestCommonPrefix(self, strs: List[str]) -> str:
     if not strs:
       return ''
 
diff --git a/solutions/140. Word Break II/140.py b/solutions/140. Word Break II/140.py
index cf629c4c538..ca2c2cbebae 100644
--- a/solutions/140. Word Break II/140.py	
+++ b/solutions/140. Word Break II/140.py	
@@ -1,14 +1,14 @@
 class Solution:
-  def wordBreak(self, s: str, wordDict: list[str]) -> list[str]:
+  def wordBreak(self, s: str, wordDict: List[str]) -> List[str]:
     wordSet = set(wordDict)
 
     @functools.lru_cache(None)
-    def wordBreak(s: str) -> list[str]:
+    def wordBreak(s: str) -> List[str]:
       ans = []
 
       # 1 <= len(prefix) < len(s)
       for i in range(1, len(s)):
-        prefix = s[:i]
+        prefix = s[0:i]
         suffix = s[i:]
         if prefix in wordSet:
           for word in wordBreak(suffix):
diff --git a/solutions/1402. Reducing Dishes/1402.py b/solutions/1402. Reducing Dishes/1402.py
index 99aac3dcd11..3ce980bad56 100644
--- a/solutions/1402. Reducing Dishes/1402.py	
+++ b/solutions/1402. Reducing Dishes/1402.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSatisfaction(self, satisfaction: list[int]) -> int:
+  def maxSatisfaction(self, satisfaction: List[int]) -> int:
     ans = 0
     sumSatisfaction = 0
 
diff --git a/solutions/1403. Minimum Subsequence in Non-Increasing Order/1403.py b/solutions/1403. Minimum Subsequence in Non-Increasing Order/1403.py
index b2abd056972..f400c68a85d 100644
--- a/solutions/1403. Minimum Subsequence in Non-Increasing Order/1403.py	
+++ b/solutions/1403. Minimum Subsequence in Non-Increasing Order/1403.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minSubsequence(self, nums: list[int]) -> list[int]:
+  def minSubsequence(self, nums: List[int]) -> List[int]:
     ans = []
     maxHeap = [-num for num in nums]
     heapq.heapify(maxHeap)
diff --git a/solutions/1406. Stone Game III/1406-2.py b/solutions/1406. Stone Game III/1406-2.py
index f4a20058d53..6ecdc972a05 100644
--- a/solutions/1406. Stone Game III/1406-2.py	
+++ b/solutions/1406. Stone Game III/1406-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def stoneGameIII(self, stoneValue: list[int]) -> str:
+  def stoneGameIII(self, stoneValue: List[int]) -> str:
     n = len(stoneValue)
     # dp[i] := the maximum relative score Alice can make with stoneValue[i..n)
     dp = [-math.inf] * n + [0]
diff --git a/solutions/1406. Stone Game III/1406.py b/solutions/1406. Stone Game III/1406.py
index a9cac597c51..b40a55e7863 100644
--- a/solutions/1406. Stone Game III/1406.py	
+++ b/solutions/1406. Stone Game III/1406.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def stoneGameIII(self, stoneValue: list[int]) -> str:
+  def stoneGameIII(self, stoneValue: List[int]) -> str:
     @functools.lru_cache(None)
     def dp(i: int) -> int:
       """
diff --git a/solutions/1408. String Matching in an Array/1408-2.cpp b/solutions/1408. String Matching in an Array/1408-2.cpp
index 4ad5e535236..70f9b4f11c2 100644
--- a/solutions/1408. String Matching in an Array/1408-2.cpp	
+++ b/solutions/1408. String Matching in an Array/1408-2.cpp	
@@ -36,8 +36,9 @@ class Solution {
     vector<string> ans;
     Trie trie;
 
-    ranges::sort(words, ranges::greater{},
-                 [](const string& word) { return word.length(); });
+    ranges::sort(words, [](const string& a, const string& b) {
+      return a.length() > b.length();
+    });
 
     for (const string& word : words) {
       if (trie.search(word))
diff --git a/solutions/1408. String Matching in an Array/1408-2.java b/solutions/1408. String Matching in an Array/1408-2.java
index 67057e0a6ac..b456a21530d 100644
--- a/solutions/1408. String Matching in an Array/1408-2.java	
+++ b/solutions/1408. String Matching in an Array/1408-2.java	
@@ -3,7 +3,7 @@ class TrieNode {
 }
 
 class Trie {
-  public void insert(final String word) {
+  public void insert(String word) {
     TrieNode node = root;
     for (final char c : word.toCharArray()) {
       final int i = c - 'a';
@@ -13,7 +13,7 @@ public void insert(final String word) {
     }
   }
 
-  public boolean search(final String word) {
+  public boolean search(String word) {
     TrieNode node = root;
     for (final char c : word.toCharArray()) {
       final int i = c - 'a';
@@ -32,7 +32,7 @@ public List<String> stringMatching(String[] words) {
     List<String> ans = new ArrayList<>();
     Trie trie = new Trie();
 
-    Arrays.sort(words, Comparator.comparingInt(String::length).reversed());
+    Arrays.sort(words, (a, b) -> b.length() - a.length());
 
     for (final String word : words) {
       if (trie.search(word))
diff --git a/solutions/1408. String Matching in an Array/1408-2.py b/solutions/1408. String Matching in an Array/1408-2.py
index 2fedb5e757a..df6454c3a40 100644
--- a/solutions/1408. String Matching in an Array/1408-2.py	
+++ b/solutions/1408. String Matching in an Array/1408-2.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
 
 
 class Trie:
@@ -22,7 +22,7 @@ def search(self, word: str) -> bool:
 
 
 class Solution:
-  def stringMatching(self, words: list[str]) -> list[str]:
+  def stringMatching(self, words: List[str]) -> List[str]:
     ans = []
     trie = Trie()
 
diff --git a/solutions/1408. String Matching in an Array/1408-3.java b/solutions/1408. String Matching in an Array/1408-3.java
index d8a1354bbbe..22368173b9b 100644
--- a/solutions/1408. String Matching in an Array/1408-3.java	
+++ b/solutions/1408. String Matching in an Array/1408-3.java	
@@ -4,7 +4,7 @@ class TrieNode {
 }
 
 class Trie {
-  public void insert(final String word) {
+  public void insert(String word) {
     TrieNode node = root;
     for (final char c : word.toCharArray()) {
       final int i = c - 'a';
@@ -15,7 +15,7 @@ public void insert(final String word) {
     }
   }
 
-  public boolean search(final String word) {
+  public boolean search(String word) {
     TrieNode node = root;
     for (final char c : word.toCharArray()) {
       final int i = c - 'a';
diff --git a/solutions/1408. String Matching in an Array/1408-3.py b/solutions/1408. String Matching in an Array/1408-3.py
index ac20f6c95c0..22d18afacb0 100644
--- a/solutions/1408. String Matching in an Array/1408-3.py	
+++ b/solutions/1408. String Matching in an Array/1408-3.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
     self.count = 0
 
 
@@ -24,7 +24,7 @@ def search(self, word: str) -> bool:
 
 
 class Solution:
-  def stringMatching(self, words: list[str]) -> list[str]:
+  def stringMatching(self, words: List[str]) -> List[str]:
     trie = Trie()
 
     for word in words:
diff --git a/solutions/1408. String Matching in an Array/1408.py b/solutions/1408. String Matching in an Array/1408.py
index 848a55ba857..3c61029451d 100644
--- a/solutions/1408. String Matching in an Array/1408.py	
+++ b/solutions/1408. String Matching in an Array/1408.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def stringMatching(self, words: list[str]) -> list[str]:
+  def stringMatching(self, words: List[str]) -> List[str]:
     ans = []
     for a in words:
       for b in words:
diff --git a/solutions/1409. Queries on a Permutation With Key/1409.py b/solutions/1409. Queries on a Permutation With Key/1409.py
index 663bcac4978..8c74cc5a54a 100644
--- a/solutions/1409. Queries on a Permutation With Key/1409.py	
+++ b/solutions/1409. Queries on a Permutation With Key/1409.py	
@@ -20,7 +20,7 @@ def lowbit(i: int) -> int:
 
 
 class Solution:
-  def processQueries(self, queries: list[int], m: int) -> list[int]:
+  def processQueries(self, queries: List[int], m: int) -> List[int]:
     ans = []
     # Map [-m, m] to [0, 2 * m].
     tree = FenwickTree(2 * m + 1)
diff --git a/solutions/141. Linked List Cycle/141.java b/solutions/141. Linked List Cycle/141.java
index 993ff2c074c..f75d68bcf1e 100644
--- a/solutions/141. Linked List Cycle/141.java	
+++ b/solutions/141. Linked List Cycle/141.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public boolean hasCycle(ListNode head) {
     ListNode slow = head;
     ListNode fast = head;
diff --git "a/solutions/1411. Number of Ways to Paint N \303\227 3 Grid/1411.java" "b/solutions/1411. Number of Ways to Paint N \303\227 3 Grid/1411.java"
index 0e6350c6f0a..a6b62d4558a 100644
--- "a/solutions/1411. Number of Ways to Paint N \303\227 3 Grid/1411.java"	
+++ "b/solutions/1411. Number of Ways to Paint N \303\227 3 Grid/1411.java"	
@@ -1,16 +1,16 @@
 class Solution {
   public int numOfWays(int n) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long color2 = 6; // 121, 131, 212, 232, 313, 323
     long color3 = 6; // 123, 132, 213, 231, 312, 321
 
     for (int i = 1; i < n; ++i) {
       final long nextColor2 = color2 * 3 + color3 * 2;
       final long nextColor3 = color2 * 2 + color3 * 2;
-      color2 = nextColor2 % MOD;
-      color3 = nextColor3 % MOD;
+      color2 = nextColor2 % kMod;
+      color3 = nextColor3 % kMod;
     }
 
-    return (int) ((color2 + color3) % MOD);
+    return (int) ((color2 + color3) % kMod);
   }
 }
diff --git a/solutions/1413. Minimum Value to Get Positive Step by Step Sum/1413.py b/solutions/1413. Minimum Value to Get Positive Step by Step Sum/1413.py
index 27aa8c553e4..f6880f328e9 100644
--- a/solutions/1413. Minimum Value to Get Positive Step by Step Sum/1413.py	
+++ b/solutions/1413. Minimum Value to Get Positive Step by Step Sum/1413.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minStartValue(self, nums: list[int]) -> int:
+  def minStartValue(self, nums: List[int]) -> int:
     summ = 0
     minSum = 0
 
diff --git a/solutions/1415. The k-th Lexicographical String of All Happy Strings of Length n/1415.java b/solutions/1415. The k-th Lexicographical String of All Happy Strings of Length n/1415.java
index 65118b30fa2..d644b9d6bc1 100644
--- a/solutions/1415. The k-th Lexicographical String of All Happy Strings of Length n/1415.java	
+++ b/solutions/1415. The k-th Lexicographical String of All Happy Strings of Length n/1415.java	
@@ -1,7 +1,7 @@
 class Solution {
   public String getHappyString(int n, int k) {
     Map<Character, String> nextLetters = Map.of('a', "bc", 'b', "ac", 'c', "ab");
-    Queue<String> q = new ArrayDeque<>(List.of("a", "b", "c"));
+    Queue<String> q = new ArrayDeque<>(Arrays.asList("a", "b", "c"));
 
     while (q.peek().length() != n) {
       final String u = q.poll();
diff --git a/solutions/1418. Display Table of Food Orders in a Restaurant/1418.cpp b/solutions/1418. Display Table of Food Orders in a Restaurant/1418.cpp
index 596c299ed27..f13b201c45e 100644
--- a/solutions/1418. Display Table of Food Orders in a Restaurant/1418.cpp	
+++ b/solutions/1418. Display Table of Food Orders in a Restaurant/1418.cpp	
@@ -20,8 +20,10 @@ class Solution {
 
     // Sort the first row and the column, except ans[0][0].
     sort(ans[0].begin() + 1, ans[0].end());
-    ranges::sort(ans.begin() + 1, ans.end(), ranges::less{},
-                 [](const vector<string>& cols) { return stoi(cols[0]); });
+    sort(ans.begin() + 1, ans.end(),
+         [](const vector<string>& a, const vector<string>& b) {
+      return stoi(a[0]) < stoi(b[0]);
+    });
 
     // Set the indices after sorting.
     for (int i = 0; i < tableNumberToRowIndex.size(); ++i)
diff --git a/solutions/1419. Minimum Number of Frogs Croaking/1419.java b/solutions/1419. Minimum Number of Frogs Croaking/1419.java
index 0cfca107b89..ec66b7b6a8f 100644
--- a/solutions/1419. Minimum Number of Frogs Croaking/1419.java	
+++ b/solutions/1419. Minimum Number of Frogs Croaking/1419.java	
@@ -1,12 +1,12 @@
 class Solution {
   public int minNumberOfFrogs(String croakOfFrogs) {
-    final String CROAK = "croak";
+    final String kCroak = "croak";
     int ans = 0;
     int frogs = 0;
     int[] count = new int[5];
 
     for (final char c : croakOfFrogs.toCharArray()) {
-      ++count[CROAK.indexOf(c)];
+      ++count[kCroak.indexOf(c)];
       for (int i = 1; i < 5; ++i)
         if (count[i] > count[i - 1])
           return -1;
diff --git a/solutions/1419. Minimum Number of Frogs Croaking/1419.py b/solutions/1419. Minimum Number of Frogs Croaking/1419.py
index 37dee9443b1..01864c24e8b 100644
--- a/solutions/1419. Minimum Number of Frogs Croaking/1419.py	
+++ b/solutions/1419. Minimum Number of Frogs Croaking/1419.py	
@@ -1,12 +1,12 @@
 class Solution:
   def minNumberOfFrogs(self, croakOfFrogs: str) -> int:
-    CROAK = 'croak'
+    kCroak = 'croak'
     ans = 0
     frogs = 0
     count = [0] * 5
 
     for c in croakOfFrogs:
-      count[CROAK.index(c)] += 1
+      count[kCroak.index(c)] += 1
       if any(count[i] > count[i - 1] for i in range(1, 5)):
         return -1
       if c == 'c':
diff --git a/solutions/142. Linked List Cycle II/142.java b/solutions/142. Linked List Cycle II/142.java
index f7004a4e5c3..fc6f3e830d2 100644
--- a/solutions/142. Linked List Cycle II/142.java	
+++ b/solutions/142. Linked List Cycle II/142.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public ListNode detectCycle(ListNode head) {
     ListNode slow = head;
     ListNode fast = head;
diff --git a/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420-2.java b/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420-2.java
index 683f98204d7..f2e10154426 100644
--- a/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420-2.java	
+++ b/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numOfArrays(int n, int m, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i][j][k] := the number of ways to build an array of length i, where j
     // is the maximum number and k is the `search_cost`
     int[][][] dp = new int[n + 1][m + 1][k + 1];
@@ -19,14 +19,14 @@ public int numOfArrays(int n, int m, int k) {
           //    maximum and cost.
           // 2. Appending j in the i-th position makes j the new max and cost 1.
           dp[i][j][cost] =
-              (int) (((long) j * dp[i - 1][j][cost] + prefix[i - 1][j - 1][cost - 1]) % MOD);
-          prefix[i][j][cost] = (dp[i][j][cost] + prefix[i][j - 1][cost]) % MOD;
+              (int) (((long) j * dp[i - 1][j][cost] + prefix[i - 1][j - 1][cost - 1]) % kMod);
+          prefix[i][j][cost] = (dp[i][j][cost] + prefix[i][j - 1][cost]) % kMod;
         }
 
     int ans = 0;
     for (int j = 1; j <= m; ++j) {
       ans += dp[n][j][k];
-      ans %= MOD;
+      ans %= kMod;
     }
     return ans;
   }
diff --git a/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420-2.py b/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420-2.py
index 13edd607a0d..4d60e724a7d 100644
--- a/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420-2.py	
+++ b/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420-2.py	
@@ -1,6 +1,6 @@
 class Solution:
   def numOfArrays(self, n: int, m: int, k: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # dp[i][j][k] := the number of ways to build an array of length i, where j
     # is the maximum number and k is the `search_cost`
     dp = [[[0] * (k + 1) for j in range(m + 1)] for _ in range(n + 1)]
@@ -18,7 +18,7 @@ def numOfArrays(self, n: int, m: int, k: int) -> int:
           #    maximum and cost.
           # 2. Appending j in the i-th position makes j the new max and cost 1.
           dp[i][j][cost] = (j * dp[i - 1][j][cost] +
-                            prefix[i - 1][j - 1][cost - 1]) % MOD
-          prefix[i][j][cost] = (dp[i][j][cost] + prefix[i][j - 1][cost]) % MOD
+                            prefix[i - 1][j - 1][cost - 1]) % kMod
+          prefix[i][j][cost] = (dp[i][j][cost] + prefix[i][j - 1][cost]) % kMod
 
-    return sum(dp[n][j][k] for j in range(1, m + 1)) % MOD
+    return sum(dp[n][j][k] for j in range(1, m + 1)) % kMod
diff --git a/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420.java b/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420.java
index 5134559ca64..82adaecdadd 100644
--- a/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420.java	
+++ b/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numOfArrays(int n, int m, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i][j][k] := the number of ways to build an array of length i, where j
     // is the maximum number and k is `search_cost`
     int[][][] dp = new int[n + 1][m + 1][k + 1];
@@ -13,18 +13,18 @@ public int numOfArrays(int n, int m, int k) {
         for (int cost = 1; cost <= k; ++cost) { // for each cost
           // 1. Appending any of [1, j] in the i-th position doesn't change the
           //    maximum and cost.
-          dp[i][j][cost] = (int) ((long) j * dp[i - 1][j][cost] % MOD);
+          dp[i][j][cost] = (int) ((long) j * dp[i - 1][j][cost] % kMod);
           // 2. Appending j in the i-th position makes j the new max and cost 1.
           for (int prevMax = 1; prevMax < j; ++prevMax) {
             dp[i][j][cost] += dp[i - 1][prevMax][cost - 1];
-            dp[i][j][cost] %= MOD;
+            dp[i][j][cost] %= kMod;
           }
         }
 
     int ans = 0;
     for (int j = 1; j <= m; ++j) {
       ans += dp[n][j][k];
-      ans %= MOD;
+      ans %= kMod;
     }
     return ans;
   }
diff --git a/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420.py b/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420.py
index 24b4d119061..42905ed816b 100644
--- a/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420.py	
+++ b/solutions/1420. Build Array Where You Can Find The Maximum Exactly K Comparisons/1420.py	
@@ -1,6 +1,6 @@
 class Solution:
   def numOfArrays(self, n: int, m: int, k: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # dp[i][j][k] := the number of ways to build an array of length i, where j
     # is the maximum number and k is `search_cost`
     dp = [[[0] * (k + 1) for j in range(m + 1)] for _ in range(n + 1)]
@@ -13,10 +13,10 @@ def numOfArrays(self, n: int, m: int, k: int) -> int:
         for cost in range(1, k + 1):  # for each cost
           # 1. Appending any of [1, j] in the i-th position doesn't change the
           #    maximum and cost.
-          dp[i][j][cost] = j * dp[i - 1][j][cost] % MOD
+          dp[i][j][cost] = j * dp[i - 1][j][cost] % kMod
           # 2. Appending j in the i-th position makes j the new max and cost 1.
           for prevMax in range(1, j):
             dp[i][j][cost] += dp[i - 1][prevMax][cost - 1]
-            dp[i][j][cost] %= MOD
+            dp[i][j][cost] %= kMod
 
-    return sum(dp[n][j][k] for j in range(1, m + 1)) % MOD
+    return sum(dp[n][j][k] for j in range(1, m + 1)) % kMod
diff --git a/solutions/1423. Maximum Points You Can Obtain from Cards/1423.py b/solutions/1423. Maximum Points You Can Obtain from Cards/1423.py
index af2c3ca02db..daa92d4ffbe 100644
--- a/solutions/1423. Maximum Points You Can Obtain from Cards/1423.py	
+++ b/solutions/1423. Maximum Points You Can Obtain from Cards/1423.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxScore(self, cardPoints: list[int], k: int) -> int:
+  def maxScore(self, cardPoints: List[int], k: int) -> int:
     n = len(cardPoints)
     summ = sum(cardPoints)
     windowSum = sum(cardPoints[:n - k])
diff --git a/solutions/1425. Constrained Subsequence Sum/1425.py b/solutions/1425. Constrained Subsequence Sum/1425.py
index 79f1a09d32e..10a630575c8 100644
--- a/solutions/1425. Constrained Subsequence Sum/1425.py	
+++ b/solutions/1425. Constrained Subsequence Sum/1425.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def constrainedSubsetSum(self, nums: list[int], k: int) -> int:
+  def constrainedSubsetSum(self, nums: List[int], k: int) -> int:
     # dp[i] := the maximum the sum of non-empty subsequences in nums[0..i]
     dp = [0] * len(nums)
     # dq stores dp[i - k], dp[i - k + 1], ..., dp[i - 1] whose values are > 0
diff --git a/solutions/1426. Counting Elements/1426.py b/solutions/1426. Counting Elements/1426.py
index 3101f2a6c49..c7a56e40dd3 100644
--- a/solutions/1426. Counting Elements/1426.py	
+++ b/solutions/1426. Counting Elements/1426.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countElements(self, arr: list[int]) -> int:
+  def countElements(self, arr: List[int]) -> int:
     count = collections.Counter(arr)
     return sum(freq
                for a, freq in count.items()
diff --git a/solutions/1427. Perform String Shifts/1427.py b/solutions/1427. Perform String Shifts/1427.py
index d695e0f27b2..b400c4899e0 100644
--- a/solutions/1427. Perform String Shifts/1427.py	
+++ b/solutions/1427. Perform String Shifts/1427.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def stringShift(self, s: str, shift: list[list[int]]) -> str:
+  def stringShift(self, s: str, shift: List[List[int]]) -> str:
     move = 0
 
     for direction, amount in shift:
diff --git a/solutions/1428. Leftmost Column with at Least a One/1428-2.py b/solutions/1428. Leftmost Column with at Least a One/1428-2.py
index 8df401b4da9..061a004fc2d 100644
--- a/solutions/1428. Leftmost Column with at Least a One/1428-2.py	
+++ b/solutions/1428. Leftmost Column with at Least a One/1428-2.py	
@@ -4,7 +4,7 @@
 # """
 # Class BinaryMatrix(object):
 #   def get(self, row: int, col: int) -> int:
-#   def dimensions(self) -> list[int]:
+#   def dimensions(self) -> List[int]:
 
 class Solution:
   def leftMostColumnWithOne(self, binaryMatrix: 'BinaryMatrix') -> int:
diff --git a/solutions/1428. Leftmost Column with at Least a One/1428.py b/solutions/1428. Leftmost Column with at Least a One/1428.py
index 2fc31685ad4..814a99da305 100644
--- a/solutions/1428. Leftmost Column with at Least a One/1428.py	
+++ b/solutions/1428. Leftmost Column with at Least a One/1428.py	
@@ -4,7 +4,7 @@
 # """
 # Class BinaryMatrix(object):
 #   def get(self, row: int, col: int) -> int:
-#   def dimensions(self) -> list[int]:
+#   def dimensions(self) -> List[int]:
 
 class Solution:
   def leftMostColumnWithOne(self, binaryMatrix: 'BinaryMatrix') -> int:
diff --git a/solutions/1429. First Unique Number/1429.py b/solutions/1429. First Unique Number/1429.py
index 071cbf48180..95c3859391d 100644
--- a/solutions/1429. First Unique Number/1429.py	
+++ b/solutions/1429. First Unique Number/1429.py	
@@ -1,5 +1,5 @@
 class FirstUnique:
-  def __init__(self, nums: list[int]):
+  def __init__(self, nums: List[int]):
     self.seen = set()
     self.unique = {}
     for num in nums:
diff --git a/solutions/143. Reorder List/143.cpp b/solutions/143. Reorder List/143.cpp
index 95f32c41088..877ffb61227 100644
--- a/solutions/143. Reorder List/143.cpp	
+++ b/solutions/143. Reorder List/143.cpp	
@@ -29,7 +29,7 @@ class Solution {
     ListNode* prev = nullptr;
     ListNode* curr = head;
 
-    while (curr != nullptr) {
+    while (curr) {
       ListNode* next = curr->next;
       curr->next = prev;
       prev = curr;
diff --git a/solutions/1430. Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/1430.py b/solutions/1430. Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/1430.py
index 843add95b55..57909ee180b 100644
--- a/solutions/1430. Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/1430.py	
+++ b/solutions/1430. Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree/1430.py	
@@ -1,12 +1,10 @@
 class Solution:
-  def isValidSequence(self, root: TreeNode | None, arr: list[int]) -> bool:
-    def isValidSequence(root: TreeNode | None, i: int) -> bool:
+  def isValidSequence(self, root: Optional[TreeNode], arr: List[int]) -> bool:
+    def isValidSequence(root: Optional[TreeNode], i: int) -> bool:
       if not root:
         return False
       if i == len(arr) - 1:
         return root.val == arr[i] and not root.left and not root.right
-      return root.val == arr[i] and (
-          isValidSequence(root.left, i + 1) or
-          isValidSequence(root.right, i + 1))
+      return root.val == arr[i] and (isValidSequence(root.left, i + 1) or isValidSequence(root.right,  i + 1))
 
     return isValidSequence(root, 0)
diff --git a/solutions/1431. Kids With the Greatest Number of Candies/1431.py b/solutions/1431. Kids With the Greatest Number of Candies/1431.py
index 7bdc0015ced..31d0d5b37bb 100644
--- a/solutions/1431. Kids With the Greatest Number of Candies/1431.py	
+++ b/solutions/1431. Kids With the Greatest Number of Candies/1431.py	
@@ -1,8 +1,4 @@
 class Solution:
-  def kidsWithCandies(
-      self,
-      candies: list[int],
-      extraCandies: int,
-  ) -> list[bool]:
+  def kidsWithCandies(self, candies: List[int], extraCandies: int) -> List[bool]:
     maxCandy = max(candies)
     return [candy + extraCandies >= maxCandy for candy in candies]
diff --git a/solutions/1433. Check If a String Can Break Another String/1433-2.py b/solutions/1433. Check If a String Can Break Another String/1433-2.py
index dbd0e624610..b2eae91010a 100644
--- a/solutions/1433. Check If a String Can Break Another String/1433-2.py	
+++ b/solutions/1433. Check If a String Can Break Another String/1433-2.py	
@@ -6,5 +6,5 @@ def checkIfCanBreak(self, s1: str, s2: str) -> bool:
     for a, b in itertools.pairwise(string.ascii_lowercase):
       count[b] += count[a]
 
-    return (all(value <= 0 for value in count.values()) or
-            all(value >= 0 for value in count.values()))
+    return all(value <= 0 for value in count.values()) or \
+        all(value >= 0 for value in count.values())
diff --git a/solutions/1433. Check If a String Can Break Another String/1433.py b/solutions/1433. Check If a String Can Break Another String/1433.py
index f6fa6de2a9e..165420664eb 100644
--- a/solutions/1433. Check If a String Can Break Another String/1433.py	
+++ b/solutions/1433. Check If a String Can Break Another String/1433.py	
@@ -3,7 +3,7 @@ def checkIfCanBreak(self, s1: str, s2: str) -> bool:
     count1 = collections.Counter(s1)
     count2 = collections.Counter(s2)
 
-    def canBreak(count1: dict[str, int], count2: dict[str, int]) -> bool:
+    def canBreak(count1: Dict[str, int], count2: Dict[str, int]) -> bool:
       """Returns True if count1 can break count2."""
       diff = 0
       for c in string.ascii_lowercase:
diff --git a/solutions/1434. Number of Ways to Wear Different Hats to Each Other/1434-2.java b/solutions/1434. Number of Ways to Wear Different Hats to Each Other/1434-2.java
index e9ecf2a5e18..d1b3e297d84 100644
--- a/solutions/1434. Number of Ways to Wear Different Hats to Each Other/1434-2.java	
+++ b/solutions/1434. Number of Ways to Wear Different Hats to Each Other/1434-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numberWays(List<List<Integer>> hats) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int nHats = 40;
     final int nPeople = hats.size();
     final int nAssignments = 1 << nPeople;
@@ -22,13 +22,13 @@ public int numberWays(List<List<Integer>> hats) {
         // We can cover the assignment j in 2 ways:
         // 1. Assign the first h - 1 hats to people without using the hat `h`.
         dp[h][j] += dp[h - 1][j];
-        dp[h][j] %= MOD;
+        dp[h][j] %= kMod;
         for (final int p : hatToPeople[h])
           if ((j >> p & 1) == 1) {
             // 2. Assign the first h - 1 hats to people without the person `p`
             //    and assign the hat `h` to the person `p`.
             dp[h][j] += dp[h - 1][j ^ 1 << p];
-            dp[h][j] %= MOD;
+            dp[h][j] %= kMod;
           }
       }
 
diff --git a/solutions/1434. Number of Ways to Wear Different Hats to Each Other/1434-3.java b/solutions/1434. Number of Ways to Wear Different Hats to Each Other/1434-3.java
index 4ebedf30d32..fd84f567730 100644
--- a/solutions/1434. Number of Ways to Wear Different Hats to Each Other/1434-3.java	
+++ b/solutions/1434. Number of Ways to Wear Different Hats to Each Other/1434-3.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numberWays(List<List<Integer>> hats) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int nHats = 40;
     final int nPeople = hats.size();
     final int nAssignments = 1 << nPeople;
@@ -22,7 +22,7 @@ public int numberWays(List<List<Integer>> hats) {
         for (final int p : hatToPeople[h])
           if ((j >> p & 1) == 1) {
             dp[j] += dp[j ^ 1 << p];
-            dp[j] %= MOD;
+            dp[j] %= kMod;
           }
 
     return dp[nAssignments - 1];
diff --git a/solutions/1434. Number of Ways to Wear Different Hats to Each Other/1434.java b/solutions/1434. Number of Ways to Wear Different Hats to Each Other/1434.java
index 2312683e51f..d081ce0c12e 100644
--- a/solutions/1434. Number of Ways to Wear Different Hats to Each Other/1434.java	
+++ b/solutions/1434. Number of Ways to Wear Different Hats to Each Other/1434.java	
@@ -15,7 +15,7 @@ public int numberWays(List<List<Integer>> hats) {
     return numberWays(hats, 0, 1, hatToPeople, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of ways to assign hats 1, 2, ..., h to people, where
   // `assignment` is the bitmask of the current assignment.
@@ -38,7 +38,7 @@ private int numberWays(List<List<Integer>> hats, int assignment, int h,
         continue;
       // Assign the hat `h` to the person `p`.
       ans += numberWays(hats, assignment | 1 << p, h + 1, hatToPeople, mem);
-      ans %= MOD;
+      ans %= kMod;
     }
 
     return mem[h][assignment] = ans;
diff --git a/solutions/1436. Destination City/1436.py b/solutions/1436. Destination City/1436.py
index 64f7db0b7d9..fbda7ffd320 100644
--- a/solutions/1436. Destination City/1436.py	
+++ b/solutions/1436. Destination City/1436.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def destCity(self, paths: list[list[str]]) -> str:
+  def destCity(self, paths: List[List[str]]) -> str:
     count = collections.Counter()
 
     for a, b in paths:
diff --git a/solutions/1437. Check If All 1's Are at Least Length K Places Away/1437.py b/solutions/1437. Check If All 1's Are at Least Length K Places Away/1437.py
index 3d167872ae7..95b59c3af0e 100644
--- a/solutions/1437. Check If All 1's Are at Least Length K Places Away/1437.py	
+++ b/solutions/1437. Check If All 1's Are at Least Length K Places Away/1437.py	
@@ -1,9 +1,10 @@
 class Solution:
-  def kLengthApart(self, nums: list[int], k: int) -> bool:
+  def kLengthApart(self, nums: List[int], k: int) -> bool:
     if k == 0:
       return True
 
     n = len(nums)
+
     curr = 0
     next = 1
 
diff --git a/solutions/1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows/1439.cpp b/solutions/1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows/1439.cpp
index 81b5fc39247..d8931a50d55 100644
--- a/solutions/1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows/1439.cpp	
+++ b/solutions/1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows/1439.cpp	
@@ -2,6 +2,7 @@ struct T {
   int i;
   int j;
   int sum;  // nums1[i] + nums2[j]
+  T(int i, int j, int sum) : i(i), j(j), sum(sum) {}
 };
 
 class Solution {
diff --git a/solutions/1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows/1439.java b/solutions/1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows/1439.java
index e8f3669ee75..3c144638a73 100644
--- a/solutions/1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows/1439.java	
+++ b/solutions/1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows/1439.java	
@@ -1,3 +1,14 @@
+class T {
+  public int i;
+  public int j;
+  public int sum; // nums1[i] + nums2[j]
+  public T(int i, int j, int sum) {
+    this.i = i;
+    this.j = j;
+    this.sum = sum;
+  }
+}
+
 class Solution {
   public int kthSmallest(int[][] mat, int k) {
     int[] row = mat[0];
@@ -8,12 +19,10 @@ public int kthSmallest(int[][] mat, int k) {
     return row[k - 1];
   }
 
-  private record T(int i, int j, int sum) {}
-
   // Similar to 373. Find K Pairs with Smallest Sums
   private int[] kSmallestPairSums(int[] nums1, int[] nums2, int k) {
     List<Integer> ans = new ArrayList<>();
-    Queue<T> minHeap = new PriorityQueue<>(Comparator.comparingInt(T::sum));
+    Queue<T> minHeap = new PriorityQueue<>((a, b) -> a.sum - b.sum);
 
     for (int i = 0; i < k && i < nums1.length; ++i)
       minHeap.offer(new T(i, 0, nums1[i] + nums2[0]));
diff --git a/solutions/144. Binary Tree Preorder Traversal/144-2.py b/solutions/144. Binary Tree Preorder Traversal/144-2.py
index 71af09181ae..6052c14320e 100644
--- a/solutions/144. Binary Tree Preorder Traversal/144-2.py	
+++ b/solutions/144. Binary Tree Preorder Traversal/144-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def preorderTraversal(self, root: TreeNode | None) -> list[int]:
+  def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
     if not root:
       return []
 
diff --git a/solutions/144. Binary Tree Preorder Traversal/144.py b/solutions/144. Binary Tree Preorder Traversal/144.py
index 30732085bff..b5d1f6602c2 100644
--- a/solutions/144. Binary Tree Preorder Traversal/144.py	
+++ b/solutions/144. Binary Tree Preorder Traversal/144.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def preorderTraversal(self, root: TreeNode | None) -> list[int]:
+  def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
     ans = []
 
-    def preorder(root: TreeNode | None) -> None:
+    def preorder(root: Optional[TreeNode]) -> None:
       if not root:
         return
 
diff --git a/solutions/1441. Build an Array With Stack Operations/1441.py b/solutions/1441. Build an Array With Stack Operations/1441.py
index 0090ba26cd6..c57039a1e6a 100644
--- a/solutions/1441. Build an Array With Stack Operations/1441.py	
+++ b/solutions/1441. Build an Array With Stack Operations/1441.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def buildArray(self, target: list[int], n: int) -> list[str]:
+  def buildArray(self, target: List[int], n: int) -> List[str]:
     ans = []
     i = 0  # Target pointer
     num = 1  # Curr num
@@ -7,11 +7,11 @@ def buildArray(self, target: list[int], n: int) -> list[str]:
     while i < len(target):
       t = target[i]
       if t == num:
-        ans.append('Push')
+        ans.append("Push")
         i += 1
       else:
-        ans.append('Push')
-        ans.append('Pop')
+        ans.append("Push")
+        ans.append("Pop")
       num += 1
 
     return ans
diff --git a/solutions/1442. Count Triplets That Can Form Two Arrays of Equal XOR/1442.py b/solutions/1442. Count Triplets That Can Form Two Arrays of Equal XOR/1442.py
index 919ffd3c8c2..66b6a0cc1b8 100644
--- a/solutions/1442. Count Triplets That Can Form Two Arrays of Equal XOR/1442.py	
+++ b/solutions/1442. Count Triplets That Can Form Two Arrays of Equal XOR/1442.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countTriplets(self, arr: list[int]) -> int:
+  def countTriplets(self, arr: List[int]) -> int:
     ans = 0
     xors = [0]
     prefix = 0
diff --git a/solutions/1443. Minimum Time to Collect All Apples in a Tree/1443.cpp b/solutions/1443. Minimum Time to Collect All Apples in a Tree/1443.cpp
index 21441e1057d..a635d84d1ed 100644
--- a/solutions/1443. Minimum Time to Collect All Apples in a Tree/1443.cpp	
+++ b/solutions/1443. Minimum Time to Collect All Apples in a Tree/1443.cpp	
@@ -22,7 +22,7 @@ class Solution {
     for (const int v : graph[u]) {
       if (seen[v])
         continue;
-      const int cost = dfs(graph, v, std::move(seen), hasApple);
+      const int cost = dfs(graph, v, move(seen), hasApple);
       if (cost > 0 || hasApple[v])
         totalCost += cost + 2;
     }
diff --git a/solutions/1443. Minimum Time to Collect All Apples in a Tree/1443.java b/solutions/1443. Minimum Time to Collect All Apples in a Tree/1443.java
index 30eec3760d8..ff624e7e8f4 100644
--- a/solutions/1443. Minimum Time to Collect All Apples in a Tree/1443.java	
+++ b/solutions/1443. Minimum Time to Collect All Apples in a Tree/1443.java	
@@ -1,7 +1,9 @@
 class Solution {
   public int minTime(int n, int[][] edges, List<Boolean> hasApple) {
     List<Integer>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
diff --git a/solutions/1444. Number of Ways of Cutting a Pizza/1444.java b/solutions/1444. Number of Ways of Cutting a Pizza/1444.java
index e2295bacbb7..1115a33d37b 100644
--- a/solutions/1444. Number of Ways of Cutting a Pizza/1444.java	
+++ b/solutions/1444. Number of Ways of Cutting a Pizza/1444.java	
@@ -1,11 +1,12 @@
 class Solution {
   public int ways(String[] pizza, int k) {
-    final int M = pizza.length;
+    final int M = pizza.size();
     final int N = pizza[0].length();
     int[][][] mem = new int[M][N][k];
     int[][] prefix = new int[M + 1][N + 1];
 
-    Arrays.stream(mem).forEach(A -> Arrays.stream(A).forEach(B -> Arrays.fill(B, -1)));
+    for (int[][] A : mem)
+      Arrays.stream(mem).forEach(B -> Arrays.fill(B, -1));
 
     for (int i = 0; i < M; ++i)
       for (int j = 0; j < N; ++j)
@@ -15,7 +16,7 @@ public int ways(String[] pizza, int k) {
     return ways(0, 0, k - 1, M, N, prefix, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of ways to cut pizza[m..M)[n..N) with k cuts.
   private int ways(int m, int n, int k, int M, int N, int[][] prefix, int[][][] mem) {
@@ -29,13 +30,13 @@ private int ways(int m, int n, int k, int M, int N, int[][] prefix, int[][][] me
     for (int i = m + 1; i < M; ++i) // Cut horizontally.
       if (hasApple(prefix, m, i, n, N) && hasApple(prefix, i, M, n, N)) {
         mem[m][n][k] += ways(i, n, k - 1, M, N, prefix, mem);
-        mem[m][n][k] %= MOD;
+        mem[m][n][k] %= kMod;
       }
 
     for (int j = n + 1; j < N; ++j) // Cut vertically.
       if (hasApple(prefix, m, M, n, j) && hasApple(prefix, m, M, j, N)) {
         mem[m][n][k] += ways(m, j, k - 1, M, N, prefix, mem);
-        mem[m][n][k] %= MOD;
+        mem[m][n][k] %= kMod;
       }
 
     return mem[m][n][k];
diff --git a/solutions/1444. Number of Ways of Cutting a Pizza/1444.py b/solutions/1444. Number of Ways of Cutting a Pizza/1444.py
index d889da9c456..93db6751170 100644
--- a/solutions/1444. Number of Ways of Cutting a Pizza/1444.py	
+++ b/solutions/1444. Number of Ways of Cutting a Pizza/1444.py	
@@ -1,14 +1,14 @@
 class Solution:
-  def ways(self, pizza: list[str], k: int) -> int:
-    MOD = 1_000_000_007
+  def ways(self, pizza: List[str], k: int) -> int:
+    kMod = 1_000_000_007
     M = len(pizza)
     N = len(pizza[0])
     prefix = [[0] * (N + 1) for _ in range(M + 1)]
 
     for i in range(M):
       for j in range(N):
-        prefix[i + 1][j + 1] = ((pizza[i][j] == 'A') + prefix[i][j + 1] +
-                                prefix[i + 1][j] - prefix[i][j])
+        prefix[i + 1][j + 1] = (pizza[i][j] == 'A') + \
+            prefix[i][j + 1] + prefix[i + 1][j] - prefix[i][j]
 
     def hasApple(row1: int, row2: int, col1: int, col2: int) -> bool:
       """Returns True if pizza[row1..row2)[col1..col2) has apple."""
@@ -31,6 +31,6 @@ def dp(m: int, n: int, k: int) -> int:
         if hasApple(m, M, n, j) and hasApple(m, M, j, N):
           res += dp(m, j, k - 1)
 
-      return res % MOD
+      return res % kMod
 
     return dp(0, 0, k - 1)
diff --git a/solutions/1447. Simplified Fractions/1447.py b/solutions/1447. Simplified Fractions/1447.py
index 53c61a393d7..19c233022c3 100644
--- a/solutions/1447. Simplified Fractions/1447.py	
+++ b/solutions/1447. Simplified Fractions/1447.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def simplifiedFractions(self, n: int) -> list[str]:
+  def simplifiedFractions(self, n: int) -> List[str]:
     ans = []
     for denominator in range(2, n + 1):
       for numerator in range(1, denominator):
diff --git a/solutions/145. Binary Tree Postorder Traversal/145-2.cpp b/solutions/145. Binary Tree Postorder Traversal/145-2.cpp
index 1616dbfb8c8..46352b302db 100644
--- a/solutions/145. Binary Tree Postorder Traversal/145-2.cpp	
+++ b/solutions/145. Binary Tree Postorder Traversal/145-2.cpp	
@@ -16,7 +16,7 @@ class Solution {
         stack.push(root->right);
     }
 
-    ranges::reverse(ans);
+    reverse(ans.begin(), ans.end());
     return ans;
   }
 };
diff --git a/solutions/145. Binary Tree Postorder Traversal/145-2.py b/solutions/145. Binary Tree Postorder Traversal/145-2.py
index 029f4326dae..304aadcc046 100644
--- a/solutions/145. Binary Tree Postorder Traversal/145-2.py	
+++ b/solutions/145. Binary Tree Postorder Traversal/145-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def postorderTraversal(self, root: TreeNode | None) -> list[int]:
+  def postorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
     if not root:
       return []
 
diff --git a/solutions/145. Binary Tree Postorder Traversal/145.py b/solutions/145. Binary Tree Postorder Traversal/145.py
index 67a63ff77e6..57b7b09fc07 100644
--- a/solutions/145. Binary Tree Postorder Traversal/145.py	
+++ b/solutions/145. Binary Tree Postorder Traversal/145.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def postorderTraversal(self, root: TreeNode | None) -> list[int]:
+  def postorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
     ans = []
 
-    def postorder(root: TreeNode | None) -> None:
+    def postorder(root: Optional[TreeNode]) -> None:
       if not root:
         return
 
diff --git a/solutions/1452. People Whose List of Favorite Companies Is Not a Subset of Another List/1452.py b/solutions/1452. People Whose List of Favorite Companies Is Not a Subset of Another List/1452.py
index 024a08dcc24..1e17ec2c9f3 100644
--- a/solutions/1452. People Whose List of Favorite Companies Is Not a Subset of Another List/1452.py	
+++ b/solutions/1452. People Whose List of Favorite Companies Is Not a Subset of Another List/1452.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def peopleIndexes(self, favoriteCompanies: list[list[str]]) -> list[int]:
+  def peopleIndexes(self, favoriteCompanies: List[List[str]]) -> List[int]:
     ans = []
     n = len(favoriteCompanies)
     companies = [set(comp) for comp in favoriteCompanies]
diff --git a/solutions/1453. Maximum Number of Darts Inside of a Circular Dartboard/1453.java b/solutions/1453. Maximum Number of Darts Inside of a Circular Dartboard/1453.java
index d049a0b6df5..2c2b6f1ac93 100644
--- a/solutions/1453. Maximum Number of Darts Inside of a Circular Dartboard/1453.java	
+++ b/solutions/1453. Maximum Number of Darts Inside of a Circular Dartboard/1453.java	
@@ -17,7 +17,7 @@ public int numPoints(int[][] darts, int r) {
         for (Point c : getCircles(points.get(i), points.get(j), r)) {
           int count = 0;
           for (Point point : points)
-            if (dist(c, point) - r <= ERR)
+            if (dist(c, point) - r <= kErr)
               ++count;
           ans = Math.max(ans, count);
         }
@@ -25,7 +25,7 @@ public int numPoints(int[][] darts, int r) {
     return ans;
   }
 
-  private static final double ERR = 1e-6;
+  private static final double kErr = 1e-6;
 
   private List<Point> convertToPoints(int[][] darts) {
     List<Point> points = new ArrayList<>();
@@ -35,7 +35,7 @@ private List<Point> convertToPoints(int[][] darts) {
   }
 
   private Point[] getCircles(Point p, Point q, int r) {
-    if (dist(p, q) - 2.0 * r > ERR)
+    if (dist(p, q) - 2.0 * r > kErr)
       return new Point[] {};
     Point m = new Point((p.x + q.x) / 2, (p.y + q.y) / 2);
     final double distCM = Math.sqrt(Math.pow(r, 2) - Math.pow(dist(p, q) / 2, 2));
diff --git a/solutions/1453. Maximum Number of Darts Inside of a Circular Dartboard/1453.py b/solutions/1453. Maximum Number of Darts Inside of a Circular Dartboard/1453.py
index cec3ab8eddb..a93dfa1c439 100644
--- a/solutions/1453. Maximum Number of Darts Inside of a Circular Dartboard/1453.py	
+++ b/solutions/1453. Maximum Number of Darts Inside of a Circular Dartboard/1453.py	
@@ -5,16 +5,16 @@ def __init__(self, x: float, y: float):
 
 
 class Solution:
-  def numPoints(self, darts: list[list[int]], r: int) -> int:
-    ERR = 1e-6
+  def numPoints(self, darts: List[List[int]], r: int) -> int:
+    kErr = 1e-6
     ans = 1
     points = [Point(x, y) for x, y in darts]
 
     def dist(p: Point, q: Point) -> float:
       return ((p.x - q.x)**2 + (p.y - q.y)**2)**0.5
 
-    def getCircles(p: Point, q: Point) -> list[Point]:
-      if dist(p, q) - 2.0 * r > ERR:
+    def getCircles(p: Point, q: Point) -> List[Point]:
+      if dist(p, q) - 2.0 * r > kErr:
         return []
       m = Point((p.x + q.x) / 2, (p.y + q.y) / 2)
       distCM = (r**2 - (dist(p, q) / 2)**2)**0.5
@@ -22,12 +22,13 @@ def getCircles(p: Point, q: Point) -> list[Point]:
       return [Point(m.x - distCM * math.sin(alpha), m.y - distCM * math.cos(alpha)),
               Point(m.x + distCM * math.sin(alpha), m.y + distCM * math.cos(alpha))]
 
-    for i, j in itertools.combinations(points, 2):
-      for c in getCircles(i, j):
-        count = 0
-        for point in points:
-          if dist(c, point) - r <= ERR:
-            count += 1
-        ans = max(ans, count)
+    for i in range(len(points)):
+      for j in range(i + 1, len(points)):
+        for c in getCircles(points[i], points[j]):
+          count = 0
+          for point in points:
+            if dist(c, point) - r <= kErr:
+              count += 1
+          ans = max(ans, count)
 
     return ans
diff --git a/solutions/1456. Maximum Number of Vowels in a Substring of Given Length/1456.py b/solutions/1456. Maximum Number of Vowels in a Substring of Given Length/1456.py
index c6c6c483650..ff2425cab10 100644
--- a/solutions/1456. Maximum Number of Vowels in a Substring of Given Length/1456.py	
+++ b/solutions/1456. Maximum Number of Vowels in a Substring of Given Length/1456.py	
@@ -2,12 +2,12 @@ class Solution:
   def maxVowels(self, s: str, k: int) -> int:
     ans = 0
     mx = 0
-    VOWELS = 'aeiou'
+    kVowels = 'aeiou'
 
     for i, c in enumerate(s):
-      if c in VOWELS:
+      if c in kVowels:
         mx += 1
-      if i >= k and s[i - k] in VOWELS:
+      if i >= k and s[i - k] in kVowels:
         mx -= 1
       ans = max(ans, mx)
 
diff --git a/solutions/1457. Pseudo-Palindromic Paths in a Binary Tree/1457.py b/solutions/1457. Pseudo-Palindromic Paths in a Binary Tree/1457.py
index bfac4f2630d..41bf3c66c30 100644
--- a/solutions/1457. Pseudo-Palindromic Paths in a Binary Tree/1457.py	
+++ b/solutions/1457. Pseudo-Palindromic Paths in a Binary Tree/1457.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def pseudoPalindromicPaths(self, root: TreeNode | None) -> int:
+  def pseudoPalindromicPaths(self, root: Optional[TreeNode]) -> int:
     ans = 0
 
-    def dfs(root: TreeNode | None, path: int) -> None:
+    def dfs(root: Optional[TreeNode], path: int) -> None:
       nonlocal ans
       if not root:
         return
diff --git a/solutions/1458. Max Dot Product of Two Subsequences/1458.py b/solutions/1458. Max Dot Product of Two Subsequences/1458.py
index 9944faf9e1a..9e68679227f 100644
--- a/solutions/1458. Max Dot Product of Two Subsequences/1458.py	
+++ b/solutions/1458. Max Dot Product of Two Subsequences/1458.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxDotProduct(self, A: list[int], B: list[int]) -> int:
+  def maxDotProduct(self, A: List[int], B: List[int]) -> int:
     m = len(A)
     n = len(B)
     # dp[i][j] := the maximum dot product of the two subsequences nums[0..i)
diff --git a/solutions/146. LRU Cache/146-2.cpp b/solutions/146. LRU Cache/146-2.cpp
index ce7264e4d3c..6da31bdb152 100644
--- a/solutions/146. LRU Cache/146-2.cpp	
+++ b/solutions/146. LRU Cache/146-2.cpp	
@@ -1,6 +1,7 @@
 struct Node {
   int key;
   int value;
+  Node(int key, int value) : key(key), value(value) {}
 };
 
 class LRUCache {
diff --git a/solutions/146. LRU Cache/146.cpp b/solutions/146. LRU Cache/146.cpp
index 464bcfc30ec..d4b26c8588b 100644
--- a/solutions/146. LRU Cache/146.cpp	
+++ b/solutions/146. LRU Cache/146.cpp	
@@ -3,6 +3,7 @@ struct Node {
   int value;
   shared_ptr<Node> prev;
   shared_ptr<Node> next;
+  Node(int key, int value) : key(key), value(value) {}
 };
 
 class LRUCache {
diff --git a/solutions/1460. Make Two Arrays Equal by Reversing Subarrays/1460.py b/solutions/1460. Make Two Arrays Equal by Reversing Subarrays/1460.py
index 7dbde535106..685c4bdf6da 100644
--- a/solutions/1460. Make Two Arrays Equal by Reversing Subarrays/1460.py	
+++ b/solutions/1460. Make Two Arrays Equal by Reversing Subarrays/1460.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def canBeEqual(self, target: list[int], arr: list[int]) -> bool:
+  def canBeEqual(self, target: List[int], arr: List[int]) -> bool:
     return collections.Counter(arr) == collections.Counter(target)
diff --git a/solutions/1462. Course Schedule IV/1462-2.py b/solutions/1462. Course Schedule IV/1462-2.py
index 60ee307a9f6..96f68b79a5e 100644
--- a/solutions/1462. Course Schedule IV/1462-2.py	
+++ b/solutions/1462. Course Schedule IV/1462-2.py	
@@ -1,10 +1,6 @@
 class Solution:
-  def checkIfPrerequisite(
-      self,
-      numCourses: int,
-      prerequisites: list[list[int]],
-      queries: list[list[int]],
-  ) -> list[bool]:
+  def checkIfPrerequisite(self, numCourses: int, prerequisites: List[List[int]], queries: List[List[int]]) -> List[bool]:
+    ans = []
     # isPrerequisite[i][j] := True if course i is a prerequisite of course j.
     isPrerequisite = [[False] * numCourses for _ in range(numCourses)]
 
@@ -14,7 +10,7 @@ def checkIfPrerequisite(
     for k in range(numCourses):
       for i in range(numCourses):
         for j in range(numCourses):
-          isPrerequisite[i][j] = (isPrerequisite[i][j] or (
-              isPrerequisite[i][k] and isPrerequisite[k][j]))
+          isPrerequisite[i][j] = isPrerequisite[i][j] or \
+              (isPrerequisite[i][k] and isPrerequisite[k][j])
 
     return [isPrerequisite[u][v] for u, v in queries]
diff --git a/solutions/1462. Course Schedule IV/1462.java b/solutions/1462. Course Schedule IV/1462.java
index 894b66c23f5..cac577a3e30 100644
--- a/solutions/1462. Course Schedule IV/1462.java	
+++ b/solutions/1462. Course Schedule IV/1462.java	
@@ -1,3 +1,41 @@
+class Solution {
+  public boolean[] checkIfPrerequisite(int numCourses, int[][] prerequisites, int[][] queries) {
+    List<Boolean> ans = new ArrayList<>();
+    List<Integer>[] graph = new List[numCourses];
+    // isPrerequisite[i][j] := true if course i is a prerequisite of course j
+    boolean[][] isPrerequisite = new boolean[numCourses][numCourses];
+
+    for (int i = 0; i < numCourses; ++i)
+      graph[i] = new ArrayList<>();
+
+    for (int[] prerequisite : prerequisites) {
+      final int u = prerequisite[0];
+      final int v = prerequisite[1];
+      graph[u].add(v);
+    }
+
+    // DFS from every course.
+    for (int i = 0; i < numCourses; ++i)
+      dfs(graph, i, isPrerequisite[i]);
+
+    for (int[] query : queries) {
+      final int u = query[0];
+      final int v = query[1];
+      ans.add(isPrerequisite[u][v]);
+    }
+
+    return ans;
+  }
+
+  public void dfs(const vector<vector<int>> &graph, int u, boolean[] used) {
+    for (final int v : graph[u]) {
+      if (used[v])
+        continue;
+      used[v] = true;
+      dfs(graph, v, used);
+    }
+  }
+}
 class Solution {
   public List<Boolean> checkIfPrerequisite(int numCourses, int[][] prerequisites, int[][] queries) {
     List<Boolean> ans = new ArrayList<>();
diff --git a/solutions/1462. Course Schedule IV/1462.py b/solutions/1462. Course Schedule IV/1462.py
index 175a5b4ef2a..758b5ca65b9 100644
--- a/solutions/1462. Course Schedule IV/1462.py	
+++ b/solutions/1462. Course Schedule IV/1462.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def checkIfPrerequisite(
-      self,
-      numCourses: int,
-      prerequisites: list[list[int]],
-      queries: list[list[int]],
-  ) -> list[bool]:
+  def checkIfPrerequisite(self, numCourses: int, prerequisites: List[List[int]], queries: List[List[int]]) -> List[bool]:
     graph = [[] for _ in range(numCourses)]
     # isPrerequisite[i][j] := True if course i is a prerequisite of course j.
     isPrerequisite = [[False] * numCourses for _ in range(numCourses)]
@@ -18,7 +13,7 @@ def checkIfPrerequisite(
 
     return [isPrerequisite[u][v] for u, v in queries]
 
-  def _dfs(self, graph: list[list[int]], u: int, used: list[bool]) -> None:
+  def _dfs(self, graph: List[List[int]], u: int, used: List[bool]) -> None:
     for v in graph[u]:
       if used[v]:
         continue
diff --git a/solutions/1463. Cherry Pickup II/1463.cpp b/solutions/1463. Cherry Pickup II/1463.cpp
index a60711060a9..83293c6c5b1 100644
--- a/solutions/1463. Cherry Pickup II/1463.cpp	
+++ b/solutions/1463. Cherry Pickup II/1463.cpp	
@@ -5,14 +5,14 @@ class Solution {
     const int n = grid[0].size();
     vector<vector<vector<int>>> mem(m,
                                     vector<vector<int>>(n, vector<int>(n, -1)));
-    return cherryPickup(grid, 0, 0, n - 1, mem);
+    return cherryPick(grid, 0, 0, n - 1, mem);
   }
 
  private:
   // Returns the maximum cherries we can collect, where the robot #1 is on
   // (x, y1) and the robot #2 is on (x, y2).
-  int cherryPickup(const vector<vector<int>>& grid, int x, int y1, int y2,
-                   vector<vector<vector<int>>>& mem) {
+  int cherryPick(const vector<vector<int>>& grid, int x, int y1, int y2,
+                 vector<vector<vector<int>>>& mem) {
     if (x == grid.size())
       return 0;
     if (y1 < 0 || y1 == grid[0].size() || y2 < 0 || y2 == grid[0].size())
@@ -26,7 +26,7 @@ class Solution {
       for (int d2 = -1; d2 <= 1; ++d2)
         mem[x][y1][y2] =
             max(mem[x][y1][y2],
-                currRow + cherryPickup(grid, x + 1, y1 + d1, y2 + d2, mem));
+                currRow + cherryPick(grid, x + 1, y1 + d1, y2 + d2, mem));
 
     return mem[x][y1][y2];
   }
diff --git a/solutions/1463. Cherry Pickup II/1463.java b/solutions/1463. Cherry Pickup II/1463.java
index f748276e0f9..1d132b70361 100644
--- a/solutions/1463. Cherry Pickup II/1463.java	
+++ b/solutions/1463. Cherry Pickup II/1463.java	
@@ -3,13 +3,16 @@ public int cherryPickup(int[][] grid) {
     final int m = grid.length;
     final int n = grid[0].length;
     int[][][] mem = new int[m][n][n];
-    Arrays.stream(mem).forEach(A -> Arrays.stream(A).forEach(B -> Arrays.fill(B, -1)));
-    return dp(grid, 0, 0, n - 1, mem);
+
+    for (int[][] A : mem)
+      Arrays.stream(A).forEach(B -> Arrays.fill(B, -1));
+
+    return cherryPick(grid, 0, 0, n - 1, mem);
   }
 
   // Returns the maximum cherries we can collect, where robot #1 is on (x, y1)
   // and robot #2 is on (x, y2).
-  private int dp(int[][] grid, int x, int y1, int y2, int[][][] mem) {
+  private int cherryPick(int[][] grid, int x, int y1, int y2, int[][][] mem) {
     if (x == grid.length)
       return 0;
     if (y1 < 0 || y1 == grid[0].length || y2 < 0 || y2 == grid[0].length)
@@ -21,7 +24,8 @@ private int dp(int[][] grid, int x, int y1, int y2, int[][][] mem) {
 
     for (int d1 = -1; d1 <= 1; ++d1)
       for (int d2 = -1; d2 <= 1; ++d2)
-        mem[x][y1][y2] = Math.max(mem[x][y1][y2], currRow + dp(grid, x + 1, y1 + d1, y2 + d2, mem));
+        mem[x][y1][y2] =
+            Math.max(mem[x][y1][y2], currRow + cherryPick(grid, x + 1, y1 + d1, y2 + d2, mem));
 
     return mem[x][y1][y2];
   }
diff --git a/solutions/1464. Maximum Product of Two Elements in an Array/1464.py b/solutions/1464. Maximum Product of Two Elements in an Array/1464.py
index aa6a18c51ac..a0760522b4f 100644
--- a/solutions/1464. Maximum Product of Two Elements in an Array/1464.py	
+++ b/solutions/1464. Maximum Product of Two Elements in an Array/1464.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxProduct(self, nums: list[int]) -> int:
+  def maxProduct(self, nums: List[int]) -> int:
     max1 = 0
     max2 = 0
 
diff --git a/solutions/1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts/1465.java b/solutions/1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts/1465.java
index 63e890bdc8f..b0da9b9d41d 100644
--- a/solutions/1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts/1465.java	
+++ b/solutions/1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts/1465.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int maxArea(int h, int w, int[] horizontalCuts, int[] verticalCuts) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     Arrays.sort(horizontalCuts);
     Arrays.sort(verticalCuts);
 
@@ -14,6 +14,6 @@ public int maxArea(int h, int w, int[] horizontalCuts, int[] verticalCuts) {
     for (int i = 1; i < horizontalCuts.length; ++i)
       maxGapY = Math.max(maxGapY, horizontalCuts[i] - horizontalCuts[i - 1]);
 
-    return (int) ((long) maxGapX * maxGapY % MOD);
+    return (int) ((long) maxGapX * maxGapY % kMod);
   }
 }
diff --git a/solutions/1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts/1465.py b/solutions/1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts/1465.py
index a1e1ec8bef5..b7149ec18be 100644
--- a/solutions/1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts/1465.py	
+++ b/solutions/1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts/1465.py	
@@ -1,17 +1,9 @@
 class Solution:
-  def maxArea(
-      self,
-      h: int,
-      w: int,
-      horizontalCuts: list[int],
-      verticalCuts: list[int],
-  ) -> int:
-    MOD = 1_000_000_007
+  def maxArea(self, h: int, w: int, horizontalCuts: List[int], verticalCuts: List[int]) -> int:
+    kMod = 1_000_000_007
     # the maximum gap of each direction
     maxGapX = max(b - a
-                  for a, b in itertools.pairwise(
-                      [0] + sorted(horizontalCuts) + [h]))
+                  for a, b in itertools.pairwise([0] + sorted(horizontalCuts) + [h]))
     maxGapY = max(b - a
-                  for a, b in itertools.pairwise(
-                      [0] + sorted(verticalCuts) + [w]))
-    return maxGapX * maxGapY % MOD
+                  for a, b in itertools.pairwise([0] + sorted(verticalCuts) + [w]))
+    return maxGapX * maxGapY % kMod
diff --git a/solutions/1466. Reorder Routes to Make All Paths Lead to the City Zero/1466.cpp b/solutions/1466. Reorder Routes to Make All Paths Lead to the City Zero/1466.cpp
index f0d7b9aedee..ace88f6032a 100644
--- a/solutions/1466. Reorder Routes to Make All Paths Lead to the City Zero/1466.cpp	
+++ b/solutions/1466. Reorder Routes to Make All Paths Lead to the City Zero/1466.cpp	
@@ -14,11 +14,11 @@ class Solution {
   }
 
  private:
-  int dfs(const vector<vector<int>>& graph, int u, int prev) {
+  int dfs(const vector<vector<int>>& graph, int u, int parent) {
     int change = 0;
 
     for (const int v : graph[u]) {
-      if (abs(v) == prev)
+      if (abs(v) == parent)
         continue;
       if (v > 0)
         ++change;
diff --git a/solutions/1466. Reorder Routes to Make All Paths Lead to the City Zero/1466.java b/solutions/1466. Reorder Routes to Make All Paths Lead to the City Zero/1466.java
index f446655391a..ef284d6df8d 100644
--- a/solutions/1466. Reorder Routes to Make All Paths Lead to the City Zero/1466.java	
+++ b/solutions/1466. Reorder Routes to Make All Paths Lead to the City Zero/1466.java	
@@ -1,7 +1,9 @@
 class Solution {
   public int minReorder(int n, int[][] connections) {
     List<Integer>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] connection : connections) {
       final int u = connection[0];
@@ -13,11 +15,11 @@ public int minReorder(int n, int[][] connections) {
     return dfs(graph, 0, -1);
   }
 
-  private int dfs(List<Integer>[] graph, int u, int prev) {
+  private int dfs(List<Integer>[] graph, int u, int parent) {
     int change = 0;
 
     for (final int v : graph[u]) {
-      if (Math.abs(v) == prev)
+      if (Math.abs(v) == parent)
         continue;
       if (v > 0)
         ++change;
diff --git a/solutions/1467. Probability of a Two Boxes Having The Same Number of Distinct Balls/1467.java b/solutions/1467. Probability of a Two Boxes Having The Same Number of Distinct Balls/1467.java
index 845a4355a8f..39db6b5b4a8 100644
--- a/solutions/1467. Probability of a Two Boxes Having The Same Number of Distinct Balls/1467.java	
+++ b/solutions/1467. Probability of a Two Boxes Having The Same Number of Distinct Balls/1467.java	
@@ -1,10 +1,10 @@
-enum BoxCase { EQUAL_BALLS, EQUAL_DISTANT_BALLS }
+enum BoxCase { kEqualBalls, kEqualDistantBalls }
 
 class Solution {
   public double getProbability(int[] balls) {
     final int n = Arrays.stream(balls).sum() / 2;
-    return cases(balls, 0, 0, 0, 0, 0, n, BoxCase.EQUAL_DISTANT_BALLS) /
-        cases(balls, 0, 0, 0, 0, 0, n, BoxCase.EQUAL_BALLS);
+    return cases(balls, 0, 0, 0, 0, 0, n, BoxCase.kEqualDistantBalls) /
+        cases(balls, 0, 0, 0, 0, 0, n, BoxCase.kEqualBalls);
   }
 
   private int[] fact = {1, 1, 2, 6, 24, 120, 720};
@@ -15,7 +15,7 @@ public double getProbability(int[] balls) {
     if (ballsCountA > n || ballsCountB > n)
       return 0;
     if (i == balls.length)
-      return boxCase == BoxCase.EQUAL_BALLS ? 1 : (colorsCountA == colorsCountB ? 1 : 0);
+      return boxCase == BoxCase.kEqualBalls ? 1 : (colorsCountA == colorsCountB ? 1 : 0);
 
     double ans = 0;
 
diff --git a/solutions/1467. Probability of a Two Boxes Having The Same Number of Distinct Balls/1467.py b/solutions/1467. Probability of a Two Boxes Having The Same Number of Distinct Balls/1467.py
index e97408d6a91..acae68a0983 100644
--- a/solutions/1467. Probability of a Two Boxes Having The Same Number of Distinct Balls/1467.py	
+++ b/solutions/1467. Probability of a Two Boxes Having The Same Number of Distinct Balls/1467.py	
@@ -2,27 +2,21 @@
 
 
 class BoxCase(Enum):
-  EQUAL_DISTANT_BALLS = 0
-  EQUAL_BALLS = 1
+  kEqualDistantBalls = 0
+  kEqualBalls = 1
 
 
 class Solution:
-  def getProbability(self, balls: list[int]) -> float:
+  def getProbability(self, balls: List[int]) -> float:
     n = sum(balls) // 2
     fact = [1, 1, 2, 6, 24, 120, 720]
 
-    def cases(
-            i: int,
-            ballsCountA: int,
-            ballsCountB: int,
-            colorsCountA: int,
-            colorsCountB,
-            boxCase: BoxCase) -> float:
+    def cases(i: int, ballsCountA: int, ballsCountB: int,
+              colorsCountA: int, colorsCountB, boxCase: BoxCase) -> float:
       if ballsCountA > n or ballsCountB > n:
         return 0
       if i == len(balls):
-        return (1 if boxCase == BoxCase.EQUAL_BALLS
-                else colorsCountA == colorsCountB)
+        return 1 if boxCase == BoxCase.kEqualBalls else colorsCountA == colorsCountB
 
       ans = 0.0
 
@@ -31,13 +25,11 @@ def cases(
         ballsTakenB = balls[i] - ballsTakenA
         newcolorsCountA = colorsCountA + (ballsTakenA > 0)
         newcolorsCountB = colorsCountB + (ballsTakenB > 0)
-        ans += (cases(i + 1,
-                      ballsCountA + ballsTakenA,
-                      ballsCountB + ballsTakenB,
-                      newcolorsCountA, newcolorsCountB, boxCase) /
-                (fact[ballsTakenA] * fact[ballsTakenB]))
+        ans += cases(i + 1, ballsCountA + ballsTakenA, ballsCountB + ballsTakenB,
+                     newcolorsCountA, newcolorsCountB, boxCase) / \
+            (fact[ballsTakenA] * fact[ballsTakenB])
 
       return ans
 
-    return (cases(0, 0, 0, 0, 0, BoxCase.EQUAL_DISTANT_BALLS) /
-            cases(0, 0, 0, 0, 0, BoxCase.EQUAL_BALLS))
+    return cases(0, 0, 0, 0, 0, BoxCase.kEqualDistantBalls) / \
+        cases(0, 0, 0, 0, 0, BoxCase.kEqualBalls)
diff --git a/solutions/147. Insertion Sort List/147.py b/solutions/147. Insertion Sort List/147.py
index 9e2413df79b..470ed7b3bc1 100644
--- a/solutions/147. Insertion Sort List/147.py	
+++ b/solutions/147. Insertion Sort List/147.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def insertionSortList(self, head: ListNode | None) -> ListNode | None:
+  def insertionSortList(self, head: Optional[ListNode]) -> Optional[ListNode]:
     dummy = ListNode(0)
     prev = dummy  # the last and thus largest of the sorted list
 
diff --git a/solutions/1470. Shuffle the Array/1470.py b/solutions/1470. Shuffle the Array/1470.py
index e22fb3555a1..9f81cdc6608 100644
--- a/solutions/1470. Shuffle the Array/1470.py	
+++ b/solutions/1470. Shuffle the Array/1470.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def shuffle(self, nums: list[int], n: int) -> list[int]:
+  def shuffle(self, nums: List[int], n: int) -> List[int]:
     ans = []
     for a, b in zip(nums[:n], nums[n:]):
       ans.append(a)
diff --git a/solutions/1471. The k Strongest Values in an Array/1471.py b/solutions/1471. The k Strongest Values in an Array/1471.py
index 9e879151862..111bffcd69f 100644
--- a/solutions/1471. The k Strongest Values in an Array/1471.py	
+++ b/solutions/1471. The k Strongest Values in an Array/1471.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getStrongest(self, arr: list[int], k: int) -> list[int]:
+  def getStrongest(self, arr: List[int], k: int) -> List[int]:
     arr.sort()
 
     ans = []
diff --git a/solutions/1473. Paint House III/1473.java b/solutions/1473. Paint House III/1473.java
index d5610259eba..047bd2482ec 100644
--- a/solutions/1473. Paint House III/1473.java	
+++ b/solutions/1473. Paint House III/1473.java	
@@ -3,24 +3,24 @@ public int minCost(int[] houses, int[][] cost, int m, int n, int target) {
     int[][][] mem = new int[target + 1][m][n + 1];
     // Initialize `prevColor` to 0 (the virtual neighbor).
     final int c = minCost(houses, cost, m, n, target, 0, 0, mem);
-    return c == MAX ? -1 : c;
+    return c == kMax ? -1 : c;
   }
 
-  private static final int MAX = 1_000_001;
+  private static final int kMax = 1_000_001;
 
   // Returns the minimum cost to paint houses[i..m) into k neighborhoods, where
   // there are houses[i - 1] colors = prevColor.
   public int minCost(int[] houses, int[][] cost, int m, int n, int k, int i, int prevColor,
                      int[][][] mem) {
     if (i == m || k < 0)
-      return k == 0 ? 0 : MAX;
+      return k == 0 ? 0 : kMax;
     if (mem[k][i][prevColor] > 0)
       return mem[k][i][prevColor];
     if (houses[i] > 0) // The house was painted last year.
       return minCost(houses, cost, m, n, k - (prevColor == houses[i] ? 0 : 1), i + 1, houses[i],
                      mem);
 
-    int ans = MAX;
+    int ans = kMax;
 
     // Try to paint the houses[i] with each color in 1..n.
     for (int color = 1; color <= n; ++color)
diff --git a/solutions/1474. Delete N Nodes After M Nodes of a Linked List/1474.py b/solutions/1474. Delete N Nodes After M Nodes of a Linked List/1474.py
index 9e819099560..ae9e932a6e5 100644
--- a/solutions/1474. Delete N Nodes After M Nodes of a Linked List/1474.py	
+++ b/solutions/1474. Delete N Nodes After M Nodes of a Linked List/1474.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def deleteNodes(
-      self,
-      head: ListNode | None,
-      m: int,
-      n: int,
-  ) -> ListNode | None:
+  def deleteNodes(self, head: Optional[ListNode], m: int, n: int) -> Optional[ListNode]:
     curr = head
     prev = None  # prev.next == curr
 
diff --git a/solutions/1475. Final Prices With a Special Discount in a Shop/1475.py b/solutions/1475. Final Prices With a Special Discount in a Shop/1475.py
index 4a3c3d62c57..a9a97604c4b 100644
--- a/solutions/1475. Final Prices With a Special Discount in a Shop/1475.py	
+++ b/solutions/1475. Final Prices With a Special Discount in a Shop/1475.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def finalPrices(self, prices: list[int]) -> list[int]:
+  def finalPrices(self, prices: List[int]) -> List[int]:
     ans = prices.copy()
     stack = []
 
diff --git a/solutions/1476. Subrectangle Queries/1476.py b/solutions/1476. Subrectangle Queries/1476.py
index a8067c9ac4f..4f2f29f0069 100644
--- a/solutions/1476. Subrectangle Queries/1476.py	
+++ b/solutions/1476. Subrectangle Queries/1476.py	
@@ -1,10 +1,9 @@
 class SubrectangleQueries:
-  def __init__(self, rectangle: list[list[int]]):
+  def __init__(self, rectangle: List[List[int]]):
     self.rectangle = rectangle
     self.updates = []
 
-  def updateSubrectangle(self, row1: int, col1: int, row2: int, col2: int,
-                         newValue: int) -> None:
+  def updateSubrectangle(self, row1: int, col1: int, row2: int, col2: int, newValue: int) -> None:
     self.updates.append((row1, col1, row2, col2, newValue))
 
   def getValue(self, row: int, col: int) -> int:
diff --git a/solutions/1478. Allocate Mailboxes/1478.java b/solutions/1478. Allocate Mailboxes/1478.java
index 2af02018b47..16c5e24d976 100644
--- a/solutions/1478. Allocate Mailboxes/1478.java	
+++ b/solutions/1478. Allocate Mailboxes/1478.java	
@@ -19,14 +19,14 @@ public int minDistance(int[] houses, int k) {
     return minDistance(houses, 0, k, cost, mem);
   }
 
-  private static final int MAX = 1_000_000;
+  private static final int kMax = 1_000_000;
 
   // Returns the minimum distance to allocate k mailboxes for houses[i..n).
   private int minDistance(int[] houses, int i, int k, int[][] cost, int[][] mem) {
     if (i == houses.length && k == 0)
       return 0;
     if (i == houses.length || k == 0)
-      return MAX;
+      return kMax;
     if (mem[i][k] != Integer.MAX_VALUE)
       return mem[i][k];
 
diff --git a/solutions/148. Sort List/148.cpp b/solutions/148. Sort List/148.cpp
index 3904620a077..2fba9e07dfd 100644
--- a/solutions/148. Sort List/148.cpp	
+++ b/solutions/148. Sort List/148.cpp	
@@ -7,7 +7,7 @@ class Solution {
     for (int k = 1; k < length; k *= 2) {
       ListNode* curr = dummy.next;
       ListNode* tail = &dummy;
-      while (curr != nullptr) {
+      while (curr) {
         ListNode* l = curr;
         ListNode* r = split(l, k);
         curr = split(r, k);
@@ -49,7 +49,7 @@ class Solution {
       tail = tail->next;
     }
     tail->next = l1 ? l1 : l2;
-    while (tail->next != nullptr)
+    while (tail->next)
       tail = tail->next;
 
     return {dummy.next, tail};
diff --git a/solutions/1480. Running Sum of 1d Array/1480.py b/solutions/1480. Running Sum of 1d Array/1480.py
index 5560ba2306c..4b25218063f 100644
--- a/solutions/1480. Running Sum of 1d Array/1480.py	
+++ b/solutions/1480. Running Sum of 1d Array/1480.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def runningSum(self, nums: list[int]) -> list[int]:
+  def runningSum(self, nums: List[int]) -> List[int]:
     return itertools.accumulate(nums)
diff --git a/solutions/1481. Least Number of Unique Integers after K Removals/1481.py b/solutions/1481. Least Number of Unique Integers after K Removals/1481.py
index 3c18380d35f..9264ca325f9 100644
--- a/solutions/1481. Least Number of Unique Integers after K Removals/1481.py	
+++ b/solutions/1481. Least Number of Unique Integers after K Removals/1481.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLeastNumOfUniqueInts(self, arr: list[int], k: int) -> int:
+  def findLeastNumOfUniqueInts(self, arr: List[int], k: int) -> int:
     minHeap = list(collections.Counter(arr).values())
     heapq.heapify(minHeap)
 
diff --git a/solutions/1482. Minimum Number of Days to Make m Bouquets/1482.py b/solutions/1482. Minimum Number of Days to Make m Bouquets/1482.py
index 9bc3daa2cee..3eaa61bba20 100644
--- a/solutions/1482. Minimum Number of Days to Make m Bouquets/1482.py	
+++ b/solutions/1482. Minimum Number of Days to Make m Bouquets/1482.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minDays(self, bloomDay: list[int], m: int, k: int) -> int:
+  def minDays(self, bloomDay: List[int], m: int, k: int) -> int:
     if len(bloomDay) < m * k:
       return -1
 
diff --git a/solutions/1483. Kth Ancestor of a Tree Node/1483.py b/solutions/1483. Kth Ancestor of a Tree Node/1483.py
index 6b24a541a54..5c35a7f9f5d 100644
--- a/solutions/1483. Kth Ancestor of a Tree Node/1483.py	
+++ b/solutions/1483. Kth Ancestor of a Tree Node/1483.py	
@@ -1,5 +1,5 @@
 class TreeAncestor:
-  def __init__(self, n: int, parent: list[int]):
+  def __init__(self, n: int, parent: List[int]):
     self.maxLevel = n.bit_length()
     # dp[i][j] := node i's 2^j-th ancestor
     self.dp = [[0] * self.maxLevel for _ in range(n)]
diff --git a/solutions/1487. Making File Names Unique/1487.py b/solutions/1487. Making File Names Unique/1487.py
index df3bbbfaf1c..a9f49c717d1 100644
--- a/solutions/1487. Making File Names Unique/1487.py	
+++ b/solutions/1487. Making File Names Unique/1487.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getFolderNames(self, names: list[str]) -> list[str]:
+  def getFolderNames(self, names: List[str]) -> List[str]:
     ans = []
     nameToSuffix = {}
 
diff --git a/solutions/1488. Avoid Flood in The City/1488.py b/solutions/1488. Avoid Flood in The City/1488.py
index 9ef2dd94cca..c4dae6c1741 100644
--- a/solutions/1488. Avoid Flood in The City/1488.py	
+++ b/solutions/1488. Avoid Flood in The City/1488.py	
@@ -2,7 +2,7 @@
 
 
 class Solution:
-  def avoidFlood(self, rains: list[int]) -> list[int]:
+  def avoidFlood(self, rains: List[int]) -> List[int]:
     ans = [-1] * len(rains)
     lakeIdToFullDay = {}
     emptyDays = SortedSet()  # indices of rains[i] == 0
diff --git a/solutions/1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/1489.cpp b/solutions/1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/1489.cpp
index f59c17b0a99..f34ac0ce9c4 100644
--- a/solutions/1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/1489.cpp	
+++ b/solutions/1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/1489.cpp	
@@ -40,8 +40,9 @@ class Solution {
       edges[i].push_back(i);
 
     // Sort by the weight.
-    ranges::sort(edges, ranges::less{},
-                 [](const vector<int>& edge) { return edge[2]; });
+    sort(
+        edges.begin(), edges.end(),
+        [](const vector<int>& a, const vector<int>& b) { return a[2] < b[2]; });
 
     const int mstWeight = getMSTWeight(n, edges, {}, -1);
 
diff --git a/solutions/1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/1489.java b/solutions/1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/1489.java
index f988fa9eb06..d3663182c3b 100644
--- a/solutions/1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/1489.java	
+++ b/solutions/1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/1489.java	
@@ -39,7 +39,7 @@ public List<List<Integer>> findCriticalAndPseudoCriticalEdges(int n, int[][] edg
       edges[i] = new int[] {edges[i][0], edges[i][1], edges[i][2], i};
 
     // Sort by the weight.
-    Arrays.sort(edges, Comparator.comparingInt(edge -> edge[2]));
+    Arrays.sort(edges, (a, b) -> a[2] - b[2]);
 
     final int mstWeight = getMSTWeight(n, edges, new int[] {}, -1);
 
@@ -54,7 +54,7 @@ else if (getMSTWeight(n, edges, edge, -1) == mstWeight)
         pseudoCriticalEdges.add(index);
     }
 
-    return List.of(criticalEdges, pseudoCriticalEdges);
+    return new ArrayList<>(Arrays.asList(criticalEdges, pseudoCriticalEdges));
   }
 
   private int getMSTWeight(int n, int[][] edges, int[] firstEdge, int deletedEdgeIndex) {
diff --git a/solutions/1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/1489.py b/solutions/1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/1489.py
index 01694128cb6..5ab27cf8962 100644
--- a/solutions/1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/1489.py	
+++ b/solutions/1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/1489.py	
@@ -23,7 +23,7 @@ def find(self, u: int) -> int:
 
 
 class Solution:
-  def findCriticalAndPseudoCriticalEdges(self, n: int, edges: list[list[int]]) -> list[list[int]]:
+  def findCriticalAndPseudoCriticalEdges(self, n: int, edges: List[List[int]]) -> List[List[int]]:
     criticalEdges = []
     pseudoCriticalEdges = []
 
@@ -34,9 +34,7 @@ def findCriticalAndPseudoCriticalEdges(self, n: int, edges: list[list[int]]) ->
     # Sort by the weight.
     edges.sort(key=lambda x: x[2])
 
-    def getMSTWeight(
-            firstEdge: list[int],
-            deletedEdgeIndex: int) -> int | float:
+    def getMSTWeight(firstEdge: List[int], deletedEdgeIndex: int) -> Union[int, float]:
       mstWeight = 0
       uf = UnionFind(n)
 
diff --git a/solutions/149. Max Points on a Line/149.py b/solutions/149. Max Points on a Line/149.py
index 0b6eee167ec..58836aac3d8 100644
--- a/solutions/149. Max Points on a Line/149.py	
+++ b/solutions/149. Max Points on a Line/149.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def maxPoints(self, points: list[list[int]]) -> int:
+  def maxPoints(self, points: List[List[int]]) -> int:
     ans = 0
 
     def gcd(a: int, b: int) -> int:
       return a if b == 0 else gcd(b, a % b)
 
-    def getSlope(p: list[int], q: list[int]) -> tuple[int, int]:
+    def getSlope(p: List[int], q: List[int]) -> Tuple[int, int]:
       dx = p[0] - q[0]
       dy = p[1] - q[1]
       if dx == 0:
diff --git a/solutions/1491. Average Salary Excluding the Minimum and Maximum Salary/1491.py b/solutions/1491. Average Salary Excluding the Minimum and Maximum Salary/1491.py
index 75f5bf9b985..b811945853b 100644
--- a/solutions/1491. Average Salary Excluding the Minimum and Maximum Salary/1491.py	
+++ b/solutions/1491. Average Salary Excluding the Minimum and Maximum Salary/1491.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def average(self, salary: list[int]) -> float:
+  def average(self, salary: List[int]) -> float:
     return (sum(salary) - max(salary) - min(salary)) / (len(salary) - 2)
diff --git a/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493-2.cpp b/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493-2.cpp
index 3eda7dce8e5..fbb17378112 100644
--- a/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493-2.cpp	
+++ b/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493-2.cpp	
@@ -2,13 +2,13 @@ class Solution {
  public:
   int longestSubarray(vector<int>& nums) {
     int l = 0;
-    int zeros = 0;
+    int count0 = 0;
 
     for (const int num : nums) {
       if (num == 0)
-        ++zeros;
-      if (zeros > 1 && nums[l++] == 0)
-        --zeros;
+        ++count0;
+      if (count0 > 1 && nums[l++] == 0)
+        --count0;
     }
 
     return nums.size() - l - 1;
diff --git a/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493-2.java b/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493-2.java
index c19e807c28a..08aca8a3a62 100644
--- a/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493-2.java	
+++ b/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493-2.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int longestSubarray(int[] nums) {
     int l = 0;
-    int zeros = 0;
+    int count0 = 0;
 
     for (final int num : nums) {
       if (num == 0)
-        ++zeros;
-      if (zeros > 1 && nums[l++] == 0)
-        --zeros;
+        ++count0;
+      if (count0 > 1 && nums[l++] == 0)
+        --count0;
     }
 
     return nums.length - l - 1;
diff --git a/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493-2.py b/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493-2.py
index 8960becb4a2..aa22d7ed0e9 100644
--- a/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493-2.py	
+++ b/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493-2.py	
@@ -1,14 +1,14 @@
 class Solution:
-  def longestSubarray(self, nums: list[int]) -> int:
+  def longestSubarray(self, nums: List[int]) -> int:
     l = 0
-    zeros = 0
+    count0 = 0
 
     for num in nums:
       if num == 0:
-        zeros += 1
-      if zeros > 1:
+        count0 += 1
+      if count0 > 1:
         if nums[l] == 0:
-          zeros -= 1
+          count0 -= 1
         l += 1
 
     return len(nums) - l - 1
diff --git a/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493.cpp b/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493.cpp
index c604bcb1796..c7db2bf08a7 100644
--- a/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493.cpp	
+++ b/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493.cpp	
@@ -2,14 +2,14 @@ class Solution {
  public:
   int longestSubarray(vector<int>& nums) {
     int ans = 0;
-    int zeros = 0;
+    int count0 = 0;
 
     for (int l = 0, r = 0; r < nums.size(); ++r) {
       if (nums[r] == 0)
-        ++zeros;
-      while (zeros == 2)
+        ++count0;
+      while (count0 == 2)
         if (nums[l++] == 0)
-          --zeros;
+          --count0;
       ans = max(ans, r - l);
     }
 
diff --git a/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493.java b/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493.java
index 9c10dbb8685..3c26d728127 100644
--- a/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493.java	
+++ b/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493.java	
@@ -1,14 +1,14 @@
 class Solution {
   public int longestSubarray(int[] nums) {
     int ans = 0;
-    int zeros = 0;
+    int count0 = 0;
 
     for (int l = 0, r = 0; r < nums.length; ++r) {
       if (nums[r] == 0)
-        ++zeros;
-      while (zeros == 2)
+        ++count0;
+      while (count0 == 2)
         if (nums[l++] == 0)
-          --zeros;
+          --count0;
       ans = Math.max(ans, r - l);
     }
 
diff --git a/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493.py b/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493.py
index f1d04ede5a5..2dce475ff3d 100644
--- a/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493.py	
+++ b/solutions/1493. Longest Subarray of 1's After Deleting One Element/1493.py	
@@ -1,15 +1,15 @@
 class Solution:
-  def longestSubarray(self, nums: list[int]) -> int:
+  def longestSubarray(self, nums: List[int]) -> int:
     ans = 0
-    zeros = 0
+    count0 = 0
 
     l = 0
     for r, num in enumerate(nums):
       if num == 0:
-        zeros += 1
-      while zeros == 2:
+        count0 += 1
+      while count0 == 2:
         if nums[l] == 0:
-          zeros -= 1
+          count0 -= 1
         l += 1
       ans = max(ans, r - l)
 
diff --git a/solutions/1494. Parallel Courses II/1494.py b/solutions/1494. Parallel Courses II/1494.py
index 1ddaa6422bb..a225f658b9a 100644
--- a/solutions/1494. Parallel Courses II/1494.py	
+++ b/solutions/1494. Parallel Courses II/1494.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minNumberOfSemesters(
-      self,
-      n: int,
-      relations: list[list[int]],
-      k: int,
-  ) -> int:
+  def minNumberOfSemesters(self, n: int, relations: List[List[int]], k: int) -> int:
     # dp[i] := the minimum number of semesters to take the courses, where i is
     # the bitmask of the taken courses
     dp = [n] * (1 << n)
diff --git a/solutions/1497. Check If Array Pairs Are Divisible by k/1497.py b/solutions/1497. Check If Array Pairs Are Divisible by k/1497.py
index 829d81082c4..3d2866ec08e 100644
--- a/solutions/1497. Check If Array Pairs Are Divisible by k/1497.py	
+++ b/solutions/1497. Check If Array Pairs Are Divisible by k/1497.py	
@@ -1,11 +1,10 @@
 class Solution:
-  def canArrange(self, arr: list[int], k: int) -> bool:
+  def canArrange(self, arr: List[int], k: int) -> bool:
     count = [0] * k
 
     for a in arr:
       a %= k
       count[a if a >= 0 else a + k] += 1
 
-    return (count[0] % 2 == 0 and
-            all(count[i] == count[k - i]
-                for i in range(1, k // 2 + 1)))
+    return count[0] % 2 == 0 and \
+        all(count[i] == count[k - i] for i in range(1, k // 2 + 1))
diff --git a/solutions/1498. Number of Subsequences That Satisfy the Given Sum Condition/1498.java b/solutions/1498. Number of Subsequences That Satisfy the Given Sum Condition/1498.java
index 77488b58123..fee017d20e6 100644
--- a/solutions/1498. Number of Subsequences That Satisfy the Given Sum Condition/1498.java	
+++ b/solutions/1498. Number of Subsequences That Satisfy the Given Sum Condition/1498.java	
@@ -1,20 +1,20 @@
 class Solution {
   public int numSubseq(int[] nums, int target) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = nums.length;
     int ans = 0;
-    int[] pows = new int[n]; // pows[i] = 2^i % MOD
+    int[] pows = new int[n]; // pows[i] = 2^i % kMod
     pows[0] = 1;
 
     for (int i = 1; i < n; ++i)
-      pows[i] = pows[i - 1] * 2 % MOD;
+      pows[i] = pows[i - 1] * 2 % kMod;
 
     Arrays.sort(nums);
 
     for (int l = 0, r = n - 1; l <= r;)
       if (nums[l] + nums[r] <= target) {
         ans += pows[r - l];
-        ans %= MOD;
+        ans %= kMod;
         ++l;
       } else {
         --r;
diff --git a/solutions/1498. Number of Subsequences That Satisfy the Given Sum Condition/1498.py b/solutions/1498. Number of Subsequences That Satisfy the Given Sum Condition/1498.py
index c40d26e93ce..7117194ac41 100644
--- a/solutions/1498. Number of Subsequences That Satisfy the Given Sum Condition/1498.py	
+++ b/solutions/1498. Number of Subsequences That Satisfy the Given Sum Condition/1498.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def numSubseq(self, nums: list[int], target: int) -> int:
-    MOD = 1_000_000_007
+  def numSubseq(self, nums: List[int], target: int) -> int:
+    kMod = 1_000_000_007
     n = len(nums)
     ans = 0
 
@@ -10,9 +10,9 @@ def numSubseq(self, nums: list[int], target: int) -> int:
     r = n - 1
     while l <= r:
       if nums[l] + nums[r] <= target:
-        ans += pow(2, r - l, MOD)
+        ans += pow(2, r - l, kMod)
         l += 1
       else:
         r -= 1
 
-    return ans % MOD
+    return ans % kMod
diff --git a/solutions/1499. Max Value of Equation/1499-2.py b/solutions/1499. Max Value of Equation/1499-2.py
index 0d3383b8823..454f2a66916 100644
--- a/solutions/1499. Max Value of Equation/1499-2.py	
+++ b/solutions/1499. Max Value of Equation/1499-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaxValueOfEquation(self, points: list[list[int]], k: int) -> int:
+  def findMaxValueOfEquation(self, points: List[List[int]], k: int) -> int:
     ans = -math.inf
     maxQ = collections.deque()  # (y - x, x)
 
diff --git a/solutions/1499. Max Value of Equation/1499.java b/solutions/1499. Max Value of Equation/1499.java
index 39efc7ff1d5..ba2582802c9 100644
--- a/solutions/1499. Max Value of Equation/1499.java	
+++ b/solutions/1499. Max Value of Equation/1499.java	
@@ -3,7 +3,9 @@ public int findMaxValueOfEquation(int[][] points, int k) {
     int ans = Integer.MIN_VALUE;
     // (y - x, x)
     Queue<Pair<Integer, Integer>> maxHeap =
-        new PriorityQueue<>(Comparator.comparing(Pair::getKey, Comparator.reverseOrder()));
+        new PriorityQueue<>((a, b)
+                                -> a.getKey().equals(b.getKey()) ? b.getValue() - a.getValue()
+                                                                 : b.getKey() - a.getKey());
 
     for (int[] p : points) {
       final int x = p[0];
diff --git a/solutions/1499. Max Value of Equation/1499.py b/solutions/1499. Max Value of Equation/1499.py
index 29f4311adee..424f6556e8c 100644
--- a/solutions/1499. Max Value of Equation/1499.py	
+++ b/solutions/1499. Max Value of Equation/1499.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaxValueOfEquation(self, points: list[list[int]], k: int) -> int:
+  def findMaxValueOfEquation(self, points: List[List[int]], k: int) -> int:
     ans = -math.inf
     maxHeap = []  # (y - x, x)
 
diff --git a/solutions/15. 3Sum/15.py b/solutions/15. 3Sum/15.py
index 7bec3042083..dfa36a4ca41 100644
--- a/solutions/15. 3Sum/15.py	
+++ b/solutions/15. 3Sum/15.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def threeSum(self, nums: list[int]) -> list[list[int]]:
+  def threeSum(self, nums: List[int]) -> List[List[int]]:
     if len(nums) < 3:
       return []
 
diff --git a/solutions/150. Evaluate Reverse Polish Notation/150.py b/solutions/150. Evaluate Reverse Polish Notation/150.py
index 5a9b1143d23..2cc51d6d24e 100644
--- a/solutions/150. Evaluate Reverse Polish Notation/150.py	
+++ b/solutions/150. Evaluate Reverse Polish Notation/150.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def evalRPN(self, tokens: list[str]) -> int:
+  def evalRPN(self, tokens: List[str]) -> int:
     stack = []
     op = {
         '+': lambda a, b: a + b,
diff --git a/solutions/1500. Design a File Sharing System/1500.java b/solutions/1500. Design a File Sharing System/1500.java
index 63cbcabe258..a8030d6be07 100644
--- a/solutions/1500. Design a File Sharing System/1500.java	
+++ b/solutions/1500. Design a File Sharing System/1500.java	
@@ -1,6 +1,4 @@
 class FileSharing {
-  public FileSharing(int m) {}
-
   public int join(List<Integer> ownedChunks) {
     final int userId =
         availableUserIds.isEmpty() ? userToChunks.size() + 1 : availableUserIds.poll();
diff --git a/solutions/1500. Design a File Sharing System/1500.py b/solutions/1500. Design a File Sharing System/1500.py
index 62c4cffcf65..8b3446a74a6 100644
--- a/solutions/1500. Design a File Sharing System/1500.py	
+++ b/solutions/1500. Design a File Sharing System/1500.py	
@@ -3,13 +3,13 @@
 
 class FileSharing:
   def __init__(self, m: int):
-    self.userToChunks: dict[int, SortedSet[int]] = {}
-    self.chunkToUsers: dict[int, SortedSet[int]] = {}
-    self.availableUserIds: list[int] = []
+    self.userToChunks: Dict[int, SortedSet[int]] = {}
+    self.chunkToUsers: Dict[int, SortedSet[int]] = {}
+    self.availableUserIds: List[int] = []
 
-  def join(self, ownedChunks: list[int]) -> int:
-    userId = (heapq.heappop(self.availableUserIds) if self.availableUserIds
-              else len(self.userToChunks) + 1)
+  def join(self, ownedChunks: List[int]) -> int:
+    userId = heapq.heappop(self.availableUserIds) if self.availableUserIds \
+      else len(self.userToChunks) + 1
     self.userToChunks[userId] = SortedSet(ownedChunks)
     for chunk in ownedChunks:
       self.chunkToUsers.setdefault(chunk, SortedSet()).add(userId)
@@ -25,7 +25,7 @@ def leave(self, userID: int) -> None:
     del self.userToChunks[userID]
     heapq.heappush(self.availableUserIds, userID)
 
-  def request(self, userID: int, chunkID: int) -> list[int]:
+  def request(self, userID: int, chunkID: int) -> List[int]:
     if chunkID not in self.chunkToUsers:
       return []
     userIds = list(self.chunkToUsers[chunkID])
diff --git a/solutions/1504. Count Submatrices With All Ones/1504-2.cpp b/solutions/1504. Count Submatrices With All Ones/1504-2.cpp
index 66cc5d54838..df4a283a87c 100644
--- a/solutions/1504. Count Submatrices With All Ones/1504-2.cpp	
+++ b/solutions/1504. Count Submatrices With All Ones/1504-2.cpp	
@@ -1,8 +1,10 @@
 class Solution {
  public:
   int numSubmat(vector<vector<int>>& mat) {
+    const int m = mat.size();
+    const int n = mat[0].size();
     int ans = 0;
-    vector<int> hist(mat[0].size());
+    vector<int> hist(n);
 
     for (const vector<int>& row : mat) {
       for (int i = 0; i < row.size(); ++i)
@@ -14,20 +16,20 @@ class Solution {
   }
 
  private:
-  int count(const vector<int>& hist) {
+  int count(const vector<int>& A) {
     // submatrices[i] := the number of submatrices, where the i-th column is the
     // right border
-    vector<int> submatrices(hist.size());
+    vector<int> submatrices(A.size());
     stack<int> stack;
 
-    for (int i = 0; i < hist.size(); ++i) {
-      while (!stack.empty() && hist[stack.top()] >= hist[i])
+    for (int i = 0; i < A.size(); ++i) {
+      while (!stack.empty() && A[stack.top()] >= A[i])
         stack.pop();
       if (!stack.empty()) {
         const int prevIndex = stack.top();
-        submatrices[i] = submatrices[prevIndex] + hist[i] * (i - prevIndex);
+        submatrices[i] = submatrices[prevIndex] + A[i] * (i - prevIndex);
       } else {
-        submatrices[i] = hist[i] * (i + 1);
+        submatrices[i] = A[i] * (i + 1);
       }
       stack.push(i);
     }
diff --git a/solutions/1504. Count Submatrices With All Ones/1504-2.java b/solutions/1504. Count Submatrices With All Ones/1504-2.java
index 6d782b16e7b..c48c7a154fc 100644
--- a/solutions/1504. Count Submatrices With All Ones/1504-2.java	
+++ b/solutions/1504. Count Submatrices With All Ones/1504-2.java	
@@ -1,7 +1,9 @@
 class Solution {
   public int numSubmat(int[][] mat) {
+    final int m = mat.length;
+    final int n = mat[0].length;
     int ans = 0;
-    int[] hist = new int[mat[0].length];
+    int[] hist = new int[n];
 
     for (int[] row : mat) {
       for (int i = 0; i < row.length; ++i)
@@ -12,20 +14,19 @@ public int numSubmat(int[][] mat) {
     return ans;
   }
 
-  private int count(int[] hist) {
-    // submatrices[i] := the number of submatrices, where the i-th column is the
-    // right border
-    int[] submatrices = new int[hist.length];
+  private int count(int[] A) {
+    // submatrices[i] := the number of submatrices, where the i-th column is the right border
+    int[] submatrices = new int[A.length];
     Deque<Integer> stack = new ArrayDeque<>();
 
-    for (int i = 0; i < hist.length; ++i) {
-      while (!stack.isEmpty() && hist[stack.peek()] >= hist[i])
+    for (int i = 0; i < A.length; ++i) {
+      while (!stack.isEmpty() && A[stack.peek()] >= A[i])
         stack.pop();
       if (!stack.isEmpty()) {
         final int prevIndex = stack.peek();
-        submatrices[i] = submatrices[prevIndex] + hist[i] * (i - prevIndex);
+        submatrices[i] = submatrices[prevIndex] + A[i] * (i - prevIndex);
       } else {
-        submatrices[i] = hist[i] * (i + 1);
+        submatrices[i] = A[i] * (i + 1);
       }
       stack.push(i);
     }
diff --git a/solutions/1504. Count Submatrices With All Ones/1504-2.py b/solutions/1504. Count Submatrices With All Ones/1504-2.py
deleted file mode 100644
index be59092294e..00000000000
--- a/solutions/1504. Count Submatrices With All Ones/1504-2.py	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution:
-  def numSubmat(self, mat: list[list[int]]) -> int:
-    ans = 0
-    hist = [0] * len(mat[0])
-
-    for row in mat:
-      for i, num in enumerate(row):
-        hist[i] = 0 if num == 0 else hist[i] + 1
-      ans += self._count(hist)
-
-    return ans
-
-  def _count(self, hist: list[int]) -> int:
-    # submatrices[i] := the number of submatrices, where the i-th column is the
-    # right border
-    submatrices = [0] * len(hist)
-    stack = []
-
-    for i, h in enumerate(hist):
-      while stack and hist[stack[-1]] >= h:
-        stack.pop()
-      if stack:
-        prevIndex = stack[-1]
-        submatrices[i] = submatrices[prevIndex] + h * (i - prevIndex)
-      else:
-        submatrices[i] = h * (i + 1)
-      stack.append(i)
-
-    return sum(submatrices)
diff --git a/solutions/1504. Count Submatrices With All Ones/1504.cpp b/solutions/1504. Count Submatrices With All Ones/1504.cpp
index c9cdbf191f2..d70613eb512 100644
--- a/solutions/1504. Count Submatrices With All Ones/1504.cpp	
+++ b/solutions/1504. Count Submatrices With All Ones/1504.cpp	
@@ -19,12 +19,14 @@ class Solution {
 
  private:
   int count(vector<int>& row) {
-    int res = 0;
+    int ans = 0;
     int length = 0;
-    for (const int num : row) {
-      length = num == 0 ? 0 : length + 1;
-      res += length;
+
+    for (const int a : row) {
+      length = a == 0 ? 0 : length + 1;
+      ans += length;
     }
-    return res;
+
+    return ans;
   }
 };
diff --git a/solutions/1504. Count Submatrices With All Ones/1504.java b/solutions/1504. Count Submatrices With All Ones/1504.java
index b1016a999a3..3748a6d2927 100644
--- a/solutions/1504. Count Submatrices With All Ones/1504.java	
+++ b/solutions/1504. Count Submatrices With All Ones/1504.java	
@@ -18,12 +18,14 @@ public int numSubmat(int[][] mat) {
   }
 
   private int count(int[] row) {
-    int res = 0;
+    int ans = 0;
     int length = 0;
-    for (final int num : row) {
-      length = num == 0 ? 0 : length + 1;
-      res += length;
+
+    for (final int a : row) {
+      length = a == 0 ? 0 : length + 1;
+      ans += length;
     }
-    return res;
+
+    return ans;
   }
 }
diff --git a/solutions/1504. Count Submatrices With All Ones/1504.py b/solutions/1504. Count Submatrices With All Ones/1504.py
deleted file mode 100644
index 9f078459c51..00000000000
--- a/solutions/1504. Count Submatrices With All Ones/1504.py	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution:
-  def numSubmat(self, mat: list[list[int]]) -> int:
-    m = len(mat)
-    n = len(mat[0])
-    ans = 0
-
-    for baseRow in range(m):
-      row = [1] * n
-      for i in range(baseRow, m):
-        for j in range(n):
-          row[j] &= mat[i][j]
-        ans += self._count(row)
-
-    return ans
-
-  def _count(self, row: list[int]) -> int:
-    res = 0
-    length = 0
-    for num in row:
-      length = 0 if num == 0 else length + 1
-      res += length
-    return res
diff --git a/solutions/1506. Find Root of N-Ary Tree/1506.py b/solutions/1506. Find Root of N-Ary Tree/1506.py
index 7aa9b8b393c..081306471ca 100644
--- a/solutions/1506. Find Root of N-Ary Tree/1506.py	
+++ b/solutions/1506. Find Root of N-Ary Tree/1506.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findRoot(self, tree: list['Node']) -> 'Node':
+  def findRoot(self, tree: List['Node']) -> 'Node':
     sum = 0
 
     for node in tree:
diff --git a/solutions/1509. Minimum Difference Between Largest and Smallest Value in Three Moves/1509.py b/solutions/1509. Minimum Difference Between Largest and Smallest Value in Three Moves/1509.py
index 565e97c4880..db30d4d4e0b 100644
--- a/solutions/1509. Minimum Difference Between Largest and Smallest Value in Three Moves/1509.py	
+++ b/solutions/1509. Minimum Difference Between Largest and Smallest Value in Three Moves/1509.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minDifference(self, nums: list[int]) -> int:
+  def minDifference(self, nums: List[int]) -> int:
     n = len(nums)
     if n < 5:
       return 0
diff --git a/solutions/151. Reverse Words in a String/151.cpp b/solutions/151. Reverse Words in a String/151.cpp
index ad52b877117..1c818913bfc 100644
--- a/solutions/151. Reverse Words in a String/151.cpp	
+++ b/solutions/151. Reverse Words in a String/151.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   string reverseWords(string s) {
-    ranges::reverse(s);                 // Reverse the whole string.
+    reverse(s.begin(), s.end());        // Reverse the whole string.
     reverseWords(s, s.length());        // Reverse each word.
     return cleanSpaces(s, s.length());  // Clean up the spaces.
   }
diff --git a/solutions/1514. Path with Maximum Probability/1514.java b/solutions/1514. Path with Maximum Probability/1514.java
index 31e4bb450ce..6c08a555423 100644
--- a/solutions/1514. Path with Maximum Probability/1514.java	
+++ b/solutions/1514. Path with Maximum Probability/1514.java	
@@ -4,11 +4,13 @@ public double maxProbability(int n, int[][] edges, double[] succProb, int start,
     List<Pair<Integer, Double>>[] graph = new List[n];
     // (the probability to reach u, u)
     Queue<Pair<Double, Integer>> maxHeap =
-        new PriorityQueue<>((a, b) -> Double.compare(b.getKey(), a.getKey())) {
-          { offer(new Pair<>(1.0, start)); }
-        };
+        new PriorityQueue<>((a, b) -> Double.compare(b.getKey(), a.getKey()));
+
+    maxHeap.offer(new Pair<>(1.0, start));
     boolean[] seen = new boolean[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int i = 0; i < edges.length; ++i) {
       final int u = edges[i][0];
diff --git a/solutions/1514. Path with Maximum Probability/1514.py b/solutions/1514. Path with Maximum Probability/1514.py
index a5a3dc63a57..720fe668ea2 100644
--- a/solutions/1514. Path with Maximum Probability/1514.py	
+++ b/solutions/1514. Path with Maximum Probability/1514.py	
@@ -1,12 +1,5 @@
 class Solution:
-  def maxProbability(
-      self,
-      n: int,
-      edges: list[list[int]],
-      succProb: list[float],
-      start: int,
-      end: int,
-  ) -> float:
+  def maxProbability(self, n: int, edges: List[List[int]], succProb: List[float], start: int, end: int) -> float:
     graph = [[] for _ in range(n)]  # {a: [(b, probability_ab)]}
     maxHeap = [(-1.0, start)]   # (the probability to reach u, u)
     seen = [False] * n
diff --git a/solutions/1515. Best Position for a Service Centre/1515.java b/solutions/1515. Best Position for a Service Centre/1515.java
index bd2db1d3215..464f88c6999 100644
--- a/solutions/1515. Best Position for a Service Centre/1515.java	
+++ b/solutions/1515. Best Position for a Service Centre/1515.java	
@@ -1,16 +1,16 @@
 class Solution {
   public double getMinDistSum(int[][] positions) {
-    final double ERR = 1e-6;
+    final double kErr = 1e-6;
     double currX = 50;
     double currY = 50;
     double ans = distSum(positions, currX, currY);
     double step = 1;
 
-    while (step > ERR) {
+    while (step > kErr) {
       boolean shouldDecreaseStep = true;
-      for (double[] DIRS : new double[][] {{0, step}, {0, -step}, {step, 0}, {-step, 0}}) {
-        final double x = currX + DIRS[0];
-        final double y = currY + DIRS[1];
+      for (double[] dirs : new double[][] {{0, step}, {0, -step}, {step, 0}, {-step, 0}}) {
+        final double x = currX + dirs[0];
+        final double y = currY + dirs[1];
         final double newDistSum = distSum(positions, x, y);
         if (newDistSum < ans) {
           ans = newDistSum;
diff --git a/solutions/1515. Best Position for a Service Centre/1515.py b/solutions/1515. Best Position for a Service Centre/1515.py
index 0890462b547..2d7d87b0617 100644
--- a/solutions/1515. Best Position for a Service Centre/1515.py	
+++ b/solutions/1515. Best Position for a Service Centre/1515.py	
@@ -1,16 +1,16 @@
 class Solution:
-  def getMinDistSum(self, positions: list[list[int]]) -> float:
+  def getMinDistSum(self, positions: List[List[int]]) -> float:
     def distSum(a: float, b: float) -> float:
       return sum(math.sqrt((a - x)**2 + (b - y)**2)
                  for x, y in positions)
 
-    ERR = 1e-6
+    kErr = 1e-6
     currX = 50
     currY = 50
     ans = distSum(currX, currY)
     step = 1
 
-    while step > ERR:
+    while step > kErr:
       shouldDecreaseStep = True
       for dx, dy in [(0, step), (0, -step), (step, 0), (-step, 0)]:
         x = currX + dx
diff --git a/solutions/1519. Number of Nodes in the Sub-Tree With the Same Label/1519.cpp b/solutions/1519. Number of Nodes in the Sub-Tree With the Same Label/1519.cpp
index 50aa746b237..f8cb89c996c 100644
--- a/solutions/1519. Number of Nodes in the Sub-Tree With the Same Label/1519.cpp	
+++ b/solutions/1519. Number of Nodes in the Sub-Tree With the Same Label/1519.cpp	
@@ -16,13 +16,13 @@ class Solution {
   }
 
  private:
-  vector<int> dfs(const vector<vector<int>>& tree, int u, int prev,
+  vector<int> dfs(const vector<vector<int>>& tree, int u, int parent,
                   const string& labels, vector<int>& ans) {
     // count[i] := the number of letters down from ('a' + i)
     vector<int> count(26);
 
     for (const int v : tree[u]) {
-      if (v == prev)
+      if (v == parent)
         continue;
       vector<int> childCount = dfs(tree, v, u, labels, ans);
       for (int i = 0; i < 26; ++i)
diff --git a/solutions/1519. Number of Nodes in the Sub-Tree With the Same Label/1519.java b/solutions/1519. Number of Nodes in the Sub-Tree With the Same Label/1519.java
index c8da5f7844d..70f1f4adb7b 100644
--- a/solutions/1519. Number of Nodes in the Sub-Tree With the Same Label/1519.java	
+++ b/solutions/1519. Number of Nodes in the Sub-Tree With the Same Label/1519.java	
@@ -2,7 +2,9 @@ class Solution {
   public int[] countSubTrees(int n, int[][] edges, String labels) {
     int[] ans = new int[n];
     List<Integer>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
@@ -15,12 +17,12 @@ public int[] countSubTrees(int n, int[][] edges, String labels) {
     return ans;
   }
 
-  private int[] dfs(List<Integer>[] graph, int u, int prev, final String labels, int[] ans) {
+  private int[] dfs(List<Integer>[] graph, int u, int parent, final String labels, int[] ans) {
     // count[i] := the number of letters down from ('a' + i)
     int[] count = new int[26];
 
     for (final int v : graph[u]) {
-      if (v == prev)
+      if (v == parent)
         continue;
       int[] childCount = dfs(graph, v, u, labels, ans);
       for (int i = 0; i < 26; ++i)
diff --git a/solutions/152. Maximum Product Subarray/152.py b/solutions/152. Maximum Product Subarray/152.py
index 71e10739552..100049d58c8 100644
--- a/solutions/152. Maximum Product Subarray/152.py	
+++ b/solutions/152. Maximum Product Subarray/152.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxProduct(self, nums: list[int]) -> int:
+  def maxProduct(self, nums: List[int]) -> int:
     ans = nums[0]
     dpMin = nums[0]  # the minimum so far
     dpMax = nums[0]  # the maximum so far
diff --git a/solutions/1521. Find a Value of a Mysterious Function Closest to Target/1521.cpp b/solutions/1521. Find a Value of a Mysterious Function Closest to Target/1521.cpp
index 224d790ed99..762018e2293 100644
--- a/solutions/1521. Find a Value of a Mysterious Function Closest to Target/1521.cpp	
+++ b/solutions/1521. Find a Value of a Mysterious Function Closest to Target/1521.cpp	
@@ -14,7 +14,7 @@ class Solution {
         curr.insert(val & num);
       for (const int val : curr)
         ans = min(ans, abs(target - val));
-      prev = std::move(curr);
+      prev = move(curr);
     }
 
     return ans;
diff --git a/solutions/1521. Find a Value of a Mysterious Function Closest to Target/1521.py b/solutions/1521. Find a Value of a Mysterious Function Closest to Target/1521.py
index 83dd943771b..7b95a8649a9 100644
--- a/solutions/1521. Find a Value of a Mysterious Function Closest to Target/1521.py	
+++ b/solutions/1521. Find a Value of a Mysterious Function Closest to Target/1521.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def closestToTarget(self, arr: list[int], target: int) -> int:
+  def closestToTarget(self, arr: List[int], target: int) -> int:
     ans = math.inf
     dp = set()  # all the values of subarrays that end in the current number
 
diff --git a/solutions/1526. Minimum Number of Increments on Subarrays to Form a Target Array/1526.py b/solutions/1526. Minimum Number of Increments on Subarrays to Form a Target Array/1526.py
index 4c8ff8b8a11..71991e0a935 100644
--- a/solutions/1526. Minimum Number of Increments on Subarrays to Form a Target Array/1526.py	
+++ b/solutions/1526. Minimum Number of Increments on Subarrays to Form a Target Array/1526.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minNumberOperations(self, target: list[int]) -> int:
+  def minNumberOperations(self, target: List[int]) -> int:
     ans = target[0]
 
     for a, b in zip(target, target[1:]):
diff --git a/solutions/153. Find Minimum in Rotated Sorted Array/153.py b/solutions/153. Find Minimum in Rotated Sorted Array/153.py
index 4492ec91add..18d4b234146 100644
--- a/solutions/153. Find Minimum in Rotated Sorted Array/153.py	
+++ b/solutions/153. Find Minimum in Rotated Sorted Array/153.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMin(self, nums: list[int]) -> int:
+  def findMin(self, nums: List[int]) -> int:
     l = 0
     r = len(nums) - 1
 
diff --git a/solutions/1531. String Compression II/1531.java b/solutions/1531. String Compression II/1531.java
index 6ab82359451..04389a0da5d 100644
--- a/solutions/1531. String Compression II/1531.java	
+++ b/solutions/1531. String Compression II/1531.java	
@@ -1,20 +1,20 @@
 class Solution {
   public int getLengthOfOptimalCompression(String s, int k) {
     int[][] mem = new int[s.length()][k + 1];
-    Arrays.stream(mem).forEach(A -> Arrays.fill(A, MAX));
+    Arrays.stream(mem).forEach(A -> Arrays.fill(A, kMax));
     return compression(s, 0, k, mem);
   }
 
-  private static final int MAX = 101;
+  private static final int kMax = 101;
 
   // Returns the length of the optimal compression of s[i..n) with at most k
   // deletion.
   private int compression(final String s, int i, int k, int[][] mem) {
     if (k < 0)
-      return MAX;
+      return kMax;
     if (i == s.length() || s.length() - i <= k)
       return 0;
-    if (mem[i][k] != MAX)
+    if (mem[i][k] != kMax)
       return mem[i][k];
 
     int maxFreq = 0;
diff --git a/solutions/1533. Find the Index of the Large Integer/1533-2.py b/solutions/1533. Find the Index of the Large Integer/1533-2.py
index 359a61931bd..414f2d4434f 100644
--- a/solutions/1533. Find the Index of the Large Integer/1533-2.py	
+++ b/solutions/1533. Find the Index of the Large Integer/1533-2.py	
@@ -21,8 +21,8 @@ def getIndex(self, reader: 'ArrayReader') -> int:
 
     while l < r:
       m = (l + r) // 2
-      res = (reader.compareSub(l, m, m + 1, r) if (r - l + 1) % 2 == 0
-             else reader.compareSub(l, m, m, r))
+      res = reader.compareSub(l, m, m + 1, r) if (r - l + 1) % 2 == 0 \
+          else reader.compareSub(l, m, m, r)
       if res == -1:
         l = m + 1
       else:  # res == 1 or res == 0
diff --git a/solutions/1534. Count Good Triplets/1534.py b/solutions/1534. Count Good Triplets/1534.py
index 76c6e1c38e9..290171e277f 100644
--- a/solutions/1534. Count Good Triplets/1534.py	
+++ b/solutions/1534. Count Good Triplets/1534.py	
@@ -1,6 +1,8 @@
 class Solution:
-  def countGoodTriplets(self, arr: list[int], a: int, b: int, c: int) -> int:
+  def countGoodTriplets(self, arr: List[int], a: int, b: int, c: int) -> int:
     return sum(abs(arr[i] - arr[j]) <= a and
                abs(arr[j] - arr[k]) <= b and
                abs(arr[i] - arr[k]) <= c
-               for i, j, k in itertools.combinations(range(len(arr)), 3))
+               for i in range(len(arr))
+               for j in range(i + 1, len(arr))
+               for k in range(j + 1, len(arr)))
diff --git a/solutions/1535. Find the Winner of an Array Game/1535.py b/solutions/1535. Find the Winner of an Array Game/1535.py
index e0ff2fc1e58..d51cfd3dfbd 100644
--- a/solutions/1535. Find the Winner of an Array Game/1535.py	
+++ b/solutions/1535. Find the Winner of an Array Game/1535.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getWinner(self, arr: list[int], k: int) -> int:
+  def getWinner(self, arr: List[int], k: int) -> int:
     ans = arr[0]
     wins = 0
 
diff --git a/solutions/1536. Minimum Swaps to Arrange a Binary Grid/1536.py b/solutions/1536. Minimum Swaps to Arrange a Binary Grid/1536.py
index fb6a0d03f45..754493ed65b 100644
--- a/solutions/1536. Minimum Swaps to Arrange a Binary Grid/1536.py	
+++ b/solutions/1536. Minimum Swaps to Arrange a Binary Grid/1536.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minSwaps(self, grid: list[list[int]]) -> int:
+  def minSwaps(self, grid: List[List[int]]) -> int:
     n = len(grid)
     ans = 0
     # suffixZeros[i] := the number of suffix zeros in the i-th row
diff --git a/solutions/1537. Get the Maximum Score/1537.java b/solutions/1537. Get the Maximum Score/1537.java
index 1018631d50e..063523f0bd7 100644
--- a/solutions/1537. Get the Maximum Score/1537.java	
+++ b/solutions/1537. Get the Maximum Score/1537.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int maxSum(int[] nums1, int[] nums2) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // Keep the running the sum of `nums1` and `nums2` before the next rendezvous.
     // Since `nums1` and `nums2` are increasing, move forward on the smaller one
     // to ensure we don't miss any rendezvous. When meet rendezvous, choose the
@@ -31,6 +31,6 @@ public int maxSum(int[] nums1, int[] nums2) {
     while (j < nums2.length)
       sum2 += nums2[j++];
 
-    return (int) ((ans + Math.max(sum1, sum2)) % MOD);
+    return (int) ((ans + Math.max(sum1, sum2)) % kMod);
   }
 }
diff --git a/solutions/1537. Get the Maximum Score/1537.py b/solutions/1537. Get the Maximum Score/1537.py
index a248db70cc4..e60a95b2f45 100644
--- a/solutions/1537. Get the Maximum Score/1537.py	
+++ b/solutions/1537. Get the Maximum Score/1537.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSum(self, nums1: list[int], nums2: list[int]) -> int:
+  def maxSum(self, nums1: List[int], nums2: List[int]) -> int:
     # Keep the running the sum of `nums1` and `nums2` before the next rendezvous.
     # Since `nums1` and `nums2` are increasing, move forward on the smaller one
     # to ensure we don't miss any rendezvous. When meet rendezvous, choose the
diff --git a/solutions/1538. Guess the Majority in a Hidden Array/1538.cpp b/solutions/1538. Guess the Majority in a Hidden Array/1538.cpp
index da8f641aecf..b8044b5c888 100644
--- a/solutions/1538. Guess the Majority in a Hidden Array/1538.cpp	
+++ b/solutions/1538. Guess the Majority in a Hidden Array/1538.cpp	
@@ -23,9 +23,9 @@ class Solution {
     const int query0123 = reader.query(0, 1, 2, 3);
     const int query1234 = reader.query(1, 2, 3, 4);
     // the number of numbers that are same as `nums[0]`
-    int zeros = 1;
+    int count0 = 1;
     // the number of numbers that are different from `nums[0]`
-    int nonZeros = 0;
+    int countNot0 = 0;
     // any index i s.t. nums[i] != nums[0]
     int indexNot0 = -1;
 
@@ -33,9 +33,9 @@ class Solution {
     for (int i = 1; i <= 3; ++i) {
       vector<int> abcd = getABCD(i);
       if (reader.query(abcd[0], abcd[1], abcd[2], abcd[3]) == query1234) {
-        ++zeros;
+        ++count0;
       } else {
-        ++nonZeros;
+        ++countNot0;
         indexNot0 = i;
       }
     }
@@ -43,21 +43,21 @@ class Solution {
     // Find which group nums[4..n) belong to.
     for (int i = 4; i < n; ++i)
       if (reader.query(1, 2, 3, i) == query0123) {
-        ++zeros;
+        ++count0;
       } else {
-        ++nonZeros;
+        ++countNot0;
         indexNot0 = i;
       }
 
-    if (zeros == nonZeros)
+    if (count0 == countNot0)
       return -1;
-    if (zeros > nonZeros)
+    if (count0 > countNot0)
       return 0;
     return indexNot0;
   }
 
- private:
   // Returns [0..4] except i.
+ private:
   vector<int> getABCD(int i) {
     vector<int> abcd{0};
     for (int j = 1; j <= 3; ++j)
diff --git a/solutions/1538. Guess the Majority in a Hidden Array/1538.java b/solutions/1538. Guess the Majority in a Hidden Array/1538.java
index 02650bdf76e..1e825514052 100644
--- a/solutions/1538. Guess the Majority in a Hidden Array/1538.java	
+++ b/solutions/1538. Guess the Majority in a Hidden Array/1538.java	
@@ -21,9 +21,9 @@ public int guessMajority(ArrayReader reader) {
     final int query0123 = reader.query(0, 1, 2, 3);
     final int query1234 = reader.query(1, 2, 3, 4);
     // the number of numbers that are same as `nums[0]`
-    int zeros = 1;
+    int count0 = 1;
     // the number of numbers that are different from `nums[0]`
-    int nonZeros = 0;
+    int countNot0 = 0;
     // any index i s.t. nums[i] != nums[0]
     int indexNot0 = -1;
 
@@ -31,9 +31,9 @@ public int guessMajority(ArrayReader reader) {
     for (int i = 1; i <= 3; ++i) {
       List<Integer> abcd = getABCD(i);
       if (reader.query(abcd.get(0), abcd.get(1), abcd.get(2), abcd.get(3)) == query1234) {
-        ++zeros;
+        ++count0;
       } else {
-        ++nonZeros;
+        ++countNot0;
         indexNot0 = i;
       }
     }
@@ -41,22 +41,22 @@ public int guessMajority(ArrayReader reader) {
     // Find which group nums[4..n) belong to.
     for (int i = 4; i < n; ++i)
       if (reader.query(1, 2, 3, i) == query0123) {
-        ++zeros;
+        ++count0;
       } else {
-        ++nonZeros;
+        ++countNot0;
         indexNot0 = i;
       }
 
-    if (zeros == nonZeros)
+    if (count0 == countNot0)
       return -1;
-    if (zeros > nonZeros)
+    if (count0 > countNot0)
       return 0;
     return indexNot0;
   }
 
   // Returns [0..4] except i.
   private List<Integer> getABCD(int i) {
-    List<Integer> abcd = new ArrayList<>(List.of(0));
+    List<Integer> abcd = new ArrayList<>(Arrays.asList(0));
     for (int j = 1; j <= 3; ++j)
       if (j != i)
         abcd.add(j);
diff --git a/solutions/1538. Guess the Majority in a Hidden Array/1538.py b/solutions/1538. Guess the Majority in a Hidden Array/1538.py
index fbcce3b82cf..3bee5a7b2a4 100644
--- a/solutions/1538. Guess the Majority in a Hidden Array/1538.py	
+++ b/solutions/1538. Guess the Majority in a Hidden Array/1538.py	
@@ -20,29 +20,29 @@ def guessMajority(self, reader: 'ArrayReader') -> int:
     n = reader.length()
     query0123 = reader.query(0, 1, 2, 3)
     query1234 = reader.query(1, 2, 3, 4)
-    zeros = 1  # the number of numbers that are same as `nums[0]`
-    nonZeros = 0  # the number of numbers that are different from `nums[0]`
+    count0 = 1  # the number of numbers that are same as `nums[0]`
+    countNot0 = 0  # the number of numbers that are different from `nums[0]`
     indexNot0 = -1  # any index i s.t. nums[i] != nums[0]
 
     # Find which group nums[1..3] belong to.
     for i in range(1, 4):
       abcd = [0] + [num for num in [1, 2, 3] if num != i] + [4]
       if reader.query(*abcd) == query1234:  # nums[i] == nums[0]
-        zeros += 1
+        count0 += 1
       else:
-        nonZeros += 1
+        countNot0 += 1
         indexNot0 = i
 
     # Find which group nums[4..n) belong to.
     for i in range(4, n):
       if reader.query(1, 2, 3, i) == query0123:  # nums[i] == nums[0]
-        zeros += 1
+        count0 += 1
       else:
-        nonZeros += 1
+        countNot0 += 1
         indexNot0 = i
 
-    if zeros == nonZeros:
+    if count0 == countNot0:
       return -1
-    if zeros > nonZeros:
+    if count0 > countNot0:
       return 0
     return indexNot0
diff --git a/solutions/154. Find Minimum in Rotated Sorted Array II/154.py b/solutions/154. Find Minimum in Rotated Sorted Array II/154.py
index b89574e5635..6237873bec7 100644
--- a/solutions/154. Find Minimum in Rotated Sorted Array II/154.py	
+++ b/solutions/154. Find Minimum in Rotated Sorted Array II/154.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMin(self, nums: list[int]) -> int:
+  def findMin(self, nums: List[int]) -> int:
     l = 0
     r = len(nums) - 1
 
diff --git a/solutions/1542. Find Longest Awesome Substring/1542.py b/solutions/1542. Find Longest Awesome Substring/1542.py
index 2185f0205a5..0a051987fcd 100644
--- a/solutions/1542. Find Longest Awesome Substring/1542.py	
+++ b/solutions/1542. Find Longest Awesome Substring/1542.py	
@@ -6,7 +6,7 @@ def longestAwesome(self, s: str) -> int:
     prefixToIndex[0] = -1
 
     for i, c in enumerate(s):
-      prefix ^= 1 << int(c)
+      prefix ^= 1 << ord(c) - ord('0')
       ans = max(ans, i - prefixToIndex[prefix])
       for j in range(10):
         ans = max(ans, i - prefixToIndex[prefix ^ 1 << j])
diff --git a/solutions/1546. Maximum Number of Non-Overlapping Subarrays With Sum Equals Target/1546.py b/solutions/1546. Maximum Number of Non-Overlapping Subarrays With Sum Equals Target/1546.py
index 427fb97bb5b..19e120c3a99 100644
--- a/solutions/1546. Maximum Number of Non-Overlapping Subarrays With Sum Equals Target/1546.py	
+++ b/solutions/1546. Maximum Number of Non-Overlapping Subarrays With Sum Equals Target/1546.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxNonOverlapping(self, nums: list[int], target: int) -> int:
+  def maxNonOverlapping(self, nums: List[int], target: int) -> int:
     # Ending the subarray ASAP always has a better result.
     ans = 0
     prefix = 0
diff --git a/solutions/1547. Minimum Cost to Cut a Stick/1547-2.java b/solutions/1547. Minimum Cost to Cut a Stick/1547-2.java
index 1161e1e3c46..2d31f7185f3 100644
--- a/solutions/1547. Minimum Cost to Cut a Stick/1547-2.java	
+++ b/solutions/1547. Minimum Cost to Cut a Stick/1547-2.java	
@@ -1,23 +1,23 @@
 class Solution {
   public int minCost(int n, int[] cuts) {
-    int[] arr = new int[cuts.length + 2];
-    System.arraycopy(cuts, 0, arr, 1, cuts.length);
-    arr[0] = 0;
-    arr[arr.length - 1] = n;
+    int[] A = new int[cuts.length + 2];
+    System.arraycopy(cuts, 0, A, 1, cuts.length);
+    A[0] = 0;
+    A[A.length - 1] = n;
 
-    Arrays.sort(arr);
+    Arrays.sort(A);
 
     // dp[i][j] := minCost(cuts[i..j])
-    int[][] dp = new int[arr.length][arr.length];
+    int[][] dp = new int[A.length][A.length];
 
-    for (int d = 2; d < arr.length; ++d)
-      for (int i = 0; i + d < arr.length; ++i) {
+    for (int d = 2; d < A.length; ++d)
+      for (int i = 0; i + d < A.length; ++i) {
         final int j = i + d;
         dp[i][j] = Integer.MAX_VALUE;
         for (int k = i + 1; k < j; ++k)
-          dp[i][j] = Math.min(dp[i][j], arr[j] - arr[i] + dp[i][k] + dp[k][j]);
+          dp[i][j] = Math.min(dp[i][j], A[j] - A[i] + dp[i][k] + dp[k][j]);
       }
 
-    return dp[0][arr.length - 1];
+    return dp[0][A.length - 1];
   }
 }
diff --git a/solutions/1547. Minimum Cost to Cut a Stick/1547-2.py b/solutions/1547. Minimum Cost to Cut a Stick/1547-2.py
index 08a2b207d11..d9c44863d4b 100644
--- a/solutions/1547. Minimum Cost to Cut a Stick/1547-2.py	
+++ b/solutions/1547. Minimum Cost to Cut a Stick/1547-2.py	
@@ -1,14 +1,14 @@
 class Solution:
-  def minCost(self, n: int, cuts: list[int]) -> int:
-    arr = sorted([0] + cuts + [n])
+  def minCost(self, n: int, cuts: List[int]) -> int:
+    A = sorted([0] + cuts + [n])
 
-    dp = [[0] * len(arr) for _ in range(len(arr))]
+    dp = [[0] * len(A) for _ in range(len(A))]
 
-    for d in range(2, len(arr)):
-      for i in range(len(arr) - d):
+    for d in range(2, len(A)):
+      for i in range(len(A) - d):
         j = i + d
         dp[i][j] = math.inf
         for k in range(i + 1, j):
-          dp[i][j] = min(dp[i][j], arr[j] - arr[i] + dp[i][k] + dp[k][j])
+          dp[i][j] = min(dp[i][j], A[j] - A[i] + dp[i][k] + dp[k][j])
 
-    return dp[0][len(arr) - 1]
+    return dp[0][len(A) - 1]
diff --git a/solutions/1547. Minimum Cost to Cut a Stick/1547.py b/solutions/1547. Minimum Cost to Cut a Stick/1547.py
index 3f795284dd3..22312038c6d 100644
--- a/solutions/1547. Minimum Cost to Cut a Stick/1547.py	
+++ b/solutions/1547. Minimum Cost to Cut a Stick/1547.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minCost(self, n: int, cuts: list[int]) -> int:
+  def minCost(self, n: int, cuts: List[int]) -> int:
     A = sorted([0] + cuts + [n])
 
     @functools.lru_cache(None)
diff --git a/solutions/1548. The Most Similar Path in a Graph/1548.java b/solutions/1548. The Most Similar Path in a Graph/1548.java
index deb7339d7f2..3807ad6ba54 100644
--- a/solutions/1548. The Most Similar Path in a Graph/1548.java	
+++ b/solutions/1548. The Most Similar Path in a Graph/1548.java	
@@ -9,7 +9,9 @@ public List<Integer> mostSimilar(int n, int[][] roads, String[] names, String[]
     this.graph = new List[n];
 
     Arrays.stream(cost).forEach(a -> Arrays.fill(a, -1));
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] road : roads) {
       graph[road[0]].add(road[1]);
diff --git a/solutions/1548. The Most Similar Path in a Graph/1548.py b/solutions/1548. The Most Similar Path in a Graph/1548.py
index 41f20d0ebe0..276dcf9960c 100644
--- a/solutions/1548. The Most Similar Path in a Graph/1548.py	
+++ b/solutions/1548. The Most Similar Path in a Graph/1548.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def mostSimilar(self, n: int, roads: list[list[int]], names: list[str],
-                  targetPath: list[str]) -> list[int]:
+  def mostSimilar(self, n: int, roads: List[List[int]], names: List[str],
+                  targetPath: List[str]) -> List[int]:
     # cost[i][j] := the minimum cost to start from names[i] in path[j]
     cost = [[-1] * len(targetPath) for _ in range(len(names))]
     # next[i][j] := the best next of names[i] in path[j]
diff --git a/solutions/1550. Three Consecutive Odds/1550.py b/solutions/1550. Three Consecutive Odds/1550.py
index c8b070ed9d2..d7c51efcf2c 100644
--- a/solutions/1550. Three Consecutive Odds/1550.py	
+++ b/solutions/1550. Three Consecutive Odds/1550.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def threeConsecutiveOdds(self, arr: list[int]) -> bool:
+  def threeConsecutiveOdds(self, arr: List[int]) -> bool:
     count = 0
     for a in arr:
       count = 0 if a % 2 == 0 else count + 1
diff --git a/solutions/1552. Magnetic Force Between Two Balls/1552.py b/solutions/1552. Magnetic Force Between Two Balls/1552.py
index 24352f9bcc3..3e4a7661430 100644
--- a/solutions/1552. Magnetic Force Between Two Balls/1552.py	
+++ b/solutions/1552. Magnetic Force Between Two Balls/1552.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxDistance(self, position: list[int], m: int) -> int:
+  def maxDistance(self, position: List[int], m: int) -> int:
     position.sort()
 
     l = 1
diff --git a/solutions/1554. Strings Differ by One Character/1554-2.cpp b/solutions/1554. Strings Differ by One Character/1554-2.cpp
index 5750347c05d..77e20777ffd 100644
--- a/solutions/1554. Strings Differ by One Character/1554-2.cpp	
+++ b/solutions/1554. Strings Differ by One Character/1554-2.cpp	
@@ -17,8 +17,8 @@ class Solution {
         const string& word = dict[i];
         const int newHash =
             (wordToHash[i] -
-             static_cast<long>(coefficient) * val(word[j]) % kHash + kHash) %
-            kHash;
+             static_cast<long>(coefficient) * val(word[j]) % kMod + kMod) %
+            kMod;
         if (const auto it = newHashToIndices.find(newHash);
             it != newHashToIndices.cend())
           for (const int index : it->second)
@@ -30,26 +30,25 @@ class Solution {
               return true;
         newHashToIndices[newHash].push_back(i);
       }
-      coefficient = coefficient * kBase % kHash;
+      coefficient = 26L * coefficient % kMod;
     }
 
     return false;
   }
 
  private:
-  static constexpr long kBase = 26;
-  static constexpr int kHash = 1'000'000'007;
-
-  static constexpr int val(char c) {
-    return c - 'a';
-  }
+  static constexpr int kMod = 1'000'000'007;
 
   // Returns the hash of `s`. Assume the length of `s` is m.
   // e.g. getHash(s) = 26^(m - 1) * s[0] + 26^(m - 2) * s[1] + ... + s[m - 1].
   int getHash(const string& s) {
     int hash = 0;
     for (const char c : s)
-      hash = (hash * kBase + val(c)) % kHash;
+      hash = (26L * hash + val(c)) % kMod;
     return hash;
   }
+
+  constexpr int val(char c) {
+    return c - 'a';
+  }
 };
diff --git a/solutions/1554. Strings Differ by One Character/1554-2.java b/solutions/1554. Strings Differ by One Character/1554-2.java
index 3494de77db0..22480dbc86a 100644
--- a/solutions/1554. Strings Differ by One Character/1554-2.java	
+++ b/solutions/1554. Strings Differ by One Character/1554-2.java	
@@ -14,8 +14,8 @@ public boolean differByOne(String[] dict) {
       Map<Integer, List<Integer>> newHashToIndices = new HashMap<>();
       for (int i = 0; i < dict.length; ++i) {
         final int newHash =
-            (int) ((wordToHash[i] - (long) coefficient * val(dict[i].charAt(j)) % HASH + HASH) %
-                   HASH);
+            (int) ((wordToHash[i] - (long) coefficient * val(dict[i].charAt(j)) % kMod + kMod) %
+                   kMod);
         if (newHashToIndices.containsKey(newHash)) {
           for (final int index : newHashToIndices.get(newHash)) {
             if (dict[i].substring(0, j).equals(dict[index].substring(0, j)) &&
@@ -27,26 +27,25 @@ public boolean differByOne(String[] dict) {
         newHashToIndices.putIfAbsent(newHash, new ArrayList<>());
         newHashToIndices.get(newHash).add(i);
       }
-      coefficient = (int) (coefficient * BASE % HASH);
+      coefficient = (int) ((26L * coefficient) % kMod);
     }
 
     return false;
   }
 
-  private static final long BASE = 26;
-  private static final int HASH = 1_000_000_007;
-
-  private static int val(char c) {
-    return c - 'a';
-  }
+  private static final int kMod = 1_000_000_007;
 
   // Returns the hash of `s`. Assume the length of `s` is m.
   // e.g. getHash(s) = 26^(m - 1) * s[0] + 26^(m - 2) * s[1] + ... + s[m - 1].
   private int getHash(String s) {
     int hash = 0;
     for (final char c : s.toCharArray()) {
-      hash = (int) ((hash * BASE + val(c)) % HASH);
+      hash = (int) ((26L * hash + val(c)) % kMod);
     }
     return hash;
   }
+
+  private int val(char c) {
+    return c - 'a';
+  }
 }
diff --git a/solutions/1554. Strings Differ by One Character/1554-2.py b/solutions/1554. Strings Differ by One Character/1554-2.py
index 35b98ed1bf0..c448e25a970 100644
--- a/solutions/1554. Strings Differ by One Character/1554-2.py	
+++ b/solutions/1554. Strings Differ by One Character/1554-2.py	
@@ -1,7 +1,6 @@
 class Solution:
-  def differByOne(self, dict: list[str]) -> bool:
-    BASE = 26
-    HASH = 1_000_000_007
+  def differByOne(self, dict: List[str]) -> bool:
+    kMod = 1_000_000_007
     m = len(dict[0])
 
     def val(c: str) -> int:
@@ -14,7 +13,7 @@ def getHash(s: str) -> int:
       """
       hash = 0
       for c in s:
-        hash = (hash * BASE + val(c))
+        hash = (26 * hash + val(c))
       return hash
 
     wordToHash = [getHash(word) for word in dict]
@@ -26,11 +25,11 @@ def getHash(s: str) -> int:
     for j in range(m - 1, -1, -1):
       newHashToIndices = collections.defaultdict(list)
       for i, (word, hash) in enumerate(zip(dict, wordToHash)):
-        newHash = (hash - coefficient * val(word[j]) % HASH + HASH) % HASH
-        if any(word[: j] == dict[index][: j] and word[j + 1:] ==
-               dict[index][j + 1:] for index in newHashToIndices[newHash]):
+        newHash = (hash - coefficient * val(word[j]) % kMod + kMod) % kMod
+        if any(word[:j] == dict[index][:j] and word[j + 1:] == dict[index][j + 1:]
+               for index in newHashToIndices[newHash]):
           return True
         newHashToIndices[newHash].append(i)
-      coefficient = coefficient * BASE % HASH
+      coefficient = (26 * coefficient) % kMod
 
     return False
diff --git a/solutions/1557. Minimum Number of Vertices to Reach All Nodes/1557.py b/solutions/1557. Minimum Number of Vertices to Reach All Nodes/1557.py
index 2c84f2f231c..bb87861850a 100644
--- a/solutions/1557. Minimum Number of Vertices to Reach All Nodes/1557.py	
+++ b/solutions/1557. Minimum Number of Vertices to Reach All Nodes/1557.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def findSmallestSetOfVertices(
-      self,
-      n: int,
-      edges: list[list[int]],
-  ) -> list[int]:
+  def findSmallestSetOfVertices(self, n: int, edges: List[List[int]]) -> List[int]:
     inDegrees = [0] * n
 
     for _, v in edges:
diff --git a/solutions/1558. Minimum Numbers of Function Calls to Make Target Array/1558.cpp b/solutions/1558. Minimum Numbers of Function Calls to Make Target Array/1558.cpp
index 7875d6ddc5e..a7f6f511016 100644
--- a/solutions/1558. Minimum Numbers of Function Calls to Make Target Array/1558.cpp	
+++ b/solutions/1558. Minimum Numbers of Function Calls to Make Target Array/1558.cpp	
@@ -1,9 +1,10 @@
 class Solution {
  public:
   int minOperations(vector<int>& nums) {
-    const int mx = ranges::max(nums);
-    return accumulate(nums.begin(), nums.end(), 0, [](int acc, unsigned num) {
-      return acc + popcount(num);
-    }) + (mx == 0 ? 0 : static_cast<int>(log2(mx)));
+    const int maxNum = ranges::max(nums);
+    return accumulate(nums.begin(), nums.end(), 0,
+                      [](int subtotal, unsigned num) {
+      return subtotal + popcount(num);
+    }) + (maxNum == 0 ? 0 : (int)log2(maxNum));
   }
 };
diff --git a/solutions/1558. Minimum Numbers of Function Calls to Make Target Array/1558.java b/solutions/1558. Minimum Numbers of Function Calls to Make Target Array/1558.java
index 97c991d6656..de1243cccfc 100644
--- a/solutions/1558. Minimum Numbers of Function Calls to Make Target Array/1558.java	
+++ b/solutions/1558. Minimum Numbers of Function Calls to Make Target Array/1558.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int minOperations(int[] nums) {
-    final int mx = Arrays.stream(nums).max().getAsInt();
+    final int maxNum = Arrays.stream(nums).max().getAsInt();
     return Arrays.stream(nums).map(num -> Integer.bitCount(num)).sum() +
-        (mx == 0 ? 0 : (int) (Math.log(mx) / Math.log(2)));
+        (maxNum == 0 ? 0 : (int) (Math.log(maxNum) / Math.log(2)));
   }
 }
diff --git a/solutions/1558. Minimum Numbers of Function Calls to Make Target Array/1558.py b/solutions/1558. Minimum Numbers of Function Calls to Make Target Array/1558.py
index cc4c7a37573..6f06a8a091b 100644
--- a/solutions/1558. Minimum Numbers of Function Calls to Make Target Array/1558.py	
+++ b/solutions/1558. Minimum Numbers of Function Calls to Make Target Array/1558.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums: list[int]) -> int:
-    mx = max(nums)
-    return (sum(num.bit_count() for num in nums) +
-            (0 if mx == 0 else mx.bit_length() - 1))
+  def minOperations(self, nums: List[int]) -> int:
+    maxNum = max(nums)
+    return sum(num.bit_count() for num in nums) + \
+        (0 if maxNum == 0 else maxNum.bit_length() - 1)
diff --git a/solutions/1559. Detect Cycles in 2D Grid/1559.cpp b/solutions/1559. Detect Cycles in 2D Grid/1559.cpp
index 59677f58ac9..f24d9af90ed 100644
--- a/solutions/1559. Detect Cycles in 2D Grid/1559.cpp	
+++ b/solutions/1559. Detect Cycles in 2D Grid/1559.cpp	
@@ -17,13 +17,13 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   bool dfs(const vector<vector<char>>& grid, int i, int j, int prevI, int prevJ,
            char c, vector<vector<bool>>& seen) {
     seen[i][j] = true;
 
-    for (const auto& [dx, dy] : kDirs) {
+    for (const auto& [dx, dy] : dirs) {
       const int x = i + dx;
       const int y = j + dy;
       if (x < 0 || x == grid.size() || y < 0 || y == grid[0].size())
diff --git a/solutions/1559. Detect Cycles in 2D Grid/1559.java b/solutions/1559. Detect Cycles in 2D Grid/1559.java
index 6556cee7ef7..2c2f66f9a51 100644
--- a/solutions/1559. Detect Cycles in 2D Grid/1559.java	
+++ b/solutions/1559. Detect Cycles in 2D Grid/1559.java	
@@ -15,12 +15,12 @@ public boolean containsCycle(char[][] grid) {
     return false;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private boolean dfs(char[][] grid, int i, int j, int prevI, int prevJ, char c, boolean[][] seen) {
     seen[i][j] = true;
 
-    for (int[] dir : DIRS) {
+    for (int[] dir : dirs) {
       final int x = i + dir[0];
       final int y = j + dir[1];
       if (x < 0 || x == grid.length || y < 0 || y == grid[0].length)
diff --git a/solutions/156. Binary Tree Upside Down/156-2.py b/solutions/156. Binary Tree Upside Down/156-2.py
index 0af9c888878..e5c4e0455e3 100644
--- a/solutions/156. Binary Tree Upside Down/156-2.py	
+++ b/solutions/156. Binary Tree Upside Down/156-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def upsideDownBinaryTree(self, root: TreeNode | None) -> TreeNode | None:
+  def upsideDownBinaryTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
     prevRoot = None
     prevRightChild = None
 
diff --git a/solutions/156. Binary Tree Upside Down/156.py b/solutions/156. Binary Tree Upside Down/156.py
index 824fe7cf46e..a9ac070e5ae 100644
--- a/solutions/156. Binary Tree Upside Down/156.py	
+++ b/solutions/156. Binary Tree Upside Down/156.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def upsideDownBinaryTree(self, root: TreeNode | None) -> TreeNode | None:
+  def upsideDownBinaryTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
     if not root or not root.left:
       return root
 
diff --git a/solutions/1560. Most Visited Sector in a Circular Track/1560.py b/solutions/1560. Most Visited Sector in a Circular Track/1560.py
index 8116787ba3a..e7c6af3a750 100644
--- a/solutions/1560. Most Visited Sector in a Circular Track/1560.py	
+++ b/solutions/1560. Most Visited Sector in a Circular Track/1560.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def mostVisited(self, n: int, rounds: list[int]) -> list[int]:
+  def mostVisited(self, n: int, rounds: List[int]) -> List[int]:
     # 1. if start <= end, [start, end] is the most visited.
     #
     #      s --------- n
diff --git a/solutions/1561. Maximum Number of Coins You Can Get/1561.py b/solutions/1561. Maximum Number of Coins You Can Get/1561.py
index 601dd863737..fcfd0d7c99d 100644
--- a/solutions/1561. Maximum Number of Coins You Can Get/1561.py	
+++ b/solutions/1561. Maximum Number of Coins You Can Get/1561.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def maxCoins(self, piles: list[int]) -> int:
+  def maxCoins(self, piles: List[int]) -> int:
     return sum(sorted(piles)[len(piles) // 3::2])
diff --git a/solutions/1562. Find Latest Group of Size M/1562.py b/solutions/1562. Find Latest Group of Size M/1562.py
index 04a29f4ebff..c13c39136df 100644
--- a/solutions/1562. Find Latest Group of Size M/1562.py	
+++ b/solutions/1562. Find Latest Group of Size M/1562.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLatestStep(self, arr: list[int], m: int) -> int:
+  def findLatestStep(self, arr: List[int], m: int) -> int:
     if len(arr) == m:
       return len(arr)
 
diff --git a/solutions/1564. Put Boxes Into the Warehouse I/1564-2.py b/solutions/1564. Put Boxes Into the Warehouse I/1564-2.py
index fae161b070c..20555f59886 100644
--- a/solutions/1564. Put Boxes Into the Warehouse I/1564-2.py	
+++ b/solutions/1564. Put Boxes Into the Warehouse I/1564-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxBoxesInWarehouse(self, boxes: list[int], warehouse: list[int]) -> int:
+  def maxBoxesInWarehouse(self, boxes: List[int], warehouse: List[int]) -> int:
     i = 0  # warehouse's index
 
     for box in sorted(boxes, reverse=True):
diff --git a/solutions/1564. Put Boxes Into the Warehouse I/1564.py b/solutions/1564. Put Boxes Into the Warehouse I/1564.py
index a16a2d9e9f9..65601e6da86 100644
--- a/solutions/1564. Put Boxes Into the Warehouse I/1564.py	
+++ b/solutions/1564. Put Boxes Into the Warehouse I/1564.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxBoxesInWarehouse(self, boxes: list[int], warehouse: list[int]) -> int:
+  def maxBoxesInWarehouse(self, boxes: List[int], warehouse: List[int]) -> int:
     realWarehouse = [warehouse[0]]
 
     for i in range(1, len(warehouse)):
diff --git a/solutions/1566. Detect Pattern of Length M Repeated K or More Times/1566.py b/solutions/1566. Detect Pattern of Length M Repeated K or More Times/1566.py
index d703cdde9e7..e29fe4c13fa 100644
--- a/solutions/1566. Detect Pattern of Length M Repeated K or More Times/1566.py	
+++ b/solutions/1566. Detect Pattern of Length M Repeated K or More Times/1566.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def containsPattern(self, arr: list[int], m: int, k: int) -> bool:
+  def containsPattern(self, arr: List[int], m: int, k: int) -> bool:
     count = 0
     for i in range(m, len(arr)):
       count = count + 1 if arr[i] == arr[i - m] else 0
diff --git a/solutions/1567. Maximum Length of Subarray With Positive Product/1567.py b/solutions/1567. Maximum Length of Subarray With Positive Product/1567.py
index 154b25628d3..d5a0de77935 100644
--- a/solutions/1567. Maximum Length of Subarray With Positive Product/1567.py	
+++ b/solutions/1567. Maximum Length of Subarray With Positive Product/1567.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getMaxLen(self, nums: list[int]) -> int:
+  def getMaxLen(self, nums: List[int]) -> int:
     ans = 0
     # the maximum length of subarrays ending in `num` with a negative product
     neg = 0
diff --git a/solutions/1568. Minimum Number of Days to Disconnect Island/1568.cpp b/solutions/1568. Minimum Number of Days to Disconnect Island/1568.cpp
index adc7e069fc4..865d40a42da 100644
--- a/solutions/1568. Minimum Number of Days to Disconnect Island/1568.cpp	
+++ b/solutions/1568. Minimum Number of Days to Disconnect Island/1568.cpp	
@@ -19,7 +19,7 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   bool disconnected(const vector<vector<int>>& grid) {
     int islandsCount = 0;
@@ -38,7 +38,7 @@ class Solution {
   void dfs(const vector<vector<int>>& grid, int i, int j,
            vector<vector<bool>>& seen) {
     seen[i][j] = true;
-    for (const auto& [dx, dy] : kDirs) {
+    for (const auto& [dx, dy] : dirs) {
       const int x = i + dx;
       const int y = j + dy;
       if (x < 0 || x == grid.size() || y < 0 || y == grid[0].size())
diff --git a/solutions/1568. Minimum Number of Days to Disconnect Island/1568.java b/solutions/1568. Minimum Number of Days to Disconnect Island/1568.java
index 9f34ac7eb13..ae814f22182 100644
--- a/solutions/1568. Minimum Number of Days to Disconnect Island/1568.java	
+++ b/solutions/1568. Minimum Number of Days to Disconnect Island/1568.java	
@@ -17,7 +17,7 @@ public int minDays(int[][] grid) {
     return 2;
   }
 
-  private final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private boolean disconnected(int[][] grid) {
     int islandsCount = 0;
@@ -36,7 +36,7 @@ private boolean disconnected(int[][] grid) {
 
   private void dfs(int[][] grid, int i, int j, boolean[][] seen) {
     seen[i][j] = true;
-    for (int[] dir : DIRS) {
+    for (int[] dir : dirs) {
       int x = i + dir[0];
       int y = j + dir[1];
       if (x < 0 || x == grid.length || y < 0 || y == grid[0].length)
diff --git a/solutions/1568. Minimum Number of Days to Disconnect Island/1568.py b/solutions/1568. Minimum Number of Days to Disconnect Island/1568.py
index 790e4506401..02451a8d09c 100644
--- a/solutions/1568. Minimum Number of Days to Disconnect Island/1568.py	
+++ b/solutions/1568. Minimum Number of Days to Disconnect Island/1568.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def minDays(self, grid: list[list[int]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def minDays(self, grid: List[List[int]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
 
-    def dfs(grid: list[list[int]], i: int, j: int, seen: set[tuple[int, int]]):
+    def dfs(grid: List[List[int]], i: int, j: int, seen: Set[Tuple[int, int]]):
       seen.add((i, j))
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
@@ -15,7 +15,7 @@ def dfs(grid: list[list[int]], i: int, j: int, seen: set[tuple[int, int]]):
           continue
         dfs(grid, x, y, seen)
 
-    def disconnected(grid: list[list[int]]) -> bool:
+    def disconnected(grid: List[List[int]]) -> bool:
       islandsCount = 0
       seen = set()
       for i in range(m):
diff --git a/solutions/1569. Number of Ways to Reorder Array to Get Same BST/1569.java b/solutions/1569. Number of Ways to Reorder Array to Get Same BST/1569.java
index a97835266db..12b5e6c1558 100644
--- a/solutions/1569. Number of Ways to Reorder Array to Get Same BST/1569.java	
+++ b/solutions/1569. Number of Ways to Reorder Array to Get Same BST/1569.java	
@@ -4,7 +4,7 @@ public int numOfWays(int[] nums) {
     return ways(Arrays.stream(nums).boxed().collect(Collectors.toList())) - 1;
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
   // comb[n][k] := C(n, k)
   private List<List<Integer>> comb;
 
@@ -22,8 +22,8 @@ private int ways(List<Integer> nums) {
         right.add(nums.get(i));
 
     long ans = comb.get(nums.size() - 1).get(left.size());
-    ans = (ans * ways(left)) % MOD;
-    ans = (ans * ways(right)) % MOD;
+    ans = (ans * ways(left)) % kMod;
+    ans = (ans * ways(right)) % kMod;
     return (int) ans;
   }
 
@@ -39,7 +39,7 @@ public List<List<Integer>> generate(int numRows) {
 
     for (int i = 2; i < numRows; ++i)
       for (int j = 1; j < comb.get(i).size() - 1; ++j)
-        comb.get(i).set(j, (comb.get(i - 1).get(j - 1) + comb.get(i - 1).get(j)) % MOD);
+        comb.get(i).set(j, (comb.get(i - 1).get(j - 1) + comb.get(i - 1).get(j)) % kMod);
 
     return comb;
   }
diff --git a/solutions/157. Read N Characters Given Read4/157.py b/solutions/157. Read N Characters Given Read4/157.py
index 07300b35afe..f7e2a1120f6 100644
--- a/solutions/157. Read N Characters Given Read4/157.py	
+++ b/solutions/157. Read N Characters Given Read4/157.py	
@@ -1,6 +1,6 @@
 """
 The read4 API is already defined for you.
-  def read4(buf4: list[str]) -> int:
+  def read4(buf4: List[chr]) -> int:
 
 # Below is an example of how the read4 API can be called.
 file = File("abcdefghijk") # File is "abcdefghijk", initially file pointer (fp) points to 'a'
@@ -12,7 +12,7 @@ def read4(buf4: list[str]) -> int:
 
 
 class Solution:
-  def read(self, buf: list[str], n: int) -> int:
+  def read(self, buf: List[str], n: int) -> int:
     buf4 = [' '] * 4
     i4 = 0  # buf4's index
     n4 = 0  # buf4's size
diff --git a/solutions/1570. Dot Product of Two Sparse Vectors/1570-2.java b/solutions/1570. Dot Product of Two Sparse Vectors/1570-2.java
index 2086a05e569..12ec20303e2 100644
--- a/solutions/1570. Dot Product of Two Sparse Vectors/1570-2.java	
+++ b/solutions/1570. Dot Product of Two Sparse Vectors/1570-2.java	
@@ -1,3 +1,13 @@
+class T {
+  public int index;
+  public int num;
+
+  public T(int index, int num) {
+    this.index = index;
+    this.num = num;
+  }
+}
+
 class SparseVector {
   SparseVector(int[] nums) {
     for (int i = 0; i < nums.length; ++i)
@@ -20,6 +30,5 @@ else if (v.get(i).index < vec.v.get(j).index)
     return ans;
   }
 
-  private record T(int index, int num) {}
   private List<T> v = new ArrayList<>(); // [(index, num)]
 }
diff --git a/solutions/1572. Matrix Diagonal Sum/1572.py b/solutions/1572. Matrix Diagonal Sum/1572.py
index c0a22bf403a..b978462e5fa 100644
--- a/solutions/1572. Matrix Diagonal Sum/1572.py	
+++ b/solutions/1572. Matrix Diagonal Sum/1572.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def diagonalSum(self, mat: list[list[int]]) -> int:
+  def diagonalSum(self, mat: List[List[int]]) -> int:
     n = len(mat)
     ans = 0
 
diff --git a/solutions/1573. Number of Ways to Split a String/1573.java b/solutions/1573. Number of Ways to Split a String/1573.java
index 291d72877a9..5ef1e6a4cb5 100644
--- a/solutions/1573. Number of Ways to Split a String/1573.java	
+++ b/solutions/1573. Number of Ways to Split a String/1573.java	
@@ -1,12 +1,12 @@
-class Solution {
+public class Solution {
   public int numWays(String s) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int ones = (int) s.chars().filter(c -> c == '1').count();
     if (ones % 3 != 0)
       return 0;
     if (ones == 0) {
       final long n = s.length();
-      return (int) ((n - 1) * (n - 2) / 2 % MOD);
+      return (int) ((n - 1) * (n - 2) / 2 % kMod);
     }
 
     int s1End = -1;
@@ -28,6 +28,6 @@ else if (s3Start == -1 && onesSoFar == ones / 3 * 2 + 1)
         s3Start = i;
     }
 
-    return (int) ((long) (s2Start - s1End) * (s3Start - s2End) % MOD);
+    return (int) ((long) (s2Start - s1End) * (s3Start - s2End) % kMod);
   }
 }
diff --git a/solutions/1573. Number of Ways to Split a String/1573.py b/solutions/1573. Number of Ways to Split a String/1573.py
index 2d1a30f4f41..d0b564fd758 100644
--- a/solutions/1573. Number of Ways to Split a String/1573.py	
+++ b/solutions/1573. Number of Ways to Split a String/1573.py	
@@ -1,12 +1,12 @@
 class Solution:
   def numWays(self, s: str) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     ones = s.count('1')
     if ones % 3 != 0:
       return 0
     if ones == 0:
       n = len(s)
-      return (n - 1) * (n - 2) // 2 % MOD
+      return (n - 1) * (n - 2) // 2 % kMod
 
     s1End = -1
     s2Start = -1
@@ -26,4 +26,4 @@ def numWays(self, s: str) -> int:
       elif s3Start == -1 and onesSoFar == ones // 3 * 2 + 1:
         s3Start = i
 
-    return (s2Start - s1End) * (s3Start - s2End) % MOD
+    return (s2Start - s1End) * (s3Start - s2End) % kMod
diff --git a/solutions/1574. Shortest Subarray to be Removed to Make Array Sorted/1574.py b/solutions/1574. Shortest Subarray to be Removed to Make Array Sorted/1574.py
index 5a9a12438c2..f58d90b0f0d 100644
--- a/solutions/1574. Shortest Subarray to be Removed to Make Array Sorted/1574.py	
+++ b/solutions/1574. Shortest Subarray to be Removed to Make Array Sorted/1574.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLengthOfShortestSubarray(self, arr: list[int]) -> int:
+  def findLengthOfShortestSubarray(self, arr: List[int]) -> int:
     n = len(arr)
     l = 0
     r = n - 1
diff --git a/solutions/1575. Count All Possible Routes/1575-2.java b/solutions/1575. Count All Possible Routes/1575-2.java
index a2a78f8990a..5172ae9cb3f 100644
--- a/solutions/1575. Count All Possible Routes/1575-2.java	
+++ b/solutions/1575. Count All Possible Routes/1575-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int countRoutes(int[] locations, int start, int finish, int fuel) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int n = locations.length;
     // dp[i][j] := the number of ways to reach the `finish` city from the i-th
     // city with `j` fuel
@@ -17,7 +17,7 @@ public int countRoutes(int[] locations, int start, int finish, int fuel) {
           final int requiredFuel = Math.abs(locations[i] - locations[j]);
           if (requiredFuel <= f) {
             dp[i][f] += dp[j][f - requiredFuel];
-            dp[i][f] %= MOD;
+            dp[i][f] %= kMod;
           }
         }
 
diff --git a/solutions/1575. Count All Possible Routes/1575-2.py b/solutions/1575. Count All Possible Routes/1575-2.py
index aacb659eb20..ce6aa53ac5a 100644
--- a/solutions/1575. Count All Possible Routes/1575-2.py	
+++ b/solutions/1575. Count All Possible Routes/1575-2.py	
@@ -1,12 +1,6 @@
 class Solution:
-  def countRoutes(
-      self,
-      locations: list[int],
-      start: int,
-      finish: int,
-      fuel: int,
-  ) -> int:
-    MOD = 1_000_000_007
+  def countRoutes(self, locations: List[int], start: int, finish: int, fuel: int) -> int:
+    kMod = 1_000_000_007
     n = len(locations)
     # dp[i][j] := the number of ways to reach the `finish` city from the i-th
     # city with `j` fuel
@@ -23,6 +17,6 @@ def countRoutes(
           requiredFuel = abs(locations[i] - locations[j])
           if requiredFuel <= f:
             dp[i][f] += dp[j][f - requiredFuel]
-            dp[i][f] %= MOD
+            dp[i][f] %= kMod
 
     return dp[start][fuel]
diff --git a/solutions/1575. Count All Possible Routes/1575.java b/solutions/1575. Count All Possible Routes/1575.java
index 26dbfa6dc3e..53729f35c92 100644
--- a/solutions/1575. Count All Possible Routes/1575.java	
+++ b/solutions/1575. Count All Possible Routes/1575.java	
@@ -4,7 +4,7 @@ public int countRoutes(int[] locations, int start, int finish, int fuel) {
     return countRoutes(locations, start, finish, fuel, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of ways to reach the `finish` city from the i-th city
   // with `fuel` fuel.
@@ -19,7 +19,7 @@ private int countRoutes(int[] locations, int i, int finish, int fuel, Integer[][
       if (j == i)
         continue;
       res += countRoutes(locations, j, finish, fuel - Math.abs(locations[i] - locations[j]), mem);
-      res %= MOD;
+      res %= kMod;
     }
 
     return mem[i][fuel] = res;
diff --git a/solutions/1575. Count All Possible Routes/1575.py b/solutions/1575. Count All Possible Routes/1575.py
index 5aff1a6011c..64071f1736e 100644
--- a/solutions/1575. Count All Possible Routes/1575.py	
+++ b/solutions/1575. Count All Possible Routes/1575.py	
@@ -1,12 +1,6 @@
 class Solution:
-  def countRoutes(
-      self,
-      locations: list[int],
-      start: int,
-      finish: int,
-      fuel: int,
-  ) -> int:
-    MOD = 1_000_000_007
+  def countRoutes(self, locations: List[int], start: int, finish: int, fuel: int) -> int:
+    kMod = 1_000_000_007
 
     @functools.lru_cache(None)
     def dp(i: int, fuel: int) -> int:
@@ -22,7 +16,7 @@ def dp(i: int, fuel: int) -> int:
         if j == i:
           continue
         res += dp(j, fuel - abs(locations[i] - locations[j]))
-        res %= MOD
+        res %= kMod
 
       return res
 
diff --git a/solutions/1576. Replace All ?'s to Avoid Consecutive Repeating Characters/1576.py b/solutions/1576. Replace All ?'s to Avoid Consecutive Repeating Characters/1576.py
index 2758611dafc..c619aa78d3e 100644
--- a/solutions/1576. Replace All ?'s to Avoid Consecutive Repeating Characters/1576.py	
+++ b/solutions/1576. Replace All ?'s to Avoid Consecutive Repeating Characters/1576.py	
@@ -2,10 +2,10 @@ class Solution:
   def modifyString(self, s: str) -> str:
     ans = []
 
-    def nextAvailable(ans: list[int], s: str, i: int) -> str:
+    def nextAvailable(ans: List[int], s: str, i: int) -> str:
       c = 'a'
-      while ((i > 0 and ans[i - 1] == c) or
-             (i + 1 < len(s) and c == s[i + 1])):
+      while (i > 0 and ans[i - 1] == c) or \
+              (i + 1 < len(s) and c == s[i + 1]):
         c = chr(ord(c) + 1)
       return c
 
diff --git a/solutions/1577. Number of Ways Where Square of Number Is Equal to Product of Two Numbers/1577.py b/solutions/1577. Number of Ways Where Square of Number Is Equal to Product of Two Numbers/1577.py
index fa76d69bae7..56ead1a5da3 100644
--- a/solutions/1577. Number of Ways Where Square of Number Is Equal to Product of Two Numbers/1577.py	
+++ b/solutions/1577. Number of Ways Where Square of Number Is Equal to Product of Two Numbers/1577.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def numTriplets(self, nums1: list[int], nums2: list[int]) -> int:
-    def countTriplets(A: list[int], B: list[int]):
+  def numTriplets(self, nums1: List[int], nums2: List[int]) -> int:
+    def countTriplets(A: List[int], B: List[int]):
       """Returns the number of triplet (i, j, k) if A[i]^2 == B[j] * B[k]."""
       res = 0
       count = collections.Counter(B)
diff --git a/solutions/1578. Minimum Time to Make Rope Colorful/1578.py b/solutions/1578. Minimum Time to Make Rope Colorful/1578.py
index 74f3e5617ec..d6dd5f7e3ae 100644
--- a/solutions/1578. Minimum Time to Make Rope Colorful/1578.py	
+++ b/solutions/1578. Minimum Time to Make Rope Colorful/1578.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minCost(self, colors: str, neededTime: list[int]) -> int:
+  def minCost(self, colors: str, neededTime: List[int]) -> int:
     ans = 0
     maxNeededTime = neededTime[0]
 
diff --git a/solutions/1579. Remove Max Number of Edges to Keep Graph Fully Traversable/1579.cpp b/solutions/1579. Remove Max Number of Edges to Keep Graph Fully Traversable/1579.cpp
index 98e6a30ad5c..c418afba964 100644
--- a/solutions/1579. Remove Max Number of Edges to Keep Graph Fully Traversable/1579.cpp	
+++ b/solutions/1579. Remove Max Number of Edges to Keep Graph Fully Traversable/1579.cpp	
@@ -43,8 +43,9 @@ class Solution {
     int requiredEdges = 0;
 
     // Greedily put type 3 edges in the front.
-    ranges::sort(edges, ranges::greater{},
-                 [](const vector<int>& edge) { return edge[0]; });
+    sort(
+        edges.begin(), edges.end(),
+        [](const vector<int>& a, const vector<int>& b) { return a[0] > b[0]; });
 
     for (const vector<int>& edge : edges) {
       const int type = edge[0];
@@ -61,11 +62,9 @@ class Solution {
         case 2:  // Can be traversed by Bob.
           if (bob.unionByRank(u, v))
             ++requiredEdges;
-          break;
         case 1:  // Can be traversed by Alice.
           if (alice.unionByRank(u, v))
             ++requiredEdges;
-          break;
       }
     }
 
diff --git a/solutions/1579. Remove Max Number of Edges to Keep Graph Fully Traversable/1579.java b/solutions/1579. Remove Max Number of Edges to Keep Graph Fully Traversable/1579.java
index e432688fa54..e86032513c9 100644
--- a/solutions/1579. Remove Max Number of Edges to Keep Graph Fully Traversable/1579.java	
+++ b/solutions/1579. Remove Max Number of Edges to Keep Graph Fully Traversable/1579.java	
@@ -44,7 +44,7 @@ public int maxNumEdgesToRemove(int n, int[][] edges) {
     int requiredEdges = 0;
 
     // Greedily put type 3 edges in the front.
-    Arrays.sort(edges, Comparator.comparingInt(edge -> - edge[0]));
+    Arrays.sort(edges, (a, b) -> b[0] - a[0]);
 
     for (int[] edge : edges) {
       final int type = edge[0];
@@ -61,7 +61,6 @@ public int maxNumEdgesToRemove(int n, int[][] edges) {
         case 2: // Can be traversed by Bob.
           if (bob.unionByRank(u, v))
             ++requiredEdges;
-          break;
         case 1: // Can be traversed by Alice.
           if (alice.unionByRank(u, v))
             ++requiredEdges;
diff --git a/solutions/1579. Remove Max Number of Edges to Keep Graph Fully Traversable/1579.py b/solutions/1579. Remove Max Number of Edges to Keep Graph Fully Traversable/1579.py
index c576f69b80a..3e8aea2ebf3 100644
--- a/solutions/1579. Remove Max Number of Edges to Keep Graph Fully Traversable/1579.py	
+++ b/solutions/1579. Remove Max Number of Edges to Keep Graph Fully Traversable/1579.py	
@@ -26,28 +26,28 @@ def _find(self, u: int) -> int:
 
 
 class Solution:
-  def maxNumEdgesToRemove(self, n: int, edges: list[list[int]]) -> int:
+  def maxNumEdgesToRemove(self, n: int, edges: List[List[int]]) -> int:
     alice = UnionFind(n)
     bob = UnionFind(n)
     requiredEdges = 0
 
     # Greedily put type 3 edges in the front.
-    for type_, u, v in sorted(edges, reverse=True):
+    for type, u, v in sorted(edges, reverse=True):
       u -= 1
       v -= 1
-      if type_ == 3:  # Can be traversed by Alice and Bob.
+      if type == 3:  # Can be traversed by Alice and Bob.
           # Note that we should use | instead of or because if the first
           # expression is True, short-circuiting will skip the second
           # expression.
         if alice.unionByRank(u, v) | bob.unionByRank(u, v):
           requiredEdges += 1
-      elif type_ == 2:  # Can be traversed by Bob.
+      elif type == 2:  # Can be traversed by Bob.
         if bob.unionByRank(u, v):
           requiredEdges += 1
       else:  # type == 1 Can be traversed by Alice.
         if alice.unionByRank(u, v):
           requiredEdges += 1
 
-    return (len(edges) - requiredEdges
-            if alice.count == 1 and bob.count == 1
-            else -1)
+    return len(edges) - requiredEdges \
+        if alice.count == 1 and bob.count == 1 \
+        else -1
diff --git a/solutions/158. Read N Characters Given Read4 II - Call multiple times/158.py b/solutions/158. Read N Characters Given Read4 II - Call multiple times/158.py
index 4ed8859e543..7584ba13dfe 100644
--- a/solutions/158. Read N Characters Given Read4 II - Call multiple times/158.py	
+++ b/solutions/158. Read N Characters Given Read4 II - Call multiple times/158.py	
@@ -1,8 +1,8 @@
 # The read4 API is already defined for you.
-# Def read4(buf4: list[str]) -> int:
+# Def read4(buf4: List[str]) -> int:
 
 class Solution:
-  def read(self, buf: list[str], n: int) -> int:
+  def read(self, buf: List[str], n: int) -> int:
     i = 0  # buf's index
 
     while i < n:
diff --git a/solutions/1580. Put Boxes Into the Warehouse II/1580.py b/solutions/1580. Put Boxes Into the Warehouse II/1580.py
index 368e26a5ca5..0487f3f7bbc 100644
--- a/solutions/1580. Put Boxes Into the Warehouse II/1580.py	
+++ b/solutions/1580. Put Boxes Into the Warehouse II/1580.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxBoxesInWarehouse(self, boxes: list[int], warehouse: list[int]) -> int:
+  def maxBoxesInWarehouse(self, boxes: List[int], warehouse: List[int]) -> int:
     l = 0
     r = len(warehouse) - 1
 
diff --git a/solutions/1582. Special Positions in a Binary Matrix/1582.py b/solutions/1582. Special Positions in a Binary Matrix/1582.py
index e002d23f480..00c5fc8b7de 100644
--- a/solutions/1582. Special Positions in a Binary Matrix/1582.py	
+++ b/solutions/1582. Special Positions in a Binary Matrix/1582.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numSpecial(self, mat: list[list[int]]) -> int:
+  def numSpecial(self, mat: List[List[int]]) -> int:
     m = len(mat)
     n = len(mat[0])
     ans = 0
diff --git a/solutions/1583. Count Unhappy Friends/1583.py b/solutions/1583. Count Unhappy Friends/1583.py
index b0594e6bafb..f6787b66676 100644
--- a/solutions/1583. Count Unhappy Friends/1583.py	
+++ b/solutions/1583. Count Unhappy Friends/1583.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def unhappyFriends(
-      self,
-      n: int,
-      preferences: list[list[int]],
-      pairs: list[list[int]],
-  ) -> int:
+  def unhappyFriends(self, n: int, preferences: List[List[int]], pairs: List[List[int]]) -> int:
     ans = 0
     matches = [0] * n
     prefer = [{} for _ in range(n)]
diff --git a/solutions/1584. Min Cost to Connect All Points/1584.py b/solutions/1584. Min Cost to Connect All Points/1584.py
index f476321e59e..0665319ad63 100644
--- a/solutions/1584. Min Cost to Connect All Points/1584.py	
+++ b/solutions/1584. Min Cost to Connect All Points/1584.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minCostConnectPoints(self, points: list[int]) -> int:
+  def minCostConnectPoints(self, points: List[int]) -> int:
     # dist[i] := the minimum distance to connect the points[i]
     dist = [math.inf] * len(points)
     ans = 0
diff --git a/solutions/1586. Binary Search Tree Iterator II/1586.py b/solutions/1586. Binary Search Tree Iterator II/1586.py
index 61c3a461b34..b5b328424f7 100644
--- a/solutions/1586. Binary Search Tree Iterator II/1586.py	
+++ b/solutions/1586. Binary Search Tree Iterator II/1586.py	
@@ -1,5 +1,5 @@
 class BSTIterator:
-  def __init__(self, root: TreeNode | None):
+  def __init__(self, root: Optional[TreeNode]):
     self.prevsAndCurr = []
     self.nexts = []
     self._pushLeftsUntilNull(root)
diff --git a/solutions/1588. Sum of All Odd Length Subarrays/1588.py b/solutions/1588. Sum of All Odd Length Subarrays/1588.py
index 2eb99e84e85..177dcefa091 100644
--- a/solutions/1588. Sum of All Odd Length Subarrays/1588.py	
+++ b/solutions/1588. Sum of All Odd Length Subarrays/1588.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sumOddLengthSubarrays(self, arr: list[int]) -> int:
+  def sumOddLengthSubarrays(self, arr: List[int]) -> int:
     ans = 0
     # Maintain two sums of subarrays ending in the previous index.
     # Each time we meet a new number, we'll consider 'how many times' it should
diff --git a/solutions/1589. Maximum Sum Obtained of Any Permutation/1589.java b/solutions/1589. Maximum Sum Obtained of Any Permutation/1589.java
index 8d639815471..092524e3480 100644
--- a/solutions/1589. Maximum Sum Obtained of Any Permutation/1589.java	
+++ b/solutions/1589. Maximum Sum Obtained of Any Permutation/1589.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int maxSumRangeQuery(int[] nums, int[][] requests) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long ans = 0;
     // count[i] := the number of times nums[i] has been requested
     int[] count = new int[nums.length];
@@ -21,7 +21,7 @@ public int maxSumRangeQuery(int[] nums, int[][] requests) {
 
     for (int i = 0; i < nums.length; ++i) {
       ans += (long) nums[i] * count[i];
-      ans %= MOD;
+      ans %= kMod;
     }
 
     return (int) ans;
diff --git a/solutions/1589. Maximum Sum Obtained of Any Permutation/1589.py b/solutions/1589. Maximum Sum Obtained of Any Permutation/1589.py
index 4ffb11fda46..ff6891d7408 100644
--- a/solutions/1589. Maximum Sum Obtained of Any Permutation/1589.py	
+++ b/solutions/1589. Maximum Sum Obtained of Any Permutation/1589.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def maxSumRangeQuery(self, nums: list[int], requests: list[list[int]]) -> int:
-    MOD = 1_000_000_007
+  def maxSumRangeQuery(self, nums: List[int], requests: List[List[int]]) -> int:
+    kMod = 1_000_000_007
     ans = 0
     # count[i] := the number of times nums[i] has been requested
     count = [0] * len(nums)
@@ -15,6 +15,6 @@ def maxSumRangeQuery(self, nums: list[int], requests: list[list[int]]) -> int:
 
     for num, c in zip(sorted(nums), sorted(count)):
       ans += num * c
-      ans %= MOD
+      ans %= kMod
 
     return ans
diff --git a/solutions/1590. Make Sum Divisible by P/1590.py b/solutions/1590. Make Sum Divisible by P/1590.py
index 211b42970f0..7bc5447a2cd 100644
--- a/solutions/1590. Make Sum Divisible by P/1590.py	
+++ b/solutions/1590. Make Sum Divisible by P/1590.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minSubarray(self, nums: list[int], p: int) -> int:
+  def minSubarray(self, nums: List[int], p: int) -> int:
     summ = sum(nums)
     remainder = summ % p
     if remainder == 0:
diff --git a/solutions/1591. Strange Printer II/1591.cpp b/solutions/1591. Strange Printer II/1591.cpp
index 9a15da5f26a..28c29203f85 100644
--- a/solutions/1591. Strange Printer II/1591.cpp	
+++ b/solutions/1591. Strange Printer II/1591.cpp	
@@ -46,11 +46,13 @@ class Solution {
       return true;
     if (states[u] == State::kVisited)
       return false;
+
     states[u] = State::kVisiting;
     for (const int v : graph[u])
       if (hasCycle(graph, v, states))
         return true;
     states[u] = State::kVisited;
+
     return false;
   }
 };
diff --git a/solutions/1591. Strange Printer II/1591.java b/solutions/1591. Strange Printer II/1591.java
index 55182445fc5..c39e8d46091 100644
--- a/solutions/1591. Strange Printer II/1591.java	
+++ b/solutions/1591. Strange Printer II/1591.java	
@@ -1,14 +1,14 @@
-enum State { INIT, VISITING, VISITED }
+enum State { kInit, kVisiting, kVisited }
 
 class Solution {
   public boolean isPrintable(int[][] targetGrid) {
-    final int MAX_COLOR = 60;
+    final int kMaxColor = 60;
     final int m = targetGrid.length;
     final int n = targetGrid[0].length;
     // graph[u] := {v1, v2} means v1 and v2 cover u
-    Set<Integer>[] graph = new HashSet[MAX_COLOR + 1];
+    Set<Integer>[] graph = new HashSet[kMaxColor + 1];
 
-    for (int color = 1; color <= MAX_COLOR; ++color) {
+    for (int color = 1; color <= kMaxColor; ++color) {
       // Get the rectangle of the current color.
       int minI = m;
       int minJ = n;
@@ -31,9 +31,9 @@ public boolean isPrintable(int[][] targetGrid) {
           }
     }
 
-    State[] states = new State[MAX_COLOR + 1];
+    State[] states = new State[kMaxColor + 1];
 
-    for (int color = 1; color <= MAX_COLOR; ++color)
+    for (int color = 1; color <= kMaxColor; ++color)
       if (hasCycle(graph, color, states))
         return false;
 
@@ -41,15 +41,17 @@ public boolean isPrintable(int[][] targetGrid) {
   }
 
   private boolean hasCycle(Set<Integer>[] graph, int u, State[] states) {
-    if (states[u] == State.VISITING)
+    if (states[u] == State.kVisiting)
       return true;
-    if (states[u] == State.VISITED)
+    if (states[u] == State.kVisited)
       return false;
-    states[u] = State.VISITING;
+
+    states[u] = State.kVisiting;
     for (int v : graph[u])
       if (hasCycle(graph, v, states))
         return true;
-    states[u] = State.VISITED;
+    states[u] = State.kVisited;
+
     return false;
   }
 }
diff --git a/solutions/1591. Strange Printer II/1591.py b/solutions/1591. Strange Printer II/1591.py
index f1bdfd718e7..b50a95179b8 100644
--- a/solutions/1591. Strange Printer II/1591.py	
+++ b/solutions/1591. Strange Printer II/1591.py	
@@ -2,21 +2,21 @@
 
 
 class State(Enum):
-  INIT = 0
-  VISITING = 1
-  VISITED = 2
+  kInit = 0
+  kVisiting = 1
+  kVisited = 2
 
 
 class Solution:
-  def isPrintable(self, targetGrid: list[list[int]]) -> bool:
-    MAX_COLOR = 60
+  def isPrintable(self, targetGrid: List[List[int]]) -> bool:
+    kMaxColor = 60
     m = len(targetGrid)
     n = len(targetGrid[0])
 
     # graph[u] := {v1, v2} means v1 and v2 cover u
-    graph = [set() for _ in range(MAX_COLOR + 1)]
+    graph = [set() for _ in range(kMaxColor + 1)]
 
-    for color in range(1, MAX_COLOR + 1):
+    for color in range(1, kMaxColor + 1):
       # Get the rectangle of the current color.
       minI = m
       minJ = n
@@ -36,17 +36,19 @@ def isPrintable(self, targetGrid: list[list[int]]) -> bool:
           if targetGrid[i][j] != color:
             graph[color].add(targetGrid[i][j])
 
-    states = [State.INIT] * (MAX_COLOR + 1)
+    states = [State.kInit] * (kMaxColor + 1)
 
     def hasCycle(u: int) -> bool:
-      if states[u] == State.VISITING:
+      if states[u] == State.kVisiting:
         return True
-      if states[u] == State.VISITED:
+      if states[u] == State.kVisited:
         return False
-      states[u] = State.VISITING
+
+      states[u] = State.kVisiting
       if any(hasCycle(v) for v in graph[u]):
         return True
-      states[u] = State.VISITED
+      states[u] = State.kVisited
+
       return False
 
-    return not (any(hasCycle(i) for i in range(1, MAX_COLOR + 1)))
+    return not (any(hasCycle(i) for i in range(1, kMaxColor + 1)))
diff --git a/solutions/1593. Split a String Into the Max Number of Unique Substrings/1593.cpp b/solutions/1593. Split a String Into the Max Number of Unique Substrings/1593.cpp
index b557a332d9f..8c1923b642b 100644
--- a/solutions/1593. Split a String Into the Max Number of Unique Substrings/1593.cpp	
+++ b/solutions/1593. Split a String Into the Max Number of Unique Substrings/1593.cpp	
@@ -19,7 +19,7 @@ class Solution {
       if (seen.contains(cand))
         continue;
       seen.insert(cand);
-      dfs(s, start + i, std::move(seen), ans);
+      dfs(s, start + i, move(seen), ans);
       seen.erase(cand);
     }
   }
diff --git a/solutions/1594. Maximum Non Negative Product in a Matrix/1594.java b/solutions/1594. Maximum Non Negative Product in a Matrix/1594.java
index 1a31d0507ac..63a1b34e86e 100644
--- a/solutions/1594. Maximum Non Negative Product in a Matrix/1594.java	
+++ b/solutions/1594. Maximum Non Negative Product in a Matrix/1594.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int maxProductPath(int[][] grid) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int m = grid.length;
     final int n = grid[0].length;
     // dpMin[i][j] := the minimum product from (0, 0) to (i, j)
@@ -27,6 +27,6 @@ public int maxProductPath(int[][] grid) {
         }
 
     final long mx = Math.max(dpMin[m - 1][n - 1], dpMax[m - 1][n - 1]);
-    return mx < 0 ? -1 : (int) (mx % MOD);
+    return mx < 0 ? -1 : (int) (mx % kMod);
   }
 }
diff --git a/solutions/1595. Minimum Cost to Connect Two Groups of Points/1595.py b/solutions/1595. Minimum Cost to Connect Two Groups of Points/1595.py
index 0836fa4a29d..92c09a01346 100644
--- a/solutions/1595. Minimum Cost to Connect Two Groups of Points/1595.py	
+++ b/solutions/1595. Minimum Cost to Connect Two Groups of Points/1595.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def connectTwoGroups(self, cost: list[list[int]]) -> int:
+  def connectTwoGroups(self, cost: List[List[int]]) -> int:
     # minCosts[j] := the minimum cost of connecting group2's point j
     minCosts = [min(col) for col in zip(*cost)]
 
diff --git a/solutions/16. 3Sum Closest/16.py b/solutions/16. 3Sum Closest/16.py
index 3f5862efda3..25dbd767419 100644
--- a/solutions/16. 3Sum Closest/16.py	
+++ b/solutions/16. 3Sum Closest/16.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def threeSumClosest(self, nums: list[int], target: int) -> int:
+  def threeSumClosest(self, nums: List[int], target: int) -> int:
     ans = nums[0] + nums[1] + nums[2]
 
     nums.sort()
diff --git a/solutions/160. Intersection of Two Linked Lists/160.java b/solutions/160. Intersection of Two Linked Lists/160.java
index 0b7e23aafba..5ff44ef5d0c 100644
--- a/solutions/160. Intersection of Two Linked Lists/160.java	
+++ b/solutions/160. Intersection of Two Linked Lists/160.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
     ListNode a = headA;
     ListNode b = headB;
diff --git a/solutions/160. Intersection of Two Linked Lists/160.py b/solutions/160. Intersection of Two Linked Lists/160.py
index 7365575ad78..7d227c2ed02 100644
--- a/solutions/160. Intersection of Two Linked Lists/160.py	
+++ b/solutions/160. Intersection of Two Linked Lists/160.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def getIntersectionNode(
-      self,
-      headA: ListNode,
-      headB: ListNode,
-  ) -> ListNode | None:
+  def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> Optional[ListNode]:
     a = headA
     b = headB
 
diff --git a/solutions/1602. Find Nearest Right Node in Binary Tree/1602.py b/solutions/1602. Find Nearest Right Node in Binary Tree/1602.py
index 0c21ccf7443..625b59a5f08 100644
--- a/solutions/1602. Find Nearest Right Node in Binary Tree/1602.py	
+++ b/solutions/1602. Find Nearest Right Node in Binary Tree/1602.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def findNearestRightNode(
-      self,
-      root: TreeNode,
-      u: TreeNode,
-  ) -> TreeNode | None:
+  def findNearestRightNode(self, root: TreeNode, u: TreeNode) -> Optional[TreeNode]:
     ans = None
     targetDepth = -1
 
diff --git a/solutions/1604. Alert Using Same Key-Card Three or More Times in a One Hour Period/1604.py b/solutions/1604. Alert Using Same Key-Card Three or More Times in a One Hour Period/1604.py
index 02b9d9bc5f4..78af698707a 100644
--- a/solutions/1604. Alert Using Same Key-Card Three or More Times in a One Hour Period/1604.py	
+++ b/solutions/1604. Alert Using Same Key-Card Three or More Times in a One Hour Period/1604.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def alertNames(self, keyName: list[str], keyTime: list[str]) -> list[str]:
+  def alertNames(self, keyName: List[str], keyTime: List[str]) -> List[str]:
     nameToMinutes = collections.defaultdict(list)
 
     for name, time in zip(keyName, keyTime):
@@ -9,7 +9,7 @@ def alertNames(self, keyName: list[str], keyTime: list[str]) -> list[str]:
     return sorted([name for name, minutes in nameToMinutes.items()
                    if self._hasAlert(minutes)])
 
-  def _hasAlert(self, minutes: list[int]) -> bool:
+  def _hasAlert(self, minutes: List[int]) -> bool:
     if len(minutes) > 70:
       return True
     minutes.sort()
diff --git a/solutions/1605. Find Valid Matrix Given Row and Column Sums/1605.py b/solutions/1605. Find Valid Matrix Given Row and Column Sums/1605.py
index df518b98674..42dbec773e2 100644
--- a/solutions/1605. Find Valid Matrix Given Row and Column Sums/1605.py	
+++ b/solutions/1605. Find Valid Matrix Given Row and Column Sums/1605.py	
@@ -1,6 +1,5 @@
 class Solution:
-  def restoreMatrix(self, rowSum: list[int],
-                    colSum: list[int]) -> list[list[int]]:
+  def restoreMatrix(self, rowSum: List[int], colSum: List[int]) -> List[List[int]]:
     m = len(rowSum)
     n = len(colSum)
     ans = [[0] * n for _ in range(m)]
diff --git a/solutions/1606. Find Servers That Handled Most Number of Requests/1606.java b/solutions/1606. Find Servers That Handled Most Number of Requests/1606.java
index f904843646d..805a307b658 100644
--- a/solutions/1606. Find Servers That Handled Most Number of Requests/1606.java	
+++ b/solutions/1606. Find Servers That Handled Most Number of Requests/1606.java	
@@ -4,8 +4,7 @@ public List<Integer> busiestServers(int k, int[] arrival, int[] load) {
     int[] times = new int[k];
     TreeSet<Integer> idleServers = new TreeSet<>();
     // (endTime, server)
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey));
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
 
     for (int i = 0; i < k; ++i)
       idleServers.add(i);
diff --git a/solutions/1608. Special Array With X Elements Greater Than or Equal X/1608.py b/solutions/1608. Special Array With X Elements Greater Than or Equal X/1608.py
index f2920880bb8..f0672e7a2e9 100644
--- a/solutions/1608. Special Array With X Elements Greater Than or Equal X/1608.py	
+++ b/solutions/1608. Special Array With X Elements Greater Than or Equal X/1608.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def specialArray(self, nums: list[int]) -> int:
+  def specialArray(self, nums: List[int]) -> int:
     nums.sort()
 
     if nums[0] >= len(nums):
diff --git a/solutions/1609. Even Odd Tree/1609.py b/solutions/1609. Even Odd Tree/1609.py
index 28d56b996c8..1792ac724c6 100644
--- a/solutions/1609. Even Odd Tree/1609.py	
+++ b/solutions/1609. Even Odd Tree/1609.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isEvenOddTree(self, root: TreeNode | None) -> bool:
+  def isEvenOddTree(self, root: Optional[TreeNode]) -> bool:
     q = collections.deque([root])
     isEven = True
 
diff --git a/solutions/1610. Maximum Number of Visible Points/1610.py b/solutions/1610. Maximum Number of Visible Points/1610.py
index ba9f08aa757..dadf3ed56c3 100644
--- a/solutions/1610. Maximum Number of Visible Points/1610.py	
+++ b/solutions/1610. Maximum Number of Visible Points/1610.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def visiblePoints(
-      self,
-      points: list[list[int]],
-      angle: int,
-      location: list[int],
-  ) -> int:
+  def visiblePoints(self, points: List[List[int]], angle: int, location: List[int]) -> int:
     posX, posY = location
     maxVisible = 0
     same = 0
diff --git a/solutions/1613. Find the Missing IDs/1613.sql b/solutions/1613. Find the Missing IDs/1613.sql
index 7f50540c36d..c892c4b4fb8 100644
--- a/solutions/1613. Find the Missing IDs/1613.sql	
+++ b/solutions/1613. Find the Missing IDs/1613.sql	
@@ -1,5 +1,5 @@
-WITH RECURSIVE
-  Ids AS (
+WITH
+  RECURSIVE Ids AS (
     SELECT 1 AS id
     UNION ALL
     SELECT id + 1
diff --git a/solutions/1615. Maximal Network Rank/1615.py b/solutions/1615. Maximal Network Rank/1615.py
index 50160c1660b..906a2b6d31f 100644
--- a/solutions/1615. Maximal Network Rank/1615.py	
+++ b/solutions/1615. Maximal Network Rank/1615.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximalNetworkRank(self, n: int, roads: list[list[int]]) -> int:
+  def maximalNetworkRank(self, n: int, roads: List[List[int]]) -> int:
     degrees = [0] * n
 
     for u, v in roads:
@@ -31,8 +31,8 @@ def maximalNetworkRank(self, n: int, roads: list[list[int]]) -> int:
       # need to use the node with degree = `maxDegree2`. The answer in general
       # will be (maxDegree1 + maxDegree2), but if the two nodes that we're
       # considering are connected, then we'll have to subtract 1.
-      edgeCount = (self._getEdgeCount(roads, degrees, maxDegree1, maxDegree2) +
-                   self._getEdgeCount(roads, degrees, maxDegree2, maxDegree1))
+      edgeCount = self._getEdgeCount(roads, degrees, maxDegree1, maxDegree2) + \
+          self._getEdgeCount(roads, degrees, maxDegree2, maxDegree1)
       return maxDegree1 + maxDegree2 - (countMaxDegree2 == edgeCount)
     else:
       # 2. If there are more than one node with degree = `maxDegree1`, then we
@@ -43,12 +43,7 @@ def maximalNetworkRank(self, n: int, roads: list[list[int]]) -> int:
       maxPossibleEdgeCount = countMaxDegree1 * (countMaxDegree1 - 1) // 2
       return 2 * maxDegree1 - (maxPossibleEdgeCount == edgeCount)
 
-  def _getEdgeCount(
-      self,
-      roads: list[list[int]],
-      degrees: list[int],
-      degreeU: int, degreeV: int,
-  ) -> int:
+  def _getEdgeCount(self, roads: List[List[int]], degrees: List[int], degreeU: int, degreeV: int) -> int:
     """
     Returns the number of edges (u, v) where degress[u] == degreeU and
     degrees[v] == degreeV.
diff --git a/solutions/1616. Split Two Strings to Make Palindrome/1616.java b/solutions/1616. Split Two Strings to Make Palindrome/1616.java
index 459ccc88cb0..9b2dfd7a567 100644
--- a/solutions/1616. Split Two Strings to Make Palindrome/1616.java	
+++ b/solutions/1616. Split Two Strings to Make Palindrome/1616.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public boolean checkPalindromeFormation(String a, String b) {
     return check(a, b) || check(b, a);
   }
diff --git a/solutions/1617. Count Subtrees With Max Distance Between Cities/1617.py b/solutions/1617. Count Subtrees With Max Distance Between Cities/1617.py
index 83d34bd356b..d95c344a9b9 100644
--- a/solutions/1617. Count Subtrees With Max Distance Between Cities/1617.py	
+++ b/solutions/1617. Count Subtrees With Max Distance Between Cities/1617.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def countSubgraphsForEachDiameter(
-      self,
-      n: int,
-      edges: list[list[int]],
-  ) -> list[int]:
+  def countSubgraphsForEachDiameter(self, n: int, edges: List[List[int]]) -> List[int]:
     maxMask = 1 << n
     dist = self._floydWarshall(n, edges)
     ans = [0] * (n - 1)
@@ -16,7 +12,7 @@ def countSubgraphsForEachDiameter(
 
     return ans
 
-  def _floydWarshall(self, n: int, edges: list[list[int]]) -> list[list[int]]:
+  def _floydWarshall(self, n: int, edges: List[List[int]]) -> List[List[int]]:
     dist = [[n] * n for _ in range(n)]
 
     for i in range(n):
@@ -33,7 +29,7 @@ def _floydWarshall(self, n: int, edges: list[list[int]]) -> list[list[int]]:
 
     return dist
 
-  def _getMaxDist(self, mask: int, dist: list[list[int]], n: int) -> int:
+  def _getMaxDist(self, mask: int, dist: List[List[int]], n: int) -> int:
     maxDist = 0
     edgeCount = 0
     cityCount = 0
diff --git a/solutions/1618. Maximum Font to Fit a Sentence in a Screen/1618.py b/solutions/1618. Maximum Font to Fit a Sentence in a Screen/1618.py
index 32d13ac3d21..a481df5e19d 100644
--- a/solutions/1618. Maximum Font to Fit a Sentence in a Screen/1618.py	
+++ b/solutions/1618. Maximum Font to Fit a Sentence in a Screen/1618.py	
@@ -10,36 +10,21 @@
 #   def getHeight(self, fontSize: int) -> int:
 #     pass
 class Solution:
-  def maxFont(
-      self,
-      text: str,
-      w: int,
-      h: int,
-      fonts: list[int],
-      fontInfo: 'FontInfo',
-  ) -> int:
+  def maxFont(self, text: str, w: int, h: int, fonts: List[int], fontInfo: 'FontInfo') -> int:
     count = collections.Counter(text)
     l = 0
     r = len(fonts) - 1
 
     while l < r:
       m = (l + r + 1) // 2
-      if fontInfo.getHeight(
-              fonts[m]) <= h and self._getWidthSum(
-              count, fonts[m],
-              fontInfo) <= w:
+      if fontInfo.getHeight(fonts[m]) <= h and self._getWidthSum(count, fonts[m], fontInfo) <= w:
         l = m
       else:
         r = m - 1
 
     return fonts[l] if self._getWidthSum(count, fonts[l], fontInfo) <= w else -1
 
-  def _getWidthSum(
-      self,
-      count: list[int],
-      font: int,
-      fontInfo: 'FontInfo',
-  ) -> int:
+  def _getWidthSum(self, count: List[int], font: int, fontInfo: 'FontInfo') -> int:
     width = 0
     for c in string.ascii_lowercase:
       width += count[c] * fontInfo.getWidth(font, c)
diff --git a/solutions/1619. Mean of Array After Removing Some Elements/1619.py b/solutions/1619. Mean of Array After Removing Some Elements/1619.py
index 6ca00675c20..069df82ceb9 100644
--- a/solutions/1619. Mean of Array After Removing Some Elements/1619.py	
+++ b/solutions/1619. Mean of Array After Removing Some Elements/1619.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def trimMean(self, arr: list[int]) -> float:
+  def trimMean(self, arr: List[int]) -> float:
     arr.sort()
     offset = len(arr) // 20
     return mean(arr[offset:-offset])
diff --git a/solutions/162. Find Peak Element/162.py b/solutions/162. Find Peak Element/162.py
index 2826785a5ea..e84170084b3 100644
--- a/solutions/162. Find Peak Element/162.py	
+++ b/solutions/162. Find Peak Element/162.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findPeakElement(self, nums: list[int]) -> int:
+  def findPeakElement(self, nums: List[int]) -> int:
     l = 0
     r = len(nums) - 1
 
diff --git a/solutions/1620. Coordinate With Maximum Network Quality/1620.java b/solutions/1620. Coordinate With Maximum Network Quality/1620.java
index a9ec560ae1c..59be5dde3fb 100644
--- a/solutions/1620. Coordinate With Maximum Network Quality/1620.java	
+++ b/solutions/1620. Coordinate With Maximum Network Quality/1620.java	
@@ -1,12 +1,12 @@
 class Solution {
   public int[] bestCoordinate(int[][] towers, int radius) {
-    final int MAX = 50;
+    final int kMax = 50;
     final int n = towers.length;
     int[] ans = new int[2];
     int maxQuality = 0;
 
-    for (int i = 0; i <= MAX; ++i) {
-      for (int j = 0; j <= MAX; ++j) {
+    for (int i = 0; i <= kMax; ++i) {
+      for (int j = 0; j <= kMax; ++j) {
         int qualitySum = 0;
         for (int[] tower : towers) {
           double d = dist(tower, i, j);
diff --git a/solutions/1620. Coordinate With Maximum Network Quality/1620.py b/solutions/1620. Coordinate With Maximum Network Quality/1620.py
index 5a487356c69..5a185e8da84 100644
--- a/solutions/1620. Coordinate With Maximum Network Quality/1620.py	
+++ b/solutions/1620. Coordinate With Maximum Network Quality/1620.py	
@@ -1,16 +1,16 @@
 class Solution:
-  def bestCoordinate(self, towers: list[list[int]], radius: int) -> list[int]:
-    MAX = 50
+  def bestCoordinate(self, towers: List[List[int]], radius: int) -> List[int]:
+    kMax = 50
     n = len(towers)
     ans = [0] * 2
     maxQuality = 0
 
-    def dist(tower: list[int], i: int, j: int) -> float:
+    def dist(tower: List[int], i: int, j: int) -> float:
       """Returns the distance between the tower and the coordinate."""
       return math.sqrt((tower[0] - i)**2 + (tower[1] - j)**2)
 
-    for i in range(MAX + 1):
-      for j in range(MAX + 1):
+    for i in range(kMax + 1):
+      for j in range(kMax + 1):
         qualitySum = 0
         for tower in towers:
           q = tower[2]
diff --git a/solutions/1621. Number of Sets of K Non-Overlapping Line Segments/1621.java b/solutions/1621. Number of Sets of K Non-Overlapping Line Segments/1621.java
index 3c1daf076b4..3a66eeb31a5 100644
--- a/solutions/1621. Number of Sets of K Non-Overlapping Line Segments/1621.java	
+++ b/solutions/1621. Number of Sets of K Non-Overlapping Line Segments/1621.java	
@@ -4,7 +4,7 @@ public int numberOfSets(int n, int k) {
     return numberOfSets(0, k, /*drawing=*/false, n, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private int numberOfSets(int i, int k, boolean drawing, int n, Integer[][][] mem) {
     if (k == 0) // Find a way to draw k segments.
@@ -18,11 +18,11 @@ private int numberOfSets(int i, int k, boolean drawing, int n, Integer[][][] mem
       // 2. Stop at i so decrease k. We can start from i for the next segment.
       return mem[i][k][drawing ? 1 : 0] = (numberOfSets(i + 1, k, true, n, mem) + //
                                            numberOfSets(i, k - 1, false, n, mem)) %
-                                          MOD;
+                                          kMod;
     // 1. Skip i and move to i + 1.
     // 2. Start at i and move to i + 1.
     return mem[i][k][drawing ? 1 : 0] = (numberOfSets(i + 1, k, false, n, mem) + //
                                          numberOfSets(i + 1, k, true, n, mem)) %
-                                        MOD;
+                                        kMod;
   }
 }
diff --git a/solutions/1621. Number of Sets of K Non-Overlapping Line Segments/1621.py b/solutions/1621. Number of Sets of K Non-Overlapping Line Segments/1621.py
index f37c99e6ca6..352517a4f30 100644
--- a/solutions/1621. Number of Sets of K Non-Overlapping Line Segments/1621.py	
+++ b/solutions/1621. Number of Sets of K Non-Overlapping Line Segments/1621.py	
@@ -1,6 +1,6 @@
 class Solution:
   def numberOfSets(self, n: int, k: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
 
     @functools.lru_cache(None)
     def dp(i: int, k: int, drawing: bool) -> int:
@@ -11,9 +11,9 @@ def dp(i: int, k: int, drawing: bool) -> int:
       if drawing:
         # 1. Keep drawing at i and move to i + 1.
         # 2. Stop at i so decrease k. We can start from i for the next segment.
-        return (dp(i + 1, k, True) + dp(i, k - 1, False)) % MOD
+        return (dp(i + 1, k, True) + dp(i, k - 1, False)) % kMod
       # 1. Skip i and move to i + 1.
       # 2. Start at i and move to i + 1.
-      return (dp(i + 1, k, False) + dp(i + 1, k, True)) % MOD
+      return (dp(i + 1, k, False) + dp(i + 1, k, True)) % kMod
 
     return dp(0, k, False)
diff --git a/solutions/1622. Fancy Sequence/1622.java b/solutions/1622. Fancy Sequence/1622.java
index e3e063691ee..751846ebf41 100644
--- a/solutions/1622. Fancy Sequence/1622.java	
+++ b/solutions/1622. Fancy Sequence/1622.java	
@@ -5,28 +5,28 @@ class Fancy {
   //   a^(p - 2) ≡ a^(-1) (mod p)
   // So, (val - b) / a ≡ (val - b) * a^(p - 2) (mod p)
   public void append(int val) {
-    final long x = (val - b + MOD) % MOD;
-    vals.add(x * modPow(a, MOD - 2) % MOD);
+    final long x = (val - b + kMod) % kMod;
+    vals.add(x * modPow(a, kMod - 2) % kMod);
   }
 
   // If the value is a * val + b, then the value after adding by `inc` will be
   // a * val + b + inc. So, we adjust b to b + inc.
   public void addAll(int inc) {
-    b = (b + inc) % MOD;
+    b = (b + inc) % kMod;
   }
 
   // If the value is a * val + b, then the value after multiplying by `m` will
   // be a * m * val + b * m. So, we adjust a to a * m and b to b * m.
   public void multAll(int m) {
-    a = (a * m) % MOD;
-    b = (b * m) % MOD;
+    a = (a * m) % kMod;
+    b = (b * m) % kMod;
   }
 
   public int getIndex(int idx) {
-    return idx >= vals.size() ? -1 : (int) ((a * vals.get(idx) + b) % MOD);
+    return idx >= vals.size() ? -1 : (int) ((a * vals.get(idx) + b) % kMod);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
   // For each `val` in `vals`, it actually represents a * val + b.
   private List<Long> vals = new ArrayList<>();
   private long a = 1;
@@ -36,7 +36,7 @@ private int modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return (int) (x * modPow(x % MOD, (n - 1)) % MOD);
-    return modPow(x * x % MOD, (n / 2)) % MOD;
+      return (int) (x * modPow(x % kMod, (n - 1)) % kMod);
+    return modPow(x * x % kMod, (n / 2)) % kMod;
   }
 }
diff --git a/solutions/1622. Fancy Sequence/1622.py b/solutions/1622. Fancy Sequence/1622.py
index 2e31e81e381..251848d5d72 100644
--- a/solutions/1622. Fancy Sequence/1622.py	
+++ b/solutions/1622. Fancy Sequence/1622.py	
@@ -1,6 +1,6 @@
 class Fancy:
   def __init__(self):
-    self.MOD = 1_000_000_007
+    self.kMod = 1_000_000_007
     # For each `val` in `vals`, it actually represents a * val + b.
     self.vals = []
     self.a = 1
@@ -12,20 +12,20 @@ def __init__(self):
   #   a^(p - 2) ≡ a^(-1) (mod p)
   # So, (val - b) / a ≡ (val - b) * a^(p - 2) (mod p)
   def append(self, val: int) -> None:
-    x = (val - self.b + self.MOD) % self.MOD
-    self.vals.append(x * pow(self.a, self.MOD - 2, self.MOD))
+    x = (val - self.b + self.kMod) % self.kMod
+    self.vals.append(x * pow(self.a, self.kMod - 2, self.kMod))
 
   # If the value is a * val + b, then the value after adding by `inc` will be
   # a * val + b + inc. So, we adjust b to b + inc.
   def addAll(self, inc: int) -> None:
-    self.b = (self.b + inc) % self.MOD
+    self.b = (self.b + inc) % self.kMod
 
   # If the value is a * val + b, then the value after multiplying by `m` will
   # be a * m * val + b * m. So, we adjust a to a * m and b to b * m.
   def multAll(self, m: int) -> None:
-    self.a = (self.a * m) % self.MOD
-    self.b = (self.b * m) % self.MOD
+    self.a = (self.a * m) % self.kMod
+    self.b = (self.b * m) % self.kMod
 
   def getIndex(self, idx: int) -> int:
-    return (-1 if idx >= len(self.vals)
-            else (self.a * self.vals[idx] + self.b) % self.MOD)
+    return -1 if idx >= len(self.vals) \
+        else (self.a * self.vals[idx] + self.b) % self.kMod
diff --git a/solutions/1625. Lexicographically Smallest String After Applying Operations/1625.cpp b/solutions/1625. Lexicographically Smallest String After Applying Operations/1625.cpp
index c6d57efff95..aa2d1478800 100644
--- a/solutions/1625. Lexicographically Smallest String After Applying Operations/1625.cpp	
+++ b/solutions/1625. Lexicographically Smallest String After Applying Operations/1625.cpp	
@@ -16,8 +16,8 @@ class Solution {
     seen.insert(s);
     ans = min(ans, s);
 
-    dfs(add(s, a), a, b, std::move(seen), ans);
-    dfs(rotate(s, b), a, b, std::move(seen), ans);
+    dfs(add(s, a), a, b, move(seen), ans);
+    dfs(rotate(s, b), a, b, move(seen), ans);
   }
 
   string add(string& s, int a) {
diff --git a/solutions/1626. Best Team With No Conflicts/1626.cpp b/solutions/1626. Best Team With No Conflicts/1626.cpp
index 2edb7ca2916..0e0f909cc12 100644
--- a/solutions/1626. Best Team With No Conflicts/1626.cpp	
+++ b/solutions/1626. Best Team With No Conflicts/1626.cpp	
@@ -16,8 +16,8 @@ class Solution {
     for (int i = 0; i < n; ++i)
       players.emplace_back(ages[i], scores[i]);
 
-    ranges::sort(players, ranges::greater{}, [](const Player& player) {
-      return pair<int, int>{player.age, player.score};
+    ranges::sort(players, [](const Player& a, const Player& b) {
+      return a.age == b.age ? a.score > b.score : a.age > b.age;
     });
 
     for (int i = 0; i < n; ++i) {
diff --git a/solutions/1626. Best Team With No Conflicts/1626.java b/solutions/1626. Best Team With No Conflicts/1626.java
index 586391c3727..e4a8b03f51c 100644
--- a/solutions/1626. Best Team With No Conflicts/1626.java	
+++ b/solutions/1626. Best Team With No Conflicts/1626.java	
@@ -1,17 +1,23 @@
+class Player {
+  public int age;
+  public int score;
+  public Player(int age, int score) {
+    this.age = age;
+    this.score = score;
+  }
+};
+
 class Solution {
   public int bestTeamScore(int[] scores, int[] ages) {
-    record Player(int age, int score) {}
     final int n = scores.length;
     Player[] players = new Player[n];
-    // dp[i] := the maximum score of choosing the players[0..i] with the
-    // players[i] being selected
+    // dp[i] := the maximum score of choosing the players[0..i] with the players[i] being selected
     int[] dp = new int[n];
 
     for (int i = 0; i < n; ++i)
       players[i] = new Player(ages[i], scores[i]);
 
-    Arrays.sort(players, Comparator.comparing(Player::age, Comparator.reverseOrder())
-                             .thenComparing(Player::score, Comparator.reverseOrder()));
+    Arrays.sort(players, (a, b) -> a.age == b.age ? b.score - a.score : b.age - a.age);
 
     for (int i = 0; i < n; ++i) {
       // For each player, choose it first.
diff --git a/solutions/1626. Best Team With No Conflicts/1626.py b/solutions/1626. Best Team With No Conflicts/1626.py
deleted file mode 100644
index 2f06ce9eccb..00000000000
--- a/solutions/1626. Best Team With No Conflicts/1626.py	
+++ /dev/null
@@ -1,30 +0,0 @@
-from dataclasses import dataclass
-
-
-@dataclass
-class Player:
-  age: int
-  score: int
-
-
-class Solution:
-  def bestTeamScore(self, scores: list[int], ages: list[int]) -> int:
-    n = len(scores)
-    players = [Player(age, score) for age, score in zip(ages, scores)]
-    # dp[i] := the maximum score of choosing the players[0..i] with the
-    # players[i] being selected
-    dp = [0] * n
-
-    # Sort by age descending, then by score descending
-    players.sort(key=lambda x: (-x.age, -x.score))
-
-    for i in range(n):
-      # For each player, choose it first
-      dp[i] = players[i].score
-      # players[j].age >= players[i].age since we sort in descending order.
-      # So, we only have to check that players[j].score >= players[i].score.
-      for j in range(i):
-        if players[j].score >= players[i].score:
-          dp[i] = max(dp[i], dp[j] + players[i].score)
-
-    return max(dp)
diff --git a/solutions/1627. Graph Connectivity With Threshold/1627.py b/solutions/1627. Graph Connectivity With Threshold/1627.py
index 6df027451fa..4fa36277940 100644
--- a/solutions/1627. Graph Connectivity With Threshold/1627.py	
+++ b/solutions/1627. Graph Connectivity With Threshold/1627.py	
@@ -24,12 +24,7 @@ def find(self, u: int) -> int:
 
 
 class Solution:
-  def areConnected(
-      self,
-      n: int,
-      threshold: int,
-      queries: list[list[int]],
-  ) -> list[bool]:
+  def areConnected(self, n: int, threshold: int, queries: List[List[int]]) -> List[bool]:
     uf = UnionFind(n + 1)
 
     for z in range(threshold + 1, n + 1):
diff --git a/solutions/1628. Design an Expression Tree With Evaluate Function/1628.py b/solutions/1628. Design an Expression Tree With Evaluate Function/1628.py
index 2c922792470..f2e73a0122f 100644
--- a/solutions/1628. Design an Expression Tree With Evaluate Function/1628.py	
+++ b/solutions/1628. Design an Expression Tree With Evaluate Function/1628.py	
@@ -21,12 +21,7 @@ class ExpNode(Node):
       '/': lambda a, b: int(a / b),
   }
 
-  def __init__(
-      self,
-      val: str,
-      left: Optional['ExpNode'],
-      right: Optional['ExpNode'],
-  ):
+  def __init__(self, val: str, left: Optional['ExpNode'], right: Optional['ExpNode']):
     self.val = val
     self.left = left
     self.right = right
@@ -45,8 +40,8 @@ def evaluate(self) -> int:
 
 
 class TreeBuilder(object):
-  def buildTree(self, postfix: list[str]) -> 'Node':
-    stack: list[ExpNode | None] = []
+  def buildTree(self, postfix: List[str]) -> 'Node':
+    stack: List[Optional[ExpNode]] = []
 
     for val in postfix:
       if val in '+-*/':
diff --git a/solutions/1629. Slowest Key/1629.py b/solutions/1629. Slowest Key/1629.py
index 6a79c1d5a7e..390c3dedd85 100644
--- a/solutions/1629. Slowest Key/1629.py	
+++ b/solutions/1629. Slowest Key/1629.py	
@@ -1,12 +1,11 @@
 class Solution:
-  def slowestKey(self, releaseTimes: list[int], keysPressed: str) -> str:
+  def slowestKey(self, releaseTimes: List[int], keysPressed: str) -> str:
     ans = keysPressed[0]
     maxDuration = releaseTimes[0]
 
     for i in range(1, len(keysPressed)):
       duration = releaseTimes[i] - releaseTimes[i-1]
-      if duration > maxDuration or (
-              duration == maxDuration and keysPressed[i] > ans):
+      if duration > maxDuration or (duration == maxDuration and keysPressed[i] > ans):
         ans = keysPressed[i]
         maxDuration = duration
 
diff --git a/solutions/163. Missing Ranges/163.cpp b/solutions/163. Missing Ranges/163.cpp
index 8a712cc3013..6c6fb1e527b 100644
--- a/solutions/163. Missing Ranges/163.cpp	
+++ b/solutions/163. Missing Ranges/163.cpp	
@@ -1,11 +1,10 @@
 class Solution {
  public:
-  vector<vector<int>> findMissingRanges(vector<int>& nums, int lower,
-                                        int upper) {
+  vector<string> findMissingRanges(vector<int>& nums, int lower, int upper) {
     if (nums.empty())
       return {getRange(lower, upper)};
 
-    vector<vector<int>> ans;
+    vector<string> ans;
 
     if (nums.front() > lower)
       ans.push_back(getRange(lower, nums.front() - 1));
@@ -21,9 +20,9 @@ class Solution {
   }
 
  private:
-  vector<int> getRange(int lo, int hi) {
+  string getRange(int lo, int hi) {
     if (lo == hi)
-      return vector<int>{lo, lo};
-    return vector<int>{lo, hi};
+      return to_string(lo);
+    return to_string(lo) + "->" + to_string(hi);
   }
 };
diff --git a/solutions/163. Missing Ranges/163.java b/solutions/163. Missing Ranges/163.java
index 48f071fc556..35013d4aff9 100644
--- a/solutions/163. Missing Ranges/163.java	
+++ b/solutions/163. Missing Ranges/163.java	
@@ -1,9 +1,9 @@
 class Solution {
-  public List<List<Integer>> findMissingRanges(int[] nums, int lower, int upper) {
+  public List<String> findMissingRanges(int[] nums, int lower, int upper) {
     if (nums.length == 0)
-      return List.of(getRange(lower, upper));
+      return new ArrayList<>(Arrays.asList(getRange(lower, upper)));
 
-    List<List<Integer>> ans = new ArrayList<>();
+    List<String> ans = new ArrayList<>();
 
     if (nums[0] > lower)
       ans.add(getRange(lower, nums[0] - 1));
@@ -18,9 +18,9 @@ public List<List<Integer>> findMissingRanges(int[] nums, int lower, int upper) {
     return ans;
   }
 
-  private List<Integer> getRange(int lo, int hi) {
+  private String getRange(int lo, int hi) {
     if (lo == hi)
-      return List.of(lo, lo);
-    return List.of(lo, hi);
+      return String.valueOf(lo);
+    return lo + "->" + hi;
   }
 }
diff --git a/solutions/163. Missing Ranges/163.py b/solutions/163. Missing Ranges/163.py
index 7f34e0e943d..ca1f33ddd0a 100644
--- a/solutions/163. Missing Ranges/163.py	
+++ b/solutions/163. Missing Ranges/163.py	
@@ -1,14 +1,9 @@
 class Solution:
-  def findMissingRanges(
-      self,
-      nums: list[int],
-      lower: int,
-      upper: int,
-  ) -> list[list[int]]:
-    def getRange(lo: int, hi: int) -> list[int]:
+  def findMissingRanges(self, nums: List[int], lower: int, upper: int) -> List[str]:
+    def getRange(lo: int, hi: int) -> str:
       if lo == hi:
-        return [lo, lo]
-      return [lo, hi]
+        return str(lo)
+      return str(lo) + '->' + str(hi)
 
     if not nums:
       return [getRange(lower, upper)]
diff --git a/solutions/1630. Arithmetic Subarrays/1630.py b/solutions/1630. Arithmetic Subarrays/1630.py
index bfc4f7566ad..4e5d8a8b514 100644
--- a/solutions/1630. Arithmetic Subarrays/1630.py	
+++ b/solutions/1630. Arithmetic Subarrays/1630.py	
@@ -1,13 +1,8 @@
 class Solution:
-  def checkArithmeticSubarrays(
-      self,
-      nums: list[int],
-      l: list[int],
-      r: list[int],
-  ) -> list[bool]:
+  def checkArithmeticSubarrays(self, nums: List[int], l: List[int], r: List[int]) -> List[bool]:
     return [self._isArithmetic(nums, a, b) for a, b in zip(l, r)]
 
-  def _isArithmetic(self, nums: list[int], l: int, r: int) -> bool:
+  def _isArithmetic(self, nums: List[int], l: int, r: int) -> bool:
     if r - l < 2:
       return True
 
diff --git a/solutions/1631. Path With Minimum Effort/1631.cpp b/solutions/1631. Path With Minimum Effort/1631.cpp
index cfe50a0bdba..8f7a1397f77 100644
--- a/solutions/1631. Path With Minimum Effort/1631.cpp	
+++ b/solutions/1631. Path With Minimum Effort/1631.cpp	
@@ -1,13 +1,14 @@
 struct T {
   int i;
   int j;
-  int d;  // the maximum difference of (i, j) and its neighbors
+  int d;
+  T(int i, int j, int d) : i(i), j(j), d(d) {}
 };
 
 class Solution {
  public:
   int minimumEffortPath(vector<vector<int>>& heights) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = heights.size();
     const int n = heights[0].size();
     auto compare = [](const T& a, const T& b) { return a.d > b.d; };
@@ -25,7 +26,7 @@ class Solution {
       if (i == m - 1 && j == n - 1)
         return d;
       seen[i][j] = true;
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1631. Path With Minimum Effort/1631.java b/solutions/1631. Path With Minimum Effort/1631.java
index bf06bd11730..573284bfc60 100644
--- a/solutions/1631. Path With Minimum Effort/1631.java	
+++ b/solutions/1631. Path With Minimum Effort/1631.java	
@@ -1,14 +1,23 @@
+class T {
+  public int i;
+  public int j;
+  public int d; // Max difference of (i, j) and its neighbors
+  public T(int i, int j, int d) {
+    this.i = i;
+    this.j = j;
+    this.d = d;
+  }
+}
+
 class Solution {
   public int minimumEffortPath(int[][] heights) {
-    // d := the maximum difference of (i, j) and its neighbors
-    record T(int i, int j, int d) {}
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = heights.length;
     final int n = heights[0].length;
-    Queue<T> minHeap = new PriorityQueue<>(Comparator.comparingInt(T::d));
+    Queue<T> minHeap = new PriorityQueue<>((a, b) -> a.d - b.d);
     // dist[i][j] := the maximum absolute difference to reach (i, j)
     int[][] diff = new int[m][n];
-    Arrays.stream(diff).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE));
+    Arrays.stream(diff).forEach(row -> Arrays.fill(row, Integer.MAX_VALUE));
     boolean[][] seen = new boolean[m][n];
 
     minHeap.offer(new T(0, 0, 0));
@@ -21,7 +30,7 @@ record T(int i, int j, int d) {}
       if (i == m - 1 && j == n - 1)
         return d;
       seen[i][j] = true;
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1631. Path With Minimum Effort/1631.py b/solutions/1631. Path With Minimum Effort/1631.py
index fc56fd169fc..1fa93048950 100644
--- a/solutions/1631. Path With Minimum Effort/1631.py	
+++ b/solutions/1631. Path With Minimum Effort/1631.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def minimumEffortPath(self, heights: list[list[int]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def minimumEffortPath(self, heights: List[List[int]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(heights)
     n = len(heights[0])
     # diff[i][j] := the maximum absolute difference to reach (i, j)
@@ -15,7 +15,7 @@ def minimumEffortPath(self, heights: list[list[int]]) -> int:
       if i == m - 1 and j == n - 1:
         return d
       seen.add((i, j))
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/1632. Rank Transform of a Matrix/1632.py b/solutions/1632. Rank Transform of a Matrix/1632.py
index 6d608f10686..9193a1bf4b0 100644
--- a/solutions/1632. Rank Transform of a Matrix/1632.py	
+++ b/solutions/1632. Rank Transform of a Matrix/1632.py	
@@ -10,7 +10,7 @@ def union(self, u: int, v: int) -> None:
     if i != j:
       self.id[i] = j
 
-  def getGroupIdToValues(self) -> dict[int, list[int]]:
+  def getGroupIdToValues(self) -> Dict[int, List[int]]:
     groupIdToValues = collections.defaultdict(list)
     for u in self.id.keys():
       groupIdToValues[self._find(u)].append(u)
@@ -23,7 +23,7 @@ def _find(self, u: int) -> int:
 
 
 class Solution:
-  def matrixRankTransform(self, matrix: list[list[int]]) -> list[list[int]]:
+  def matrixRankTransform(self, matrix: List[List[int]]) -> List[List[int]]:
     m = len(matrix)
     n = len(matrix[0])
     ans = [[0] * n for _ in range(m)]
diff --git a/solutions/1635. Hopper Company Queries I/1635.sql b/solutions/1635. Hopper Company Queries I/1635.sql
index b29e8348a85..796f17e52d1 100644
--- a/solutions/1635. Hopper Company Queries I/1635.sql	
+++ b/solutions/1635. Hopper Company Queries I/1635.sql	
@@ -1,5 +1,5 @@
-WITH RECURSIVE
-  Calendar AS (
+WITH
+  RECURSIVE Calendar AS (
     SELECT 1 AS month
     UNION ALL
     SELECT month + 1
diff --git a/solutions/1636. Sort Array by Increasing Frequency/1636.cpp b/solutions/1636. Sort Array by Increasing Frequency/1636.cpp
index 8d3a2865c36..c27dabec436 100644
--- a/solutions/1636. Sort Array by Increasing Frequency/1636.cpp	
+++ b/solutions/1636. Sort Array by Increasing Frequency/1636.cpp	
@@ -1,6 +1,7 @@
 struct T {
   int num;
   int freq;
+  T(int num, int freq) : num(num), freq(freq) {}
 };
 
 class Solution {
diff --git a/solutions/1636. Sort Array by Increasing Frequency/1636.java b/solutions/1636. Sort Array by Increasing Frequency/1636.java
index 5307181fe53..02a7d7ffd7d 100644
--- a/solutions/1636. Sort Array by Increasing Frequency/1636.java	
+++ b/solutions/1636. Sort Array by Increasing Frequency/1636.java	
@@ -1,11 +1,19 @@
+class T {
+  public int num;
+  public int freq;
+  public T(int num, int freq) {
+    this.num = num;
+    this.freq = freq;
+  }
+};
+
 class Solution {
   public int[] frequencySort(int[] nums) {
-    record T(int num, int freq) {}
     int[] ans = new int[nums.length];
     int ansIndex = 0;
     Map<Integer, Integer> count = new HashMap<>();
-    Queue<T> heap = new PriorityQueue<>(
-        Comparator.comparingInt(T::freq).thenComparing(T::num, Comparator.reverseOrder()));
+    Queue<T> heap =
+        new PriorityQueue<>((a, b) -> a.freq == b.freq ? b.num - a.num : a.freq - b.freq);
 
     for (final int num : nums)
       count.merge(num, 1, Integer::sum);
diff --git a/solutions/1636. Sort Array by Increasing Frequency/1636.py b/solutions/1636. Sort Array by Increasing Frequency/1636.py
index 707ae66442d..4d51cd9393e 100644
--- a/solutions/1636. Sort Array by Increasing Frequency/1636.py	
+++ b/solutions/1636. Sort Array by Increasing Frequency/1636.py	
@@ -1,10 +1,7 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
 class T:
-  num: int
-  freq: int
+  def __init__(self, num: int, freq: int):
+    self.num = num
+    self.freq = freq
 
   def __lt__(self, other):
     if self.freq == other.freq:
@@ -13,7 +10,7 @@ def __lt__(self, other):
 
 
 class Solution:
-  def frequencySort(self, nums: list[int]) -> list[int]:
+  def frequencySort(self, nums: List[int]) -> List[int]:
     ans = []
     heap = []
 
diff --git a/solutions/1637. Widest Vertical Area Between Two Points Containing No Points/1637.py b/solutions/1637. Widest Vertical Area Between Two Points Containing No Points/1637.py
index 0a71e8bb1f6..aafe6faeb90 100644
--- a/solutions/1637. Widest Vertical Area Between Two Points Containing No Points/1637.py	
+++ b/solutions/1637. Widest Vertical Area Between Two Points Containing No Points/1637.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def maxWidthOfVerticalArea(self, points: list[list[int]]) -> int:
+  def maxWidthOfVerticalArea(self, points: List[List[int]]) -> int:
     xs = sorted([x for x, _ in points])
     return max(b - a for a, b in itertools.pairwise(xs))
diff --git a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-2.cpp b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-2.cpp
index d18d71c307d..cf0eae5c1c8 100644
--- a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-2.cpp	
+++ b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-2.cpp	
@@ -20,7 +20,7 @@ class Solution {
         if (i < target.length())
           // Pick the character target[i] from word[j].
           dp[i + 1][j + 1] =
-              static_cast<long>(dp[i][j]) * counts[j][target[i] - 'a'] % kMod;
+              dp[i][j] * static_cast<long>(counts[j][target[i] - 'a']) % kMod;
         // Skip the word[j].
         dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % kMod;
       }
diff --git a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-2.java b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-2.java
index c01470c1df4..98afd0b1c36 100644
--- a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-2.java	
+++ b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numWays(String[] words, String target) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int wordLength = words[0].length();
     // dp[i][j] := the number of ways to form the first i characters of the
     // `target` using the j first characters in each word
@@ -18,9 +18,9 @@ public int numWays(String[] words, String target) {
       for (int j = 0; j < wordLength; ++j) {
         if (i < target.length())
           // Pick the character target[i] from word[j].
-          dp[i + 1][j + 1] = (int) ((long) dp[i][j] * counts[j][target.charAt(i) - 'a'] % MOD);
+          dp[i + 1][j + 1] = (int) ((dp[i][j] * (long) counts[j][target.charAt(i) - 'a']) % kMod);
         // Skip the word[j].
-        dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % MOD;
+        dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % kMod;
       }
 
     return dp[target.length()][wordLength];
diff --git a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-2.py b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-2.py
index 34cb60bc9ae..1eca501774a 100644
--- a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-2.py	
+++ b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-2.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def numWays(self, words: list[str], target: str) -> int:
-    MOD = 1_000_000_007
+  def numWays(self, words: List[str], target: str) -> int:
+    kMod = 1_000_000_007
     wordLength = len(words[0])
     # dp[i][j] := the number of ways to form the first i characters of the
     # `target` using the j first characters in each word
@@ -19,9 +19,9 @@ def numWays(self, words: list[str], target: str) -> int:
         if i < len(target):
           # Pick the character target[i] from word[j].
           dp[i + 1][j + 1] = dp[i][j] * counts[j][target[i]]
-          dp[i + 1][j + 1] %= MOD
+          dp[i + 1][j + 1] %= kMod
         # Skip the word[j].
         dp[i][j + 1] += dp[i][j]
-        dp[i][j + 1] %= MOD
+        dp[i][j + 1] %= kMod
 
     return dp[len(target)][wordLength]
diff --git a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-3.java b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-3.java
index 26d5b849748..0cf9b042e7d 100644
--- a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-3.java	
+++ b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-3.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numWays(String[] words, String target) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int wordLength = words[0].length();
     // dp[i] := the number of ways to form the first i characters of `target`
     long[] dp = new long[target.length() + 1];
@@ -12,7 +12,7 @@ public int numWays(String[] words, String target) {
         ++count[word.charAt(j) - 'a'];
       for (int i = target.length(); i > 0; --i) {
         dp[i] += dp[i - 1] * count[target.charAt(i - 1) - 'a'];
-        dp[i] %= MOD;
+        dp[i] %= kMod;
       }
     }
 
diff --git a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-3.py b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-3.py
index bf47a48e7c0..d7fd5ef929b 100644
--- a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-3.py	
+++ b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639-3.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def numWays(self, words: list[str], target: str) -> int:
-    MOD = 1_000_000_007
+  def numWays(self, words: List[str], target: str) -> int:
+    kMod = 1_000_000_007
     # dp[i] := the number of ways to form the first i characters of `target`
     dp = [0] * (len(target) + 1)
     dp[0] = 1
@@ -9,6 +9,6 @@ def numWays(self, words: list[str], target: str) -> int:
       count = collections.Counter(word[j] for word in words)
       for i in range(len(target), 0, -1):
         dp[i] += dp[i - 1] * count[target[i - 1]]
-        dp[i] %= MOD
+        dp[i] %= kMod
 
     return dp[len(target)]
diff --git a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639.cpp b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639.cpp
index 177d64cf160..5a67be36748 100644
--- a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639.cpp	
+++ b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639.cpp	
@@ -25,10 +25,9 @@ class Solution {
       return 0;
     if (mem[i][j] != -1)
       return mem[i][j];
-    return mem[i][j] =
-               (static_cast<long>(numWays(target, i + 1, j + 1, counts, mem)) *
-                    counts[j][target[i] - 'a'] +
-                numWays(target, i, j + 1, counts, mem)) %
-               kMod;
+    return mem[i][j] = (numWays(target, i + 1, j + 1, counts, mem) *
+                            static_cast<long>(counts[j][target[i] - 'a']) +
+                        numWays(target, i, j + 1, counts, mem)) %
+                       kMod;
   };
 };
diff --git a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639.java b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639.java
index b6a658cdbae..76b69e0ee03 100644
--- a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639.java	
+++ b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639.java	
@@ -12,7 +12,7 @@ public int numWays(String[] words, String target) {
     return numWays(target, 0, 0, counts, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of ways to form target[i..n) using word[j..n).
   private int numWays(final String target, int i, int j, int[][] counts, Integer[][] mem) {
@@ -22,9 +22,9 @@ private int numWays(final String target, int i, int j, int[][] counts, Integer[]
       return 0;
     if (mem[i][j] != null)
       return mem[i][j];
-    return mem[i][j] = (int) (((long) numWays(target, i + 1, j + 1, counts, mem) *
-                                   (counts[j][target.charAt(i) - 'a']) +
+    return mem[i][j] = (int) ((numWays(target, i + 1, j + 1, counts, mem) *
+                                   (long) (counts[j][target.charAt(i) - 'a']) +
                                numWays(target, i, j + 1, counts, mem)) %
-                              MOD);
+                              kMod);
   }
 }
diff --git a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639.py b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639.py
index d166b4cfee6..ade1f6346e7 100644
--- a/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639.py	
+++ b/solutions/1639. Number of Ways to Form a Target String Given a Dictionary/1639.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def numWays(self, words: list[str], target: str) -> int:
-    MOD = 1_000_000_007
+  def numWays(self, words: List[str], target: str) -> int:
+    kMod = 1_000_000_007
     wordLength = len(words[0])
     # counts[j] := the count map of words[i][j], where 0 <= i < |words|
     counts = [collections.Counter() for _ in range(wordLength)]
@@ -16,6 +16,6 @@ def dp(i: int, j: int):
         return 1
       if j == wordLength:
         return 0
-      return (dp(i + 1, j + 1) * counts[j][target[i]] + dp(i, j + 1)) % MOD
+      return (dp(i + 1, j + 1) * counts[j][target[i]] + dp(i, j + 1)) % kMod
 
     return dp(0, 0)
diff --git a/solutions/164. Maximum Gap/164.py b/solutions/164. Maximum Gap/164.py
index e8f4ccf8873..4d2fb4887c9 100644
--- a/solutions/164. Maximum Gap/164.py	
+++ b/solutions/164. Maximum Gap/164.py	
@@ -5,7 +5,7 @@ def __init__(self, mn: int, mx: int):
 
 
 class Solution:
-  def maximumGap(self, nums: list[int]) -> int:
+  def maximumGap(self, nums: List[int]) -> int:
     if len(nums) < 2:
       return 0
 
diff --git a/solutions/1640. Check Array Formation Through Concatenation/1640.py b/solutions/1640. Check Array Formation Through Concatenation/1640.py
index 861028f9199..c62f39b9c8b 100644
--- a/solutions/1640. Check Array Formation Through Concatenation/1640.py	
+++ b/solutions/1640. Check Array Formation Through Concatenation/1640.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canFormArray(self, arr: list[int], pieces: list[list[int]]) -> bool:
+  def canFormArray(self, arr: List[int], pieces: List[List[int]]) -> bool:
     concatenated = []
     startToPiece = {piece[0]: piece for piece in pieces}
 
diff --git a/solutions/1641. Count Sorted Vowel Strings/1641.cpp b/solutions/1641. Count Sorted Vowel Strings/1641.cpp
index e1b0d75d987..9ee03bbb869 100644
--- a/solutions/1641. Count Sorted Vowel Strings/1641.cpp	
+++ b/solutions/1641. Count Sorted Vowel Strings/1641.cpp	
@@ -13,7 +13,7 @@ class Solution {
       for (int j = 0; j < 5; ++j)
         for (int k = 0; k <= j; ++k)
           newDp[j] += dp[k];
-      dp = std::move(newDp);
+      dp = move(newDp);
     }
 
     return accumulate(dp.begin(), dp.end(), 0);
diff --git a/solutions/1642. Furthest Building You Can Reach/1642.py b/solutions/1642. Furthest Building You Can Reach/1642.py
index 5f224110418..5c693179ac2 100644
--- a/solutions/1642. Furthest Building You Can Reach/1642.py	
+++ b/solutions/1642. Furthest Building You Can Reach/1642.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def furthestBuilding(
-      self,
-      heights: list[int],
-      bricks: int,
-      ladders: int,
-  ) -> int:
+  def furthestBuilding(self, heights: List[int], bricks: int, ladders: int) -> int:
     minHeap = []
 
     for i, (a, b) in enumerate(itertools.pairwise(heights)):
diff --git a/solutions/1643. Kth Smallest Instructions/1643.py b/solutions/1643. Kth Smallest Instructions/1643.py
index e7eb02ed03b..7a6cd95714a 100644
--- a/solutions/1643. Kth Smallest Instructions/1643.py	
+++ b/solutions/1643. Kth Smallest Instructions/1643.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def kthSmallestPath(self, destination: list[int], k: int) -> str:
+  def kthSmallestPath(self, destination: List[int], k: int) -> str:
     ans = []
     v, h = destination
 
diff --git a/solutions/1644. Lowest Common Ancestor of a Binary Tree II/1644-2.py b/solutions/1644. Lowest Common Ancestor of a Binary Tree II/1644-2.py
index 33435e14800..f12551396e9 100644
--- a/solutions/1644. Lowest Common Ancestor of a Binary Tree II/1644-2.py	
+++ b/solutions/1644. Lowest Common Ancestor of a Binary Tree II/1644-2.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def lowestCommonAncestor(
-      self,
-      root: 'TreeNode',
-      p: 'TreeNode',
-      q: 'TreeNode',
-  ) -> 'TreeNode':
+  def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
     def getLCA(root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
       if not root or root == p or root == q:
         return root
diff --git a/solutions/1644. Lowest Common Ancestor of a Binary Tree II/1644.py b/solutions/1644. Lowest Common Ancestor of a Binary Tree II/1644.py
index 0717548b288..a21da924f7b 100644
--- a/solutions/1644. Lowest Common Ancestor of a Binary Tree II/1644.py	
+++ b/solutions/1644. Lowest Common Ancestor of a Binary Tree II/1644.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def lowestCommonAncestor(
-      self,
-      root: 'TreeNode',
-      p: 'TreeNode',
-      q: 'TreeNode',
-  ) -> 'TreeNode':
+  def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
     seenP = False
     seenQ = False
 
diff --git a/solutions/1645. Hopper Company Queries II/1645.sql b/solutions/1645. Hopper Company Queries II/1645.sql
index 82717dbbea1..304e73c3cb9 100644
--- a/solutions/1645. Hopper Company Queries II/1645.sql	
+++ b/solutions/1645. Hopper Company Queries II/1645.sql	
@@ -1,5 +1,5 @@
-WITH RECURSIVE
-  Calendar AS (
+WITH
+  RECURSIVE Calendar AS (
     SELECT 1 AS month
     UNION ALL
     SELECT month + 1
diff --git a/solutions/1648. Sell Diminishing-Valued Colored Balls/1648.cpp b/solutions/1648. Sell Diminishing-Valued Colored Balls/1648.cpp
index b9b59ef207c..ef0ff8851a8 100644
--- a/solutions/1648. Sell Diminishing-Valued Colored Balls/1648.cpp	
+++ b/solutions/1648. Sell Diminishing-Valued Colored Balls/1648.cpp	
@@ -22,7 +22,7 @@ class Solution {
           return (ans +
                   largestCount *
                       trapezoid(inventory[i], inventory[i] - actualPick + 1) +
-                  static_cast<long>(remaining) * (inventory[i] - actualPick)) %
+                  remaining * static_cast<long>(inventory[i] - actualPick)) %
                  kMod;
         }
         ans += largestCount * trapezoid(inventory[i], inventory[i] - pick + 1);
diff --git a/solutions/1648. Sell Diminishing-Valued Colored Balls/1648.java b/solutions/1648. Sell Diminishing-Valued Colored Balls/1648.java
index 2176d6b8841..f529047ce30 100644
--- a/solutions/1648. Sell Diminishing-Valued Colored Balls/1648.java	
+++ b/solutions/1648. Sell Diminishing-Valued Colored Balls/1648.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int maxProfit(int[] inventory, int orders) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long ans = 0;
     long largestCount = 1;
 
@@ -19,10 +19,10 @@ public int maxProfit(int[] inventory, int orders) {
           return (int) ((ans +
                          largestCount * trapezoid(inventory[i], inventory[i] - actualPick + 1) +
                          remaining * (inventory[i] - actualPick)) %
-                        MOD);
+                        kMod);
         }
         ans += largestCount * trapezoid(inventory[i], inventory[i] - pick + 1);
-        ans %= MOD;
+        ans %= kMod;
         orders -= largestCount * pick;
       }
 
diff --git a/solutions/1648. Sell Diminishing-Valued Colored Balls/1648.py b/solutions/1648. Sell Diminishing-Valued Colored Balls/1648.py
index 3738f81ee86..b62dd13b41a 100644
--- a/solutions/1648. Sell Diminishing-Valued Colored Balls/1648.py	
+++ b/solutions/1648. Sell Diminishing-Valued Colored Balls/1648.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def maxProfit(self, inventory: list[int], orders: int) -> int:
-    MOD = 1_000_000_007
+  def maxProfit(self, inventory: List[int], orders: int) -> int:
+    kMod = 1_000_000_007
     ans = 0
     largestCount = 1
 
@@ -18,8 +18,8 @@ def trapezoid(a: int, b: int) -> int:
           actualPick, remaining = divmod(orders, largestCount)
           return (ans +
                   largestCount * trapezoid(a, a - actualPick + 1) +
-                  remaining * (a - actualPick)) % MOD
+                  remaining * (a - actualPick)) % kMod
         ans += largestCount * trapezoid(a, a - pick + 1)
-        ans %= MOD
+        ans %= kMod
         orders -= largestCount * pick
       largestCount += 1
diff --git a/solutions/1649. Create Sorted Array through Instructions/1649-2.cpp b/solutions/1649. Create Sorted Array through Instructions/1649-2.cpp
index c6bd5601486..35d139f0e82 100644
--- a/solutions/1649. Create Sorted Array through Instructions/1649-2.cpp	
+++ b/solutions/1649. Create Sorted Array through Instructions/1649-2.cpp	
@@ -31,10 +31,10 @@ class SegmentTree {
     }
     const int mid = (lo + hi) / 2;
     if (i <= mid)
-      add(2 * treeIndex + 1, lo, mid, i, val);
+      add(left(treeIndex), lo, mid, i, val);
     else
-      add(2 * treeIndex + 2, mid + 1, hi, i, val);
-    tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
+      add(right(treeIndex), mid + 1, hi, i, val);
+    tree[treeIndex] = merge(tree[left(treeIndex)], tree[right(treeIndex)]);
   }
 
   NodeType query(int treeIndex, int lo, int hi, int i, int j) const {
@@ -43,8 +43,16 @@ class SegmentTree {
     if (j < lo || hi < i)  // [lo, hi] lies completely outside [i, j].
       return defaultNode;
     const int mid = (lo + hi) / 2;
-    return merge(query(2 * treeIndex + 1, lo, mid, i, j),
-                 query(2 * treeIndex + 2, mid + 1, hi, i, j));
+    return merge(query(left(treeIndex), lo, mid, i, j),
+                 query(right(treeIndex), mid + 1, hi, i, j));
+  }
+
+  int left(int treeIndex) const {
+    return 2 * treeIndex + 1;
+  }
+
+  int right(int treeIndex) const {
+    return 2 * treeIndex + 2;
   }
 };
 
diff --git a/solutions/1651. Hopper Company Queries III/1651.sql b/solutions/1651. Hopper Company Queries III/1651.sql
index 9d7dac75d13..fff37026707 100644
--- a/solutions/1651. Hopper Company Queries III/1651.sql	
+++ b/solutions/1651. Hopper Company Queries III/1651.sql	
@@ -1,5 +1,5 @@
-WITH RECURSIVE
-  Calendar AS (
+WITH
+  RECURSIVE Calendar AS (
     SELECT 2 AS MONTH
     UNION ALL
     SELECT MONTH + 1
diff --git a/solutions/1652. Defuse the Bomb/1652.py b/solutions/1652. Defuse the Bomb/1652.py
index 5ff190ec4c4..701f04e9034 100644
--- a/solutions/1652. Defuse the Bomb/1652.py	
+++ b/solutions/1652. Defuse the Bomb/1652.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def decrypt(self, code: list[int], k: int) -> list[int]:
+  def decrypt(self, code: List[int], k: int) -> List[int]:
     n = len(code)
     ans = [0] * n
     if k == 0:
diff --git a/solutions/1654. Minimum Jumps to Reach Home/1654.java b/solutions/1654. Minimum Jumps to Reach Home/1654.java
index 9af142594dc..9969972556d 100644
--- a/solutions/1654. Minimum Jumps to Reach Home/1654.java	
+++ b/solutions/1654. Minimum Jumps to Reach Home/1654.java	
@@ -1,4 +1,4 @@
-enum Direction { FORWARD, BACKWARD }
+enum Direction { kForward, kBackward }
 
 class Solution {
   public int minimumJumps(int[] forbidden, int a, int b, int x) {
@@ -13,7 +13,8 @@ public int minimumJumps(int[] forbidden, int a, int b, int x) {
     }
 
     // (direction, position)
-    Queue<Pair<Direction, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(Direction.FORWARD, 0)));
+    Queue<Pair<Direction, Integer>> q =
+        new ArrayDeque<>(Arrays.asList(new Pair<>(Direction.kForward, 0)));
 
     for (int ans = 0; !q.isEmpty(); ++ans)
       for (int sz = q.size(); sz > 0; --sz) {
@@ -24,10 +25,10 @@ public int minimumJumps(int[] forbidden, int a, int b, int x) {
         final int forward = pos + a;
         final int backward = pos - b;
         if (forward <= furthest && seenForward.add(forward))
-          q.offer(new Pair<>(Direction.FORWARD, forward));
+          q.offer(new Pair<>(Direction.kForward, forward));
         // It cannot jump backward twice in a row.
-        if (dir == Direction.FORWARD && backward >= 0 && seenBackward.add(backward))
-          q.offer(new Pair<>(Direction.BACKWARD, backward));
+        if (dir == Direction.kForward && backward >= 0 && seenBackward.add(backward))
+          q.offer(new Pair<>(Direction.kBackward, backward));
       }
 
     return -1;
diff --git a/solutions/1654. Minimum Jumps to Reach Home/1654.py b/solutions/1654. Minimum Jumps to Reach Home/1654.py
index a1539e8933c..7be93bdd502 100644
--- a/solutions/1654. Minimum Jumps to Reach Home/1654.py	
+++ b/solutions/1654. Minimum Jumps to Reach Home/1654.py	
@@ -2,18 +2,18 @@
 
 
 class Direction(Enum):
-  FORWARD = 0
-  BACKWARD = 1
+  kForward = 0
+  kBackward = 1
 
 
 class Solution:
-  def minimumJumps(self, forbidden: list[int], a: int, b: int, x: int) -> int:
+  def minimumJumps(self, forbidden: List[int], a: int, b: int, x: int) -> int:
     furthest = max(x + a + b, max(pos + a + b for pos in forbidden))
     seenForward = {pos for pos in forbidden}
     seenBackward = {pos for pos in forbidden}
 
     # (direction, position)
-    q = collections.deque([(Direction.FORWARD, 0)])
+    q = collections.deque([(Direction.kForward, 0)])
 
     ans = 0
     while q:
@@ -25,11 +25,11 @@ def minimumJumps(self, forbidden: list[int], a: int, b: int, x: int) -> int:
         backward = pos - b
         if forward <= furthest and forward not in seenForward:
           seenForward.add(forward)
-          q.append((Direction.FORWARD, forward))
+          q.append((Direction.kForward, forward))
         # It cannot jump backward twice in a row.
-        if dir == Direction.FORWARD and backward >= 0 and backward not in seenBackward:
+        if dir == Direction.kForward and backward >= 0 and backward not in seenBackward:
           seenBackward.add(backward)
-          q.append((Direction.BACKWARD, backward))
+          q.append((Direction.kBackward, backward))
       ans += 1
 
     return -1
diff --git a/solutions/1655. Distribute Repeating Integers/1655.py b/solutions/1655. Distribute Repeating Integers/1655.py
index 0a730091bbe..b3d4a1d700c 100644
--- a/solutions/1655. Distribute Repeating Integers/1655.py	
+++ b/solutions/1655. Distribute Repeating Integers/1655.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canDistribute(self, nums: list[int], quantity: list[int]) -> bool:
+  def canDistribute(self, nums: List[int], quantity: List[int]) -> bool:
     freqs = list(collections.Counter(nums).values())
     # validDistribution[i][j] := True if it's possible to distribute the i-th
     # freq into a subset of quantity represented by the bitmask j
@@ -24,8 +24,7 @@ def canDistribute(self, nums: list[int], quantity: list[int]) -> bool:
 
     return dp[0][0]
 
-  def _getValidDistribution(self, freqs: list[int],
-                            quantity: list[int]) -> list[list[bool]]:
+  def _getValidDistribution(self, freqs: List[int], quantity: List[int]) -> List[List[bool]]:
     maxMask = 1 << len(quantity)
     validDistribution = [[False] * maxMask for _ in range(len(freqs))]
     for i, freq in enumerate(freqs):
@@ -34,6 +33,6 @@ def _getValidDistribution(self, freqs: list[int],
           validDistribution[i][mask] = True
     return validDistribution
 
-  def _getQuantitySum(self, quantity: list[int], mask: int) -> int:
+  def _getQuantitySum(self, quantity: List[int], mask: int) -> int:
     """Returns the sum of the selected quantity represented by `mask`."""
     return sum(q for i, q in enumerate(quantity) if mask >> i & 1)
diff --git a/solutions/1656. Design an Ordered Stream/1656.py b/solutions/1656. Design an Ordered Stream/1656.py
index 27ba74589d8..a050e641b41 100644
--- a/solutions/1656. Design an Ordered Stream/1656.py	
+++ b/solutions/1656. Design an Ordered Stream/1656.py	
@@ -3,7 +3,7 @@ def __init__(self, n: int):
     self.values = [''] * n
     self.i = 0  # self.values' index (0-indexed)
 
-  def insert(self, idKey: int, value: str) -> list[str]:
+  def insert(self, idKey: int, value: str) -> List[str]:
     idKey -= 1  # Converts to 0-indexed.
     self.values[idKey] = value
     if idKey > self.i:
diff --git a/solutions/1658. Minimum Operations to Reduce X to Zero/1658.py b/solutions/1658. Minimum Operations to Reduce X to Zero/1658.py
index 7cc8466a18b..c25ab5ba012 100644
--- a/solutions/1658. Minimum Operations to Reduce X to Zero/1658.py	
+++ b/solutions/1658. Minimum Operations to Reduce X to Zero/1658.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums: list[int], x: int) -> int:
+  def minOperations(self, nums: List[int], x: int) -> int:
     targetSum = sum(nums) - x
     if targetSum == 0:
       return len(nums)
@@ -7,7 +7,7 @@ def minOperations(self, nums: list[int], x: int) -> int:
     return -1 if maxLen == -1 else len(nums) - maxLen
 
   # Same as 325. Maximum Size Subarray Sum Equals k
-  def _maxSubArrayLen(self, nums: list[int], k: int) -> int:
+  def _maxSubArrayLen(self, nums: List[int], k: int) -> int:
     res = -1
     prefix = 0
     prefixToIndex = {0: -1}
diff --git a/solutions/1659. Maximize Grid Happiness/1659.java b/solutions/1659. Maximize Grid Happiness/1659.java
index 978a593f4ad..7105d3a8e93 100644
--- a/solutions/1659. Maximize Grid Happiness/1659.java	
+++ b/solutions/1659. Maximize Grid Happiness/1659.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public int getMaxGridHappiness(int m, int n, int introvertsCount, int extrovertsCount) {
     final int twoToThePowerOfN = (int) Math.pow(2, n);
     int[][][][][] mem = new int[m * n][twoToThePowerOfN][twoToThePowerOfN][introvertsCount + 1]
diff --git a/solutions/1659. Maximize Grid Happiness/1659.py b/solutions/1659. Maximize Grid Happiness/1659.py
index 9ad4d3725db..40e4a0c98f1 100644
--- a/solutions/1659. Maximize Grid Happiness/1659.py	
+++ b/solutions/1659. Maximize Grid Happiness/1659.py	
@@ -1,18 +1,6 @@
 class Solution:
-  def getMaxGridHappiness(
-      self,
-      m: int,
-      n: int,
-      introvertsCount: int,
-      extrovertsCount: int,
-  ) -> int:
-    def getPlacementCost(
-        i: int,
-        j: int,
-        inMask: int,
-        exMask: int,
-        diff: int,
-    ) -> int:
+  def getMaxGridHappiness(self, m: int, n: int, introvertsCount: int, extrovertsCount: int) -> int:
+    def getPlacementCost(i: int, j: int, inMask: int, exMask: int, diff: int) -> int:
       """Calculates the cost based on left and up neighbors.
 
       The `diff` parameter represents the happiness change due to the current
@@ -36,9 +24,7 @@ def getPlacementCost(
       return cost
 
     @functools.lru_cache(None)
-    def dp(
-        pos: int, inMask: int, exMask: int, inCount: int, exCount: int
-    ) -> int:
+    def dp(pos: int, inMask: int, exMask: int, inCount: int, exCount: int) -> int:
       # `inMask` is the placement of introvert people in the last n cells.
       # e.g. if we have m = 2, n = 3, i = 1, j = 1, then inMask = 0b101 means
       #
@@ -52,16 +38,12 @@ def dp(
       shiftedExMask = (exMask << 1) & ((1 << n) - 1)
 
       skip = dp(pos + 1, shiftedInMask, shiftedExMask, inCount, exCount)
-      placeIntrovert = (
-          120 + getPlacementCost(i, j, inMask, exMask, -30) +
-          dp(pos + 1, shiftedInMask + 1, shiftedExMask, inCount - 1, exCount)
-          if inCount > 0
-          else -math.inf)
-      placeExtrovert = (
-          40 + getPlacementCost(i, j, inMask, exMask, 20) +
-          dp(pos + 1, shiftedInMask, shiftedExMask + 1, inCount, exCount - 1)
-          if exCount > 0
-          else -math.inf)
+      placeIntrovert = 120 + getPlacementCost(i, j, inMask, exMask, -30) + \
+          dp(pos + 1, shiftedInMask + 1, shiftedExMask, inCount - 1, exCount) if inCount > 0 \
+          else -math.inf
+      placeExtrovert = 40 + getPlacementCost(i, j, inMask, exMask, 20) + \
+          dp(pos + 1, shiftedInMask, shiftedExMask + 1, inCount, exCount - 1) if exCount > 0 \
+          else -math.inf
       return max(skip, placeIntrovert, placeExtrovert)
 
     return dp(0, 0, 0, introvertsCount, extrovertsCount)
diff --git a/solutions/1660. Correct a Binary Tree/1660.py b/solutions/1660. Correct a Binary Tree/1660.py
index ef0d07943a9..73fde0af486 100644
--- a/solutions/1660. Correct a Binary Tree/1660.py	
+++ b/solutions/1660. Correct a Binary Tree/1660.py	
@@ -2,7 +2,7 @@ class Solution:
   def __init__(self):
     self.seen = set()
 
-  def correctBinaryTree(self, root: TreeNode | None) -> TreeNode | None:
+  def correctBinaryTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
     if root == None:
       return None
     if root.right and root.right.val in self.seen:
diff --git a/solutions/1662. Check If Two String Arrays are Equivalent/1662.py b/solutions/1662. Check If Two String Arrays are Equivalent/1662.py
index 60483862f95..859f2f942c6 100644
--- a/solutions/1662. Check If Two String Arrays are Equivalent/1662.py	
+++ b/solutions/1662. Check If Two String Arrays are Equivalent/1662.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def arrayStringsAreEqual(self, word1: list[str], word2: list[str]) -> bool:
+  def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:
     i = 0  # word1's index
     j = 0  # word2's index
     a = 0  # word1[i]'s index
diff --git a/solutions/1665. Minimum Initial Energy to Finish Tasks/1665.cpp b/solutions/1665. Minimum Initial Energy to Finish Tasks/1665.cpp
index 6b6e0f958a5..11c53542d36 100644
--- a/solutions/1665. Minimum Initial Energy to Finish Tasks/1665.cpp	
+++ b/solutions/1665. Minimum Initial Energy to Finish Tasks/1665.cpp	
@@ -4,8 +4,9 @@ class Solution {
     int ans = 0;
     int prevSaved = 0;
 
-    ranges::sort(tasks, ranges::greater{},
-                 [](const vector<int>& task) { return task[1] - task[0]; });
+    ranges::sort(tasks, [](const vector<int>& a, const vector<int>& b) {
+      return a[1] - a[0] > b[1] - b[0];
+    });
 
     for (const vector<int>& task : tasks) {
       const int actual = task[0];
diff --git a/solutions/1665. Minimum Initial Energy to Finish Tasks/1665.java b/solutions/1665. Minimum Initial Energy to Finish Tasks/1665.java
index 39a7b4bb145..a46c0ac4b6b 100644
--- a/solutions/1665. Minimum Initial Energy to Finish Tasks/1665.java	
+++ b/solutions/1665. Minimum Initial Energy to Finish Tasks/1665.java	
@@ -3,7 +3,7 @@ public int minimumEffort(int[][] tasks) {
     int ans = 0;
     int prevSaved = 0;
 
-    Arrays.sort(tasks, Comparator.comparingInt(task -> task[0] - task[1]));
+    Arrays.sort(tasks, (a, b) -> (b[1] - b[0]) - (a[1] - a[0]));
 
     for (int[] task : tasks) {
       final int actual = task[0];
diff --git a/solutions/1665. Minimum Initial Energy to Finish Tasks/1665.py b/solutions/1665. Minimum Initial Energy to Finish Tasks/1665.py
index 5d98be86c58..d42ca20197c 100644
--- a/solutions/1665. Minimum Initial Energy to Finish Tasks/1665.py	
+++ b/solutions/1665. Minimum Initial Energy to Finish Tasks/1665.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumEffort(self, tasks: list[list[int]]) -> int:
+  def minimumEffort(self, tasks: List[List[int]]) -> int:
     ans = 0
     prevSaved = 0
 
diff --git a/solutions/1669. Merge In Between Linked Lists/1669.py b/solutions/1669. Merge In Between Linked Lists/1669.py
index 8744efecee0..ed01e9ad2a3 100644
--- a/solutions/1669. Merge In Between Linked Lists/1669.py	
+++ b/solutions/1669. Merge In Between Linked Lists/1669.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def mergeInBetween(
-      self,
-      list1: ListNode,
-      a: int,
-      b: int,
-      list2: ListNode,
-  ) -> ListNode:
+  def mergeInBetween(self, list1: ListNode, a: int, b: int, list2: ListNode) -> ListNode:
     nodeBeforeA = list1
     for i in range(a - 1):
       nodeBeforeA = nodeBeforeA.next
diff --git a/solutions/167. Two Sum II - Input array is sorted/167.py b/solutions/167. Two Sum II - Input array is sorted/167.py
index 7160f5793ae..4220003ab01 100644
--- a/solutions/167. Two Sum II - Input array is sorted/167.py	
+++ b/solutions/167. Two Sum II - Input array is sorted/167.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def twoSum(self, numbers: list[int], target: int) -> list[int]:
+  def twoSum(self, numbers: List[int], target: int) -> List[int]:
     l = 0
     r = len(numbers) - 1
 
diff --git a/solutions/1671. Minimum Number of Removals to Make Mountain Array/1671.cpp b/solutions/1671. Minimum Number of Removals to Make Mountain Array/1671.cpp
index fbe73a2ebbd..958b28a6828 100644
--- a/solutions/1671. Minimum Number of Removals to Make Mountain Array/1671.cpp	
+++ b/solutions/1671. Minimum Number of Removals to Make Mountain Array/1671.cpp	
@@ -1,8 +1,8 @@
 class Solution {
  public:
   int minimumMountainRemovals(vector<int>& nums) {
-    const vector<int> l = lengthOfLIS(nums);
-    const vector<int> r = reversed(lengthOfLIS(reversed(nums)));
+    vector<int> l = lengthOfLIS(nums);
+    vector<int> r = reversed(lengthOfLIS(reversed(nums)));
     int maxMountainSeq = 0;
 
     for (int i = 0; i < nums.size(); ++i)
@@ -15,23 +15,23 @@ class Solution {
  private:
   // Similar to 300. Longest Increasing Subsequence
   vector<int> lengthOfLIS(vector<int> nums) {
-    // tails[i] := the minimum tail of all the increasing subsequences having
+    // tail[i] := the minimum tail of all the increasing subsequences having
     // length i + 1
-    vector<int> tails;
+    vector<int> tail;
     // dp[i] := the length of LIS ending in nums[i]
     vector<int> dp;
     for (const int num : nums) {
-      if (tails.empty() || num > tails.back())
-        tails.push_back(num);
+      if (tail.empty() || num > tail.back())
+        tail.push_back(num);
       else
-        tails[firstGreaterEqual(tails, num)] = num;
-      dp.push_back(tails.size());
+        tail[firstGreaterEqual(tail, num)] = num;
+      dp.push_back(tail.size());
     }
     return dp;
   }
 
-  int firstGreaterEqual(const vector<int>& arr, int target) {
-    return ranges::lower_bound(arr, target) - arr.begin();
+  int firstGreaterEqual(const vector<int>& A, int target) {
+    return ranges::lower_bound(A, target) - A.begin();
   }
 
   vector<int> reversed(const vector<int>& nums) {
diff --git a/solutions/1671. Minimum Number of Removals to Make Mountain Array/1671.java b/solutions/1671. Minimum Number of Removals to Make Mountain Array/1671.java
index 430f2c78aab..fc4375204db 100644
--- a/solutions/1671. Minimum Number of Removals to Make Mountain Array/1671.java	
+++ b/solutions/1671. Minimum Number of Removals to Make Mountain Array/1671.java	
@@ -13,39 +13,39 @@ public int minimumMountainRemovals(int[] nums) {
 
   // Similar to 300. Longest Increasing Subsequence
   private int[] lengthOfLIS(int[] nums) {
-    // tails[i] := the minimum tail of all the increasing subsequences with
+    // tail[i] := the minimum tail of all the increasing subsequences with
     // length i + 1
-    List<Integer> tails = new ArrayList<>();
+    List<Integer> tail = new ArrayList<>();
     // dp[i] := the length of LIS ending in nums[i]
     int[] dp = new int[nums.length];
     for (int i = 0; i < nums.length; ++i) {
       final int num = nums[i];
-      if (tails.isEmpty() || num > tails.get(tails.size() - 1))
-        tails.add(num);
+      if (tail.isEmpty() || num > tail.get(tail.size() - 1))
+        tail.add(num);
       else
-        tails.set(firstGreaterEqual(tails, num), num);
-      dp[i] = tails.size();
+        tail.set(firstGreaterEqual(tail, num), num);
+      dp[i] = tail.size();
     }
     return dp;
   }
 
-  private int firstGreaterEqual(List<Integer> arr, int target) {
-    final int i = Collections.binarySearch(arr, target);
+  private int firstGreaterEqual(List<Integer> A, int target) {
+    final int i = Collections.binarySearch(A, target);
     return i < 0 ? -i - 1 : i;
   }
 
   private int[] reversed(int[] nums) {
-    int[] arr = nums.clone();
+    int[] A = nums.clone();
     int l = 0;
     int r = nums.length - 1;
     while (l < r)
-      swap(arr, l++, r--);
-    return arr;
+      swap(A, l++, r--);
+    return A;
   }
 
-  private void swap(int[] arr, int i, int j) {
-    final int temp = arr[i];
-    arr[i] = arr[j];
-    arr[j] = temp;
+  private void swap(int[] A, int i, int j) {
+    final int temp = A[i];
+    A[i] = A[j];
+    A[j] = temp;
   }
 }
diff --git a/solutions/1671. Minimum Number of Removals to Make Mountain Array/1671.py b/solutions/1671. Minimum Number of Removals to Make Mountain Array/1671.py
index a3df021d828..f5479563bf9 100644
--- a/solutions/1671. Minimum Number of Removals to Make Mountain Array/1671.py	
+++ b/solutions/1671. Minimum Number of Removals to Make Mountain Array/1671.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumMountainRemovals(self, nums: list[int]) -> int:
+  def minimumMountainRemovals(self, nums: List[int]) -> int:
     left = self._lengthOfLIS(nums)
     right = self._lengthOfLIS(nums[::-1])[::-1]
     maxMountainSeq = 0
@@ -11,16 +11,16 @@ def minimumMountainRemovals(self, nums: list[int]) -> int:
     return len(nums) - maxMountainSeq
 
   # Similar to 300. Longest Increasing Subsequence
-  def _lengthOfLIS(self, nums: list[int]) -> list[int]:
-    # tails[i] := the minimum tail of all the increasing subsequences having
+  def _lengthOfLIS(self, nums: List[int]) -> List[int]:
+    # tail[i] := the minimum tail of all the increasing subsequences having
     # length i + 1
-    tails = []
+    tail = []
     # dp[i] := the length of LIS ending in nums[i]
     dp = []
     for num in nums:
-      if not tails or num > tails[-1]:
-        tails.append(num)
+      if not tail or num > tail[-1]:
+        tail.append(num)
       else:
-        tails[bisect.bisect_left(tails, num)] = num
-      dp.append(len(tails))
+        tail[bisect.bisect_left(tail, num)] = num
+      dp.append(len(tail))
     return dp
diff --git a/solutions/1672. Richest Customer Wealth/1672.cpp b/solutions/1672. Richest Customer Wealth/1672.cpp
index 3b66ca8d528..bbc3b32962b 100644
--- a/solutions/1672. Richest Customer Wealth/1672.cpp	
+++ b/solutions/1672. Richest Customer Wealth/1672.cpp	
@@ -2,8 +2,8 @@ class Solution {
  public:
   int maximumWealth(vector<vector<int>>& accounts) {
     return accumulate(accounts.begin(), accounts.end(), 0,
-                      [](int acc, const vector<int>& account) {
-      return max(acc, accumulate(account.begin(), account.end(), 0));
+                      [](int subtotal, const vector<int>& account) {
+      return max(subtotal, accumulate(account.begin(), account.end(), 0));
     });
   }
 };
diff --git a/solutions/1672. Richest Customer Wealth/1672.py b/solutions/1672. Richest Customer Wealth/1672.py
index fa1315ca7c8..dd5215b28e0 100644
--- a/solutions/1672. Richest Customer Wealth/1672.py	
+++ b/solutions/1672. Richest Customer Wealth/1672.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def maximumWealth(self, accounts: list[list[int]]) -> int:
+  def maximumWealth(self, accounts: List[List[int]]) -> int:
     return max(map(sum, accounts))
diff --git a/solutions/1673. Find the Most Competitive Subsequence/1673.py b/solutions/1673. Find the Most Competitive Subsequence/1673.py
index 113c41ea3bd..c7f80e65bb6 100644
--- a/solutions/1673. Find the Most Competitive Subsequence/1673.py	
+++ b/solutions/1673. Find the Most Competitive Subsequence/1673.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def mostCompetitive(self, nums: list[int], k: int) -> list[int]:
+  def mostCompetitive(self, nums: List[int], k: int) -> List[int]:
     ans = []
 
     for i, num in enumerate(nums):
diff --git a/solutions/1674. Minimum Moves to Make Array Complementary/1674.py b/solutions/1674. Minimum Moves to Make Array Complementary/1674.py
index 4edba644703..b4790b682df 100644
--- a/solutions/1674. Minimum Moves to Make Array Complementary/1674.py	
+++ b/solutions/1674. Minimum Moves to Make Array Complementary/1674.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minMoves(self, nums: list[int], limit: int) -> int:
+  def minMoves(self, nums: List[int], limit: int) -> int:
     n = len(nums)
     ans = n
     # delta[i] := the number of moves needed when target goes from i - 1 to i
diff --git a/solutions/1675. Minimize Deviation in Array/1675.py b/solutions/1675. Minimize Deviation in Array/1675.py
index 1c69d81ac21..35fcf71c6cb 100644
--- a/solutions/1675. Minimize Deviation in Array/1675.py	
+++ b/solutions/1675. Minimize Deviation in Array/1675.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumDeviation(self, nums: list[int]) -> int:
+  def minimumDeviation(self, nums: List[int]) -> int:
     ans = math.inf
     mn = math.inf
     maxHeap = []
diff --git a/solutions/1676. Lowest Common Ancestor of a Binary Tree IV/1676.py b/solutions/1676. Lowest Common Ancestor of a Binary Tree IV/1676.py
index aee95d8a623..a907146aa55 100644
--- a/solutions/1676. Lowest Common Ancestor of a Binary Tree IV/1676.py	
+++ b/solutions/1676. Lowest Common Ancestor of a Binary Tree IV/1676.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def lowestCommonAncestor(
-      self,
-      root: 'TreeNode',
-      nodes: 'list[TreeNode]',
-  ) -> 'TreeNode':
+  def lowestCommonAncestor(self, root: 'TreeNode', nodes: 'List[TreeNode]') -> 'TreeNode':
     nodes = set(nodes)
 
     def lca(root: 'TreeNode') -> 'TreeNode':
diff --git a/solutions/1679. Max Number of K-Sum Pairs/1679.py b/solutions/1679. Max Number of K-Sum Pairs/1679.py
index 03260ecd1f7..fc30680bc05 100644
--- a/solutions/1679. Max Number of K-Sum Pairs/1679.py	
+++ b/solutions/1679. Max Number of K-Sum Pairs/1679.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxOperations(self, nums: list[int], k: int) -> int:
+  def maxOperations(self, nums: List[int], k: int) -> int:
     count = collections.Counter(nums)
     return sum(min(count[num], count[k - num])
                for num in count) // 2
diff --git a/solutions/168. Excel Sheet Column Title/168.py b/solutions/168. Excel Sheet Column Title/168.py
index 7a51e726e37..af4ea7ef9ca 100644
--- a/solutions/168. Excel Sheet Column Title/168.py	
+++ b/solutions/168. Excel Sheet Column Title/168.py	
@@ -1,5 +1,4 @@
 class Solution:
   def convertToTitle(self, n: int) -> str:
-    return (self.convertToTitle((n - 1) // 26) + chr(ord('A') + (n - 1) % 26)
-            if n
-            else '')
+    return self.convertToTitle((n - 1) // 26) + \
+        chr(ord('A') + (n - 1) % 26) if n else ''
diff --git a/solutions/1680. Concatenation of Consecutive Binary Numbers/1680-2.java b/solutions/1680. Concatenation of Consecutive Binary Numbers/1680-2.java
index a92da6ced1c..f5b12605942 100644
--- a/solutions/1680. Concatenation of Consecutive Binary Numbers/1680-2.java	
+++ b/solutions/1680. Concatenation of Consecutive Binary Numbers/1680-2.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int concatenatedBinary(int n) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long ans = 0;
     int numberOfBits = 0;
 
     for (int i = 1; i <= n; ++i) {
       if (Integer.bitCount(i) == 1)
         ++numberOfBits;
-      ans = ((ans << numberOfBits) % MOD + i) % MOD;
+      ans = ((ans << numberOfBits) % kMod + i) % kMod;
     }
 
     return (int) ans;
diff --git a/solutions/1680. Concatenation of Consecutive Binary Numbers/1680-2.py b/solutions/1680. Concatenation of Consecutive Binary Numbers/1680-2.py
index 5484ed5caf1..42853365c02 100644
--- a/solutions/1680. Concatenation of Consecutive Binary Numbers/1680-2.py	
+++ b/solutions/1680. Concatenation of Consecutive Binary Numbers/1680-2.py	
@@ -1,12 +1,12 @@
 class Solution:
   def concatenatedBinary(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     ans = 0
     numberOfBits = 0
 
     for i in range(1, n + 1):
       if i.bit_count() == 1:
         numberOfBits += 1
-      ans = ((ans << numberOfBits) + i) % MOD
+      ans = ((ans << numberOfBits) + i) % kMod
 
     return ans
diff --git a/solutions/1680. Concatenation of Consecutive Binary Numbers/1680.java b/solutions/1680. Concatenation of Consecutive Binary Numbers/1680.java
index f5e3f102195..714919f4bda 100644
--- a/solutions/1680. Concatenation of Consecutive Binary Numbers/1680.java	
+++ b/solutions/1680. Concatenation of Consecutive Binary Numbers/1680.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int concatenatedBinary(int n) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long ans = 0;
 
     for (int i = 1; i <= n; ++i)
-      ans = ((ans << numberOfBits(i)) % MOD + i) % MOD;
+      ans = ((ans << numberOfBits(i)) % kMod + i) % kMod;
 
     return (int) ans;
   }
diff --git a/solutions/1680. Concatenation of Consecutive Binary Numbers/1680.py b/solutions/1680. Concatenation of Consecutive Binary Numbers/1680.py
index 675f9df67b4..76564355da6 100644
--- a/solutions/1680. Concatenation of Consecutive Binary Numbers/1680.py	
+++ b/solutions/1680. Concatenation of Consecutive Binary Numbers/1680.py	
@@ -1,12 +1,12 @@
 class Solution:
   def concatenatedBinary(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     ans = 0
 
     def numberOfBits(n: int) -> int:
       return int(math.log2(n)) + 1
 
     for i in range(1, n + 1):
-      ans = ((ans << numberOfBits(i)) + i) % MOD
+      ans = ((ans << numberOfBits(i)) + i) % kMod
 
     return ans
diff --git a/solutions/1681. Minimum Incompatibility/1681.java b/solutions/1681. Minimum Incompatibility/1681.java
index ea4d94c7f17..cc8c42a233c 100644
--- a/solutions/1681. Minimum Incompatibility/1681.java	
+++ b/solutions/1681. Minimum Incompatibility/1681.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int minimumIncompatibility(int[] nums, int k) {
-    final int MAX_COMPATIBILITY = (16 - 1) * (16 / 2);
+    final int kMaxCompatibility = (16 - 1) * (16 / 2);
     final int n = nums.length;
     final int subsetSize = n / k;
     final int maxMask = 1 << n;
@@ -8,7 +8,7 @@ public int minimumIncompatibility(int[] nums, int k) {
     // dp[i] := the minimum possible sum of incompatibilities of the subset
     // of numbers represented by the bitmask i
     int[] dp = new int[maxMask];
-    Arrays.fill(dp, MAX_COMPATIBILITY);
+    Arrays.fill(dp, kMaxCompatibility);
     dp[0] = 0;
 
     for (int mask = 1; mask < maxMask; ++mask) {
@@ -21,10 +21,10 @@ public int minimumIncompatibility(int[] nums, int k) {
           dp[mask] = Math.min(dp[mask], dp[mask - submask] + incompatibilities[submask]);
     }
 
-    return dp[maxMask - 1] == MAX_COMPATIBILITY ? -1 : dp[maxMask - 1];
+    return dp[maxMask - 1] == kMaxCompatibility ? -1 : dp[maxMask - 1];
   }
 
-  private static final int MAX_NUM = 16;
+  private static final int kMaxNum = 16;
 
   // Returns an incompatibilities array where
   // * incompatibilities[i] := the incompatibility of the subset of numbers
@@ -57,7 +57,7 @@ private boolean isUnique(int[] nums, int mask, int subsetSize) {
   // Returns the incompatibility of the selected numbers represented by the
   // `mask`.
   private int getIncompatibility(int[] nums, int mask) {
-    int mn = MAX_NUM;
+    int mn = kMaxNum;
     int mx = 0;
     for (int i = 0; i < nums.length; ++i)
       if ((mask >> i & 1) == 1) {
diff --git a/solutions/1681. Minimum Incompatibility/1681.py b/solutions/1681. Minimum Incompatibility/1681.py
index 4a65437b467..6d3e7a30517 100644
--- a/solutions/1681. Minimum Incompatibility/1681.py	
+++ b/solutions/1681. Minimum Incompatibility/1681.py	
@@ -1,9 +1,9 @@
 class Solution:
   def __init__(self):
-    self.MAX_NUM = 16
+    self.kMaxNum = 16
 
-  def minimumIncompatibility(self, nums: list[int], k: int) -> int:
-    MAX_COMPATIBILITY = (16 - 1) * (16 // 2)
+  def minimumIncompatibility(self, nums: List[int], k: int) -> int:
+    kMaxCompatibility = (16 - 1) * (16 // 2)
     n = len(nums)
     subsetSize = n // k
     maxMask = 1 << n
@@ -11,7 +11,7 @@ def minimumIncompatibility(self, nums: list[int], k: int) -> int:
 
     # dp[i] := the minimum possible sum of incompatibilities of the subset
     # of numbers represented by the bitmask i
-    dp = [MAX_COMPATIBILITY] * maxMask
+    dp = [kMaxCompatibility] * maxMask
     dp[0] = 0
 
     for mask in range(1, maxMask):
@@ -26,13 +26,9 @@ def minimumIncompatibility(self, nums: list[int], k: int) -> int:
                          incompatibilities[submask])
         submask = (submask - 1) & mask
 
-    return dp[-1] if dp[-1] != MAX_COMPATIBILITY else -1
+    return dp[-1] if dp[-1] != kMaxCompatibility else -1
 
-  def _getIncompatibilities(
-      self,
-      nums: list[int],
-      subsetSize: int,
-  ) -> list[int]:
+  def _getIncompatibilities(self, nums: List[int], subsetSize: int) -> List[int]:
     """
     Returns an incompatibilities array where
     * incompatibilities[i] := the incompatibility of the subset of numbers
@@ -47,7 +43,7 @@ def _getIncompatibilities(
         incompatibilities[mask] = self._getIncompatibility(nums, mask)
     return incompatibilities
 
-  def _isUnique(self, nums: list[int], mask: int, subsetSize: int) -> bool:
+  def _isUnique(self, nums: List[int], mask: int, subsetSize: int) -> bool:
     """Returns True if the numbers selected by `mask` are unique."""
     used = 0
     for i, num in enumerate(nums):
@@ -55,12 +51,12 @@ def _isUnique(self, nums: list[int], mask: int, subsetSize: int) -> bool:
         used |= 1 << num
     return used.bit_count() == subsetSize
 
-  def _getIncompatibility(self, nums: list[int], mask: int) -> int:
+  def _getIncompatibility(self, nums: List[int], mask: int) -> int:
     """
     Returns the incompatibility of the selected numbers represented by the
     `mask`.
     """
-    mn = self.MAX_NUM
+    mn = self.kMaxNum
     mx = 0
     for i, num in enumerate(nums):
       if mask >> i & 1:
diff --git a/solutions/1684. Count the Number of Consistent Strings/1684.cpp b/solutions/1684. Count the Number of Consistent Strings/1684.cpp
index e163d2a13da..2c2c1745049 100644
--- a/solutions/1684. Count the Number of Consistent Strings/1684.cpp	
+++ b/solutions/1684. Count the Number of Consistent Strings/1684.cpp	
@@ -2,8 +2,8 @@ class Solution {
  public:
   int countConsistentStrings(string allowed, vector<string>& words) {
     return accumulate(words.begin(), words.end(), 0,
-                      [&allowed](int acc, const string& word) {
-      return acc + ranges::all_of(word, [&allowed](char c) {
+                      [&allowed](int subtotal, const string& word) {
+      return subtotal + ranges::all_of(word, [&allowed](char c) {
         return allowed.find(c) != string::npos;
       });
     });
diff --git a/solutions/1684. Count the Number of Consistent Strings/1684.py b/solutions/1684. Count the Number of Consistent Strings/1684.py
index 8cda2bfb716..aa501c85802 100644
--- a/solutions/1684. Count the Number of Consistent Strings/1684.py	
+++ b/solutions/1684. Count the Number of Consistent Strings/1684.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def countConsistentStrings(self, allowed: str, words: list[str]) -> int:
+  def countConsistentStrings(self, allowed: str, words: List[str]) -> int:
     return sum(all(c in allowed for c in word)
                for word in words)
diff --git a/solutions/1685. Sum of Absolute Differences in a Sorted Array/1685.py b/solutions/1685. Sum of Absolute Differences in a Sorted Array/1685.py
index 8ecd37d5c1c..7a9f8b9128a 100644
--- a/solutions/1685. Sum of Absolute Differences in a Sorted Array/1685.py	
+++ b/solutions/1685. Sum of Absolute Differences in a Sorted Array/1685.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getSumAbsoluteDifferences(self, nums: list[int]) -> list[int]:
+  def getSumAbsoluteDifferences(self, nums: List[int]) -> List[int]:
     prefix = list(itertools.accumulate(nums))
     suffix = list(itertools.accumulate(nums[::-1]))[::-1]
     return [num * (i + 1) - prefix[i] + suffix[i] - num * (len(nums) - i)
diff --git a/solutions/1686. Stone Game VI/1686.cpp b/solutions/1686. Stone Game VI/1686.cpp
index 74411ae8b33..95ce963b4f3 100644
--- a/solutions/1686. Stone Game VI/1686.cpp	
+++ b/solutions/1686. Stone Game VI/1686.cpp	
@@ -9,8 +9,9 @@ class Solution {
     for (int i = 0; i < n; ++i)
       values.push_back({aliceValues[i], bobValues[i]});
 
-    ranges::sort(values, ranges::greater{},
-                 [](const vector<int>& value) { return value[0] + value[1]; });
+    ranges::sort(values, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] + a[1] > b[0] + b[1];
+    });
 
     for (int i = 0; i < n; ++i)
       if (i % 2 == 0)
diff --git a/solutions/1686. Stone Game VI/1686.java b/solutions/1686. Stone Game VI/1686.java
index ffc21a2ec6b..eee6b6092f9 100644
--- a/solutions/1686. Stone Game VI/1686.java	
+++ b/solutions/1686. Stone Game VI/1686.java	
@@ -6,7 +6,7 @@ public int stoneGameVI(int[] aliceValues, int[] bobValues) {
     for (int i = 0; i < n; ++i)
       values[i] = new int[] {aliceValues[i], bobValues[i]};
 
-    Arrays.sort(values, Comparator.comparingInt(value -> - value[0] - value[1]));
+    Arrays.sort(values, (a, b) -> b[0] + b[1] - a[0] - a[1]);
 
     int a = 0;
     int b = 0;
diff --git a/solutions/1687. Delivering Boxes from Storage to Ports/1687.py b/solutions/1687. Delivering Boxes from Storage to Ports/1687.py
index 620ec242827..01db90b493b 100644
--- a/solutions/1687. Delivering Boxes from Storage to Ports/1687.py	
+++ b/solutions/1687. Delivering Boxes from Storage to Ports/1687.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def boxDelivering(
-      self,
-      boxes: list[list[int]],
-      portsCount: int,
-      maxBoxes: int,
-      maxWeight: int,
-  ) -> int:
+  def boxDelivering(self, boxes: List[List[int]], portsCount: int, maxBoxes: int, maxWeight: int) -> int:
     n = len(boxes)
     # dp[i] := the minimum trips to deliver boxes[0..i) and return to the
     # storage
@@ -24,8 +18,7 @@ def boxDelivering(
 
       # Loading boxes[l] in the previous turn is always no bad than loading it
       # in this turn
-      while r - l + 1 > maxBoxes or weight > maxWeight or (
-              l < r and dp[l + 1] == dp[l]):
+      while r - l + 1 > maxBoxes or weight > maxWeight or (l < r and dp[l + 1] == dp[l]):
         weight -= boxes[l][1]
         if boxes[l][0] != boxes[l + 1][0]:
           trips -= 1
diff --git a/solutions/169. Majority Element/169.py b/solutions/169. Majority Element/169.py
index 88793dd0657..8e376e6d31a 100644
--- a/solutions/169. Majority Element/169.py	
+++ b/solutions/169. Majority Element/169.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def majorityElement(self, nums: list[int]) -> int:
+  def majorityElement(self, nums: List[int]) -> int:
     ans = None
     count = 0
 
diff --git a/solutions/1692. Count Ways to Distribute Candies/1692-2.java b/solutions/1692. Count Ways to Distribute Candies/1692-2.java
index e222221c17c..4480507436b 100644
--- a/solutions/1692. Count Ways to Distribute Candies/1692-2.java	
+++ b/solutions/1692. Count Ways to Distribute Candies/1692-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int waysToDistribute(int n, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long[][] dp = new long[k + 1][n + 1];
 
     for (int i = 0; i <= k; ++i)
@@ -8,7 +8,7 @@ public int waysToDistribute(int n, int k) {
 
     for (int i = 1; i <= k; ++i)
       for (int j = i + 1; j <= n; ++j)
-        dp[i][j] = (dp[i - 1][j - 1] + i * dp[i][j - 1]) % MOD;
+        dp[i][j] = (dp[i - 1][j - 1] + i * dp[i][j - 1]) % kMod;
 
     return (int) dp[k][n];
   }
diff --git a/solutions/1692. Count Ways to Distribute Candies/1692.java b/solutions/1692. Count Ways to Distribute Candies/1692.java
index f577f2a568e..03919033150 100644
--- a/solutions/1692. Count Ways to Distribute Candies/1692.java	
+++ b/solutions/1692. Count Ways to Distribute Candies/1692.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int waysToDistribute(int n, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i][j] := the number of ways to distribute i candies to j bags
     // dp[i][j] = 0, if i < j
     //          = 1, if i == j
@@ -13,7 +13,7 @@ public int waysToDistribute(int n, int k) {
 
     for (int i = 1; i <= n; ++i)
       for (int j = 1; j <= k; ++j)
-        dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j] * j) % MOD;
+        dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j] * j) % kMod;
 
     return (int) dp[n][k];
   }
diff --git a/solutions/1695. Maximum Erasure Value/1695.py b/solutions/1695. Maximum Erasure Value/1695.py
index 9d862228451..1cec3da6aac 100644
--- a/solutions/1695. Maximum Erasure Value/1695.py	
+++ b/solutions/1695. Maximum Erasure Value/1695.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumUniqueSubarray(self, nums: list[int]) -> int:
+  def maximumUniqueSubarray(self, nums: List[int]) -> int:
     ans = 0
     score = 0
     seen = set()
diff --git a/solutions/1696. Jump Game VI/1696.java b/solutions/1696. Jump Game VI/1696.java
index c7fc682c2ca..34690df3f71 100644
--- a/solutions/1696. Jump Game VI/1696.java	
+++ b/solutions/1696. Jump Game VI/1696.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int maxResult(int[] nums, int k) {
     // Stores dp[i] within the bounds.
-    Deque<Integer> maxQ = new ArrayDeque<>(List.of(0));
+    Deque<Integer> maxQ = new ArrayDeque<>(Arrays.asList(0));
     // dp[i] := the maximum score to consider nums[0..i]
     int[] dp = new int[nums.length];
     dp[0] = nums[0];
diff --git a/solutions/1696. Jump Game VI/1696.py b/solutions/1696. Jump Game VI/1696.py
index cd48d04e50f..7adfe0f9180 100644
--- a/solutions/1696. Jump Game VI/1696.py	
+++ b/solutions/1696. Jump Game VI/1696.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxResult(self, nums: list[int], k: int) -> int:
+  def maxResult(self, nums: List[int], k: int) -> int:
     # Stores dp[i] within the bounds.
     maxQ = collections.deque([0])
     # dp[i] := the maximum score to consider nums[0..i]
diff --git a/solutions/1697. Checking Existence of Edge Length Limited Paths/1697.cpp b/solutions/1697. Checking Existence of Edge Length Limited Paths/1697.cpp
index ff84e748fda..2a3ebc25e82 100644
--- a/solutions/1697. Checking Existence of Edge Length Limited Paths/1697.cpp	
+++ b/solutions/1697. Checking Existence of Edge Length Limited Paths/1697.cpp	
@@ -38,21 +38,18 @@ class Solution {
     for (int i = 0; i < queries.size(); ++i)
       queries[i].push_back(i);
 
-    ranges::sort(queries, ranges::less{},
-                 [](const vector<int>& query) { return query[2]; });
-    ranges::sort(edgeList, ranges::less{},
-                 [](const vector<int>& edge) { return edge[2]; });
+    ranges::sort(queries,
+                 [](const auto& a, const auto& b) { return a[2] < b[2]; });
+    ranges::sort(edgeList,
+                 [](const auto& a, const auto& b) { return a[2] < b[2]; });
 
     int i = 0;  // i := edgeList's index
     for (const vector<int>& query : queries) {
-      const int p = query[0];
-      const int q = query[1];
-      const int limit = query[2];
-      // Union edges whose distances < limit.
-      while (i < edgeList.size() && edgeList[i][2] < limit)
+      // Union edges whose distances < limit (query[2]).
+      while (i < edgeList.size() && edgeList[i][2] < query[2])
         uf.unionByRank(edgeList[i][0], edgeList[i++][1]);
-      if (uf.find(p) == uf.find(q))
-        ans[query.back()] = true;
+      if (uf.find(query[0]) == uf.find(query[1]))
+        ans[q.back()] = true;
     }
 
     return ans;
diff --git a/solutions/1697. Checking Existence of Edge Length Limited Paths/1697.java b/solutions/1697. Checking Existence of Edge Length Limited Paths/1697.java
index 3404bff0d44..b0f4190b171 100644
--- a/solutions/1697. Checking Existence of Edge Length Limited Paths/1697.java	
+++ b/solutions/1697. Checking Existence of Edge Length Limited Paths/1697.java	
@@ -42,8 +42,8 @@ public boolean[] distanceLimitedPathsExist(int n, int[][] edgeList, int[][] quer
       qs[i][3] = i;
     }
 
-    Arrays.sort(qs, Comparator.comparingInt(q -> q[2]));
-    Arrays.sort(edgeList, Comparator.comparingInt(edge -> edge[2]));
+    Arrays.sort(qs, (a, b) -> a[2] - b[2]);
+    Arrays.sort(edgeList, (a, b) -> a[2] - b[2]);
 
     int i = 0; // i := edgeList's index
     for (int[] q : qs) {
diff --git a/solutions/1698. Number of Distinct Substrings in a String/1698.cpp b/solutions/1698. Number of Distinct Substrings in a String/1698.cpp
index f72dbc152bc..1d86552ce9d 100644
--- a/solutions/1698. Number of Distinct Substrings in a String/1698.cpp	
+++ b/solutions/1698. Number of Distinct Substrings in a String/1698.cpp	
@@ -8,8 +8,8 @@ class Solution {
 
     pow[0] = 1;
     for (int i = 1; i <= n; ++i) {
-      pow[i] = pow[i - 1] * kBase % kHash;
-      hashes[i] = (hashes[i - 1] * kBase + val(s[i - 1])) % kHash;
+      pow[i] = pow[i - 1] * kBase % kMod;
+      hashes[i] = (hashes[i - 1] * kBase + val(s[i - 1])) % kMod;
     }
 
     for (int length = 1; length <= n; ++length) {
@@ -24,16 +24,16 @@ class Solution {
 
  private:
   static constexpr int kBase = 26;
-  static constexpr int kHash = 1'000'000'007;
-
-  static constexpr int val(char c) {
-    return c - 'a';
-  }
+  static constexpr int kMod = 1'000'000'007;
 
   // Returns the hash of s[l..r).
   long getHash(int l, int r, const vector<long>& hashes,
                const vector<long>& pow) {
-    const long hash = (hashes[r] - hashes[l] * pow[r - l]) % kHash;
-    return hash < 0 ? hash + kHash : hash;
+    const long hash = (hashes[r] - hashes[l] * pow[r - l]) % kMod;
+    return hash < 0 ? hash + kMod : hash;
+  }
+
+  constexpr int val(char c) {
+    return c - 'a';
   }
 };
diff --git a/solutions/1698. Number of Distinct Substrings in a String/1698.java b/solutions/1698. Number of Distinct Substrings in a String/1698.java
index 4d3359d1c06..88d4d3ade0f 100644
--- a/solutions/1698. Number of Distinct Substrings in a String/1698.java	
+++ b/solutions/1698. Number of Distinct Substrings in a String/1698.java	
@@ -2,13 +2,13 @@ class Solution {
   public int countDistinct(String s) {
     final int n = s.length();
     int ans = 0;
-    long[] pow = new long[n + 1];    // pow[i] := BASE^i
+    long[] pow = new long[n + 1];    // pow[i] := kBase^i
     long[] hashes = new long[n + 1]; // hashes[i] := the hash of s[0..i)
 
     pow[0] = 1;
     for (int i = 1; i <= n; ++i) {
-      pow[i] = pow[i - 1] * BASE % HASH;
-      hashes[i] = (hashes[i - 1] * BASE + val(s.charAt(i - 1))) % HASH;
+      pow[i] = pow[i - 1] * kBase % kMod;
+      hashes[i] = (hashes[i - 1] * kBase + val(s.charAt(i - 1))) % kMod;
     }
 
     for (int length = 1; length <= n; ++length) {
@@ -21,16 +21,16 @@ public int countDistinct(String s) {
     return ans;
   }
 
-  private static final int BASE = 26;
-  private static final int HASH = 1_000_000_007;
-
-  private static int val(char c) {
-    return c - 'a';
-  }
+  private static final int kBase = 26;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the hash of s[l..r).
   private long getHash(int l, int r, long[] hashes, long[] pow) {
-    final long hash = (hashes[r] - hashes[l] * pow[r - l]) % HASH;
-    return hash < 0 ? hash + HASH : hash;
+    final long hash = (hashes[r] - hashes[l] * pow[r - l]) % kMod;
+    return hash < 0 ? hash + kMod : hash;
+  }
+
+  private int val(char c) {
+    return c - 'a';
   }
 }
diff --git a/solutions/1698. Number of Distinct Substrings in a String/1698.py b/solutions/1698. Number of Distinct Substrings in a String/1698.py
index c979d41efb8..309096d8006 100644
--- a/solutions/1698. Number of Distinct Substrings in a String/1698.py	
+++ b/solutions/1698. Number of Distinct Substrings in a String/1698.py	
@@ -1,24 +1,24 @@
 class Solution:
   def countDistinct(self, s: str) -> int:
-    BASE = 26
-    HASH = 1_000_000_007
+    kBase = 26
+    kMod = 1_000_000_007
 
     n = len(s)
     ans = 0
-    pow = [1] + [0] * n     # pow[i] := BASE^i
+    pow = [1] + [0] * n     # pow[i] := kBase^i
     hashes = [0] * (n + 1)  # hashes[i] := the hash of s[0..i)
 
     def val(c: str) -> int:
       return ord(c) - ord('a')
 
     for i in range(1, n + 1):
-      pow[i] = pow[i - 1] * BASE % HASH
-      hashes[i] = (hashes[i - 1] * BASE + val(s[i - 1])) % HASH
+      pow[i] = pow[i - 1] * kBase % kMod
+      hashes[i] = (hashes[i - 1] * kBase + val(s[i - 1])) % kMod
 
     def getHash(l: int, r: int) -> int:
       """Returns the hash of s[l..r)."""
-      hash = (hashes[r] - hashes[l] * pow[r - l]) % HASH
-      return hash + HASH if hash < 0 else hash
+      hash = (hashes[r] - hashes[l] * pow[r - l]) % kMod
+      return hash + kMod if hash < 0 else hash
 
     for length in range(1, n + 1):
       seen = set()
diff --git a/solutions/17. Letter Combinations of a Phone Number/17-2.cpp b/solutions/17. Letter Combinations of a Phone Number/17-2.cpp
index ffb246e7cd8..eab897d785c 100644
--- a/solutions/17. Letter Combinations of a Phone Number/17-2.cpp	
+++ b/solutions/17. Letter Combinations of a Phone Number/17-2.cpp	
@@ -13,7 +13,7 @@ class Solution {
       for (const string& s : ans)
         for (const char c : digitToLetters[d - '0'])
           temp.push_back(s + c);
-      ans = std::move(temp);
+      ans = move(temp);
     }
 
     return ans;
diff --git a/solutions/17. Letter Combinations of a Phone Number/17-2.py b/solutions/17. Letter Combinations of a Phone Number/17-2.py
index 3afdd97c7ff..7be99e5ab67 100644
--- a/solutions/17. Letter Combinations of a Phone Number/17-2.py	
+++ b/solutions/17. Letter Combinations of a Phone Number/17-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def letterCombinations(self, digits: str) -> list[str]:
+  def letterCombinations(self, digits: str) -> List[str]:
     if not digits:
       return []
 
@@ -10,7 +10,7 @@ def letterCombinations(self, digits: str) -> list[str]:
     for d in digits:
       temp = []
       for s in ans:
-        for c in digitToLetters[int(d)]:
+        for c in digitToLetters[ord(d) - ord('0')]:
           temp.append(s + c)
       ans = temp
 
diff --git a/solutions/17. Letter Combinations of a Phone Number/17.cpp b/solutions/17. Letter Combinations of a Phone Number/17.cpp
index a83e63f493a..54a4cc1f6cd 100644
--- a/solutions/17. Letter Combinations of a Phone Number/17.cpp	
+++ b/solutions/17. Letter Combinations of a Phone Number/17.cpp	
@@ -22,7 +22,7 @@ class Solution {
 
     for (const char letter : digitToLetters[digits[i] - '0']) {
       path.push_back(letter);
-      dfs(digits, i + 1, std::move(path), ans);
+      dfs(digits, i + 1, move(path), ans);
       path.pop_back();
     }
   }
diff --git a/solutions/17. Letter Combinations of a Phone Number/17.py b/solutions/17. Letter Combinations of a Phone Number/17.py
index 0aa91b9aba7..17de30c85ce 100644
--- a/solutions/17. Letter Combinations of a Phone Number/17.py	
+++ b/solutions/17. Letter Combinations of a Phone Number/17.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def letterCombinations(self, digits: str) -> list[str]:
+  def letterCombinations(self, digits: str) -> List[str]:
     if not digits:
       return []
 
@@ -7,12 +7,12 @@ def letterCombinations(self, digits: str) -> list[str]:
                       'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']
     ans = []
 
-    def dfs(i: int, path: list[str]) -> None:
+    def dfs(i: int, path: List[chr]) -> None:
       if i == len(digits):
         ans.append(''.join(path))
         return
 
-      for letter in digitToLetters[int(digits[i])]:
+      for letter in digitToLetters[ord(digits[i]) - ord('0')]:
         path.append(letter)
         dfs(i + 1, path)
         path.pop()
diff --git a/solutions/1700. Number of Students Unable to Eat Lunch/1700.py b/solutions/1700. Number of Students Unable to Eat Lunch/1700.py
index 69927ead13c..41dfb21fb15 100644
--- a/solutions/1700. Number of Students Unable to Eat Lunch/1700.py	
+++ b/solutions/1700. Number of Students Unable to Eat Lunch/1700.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countStudents(self, students: list[int], sandwiches: list[int]) -> int:
+  def countStudents(self, students: List[int], sandwiches: List[int]) -> int:
     count = collections.Counter(students)
 
     for i, sandwich in enumerate(sandwiches):
diff --git a/solutions/1704. Determine if String Halves Are Alike/1704.cpp b/solutions/1704. Determine if String Halves Are Alike/1704.cpp
index c04fda17959..d26a6cc3bee 100644
--- a/solutions/1704. Determine if String Halves Are Alike/1704.cpp	
+++ b/solutions/1704. Determine if String Halves Are Alike/1704.cpp	
@@ -4,9 +4,9 @@ class Solution {
     const string a = s.substr(0, s.length() / 2);
     const string b = s.substr(s.length() / 2);
     const int aVowelsCount =
-        ranges::count_if(a, [this](char c) { return isVowel(c); });
+        ranges::count_if(a, [=](char c) { return isVowel(c); });
     const int bVowelsCount =
-        ranges::count_if(b, [this](char c) { return isVowel(c); });
+        ranges::count_if(b, [=](char c) { return isVowel(c); });
     return aVowelsCount == bVowelsCount;
   }
 
diff --git a/solutions/1704. Determine if String Halves Are Alike/1704.py b/solutions/1704. Determine if String Halves Are Alike/1704.py
index 68fc9d33799..3792659aa8c 100644
--- a/solutions/1704. Determine if String Halves Are Alike/1704.py	
+++ b/solutions/1704. Determine if String Halves Are Alike/1704.py	
@@ -1,6 +1,6 @@
 class Solution:
   def halvesAreAlike(self, s: str) -> bool:
-    VOWELS = 'aeiouAEIOU'
-    aVowelsCount = sum(c in VOWELS for c in s[:len(s) // 2])
-    bVowelsCount = sum(c in VOWELS for c in s[len(s) // 2:])
+    kVowels = 'aeiouAEIOU'
+    aVowelsCount = sum(c in kVowels for c in s[:len(s) // 2])
+    bVowelsCount = sum(c in kVowels for c in s[len(s) // 2:])
     return aVowelsCount == bVowelsCount
diff --git a/solutions/1705. Maximum Number of Eaten Apples/1705.java b/solutions/1705. Maximum Number of Eaten Apples/1705.java
index 86ccaae8671..a3a15e0a4c8 100644
--- a/solutions/1705. Maximum Number of Eaten Apples/1705.java	
+++ b/solutions/1705. Maximum Number of Eaten Apples/1705.java	
@@ -3,8 +3,7 @@ public int eatenApples(int[] apples, int[] days) {
     final int n = apples.length;
     int ans = 0;
     // (the rotten day, the number of apples)
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey));
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>((a, b) -> a.getKey() - b.getKey());
 
     for (int i = 0; i < n || !minHeap.isEmpty(); ++i) {
       // Remove the rotten apples.
diff --git a/solutions/1705. Maximum Number of Eaten Apples/1705.py b/solutions/1705. Maximum Number of Eaten Apples/1705.py
index a5ee1758d3c..5ae100f7bb6 100644
--- a/solutions/1705. Maximum Number of Eaten Apples/1705.py	
+++ b/solutions/1705. Maximum Number of Eaten Apples/1705.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def eatenApples(self, apples: list[int], days: list[int]) -> int:
+  def eatenApples(self, apples: List[int], days: List[int]) -> int:
     n = len(apples)
     ans = 0
     minHeap = []  # (the rotten day, the number of apples)
diff --git a/solutions/1706. Where Will the Ball Fall/1706.cpp b/solutions/1706. Where Will the Ball Fall/1706.cpp
index 90b2fae5628..2e8ad84ca3c 100644
--- a/solutions/1706. Where Will the Ball Fall/1706.cpp	
+++ b/solutions/1706. Where Will the Ball Fall/1706.cpp	
@@ -23,7 +23,7 @@ class Solution {
           continue;
         newDp[j + grid[i][j]] = dp[j];
       }
-      dp = std::move(newDp);
+      dp = move(newDp);
     }
 
     for (int i = 0; i < n; ++i)
diff --git a/solutions/1706. Where Will the Ball Fall/1706.py b/solutions/1706. Where Will the Ball Fall/1706.py
index 044f2127f07..ad9382943cc 100644
--- a/solutions/1706. Where Will the Ball Fall/1706.py	
+++ b/solutions/1706. Where Will the Ball Fall/1706.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findBall(self, grid: list[list[int]]) -> list[int]:
+  def findBall(self, grid: List[List[int]]) -> List[int]:
     m = len(grid)
     n = len(grid[0])
     # dp[i] := status of the i-th column
@@ -14,8 +14,8 @@ def findBall(self, grid: list[list[int]]) -> list[int]:
         # out-of-bounds
         if j + grid[i][j] < 0 or j + grid[i][j] == n:
           continue
-        if (grid[i][j] == 1 and grid[i][j + 1] == -1 or
-                grid[i][j] == -1 and grid[i][j - 1] == 1):
+        if grid[i][j] == 1 and grid[i][j + 1] == -1 or \
+                grid[i][j] == -1 and grid[i][j - 1] == 1:
           continue
         newDp[j + grid[i][j]] = dp[j]
       dp = newDp
diff --git a/solutions/1707. Maximum XOR With an Element From Array/1707.cpp b/solutions/1707. Maximum XOR With an Element From Array/1707.cpp
index 5a10be3c1de..feb63b57d6b 100644
--- a/solutions/1707. Maximum XOR With an Element From Array/1707.cpp	
+++ b/solutions/1707. Maximum XOR With an Element From Array/1707.cpp	
@@ -51,9 +51,10 @@ class Solution {
   vector<int> maximizeXor(vector<int>& nums, vector<vector<int>>& queries) {
     vector<int> ans(queries.size(), -1);
     const int maxNumInNums = ranges::max(nums);
-    const int maxNumInQuery = ranges::max_element(queries, ranges::less{},
-                                                  [](const vector<int>& query) {
-      return query[0];
+    const int maxNumInQuery =
+        ranges::max_element(queries,
+                            [](const vector<int>& a, const vector<int>& b) {
+      return a[0] < b[0];
     })->at(0);
     const int maxBit = static_cast<int>(log2(max(maxNumInNums, maxNumInQuery)));
     BitTrie bitTrie(maxBit);
@@ -75,10 +76,10 @@ class Solution {
   vector<IndexedQuery> getIndexedQueries(const vector<vector<int>>& queries) {
     vector<IndexedQuery> indexedQueries;
     for (int i = 0; i < queries.size(); ++i)
-      indexedQueries.emplace_back(i, queries[i][0], queries[i][1]);
+      indexedQueries.push_back({i, queries[i][0], queries[i][1]});
     ranges::sort(
-        indexedQueries, ranges::less{},
-        [](const IndexedQuery& indexedQuery) { return indexedQuery.m; });
+        indexedQueries,
+        [](const IndexedQuery& a, const IndexedQuery& b) { return a.m < b.m; });
     return indexedQueries;
   }
 };
diff --git a/solutions/1707. Maximum XOR With an Element From Array/1707.java b/solutions/1707. Maximum XOR With an Element From Array/1707.java
index 6ba94d552a9..d049dc37b97 100644
--- a/solutions/1707. Maximum XOR With an Element From Array/1707.java	
+++ b/solutions/1707. Maximum XOR With an Element From Array/1707.java	
@@ -70,7 +70,7 @@ private IndexedQuery[] getIndexedQueries(int[][] queries) {
     IndexedQuery[] indexedQueries = new IndexedQuery[queries.length];
     for (int i = 0; i < queries.length; ++i)
       indexedQueries[i] = new IndexedQuery(i, queries[i][0], queries[i][1]);
-    Arrays.sort(indexedQueries, Comparator.comparingInt(IndexedQuery::m));
+    Arrays.sort(indexedQueries, (a, b) -> a.m - b.m);
     return indexedQueries;
   }
 }
diff --git a/solutions/1707. Maximum XOR With an Element From Array/1707.py b/solutions/1707. Maximum XOR With an Element From Array/1707.py
index dc6fc664e1c..c2b825ea574 100644
--- a/solutions/1707. Maximum XOR With an Element From Array/1707.py	
+++ b/solutions/1707. Maximum XOR With an Element From Array/1707.py	
@@ -1,9 +1,6 @@
-from dataclasses import dataclass
-
-
 class TrieNode:
   def __init__(self):
-    self.children: list[TrieNode | None] = [None] * 2
+    self.children: List[Optional[TrieNode]] = [None] * 2
 
 
 class BitTrie:
@@ -35,11 +32,11 @@ def getMaxXor(self, num: int) -> int:
     return maxXor
 
 
-@dataclass(frozen=True)
 class IndexedQuery:
-  queryIndex: int
-  x: int
-  m: int
+  def __init__(self, queryIndex: int, x: int, m: int):
+    self.queryIndex = queryIndex
+    self.x = x
+    self.m = m
 
   def __iter__(self):
     yield self.queryIndex
@@ -48,7 +45,7 @@ def __iter__(self):
 
 
 class Solution:
-  def maximizeXor(self, nums: list[int], queries: list[list[int]]) -> list[int]:
+  def maximizeXor(self, nums: List[int], queries: List[List[int]]) -> List[int]:
     ans = [-1] * len(queries)
     maxBit = int(math.log2(max(max(nums), max(x for x, _ in queries))))
     bitTrie = BitTrie(maxBit)
@@ -58,7 +55,7 @@ def maximizeXor(self, nums: list[int], queries: list[list[int]]) -> list[int]:
     i = 0  # nums' index
     for queryIndex, x, m in sorted([IndexedQuery(i, x, m)
                                     for i, (x, m) in enumerate(queries)],
-                                   key=lambda x: x.m):
+                                   key=lambda iq: iq.m):
       while i < len(nums) and nums[i] <= m:
         bitTrie.insert(nums[i])
         i += 1
diff --git a/solutions/1708. Largest Subarray Length K/1708.py b/solutions/1708. Largest Subarray Length K/1708.py
index 50a2c2e5bde..e3053cb49fa 100644
--- a/solutions/1708. Largest Subarray Length K/1708.py	
+++ b/solutions/1708. Largest Subarray Length K/1708.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestSubarray(self, nums: list[int], k: int) -> list[int]:
+  def largestSubarray(self, nums: List[int], k: int) -> List[int]:
     mx = max(nums[:len(nums) - k + 1])
     i = nums.index(mx)
     return nums[i:i + k]
diff --git a/solutions/171. Excel Sheet Column Number/171.cpp b/solutions/171. Excel Sheet Column Number/171.cpp
index 7f89e26bdce..283117b6166 100644
--- a/solutions/171. Excel Sheet Column Number/171.cpp	
+++ b/solutions/171. Excel Sheet Column Number/171.cpp	
@@ -1,7 +1,8 @@
 class Solution {
  public:
   int titleToNumber(string columnTitle) {
-    return accumulate(columnTitle.begin(), columnTitle.end(), 0,
-                      [](int acc, char c) { return acc * 26 + (c - 'A' + 1); });
+    return accumulate(
+        columnTitle.begin(), columnTitle.end(), 0,
+        [](int subtotal, char c) { return subtotal * 26 + (c - 'A' + 1); });
   }
 };
diff --git a/solutions/1710. Maximum Units on a Truck/1710.cpp b/solutions/1710. Maximum Units on a Truck/1710.cpp
index 403a53d0b05..4615a926990 100644
--- a/solutions/1710. Maximum Units on a Truck/1710.cpp	
+++ b/solutions/1710. Maximum Units on a Truck/1710.cpp	
@@ -3,8 +3,9 @@ class Solution {
   int maximumUnits(vector<vector<int>>& boxTypes, int truckSize) {
     int ans = 0;
 
-    ranges::sort(boxTypes, ranges::greater{},
-                 [](const vector<int>& boxType) { return boxType[1]; });
+    ranges::sort(boxTypes, [](const vector<int>& a, const vector<int>& b) {
+      return b[1] < a[1];
+    });
 
     for (const vector<int>& boxType : boxTypes) {
       const int boxes = boxType[0];
diff --git a/solutions/1710. Maximum Units on a Truck/1710.java b/solutions/1710. Maximum Units on a Truck/1710.java
index f5549a0ad73..ea573311264 100644
--- a/solutions/1710. Maximum Units on a Truck/1710.java	
+++ b/solutions/1710. Maximum Units on a Truck/1710.java	
@@ -2,7 +2,7 @@ class Solution {
   public int maximumUnits(int[][] boxTypes, int truckSize) {
     int ans = 0;
 
-    Arrays.sort(boxTypes, Comparator.comparingInt(boxType -> - boxType[1]));
+    Arrays.sort(boxTypes, (a, b) -> Integer.compare(b[1], a[1]));
 
     for (int[] boxType : boxTypes) {
       final int boxes = boxType[0];
diff --git a/solutions/1710. Maximum Units on a Truck/1710.py b/solutions/1710. Maximum Units on a Truck/1710.py
index 4b68c33b973..4fbb2fd924f 100644
--- a/solutions/1710. Maximum Units on a Truck/1710.py	
+++ b/solutions/1710. Maximum Units on a Truck/1710.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumUnits(self, boxTypes: list[list[int]], truckSize: int) -> int:
+  def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int:
     ans = 0
 
     for boxes, units in sorted(boxTypes, key=lambda x: -x[1]):
diff --git a/solutions/1711. Count Good Meals/1711.java b/solutions/1711. Count Good Meals/1711.java
index 52b4c3140d7..b96274c813b 100644
--- a/solutions/1711. Count Good Meals/1711.java	
+++ b/solutions/1711. Count Good Meals/1711.java	
@@ -1,15 +1,15 @@
 class Solution {
   public int countPairs(int[] deliciousness) {
-    final int MOD = 1_000_000_007;
-    final int MAX_BIT = 20 + 1;
-    final int MAX_POWER = (int) Math.pow(2, MAX_BIT);
+    final int kMod = 1_000_000_007;
+    final int kMaxBit = 20 + 1;
+    final int kMaxPower = (int) Math.pow(2, kMaxBit);
     int ans = 0;
     Map<Integer, Integer> count = new HashMap<>();
 
     for (final int d : deliciousness) {
-      for (int power = 1; power <= MAX_POWER; power *= 2) {
+      for (int power = 1; power <= kMaxPower; power *= 2) {
         ans += count.getOrDefault(power - d, 0);
-        ans %= MOD;
+        ans %= kMod;
       }
       count.merge(d, 1, Integer::sum);
     }
diff --git a/solutions/1711. Count Good Meals/1711.py b/solutions/1711. Count Good Meals/1711.py
index 13ce494675a..7a6e2866f2b 100644
--- a/solutions/1711. Count Good Meals/1711.py	
+++ b/solutions/1711. Count Good Meals/1711.py	
@@ -1,15 +1,15 @@
 class Solution:
-  def countPairs(self, deliciousness: list[int]) -> int:
-    MOD = 10**9 + 7
-    MAX_BIT = 20 + 1
+  def countPairs(self, deliciousness: List[int]) -> int:
+    kMod = 10**9 + 7
+    kMaxBit = 20 + 1
     ans = 0
     count = collections.Counter()
 
     for d in deliciousness:
-      for i in range(MAX_BIT + 1):
+      for i in range(kMaxBit + 1):
         power = 1 << i
         ans += count[power - d]
-        ans %= MOD
+        ans %= kMod
       count[d] += 1
 
     return ans
diff --git a/solutions/1712. Ways to Split Array Into Three Subarrays/1712-2.java b/solutions/1712. Ways to Split Array Into Three Subarrays/1712-2.java
index 8d3cb1eed56..3bf10208e54 100644
--- a/solutions/1712. Ways to Split Array Into Three Subarrays/1712-2.java	
+++ b/solutions/1712. Ways to Split Array Into Three Subarrays/1712-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int waysToSplit(int[] nums) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = nums.length;
     int ans = 0;
     int[] prefix = nums.clone();
@@ -20,7 +20,7 @@ public int waysToSplit(int[] nums) {
       while (k < n - 1 && prefix[k] - prefix[i] <= prefix[prefix.length - 1] - prefix[k])
         ++k;
       ans += k - j;
-      ans %= MOD;
+      ans %= kMod;
     }
 
     return ans;
diff --git a/solutions/1712. Ways to Split Array Into Three Subarrays/1712-2.py b/solutions/1712. Ways to Split Array Into Three Subarrays/1712-2.py
index 9f4a1a7b40f..d316d38b306 100644
--- a/solutions/1712. Ways to Split Array Into Three Subarrays/1712-2.py	
+++ b/solutions/1712. Ways to Split Array Into Three Subarrays/1712-2.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def waysToSplit(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
+  def waysToSplit(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
     n = len(nums)
     ans = 0
     prefix = list(itertools.accumulate(nums))
@@ -19,6 +19,6 @@ def waysToSplit(self, nums: list[int]) -> int:
       while k < n - 1 and prefix[k] - prefix[i] <= prefix[-1] - prefix[k]:
         k += 1
       ans += k - j
-      ans %= MOD
+      ans %= kMod
 
     return ans
diff --git a/solutions/1712. Ways to Split Array Into Three Subarrays/1712.java b/solutions/1712. Ways to Split Array Into Three Subarrays/1712.java
index 6faf005f5ff..3d2b84bb661 100644
--- a/solutions/1712. Ways to Split Array Into Three Subarrays/1712.java	
+++ b/solutions/1712. Ways to Split Array Into Three Subarrays/1712.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int waysToSplit(int[] nums) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = nums.length;
     int ans = 0;
     int[] prefix = nums.clone();
@@ -17,7 +17,7 @@ public int waysToSplit(int[] nums) {
       if (mid > right)
         continue;
       final int k = firstGreater(prefix, i);
-      ans = (ans + k - j) % MOD;
+      ans = (ans + k - j) % kMod;
     }
 
     return ans;
diff --git a/solutions/1712. Ways to Split Array Into Three Subarrays/1712.py b/solutions/1712. Ways to Split Array Into Three Subarrays/1712.py
index e23f97d45d0..9ff31fc9a21 100644
--- a/solutions/1712. Ways to Split Array Into Three Subarrays/1712.py	
+++ b/solutions/1712. Ways to Split Array Into Three Subarrays/1712.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def waysToSplit(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
+  def waysToSplit(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
     n = len(nums)
     ans = 0
     prefix = list(itertools.accumulate(nums))
@@ -42,6 +42,6 @@ def firstGreater(i: int) -> int:
       if mid > right:
         continue
       k = firstGreater(i)
-      ans = (ans + k - j) % MOD
+      ans = (ans + k - j) % kMod
 
     return ans
diff --git a/solutions/1713. Minimum Operations to Make a Subsequence/1713.cpp b/solutions/1713. Minimum Operations to Make a Subsequence/1713.cpp
index 15b92dd34ae..112926a1c23 100644
--- a/solutions/1713. Minimum Operations to Make a Subsequence/1713.cpp	
+++ b/solutions/1713. Minimum Operations to Make a Subsequence/1713.cpp	
@@ -17,19 +17,19 @@ class Solution {
  private:
   // Same as 300. Longest Increasing Subsequence
   int lengthOfLIS(vector<int>& nums) {
-    // tails[i] := the minimum tail of all the increasing subsequences having
+    // tail[i] := the minimum tail of all the increasing subsequences having
     // length i + 1
-    vector<int> tails;
+    vector<int> tail;
     for (const int num : nums)
-      if (tails.empty() || num > tails.back())
-        tails.push_back(num);
+      if (tail.empty() || num > tail.back())
+        tail.push_back(num);
       else
-        tails[firstGreaterEqual(tails, num)] = num;
-    return tails.size();
+        tail[firstGreaterEqual(tail, num)] = num;
+    return tail.size();
   }
 
  private:
-  int firstGreaterEqual(const vector<int>& arr, int target) {
-    return ranges::lower_bound(arr, target) - arr.begin();
+  int firstGreaterEqual(const vector<int>& A, int target) {
+    return ranges::lower_bound(A, target) - A.begin();
   }
 };
diff --git a/solutions/1713. Minimum Operations to Make a Subsequence/1713.java b/solutions/1713. Minimum Operations to Make a Subsequence/1713.java
index 974b24b703c..df4ebe066ca 100644
--- a/solutions/1713. Minimum Operations to Make a Subsequence/1713.java	
+++ b/solutions/1713. Minimum Operations to Make a Subsequence/1713.java	
@@ -15,19 +15,19 @@ public int minOperations(int[] target, int[] arr) {
 
   // Same as 300. Longest Increasing Subsequence
   private int lengthOfLIS(List<Integer> nums) {
-    // tails[i] := the minimum tail of all the increasing subsequences with
+    // tail[i] := the minimum tail of all the increasing subsequences with
     // length i + 1
-    List<Integer> tails = new ArrayList<>();
+    List<Integer> tail = new ArrayList<>();
     for (final int num : nums)
-      if (tails.isEmpty() || num > tails.get(tails.size() - 1))
-        tails.add(num);
+      if (tail.isEmpty() || num > tail.get(tail.size() - 1))
+        tail.add(num);
       else
-        tails.set(firstGreaterEqual(tails, num), num);
-    return tails.size();
+        tail.set(firstGreaterEqual(tail, num), num);
+    return tail.size();
   }
 
-  private int firstGreaterEqual(List<Integer> arr, int target) {
-    final int i = Collections.binarySearch(arr, target);
+  private int firstGreaterEqual(List<Integer> A, int target) {
+    final int i = Collections.binarySearch(A, target);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/1713. Minimum Operations to Make a Subsequence/1713.py b/solutions/1713. Minimum Operations to Make a Subsequence/1713.py
index 47961fff703..a542a41968f 100644
--- a/solutions/1713. Minimum Operations to Make a Subsequence/1713.py	
+++ b/solutions/1713. Minimum Operations to Make a Subsequence/1713.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, target: list[int], arr: list[int]) -> int:
+  def minOperations(self, target: List[int], arr: List[int]) -> int:
     indices = []
     numToIndex = {num: i for i, num in enumerate(target)}
 
@@ -10,13 +10,13 @@ def minOperations(self, target: list[int], arr: list[int]) -> int:
     return len(target) - self._lengthOfLIS(indices)
 
   # Same as 300. Longest Increasing Subsequence
-  def _lengthOfLIS(self, nums: list[int]) -> int:
-    # tails[i] := the minimum tail of all the increasing subsequences having
+  def _lengthOfLIS(self, nums: List[int]) -> int:
+    # tail[i] := the minimum tail of all the increasing subsequences having
     # length i + 1
-    tails = []
+    tail = []
     for num in nums:
-      if not tails or num > tails[-1]:
-        tails.append(num)
+      if not tail or num > tail[-1]:
+        tail.append(num)
       else:
-        tails[bisect.bisect_left(tails, num)] = num
-    return len(tails)
+        tail[bisect.bisect_left(tail, num)] = num
+    return len(tail)
diff --git a/solutions/1714. Sum Of Special Evenly-Spaced Elements In Array/1714.java b/solutions/1714. Sum Of Special Evenly-Spaced Elements In Array/1714.java
index a2b840846e4..b5f9d386dfb 100644
--- a/solutions/1714. Sum Of Special Evenly-Spaced Elements In Array/1714.java	
+++ b/solutions/1714. Sum Of Special Evenly-Spaced Elements In Array/1714.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int[] solve(int[] nums, int[][] queries) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = nums.length;
     final int sqrtN = (int) Math.sqrt(n);
     int[] ans = new int[queries.length];
@@ -16,7 +16,7 @@ public int[] solve(int[] nums, int[][] queries) {
       for (int y = 1; y < sqrtN; ++y)
         if (x + y < n) {
           prefix[x][y] += prefix[x + y][y];
-          prefix[x][y] %= MOD;
+          prefix[x][y] %= kMod;
         }
 
     for (int i = 0; i < queries.length; ++i) {
@@ -27,7 +27,7 @@ public int[] solve(int[] nums, int[][] queries) {
       } else {
         int sum = 0;
         for (int j = x; j < n; j += y)
-          sum = (sum + nums[j]) % MOD;
+          sum = (sum + nums[j]) % kMod;
         ans[i] = sum;
       }
     }
diff --git a/solutions/1714. Sum Of Special Evenly-Spaced Elements In Array/1714.py b/solutions/1714. Sum Of Special Evenly-Spaced Elements In Array/1714.py
index 6bd97ec6410..127991b9f97 100644
--- a/solutions/1714. Sum Of Special Evenly-Spaced Elements In Array/1714.py	
+++ b/solutions/1714. Sum Of Special Evenly-Spaced Elements In Array/1714.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def solve(self, nums: list[int], queries: list[list[int]]) -> list[int]:
-    MOD = 10**9 + 7
+  def solve(self, nums: List[int], queries: List[List[int]]) -> List[int]:
+    kMod = 10**9 + 7
     n = len(nums)
     sqrtN = int(n**0.5)
     # prefix[x][y] = sum(nums[x + ay]), where a >= 0 and x + ay < n
@@ -11,8 +11,8 @@ def solve(self, nums: list[int], queries: list[list[int]]) -> list[int]:
       for y in range(1, sqrtN):
         if x + y < n:
           prefix[x][y] += prefix[x + y][y]
-          prefix[x][y] %= MOD
+          prefix[x][y] %= kMod
 
     return [prefix[x][y] if y < sqrtN
-            else sum(nums[x::y]) % MOD
+            else sum(nums[x::y]) % kMod
             for x, y in queries]
diff --git a/solutions/1717. Maximum Score From Removing Substrings/1717.py b/solutions/1717. Maximum Score From Removing Substrings/1717.py
index 59cb07eeff9..3fb3adfafc6 100644
--- a/solutions/1717. Maximum Score From Removing Substrings/1717.py	
+++ b/solutions/1717. Maximum Score From Removing Substrings/1717.py	
@@ -5,8 +5,8 @@ def maximumGain(self, s: str, x: int, y: int) -> int:
     # preventing two 'ba' removals, but after removing 'ab', we can still
     # remove one 'ba', resulting in a higher gain. Thus, removing 'ba' first is
     # not optimal.
-    return (self._gain(s, 'ab', x, 'ba', y) if x > y else
-            self._gain(s, 'ba', y, 'ab', x))
+    return self._gain(s, 'ab', x, 'ba', y) if x > y \
+        else self._gain(s, 'ba', y, 'ab', x)
 
   # Returns the points gained by first removing sub1 ('ab' | 'ba') from s with
   # point1, then removing sub2 ('ab' | 'ba') from s with point2.
diff --git a/solutions/1718. Construct the Lexicographically Largest Valid Sequence/1718.py b/solutions/1718. Construct the Lexicographically Largest Valid Sequence/1718.py
index 11a1567dc5c..4ada4e8b38e 100644
--- a/solutions/1718. Construct the Lexicographically Largest Valid Sequence/1718.py	
+++ b/solutions/1718. Construct the Lexicographically Largest Valid Sequence/1718.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def constructDistancedSequence(self, n: int) -> list[int]:
+  def constructDistancedSequence(self, n: int) -> List[int]:
     ans = [0] * (2 * n - 1)
 
     def dfs(i: int, mask: int) -> bool:
diff --git a/solutions/1719. Number Of Ways To Reconstruct A Tree/1719.cpp b/solutions/1719. Number Of Ways To Reconstruct A Tree/1719.cpp
index a2f21878b1f..954b3e5e0ec 100644
--- a/solutions/1719. Number Of Ways To Reconstruct A Tree/1719.cpp	
+++ b/solutions/1719. Number Of Ways To Reconstruct A Tree/1719.cpp	
@@ -19,8 +19,9 @@ class Solution {
 
     // For each node, sort its children by degrees in descending order.
     for (auto& [_, children] : graph)
-      ranges::sort(children, ranges::greater{},
-                   [&degrees](int child) { return degrees[child]; });
+      ranges::sort(children, [&degrees](int a, int b) {
+        return degrees[b] < degrees[a];
+      });
 
     const int root = getRoot(degrees, graph.size());
     if (root == -1)
@@ -59,8 +60,7 @@ class Solution {
       // We can swap u with v, so there are more than one way.
       if (degrees[v] == degrees[u])
         hasMoreThanOneWay = true;
-      if (!dfs(graph, v, degrees, connected, std::move(ancestors),
-               std::move(seen)))
+      if (!dfs(graph, v, degrees, connected, move(ancestors), move(seen)))
         return false;
     }
 
diff --git a/solutions/1719. Number Of Ways To Reconstruct A Tree/1719.java b/solutions/1719. Number Of Ways To Reconstruct A Tree/1719.java
index a55727fd223..b6fce365dad 100644
--- a/solutions/1719. Number Of Ways To Reconstruct A Tree/1719.java	
+++ b/solutions/1719. Number Of Ways To Reconstruct A Tree/1719.java	
@@ -1,9 +1,9 @@
 class Solution {
   public int checkWays(int[][] pairs) {
-    final int MAX = 501;
+    final int kMax = 501;
     Map<Integer, List<Integer>> graph = new HashMap<>();
-    int[] degrees = new int[MAX];
-    boolean[][] connected = new boolean[MAX][MAX];
+    int[] degrees = new int[kMax];
+    boolean[][] connected = new boolean[kMax][kMax];
 
     for (int[] pair : pairs) {
       final int u = pair[0];
@@ -20,12 +20,12 @@ public int checkWays(int[][] pairs) {
 
     // For each node, sort its children by degrees in descending order.
     for (final int u : graph.keySet())
-      graph.get(u).sort(Comparator.comparingInt(a -> - degrees[a]));
+      graph.get(u).sort((a, b) -> Integer.compare(degrees[b], degrees[a]));
 
     final int root = getRoot(degrees, graph.keySet().size());
     if (root == -1)
       return 0;
-    if (!dfs(graph, root, degrees, connected, new ArrayList<>(), new boolean[MAX]))
+    if (!dfs(graph, root, degrees, connected, new ArrayList<>(), new boolean[kMax]))
       return 0;
     return hasMoreThanOneWay ? 2 : 1;
   }
diff --git a/solutions/1719. Number Of Ways To Reconstruct A Tree/1719.py b/solutions/1719. Number Of Ways To Reconstruct A Tree/1719.py
index f8e2a0bb5ab..7e9f7a41429 100644
--- a/solutions/1719. Number Of Ways To Reconstruct A Tree/1719.py	
+++ b/solutions/1719. Number Of Ways To Reconstruct A Tree/1719.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def checkWays(self, pairs: list[list[int]]) -> int:
-    MAX = 501
+  def checkWays(self, pairs: List[List[int]]) -> int:
+    kMax = 501
     graph = collections.defaultdict(list)
-    degrees = [0] * MAX
-    connected = [[False] * MAX for _ in range(MAX)]
+    degrees = [0] * kMax
+    connected = [[False] * kMax for _ in range(kMax)]
 
     for u, v in pairs:
       graph[u].append(v)
@@ -15,7 +15,7 @@ def checkWays(self, pairs: list[list[int]]) -> int:
 
     # For each node, sort its children by degrees in descending order.
     for _, children in graph.items():
-      children.sort(key=lambda x: -degrees[x])
+      children.sort(key=lambda a: degrees[a], reverse=True)
 
     # Find the root with a degree that equals to n - 1.
     root = next((i for i, d in enumerate(degrees) if d == len(graph) - 1), -1)
@@ -24,7 +24,7 @@ def checkWays(self, pairs: list[list[int]]) -> int:
 
     hasMoreThanOneWay = False
 
-    def dfs(u: int, ancestors: list[int], seen: list[bool]) -> bool:
+    def dfs(u: int, ancestors: List[int], seen: List[bool]) -> bool:
       """
       Returns True if each node rooted at u is connected to all of its
       ancestors.
@@ -45,6 +45,6 @@ def dfs(u: int, ancestors: list[int], seen: list[bool]) -> bool:
       ancestors.pop()
       return True
 
-    if not dfs(root, [], [False] * MAX):
+    if not dfs(root, [], [False] * kMax):
       return 0
     return 2 if hasMoreThanOneWay else 1
diff --git a/solutions/1720. Decode XORed Array/1720.py b/solutions/1720. Decode XORed Array/1720.py
index 0d6f1bc14e4..48081dc9039 100644
--- a/solutions/1720. Decode XORed Array/1720.py	
+++ b/solutions/1720. Decode XORed Array/1720.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def decode(self, encoded: list[int], first: int) -> list[int]:
+  def decode(self, encoded: List[int], first: int) -> List[int]:
     ans = [first]
 
     for e in encoded:
diff --git a/solutions/1721. Swapping Nodes in a Linked List/1721.py b/solutions/1721. Swapping Nodes in a Linked List/1721.py
index 80b361e3d46..13fdc07f95f 100644
--- a/solutions/1721. Swapping Nodes in a Linked List/1721.py	
+++ b/solutions/1721. Swapping Nodes in a Linked List/1721.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def swapNodes(self, head: ListNode | None, k: int) -> ListNode | None:
+  def swapNodes(self, head: Optional[ListNode], k: int) -> Optional[ListNode]:
     p = None  # Points the k-th node from the beginning.
     q = None  # Points the k-th node from the end.
 
diff --git a/solutions/1722. Minimize Hamming Distance After Swap Operations/1722.py b/solutions/1722. Minimize Hamming Distance After Swap Operations/1722.py
index cf2d027fb96..006094d8f09 100644
--- a/solutions/1722. Minimize Hamming Distance After Swap Operations/1722.py	
+++ b/solutions/1722. Minimize Hamming Distance After Swap Operations/1722.py	
@@ -23,12 +23,7 @@ def find(self, u: int) -> int:
 
 
 class Solution:
-  def minimumHammingDistance(
-      self,
-      source: list[int],
-      target: list[int],
-      allowedSwaps: list[list[int]],
-  ) -> int:
+  def minimumHammingDistance(self, source: List[int], target: List[int], allowedSwaps: List[List[int]]) -> int:
     n = len(source)
     ans = 0
     uf = UnionFind(n)
diff --git a/solutions/1723. Find Minimum Time to Finish All Jobs/1723.py b/solutions/1723. Find Minimum Time to Finish All Jobs/1723.py
index a88f06af577..3be14d1446a 100644
--- a/solutions/1723. Find Minimum Time to Finish All Jobs/1723.py	
+++ b/solutions/1723. Find Minimum Time to Finish All Jobs/1723.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumTimeRequired(self, jobs: list[int], k: int) -> int:
+  def minimumTimeRequired(self, jobs: List[int], k: int) -> int:
     ans = sum(jobs)
     times = [0] * k  # times[i] := accumulate time of workers[i]
 
diff --git a/solutions/1724. Checking Existence of Edge Length Limited Paths II/1724.cpp b/solutions/1724. Checking Existence of Edge Length Limited Paths II/1724.cpp
index 0325846cb6f..d7c42cafde0 100644
--- a/solutions/1724. Checking Existence of Edge Length Limited Paths II/1724.cpp	
+++ b/solutions/1724. Checking Existence of Edge Length Limited Paths II/1724.cpp	
@@ -38,8 +38,8 @@ class DistanceLimitedPathsExist {
   DistanceLimitedPathsExist(int n, vector<vector<int>>& edgeList) {
     uf = UnionFind(n);
 
-    ranges::sort(edgeList, ranges::less{},
-                 [](const vector<int>& edge) { return edge[2]; });
+    ranges::sort(edgeList,
+                 [](const auto& a, const auto& b) { return a[2] < b[2]; });
 
     for (const vector<int>& edge : edgeList) {
       const int u = edge[0];
diff --git a/solutions/1724. Checking Existence of Edge Length Limited Paths II/1724.java b/solutions/1724. Checking Existence of Edge Length Limited Paths II/1724.java
index ce76cf24dcb..d164c7475bc 100644
--- a/solutions/1724. Checking Existence of Edge Length Limited Paths II/1724.java	
+++ b/solutions/1724. Checking Existence of Edge Length Limited Paths II/1724.java	
@@ -35,7 +35,7 @@ class DistanceLimitedPathsExist {
   public DistanceLimitedPathsExist(int n, int[][] edgeList) {
     uf = new UnionFind(n);
 
-    Arrays.sort(edgeList, Comparator.comparingInt(edge -> edge[2]));
+    Arrays.sort(edgeList, (a, b) -> a[2] - b[2]);
 
     for (int[] edge : edgeList) {
       final int u = edge[0];
diff --git a/solutions/1725. Number Of Rectangles That Can Form The Largest Square/1725.py b/solutions/1725. Number Of Rectangles That Can Form The Largest Square/1725.py
index bfe99838c76..976610d676e 100644
--- a/solutions/1725. Number Of Rectangles That Can Form The Largest Square/1725.py	
+++ b/solutions/1725. Number Of Rectangles That Can Form The Largest Square/1725.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def countGoodRectangles(self, rectangles: list[list[int]]) -> int:
+  def countGoodRectangles(self, rectangles: List[List[int]]) -> int:
     minSides = [min(x, y) for x, y in rectangles]
     return minSides.count(max(minSides))
diff --git a/solutions/1726. Tuple with Same Product/1726.py b/solutions/1726. Tuple with Same Product/1726.py
index 482d0029bbc..22745e1fb4f 100644
--- a/solutions/1726. Tuple with Same Product/1726.py	
+++ b/solutions/1726. Tuple with Same Product/1726.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def tupleSameProduct(self, nums: list[int]) -> int:
+  def tupleSameProduct(self, nums: List[int]) -> int:
     # nums of ways to arrange (a, b) = 2
     # nums of ways to arrange (c, d) = 2
     # nums of ways to arrange (a, b), (c, d) = 2^3 = 8
diff --git a/solutions/1727. Largest Submatrix With Rearrangements/1727.py b/solutions/1727. Largest Submatrix With Rearrangements/1727.py
index 34a3c38347d..7df8f087a14 100644
--- a/solutions/1727. Largest Submatrix With Rearrangements/1727.py	
+++ b/solutions/1727. Largest Submatrix With Rearrangements/1727.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestSubmatrix(self, matrix: list[list[int]]) -> int:
+  def largestSubmatrix(self, matrix: List[List[int]]) -> int:
     ans = 0
     hist = [0] * len(matrix[0])
 
diff --git a/solutions/1728. Cat and Mouse II/1728.cpp b/solutions/1728. Cat and Mouse II/1728.cpp
index e3bdd0d25fc..867db4fd98e 100644
--- a/solutions/1728. Cat and Mouse II/1728.cpp	
+++ b/solutions/1728. Cat and Mouse II/1728.cpp	
@@ -24,7 +24,7 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   // Returns true if the mouse can win, where the cat is on (i / 8, i % 8), the
   // mouse is on (j / 8, j % 8), and the turns is k.
@@ -42,7 +42,7 @@ class Solution {
       // the mouse's turn
       const int i = mouse / n;
       const int j = mouse % n;
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         for (int jump = 0; jump <= mouseJump; ++jump) {
           const int x = i + dx * jump;
           const int y = j + dy * jump;
@@ -64,7 +64,7 @@ class Solution {
       // the cat's turn
       const int i = cat / n;
       const int j = cat % n;
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         for (int jump = 0; jump <= catJump; ++jump) {
           const int x = i + dx * jump;
           const int y = j + dy * jump;
diff --git a/solutions/1728. Cat and Mouse II/1728.java b/solutions/1728. Cat and Mouse II/1728.java
index effaa1a2858..d79bc5c9b48 100644
--- a/solutions/1728. Cat and Mouse II/1728.java	
+++ b/solutions/1728. Cat and Mouse II/1728.java	
@@ -20,7 +20,7 @@ else if (grid[i].charAt(j) == 'M')
     return canMouseWin(grid, cat, mouse, 0, catJump, mouseJump, m, n, nFloors, mem);
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   // Returns true if the mouse can win, where the cat is on (i / 8, i % 8), the
   // mouse is on (j / 8, j % 8), and the turns is k.
@@ -36,7 +36,7 @@ private boolean canMouseWin(String[] grid, int cat, int mouse, int turn, int cat
       // the mouse's turn
       int i = mouse / n;
       int j = mouse % n;
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         for (int jump = 0; jump <= mouseJump; ++jump) {
           int x = i + dir[0] * jump;
           int y = j + dir[1] * jump;
@@ -58,7 +58,7 @@ private boolean canMouseWin(String[] grid, int cat, int mouse, int turn, int cat
       // the cat's turn
       final int i = cat / n;
       final int j = cat % n;
-      for (int[] dir : DIRS)
+      for (int[] dir : dirs)
         for (int jump = 0; jump <= catJump; ++jump) {
           final int x = i + dir[0] * jump;
           final int y = j + dir[1] * jump;
diff --git a/solutions/1728. Cat and Mouse II/1728.py b/solutions/1728. Cat and Mouse II/1728.py
index b566215ffdf..2cb2ae85286 100644
--- a/solutions/1728. Cat and Mouse II/1728.py	
+++ b/solutions/1728. Cat and Mouse II/1728.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def canMouseWin(self, grid: list[str], catJump: int, mouseJump: int) -> bool:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def canMouseWin(self, grid: List[str], catJump: int, mouseJump: int) -> bool:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
     nFloors = 0
@@ -33,7 +33,7 @@ def dp(cat: int, mouse: int, turn: int) -> bool:
         # the mouse's turn
         i = mouse // n
         j = mouse % n
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           for jump in range(mouseJump + 1):
             x = i + dx * jump
             y = j + dy * jump
@@ -52,7 +52,7 @@ def dp(cat: int, mouse: int, turn: int) -> bool:
         # the cat's turn
         i = cat // n
         j = cat % n
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           for jump in range(catJump + 1):
             x = i + dx * jump
             y = j + dy * jump
diff --git a/solutions/173. Binary Search Tree Iterator/173-2.py b/solutions/173. Binary Search Tree Iterator/173-2.py
index a0ae060c9c4..3d9d1766574 100644
--- a/solutions/173. Binary Search Tree Iterator/173-2.py	
+++ b/solutions/173. Binary Search Tree Iterator/173-2.py	
@@ -1,5 +1,5 @@
 class BSTIterator:
-  def __init__(self, root: TreeNode | None):
+  def __init__(self, root: Optional[TreeNode]):
     self.stack = []
     self._pushLeftsUntilNull(root)
 
@@ -11,7 +11,7 @@ def next(self) -> int:
   def hasNext(self) -> bool:
     return self.stack
 
-  def _pushLeftsUntilNull(self, root: TreeNode | None) -> None:
+  def _pushLeftsUntilNull(self, root: Optional[TreeNode]) -> None:
     while root:
       self.stack.append(root)
       root = root.left
diff --git a/solutions/173. Binary Search Tree Iterator/173.py b/solutions/173. Binary Search Tree Iterator/173.py
index 3e1a44da070..be9ed7f54e3 100644
--- a/solutions/173. Binary Search Tree Iterator/173.py	
+++ b/solutions/173. Binary Search Tree Iterator/173.py	
@@ -1,5 +1,5 @@
 class BSTIterator:
-  def __init__(self, root: TreeNode | None):
+  def __init__(self, root: Optional[TreeNode]):
     self.i = 0
     self.vals = []
     self._inorder(root)
@@ -11,7 +11,7 @@ def next(self) -> int:
   def hasNext(self) -> bool:
     return self.i < len(self.vals)
 
-  def _inorder(self, root: TreeNode | None) -> None:
+  def _inorder(self, root: Optional[TreeNode]) -> None:
     if not root:
       return
     self._inorder(root.left)
diff --git a/solutions/1730. Shortest Path to Get Food/1730.cpp b/solutions/1730. Shortest Path to Get Food/1730.cpp
index dee3e82f227..44bf62c9f3e 100644
--- a/solutions/1730. Shortest Path to Get Food/1730.cpp	
+++ b/solutions/1730. Shortest Path to Get Food/1730.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int getFood(vector<vector<char>>& grid) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = grid.size();
     const int n = grid[0].size();
     queue<pair<int, int>> q{{getStartLocation(grid)}};
@@ -10,7 +10,7 @@ class Solution {
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1730. Shortest Path to Get Food/1730.java b/solutions/1730. Shortest Path to Get Food/1730.java
index bdbb4aa49aa..5ad6faa5ada 100644
--- a/solutions/1730. Shortest Path to Get Food/1730.java	
+++ b/solutions/1730. Shortest Path to Get Food/1730.java	
@@ -1,15 +1,15 @@
 class Solution {
   public int getFood(char[][] grid) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = grid.length;
     final int n = grid[0].length;
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(getStartLocation(grid)));
+    Queue<int[]> q = new ArrayDeque<>(Arrays.asList(getStartLocation(grid)));
 
     for (int ans = 0; !q.isEmpty(); ++ans)
       for (int sz = q.size(); sz > 0; --sz) {
-        final int i = q.peek().getKey();
-        final int j = q.poll().getValue();
-        for (int[] dir : DIRS) {
+        final int i = q.peek()[0];
+        final int j = q.poll()[1];
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == m || y < 0 || y == n)
@@ -18,7 +18,7 @@ public int getFood(char[][] grid) {
             continue;
           if (grid[x][y] == '#')
             return ans + 1;
-          q.add(new Pair<>(x, y));
+          q.add(new int[] {x, y});
           grid[x][y] = 'X'; // Mark as visited.
         }
       }
@@ -26,11 +26,11 @@ public int getFood(char[][] grid) {
     return -1;
   }
 
-  private Pair<Integer, Integer> getStartLocation(char[][] grid) {
+  private int[] getStartLocation(char[][] grid) {
     for (int i = 0; i < grid.length; ++i)
       for (int j = 0; j < grid[0].length; ++j)
         if (grid[i][j] == '*')
-          return new Pair<>(i, j);
+          return new int[] {i, j};
     throw new IllegalArgumentException();
   }
 }
diff --git a/solutions/1730. Shortest Path to Get Food/1730.py b/solutions/1730. Shortest Path to Get Food/1730.py
index ab543e1a9ec..ab3f5b116ac 100644
--- a/solutions/1730. Shortest Path to Get Food/1730.py	
+++ b/solutions/1730. Shortest Path to Get Food/1730.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def getFood(self, grid: list[list[str]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def getFood(self, grid: List[List[str]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
     ans = 0
@@ -9,7 +9,7 @@ def getFood(self, grid: list[list[str]]) -> int:
     while q:
       for _ in range(len(q)):
         i, j = q.popleft()
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == m or y < 0 or y == n:
@@ -24,7 +24,7 @@ def getFood(self, grid: list[list[str]]) -> int:
 
     return -1
 
-  def _getStartLocation(self, grid: list[list[str]]) -> tuple[int, int]:
+  def _getStartLocation(self, grid: List[List[str]]) -> Tuple[int, int]:
     for i, row in enumerate(grid):
       for j, cell in enumerate(row):
         if cell == '*':
diff --git a/solutions/1732. Find the Highest Altitude/1732.py b/solutions/1732. Find the Highest Altitude/1732.py
index d3606bfdff0..c412da789b7 100644
--- a/solutions/1732. Find the Highest Altitude/1732.py	
+++ b/solutions/1732. Find the Highest Altitude/1732.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestAltitude(self, gain: list[int]) -> int:
+  def largestAltitude(self, gain: List[int]) -> int:
     ans = 0
     currAltitude = 0
     for g in gain:
diff --git a/solutions/1733. Minimum Number of People to Teach/1733.py b/solutions/1733. Minimum Number of People to Teach/1733.py
index 3c04d83278e..43fa507b7de 100644
--- a/solutions/1733. Minimum Number of People to Teach/1733.py	
+++ b/solutions/1733. Minimum Number of People to Teach/1733.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minimumTeachings(
-      self,
-      n: int,
-      languages: list[list[int]],
-      friendships: list[list[int]],
-  ) -> int:
+  def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:
     languageSets = [set(languages) for languages in languages]
     needTeach = set()
     languageCount = collections.Counter()
diff --git a/solutions/1734. Decode XORed Permutation/1734.py b/solutions/1734. Decode XORed Permutation/1734.py
index faa35609064..5bf8268b460 100644
--- a/solutions/1734. Decode XORed Permutation/1734.py	
+++ b/solutions/1734. Decode XORed Permutation/1734.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def decode(self, encoded: list[int]) -> list[int]:
+  def decode(self, encoded: List[int]) -> List[int]:
     # Our goal is to find the value of a1, which will allow us to decode a2, a3,
     # ..., an. This can be achieved by performing XOR operation between each
     # element in `encoded` and a1.
diff --git a/solutions/1735. Count Ways to Make Array With Product/1735.java b/solutions/1735. Count Ways to Make Array With Product/1735.java
index 7ebe9de7cb2..00a9641a254 100644
--- a/solutions/1735. Count Ways to Make Array With Product/1735.java	
+++ b/solutions/1735. Count Ways to Make Array With Product/1735.java	
@@ -1,9 +1,9 @@
 class Solution {
   public int[] waysToFillArray(int[][] queries) {
-    final int MAX = 10_000;
-    final int MAX_FREQ = 13; // 2^13 = 8192 < MAX
-    final int[] minPrimeFactors = sieveEratosthenes(MAX + 1);
-    final long[][] factAndInvFact = getFactAndInvFact(MAX + MAX_FREQ - 1);
+    final int kMax = 10_000;
+    final int kMaxFreq = 13; // 2^13 = 8192 < kMax
+    final int[] minPrimeFactors = sieveEratosthenes(kMax + 1);
+    final long[][] factAndInvFact = getFactAndInvFact(kMax + kMaxFreq - 1);
     final long[] fact = factAndInvFact[0];
     final long[] invFact = factAndInvFact[1];
     int[] ans = new int[queries.length];
@@ -13,14 +13,14 @@ public int[] waysToFillArray(int[][] queries) {
       final int k = queries[i][1];
       int res = 1;
       for (final int freq : getPrimeFactorsCount(k, minPrimeFactors).values())
-        res = (int) ((long) res * nCk(n - 1 + freq, freq, fact, invFact) % MOD);
+        res = (int) ((long) res * nCk(n - 1 + freq, freq, fact, invFact) % kMod);
       ans[i] = res;
     }
 
     return ans;
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Gets the minimum prime factor of i, where 1 < i <= n.
   private int[] sieveEratosthenes(int n) {
@@ -54,14 +54,14 @@ private long[][] getFactAndInvFact(int n) {
     inv[0] = inv[1] = 1;
     for (int i = 1; i <= n; ++i) {
       if (i >= 2)
-        inv[i] = MOD - MOD / i * inv[MOD % i] % MOD;
-      fact[i] = fact[i - 1] * i % MOD;
-      invFact[i] = invFact[i - 1] * inv[i] % MOD;
+        inv[i] = kMod - kMod / i * inv[kMod % i] % kMod;
+      fact[i] = fact[i - 1] * i % kMod;
+      invFact[i] = invFact[i - 1] * inv[i] % kMod;
     }
     return new long[][] {fact, invFact};
   }
 
   private int nCk(int n, int k, long[] fact, long[] invFact) {
-    return (int) (fact[n] * invFact[k] % MOD * invFact[n - k] % MOD);
+    return (int) (fact[n] * invFact[k] % kMod * invFact[n - k] % kMod);
   }
 }
diff --git a/solutions/1735. Count Ways to Make Array With Product/1735.py b/solutions/1735. Count Ways to Make Array With Product/1735.py
index 1e1a207f3a8..f3ac0f36062 100644
--- a/solutions/1735. Count Ways to Make Array With Product/1735.py	
+++ b/solutions/1735. Count Ways to Make Array With Product/1735.py	
@@ -1,32 +1,32 @@
 class Solution:
-  def waysToFillArray(self, queries: list[list[int]]) -> list[int]:
-    MOD = 1_000_000_007
-    MAX = 10_000
-    minPrimeFactors = self._sieveEratosthenes(MAX + 1)
+  def waysToFillArray(self, queries: List[List[int]]) -> List[int]:
+    kMod = 1_000_000_007
+    kMax = 10_000
+    minPrimeFactors = self._sieveEratosthenes(kMax + 1)
 
     @functools.lru_cache(None)
     def fact(i: int) -> int:
-      return 1 if i <= 1 else i * fact(i - 1) % MOD
+      return 1 if i <= 1 else i * fact(i - 1) % kMod
 
     @functools.lru_cache(None)
     def inv(i: int) -> int:
-      return pow(i, MOD - 2, MOD)
+      return pow(i, kMod - 2, kMod)
 
     @functools.lru_cache(None)
     def nCk(n: int, k: int) -> int:
-      return fact(n) * inv(fact(k)) * inv(fact(n - k)) % MOD
+      return fact(n) * inv(fact(k)) * inv(fact(n - k)) % kMod
 
     ans = []
 
     for n, k in queries:
       res = 1
       for freq in self._getPrimeFactorsCount(k, minPrimeFactors).values():
-        res = res * nCk(n - 1 + freq, freq) % MOD
+        res = res * nCk(n - 1 + freq, freq) % kMod
       ans.append(res)
 
     return ans
 
-  def _sieveEratosthenes(self, n: int) -> list[int]:
+  def _sieveEratosthenes(self, n: int) -> List[int]:
     """Gets the minimum prime factor of i, where 1 < i <= n."""
     minPrimeFactors = [i for i in range(n + 1)]
     for i in range(2, int(n**0.5) + 1):
@@ -35,7 +35,7 @@ def _sieveEratosthenes(self, n: int) -> list[int]:
           minPrimeFactors[j] = min(minPrimeFactors[j], i)
     return minPrimeFactors
 
-  def _getPrimeFactorsCount(self, num: int, minPrimeFactors: list[int]) -> dict[int, int]:
+  def _getPrimeFactorsCount(self, num: int, minPrimeFactors: List[int]) -> Dict[int, int]:
     count = collections.Counter()
     while num > 1:
       divisor = minPrimeFactors[num]
diff --git a/solutions/174. Dungeon Game/174.py b/solutions/174. Dungeon Game/174.py
index 9933291afea..3380f9e1d54 100644
--- a/solutions/174. Dungeon Game/174.py	
+++ b/solutions/174. Dungeon Game/174.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def calculateMinimumHP(self, dungeon: list[list[int]]) -> int:
+  def calculateMinimumHP(self, dungeon: List[List[int]]) -> int:
     m = len(dungeon)
     n = len(dungeon[0])
     dp = [math.inf] * (n + 1)
diff --git a/solutions/1743. Restore the Array From Adjacent Pairs/1743.py b/solutions/1743. Restore the Array From Adjacent Pairs/1743.py
index 457d1579680..36dd8d2d399 100644
--- a/solutions/1743. Restore the Array From Adjacent Pairs/1743.py	
+++ b/solutions/1743. Restore the Array From Adjacent Pairs/1743.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def restoreArray(self, adjacentPairs: list[list[int]]) -> list[int]:
+  def restoreArray(self, adjacentPairs: List[List[int]]) -> List[int]:
     ans = []
     numToAdjs = collections.defaultdict(list)
 
diff --git a/solutions/1744. Can You Eat Your Favorite Candy on Your Favorite Day?/1744.py b/solutions/1744. Can You Eat Your Favorite Candy on Your Favorite Day?/1744.py
index 693c603190f..2a102bbcb0a 100644
--- a/solutions/1744. Can You Eat Your Favorite Candy on Your Favorite Day?/1744.py	
+++ b/solutions/1744. Can You Eat Your Favorite Candy on Your Favorite Day?/1744.py	
@@ -1,8 +1,4 @@
 class Solution:
-  def canEat(
-      self,
-      candiesCount: list[int],
-      queries: list[list[int]]
-  ) -> list[bool]:
-    prefix = list(itertools.accumulate(candiesCount, initial=0))
+  def canEat(self, candiesCount: List[int], queries: List[List[int]]) -> List[bool]:
+    prefix = [0] + list(itertools.accumulate(candiesCount))
     return [prefix[t] // c <= d < prefix[t + 1] for t, d, c in queries]
diff --git a/solutions/1745. Palindrome Partitioning IV/1745-2.cpp b/solutions/1745. Palindrome Partitioning IV/1745-2.cpp
index a7d70c83ade..af4c7df5e89 100644
--- a/solutions/1745. Palindrome Partitioning IV/1745-2.cpp	
+++ b/solutions/1745. Palindrome Partitioning IV/1745-2.cpp	
@@ -3,7 +3,7 @@ class Solution {
   bool checkPartitioning(string s) {
     const int n = s.length();
     // dp[i][j] := true if s[i..j] is a palindrome
-    vector<vector<bool>> dp(n + 1, vector<bool>(n + 1));
+    vector<vector<bool>> dp(n, vector<bool>(n));
 
     for (int i = 0; i < n; ++i)
       dp[i][i] = true;
diff --git a/solutions/1745. Palindrome Partitioning IV/1745-2.java b/solutions/1745. Palindrome Partitioning IV/1745-2.java
index 5edaf155fa0..9555b10c9b2 100644
--- a/solutions/1745. Palindrome Partitioning IV/1745-2.java	
+++ b/solutions/1745. Palindrome Partitioning IV/1745-2.java	
@@ -2,7 +2,7 @@ class Solution {
   public boolean checkPartitioning(String s) {
     final int n = s.length();
     // dp[i][j] := true if s[i..j] is a palindrome
-    boolean[][] dp = new boolean[n + 1][n + 1];
+    boolean[][] dp = new boolean[n][n];
 
     for (int i = 0; i < n; ++i)
       dp[i][i] = true;
diff --git a/solutions/1745. Palindrome Partitioning IV/1745-2.py b/solutions/1745. Palindrome Partitioning IV/1745-2.py
index bc8c1d39472..f10dd517d9d 100644
--- a/solutions/1745. Palindrome Partitioning IV/1745-2.py	
+++ b/solutions/1745. Palindrome Partitioning IV/1745-2.py	
@@ -2,7 +2,7 @@ class Solution:
   def checkPartitioning(self, s: str) -> bool:
     n = len(s)
     # dp[i][j] := true if s[i..j] is a palindrome
-    dp = [[False] * (n + 1) for _ in range(n + 1)]
+    dp = [[False] * n for _ in range(n)]
 
     for i in range(n):
       dp[i][i] = True
@@ -13,8 +13,9 @@ def checkPartitioning(self, s: str) -> bool:
         if s[i] == s[j]:
           dp[i][j] = i + 1 > j - 1 or dp[i + 1][j - 1]
 
-    for i, j in itertools.combinations(range(n), 2):
-      if dp[0][i] and dp[i + 1][j] and dp[j + 1][n - 1]:
-        return True
+    for i in range(n):
+      for j in range(i + 1, n):
+        if dp[0][i] and dp[i + 1][j] and dp[j + 1][n - 1]:
+          return True
 
     return False
diff --git a/solutions/1746. Maximum Subarray Sum After One Operation/1746.py b/solutions/1746. Maximum Subarray Sum After One Operation/1746.py
index d36b037cb2b..77ba1cd75c8 100644
--- a/solutions/1746. Maximum Subarray Sum After One Operation/1746.py	
+++ b/solutions/1746. Maximum Subarray Sum After One Operation/1746.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSumAfterOperation(self, nums: list[int]) -> int:
+  def maxSumAfterOperation(self, nums: List[int]) -> int:
     ans = -math.inf
     regular = 0
     squared = 0
diff --git a/solutions/1748. Sum of Unique Elements/1748.java b/solutions/1748. Sum of Unique Elements/1748.java
index 285170a2a1a..8728109e837 100644
--- a/solutions/1748. Sum of Unique Elements/1748.java	
+++ b/solutions/1748. Sum of Unique Elements/1748.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int sumOfUnique(int[] nums) {
-    final int MAX = 100;
+    final int kMax = 100;
     int ans = 0;
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (final int num : nums)
       ++count[num];
 
-    for (int i = 1; i <= MAX; ++i)
+    for (int i = 1; i <= kMax; ++i)
       if (count[i] == 1)
         ans += i;
 
diff --git a/solutions/1748. Sum of Unique Elements/1748.py b/solutions/1748. Sum of Unique Elements/1748.py
index acb7e0dd101..b012c816897 100644
--- a/solutions/1748. Sum of Unique Elements/1748.py	
+++ b/solutions/1748. Sum of Unique Elements/1748.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sumOfUnique(self, nums: list[int]) -> int:
+  def sumOfUnique(self, nums: List[int]) -> int:
     return sum(num
                for num, freq in collections.Counter(nums).items()
                if freq == 1)
diff --git a/solutions/1751. Maximum Number of Events That Can Be Attended II/1751.java b/solutions/1751. Maximum Number of Events That Can Be Attended II/1751.java
index 62a4b81934b..955e216da7b 100644
--- a/solutions/1751. Maximum Number of Events That Can Be Attended II/1751.java	
+++ b/solutions/1751. Maximum Number of Events That Can Be Attended II/1751.java	
@@ -1,8 +1,7 @@
 class Solution {
   public int maxValue(int[][] events, int k) {
     Integer[][] mem = new Integer[events.length][k + 1];
-    Arrays.sort(events, Comparator.comparingInt((int[] event) -> event[0])
-                            .thenComparing((int[] event) -> event[1]));
+    Arrays.sort(events, (a, b) -> a[0] == b[0] ? a[1] - b[1] : a[0] - b[0]);
     return maxValue(events, 0, k, mem);
   }
 
diff --git a/solutions/1751. Maximum Number of Events That Can Be Attended II/1751.py b/solutions/1751. Maximum Number of Events That Can Be Attended II/1751.py
index f65bb17a766..d125c621292 100644
--- a/solutions/1751. Maximum Number of Events That Can Be Attended II/1751.py	
+++ b/solutions/1751. Maximum Number of Events That Can Be Attended II/1751.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxValue(self, events: list[list[int]], k: int) -> int:
+  def maxValue(self, events: List[List[int]], k: int) -> int:
     events.sort()
 
     @functools.lru_cache(None)
diff --git a/solutions/1755. Closest Subsequence Sum/1755.cpp b/solutions/1755. Closest Subsequence Sum/1755.cpp
index a584cd0ac0f..555cecaf292 100644
--- a/solutions/1755. Closest Subsequence Sum/1755.cpp	
+++ b/solutions/1755. Closest Subsequence Sum/1755.cpp	
@@ -24,16 +24,16 @@ class Solution {
   }
 
  private:
-  void dfs(const vector<int>& arr, int i, int path, vector<int>& sums) {
-    if (i == arr.size()) {
+  void dfs(const vector<int>& A, int i, int path, vector<int>& sums) {
+    if (i == A.size()) {
       sums.push_back(path);
       return;
     }
-    dfs(arr, i + 1, path + arr[i], sums);
-    dfs(arr, i + 1, path, sums);
+    dfs(A, i + 1, path + A[i], sums);
+    dfs(A, i + 1, path, sums);
   }
 
-  int firstGreaterEqual(const vector<int>& arr, int target) {
-    return ranges::lower_bound(arr, target) - arr.begin();
+  int firstGreaterEqual(const vector<int>& A, int target) {
+    return ranges::lower_bound(A, target) - A.begin();
   }
 };
diff --git a/solutions/1755. Closest Subsequence Sum/1755.java b/solutions/1755. Closest Subsequence Sum/1755.java
index 79d3135cb04..af822f6cfff 100644
--- a/solutions/1755. Closest Subsequence Sum/1755.java	
+++ b/solutions/1755. Closest Subsequence Sum/1755.java	
@@ -22,17 +22,17 @@ public int minAbsDifference(int[] nums, int goal) {
     return ans;
   }
 
-  private void dfs(int[] arr, int i, int path, List<Integer> sums) {
-    if (i == arr.length) {
+  private void dfs(int[] A, int i, int path, List<Integer> sums) {
+    if (i == A.length) {
       sums.add(path);
       return;
     }
-    dfs(arr, i + 1, path + arr[i], sums);
-    dfs(arr, i + 1, path, sums);
+    dfs(A, i + 1, path + A[i], sums);
+    dfs(A, i + 1, path, sums);
   }
 
-  private int firstGreaterEqual(List<Integer> arr, int target) {
-    final int i = Collections.binarySearch(arr, target);
+  private int firstGreaterEqual(List<Integer> A, int target) {
+    final int i = Collections.binarySearch(A, target);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/1755. Closest Subsequence Sum/1755.py b/solutions/1755. Closest Subsequence Sum/1755.py
index 69d46557748..5d03c491390 100644
--- a/solutions/1755. Closest Subsequence Sum/1755.py	
+++ b/solutions/1755. Closest Subsequence Sum/1755.py	
@@ -1,16 +1,16 @@
 class Solution:
-  def minAbsDifference(self, nums: list[int], goal: int) -> int:
+  def minAbsDifference(self, nums: List[int], goal: int) -> int:
     n = len(nums) // 2
     ans = math.inf
     lSums = []
     rSums = []
 
-    def dfs(arr: list[int], i: int, path: int, sums: list[int]) -> None:
-      if i == len(arr):
+    def dfs(A: List[int], i: int, path: int, sums: List[int]) -> None:
+      if i == len(A):
         sums.append(path)
         return
-      dfs(arr, i + 1, path + arr[i], sums)
-      dfs(arr, i + 1, path, sums)
+      dfs(A, i + 1, path + A[i], sums)
+      dfs(A, i + 1, path, sums)
 
     dfs(nums[:n], 0, 0, lSums)
     dfs(nums[n:], 0, 0, rSums)
diff --git a/solutions/1759. Count Number of Homogenous Substrings/1759.java b/solutions/1759. Count Number of Homogenous Substrings/1759.java
index e4a5f708215..bb4a71b11bf 100644
--- a/solutions/1759. Count Number of Homogenous Substrings/1759.java	
+++ b/solutions/1759. Count Number of Homogenous Substrings/1759.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int countHomogenous(String s) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int ans = 0;
     int count = 0;
     char currentChar = '@';
@@ -9,7 +9,7 @@ public int countHomogenous(String s) {
       count = c == currentChar ? count + 1 : 1;
       currentChar = c;
       ans += count;
-      ans %= MOD;
+      ans %= kMod;
     }
 
     return ans;
diff --git a/solutions/1759. Count Number of Homogenous Substrings/1759.py b/solutions/1759. Count Number of Homogenous Substrings/1759.py
index ef718dd4330..ee4804ba18f 100644
--- a/solutions/1759. Count Number of Homogenous Substrings/1759.py	
+++ b/solutions/1759. Count Number of Homogenous Substrings/1759.py	
@@ -1,6 +1,6 @@
 class Solution:
   def countHomogenous(self, s: str) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     ans = 0
     count = 0
     currentChar = '@'
@@ -9,6 +9,6 @@ def countHomogenous(self, s: str) -> int:
       count = count + 1 if c == currentChar else 1
       currentChar = c
       ans += count
-      ans %= MOD
+      ans %= kMod
 
     return ans
diff --git a/solutions/1760. Minimum Limit of Balls in a Bag/1760.py b/solutions/1760. Minimum Limit of Balls in a Bag/1760.py
index 72fc543e71a..4941e55b5dc 100644
--- a/solutions/1760. Minimum Limit of Balls in a Bag/1760.py	
+++ b/solutions/1760. Minimum Limit of Balls in a Bag/1760.py	
@@ -1,10 +1,7 @@
 class Solution:
-  def minimumSize(self, nums: list[int], maxOperations: int) -> int:
+  def minimumSize(self, nums: List[int], maxOperations: int) -> int:
+    # Returns the number of operations required to make m penalty.
     def numOperations(m: int) -> int:
-      """Returns the number of operations required to make m penalty."""
-      return sum((num - 1) // m for num in nums)
-    l = 1
-    r = max(nums)
-    return bisect.bisect_left(
-        range(l, r),
-        True, key=lambda m: numOperations(m) <= maxOperations) + l
+      return sum((num - 1) // m for num in nums) <= maxOperations
+    return bisect.bisect_left(range(1, max(nums)), True,
+                              key=lambda m: numOperations(m)) + 1
diff --git a/solutions/1761. Minimum Degree of a Connected Trio in a Graph/1761.py b/solutions/1761. Minimum Degree of a Connected Trio in a Graph/1761.py
index df1419bcddc..6bf28a49b30 100644
--- a/solutions/1761. Minimum Degree of a Connected Trio in a Graph/1761.py	
+++ b/solutions/1761. Minimum Degree of a Connected Trio in a Graph/1761.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minTrioDegree(self, n: int, edges: list[list[int]]) -> int:
+  def minTrioDegree(self, n: int, edges: List[List[int]]) -> int:
     ans = math.inf
     graph = [set() for _ in range(n)]
     degrees = [0] * n
diff --git a/solutions/1762. Buildings With an Ocean View/1762.py b/solutions/1762. Buildings With an Ocean View/1762.py
index f1d0060f552..9264667013d 100644
--- a/solutions/1762. Buildings With an Ocean View/1762.py	
+++ b/solutions/1762. Buildings With an Ocean View/1762.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findBuildings(self, heights: list[int]) -> list[int]:
+  def findBuildings(self, heights: List[int]) -> List[int]:
     stack = []
 
     for i, height in enumerate(heights):
diff --git a/solutions/1764. Form Array by Concatenating Subarrays of Another Array/1764.py b/solutions/1764. Form Array by Concatenating Subarrays of Another Array/1764.py
index 26257c480b6..8fdb93bbfaa 100644
--- a/solutions/1764. Form Array by Concatenating Subarrays of Another Array/1764.py	
+++ b/solutions/1764. Form Array by Concatenating Subarrays of Another Array/1764.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canChoose(self, groups: list[list[int]], nums: list[int]) -> bool:
+  def canChoose(self, groups: List[List[int]], nums: List[int]) -> bool:
     i = 0  # groups' index
     j = 0  # nums' index
 
@@ -13,8 +13,8 @@ def canChoose(self, groups: list[list[int]], nums: list[int]) -> bool:
     return i == len(groups)
 
   # Returns True if group == nums[j..j + |group|].
-  def _isMatch(self, group: list[int], nums: list[int], j: int) -> bool:
-    if j + |group | > len(nums):
+  def _isMatch(self, group: List[int], nums: List[int], j: int) -> bool:
+    if j + |group| > len(nums):
       return False
     for i, g in enumerate(group):
       if g != nums[j + i]:
diff --git a/solutions/1765. Map of Highest Peak/1765.cpp b/solutions/1765. Map of Highest Peak/1765.cpp
index aba7fcca1ec..8c494cf3b76 100644
--- a/solutions/1765. Map of Highest Peak/1765.cpp	
+++ b/solutions/1765. Map of Highest Peak/1765.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   vector<vector<int>> highestPeak(vector<vector<int>>& isWater) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = isWater.size();
     const int n = isWater[0].size();
     vector<vector<int>> ans(m, vector<int>(n, -1));
@@ -17,7 +17,7 @@ class Solution {
     while (!q.empty()) {
       const auto [i, j] = q.front();
       q.pop();
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1765. Map of Highest Peak/1765.java b/solutions/1765. Map of Highest Peak/1765.java
index 339fa61b258..a6067e7785c 100644
--- a/solutions/1765. Map of Highest Peak/1765.java	
+++ b/solutions/1765. Map of Highest Peak/1765.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int[][] highestPeak(int[][] isWater) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = isWater.length;
     final int n = isWater[0].length;
     int[][] ans = new int[m][n];
@@ -17,7 +17,7 @@ public int[][] highestPeak(int[][] isWater) {
     while (!q.isEmpty()) {
       final int i = q.peek().getKey();
       final int j = q.poll().getValue();
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/1765. Map of Highest Peak/1765.py b/solutions/1765. Map of Highest Peak/1765.py
index bfe7cd28597..a51f85616a3 100644
--- a/solutions/1765. Map of Highest Peak/1765.py	
+++ b/solutions/1765. Map of Highest Peak/1765.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def highestPeak(self, isWater: list[list[int]]) -> list[list[int]]:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def highestPeak(self, isWater: List[List[int]]) -> List[List[int]]:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(isWater)
     n = len(isWater[0])
     ans = [[-1] * n for _ in range(m)]
@@ -14,7 +14,7 @@ def highestPeak(self, isWater: list[list[int]]) -> list[list[int]]:
 
     while q:
       i, j = q.popleft()
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/1766. Tree of Coprimes/1766.cpp b/solutions/1766. Tree of Coprimes/1766.cpp
index 2e8e4dc13b2..ce558d3dcee 100644
--- a/solutions/1766. Tree of Coprimes/1766.cpp	
+++ b/solutions/1766. Tree of Coprimes/1766.cpp	
@@ -27,7 +27,7 @@ class Solution {
     stacks[nums[u]].push({u, depth});
 
     for (const int v : tree[u])
-      if (v != prev)
+      if (prev != v)
         dfs(tree, v, u, depth + 1, nums, stacks, ans);
 
     stacks[nums[u]].pop();
diff --git a/solutions/1766. Tree of Coprimes/1766.java b/solutions/1766. Tree of Coprimes/1766.java
index 42146b03bbd..7207e630815 100644
--- a/solutions/1766. Tree of Coprimes/1766.java	
+++ b/solutions/1766. Tree of Coprimes/1766.java	
@@ -4,12 +4,12 @@ public int[] getCoprimes(int[] nums, int[][] edges) {
     Arrays.fill(ans, -1);
     List<Integer>[] tree = new List[nums.length];
     // stacks[i] := (node, depth)s of nodes with value i
-    Deque<Pair<Integer, Integer>>[] stacks = new Deque[MAX + 1];
+    Deque<Pair<Integer, Integer>>[] stacks = new Deque[kMax + 1];
 
     for (int i = 0; i < nums.length; ++i)
       tree[i] = new ArrayList<>();
 
-    for (int i = 1; i <= MAX; ++i)
+    for (int i = 1; i <= kMax; ++i)
       stacks[i] = new ArrayDeque<>();
 
     for (int[] edge : edges) {
@@ -23,7 +23,7 @@ public int[] getCoprimes(int[] nums, int[][] edges) {
     return ans;
   }
 
-  private static final int MAX = 50;
+  private static final int kMax = 50;
 
   private void dfs(List<Integer>[] tree, int u, int prev, int depth, int[] nums,
                    Deque<Pair<Integer, Integer>>[] stacks, int[] ans) {
@@ -31,7 +31,7 @@ private void dfs(List<Integer>[] tree, int u, int prev, int depth, int[] nums,
     stacks[nums[u]].push(new Pair<>(u, depth));
 
     for (final int v : tree[u])
-      if (v != prev)
+      if (prev != v)
         dfs(tree, v, u, depth + 1, nums, stacks, ans);
 
     stacks[nums[u]].pop();
@@ -40,7 +40,7 @@ private void dfs(List<Integer>[] tree, int u, int prev, int depth, int[] nums,
   private int getAncestor(int u, Deque<Pair<Integer, Integer>>[] stacks, int[] nums) {
     int maxNode = -1;
     int maxDepth = -1;
-    for (int i = 1; i <= MAX; ++i)
+    for (int i = 1; i <= kMax; ++i)
       if (!stacks[i].isEmpty() && stacks[i].peek().getValue() > maxDepth && gcd(nums[u], i) == 1) {
         maxNode = stacks[i].peek().getKey();
         maxDepth = stacks[i].peek().getValue();
diff --git a/solutions/1766. Tree of Coprimes/1766.py b/solutions/1766. Tree of Coprimes/1766.py
index 8fc5c37ba01..0936f4eb352 100644
--- a/solutions/1766. Tree of Coprimes/1766.py	
+++ b/solutions/1766. Tree of Coprimes/1766.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def getCoprimes(self, nums: list[int], edges: list[list[int]]) -> list[int]:
-    MAX = 50
+  def getCoprimes(self, nums: List[int], edges: List[List[int]]) -> List[int]:
+    kMax = 50
     ans = [-1] * len(nums)
     tree = [[] for _ in range(len(nums))]
     # stacks[i] := (node, depth)s of nodes with value i
-    stacks = [[] for _ in range(MAX + 1)]
+    stacks = [[] for _ in range(kMax + 1)]
 
     for u, v in edges:
       tree[u].append(v)
@@ -23,7 +23,7 @@ def dfs(u: int, prev: int, depth: int) -> int:
       stacks[nums[u]].append((u, depth))
 
       for v in tree[u]:
-        if v != prev:
+        if prev != v:
           dfs(v, u, depth + 1)
 
       stacks[nums[u]].pop()
diff --git a/solutions/1767. Find the Subtasks That Did Not Execute/1767.sql b/solutions/1767. Find the Subtasks That Did Not Execute/1767.sql
index c30db0b41be..e0b86e4ca5a 100644
--- a/solutions/1767. Find the Subtasks That Did Not Execute/1767.sql	
+++ b/solutions/1767. Find the Subtasks That Did Not Execute/1767.sql	
@@ -1,5 +1,5 @@
-WITH RECURSIVE
-  TaskToSubtask AS (
+WITH
+  RECURSIVE TaskToSubtask AS (
     SELECT task_id, subtasks_count AS subtask_id FROM Tasks
     UNION ALL
     SELECT task_id, subtask_id - 1 FROM TaskToSubtask
diff --git a/solutions/1770. Maximum Score from Performing Multiplication Operations/1770.py b/solutions/1770. Maximum Score from Performing Multiplication Operations/1770.py
index e1388725d58..a4f00a4c250 100644
--- a/solutions/1770. Maximum Score from Performing Multiplication Operations/1770.py	
+++ b/solutions/1770. Maximum Score from Performing Multiplication Operations/1770.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumScore(self, nums: list[int], multipliers: list[int]) -> int:
+  def maximumScore(self, nums: List[int], multipliers: List[int]) -> int:
     @functools.lru_cache(2000)
     def dp(s: int, i: int) -> int:
       """Returns the maximum score of nums[s..e] and multipliers[i]."""
diff --git a/solutions/1772. Sort Features by Popularity/1772.cpp b/solutions/1772. Sort Features by Popularity/1772.cpp
index 708a566be6e..ecece4fca5e 100644
--- a/solutions/1772. Sort Features by Popularity/1772.cpp	
+++ b/solutions/1772. Sort Features by Popularity/1772.cpp	
@@ -18,9 +18,9 @@ class Solution {
     for (int i = 0; i < features.size(); ++i)
       featCount.emplace_back(i, count[features[i]]);
 
-    ranges::sort(featCount, ranges::less{}, [](const pair<int, int>& a) {
-      const auto& [i, count] = a;
-      return pair<int, int>{-count, i};
+    ranges::sort(featCount,
+                 [](const pair<int, int>& a, const pair<int, int>& b) {
+      return a.second == b.second ? a.first < b.first : a.second > b.second;
     });
 
     for (const auto& [i, count] : featCount)
diff --git a/solutions/1772. Sort Features by Popularity/1772.java b/solutions/1772. Sort Features by Popularity/1772.java
index d3635b5dd57..9be3a1e988d 100644
--- a/solutions/1772. Sort Features by Popularity/1772.java	
+++ b/solutions/1772. Sort Features by Popularity/1772.java	
@@ -11,8 +11,7 @@ public String[] sortFeatures(String[] features, String[] responses) {
     for (int i = 0; i < features.length; ++i)
       featCount[i] = new int[] {i, count.getOrDefault(features[i], 0)};
 
-    Arrays.sort(featCount,
-                Comparator.comparingInt((int[] a) -> - a[1]).thenComparingInt((int[] a) -> a[0]));
+    Arrays.sort(featCount, (a, b) -> a[1] == b[1] ? a[0] - b[0] : b[1] - a[1]);
 
     for (int i = 0; i < features.length; ++i)
       ans[i] = features[featCount[i][0]];
diff --git a/solutions/1776. Car Fleet II/1776.java b/solutions/1776. Car Fleet II/1776.java
index 261f40fcc72..79e02cea4c5 100644
--- a/solutions/1776. Car Fleet II/1776.java	
+++ b/solutions/1776. Car Fleet II/1776.java	
@@ -1,3 +1,14 @@
+class Car {
+  public int pos;
+  public int speed;
+  public double collisionTime;
+  public Car(int pos, int speed, double collisionTime) {
+    this.pos = pos;
+    this.speed = speed;
+    this.collisionTime = collisionTime;
+  }
+}
+
 class Solution {
   public double[] getCollisionTimes(int[][] cars) {
     double[] ans = new double[cars.length];
@@ -23,8 +34,6 @@ public double[] getCollisionTimes(int[][] cars) {
     return ans;
   }
 
-  private record Car(int pos, int speed, double collisionTime) {}
-
   private double getCollisionTime(Car car, int pos, int speed) {
     return (double) (car.pos - pos) / (speed - car.speed);
   }
diff --git a/solutions/1776. Car Fleet II/1776.py b/solutions/1776. Car Fleet II/1776.py
index a5da52fd943..468a224d5dc 100644
--- a/solutions/1776. Car Fleet II/1776.py	
+++ b/solutions/1776. Car Fleet II/1776.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def getCollisionTimes(self, cars: list[list[int]]) -> list[float]:
+  def getCollisionTimes(self, cars: List[List[int]]) -> List[float]:
     ans = []
     stack = []  # (pos, speed, collisionTime)
 
     def getCollisionTime(
-            car: tuple[int, int, int],
+            car: Tuple[int, int, int],
             pos: int, speed: int) -> float:
       return (car[0] - pos) / (speed - car[1])
 
diff --git a/solutions/1778. Shortest Path in a Hidden Grid/1778.cpp b/solutions/1778. Shortest Path in a Hidden Grid/1778.cpp
index 8743f228c3c..d338d5ae036 100644
--- a/solutions/1778. Shortest Path in a Hidden Grid/1778.cpp	
+++ b/solutions/1778. Shortest Path in a Hidden Grid/1778.cpp	
@@ -4,7 +4,7 @@
  * class GridMaster {
  *  public:
  *   bool canMove(char direction);
- *   void std::move(char direction);
+ *   void move(char direction);
  *   boolean isTarget();
  * };
  */
@@ -14,7 +14,7 @@ enum class Grid { kUnvisited, kStart, kTarget, kBlocked, kEmpty };
 class Solution {
  public:
   int findShortestPath(GridMaster& master) {
-    constexpr int m = 501;
+    constexpr int m = 500;
     constexpr int startX = m;
     constexpr int startY = m;
     vector<vector<Grid>> grid(m * 2, vector<Grid>(m * 2, Grid::kUnvisited));
@@ -22,31 +22,34 @@ class Solution {
     // Build the grid information by DFS.
     dfs(master, grid, startX, startY);
 
+    int ans = 0;
     queue<pair<int, int>> q{{{startX, startY}}};
     grid[startX][startY] = Grid::kBlocked;
 
     // Find the steps by BFS.
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (grid[x][y] == Grid::kTarget)
-            return step;
+            return ans;
           if (grid[x][y] == Grid::kBlocked)
             continue;
           grid[x][y] = Grid::kBlocked;
           q.emplace(x, y);
         }
       }
+    }
 
     return -1;
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
   static constexpr char charTable[4] = {'R', 'D', 'L', 'U'};
 
   void dfs(GridMaster& master, vector<vector<Grid>>& grid, int i, int j) {
@@ -58,8 +61,8 @@ class Solution {
       grid[i][j] = Grid::kEmpty;
 
     for (int k = 0; k < 4; ++k) {
-      const int x = i + kDirs[k][0];
-      const int y = j + kDirs[k][1];
+      const int x = i + dirs[k][0];
+      const int y = j + dirs[k][1];
       const char d = charTable[k];
       const char undoD = charTable[(k + 2) % 4];
       if (master.canMove(d)) {
diff --git a/solutions/1778. Shortest Path in a Hidden Grid/1778.java b/solutions/1778. Shortest Path in a Hidden Grid/1778.java
index 4794124a175..fdda656b0e5 100644
--- a/solutions/1778. Shortest Path in a Hidden Grid/1778.java	
+++ b/solutions/1778. Shortest Path in a Hidden Grid/1778.java	
@@ -5,59 +5,63 @@
  *   boolean canMove(char direction);
  *   void move(char direction);
  *   boolean isTarget();
- * }
+ * };
  */
 
-enum Grid { UNVISITED, START, TARGET, BLOCKED, EMPTY }
+enum Grid { kUnvisited, kStart, kTarget, kBlocked, kEmpty }
 
 class Solution {
   public int findShortestPath(GridMaster master) {
-    final int m = 501;
+    final int m = 500;
     final int startX = m;
     final int startY = m;
     Grid[][] grid = new Grid[m * 2][m * 2];
-    Arrays.stream(grid).forEach(A -> Arrays.fill(A, Grid.UNVISITED));
+    Arrays.stream(grid).forEach(A -> Arrays.fill(A, Grid.kUnvisited));
 
     // Build the grid information by DFS.
     dfs(master, grid, startX, startY);
 
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(startX, startY)));
-    grid[startX][startY] = Grid.BLOCKED;
+    int ans = 0;
+    Queue<int[]> q = new ArrayDeque<>();
+    q.offer(new int[] {startX, startY});
+    grid[startX][startY] = Grid.kBlocked;
 
     // Find the steps by BFS.
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
-        final int i = q.peek().getKey();
-        final int j = q.poll().getValue();
-        for (int[] dir : DIRS) {
+        final int i = q.peek()[0];
+        final int j = q.poll()[1];
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
-          if (grid[x][y] == Grid.TARGET)
-            return step;
-          if (grid[x][y] == Grid.BLOCKED)
+          if (grid[x][y] == Grid.kTarget)
+            return ans;
+          if (grid[x][y] == Grid.kBlocked)
             continue;
-          grid[x][y] = Grid.BLOCKED;
-          q.offer(new Pair<>(x, y));
+          grid[x][y] = Grid.kBlocked;
+          q.offer(new int[] {x, y});
         }
       }
+    }
 
     return -1;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
   private static final char[] charTable = {'R', 'D', 'L', 'U'};
 
   private void dfs(GridMaster master, Grid[][] grid, int i, int j) {
-    if (grid[i][j] != Grid.UNVISITED)
+    if (grid[i][j] != Grid.kUnvisited)
       return;
     if (master.isTarget())
-      grid[i][j] = Grid.TARGET;
+      grid[i][j] = Grid.kTarget;
     else
-      grid[i][j] = Grid.EMPTY;
+      grid[i][j] = Grid.kEmpty;
 
     for (int k = 0; k < 4; ++k) {
-      final int x = i + DIRS[k][0];
-      final int y = j + DIRS[k][1];
+      final int x = i + dirs[k];
+      final int y = j + dirs[k + 1];
       final char d = charTable[k];
       final char undoD = charTable[(k + 2) % 4];
       if (master.canMove(d)) {
@@ -65,7 +69,7 @@ private void dfs(GridMaster master, Grid[][] grid, int i, int j) {
         dfs(master, grid, x, y);
         master.move(undoD);
       } else {
-        grid[x][y] = Grid.BLOCKED;
+        grid[x][y] = Grid.kBlocked;
       }
     }
   }
diff --git a/solutions/1780. Check if Number is a Sum of Powers of Three/1780.java b/solutions/1780. Check if Number is a Sum of Powers of Three/1780.java
index cfd446ae440..cbd137c657f 100644
--- a/solutions/1780. Check if Number is a Sum of Powers of Three/1780.java	
+++ b/solutions/1780. Check if Number is a Sum of Powers of Three/1780.java	
@@ -1,7 +1,7 @@
 class Solution {
   public boolean checkPowersOfThree(int n) {
     while (n > 1) {
-      final int r = n % 3;
+      const int r = n % 3;
       if (r == 2)
         return false;
       n /= 3;
diff --git a/solutions/1782. Count Pairs Of Nodes/1782.py b/solutions/1782. Count Pairs Of Nodes/1782.py
index 691dd9f4142..ec272808717 100644
--- a/solutions/1782. Count Pairs Of Nodes/1782.py	
+++ b/solutions/1782. Count Pairs Of Nodes/1782.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def countPairs(
-      self,
-      n: int,
-      edges: list[list[int]],
-      queries: list[int],
-  ) -> list[int]:
+  def countPairs(self, n: int, edges: List[List[int]], queries: List[int]) -> List[int]:
     ans = [0] * len(queries)
 
     # count[i] := the number of edges of node i
diff --git a/solutions/1786. Number of Restricted Paths From First to Last Node/1786.cpp b/solutions/1786. Number of Restricted Paths From First to Last Node/1786.cpp
index 2f6dab34a85..4821c539fa5 100644
--- a/solutions/1786. Number of Restricted Paths From First to Last Node/1786.cpp	
+++ b/solutions/1786. Number of Restricted Paths From First to Last Node/1786.cpp	
@@ -21,11 +21,11 @@ class Solution {
     vector<long> ways(graph.size());
     // dist[i] := the distance to the last node of i
     vector<long> dist(graph.size(), LONG_MAX);
-
-    ways[dst] = 1;
-    dist[dst] = 0;
     using P = pair<long, int>;  // (d, u)
     priority_queue<P, vector<P>, greater<>> minHeap;
+
+    dist[dst] = 0;
+    ways[dst] = 1;
     minHeap.emplace(dist[dst], dst);
 
     while (!minHeap.empty()) {
diff --git a/solutions/1786. Number of Restricted Paths From First to Last Node/1786.java b/solutions/1786. Number of Restricted Paths From First to Last Node/1786.java
index 25a8bcf27cc..cedcab385e7 100644
--- a/solutions/1786. Number of Restricted Paths From First to Last Node/1786.java	
+++ b/solutions/1786. Number of Restricted Paths From First to Last Node/1786.java	
@@ -1,7 +1,9 @@
 class Solution {
   public int countRestrictedPaths(int n, int[][] edges) {
     List<Pair<Integer, Integer>>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0] - 1;
@@ -15,18 +17,17 @@ public int countRestrictedPaths(int n, int[][] edges) {
   }
 
   private int dijkstra(List<Pair<Integer, Integer>>[] graph, int src, int dst) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // ways[i] := the number of restricted path from i to n
     long[] ways = new long[graph.length];
     // dist[i] := the distance to the last node of i
     long[] dist = new long[graph.length];
     Arrays.fill(dist, Long.MAX_VALUE);
+    // (d, u)
+    Queue<Pair<Long, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
 
     ways[dst] = 1;
     dist[dst] = 0;
-    // (d, u)
-    Queue<Pair<Long, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingLong(Pair::getKey));
     minHeap.offer(new Pair<>(dist[dst], dst));
 
     while (!minHeap.isEmpty()) {
@@ -43,7 +44,7 @@ private int dijkstra(List<Pair<Integer, Integer>>[] graph, int src, int dst) {
         }
         if (dist[v] < dist[u]) {
           ways[u] += ways[v];
-          ways[u] %= MOD;
+          ways[u] %= kMod;
         }
       }
     }
diff --git a/solutions/1786. Number of Restricted Paths From First to Last Node/1786.py b/solutions/1786. Number of Restricted Paths From First to Last Node/1786.py
index 816db3f1cc9..e5d7edec630 100644
--- a/solutions/1786. Number of Restricted Paths From First to Last Node/1786.py	
+++ b/solutions/1786. Number of Restricted Paths From First to Last Node/1786.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countRestrictedPaths(self, n: int, edges: list[list[int]]) -> int:
+  def countRestrictedPaths(self, n: int, edges: List[List[int]]) -> int:
     graph = [[] for _ in range(n)]
 
     for u, v, w in edges:
@@ -8,13 +8,8 @@ def countRestrictedPaths(self, n: int, edges: list[list[int]]) -> int:
 
     return self._dijkstra(graph, 0, n - 1)
 
-  def _dijkstra(
-      self,
-      graph: list[list[tuple[int, int]]],
-      src: int,
-      dst: int,
-  ) -> int:
-    MOD = 10**9 + 7
+  def _dijkstra(self, graph: List[List[Tuple[int, int]]], src: int, dst: int) -> int:
+    kMod = 10**9 + 7
     # ways[i] := the number of restricted path from i to n
     ways = [0] * len(graph)
     # dist[i] := the distance to the last node of i
@@ -34,6 +29,6 @@ def _dijkstra(
           heapq.heappush(minHeap, (dist[v], v))
         if dist[v] < dist[u]:
           ways[u] += ways[v]
-          ways[u] %= MOD
+          ways[u] %= kMod
 
     return ways[src]
diff --git a/solutions/1787. Make the XOR of All Segments Equal to Zero/1787.java b/solutions/1787. Make the XOR of All Segments Equal to Zero/1787.java
index c12dc2b568f..ab62e26fad9 100644
--- a/solutions/1787. Make the XOR of All Segments Equal to Zero/1787.java	
+++ b/solutions/1787. Make the XOR of All Segments Equal to Zero/1787.java	
@@ -1,11 +1,11 @@
 class Solution {
   public int minChanges(int[] nums, int k) {
-    final int MAX = 1024;
+    final int kMax = 1024;
     final int n = nums.length;
     // counts[i] := the counter that maps at the i-th position
     Map<Integer, Integer>[] counts = new Map[k];
     // dp[i][j] := the minimum number of elements to change s.t. XOR(nums[i..k - 1]) is j
-    int[][] dp = new int[k][MAX];
+    int[][] dp = new int[k][kMax];
 
     for (int i = 0; i < k; ++i)
       counts[i] = new HashMap<>();
@@ -16,14 +16,14 @@ public int minChanges(int[] nums, int k) {
     Arrays.stream(dp).forEach(A -> Arrays.fill(A, n));
 
     // Initialize the DP array.
-    for (int j = 0; j < MAX; ++j)
+    for (int j = 0; j < kMax; ++j)
       dp[k - 1][j] = countAt(n, k, k - 1) - counts[k - 1].getOrDefault(j, 0);
 
     for (int i = k - 2; i >= 0; --i) {
       // The worst-case scenario is changing all the i-th position numbers to a
       // non-existent value in the current bucket.
       final int changeAll = countAt(n, k, i) + Arrays.stream(dp[i + 1]).min().getAsInt();
-      for (int j = 0; j < MAX; ++j) {
+      for (int j = 0; j < kMax; ++j) {
         dp[i][j] = changeAll;
         for (Map.Entry<Integer, Integer> entry : counts[i].entrySet()) {
           final int num = entry.getKey();
diff --git a/solutions/1787. Make the XOR of All Segments Equal to Zero/1787.py b/solutions/1787. Make the XOR of All Segments Equal to Zero/1787.py
index 12d40a3e62b..2388675acf2 100644
--- a/solutions/1787. Make the XOR of All Segments Equal to Zero/1787.py	
+++ b/solutions/1787. Make the XOR of All Segments Equal to Zero/1787.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def minChanges(self, nums: list[int], k: int) -> int:
-    MAX = 1024
+  def minChanges(self, nums: List[int], k: int) -> int:
+    kMax = 1024
     n = len(nums)
     # counts[i] := the counter that maps at the i-th position
     counts = [collections.Counter() for _ in range(k)]
     # dp[i][j] := the minimum number of elements to change s.t. XOR(nums[i..k - 1]) is j
-    dp = [[n] * MAX for _ in range(k)]
+    dp = [[n] * kMax for _ in range(k)]
 
     for i, num in enumerate(nums):
       counts[i % k][num] += 1
@@ -14,14 +14,14 @@ def countAt(i: int) -> int:
       return n // k + (1 if n % k > i else 0)
 
     # Initialize the DP array.
-    for j in range(MAX):
+    for j in range(kMax):
       dp[k - 1][j] = countAt(k - 1) - counts[k - 1][j]
 
     for i in range(k - 2, -1, -1):
       # The worst-case scenario is changing all the i-th position numbers to a
       # non-existent value in the current bucket.
       changeAll = countAt(i) + min(dp[i + 1])
-      for j in range(MAX):
+      for j in range(kMax):
         dp[i][j] = changeAll
         for num, freq in counts[i].items():
           # the cost to change every number in the i-th position to `num`
diff --git a/solutions/1788. Maximize the Beauty of the Garden/1788.py b/solutions/1788. Maximize the Beauty of the Garden/1788.py
index beea31c41af..0fb34c418be 100644
--- a/solutions/1788. Maximize the Beauty of the Garden/1788.py	
+++ b/solutions/1788. Maximize the Beauty of the Garden/1788.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumBeauty(self, flowers: list[int]) -> int:
+  def maximumBeauty(self, flowers: List[int]) -> int:
     ans = -math.inf
     prefix = 0
     flowerToPrefix = collections.defaultdict(int)
diff --git a/solutions/179. Largest Number/179.py b/solutions/179. Largest Number/179.py
index a2101401432..96e70e299c2 100644
--- a/solutions/179. Largest Number/179.py	
+++ b/solutions/179. Largest Number/179.py	
@@ -4,5 +4,5 @@ def __lt__(x: str, y: str) -> bool:
 
 
 class Solution:
-  def largestNumber(self, nums: list[int]) -> str:
+  def largestNumber(self, nums: List[int]) -> str:
     return ''.join(sorted(map(str, nums), key=LargerStrKey)).lstrip('0') or '0'
diff --git a/solutions/1791. Find Center of Star Graph/1791.py b/solutions/1791. Find Center of Star Graph/1791.py
index 6861aa9100d..8ec300ccf81 100644
--- a/solutions/1791. Find Center of Star Graph/1791.py	
+++ b/solutions/1791. Find Center of Star Graph/1791.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findCenter(self, edges: list[list[int]]) -> int:
+  def findCenter(self, edges: List[List[int]]) -> int:
     if edges[0][0] in edges[1]:
       return edges[0][0]
     return edges[0][1]
diff --git a/solutions/1792. Maximum Average Pass Ratio/1792.py b/solutions/1792. Maximum Average Pass Ratio/1792.py
index 1614fd1505f..7dd3937bf95 100644
--- a/solutions/1792. Maximum Average Pass Ratio/1792.py	
+++ b/solutions/1792. Maximum Average Pass Ratio/1792.py	
@@ -1,15 +1,10 @@
 class Solution:
-  def maxAverageRatio(
-      self,
-      classes: list[list[int]],
-      extraStudents: int,
-  ) -> float:
+  def maxAverageRatio(self, classes: List[List[int]], extraStudents: int) -> float:
     def extraPassRatio(pas: int, total: int) -> float:
       """Returns the extra pass ratio if a brilliant student joins."""
       return (pas + 1) / (total + 1) - pas / total
 
-    maxHeap = [(-extraPassRatio(pas, total), pas, total)
-               for pas, total in classes]
+    maxHeap = [(-extraPassRatio(pas, total), pas, total) for pas, total in classes]
     heapq.heapify(maxHeap)
 
     for _ in range(extraStudents):
diff --git a/solutions/1793. Maximum Score of a Good Subarray/1793-2.py b/solutions/1793. Maximum Score of a Good Subarray/1793-2.py
index 9aecb5bab90..9c700d45d3e 100644
--- a/solutions/1793. Maximum Score of a Good Subarray/1793-2.py	
+++ b/solutions/1793. Maximum Score of a Good Subarray/1793-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumScore(self, nums: list[int], k: int) -> int:
+  def maximumScore(self, nums: List[int], k: int) -> int:
     n = len(nums)
     ans = nums[k]
     mn = nums[k]
diff --git a/solutions/1793. Maximum Score of a Good Subarray/1793.py b/solutions/1793. Maximum Score of a Good Subarray/1793.py
index 802dec2b61e..7dd461e8f70 100644
--- a/solutions/1793. Maximum Score of a Good Subarray/1793.py	
+++ b/solutions/1793. Maximum Score of a Good Subarray/1793.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Similar to 84. Largest Rectangle in Histogram
-  def maximumScore(self, nums: list[int], k: int) -> int:
+  def maximumScore(self, nums: List[int], k: int) -> int:
     ans = 0
     stack = []
 
diff --git a/solutions/1797. Design Authentication Manager/1797.py b/solutions/1797. Design Authentication Manager/1797.py
index 3ba33909ada..a258d9fd5d1 100644
--- a/solutions/1797. Design Authentication Manager/1797.py	
+++ b/solutions/1797. Design Authentication Manager/1797.py	
@@ -12,8 +12,8 @@ def generate(self, tokenId: str, currentTime: int) -> None:
     self.times.add(currentTime)
 
   def renew(self, tokenId: str, currentTime: int) -> None:
-    if (tokenId not in self.tokenIdToExpiryTime or
-            currentTime >= self.tokenIdToExpiryTime[tokenId] + self.timeToLive):
+    if tokenId not in self.tokenIdToExpiryTime or \
+            currentTime >= self.tokenIdToExpiryTime[tokenId] + self.timeToLive:
       return
     self.times.remove(self.tokenIdToExpiryTime[tokenId])
     self.tokenIdToExpiryTime[tokenId] = currentTime
diff --git a/solutions/1798. Maximum Number of Consecutive Values You Can Make/1798.py b/solutions/1798. Maximum Number of Consecutive Values You Can Make/1798.py
index 0b4b59f37f5..236b9fa5e9e 100644
--- a/solutions/1798. Maximum Number of Consecutive Values You Can Make/1798.py	
+++ b/solutions/1798. Maximum Number of Consecutive Values You Can Make/1798.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getMaximumConsecutive(self, coins: list[int]) -> int:
+  def getMaximumConsecutive(self, coins: List[int]) -> int:
     ans = 1  # the next value we want to make
 
     for coin in sorted(coins):
diff --git a/solutions/1799. Maximize Score After N Operations/1799.py b/solutions/1799. Maximize Score After N Operations/1799.py
index 12cc7d33b7b..993fa454793 100644
--- a/solutions/1799. Maximize Score After N Operations/1799.py	
+++ b/solutions/1799. Maximize Score After N Operations/1799.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxScore(self, nums: list[int]) -> int:
+  def maxScore(self, nums: List[int]) -> int:
     n = len(nums) // 2
 
     @functools.lru_cache(None)
@@ -13,11 +13,12 @@ def dp(k: int, mask: int) -> int:
 
       res = 0
 
-      for i, j in itertools.combinations(range(len(nums)), 2):
-        chosenMask = 1 << i | 1 << j
-        if (mask & chosenMask) == 0:
-          res = max(res, k * math.gcd(nums[i], nums[j])
-                    + dp(k + 1, mask | chosenMask))
+      for i in range(len(nums)):
+        for j in range(i + 1, len(nums)):
+          chosenMask = 1 << i | 1 << j
+          if (mask & chosenMask) == 0:
+            res = max(res,
+                      k * math.gcd(nums[i], nums[j]) + dp(k + 1, mask | chosenMask))
 
       return res
 
diff --git a/solutions/18. 4Sum/18.py b/solutions/18. 4Sum/18.py
index b317be0a852..f77e13c89fc 100644
--- a/solutions/18. 4Sum/18.py	
+++ b/solutions/18. 4Sum/18.py	
@@ -1,10 +1,8 @@
 class Solution:
-  def fourSum(self, nums: list[int], target: int):
+  def fourSum(self, nums: List[int], target: int):
     ans = []
 
-    def nSum(
-            l: int, r: int, target: int, n: int, path: list[int],
-            ans: list[list[int]]) -> None:
+    def nSum(l: int, r: int, target: int, n: int, path: List[int], ans: List[List[int]]) -> None:
       """Finds n numbers that add up to the target in [l, r]."""
       if r - l + 1 < n or n < 2 or target < nums[l] * n or target > nums[r] * n:
         return
diff --git a/solutions/1800. Maximum Ascending Subarray Sum/1800.py b/solutions/1800. Maximum Ascending Subarray Sum/1800.py
index c3e6a29fde7..5ffee468798 100644
--- a/solutions/1800. Maximum Ascending Subarray Sum/1800.py	
+++ b/solutions/1800. Maximum Ascending Subarray Sum/1800.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxAscendingSum(self, nums: list[int]) -> int:
+  def maxAscendingSum(self, nums: List[int]) -> int:
     ans = 0
     sum = nums[0]
 
diff --git a/solutions/1801. Number of Orders in the Backlog/1801.java b/solutions/1801. Number of Orders in the Backlog/1801.java
index 61ba518f7e9..65c9f3705ff 100644
--- a/solutions/1801. Number of Orders in the Backlog/1801.java	
+++ b/solutions/1801. Number of Orders in the Backlog/1801.java	
@@ -1,9 +1,9 @@
 class Solution {
   public int getNumberOfBacklogOrders(int[][] orders) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int ans = 0;
-    Queue<int[]> buysMaxHeap = new PriorityQueue<>(Comparator.comparingInt(a -> - a[0]));
-    Queue<int[]> sellsMinHeap = new PriorityQueue<>(Comparator.comparingInt(a -> a[0]));
+    PriorityQueue<int[]> buysMaxHeap = new PriorityQueue<>((a, b) -> b[0] - a[0]);
+    PriorityQueue<int[]> sellsMinHeap = new PriorityQueue<>((a, b) -> a[0] - b[0]);
 
     for (int[] order : orders) {
       if (order[2] == 0)
@@ -24,12 +24,12 @@ public int getNumberOfBacklogOrders(int[][] orders) {
 
     while (!buysMaxHeap.isEmpty()) {
       ans += buysMaxHeap.poll()[1];
-      ans %= MOD;
+      ans %= kMod;
     }
 
     while (!sellsMinHeap.isEmpty()) {
       ans += sellsMinHeap.poll()[1];
-      ans %= MOD;
+      ans %= kMod;
     }
 
     return ans;
diff --git a/solutions/1803. Count Pairs With XOR in a Range/1803.java b/solutions/1803. Count Pairs With XOR in a Range/1803.java
index 4a736429b3e..8d9d98dfdd7 100644
--- a/solutions/1803. Count Pairs With XOR in a Range/1803.java	
+++ b/solutions/1803. Count Pairs With XOR in a Range/1803.java	
@@ -15,12 +15,12 @@ public int countPairs(int[] nums, int low, int high) {
     return ans;
   }
 
-  private final int HEIGHT = 14;
+  private final int kHeight = 14;
   private TrieNode root = new TrieNode();
 
   private void insert(int num) {
     TrieNode node = root;
-    for (int i = HEIGHT; i >= 0; --i) {
+    for (int i = kHeight; i >= 0; --i) {
       final int bit = num >> i & 1;
       if (node.children[bit] == null)
         node.children[bit] = new TrieNode();
@@ -33,7 +33,7 @@ private void insert(int num) {
   private int getCount(int num, int limit) {
     int count = 0;
     TrieNode node = root;
-    for (int i = HEIGHT; i >= 0; --i) {
+    for (int i = kHeight; i >= 0; --i) {
       final int bit = num >> i & 1;
       final int bitLimit = ((limit >> i) & 1);
       if (bitLimit == 1) {
diff --git a/solutions/1804. Implement Trie II (Prefix Tree)/1804.java b/solutions/1804. Implement Trie II (Prefix Tree)/1804.java
index 02d74a243a5..d20dc5977ec 100644
--- a/solutions/1804. Implement Trie II (Prefix Tree)/1804.java	
+++ b/solutions/1804. Implement Trie II (Prefix Tree)/1804.java	
@@ -5,7 +5,7 @@ class TrieNode {
 }
 
 class Trie {
-  public void insert(final String word) {
+  public void insert(String word) {
     TrieNode node = root;
     for (final char c : word.toCharArray()) {
       final int i = c - 'a';
@@ -17,17 +17,17 @@ public void insert(final String word) {
     ++node.wordCount;
   }
 
-  public int countWordsEqualTo(final String word) {
+  public int countWordsEqualTo(String word) {
     TrieNode node = find(word);
     return node == null ? 0 : node.wordCount;
   }
 
-  public int countWordsStartingWith(final String prefix) {
+  public int countWordsStartingWith(String prefix) {
     TrieNode node = find(prefix);
     return node == null ? 0 : node.prefixCount;
   }
 
-  public void erase(final String word) {
+  public void erase(String word) {
     TrieNode node = root;
     for (final char c : word.toCharArray()) {
       final int i = c - 'a';
diff --git a/solutions/1808. Maximize Number of Nice Divisors/1808.java b/solutions/1808. Maximize Number of Nice Divisors/1808.java
index ac2e8f7c52a..2383bdc71b8 100644
--- a/solutions/1808. Maximize Number of Nice Divisors/1808.java	
+++ b/solutions/1808. Maximize Number of Nice Divisors/1808.java	
@@ -3,19 +3,19 @@ public int maxNiceDivisors(int primeFactors) {
     if (primeFactors <= 3)
       return primeFactors;
     if (primeFactors % 3 == 0)
-      return (int) (modPow(3, primeFactors / 3) % MOD);
+      return (int) (modPow(3, primeFactors / 3) % kMod);
     if (primeFactors % 3 == 1)
-      return (int) (4 * modPow(3, (primeFactors - 4) / 3) % MOD);
-    return (int) (2 * modPow(3, (primeFactors - 2) / 3) % MOD);
+      return (int) (4 * modPow(3, (primeFactors - 4) / 3) % kMod);
+    return (int) (2 * modPow(3, (primeFactors - 2) / 3) % kMod);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2);
+      return x * modPow(x, n - 1) % kMod;
+    return modPow(x * x % kMod, n / 2);
   }
 }
diff --git a/solutions/1810. Minimum Path Cost in a Hidden Grid/1810.cpp b/solutions/1810. Minimum Path Cost in a Hidden Grid/1810.cpp
index f865847b990..3bd45cc0bac 100644
--- a/solutions/1810. Minimum Path Cost in a Hidden Grid/1810.cpp	
+++ b/solutions/1810. Minimum Path Cost in a Hidden Grid/1810.cpp	
@@ -4,7 +4,7 @@
  * class GridMaster {
  *  public:
  *   bool canMove(char direction);
- *   int std::move(char direction);
+ *   int move(char direction);
  *   boolean isTarget();
  * };
  */
@@ -15,6 +15,7 @@ class Solution {
     constexpr int m = 100;
     constexpr int startX = m;
     constexpr int startY = m;
+
     vector<int> target{m * 2, m * 2};
     vector<vector<int>> grid(m * 2, vector<int>(m * 2, -1));
     vector<vector<bool>> seen(m * 2, vector<bool>(m * 2));
@@ -37,7 +38,7 @@ class Solution {
       if (seen[i][j])
         continue;
       seen[i][j] = true;
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == 2 * m || y < 0 || y == 2 * m)
@@ -53,7 +54,7 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
   static constexpr char charTable[4] = {'R', 'D', 'L', 'U'};
 
   void dfs(GridMaster& master, vector<vector<int>>& grid, int i, int j,
@@ -64,8 +65,8 @@ class Solution {
     }
 
     for (int k = 0; k < 4; ++k) {
-      const int x = i + kDirs[k][0];
-      const int y = j + kDirs[k][1];
+      const int x = i + dirs[k][0];
+      const int y = j + dirs[k][1];
       const char d = charTable[k];
       const char undoD = charTable[(k + 2) % 4];
       if (master.canMove(d) && grid[x][y] == -1) {
diff --git a/solutions/1810. Minimum Path Cost in a Hidden Grid/1810.java b/solutions/1810. Minimum Path Cost in a Hidden Grid/1810.java
index 1e748d3b7a9..5628e02d38b 100644
--- a/solutions/1810. Minimum Path Cost in a Hidden Grid/1810.java	
+++ b/solutions/1810. Minimum Path Cost in a Hidden Grid/1810.java	
@@ -2,9 +2,9 @@
  * // This is the GridMaster's API interface.
  * // You should not implement it, or speculate about its implementation
  * class GridMaster {
- *   boolean canMove(char direction);
- *   int move(char direction);
- *   boolean isTarget();
+ *     boolean canMove(char direction);
+ *     int move(char direction);
+ *     boolean isTarget();
  * }
  */
 
@@ -13,6 +13,7 @@ public int findShortestPath(GridMaster master) {
     final int m = 100;
     final int startX = m;
     final int startY = m;
+
     int[] target = {m * 2, m * 2};
     int[][] grid = new int[m * 2][m * 2];
     boolean[][] seen = new boolean[m * 2][m * 2];
@@ -21,9 +22,8 @@ public int findShortestPath(GridMaster master) {
     // Build the grid information by DFS.
     dfs(master, grid, startX, startY, target);
 
-    Queue<int[]> minHeap = new PriorityQueue<>(Comparator.comparingInt(a -> a[2])) {
-      { offer(new int[] {startX, startY, 0}); }
-    };
+    PriorityQueue<int[]> minHeap = new PriorityQueue<>((a, b) -> a[2] - b[2]);
+    minHeap.offer(new int[] {startX, startY, 0});
 
     // Find the steps by BFS.
     while (!minHeap.isEmpty()) {
@@ -35,7 +35,7 @@ public int findShortestPath(GridMaster master) {
       if (seen[i][j])
         continue;
       seen[i][j] = true;
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == 2 * m || y < 0 || y == 2 * m)
@@ -50,7 +50,7 @@ public int findShortestPath(GridMaster master) {
     return -1;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
   private static final char[] charTable = {'R', 'D', 'L', 'U'};
 
   private void dfs(GridMaster master, int[][] grid, int i, int j, int[] target) {
@@ -60,8 +60,8 @@ private void dfs(GridMaster master, int[][] grid, int i, int j, int[] target) {
     }
 
     for (int k = 0; k < 4; ++k) {
-      final int x = i + DIRS[k][0];
-      final int y = j + DIRS[k][1];
+      final int x = i + dirs[k];
+      final int y = j + dirs[k + 1];
       final char d = charTable[k];
       final char undoD = charTable[(k + 2) % 4];
       if (master.canMove(d) && grid[x][y] == -1) {
diff --git a/solutions/1814. Count Nice Pairs in an Array/1814.cpp b/solutions/1814. Count Nice Pairs in an Array/1814.cpp
index ed23bc13b96..4e4ccb60896 100644
--- a/solutions/1814. Count Nice Pairs in an Array/1814.cpp	
+++ b/solutions/1814. Count Nice Pairs in an Array/1814.cpp	
@@ -19,7 +19,7 @@ class Solution {
  private:
   int rev(int n) {
     int x = 0;
-    while (n > 0) {
+    while (n) {
       x = x * 10 + (n % 10);
       n /= 10;
     }
diff --git a/solutions/1814. Count Nice Pairs in an Array/1814.java b/solutions/1814. Count Nice Pairs in an Array/1814.java
index bde803345b4..55a052617a1 100644
--- a/solutions/1814. Count Nice Pairs in an Array/1814.java	
+++ b/solutions/1814. Count Nice Pairs in an Array/1814.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int countNicePairs(int[] nums) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long ans = 0;
     Map<Integer, Long> count = new HashMap<>();
 
@@ -9,7 +9,7 @@ public int countNicePairs(int[] nums) {
 
     for (final long freq : count.values()) {
       ans += freq * (freq - 1) / 2;
-      ans %= MOD;
+      ans %= kMod;
     }
 
     return (int) ans;
diff --git a/solutions/1814. Count Nice Pairs in an Array/1814.py b/solutions/1814. Count Nice Pairs in an Array/1814.py
index 6c9ae631115..71dcf129e0e 100644
--- a/solutions/1814. Count Nice Pairs in an Array/1814.py	
+++ b/solutions/1814. Count Nice Pairs in an Array/1814.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def countNicePairs(self, nums: list[int]) -> int:
+  def countNicePairs(self, nums: List[int]) -> int:
     freqs = collections.Counter(num - int(str(num)[::-1]) for num in nums)
     return sum(freq * (freq - 1) // 2 for freq in freqs.values()) % 1000000007
diff --git a/solutions/1815. Maximum Number of Groups Getting Fresh Donuts/1815.py b/solutions/1815. Maximum Number of Groups Getting Fresh Donuts/1815.py
index 2eb0d867289..a566863743b 100644
--- a/solutions/1815. Maximum Number of Groups Getting Fresh Donuts/1815.py	
+++ b/solutions/1815. Maximum Number of Groups Getting Fresh Donuts/1815.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxHappyGroups(self, batchSize: int, groups: list[int]) -> int:
+  def maxHappyGroups(self, batchSize: int, groups: List[int]) -> int:
     happy = 0
     freq = [0] * batchSize
 
diff --git a/solutions/1817. Finding the Users Active Minutes/1817.py b/solutions/1817. Finding the Users Active Minutes/1817.py
index 285f6cd4aa5..3c2bc7673b0 100644
--- a/solutions/1817. Finding the Users Active Minutes/1817.py	
+++ b/solutions/1817. Finding the Users Active Minutes/1817.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def findingUsersActiveMinutes(
-      self,
-      logs: list[list[int]],
-      k: int,
-  ) -> list[int]:
+  def findingUsersActiveMinutes(self, logs: List[List[int]], k: int) -> List[int]:
     idToTimes = collections.defaultdict(set)
 
     for id, time in logs:
diff --git a/solutions/1818. Minimum Absolute Sum Difference/1818.java b/solutions/1818. Minimum Absolute Sum Difference/1818.java
index 3f0b42f11f9..e6c645f7756 100644
--- a/solutions/1818. Minimum Absolute Sum Difference/1818.java	
+++ b/solutions/1818. Minimum Absolute Sum Difference/1818.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int minAbsoluteSumDiff(int[] nums1, int[] nums2) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long sumDiff = 0;
     long maxDecrement = 0;
     TreeSet<Integer> sorted = new TreeSet<>();
@@ -19,6 +19,6 @@ public int minAbsoluteSumDiff(int[] nums1, int[] nums2) {
         maxDecrement = Math.max(maxDecrement, currDiff - (long) Math.abs(floor - nums2[i]));
     }
 
-    return (int) ((sumDiff - maxDecrement) % MOD);
+    return (int) ((sumDiff - maxDecrement) % kMod);
   }
 }
diff --git a/solutions/1818. Minimum Absolute Sum Difference/1818.py b/solutions/1818. Minimum Absolute Sum Difference/1818.py
index 293e11705a4..ec76b669c75 100644
--- a/solutions/1818. Minimum Absolute Sum Difference/1818.py	
+++ b/solutions/1818. Minimum Absolute Sum Difference/1818.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minAbsoluteSumDiff(self, nums1: list[int], nums2: list[int]) -> int:
+  def minAbsoluteSumDiff(self, nums1: List[int], nums2: List[int]) -> int:
     ans = math.inf
     diffs = [abs(a - b) for a, b in zip(nums1, nums2)]
     sumDiff = sum(diffs)
@@ -13,4 +13,4 @@ def minAbsoluteSumDiff(self, nums1: list[int], nums2: list[int]) -> int:
       if i < len(nums1):
         ans = min(ans, sumDiff - diff + abs(num - nums1[i]))
 
-    return ans % 1_000_000_007
+    return ans % int(1e9 + 7)
diff --git a/solutions/1820. Maximum Number of Accepted Invitations/1820.cpp b/solutions/1820. Maximum Number of Accepted Invitations/1820.cpp
index da6834ebfce..032ff2c4ffc 100644
--- a/solutions/1820. Maximum Number of Accepted Invitations/1820.cpp	
+++ b/solutions/1820. Maximum Number of Accepted Invitations/1820.cpp	
@@ -22,7 +22,7 @@ class Solution {
       if (!grid[i][j] || seen[j])
         continue;
       seen[j] = true;
-      if (mates[j] == -1 || canInvite(grid, mates[j], std::move(seen), mates)) {
+      if (mates[j] == -1 || canInvite(grid, mates[j], move(seen), mates)) {
         mates[j] = i;  // Match the j-th girl with i-th boy.
         return true;
       }
diff --git a/solutions/1820. Maximum Number of Accepted Invitations/1820.py b/solutions/1820. Maximum Number of Accepted Invitations/1820.py
index c43054f6621..c29e2751014 100644
--- a/solutions/1820. Maximum Number of Accepted Invitations/1820.py	
+++ b/solutions/1820. Maximum Number of Accepted Invitations/1820.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def maximumInvitations(self, grid: list[list[int]]) -> int:
+  def maximumInvitations(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
     ans = 0
     mates = [-1] * n  # mates[i] := the i-th girl's mate
 
-    def canInvite(i: int, seen: list[bool]) -> bool:
+    def canInvite(i: int, seen: List[bool]) -> bool:
       """Returns True if the i-th boy can make an invitation."""
       # The i-th boy asks each girl.
       for j in range(n):
diff --git a/solutions/1822. Sign of the Product of an Array/1822.py b/solutions/1822. Sign of the Product of an Array/1822.py
index f00fceb3382..33bc2af1382 100644
--- a/solutions/1822. Sign of the Product of an Array/1822.py	
+++ b/solutions/1822. Sign of the Product of an Array/1822.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def arraySign(self, nums: list[int]) -> int:
+  def arraySign(self, nums: List[int]) -> int:
     sign = 1
 
     for num in nums:
diff --git a/solutions/1824. Minimum Sideway Jumps/1824.cpp b/solutions/1824. Minimum Sideway Jumps/1824.cpp
index 5e2fd25dc61..2f91ff6b5fc 100644
--- a/solutions/1824. Minimum Sideway Jumps/1824.cpp	
+++ b/solutions/1824. Minimum Sideway Jumps/1824.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int minSideJumps(vector<int>& obstacles) {
-    constexpr int kInf = 1'000'000;
+    constexpr int kInf = 1e6;
     // dp[i] := the minimum jump to reach the i-th lane
     vector<int> dp{kInf, 1, 0, 1};
 
diff --git a/solutions/1824. Minimum Sideway Jumps/1824.java b/solutions/1824. Minimum Sideway Jumps/1824.java
index 2273773bb26..c137a8279fa 100644
--- a/solutions/1824. Minimum Sideway Jumps/1824.java	
+++ b/solutions/1824. Minimum Sideway Jumps/1824.java	
@@ -1,12 +1,12 @@
 class Solution {
   public int minSideJumps(int[] obstacles) {
-    final int INF = 1_000_000;
+    final int kInf = (int) 1e6;
     // dp[i] := the minimum jump to reach the i-th lane
-    int[] dp = {INF, 1, 0, 1};
+    int[] dp = {kInf, 1, 0, 1};
 
     for (final int obstacle : obstacles) {
       if (obstacle > 0)
-        dp[obstacle] = INF;
+        dp[obstacle] = kInf;
       for (int i = 1; i <= 3; ++i) // the current
         if (i != obstacle)
           for (int j = 1; j <= 3; ++j) // the previous
diff --git a/solutions/1824. Minimum Sideway Jumps/1824.py b/solutions/1824. Minimum Sideway Jumps/1824.py
index 53e26362759..764cb6eaf1c 100644
--- a/solutions/1824. Minimum Sideway Jumps/1824.py	
+++ b/solutions/1824. Minimum Sideway Jumps/1824.py	
@@ -1,13 +1,13 @@
 class Solution:
-  def minSideJumps(self, obstacles: list[int]) -> int:
-    INF = 1e6
+  def minSideJumps(self, obstacles: List[int]) -> int:
+    kInf = 1e6
     # dp[i] := the minimum jump to reach the i-th lane
-    dp = [INF, 1, 0, 1]
+    dp = [kInf, 1, 0, 1]
 
     for obstacle in obstacles:
       print(dp)
       if obstacle > 0:
-        dp[obstacle] = INF
+        dp[obstacle] = kInf
       for i in range(1, 4):  # the current
         if i != obstacle:
           for j in range(1, 4):  # the previous
diff --git a/solutions/1825. Finding MK Average/1825-2.java b/solutions/1825. Finding MK Average/1825-2.java
index 4e8b5e38315..4bdd5c8f022 100644
--- a/solutions/1825. Finding MK Average/1825-2.java	
+++ b/solutions/1825. Finding MK Average/1825-2.java	
@@ -8,7 +8,7 @@ class MKAverage {
   public MKAverage(int m, int k) {
     this.m = m;
     this.k = k;
-    this.MID_SIZE = m - 2 * k;
+    this.kMidSize = m - 2 * k;
   }
 
   public void addElement(int num) {
@@ -20,12 +20,12 @@ public void addElement(int num) {
   }
 
   public int calculateMKAverage() {
-    return q.size() == m ? (int) (mid.sum / MID_SIZE) : -1;
+    return q.size() == m ? (int) (mid.sum / kMidSize) : -1;
   }
 
   private final int m;
   private final int k;
-  private final int MID_SIZE;
+  private final int kMidSize;
   private Queue<Integer> q = new ArrayDeque<>();
   private MyMap bot = new MyMap();
   private MyMap mid = new MyMap();
@@ -35,7 +35,7 @@ private void add(int num) {
     add(bot, num);
     if (bot.size > k)
       add(mid, remove(bot, bot.map.lastKey()));
-    if (mid.size > MID_SIZE)
+    if (mid.size > kMidSize)
       add(top, remove(mid, mid.map.lastKey()));
   }
 
@@ -49,7 +49,7 @@ else if (mid.map.containsKey(num))
 
     if (bot.size < k)
       add(bot, remove(mid, mid.map.firstKey()));
-    if (mid.size < MID_SIZE)
+    if (mid.size < kMidSize)
       add(mid, remove(top, top.map.firstKey()));
   }
 
diff --git a/solutions/1826. Faulty Sensor/1826.py b/solutions/1826. Faulty Sensor/1826.py
index 046326c2269..e0708fb4147 100644
--- a/solutions/1826. Faulty Sensor/1826.py	
+++ b/solutions/1826. Faulty Sensor/1826.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def badSensor(self, sensor1: list[int], sensor2: list[int]) -> int:
+  def badSensor(self, sensor1: List[int], sensor2: List[int]) -> int:
     # A -> B, so B is defect
     def canReplace(A, B):
       i = 0  # A's index
diff --git a/solutions/1827. Minimum Operations to Make the Array Increasing/1827.py b/solutions/1827. Minimum Operations to Make the Array Increasing/1827.py
index 8257772120b..fd99b96950b 100644
--- a/solutions/1827. Minimum Operations to Make the Array Increasing/1827.py	
+++ b/solutions/1827. Minimum Operations to Make the Array Increasing/1827.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums: list[int]) -> int:
+  def minOperations(self, nums: List[int]) -> int:
     ans = 0
     last = 0
 
diff --git a/solutions/1828. Queries on Number of Points Inside a Circle/1828.py b/solutions/1828. Queries on Number of Points Inside a Circle/1828.py
index 272b8385462..2070de3ee4c 100644
--- a/solutions/1828. Queries on Number of Points Inside a Circle/1828.py	
+++ b/solutions/1828. Queries on Number of Points Inside a Circle/1828.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def countPoints(
-      self,
-      points: list[list[int]],
-      queries: list[list[int]],
-  ) -> list[int]:
+  def countPoints(self, points: List[List[int]], queries: List[List[int]]) -> List[int]:
     ans = []
 
     for xj, yj, rj in queries:
diff --git a/solutions/1829. Maximum XOR for Each Query/1829.cpp b/solutions/1829. Maximum XOR for Each Query/1829.cpp
index ebb26fce50c..a0a9018d2cc 100644
--- a/solutions/1829. Maximum XOR for Each Query/1829.cpp	
+++ b/solutions/1829. Maximum XOR for Each Query/1829.cpp	
@@ -10,7 +10,7 @@ class Solution {
       ans.push_back(xors ^ mx);
     }
 
-    ranges::reverse(ans);
+    reverse(ans.begin(), ans.end());
     return ans;
   }
 };
diff --git a/solutions/1829. Maximum XOR for Each Query/1829.py b/solutions/1829. Maximum XOR for Each Query/1829.py
index 891ab7178ca..1e5dac39ec5 100644
--- a/solutions/1829. Maximum XOR for Each Query/1829.py	
+++ b/solutions/1829. Maximum XOR for Each Query/1829.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getMaximumXor(self, nums: list[int], maximumBit: int) -> list[int]:
+  def getMaximumXor(self, nums: List[int], maximumBit: int) -> List[int]:
     mx = (1 << maximumBit) - 1
     ans = []
     xors = 0
diff --git a/solutions/1830. Minimum Number of Operations to Make String Sorted/1830.java b/solutions/1830. Minimum Number of Operations to Make String Sorted/1830.java
index 388a4922eed..113a48e9aab 100644
--- a/solutions/1830. Minimum Number of Operations to Make String Sorted/1830.java	
+++ b/solutions/1830. Minimum Number of Operations to Make String Sorted/1830.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int makeStringSorted(String s) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = s.length();
     final long[][] factAndInvFact = getFactAndInvFact(n);
     final long[] fact = factAndInvFact[0];
@@ -11,17 +11,17 @@ public int makeStringSorted(String s) {
     for (int i = n - 1; i >= 0; --i) {
       final int order = s.charAt(i) - 'a';
       ++count[order];
-      long perm = Arrays.stream(count, 0, order).sum() * fact[n - 1 - i] % MOD;
+      long perm = Arrays.stream(count, 0, order).sum() * fact[n - 1 - i] % kMod;
       for (int j = 0; j < 26; ++j)
-        perm = perm * invFact[count[j]] % MOD;
+        perm = perm * invFact[count[j]] % kMod;
       ans += perm;
-      ans %= MOD;
+      ans %= kMod;
     }
 
     return ans;
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long[][] getFactAndInvFact(int n) {
     long[] fact = new long[n + 1];
@@ -31,9 +31,9 @@ private long[][] getFactAndInvFact(int n) {
     inv[0] = inv[1] = 1;
     for (int i = 1; i <= n; ++i) {
       if (i >= 2)
-        inv[i] = MOD - MOD / i * inv[MOD % i] % MOD;
-      fact[i] = fact[i - 1] * i % MOD;
-      invFact[i] = invFact[i - 1] * inv[i] % MOD;
+        inv[i] = kMod - kMod / i * inv[kMod % i] % kMod;
+      fact[i] = fact[i - 1] * i % kMod;
+      invFact[i] = invFact[i - 1] * inv[i] % kMod;
     }
     return new long[][] {fact, invFact};
   }
diff --git a/solutions/1830. Minimum Number of Operations to Make String Sorted/1830.py b/solutions/1830. Minimum Number of Operations to Make String Sorted/1830.py
index 13a38a97436..fea69132366 100644
--- a/solutions/1830. Minimum Number of Operations to Make String Sorted/1830.py	
+++ b/solutions/1830. Minimum Number of Operations to Make String Sorted/1830.py	
@@ -1,16 +1,16 @@
 class Solution:
   def makeStringSorted(self, s: str) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     ans = 0
     count = [0] * 26
 
     @functools.lru_cache(None)
     def fact(i: int) -> int:
-      return 1 if i <= 1 else i * fact(i - 1) % MOD
+      return 1 if i <= 1 else i * fact(i - 1) % kMod
 
     @functools.lru_cache(None)
     def inv(i: int) -> int:
-      return pow(i, MOD - 2, MOD)
+      return pow(i, kMod - 2, kMod)
 
     for i, c in enumerate(reversed(s)):
       order = ord(c) - ord('a')
@@ -19,7 +19,7 @@ def inv(i: int) -> int:
       # fact(i) := s[i + 1..n - 1] can be any sequence of characters
       perm = sum(count[:order]) * fact(i)
       for j in range(26):
-        perm = perm * inv(fact(count[j])) % MOD
-      ans = (ans + perm) % MOD
+        perm = perm * inv(fact(count[j])) % kMod
+      ans = (ans + perm) % kMod
 
     return ans
diff --git a/solutions/1833. Maximum Ice Cream Bars/1833.py b/solutions/1833. Maximum Ice Cream Bars/1833.py
index eeba47fc695..36b170759d9 100644
--- a/solutions/1833. Maximum Ice Cream Bars/1833.py	
+++ b/solutions/1833. Maximum Ice Cream Bars/1833.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxIceCream(self, costs: list[int], coins: int) -> int:
+  def maxIceCream(self, costs: List[int], coins: int) -> int:
     for i, cost in enumerate(sorted(costs)):
       if coins >= cost:
         coins -= cost
diff --git a/solutions/1834. Single-Threaded CPU/1834.cpp b/solutions/1834. Single-Threaded CPU/1834.cpp
index 1ea639a41df..5a7283c8d8d 100644
--- a/solutions/1834. Single-Threaded CPU/1834.cpp	
+++ b/solutions/1834. Single-Threaded CPU/1834.cpp	
@@ -4,7 +4,7 @@ class Solution {
     const int n = tasks.size();
 
     // Add index information.
-    for (int i = 0; i < n; ++i)
+    for (int i = 0; i < tasks.size(); ++i)
       tasks[i].push_back(i);
 
     vector<int> ans;
diff --git a/solutions/1834. Single-Threaded CPU/1834.java b/solutions/1834. Single-Threaded CPU/1834.java
index efec382c8ab..d090d5fabc2 100644
--- a/solutions/1834. Single-Threaded CPU/1834.java	
+++ b/solutions/1834. Single-Threaded CPU/1834.java	
@@ -1,6 +1,15 @@
+class T {
+  public int procTime;
+  public int index;
+
+  public T(int procTime, int index) {
+    this.procTime = procTime;
+    this.index = index;
+  }
+}
+
 class Solution {
   public int[] getOrder(int[][] tasks) {
-    record T(int procTime, int index) {}
     final int n = tasks.length;
     int[][] A = new int[n][3];
 
@@ -12,12 +21,12 @@ record T(int procTime, int index) {}
 
     int[] ans = new int[n];
     int ansIndex = 0;
-    Queue<T> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(T::procTime).thenComparingInt(T::index));
+    Queue<T> minHeap = new PriorityQueue<>(
+        (a, b) -> a.procTime == b.procTime ? a.index - b.index : a.procTime - b.procTime);
     int i = 0;     // tasks' index
     long time = 0; // the current time
 
-    Arrays.sort(A, Comparator.comparingInt(a -> a[0]));
+    Arrays.sort(A, Comparator.comparing(a -> a[0]));
 
     while (i < n || !minHeap.isEmpty()) {
       if (minHeap.isEmpty())
diff --git a/solutions/1834. Single-Threaded CPU/1834.py b/solutions/1834. Single-Threaded CPU/1834.py
index 53f03fba62d..d5380be8585 100644
--- a/solutions/1834. Single-Threaded CPU/1834.py	
+++ b/solutions/1834. Single-Threaded CPU/1834.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getOrder(self, tasks: list[list[int]]) -> list[int]:
+  def getOrder(self, tasks: List[List[int]]) -> List[int]:
     n = len(tasks)
     A = [[*task, i] for i, task in enumerate(tasks)]
     ans = []
diff --git a/solutions/1835. Find XOR Sum of All Pairs Bitwise AND/1835.py b/solutions/1835. Find XOR Sum of All Pairs Bitwise AND/1835.py
index 59be5ceb2f8..a14a05070c5 100644
--- a/solutions/1835. Find XOR Sum of All Pairs Bitwise AND/1835.py	
+++ b/solutions/1835. Find XOR Sum of All Pairs Bitwise AND/1835.py	
@@ -1,5 +1,3 @@
 class Solution:
-  def getXORSum(self, arr1: list[int], arr2: list[int]) -> int:
-    return functools.reduce(
-        operator.xor, arr1) & functools.reduce(
-        operator.xor, arr2)
+  def getXORSum(self, arr1: List[int], arr2: List[int]) -> int:
+    return functools.reduce(operator.xor, arr1) & functools.reduce(operator.xor, arr2)
diff --git a/solutions/1836. Remove Duplicates From an Unsorted Linked List/1836.cpp b/solutions/1836. Remove Duplicates From an Unsorted Linked List/1836.cpp
index 6f5a7c69f59..7dc43bcca0a 100644
--- a/solutions/1836. Remove Duplicates From an Unsorted Linked List/1836.cpp	
+++ b/solutions/1836. Remove Duplicates From an Unsorted Linked List/1836.cpp	
@@ -9,7 +9,7 @@ class Solution {
 
     ListNode* curr = &dummy;
 
-    while (curr != nullptr) {
+    while (curr) {
       while (curr->next && count.contains(curr->next->val) &&
              count[curr->next->val] > 1)
         curr->next = curr->next->next;
diff --git a/solutions/1837. Sum of Digits in Base K/1837.cpp b/solutions/1837. Sum of Digits in Base K/1837.cpp
index 89b902b465d..336c5a63097 100644
--- a/solutions/1837. Sum of Digits in Base K/1837.cpp	
+++ b/solutions/1837. Sum of Digits in Base K/1837.cpp	
@@ -3,7 +3,7 @@ class Solution {
   int sumBase(int n, int k) {
     int ans = 0;
 
-    while (n > 0) {
+    while (n) {
       ans += n % k;
       n /= k;
     }
diff --git a/solutions/1837. Sum of Digits in Base K/1837.py b/solutions/1837. Sum of Digits in Base K/1837.py
index f09e1e8f930..1cd244051f9 100644
--- a/solutions/1837. Sum of Digits in Base K/1837.py	
+++ b/solutions/1837. Sum of Digits in Base K/1837.py	
@@ -2,7 +2,7 @@ class Solution:
   def sumBase(self, n: int, k: int) -> int:
     ans = 0
 
-    while n > 0:
+    while n:
       ans += n % k
       n //= k
 
diff --git a/solutions/1838. Frequency of the Most Frequent Element/1838.py b/solutions/1838. Frequency of the Most Frequent Element/1838.py
index 2d831bb86f9..981a49de9ee 100644
--- a/solutions/1838. Frequency of the Most Frequent Element/1838.py	
+++ b/solutions/1838. Frequency of the Most Frequent Element/1838.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxFrequency(self, nums: list[int], k: int) -> int:
+  def maxFrequency(self, nums: List[int], k: int) -> int:
     ans = 0
     summ = 0
 
diff --git a/solutions/1840. Maximum Building Height/1840.java b/solutions/1840. Maximum Building Height/1840.java
index 7bf7210323f..830fc65fe5f 100644
--- a/solutions/1840. Maximum Building Height/1840.java	
+++ b/solutions/1840. Maximum Building Height/1840.java	
@@ -6,7 +6,7 @@ public int maxBuilding(int n, int[][] restrictions) {
     A[k] = new int[] {1, 0};
     A[k + 1] = new int[] {n, n - 1};
 
-    Arrays.sort(A, Comparator.comparingInt((int[] a) -> a[0]).thenComparingInt(a -> a[1]));
+    Arrays.sort(A, (a, b) -> a[0] == b[0] ? a[1] - b[1] : a[0] - b[0]);
 
     for (int i = 1; i < A.length; ++i) {
       final int dist = A[i][0] - A[i - 1][0];
diff --git a/solutions/1840. Maximum Building Height/1840.py b/solutions/1840. Maximum Building Height/1840.py
index 89515d4cf13..30b24fbd368 100644
--- a/solutions/1840. Maximum Building Height/1840.py	
+++ b/solutions/1840. Maximum Building Height/1840.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxBuilding(self, n: int, restrictions: list[list[int]]) -> int:
+  def maxBuilding(self, n: int, restrictions: List[List[int]]) -> int:
     A = sorted(restrictions + [[1, 0]] + [[n, n - 1]])
 
     for i in range(len(A)):
diff --git a/solutions/1842. Next Palindrome Using Same Digits/1842.cpp b/solutions/1842. Next Palindrome Using Same Digits/1842.cpp
index 8b1b946de2b..03618b0ee46 100644
--- a/solutions/1842. Next Palindrome Using Same Digits/1842.cpp	
+++ b/solutions/1842. Next Palindrome Using Same Digits/1842.cpp	
@@ -2,26 +2,53 @@ class Solution {
  public:
   string nextPalindrome(string num) {
     const int n = num.length();
-    vector<int> arr(n / 2);
+    vector<int> A(n / 2);
 
-    for (int i = 0; i < arr.size(); ++i)
-      arr[i] = num[i] - '0';
+    for (int i = 0; i < A.size(); ++i)
+      A[i] = num[i] - '0';
 
-    if (!ranges::next_permutation(arr).found)
+    if (!nextPermutation(A))
       return "";
 
     string s;
 
-    for (const int a : arr)
+    for (const int a : A)
       s += '0' + a;
 
     if (n % 2 == 1)
-      return s + num[n / 2] + reversed(s);
-    return s + reversed(s);
+      return s + num[n / 2] + string(s.rbegin(), s.rend());
+    return s + string(s.rbegin(), s.rend());
   }
 
  private:
-  string reversed(const string& s) {
-    return {s.rbegin(), s.rend()};
+  // Returns true if `nums` has the next permutation.
+  bool nextPermutation(vector<int>& nums) {
+    const int n = nums.size();
+
+    // From the back to the front, find the first num < nums[i + 1].
+    int i;
+    for (i = n - 2; i >= 0; --i)
+      if (nums[i] < nums[i + 1])
+        break;
+
+    if (i < 0)
+      return false;
+
+    // From the back to the front, find the first num > nums[i] and swap it with
+    // nums[i].
+    for (int j = n - 1; j > i; --j)
+      if (nums[j] > nums[i]) {
+        swap(nums[i], nums[j]);
+        break;
+      }
+
+    // Reverse nums[i + 1..n - 1].
+    reverse(nums, i + 1, n - 1);
+    return true;
+  }
+
+  void reverse(vector<int>& nums, int l, int r) {
+    while (l < r)
+      swap(nums[l++], nums[r--]);
   }
 };
diff --git a/solutions/1842. Next Palindrome Using Same Digits/1842.java b/solutions/1842. Next Palindrome Using Same Digits/1842.java
index 18b1be45d1b..76012e7c510 100644
--- a/solutions/1842. Next Palindrome Using Same Digits/1842.java	
+++ b/solutions/1842. Next Palindrome Using Same Digits/1842.java	
@@ -1,17 +1,17 @@
 class Solution {
   public String nextPalindrome(String num) {
     final int n = num.length();
-    int[] arr = new int[n / 2];
+    int[] A = new int[n / 2];
 
-    for (int i = 0; i < arr.length; ++i)
-      arr[i] = num.charAt(i) - '0';
+    for (int i = 0; i < A.length; ++i)
+      A[i] = num.charAt(i) - '0';
 
-    if (!nextPermutation(arr))
+    if (!nextPermutation(A))
       return "";
 
     StringBuilder sb = new StringBuilder();
 
-    for (final int a : arr)
+    for (final int a : A)
       sb.append(a);
 
     if (n % 2 == 1)
diff --git a/solutions/1842. Next Palindrome Using Same Digits/1842.py b/solutions/1842. Next Palindrome Using Same Digits/1842.py
index 89d76ab9224..a90e921e246 100644
--- a/solutions/1842. Next Palindrome Using Same Digits/1842.py	
+++ b/solutions/1842. Next Palindrome Using Same Digits/1842.py	
@@ -1,6 +1,6 @@
 class Solution:
   def nextPalindrome(self, num: str) -> str:
-    def nextPermutation(nums: list[int]) -> bool:
+    def nextPermutation(nums: List[int]) -> bool:
       n = len(nums)
 
       # From the back to the front, find the first num < nums[i + 1].
@@ -31,11 +31,12 @@ def reverse(nums, l, r):
       return True
 
     n = len(num)
-    arr = [int(num[i]) for i in range(len(num) // 2)]
-    if not nextPermutation(arr):
+    A = [ord(num[i]) - ord('0') for i in range(len(num) // 2)]
+
+    if not nextPermutation(A):
       return ''
 
-    s = ''.join([chr(ord('0') + a) for a in arr])
+    s = ''.join([chr(ord('0') + a) for a in A])
     if n % 2 == 1:
       return s + num[n // 2] + s[::-1]
     return s + s[::-1]
diff --git a/solutions/1844. Replace All Digits with Characters/1844.cpp b/solutions/1844. Replace All Digits with Characters/1844.cpp
index 542c8f32918..90bcf3d83d7 100644
--- a/solutions/1844. Replace All Digits with Characters/1844.cpp	
+++ b/solutions/1844. Replace All Digits with Characters/1844.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   string replaceDigits(string s) {
-    for (int i = 1; i < s.length(); i += 2)
+    for (int i = 0; i < s.length(); ++i)
       s[i] += s[i - 1] - '0';
     return s;
   }
diff --git a/solutions/1844. Replace All Digits with Characters/1844.java b/solutions/1844. Replace All Digits with Characters/1844.java
index 75d77f931bb..3db4ba16bd0 100644
--- a/solutions/1844. Replace All Digits with Characters/1844.java	
+++ b/solutions/1844. Replace All Digits with Characters/1844.java	
@@ -1,8 +1,10 @@
 class Solution {
   public String replaceDigits(String s) {
-    char[] chars = s.toCharArray();
-    for (int i = 1; i < chars.length; i += 2)
-      chars[i] += chars[i - 1] - '0';
-    return String.valueOf(chars);
+    char[] A = s.toCharArray();
+
+    for (int i = 1; i < A.length; i += 2)
+      A[i] += (char) (A[i - 1] - '0');
+
+    return String.valueOf(A);
   }
 }
diff --git a/solutions/1844. Replace All Digits with Characters/1844.py b/solutions/1844. Replace All Digits with Characters/1844.py
index 3d4461a2106..ea4bfab4676 100644
--- a/solutions/1844. Replace All Digits with Characters/1844.py	
+++ b/solutions/1844. Replace All Digits with Characters/1844.py	
@@ -1,6 +1,8 @@
 class Solution:
   def replaceDigits(self, s: str) -> str:
-    return ''.join(
-        c if i % 2 == 0 else chr(ord(s[i - 1]) + int(c))
-        for i, c in enumerate(s)
-    )
+    chars = list(s)
+
+    for i in range(1, len(chars), 2):
+      chars[i] = chr(ord(chars[i - 1]) + ord(chars[i]) - ord('0'))
+
+    return ''.join(chars)
diff --git a/solutions/1846. Maximum Element After Decreasing and Rearranging/1846.py b/solutions/1846. Maximum Element After Decreasing and Rearranging/1846.py
index c0435823246..cd1337b0aa5 100644
--- a/solutions/1846. Maximum Element After Decreasing and Rearranging/1846.py	
+++ b/solutions/1846. Maximum Element After Decreasing and Rearranging/1846.py	
@@ -1,7 +1,5 @@
 class Solution:
-  def maximumElementAfterDecrementingAndRearranging(
-      self, arr: list[int],
-  ) -> int:
+  def maximumElementAfterDecrementingAndRearranging(self, arr: List[int]) -> int:
     arr.sort()
     arr[0] = 1
 
diff --git a/solutions/1847. Closest Room/1847.cpp b/solutions/1847. Closest Room/1847.cpp
index e7cf303c1c2..ca850d5ffac 100644
--- a/solutions/1847. Closest Room/1847.cpp	
+++ b/solutions/1847. Closest Room/1847.cpp	
@@ -8,10 +8,9 @@ class Solution {
     for (int i = 0; i < queries.size(); ++i)
       queries[i].push_back(i);
 
-    ranges::sort(rooms, ranges::greater{},
-                 [](const vector<int>& room) { return room[1]; });
-    ranges::sort(queries, ranges::greater{},
-                 [](const vector<int>& query) { return query[1]; });
+    auto descSize = [](const auto& a, const auto& b) { return a[1] > b[1]; };
+    ranges::sort(rooms, descSize);
+    ranges::sort(queries, descSize);
 
     int i = 0;  // rooms' index
     for (const vector<int>& query : queries) {
diff --git a/solutions/1847. Closest Room/1847.java b/solutions/1847. Closest Room/1847.java
index 650c5371e51..4a380ab405d 100644
--- a/solutions/1847. Closest Room/1847.java	
+++ b/solutions/1847. Closest Room/1847.java	
@@ -7,8 +7,8 @@ public int[] closestRoom(int[][] rooms, int[][] queries) {
     for (int i = 0; i < queries.length; ++i)
       indices[i] = i;
 
-    Arrays.sort(rooms, Comparator.comparingInt(room -> - room[1]));
-    Arrays.sort(indices, Comparator.comparingInt(index -> - queries[index][1]));
+    Arrays.sort(rooms, (a, b) -> b[1] - a[1]);
+    Arrays.sort(indices, (a, b) -> queries[b][1] - queries[a][1]);
 
     int i = 0; // rooms' index
     for (final int index : indices) {
diff --git a/solutions/1847. Closest Room/1847.py b/solutions/1847. Closest Room/1847.py
index 41dfeffcbe7..e5a128a60fa 100644
--- a/solutions/1847. Closest Room/1847.py	
+++ b/solutions/1847. Closest Room/1847.py	
@@ -2,11 +2,7 @@
 
 
 class Solution:
-  def closestRoom(
-      self,
-      rooms: list[list[int]],
-      queries: list[list[int]],
-  ) -> list[int]:
+  def closestRoom(self, rooms: List[List[int]], queries: List[List[int]]) -> List[int]:
     ans = [0] * len(queries)
     qs = [[*q, i] for i, q in enumerate(queries)]
     roomIds = SortedList()
diff --git a/solutions/1848. Minimum Distance to the Target Element/1848.py b/solutions/1848. Minimum Distance to the Target Element/1848.py
index 7b972578287..1f7cb18f9a5 100644
--- a/solutions/1848. Minimum Distance to the Target Element/1848.py	
+++ b/solutions/1848. Minimum Distance to the Target Element/1848.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getMinDistance(self, nums: list[int], target: int, start: int) -> int:
+  def getMinDistance(self, nums: List[int], target: int, start: int) -> int:
     ans = math.inf
 
     for i, num in enumerate(nums):
diff --git a/solutions/1849. Splitting a String Into Descending Consecutive Values/1849.py b/solutions/1849. Splitting a String Into Descending Consecutive Values/1849.py
index 4bd9436dc81..08f537a0ae1 100644
--- a/solutions/1849. Splitting a String Into Descending Consecutive Values/1849.py	
+++ b/solutions/1849. Splitting a String Into Descending Consecutive Values/1849.py	
@@ -6,7 +6,7 @@ def isValid(s: str, start: int, prev: int, segment: int) -> bool:
 
       curr = 0
       for i in range(start, len(s)):
-        curr = curr * 10 + int(s[i])
+        curr = curr * 10 + ord(s[i]) - ord('0')
         if curr > 9999999999:
           return False
         if (prev == -1 or curr == prev - 1) and isValid(s, i + 1, curr, segment + 1):
diff --git a/solutions/1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number/1850.cpp b/solutions/1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number/1850.cpp
index 1ea9de1292f..65bfc23f3e6 100644
--- a/solutions/1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number/1850.cpp	
+++ b/solutions/1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number/1850.cpp	
@@ -3,7 +3,7 @@ class Solution {
   int getMinSwaps(string num, int k) {
     string perm = num;
 
-    while (k-- > 0)
+    while (k--)
       next_permutation(perm.begin(), perm.end());
 
     return countSteps(num, perm);
diff --git a/solutions/1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number/1850.java b/solutions/1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number/1850.java
index 62d9826c7f9..03ae6f81958 100644
--- a/solutions/1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number/1850.java	
+++ b/solutions/1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number/1850.java	
@@ -1,16 +1,16 @@
 class Solution {
   public int getMinSwaps(String num, int k) {
-    int[] original = new int[num.length()];
+    int[] A = new int[num.length()]; // Original
 
-    for (int i = 0; i < original.length; ++i)
-      original[i] = num.charAt(i) - '0';
+    for (int i = 0; i < A.length; ++i)
+      A[i] = num.charAt(i) - '0';
 
-    int[] permutated = original.clone();
+    int[] B = A.clone(); // Permutated
 
     for (int i = 0; i < k; ++i)
-      nextPermutation(permutated);
+      nextPermutation(B);
 
-    return countSteps(original, permutated);
+    return countSteps(A, B);
   }
 
   public void nextPermutation(int[] nums) {
@@ -30,7 +30,7 @@ public void nextPermutation(int[] nums) {
           break;
         }
 
-    // Reverse nums[i + 1..n - 1].
+    // Reverse nums[i + 1..n - 1]
     reverse(nums, i + 1, n - 1);
   }
 
diff --git a/solutions/1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number/1850.py b/solutions/1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number/1850.py
index c394068fc62..75e9ed02ebe 100644
--- a/solutions/1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number/1850.py	
+++ b/solutions/1850. Minimum Adjacent Swaps to Reach the Kth Smallest Number/1850.py	
@@ -1,50 +1,50 @@
 class Solution:
   def getMinSwaps(self, num: str, k: int) -> int:
-    original = [int(c) for c in num]
-    permutated = original.copy()
+    def nextPermutation(nums: List[int]):
+      n = len(nums)
 
-    for _ in range(k):
-      self._nextPermutation(permutated)
+      # From the back to the front, find the first num < nums[i + 1].
+      i = n - 2
+      while i >= 0:
+        if nums[i] < nums[i + 1]:
+          break
+        i -= 1
 
-    return self._countSteps(original, permutated)
+      # From the back to the front, find the first num > nums[i] and swap it with nums[i].
+      if i >= 0:
+        for j in range(n - 1, i, -1):
+          if nums[j] > nums[i]:
+            nums[i], nums[j] = nums[j], nums[i]
+            break
 
-  def _nextPermutation(self, nums: list[int]):
-    n = len(nums)
+      def reverse(nums, l, r):
+        while l < r:
+          nums[l], nums[r] = nums[r], nums[l]
+          l += 1
+          r -= 1
 
-    # From the back to the front, find the first num < nums[i + 1].
-    i = n - 2
-    while i >= 0:
-      if nums[i] < nums[i + 1]:
-        break
-      i -= 1
+      # Reverse nums[i + 1..n - 1]
+      reverse(nums, i + 1, len(nums) - 1)
 
-    # From the back to the front, find the first num > nums[i] and swap it with nums[i].
-    if i >= 0:
-      for j in range(n - 1, i, -1):
-        if nums[j] > nums[i]:
-          nums[i], nums[j] = nums[j], nums[i]
-          break
+    A = [int(c) for c in num]  # Original
+    B = A.copy()  # Permutated
+
+    for _ in range(k):
+      nextPermutation(B)
+
+    def countSteps(A: List[int], B: List[int]) -> int:
+      count = 0
+
+      j = 0
+      for i in range(len(A)):
+        j = i
+        while A[i] != B[j]:
+          j += 1
+        while i < j:
+          B[j], B[j - 1] = B[j - 1], B[j]
+          j -= 1
+          count += 1
+
+      return count
 
-    def reverse(nums, l, r):
-      while l < r:
-        nums[l], nums[r] = nums[r], nums[l]
-        l += 1
-        r -= 1
-
-    # Reverse nums[i + 1..n - 1].
-    reverse(nums, i + 1, len(nums) - 1)
-
-  def _countSteps(self, A: list[int], B: list[int]) -> int:
-    count = 0
-
-    j = 0
-    for i in range(len(A)):
-      j = i
-      while A[i] != B[j]:
-        j += 1
-      while i < j:
-        B[j], B[j - 1] = B[j - 1], B[j]
-        j -= 1
-        count += 1
-
-    return count
+    return countSteps(A, B)
diff --git a/solutions/1851. Minimum Interval to Include Each Query/1851.cpp b/solutions/1851. Minimum Interval to Include Each Query/1851.cpp
index 3a4eee84b01..1c191b18b36 100644
--- a/solutions/1851. Minimum Interval to Include Each Query/1851.cpp	
+++ b/solutions/1851. Minimum Interval to Include Each Query/1851.cpp	
@@ -1,6 +1,7 @@
 struct T {
   int size;
   int right;
+  T(int size, int right) : size(size), right(right) {}
 };
 
 class Solution {
diff --git a/solutions/1851. Minimum Interval to Include Each Query/1851.java b/solutions/1851. Minimum Interval to Include Each Query/1851.java
index 22f06b78ea2..8dc7217f778 100644
--- a/solutions/1851. Minimum Interval to Include Each Query/1851.java	
+++ b/solutions/1851. Minimum Interval to Include Each Query/1851.java	
@@ -1,16 +1,24 @@
+class T {
+  public int size;
+  public int right;
+  public T(int size, int right) {
+    this.size = size;
+    this.right = right;
+  }
+}
+
 class Solution {
   public int[] minInterval(int[][] intervals, int[] queries) {
-    record T(int size, int right) {}
     int[] ans = new int[queries.length];
     Arrays.fill(ans, -1);
-    Queue<T> minHeap = new PriorityQueue<T>(Comparator.comparingInt(T::size));
+    Queue<T> minHeap = new Queue<T>((a, b) -> a.size - b.size);
     Integer[] indices = new Integer[queries.length];
 
     for (int i = 0; i < queries.length; ++i)
       indices[i] = i;
 
-    Arrays.sort(intervals, Comparator.comparingInt(interval -> interval[0]));
-    Arrays.sort(indices, Comparator.comparingInt(index -> queries[index]));
+    Arrays.sort(intervals, (a, b) -> a[0] - b[0]);
+    Arrays.sort(indices, (a, b) -> queries[a] - queries[b]);
 
     int i = 0; // intervals' index
     for (final int index : indices) {
diff --git a/solutions/1852. Distinct Numbers in Each Subarray/1852.py b/solutions/1852. Distinct Numbers in Each Subarray/1852.py
index 4713faa46f7..db41a8db399 100644
--- a/solutions/1852. Distinct Numbers in Each Subarray/1852.py	
+++ b/solutions/1852. Distinct Numbers in Each Subarray/1852.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def distinctNumbers(self, nums: list[int], k: int) -> list[int]:
+  def distinctNumbers(self, nums: List[int], k: int) -> List[int]:
     ans = []
     count = collections.Counter()
     distinct = 0
diff --git a/solutions/1854. Maximum Population Year/1854.java b/solutions/1854. Maximum Population Year/1854.java
index 85c7f301db2..59c99030e66 100644
--- a/solutions/1854. Maximum Population Year/1854.java	
+++ b/solutions/1854. Maximum Population Year/1854.java	
@@ -1,12 +1,12 @@
 class Solution {
   public int maximumPopulation(int[][] logs) {
-    final int MIN_YEAR = 1950;
-    final int MAX_YEAR = 2050;
+    final int kMinYear = 1950;
+    final int kMaxYear = 2050;
     int ans = 0;
     int maxPopulation = 0;
     int runningPopulation = 0;
     // population[i] := the population of year i
-    int[] population = new int[MAX_YEAR + 1];
+    int[] population = new int[kMaxYear + 1];
 
     for (int[] log : logs) {
       final int birth = log[0];
@@ -15,7 +15,7 @@ public int maximumPopulation(int[][] logs) {
       --population[death];
     }
 
-    for (int year = MIN_YEAR; year <= MAX_YEAR; ++year) {
+    for (int year = kMinYear; year <= kMaxYear; ++year) {
       runningPopulation += population[year];
       if (runningPopulation > maxPopulation) {
         maxPopulation = runningPopulation;
diff --git a/solutions/1854. Maximum Population Year/1854.py b/solutions/1854. Maximum Population Year/1854.py
index cf10208d697..4f87f77f20c 100644
--- a/solutions/1854. Maximum Population Year/1854.py	
+++ b/solutions/1854. Maximum Population Year/1854.py	
@@ -1,18 +1,18 @@
 class Solution:
-  def maximumPopulation(self, logs: list[list[int]]) -> int:
-    MIN_YEAR = 1950
-    MAX_YEAR = 2050
+  def maximumPopulation(self, logs: List[List[int]]) -> int:
+    kMinYear = 1950
+    kMaxYear = 2050
     ans = 0
     maxPopulation = 0
     runningPopulation = 0
     # population[i] := the population of year i
-    population = [0] * (MAX_YEAR + 1)
+    population = [0] * (kMaxYear + 1)
 
     for birth, death in logs:
       population[birth] += 1
       population[death] -= 1
 
-    for year in range(MIN_YEAR, MAX_YEAR + 1):
+    for year in range(kMinYear, kMaxYear + 1):
       runningPopulation += population[year]
       if runningPopulation > maxPopulation:
         maxPopulation = runningPopulation
diff --git a/solutions/1855. Maximum Distance Between a Pair of Values/1855-2.py b/solutions/1855. Maximum Distance Between a Pair of Values/1855-2.py
index 251c7aef30c..e41afaf58b2 100644
--- a/solutions/1855. Maximum Distance Between a Pair of Values/1855-2.py	
+++ b/solutions/1855. Maximum Distance Between a Pair of Values/1855-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxDistance(self, nums1: list[int], nums2: list[int]) -> int:
+  def maxDistance(self, nums1: List[int], nums2: List[int]) -> int:
     i = 0
     j = 0
 
diff --git a/solutions/1855. Maximum Distance Between a Pair of Values/1855.py b/solutions/1855. Maximum Distance Between a Pair of Values/1855.py
index 9d75a62ce30..83c756ca173 100644
--- a/solutions/1855. Maximum Distance Between a Pair of Values/1855.py	
+++ b/solutions/1855. Maximum Distance Between a Pair of Values/1855.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxDistance(self, nums1: list[int], nums2: list[int]) -> int:
+  def maxDistance(self, nums1: List[int], nums2: List[int]) -> int:
     ans = 0
     i = 0
     j = 0
diff --git a/solutions/1856. Maximum Subarray Min-Product/1856.java b/solutions/1856. Maximum Subarray Min-Product/1856.java
index 0f751f00559..f08b60efc20 100644
--- a/solutions/1856. Maximum Subarray Min-Product/1856.java	
+++ b/solutions/1856. Maximum Subarray Min-Product/1856.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int maxSumMinProduct(int[] nums) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long ans = 0;
     Deque<Integer> stack = new ArrayDeque<>();
     long[] prefix = new long[nums.length + 1];
@@ -17,6 +17,6 @@ public int maxSumMinProduct(int[] nums) {
       stack.push(i);
     }
 
-    return (int) (ans % MOD);
+    return (int) (ans % kMod);
   }
 }
diff --git a/solutions/1856. Maximum Subarray Min-Product/1856.py b/solutions/1856. Maximum Subarray Min-Product/1856.py
index 901fb194d99..11d412d7ffb 100644
--- a/solutions/1856. Maximum Subarray Min-Product/1856.py	
+++ b/solutions/1856. Maximum Subarray Min-Product/1856.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def maxSumMinProduct(self, nums: list[int]) -> int:
+  def maxSumMinProduct(self, nums: List[int]) -> int:
     ans = 0
     stack = []
-    prefix = list(itertools.accumulate(nums, initial=0))
+    prefix = [0] + list(itertools.accumulate(nums))
 
     for i in range(len(nums) + 1):
       while stack and (i == len(nums) or nums[stack[-1]] > nums[i]):
@@ -11,4 +11,4 @@ def maxSumMinProduct(self, nums: list[int]) -> int:
         ans = max(ans, minVal * summ)
       stack.append(i)
 
-    return ans % 1_000_000_007
+    return ans % int(1e9 + 7)
diff --git a/solutions/1857. Largest Color Value in a Directed Graph/1857.java b/solutions/1857. Largest Color Value in a Directed Graph/1857.java
index 162654e46d2..46df0c76b77 100644
--- a/solutions/1857. Largest Color Value in a Directed Graph/1857.java	
+++ b/solutions/1857. Largest Color Value in a Directed Graph/1857.java	
@@ -6,7 +6,9 @@ public int largestPathValue(String colors, int[][] edges) {
     List<Integer>[] graph = new List[n];
     int[] inDegrees = new int[n];
     int[][] count = new int[n][26];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     // Build the graph.
     for (int[] edge : edges) {
diff --git a/solutions/1857. Largest Color Value in a Directed Graph/1857.py b/solutions/1857. Largest Color Value in a Directed Graph/1857.py
index d85481774b6..3611ff4c2cd 100644
--- a/solutions/1857. Largest Color Value in a Directed Graph/1857.py	
+++ b/solutions/1857. Largest Color Value in a Directed Graph/1857.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestPathValue(self, colors: str, edges: list[list[int]]) -> int:
+  def largestPathValue(self, colors: str, edges: List[List[int]]) -> int:
     n = len(colors)
     ans = 0
     processed = 0
diff --git a/solutions/1858. Longest Word With All Prefixes/1858.py b/solutions/1858. Longest Word With All Prefixes/1858.py
index 79e72c4d988..d6ee9ad65a6 100644
--- a/solutions/1858. Longest Word With All Prefixes/1858.py	
+++ b/solutions/1858. Longest Word With All Prefixes/1858.py	
@@ -2,7 +2,7 @@ class Solution:
   def __init__(self):
     self.root = {}
 
-  def longestWord(self, words: list[str]) -> str:
+  def longestWord(self, words: List[str]) -> str:
     ans = ''
 
     for word in words:
diff --git a/solutions/1859. Sorting the Sentence/1859.cpp b/solutions/1859. Sorting the Sentence/1859.cpp
index 8512d7db4e3..acac3eb5928 100644
--- a/solutions/1859. Sorting the Sentence/1859.cpp	
+++ b/solutions/1859. Sorting the Sentence/1859.cpp	
@@ -8,8 +8,9 @@ class Solution {
     while (iss >> word)
       words.push_back(word);
 
-    ranges::sort(words, ranges::less(),
-                 [](const string& word) { return word.back(); });
+    ranges::sort(words, [](const string& a, const string& b) {
+      return a.back() < b.back();
+    });
 
     string ans = trim(words[0]);
 
diff --git a/solutions/1859. Sorting the Sentence/1859.py b/solutions/1859. Sorting the Sentence/1859.py
index cc71c414f21..35a46df314f 100644
--- a/solutions/1859. Sorting the Sentence/1859.py	
+++ b/solutions/1859. Sorting the Sentence/1859.py	
@@ -1,4 +1,3 @@
 class Solution:
   def sortSentence(self, s: str) -> str:
-    return ' '.join([word[:-1]
-                     for word in sorted(s.split(), key=lambda x: x[-1])])
+    return ' '.join([w[:-1] for w in sorted(s.split(), key=lambda x: x[-1])])
diff --git a/solutions/186. Reverse Words in a String II/186.cpp b/solutions/186. Reverse Words in a String II/186.cpp
index 024fe6af17a..0cd08d4f589 100644
--- a/solutions/186. Reverse Words in a String II/186.cpp	
+++ b/solutions/186. Reverse Words in a String II/186.cpp	
@@ -1,8 +1,8 @@
 class Solution {
  public:
   void reverseWords(vector<char>& s) {
-    ranges::reverse(s);         // Reverse the whole string.
-    reverseWords(s, s.size());  // Reverse each word.
+    reverse(s.begin(), s.end());  // Reverse the whole string.
+    reverseWords(s, s.size());    // Reverse each word.
   }
 
  private:
diff --git a/solutions/186. Reverse Words in a String II/186.py b/solutions/186. Reverse Words in a String II/186.py
index fdbfb4ad0af..37fd8d0138e 100644
--- a/solutions/186. Reverse Words in a String II/186.py	
+++ b/solutions/186. Reverse Words in a String II/186.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def reverseWords(self, s: list[str]) -> None:
+  def reverseWords(self, s: List[str]) -> None:
     def reverse(l: int, r: int) -> None:
       while l < r:
         s[l], s[r] = s[r], s[l]
diff --git a/solutions/1860. Incremental Memory Leak/1860.py b/solutions/1860. Incremental Memory Leak/1860.py
index 8662bcdc0cc..a7225b2f3e5 100644
--- a/solutions/1860. Incremental Memory Leak/1860.py	
+++ b/solutions/1860. Incremental Memory Leak/1860.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def memLeak(self, memory1: int, memory2: int) -> list[int]:
+  def memLeak(self, memory1: int, memory2: int) -> List[int]:
     i = 1
 
     while memory1 >= i or memory2 >= i:
diff --git a/solutions/1861. Rotating the Box/1861.java b/solutions/1861. Rotating the Box/1861.java
index 56f84857e80..a9686bae3db 100644
--- a/solutions/1861. Rotating the Box/1861.java	
+++ b/solutions/1861. Rotating the Box/1861.java	
@@ -3,7 +3,7 @@ public char[][] rotateTheBox(char[][] box) {
     final int m = box.length;
     final int n = box[0].length;
     char[][] ans = new char[n][m];
-    Arrays.stream(ans).forEach(A -> Arrays.fill(A, '.'));
+    Arrays.stream(ans).forEach(row -> Arrays.fill(row, '.'));
 
     for (int i = 0; i < m; ++i)
       for (int j = n - 1, k = n - 1; j >= 0; --j)
diff --git a/solutions/1861. Rotating the Box/1861.py b/solutions/1861. Rotating the Box/1861.py
index 452f61709bc..d0df35ea468 100644
--- a/solutions/1861. Rotating the Box/1861.py	
+++ b/solutions/1861. Rotating the Box/1861.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def rotateTheBox(self, box: list[list[str]]) -> list[list[str]]:
+  def rotateTheBox(self, box: List[List[str]]) -> List[List[str]]:
     m = len(box)
     n = len(box[0])
     rotated = [['.'] * m for _ in range(n)]
diff --git a/solutions/1862. Sum of Floored Pairs/1862.java b/solutions/1862. Sum of Floored Pairs/1862.java
index 5b68f21c747..747e843b901 100644
--- a/solutions/1862. Sum of Floored Pairs/1862.java	
+++ b/solutions/1862. Sum of Floored Pairs/1862.java	
@@ -1,27 +1,27 @@
 class Solution {
   public int sumOfFlooredPairs(int[] nums) {
-    final int MOD = 1_000_000_007;
-    final int MAX = Arrays.stream(nums).max().getAsInt();
+    final int kMod = 1_000_000_007;
+    final int kMax = Arrays.stream(nums).max().getAsInt();
     long ans = 0;
     // count[i] := the number of `nums` <= i
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (final int num : nums)
       ++count[num];
 
-    for (int i = 1; i <= MAX; ++i)
+    for (int i = 1; i <= kMax; ++i)
       count[i] += count[i - 1];
 
-    for (int i = 1; i <= MAX; ++i)
+    for (int i = 1; i <= kMax; ++i)
       if (count[i] > count[i - 1]) {
         long sum = 0;
-        for (int j = 1; i * j <= MAX; ++j) {
+        for (int j = 1; i * j <= kMax; ++j) {
           final int lo = i * j - 1;
           final int hi = i * (j + 1) - 1;
-          sum += (count[Math.min(hi, MAX)] - count[lo]) * j;
+          sum += (count[Math.min(hi, kMax)] - count[lo]) * (long) j;
         }
         ans += sum * (count[i] - count[i - 1]);
-        ans %= MOD;
+        ans %= kMod;
       }
 
     return (int) ans;
diff --git a/solutions/1862. Sum of Floored Pairs/1862.py b/solutions/1862. Sum of Floored Pairs/1862.py
index 23ebc38acba..a9c1f5296e8 100644
--- a/solutions/1862. Sum of Floored Pairs/1862.py	
+++ b/solutions/1862. Sum of Floored Pairs/1862.py	
@@ -1,26 +1,26 @@
 class Solution:
-  def sumOfFlooredPairs(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-    MAX = max(nums)
+  def sumOfFlooredPairs(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
+    kMax = max(nums)
     ans = 0
-    count = [0] * (MAX + 1)
+    count = [0] * (kMax + 1)
 
     for num in nums:
       count[num] += 1
 
-    for i in range(1, MAX + 1):
+    for i in range(1, kMax + 1):
       count[i] += count[i - 1]
 
-    for i in range(1, MAX + 1):
+    for i in range(1, kMax + 1):
       if count[i] > count[i - 1]:
         summ = 0
         j = 1
-        while i * j <= MAX:
+        while i * j <= kMax:
           lo = i * j - 1
           hi = i * (j + 1) - 1
-          summ += (count[min(hi, MAX)] - count[lo]) * j
+          summ += (count[min(hi, kMax)] - count[lo]) * j
           j += 1
         ans += summ * (count[i] - count[i - 1])
-        ans %= MOD
+        ans %= kMod
 
     return ans
diff --git a/solutions/1863. Sum of All Subset XOR Totals/1863-2.py b/solutions/1863. Sum of All Subset XOR Totals/1863-2.py
index 81a0dc96be4..2d84b90bc08 100644
--- a/solutions/1863. Sum of All Subset XOR Totals/1863-2.py	
+++ b/solutions/1863. Sum of All Subset XOR Totals/1863-2.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def subsetXORSum(self, nums: list[int]) -> int:
+  def subsetXORSum(self, nums: List[int]) -> int:
     return functools.reduce(operator.or_, nums) << len(nums) - 1
diff --git a/solutions/1863. Sum of All Subset XOR Totals/1863.py b/solutions/1863. Sum of All Subset XOR Totals/1863.py
index de229971eef..0944e919de1 100644
--- a/solutions/1863. Sum of All Subset XOR Totals/1863.py	
+++ b/solutions/1863. Sum of All Subset XOR Totals/1863.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def subsetXORSum(self, nums: list[int]) -> int:
+  def subsetXORSum(self, nums: List[int]) -> int:
     def dfs(i: int, xors: int) -> int:
       if i == len(nums):
         return xors
diff --git a/solutions/1865. Finding Pairs With a Certain Sum/1865.py b/solutions/1865. Finding Pairs With a Certain Sum/1865.py
index 39ab149ee53..69c33d25220 100644
--- a/solutions/1865. Finding Pairs With a Certain Sum/1865.py	
+++ b/solutions/1865. Finding Pairs With a Certain Sum/1865.py	
@@ -1,5 +1,5 @@
 class FindSumPairs:
-  def __init__(self, nums1: list[int], nums2: list[int]):
+  def __init__(self, nums1: List[int], nums2: List[int]):
     self.nums1 = nums1
     self.nums2 = nums2
     self.count2 = collections.Counter(nums2)
diff --git a/solutions/1866. Number of Ways to Rearrange Sticks With K Sticks Visible/1866.java b/solutions/1866. Number of Ways to Rearrange Sticks With K Sticks Visible/1866.java
index 1cdff2cb465..78add4a27b3 100644
--- a/solutions/1866. Number of Ways to Rearrange Sticks With K Sticks Visible/1866.java	
+++ b/solutions/1866. Number of Ways to Rearrange Sticks With K Sticks Visible/1866.java	
@@ -8,9 +8,9 @@ public int rearrangeSticks(int n, int k) {
       return dp[n][k];
     return dp[n][k] = (int) (((long) rearrangeSticks(n - 1, k - 1) +
                               (long) rearrangeSticks(n - 1, k) * (n - 1)) %
-                             MOD);
+                             kMod);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
   private int[][] dp = new int[1001][1001];
 }
diff --git a/solutions/1866. Number of Ways to Rearrange Sticks With K Sticks Visible/1866.py b/solutions/1866. Number of Ways to Rearrange Sticks With K Sticks Visible/1866.py
index 130dc362cb5..ff49f45ae91 100644
--- a/solutions/1866. Number of Ways to Rearrange Sticks With K Sticks Visible/1866.py	
+++ b/solutions/1866. Number of Ways to Rearrange Sticks With K Sticks Visible/1866.py	
@@ -6,6 +6,6 @@ def rearrangeSticks(self, n: int, k: int) -> int:
     if k == 0:
       return 0
     return (self.rearrangeSticks(n - 1, k - 1) +
-            self.rearrangeSticks(n - 1, k) * (n - 1)) % self.MOD
+            self.rearrangeSticks(n - 1, k) * (n - 1)) % self.kMod
 
-  MOD = 1_000_000_007
+  kMod = 1_000_000_007
diff --git a/solutions/1868. Product of Two Run-Length Encoded Arrays/1868.py b/solutions/1868. Product of Two Run-Length Encoded Arrays/1868.py
index 81858618fcc..fb19e6715e8 100644
--- a/solutions/1868. Product of Two Run-Length Encoded Arrays/1868.py	
+++ b/solutions/1868. Product of Two Run-Length Encoded Arrays/1868.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def findRLEArray(self, encoded1: list[list[int]],
-                   encoded2: list[list[int]]) -> list[list[int]]:
+  def findRLEArray(self, encoded1: List[List[int]],
+                   encoded2: List[List[int]]) -> List[List[int]]:
     ans = []
     i = 0  # encoded1's index
     j = 0  # encoded2's index
diff --git a/solutions/187. Repeated DNA Sequences/187.py b/solutions/187. Repeated DNA Sequences/187.py
index b8b3697923b..3ab1663badf 100644
--- a/solutions/187. Repeated DNA Sequences/187.py	
+++ b/solutions/187. Repeated DNA Sequences/187.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findRepeatedDnaSequences(self, s: str) -> list[str]:
+  def findRepeatedDnaSequences(self, s: str) -> List[str]:
     ans = set()
     seen = set()
 
diff --git a/solutions/1870. Minimum Speed to Arrive on Time/1870.cpp b/solutions/1870. Minimum Speed to Arrive on Time/1870.cpp
index 65fa57e02ae..968e8011546 100644
--- a/solutions/1870. Minimum Speed to Arrive on Time/1870.cpp	
+++ b/solutions/1870. Minimum Speed to Arrive on Time/1870.cpp	
@@ -3,7 +3,7 @@ class Solution {
   int minSpeedOnTime(vector<int>& dist, double hour) {
     int ans = -1;
     int l = 1;
-    int r = 10'000'000;
+    int r = 1e7;
 
     while (l <= r) {
       const int m = (l + r) / 2;
diff --git a/solutions/1870. Minimum Speed to Arrive on Time/1870.java b/solutions/1870. Minimum Speed to Arrive on Time/1870.java
index 9626d2eaddd..955d223c11c 100644
--- a/solutions/1870. Minimum Speed to Arrive on Time/1870.java	
+++ b/solutions/1870. Minimum Speed to Arrive on Time/1870.java	
@@ -2,7 +2,7 @@ class Solution {
   public int minSpeedOnTime(int[] dist, double hour) {
     int ans = -1;
     int l = 1;
-    int r = 10_000_000;
+    int r = (int) 1e7;
 
     while (l <= r) {
       final int m = (l + r) / 2;
diff --git a/solutions/1870. Minimum Speed to Arrive on Time/1870.py b/solutions/1870. Minimum Speed to Arrive on Time/1870.py
index 52e33961f55..fa8fdf88544 100644
--- a/solutions/1870. Minimum Speed to Arrive on Time/1870.py	
+++ b/solutions/1870. Minimum Speed to Arrive on Time/1870.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minSpeedOnTime(self, dist: list[int], hour: float) -> int:
+  def minSpeedOnTime(self, dist: List[int], hour: float) -> int:
     ans = -1
     l = 1
     r = int(1e7)
diff --git a/solutions/1872. Stone Game VIII/1872.py b/solutions/1872. Stone Game VIII/1872.py
index fb7531afaae..5246789c208 100644
--- a/solutions/1872. Stone Game VIII/1872.py	
+++ b/solutions/1872. Stone Game VIII/1872.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def stoneGameVIII(self, stones: list[int]) -> int:
+  def stoneGameVIII(self, stones: List[int]) -> int:
     n = len(stones)
     prefix = list(itertools.accumulate(stones))
     # dp[i] := the maximum score difference the current player can get when the
diff --git a/solutions/1874. Minimize Product Sum of Two Arrays/1874.py b/solutions/1874. Minimize Product Sum of Two Arrays/1874.py
index fd86339d757..f231d951e8a 100644
--- a/solutions/1874. Minimize Product Sum of Two Arrays/1874.py	
+++ b/solutions/1874. Minimize Product Sum of Two Arrays/1874.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def minProductSum(self, nums1: list[int], nums2: list[int]) -> int:
+  def minProductSum(self, nums1: List[int], nums2: List[int]) -> int:
     return sum([a * b for a, b in zip(sorted(nums1), sorted(nums2, reverse=True))])
diff --git a/solutions/1877. Minimize Maximum Pair Sum in Array/1877.py b/solutions/1877. Minimize Maximum Pair Sum in Array/1877.py
index 56ae4cd82a6..d72ba5da94f 100644
--- a/solutions/1877. Minimize Maximum Pair Sum in Array/1877.py	
+++ b/solutions/1877. Minimize Maximum Pair Sum in Array/1877.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def minPairSum(self, nums: list[int]) -> int:
+  def minPairSum(self, nums: List[int]) -> int:
     nums.sort()
     return max(nums[i] + nums[len(nums) - 1 - i] for i in range(len(nums) // 2))
diff --git a/solutions/1878. Get Biggest Three Rhombus Sums in a Grid/1878.py b/solutions/1878. Get Biggest Three Rhombus Sums in a Grid/1878.py
index f7b6ca01edc..5a89f412d05 100644
--- a/solutions/1878. Get Biggest Three Rhombus Sums in a Grid/1878.py	
+++ b/solutions/1878. Get Biggest Three Rhombus Sums in a Grid/1878.py	
@@ -2,7 +2,7 @@
 
 
 class Solution:
-  def getBiggestThree(self, grid: list[list[int]]) -> list[int]:
+  def getBiggestThree(self, grid: List[List[int]]) -> List[int]:
     m = len(grid)
     n = len(grid[0])
     sums = SortedSet()
@@ -19,7 +19,7 @@ def getBiggestThree(self, grid: list[list[int]]) -> list[int]:
 
     return sums
 
-  def _getSum(self, grid: list[list[int]], i: int, j: int, sz: int) -> int:
+  def _getSum(self, grid: List[List[int]], i: int, j: int, sz: int) -> int:
     """
     Returns the sum of the rhombus, where the top grid is (i, j) and the edge
     size is `sz`.
diff --git a/solutions/1879. Minimum XOR Sum of Two Arrays/1879.py b/solutions/1879. Minimum XOR Sum of Two Arrays/1879.py
index d52b2ee22dc..2b84aa88f76 100644
--- a/solutions/1879. Minimum XOR Sum of Two Arrays/1879.py	
+++ b/solutions/1879. Minimum XOR Sum of Two Arrays/1879.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumXORSum(self, nums1: list[int], nums2: list[int]) -> int:
+  def minimumXORSum(self, nums1: List[int], nums2: List[int]) -> int:
     @functools.lru_cache(None)
     def dp(mask: int) -> int:
       i = mask.bit_count()
diff --git a/solutions/188. Best Time to Buy and Sell Stock IV/188.py b/solutions/188. Best Time to Buy and Sell Stock IV/188.py
index fd2065fa918..d96e5959f1f 100644
--- a/solutions/188. Best Time to Buy and Sell Stock IV/188.py	
+++ b/solutions/188. Best Time to Buy and Sell Stock IV/188.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxProfit(self, k: int, prices: list[int]) -> int:
+  def maxProfit(self, k: int, prices: List[int]) -> int:
     if k >= len(prices) // 2:
       sell = 0
       hold = -math.inf
diff --git a/solutions/1880. Check if Word Equals Summation of Two Words/1880.py b/solutions/1880. Check if Word Equals Summation of Two Words/1880.py
index 0bd15c4c9bf..ef584c9a77d 100644
--- a/solutions/1880. Check if Word Equals Summation of Two Words/1880.py	
+++ b/solutions/1880. Check if Word Equals Summation of Two Words/1880.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def isSumEqual(
-      self,
-      firstWord: str,
-      secondWord: str,
-      targetWord: str,
-  ) -> bool:
+  def isSumEqual(self, firstWord: str, secondWord: str, targetWord: str) -> bool:
     first = self._getNumber(firstWord)
     second = self._getNumber(secondWord)
     target = self._getNumber(targetWord)
@@ -13,5 +8,5 @@ def isSumEqual(
   def _getNumber(self, word: str) -> int:
     num = 0
     for c in word:
-      num = num * 10 + ord(c) - ord('a')
+      num = num * 10 + (ord(c) - ord('a'))
     return num
diff --git a/solutions/1881. Maximum Value after Insertion/1881.py b/solutions/1881. Maximum Value after Insertion/1881.py
index 116f692e812..0e6363602cc 100644
--- a/solutions/1881. Maximum Value after Insertion/1881.py	
+++ b/solutions/1881. Maximum Value after Insertion/1881.py	
@@ -3,7 +3,7 @@ def maxValue(self, n: str, x: int) -> str:
     isNegative = n[0] == '-'
 
     for i, c in enumerate(n):
-      if not isNegative and int(c) < x or isNegative and int(c) > x:
+      if not isNegative and ord(c) - ord('0') < x or isNegative and ord(c) - ord('0') > x:
         return n[:i] + str(x) + n[i:]
 
     return n + str(x)
diff --git a/solutions/1882. Process Tasks Using Servers/1882.cpp b/solutions/1882. Process Tasks Using Servers/1882.cpp
index 19506718aa2..6019ae6a1a3 100644
--- a/solutions/1882. Process Tasks Using Servers/1882.cpp	
+++ b/solutions/1882. Process Tasks Using Servers/1882.cpp	
@@ -2,6 +2,8 @@ struct T {
   int weight;
   int index;
   int freeTime;
+  T(int weight, int index, int freeTime)
+      : weight(weight), index(index), freeTime(freeTime) {}
 };
 
 class Solution {
diff --git a/solutions/1882. Process Tasks Using Servers/1882.java b/solutions/1882. Process Tasks Using Servers/1882.java
index d1981a8ebcb..ad042b80ecc 100644
--- a/solutions/1882. Process Tasks Using Servers/1882.java	
+++ b/solutions/1882. Process Tasks Using Servers/1882.java	
@@ -15,10 +15,17 @@ public int[] assignTasks(int[] servers, int[] tasks) {
     final int m = tasks.length;
     int[] ans = new int[m];
     Queue<T> free = new PriorityQueue<>(
-        Comparator.comparing((T t) -> t.weight).thenComparing((T t) -> t.index));
-    Queue<T> used = new PriorityQueue<>(Comparator.comparing((T t) -> t.freeTime)
-                                            .thenComparing((T t) -> t.weight)
-                                            .thenComparing((T t) -> t.index));
+        (a, b) -> a.weight == b.weight ? a.index - b.index : a.weight - b.weight);
+    Queue<T> used = new PriorityQueue<>(new Comparator<T>() {
+      @Override
+      public int compare(T a, T b) {
+        if (a.freeTime != b.freeTime)
+          return a.freeTime - b.freeTime;
+        if (a.weight != b.weight)
+          return a.weight - b.weight;
+        return a.index - b.index;
+      }
+    });
 
     for (int i = 0; i < n; ++i)
       free.offer(new T(servers[i], i, 0));
diff --git a/solutions/1882. Process Tasks Using Servers/1882.py b/solutions/1882. Process Tasks Using Servers/1882.py
index 2fe37e6c3d5..8a4284066bf 100644
--- a/solutions/1882. Process Tasks Using Servers/1882.py	
+++ b/solutions/1882. Process Tasks Using Servers/1882.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def assignTasks(self, servers: list[int], tasks: list[int]) -> list[int]:
+  def assignTasks(self, servers: List[int], tasks: List[int]) -> List[int]:
     ans = []
     free = []  # (weight, index, freeTime)
     used = []  # (freeTime, weight, index)
diff --git a/solutions/1883. Minimum Skips to Arrive at Meeting On Time/1883.cpp b/solutions/1883. Minimum Skips to Arrive at Meeting On Time/1883.cpp
index 0664e02e20d..0ba136692fa 100644
--- a/solutions/1883. Minimum Skips to Arrive at Meeting On Time/1883.cpp	
+++ b/solutions/1883. Minimum Skips to Arrive at Meeting On Time/1883.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int minSkips(vector<int>& dist, int speed, int hoursBefore) {
-    constexpr double kInf = 10'000'000;
+    constexpr double kInf = 1e7;
     constexpr double kEps = 1e-9;
     const int n = dist.size();
     // dp[i][j] := the minimum time, where i is the number of roads we traversed
diff --git a/solutions/1883. Minimum Skips to Arrive at Meeting On Time/1883.java b/solutions/1883. Minimum Skips to Arrive at Meeting On Time/1883.java
index e10f4c39328..71a4cf53752 100644
--- a/solutions/1883. Minimum Skips to Arrive at Meeting On Time/1883.java	
+++ b/solutions/1883. Minimum Skips to Arrive at Meeting On Time/1883.java	
@@ -1,20 +1,20 @@
 class Solution {
   public int minSkips(int[] dist, int speed, int hoursBefore) {
-    final double INF = 1e7;
-    final double EPS = 1e-9;
+    final double kInf = 1e7;
+    final double kEps = 1e-9;
     final int n = dist.length;
     // dp[i][j] := the minimum time, where i is the number of roads we traversed
     // so far and j is the number of skips we did
     double[][] dp = new double[n + 1][n + 1];
-    Arrays.stream(dp).forEach(A -> Arrays.fill(A, INF));
+    Arrays.stream(dp).forEach(A -> Arrays.fill(A, kInf));
     dp[0][0] = 0;
 
     for (int i = 1; i <= n; ++i) {
       final double d = dist[i - 1];
-      dp[i][0] = Math.ceil(dp[i - 1][0] + d / speed - EPS);
+      dp[i][0] = Math.ceil(dp[i - 1][0] + d / speed - kEps);
       for (int j = 1; j <= i; ++j)
         dp[i][j] =
-            Math.min(dp[i - 1][j - 1] + d / speed, Math.ceil(dp[i - 1][j] + d / speed - EPS));
+            Math.min(dp[i - 1][j - 1] + d / speed, Math.ceil(dp[i - 1][j] + d / speed - kEps));
     }
 
     for (int j = 0; j <= n; ++j)
diff --git a/solutions/1883. Minimum Skips to Arrive at Meeting On Time/1883.py b/solutions/1883. Minimum Skips to Arrive at Meeting On Time/1883.py
index abd93da9652..d422cd64d98 100644
--- a/solutions/1883. Minimum Skips to Arrive at Meeting On Time/1883.py	
+++ b/solutions/1883. Minimum Skips to Arrive at Meeting On Time/1883.py	
@@ -1,18 +1,18 @@
 class Solution:
-  def minSkips(self, dist: list[int], speed: int, hoursBefore: int) -> int:
-    INF = 10**7
-    EPS = 1e-9
+  def minSkips(self, dist: List[int], speed: int, hoursBefore: int) -> int:
+    kInf = 10**7
+    kEps = 1e-9
     n = len(dist)
     # dp[i][j] := the minimum time, where i is the number of roads we traversed
     # so far and j is the number of skips we did
-    dp = [[INF] * (n + 1) for _ in range(n + 1)]
+    dp = [[kInf] * (n + 1) for _ in range(n + 1)]
     dp[0][0] = 0
 
     for i, d in enumerate(dist, 1):
-      dp[i][0] = math.ceil(dp[i - 1][0] + d / speed - EPS)
+      dp[i][0] = math.ceil(dp[i - 1][0] + d / speed - kEps)
       for j in range(1, i + 1):
         dp[i][j] = min(dp[i - 1][j - 1] + d / speed,
-                       math.ceil(dp[i - 1][j] + d / speed - EPS))
+                       math.ceil(dp[i - 1][j] + d / speed - kEps))
 
     for j, time in enumerate(dp[-1]):
       if time <= hoursBefore:
diff --git a/solutions/1885. Count Pairs in Two Arrays/1885.cpp b/solutions/1885. Count Pairs in Two Arrays/1885.cpp
index 147380ed89e..2f197ae8b4b 100644
--- a/solutions/1885. Count Pairs in Two Arrays/1885.cpp	
+++ b/solutions/1885. Count Pairs in Two Arrays/1885.cpp	
@@ -2,16 +2,16 @@ class Solution {
  public:
   long long countPairs(vector<int>& nums1, vector<int>& nums2) {
     long ans = 0;
-    vector<int> arr(nums1.size());
+    vector<int> A(nums1.size());
 
-    for (int i = 0; i < arr.size(); ++i)
-      arr[i] = nums1[i] - nums2[i];
+    for (int i = 0; i < A.size(); ++i)
+      A[i] = nums1[i] - nums2[i];
 
-    ranges::sort(arr);
+    ranges::sort(A);
 
-    for (int i = 0; i < arr.size(); ++i) {
-      const auto it = lower_bound(arr.begin() + i + 1, arr.end(), -arr[i] + 1);
-      ans += arr.cend() - it;
+    for (int i = 0; i < A.size(); ++i) {
+      const auto it = lower_bound(A.begin() + i + 1, A.end(), -A[i] + 1);
+      ans += A.cend() - it;
     }
 
     return ans;
diff --git a/solutions/1885. Count Pairs in Two Arrays/1885.java b/solutions/1885. Count Pairs in Two Arrays/1885.java
index 99802098f51..8203ad5d6f1 100644
--- a/solutions/1885. Count Pairs in Two Arrays/1885.java	
+++ b/solutions/1885. Count Pairs in Two Arrays/1885.java	
@@ -1,27 +1,27 @@
 class Solution {
   public long countPairs(int[] nums1, int[] nums2) {
     long ans = 0;
-    int[] arr = new int[nums1.length]; // arr[i] = nums1[i] - nums2[i]
+    int[] A = new int[nums1.length]; // A[i] = nums1[i] - nums2[i]
 
-    for (int i = 0; i < arr.length; ++i)
-      arr[i] = nums1[i] - nums2[i];
+    for (int i = 0; i < A.length; ++i)
+      A[i] = nums1[i] - nums2[i];
 
-    Arrays.sort(arr);
+    Arrays.sort(A);
 
-    for (int i = 0; i < arr.length; ++i) {
-      final int index = firstGreater(arr, -arr[i]);
-      ans += arr.length - Math.max(i + 1, index);
+    for (int i = 0; i < A.length; ++i) {
+      final int index = firstGreater(A, -A[i]);
+      ans += A.length - Math.max(i + 1, index);
     }
 
     return ans;
   }
 
-  private int firstGreater(int[] arr, int target) {
+  private int firstGreater(int[] A, int target) {
     int l = 0;
-    int r = arr.length;
+    int r = A.length;
     while (l < r) {
       final int m = (l + r) / 2;
-      if (arr[m] > target)
+      if (A[m] > target)
         r = m;
       else
         l = m + 1;
diff --git a/solutions/1885. Count Pairs in Two Arrays/1885.py b/solutions/1885. Count Pairs in Two Arrays/1885.py
index 3b738d6a567..c507414869c 100644
--- a/solutions/1885. Count Pairs in Two Arrays/1885.py	
+++ b/solutions/1885. Count Pairs in Two Arrays/1885.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def countPairs(self, nums1: list[int], nums2: list[int]) -> int:
+  def countPairs(self, nums1: List[int], nums2: List[int]) -> int:
     ans = 0
-    arr = sorted([x - y for x, y in zip(nums1, nums2)])
+    A = sorted([x - y for x, y in zip(nums1, nums2)])
 
-    for i, a in enumerate(arr):
-      index = bisect_left(arr, -a + 1)
-      ans += len(arr) - max(i + 1, index)
+    for i, a in enumerate(A):
+      index = bisect_left(A, -a + 1)
+      ans += len(A) - max(i + 1, index)
 
     return ans
diff --git a/solutions/1886. Determine Whether Matrix Can Be Obtained By Rotation/1886.cpp b/solutions/1886. Determine Whether Matrix Can Be Obtained By Rotation/1886.cpp
index 7d1d05c8b67..494e82051b5 100644
--- a/solutions/1886. Determine Whether Matrix Can Be Obtained By Rotation/1886.cpp	
+++ b/solutions/1886. Determine Whether Matrix Can Be Obtained By Rotation/1886.cpp	
@@ -10,10 +10,10 @@ class Solution {
   }
 
  private:
-  void rotate(vector<vector<int>>& mat) {
-    ranges::reverse(mat);
-    for (int i = 0; i < mat.size(); ++i)
-      for (int j = i + 1; j < mat.size(); ++j)
-        swap(mat[i][j], mat[j][i]);
+  void rotate(vector<vector<int>>& M) {
+    reverse(M.begin(), M.end());
+    for (int i = 0; i < M.size(); ++i)
+      for (int j = i + 1; j < M.size(); ++j)
+        swap(M[i][j], M[j][i]);
   }
 };
diff --git a/solutions/1886. Determine Whether Matrix Can Be Obtained By Rotation/1886.java b/solutions/1886. Determine Whether Matrix Can Be Obtained By Rotation/1886.java
index a4aae7378ac..b0cfd18fa41 100644
--- a/solutions/1886. Determine Whether Matrix Can Be Obtained By Rotation/1886.java	
+++ b/solutions/1886. Determine Whether Matrix Can Be Obtained By Rotation/1886.java	
@@ -8,17 +8,17 @@ public boolean findRotation(int[][] mat, int[][] target) {
     return false;
   }
 
-  private void rotate(int[][] mat) {
-    for (int i = 0, j = mat.length - 1; i < j; ++i, --j) {
-      int[] temp = mat[i];
-      mat[i] = mat[j];
-      mat[j] = temp;
+  private void rotate(int[][] M) {
+    for (int i = 0, j = M.length - 1; i < j; ++i, --j) {
+      int[] temp = M[i];
+      M[i] = M[j];
+      M[j] = temp;
     }
-    for (int i = 0; i < mat.length; ++i)
-      for (int j = i + 1; j < mat.length; ++j) {
-        final int temp = mat[i][j];
-        mat[i][j] = mat[j][i];
-        mat[j][i] = temp;
+    for (int i = 0; i < M.length; ++i)
+      for (int j = i + 1; j < M.length; ++j) {
+        final int temp = M[i][j];
+        M[i][j] = M[j][i];
+        M[j][i] = temp;
       }
   }
 }
diff --git a/solutions/1886. Determine Whether Matrix Can Be Obtained By Rotation/1886.py b/solutions/1886. Determine Whether Matrix Can Be Obtained By Rotation/1886.py
index c6e258b4af0..0b558da9775 100644
--- a/solutions/1886. Determine Whether Matrix Can Be Obtained By Rotation/1886.py	
+++ b/solutions/1886. Determine Whether Matrix Can Be Obtained By Rotation/1886.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findRotation(self, mat: list[list[int]], target: list[list[int]]) -> bool:
+  def findRotation(self, mat: List[List[int]], target: List[List[int]]) -> bool:
     for _ in range(4):
       if mat == target:
         return True
diff --git a/solutions/1887. Reduction Operations to Make the Array Elements Equal/1887.py b/solutions/1887. Reduction Operations to Make the Array Elements Equal/1887.py
index 553ee1d4637..65291306030 100644
--- a/solutions/1887. Reduction Operations to Make the Array Elements Equal/1887.py	
+++ b/solutions/1887. Reduction Operations to Make the Array Elements Equal/1887.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def reductionOperations(self, nums: list[int]) -> int:
+  def reductionOperations(self, nums: List[int]) -> int:
     ans = 0
 
     nums.sort()
diff --git a/solutions/1888. Minimum Number of Flips to Make the Binary String Alternating/1888.py b/solutions/1888. Minimum Number of Flips to Make the Binary String Alternating/1888.py
index 743b85ef2ee..b9f248f0965 100644
--- a/solutions/1888. Minimum Number of Flips to Make the Binary String Alternating/1888.py	
+++ b/solutions/1888. Minimum Number of Flips to Make the Binary String Alternating/1888.py	
@@ -8,15 +8,15 @@ def minFlips(self, s: str) -> int:
     count = [[0] * 2 for _ in range(2)]
 
     for i, c in enumerate(s):
-      count[int(c)][i % 2] += 1
+      count[ord(c) - ord('0')][i % 2] += 1
 
     # min(make all 0s in the even indices + make all 1s in the odd indices,
     #     make all 1s in the even indices + make all 0s in the odd indices)
     ans = min(count[1][0] + count[0][1], count[0][0] + count[1][1])
 
     for i, c in enumerate(s):
-      count[int(c)][i % 2] -= 1
-      count[int(c)][(n + i) % 2] += 1
+      count[ord(c) - ord('0')][i % 2] -= 1
+      count[ord(c) - ord('0')][(n + i) % 2] += 1
       ans = min(ans, count[1][0] + count[0][1], count[0][0] + count[1][1])
 
     return ans
diff --git a/solutions/1889. Minimum Space Wasted From Packaging/1889.cpp b/solutions/1889. Minimum Space Wasted From Packaging/1889.cpp
index ba91e944345..f6f4e3d27d7 100644
--- a/solutions/1889. Minimum Space Wasted From Packaging/1889.cpp	
+++ b/solutions/1889. Minimum Space Wasted From Packaging/1889.cpp	
@@ -2,7 +2,7 @@ class Solution {
  public:
   int minWastedSpace(vector<int>& packages, vector<vector<int>>& boxes) {
     constexpr int kMod = 1'000'000'007;
-    constexpr long kInf = 100'000'000'000;
+    constexpr long kInf = 1e11;
     const long packagesSum = accumulate(packages.begin(), packages.end(), 0L);
     long minBoxesSum = kInf;
 
@@ -26,7 +26,7 @@ class Solution {
   }
 
  private:
-  int firstGreaterEqual(const vector<int>& arr, int target) {
-    return ranges::lower_bound(arr, target) - arr.begin();
+  int firstGreaterEqual(const vector<int>& A, int target) {
+    return ranges::lower_bound(A, target) - A.begin();
   }
 };
diff --git a/solutions/1889. Minimum Space Wasted From Packaging/1889.java b/solutions/1889. Minimum Space Wasted From Packaging/1889.java
index f40255644d5..ab46c36aab6 100644
--- a/solutions/1889. Minimum Space Wasted From Packaging/1889.java	
+++ b/solutions/1889. Minimum Space Wasted From Packaging/1889.java	
@@ -1,9 +1,9 @@
 class Solution {
   public int minWastedSpace(int[] packages, int[][] boxes) {
-    final int MOD = 1_000_000_007;
-    final long INF = (long) 1e11;
-    final long packagesSum = Arrays.stream(packages).asLongStream().sum();
-    long minBoxesSum = INF;
+    final int kMod = 1_000_000_007;
+    final long kInf = (long) 1e11;
+    final long packagesSum = Arrays.stream(packages).mapToLong(p -> p).sum();
+    long minBoxesSum = kInf;
 
     Arrays.sort(packages);
 
@@ -21,15 +21,15 @@ public int minWastedSpace(int[] packages, int[][] boxes) {
       minBoxesSum = Math.min(minBoxesSum, accu);
     }
 
-    return minBoxesSum == INF ? -1 : (int) ((minBoxesSum - packagesSum) % MOD);
+    return minBoxesSum == kInf ? -1 : (int) ((minBoxesSum - packagesSum) % kMod);
   }
 
-  private int firstGreaterEqual(int[] arr, int target) {
+  private int firstGreaterEqual(int[] A, int target) {
     int l = 0;
-    int r = arr.length;
+    int r = A.length;
     while (l < r) {
       final int m = (l + r) / 2;
-      if (arr[m] >= target)
+      if (A[m] >= target)
         r = m;
       else
         l = m + 1;
diff --git a/solutions/1889. Minimum Space Wasted From Packaging/1889.py b/solutions/1889. Minimum Space Wasted From Packaging/1889.py
index e74b9ea7c5b..5746a1cb135 100644
--- a/solutions/1889. Minimum Space Wasted From Packaging/1889.py	
+++ b/solutions/1889. Minimum Space Wasted From Packaging/1889.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minWastedSpace(self, packages: list[int], boxes: list[list[int]]) -> int:
+  def minWastedSpace(self, packages: List[int], boxes: List[List[int]]) -> int:
     ans = math.inf
 
     packages.sort()
@@ -16,4 +16,4 @@ def minWastedSpace(self, packages: list[int], boxes: list[list[int]]) -> int:
         i = j
       ans = min(ans, accu)
 
-    return -1 if ans == math.inf else (ans - sum(packages)) % 1_000_000_007
+    return -1 if ans == math.inf else (ans - sum(packages)) % int(1e9 + 7)
diff --git a/solutions/189. Rotate Array/189.py b/solutions/189. Rotate Array/189.py
index ddd70a7adfc..8745ce92644 100644
--- a/solutions/189. Rotate Array/189.py	
+++ b/solutions/189. Rotate Array/189.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def rotate(self, nums: list[int], k: int) -> None:
+  def rotate(self, nums: List[int], k: int) -> None:
     k %= len(nums)
     self.reverse(nums, 0, len(nums) - 1)
     self.reverse(nums, 0, k - 1)
     self.reverse(nums, k, len(nums) - 1)
 
-  def reverse(self, nums: list[int], l: int, r: int) -> None:
+  def reverse(self, nums: List[int], l: int, r: int) -> None:
     while l < r:
       nums[l], nums[r] = nums[r], nums[l]
       l += 1
diff --git a/solutions/1891. Cutting Ribbons/1891.py b/solutions/1891. Cutting Ribbons/1891.py
index b0fb100d8ca..0a8168c8b63 100644
--- a/solutions/1891. Cutting Ribbons/1891.py	
+++ b/solutions/1891. Cutting Ribbons/1891.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxLength(self, ribbons: list[int], k: int) -> int:
+  def maxLength(self, ribbons: List[int], k: int) -> int:
     def isCutPossible(length: int) -> bool:
       count = 0
       for ribbon in ribbons:
diff --git a/solutions/1893. Check if All the Integers in a Range Are Covered/1893-2.py b/solutions/1893. Check if All the Integers in a Range Are Covered/1893-2.py
index c88c63b2424..8ce7f845d59 100644
--- a/solutions/1893. Check if All the Integers in a Range Are Covered/1893-2.py	
+++ b/solutions/1893. Check if All the Integers in a Range Are Covered/1893-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isCovered(self, ranges: list[list[int]], left: int, right: int) -> bool:
+  def isCovered(self, ranges: List[List[int]], left: int, right: int) -> bool:
     seen = [0] * 52
 
     for l, r in ranges:
diff --git a/solutions/1893. Check if All the Integers in a Range Are Covered/1893.py b/solutions/1893. Check if All the Integers in a Range Are Covered/1893.py
index 62ebe996b0c..a47e29a5927 100644
--- a/solutions/1893. Check if All the Integers in a Range Are Covered/1893.py	
+++ b/solutions/1893. Check if All the Integers in a Range Are Covered/1893.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def isCovered(self, ranges: list[list[int]], left: int, right: int) -> bool:
+  def isCovered(self, ranges: List[List[int]], left: int, right: int) -> bool:
     return all(any(l <= i <= r for l, r in ranges) for i in range(
         left, right + 1))
diff --git a/solutions/1894. Find the Student that Will Replace the Chalk/1894.py b/solutions/1894. Find the Student that Will Replace the Chalk/1894.py
index caa23d3dafb..a06732b95b6 100644
--- a/solutions/1894. Find the Student that Will Replace the Chalk/1894.py	
+++ b/solutions/1894. Find the Student that Will Replace the Chalk/1894.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def chalkReplacer(self, chalk: list[int], k: int) -> int:
+  def chalkReplacer(self, chalk: List[int], k: int) -> int:
     k %= sum(chalk)
     if k == 0:
       return 0
diff --git a/solutions/1895. Largest Magic Square/1895.py b/solutions/1895. Largest Magic Square/1895.py
index 00cf625c5a4..e4fff807433 100644
--- a/solutions/1895. Largest Magic Square/1895.py	
+++ b/solutions/1895. Largest Magic Square/1895.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestMagicSquare(self, grid: list[list[int]]) -> int:
+  def largestMagicSquare(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
     # prefixRow[i][j] := the sum of the first j numbers in the i-th row
@@ -41,6 +41,6 @@ def containsMagicSquare(k: int) -> bool:
 
     return 1
 
-  def _getSum(self, prefix: list[list[int]], i: int, l: int, r: int) -> int:
+  def _getSum(self, prefix: List[List[int]], i: int, l: int, r: int) -> int:
     """Returns sum(grid[i][l..r]) or sum(grid[l..r][i])."""
     return prefix[i][r + 1] - prefix[i][l]
diff --git a/solutions/1897. Redistribute Characters to Make All Strings Equal/1897.py b/solutions/1897. Redistribute Characters to Make All Strings Equal/1897.py
index 6c86087a5e0..450610f14cf 100644
--- a/solutions/1897. Redistribute Characters to Make All Strings Equal/1897.py	
+++ b/solutions/1897. Redistribute Characters to Make All Strings Equal/1897.py	
@@ -1,4 +1,3 @@
 class Solution:
-  def makeEqual(self, words: list[str]) -> bool:
-    return all(c % len(words) == 0
-               for c in collections.Counter(''.join(words)).values())
+  def makeEqual(self, words: List[str]) -> bool:
+    return all(c % len(words) == 0 for c in collections.Counter(''.join(words)).values())
diff --git a/solutions/1898. Maximum Number of Removable Characters/1898.py b/solutions/1898. Maximum Number of Removable Characters/1898.py
index a20d77611da..bb4deafda2b 100644
--- a/solutions/1898. Maximum Number of Removable Characters/1898.py	
+++ b/solutions/1898. Maximum Number of Removable Characters/1898.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumRemovals(self, s: str, p: str, removable: list[int]) -> int:
+  def maximumRemovals(self, s: str, p: str, removable: List[int]) -> int:
     l = 0
     r = len(removable) + 1
 
diff --git a/solutions/1899. Merge Triplets to Form Target Triplet/1899.py b/solutions/1899. Merge Triplets to Form Target Triplet/1899.py
index ae358df74c3..7e6a30eba57 100644
--- a/solutions/1899. Merge Triplets to Form Target Triplet/1899.py	
+++ b/solutions/1899. Merge Triplets to Form Target Triplet/1899.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def mergeTriplets(self, triplets: list[list[int]], target: list[int]) -> bool:
+  def mergeTriplets(self, triplets: List[List[int]], target: List[int]) -> bool:
     merged = [0] * len(target)
 
     for triplet in triplets:
diff --git a/solutions/19. Remove Nth Node From End of List/19.cpp b/solutions/19. Remove Nth Node From End of List/19.cpp
index 8065471e988..0f5b94141f9 100644
--- a/solutions/19. Remove Nth Node From End of List/19.cpp	
+++ b/solutions/19. Remove Nth Node From End of List/19.cpp	
@@ -4,12 +4,12 @@ class Solution {
     ListNode* slow = head;
     ListNode* fast = head;
 
-    while (n-- > 0)
+    while (n--)
       fast = fast->next;
     if (fast == nullptr)
       return head->next;
 
-    while (fast->next != nullptr) {
+    while (fast->next) {
       slow = slow->next;
       fast = fast->next;
     }
diff --git a/solutions/190. Reverse Bits/190.java b/solutions/190. Reverse Bits/190.java
index fa5d69243bc..4b1b74a2ba7 100644
--- a/solutions/190. Reverse Bits/190.java	
+++ b/solutions/190. Reverse Bits/190.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   // You need treat n as an unsigned value
   public int reverseBits(int n) {
     int ans = 0;
diff --git a/solutions/1900. The Earliest and Latest Rounds Where Players Compete/1900.py b/solutions/1900. The Earliest and Latest Rounds Where Players Compete/1900.py
index 79024e3212d..0c3dc81a6ff 100644
--- a/solutions/1900. The Earliest and Latest Rounds Where Players Compete/1900.py	
+++ b/solutions/1900. The Earliest and Latest Rounds Where Players Compete/1900.py	
@@ -1,8 +1,8 @@
 class Solution:
   def earliestAndLatest(self, n: int,
-                        firstPlayer: int, secondPlayer: int) -> list[int]:
+                        firstPlayer: int, secondPlayer: int) -> List[int]:
     @functools.lru_cache(None)
-    def dp(l: int, r: int, k: int) -> list[int]:
+    def dp(l: int, r: int, k: int) -> List[int]:
       """
       Returns the (earliest, latest) pair, the first player is the l-th player
       from the front, the second player is the r-th player from the end, and
diff --git a/solutions/1901. Find a Peak Element II/1901.cpp b/solutions/1901. Find a Peak Element II/1901.cpp
index e9a2a75ce36..a13c479ce6a 100644
--- a/solutions/1901. Find a Peak Element II/1901.cpp	
+++ b/solutions/1901. Find a Peak Element II/1901.cpp	
@@ -16,11 +16,11 @@ class Solution {
   }
 
  private:
-  int getMaxIndex(const vector<int>& arr) {
-    pair<int, int> res{0, arr[0]};
-    for (int i = 1; i < arr.size(); ++i)
-      if (arr[i] > res.second)
-        res = {i, arr[i]};
+  int getMaxIndex(const vector<int>& A) {
+    pair<int, int> res{0, A[0]};
+    for (int i = 1; i < A.size(); ++i)
+      if (A[i] > res.second)
+        res = {i, A[i]};
     return res.first;
   }
 };
diff --git a/solutions/1901. Find a Peak Element II/1901.java b/solutions/1901. Find a Peak Element II/1901.java
index bca138a65f2..9db1c56583d 100644
--- a/solutions/1901. Find a Peak Element II/1901.java	
+++ b/solutions/1901. Find a Peak Element II/1901.java	
@@ -14,11 +14,11 @@ public int[] findPeakGrid(int[][] mat) {
     return new int[] {l, getMaxIndex(mat[l])};
   }
 
-  private int getMaxIndex(int[] arr) {
-    int[] res = {0, arr[0]};
-    for (int i = 1; i < arr.length; ++i)
-      if (arr[i] > res[1])
-        res = new int[] {i, arr[i]};
+  private int getMaxIndex(int[] A) {
+    int[] res = {0, A[0]};
+    for (int i = 1; i < A.length; ++i)
+      if (A[i] > res[1])
+        res = new int[] {i, A[i]};
     return res[0];
   }
 }
diff --git a/solutions/1901. Find a Peak Element II/1901.py b/solutions/1901. Find a Peak Element II/1901.py
index e07f44356d3..28adaa31a97 100644
--- a/solutions/1901. Find a Peak Element II/1901.py	
+++ b/solutions/1901. Find a Peak Element II/1901.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findPeakGrid(self, mat: list[list[int]]) -> list[int]:
+  def findPeakGrid(self, mat: List[List[int]]) -> List[int]:
     l = 0
     r = len(mat) - 1
 
diff --git a/solutions/1905. Count Sub Islands/1905.py b/solutions/1905. Count Sub Islands/1905.py
index f03d6991527..cfd4433c9c4 100644
--- a/solutions/1905. Count Sub Islands/1905.py	
+++ b/solutions/1905. Count Sub Islands/1905.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def countSubIslands(
-      self,
-      grid1: list[list[int]],
-      grid2: list[list[int]],
-  ) -> int:
+  def countSubIslands(self, grid1: List[List[int]], grid2: List[List[int]]) -> int:
     m = len(grid2)
     n = len(grid2[0])
 
@@ -15,8 +11,8 @@ def dfs(i: int, j: int) -> int:
 
       grid2[i][j] = 2  # Mark 2 as visited.
 
-      return (dfs(i + 1, j) & dfs(i - 1, j) &
-              dfs(i, j + 1) & dfs(i, j - 1) & grid1[i][j])
+      return dfs(i + 1, j) & dfs(i - 1, j) & \
+          dfs(i, j + 1) & dfs(i, j - 1) & grid1[i][j]
 
     ans = 0
 
diff --git a/solutions/1906. Minimum Absolute Difference Queries/1906.py b/solutions/1906. Minimum Absolute Difference Queries/1906.py
index e72836a7b22..607cc814a26 100644
--- a/solutions/1906. Minimum Absolute Difference Queries/1906.py	
+++ b/solutions/1906. Minimum Absolute Difference Queries/1906.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def minDifference(
-      self,
-      nums: list[int],
-      queries: list[list[int]],
-  ) -> list[int]:
+  def minDifference(self, nums: List[int], queries: List[List[int]]) -> List[int]:
     numToIndices = [[] for _ in range(101)]
 
     for i, num in enumerate(nums):
diff --git a/solutions/1908. Game of Nim/1908.py b/solutions/1908. Game of Nim/1908.py
index a39889bfbb5..1238a8a1abc 100644
--- a/solutions/1908. Game of Nim/1908.py	
+++ b/solutions/1908. Game of Nim/1908.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def nimGame(self, piles: list[int]) -> bool:
+  def nimGame(self, piles: List[int]) -> bool:
     return functools.reduce(operator.xor, piles) > 0
diff --git a/solutions/1909. Remove One Element to Make the Array Strictly Increasing/1909.py b/solutions/1909. Remove One Element to Make the Array Strictly Increasing/1909.py
index c778283f36b..81ed5fb69fd 100644
--- a/solutions/1909. Remove One Element to Make the Array Strictly Increasing/1909.py	
+++ b/solutions/1909. Remove One Element to Make the Array Strictly Increasing/1909.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canBeIncreasing(self, nums: list[int]) -> bool:
+  def canBeIncreasing(self, nums: List[int]) -> bool:
     removed = False
 
     for i in range(1, len(nums)):
diff --git a/solutions/191. Number of 1 Bits/191-2.java b/solutions/191. Number of 1 Bits/191-2.java
index 50fb180df7e..1cfb63b20ce 100644
--- a/solutions/191. Number of 1 Bits/191-2.java	
+++ b/solutions/191. Number of 1 Bits/191-2.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   // You need to treat n as an unsigned value
   public int hammingWeight(int n) {
     return Integer.bitCount(n);
diff --git a/solutions/191. Number of 1 Bits/191.java b/solutions/191. Number of 1 Bits/191.java
index 190363eea2c..05603a6bb0c 100644
--- a/solutions/191. Number of 1 Bits/191.java	
+++ b/solutions/191. Number of 1 Bits/191.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   // You need to treat n as an unsigned value
   public int hammingWeight(int n) {
     int ans = 0;
diff --git a/solutions/1911. Maximum Alternating Subsequence Sum/1911.py b/solutions/1911. Maximum Alternating Subsequence Sum/1911.py
index e2e22f9ff64..ed851a2ef1a 100644
--- a/solutions/1911. Maximum Alternating Subsequence Sum/1911.py	
+++ b/solutions/1911. Maximum Alternating Subsequence Sum/1911.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxAlternatingSum(self, nums: list[int]) -> int:
+  def maxAlternatingSum(self, nums: List[int]) -> int:
     even = 0  # the maximum alternating sum ending in an even index
     odd = 0  # the maximum alternating sum ending in an odd index
 
diff --git a/solutions/1912. Design Movie Rental System/1912.java b/solutions/1912. Design Movie Rental System/1912.java
index aa8d394d431..da5c72d3841 100644
--- a/solutions/1912. Design Movie Rental System/1912.java	
+++ b/solutions/1912. Design Movie Rental System/1912.java	
@@ -1,3 +1,15 @@
+class Entry {
+  public int price;
+  public int shop;
+  public int movie;
+
+  public Entry(int price, int shop, int movie) {
+    this.price = price;
+    this.shop = shop;
+    this.movie = movie;
+  }
+}
+
 class MovieRentingSystem {
   public MovieRentingSystem(int n, int[][] entries) {
     for (int[] e : entries) {
@@ -34,11 +46,13 @@ public List<List<Integer>> report() {
     return rented.stream().limit(5).map(e -> List.of(e.shop, e.movie)).collect(Collectors.toList());
   }
 
-  private record Entry(int price, int shop, int movie) {}
-
-  private Comparator<Entry> comparator = Comparator.comparingInt(Entry::price)
-                                             .thenComparingInt(Entry::shop)
-                                             .thenComparingInt(Entry::movie);
+  private Comparator<Entry> comparator = (a, b) -> {
+    if (a.price != b.price)
+      return Integer.compare(a.price, b.price);
+    if (a.shop != b.shop)
+      return Integer.compare(a.shop, b.shop);
+    return Integer.compare(a.movie, b.movie);
+  };
 
   // {movie: (price, shop)}
   private Map<Integer, Set<Entry>> unrented = new HashMap<>();
diff --git a/solutions/1912. Design Movie Rental System/1912.py b/solutions/1912. Design Movie Rental System/1912.py
index c920b20f61c..7fafb6efd96 100644
--- a/solutions/1912. Design Movie Rental System/1912.py	
+++ b/solutions/1912. Design Movie Rental System/1912.py	
@@ -2,7 +2,7 @@
 
 
 class MovieRentingSystem:
-  def __init__(self, n: int, entries: list[list[int]]):
+  def __init__(self, n: int, entries: List[List[int]]):
     self.unrented = collections.defaultdict(
         SortedList)  # {movie: (price, shop)}
     self.shopAndMovieToPrice = {}  # {(shop, movie): price}
@@ -11,7 +11,7 @@ def __init__(self, n: int, entries: list[list[int]]):
       self.unrented[movie].add((price, shop))
       self.shopAndMovieToPrice[(shop, movie)] = price
 
-  def search(self, movie: int) -> list[int]:
+  def search(self, movie: int) -> List[int]:
     return [shop for _, shop in self.unrented[movie][:5]]
 
   def rent(self, shop: int, movie: int) -> None:
@@ -24,5 +24,5 @@ def drop(self, shop: int, movie: int) -> None:
     self.unrented[movie].add((price, shop))
     self.rented.remove((price, shop, movie))
 
-  def report(self) -> list[list[int]]:
+  def report(self) -> List[List[int]]:
     return [[shop, movie] for _, shop, movie in self.rented[:5]]
diff --git a/solutions/1913. Maximum Product Difference Between Two Pairs/1913.py b/solutions/1913. Maximum Product Difference Between Two Pairs/1913.py
index 4fbb44f1f2c..95b10944b5d 100644
--- a/solutions/1913. Maximum Product Difference Between Two Pairs/1913.py	
+++ b/solutions/1913. Maximum Product Difference Between Two Pairs/1913.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxProductDifference(self, nums: list[int]) -> int:
+  def maxProductDifference(self, nums: List[int]) -> int:
     max1 = -math.inf
     max2 = -math.inf
     min1 = math.inf
diff --git a/solutions/1914. Cyclically Rotating a Grid/1914.py b/solutions/1914. Cyclically Rotating a Grid/1914.py
index 3c3001e7f76..05f78b30fb8 100644
--- a/solutions/1914. Cyclically Rotating a Grid/1914.py	
+++ b/solutions/1914. Cyclically Rotating a Grid/1914.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def rotateGrid(self, grid: list[list[int]], k: int) -> list[list[int]]:
+  def rotateGrid(self, grid: List[List[int]], k: int) -> List[List[int]]:
     m = len(grid)
     n = len(grid[0])
     t = 0  # the top
diff --git a/solutions/1916. Count Ways to Build Rooms in an Ant Colony/1916.py b/solutions/1916. Count Ways to Build Rooms in an Ant Colony/1916.py
index 3789fd2fd72..8075671eae3 100644
--- a/solutions/1916. Count Ways to Build Rooms in an Ant Colony/1916.py	
+++ b/solutions/1916. Count Ways to Build Rooms in an Ant Colony/1916.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def waysToBuildRooms(self, prevRoom: list[int]) -> int:
-    MOD = 1_000_000_007
+  def waysToBuildRooms(self, prevRoom: List[int]) -> int:
+    kMod = 1_000_000_007
     graph = collections.defaultdict(list)
 
     for i, prev in enumerate(prevRoom):
       graph[prev].append(i)
 
-    def dfs(node: int) -> tuple[int, int]:
+    def dfs(node: int) -> Tuple[int, int]:
       if not graph[node]:
         return 1, 1
 
@@ -15,7 +15,7 @@ def dfs(node: int) -> tuple[int, int]:
 
       for child in graph[node]:
         temp, r = dfs(child)
-        ans = (ans * temp * math.comb(l + r, r)) % MOD
+        ans = (ans * temp * math.comb(l + r, r)) % kMod
         l += r
 
       return ans, l + 1
diff --git a/solutions/1918. Kth Smallest Subarray Sum/1918.py b/solutions/1918. Kth Smallest Subarray Sum/1918.py
index f59d6fce987..59f196fa668 100644
--- a/solutions/1918. Kth Smallest Subarray Sum/1918.py	
+++ b/solutions/1918. Kth Smallest Subarray Sum/1918.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def kthSmallestSubarraySum(self, nums: list[int], k: int) -> int:
+  def kthSmallestSubarraySum(self, nums: List[int], k: int) -> int:
     def numSubarrayLessThan(m: int) -> int:
       res = 0
       summ = 0
@@ -12,4 +12,5 @@ def numSubarrayLessThan(m: int) -> int:
         res += r - l + 1
       return res
 
-    return bisect.bisect_left(range(sum(nums)), k, key=numSubarrayLessThan)
+    return bisect.bisect_left(range(0, sum(nums)), k,
+                              key=lambda m: numSubarrayLessThan(m))
diff --git a/solutions/1920. Build Array from Permutation/1920.py b/solutions/1920. Build Array from Permutation/1920.py
index a099fbccdde..1ca2334e93a 100644
--- a/solutions/1920. Build Array from Permutation/1920.py	
+++ b/solutions/1920. Build Array from Permutation/1920.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def buildArray(self, nums: list[int]) -> list[int]:
+  def buildArray(self, nums: List[int]) -> List[int]:
     n = len(nums)
 
     for i, num in enumerate(nums):
diff --git a/solutions/1921. Eliminate Maximum Number of Monsters/1921.py b/solutions/1921. Eliminate Maximum Number of Monsters/1921.py
index 186b424b51d..39d19c65899 100644
--- a/solutions/1921. Eliminate Maximum Number of Monsters/1921.py	
+++ b/solutions/1921. Eliminate Maximum Number of Monsters/1921.py	
@@ -1,7 +1,6 @@
 class Solution:
-  def eliminateMaximum(self, dist: list[int], speed: list[int]) -> int:
-    for i, arrivalTime in enumerate(
-            sorted([(d - 1) // s for d, s in zip(dist, speed)])):
+  def eliminateMaximum(self, dist: List[int], speed: List[int]) -> int:
+    for i, arrivalTime in enumerate(sorted([(d - 1) // s for d, s in zip(dist, speed)])):
       if i > arrivalTime:
         return i
     return len(dist)
diff --git a/solutions/1922. Count Good Numbers/1922.java b/solutions/1922. Count Good Numbers/1922.java
index a00d7d562b0..c7bbf3f31fb 100644
--- a/solutions/1922. Count Good Numbers/1922.java	
+++ b/solutions/1922. Count Good Numbers/1922.java	
@@ -1,15 +1,15 @@
 class Solution {
   public int countGoodNumbers(long n) {
-    return (int) (modPow(4 * 5, n / 2) * (n % 2 == 0 ? 1 : 5) % MOD);
+    return (int) (modPow(4 * 5, n / 2) * (n % 2 == 0 ? 1 : 5) % kMod);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2);
+      return x * modPow(x, n - 1) % kMod;
+    return modPow(x * x % kMod, n / 2);
   }
 }
diff --git a/solutions/1922. Count Good Numbers/1922.py b/solutions/1922. Count Good Numbers/1922.py
index 3728f84c8de..a0b2aeb34c0 100644
--- a/solutions/1922. Count Good Numbers/1922.py	
+++ b/solutions/1922. Count Good Numbers/1922.py	
@@ -1,12 +1,12 @@
 class Solution:
   def countGoodNumbers(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
 
     def modPow(x: int, n: int) -> int:
       if n == 0:
         return 1
       if n % 2 == 1:
-        return x * modPow(x, n - 1) % MOD
-      return modPow(x * x % MOD, n // 2)
+        return x * modPow(x, n - 1) % kMod
+      return modPow(x * x % kMod, n // 2)
 
-    return modPow(4 * 5, n // 2) * (1 if n % 2 == 0 else 5) % MOD
+    return modPow(4 * 5, n // 2) * (1 if n % 2 == 0 else 5) % kMod
diff --git a/solutions/1923. Longest Common Subpath/1923.cpp b/solutions/1923. Longest Common Subpath/1923.cpp
index 9e71734ef89..cb43c88ad48 100644
--- a/solutions/1923. Longest Common Subpath/1923.cpp	
+++ b/solutions/1923. Longest Common Subpath/1923.cpp	
@@ -15,8 +15,8 @@ class Solution {
     return l;
   }
 
+  static constexpr long kMod = 8'417'508'174'513;
   static constexpr long kBase = 165'131;
-  static constexpr long kHash = 8'417'508'174'513;
 
   // Returns true if there's a common subpath of length m for all the paths.
   bool checkCommonSubpath(const vector<vector<int>>& paths, int m) {
@@ -43,11 +43,11 @@ class Solution {
     long maxPower = 1;
     long hash = 0;
     for (int i = 0; i < path.size(); ++i) {
-      hash = (hash * kBase + path[i]) % kHash;
+      hash = (hash * kBase + path[i]) % kMod;
       if (i >= m)
-        hash = (hash - path[i - m] * maxPower % kHash + kHash) % kHash;
+        hash = (hash - path[i - m] * maxPower % kMod + kMod) % kMod;
       else
-        maxPower = maxPower * kBase % kHash;
+        maxPower = maxPower * kBase % kMod;
       if (i >= m - 1)
         hashes.insert(hash);
     }
diff --git a/solutions/1923. Longest Common Subpath/1923.java b/solutions/1923. Longest Common Subpath/1923.java
index 27d3dd31cc1..ff25a6cd7ac 100644
--- a/solutions/1923. Longest Common Subpath/1923.java	
+++ b/solutions/1923. Longest Common Subpath/1923.java	
@@ -14,8 +14,8 @@ public int longestCommonSubpath(int n, int[][] paths) {
     return l;
   }
 
-  private static final long BASE = 165_131L;
-  private static final long HASH = 8_417_508_174_513L;
+  private static final long kMod = 8_417_508_174_513L;
+  private static final long kBase = 165_131L;
 
   // Returns true if there's a common subpath of length m for all the paths.
   private boolean checkCommonSubpath(int[][] paths, int m) {
@@ -39,11 +39,11 @@ private Set<Long> rabinKarp(int[] path, int m) {
     long maxPower = 1;
     long hash = 0;
     for (int i = 0; i < path.length; ++i) {
-      hash = (hash * BASE + path[i]) % HASH;
+      hash = (hash * kBase + path[i]) % kMod;
       if (i >= m)
-        hash = (hash - path[i - m] * maxPower % HASH + HASH) % HASH;
+        hash = (hash - path[i - m] * maxPower % kMod + kMod) % kMod;
       else
-        maxPower = maxPower * BASE % HASH;
+        maxPower = maxPower * kBase % kMod;
       if (i >= m - 1)
         hashes.add(hash);
     }
diff --git a/solutions/1923. Longest Common Subpath/1923.py b/solutions/1923. Longest Common Subpath/1923.py
index 077a35b53ac..5e1d14f1ed9 100644
--- a/solutions/1923. Longest Common Subpath/1923.py	
+++ b/solutions/1923. Longest Common Subpath/1923.py	
@@ -1,9 +1,9 @@
 class Solution:
   def __init__(self):
-    self.BASE = 165_131
-    self.HASH = 8_417_508_174_513
+    self.kMod = 8_417_508_174_513
+    self.kBase = 165_131
 
-  def longestCommonSubpath(self, n: int, paths: list[list[int]]) -> int:
+  def longestCommonSubpath(self, n: int, paths: List[List[int]]) -> int:
     l = 0
     r = len(paths[0])
 
@@ -16,7 +16,7 @@ def longestCommonSubpath(self, n: int, paths: list[list[int]]) -> int:
 
     return l
 
-  def _checkCommonSubpath(self, paths: list[list[int]], m: int) -> bool:
+  def _checkCommonSubpath(self, paths: List[List[int]], m: int) -> bool:
     """
     Returns True if there's a common subpath of length m for all the paths.
     """
@@ -30,19 +30,19 @@ def _checkCommonSubpath(self, paths: list[list[int]], m: int) -> bool:
 
     return False
 
-  def _rabinKarp(self, path: list[int], m: int) -> set[int]:
+  def _rabinKarp(self, path: List[int], m: int) -> Set[int]:
     """Returns the hash values for subpaths of length m in the path."""
     hashes = set()
     maxPower = 1
     hash = 0
 
     for i, num in enumerate(path):
-      hash = (hash * self.BASE + num) % self.HASH
+      hash = (hash * self.kBase + num) % self.kMod
       if i >= m:
         hash = (hash - path[i - m] * maxPower %
-                self.HASH + self.HASH) % self.HASH
+                self.kMod + self.kMod) % self.kMod
       else:
-        maxPower = maxPower * self.BASE % self.HASH
+        maxPower = maxPower * self.kBase % self.kMod
       if i >= m - 1:
         hashes.add(hash)
 
diff --git a/solutions/1924. Erect the Fence II/1924.cpp b/solutions/1924. Erect the Fence II/1924.cpp
index a6e5ee2458a..3d7e0672a39 100644
--- a/solutions/1924. Erect the Fence II/1924.cpp	
+++ b/solutions/1924. Erect the Fence II/1924.cpp	
@@ -22,7 +22,6 @@ class Solution {
 
  private:
   // Returns the smallest disk that encloses points[i..n).
-  //
   // https://en.wikipedia.org/wiki/Smallest-disk_problem#Welzl's_algorithm
   Disk welzl(const vector<Point>& points, int i, vector<Point> planePoints) {
     if (i == points.size() || planePoints.size() == 3)
diff --git a/solutions/1924. Erect the Fence II/1924.java b/solutions/1924. Erect the Fence II/1924.java
index 8e346476ec1..9636c5d5931 100644
--- a/solutions/1924. Erect the Fence II/1924.java	
+++ b/solutions/1924. Erect the Fence II/1924.java	
@@ -26,7 +26,6 @@ public double[] outerTrees(int[][] trees) {
   }
 
   // Returns the smallest disk that encloses points[i..n).
-  //
   // https://en.wikipedia.org/wiki/Smallest-disk_problem#Welzl's_algorithm
   private Disk welzl(Point[] points, int i, List<Point> planePoints) {
     if (i == points.length || planePoints.size() == 3)
diff --git a/solutions/1924. Erect the Fence II/1924.py b/solutions/1924. Erect the Fence II/1924.py
index 4caac5cb4a5..a971920b32d 100644
--- a/solutions/1924. Erect the Fence II/1924.py	
+++ b/solutions/1924. Erect the Fence II/1924.py	
@@ -14,17 +14,12 @@ class Disk:
 
 
 class Solution:
-  def outerTrees(self, trees: list[list[int]]) -> list[float]:
+  def outerTrees(self, trees: List[List[int]]) -> List[float]:
     points = [Point(x, y) for x, y in trees]
     disk = self._welzl(points, 0, [])
     return [disk.center.x, disk.center.y, disk.radius]
 
-  def _welzl(
-      self,
-      points: list[Point],
-      i: int,
-      planePoints: list[Point],
-  ) -> Disk:
+  def _welzl(self, points: List[Point], i: int, planePoints: List[Point]) -> Disk:
     """Returns the smallest disk that encloses points[i..n).
 
     https://en.wikipedia.org/wiki/Smallest-disk_problem#Welzl's_algorithm
@@ -36,7 +31,7 @@ def _welzl(
       return disk
     return self._welzl(points, i + 1, planePoints + [points[i]])
 
-  def _trivial(self, planePoints: list[Point]) -> Disk:
+  def _trivial(self, planePoints: List[Point]) -> Disk:
     """Returns the smallest disk that encloses `planePoints`."""
     if len(planePoints) == 0:
       return Disk(Point(0, 0), 0)
@@ -57,10 +52,7 @@ def _trivial(self, planePoints: list[Point]) -> Disk:
     if self._inside(disk12, planePoints[0]):
       return disk12
 
-    return self._getDiskFromThree(
-        planePoints[0],
-        planePoints[1],
-        planePoints[2])
+    return self._getDiskFromThree(planePoints[0], planePoints[1], planePoints[2])
 
   def _getDisk(self, A: Point, B: Point) -> Disk:
     """Returns the smallest disk that encloses the points A and B."""
diff --git a/solutions/1926. Nearest Exit from Entrance in Maze/1926.cpp b/solutions/1926. Nearest Exit from Entrance in Maze/1926.cpp
index d8a9eb25df0..335cd309049 100644
--- a/solutions/1926. Nearest Exit from Entrance in Maze/1926.cpp	
+++ b/solutions/1926. Nearest Exit from Entrance in Maze/1926.cpp	
@@ -1,18 +1,20 @@
 class Solution {
  public:
   int nearestExit(vector<vector<char>>& maze, vector<int>& entrance) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = maze.size();
     const int n = maze[0].size();
+    int ans = 0;
     queue<pair<int, int>> q{{{entrance[0], entrance[1]}}};
     vector<vector<bool>> seen(m, vector<bool>(n));
     seen[entrance[0]][entrance[1]] = true;
 
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
@@ -20,11 +22,12 @@ class Solution {
           if (seen[x][y] || maze[x][y] == '+')
             continue;
           if (x == 0 || x == m - 1 || y == 0 || y == n - 1)
-            return step;
+            return ans;
           q.emplace(x, y);
           seen[x][y] = true;
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/1926. Nearest Exit from Entrance in Maze/1926.java b/solutions/1926. Nearest Exit from Entrance in Maze/1926.java
index 995ffb050b5..b872f6dc2ff 100644
--- a/solutions/1926. Nearest Exit from Entrance in Maze/1926.java	
+++ b/solutions/1926. Nearest Exit from Entrance in Maze/1926.java	
@@ -1,18 +1,19 @@
 class Solution {
   public int nearestExit(char[][] maze, int[] entrance) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = maze.length;
     final int n = maze[0].length;
-    Queue<Pair<Integer, Integer>> q =
-        new ArrayDeque<>(List.of(new Pair<>(entrance[0], entrance[1])));
+    int ans = 0;
+    Queue<int[]> q = new ArrayDeque<>(Arrays.asList(new int[] {entrance[0], entrance[1]}));
     boolean[][] seen = new boolean[m][n];
     seen[entrance[0]][entrance[1]] = true;
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
-        final int i = q.peek().getKey();
-        final int j = q.poll().getValue();
-        for (int[] dir : DIRS) {
+        final int i = q.peek()[0];
+        final int j = q.poll()[1];
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == m || y < 0 || y == n)
@@ -20,11 +21,12 @@ public int nearestExit(char[][] maze, int[] entrance) {
           if (seen[x][y] || maze[x][y] == '+')
             continue;
           if (x == 0 || x == m - 1 || y == 0 || y == n - 1)
-            return step;
-          q.offer(new Pair<>(x, y));
+            return ans;
+          q.offer(new int[] {x, y});
           seen[x][y] = true;
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/1926. Nearest Exit from Entrance in Maze/1926.py b/solutions/1926. Nearest Exit from Entrance in Maze/1926.py
index e2b5e3f0a4e..4d4485400f2 100644
--- a/solutions/1926. Nearest Exit from Entrance in Maze/1926.py	
+++ b/solutions/1926. Nearest Exit from Entrance in Maze/1926.py	
@@ -1,16 +1,17 @@
 class Solution:
-  def nearestExit(self, maze: list[list[str]], entrance: list[int]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def nearestExit(self, maze: List[List[str]], entrance: List[int]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(maze)
     n = len(maze[0])
+    ans = 0
     q = collections.deque([(entrance[0], entrance[1])])
     seen = {(entrance[0], entrance[1])}
 
-    step = 1
     while q:
+      ans += 1
       for _ in range(len(q)):
         i, j = q.popleft()
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == m or y < 0 or y == n:
@@ -18,9 +19,8 @@ def nearestExit(self, maze: list[list[str]], entrance: list[int]) -> int:
           if (x, y) in seen or maze[x][y] == '+':
             continue
           if x == 0 or x == m - 1 or y == 0 or y == n - 1:
-            return step
+            return ans
           q.append((x, y))
           seen.add((x, y))
-      step += 1
 
     return -1
diff --git a/solutions/1927. Sum Game/1927.py b/solutions/1927. Sum Game/1927.py
index 21346f92c0f..ac427b72ea0 100644
--- a/solutions/1927. Sum Game/1927.py	
+++ b/solutions/1927. Sum Game/1927.py	
@@ -4,7 +4,7 @@ def sumGame(self, num: str) -> bool:
     ans = 0.0
 
     def getExpectation(c: str) -> float:
-      return 4.5 if c == '?' else int(c)
+      return 4.5 if c == '?' else ord(c) - ord('0')
 
     for i in range(n // 2):
       ans += getExpectation(num[i])
diff --git a/solutions/1928. Minimum Cost to Reach Destination in Time/1928.cpp b/solutions/1928. Minimum Cost to Reach Destination in Time/1928.cpp
index 3e0a5932ee4..dc18f42478a 100644
--- a/solutions/1928. Minimum Cost to Reach Destination in Time/1928.cpp	
+++ b/solutions/1928. Minimum Cost to Reach Destination in Time/1928.cpp	
@@ -23,11 +23,11 @@ class Solution {
     vector<int> cost(graph.size(), INT_MAX);
     // dist[i] := the minimum time to reach the i-th city
     vector<int> dist(graph.size(), maxTime + 1);
+    using T = tuple<int, int, int>;  // (cost[u], dist[u], u)
+    priority_queue<T, vector<T>, greater<>> minHeap;
 
     cost[src] = passingFees[src];
     dist[src] = 0;
-    using T = tuple<int, int, int>;  // (cost[u], dist[u], u)
-    priority_queue<T, vector<T>, greater<>> minHeap;
     minHeap.emplace(cost[src], dist[src], src);
 
     while (!minHeap.empty()) {
diff --git a/solutions/1928. Minimum Cost to Reach Destination in Time/1928.java b/solutions/1928. Minimum Cost to Reach Destination in Time/1928.java
index 88309e3c32b..f8d7e984b0a 100644
--- a/solutions/1928. Minimum Cost to Reach Destination in Time/1928.java	
+++ b/solutions/1928. Minimum Cost to Reach Destination in Time/1928.java	
@@ -2,7 +2,9 @@ class Solution {
   public int minCost(int maxTime, int[][] edges, int[] passingFees) {
     final int n = passingFees.length;
     List<Pair<Integer, Integer>>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
@@ -21,12 +23,12 @@ private int dijkstra(List<Pair<Integer, Integer>>[] graph, int src, int dst, int
     int[] dist = new int[graph.length]; // dist[i] := the minimum distance to reach the i-th city
     Arrays.fill(cost, Integer.MAX_VALUE);
     Arrays.fill(dist, maxTime + 1);
+    // (cost[u], dist[u], u)
+    Queue<int[]> minHeap = new PriorityQueue<>((a, b) -> a[0] - b[0]);
 
     cost[0] = passingFees[0];
     dist[0] = 0;
-    Queue<int[]> minHeap = new PriorityQueue<>(Comparator.comparingInt(a -> a[0])) {
-      { offer(new int[] {cost[src], dist[src], src}); } // (cost[u], dist[u], u)
-    };
+    minHeap.offer(new int[] {cost[src], dist[src], src});
 
     while (!minHeap.isEmpty()) {
       final int currCost = minHeap.peek()[0];
diff --git a/solutions/1928. Minimum Cost to Reach Destination in Time/1928.py b/solutions/1928. Minimum Cost to Reach Destination in Time/1928.py
index 347dbfa3d40..97b1fe873e8 100644
--- a/solutions/1928. Minimum Cost to Reach Destination in Time/1928.py	
+++ b/solutions/1928. Minimum Cost to Reach Destination in Time/1928.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minCost(
-      self,
-      maxTime: int,
-      edges: list[list[int]],
-      passingFees: list[int],
-  ) -> int:
+  def minCost(self, maxTime: int, edges: List[List[int]], passingFees: List[int]) -> int:
     n = len(passingFees)
     graph = [[] for _ in range(n)]
 
@@ -14,18 +9,11 @@ def minCost(
 
     return self._dijkstra(graph, 0, n - 1, maxTime, passingFees)
 
-  def _dijkstra(
-      self,
-      graph: list[list[tuple[int, int]]],
-      src: int,
-      dst: int,
-      maxTime: int,
-      passingFees: list[int],
-  ) -> int:
+  def _dijkstra(self, graph: List[List[Tuple[int, int]]], src: int, dst: int, maxTime: int, passingFees: List[int]) -> int:
     # cost[i] := the minimum cost to reach the i-th city
-    cost = [math.inf] * len(graph)
+    cost = [math.inf for _ in range(len(graph))]
     # dist[i] := the minimum time to reach the i-th city
-    dist = [maxTime + 1] * len(graph)
+    dist = [maxTime + 1 for _ in range(len(graph))]
 
     cost[src] = passingFees[src]
     dist[src] = 0
diff --git a/solutions/1929. Concatenation of Array/1929.py b/solutions/1929. Concatenation of Array/1929.py
index 841d66a3c65..26f01f4dbf1 100644
--- a/solutions/1929. Concatenation of Array/1929.py	
+++ b/solutions/1929. Concatenation of Array/1929.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def getConcatenation(self, nums: list[int]) -> list[int]:
+  def getConcatenation(self, nums: List[int]) -> List[int]:
     return nums * 2
diff --git a/solutions/1930. Unique Length-3 Palindromic Subsequences/1930.cpp b/solutions/1930. Unique Length-3 Palindromic Subsequences/1930.cpp
index dc8c404a1c0..c0b048ba51e 100644
--- a/solutions/1930. Unique Length-3 Palindromic Subsequences/1930.cpp	
+++ b/solutions/1930. Unique Length-3 Palindromic Subsequences/1930.cpp	
@@ -3,7 +3,7 @@ class Solution {
   int countPalindromicSubsequence(string s) {
     int ans = 0;
     vector<int> first(26, s.length());
-    vector<int> last(26, -1);
+    vector<int> last(26);
 
     for (int i = 0; i < s.length(); ++i) {
       const int index = s[i] - 'a';
diff --git a/solutions/1930. Unique Length-3 Palindromic Subsequences/1930.java b/solutions/1930. Unique Length-3 Palindromic Subsequences/1930.java
index 828e07b000f..b4d7bb2ed3d 100644
--- a/solutions/1930. Unique Length-3 Palindromic Subsequences/1930.java	
+++ b/solutions/1930. Unique Length-3 Palindromic Subsequences/1930.java	
@@ -5,7 +5,6 @@ public int countPalindromicSubsequence(String s) {
     int[] last = new int[26];
 
     Arrays.fill(first, s.length());
-    Arrays.fill(last, -1);
 
     for (int i = 0; i < s.length(); ++i) {
       final int index = s.charAt(i) - 'a';
diff --git a/solutions/1930. Unique Length-3 Palindromic Subsequences/1930.py b/solutions/1930. Unique Length-3 Palindromic Subsequences/1930.py
index 595dc703df2..e396f9e1971 100644
--- a/solutions/1930. Unique Length-3 Palindromic Subsequences/1930.py	
+++ b/solutions/1930. Unique Length-3 Palindromic Subsequences/1930.py	
@@ -2,7 +2,7 @@ class Solution:
   def countPalindromicSubsequence(self, s: str) -> int:
     ans = 0
     first = [len(s)] * 26
-    last = [-1] * 26
+    last = [0] * 26
 
     for i, c in enumerate(s):
       index = ord(c) - ord('a')
diff --git a/solutions/1931. Painting a Grid With Three Different Colors/1931.java b/solutions/1931. Painting a Grid With Three Different Colors/1931.java
index ea6dfb6d6d3..39cf3a4bd24 100644
--- a/solutions/1931. Painting a Grid With Three Different Colors/1931.java	
+++ b/solutions/1931. Painting a Grid With Three Different Colors/1931.java	
@@ -5,7 +5,7 @@ public int colorTheGrid(int m, int n) {
     return dp(0, 0, 0, 0);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
   private int m;
   private int n;
   private int[][] mem = new int[1000][1024];
@@ -27,7 +27,7 @@ private int dp(int r, int c, int prevColMask, int currColMask) {
       if (r > 0 && getColor(currColMask, r - 1) == color)
         continue;
       ans += dp(r + 1, c, prevColMask, setColor(currColMask, r, color));
-      ans %= MOD;
+      ans %= kMod;
     }
 
     if (r == 0)
diff --git a/solutions/1931. Painting a Grid With Three Different Colors/1931.py b/solutions/1931. Painting a Grid With Three Different Colors/1931.py
index 5e1ed6de8bc..72525f13361 100644
--- a/solutions/1931. Painting a Grid With Three Different Colors/1931.py	
+++ b/solutions/1931. Painting a Grid With Three Different Colors/1931.py	
@@ -6,7 +6,7 @@ def getColor(mask: int, r: int) -> int:
     def setColor(mask: int, r: int, color: int) -> int:
       return mask | color << r * 2
 
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
 
     @functools.lru_cache(None)
     def dp(r: int, c: int, prevColMask: int, currColMask: int) -> int:
@@ -24,7 +24,7 @@ def dp(r: int, c: int, prevColMask: int, currColMask: int) -> int:
         if r > 0 and getColor(currColMask, r - 1) == color:
           continue
         ans += dp(r + 1, c, prevColMask, setColor(currColMask, r, color))
-        ans %= MOD
+        ans %= kMod
 
       return ans
 
diff --git a/solutions/1932. Merge BSTs to Create Single BST/1932.py b/solutions/1932. Merge BSTs to Create Single BST/1932.py
index e1e75f879a4..2416f6ae912 100644
--- a/solutions/1932. Merge BSTs to Create Single BST/1932.py	
+++ b/solutions/1932. Merge BSTs to Create Single BST/1932.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canMerge(self, trees: list[TreeNode]) -> TreeNode | None:
+  def canMerge(self, trees: List[TreeNode]) -> Optional[TreeNode]:
     valToNode = {}  # {val: node}
     count = collections.Counter()  # {val: freq}
 
@@ -11,8 +11,7 @@ def canMerge(self, trees: list[TreeNode]) -> TreeNode | None:
       if tree.right:
         count[tree.right.val] += 1
 
-    def isValidBST(tree: TreeNode | None, minNode: TreeNode | None,
-                   maxNode: TreeNode | None) -> bool:
+    def isValidBST(tree: Optional[TreeNode], minNode: Optional[TreeNode], maxNode: Optional[TreeNode]) -> bool:
       if not tree:
         return True
       if minNode and tree.val <= minNode.val:
@@ -25,9 +24,7 @@ def isValidBST(tree: TreeNode | None, minNode: TreeNode | None,
         tree.right = valToNode[val].right
         del valToNode[val]
 
-      return isValidBST(
-          tree.left, minNode, tree) and isValidBST(
-          tree.right, tree, maxNode)
+      return isValidBST(tree.left, minNode, tree) and isValidBST(tree.right, tree, maxNode)
 
     for tree in trees:
       if count[tree.val] == 1:
diff --git a/solutions/1936. Add Minimum Number of Rungs/1936.py b/solutions/1936. Add Minimum Number of Rungs/1936.py
index bd970c1e54b..6e1f0cbda4c 100644
--- a/solutions/1936. Add Minimum Number of Rungs/1936.py	
+++ b/solutions/1936. Add Minimum Number of Rungs/1936.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def addRungs(self, rungs: list[int], dist: int) -> int:
+  def addRungs(self, rungs: List[int], dist: int) -> int:
     ans = 0
     prev = 0
 
diff --git a/solutions/1937. Maximum Number of Points with Cost/1937.py b/solutions/1937. Maximum Number of Points with Cost/1937.py
index 3b89be7b7a7..8147fa04c6b 100644
--- a/solutions/1937. Maximum Number of Points with Cost/1937.py	
+++ b/solutions/1937. Maximum Number of Points with Cost/1937.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxPoints(self, points: list[list[int]]) -> int:
+  def maxPoints(self, points: List[List[int]]) -> int:
     n = len(points[0])
     # dp[j] := the maximum number of points you can have if points[i][j] is the
     # most recent cell you picked
diff --git a/solutions/1938. Maximum Genetic Difference Query/1938.java b/solutions/1938. Maximum Genetic Difference Query/1938.java
index 3cfa45c9cfd..e7ca4641455 100644
--- a/solutions/1938. Maximum Genetic Difference Query/1938.java	
+++ b/solutions/1938. Maximum Genetic Difference Query/1938.java	
@@ -6,7 +6,7 @@ class TrieNode {
 class Trie {
   public void update(int num, int val) {
     TrieNode node = root;
-    for (int i = HEIGHT; i >= 0; --i) {
+    for (int i = kHeight; i >= 0; --i) {
       final int bit = (num >> i) & 1;
       if (node.children[bit] == null)
         node.children[bit] = new TrieNode();
@@ -18,7 +18,7 @@ public void update(int num, int val) {
   public int query(int num) {
     int ans = 0;
     TrieNode node = root;
-    for (int i = HEIGHT; i >= 0; --i) {
+    for (int i = kHeight; i >= 0; --i) {
       final int bit = (num >> i) & 1;
       final int targetBit = bit ^ 1;
       if (node.children[targetBit] != null && node.children[targetBit].count > 0) {
@@ -31,7 +31,7 @@ public int query(int num) {
     return ans;
   }
 
-  private static final int HEIGHT = 17;
+  private static final int kHeight = 17;
   TrieNode root = new TrieNode();
 }
 
diff --git a/solutions/1938. Maximum Genetic Difference Query/1938.py b/solutions/1938. Maximum Genetic Difference Query/1938.py
index d3df8062861..e972d61aacc 100644
--- a/solutions/1938. Maximum Genetic Difference Query/1938.py	
+++ b/solutions/1938. Maximum Genetic Difference Query/1938.py	
@@ -1,17 +1,17 @@
 class TrieNode:
   def __init__(self):
-    self.children: list[TrieNode | None] = [None] * 2
+    self.children = [None] * 2
     self.count = 0
 
 
 class Trie:
   def __init__(self):
     self.root = TrieNode()
-    self.HEIGHT = 17
+    self.kHeight = 17
 
   def update(self, num: int, val: int) -> None:
     node = self.root
-    for i in range(self.HEIGHT, -1, -1):
+    for i in range(self.kHeight, -1, -1):
       bit = (num >> i) & 1
       if not node.children[bit]:
         node.children[bit] = TrieNode()
@@ -21,7 +21,7 @@ def update(self, num: int, val: int) -> None:
   def query(self, num: int) -> int:
     ans = 0
     node = self.root
-    for i in range(self.HEIGHT, -1, -1):
+    for i in range(self.kHeight, -1, -1):
       bit = (num >> i) & 1
       targetBit = bit ^ 1
       if node.children[targetBit] and node.children[targetBit].count > 0:
@@ -33,11 +33,7 @@ def query(self, num: int) -> int:
 
 
 class Solution:
-  def maxGeneticDifference(
-      self,
-      parents: list[int],
-      queries: list[list[int]],
-  ) -> list[int]:
+  def maxGeneticDifference(self, parents: List[int], queries: List[List[int]]) -> List[int]:
     n = len(parents)
     ans = [0] * len(queries)
     rootVal = -1
diff --git a/solutions/1940. Longest Common Subsequence Between Sorted Arrays/1940-2.py b/solutions/1940. Longest Common Subsequence Between Sorted Arrays/1940-2.py
index 3362e970cfd..44edc857ef4 100644
--- a/solutions/1940. Longest Common Subsequence Between Sorted Arrays/1940-2.py	
+++ b/solutions/1940. Longest Common Subsequence Between Sorted Arrays/1940-2.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def longestCommonSubsequence(self, arrays: list[list[int]]) -> list[int]:
+  def longestCommonSubsequence(self, arrays: List[List[int]]) -> List[int]:
     return sorted(functools.reduce(lambda a, b: set(a) & set(b), arrays))
diff --git a/solutions/1940. Longest Common Subsequence Between Sorted Arrays/1940.java b/solutions/1940. Longest Common Subsequence Between Sorted Arrays/1940.java
index f1d49a9a807..9896275c2b9 100644
--- a/solutions/1940. Longest Common Subsequence Between Sorted Arrays/1940.java	
+++ b/solutions/1940. Longest Common Subsequence Between Sorted Arrays/1940.java	
@@ -1,8 +1,8 @@
 class Solution {
   public List<Integer> longestCommonSubsequence(int[][] arrays) {
-    final int MAX = 100;
+    final int kMax = 100;
     List<Integer> ans = new ArrayList<>();
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (int[] array : arrays)
       for (final int a : array)
diff --git a/solutions/1940. Longest Common Subsequence Between Sorted Arrays/1940.py b/solutions/1940. Longest Common Subsequence Between Sorted Arrays/1940.py
index 83ae0916f3f..d04155b233f 100644
--- a/solutions/1940. Longest Common Subsequence Between Sorted Arrays/1940.py	
+++ b/solutions/1940. Longest Common Subsequence Between Sorted Arrays/1940.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def longestCommonSubsequence(self, arrays: list[list[int]]) -> list[int]:
-    MAX = 100
+  def longestCommonSubsequence(self, arrays: List[List[int]]) -> List[int]:
+    kMax = 100
     ans = []
-    count = [0] * (MAX + 1)
+    count = [0] * (kMax + 1)
 
     for array in arrays:
       for a in array:
diff --git a/solutions/1942. The Number of the Smallest Unoccupied Chair/1942.java b/solutions/1942. The Number of the Smallest Unoccupied Chair/1942.java
index d86e2085a4c..14a3666a7ca 100644
--- a/solutions/1942. The Number of the Smallest Unoccupied Chair/1942.java	
+++ b/solutions/1942. The Number of the Smallest Unoccupied Chair/1942.java	
@@ -3,7 +3,7 @@ public int smallestChair(int[][] times, int targetFriend) {
     int nextUnsatChair = 0;
     PriorityQueue<Integer> emptyChairs = new PriorityQueue<>();
     PriorityQueue<Pair<Integer, Integer>> occupied =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey));
+        new PriorityQueue<>(Comparator.comparing(Pair::getKey));
 
     for (int i = 0; i < times.length; ++i) {
       int[] time = times[i];
@@ -12,7 +12,7 @@ public int smallestChair(int[][] times, int targetFriend) {
       times[i] = time;
     }
 
-    Arrays.sort(times, Comparator.comparingInt(time -> time[0]));
+    Arrays.sort(times, (a, b) -> a[0] - b[0]);
 
     for (int[] time : times) {
       final int arrival = time[0];
diff --git a/solutions/1942. The Number of the Smallest Unoccupied Chair/1942.py b/solutions/1942. The Number of the Smallest Unoccupied Chair/1942.py
index 0915589f96c..10e485d7c23 100644
--- a/solutions/1942. The Number of the Smallest Unoccupied Chair/1942.py	
+++ b/solutions/1942. The Number of the Smallest Unoccupied Chair/1942.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def smallestChair(self, times: list[list[int]], targetFriend: int) -> int:
+  def smallestChair(self, times: List[List[int]], targetFriend: int) -> int:
     nextUnsatChair = 0
     emptyChairs = []
     occupied = []  # (leaving, chair)
@@ -7,7 +7,7 @@ def smallestChair(self, times: list[list[int]], targetFriend: int) -> int:
     for i in range(len(times)):
       times[i].append(i)
 
-    times.sort(key=lambda x: x[0])
+    times.sort(key=lambda time: time[0])
 
     for arrival, leaving, i in times:
       while len(occupied) > 0 and occupied[0][0] <= arrival:
diff --git a/solutions/1943. Describe the Painting/1943.cpp b/solutions/1943. Describe the Painting/1943.cpp
index 99d760cbb77..82a6b91cf48 100644
--- a/solutions/1943. Describe the Painting/1943.cpp	
+++ b/solutions/1943. Describe the Painting/1943.cpp	
@@ -4,17 +4,17 @@ class Solution {
     vector<vector<long long>> ans;
     int prevIndex = 0;
     long runningMix = 0;
-    map<int, long> line;
+    map<int, long> timeline;
 
     for (const vector<int>& segment : segments) {
       const int start = segment[0];
       const int end = segment[1];
       const int color = segment[2];
-      line[start] += color;
-      line[end] -= color;
+      timeline[start] += color;
+      timeline[end] -= color;
     }
 
-    for (const auto& [i, mix] : line) {
+    for (const auto& [i, mix] : timeline) {
       if (runningMix > 0)
         ans.push_back({prevIndex, i, runningMix});
       runningMix += mix;
diff --git a/solutions/1943. Describe the Painting/1943.java b/solutions/1943. Describe the Painting/1943.java
index d6a3ade7ea5..6256a25ea1e 100644
--- a/solutions/1943. Describe the Painting/1943.java	
+++ b/solutions/1943. Describe the Painting/1943.java	
@@ -3,19 +3,18 @@ public List<List<Long>> splitPainting(int[][] segments) {
     List<List<Long>> ans = new ArrayList<>();
     int prevIndex = 0;
     long runningMix = 0;
-    TreeMap<Integer, Long> line = new TreeMap<>();
+    TreeMap<Integer, Long> timeline = new TreeMap<>();
 
     for (int[] segment : segments) {
       final int start = segment[0];
       final int end = segment[1];
       final int color = segment[2];
-      line.merge(start, (long) color, Long::sum);
-      line.merge(end, (long) -color, Long::sum);
+      timeline.merge(start, (long) color, Long::sum);
+      timeline.merge(end, (long) -color, Long::sum);
     }
 
-    for (Map.Entry<Integer, Long> entry : line.entrySet()) {
-      final int i = entry.getKey();
-      final long mix = entry.getValue();
+    for (final int i : timeline.keySet()) {
+      final long mix = timeline.get(i);
       if (runningMix > 0)
         ans.add(List.of((long) prevIndex, (long) i, runningMix));
       runningMix += mix;
diff --git a/solutions/1943. Describe the Painting/1943.py b/solutions/1943. Describe the Painting/1943.py
index 8372d8db6ce..b57861431bb 100644
--- a/solutions/1943. Describe the Painting/1943.py	
+++ b/solutions/1943. Describe the Painting/1943.py	
@@ -2,17 +2,17 @@
 
 
 class Solution:
-  def splitPainting(self, segments: list[list[int]]) -> list[list[int]]:
+  def splitPainting(self, segments: List[List[int]]) -> List[List[int]]:
     ans = []
     prevIndex = 0
     runningMix = 0
-    line = SortedDict()
+    timeline = SortedDict()
 
     for start, end, color in segments:
-      line[start] = line.get(start, 0) + color
-      line[end] = line.get(end, 0) - color
+      timeline[start] = timeline.get(start, 0) + color
+      timeline[end] = timeline.get(end, 0) - color
 
-    for i, mix in line.items():
+    for i, mix in timeline.items():
       if runningMix > 0:
         ans.append([prevIndex, i, runningMix])
       runningMix += mix
diff --git a/solutions/1944. Number of Visible People in a Queue/1944.py b/solutions/1944. Number of Visible People in a Queue/1944.py
index 3a7fde9b683..b18713a5c2a 100644
--- a/solutions/1944. Number of Visible People in a Queue/1944.py	
+++ b/solutions/1944. Number of Visible People in a Queue/1944.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canSeePersonsCount(self, heights: list[int]) -> list[int]:
+  def canSeePersonsCount(self, heights: List[int]) -> List[int]:
     ans = [0] * len(heights)
     stack = []
 
diff --git a/solutions/1946. Largest Number After Mutating Substring/1946.py b/solutions/1946. Largest Number After Mutating Substring/1946.py
index 5a7f2f64b18..c0dbb9849f4 100644
--- a/solutions/1946. Largest Number After Mutating Substring/1946.py	
+++ b/solutions/1946. Largest Number After Mutating Substring/1946.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def maximumNumber(self, num: str, change: list[int]) -> str:
+  def maximumNumber(self, num: str, change: List[int]) -> str:
     numList = list(num)
     mutated = False
 
     for i, c in enumerate(numList):
       d = int(c)
-      numlist[i] = chr(ord('0') + max(d, change[d]))
+      numList[i] = chr(ord('0') + max(d, change[d]))
       if mutated and d > change[d]:
         return ''.join(numList)
       if d < change[d]:
diff --git a/solutions/1947. Maximum Compatibility Score Sum/1947.cpp b/solutions/1947. Maximum Compatibility Score Sum/1947.cpp
index a6d6157c8eb..ea97d40ecc9 100644
--- a/solutions/1947. Maximum Compatibility Score Sum/1947.cpp	
+++ b/solutions/1947. Maximum Compatibility Score Sum/1947.cpp	
@@ -20,7 +20,7 @@ class Solution {
         continue;
       used[j] = true;  // The `mentors[j]` is used.
       dfs(students, mentors, i + 1,
-          scoreSum + getScore(students[i], mentors[j]), std::move(used), ans);
+          scoreSum + getScore(students[i], mentors[j]), move(used), ans);
       used[j] = false;
     }
   }
diff --git a/solutions/1947. Maximum Compatibility Score Sum/1947.py b/solutions/1947. Maximum Compatibility Score Sum/1947.py
index d3f680355c9..b755aabc195 100644
--- a/solutions/1947. Maximum Compatibility Score Sum/1947.py	
+++ b/solutions/1947. Maximum Compatibility Score Sum/1947.py	
@@ -1,12 +1,8 @@
 class Solution:
-  def maxCompatibilitySum(
-      self,
-      students: list[list[int]],
-      mentors: list[list[int]],
-  ) -> int:
+  def maxCompatibilitySum(self, students: List[List[int]], mentors: List[List[int]]) -> int:
     ans = 0
 
-    def dfs(i: int, scoreSum: int, used: list[bool]) -> None:
+    def dfs(i: int, scoreSum: int, used: List[bool]) -> None:
       nonlocal ans
       if i == len(students):
         ans = max(ans, scoreSum)
diff --git a/solutions/1948. Delete Duplicate Folders in System/1948.java b/solutions/1948. Delete Duplicate Folders in System/1948.java
index 2e573dd081f..23aa91a55d0 100644
--- a/solutions/1948. Delete Duplicate Folders in System/1948.java	
+++ b/solutions/1948. Delete Duplicate Folders in System/1948.java	
@@ -8,15 +8,14 @@ public List<List<String>> deleteDuplicateFolder(List<List<String>> paths) {
     List<List<String>> ans = new ArrayList<>();
     Map<String, List<TrieNode>> subtreeToNodes = new HashMap<>();
 
-    Collections.sort(paths,
-                     Comparator.<List<String>>comparingInt(List::size).thenComparing((a, b) -> {
-                       for (int i = 0; i < Math.min(a.size(), b.size()); ++i) {
-                         final int c = a.get(i).compareTo(b.get(i));
-                         if (c != 0)
-                           return c;
-                       }
-                       return 0;
-                     }));
+    Collections.sort(paths, (a, b) -> {
+      for (int i = 0; i < Math.min(a.size(), b.size()); ++i) {
+        final int c = a.get(i).compareTo(b.get(i));
+        if (c != 0)
+          return c;
+      }
+      return Integer.compare(a.size(), b.size());
+    });
 
     for (List<String> path : paths) {
       TrieNode node = root;
diff --git a/solutions/1948. Delete Duplicate Folders in System/1948.py b/solutions/1948. Delete Duplicate Folders in System/1948.py
index 25908942455..23775870537 100644
--- a/solutions/1948. Delete Duplicate Folders in System/1948.py	
+++ b/solutions/1948. Delete Duplicate Folders in System/1948.py	
@@ -1,20 +1,20 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = collections.defaultdict(TrieNode)
     self.deleted = False
 
 
 class Solution:
-  def deleteDuplicateFolder(self, paths: list[list[str]]) -> list[list[str]]:
+  def deleteDuplicateFolder(self, paths: List[List[str]]) -> List[List[str]]:
     ans = []
     root = TrieNode()
-    subtreeToNodes: dict[str, list[TrieNode]] = collections.defaultdict(list)
+    subtreeToNodes: Dict[str, List[TrieNode]] = collections.defaultdict(list)
 
     # Construct the Trie
     for path in sorted(paths):
       node = root
       for s in path:
-        node = node.children.setdefault(s, TrieNode())
+        node = node.children[s]
 
     # For each subtree, fill in the {subtree encoding: [root]} hash table
     def buildSubtreeToRoots(node: TrieNode) -> str:
@@ -33,7 +33,7 @@ def buildSubtreeToRoots(node: TrieNode) -> str:
           node.deleted = True
 
     # Construct the answer array for nodes that haven't been deleted
-    def constructPath(node: TrieNode, path: list[str]) -> None:
+    def constructPath(node: TrieNode, path: List[str]) -> None:
       for s, child in node.children.items():
         if not child.deleted:
           constructPath(child, path + [s])
diff --git a/solutions/1950. Maximum of Minimum Values in All Subarrays/1950.py b/solutions/1950. Maximum of Minimum Values in All Subarrays/1950.py
index d6912d80c95..e4e8d315d9a 100644
--- a/solutions/1950. Maximum of Minimum Values in All Subarrays/1950.py	
+++ b/solutions/1950. Maximum of Minimum Values in All Subarrays/1950.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Similar to 1950. Maximum of Minimum Values in All Subarrays
-  def findMaximums(self, nums: list[int]) -> list[int]:
+  def findMaximums(self, nums: List[int]) -> List[int]:
     n = len(nums)
     ans = [0] * n
     # prevMin[i] := the index k s.t.
diff --git a/solutions/1952. Three Divisors/1952.py b/solutions/1952. Three Divisors/1952.py
index 8779514958e..0d251deb384 100644
--- a/solutions/1952. Three Divisors/1952.py	
+++ b/solutions/1952. Three Divisors/1952.py	
@@ -5,6 +5,6 @@ def isThree(self, n: int) -> bool:
     # The numbers with exactly three divisors are perfect squares of a prime
     # number.
     root = math.isqrt(n)
-    return (root**2 == n and
-            all(root % i != 0
-                for i in range(2, math.isqrt(root) + 1)))
+    return root**2 == n and \
+        all(root % i != 0
+            for i in range(2, math.isqrt(root) + 1))
diff --git a/solutions/1953. Maximum Number of Weeks for Which You Can Work/1953.py b/solutions/1953. Maximum Number of Weeks for Which You Can Work/1953.py
index 735b0d58ccc..77876578e74 100644
--- a/solutions/1953. Maximum Number of Weeks for Which You Can Work/1953.py	
+++ b/solutions/1953. Maximum Number of Weeks for Which You Can Work/1953.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfWeeks(self, milestones: list[int]) -> int:
+  def numberOfWeeks(self, milestones: List[int]) -> int:
     # The best strategy is to pick 'max, nonMax, max, nonMax, ...'.
     summ = sum(milestones)
     nonMax = summ - max(milestones)
diff --git a/solutions/1954. Minimum Garden Perimeter to Collect Enough Apples/1954.py b/solutions/1954. Minimum Garden Perimeter to Collect Enough Apples/1954.py
index db3d2d24c9b..8b723a36508 100644
--- a/solutions/1954. Minimum Garden Perimeter to Collect Enough Apples/1954.py	
+++ b/solutions/1954. Minimum Garden Perimeter to Collect Enough Apples/1954.py	
@@ -25,4 +25,4 @@ def numApples(k: int) -> int:
       return 2 * k * (k + 1) * (2 * k + 1)
 
     return bisect.bisect_left(range(100_000), neededApples,
-                              key=numApples) * 8
+                              key=lambda m: numApples(m)) * 8
diff --git a/solutions/1955. Count Number of Special Subsequences/1955-2.java b/solutions/1955. Count Number of Special Subsequences/1955-2.java
index bdc2afad5bc..3bb2effd010 100644
--- a/solutions/1955. Count Number of Special Subsequences/1955-2.java	
+++ b/solutions/1955. Count Number of Special Subsequences/1955-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int countSpecialSubsequences(int[] nums) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = nums.length;
     // dp[i][j] := the number of increasing subsequences of the first i numbers
     // that end in j
@@ -30,7 +30,7 @@ else if (nums[i] == 1)
         dp[i][2] = dp[i - 1][2] * 2 + dp[i - 1][1];
 
       for (int ending = 0; ending < 3; ++ending)
-        dp[i][ending] %= MOD;
+        dp[i][ending] %= kMod;
     }
 
     return (int) dp[n - 1][2];
diff --git a/solutions/1955. Count Number of Special Subsequences/1955-2.py b/solutions/1955. Count Number of Special Subsequences/1955-2.py
index f50a39536e3..44776aad8d7 100644
--- a/solutions/1955. Count Number of Special Subsequences/1955-2.py	
+++ b/solutions/1955. Count Number of Special Subsequences/1955-2.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def countSpecialSubsequences(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
+  def countSpecialSubsequences(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
     n = len(nums)
     # dp[i][j] := the number of increasing subsequences of the first i numbers
     # that end in j
@@ -30,6 +30,6 @@ def countSpecialSubsequences(self, nums: list[int]) -> int:
         dp[i][2] = dp[i - 1][2] * 2 + dp[i - 1][1]
 
       for ending in range(3):
-        dp[i][ending] %= MOD
+        dp[i][ending] %= kMod
 
     return dp[-1][2]
diff --git a/solutions/1955. Count Number of Special Subsequences/1955-3.java b/solutions/1955. Count Number of Special Subsequences/1955-3.java
index 2ba937c5197..89f571e9b0e 100644
--- a/solutions/1955. Count Number of Special Subsequences/1955-3.java	
+++ b/solutions/1955. Count Number of Special Subsequences/1955-3.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int countSpecialSubsequences(int[] nums) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = nums.length;
     // dp[j] := the number of increasing subsequences of the numbers so far that
     // end in j
@@ -18,7 +18,7 @@ else if (nums[i] == 1)
         dp[2] = dp[2] * 2 + dp[1];
 
       for (int ending = 0; ending < 3; ++ending)
-        dp[ending] %= MOD;
+        dp[ending] %= kMod;
     }
 
     return (int) dp[2];
diff --git a/solutions/1955. Count Number of Special Subsequences/1955-3.py b/solutions/1955. Count Number of Special Subsequences/1955-3.py
index a65e8bbf78f..7556a1401f3 100644
--- a/solutions/1955. Count Number of Special Subsequences/1955-3.py	
+++ b/solutions/1955. Count Number of Special Subsequences/1955-3.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def countSpecialSubsequences(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
+  def countSpecialSubsequences(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
     n = len(nums)
     # dp[j] := the number of increasing subsequences of the numbers so far that
     # end in j
@@ -18,6 +18,6 @@ def countSpecialSubsequences(self, nums: list[int]) -> int:
         dp[2] = dp[2] * 2 + dp[1]
 
       for ending in range(3):
-        dp[ending] %= MOD
+        dp[ending] %= kMod
 
     return dp[2]
diff --git a/solutions/1955. Count Number of Special Subsequences/1955.java b/solutions/1955. Count Number of Special Subsequences/1955.java
index dd4cffa83e0..06930024e00 100644
--- a/solutions/1955. Count Number of Special Subsequences/1955.java	
+++ b/solutions/1955. Count Number of Special Subsequences/1955.java	
@@ -4,7 +4,7 @@ public int countSpecialSubsequences(int[] nums) {
     return countSpecialSubsequences(nums, 0, -1, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of increasing subsequences of the first i numbers, where
   // the previous number is `prev`.
@@ -30,7 +30,7 @@ int countSpecialSubsequences(int[] nums, int i, int prev, Integer[][] mem) {
     if (prev == 1 && nums[i] == 2)
       res += countSpecialSubsequences(nums, i + 1, 2, mem);
 
-    res %= MOD;
+    res %= kMod;
     return mem[i][j] = (int) res;
   }
 }
diff --git a/solutions/1955. Count Number of Special Subsequences/1955.py b/solutions/1955. Count Number of Special Subsequences/1955.py
index c1b42479c02..d586f5c127d 100644
--- a/solutions/1955. Count Number of Special Subsequences/1955.py	
+++ b/solutions/1955. Count Number of Special Subsequences/1955.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def countSpecialSubsequences(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
+  def countSpecialSubsequences(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
 
     @functools.lru_cache(None)
     def dp(i: int, prev: int) -> int:
@@ -26,7 +26,7 @@ def dp(i: int, prev: int) -> int:
       if prev == 1 and nums[i] == 2:
         res += dp(i + 1, 2)
 
-      res %= MOD
+      res %= kMod
       return res
 
     return dp(0, -1)
diff --git a/solutions/1956. Minimum Time For K Virus Variants to Spread/1956.java b/solutions/1956. Minimum Time For K Virus Variants to Spread/1956.java
index d309ba4f3f2..279ced51d1e 100644
--- a/solutions/1956. Minimum Time For K Virus Variants to Spread/1956.java	
+++ b/solutions/1956. Minimum Time For K Virus Variants to Spread/1956.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int minDayskVariants(int[][] points, int k) {
-    final int MAX = 100;
+    final int kMax = 100;
     int ans = Integer.MAX_VALUE;
 
-    for (int a = 1; a <= MAX; ++a)
-      for (int b = 1; b <= MAX; ++b) {
+    for (int a = 1; a <= kMax; ++a)
+      for (int b = 1; b <= kMax; ++b) {
         // Stores the k minimum distances of points that can reach (a, b).
         Queue<Integer> maxHeap = new PriorityQueue<>(Collections.reverseOrder());
         for (int[] point : points) {
diff --git a/solutions/1956. Minimum Time For K Virus Variants to Spread/1956.py b/solutions/1956. Minimum Time For K Virus Variants to Spread/1956.py
index 6b570d160c3..9620b72def6 100644
--- a/solutions/1956. Minimum Time For K Virus Variants to Spread/1956.py	
+++ b/solutions/1956. Minimum Time For K Virus Variants to Spread/1956.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def minDayskVariants(self, points: list[list[int]], k: int) -> int:
-    MAX = 100
+  def minDayskVariants(self, points: List[List[int]], k: int) -> int:
+    kMax = 100
     ans = math.inf
 
-    for a in range(1, MAX + 1):
-      for b in range(1, MAX + 1):
+    for a in range(1, kMax + 1):
+      for b in range(1, kMax + 1):
         # Stores the k minimum distances of points that can reach (a, b).
         maxHeap = []
         for x, y in points:
diff --git a/solutions/1958. Check if Move is Legal/1958.cpp b/solutions/1958. Check if Move is Legal/1958.cpp
index 0d83c16ac2c..c9e160d8b42 100644
--- a/solutions/1958. Check if Move is Legal/1958.cpp	
+++ b/solutions/1958. Check if Move is Legal/1958.cpp	
@@ -2,10 +2,10 @@ class Solution {
  public:
   bool checkMove(vector<vector<char>>& board, int rMove, int cMove,
                  char color) {
-    constexpr int kDirs[8][2] = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1},
-                                 {0, 1},   {1, -1}, {1, 0},  {1, 1}};
+    const vector<pair<int, int>> dirs{{-1, -1}, {-1, 0}, {-1, 1}, {0, -1},
+                                      {0, 1},   {1, -1}, {1, 0},  {1, 1}};
 
-    for (const auto& [dx, dy] : kDirs) {
+    for (const auto& [dx, dy] : dirs) {
       int cellsCount = 2;
       int i = rMove + dx;
       int j = cMove + dy;
diff --git a/solutions/1958. Check if Move is Legal/1958.java b/solutions/1958. Check if Move is Legal/1958.java
index 657e9b5b3ca..6c16ac5b50d 100644
--- a/solutions/1958. Check if Move is Legal/1958.java	
+++ b/solutions/1958. Check if Move is Legal/1958.java	
@@ -1,6 +1,6 @@
 class Solution {
   public boolean checkMove(char[][] board, int rMove, int cMove, char color) {
-    final int[][] DIRS = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}};
+    final int[][] dirs = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}};
 
     for (int k = 0; k < 8; ++k) {
       final int dx = dir[0][0];
diff --git a/solutions/1958. Check if Move is Legal/1958.py b/solutions/1958. Check if Move is Legal/1958.py
index 8656e03f43b..0081889c5f5 100644
--- a/solutions/1958. Check if Move is Legal/1958.py	
+++ b/solutions/1958. Check if Move is Legal/1958.py	
@@ -1,15 +1,9 @@
 class Solution:
-  def checkMove(
-      self,
-      board: list[list[str]],
-      rMove: int,
-      cMove: int,
-      color: str,
-  ) -> bool:
-    DIRS = ((-1, -1), (-1, 0), (-1, 1), (0, -1),
+  def checkMove(self, board: List[List[str]], rMove: int, cMove: int, color: str) -> bool:
+    dirs = ((-1, -1), (-1, 0), (-1, 1), (0, -1),
             (0, 1), (1, -1), (1, 0), (1, 1))
 
-    for dx, dy in DIRS:
+    for dx, dy in dirs:
       cellsCount = 2
       i = rMove + dx
       j = cMove + dy
diff --git a/solutions/1959. Minimum Total Space Wasted With K Resizing Operations/1959.java b/solutions/1959. Minimum Total Space Wasted With K Resizing Operations/1959.java
index 83f05657a9c..d57d1fff7c0 100644
--- a/solutions/1959. Minimum Total Space Wasted With K Resizing Operations/1959.java	
+++ b/solutions/1959. Minimum Total Space Wasted With K Resizing Operations/1959.java	
@@ -4,18 +4,18 @@ public int minSpaceWastedKResizing(int[] nums, int k) {
     return minSpaceWasted(nums, 0, k, mem);
   }
 
-  private static final int MAX = 200_000_000;
+  private static final int kMax = 200_000_000;
 
   // Returns the minimum space wasted for nums[i..n) if you can resize k times.
   private int minSpaceWasted(int[] nums, int i, int k, Integer[][] mem) {
     if (i == nums.length)
       return 0;
     if (k == -1)
-      return MAX;
+      return kMax;
     if (mem[i][k] != null)
       return mem[i][k];
 
-    int res = MAX;
+    int res = kMax;
     int sum = 0;
     int maxNum = nums[i];
 
diff --git a/solutions/1959. Minimum Total Space Wasted With K Resizing Operations/1959.py b/solutions/1959. Minimum Total Space Wasted With K Resizing Operations/1959.py
index 5ecaf96f6cf..d7015254c02 100644
--- a/solutions/1959. Minimum Total Space Wasted With K Resizing Operations/1959.py	
+++ b/solutions/1959. Minimum Total Space Wasted With K Resizing Operations/1959.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def minSpaceWastedKResizing(self, nums: list[int], k: int) -> int:
-    MAX = 200_000_000
+  def minSpaceWastedKResizing(self, nums: List[int], k: int) -> int:
+    kMax = 200_000_000
 
     @functools.lru_cache(None)
     def dp(i: int, k: int) -> int:
@@ -10,9 +10,9 @@ def dp(i: int, k: int) -> int:
       if i == len(nums):
         return 0
       if k == -1:
-        return MAX
+        return kMax
 
-      res = MAX
+      res = kMax
       summ = 0
       maxNum = nums[i]
 
diff --git a/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960-2.cpp b/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960-2.cpp
index 061c4fbf7e5..339f9813750 100644
--- a/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960-2.cpp	
+++ b/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960-2.cpp	
@@ -3,77 +3,70 @@ class Solution {
   long long maxProduct(string s) {
     const int n = s.length();
     long ans = 1;
-    vector<long> pows{1};  // pows[i] := kBase^i % kHash
-    // hashL[i] = the hash of the first i letters of s, where hashL[i] =
-    // (26^(i - 1) * s[0] + 26^(i - 2) * s[1] + ... + s[i - 1]) % kHash
-    vector<long> hashL{0};
-    // hashR[i] = the hash of the last i letters of s, where hashR[i] =
-    // (26^(i - 1) * s[-1] + 26^(i - 2) * s[-2] + ... + s[-i]) % kHash
-    vector<long> hashR{0};
-    // maxLeft[i] := the maximum odd length of palindromes in s[0..i]
-    vector<int> maxLeft(n);
-    // maxRight[i] := the maximum odd length of palindromes in s[i..n - 1]
-    vector<int> maxRight(n);
+    vector<long> pow(n + 1);        // pow[i] := kBase^i
+    vector<long> hashFromL(n + 1);  // hashFromL[i] = the hash of s[0..i)
+    vector<long> hashFromR(n + 1);  // hashFromR[i] = the hash of s[i..n)
+    vector<int> l(n);  // l[i] := the maximum length of palindromes in s[0..i)
+    vector<int> r(n);  // r[i] := the maximum length of palindromes in s[i..n)
 
-    for (int i = 0; i < n; ++i)
-      pows.push_back(pows.back() * kBase % kHash);
+    pow[0] = 1;
+    for (int i = 1; i <= n; ++i)
+      pow[i] = pow[i - 1] * kBase % kMod;
 
-    for (int i = 0; i < n; ++i)
-      hashL.push_back((hashL.back() * kBase + val(s[i])) % kHash);
+    for (int i = 1; i <= n; ++i)
+      hashFromL[i] = (hashFromL[i - 1] * kBase + val(s[i - 1])) % kMod;
 
     for (int i = n - 1; i >= 0; --i)
-      hashR.push_back((hashR.back() * kBase + val(s[i])) % kHash);
+      hashFromR[i] = (hashFromR[i + 1] * kBase + val(s[i])) % kMod;
 
-    ranges::reverse(hashR);
-
-    int maxLength = 1;
-    for (int r = 0; r < n; ++r) {
-      const int l = (r - maxLength - 2) + 1;
-      if (l >= 0 && isPalindrome(l, r + 1, hashL, hashR, pows))
-        maxLength += 2;
-      maxLeft[r] = maxLength;
+    int mx = 1;  // the maximum length of palindromes so far
+    for (int i = 0; i < n; i++) {
+      if (i - mx - 1 >= 0 &&
+          isPalindrome(i - mx - 1, i + 1, hashFromL, hashFromR, pow))
+        mx += 2;
+      l[i] = mx;
     }
 
-    maxLength = 1;
-    for (int l = n - 1; l >= 0; --l) {
-      const int r = (l + maxLength + 2) - 1;
-      if (r < n && isPalindrome(l, r + 1, hashL, hashR, pows))
-        maxLength += 2;
-      maxRight[l] = maxLength;
+    // Fill in r.
+    mx = 1;
+    for (int i = n - 1; i >= 0; i--) {
+      if (i + mx + 2 <= n &&
+          isPalindrome(i, i + mx + 2, hashFromL, hashFromR, pow))
+        mx += 2;
+      r[i] = mx;
     }
 
-    for (int i = 1; i < n; ++i)
-      ans = max(ans, static_cast<long>(maxLeft[i - 1]) * maxRight[i]);
+    for (int i = 0; i + 1 < n; ++i)
+      ans = max(ans, static_cast<long>(l[i]) * r[i + 1]);
 
     return ans;
   }
 
  private:
   static constexpr int kBase = 26;
-  static constexpr int kHash = 1'000'000'007;
+  static constexpr int kMod = 1'000'000'007;
 
-  static constexpr int val(char c) {
-    return c - 'a';
+  // Returns true if s[l..r) is a palindrome.
+  bool isPalindrome(int l, int r, const vector<long>& hashFromL,
+                    const vector<long>& hashFromR, const vector<long>& pow) {
+    return leftHash(l, r, hashFromL, pow) == rightHash(l, r, hashFromR, pow);
   }
 
-  // Returns true if s[l..r) is a palindrome.
-  bool isPalindrome(int l, int r, const vector<long>& hashL,
-                    const vector<long>& hashR, const vector<long>& pows) {
-    return getLeftRollingHash(l, r, hashL, pows) ==
-           getRightRollingHash(l, r, hashR, pows);
+  // Returns the hash of s[l..r) from the left.
+  long leftHash(int l, int r, const vector<long>& hashFromL,
+                const vector<long>& pow) {
+    const long hash = (hashFromL[r] - hashFromL[l] * pow[r - l]) % kMod;
+    return hash < 0 ? hash + kMod : hash;
   }
 
-  // Returns the left rolling hash of s[l..r).
-  long getLeftRollingHash(int l, int r, const vector<long>& hashL,
-                          const vector<long>& pows) {
-    const long h = (hashL[r] - hashL[l] * pows[r - l]) % kHash;
-    return h < 0 ? h + kHash : h;
+  // Returns the hash of s[l..r) from the right.
+  long rightHash(int l, int r, const vector<long>& hashFromR,
+                 const vector<long>& pow) {
+    const long hash = (hashFromR[l] - hashFromR[r] * pow[r - l]) % kMod;
+    return hash < 0 ? hash + kMod : hash;
   }
 
-  // Returns the right rolling hash of s[l..r).
-  long getRightRollingHash(int l, int r, const vector<long>& hashR,
-                           const vector<long>& pows) {
-    const long h = (hashR[l] - hashR[r] * pows[r - l]) % kHash;
-    return h < 0 ? h + kHash : h;
+  constexpr int val(char c) {
+    return c - 'a';
   }
 };
diff --git a/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960-2.java b/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960-2.java
index 5289615e8ec..df57de4f61c 100644
--- a/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960-2.java	
+++ b/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960-2.java	
@@ -2,71 +2,64 @@ class Solution {
   public long maxProduct(String s) {
     final int n = s.length();
     long ans = 1;
-    long[] pows = new long[n + 1]; // pows[i] := BASE^i % HASH
-    // hashL[i] = the hash of the first i letters of s, where hashL[i] =
-    // (26^(i - 1) * s[0] + 26^(i - 2) * s[1] + ... + s[i - 1]) % HASH
-    long[] hashL = new long[n + 1];
-    // hashR[i] = the hash of the last i letters of s, where hashR[i] =
-    // (26^(i - 1) * s[-1] + 26^(i - 2) * s[-2] + ... + s[-i]) % HASH
-    long[] hashR = new long[n + 1];
-    // maxLeft[i] := the maximum odd length of palindromes in s[0..i]
-    int[] maxLeft = new int[n];
-    // maxRight[i] := the maximum odd length of palindromes in s[i..n - 1]
-    int[] maxRight = new int[n];
+    long[] pow = new long[n + 1];       // pow[i] := kBase^i
+    long[] hashFromL = new long[n + 1]; // hashFromL[i] = the hash of s[0..i)
+    long[] hashFromR = new long[n + 1]; // hashFromR[i] = the hash of s[i..n)
+    int[] l = new int[n];               // l[i] := the maximum length of palindromes in s[0..i)
+    int[] r = new int[n];               // r[i] := the maximum length of palindromes in s[i..n)
 
-    pows[0] = 1;
+    pow[0] = 1;
     for (int i = 1; i <= n; ++i)
-      pows[i] = pows[i - 1] * BASE % HASH;
+      pow[i] = pow[i - 1] * kBase % kMod;
 
     for (int i = 1; i <= n; ++i)
-      hashL[i] = (hashL[i - 1] * BASE + val(s.charAt(i - 1))) % HASH;
+      hashFromL[i] = (hashFromL[i - 1] * kBase + val(s.charAt(i - 1))) % kMod;
 
     for (int i = n - 1; i >= 0; --i)
-      hashR[i] = (hashR[i + 1] * BASE + val(s.charAt(i))) % HASH;
+      hashFromR[i] = (hashFromR[i + 1] * kBase + val(s.charAt(i))) % kMod;
 
-    int maxLength = 1;
-    for (int r = 0; r < n; ++r) {
-      final int l = (r - maxLength - 2) + 1;
-      if (l >= 0 && isPalindrome(l, r + 1, hashL, hashR, pows))
-        maxLength += 2;
-      maxLeft[r] = maxLength;
+    int mx = 1; // the maximum length of palindromes so far
+    for (int i = 0; i < n; i++) {
+      if (i - mx - 1 >= 0 && isPalindrome(i - mx - 1, i + 1, hashFromL, hashFromR, pow))
+        mx += 2;
+      l[i] = mx;
     }
 
-    maxLength = 1;
-    for (int l = n - 1; l >= 0; --l) {
-      final int r = (l + maxLength + 2) - 1;
-      if (r < n && isPalindrome(l, r + 1, hashL, hashR, pows))
-        maxLength += 2;
-      maxRight[l] = maxLength;
+    // Fill in r.
+    mx = 1;
+    for (int i = n - 1; i >= 0; i--) {
+      if (i + mx + 2 <= n && isPalindrome(i, i + mx + 2, hashFromL, hashFromR, pow))
+        mx += 2;
+      r[i] = mx;
     }
 
-    for (int i = 1; i < n; ++i)
-      ans = Math.max(ans, (long) maxLeft[i - 1] * maxRight[i]);
+    for (int i = 0; i + 1 < n; ++i)
+      ans = Math.max(ans, (long) l[i] * r[i + 1]);
 
     return ans;
   }
 
-  private static final int BASE = 26;
-  private static final int HASH = 1_000_000_007;
+  private static final int kBase = 26;
+  private static final int kMod = 1_000_000_007;
 
-  private static int val(char c) {
-    return c - 'a';
+  // Returns true if s[l..r) is a palindrome.
+  private boolean isPalindrome(int l, int r, long[] hashFromL, long[] hashFromR, long[] pow) {
+    return leftHash(l, r, hashFromL, pow) == rightHash(l, r, hashFromR, pow);
   }
 
-  // Returns true if s[l..r) is a palindrome.
-  private boolean isPalindrome(int l, int r, long[] hashL, long[] hashR, long[] pows) {
-    return getLeftRollingHash(l, r, hashL, pows) == getRightRollingHash(l, r, hashR, pows);
+  // Returns the hash of s[l..r) from the left.
+  private long leftHash(int l, int r, long[] hashFromL, long[] pow) {
+    final long hash = (hashFromL[r] - hashFromL[l] * pow[r - l]) % kMod;
+    return hash < 0 ? hash + kMod : hash;
   }
 
-  // Returns the left rolling hash of s[l..r).
-  private long getLeftRollingHash(int l, int r, long[] hashL, long[] pows) {
-    final long h = (hashL[r] - hashL[l] * pows[r - l]) % HASH;
-    return h < 0 ? h + HASH : h;
+  // Returns the hash of s[l..r) from the right.
+  private long rightHash(int l, int r, long[] hashFromR, long[] pow) {
+    final long hash = (hashFromR[l] - hashFromR[r] * pow[r - l]) % kMod;
+    return hash < 0 ? hash + kMod : hash;
   }
 
-  // Returns the right rolling hash of s[l..r).
-  private long getRightRollingHash(int l, int r, long[] hashR, long[] pows) {
-    final long h = (hashR[l] - hashR[r] * pows[r - l]) % HASH;
-    return h < 0 ? h + HASH : h;
+  private int val(char c) {
+    return c - 'a';
   }
 }
diff --git a/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960-2.py b/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960-2.py
index 55855f5e3a6..53e50b3425f 100644
--- a/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960-2.py	
+++ b/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960-2.py	
@@ -1,60 +1,55 @@
 class Solution:
   def maxProduct(self, s: str) -> int:
-    BASE = 26
-    HASH = 1_000_000_007
+    kBase = 26
+    kMod = 1_000_000_007
     n = len(s)
-    pows = [1]  # pows[i] := BASE^i % HASH
-    # hashL[i] = the hash of the first i letters of s, where hashL[i] =
-    # (26^(i - 1) * s[0] + 26^(i - 2) * s[1] + ... + s[i - 1]) % HASH
-    hashL = [0]
-    # hashR[i] = the hash of the last i letters of s, where hashR[i] =
-    # (26^(i - 1) * s[-1] + 26^(i - 2) * s[-2] + ... + s[-i]) % HASH
-    hashR = [0]
-    # maxLeft[i] := the maximum odd length of palindromes in s[0..i]
-    maxLeft = [0] * n
-    # maxRight[i] := the maximum odd length of palindromes in s[i..n - 1]
-    maxRight = [0] * n
+    ans = 1
+    pow = [1] + [0] * n  # pow[i] := kBase^i
+    hashFromL = [0] * (n + 1)  # hashFromL[i] = the hash of s[0..i)
+    hashFromR = [0] * (n + 1)  # hashFromR[i] = the hash of s[i..n)
+    l = [0] * n  # l[i] := the maximum length of palindromes in s[0..i)
+    r = [0] * n  # r[i] := the maximum length of palindromes in s[i..n)
+
+    for i in range(1, n + 1):
+      pow[i] = pow[i - 1] * kBase % kMod
 
     def val(c: str) -> int:
       return ord(c) - ord('a')
 
-    for _ in range(n):
-      pows.append(pows[-1] * BASE % HASH)
-
-    for c in s:
-      hashL.append((hashL[-1] * BASE + val(c)) % HASH)
+    for i in range(1, n + 1):
+      hashFromL[i] = (hashFromL[i - 1] * kBase + val(s[i - 1])) % kMod
 
-    for c in reversed(s):
-      hashR.append((hashR[-1] * BASE + val(c)) % HASH)
+    for i in reversed(range(n)):
+      hashFromR[i] = (hashFromR[i + 1] * kBase + val(s[i])) % kMod
 
-    hashR.reverse()
+    # Returns the hash of s[l..r) from the left.
+    def leftHash(l: int, r: int) -> int:
+      hash = (hashFromL[r] - hashFromL[l] * pow[r - l]) % kMod
+      return hash + kMod if hash < 0 else hash
 
-    def getLeftRollingHash(l: int, r: int) -> int:
-      """Returns the left rolling hash of s[l..r)."""
-      h = (hashL[r] - hashL[l] * pows[r - l]) % HASH
-      return h + HASH if h < 0 else h
-
-    def getRightRollingHash(l: int, r: int) -> int:
-      """Returns the right rolling hash of s[l..r)."""
-      h = (hashR[l] - hashR[r] * pows[r - l]) % HASH
-      return h + HASH if h < 0 else h
+    # Returns the hash of s[l..r) from the right.
+    def rightHash(l: int, r: int) -> int:
+      hash = (hashFromR[l] - hashFromR[r] * pow[r - l]) % kMod
+      return hash + kMod if hash < 0 else hash
 
     def isPalindrome(l: int, r: int) -> bool:
       """Returns True if s[l..r) is a palindrome."""
-      return getLeftRollingHash(l, r) == getRightRollingHash(l, r)
-
-    maxLength = 1
-    for r in range(n):
-      l = (r - maxLength - 2) + 1
-      if l >= 0 and isPalindrome(l, r + 1):
-        maxLength += 2
-      maxLeft[r] = maxLength
-
-    maxLength = 1
-    for l in reversed(range(n)):
-      r = (l + maxLength + 2) - 1
-      if r < n and isPalindrome(l, r + 1):
-        maxLength += 2
-      maxRight[l] = maxLength
-
-    return max(maxLeft[i - 1] * maxRight[i] for i in range(1, n))
+      return leftHash(l, r) == rightHash(l, r)
+
+    mx = 1  # the maximum length of palindromes so far
+    for i in range(n):
+      if i - mx - 1 >= 0 and isPalindrome(i - mx - 1, i + 1):
+        mx += 2
+      l[i] = mx
+
+    # Fill in r.
+    mx = 1
+    for i in reversed(range(n)):
+      if i + mx + 2 <= n and isPalindrome(i, i + mx + 2):
+        mx += 2
+      r[i] = mx
+
+    for i in range(n - 1):
+      ans = max(ans, l[i] * r[i + 1])
+
+    return ans
diff --git a/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.cpp b/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.cpp
index 76af5594af1..51b7b472970 100644
--- a/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.cpp	
+++ b/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.cpp	
@@ -3,15 +3,14 @@ class Solution {
   long long maxProduct(string s) {
     const int n = s.length();
     long ans = 1;
-    // maxLeft[i] := the maximum odd length of palindromes in s[0..i]
-    vector<int> maxLeft = manacher(s, n);
-    // maxRight[i] := the maximum odd length of palindromes in s[i..n - 1]
-    vector<int> maxRight = manacher(string{s.rbegin(), s.rend()}, n);
+    // l[i] := the maximum length of palindromes in s[0..i)
+    vector<int> l = manacher(s, n);
+    // r[i] := the maximum length of palindromes in s[i..n)
+    vector<int> r = manacher(string(s.rbegin(), s.rend()), n);
+    reverse(r.begin(), r.end());
 
-    ranges::reverse(maxRight);
-
-    for (int i = 1; i < n; ++i)
-      ans = max(ans, static_cast<long>(maxLeft[i - 1]) * maxRight[i]);
+    for (int i = 0; i + 1 < n; ++i)
+      ans = max(ans, static_cast<long>(l[i]) * r[i + 1]);
 
     return ans;
   }
@@ -19,7 +18,7 @@ class Solution {
  private:
   vector<int> manacher(const string& s, int n) {
     vector<int> maxExtends(n);
-    vector<int> leftToRight(n, 1);
+    vector<int> l2r(n, 1);
     int center = 0;
 
     for (int i = 0; i < n; ++i) {
@@ -28,7 +27,7 @@ class Solution {
       int extend = i > r ? 1 : min(maxExtends[mirrorIndex], r - i + 1);
       while (i - extend >= 0 && i + extend < n &&
              s[i - extend] == s[i + extend]) {
-        leftToRight[i + extend] = 2 * extend + 1;
+        l2r[i + extend] = 2 * extend + 1;
         ++extend;
       }
       maxExtends[i] = extend;
@@ -37,8 +36,8 @@ class Solution {
     }
 
     for (int i = 1; i < n; ++i)
-      leftToRight[i] = max(leftToRight[i], leftToRight[i - 1]);
+      l2r[i] = max(l2r[i], l2r[i - 1]);
 
-    return leftToRight;
+    return l2r;
   }
 };
diff --git a/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.java b/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.java
index fe291ea10f0..a44acb991c2 100644
--- a/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.java	
+++ b/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.java	
@@ -2,23 +2,23 @@ class Solution {
   public long maxProduct(String s) {
     final int n = s.length();
     long ans = 1;
-    // maxLeft[i] := the maximum odd length of palindromes in s[0..i]
-    int[] maxLeft = manacher(s, n);
-    // maxRight[i] := the maximum odd length of palindromes in s[i..n - 1]
-    int[] maxRight = manacher(new StringBuilder(s).reverse().toString(), n);
+    // l[i] := the maximum length of palindromes in s[0..i)
+    int[] l = manacher(s, n);
+    // r[i] := the maximum length of palindromes in s[i..n)
+    int[] r = manacher(new StringBuilder(s).reverse().toString(), n);
 
-    reverse(maxRight, 0, n - 1);
+    reverse(r, 0, n - 1);
 
-    for (int i = 1; i < n; ++i)
-      ans = Math.max(ans, (long) maxLeft[i - 1] * maxRight[i]);
+    for (int i = 0; i + 1 < n; ++i)
+      ans = Math.max(ans, (long) l[i] * r[i + 1]);
 
     return ans;
   }
 
   private int[] manacher(final String s, int n) {
     int[] maxExtends = new int[n];
-    int[] leftToRight = new int[n];
-    Arrays.fill(leftToRight, 1);
+    int[] l2r = new int[n];
+    Arrays.fill(l2r, 1);
     int center = 0;
 
     for (int i = 0; i < n; ++i) {
@@ -26,7 +26,7 @@ private int[] manacher(final String s, int n) {
       final int mirrorIndex = center - (i - center);
       int extend = i > r ? 1 : Math.min(maxExtends[mirrorIndex], r - i + 1);
       while (i - extend >= 0 && i + extend < n && s.charAt(i - extend) == s.charAt(i + extend)) {
-        leftToRight[i + extend] = 2 * extend + 1;
+        l2r[i + extend] = 2 * extend + 1;
         ++extend;
       }
       maxExtends[i] = extend;
@@ -35,19 +35,19 @@ private int[] manacher(final String s, int n) {
     }
 
     for (int i = 1; i < n; ++i)
-      leftToRight[i] = Math.max(leftToRight[i], leftToRight[i - 1]);
+      l2r[i] = Math.max(l2r[i], l2r[i - 1]);
 
-    return leftToRight;
+    return l2r;
   }
 
-  private void reverse(int[] arr, int l, int r) {
+  private void reverse(int[] A, int l, int r) {
     while (l < r)
-      swap(arr, l++, r--);
+      swap(A, l++, r--);
   }
 
-  private void swap(int[] arr, int i, int j) {
-    final int temp = arr[i];
-    arr[i] = arr[j];
-    arr[j] = temp;
+  private void swap(int[] A, int i, int j) {
+    final int temp = A[i];
+    A[i] = A[j];
+    A[j] = temp;
   }
 }
diff --git a/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.py b/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.py
index 96fdbfdc0db..2e75c5a2a63 100644
--- a/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.py	
+++ b/solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.py	
@@ -2,9 +2,9 @@ class Solution:
   def maxProduct(self, s: str) -> int:
     n = len(s)
 
-    def manacher(s: str) -> list[int]:
+    def manacher(s: str) -> List[int]:
       maxExtends = [0] * n
-      leftToRight = [1] * n
+      l2r = [1] * n
       center = 0
 
       for i in range(n):
@@ -12,19 +12,19 @@ def manacher(s: str) -> list[int]:
         mirrorIndex = center - (i - center)
         extend = 1 if i > r else min(maxExtends[mirrorIndex], r - i + 1)
         while i - extend >= 0 and i + extend < n and s[i - extend] == s[i + extend]:
-          leftToRight[i + extend] = 2 * extend + 1
+          l2r[i + extend] = 2 * extend + 1
           extend += 1
         maxExtends[i] = extend
         if i + maxExtends[i] >= r:
           center = i
 
       for i in range(1, n):
-        leftToRight[i] = max(leftToRight[i], leftToRight[i - 1])
+        l2r[i] = max(l2r[i], l2r[i - 1])
 
-      return leftToRight
+      return l2r
 
-    # maxLeft[i] := the maximum odd length of palindromes in s[0..i]
-    maxLeft = manacher(s)
-    # maxRight[i] := the maximum odd length of palindromes in s[i..n - 1]
-    maxRight = manacher(s[::-1])[::-1]
-    return max(maxLeft[i - 1] * maxRight[i] for i in range(1, n))
+    # l[i] := the maximum length of palindromes in s[0..i)
+    l = manacher(s)
+    # r[i] := the maximum length of palindromes in s[i..n)
+    r = manacher(s[::-1])[::-1]
+    return max(l[i] * r[i + 1] for i in range(n - 1))
diff --git a/solutions/1961. Check If String Is a Prefix of Array/1961.py b/solutions/1961. Check If String Is a Prefix of Array/1961.py
index b2311c2b4b6..60db33d46b7 100644
--- a/solutions/1961. Check If String Is a Prefix of Array/1961.py	
+++ b/solutions/1961. Check If String Is a Prefix of Array/1961.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isPrefixString(self, s: str, words: list[str]) -> bool:
+  def isPrefixString(self, s: str, words: List[str]) -> bool:
     prefix = []
     for word in words:
       prefix.append(word)
diff --git a/solutions/1962. Remove Stones to Minimize the Total/1962.py b/solutions/1962. Remove Stones to Minimize the Total/1962.py
index 7c8282ece62..22330ac9b13 100644
--- a/solutions/1962. Remove Stones to Minimize the Total/1962.py	
+++ b/solutions/1962. Remove Stones to Minimize the Total/1962.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minStoneSum(self, piles: list[int], k: int) -> int:
+  def minStoneSum(self, piles: List[int], k: int) -> int:
     maxHeap = [-pile for pile in piles]
     heapq.heapify(maxHeap)
 
diff --git a/solutions/1964. Find the Longest Valid Obstacle Course at Each Position/1964.cpp b/solutions/1964. Find the Longest Valid Obstacle Course at Each Position/1964.cpp
index 9c09a67fc93..b4c214c5d70 100644
--- a/solutions/1964. Find the Longest Valid Obstacle Course at Each Position/1964.cpp	
+++ b/solutions/1964. Find the Longest Valid Obstacle Course at Each Position/1964.cpp	
@@ -3,17 +3,17 @@ class Solution {
   // Similar to 300. Longest Increasing Subsequence
   vector<int> longestObstacleCourseAtEachPosition(vector<int>& obstacles) {
     vector<int> ans;
-    // tails[i] := the minimum tail of all the increasing subsequences having
+    // tail[i] := the minimum tail of all the increasing subsequences having
     // length i + 1
-    vector<int> tails;
+    vector<int> tail;
 
     for (const int obstacle : obstacles)
-      if (tails.empty() || obstacle >= tails.back()) {
-        tails.push_back(obstacle);
-        ans.push_back(tails.size());
+      if (tail.empty() || obstacle >= tail.back()) {
+        tail.push_back(obstacle);
+        ans.push_back(tail.size());
       } else {
-        const int index = firstGreater(tails, obstacle);
-        tails[index] = obstacle;
+        const int index = firstGreater(tail, obstacle);
+        tail[index] = obstacle;
         ans.push_back(index + 1);
       }
 
@@ -21,7 +21,7 @@ class Solution {
   }
 
  private:
-  int firstGreater(const vector<int>& arr, int target) {
-    return ranges::upper_bound(arr, target) - arr.begin();
+  int firstGreater(const vector<int>& A, int target) {
+    return ranges::upper_bound(A, target) - A.begin();
   }
 };
diff --git a/solutions/1964. Find the Longest Valid Obstacle Course at Each Position/1964.java b/solutions/1964. Find the Longest Valid Obstacle Course at Each Position/1964.java
index 8221b171c06..042575ea3b8 100644
--- a/solutions/1964. Find the Longest Valid Obstacle Course at Each Position/1964.java	
+++ b/solutions/1964. Find the Longest Valid Obstacle Course at Each Position/1964.java	
@@ -2,29 +2,29 @@ class Solution {
   // Similar to 300. Longest Increasing Subsequence
   public int[] longestObstacleCourseAtEachPosition(int[] obstacles) {
     List<Integer> ans = new ArrayList<>();
-    // tails[i] := the minimum tail of all the increasing subsequences with
+    // tail[i] := the minimum tail of all the increasing subsequences with
     // length i + 1
-    List<Integer> tails = new ArrayList<>();
+    List<Integer> tail = new ArrayList<>();
 
     for (final int obstacle : obstacles)
-      if (tails.isEmpty() || obstacle >= tails.get(tails.size() - 1)) {
-        tails.add(obstacle);
-        ans.add(tails.size());
+      if (tail.isEmpty() || obstacle >= tail.get(tail.size() - 1)) {
+        tail.add(obstacle);
+        ans.add(tail.size());
       } else {
-        final int index = firstGreater(tails, obstacle);
-        tails.set(index, obstacle);
+        final int index = firstGreater(tail, obstacle);
+        tail.set(index, obstacle);
         ans.add(index + 1);
       }
 
     return ans.stream().mapToInt(Integer::intValue).toArray();
   }
 
-  private int firstGreater(List<Integer> arr, int target) {
+  private int firstGreater(List<Integer> A, int target) {
     int l = 0;
-    int r = arr.size();
+    int r = A.size();
     while (l < r) {
       final int m = (l + r) / 2;
-      if (arr.get(m) > target)
+      if (A.get(m) > target)
         r = m;
       else
         l = m + 1;
diff --git a/solutions/1964. Find the Longest Valid Obstacle Course at Each Position/1964.py b/solutions/1964. Find the Longest Valid Obstacle Course at Each Position/1964.py
index 67bc1173e3a..54b20873099 100644
--- a/solutions/1964. Find the Longest Valid Obstacle Course at Each Position/1964.py	
+++ b/solutions/1964. Find the Longest Valid Obstacle Course at Each Position/1964.py	
@@ -1,20 +1,18 @@
 class Solution:
   # Similar to 300. Longest Increasing Subsequence
-  def longestObstacleCourseAtEachPosition(
-      self, obstacles: list[int],
-  ) -> list[int]:
+  def longestObstacleCourseAtEachPosition(self, obstacles: List[int]) -> List[int]:
     ans = []
-    # tails[i] := the minimum tail of all the increasing subsequences having
+    # tail[i] := the minimum tail of all the increasing subsequences having
     # length i + 1
-    tails = []
+    tail = []
 
     for obstacle in obstacles:
-      if not tails or obstacle >= tails[-1]:
-        tails.append(obstacle)
-        ans.append(len(tails))
+      if not tail or obstacle >= tail[-1]:
+        tail.append(obstacle)
+        ans.append(len(tail))
       else:
-        index = bisect.bisect_right(tails, obstacle)
-        tails[index] = obstacle
+        index = bisect.bisect_right(tail, obstacle)
+        tail[index] = obstacle
         ans.append(index + 1)
 
     return ans
diff --git a/solutions/1966. Binary Searchable Numbers in an Unsorted Array/1966.py b/solutions/1966. Binary Searchable Numbers in an Unsorted Array/1966.py
index 0d32af0dd4e..730c13d5949 100644
--- a/solutions/1966. Binary Searchable Numbers in an Unsorted Array/1966.py	
+++ b/solutions/1966. Binary Searchable Numbers in an Unsorted Array/1966.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def binarySearchableNumbers(self, nums: list[int]) -> int:
+  def binarySearchableNumbers(self, nums: List[int]) -> int:
     n = len(nums)
     # prefixMaxs[i] := max(nums[0..i))
     prefixMaxs = [0] * n
diff --git a/solutions/1967. Number of Strings That Appear as Substrings in Word/1967.py b/solutions/1967. Number of Strings That Appear as Substrings in Word/1967.py
index e648d3841f0..a7d17ac754b 100644
--- a/solutions/1967. Number of Strings That Appear as Substrings in Word/1967.py	
+++ b/solutions/1967. Number of Strings That Appear as Substrings in Word/1967.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def numOfStrings(self, patterns: list[str], word: str) -> int:
+  def numOfStrings(self, patterns: List[str], word: str) -> int:
     return sum(pattern in word for pattern in patterns)
diff --git a/solutions/1968. Array With Elements Not Equal to Average of Neighbors/1968.py b/solutions/1968. Array With Elements Not Equal to Average of Neighbors/1968.py
index a396e88871c..035f0d6a4b7 100644
--- a/solutions/1968. Array With Elements Not Equal to Average of Neighbors/1968.py	
+++ b/solutions/1968. Array With Elements Not Equal to Average of Neighbors/1968.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def rearrangeArray(self, nums: list[int]) -> list[int]:
+  def rearrangeArray(self, nums: List[int]) -> List[int]:
     nums.sort()
     for i in range(1, len(nums), 2):
       nums[i], nums[i - 1] = nums[i - 1], nums[i]
diff --git a/solutions/1969. Minimum Non-Zero Product of the Array Elements/1969.java b/solutions/1969. Minimum Non-Zero Product of the Array Elements/1969.java
index 3670df3a802..431ce4595c1 100644
--- a/solutions/1969. Minimum Non-Zero Product of the Array Elements/1969.java	
+++ b/solutions/1969. Minimum Non-Zero Product of the Array Elements/1969.java	
@@ -3,17 +3,17 @@ public int minNonZeroProduct(int p) {
     // Can always turn [1..2^p - 1] to [1, 1, ..., 2^p - 2, 2^p - 2, 2^p - 1].
     final long n = 1L << p;
     final long halfCount = n / 2 - 1;
-    return (int) (modPow(n - 2, halfCount) * ((n - 1) % MOD) % MOD);
+    return (int) (modPow(n - 2, halfCount) * ((n - 1) % kMod) % kMod);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long modPow(long x, long n) {
     if (n == 0)
       return 1L;
-    x %= MOD;
+    x %= kMod;
     if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x, n / 2) % MOD;
+      return x * modPow(x, n - 1) % kMod;
+    return modPow(x * x, n / 2) % kMod;
   }
 }
diff --git a/solutions/1969. Minimum Non-Zero Product of the Array Elements/1969.py b/solutions/1969. Minimum Non-Zero Product of the Array Elements/1969.py
index f0adf183d8d..da86afd207f 100644
--- a/solutions/1969. Minimum Non-Zero Product of the Array Elements/1969.py	
+++ b/solutions/1969. Minimum Non-Zero Product of the Array Elements/1969.py	
@@ -1,7 +1,7 @@
 class Solution:
   def minNonZeroProduct(self, p: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # Can always turn [1..2^p - 1] to [1, 1, ..., 2^p - 2, 2^p - 2, 2^p - 1].
     n = 1 << p
     halfCount = n // 2 - 1
-    return pow(n - 2, halfCount, MOD) * ((n - 1) % MOD) % MOD
+    return pow(n - 2, halfCount, kMod) * ((n - 1) % kMod) % kMod
diff --git a/solutions/1970. Last Day Where You Can Still Cross/1970.cpp b/solutions/1970. Last Day Where You Can Still Cross/1970.cpp
index ecd7fa2cd5e..5b775103a02 100644
--- a/solutions/1970. Last Day Where You Can Still Cross/1970.cpp	
+++ b/solutions/1970. Last Day Where You Can Still Cross/1970.cpp	
@@ -19,7 +19,7 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   bool canWalk(int day, int row, int col, const vector<vector<int>>& cells) {
     vector<vector<int>> matrix(row, vector<int>(col));
@@ -40,7 +40,7 @@ class Solution {
     while (!q.empty()) {
       const auto [i, j] = q.front();
       q.pop();
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == row || y < 0 || y == col)
diff --git a/solutions/1970. Last Day Where You Can Still Cross/1970.java b/solutions/1970. Last Day Where You Can Still Cross/1970.java
index 67d69c313d5..14af2cc0aa6 100644
--- a/solutions/1970. Last Day Where You Can Still Cross/1970.java	
+++ b/solutions/1970. Last Day Where You Can Still Cross/1970.java	
@@ -17,7 +17,7 @@ public int latestDayToCross(int row, int col, int[][] cells) {
     return ans;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private boolean canWalk(int day, int row, int col, int[][] cells) {
     int[][] matrix = new int[row][col];
@@ -27,18 +27,18 @@ private boolean canWalk(int day, int row, int col, int[][] cells) {
       matrix[x][y] = 1;
     }
 
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>();
+    Queue<int[]> q = new ArrayDeque<>();
 
     for (int j = 0; j < col; ++j)
       if (matrix[0][j] == 0) {
-        q.offer(new Pair<>(0, j));
+        q.offer(new int[] {0, j});
         matrix[0][j] = 1;
       }
 
     while (!q.isEmpty()) {
-      final int i = q.peek().getKey();
-      final int j = q.poll().getValue();
-      for (int[] dir : DIRS) {
+      final int i = q.peek()[0];
+      final int j = q.poll()[1];
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == row || y < 0 || y == col)
@@ -47,7 +47,7 @@ private boolean canWalk(int day, int row, int col, int[][] cells) {
           continue;
         if (x == row - 1)
           return true;
-        q.offer(new Pair<>(x, y));
+        q.offer(new int[] {x, y});
         matrix[x][y] = 1;
       }
     }
diff --git a/solutions/1970. Last Day Where You Can Still Cross/1970.py b/solutions/1970. Last Day Where You Can Still Cross/1970.py
index 1c663764f3f..e77a6cdf91b 100644
--- a/solutions/1970. Last Day Where You Can Still Cross/1970.py	
+++ b/solutions/1970. Last Day Where You Can Still Cross/1970.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def latestDayToCross(self, row: int, col: int, cells: list[list[int]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def latestDayToCross(self, row: int, col: int, cells: List[List[int]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
 
     def canWalk(day: int) -> bool:
       matrix = [[0] * col for _ in range(row)]
@@ -17,7 +17,7 @@ def canWalk(day: int) -> bool:
 
       while q:
         i, j = q.popleft()
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == row or y < 0 or y == col:
diff --git a/solutions/1971. Find if Path Exists in Graph/1971.py b/solutions/1971. Find if Path Exists in Graph/1971.py
index ca81d107554..1c31ebcfb94 100644
--- a/solutions/1971. Find if Path Exists in Graph/1971.py	
+++ b/solutions/1971. Find if Path Exists in Graph/1971.py	
@@ -23,13 +23,7 @@ def find(self, u: int) -> int:
 
 
 class Solution:
-  def validPath(
-      self,
-      n: int,
-      edges: list[list[int]],
-      source: int,
-      destination: int,
-  ) -> bool:
+  def validPath(self, n: int, edges: List[List[int]], source: int, destination: int) -> bool:
     uf = UnionFind(n)
 
     for u, v in edges:
diff --git a/solutions/1972. First and Last Call On the Same Day/1972.sql b/solutions/1972. First and Last Call On the Same Day/1972.sql
index 6a52f39386b..cbc86d41c06 100644
--- a/solutions/1972. First and Last Call On the Same Day/1972.sql	
+++ b/solutions/1972. First and Last Call On the Same Day/1972.sql	
@@ -12,7 +12,7 @@ WITH
       RANK() OVER(
         PARTITION BY caller_id, DATE(call_time)
         ORDER BY call_time ASC
-      ) AS rank_asc,
+      ) AS rank_asc
       RANK() OVER(
         PARTITION BY caller_id, DATE(call_time)
         ORDER BY call_time DESC
diff --git a/solutions/1973. Count Nodes Equal to Sum of Descendants/1973.py b/solutions/1973. Count Nodes Equal to Sum of Descendants/1973.py
index d72e3ab8f72..1962e6af494 100644
--- a/solutions/1973. Count Nodes Equal to Sum of Descendants/1973.py	
+++ b/solutions/1973. Count Nodes Equal to Sum of Descendants/1973.py	
@@ -8,8 +8,8 @@ class T:
 
 
 class Solution:
-  def equalToDescendants(self, root: TreeNode | None) -> int:
-    def dfs(root: TreeNode | None) -> T:
+  def equalToDescendants(self, root: Optional[TreeNode]) -> int:
+    def dfs(root: Optional[TreeNode]) -> T:
       if not root:
         return T(0, 0)
       left = dfs(root.left)
diff --git a/solutions/1975. Maximum Matrix Sum/1975.py b/solutions/1975. Maximum Matrix Sum/1975.py
index 910e83047fe..0b8dec0d581 100644
--- a/solutions/1975. Maximum Matrix Sum/1975.py	
+++ b/solutions/1975. Maximum Matrix Sum/1975.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxMatrixSum(self, matrix: list[list[int]]) -> int:
+  def maxMatrixSum(self, matrix: List[List[int]]) -> int:
     absSum = 0
     minAbs = math.inf
     # 0 := even number of negatives
diff --git a/solutions/1976. Number of Ways to Arrive at Destination/1976.cpp b/solutions/1976. Number of Ways to Arrive at Destination/1976.cpp
index 4d3a3c78ee0..36ca47ac6dc 100644
--- a/solutions/1976. Number of Ways to Arrive at Destination/1976.cpp	
+++ b/solutions/1976. Number of Ways to Arrive at Destination/1976.cpp	
@@ -20,11 +20,11 @@ class Solution {
     constexpr int kMod = 1'000'000'007;
     vector<long> ways(graph.size());
     vector<long> dist(graph.size(), LONG_MAX);
+    using P = pair<long, int>;  // (d, u)
+    priority_queue<P, vector<P>, greater<>> minHeap;
 
     ways[src] = 1;
     dist[src] = 0;
-    using P = pair<long, int>;  // (d, u)
-    priority_queue<P, vector<P>, greater<>> minHeap;
     minHeap.emplace(dist[src], src);
 
     while (!minHeap.empty()) {
diff --git a/solutions/1976. Number of Ways to Arrive at Destination/1976.java b/solutions/1976. Number of Ways to Arrive at Destination/1976.java
index d3c4dabd62f..2bce18064c9 100644
--- a/solutions/1976. Number of Ways to Arrive at Destination/1976.java	
+++ b/solutions/1976. Number of Ways to Arrive at Destination/1976.java	
@@ -17,18 +17,16 @@ public int countPaths(int n, int[][] roads) {
   }
 
   private int dijkstra(List<Pair<Integer, Integer>>[] graph, int src, int dst) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long[] ways = new long[graph.length];
     Arrays.fill(ways, 0);
     long[] dist = new long[graph.length];
     Arrays.fill(dist, Long.MAX_VALUE);
+    Queue<Pair<Long, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
 
     ways[src] = 1;
     dist[src] = 0;
-    Queue<Pair<Long, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingLong(Pair::getKey)) {
-          { offer(new Pair<>(dist[src], src)); }
-        };
+    minHeap.offer(new Pair<>(dist[src], src));
 
     while (!minHeap.isEmpty()) {
       final long d = minHeap.peek().getKey();
@@ -44,7 +42,7 @@ private int dijkstra(List<Pair<Integer, Integer>>[] graph, int src, int dst) {
           minHeap.offer(new Pair<>(dist[v], v));
         } else if (d + w == dist[v]) {
           ways[v] += ways[u];
-          ways[v] %= MOD;
+          ways[v] %= kMod;
         }
       }
     }
diff --git a/solutions/1976. Number of Ways to Arrive at Destination/1976.py b/solutions/1976. Number of Ways to Arrive at Destination/1976.py
index 94a1c82bfb1..ba578594821 100644
--- a/solutions/1976. Number of Ways to Arrive at Destination/1976.py	
+++ b/solutions/1976. Number of Ways to Arrive at Destination/1976.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countPaths(self, n: int, roads: list[list[int]]) -> int:
+  def countPaths(self, n: int, roads: List[List[int]]) -> int:
     graph = [[] for _ in range(n)]
 
     for u, v, w in roads:
@@ -8,13 +8,8 @@ def countPaths(self, n: int, roads: list[list[int]]) -> int:
 
     return self._dijkstra(graph, 0, n - 1)
 
-  def _dijkstra(
-      self,
-      graph: list[list[tuple[int, int]]],
-      src: int,
-      dst: int,
-  ) -> int:
-    MOD = 10**9 + 7
+  def _dijkstra(self, graph: List[List[Tuple[int, int]]], src: int, dst: int) -> int:
+    kMod = 10**9 + 7
     ways = [0] * len(graph)
     dist = [math.inf] * len(graph)
 
@@ -33,6 +28,6 @@ def _dijkstra(
           heapq.heappush(minHeap, (dist[v], v))
         elif d + w == dist[v]:
           ways[v] += ways[u]
-          ways[v] %= MOD
+          ways[v] %= kMod
 
     return ways[dst]
diff --git a/solutions/1977. Number of Ways to Separate Numbers/1977.java b/solutions/1977. Number of Ways to Separate Numbers/1977.java
index b8aa7614edc..2e9199c8b15 100644
--- a/solutions/1977. Number of Ways to Separate Numbers/1977.java	
+++ b/solutions/1977. Number of Ways to Separate Numbers/1977.java	
@@ -3,7 +3,7 @@ public int numberOfCombinations(String num) {
     if (num.charAt(0) == '0')
       return 0;
 
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = num.length();
     // dp[i][k] := the number of possible lists of integers ending in num[i] with
     // the length of the last number being 1..k
@@ -19,7 +19,7 @@ public int numberOfCombinations(String num) {
     for (int i = 0; i < n; ++i)
       for (int k = 1; k <= i + 1; ++k) {
         dp[i][k] += dp[i][k - 1];
-        dp[i][k] %= MOD;
+        dp[i][k] %= kMod;
         // The last number is num[s..i].
         final int s = i - k + 1;
         if (num.charAt(s) == '0')
@@ -46,6 +46,6 @@ public int numberOfCombinations(String num) {
           dp[i][k] += dp[s - 1][k - 1];
       }
 
-    return (int) dp[n - 1][n] % MOD;
+    return (int) dp[n - 1][n] % kMod;
   }
 }
diff --git a/solutions/1977. Number of Ways to Separate Numbers/1977.py b/solutions/1977. Number of Ways to Separate Numbers/1977.py
index 320dc75bc1d..3a56a823744 100644
--- a/solutions/1977. Number of Ways to Separate Numbers/1977.py	
+++ b/solutions/1977. Number of Ways to Separate Numbers/1977.py	
@@ -3,7 +3,7 @@ def numberOfCombinations(self, num: str) -> int:
     if num[0] == '0':
       return 0
 
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     n = len(num)
     # dp[i][k] := the number of possible lists of integers ending in num[i]
     # with the length of the last number being 1..k
@@ -19,7 +19,7 @@ def numberOfCombinations(self, num: str) -> int:
     for i in range(n):
       for k in range(1, i + 2):
         dp[i][k] += dp[i][k - 1]
-        dp[i][k] %= MOD
+        dp[i][k] %= kMod
         # The last number is num[s..i].
         s = i - k + 1
         if num[s] == '0':
@@ -42,4 +42,4 @@ def numberOfCombinations(self, num: str) -> int:
           # Have enough length k but num[s - k..s - 1] > num[j..i].
           dp[i][k] += dp[s - 1][k - 1]
 
-    return dp[n - 1][n] % MOD
+    return dp[n - 1][n] % kMod
diff --git a/solutions/1979. Find Greatest Common Divisor of Array/1979.py b/solutions/1979. Find Greatest Common Divisor of Array/1979.py
index 601dc47dea6..a708fa1b689 100644
--- a/solutions/1979. Find Greatest Common Divisor of Array/1979.py	
+++ b/solutions/1979. Find Greatest Common Divisor of Array/1979.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def findGCD(self, nums: list[int]) -> int:
+  def findGCD(self, nums: List[int]) -> int:
     return math.gcd(min(nums), max(nums))
diff --git a/solutions/198. House Robber/198-2.py b/solutions/198. House Robber/198-2.py
index 73361d8f7f5..2122b49d2ef 100644
--- a/solutions/198. House Robber/198-2.py	
+++ b/solutions/198. House Robber/198-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def rob(self, nums: list[int]) -> int:
+  def rob(self, nums: List[int]) -> int:
     prev1 = 0  # dp[i - 1]
     prev2 = 0  # dp[i - 2]
 
diff --git a/solutions/198. House Robber/198.py b/solutions/198. House Robber/198.py
index 2a42721b2ee..58b4af4ff31 100644
--- a/solutions/198. House Robber/198.py	
+++ b/solutions/198. House Robber/198.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def rob(self, nums: list[int]) -> int:
+  def rob(self, nums: List[int]) -> int:
     if not nums:
       return 0
     if len(nums) == 1:
diff --git a/solutions/1980. Find Unique Binary String/1980-2.py b/solutions/1980. Find Unique Binary String/1980-2.py
index 54328749c64..f5a86241a79 100644
--- a/solutions/1980. Find Unique Binary String/1980-2.py	
+++ b/solutions/1980. Find Unique Binary String/1980-2.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def findDifferentBinaryString(self, nums: list[str]) -> str:
+  def findDifferentBinaryString(self, nums: List[str]) -> str:
     return ''.join('1' if num[i] == '0' else '0' for i, num in enumerate(nums))
diff --git a/solutions/1980. Find Unique Binary String/1980.py b/solutions/1980. Find Unique Binary String/1980.py
index 3610e0d7b3b..e4458872c71 100644
--- a/solutions/1980. Find Unique Binary String/1980.py	
+++ b/solutions/1980. Find Unique Binary String/1980.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findDifferentBinaryString(self, nums: list[str]) -> str:
+  def findDifferentBinaryString(self, nums: List[str]) -> str:
     bitSize = len(nums[0])
     maxNum = 1 << bitSize
     numsSet = {int(num, 2) for num in nums}
diff --git a/solutions/1981. Minimize the Difference Between Target and Chosen Elements/1981.cpp b/solutions/1981. Minimize the Difference Between Target and Chosen Elements/1981.cpp
index 6c8e1a755f7..165106765ca 100644
--- a/solutions/1981. Minimize the Difference Between Target and Chosen Elements/1981.cpp	
+++ b/solutions/1981. Minimize the Difference Between Target and Chosen Elements/1981.cpp	
@@ -24,14 +24,16 @@ class Solution {
   }
 
   int getMinSum(const vector<vector<int>>& mat) {
-    return accumulate(
-        mat.begin(), mat.end(), 0,
-        [](int acc, const vector<int>& row) { return acc + ranges::min(row); });
+    return accumulate(mat.begin(), mat.end(), 0,
+                      [](int subtotal, const vector<int>& row) {
+      return subtotal + ranges::min(row);
+    });
   }
 
   int getMaxSum(const vector<vector<int>>& mat) {
-    return accumulate(
-        mat.begin(), mat.end(), 0,
-        [](int acc, const vector<int>& row) { return acc + ranges::max(row); });
+    return accumulate(mat.begin(), mat.end(), 0,
+                      [](int subtotal, const vector<int>& row) {
+      return subtotal + ranges::max(row);
+    });
   }
 };
diff --git a/solutions/1981. Minimize the Difference Between Target and Chosen Elements/1981.py b/solutions/1981. Minimize the Difference Between Target and Chosen Elements/1981.py
index 69a4a3c4dac..cac1462af1b 100644
--- a/solutions/1981. Minimize the Difference Between Target and Chosen Elements/1981.py	
+++ b/solutions/1981. Minimize the Difference Between Target and Chosen Elements/1981.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimizeTheDifference(self, mat: list[list[int]], target: int) -> int:
+  def minimizeTheDifference(self, mat: List[List[int]], target: int) -> int:
     minSum = sum(min(row) for row in mat)
     if minSum >= target:  # No need to consider any larger combination.
       return minSum - target
diff --git a/solutions/1982. Find Array Given Subset Sums/1982.py b/solutions/1982. Find Array Given Subset Sums/1982.py
index cb51c855ad2..602228cba03 100644
--- a/solutions/1982. Find Array Given Subset Sums/1982.py	
+++ b/solutions/1982. Find Array Given Subset Sums/1982.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def recoverArray(self, n: int, sums: list[int]) -> list[int]:
-    def recover(sums: list[int]) -> list[int]:
+  def recoverArray(self, n: int, sums: List[int]) -> List[int]:
+    def recover(sums: List[int]) -> List[int]:
       if len(sums) == 1:
         return []
 
@@ -26,7 +26,7 @@ def recover(sums: list[int]) -> list[int]:
       # Choose `sumsExludingNum` by default since we want to gradually strip
       # `num` from each sum in `sums` to have the final array. However, we should
       # always choose the group of sums with 0 since it's a must-have.
-      return ([num] + recover(sumsExcludingNum) if chooseSumsExcludingNum else
-              [-num] + recover(sumsIncludingNum))
+      return [num] + recover(sumsExcludingNum) if chooseSumsExcludingNum \
+          else [-num] + recover(sumsIncludingNum)
 
     return recover(sorted(sums))
diff --git a/solutions/1983. Widest Pair of Indices With Equal Range Sum/1983.py b/solutions/1983. Widest Pair of Indices With Equal Range Sum/1983.py
index 51a80b31fb1..a3a04905135 100644
--- a/solutions/1983. Widest Pair of Indices With Equal Range Sum/1983.py	
+++ b/solutions/1983. Widest Pair of Indices With Equal Range Sum/1983.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def widestPairOfIndices(self, nums1: list[int], nums2: list[int]) -> int:
+  def widestPairOfIndices(self, nums1: List[int], nums2: List[int]) -> int:
     ans = 0
     prefix = 0
     prefixToIndex = {0: -1}
diff --git a/solutions/1984. Minimum Difference Between Highest and Lowest of K Scores/1984.py b/solutions/1984. Minimum Difference Between Highest and Lowest of K Scores/1984.py
index 1bcda3f271a..6ceae1bd55a 100644
--- a/solutions/1984. Minimum Difference Between Highest and Lowest of K Scores/1984.py	
+++ b/solutions/1984. Minimum Difference Between Highest and Lowest of K Scores/1984.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumDifference(self, nums: list[int], k: int) -> int:
+  def minimumDifference(self, nums: List[int], k: int) -> int:
     nums.sort()
     ans = nums[k - 1] - nums[0]
 
diff --git a/solutions/1985. Find the Kth Largest Integer in the Array/1985.java b/solutions/1985. Find the Kth Largest Integer in the Array/1985.java
index dd2aa43c202..88c8a3f0daf 100644
--- a/solutions/1985. Find the Kth Largest Integer in the Array/1985.java	
+++ b/solutions/1985. Find the Kth Largest Integer in the Array/1985.java	
@@ -2,7 +2,7 @@ class Solution {
   // Similar to 215. Kth Largest Element in an Array
   public String kthLargestNumber(String[] nums, int k) {
     Queue<String> minHeap = new PriorityQueue<>(
-        Comparator.comparingInt(String::length).thenComparing(String::compareTo));
+        (a, b) -> a.length() == b.length() ? a.compareTo(b) : a.length() - b.length());
 
     for (final String num : nums) {
       minHeap.offer(num);
diff --git a/solutions/1985. Find the Kth Largest Integer in the Array/1985.py b/solutions/1985. Find the Kth Largest Integer in the Array/1985.py
index e18a9e6b9fb..12d0c5b28d5 100644
--- a/solutions/1985. Find the Kth Largest Integer in the Array/1985.py	
+++ b/solutions/1985. Find the Kth Largest Integer in the Array/1985.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Similar to 215. Kth Largest Element in an Array
-  def kthLargestNumber(self, nums: list[str], k: int) -> str:
+  def kthLargestNumber(self, nums: List[str], k: int) -> str:
     minHeap = []
 
     for num in nums:
diff --git a/solutions/1986. Minimum Number of Work Sessions to Finish the Tasks/1986.cpp b/solutions/1986. Minimum Number of Work Sessions to Finish the Tasks/1986.cpp
index effc19ea26a..c9f3731148d 100644
--- a/solutions/1986. Minimum Number of Work Sessions to Finish the Tasks/1986.cpp	
+++ b/solutions/1986. Minimum Number of Work Sessions to Finish the Tasks/1986.cpp	
@@ -20,7 +20,7 @@ class Solution {
         continue;
       // Assign the tasks[s] to this session.
       session += tasks[s];
-      if (dfs(tasks, s + 1, std::move(sessions), sessionTime))
+      if (dfs(tasks, s + 1, move(sessions), sessionTime))
         return true;
       // Backtracking.
       session -= tasks[s];
diff --git a/solutions/1986. Minimum Number of Work Sessions to Finish the Tasks/1986.py b/solutions/1986. Minimum Number of Work Sessions to Finish the Tasks/1986.py
index 4532786bcca..8e6b1123ca0 100644
--- a/solutions/1986. Minimum Number of Work Sessions to Finish the Tasks/1986.py	
+++ b/solutions/1986. Minimum Number of Work Sessions to Finish the Tasks/1986.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def minSessions(self, tasks: list[int], sessionTime: int) -> int:
+  def minSessions(self, tasks: List[int], sessionTime: int) -> int:
     # Returns True if we can assign tasks[s..n) to `sessions`. Note that `sessions`
     # may be occupied by some tasks.
-    def dfs(s: int, sessions: list[int]) -> bool:
+    def dfs(s: int, sessions: List[int]) -> bool:
       if s == len(tasks):
         return True
 
diff --git a/solutions/1987. Number of Unique Good Subsequences/1987.java b/solutions/1987. Number of Unique Good Subsequences/1987.java
index cb7a7614ca2..81658ae3ba5 100644
--- a/solutions/1987. Number of Unique Good Subsequences/1987.java	
+++ b/solutions/1987. Number of Unique Good Subsequences/1987.java	
@@ -1,12 +1,12 @@
 class Solution {
   // Similar to 940. Distinct Subsequences II
   public int numberOfUniqueGoodSubsequences(String binary) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // endsIn[i] := the number of subsequence that end in ('0' + i)
     int[] endsIn = new int[2];
 
     for (final char c : binary.toCharArray()) {
-      endsIn[c - '0'] = (endsIn[0] + endsIn[1]) % MOD;
+      endsIn[c - '0'] = (endsIn[0] + endsIn[1]) % kMod;
       // Don't count '0' since we want to avoid the leading zeros case.
       // However, we can always count '1'.
       if (c == '1')
@@ -14,6 +14,6 @@ public int numberOfUniqueGoodSubsequences(String binary) {
     }
 
     // Count '0' in the end.
-    return (endsIn[0] + endsIn[1] + (binary.indexOf('0') == -1 ? 0 : 1)) % MOD;
+    return (endsIn[0] + endsIn[1] + (binary.indexOf('0') == -1 ? 0 : 1)) % kMod;
   }
 }
diff --git a/solutions/1987. Number of Unique Good Subsequences/1987.py b/solutions/1987. Number of Unique Good Subsequences/1987.py
index c81bb5fcceb..04f76b83cca 100644
--- a/solutions/1987. Number of Unique Good Subsequences/1987.py	
+++ b/solutions/1987. Number of Unique Good Subsequences/1987.py	
@@ -1,16 +1,16 @@
 class Solution:
   # Similar to 940. Distinct Subsequences II
   def numberOfUniqueGoodSubsequences(self, binary: str) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # endsIn[i] := the number of subsequence that end in ('0' + i)
     endsIn = {'0': 0, '1': 0}
 
     for c in binary:
-      endsIn[c] = sum(endsIn.values()) % MOD
+      endsIn[c] = sum(endsIn.values()) % kMod
       # Don't count '0' since we want to avoid the leading zeros case.
       # However, we can always count '1'.
       if c == '1':
         endsIn['1'] += 1
 
     # Count '0' in the end.
-    return (sum(endsIn.values()) + ('0' in binary)) % MOD
+    return (sum(endsIn.values()) + ('0' in binary)) % kMod
diff --git a/solutions/1989. Maximum Number of People That Can Be Caught in Tag/1989.py b/solutions/1989. Maximum Number of People That Can Be Caught in Tag/1989.py
index c424657f6c1..32e6f9e9ca8 100644
--- a/solutions/1989. Maximum Number of People That Can Be Caught in Tag/1989.py	
+++ b/solutions/1989. Maximum Number of People That Can Be Caught in Tag/1989.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def catchMaximumAmountofPeople(self, team: list[int], dist: int) -> int:
+  def catchMaximumAmountofPeople(self, team: List[int], dist: int) -> int:
     ans = 0
     i = 0  # 0s index
     j = 0  # 1s index
diff --git a/solutions/199. Binary Tree Right Side View/199-2.py b/solutions/199. Binary Tree Right Side View/199-2.py
index c45938b244c..71ccb521c83 100644
--- a/solutions/199. Binary Tree Right Side View/199-2.py	
+++ b/solutions/199. Binary Tree Right Side View/199-2.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def rightSideView(self, root: TreeNode | None) -> list[int]:
+  def rightSideView(self, root: Optional[TreeNode]) -> List[int]:
     ans = []
 
-    def dfs(root: TreeNode | None, depth: int) -> None:
+    def dfs(root: Optional[TreeNode], depth: int) -> None:
       if not root:
         return
 
diff --git a/solutions/199. Binary Tree Right Side View/199.java b/solutions/199. Binary Tree Right Side View/199.java
index ba616ec1514..407e756fe28 100644
--- a/solutions/199. Binary Tree Right Side View/199.java	
+++ b/solutions/199. Binary Tree Right Side View/199.java	
@@ -4,7 +4,7 @@ public List<Integer> rightSideView(TreeNode root) {
       return new ArrayList<>();
 
     List<Integer> ans = new ArrayList<>();
-    Queue<TreeNode> q = new ArrayDeque<>(List.of(root));
+    Queue<TreeNode> q = new ArrayDeque<>(Arrays.asList(root));
 
     while (!q.isEmpty()) {
       final int size = q.size();
diff --git a/solutions/199. Binary Tree Right Side View/199.py b/solutions/199. Binary Tree Right Side View/199.py
index da5e0dbd478..2a367ef2b66 100644
--- a/solutions/199. Binary Tree Right Side View/199.py	
+++ b/solutions/199. Binary Tree Right Side View/199.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def rightSideView(self, root: TreeNode | None) -> list[int]:
+  def rightSideView(self, root: Optional[TreeNode]) -> List[int]:
     if not root:
       return []
 
diff --git a/solutions/1991. Find the Middle Index in Array/1991.py b/solutions/1991. Find the Middle Index in Array/1991.py
index 61a99c60102..eb1f9c40886 100644
--- a/solutions/1991. Find the Middle Index in Array/1991.py	
+++ b/solutions/1991. Find the Middle Index in Array/1991.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMiddleIndex(self, nums: list[int]) -> int:
+  def findMiddleIndex(self, nums: List[int]) -> int:
     prefix = 0
     suffix = sum(nums)
 
diff --git a/solutions/1992. Find All Groups of Farmland/1992.py b/solutions/1992. Find All Groups of Farmland/1992.py
index 3f00b3bc6c8..de3ffbfecbd 100644
--- a/solutions/1992. Find All Groups of Farmland/1992.py	
+++ b/solutions/1992. Find All Groups of Farmland/1992.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def findFarmland(self, land: list[list[int]]) -> list[list[int]]:
+  def findFarmland(self, land: List[List[int]]) -> List[List[int]]:
     ans = []
 
-    def dfs(i: int, j: int, cell: list[int]) -> None:
+    def dfs(i: int, j: int, cell: List[int]) -> None:
       if i < 0 or i == len(land) or j < 0 or j == len(land[0]):
         return
       if land[i][j] != 1:
diff --git a/solutions/1993. Operations on Tree/1993.cpp b/solutions/1993. Operations on Tree/1993.cpp
index 184b41e2271..15e748215e8 100644
--- a/solutions/1993. Operations on Tree/1993.cpp	
+++ b/solutions/1993. Operations on Tree/1993.cpp	
@@ -38,13 +38,9 @@ class LockingTree {
     return nodes[num].lockedBy = user;
   }
 
- private:
-  const vector<int> parent;
-  vector<Node> nodes;
-
   bool anyLockedDescendant(int i) {
     return nodes[i].lockedBy != -1 ||
-           ranges::any_of(nodes[i].children, [this](const int child) {
+           ranges::any_of(nodes[i].children, [=](const int child) {
       return anyLockedDescendant(child);
     });
   }
@@ -54,4 +50,8 @@ class LockingTree {
     for (const int child : nodes[i].children)
       unlockDescendants(child);
   }
+
+ private:
+  const vector<int> parent;
+  vector<Node> nodes;
 };
diff --git a/solutions/1993. Operations on Tree/1993.java b/solutions/1993. Operations on Tree/1993.java
index 41abae56cc3..bbe7aa216ec 100644
--- a/solutions/1993. Operations on Tree/1993.java	
+++ b/solutions/1993. Operations on Tree/1993.java	
@@ -43,17 +43,17 @@ public boolean upgrade(int num, int user) {
     return true;
   }
 
-  private int[] parent;
-  private Node[] nodes;
-
-  private boolean anyLockedDescendant(int i) {
+  public boolean anyLockedDescendant(int i) {
     return nodes[i].lockedBy != -1 ||
         nodes[i].children.stream().anyMatch(child -> anyLockedDescendant(child));
   }
 
-  private void unlockDescendants(int i) {
+  public void unlockDescendants(int i) {
     nodes[i].lockedBy = -1;
     for (final int child : nodes[i].children)
       unlockDescendants(child);
   }
+
+  private int[] parent;
+  private Node[] nodes;
 }
diff --git a/solutions/1993. Operations on Tree/1993.py b/solutions/1993. Operations on Tree/1993.py
index 516fe480b0d..18909ede3bd 100644
--- a/solutions/1993. Operations on Tree/1993.py	
+++ b/solutions/1993. Operations on Tree/1993.py	
@@ -1,11 +1,11 @@
 class Node:
   def __init__(self):
-    self.children: list[int] = []
+    self.children: List[int] = []
     self.lockedBy = -1
 
 
 class LockingTree:
-  def __init__(self, parent: list[int]):
+  def __init__(self, parent: List[int]):
     self.parent = parent
     self.nodes = [Node() for _ in range(len(parent))]
     for i in range(1, len(parent)):
@@ -41,9 +41,9 @@ def upgrade(self, num: int, user: int) -> bool:
     return True
 
   def _anyLockedDescendant(self, i: int) -> bool:
-    return (self.nodes[i].lockedBy != -1 or
-            any(self._anyLockedDescendant(child)
-            for child in self.nodes[i].children))
+    return self.nodes[i].lockedBy != -1 or \
+        any(self._anyLockedDescendant(child)
+            for child in self.nodes[i].children)
 
   def _unlockDescendants(self, i: int) -> None:
     self.nodes[i].lockedBy = -1
diff --git a/solutions/1994. The Number of Good Subsets/1994.java b/solutions/1994. The Number of Good Subsets/1994.java
index d0868c179c6..81ec47cf752 100644
--- a/solutions/1994. The Number of Good Subsets/1994.java	
+++ b/solutions/1994. The Number of Good Subsets/1994.java	
@@ -22,14 +22,14 @@ public int numberOfGoodSubsets(int[] nums) {
           continue;
         final int nextPrimesMask = primesMask | numPrimesMask;
         dp[nextPrimesMask] += dp[primesMask] * count[num];
-        dp[nextPrimesMask] %= MOD;
+        dp[nextPrimesMask] %= kMod;
       }
     }
 
-    return (int) (modPow(2, count[1]) * ((Arrays.stream(dp).sum() - 1) % MOD) % MOD);
+    return (int) (modPow(2, count[1]) * ((Arrays.stream(dp).sum() - 1) % kMod) % kMod);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private int getPrimesMask(int num, int[] primes) {
     int primesMask = 0;
@@ -43,7 +43,7 @@ private long modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2);
+      return x * modPow(x, n - 1) % kMod;
+    return modPow(x * x % kMod, n / 2);
   }
 }
diff --git a/solutions/1994. The Number of Good Subsets/1994.py b/solutions/1994. The Number of Good Subsets/1994.py
index a56922cfacb..edb42141275 100644
--- a/solutions/1994. The Number of Good Subsets/1994.py	
+++ b/solutions/1994. The Number of Good Subsets/1994.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def numberOfGoodSubsets(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
+  def numberOfGoodSubsets(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
     primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
     n = 1 << len(primes)
     # dp[i] := the number of good subsets with set of primes = i bit mask
@@ -21,6 +21,6 @@ def numberOfGoodSubsets(self, nums: list[int]) -> int:
           continue
         nextPrimesMask = numPrimesMask | primesMask
         dp[nextPrimesMask] += dp[primesMask] * freq
-        dp[nextPrimesMask] %= MOD
+        dp[nextPrimesMask] %= kMod
 
-    return (1 << count[1]) * sum(dp[1:]) % MOD
+    return (1 << count[1]) * sum(dp[1:]) % kMod
diff --git a/solutions/1995. Count Special Quadruplets/1995-2.py b/solutions/1995. Count Special Quadruplets/1995-2.py
index 3efeb46b217..0097c3dae92 100644
--- a/solutions/1995. Count Special Quadruplets/1995-2.py	
+++ b/solutions/1995. Count Special Quadruplets/1995-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countQuadruplets(self, nums: list[int]) -> int:
+  def countQuadruplets(self, nums: List[int]) -> int:
     n = len(nums)
     ans = 0
     count = collections.Counter()
diff --git a/solutions/1995. Count Special Quadruplets/1995-3.py b/solutions/1995. Count Special Quadruplets/1995-3.py
index 0f18a4790d0..cd545c8c6f1 100644
--- a/solutions/1995. Count Special Quadruplets/1995-3.py	
+++ b/solutions/1995. Count Special Quadruplets/1995-3.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countQuadruplets(self, nums: list[int]) -> int:
+  def countQuadruplets(self, nums: List[int]) -> int:
     n = len(nums)
     ans = 0
     count = collections.Counter()
diff --git a/solutions/1995. Count Special Quadruplets/1995.py b/solutions/1995. Count Special Quadruplets/1995.py
index 248703b6f07..fe96ef6a21a 100644
--- a/solutions/1995. Count Special Quadruplets/1995.py	
+++ b/solutions/1995. Count Special Quadruplets/1995.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countQuadruplets(self, nums: list[int]) -> int:
+  def countQuadruplets(self, nums: List[int]) -> int:
     n = len(nums)
     return sum(nums[a] + nums[b] + nums[c] == nums[d]
                for a in range(n)
diff --git a/solutions/1996. The Number of Weak Characters in the Game/1996-2.cpp b/solutions/1996. The Number of Weak Characters in the Game/1996-2.cpp
index a6067038152..7679c45f82f 100644
--- a/solutions/1996. The Number of Weak Characters in the Game/1996-2.cpp	
+++ b/solutions/1996. The Number of Weak Characters in the Game/1996-2.cpp	
@@ -3,8 +3,9 @@ class Solution {
   int numberOfWeakCharacters(vector<vector<int>>& properties) {
     int ans = 0;
     const int maxAttack = (*ranges::max_element(
-        properties, ranges::less{},
-        [](const vector<int>& property) { return property[0]; }))[0];
+        properties, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] < b[0];
+    }))[0];
     // maxDefenses[i] := the maximum defense for the i-th attack
     vector<int> maxDefenses(maxAttack + 2);
 
diff --git a/solutions/1996. The Number of Weak Characters in the Game/1996-2.py b/solutions/1996. The Number of Weak Characters in the Game/1996-2.py
index 05e011169d6..259379e190c 100644
--- a/solutions/1996. The Number of Weak Characters in the Game/1996-2.py	
+++ b/solutions/1996. The Number of Weak Characters in the Game/1996-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfWeakCharacters(self, properties: list[list[int]]) -> int:
+  def numberOfWeakCharacters(self, properties: List[List[int]]) -> int:
     ans = 0
     maxAttack = max(attack for attack, _ in properties)
     # maxDefenses[i] := the maximum defense for the i-th attack
diff --git a/solutions/1996. The Number of Weak Characters in the Game/1996.cpp b/solutions/1996. The Number of Weak Characters in the Game/1996.cpp
index 01312f2653d..1025f8df220 100644
--- a/solutions/1996. The Number of Weak Characters in the Game/1996.cpp	
+++ b/solutions/1996. The Number of Weak Characters in the Game/1996.cpp	
@@ -1,10 +1,10 @@
 class Solution {
  public:
   int numberOfWeakCharacters(vector<vector<int>>& properties) {
-    ranges::sort(properties, ranges::less{}, [](const vector<int>& property) {
-      const int attack = property[0];
-      const int defense = property[1];
-      return pair<int, int>{-attack, defense};
+    // Sort properties by `attack` in descending order, then by `defense` in
+    // ascending order.
+    ranges::sort(properties, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] == b[0] ? a[1] < b[1] : a[0] > b[0];
     });
 
     int ans = 0;
diff --git a/solutions/1996. The Number of Weak Characters in the Game/1996.java b/solutions/1996. The Number of Weak Characters in the Game/1996.java
index 6711977682f..afe5360dea0 100644
--- a/solutions/1996. The Number of Weak Characters in the Game/1996.java	
+++ b/solutions/1996. The Number of Weak Characters in the Game/1996.java	
@@ -2,8 +2,7 @@ class Solution {
   public int numberOfWeakCharacters(int[][] properties) {
     // Sort properties by `attack` in descending order, then by `defense` in
     // ascending order.
-    Arrays.sort(properties, Comparator.comparingInt((int[] property) -> - property[0])
-                                .thenComparingInt((int[] property) -> property[1]));
+    Arrays.sort(properties, (a, b) -> a[0] == b[0] ? a[1] - b[1] : b[0] - a[0]);
 
     int ans = 0;
     int maxDefense = 0;
diff --git a/solutions/1996. The Number of Weak Characters in the Game/1996.py b/solutions/1996. The Number of Weak Characters in the Game/1996.py
index ee9e50ad625..0d9bc789ac6 100644
--- a/solutions/1996. The Number of Weak Characters in the Game/1996.py	
+++ b/solutions/1996. The Number of Weak Characters in the Game/1996.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfWeakCharacters(self, properties: list[list[int]]) -> int:
+  def numberOfWeakCharacters(self, properties: List[List[int]]) -> int:
     ans = 0
     maxDefense = 0
 
diff --git a/solutions/1997. First Day Where You Have Been in All the Rooms/1997.java b/solutions/1997. First Day Where You Have Been in All the Rooms/1997.java
index 6212489a268..37daa68cd47 100644
--- a/solutions/1997. First Day Where You Have Been in All the Rooms/1997.java	
+++ b/solutions/1997. First Day Where You Have Been in All the Rooms/1997.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int firstDayBeenInAllRooms(int[] nextVisit) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = nextVisit.length;
     // dp[i] := the number of days to visit room i for the first time
     int[] dp = new int[n];
@@ -14,7 +14,7 @@ public int firstDayBeenInAllRooms(int[] nextVisit) {
       //   * 1: visit room[nextVisit[i - 1]]
       //   * dp[i - 1] - dp[nextVisit[i - 1]]: 2-time visit room[i - 1]
       //   * 1: visit room[i]
-      dp[i] = (int) ((2L * dp[i - 1] - dp[nextVisit[i - 1]] + 2 + MOD) % MOD);
+      dp[i] = (int) ((2L * dp[i - 1] - dp[nextVisit[i - 1]] + 2 + kMod) % kMod);
 
     return dp[n - 1];
   }
diff --git a/solutions/1997. First Day Where You Have Been in All the Rooms/1997.py b/solutions/1997. First Day Where You Have Been in All the Rooms/1997.py
index b104af1501a..943aeb84438 100644
--- a/solutions/1997. First Day Where You Have Been in All the Rooms/1997.py	
+++ b/solutions/1997. First Day Where You Have Been in All the Rooms/1997.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def firstDayBeenInAllRooms(self, nextVisit: list[int]) -> int:
-    MOD = 1_000_000_007
+  def firstDayBeenInAllRooms(self, nextVisit: List[int]) -> int:
+    kMod = 1_000_000_007
     n = len(nextVisit)
     # dp[i] := the number of days to visit room i for the first time
     dp = [0] * n
@@ -14,6 +14,6 @@ def firstDayBeenInAllRooms(self, nextVisit: list[int]) -> int:
       #   * 1: visit room[nextVisit[i - 1]]
       #   * dp[i - 1] - dp[nextVisit[i - 1]]: 2-time visit room[i - 1]
       #   * 1: visit room[i]
-      dp[i] = (2 * dp[i - 1] - dp[nextVisit[i - 1]] + 2) % MOD
+      dp[i] = (2 * dp[i - 1] - dp[nextVisit[i - 1]] + 2) % kMod
 
     return dp[-1]
diff --git a/solutions/1998. GCD Sort of an Array/1998.cpp b/solutions/1998. GCD Sort of an Array/1998.cpp
index 3a6c7b11017..de09787a3d3 100644
--- a/solutions/1998. GCD Sort of an Array/1998.cpp	
+++ b/solutions/1998. GCD Sort of an Array/1998.cpp	
@@ -31,9 +31,9 @@ class UnionFind {
 class Solution {
  public:
   bool gcdSort(vector<int>& nums) {
-    const int mx = ranges::max(nums);
-    const vector<int> minPrimeFactors = sieveEratosthenes(mx + 1);
-    UnionFind uf(mx + 1);
+    const int maxNum = ranges::max(nums);
+    const vector<int> minPrimeFactors = sieveEratosthenes(maxNum + 1);
+    UnionFind uf(maxNum + 1);
 
     for (const int num : nums)
       for (const int primeFactor : getPrimeFactors(num, minPrimeFactors))
diff --git a/solutions/1998. GCD Sort of an Array/1998.java b/solutions/1998. GCD Sort of an Array/1998.java
index a7d637f797b..e36ca8146ce 100644
--- a/solutions/1998. GCD Sort of an Array/1998.java	
+++ b/solutions/1998. GCD Sort of an Array/1998.java	
@@ -31,9 +31,9 @@ public int find(int u) {
 
 class Solution {
   public boolean gcdSort(int[] nums) {
-    final int mx = Arrays.stream(nums).max().getAsInt();
-    final int[] minPrimeFactors = sieveEratosthenes(mx + 1);
-    UnionFind uf = new UnionFind(mx + 1);
+    final int maxNum = Arrays.stream(nums).max().getAsInt();
+    final int[] minPrimeFactors = sieveEratosthenes(maxNum + 1);
+    UnionFind uf = new UnionFind(maxNum + 1);
 
     for (final int num : nums)
       for (final int primeFactor : getPrimeFactors(num, minPrimeFactors))
diff --git a/solutions/1998. GCD Sort of an Array/1998.py b/solutions/1998. GCD Sort of an Array/1998.py
index c4c782e8a30..6e94a6b213b 100644
--- a/solutions/1998. GCD Sort of an Array/1998.py	
+++ b/solutions/1998. GCD Sort of an Array/1998.py	
@@ -24,10 +24,10 @@ def find(self, u: int) -> int:
 
 
 class Solution:
-  def gcdSort(self, nums: list[int]) -> bool:
-    mx = max(nums)
-    minPrimeFactors = self._sieveEratosthenes(mx + 1)
-    uf = UnionFind(mx + 1)
+  def gcdSort(self, nums: List[int]) -> bool:
+    maxNum = max(nums)
+    minPrimeFactors = self._sieveEratosthenes(maxNum + 1)
+    uf = UnionFind(maxNum + 1)
 
     for num in nums:
       for primeFactor in self._getPrimeFactors(num, minPrimeFactors):
@@ -40,7 +40,7 @@ def gcdSort(self, nums: list[int]) -> bool:
 
     return True
 
-  def _sieveEratosthenes(self, n: int) -> list[int]:
+  def _sieveEratosthenes(self, n: int) -> List[int]:
     """Gets the minimum prime factor of i, where 1 < i <= n."""
     minPrimeFactors = [i for i in range(n + 1)]
     for i in range(2, int(n**0.5) + 1):
@@ -49,7 +49,7 @@ def _sieveEratosthenes(self, n: int) -> list[int]:
           minPrimeFactors[j] = min(minPrimeFactors[j], i)
     return minPrimeFactors
 
-  def _getPrimeFactors(self, num: int, minPrimeFactors: list[int]) -> list[int]:
+  def _getPrimeFactors(self, num: int, minPrimeFactors: List[int]) -> List[int]:
     primeFactors = []
     while num > 1:
       divisor = minPrimeFactors[num]
diff --git a/solutions/200. Number of Islands/200-2.py b/solutions/200. Number of Islands/200-2.py
index 335e8eb076c..e6a5ef47319 100644
--- a/solutions/200. Number of Islands/200-2.py	
+++ b/solutions/200. Number of Islands/200-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numIslands(self, grid: list[list[str]]) -> int:
+  def numIslands(self, grid: List[List[str]]) -> int:
     m = len(grid)
     n = len(grid[0])
 
diff --git a/solutions/200. Number of Islands/200.cpp b/solutions/200. Number of Islands/200.cpp
index 206971eb610..0edaa4ba0fe 100644
--- a/solutions/200. Number of Islands/200.cpp	
+++ b/solutions/200. Number of Islands/200.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int numIslands(vector<vector<char>>& grid) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = grid.size();
     const int n = grid[0].size();
     int ans = 0;
@@ -12,7 +12,7 @@ class Solution {
       while (!q.empty()) {
         const auto [i, j] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/200. Number of Islands/200.java b/solutions/200. Number of Islands/200.java
index 02a87c700f5..44fe950f882 100644
--- a/solutions/200. Number of Islands/200.java	
+++ b/solutions/200. Number of Islands/200.java	
@@ -12,22 +12,23 @@ public int numIslands(char[][] grid) {
     return ans;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private void bfs(char[][] grid, int r, int c) {
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(r, c)));
+    Queue<int[]> q = new ArrayDeque<>();
+    q.offer(new int[] {r, c});
     grid[r][c] = '2'; // Mark '2' as visited.
     while (!q.isEmpty()) {
-      final int i = q.peek().getKey();
-      final int j = q.poll().getValue();
-      for (int[] dir : DIRS) {
+      final int i = q.peek()[0];
+      final int j = q.poll()[1];
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == grid.length || y < 0 || y == grid[0].length)
           continue;
         if (grid[x][y] != '1')
           continue;
-        q.offer(new Pair<>(x, y));
+        q.offer(new int[] {x, y});
         grid[x][y] = '2'; // Mark '2' as visited.
       }
     }
diff --git a/solutions/200. Number of Islands/200.py b/solutions/200. Number of Islands/200.py
index c7a4dd5a3a1..1c778aec09f 100644
--- a/solutions/200. Number of Islands/200.py	
+++ b/solutions/200. Number of Islands/200.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def numIslands(self, grid: list[list[str]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def numIslands(self, grid: List[List[str]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
 
@@ -9,7 +9,7 @@ def bfs(r, c):
       grid[r][c] = '2'  # Mark '2' as visited.
       while q:
         i, j = q.popleft()
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/2001. Number of Pairs of Interchangeable Rectangles/2001-2.py b/solutions/2001. Number of Pairs of Interchangeable Rectangles/2001-2.py
index fb8134eb006..88a4c370b58 100644
--- a/solutions/2001. Number of Pairs of Interchangeable Rectangles/2001-2.py	
+++ b/solutions/2001. Number of Pairs of Interchangeable Rectangles/2001-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def interchangeableRectangles(self, rectangles: list[list[int]]) -> int:
+  def interchangeableRectangles(self, rectangles: List[List[int]]) -> int:
     ratioCount = collections.Counter()
 
     def gcd(a: int, b: int) -> int:
diff --git a/solutions/2001. Number of Pairs of Interchangeable Rectangles/2001.py b/solutions/2001. Number of Pairs of Interchangeable Rectangles/2001.py
index e8a5c500310..0d336ecbdb0 100644
--- a/solutions/2001. Number of Pairs of Interchangeable Rectangles/2001.py	
+++ b/solutions/2001. Number of Pairs of Interchangeable Rectangles/2001.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def interchangeableRectangles(self, rectangles: list[list[int]]) -> int:
+  def interchangeableRectangles(self, rectangles: List[List[int]]) -> int:
     ratioCount = collections.Counter()
 
     for width, height in rectangles:
diff --git a/solutions/2002. Maximum Product of the Length of Two Palindromic Subsequences/2002.cpp b/solutions/2002. Maximum Product of the Length of Two Palindromic Subsequences/2002.cpp
index 4c960873ae8..91700945fd0 100644
--- a/solutions/2002. Maximum Product of the Length of Two Palindromic Subsequences/2002.cpp	
+++ b/solutions/2002. Maximum Product of the Length of Two Palindromic Subsequences/2002.cpp	
@@ -15,14 +15,14 @@ class Solution {
     }
 
     s1.push_back(s[i]);
-    dfs(s, i + 1, std::move(s1), std::move(s2), ans);
+    dfs(s, i + 1, move(s1), move(s2), ans);
     s1.pop_back();
 
     s2.push_back(s[i]);
-    dfs(s, i + 1, std::move(s1), std::move(s2), ans);
+    dfs(s, i + 1, move(s1), move(s2), ans);
     s2.pop_back();
 
-    dfs(s, i + 1, std::move(s1), std::move(s2), ans);
+    dfs(s, i + 1, move(s1), move(s2), ans);
   }
 
   bool isPalindrome(const string& s) {
diff --git a/solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.cpp b/solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.cpp
index 4435bcf5f19..055dc87a5c0 100644
--- a/solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.cpp	
+++ b/solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.cpp	
@@ -20,9 +20,11 @@ class Solution {
 
     // Upward from `nodeThatsOne` to the root `u`.
     while (u != -1) {
-      for (const int v : tree[u])
-        if (v != prev)
-          dfs(v, tree, seen, nums);
+      for (const int v : tree[u]) {
+        if (v == prev)
+          continue;
+        dfs(v, tree, seen, nums);
+      }
       seen.insert(nums[u]);
       while (seen.contains(minMiss))
         ++minMiss;
diff --git a/solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.java b/solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.java
index b96ce82d87f..d176bfb38d1 100644
--- a/solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.java	
+++ b/solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.java	
@@ -22,9 +22,11 @@ public int[] smallestMissingValueSubtree(int[] parents, int[] nums) {
 
     // Upward from `nodeThatsOne` to the root `u`.
     while (u != -1) {
-      for (final int v : tree[u])
-        if (v != prev)
-          dfs(v, tree, seen, nums);
+      for (final int v : tree[u]) {
+        if (v == prev)
+          continue;
+        dfs(v, tree, seen, nums);
+      }
       seen.add(nums[u]);
       while (seen.contains(minMiss))
         ++minMiss;
diff --git a/solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.py b/solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.py
index 52bd337755e..480eb7b124f 100644
--- a/solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.py	
+++ b/solutions/2003. Smallest Missing Genetic Value in Each Subtree/2003.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def smallestMissingValueSubtree(
-      self,
-      parents: list[int],
-      nums: list[int],
-  ) -> list[int]:
+  def smallestMissingValueSubtree(self, parents: List[int], nums: List[int]) -> List[int]:
     n = len(parents)
     ans = [1] * n
     tree = [[] for _ in range(n)]
@@ -13,7 +9,7 @@ def smallestMissingValueSubtree(
     for i in range(1, n):
       tree[parents[i]].append(i)
 
-    def getNode(nums: list[int]) -> int:
+    def getNode(nums: List[int]) -> int:
       for i, num in enumerate(nums):
         if num == 1:
           return i
@@ -34,8 +30,9 @@ def dfs(u: int) -> None:
     # Upward from `nodeThatsOne` to the root `u`.
     while u != -1:
       for v in tree[u]:
-        if v != prev:
-          dfs(v)
+        if v == prev:
+          continue
+        dfs(v)
       seen.add(nums[u])
       while minMiss in seen:
         minMiss += 1
diff --git a/solutions/2006. Count Number of Pairs With Absolute Difference K/2006.java b/solutions/2006. Count Number of Pairs With Absolute Difference K/2006.java
index 80751a80364..3bd73f92e66 100644
--- a/solutions/2006. Count Number of Pairs With Absolute Difference K/2006.java	
+++ b/solutions/2006. Count Number of Pairs With Absolute Difference K/2006.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int countKDifference(int[] nums, int k) {
-    final int MAX = 100;
+    final int kMax = 100;
     int ans = 0;
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (final int num : nums)
       ++count[num];
 
-    for (int i = k + 1; i <= MAX; ++i)
+    for (int i = k + 1; i <= kMax; ++i)
       ans += count[i] * count[i - k];
 
     return ans;
diff --git a/solutions/2006. Count Number of Pairs With Absolute Difference K/2006.py b/solutions/2006. Count Number of Pairs With Absolute Difference K/2006.py
index c808d2db02e..76f7178b585 100644
--- a/solutions/2006. Count Number of Pairs With Absolute Difference K/2006.py	
+++ b/solutions/2006. Count Number of Pairs With Absolute Difference K/2006.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def countKDifference(self, nums: list[int], k: int) -> int:
+  def countKDifference(self, nums: List[int], k: int) -> int:
     count = collections.Counter(nums)
     return sum(count[i] * count[i - k] for i in range(k + 1, 101))
diff --git a/solutions/2007. Find Original Array From Doubled Array/2007.py b/solutions/2007. Find Original Array From Doubled Array/2007.py
index c6a73e1dda5..b171caccc32 100644
--- a/solutions/2007. Find Original Array From Doubled Array/2007.py	
+++ b/solutions/2007. Find Original Array From Doubled Array/2007.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findOriginalArray(self, changed: list[int]) -> list[int]:
+  def findOriginalArray(self, changed: List[int]) -> List[int]:
     ans = []
     q = collections.deque()
 
diff --git a/solutions/2008. Maximum Earnings From Taxi/2008-2.py b/solutions/2008. Maximum Earnings From Taxi/2008-2.py
index 049b46c0bdc..d0fd8052199 100644
--- a/solutions/2008. Maximum Earnings From Taxi/2008-2.py	
+++ b/solutions/2008. Maximum Earnings From Taxi/2008-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxTaxiEarnings(self, n: int, rides: list[list[int]]) -> int:
+  def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int:
     endToStartAndEarns = [[] for _ in range(n + 1)]
     # dp[i] := the maximum dollars you can earn starting at i
     dp = [0] * (n + 1)
diff --git a/solutions/2008. Maximum Earnings From Taxi/2008.py b/solutions/2008. Maximum Earnings From Taxi/2008.py
index 9ef4c6cc406..359f7ffb36a 100644
--- a/solutions/2008. Maximum Earnings From Taxi/2008.py	
+++ b/solutions/2008. Maximum Earnings From Taxi/2008.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxTaxiEarnings(self, n: int, rides: list[list[int]]) -> int:
+  def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int:
     startToEndAndEarns = [[] for _ in range(n)]
     # dp[i] := the maximum dollars you can earn starting at i
     dp = [0] * (n + 1)
diff --git a/solutions/2009. Minimum Number of Operations to Make Array Continuous/2009.cpp b/solutions/2009. Minimum Number of Operations to Make Array Continuous/2009.cpp
index 92acaf26c73..fd77f2ecc2c 100644
--- a/solutions/2009. Minimum Number of Operations to Make Array Continuous/2009.cpp	
+++ b/solutions/2009. Minimum Number of Operations to Make Array Continuous/2009.cpp	
@@ -19,7 +19,7 @@ class Solution {
   }
 
  private:
-  int firstGreater(const vector<int>& arr, int target) {
-    return ranges::upper_bound(arr, target) - arr.begin();
+  int firstGreater(const vector<int>& A, int target) {
+    return ranges::upper_bound(A, target) - A.begin();
   }
 };
diff --git a/solutions/2009. Minimum Number of Operations to Make Array Continuous/2009.java b/solutions/2009. Minimum Number of Operations to Make Array Continuous/2009.java
index cf057a8d059..7968de6da73 100644
--- a/solutions/2009. Minimum Number of Operations to Make Array Continuous/2009.java	
+++ b/solutions/2009. Minimum Number of Operations to Make Array Continuous/2009.java	
@@ -17,8 +17,8 @@ public int minOperations(int[] nums) {
     return ans;
   }
 
-  private int firstGreater(int[] arr, int target) {
-    final int i = Arrays.binarySearch(arr, target + 1);
+  private int firstGreater(int[] A, int target) {
+    final int i = Arrays.binarySearch(A, target + 1);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/2009. Minimum Number of Operations to Make Array Continuous/2009.py b/solutions/2009. Minimum Number of Operations to Make Array Continuous/2009.py
index 7eb910d29c8..f6cafb0469f 100644
--- a/solutions/2009. Minimum Number of Operations to Make Array Continuous/2009.py	
+++ b/solutions/2009. Minimum Number of Operations to Make Array Continuous/2009.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums: list[int]) -> int:
+  def minOperations(self, nums: List[int]) -> int:
     n = len(nums)
     ans = n
     nums = sorted(set(nums))
diff --git a/solutions/2011. Final Value of Variable After Performing Operations/2011.py b/solutions/2011. Final Value of Variable After Performing Operations/2011.py
index 7e78ec8a4c0..df104785189 100644
--- a/solutions/2011. Final Value of Variable After Performing Operations/2011.py	
+++ b/solutions/2011. Final Value of Variable After Performing Operations/2011.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def finalValueAfterOperations(self, operations: list[str]) -> int:
+  def finalValueAfterOperations(self, operations: List[str]) -> int:
     return sum(op[1] == '+' or -1 for op in operations)
diff --git a/solutions/2012. Sum of Beauty in the Array/2012.py b/solutions/2012. Sum of Beauty in the Array/2012.py
index 4f83329b84f..c20b31656c7 100644
--- a/solutions/2012. Sum of Beauty in the Array/2012.py	
+++ b/solutions/2012. Sum of Beauty in the Array/2012.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sumOfBeauties(self, nums: list[int]) -> int:
+  def sumOfBeauties(self, nums: List[int]) -> int:
     n = len(nums)
     ans = 0
     minOfRight = [0] * (n - 1) + [nums[-1]]
diff --git a/solutions/2013. Detect Squares/2013.py b/solutions/2013. Detect Squares/2013.py
index f5d108b57ce..51ef25157aa 100644
--- a/solutions/2013. Detect Squares/2013.py	
+++ b/solutions/2013. Detect Squares/2013.py	
@@ -2,10 +2,10 @@ class DetectSquares:
   def __init__(self):
     self.pointCount = collections.Counter()
 
-  def add(self, point: list[int]) -> None:
+  def add(self, point: List[int]) -> None:
     self.pointCount[tuple(point)] += 1
 
-  def count(self, point: list[int]) -> int:
+  def count(self, point: List[int]) -> int:
     x1, y1 = point
     ans = 0
     for (x3, y3), c in self.pointCount.items():
diff --git a/solutions/2014. Longest Subsequence Repeated k Times/2014.java b/solutions/2014. Longest Subsequence Repeated k Times/2014.java
index 7725098d17c..61e8e71f809 100644
--- a/solutions/2014. Longest Subsequence Repeated k Times/2014.java	
+++ b/solutions/2014. Longest Subsequence Repeated k Times/2014.java	
@@ -1,10 +1,10 @@
-class Solution {
+public class Solution {
   public String longestSubsequenceRepeatedK(String s, int k) {
     String ans = "";
     int[] count = new int[26];
     List<Character> possibleChars = new ArrayList<>();
     // Stores subsequences, where the length grows by 1 each time.
-    Queue<String> q = new ArrayDeque<>(List.of(""));
+    Queue<String> q = new ArrayDeque<>(Arrays.asList(""));
 
     for (final char c : s.toCharArray())
       ++count[c - 'a'];
diff --git a/solutions/2015. Average Height of Buildings in Each Segment/2015.cpp b/solutions/2015. Average Height of Buildings in Each Segment/2015.cpp
index 6f74364fc9d..85f247ec5ce 100644
--- a/solutions/2015. Average Height of Buildings in Each Segment/2015.cpp	
+++ b/solutions/2015. Average Height of Buildings in Each Segment/2015.cpp	
@@ -18,7 +18,8 @@ class Solution {
     int count = 0;
     int sumHeight = 0;
 
-    for (const auto& [curr, height] : events) {
+    for (const auto& [curr, h] : events) {
+      const int height = abs(h);
       if (sumHeight > 0 && curr > prev) {
         const int avgHeight = sumHeight / count;
         if (!ans.empty() && ans.back()[1] == prev && avgHeight == ans.back()[2])
@@ -26,8 +27,8 @@ class Solution {
         else
           ans.push_back({prev, curr, avgHeight});
       }
-      sumHeight += height;
-      count += height > 0 ? 1 : -1;
+      sumHeight += h;
+      count += h > 0 ? 1 : -1;
       prev = curr;
     }
 
diff --git a/solutions/2015. Average Height of Buildings in Each Segment/2015.java b/solutions/2015. Average Height of Buildings in Each Segment/2015.java
index 6aa6d03550f..723387f3ee9 100644
--- a/solutions/2015. Average Height of Buildings in Each Segment/2015.java	
+++ b/solutions/2015. Average Height of Buildings in Each Segment/2015.java	
@@ -11,7 +11,7 @@ public int[][] averageHeightOfBuildings(int[][] buildings) {
       events.add(new Pair<>(end, -height));
     }
 
-    Collections.sort(events, Comparator.comparingInt(Pair::getKey));
+    Collections.sort(events, Comparator.comparing(Pair::getKey));
 
     int prev = 0;
     int count = 0;
@@ -19,7 +19,8 @@ public int[][] averageHeightOfBuildings(int[][] buildings) {
 
     for (Pair<Integer, Integer> event : events) {
       final int curr = event.getKey();
-      final int height = event.getValue();
+      final int h = event.getValue();
+      final int height = Math.abs(h);
       if (sumHeight > 0 && curr > prev) {
         final int avgHeight = sumHeight / count;
         if (!ans.isEmpty() && ans.get(ans.size() - 1)[1] == prev &&
@@ -28,8 +29,8 @@ public int[][] averageHeightOfBuildings(int[][] buildings) {
         else
           ans.add(new int[] {prev, curr, avgHeight});
       }
-      sumHeight += height;
-      count += height > 0 ? 1 : -1;
+      sumHeight += h;
+      count += h > 0 ? 1 : -1;
       prev = curr;
     }
 
diff --git a/solutions/2015. Average Height of Buildings in Each Segment/2015.py b/solutions/2015. Average Height of Buildings in Each Segment/2015.py
index 0eb6a283d00..4fd6e06abd8 100644
--- a/solutions/2015. Average Height of Buildings in Each Segment/2015.py	
+++ b/solutions/2015. Average Height of Buildings in Each Segment/2015.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def averageHeightOfBuildings(self, buildings: list[list[int]]) -> list[list[int]]:
+  def averageHeightOfBuildings(self, buildings: List[List[int]]) -> List[List[int]]:
     ans = []
     events = []
 
@@ -11,15 +11,16 @@ def averageHeightOfBuildings(self, buildings: list[list[int]]) -> list[list[int]
     count = 0
     sumHeight = 0
 
-    for curr, height in sorted(events):
+    for curr, h in sorted(events):
+      height = abs(h)
       if sumHeight > 0 and curr > prev:
         avgHeight = sumHeight // count
         if ans and ans[-1][1] == prev and avgHeight == ans[-1][2]:
           ans[-1][1] = curr
         else:
           ans.append([prev, curr, avgHeight])
-      sumHeight += height
-      count += 1 if height > 0 else -1
+      sumHeight += h
+      count += 1 if h > 0 else -1
       prev = curr
 
     return ans
diff --git a/solutions/2016. Maximum Difference Between Increasing Elements/2016.py b/solutions/2016. Maximum Difference Between Increasing Elements/2016.py
index cd7ec080dd6..2a344bc1ce1 100644
--- a/solutions/2016. Maximum Difference Between Increasing Elements/2016.py	
+++ b/solutions/2016. Maximum Difference Between Increasing Elements/2016.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumDifference(self, nums: list[int]) -> int:
+  def maximumDifference(self, nums: List[int]) -> int:
     ans = -1
     mn = nums[0]
 
diff --git a/solutions/2017. Grid Game/2017.py b/solutions/2017. Grid Game/2017.py
index ca45ff8023b..779e8c52df3 100644
--- a/solutions/2017. Grid Game/2017.py	
+++ b/solutions/2017. Grid Game/2017.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def gridGame(self, grid: list[list[int]]) -> int:
+  def gridGame(self, grid: List[List[int]]) -> int:
     n = len(grid[0])
     ans = math.inf
     sumRow0 = sum(grid[0])
diff --git a/solutions/2018. Check if Word Can Be Placed In Crossword/2018.cpp b/solutions/2018. Check if Word Can Be Placed In Crossword/2018.cpp
index 3ff384353a3..35ec9075b2d 100644
--- a/solutions/2018. Check if Word Can Be Placed In Crossword/2018.cpp	
+++ b/solutions/2018. Check if Word Can Be Placed In Crossword/2018.cpp	
@@ -5,7 +5,7 @@ class Solution {
       for (const vector<char>& chars : state)
         for (const string& token : getTokens(join(chars)))
           for (const string& letters :
-               {word, string{word.rbegin(), word.rend()}})
+               {word, string(word.rbegin(), word.rend())})
             if (letters.length() == token.length())
               if (canFit(letters, token))
                 return true;
diff --git a/solutions/2018. Check if Word Can Be Placed In Crossword/2018.py b/solutions/2018. Check if Word Can Be Placed In Crossword/2018.py
index 0f6760198ba..01a0710baed 100644
--- a/solutions/2018. Check if Word Can Be Placed In Crossword/2018.py	
+++ b/solutions/2018. Check if Word Can Be Placed In Crossword/2018.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def placeWordInCrossword(self, board: list[list[str]], word: str) -> bool:
+  def placeWordInCrossword(self, board: List[List[str]], word: str) -> bool:
     for x in board, zip(*board):
       for row in x:
         for token in ''.join(row).split('#'):
diff --git a/solutions/2019. The Score of Students Solving Math Expression/2019.py b/solutions/2019. The Score of Students Solving Math Expression/2019.py
index ceeb5b92126..1611a27c420 100644
--- a/solutions/2019. The Score of Students Solving Math Expression/2019.py	
+++ b/solutions/2019. The Score of Students Solving Math Expression/2019.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def scoreOfStudents(self, s: str, answers: list[int]) -> int:
+  def scoreOfStudents(self, s: str, answers: List[int]) -> int:
     n = len(s) // 2 + 1
     ans = 0
     func = {'+': operator.add, '*': operator.mul}
diff --git a/solutions/202. Happy Number/202.cpp b/solutions/202. Happy Number/202.cpp
index 82185020158..ac0413b338b 100644
--- a/solutions/202. Happy Number/202.cpp	
+++ b/solutions/202. Happy Number/202.cpp	
@@ -15,7 +15,7 @@ class Solution {
  private:
   int squaredSum(int n) {
     int sum = 0;
-    while (n > 0) {
+    while (n) {
       sum += pow(n % 10, 2);
       n /= 10;
     }
diff --git a/solutions/202. Happy Number/202.py b/solutions/202. Happy Number/202.py
index 5d0b3232760..fa8454e80b3 100644
--- a/solutions/202. Happy Number/202.py	
+++ b/solutions/202. Happy Number/202.py	
@@ -2,7 +2,7 @@ class Solution:
   def isHappy(self, n: int) -> bool:
     def squaredSum(n: int) -> bool:
       summ = 0
-      while n > 0:
+      while n:
         summ += pow(n % 10, 2)
         n //= 10
       return summ
diff --git a/solutions/2021. Brightest Position on Street/2021.java b/solutions/2021. Brightest Position on Street/2021.java
index 041e299b928..a8007273ada 100644
--- a/solutions/2021. Brightest Position on Street/2021.java	
+++ b/solutions/2021. Brightest Position on Street/2021.java	
@@ -12,9 +12,8 @@ public int brightestPosition(int[][] lights) {
       line.merge(position + range + 1, -1, Integer::sum);
     }
 
-    for (Map.Entry<Integer, Integer> entry : line.entrySet()) {
-      final int pos = entry.getKey();
-      final int brightness = entry.getValue();
+    for (final int pos : line.keySet()) {
+      final int brightness = line.get(pos);
       currBrightness += brightness;
       if (currBrightness > maxBrightness) {
         maxBrightness = currBrightness;
diff --git a/solutions/2021. Brightest Position on Street/2021.py b/solutions/2021. Brightest Position on Street/2021.py
index a6a8fd962e1..6ae145d9604 100644
--- a/solutions/2021. Brightest Position on Street/2021.py	
+++ b/solutions/2021. Brightest Position on Street/2021.py	
@@ -2,7 +2,7 @@
 
 
 class Solution:
-  def brightestPosition(self, lights: list[list[int]]) -> int:
+  def brightestPosition(self, lights: List[List[int]]) -> int:
     ans = math.inf
     maxBrightness = -1
     currBrightness = 0
diff --git a/solutions/2022. Convert 1D Array Into 2D Array/2022.py b/solutions/2022. Convert 1D Array Into 2D Array/2022.py
index 98082d4f542..bde17ad849e 100644
--- a/solutions/2022. Convert 1D Array Into 2D Array/2022.py	
+++ b/solutions/2022. Convert 1D Array Into 2D Array/2022.py	
@@ -1,6 +1,5 @@
 class Solution:
-  def construct2DArray(self, original: list[int],
-                       m: int, n: int) -> list[list[int]]:
+  def construct2DArray(self, original: List[int], m: int, n: int) -> List[List[int]]:
     if len(original) != m * n:
       return []
 
diff --git a/solutions/2023. Number of Pairs of Strings With Concatenation Equal to Target/2023.py b/solutions/2023. Number of Pairs of Strings With Concatenation Equal to Target/2023.py
index 38f03115562..0fd0a6c1d14 100644
--- a/solutions/2023. Number of Pairs of Strings With Concatenation Equal to Target/2023.py	
+++ b/solutions/2023. Number of Pairs of Strings With Concatenation Equal to Target/2023.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numOfPairs(self, nums: list[str], target: str) -> int:
+  def numOfPairs(self, nums: List[str], target: str) -> int:
     ans = 0
     count = collections.Counter()
 
diff --git a/solutions/2025. Maximum Number of Ways to Partition an Array/2025.py b/solutions/2025. Maximum Number of Ways to Partition an Array/2025.py
index ebef0586097..e159139e3d2 100644
--- a/solutions/2025. Maximum Number of Ways to Partition an Array/2025.py	
+++ b/solutions/2025. Maximum Number of Ways to Partition an Array/2025.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def waysToPartition(self, nums: list[int], k: int) -> int:
+  def waysToPartition(self, nums: List[int], k: int) -> int:
     n = len(nums)
     summ = sum(nums)
     prefix = 0
diff --git a/solutions/2028. Find Missing Observations/2028.py b/solutions/2028. Find Missing Observations/2028.py
index 599baf83aa5..a972c663c07 100644
--- a/solutions/2028. Find Missing Observations/2028.py	
+++ b/solutions/2028. Find Missing Observations/2028.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def missingRolls(self, rolls: list[int], mean: int, n: int) -> list[int]:
+  def missingRolls(self, rolls: List[int], mean: int, n: int) -> List[int]:
     targetSum = (len(rolls) + n) * mean
     missingSum = targetSum - sum(rolls)
     if missingSum > n * 6 or missingSum < n:
diff --git a/solutions/2029. Stone Game IX/2029.py b/solutions/2029. Stone Game IX/2029.py
index d8c381a6053..671453d6d83 100644
--- a/solutions/2029. Stone Game IX/2029.py	
+++ b/solutions/2029. Stone Game IX/2029.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def stoneGameIX(self, stones: list[int]) -> bool:
+  def stoneGameIX(self, stones: List[int]) -> bool:
     count = collections.Counter(stone % 3 for stone in stones)
     if count[0] % 2 == 0:
       return min(count[1], count[2]) > 0
diff --git a/solutions/2030. Smallest K-Length Subsequence With Occurrences of a Letter/2030.py b/solutions/2030. Smallest K-Length Subsequence With Occurrences of a Letter/2030.py
index d74e6db8930..20428829d72 100644
--- a/solutions/2030. Smallest K-Length Subsequence With Occurrences of a Letter/2030.py	
+++ b/solutions/2030. Smallest K-Length Subsequence With Occurrences of a Letter/2030.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def smallestSubsequence(
-      self,
-      s: str,
-      k: int,
-      letter: str,
-      repetition: int,
-  ) -> str:
+  def smallestSubsequence(self, s: str, k: int, letter: str, repetition: int) -> str:
     stack = []  # running string
     required = repetition
     nLetters = s.count(letter)
@@ -15,9 +9,9 @@ def smallestSubsequence(
       # Len(stack) := the length of running string
       # Len(s) - i := the length of remain chars
       # -1 := we're going to pop a char
-      while (stack and stack[-1] > c
-              and len(stack) + len(s) - i - 1 >= k
-              and (stack[-1] != letter or nLetters > required)):
+      while stack and stack[-1] > c \
+              and len(stack) + len(s) - i - 1 >= k \
+              and (stack[-1] != letter or nLetters > required):
         if stack.pop() == letter:
           required += 1
       if len(stack) < k:
diff --git a/solutions/2031. Count Subarrays With More Ones Than Zeros/2031.java b/solutions/2031. Count Subarrays With More Ones Than Zeros/2031.java
index 30284419cc1..7a1dc290c5c 100644
--- a/solutions/2031. Count Subarrays With More Ones Than Zeros/2031.java	
+++ b/solutions/2031. Count Subarrays With More Ones Than Zeros/2031.java	
@@ -28,7 +28,7 @@ private static int lowbit(int i) {
 
 class Solution {
   public int subarraysWithMoreZerosThanOnes(int[] nums) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = nums.length;
     int ans = 0;
     int prefix = 0;
@@ -38,7 +38,7 @@ public int subarraysWithMoreZerosThanOnes(int[] nums) {
     for (final int num : nums) {
       prefix += num == 0 ? -1 : 1;
       ans += tree.get(remap(prefix - 1, n));
-      ans %= MOD;
+      ans %= kMod;
       tree.add(remap(prefix, n), 1);
     }
 
diff --git a/solutions/2031. Count Subarrays With More Ones Than Zeros/2031.py b/solutions/2031. Count Subarrays With More Ones Than Zeros/2031.py
index 1080cbd5e12..0f1fb2b8daf 100644
--- a/solutions/2031. Count Subarrays With More Ones Than Zeros/2031.py	
+++ b/solutions/2031. Count Subarrays With More Ones Than Zeros/2031.py	
@@ -19,8 +19,8 @@ def get(self, i: int) -> int:
 
 
 class Solution:
-  def subarraysWithMoreZerosThanOnes(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
+  def subarraysWithMoreZerosThanOnes(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
     ans = 0
     prefix = 0
     tree = FenwichTree(len(nums))
@@ -29,7 +29,7 @@ def subarraysWithMoreZerosThanOnes(self, nums: list[int]) -> int:
     for num in nums:
       prefix += -1 if num == 0 else 1
       ans += tree.get(prefix - 1)
-      ans %= MOD
+      ans %= kMod
       tree.add(prefix, 1)
 
     return ans
diff --git a/solutions/2032. Two Out of Three/2032.py b/solutions/2032. Two Out of Three/2032.py
index b829589dc5c..216f0395469 100644
--- a/solutions/2032. Two Out of Three/2032.py	
+++ b/solutions/2032. Two Out of Three/2032.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def twoOutOfThree(
-      self,
-      nums1: list[int],
-      nums2: list[int],
-      nums3: list[int],
-  ) -> list[int]:
+  def twoOutOfThree(self, nums1: List[int], nums2: List[int], nums3: List[int]) -> List[int]:
     count = collections.Counter()
     for nums in nums1, nums2, nums3:
       count.update(set(nums))
diff --git a/solutions/2033. Minimum Operations to Make a Uni-Value Grid/2033.cpp b/solutions/2033. Minimum Operations to Make a Uni-Value Grid/2033.cpp
index 1cd97b11f5c..0121b1ace51 100644
--- a/solutions/2033. Minimum Operations to Make a Uni-Value Grid/2033.cpp	
+++ b/solutions/2033. Minimum Operations to Make a Uni-Value Grid/2033.cpp	
@@ -1,18 +1,18 @@
 class Solution {
  public:
   int minOperations(vector<vector<int>>& grid, int x) {
-    vector<int> arr;
+    vector<int> A;
     for (const vector<int>& row : grid)
-      arr.insert(arr.end(), row.begin(), row.end());
-    if (ranges::any_of(arr, [&](int a) { return (a - arr[0]) % x; }))
+      A.insert(A.end(), row.begin(), row.end());
+    if (ranges::any_of(A, [&](int a) { return (a - A[0]) % x; }))
       return -1;
 
     int ans = 0;
 
-    nth_element(arr.begin(), arr.begin() + arr.size() / 2, arr.end());
+    nth_element(A.begin(), A.begin() + A.size() / 2, A.end());
 
-    for (const int a : arr)
-      ans += abs(a - arr[arr.size() / 2]) / x;
+    for (const int a : A)
+      ans += abs(a - A[A.size() / 2]) / x;
 
     return ans;
   }
diff --git a/solutions/2033. Minimum Operations to Make a Uni-Value Grid/2033.java b/solutions/2033. Minimum Operations to Make a Uni-Value Grid/2033.java
index a8c292ff403..d2645f7cfe2 100644
--- a/solutions/2033. Minimum Operations to Make a Uni-Value Grid/2033.java	
+++ b/solutions/2033. Minimum Operations to Make a Uni-Value Grid/2033.java	
@@ -2,19 +2,20 @@ class Solution {
   public int minOperations(int[][] grid, int x) {
     final int m = grid.length;
     final int n = grid[0].length;
-    int[] arr = new int[m * n];
+
+    int[] A = new int[m * n];
     for (int i = 0; i < m; ++i)
       for (int j = 0; j < n; ++j)
-        arr[i * n + j] = grid[i][j];
-    if (Arrays.stream(arr).anyMatch(a -> (a - arr[0]) % x != 0))
+        A[i * n + j] = grid[i][j];
+    if (Arrays.stream(A).anyMatch(a -> (a - A[0]) % x != 0))
       return -1;
 
     int ans = 0;
 
-    Arrays.sort(arr);
+    Arrays.sort(A);
 
-    for (final int a : arr)
-      ans += Math.abs(a - arr[arr.length / 2]) / x;
+    for (final int a : A)
+      ans += Math.abs(a - A[A.length / 2]) / x;
 
     return ans;
   }
diff --git a/solutions/2033. Minimum Operations to Make a Uni-Value Grid/2033.py b/solutions/2033. Minimum Operations to Make a Uni-Value Grid/2033.py
index 12c1cb0323b..13e0c52a76a 100644
--- a/solutions/2033. Minimum Operations to Make a Uni-Value Grid/2033.py	
+++ b/solutions/2033. Minimum Operations to Make a Uni-Value Grid/2033.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def minOperations(self, grid: list[list[int]], x: int) -> int:
-    arr = sorted([a for row in grid for a in row])
-    if any((a - arr[0]) % x for a in arr):
+  def minOperations(self, grid: List[List[int]], x: int) -> int:
+    A = sorted([a for row in grid for a in row])
+    if any((a - A[0]) % x for a in A):
       return -1
 
     ans = 0
 
-    for a in arr:
-      ans += abs(a - arr[len(arr) // 2]) // x
+    for a in A:
+      ans += abs(a - A[len(A) // 2]) // x
 
     return ans
diff --git a/solutions/2035. Partition Array Into Two Arrays to Minimize Sum Difference/2035.cpp b/solutions/2035. Partition Array Into Two Arrays to Minimize Sum Difference/2035.cpp
index 3120d1d0923..1914e76823b 100644
--- a/solutions/2035. Partition Array Into Two Arrays to Minimize Sum Difference/2035.cpp	
+++ b/solutions/2035. Partition Array Into Two Arrays to Minimize Sum Difference/2035.cpp	
@@ -36,17 +36,17 @@ class Solution {
   }
 
  private:
-  void dfs(const vector<int>& arr, int i, int count, int path,
+  void dfs(const vector<int>& A, int i, int count, int path,
            vector<vector<int>>& sums) {
-    if (i == arr.size()) {
+    if (i == A.size()) {
       sums[count].push_back(path);
       return;
     }
-    dfs(arr, i + 1, count + 1, path + arr[i], sums);
-    dfs(arr, i + 1, count, path, sums);
+    dfs(A, i + 1, count + 1, path + A[i], sums);
+    dfs(A, i + 1, count, path, sums);
   }
 
-  int firstGreaterEqual(const vector<int>& arr, int target) {
-    return ranges::lower_bound(arr, target) - arr.begin();
+  int firstGreaterEqual(const vector<int>& A, int target) {
+    return ranges::lower_bound(A, target) - A.begin();
   }
 };
diff --git a/solutions/2035. Partition Array Into Two Arrays to Minimize Sum Difference/2035.java b/solutions/2035. Partition Array Into Two Arrays to Minimize Sum Difference/2035.java
index 0429c76b414..c52677aa5df 100644
--- a/solutions/2035. Partition Array Into Two Arrays to Minimize Sum Difference/2035.java	
+++ b/solutions/2035. Partition Array Into Two Arrays to Minimize Sum Difference/2035.java	
@@ -39,17 +39,17 @@ public int minimumDifference(int[] nums) {
     return ans;
   }
 
-  private void dfs(int[] arr, int i, int count, int path, List<Integer>[] sums) {
-    if (i == arr.length) {
+  private void dfs(int[] A, int i, int count, int path, List<Integer>[] sums) {
+    if (i == A.length) {
       sums[count].add(path);
       return;
     }
-    dfs(arr, i + 1, count + 1, path + arr[i], sums);
-    dfs(arr, i + 1, count, path, sums);
+    dfs(A, i + 1, count + 1, path + A[i], sums);
+    dfs(A, i + 1, count, path, sums);
   }
 
-  private int firstGreaterEqual(List<Integer> arr, int target) {
-    final int i = Collections.binarySearch(arr, target);
+  private int firstGreaterEqual(List<Integer> A, int target) {
+    final int i = Collections.binarySearch(A, target);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/2035. Partition Array Into Two Arrays to Minimize Sum Difference/2035.py b/solutions/2035. Partition Array Into Two Arrays to Minimize Sum Difference/2035.py
index 2f95745951a..8fd43093b65 100644
--- a/solutions/2035. Partition Array Into Two Arrays to Minimize Sum Difference/2035.py	
+++ b/solutions/2035. Partition Array Into Two Arrays to Minimize Sum Difference/2035.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumDifference(self, nums: list[int]) -> int:
+  def minimumDifference(self, nums: List[int]) -> int:
     n = len(nums) // 2
     summ = sum(nums)
     goal = summ // 2
@@ -9,18 +9,12 @@ def minimumDifference(self, nums: list[int]) -> int:
     lSums = [[] for _ in range(n + 1)]
     rSums = [[] for _ in range(n + 1)]
 
-    def dfs(
-        arr: list[int],
-        i: int,
-        count: int,
-        path: int,
-        sums: list[list[int]]
-    ):
-      if i == len(arr):
+    def dfs(A: List[int], i: int, count: int, path: int, sums: List[List[int]]):
+      if i == len(A):
         sums[count].append(path)
         return
-      dfs(arr, i + 1, count + 1, path + arr[i], sums)
-      dfs(arr, i + 1, count, path, sums)
+      dfs(A, i + 1, count + 1, path + A[i], sums)
+      dfs(A, i + 1, count, path, sums)
 
     dfs(lNums, 0, 0, 0, lSums)
     dfs(rNums, 0, 0, 0, rSums)
diff --git a/solutions/2036. Maximum Alternating Subarray Sum/2036.py b/solutions/2036. Maximum Alternating Subarray Sum/2036.py
index bb84227f591..072c4883092 100644
--- a/solutions/2036. Maximum Alternating Subarray Sum/2036.py	
+++ b/solutions/2036. Maximum Alternating Subarray Sum/2036.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumAlternatingSubarraySum(self, nums: list[int]) -> int:
+  def maximumAlternatingSubarraySum(self, nums: List[int]) -> int:
     ans = -math.inf
     even = 0  # the subarray sum starting from an even index
     odd = 0  # the subarray sum starting from an odd index
diff --git a/solutions/2037. Minimum Number of Moves to Seat Everyone/2037.py b/solutions/2037. Minimum Number of Moves to Seat Everyone/2037.py
index e0cc27c6e21..4de9292f0a9 100644
--- a/solutions/2037. Minimum Number of Moves to Seat Everyone/2037.py	
+++ b/solutions/2037. Minimum Number of Moves to Seat Everyone/2037.py	
@@ -1,6 +1,3 @@
 class Solution:
-  def minMovesToSeat(self, seats: list[int], students: list[int]) -> int:
-    return sum(
-        abs(seat - student) for seat,
-        student in zip(sorted(seats),
-                       sorted(students)))
+  def minMovesToSeat(self, seats: List[int], students: List[int]) -> int:
+    return sum(abs(seat - student) for seat, student in zip(sorted(seats), sorted(students)))
diff --git a/solutions/2039. The Time When the Network Becomes Idle/2039.cpp b/solutions/2039. The Time When the Network Becomes Idle/2039.cpp
index 90bd0723fb0..727925035a7 100644
--- a/solutions/2039. The Time When the Network Becomes Idle/2039.cpp	
+++ b/solutions/2039. The Time When the Network Becomes Idle/2039.cpp	
@@ -15,7 +15,7 @@ class Solution {
       graph[v].push_back(u);
     }
 
-    while (!q.empty())
+    while (!q.empty()) {
       for (int sz = q.size(); sz > 0; --sz) {
         const int u = q.front();
         q.pop();
@@ -25,6 +25,7 @@ class Solution {
             q.push(v);
           }
       }
+    }
 
     for (int i = 1; i < n; ++i) {
       const int numResending = (dist[i] * 2 - 1) / patience[i];
diff --git a/solutions/2039. The Time When the Network Becomes Idle/2039.java b/solutions/2039. The Time When the Network Becomes Idle/2039.java
index 2b8ad25802f..e24e27b84a3 100644
--- a/solutions/2039. The Time When the Network Becomes Idle/2039.java	
+++ b/solutions/2039. The Time When the Network Becomes Idle/2039.java	
@@ -3,11 +3,13 @@ public int networkBecomesIdle(int[][] edges, int[] patience) {
     final int n = patience.length;
     int ans = 0;
     List<Integer>[] graph = new List[n];
-    Queue<Integer> q = new ArrayDeque<>(List.of(0));
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(0));
     int[] dist = new int[n]; // dist[i] := the distance between i and 0
     Arrays.fill(dist, Integer.MAX_VALUE);
     dist[0] = 0;
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
@@ -16,7 +18,7 @@ public int networkBecomesIdle(int[][] edges, int[] patience) {
       graph[v].add(u);
     }
 
-    while (!q.isEmpty())
+    while (!q.isEmpty()) {
       for (int sz = q.size(); sz > 0; --sz) {
         final int u = q.poll();
         for (final int v : graph[u])
@@ -25,6 +27,7 @@ public int networkBecomesIdle(int[][] edges, int[] patience) {
             q.offer(v);
           }
       }
+    }
 
     for (int i = 1; i < n; ++i) {
       final int numResending = (dist[i] * 2 - 1) / patience[i];
diff --git a/solutions/2039. The Time When the Network Becomes Idle/2039.py b/solutions/2039. The Time When the Network Becomes Idle/2039.py
index 1d376cc6730..44de0b6f28a 100644
--- a/solutions/2039. The Time When the Network Becomes Idle/2039.py	
+++ b/solutions/2039. The Time When the Network Becomes Idle/2039.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def networkBecomesIdle(
-      self,
-      edges: list[list[int]],
-      patience: list[int],
-  ) -> int:
+  def networkBecomesIdle(self, edges: List[List[int]], patience: List[int]) -> int:
     n = len(patience)
     ans = 0
     graph = [[] for _ in range(n)]
diff --git a/solutions/204. Count Primes/204.py b/solutions/204. Count Primes/204.py
index 6d83e4c9dc8..53b787d6f85 100644
--- a/solutions/204. Count Primes/204.py	
+++ b/solutions/204. Count Primes/204.py	
@@ -4,7 +4,7 @@ def countPrimes(self, n: int) -> int:
       return 0
     return sum(self._sieveEratosthenes(n))
 
-  def _sieveEratosthenes(self, n: int) -> list[bool]:
+  def _sieveEratosthenes(self, n: int) -> List[bool]:
     isPrime = [True] * n
     isPrime[0] = False
     isPrime[1] = False
diff --git a/solutions/2040. Kth Smallest Product of Two Sorted Arrays/2040.cpp b/solutions/2040. Kth Smallest Product of Two Sorted Arrays/2040.cpp
index 94d554f6880..e17fd2d47a9 100644
--- a/solutions/2040. Kth Smallest Product of Two Sorted Arrays/2040.cpp	
+++ b/solutions/2040. Kth Smallest Product of Two Sorted Arrays/2040.cpp	
@@ -14,9 +14,9 @@ class Solution {
     int sign = 1;
 
     if (k > negCount) {
-      k -= negCount;  //  Find the (k - negCount)-th positive.
+      k -= negCount;  //  Find (k - negCount)-th positive.
     } else {
-      k = negCount - k + 1;  // Find the (negCount - k + 1)-th abs(negative).
+      k = negCount - k + 1;  // Find (negCount - k + 1)-th abs(negative).
       sign = -1;
       swap(B1, B2);
     }
@@ -38,13 +38,13 @@ class Solution {
   }
 
  private:
-  void seperate(const vector<int>& arr, vector<int>& A1, vector<int>& A2) {
-    for (const int a : arr)
+  void seperate(const vector<int>& A, vector<int>& A1, vector<int>& A2) {
+    for (const int a : A)
       if (a < 0)
         A1.push_back(-a);
       else
         A2.push_back(a);
-    ranges::reverse(A1);  // Reverse to sort ascending
+    reverse(A1.begin(), A1.end());  // Reverse to sort ascending
   }
 
   long numProductNoGreaterThan(const vector<int>& A, const vector<int>& B,
diff --git a/solutions/2040. Kth Smallest Product of Two Sorted Arrays/2040.java b/solutions/2040. Kth Smallest Product of Two Sorted Arrays/2040.java
index d38c58a4616..867f6970818 100644
--- a/solutions/2040. Kth Smallest Product of Two Sorted Arrays/2040.java	
+++ b/solutions/2040. Kth Smallest Product of Two Sorted Arrays/2040.java	
@@ -12,9 +12,9 @@ public long kthSmallestProduct(int[] nums1, int[] nums2, long k) {
     int sign = 1;
 
     if (k > negCount) {
-      k -= negCount; //  Find the (k - negCount)-th positive.
+      k -= negCount; //  Find (k - negCount)-th positive.
     } else {
-      k = negCount - k + 1; // Find the (negCount - k + 1)-th abs(negative).
+      k = negCount - k + 1; // Find (negCount - k + 1)-th abs(negative).
       sign = -1;
       List<Integer> temp = B1;
       B1 = B2;
@@ -35,8 +35,8 @@ public long kthSmallestProduct(int[] nums1, int[] nums2, long k) {
     return sign * l;
   }
 
-  private void seperate(int[] arr, List<Integer> A1, List<Integer> A2) {
-    for (final int a : arr)
+  private void seperate(int[] A, List<Integer> A1, List<Integer> A2) {
+    for (final int a : A)
       if (a < 0)
         A1.add(-a);
       else
diff --git a/solutions/2040. Kth Smallest Product of Two Sorted Arrays/2040.py b/solutions/2040. Kth Smallest Product of Two Sorted Arrays/2040.py
index 220320b2397..8a65ceec61d 100644
--- a/solutions/2040. Kth Smallest Product of Two Sorted Arrays/2040.py	
+++ b/solutions/2040. Kth Smallest Product of Two Sorted Arrays/2040.py	
@@ -1,26 +1,21 @@
 class Solution:
-  def kthSmallestProduct(
-      self,
-      nums1: list[int],
-      nums2: list[int],
-      k: int,
-  ) -> int:
-    A1 = [-num for num in nums1 if num < 0][::-1]
+  def kthSmallestProduct(self, nums1: List[int], nums2: List[int], k: int) -> int:
+    A1 = [-num for num in nums1 if num < 0][::-1]  # Reverse to sort ascending
     A2 = [num for num in nums1 if num >= 0]
-    B1 = [-num for num in nums2 if num < 0][::-1]
+    B1 = [-num for num in nums2 if num < 0][::-1]  # Reverse to sort ascending
     B2 = [num for num in nums2 if num >= 0]
 
     negCount = len(A1) * len(B2) + len(A2) * len(B1)
 
-    if k > negCount:  # Find the (k - negCount)-th positive.
+    if k > negCount:  # Find (k - negCount)-th positive
       k -= negCount
       sign = 1
     else:
-      k = negCount - k + 1  # Find the (negCount - k + 1)-th abs(negative).
+      k = negCount - k + 1  # Find (negCount - k + 1)-th abs(negative).
       sign = -1
       B1, B2 = B2, B1
 
-    def numProductNoGreaterThan(A: list[int], B: list[int], m: int) -> int:
+    def numProductNoGreaterThan(A: List[int], B: List[int], m: int) -> int:
       ans = 0
       j = len(B) - 1
       for i in range(len(A)):
@@ -36,8 +31,8 @@ def numProductNoGreaterThan(A: list[int], B: list[int], m: int) -> int:
 
     while l < r:
       m = (l + r) // 2
-      if (numProductNoGreaterThan(A1, B1, m) +
-              numProductNoGreaterThan(A2, B2, m) >= k):
+      if numProductNoGreaterThan(A1, B1, m) + \
+              numProductNoGreaterThan(A2, B2, m) >= k:
         r = m
       else:
         l = m + 1
diff --git a/solutions/2043. Simple Bank System/2043.cpp b/solutions/2043. Simple Bank System/2043.cpp
index 35178b1a34c..d1f782efec0 100644
--- a/solutions/2043. Simple Bank System/2043.cpp	
+++ b/solutions/2043. Simple Bank System/2043.cpp	
@@ -1,6 +1,6 @@
 class Bank {
  public:
-  Bank(vector<long long>& balance) : balance(std::move(balance)) {}
+  Bank(vector<long long>& balance) : balance(move(balance)) {}
 
   bool transfer(int account1, int account2, long long money) {
     if (!isValid(account2))
diff --git a/solutions/2043. Simple Bank System/2043.py b/solutions/2043. Simple Bank System/2043.py
index b251cc6f296..7fe5b743d16 100644
--- a/solutions/2043. Simple Bank System/2043.py	
+++ b/solutions/2043. Simple Bank System/2043.py	
@@ -1,5 +1,5 @@
 class Bank:
-  def __init__(self, balance: list[int]):
+  def __init__(self, balance: List[int]):
     self.balance = balance
 
   def transfer(self, account1: int, account2: int, money: int) -> bool:
diff --git a/solutions/2044. Count Number of Maximum Bitwise-OR Subsets/2044.py b/solutions/2044. Count Number of Maximum Bitwise-OR Subsets/2044.py
index b461577e1cd..b7bdab43fac 100644
--- a/solutions/2044. Count Number of Maximum Bitwise-OR Subsets/2044.py	
+++ b/solutions/2044. Count Number of Maximum Bitwise-OR Subsets/2044.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countMaxOrSubsets(self, nums: list[int]) -> int:
+  def countMaxOrSubsets(self, nums: List[int]) -> int:
     ors = functools.reduce(operator.or_, nums)
     ans = 0
 
diff --git a/solutions/2045. Second Minimum Time to Reach Destination/2045.cpp b/solutions/2045. Second Minimum Time to Reach Destination/2045.cpp
index 5718faf08ff..04549fc49df 100644
--- a/solutions/2045. Second Minimum Time to Reach Destination/2045.cpp	
+++ b/solutions/2045. Second Minimum Time to Reach Destination/2045.cpp	
@@ -3,8 +3,8 @@ class Solution {
   int secondMinimum(int n, vector<vector<int>>& edges, int time, int change) {
     vector<vector<int>> graph(n + 1);
     queue<pair<int, int>> q{{{1, 0}}};
-    // minTime[u][0] := the first minimum time to reach the node u
-    // minTime[u][1] := the second minimum time to reach the node u
+    // minTime[i][0] := the first minimum time to reach the node i
+    // minTime[i][1] := the second minimum time to reach the node i
     vector<vector<int>> minTime(n + 1, vector<int>(2, INT_MAX));
     minTime[1][0] = 0;
 
@@ -16,7 +16,7 @@ class Solution {
     }
 
     while (!q.empty()) {
-      const auto [u, prevTime] = q.front();
+      const auto [i, prevTime] = q.front();
       q.pop();
       // Start from green.
       // If `numChangeSignal` is odd, now red.
@@ -25,15 +25,15 @@ class Solution {
       const int waitTime =
           numChangeSignal % 2 == 0 ? 0 : change - prevTime % change;
       const int newTime = prevTime + waitTime + time;
-      for (const int v : graph[u])
-        if (newTime < minTime[v][0]) {
-          minTime[v][0] = newTime;
-          q.emplace(v, newTime);
-        } else if (minTime[v][0] < newTime && newTime < minTime[v][1]) {
-          if (v == n)
+      for (const int j : graph[i])
+        if (newTime < minTime[j][0]) {
+          minTime[j][0] = newTime;
+          q.emplace(j, newTime);
+        } else if (minTime[j][0] < newTime && newTime < minTime[j][1]) {
+          if (j == n)
             return newTime;
-          minTime[v][1] = newTime;
-          q.emplace(v, newTime);
+          minTime[j][1] = newTime;
+          q.emplace(j, newTime);
         }
     }
 
diff --git a/solutions/2045. Second Minimum Time to Reach Destination/2045.java b/solutions/2045. Second Minimum Time to Reach Destination/2045.java
index 1725c5da6de..e80697e76db 100644
--- a/solutions/2045. Second Minimum Time to Reach Destination/2045.java	
+++ b/solutions/2045. Second Minimum Time to Reach Destination/2045.java	
@@ -1,10 +1,9 @@
 class Solution {
   public int secondMinimum(int n, int[][] edges, int time, int change) {
     List<Integer>[] graph = new List[n + 1];
-    // (index, time)
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(1, 0)));
-    // minTime[u][0] := the first minimum time to reach the node u
-    // minTime[u][1] := the second minimum time to reach the node u
+    Queue<int[]> q = new ArrayDeque<>(Arrays.asList(new int[] {1, 0})); // (index, time)
+    // minTime[i][0] := the first minimum time to reach the node i
+    // minTime[i][1] := the second minimum time to reach the node i
     int[][] minTime = new int[n + 1][2];
     Arrays.stream(minTime).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE));
     minTime[1][0] = 0;
@@ -20,23 +19,23 @@ public int secondMinimum(int n, int[][] edges, int time, int change) {
     }
 
     while (!q.isEmpty()) {
-      final int u = q.peek().getKey();
-      final int prevTime = q.poll().getValue();
+      final int i = q.peek()[0];
+      final int prevTime = q.poll()[1];
       // Start from green.
       // If `numChangeSignal` is odd, now red.
       // If `numChangeSignal` is even, now green.
       final int numChangeSignal = prevTime / change;
       final int waitTime = numChangeSignal % 2 == 0 ? 0 : change - prevTime % change;
       final int newTime = prevTime + waitTime + time;
-      for (final int v : graph[u])
-        if (newTime < minTime[v][0]) {
-          minTime[v][0] = newTime;
-          q.offer(new Pair<>(v, newTime));
-        } else if (minTime[v][0] < newTime && newTime < minTime[v][1]) {
-          if (v == n)
+      for (final int j : graph[i])
+        if (newTime < minTime[j][0]) {
+          minTime[j][0] = newTime;
+          q.offer(new int[] {j, newTime});
+        } else if (minTime[j][0] < newTime && newTime < minTime[j][1]) {
+          if (j == n)
             return newTime;
-          minTime[v][1] = newTime;
-          q.offer(new Pair<>(v, newTime));
+          minTime[j][1] = newTime;
+          q.offer(new int[] {j, newTime});
         }
     }
 
diff --git a/solutions/2045. Second Minimum Time to Reach Destination/2045.py b/solutions/2045. Second Minimum Time to Reach Destination/2045.py
index 4fa333e426e..8be783d4cb5 100644
--- a/solutions/2045. Second Minimum Time to Reach Destination/2045.py	
+++ b/solutions/2045. Second Minimum Time to Reach Destination/2045.py	
@@ -1,15 +1,9 @@
 class Solution:
-  def secondMinimum(
-      self,
-      n: int,
-      edges: list[list[int]],
-      time: int,
-      change: int,
-  ) -> int:
+  def secondMinimum(self, n: int, edges: List[List[int]], time: int, change: int) -> int:
     graph = [[] for _ in range(n + 1)]
     q = collections.deque([(1, 0)])
-    # minTime[u][0] := the first minimum time to reach the node u
-    # minTime[u][1] := the second minimum time to reach the node u
+    # minTime[i][0] := the first minimum time to reach the node i
+    # minTime[i][1] := the second minimum time to reach the node i
     minTime = [[math.inf] * 2 for _ in range(n + 1)]
     minTime[1][0] = 0
 
@@ -18,20 +12,20 @@ def secondMinimum(
       graph[v].append(u)
 
     while q:
-      u, prevTime = q.popleft()
+      i, prevTime = q.popleft()
       # Start from green.
       # If `numChangeSignal` is odd, now red.
       # If numChangeSignal is even -> now gree
       numChangeSignal = prevTime // change
-      waitTime = (0 if numChangeSignal % 2 == 0
-                  else change - (prevTime % change))
+      waitTime = 0 if numChangeSignal % 2 == 0 \
+          else change - (prevTime % change)
       newTime = prevTime + waitTime + time
-      for v in graph[u]:
-        if newTime < minTime[v][0]:
-          minTime[v][0] = newTime
-          q.append((v, newTime))
-        elif minTime[v][0] < newTime < minTime[v][1]:
-          if v == n:
+      for j in graph[i]:
+        if newTime < minTime[j][0]:
+          minTime[j][0] = newTime
+          q.append((j, newTime))
+        elif minTime[j][0] < newTime < minTime[j][1]:
+          if j == n:
             return newTime
-          minTime[v][1] = newTime
-          q.append((v, newTime))
+          minTime[j][1] = newTime
+          q.append((j, newTime))
diff --git a/solutions/2046. Sort Linked List Already Sorted Using Absolute Values/2046.cpp b/solutions/2046. Sort Linked List Already Sorted Using Absolute Values/2046.cpp
index a9441bc294a..a69d15f6fe9 100644
--- a/solutions/2046. Sort Linked List Already Sorted Using Absolute Values/2046.cpp	
+++ b/solutions/2046. Sort Linked List Already Sorted Using Absolute Values/2046.cpp	
@@ -4,7 +4,7 @@ class Solution {
     ListNode* prev = head;
     ListNode* curr = head->next;
 
-    while (curr != nullptr)
+    while (curr)
       if (curr->val < 0) {
         prev->next = curr->next;
         curr->next = head;
diff --git a/solutions/2046. Sort Linked List Already Sorted Using Absolute Values/2046.py b/solutions/2046. Sort Linked List Already Sorted Using Absolute Values/2046.py
index 0d81ff185ff..b32183a4281 100644
--- a/solutions/2046. Sort Linked List Already Sorted Using Absolute Values/2046.py	
+++ b/solutions/2046. Sort Linked List Already Sorted Using Absolute Values/2046.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sortLinkedList(self, head: ListNode | None) -> ListNode | None:
+  def sortLinkedList(self, head: Optional[ListNode]) -> Optional[ListNode]:
     prev = head
     curr = head.next
 
diff --git a/solutions/2047. Number of Valid Words in a Sentence/2047-2.py b/solutions/2047. Number of Valid Words in a Sentence/2047-2.py
index 586e7103533..9fc9501cf3b 100644
--- a/solutions/2047. Number of Valid Words in a Sentence/2047-2.py	
+++ b/solutions/2047. Number of Valid Words in a Sentence/2047-2.py	
@@ -1,5 +1,4 @@
 class Solution:
   def countValidWords(self, sentence: str) -> int:
     pattern = re.compile(r'^[a-z]*([a-z]-[a-z])?[a-z]*[!,.]?$')
-    return sum(pattern.search(token) != None for token in
-               sentence.strip().split())
+    return sum(pattern.search(token) != None for token in sentence.strip().split())
diff --git a/solutions/2048. Next Greater Numerically Balanced Number/2048.cpp b/solutions/2048. Next Greater Numerically Balanced Number/2048.cpp
index dfd9380974f..ed0d0b215d7 100644
--- a/solutions/2048. Next Greater Numerically Balanced Number/2048.cpp	
+++ b/solutions/2048. Next Greater Numerically Balanced Number/2048.cpp	
@@ -9,7 +9,7 @@ class Solution {
  private:
   bool isBalance(int num) {
     vector<int> count(10);
-    while (num > 0) {
+    while (num) {
       if (num % 10 == 0)
         return false;
       ++count[num % 10];
diff --git a/solutions/2048. Next Greater Numerically Balanced Number/2048.py b/solutions/2048. Next Greater Numerically Balanced Number/2048.py
index 9f98c08da93..2e0fd2aca9e 100644
--- a/solutions/2048. Next Greater Numerically Balanced Number/2048.py	
+++ b/solutions/2048. Next Greater Numerically Balanced Number/2048.py	
@@ -2,7 +2,7 @@ class Solution:
   def nextBeautifulNumber(self, n: int) -> int:
     def isBalance(num: int) -> bool:
       count = [0] * 10
-      while num > 0:
+      while num:
         if num % 10 == 0:
           return False
         count[num % 10] += 1
diff --git a/solutions/2049. Count Nodes With the Highest Score/2049.cpp b/solutions/2049. Count Nodes With the Highest Score/2049.cpp
index c0fb8417e04..f699aa90aba 100644
--- a/solutions/2049. Count Nodes With the Highest Score/2049.cpp	
+++ b/solutions/2049. Count Nodes With the Highest Score/2049.cpp	
@@ -19,7 +19,7 @@ class Solution {
     int count = 1;
     long score = 1;
     for (const int v : tree[u]) {
-      const int childCount = dfs(tree, v, std::move(maxScore), ans);
+      const int childCount = dfs(tree, v, move(maxScore), ans);
       count += childCount;
       score *= childCount;
     }
diff --git a/solutions/2049. Count Nodes With the Highest Score/2049.py b/solutions/2049. Count Nodes With the Highest Score/2049.py
index 5173f49e8fa..e820c94695c 100644
--- a/solutions/2049. Count Nodes With the Highest Score/2049.py	
+++ b/solutions/2049. Count Nodes With the Highest Score/2049.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countHighestScoreNodes(self, parents: list[int]) -> int:
+  def countHighestScoreNodes(self, parents: List[int]) -> int:
     tree = [[] for _ in range(len(parents))]
 
     for i, parent in enumerate(parents):
diff --git a/solutions/2050. Parallel Courses III/2050.java b/solutions/2050. Parallel Courses III/2050.java
index 76897f53223..17524c5a093 100644
--- a/solutions/2050. Parallel Courses III/2050.java	
+++ b/solutions/2050. Parallel Courses III/2050.java	
@@ -3,7 +3,9 @@ public int minimumTime(int n, int[][] relations, int[] time) {
     List<Integer>[] graph = new List[n];
     int[] inDegrees = new int[n];
     int[] dist = time.clone();
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     // Build the graph.
     for (int[] r : relations) {
diff --git a/solutions/2050. Parallel Courses III/2050.py b/solutions/2050. Parallel Courses III/2050.py
index 5f429627370..322ef8b2781 100644
--- a/solutions/2050. Parallel Courses III/2050.py	
+++ b/solutions/2050. Parallel Courses III/2050.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minimumTime(
-      self,
-      n: int,
-      relations: list[list[int]],
-      time: list[int],
-  ) -> int:
+  def minimumTime(self, n: int, relations: List[List[int]], time: List[int]) -> int:
     graph = [[] for _ in range(n)]
     inDegrees = [0] * n
     dist = time.copy()
diff --git a/solutions/2053. Kth Distinct String in an Array/2053.py b/solutions/2053. Kth Distinct String in an Array/2053.py
index d5dd147581e..8b25bd1add1 100644
--- a/solutions/2053. Kth Distinct String in an Array/2053.py	
+++ b/solutions/2053. Kth Distinct String in an Array/2053.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def kthDistinct(self, arr: list[str], k: int) -> str:
+  def kthDistinct(self, arr: List[str], k: int) -> str:
     count = collections.Counter(arr)
 
     for a in arr:
diff --git a/solutions/2054. Two Best Non-Overlapping Events/2054.cpp b/solutions/2054. Two Best Non-Overlapping Events/2054.cpp
index 83b991ff208..2895d858b15 100644
--- a/solutions/2054. Two Best Non-Overlapping Events/2054.cpp	
+++ b/solutions/2054. Two Best Non-Overlapping Events/2054.cpp	
@@ -2,6 +2,8 @@ struct Event {
   int time;
   int value;
   bool isStart;
+  Event(int time, int value, bool isStart)
+      : time(time), value(value), isStart(isStart) {}
 };
 
 class Solution {
@@ -19,8 +21,8 @@ class Solution {
       evts.emplace_back(end + 1, value, false);
     }
 
-    ranges::sort(evts, ranges::less{}, [](const Event& evt) {
-      return pair<int, bool>{evt.time, evt.isStart};
+    ranges::sort(evts, [](const Event& a, const Event& b) {
+      return a.time == b.time ? a.isStart < b.isStart : a.time < b.time;
     });
 
     for (const auto& [_, value, isStart] : evts)
diff --git a/solutions/2054. Two Best Non-Overlapping Events/2054.java b/solutions/2054. Two Best Non-Overlapping Events/2054.java
index d3ca0c23c12..b52680b9a43 100644
--- a/solutions/2054. Two Best Non-Overlapping Events/2054.java	
+++ b/solutions/2054. Two Best Non-Overlapping Events/2054.java	
@@ -1,6 +1,16 @@
+class Event {
+  public int time;
+  public int value;
+  public int isStart;
+  public Event(int time, int value, int isStart) {
+    this.time = time;
+    this.value = value;
+    this.isStart = isStart;
+  }
+};
+
 class Solution {
   public int maxTwoEvents(int[][] events) {
-    record Event(int time, int value, int isStart) {}
     int ans = 0;
     int maxValue = 0;
     Event[] evts = new Event[events.length * 2];
@@ -13,7 +23,7 @@ record Event(int time, int value, int isStart) {}
       evts[i * 2 + 1] = new Event(end + 1, value, 0);
     }
 
-    Arrays.sort(evts, Comparator.comparingInt(Event::time).thenComparingInt(Event::isStart));
+    Arrays.sort(evts, (a, b) -> a.time == b.time ? a.isStart - b.isStart : a.time - b.time);
 
     for (Event evt : evts)
       if (evt.isStart == 1)
diff --git a/solutions/2054. Two Best Non-Overlapping Events/2054.py b/solutions/2054. Two Best Non-Overlapping Events/2054.py
index 1d423ccb0f9..4862002566e 100644
--- a/solutions/2054. Two Best Non-Overlapping Events/2054.py	
+++ b/solutions/2054. Two Best Non-Overlapping Events/2054.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxTwoEvents(self, events: list[list[int]]) -> int:
+  def maxTwoEvents(self, events: List[List[int]]) -> int:
     ans = 0
     maxValue = 0
     evts = []  # (time, isStart, value)
diff --git a/solutions/2055. Plates Between Candles/2055-2.py b/solutions/2055. Plates Between Candles/2055-2.py
index cc245faee5d..979ed8d0f32 100644
--- a/solutions/2055. Plates Between Candles/2055-2.py	
+++ b/solutions/2055. Plates Between Candles/2055-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def platesBetweenCandles(self, s: str, queries: list[list[int]]) -> list[int]:
+  def platesBetweenCandles(self, s: str, queries: List[List[int]]) -> List[int]:
     n = len(s)
     ans = []
     closestLeftCandle = [0] * n
diff --git a/solutions/2055. Plates Between Candles/2055.py b/solutions/2055. Plates Between Candles/2055.py
index c0de5492391..53d641f8ddd 100644
--- a/solutions/2055. Plates Between Candles/2055.py	
+++ b/solutions/2055. Plates Between Candles/2055.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def platesBetweenCandles(self, s: str, queries: list[list[int]]) -> list[int]:
+  def platesBetweenCandles(self, s: str, queries: List[List[int]]) -> List[int]:
     ans = []
     indices = [i for i, c in enumerate(s) if c == '|']  # indices of '|'
 
diff --git a/solutions/2056. Number of Valid Move Combinations On Chessboard/2056.java b/solutions/2056. Number of Valid Move Combinations On Chessboard/2056.java
index a301b3fee45..9a638ae7835 100644
--- a/solutions/2056. Number of Valid Move Combinations On Chessboard/2056.java	
+++ b/solutions/2056. Number of Valid Move Combinations On Chessboard/2056.java	
@@ -16,13 +16,13 @@ public int countCombinations(String[] pieces, int[][] positions) {
     return hashedBoards.size();
   }
 
-  private static Map<String, int[][]> MOVES = new HashMap<>();
+  private static Map<String, int[][]> kMoves = new HashMap<>();
 
   static {
-    MOVES.put("rook", new int[][] {{1, 0}, {-1, 0}, {0, 1}, {0, -1}});
-    MOVES.put("bishop", new int[][] {{1, 1}, {1, -1}, {-1, 1}, {-1, -1}});
-    MOVES.put("queen",
-              new int[][] {{1, 0}, {-1, 0}, {0, 1}, {0, -1}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}});
+    kMoves.put("rook", new int[][] {{1, 0}, {-1, 0}, {0, 1}, {0, -1}});
+    kMoves.put("bishop", new int[][] {{1, 1}, {1, -1}, {-1, 1}, {-1, -1}});
+    kMoves.put("queen",
+               new int[][] {{1, 0}, {-1, 0}, {0, 1}, {0, -1}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}});
   }
 
   // Generates all possible combinations of moves for the given pieces.
@@ -33,7 +33,7 @@ private void getCombMoves(String[] pieces, int ithPiece, List<int[]> path,
       return;
     }
 
-    for (int[] move : MOVES.get(pieces[ithPiece])) {
+    for (int[] move : kMoves.get(pieces[ithPiece])) {
       path.add(move);
       getCombMoves(pieces, ithPiece + 1, path, combMoves);
       path.remove(path.size() - 1);
diff --git a/solutions/2056. Number of Valid Move Combinations On Chessboard/2056.py b/solutions/2056. Number of Valid Move Combinations On Chessboard/2056.py
index 23b1f2f91b9..026171e79dc 100644
--- a/solutions/2056. Number of Valid Move Combinations On Chessboard/2056.py	
+++ b/solutions/2056. Number of Valid Move Combinations On Chessboard/2056.py	
@@ -1,23 +1,15 @@
 class Solution:
-  def countCombinations(
-      self,
-      pieces: list[str],
-      positions: list[list[int]],
-  ) -> int:
+  def countCombinations(self, pieces: List[str], positions: List[List[int]]) -> int:
     n = len(pieces)
     moves = {"rook": [(1, 0), (-1, 0), (0, 1), (0, -1)],
              "bishop": [(1, 1), (1, -1), (-1, 1), (-1, -1)],
              "queen": [(1, 0), (-1, 0), (0, 1), (0, -1), (1, 1), (1, -1), (-1, 1), (-1, -1)]}
     hashedBoards = set()
 
-    def getHash(board: list[list[int]]) -> Tuple:
+    def getHash(board: List[List[int]]) -> Tuple:
       return tuple([tuple(pos) for pos in board])
 
-    def dfs(
-        board: list[list[int]],
-        pieceMoves: list[tuple[int, int]],
-        activeMask: int,
-    ) -> None:
+    def dfs(board: List[List[int]], pieceMoves: List[Tuple[int, int]], activeMask: int) -> None:
       """Performs a depth-first search to explore all possible board states."""
       if activeMask == 0:
         return
diff --git a/solutions/2057. Smallest Index With Equal Value/2057.py b/solutions/2057. Smallest Index With Equal Value/2057.py
index 84a3efcd7c2..c54b0369510 100644
--- a/solutions/2057. Smallest Index With Equal Value/2057.py	
+++ b/solutions/2057. Smallest Index With Equal Value/2057.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def smallestEqual(self, nums: list[int]) -> int:
+  def smallestEqual(self, nums: List[int]) -> int:
     return next((i for i, num in enumerate(nums) if i % 10 == num), -1)
diff --git a/solutions/2058. Find the Minimum and Maximum Number of Nodes Between Critical Points/2058.cpp b/solutions/2058. Find the Minimum and Maximum Number of Nodes Between Critical Points/2058.cpp
index 72e710746b8..2cc79c83adf 100644
--- a/solutions/2058. Find the Minimum and Maximum Number of Nodes Between Critical Points/2058.cpp	
+++ b/solutions/2058. Find the Minimum and Maximum Number of Nodes Between Critical Points/2058.cpp	
@@ -8,7 +8,7 @@ class Solution {
     ListNode* prev = head;        // Point to the index 0.
     ListNode* curr = head->next;  // Point to the index 1.
 
-    while (curr->next != nullptr) {
+    while (curr->next) {
       if (curr->val > prev->val && curr->val > curr->next->val ||
           curr->val < prev->val && curr->val < curr->next->val) {
         if (firstMaIndex == -1)  // Only assign once.
diff --git a/solutions/2058. Find the Minimum and Maximum Number of Nodes Between Critical Points/2058.py b/solutions/2058. Find the Minimum and Maximum Number of Nodes Between Critical Points/2058.py
index a606f311280..801cee05d19 100644
--- a/solutions/2058. Find the Minimum and Maximum Number of Nodes Between Critical Points/2058.py	
+++ b/solutions/2058. Find the Minimum and Maximum Number of Nodes Between Critical Points/2058.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def nodesBetweenCriticalPoints(self, head: ListNode | None) -> list[int]:
+  def nodesBetweenCriticalPoints(self, head: Optional[ListNode]) -> List[int]:
     minDistance = math.inf
     firstMaIndex = -1
     prevMaIndex = -1
@@ -8,8 +8,8 @@ def nodesBetweenCriticalPoints(self, head: ListNode | None) -> list[int]:
     curr = head.next  # Point to the index 1.
 
     while curr.next:
-      if (curr.val > prev.val and curr.val > curr.next.val or
-              curr.val < prev.val and curr.val < curr.next.val):
+      if curr.val > prev.val and curr.val > curr.next.val or \
+         curr.val < prev.val and curr.val < curr.next.val:
         if firstMaIndex == -1:  # Only assign once.
           firstMaIndex = index
         if prevMaIndex != -1:
diff --git a/solutions/2059. Minimum Operations to Convert Number/2059.cpp b/solutions/2059. Minimum Operations to Convert Number/2059.cpp
index bf171686ecc..e8e854dd508 100644
--- a/solutions/2059. Minimum Operations to Convert Number/2059.cpp	
+++ b/solutions/2059. Minimum Operations to Convert Number/2059.cpp	
@@ -1,18 +1,20 @@
 class Solution {
  public:
   int minimumOperations(vector<int>& nums, int start, int goal) {
+    int ans = 0;
     queue<int> q{{start}};
     vector<bool> seen(1001);
     seen[start] = true;
 
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         const int x = q.front();
         q.pop();
         for (const int num : nums) {
           for (const int res : {x + num, x - num, x ^ num}) {
             if (res == goal)
-              return step;
+              return ans;
             if (res < 0 || res > 1000 || seen[res])
               continue;
             seen[res] = true;
@@ -20,6 +22,7 @@ class Solution {
           }
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/2059. Minimum Operations to Convert Number/2059.java b/solutions/2059. Minimum Operations to Convert Number/2059.java
index ac0650d5477..8f1dc341c52 100644
--- a/solutions/2059. Minimum Operations to Convert Number/2059.java	
+++ b/solutions/2059. Minimum Operations to Convert Number/2059.java	
@@ -1,16 +1,18 @@
 class Solution {
   public int minimumOperations(int[] nums, int start, int goal) {
-    Queue<Integer> q = new ArrayDeque<>(List.of(start));
+    int ans = 0;
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(start));
     boolean[] seen = new boolean[1001];
     seen[start] = true;
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         final int x = q.poll();
         for (final int num : nums) {
           for (final int res : new int[] {x + num, x - num, x ^ num}) {
             if (res == goal)
-              return step;
+              return ans;
             if (res < 0 || res > 1000 || seen[res])
               continue;
             seen[res] = true;
@@ -18,6 +20,7 @@ public int minimumOperations(int[] nums, int start, int goal) {
           }
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/2059. Minimum Operations to Convert Number/2059.py b/solutions/2059. Minimum Operations to Convert Number/2059.py
index e1bc6a04d51..f6bd26db3c6 100644
--- a/solutions/2059. Minimum Operations to Convert Number/2059.py	
+++ b/solutions/2059. Minimum Operations to Convert Number/2059.py	
@@ -1,20 +1,20 @@
 class Solution:
-  def minimumOperations(self, nums: list[int], start: int, goal: int) -> int:
+  def minimumOperations(self, nums: List[int], start: int, goal: int) -> int:
+    ans = 0
     q = collections.deque([start])
     seen = {start}
 
-    step = 1
     while q:
+      ans += 1
       for _ in range(len(q)):
         x = q.popleft()
         for num in nums:
           for res in (x + num, x - num, x ^ num):
             if res == goal:
-              return step
+              return ans
             if res < 0 or res > 1000 or res in seen:
               continue
             seen.add(res)
             q.append(res)
-      step += 1
 
     return -1
diff --git a/solutions/206. Reverse Linked List/206-2.cpp b/solutions/206. Reverse Linked List/206-2.cpp
index aee16bc802b..7035c6855fd 100644
--- a/solutions/206. Reverse Linked List/206-2.cpp	
+++ b/solutions/206. Reverse Linked List/206-2.cpp	
@@ -3,7 +3,7 @@ class Solution {
   ListNode* reverseList(ListNode* head) {
     ListNode* prev = nullptr;
 
-    while (head != nullptr) {
+    while (head) {
       ListNode* next = head->next;
       head->next = prev;
       prev = head;
diff --git a/solutions/206. Reverse Linked List/206-2.py b/solutions/206. Reverse Linked List/206-2.py
index 4dabf420613..dd77eab9723 100644
--- a/solutions/206. Reverse Linked List/206-2.py	
+++ b/solutions/206. Reverse Linked List/206-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def reverseList(self, head: ListNode | None) -> ListNode | None:
+  def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]:
     prev = None
     curr = head
 
diff --git a/solutions/206. Reverse Linked List/206.py b/solutions/206. Reverse Linked List/206.py
index 7062d045148..2e8dcda36b5 100644
--- a/solutions/206. Reverse Linked List/206.py	
+++ b/solutions/206. Reverse Linked List/206.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def reverseList(self, head: ListNode | None) -> ListNode | None:
+  def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]:
     if not head or not head.next:
       return head
 
diff --git a/solutions/2060. Check if an Original String Exists Given Two Encoded Strings/2060.java b/solutions/2060. Check if an Original String Exists Given Two Encoded Strings/2060.java
index 7e3c04bc918..9a967c12936 100644
--- a/solutions/2060. Check if an Original String Exists Given Two Encoded Strings/2060.java	
+++ b/solutions/2060. Check if an Original String Exists Given Two Encoded Strings/2060.java	
@@ -54,7 +54,7 @@ private int getNextLetterIndex(final String s, int i) {
   }
 
   private List<Integer> getNums(final String s) {
-    List<Integer> nums = new ArrayList<>(List.of(Integer.parseInt(s)));
+    List<Integer> nums = new ArrayList<>(Arrays.asList(Integer.parseInt(s)));
     if (s.length() == 2) {
       nums.add(Integer.parseInt(s.substring(0, 1)) + Integer.parseInt(s.substring(1, 2)));
     } else if (s.length() == 3) {
diff --git a/solutions/2060. Check if an Original String Exists Given Two Encoded Strings/2060.py b/solutions/2060. Check if an Original String Exists Given Two Encoded Strings/2060.py
index bb93ad00890..3bb582525d5 100644
--- a/solutions/2060. Check if an Original String Exists Given Two Encoded Strings/2060.py	
+++ b/solutions/2060. Check if an Original String Exists Given Two Encoded Strings/2060.py	
@@ -1,6 +1,6 @@
 class Solution:
   def possiblyEquals(self, s1: str, s2: str) -> bool:
-    def getNums(s: str) -> set[int]:
+    def getNums(s: str) -> Set[int]:
       nums = {int(s)}
       for i in range(1, len(s)):
         nums |= {x + y for x in getNums(s[:i]) for y in getNums(s[i:])}
diff --git a/solutions/2061. Number of Spaces Cleaning Robot Cleaned/2061.cpp b/solutions/2061. Number of Spaces Cleaning Robot Cleaned/2061.cpp
index 9888ef987c2..c7f0a324ac3 100644
--- a/solutions/2061. Number of Spaces Cleaning Robot Cleaned/2061.cpp	
+++ b/solutions/2061. Number of Spaces Cleaning Robot Cleaned/2061.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int numberOfCleanRooms(vector<vector<int>>& room) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = room.size();
     const int n = room[0].size();
     int ans = 1;
@@ -13,8 +13,8 @@ class Solution {
     room[i][j] = 2;  // 2 := cleaned
 
     while (true) {
-      const int x = i + kDirs[state][0];
-      const int y = j + kDirs[state][1];
+      const int x = i + dirs[state][0];
+      const int y = j + dirs[state][1];
       if (x < 0 || x == m || y < 0 || y == n || room[x][y] == 1) {
         // Turn 90 degrees clockwise.
         state = (state + 1) % 4;
diff --git a/solutions/2061. Number of Spaces Cleaning Robot Cleaned/2061.java b/solutions/2061. Number of Spaces Cleaning Robot Cleaned/2061.java
index 6c51171cb67..c17b901b286 100644
--- a/solutions/2061. Number of Spaces Cleaning Robot Cleaned/2061.java	
+++ b/solutions/2061. Number of Spaces Cleaning Robot Cleaned/2061.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numberOfCleanRooms(int[][] room) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = room.length;
     final int n = room[0].length;
     int ans = 1;
@@ -12,8 +12,8 @@ public int numberOfCleanRooms(int[][] room) {
     room[i][j] = 2; // 2 := cleaned
 
     while (true) {
-      final int x = i + DIRS[state][0];
-      final int y = j + DIRS[state][1];
+      final int x = i + dirs[state];
+      final int y = j + dirs[state + 1];
       if (x < 0 || x == m || y < 0 || y == n || room[x][y] == 1) {
         // Turn 90 degrees clockwise.
         state = (state + 1) % 4;
diff --git a/solutions/2061. Number of Spaces Cleaning Robot Cleaned/2061.py b/solutions/2061. Number of Spaces Cleaning Robot Cleaned/2061.py
index 5cb9b09fa3e..de18e66b76a 100644
--- a/solutions/2061. Number of Spaces Cleaning Robot Cleaned/2061.py	
+++ b/solutions/2061. Number of Spaces Cleaning Robot Cleaned/2061.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def numberOfCleanRooms(self, room: list[list[int]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def numberOfCleanRooms(self, room: List[List[int]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(room)
     n = len(room[0])
     ans = 1
@@ -11,8 +11,8 @@ def numberOfCleanRooms(self, room: list[list[int]]) -> int:
     room[i][j] = 2  # 2 := cleaned
 
     while True:
-      x = i + DIRS[state][0]
-      y = j + DIRS[state][1]
+      x = i + dirs[state]
+      y = j + dirs[state + 1]
       if x < 0 or x == m or y < 0 or y == n or room[x][y] == 1:
         # Turn 90 degrees clockwise.
         state = (state + 1) % 4
diff --git a/solutions/2062. Count Vowel Substrings of a String/2062.py b/solutions/2062. Count Vowel Substrings of a String/2062.py
index fdbad21abc2..c33aceddd53 100644
--- a/solutions/2062. Count Vowel Substrings of a String/2062.py	
+++ b/solutions/2062. Count Vowel Substrings of a String/2062.py	
@@ -1,6 +1,6 @@
 class Solution:
   def countVowelSubstrings(self, word: str) -> int:
-    VOWELS = 'aeiou'
+    kVowels = 'aeiou'
 
     def countVowelSubstringsAtMost(goal: int) -> int:
       ans = 0
@@ -9,7 +9,7 @@ def countVowelSubstringsAtMost(goal: int) -> int:
 
       l = 0
       for r, c in enumerate(word):
-        if c not in VOWELS:  # Fresh start.
+        if c not in kVowels:  # Fresh start.
           l = r + 1
           k = goal
           count = collections.Counter()
diff --git a/solutions/2064. Minimized Maximum of Products Distributed to Any Store/2064.cpp b/solutions/2064. Minimized Maximum of Products Distributed to Any Store/2064.cpp
index ba3d615b308..d15a63a84d4 100644
--- a/solutions/2064. Minimized Maximum of Products Distributed to Any Store/2064.cpp	
+++ b/solutions/2064. Minimized Maximum of Products Distributed to Any Store/2064.cpp	
@@ -18,7 +18,8 @@ class Solution {
  private:
   int numStores(const vector<int>& quantities, int m) {
     // ceil(q / m)
-    return accumulate(quantities.begin(), quantities.end(), 0,
-                      [&](int acc, int q) { return acc + (q - 1) / m + 1; });
+    return accumulate(
+        quantities.begin(), quantities.end(), 0,
+        [&](int subtotal, int q) { return subtotal + (q - 1) / m + 1; });
   }
 };
diff --git a/solutions/2064. Minimized Maximum of Products Distributed to Any Store/2064.py b/solutions/2064. Minimized Maximum of Products Distributed to Any Store/2064.py
index 822a8727bfc..dbd392d8a4e 100644
--- a/solutions/2064. Minimized Maximum of Products Distributed to Any Store/2064.py	
+++ b/solutions/2064. Minimized Maximum of Products Distributed to Any Store/2064.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimizedMaximum(self, n: int, quantities: list[int]) -> int:
+  def minimizedMaximum(self, n: int, quantities: List[int]) -> int:
     l = 1
     r = max(quantities)
 
diff --git a/solutions/2065. Maximum Path Quality of a Graph/2065-2.py b/solutions/2065. Maximum Path Quality of a Graph/2065-2.py
index e6e52361291..094089d03ef 100644
--- a/solutions/2065. Maximum Path Quality of a Graph/2065-2.py	
+++ b/solutions/2065. Maximum Path Quality of a Graph/2065-2.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def maximalPathQuality(
-      self,
-      values: list[int],
-      edges: list[list[int]],
-      maxTime: int,
-  ) -> int:
+  def maximalPathQuality(self, values: List[int], edges: List[List[int]], maxTime: int) -> int:
     ans = 0
     graph = [[] for _ in range(len(values))]
     # (node, quality, remainingTime, seen)
@@ -21,7 +16,6 @@ def maximalPathQuality(
       for v, time in graph[u]:
         if time <= remainingTime:
           q.append(
-              (v, quality + values[v] * (v not in seen),
-               remainingTime - time, seen | set([v])))
+              (v, quality + values[v] * (v not in seen), remainingTime - time, seen | set([v])))
 
     return ans
diff --git a/solutions/2065. Maximum Path Quality of a Graph/2065.java b/solutions/2065. Maximum Path Quality of a Graph/2065.java
index 4ed58ec1efa..9af77cf4419 100644
--- a/solutions/2065. Maximum Path Quality of a Graph/2065.java	
+++ b/solutions/2065. Maximum Path Quality of a Graph/2065.java	
@@ -4,7 +4,9 @@ public int maximalPathQuality(int[] values, int[][] edges, int maxTime) {
     List<Pair<Integer, Integer>>[] graph = new List[n];
     int[] seen = new int[n];
     seen[0] = 1;
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
diff --git a/solutions/2065. Maximum Path Quality of a Graph/2065.py b/solutions/2065. Maximum Path Quality of a Graph/2065.py
index 591600208e8..b590fed3052 100644
--- a/solutions/2065. Maximum Path Quality of a Graph/2065.py	
+++ b/solutions/2065. Maximum Path Quality of a Graph/2065.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def maximalPathQuality(
-      self,
-      values: list[int],
-      edges: list[list[int]],
-      maxTime: int,
-  ) -> int:
+  def maximalPathQuality(self, values: List[int], edges: List[List[int]], maxTime: int) -> int:
     n = len(values)
     ans = 0
     graph = [[] for _ in range(n)]
diff --git a/solutions/2069. Walking Robot Simulation II/2069.py b/solutions/2069. Walking Robot Simulation II/2069.py
index 9a51e53b261..53bbb225752 100644
--- a/solutions/2069. Walking Robot Simulation II/2069.py	
+++ b/solutions/2069. Walking Robot Simulation II/2069.py	
@@ -2,17 +2,17 @@ class Robot:
   def __init__(self, width: int, height: int):
     self.isOrigin = True
     self.i = 0
-    self.pos = ([((0, 0), 'South')] +
-                [((i, 0), 'East') for i in range(1, width)] +
-                [((width - 1, j), 'North') for j in range(1, height)] +
-                [((i, height - 1), 'West') for i in range(width - 2, -1, -1)] +
-                [((0, j), 'South') for j in range(height - 2, 0, -1)])
+    self.pos = [((0, 0), 'South')] + \
+        [((i, 0), 'East') for i in range(1, width)] + \
+        [((width - 1, j), 'North') for j in range(1, height)] + \
+        [((i, height - 1), 'West') for i in range(width - 2, -1, -1)] +\
+        [((0, j), 'South') for j in range(height - 2, 0, -1)]
 
   def step(self, num: int) -> None:
     self.isOrigin = False
     self.i = (self.i + num) % len(self.pos)
 
-  def getPos(self) -> list[int]:
+  def getPos(self) -> List[int]:
     return self.pos[self.i][0]
 
   def getDir(self) -> str:
diff --git a/solutions/207. Course Schedule/207.cpp b/solutions/207. Course Schedule/207.cpp
index e8c94ef9eda..0a2e52243fa 100644
--- a/solutions/207. Course Schedule/207.cpp	
+++ b/solutions/207. Course Schedule/207.cpp	
@@ -26,11 +26,13 @@ class Solution {
       return true;
     if (states[u] == State::kVisited)
       return false;
+
     states[u] = State::kVisiting;
     for (const int v : graph[u])
       if (hasCycle(graph, v, states))
         return true;
     states[u] = State::kVisited;
+
     return false;
   }
 };
diff --git a/solutions/207. Course Schedule/207.java b/solutions/207. Course Schedule/207.java
index b4c1feddcc5..92dc03c5917 100644
--- a/solutions/207. Course Schedule/207.java	
+++ b/solutions/207. Course Schedule/207.java	
@@ -1,4 +1,4 @@
-enum State { INIT, VISITING, VISITED }
+enum State { kInit, kVisiting, kVisited }
 
 class Solution {
   public boolean canFinish(int numCourses, int[][] prerequisites) {
@@ -22,15 +22,17 @@ public boolean canFinish(int numCourses, int[][] prerequisites) {
   }
 
   private boolean hasCycle(List<Integer>[] graph, int u, State[] states) {
-    if (states[u] == State.VISITING)
+    if (states[u] == State.kVisiting)
       return true;
-    if (states[u] == State.VISITED)
+    if (states[u] == State.kVisited)
       return false;
-    states[u] = State.VISITING;
+
+    states[u] = State.kVisiting;
     for (final int v : graph[u])
       if (hasCycle(graph, v, states))
         return true;
-    states[u] = State.VISITED;
+    states[u] = State.kVisited;
+
     return false;
   }
 }
diff --git a/solutions/207. Course Schedule/207.py b/solutions/207. Course Schedule/207.py
index 71b5d566d55..6291b740730 100644
--- a/solutions/207. Course Schedule/207.py	
+++ b/solutions/207. Course Schedule/207.py	
@@ -2,28 +2,30 @@
 
 
 class State(Enum):
-  INIT = 0
-  VISITING = 1
-  VISITED = 2
+  kInit = 0
+  kVisiting = 1
+  kVisited = 2
 
 
 class Solution:
-  def canFinish(self, numCourses: int, prerequisites: list[list[int]]) -> bool:
+  def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
     graph = [[] for _ in range(numCourses)]
-    states = [State.INIT] * numCourses
+    states = [State.kInit] * numCourses
 
     for v, u in prerequisites:
       graph[u].append(v)
 
     def hasCycle(u: int) -> bool:
-      if states[u] == State.VISITING:
+      if states[u] == State.kVisiting:
         return True
-      if states[u] == State.VISITED:
+      if states[u] == State.kVisited:
         return False
-      states[u] = State.VISITING
+
+      states[u] = State.kVisiting
       if any(hasCycle(v) for v in graph[u]):
         return True
-      states[u] = State.VISITED
+      states[u] = State.kVisited
+
       return False
 
     return not any(hasCycle(i) for i in range(numCourses))
diff --git a/solutions/2070. Most Beautiful Item for Each Query/2070.java b/solutions/2070. Most Beautiful Item for Each Query/2070.java
index e52d3a144e0..a251cee47bb 100644
--- a/solutions/2070. Most Beautiful Item for Each Query/2070.java	
+++ b/solutions/2070. Most Beautiful Item for Each Query/2070.java	
@@ -4,7 +4,7 @@ public int[] maximumBeauty(int[][] items, int[] queries) {
     int[] prices = new int[items.length];
     int[] maxBeautySoFar = new int[items.length + 1];
 
-    Arrays.sort(items, Comparator.comparingInt(item -> item[0]));
+    Arrays.sort(items, (a, b) -> a[0] - b[0]);
 
     for (int i = 0; i < items.length; ++i)
       maxBeautySoFar[i + 1] = Math.max(maxBeautySoFar[i], items[i][1]);
diff --git a/solutions/2070. Most Beautiful Item for Each Query/2070.py b/solutions/2070. Most Beautiful Item for Each Query/2070.py
index 18f9009f3a5..801757de815 100644
--- a/solutions/2070. Most Beautiful Item for Each Query/2070.py	
+++ b/solutions/2070. Most Beautiful Item for Each Query/2070.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def maximumBeauty(
-      self,
-      items: list[list[int]],
-      queries: list[int],
-  ) -> list[int]:
+  def maximumBeauty(self, items: List[List[int]], queries: List[int]) -> List[int]:
     prices, beauties = zip(*sorted(items))
     maxBeautySoFar = [0] * (len(beauties) + 1)
 
diff --git a/solutions/2071. Maximum Number of Tasks You Can Assign/2071.py b/solutions/2071. Maximum Number of Tasks You Can Assign/2071.py
index 2f39c73f179..34e774b7616 100644
--- a/solutions/2071. Maximum Number of Tasks You Can Assign/2071.py	
+++ b/solutions/2071. Maximum Number of Tasks You Can Assign/2071.py	
@@ -2,13 +2,7 @@
 
 
 class Solution:
-  def maxTaskAssign(
-      self,
-      tasks: list[int],
-      workers: list[int],
-      pills: int,
-      strength: int,
-  ) -> int:
+  def maxTaskAssign(self, tasks: List[int], workers: List[int], pills: int, strength: int) -> int:
     tasks.sort()
     workers.sort()
 
diff --git a/solutions/2073. Time Needed to Buy Tickets/2073.py b/solutions/2073. Time Needed to Buy Tickets/2073.py
index 57963984a14..5f48a931615 100644
--- a/solutions/2073. Time Needed to Buy Tickets/2073.py	
+++ b/solutions/2073. Time Needed to Buy Tickets/2073.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def timeRequiredToBuy(self, tickets: list[int], k: int) -> int:
+  def timeRequiredToBuy(self, tickets: List[int], k: int) -> int:
     ans = 0
 
     for i, ticket in enumerate(tickets):
diff --git a/solutions/2074. Reverse Nodes in Even Length Groups/2074.cpp b/solutions/2074. Reverse Nodes in Even Length Groups/2074.cpp
index f095fda23f5..ab97bafa411 100644
--- a/solutions/2074. Reverse Nodes in Even Length Groups/2074.cpp	
+++ b/solutions/2074. Reverse Nodes in Even Length Groups/2074.cpp	
@@ -44,7 +44,7 @@ class Solution {
 
   ListNode* reverse(ListNode* head) {
     ListNode* prev = nullptr;
-    while (head != nullptr) {
+    while (head) {
       ListNode* next = head->next;
       head->next = prev;
       prev = head;
diff --git a/solutions/2074. Reverse Nodes in Even Length Groups/2074.py b/solutions/2074. Reverse Nodes in Even Length Groups/2074.py
index 2f0d7486d05..e0f5700a2c1 100644
--- a/solutions/2074. Reverse Nodes in Even Length Groups/2074.py	
+++ b/solutions/2074. Reverse Nodes in Even Length Groups/2074.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def reverseEvenLengthGroups(self, head: ListNode | None) -> ListNode | None:
+  def reverseEvenLengthGroups(self, head: Optional[ListNode]) -> Optional[ListNode]:
     # prev -> (head -> ... -> tail) -> next -> ...
     dummy = ListNode(0, head)
     prev = dummy
@@ -7,7 +7,7 @@ def reverseEvenLengthGroups(self, head: ListNode | None) -> ListNode | None:
     next = head.next
     groupLength = 1
 
-    def getTailAndLength(head: ListNode | None, groupLength: int) -> tuple[ListNode | None, int]:
+    def getTailAndLength(head: Optional[ListNode], groupLength: int) -> Tuple[Optional[ListNode], int]:
       length = 1
       tail = head
       while length < groupLength and tail.next:
@@ -15,7 +15,7 @@ def getTailAndLength(head: ListNode | None, groupLength: int) -> tuple[ListNode
         length += 1
       return tail, length
 
-    def reverse(head: ListNode | None) -> ListNode | None:
+    def reverse(head: Optional[ListNode]) -> Optional[ListNode]:
       prev = None
       while head:
         next = head.next
diff --git a/solutions/2076. Process Restricted Friend Requests/2076.py b/solutions/2076. Process Restricted Friend Requests/2076.py
index 05f82534e73..db1cddf02c7 100644
--- a/solutions/2076. Process Restricted Friend Requests/2076.py	
+++ b/solutions/2076. Process Restricted Friend Requests/2076.py	
@@ -23,12 +23,7 @@ def find(self, u: int) -> int:
 
 
 class Solution:
-  def friendRequests(
-      self,
-      n: int,
-      restrictions: list[list[int]],
-      requests: list[list[int]],
-  ) -> list[bool]:
+  def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]:
     ans = []
     uf = UnionFind(n)
 
diff --git a/solutions/2077. Paths in Maze That Lead to Same Room/2077.py b/solutions/2077. Paths in Maze That Lead to Same Room/2077.py
index bbe7309ba3a..a9e6d3f5593 100644
--- a/solutions/2077. Paths in Maze That Lead to Same Room/2077.py	
+++ b/solutions/2077. Paths in Maze That Lead to Same Room/2077.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfPaths(self, n: int, corridors: list[list[int]]) -> int:
+  def numberOfPaths(self, n: int, corridors: List[List[int]]) -> int:
     ans = 0
     graph = [[False] * 1001 for _ in range(n + 1)]
 
diff --git a/solutions/2078. Two Furthest Houses With Different Colors/2078.py b/solutions/2078. Two Furthest Houses With Different Colors/2078.py
index 4db2229c050..a8e93c7accd 100644
--- a/solutions/2078. Two Furthest Houses With Different Colors/2078.py	
+++ b/solutions/2078. Two Furthest Houses With Different Colors/2078.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxDistance(self, colors: list[int]) -> int:
+  def maxDistance(self, colors: List[int]) -> int:
     # The maximum distance always includes either the first or the last house.
     n = len(colors)
     i = 0  # the leftmost index, where colors[i] != colors[-1]
diff --git a/solutions/2079. Watering Plants/2079.py b/solutions/2079. Watering Plants/2079.py
index 2d78be7fcb4..4d8c01456ff 100644
--- a/solutions/2079. Watering Plants/2079.py	
+++ b/solutions/2079. Watering Plants/2079.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def wateringPlants(self, plants: list[int], capacity: int) -> int:
+  def wateringPlants(self, plants: List[int], capacity: int) -> int:
     ans = 0
     currCapacity = 0
 
diff --git a/solutions/208. Implement Trie (Prefix Tree)/208.java b/solutions/208. Implement Trie (Prefix Tree)/208.java
index 32f96615218..8498e3e9c1e 100644
--- a/solutions/208. Implement Trie (Prefix Tree)/208.java	
+++ b/solutions/208. Implement Trie (Prefix Tree)/208.java	
@@ -4,7 +4,7 @@ class TrieNode {
 }
 
 class Trie {
-  public void insert(final String word) {
+  public void insert(String word) {
     TrieNode node = root;
     for (final char c : word.toCharArray()) {
       final int i = c - 'a';
@@ -15,18 +15,18 @@ public void insert(final String word) {
     node.isWord = true;
   }
 
-  public boolean search(final String word) {
+  public boolean search(String word) {
     TrieNode node = find(word);
     return node != null && node.isWord;
   }
 
-  public boolean startsWith(final String prefix) {
+  public boolean startsWith(String prefix) {
     return find(prefix) != null;
   }
 
   private TrieNode root = new TrieNode();
 
-  private TrieNode find(final String prefix) {
+  private TrieNode find(String prefix) {
     TrieNode node = root;
     for (final char c : prefix.toCharArray()) {
       final int i = c - 'a';
diff --git a/solutions/208. Implement Trie (Prefix Tree)/208.py b/solutions/208. Implement Trie (Prefix Tree)/208.py
index 36d83566cab..fa8bd908853 100644
--- a/solutions/208. Implement Trie (Prefix Tree)/208.py	
+++ b/solutions/208. Implement Trie (Prefix Tree)/208.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
     self.isWord = False
 
 
@@ -15,13 +15,13 @@ def insert(self, word: str) -> None:
     node.isWord = True
 
   def search(self, word: str) -> bool:
-    node = self._find(word)
-    return node is not None and node.isWord
+    node: TrieNode = self._find(word)
+    return node and node.isWord
 
   def startsWith(self, prefix: str) -> bool:
-    return self._find(prefix) is not None
+    return self._find(prefix)
 
-  def _find(self, prefix: str) -> TrieNode | None:
+  def _find(self, prefix: str) -> Optional[TrieNode]:
     node: TrieNode = self.root
     for c in prefix:
       if c not in node.children:
diff --git a/solutions/2080. Range Frequency Queries/2080.py b/solutions/2080. Range Frequency Queries/2080.py
index 56145e39287..ae855944e11 100644
--- a/solutions/2080. Range Frequency Queries/2080.py	
+++ b/solutions/2080. Range Frequency Queries/2080.py	
@@ -1,5 +1,5 @@
 class RangeFreqQuery:
-  def __init__(self, arr: list[int]):
+  def __init__(self, arr: List[int]):
     self.valueToIndices = collections.defaultdict(list)
     for i, a in enumerate(arr):
       self.valueToIndices[a].append(i)
diff --git a/solutions/2081. Sum of k-Mirror Numbers/2081.py b/solutions/2081. Sum of k-Mirror Numbers/2081.py
index d25c82d9577..bef82e097b8 100644
--- a/solutions/2081. Sum of k-Mirror Numbers/2081.py	
+++ b/solutions/2081. Sum of k-Mirror Numbers/2081.py	
@@ -3,7 +3,7 @@ def kMirror(self, k: int, n: int) -> int:
     ans = 0
     A = ['0']
 
-    def nextKMirror(A: list[str]) -> list[str]:
+    def nextKMirror(A: List[chr]) -> List[chr]:
       for i in range(len(A) // 2, len(A)):
         nextNum = int(A[i]) + 1
         if nextNum < k:
diff --git a/solutions/2085. Count Common Words With One Occurrence/2085.cpp b/solutions/2085. Count Common Words With One Occurrence/2085.cpp
index 1d75a0d1e68..b6a5bdd5058 100644
--- a/solutions/2085. Count Common Words With One Occurrence/2085.cpp	
+++ b/solutions/2085. Count Common Words With One Occurrence/2085.cpp	
@@ -11,7 +11,6 @@ class Solution {
           it != count.cend() && it->second < 2)
         --it->second;
 
-    return ranges::count_if(
-        count, [](const pair<string, int>& c) { return c.second == 0; });
+    return ranges::count_if(count, [](const auto& c) { return c.second == 0; });
   }
 };
diff --git a/solutions/2085. Count Common Words With One Occurrence/2085.py b/solutions/2085. Count Common Words With One Occurrence/2085.py
index 59b3637cacf..92518141f8d 100644
--- a/solutions/2085. Count Common Words With One Occurrence/2085.py	
+++ b/solutions/2085. Count Common Words With One Occurrence/2085.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countWords(self, words1: list[str], words2: list[str]) -> int:
+  def countWords(self, words1: List[str], words2: List[str]) -> int:
     count = collections.Counter(words1)
 
     for word in words2:
diff --git a/solutions/2087. Minimum Cost Homecoming of a Robot in a Grid/2087.py b/solutions/2087. Minimum Cost Homecoming of a Robot in a Grid/2087.py
index e427bd4cd9b..f3c32c34ee2 100644
--- a/solutions/2087. Minimum Cost Homecoming of a Robot in a Grid/2087.py	
+++ b/solutions/2087. Minimum Cost Homecoming of a Robot in a Grid/2087.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def minCost(
-      self,
-      startPos: list[int],
-      homePos: list[int],
-      rowCosts: list[int],
-      colCosts: list[int],
-  ) -> int:
+  def minCost(self, startPos: List[int], homePos: List[int], rowCosts: List[int], colCosts: List[int]) -> int:
     ans = 0
     i, j = startPos
     x, y = homePos
diff --git a/solutions/2088. Count Fertile Pyramids in a Land/2088.cpp b/solutions/2088. Count Fertile Pyramids in a Land/2088.cpp
index 51aa9750c5a..b97c0eadaa9 100644
--- a/solutions/2088. Count Fertile Pyramids in a Land/2088.cpp	
+++ b/solutions/2088. Count Fertile Pyramids in a Land/2088.cpp	
@@ -2,7 +2,7 @@ class Solution {
  public:
   int countPyramids(vector<vector<int>>& grid) {
     int ans = count(grid);
-    ranges::reverse(grid);
+    reverse(grid.begin(), grid.end());
     ans += count(grid);
     return ans;
   }
diff --git a/solutions/2088. Count Fertile Pyramids in a Land/2088.py b/solutions/2088. Count Fertile Pyramids in a Land/2088.py
index e7f4d0e3f72..7d4b7d51793 100644
--- a/solutions/2088. Count Fertile Pyramids in a Land/2088.py	
+++ b/solutions/2088. Count Fertile Pyramids in a Land/2088.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def countPyramids(self, grid: list[list[int]]) -> int:
+  def countPyramids(self, grid: List[List[int]]) -> int:
     # dp[i][j] := the maximum height of the pyramid for which it is the apex
-    def count(dp: list[list[int]]) -> int:
+    def count(dp: List[List[int]]) -> int:
       ans = 0
       for i in range(len(dp) - 2, -1, -1):
         for j in range(1, len(dp[0]) - 1):
diff --git a/solutions/2089. Find Target Indices After Sorting Array/2089.py b/solutions/2089. Find Target Indices After Sorting Array/2089.py
index 644de953bf7..d05bedad74a 100644
--- a/solutions/2089. Find Target Indices After Sorting Array/2089.py	
+++ b/solutions/2089. Find Target Indices After Sorting Array/2089.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def targetIndices(self, nums: list[int], target: int) -> list[int]:
+  def targetIndices(self, nums: List[int], target: int) -> List[int]:
     count = nums.count(target)
     lessThan = sum(num < target for num in nums)
     return [i for i in range(lessThan, lessThan + count)]
diff --git a/solutions/209. Minimum Size Subarray Sum/209.cpp b/solutions/209. Minimum Size Subarray Sum/209.cpp
index dfb1376ba76..2f27aeed693 100644
--- a/solutions/209. Minimum Size Subarray Sum/209.cpp	
+++ b/solutions/209. Minimum Size Subarray Sum/209.cpp	
@@ -1,17 +1,17 @@
 class Solution {
  public:
-  int minSubArrayLen(int target, vector<int>& nums) {
+  int minSubArrayLen(int s, vector<int>& nums) {
     int ans = INT_MAX;
     int sum = 0;
 
     for (int l = 0, r = 0; r < nums.size(); ++r) {
       sum += nums[r];
-      while (sum >= target) {
+      while (sum >= s) {
         ans = min(ans, r - l + 1);
         sum -= nums[l++];
       }
     }
 
-    return ans == INT_MAX ? 0 : ans;
+    return ans < INT_MAX ? ans : 0;
   }
 };
diff --git a/solutions/209. Minimum Size Subarray Sum/209.java b/solutions/209. Minimum Size Subarray Sum/209.java
index 33bb2249ac1..e1ac5341593 100644
--- a/solutions/209. Minimum Size Subarray Sum/209.java	
+++ b/solutions/209. Minimum Size Subarray Sum/209.java	
@@ -1,16 +1,16 @@
 class Solution {
-  public int minSubArrayLen(int target, int[] nums) {
+  public int minSubArrayLen(int s, int[] nums) {
     int ans = Integer.MAX_VALUE;
     int sum = 0;
 
     for (int l = 0, r = 0; r < nums.length; ++r) {
       sum += nums[r];
-      while (sum >= target) {
+      while (sum >= s) {
         ans = Math.min(ans, r - l + 1);
         sum -= nums[l++];
       }
     }
 
-    return ans == Integer.MAX_VALUE ? 0 : ans;
+    return ans != Integer.MAX_VALUE ? ans : 0;
   }
 }
diff --git a/solutions/209. Minimum Size Subarray Sum/209.py b/solutions/209. Minimum Size Subarray Sum/209.py
index f716592fb6a..4315fd8d13e 100644
--- a/solutions/209. Minimum Size Subarray Sum/209.py	
+++ b/solutions/209. Minimum Size Subarray Sum/209.py	
@@ -1,14 +1,14 @@
 class Solution:
-  def minSubArrayLen(self, target: int, nums: list[int]) -> int:
+  def minSubArrayLen(self, s: int, nums: List[int]) -> int:
     ans = math.inf
     summ = 0
     j = 0
 
     for i, num in enumerate(nums):
       summ += num
-      while summ >= target:
+      while summ >= s:
         ans = min(ans, i - j + 1)
         summ -= nums[j]
         j += 1
 
-    return 0 if ans == math.inf else ans
+    return ans if ans != math.inf else 0
diff --git a/solutions/2090. K Radius Subarray Averages/2090.py b/solutions/2090. K Radius Subarray Averages/2090.py
index a2e64eaa834..7453b4b150c 100644
--- a/solutions/2090. K Radius Subarray Averages/2090.py	
+++ b/solutions/2090. K Radius Subarray Averages/2090.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getAverages(self, nums: list[int], k: int) -> list[int]:
+  def getAverages(self, nums: List[int], k: int) -> List[int]:
     n = len(nums)
     size = 2 * k + 1
     ans = [-1] * n
diff --git a/solutions/2091. Removing Minimum and Maximum From Array/2091.py b/solutions/2091. Removing Minimum and Maximum From Array/2091.py
index 69621f3aa6a..a2411507815 100644
--- a/solutions/2091. Removing Minimum and Maximum From Array/2091.py	
+++ b/solutions/2091. Removing Minimum and Maximum From Array/2091.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumDeletions(self, nums: list[int]) -> int:
+  def minimumDeletions(self, nums: List[int]) -> int:
     n = len(nums)
     a = nums.index(min(nums))
     b = nums.index(max(nums))
diff --git a/solutions/2092. Find All People With Secret/2092.cpp b/solutions/2092. Find All People With Secret/2092.cpp
index 93e6f8530fa..08d5ce3886a 100644
--- a/solutions/2092. Find All People With Secret/2092.cpp	
+++ b/solutions/2092. Find All People With Secret/2092.cpp	
@@ -46,12 +46,8 @@ class Solution {
 
     uf.unionByRank(0, firstPerson);
 
-    for (const vector<int>& meeting : meetings) {
-      const int x = meeting[0];
-      const int y = meeting[1];
-      const int time = meeting[2];
-      timeToPairs[time].push_back({x, y});
-    }
+    for (const vector<int>& m : meetings)
+      timeToPairs[m[2]].push_back({m[0], m[1]});
 
     for (const auto& [_, pairs] : timeToPairs) {
       unordered_set<int> peopleUnioned;
diff --git a/solutions/2092. Find All People With Secret/2092.java b/solutions/2092. Find All People With Secret/2092.java
index 6bcf05322b3..43b52177358 100644
--- a/solutions/2092. Find All People With Secret/2092.java	
+++ b/solutions/2092. Find All People With Secret/2092.java	
@@ -45,12 +45,9 @@ public List<Integer> findAllPeople(int n, int[][] meetings, int firstPerson) {
 
     uf.unionByRank(0, firstPerson);
 
-    for (int[] meeting : meetings) {
-      final int x = meeting[0];
-      final int y = meeting[1];
-      final int time = meeting[2];
-      timeToPairs.putIfAbsent(time, new ArrayList<>());
-      timeToPairs.get(time).add(new Pair<>(x, y));
+    for (int[] m : meetings) {
+      timeToPairs.putIfAbsent(m[2], new ArrayList<>());
+      timeToPairs.get(m[2]).add(new Pair<>(m[0], m[1]));
     }
 
     for (List<Pair<Integer, Integer>> pairs : timeToPairs.values()) {
diff --git a/solutions/2092. Find All People With Secret/2092.py b/solutions/2092. Find All People With Secret/2092.py
index e87b95c2e3a..1669caa40df 100644
--- a/solutions/2092. Find All People With Secret/2092.py	
+++ b/solutions/2092. Find All People With Secret/2092.py	
@@ -29,12 +29,7 @@ def _find(self, u: int) -> int:
 
 
 class Solution:
-  def findAllPeople(
-      self,
-      n: int,
-      meetings: list[list[int]],
-      firstPerson: int,
-  ) -> list[int]:
+  def findAllPeople(self, n: int, meetings: List[List[int]], firstPerson: int) -> List[int]:
     uf = UnionFind(n)
     timeToPairs = collections.defaultdict(list)
 
diff --git a/solutions/2093. Minimum Cost to Reach City With Discounts/2093.cpp b/solutions/2093. Minimum Cost to Reach City With Discounts/2093.cpp
index 546b2142bf2..8ca2f542a65 100644
--- a/solutions/2093. Minimum Cost to Reach City With Discounts/2093.cpp	
+++ b/solutions/2093. Minimum Cost to Reach City With Discounts/2093.cpp	
@@ -2,6 +2,8 @@ struct T {
   int u;
   int d;
   int leftDiscounts;
+  T(int u, int d, int leftDiscounts)
+      : u(u), d(d), leftDiscounts(leftDiscounts) {}
 };
 
 class Solution {
diff --git a/solutions/2093. Minimum Cost to Reach City With Discounts/2093.java b/solutions/2093. Minimum Cost to Reach City With Discounts/2093.java
index 2cdcff9e72c..9468544d811 100644
--- a/solutions/2093. Minimum Cost to Reach City With Discounts/2093.java	
+++ b/solutions/2093. Minimum Cost to Reach City With Discounts/2093.java	
@@ -1,8 +1,18 @@
+class T {
+  public int u;
+  public int d;
+  public int leftDiscounts;
+  public T(int u, int d, int leftDiscounts) {
+    this.u = u;
+    this.d = d;
+    this.leftDiscounts = leftDiscounts;
+  }
+}
+
 class Solution {
   public int minimumCost(int n, int[][] highways, int discounts) {
-    record T(int u, int d, int leftDiscounts) {}
     List<Pair<Integer, Integer>>[] graph = new List[n];
-    Queue<T> minHeap = new PriorityQueue<>(Comparator.comparingInt(T::d));
+    Queue<T> minHeap = new PriorityQueue<>((a, b) -> a.d - b.d);
     Map<Integer, Integer> minDiscounts = new HashMap<>();
 
     for (int i = 0; i < graph.length; i++)
diff --git a/solutions/2093. Minimum Cost to Reach City With Discounts/2093.py b/solutions/2093. Minimum Cost to Reach City With Discounts/2093.py
index 46c7ac3a95e..1e8a6d7233d 100644
--- a/solutions/2093. Minimum Cost to Reach City With Discounts/2093.py	
+++ b/solutions/2093. Minimum Cost to Reach City With Discounts/2093.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minimumCost(
-      self,
-      n: int,
-      highways: list[list[int]],
-      discounts: int,
-  ) -> int:
+  def minimumCost(self, n: int, highways: List[List[int]], discounts: int) -> int:
     graph = [[] for _ in range(n)]
     minHeap = [(0, 0, discounts)]  # (d, u, leftDiscounts)
     minDiscounts = {}
diff --git a/solutions/2094. Finding 3-Digit Even Numbers/2094.py b/solutions/2094. Finding 3-Digit Even Numbers/2094.py
index 013d84d3a52..da4070b8207 100644
--- a/solutions/2094. Finding 3-Digit Even Numbers/2094.py	
+++ b/solutions/2094. Finding 3-Digit Even Numbers/2094.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findEvenNumbers(self, digits: list[int]) -> list[int]:
+  def findEvenNumbers(self, digits: List[int]) -> List[int]:
     ans = []
     count = collections.Counter(digits)
 
@@ -7,10 +7,7 @@ def findEvenNumbers(self, digits: list[int]) -> list[int]:
     for a in range(1, 10):
       for b in range(0, 10):
         for c in range(0, 9, 2):
-          if count[a] > 0 and count[b] > (
-                  b == a) and count[c] > (
-                  c == a) + (
-                  c == b):
+          if count[a] > 0 and count[b] > (b == a) and count[c] > (c == a) + (c == b):
             ans.append(a * 100 + b * 10 + c)
 
     return ans
diff --git a/solutions/2095. Delete the Middle Node of a Linked List/2095.py b/solutions/2095. Delete the Middle Node of a Linked List/2095.py
index 3b9bcb3d95f..12cdf41ef30 100644
--- a/solutions/2095. Delete the Middle Node of a Linked List/2095.py	
+++ b/solutions/2095. Delete the Middle Node of a Linked List/2095.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def deleteMiddle(self, head: ListNode | None) -> ListNode | None:
+  def deleteMiddle(self, head: Optional[ListNode]) -> Optional[ListNode]:
     dummy = ListNode(0, head)
     slow = dummy
     fast = dummy
diff --git a/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.cpp b/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.cpp
index 71c9af94205..b54848414c0 100644
--- a/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.cpp	
+++ b/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.cpp	
@@ -14,11 +14,11 @@ class Solution {
     }
 
     return string(pathToStart.length(), 'U') +
-           string{pathToDest.rbegin(), pathToDest.rend()};
+           string(pathToDest.rbegin(), pathToDest.rend());
   }
 
  private:
-  // Builds the string in reverse order to avoid creating a new copy.
+  // Builds the string in the reverse order to avoid creating a new copy.
   bool dfs(TreeNode* root, int val, string& path) {
     if (root->val == val)
       return true;
diff --git a/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.java b/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.java
index 8485cb242d1..a3e49b11383 100644
--- a/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.java	
+++ b/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.java	
@@ -16,7 +16,7 @@ public String getDirections(TreeNode root, int startValue, int destValue) {
     return "U".repeat(pathToStart.length()) + pathToDest.reverse().toString();
   }
 
-  // Builds the string in reverse order to avoid creating a new copy.
+  // Builds the string in the reverse order to avoid creating a new copy.
   private boolean dfs(TreeNode root, int val, StringBuilder sb) {
     if (root.val == val)
       return true;
diff --git a/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.py b/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.py
index 1c45040b3ba..e55bdf7d716 100644
--- a/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.py	
+++ b/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.py	
@@ -1,12 +1,7 @@
 class Solution:
-  def getDirections(
-      self,
-      root: TreeNode | None,
-      startValue: int,
-      destValue: int,
-  ) -> str:
-    def dfs(root: TreeNode | None, val: int, path: list[str]) -> bool:
-      """Builds the string in reverse order to avoid creating a new copy."""
+  def getDirections(self, root: Optional[TreeNode], startValue: int, destValue: int) -> str:
+    # Buidl the string in reverse order to avoid creating new copy
+    def dfs(root: Optional[TreeNode], val: int, path: List[chr]) -> bool:
       if root.val == val:
         return True
       if root.left and dfs(root.left, val, path):
diff --git a/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096.py b/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096.py
index d5acbd21adf..1f04ceb5c8e 100644
--- a/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096.py	
+++ b/solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096.py	
@@ -1,11 +1,6 @@
 class Solution:
-  def getDirections(
-      self,
-      root: TreeNode | None,
-      startValue: int,
-      destValue: int,
-  ) -> str:
-    def lca(root: TreeNode | None) -> TreeNode | None:
+  def getDirections(self, root: Optional[TreeNode], startValue: int, destValue: int) -> str:
+    def lca(root: Optional[TreeNode]) -> Optional[TreeNode]:
       if not root or root.val in (startValue, destValue):
         return root
       left = lca(root.left)
@@ -14,7 +9,7 @@ def lca(root: TreeNode | None) -> TreeNode | None:
         return root
       return left or right
 
-    def dfs(root: TreeNode | None, path: list[str]) -> None:
+    def dfs(root: Optional[TreeNode], path: List[chr]) -> None:
       if not root:
         return
       if root.val == startValue:
diff --git a/solutions/2097. Valid Arrangement of Pairs/2097.cpp b/solutions/2097. Valid Arrangement of Pairs/2097.cpp
index ba015a87dc1..c1039e17026 100644
--- a/solutions/2097. Valid Arrangement of Pairs/2097.cpp	
+++ b/solutions/2097. Valid Arrangement of Pairs/2097.cpp	
@@ -16,7 +16,7 @@ class Solution {
 
     const int startNode = getStartNode(graph, outDegree, inDegrees, pairs);
     euler(graph, startNode, ans);
-    ranges::reverse(ans);
+    reverse(ans.begin(), ans.end());
     return ans;
   }
 
diff --git a/solutions/2097. Valid Arrangement of Pairs/2097.py b/solutions/2097. Valid Arrangement of Pairs/2097.py
index a64462e652a..361c9aaf001 100644
--- a/solutions/2097. Valid Arrangement of Pairs/2097.py	
+++ b/solutions/2097. Valid Arrangement of Pairs/2097.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def validArrangement(self, pairs: list[list[int]]) -> list[list[int]]:
+  def validArrangement(self, pairs: List[List[int]]) -> List[List[int]]:
     ans = []
     graph = collections.defaultdict(list)
     outDegree = collections.Counter()
diff --git a/solutions/2098. Subsequence of Size K With the Largest Even Sum/2098.py b/solutions/2098. Subsequence of Size K With the Largest Even Sum/2098.py
index c0a6846aa36..ca85f90d8b2 100644
--- a/solutions/2098. Subsequence of Size K With the Largest Even Sum/2098.py	
+++ b/solutions/2098. Subsequence of Size K With the Largest Even Sum/2098.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestEvenSum(self, nums: list[int], k: int) -> int:
+  def largestEvenSum(self, nums: List[int], k: int) -> int:
     nums.sort()
     summ = sum(nums[-k:])
     if summ % 2 == 0:
diff --git a/solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.cpp b/solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.cpp
index 608de549a4e..7e0c5e01ec9 100644
--- a/solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.cpp	
+++ b/solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.cpp	
@@ -2,9 +2,9 @@ class Solution {
  public:
   vector<int> maxSubsequence(vector<int>& nums, int k) {
     vector<int> ans;
-    vector<int> arr(nums);
-    nth_element(arr.begin(), arr.end() - k, arr.end());
-    const int threshold = arr[arr.size() - k];
+    vector<int> A(nums);
+    nth_element(A.begin(), A.end() - k, A.end());
+    const int threshold = A[A.size() - k];
     const int larger =
         ranges::count_if(nums, [&](int num) { return num > threshold; });
     int equal = k - larger;
diff --git a/solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.java b/solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.java
index 666621c20ff..e77fb5381a0 100644
--- a/solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.java	
+++ b/solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.java	
@@ -1,9 +1,9 @@
 class Solution {
   public int[] maxSubsequence(int[] nums, int k) {
     int[] ans = new int[k];
-    int[] arr = nums.clone();
-    Arrays.sort(arr);
-    final int threshold = arr[arr.length - k];
+    int[] A = nums.clone();
+    Arrays.sort(A);
+    final int threshold = A[A.length - k];
     final int larger = (int) Arrays.stream(nums).filter(num -> num > threshold).count();
     int equal = k - larger;
 
diff --git a/solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.py b/solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.py
index 2e9d240e6e2..3de572e17c1 100644
--- a/solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.py	
+++ b/solutions/2099. Find Subsequence of Length K With the Largest Sum/2099.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSubsequence(self, nums: list[int], k: int) -> list[int]:
+  def maxSubsequence(self, nums: List[int], k: int) -> List[int]:
     ans = []
     threshold = sorted(nums)[-k]
     larger = sum(num > threshold for num in nums)
diff --git a/solutions/21. Merge Two Sorted Lists/21.py b/solutions/21. Merge Two Sorted Lists/21.py
index dfe8341f888..9a2ef77976f 100644
--- a/solutions/21. Merge Two Sorted Lists/21.py	
+++ b/solutions/21. Merge Two Sorted Lists/21.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def mergeTwoLists(
-      self,
-      list1: ListNode | None,
-      list2: ListNode | None,
-  ) -> ListNode | None:
+  def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
     if not list1 or not list2:
       return list1 if list1 else list2
     if list1.val > list2.val:
diff --git a/solutions/210. Course Schedule II/210-2.py b/solutions/210. Course Schedule II/210-2.py
index a2af440a791..5f1f02969dc 100644
--- a/solutions/210. Course Schedule II/210-2.py	
+++ b/solutions/210. Course Schedule II/210-2.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def findOrder(
-      self,
-      numCourses: int,
-      prerequisites: list[list[int]],
-  ) -> list[int]:
+  def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]:
     ans = []
     graph = [[] for _ in range(numCourses)]
     inDegrees = [0] * numCourses
diff --git a/solutions/210. Course Schedule II/210.cpp b/solutions/210. Course Schedule II/210.cpp
index d9ac979a8f6..541d58588ce 100644
--- a/solutions/210. Course Schedule II/210.cpp	
+++ b/solutions/210. Course Schedule II/210.cpp	
@@ -17,7 +17,7 @@ class Solution {
       if (hasCycle(graph, i, states, ans))
         return {};
 
-    ranges::reverse(ans);
+    reverse(ans.begin(), ans.end());
     return ans;
   }
 
@@ -28,12 +28,14 @@ class Solution {
       return true;
     if (states[u] == State::kVisited)
       return false;
+
     states[u] = State::kVisiting;
     for (const int v : graph[u])
       if (hasCycle(graph, v, states, ans))
         return true;
     states[u] = State::kVisited;
     ans.push_back(u);
+
     return false;
   }
 };
diff --git a/solutions/210. Course Schedule II/210.java b/solutions/210. Course Schedule II/210.java
index d6d2969c2c3..522a3261cb1 100644
--- a/solutions/210. Course Schedule II/210.java	
+++ b/solutions/210. Course Schedule II/210.java	
@@ -1,4 +1,4 @@
-enum State { INIT, VISITING, VISITED }
+enum State { kInit, kVisiting, kVisited }
 
 class Solution {
   public int[] findOrder(int numCourses, int[][] prerequisites) {
@@ -23,16 +23,18 @@ public int[] findOrder(int numCourses, int[][] prerequisites) {
   }
 
   private boolean hasCycle(List<Integer>[] graph, int u, State[] states, Deque<Integer> ans) {
-    if (states[u] == State.VISITING)
+    if (states[u] == State.kVisiting)
       return true;
-    if (states[u] == State.VISITED)
+    if (states[u] == State.kVisited)
       return false;
-    states[u] = State.VISITING;
+
+    states[u] = State.kVisiting;
     for (final int v : graph[u])
       if (hasCycle(graph, v, states, ans))
         return true;
-    states[u] = State.VISITED;
+    states[u] = State.kVisited;
     ans.addFirst(u);
+
     return false;
   }
 }
diff --git a/solutions/210. Course Schedule II/210.py b/solutions/210. Course Schedule II/210.py
index 0fdfb3bad46..9861d4b8bb0 100644
--- a/solutions/210. Course Schedule II/210.py	
+++ b/solutions/210. Course Schedule II/210.py	
@@ -2,34 +2,32 @@
 
 
 class State(Enum):
-  INIT = 0
-  VISITING = 1
-  VISITED = 2
+  kInit = 0
+  kVisiting = 1
+  kVisited = 2
 
 
 class Solution:
-  def findOrder(
-      self,
-      numCourses: int,
-      prerequisites: list[list[int]],
-  ) -> list[int]:
+  def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]:
     ans = []
     graph = [[] for _ in range(numCourses)]
-    states = [State.INIT] * numCourses
+    states = [State.kInit] * numCourses
 
     for v, u in prerequisites:
       graph[u].append(v)
 
     def hasCycle(u: int) -> bool:
-      if states[u] == State.VISITING:
+      if states[u] == State.kVisiting:
         return True
-      if states[u] == State.VISITED:
+      if states[u] == State.kVisited:
         return False
-      states[u] = State.VISITING
+
+      states[u] = State.kVisiting
       if any(hasCycle(v) for v in graph[u]):
         return True
-      states[u] = State.VISITED
+      states[u] = State.kVisited
       ans.append(u)
+
       return False
 
     if any(hasCycle(i) for i in range(numCourses)):
diff --git a/solutions/2100. Find Good Days to Rob the Bank/2100.py b/solutions/2100. Find Good Days to Rob the Bank/2100.py
index 17dfe9b6445..ce172db27dc 100644
--- a/solutions/2100. Find Good Days to Rob the Bank/2100.py	
+++ b/solutions/2100. Find Good Days to Rob the Bank/2100.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def goodDaysToRobBank(self, security: list[int], time: int) -> list[int]:
+  def goodDaysToRobBank(self, security: List[int], time: int) -> List[int]:
     n = len(security)
     dec = [0] * n  # dec[i] := the number of continuous decreasing numbers before i
     inc = [0] * n  # inc[i] := the number of continuous increasing numbers after i
diff --git a/solutions/2101. Detonate the Maximum Bombs/2101.java b/solutions/2101. Detonate the Maximum Bombs/2101.java
index 94c2863aa25..a399872b192 100644
--- a/solutions/2101. Detonate the Maximum Bombs/2101.java	
+++ b/solutions/2101. Detonate the Maximum Bombs/2101.java	
@@ -3,7 +3,9 @@ public int maximumDetonation(int[][] bombs) {
     final int n = bombs.length;
     int ans = 0;
     List<Integer>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int i = 0; i < n; ++i) {
       for (int j = 0; j < n; ++j) {
diff --git a/solutions/2101. Detonate the Maximum Bombs/2101.py b/solutions/2101. Detonate the Maximum Bombs/2101.py
index 86426aba1e8..8a045559f5f 100644
--- a/solutions/2101. Detonate the Maximum Bombs/2101.py	
+++ b/solutions/2101. Detonate the Maximum Bombs/2101.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumDetonation(self, bombs: list[list[int]]) -> int:
+  def maximumDetonation(self, bombs: List[List[int]]) -> int:
     n = len(bombs)
     ans = 0
     graph = [[] for _ in range(n)]
@@ -11,7 +11,7 @@ def maximumDetonation(self, bombs: list[list[int]]) -> int:
         if ri**2 >= (xi - xj)**2 + (yi - yj)**2:
           graph[i].append(j)
 
-    def dfs(u: int, seen: set[int]) -> None:
+    def dfs(u: int, seen: Set[int]) -> None:
       for v in graph[u]:
         if v in seen:
           continue
diff --git a/solutions/2102. Sequentially Ordinal Rank Tracker/2102.cpp b/solutions/2102. Sequentially Ordinal Rank Tracker/2102.cpp
index 2400256c6d3..670ba76e70e 100644
--- a/solutions/2102. Sequentially Ordinal Rank Tracker/2102.cpp	
+++ b/solutions/2102. Sequentially Ordinal Rank Tracker/2102.cpp	
@@ -1,8 +1,7 @@
 struct Location {
   string name;
   int score;
-  Location(const string& name, int score)
-      : name(std::move(name)), score(score) {}
+  Location(const string& name, int score) : name(move(name)), score(score) {}
 };
 
 class SORTracker {
diff --git a/solutions/2102. Sequentially Ordinal Rank Tracker/2102.java b/solutions/2102. Sequentially Ordinal Rank Tracker/2102.java
index 5f920fc6d58..04a128ad5d5 100644
--- a/solutions/2102. Sequentially Ordinal Rank Tracker/2102.java	
+++ b/solutions/2102. Sequentially Ordinal Rank Tracker/2102.java	
@@ -1,3 +1,12 @@
+class Location {
+  public String name;
+  public int score;
+  public Location(String name, int score) {
+    this.name = name;
+    this.score = score;
+  }
+}
+
 class SORTracker {
   public void add(String name, int score) {
     l.offer(new Location(name, score));
@@ -13,13 +22,9 @@ public String get() {
     return name;
   }
 
-  private record Location(String name, int score) {}
-
-  private Queue<Location> l =
-      new PriorityQueue<>(Comparator.comparingInt(Location::score)
-                              .thenComparing(Location::name, Comparator.reverseOrder()));
-  private Queue<Location> r =
-      new PriorityQueue<>(Comparator.comparingInt(Location::score, Comparator.reverseOrder())
-                              .thenComparing(Location::name));
+  private Queue<Location> l = new PriorityQueue<>(
+      (a, b) -> a.score == b.score ? -a.name.compareTo(b.name) : a.score - b.score);
+  private Queue<Location> r = new PriorityQueue<>(
+      (a, b) -> a.score == b.score ? a.name.compareTo(b.name) : b.score - a.score);
   private int k;
 }
diff --git a/solutions/2104. Sum of Subarray Ranges/2104.cpp b/solutions/2104. Sum of Subarray Ranges/2104.cpp
index a1fcccbcfbd..635b8bacbb9 100644
--- a/solutions/2104. Sum of Subarray Ranges/2104.cpp	
+++ b/solutions/2104. Sum of Subarray Ranges/2104.cpp	
@@ -1,29 +1,19 @@
 class Solution {
  public:
   long long subArrayRanges(vector<int>& nums) {
-    const auto [prevGt, nextGt] = getPrevNext(nums, less<>());
-    const auto [prevLt, nextLt] = getPrevNext(nums, greater<>());
-    long ans = 0;
-
-    for (int i = 0; i < nums.size(); ++i) {
-      ans += static_cast<long>(nums[i]) * (i - prevGt[i]) * (nextGt[i] - i);
-      ans -= static_cast<long>(nums[i]) * (i - prevLt[i]) * (nextLt[i] - i);
-    }
-
-    return ans;
+    return subarraySum(nums, less<int>()) - subarraySum(nums, greater<>());
   }
 
  private:
-  // Returns `prev` and `next`, that store the indices of the nearest numbers
-  // that are smaller or larger than the current number depending on `op`.
-  pair<vector<int>, vector<int>> getPrevNext(
-      const vector<int>& nums, const function<bool(int, int)>& op) {
-    const int n = nums.size();
+  long subarraySum(const vector<int>& A, const function<int(int, int)>& op) {
+    const int n = A.size();
+    long res = 0;
     vector<int> prev(n, -1);
     vector<int> next(n, n);
     stack<int> stack;
+
     for (int i = 0; i < n; ++i) {
-      while (!stack.empty() && op(nums[stack.top()], nums[i])) {
+      while (!stack.empty() && op(A[stack.top()], A[i])) {
         const int index = stack.top();
         stack.pop();
         next[index] = i;
@@ -32,6 +22,10 @@ class Solution {
         prev[i] = stack.top();
       stack.push(i);
     }
-    return {prev, next};
+
+    for (int i = 0; i < n; ++i)
+      res += static_cast<long>(A[i]) * (i - prev[i]) * (next[i] - i);
+
+    return res;
   }
 };
diff --git a/solutions/2104. Sum of Subarray Ranges/2104.java b/solutions/2104. Sum of Subarray Ranges/2104.java
index 727719a0a0c..ffe13f8f1f1 100644
--- a/solutions/2104. Sum of Subarray Ranges/2104.java	
+++ b/solutions/2104. Sum of Subarray Ranges/2104.java	
@@ -1,37 +1,37 @@
 class Solution {
   public long subArrayRanges(int[] nums) {
-    Pair<int[], int[]> gt = getPrevNext(nums, (a, b) -> a < b);
-    Pair<int[], int[]> lt = getPrevNext(nums, (a, b) -> a > b);
-    int[] prevGt = gt.getKey();
-    int[] nextGt = gt.getValue();
-    int[] prevLt = lt.getKey();
-    int[] nextLt = lt.getValue();
-    long ans = 0;
-
-    for (int i = 0; i < nums.length; ++i) {
-      ans += (long) nums[i] * (i - prevGt[i]) * (nextGt[i] - i);
-      ans -= (long) nums[i] * (i - prevLt[i]) * (nextLt[i] - i);
-    }
-
-    return ans;
+    return subarraySum(nums, '<') - subarraySum(nums, '>');
   }
 
-  // Returns `prev` and `next`, that store the indices of the nearest numbers
-  // that are smaller or larger than the current number depending on `op`.
-  private Pair<int[], int[]> getPrevNext(int[] nums, BiFunction<Integer, Integer, Boolean> op) {
-    final int n = nums.length;
+  private long subarraySum(int[] A, char op) {
+    final int n = A.length;
+    long res = 0;
     int[] prev = new int[n];
     int[] next = new int[n];
+    Deque<Integer> stack = new ArrayDeque<>();
+
     Arrays.fill(prev, -1);
     Arrays.fill(next, n);
-    Deque<Integer> stack = new ArrayDeque<>();
+
     for (int i = 0; i < n; ++i) {
-      while (!stack.isEmpty() && op.apply(nums[stack.peek()], nums[i]))
-        next[stack.pop()] = i;
+      while (!stack.isEmpty() && func(op, A[stack.peek()], A[i])) {
+        final int index = stack.pop();
+        next[index] = i;
+      }
       if (!stack.isEmpty())
         prev[i] = stack.peek();
       stack.push(i);
     }
-    return new Pair<>(prev, next);
+
+    for (int i = 0; i < n; ++i)
+      res += (long) A[i] * (i - prev[i]) * (next[i] - i);
+
+    return res;
+  }
+
+  private boolean func(char op, int a, int b) {
+    if (op == '<')
+      return a < b;
+    return a > b;
   }
 }
diff --git a/solutions/2104. Sum of Subarray Ranges/2104.py b/solutions/2104. Sum of Subarray Ranges/2104.py
index 6478b3ece36..bfb257fdc4f 100644
--- a/solutions/2104. Sum of Subarray Ranges/2104.py	
+++ b/solutions/2104. Sum of Subarray Ranges/2104.py	
@@ -1,28 +1,24 @@
 class Solution:
-  def subArrayRanges(self, nums: list[int]) -> int:
-    prevGt, nextGt = self._getPrevNext(nums, operator.lt)
-    prevLt, nextLt = self._getPrevNext(nums, operator.gt)
-    return sum(num * (i - prevGt[i]) * (nextGt[i] - i) -
-               num * (i - prevLt[i]) * (nextLt[i] - i)
-               for i, num in enumerate(nums))
-
-  def _getPrevNext(
-      self,
-      nums: list[int],
-      op: callable
-  ) -> tuple[list[int], list[int]]:
-    """
-    Returns `prev` and `next`, that store the indices of the nearest numbers
-    that are smaller or larger than the current number depending on `op`.
-    """
+  def subArrayRanges(self, nums: List[int]) -> int:
     n = len(nums)
-    prev = [-1] * n
-    next = [n] * n
-    stack = []
-    for i, num in enumerate(nums):
-      while stack and op(nums[stack[-1]], num):
-        next[stack.pop()] = i
-      if stack:
-        prev[i] = stack[-1]
-      stack.append(i)
-    return prev, next
+
+    def sumSubarray(A: List[int], op):
+      res = 0
+      prev = [-1] * n
+      next = [n] * n
+      stack = []
+
+      for i, a in enumerate(A):
+        while stack and op(A[stack[-1]], a):
+          index = stack.pop()
+          next[index] = i
+        if stack:
+          prev[i] = stack[-1]
+        stack.append(i)
+
+      for i, a in enumerate(A):
+        res += a * (i - prev[i]) * (next[i] - i)
+
+      return res
+
+    return sumSubarray(nums, operator.lt) - sumSubarray(nums, operator.gt)
diff --git a/solutions/2105. Watering Plants II/2105.py b/solutions/2105. Watering Plants II/2105.py
index affaf8f4f97..0b36636b460 100644
--- a/solutions/2105. Watering Plants II/2105.py	
+++ b/solutions/2105. Watering Plants II/2105.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minimumRefill(
-      self,
-      plants: list[int],
-      capacityA: int,
-      capacityB: int,
-  ) -> int:
+  def minimumRefill(self, plants: List[int], capacityA: int, capacityB: int) -> int:
     ans = 0
     i = 0
     j = len(plants) - 1
diff --git a/solutions/2106. Maximum Fruits Harvested After at Most K Steps/2106.py b/solutions/2106. Maximum Fruits Harvested After at Most K Steps/2106.py
index 8791b7580c5..b35fc3a9446 100644
--- a/solutions/2106. Maximum Fruits Harvested After at Most K Steps/2106.py	
+++ b/solutions/2106. Maximum Fruits Harvested After at Most K Steps/2106.py	
@@ -1,16 +1,11 @@
 class Solution:
-  def maxTotalFruits(
-      self,
-      fruits: list[list[int]],
-      startPos: int,
-      k: int,
-  ) -> int:
+  def maxTotalFruits(self, fruits: List[List[int]], startPos: int, k: int) -> int:
     ans = 0
     maxRight = max(startPos, fruits[-1][0])
     amounts = [0] * (1 + maxRight)
     for position, amount in fruits:
       amounts[position] = amount
-    prefix = list(itertools.accumulate(amounts, initial=0))
+    prefix = [0] + list(itertools.accumulate(amounts))
 
     def getFruits(leftSteps: int, rightSteps: int) -> int:
       l = max(0, startPos - leftSteps)
diff --git a/solutions/2107. Number of Unique Flavors After Sharing K Candies/2107.py b/solutions/2107. Number of Unique Flavors After Sharing K Candies/2107.py
index 5e9ab0beb72..fb136fd4170 100644
--- a/solutions/2107. Number of Unique Flavors After Sharing K Candies/2107.py	
+++ b/solutions/2107. Number of Unique Flavors After Sharing K Candies/2107.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def shareCandies(self, candies: list[int], k: int) -> int:
+  def shareCandies(self, candies: List[int], k: int) -> int:
     ans = 0
     count = collections.Counter(candies)
     unique = len(count)
diff --git a/solutions/2108. Find First Palindromic String in the Array/2108.py b/solutions/2108. Find First Palindromic String in the Array/2108.py
index 7ab2ea668be..93ca183e3c7 100644
--- a/solutions/2108. Find First Palindromic String in the Array/2108.py	
+++ b/solutions/2108. Find First Palindromic String in the Array/2108.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def firstPalindrome(self, words: list[str]) -> str:
+  def firstPalindrome(self, words: List[str]) -> str:
     def isPalindrome(s: str) -> bool:
       i = 0
       j = len(s) - 1
diff --git a/solutions/2109. Adding Spaces to a String/2109.py b/solutions/2109. Adding Spaces to a String/2109.py
index add35e3faf4..a452795915a 100644
--- a/solutions/2109. Adding Spaces to a String/2109.py	
+++ b/solutions/2109. Adding Spaces to a String/2109.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def addSpaces(self, s: str, spaces: list[int]) -> str:
+  def addSpaces(self, s: str, spaces: List[int]) -> str:
     ans = []
     j = 0  # spaces' index
 
diff --git a/solutions/211. Add and Search Word - Data structure design/211.java b/solutions/211. Add and Search Word - Data structure design/211.java
index 7b878bca2fd..a38870ab65e 100644
--- a/solutions/211. Add and Search Word - Data structure design/211.java	
+++ b/solutions/211. Add and Search Word - Data structure design/211.java	
@@ -4,7 +4,7 @@ class TrieNode {
 }
 
 class WordDictionary {
-  public void addWord(final String word) {
+  public void addWord(String word) {
     TrieNode node = root;
     for (final char c : word.toCharArray()) {
       final int i = c - 'a';
@@ -15,13 +15,13 @@ public void addWord(final String word) {
     node.isWord = true;
   }
 
-  public boolean search(final String word) {
+  public boolean search(String word) {
     return dfs(word, 0, root);
   }
 
   private TrieNode root = new TrieNode();
 
-  private boolean dfs(final String word, int s, TrieNode node) {
+  private boolean dfs(String word, int s, TrieNode node) {
     if (s == word.length())
       return node.isWord;
     if (word.charAt(s) != '.') {
diff --git a/solutions/211. Add and Search Word - Data structure design/211.py b/solutions/211. Add and Search Word - Data structure design/211.py
index e05e4280f56..2cd85644c90 100644
--- a/solutions/211. Add and Search Word - Data structure design/211.py	
+++ b/solutions/211. Add and Search Word - Data structure design/211.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
     self.isWord = False
 
 
diff --git a/solutions/2110. Number of Smooth Descent Periods of a Stock/2110.py b/solutions/2110. Number of Smooth Descent Periods of a Stock/2110.py
index 21cc7f585d6..ea35d2e8103 100644
--- a/solutions/2110. Number of Smooth Descent Periods of a Stock/2110.py	
+++ b/solutions/2110. Number of Smooth Descent Periods of a Stock/2110.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getDescentPeriods(self, prices: list[int]) -> int:
+  def getDescentPeriods(self, prices: List[int]) -> int:
     ans = 1  # prices[0]
     dp = 1
 
diff --git a/solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.cpp b/solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.cpp
index a33e5cf8b64..6c9e50c08c1 100644
--- a/solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.cpp	
+++ b/solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.cpp	
@@ -4,27 +4,27 @@ class Solution {
     int ans = 0;
 
     for (int i = 0; i < k; ++i) {
-      vector<int> arr;
+      vector<int> A;
       for (int j = i; j < arr.size(); j += k)
-        arr.push_back(arr[j]);
-      ans += numReplaced(arr);
+        A.push_back(arr[j]);
+      ans += numReplaced(A);
     }
 
     return ans;
   }
 
  private:
-  int numReplaced(const vector<int>& arr) {
-    vector<int> tails;
-    for (const int a : arr)
-      if (tails.empty() || tails.back() <= a)
-        tails.push_back(a);
+  int numReplaced(const vector<int>& A) {
+    vector<int> tail;
+    for (const int a : A)
+      if (tail.empty() || tail.back() <= a)
+        tail.push_back(a);
       else
-        tails[firstGreater(tails, a)] = a;
-    return arr.size() - tails.size();
+        tail[firstGreater(tail, a)] = a;
+    return A.size() - tail.size();
   }
 
-  int firstGreater(const vector<int>& arr, int target) {
-    return ranges::upper_bound(arr, target) - arr.begin();
+  int firstGreater(const vector<int>& A, int target) {
+    return ranges::upper_bound(A, target) - A.begin();
   }
 };
diff --git a/solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.java b/solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.java
index b5fc19bbb17..c943c308278 100644
--- a/solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.java	
+++ b/solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.java	
@@ -3,27 +3,27 @@ public int kIncreasing(int[] arr, int k) {
     int ans = 0;
 
     for (int i = 0; i < k; ++i) {
-      List<Integer> arr = new ArrayList<>();
+      List<Integer> A = new ArrayList<>();
       for (int j = i; j < arr.length; j += k)
-        arr.add(arr[j]);
-      ans += numReplaced(arr);
+        A.add(arr[j]);
+      ans += numReplaced(A);
     }
 
     return ans;
   }
 
-  private int numReplaced(List<Integer> arr) {
-    List<Integer> tails = new ArrayList<>();
-    for (final int a : arr)
-      if (tails.isEmpty() || tails.get(tails.size() - 1) <= a)
-        tails.add(a);
+  private int numReplaced(List<Integer> A) {
+    List<Integer> tail = new ArrayList<>();
+    for (final int a : A)
+      if (tail.isEmpty() || tail.get(tail.size() - 1) <= a)
+        tail.add(a);
       else
-        tails.set(firstGreater(tails, a), a);
-    return arr.size() - tails.size();
+        tail.set(firstGreater(tail, a), a);
+    return A.size() - tail.size();
   }
 
-  private int firstGreater(List<Integer> arr, int target) {
-    final int i = Collections.binarySearch(arr, target + 1);
+  private int firstGreater(List<Integer> A, int target) {
+    final int i = Collections.binarySearch(A, target + 1);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.py b/solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.py
index 2d5c8dbcbc6..35d1b513b72 100644
--- a/solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.py	
+++ b/solutions/2111. Minimum Operations to Make the Array K-Increasing/2111.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def kIncreasing(self, arr: list[int], k: int) -> int:
-    def numReplaced(arr: list[int]) -> int:
-      tails = []
-      for a in arr:
-        if not tails or tails[-1] <= a:
-          tails.append(a)
+  def kIncreasing(self, arr: List[int], k: int) -> int:
+    def numReplaced(A: List[int]) -> int:
+      tail = []
+      for a in A:
+        if not tail or tail[-1] <= a:
+          tail.append(a)
         else:
-          tails[bisect_right(tails, a)] = a
-      return len(arr) - len(tails)
+          tail[bisect_right(tail, a)] = a
+      return len(A) - len(tail)
 
     return sum(numReplaced(arr[i::k]) for i in range(k))
diff --git a/solutions/2113. Elements in Array After Removing and Replacing Elements/2113.cpp b/solutions/2113. Elements in Array After Removing and Replacing Elements/2113.cpp
index 6f3bd620672..4bcbf0ceb74 100644
--- a/solutions/2113. Elements in Array After Removing and Replacing Elements/2113.cpp	
+++ b/solutions/2113. Elements in Array After Removing and Replacing Elements/2113.cpp	
@@ -13,13 +13,13 @@ class Solution {
   }
 
  private:
-  int f(const vector<int>& arr, int time, int index) {
-    const int n = arr.size();
+  int f(const vector<int>& A, int time, int index) {
+    const int n = A.size();
     if (time < n) {  // [0, 1, 2] -> [1, 2] -> [2]
       index += time;
-      return index >= n ? -1 : arr[index];
+      return index >= n ? -1 : A[index];
     } else {  // [] -> [0] -> [0, 1]
-      return index >= time - n ? -1 : arr[index];
+      return index >= time - n ? -1 : A[index];
     }
   }
 };
diff --git a/solutions/2113. Elements in Array After Removing and Replacing Elements/2113.java b/solutions/2113. Elements in Array After Removing and Replacing Elements/2113.java
index 03a813188c2..213b51a46af 100644
--- a/solutions/2113. Elements in Array After Removing and Replacing Elements/2113.java	
+++ b/solutions/2113. Elements in Array After Removing and Replacing Elements/2113.java	
@@ -11,13 +11,13 @@ public int[] elementInNums(int[] nums, int[][] queries) {
     return ans;
   }
 
-  private int f(int[] arr, int time, int index) {
-    final int n = arr.length;
+  private int f(int[] A, int time, int index) {
+    final int n = A.length;
     if (time < n) { // [0, 1, 2] -> [1, 2] -> [2]
       index += time;
-      return index >= n ? -1 : arr[index];
+      return index >= n ? -1 : A[index];
     } else { // [] -> [0] -> [0, 1]
-      return index >= time - n ? -1 : arr[index];
+      return index >= time - n ? -1 : A[index];
     }
   }
 }
diff --git a/solutions/2113. Elements in Array After Removing and Replacing Elements/2113.py b/solutions/2113. Elements in Array After Removing and Replacing Elements/2113.py
index 736088e25a3..0eb0b3da64a 100644
--- a/solutions/2113. Elements in Array After Removing and Replacing Elements/2113.py	
+++ b/solutions/2113. Elements in Array After Removing and Replacing Elements/2113.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def elementInNums(
-      self,
-      nums: list[int],
-      queries: list[list[int]],
-  ) -> list[int]:
+  def elementInNums(self, nums: List[int], queries: List[List[int]]) -> List[int]:
     n = len(nums)
 
     def f(time: int, index: int) -> int:
diff --git a/solutions/2114. Maximum Number of Words Found in Sentences/2114.py b/solutions/2114. Maximum Number of Words Found in Sentences/2114.py
index 07569d3a7e8..7c241fe3004 100644
--- a/solutions/2114. Maximum Number of Words Found in Sentences/2114.py	
+++ b/solutions/2114. Maximum Number of Words Found in Sentences/2114.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def mostWordsFound(self, sentences: list[str]) -> int:
+  def mostWordsFound(self, sentences: List[str]) -> int:
     return max(s.count(' ') for s in sentences) + 1
diff --git a/solutions/2115. Find All Possible Recipes from Given Supplies/2115.py b/solutions/2115. Find All Possible Recipes from Given Supplies/2115.py
index ece82b1d801..c5380f82ab3 100644
--- a/solutions/2115. Find All Possible Recipes from Given Supplies/2115.py	
+++ b/solutions/2115. Find All Possible Recipes from Given Supplies/2115.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def findAllRecipes(
-      self,
-      recipes: list[str],
-      ingredients: list[list[str]],
-      supplies: list[str],
-  ) -> list[str]:
+  def findAllRecipes(self, recipes: List[str], ingredients: List[List[str]], supplies: List[str]) -> List[str]:
     ans = []
     supplies = set(supplies)
     graph = collections.defaultdict(list)
diff --git a/solutions/2116. Check if a Parentheses String Can Be Valid/2116.cpp b/solutions/2116. Check if a Parentheses String Can Be Valid/2116.cpp
index 1e914ba95f6..c32dc301c73 100644
--- a/solutions/2116. Check if a Parentheses String Can Be Valid/2116.cpp	
+++ b/solutions/2116. Check if a Parentheses String Can Be Valid/2116.cpp	
@@ -5,8 +5,8 @@ class Solution {
       return false;
 
     const bool leftToRightIsOkay = check(s, locked, true);
-    ranges::reverse(s);
-    ranges::reverse(locked);
+    reverse(s.begin(), s.end());
+    reverse(locked.begin(), locked.end());
     const bool rightToLeftIsOkay = check(s, locked, false);
     return leftToRightIsOkay && rightToLeftIsOkay;
   }
diff --git a/solutions/212. Word Search II/212.py b/solutions/212. Word Search II/212.py
index ee898af5cfd..766f02eb0b8 100644
--- a/solutions/212. Word Search II/212.py	
+++ b/solutions/212. Word Search II/212.py	
@@ -1,11 +1,11 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
-    self.word: str | None = None
+    self.children: Dict[str, TrieNode] = {}
+    self.word: Optional[str] = None
 
 
 class Solution:
-  def findWords(self, board: list[list[str]], words: list[str]) -> list[str]:
+  def findWords(self, board: List[List[str]], words: List[str]) -> List[str]:
     m = len(board)
     n = len(board[0])
     ans = []
diff --git a/solutions/2120. Execution of All Suffix Instructions Staying in a Grid/2120.cpp b/solutions/2120. Execution of All Suffix Instructions Staying in a Grid/2120.cpp
index 8a0bad1710f..56b7519d3f2 100644
--- a/solutions/2120. Execution of All Suffix Instructions Staying in a Grid/2120.cpp	
+++ b/solutions/2120. Execution of All Suffix Instructions Staying in a Grid/2120.cpp	
@@ -20,7 +20,7 @@ class Solution {
     int y = 0;
 
     for (int i = m - 1; i >= 0; --i) {
-      const auto& [dx, dy] = moves.at(s[i]);
+      const auto [dx, dy] = moves.at(s[i]);
       x -= dx;
       y -= dy;
       reachX[x] = i;
diff --git a/solutions/2120. Execution of All Suffix Instructions Staying in a Grid/2120.py b/solutions/2120. Execution of All Suffix Instructions Staying in a Grid/2120.py
index 87d85d7c85a..546848f1f42 100644
--- a/solutions/2120. Execution of All Suffix Instructions Staying in a Grid/2120.py	
+++ b/solutions/2120. Execution of All Suffix Instructions Staying in a Grid/2120.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def executeInstructions(
-      self,
-      n: int,
-      startPos: list[int],
-      s: str,
-  ) -> list[int]:
+  def executeInstructions(self, n: int, startPos: List[int], s: str) -> List[int]:
     moves = {'L': (0, -1), 'R': (0, 1), 'U': (-1, 0), 'D': (1, 0)}
     m = len(s)
     uMost = startPos[0] + 1
diff --git a/solutions/2121. Intervals Between Identical Elements/2121.py b/solutions/2121. Intervals Between Identical Elements/2121.py
index ee61668fe85..56a7afdc5a3 100644
--- a/solutions/2121. Intervals Between Identical Elements/2121.py	
+++ b/solutions/2121. Intervals Between Identical Elements/2121.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getDistances(self, arr: list[int]) -> list[int]:
+  def getDistances(self, arr: List[int]) -> List[int]:
     prefix = [0] * len(arr)
     suffix = [0] * len(arr)
     numToIndices = collections.defaultdict(list)
@@ -15,7 +15,7 @@ def getDistances(self, arr: list[int]) -> list[int]:
       for i in range(len(indices) - 2, -1, -1):
         currIndex = indices[i]
         prevIndex = indices[i + 1]
-        suffix[currIndex] += (suffix[prevIndex] +
-                              (len(indices) - i - 1) * (prevIndex - currIndex))
+        suffix[currIndex] += suffix[prevIndex] + \
+            (len(indices) - i - 1) * (prevIndex - currIndex)
 
     return [p + s for p, s in zip(prefix, suffix)]
diff --git a/solutions/2122. Recover the Original Array/2122.cpp b/solutions/2122. Recover the Original Array/2122.cpp
index b2fdf6f9479..4bda22e3432 100644
--- a/solutions/2122. Recover the Original Array/2122.cpp	
+++ b/solutions/2122. Recover the Original Array/2122.cpp	
@@ -13,9 +13,9 @@ class Solution {
       const int x = nums[i] - nums[0];  // 2 * k
       if (x <= 0 || x % 2 == 1)
         continue;
-      vector<int> arr = getArray(nums, x, count);
-      if (!arr.empty())
-        return arr;
+      vector<int> A = getArray(nums, x, count);
+      if (!A.empty())
+        return A;
     }
 
     throw;
@@ -24,7 +24,7 @@ class Solution {
  private:
   vector<int> getArray(const vector<int>& nums, int x,
                        unordered_map<int, int> count) {
-    vector<int> arr;
+    vector<int> A;
     for (const int num : nums) {
       if (const auto it = count.find(num);
           it == count.cend() || it->second == 0)
@@ -34,8 +34,8 @@ class Solution {
         return {};
       --count[num];
       --count[num + x];
-      arr.push_back(num + x / 2);
+      A.push_back(num + x / 2);
     }
-    return arr;
+    return A;
   }
 };
diff --git a/solutions/2122. Recover the Original Array/2122.java b/solutions/2122. Recover the Original Array/2122.java
index 8fe56f7162a..2f3a136d6b8 100644
--- a/solutions/2122. Recover the Original Array/2122.java	
+++ b/solutions/2122. Recover the Original Array/2122.java	
@@ -14,16 +14,16 @@ public int[] recoverArray(int[] nums) {
         continue;
       Map<Integer, Integer> countCopy = new HashMap<>();
       countCopy.putAll(count);
-      int[] arr = getArray(nums, x, countCopy);
-      if (arr.length == n / 2)
-        return arr;
+      int[] A = getArray(nums, x, countCopy);
+      if (A.length == n / 2)
+        return A;
     }
 
-    throw new IllegalarrrgumentException();
+    throw new IllegalArgumentException();
   }
 
   private int[] getArray(int[] nums, int x, Map<Integer, Integer> count) {
-    List<Integer> arr = new ArrayList<>();
+    List<Integer> A = new ArrayList<>();
     for (final int num : nums) {
       if (count.getOrDefault(num, 0) == 0)
         continue;
@@ -31,8 +31,8 @@ private int[] getArray(int[] nums, int x, Map<Integer, Integer> count) {
         return new int[] {};
       count.merge(num, -1, Integer::sum);
       count.merge(num + x, -1, Integer::sum);
-      arr.add(num + x / 2);
+      A.add(num + x / 2);
     }
-    return arr.stream().mapToInt(Integer::intValue).toArray();
+    return A.stream().mapToInt(Integer::intValue).toArray();
   }
 }
diff --git a/solutions/2122. Recover the Original Array/2122.py b/solutions/2122. Recover the Original Array/2122.py
index acb01e47478..565acb3a233 100644
--- a/solutions/2122. Recover the Original Array/2122.py	
+++ b/solutions/2122. Recover the Original Array/2122.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def recoverArray(self, nums: list[int]) -> list[int]:
+  def recoverArray(self, nums: List[int]) -> List[int]:
     nums = sorted(nums)
 
-    def getArray(x: int, count: collections.Counter) -> list[int]:
-      arr = []
+    def getArray(x: int, count: collections.Counter) -> List[int]:
+      A = []
       for num in nums:
         if count[num] == 0:
           continue
@@ -11,8 +11,8 @@ def getArray(x: int, count: collections.Counter) -> list[int]:
           return []
         count[num] -= 1
         count[num + x] -= 1
-        arr.append(num + x // 2)
-      return arr
+        A.append(num + x // 2)
+      return A
 
     count = collections.Counter(nums)
 
@@ -20,6 +20,6 @@ def getArray(x: int, count: collections.Counter) -> list[int]:
       x = nums[i] - nums[0]  # 2 * k
       if x <= 0 or x % 2 == 1:
         continue
-      arr = getArray(x, count.copy())
-      if arr:
-        return arr
+      A = getArray(x, count.copy())
+      if A:
+        return A
diff --git a/solutions/2123. Minimum Operations to Remove Adjacent Ones in Matrix/2123.cpp b/solutions/2123. Minimum Operations to Remove Adjacent Ones in Matrix/2123.cpp
index bc13d268b06..f2c84b19150 100644
--- a/solutions/2123. Minimum Operations to Remove Adjacent Ones in Matrix/2123.cpp	
+++ b/solutions/2123. Minimum Operations to Remove Adjacent Ones in Matrix/2123.cpp	
@@ -19,14 +19,14 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   int dfs(const vector<vector<int>>& grid, int i, int j, int sessionId,
           vector<vector<int>>& seen, vector<vector<int>>& match) {
     const int m = grid.size();
     const int n = grid[0].size();
 
-    for (const auto& [dx, dy] : kDirs) {
+    for (const auto& [dx, dy] : dirs) {
       const int x = i + dx;
       const int y = j + dy;
       if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/2123. Minimum Operations to Remove Adjacent Ones in Matrix/2123.java b/solutions/2123. Minimum Operations to Remove Adjacent Ones in Matrix/2123.java
index 75223f14e84..19968aecbe8 100644
--- a/solutions/2123. Minimum Operations to Remove Adjacent Ones in Matrix/2123.java	
+++ b/solutions/2123. Minimum Operations to Remove Adjacent Ones in Matrix/2123.java	
@@ -19,14 +19,14 @@ public int minimumOperations(int[][] grid) {
     return ans;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private boolean dfs(final int[][] grid, int i, int j, int sessionId, int[][] seen,
                       int[][] match) {
     final int m = grid.length;
     final int n = grid[0].length;
 
-    for (int[] dir : DIRS) {
+    for (int[] dir : dirs) {
       final int x = i + dir[0];
       final int y = j + dir[1];
       if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/2123. Minimum Operations to Remove Adjacent Ones in Matrix/2123.py b/solutions/2123. Minimum Operations to Remove Adjacent Ones in Matrix/2123.py
index 2b17922e11e..bd1407cc766 100644
--- a/solutions/2123. Minimum Operations to Remove Adjacent Ones in Matrix/2123.py	
+++ b/solutions/2123. Minimum Operations to Remove Adjacent Ones in Matrix/2123.py	
@@ -1,13 +1,13 @@
 class Solution:
-  def minimumOperations(self, grid: list[list[int]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def minimumOperations(self, grid: List[List[int]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
     seen = [[0] * n for _ in range(m)]
     match = [[-1] * n for _ in range(m)]
 
     def dfs(i: int, j: int, sessionId: int) -> int:
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/2125. Number of Laser Beams in a Bank/2125.py b/solutions/2125. Number of Laser Beams in a Bank/2125.py
index d2667ad7fa6..746e67f1c55 100644
--- a/solutions/2125. Number of Laser Beams in a Bank/2125.py	
+++ b/solutions/2125. Number of Laser Beams in a Bank/2125.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfBeams(self, bank: list[str]) -> int:
+  def numberOfBeams(self, bank: List[str]) -> int:
     ans = 0
     prevOnes = 0
 
diff --git a/solutions/2126. Destroying Asteroids/2126.py b/solutions/2126. Destroying Asteroids/2126.py
index 8200a9c58c1..ea0d14ba1f1 100644
--- a/solutions/2126. Destroying Asteroids/2126.py	
+++ b/solutions/2126. Destroying Asteroids/2126.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def asteroidsDestroyed(self, mass: int, asteroids: list[int]) -> bool:
+  def asteroidsDestroyed(self, mass: int, asteroids: List[int]) -> bool:
     for asteroid in sorted(asteroids):
       if mass >= asteroid:
         mass += asteroid
diff --git a/solutions/2127. Maximum Employees to Be Invited to a Meeting/2127.java b/solutions/2127. Maximum Employees to Be Invited to a Meeting/2127.java
index c3d8fe53dba..02958f4f8b5 100644
--- a/solutions/2127. Maximum Employees to Be Invited to a Meeting/2127.java	
+++ b/solutions/2127. Maximum Employees to Be Invited to a Meeting/2127.java	
@@ -1,4 +1,4 @@
-enum State { INIT, VISITING, VISITED }
+enum State { kInit, kVisiting, kVisited }
 
 class Solution {
   public int maximumInvitations(int[] favorite) {
@@ -8,7 +8,9 @@ public int maximumInvitations(int[] favorite) {
     int[] inDegrees = new int[n];
     int[] maxChainLength = new int[n];
     Arrays.fill(maxChainLength, 1);
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     // Build the graph.
     for (int i = 0; i < n; ++i) {
@@ -53,13 +55,13 @@ public int maximumInvitations(int[] favorite) {
   private void findCycle(List<Integer>[] graph, int u, int[] parent, boolean[] seen,
                          State[] states) {
     seen[u] = true;
-    states[u] = State.VISITING;
+    states[u] = State.kVisiting;
 
     for (final int v : graph[u]) {
       if (!seen[v]) {
         parent[v] = u;
         findCycle(graph, v, parent, seen, states);
-      } else if (states[v] == State.VISITING) {
+      } else if (states[v] == State.kVisiting) {
         // Find the cycle's length.
         int curr = u;
         int cycleLength = 1;
@@ -71,6 +73,6 @@ private void findCycle(List<Integer>[] graph, int u, int[] parent, boolean[] see
       }
     }
 
-    states[u] = State.VISITED;
+    states[u] = State.kVisited;
   }
 }
diff --git a/solutions/2127. Maximum Employees to Be Invited to a Meeting/2127.py b/solutions/2127. Maximum Employees to Be Invited to a Meeting/2127.py
index 55e7fed3e7b..0d1ced797dc 100644
--- a/solutions/2127. Maximum Employees to Be Invited to a Meeting/2127.py	
+++ b/solutions/2127. Maximum Employees to Be Invited to a Meeting/2127.py	
@@ -2,13 +2,13 @@
 
 
 class State(Enum):
-  INIT = 0
-  VISITING = 1
-  VISITED = 2
+  kInit = 0
+  kVisiting = 1
+  kVisited = 2
 
 
 class Solution:
-  def maximumInvitations(self, favorite: list[int]) -> int:
+  def maximumInvitations(self, favorite: List[int]) -> int:
     n = len(favorite)
     sumComponentsLength = 0  # the component: a -> b -> c <-> x <- y
     graph = [[] for _ in range(n)]
@@ -39,17 +39,17 @@ def maximumInvitations(self, favorite: list[int]) -> int:
     maxCycleLength = 0  # Cycle: a -> b -> c -> a
     parent = [-1] * n
     seen = set()
-    states = [State.INIT] * n
+    states = [State.kInit] * n
 
     def findCycle(u: int) -> None:
       nonlocal maxCycleLength
       seen.add(u)
-      states[u] = State.VISITING
+      states[u] = State.kVisiting
       for v in graph[u]:
         if v not in seen:
           parent[v] = u
           findCycle(v)
-        elif states[v] == State.VISITING:
+        elif states[v] == State.kVisiting:
           # Find the cycle's length.
           curr = u
           cycleLength = 1
@@ -57,7 +57,7 @@ def findCycle(u: int) -> None:
             curr = parent[curr]
             cycleLength += 1
           maxCycleLength = max(maxCycleLength, cycleLength)
-      states[u] = State.VISITED
+      states[u] = State.kVisited
 
     for i in range(n):
       if i not in seen:
diff --git a/solutions/2128. Remove All Ones With Row and Column Flips/2128.py b/solutions/2128. Remove All Ones With Row and Column Flips/2128.py
index c7ccd2b834b..44c4331c32c 100644
--- a/solutions/2128. Remove All Ones With Row and Column Flips/2128.py	
+++ b/solutions/2128. Remove All Ones With Row and Column Flips/2128.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def removeOnes(self, grid: list[list[int]]) -> bool:
+  def removeOnes(self, grid: List[List[int]]) -> bool:
     revRow = [a ^ 1 for a in grid[0]]
     return all(row == grid[0] or row == revRow for row in grid)
diff --git a/solutions/2129. Capitalize the Title/2129.py b/solutions/2129. Capitalize the Title/2129.py
index 704c4de9614..6da3917b0b8 100644
--- a/solutions/2129. Capitalize the Title/2129.py	
+++ b/solutions/2129. Capitalize the Title/2129.py	
@@ -1,4 +1,3 @@
 class Solution:
   def capitalizeTitle(self, title: str) -> str:
-    return ' '.join(s.lower() if len(s) < 3
-                    else s.capitalize() for s in title.split())
+    return ' '.join(s.lower() if len(s) < 3 else s.capitalize() for s in title.split())
diff --git a/solutions/213. House Robber II/213.py b/solutions/213. House Robber II/213.py
index fae75df3e74..96737fe3eeb 100644
--- a/solutions/213. House Robber II/213.py	
+++ b/solutions/213. House Robber II/213.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def rob(self, nums: list[int]) -> int:
+  def rob(self, nums: List[int]) -> int:
     if not nums:
       return 0
     if len(nums) < 2:
diff --git a/solutions/2130. Maximum Twin Sum of a Linked List/2130.cpp b/solutions/2130. Maximum Twin Sum of a Linked List/2130.cpp
index 57f09bd2fbf..e7a7d9a68a7 100644
--- a/solutions/2130. Maximum Twin Sum of a Linked List/2130.cpp	
+++ b/solutions/2130. Maximum Twin Sum of a Linked List/2130.cpp	
@@ -26,7 +26,7 @@ class Solution {
  private:
   ListNode* reverseList(ListNode* head) {
     ListNode* prev = nullptr;
-    while (head != nullptr) {
+    while (head) {
       auto next = head->next;
       head->next = prev;
       prev = head;
diff --git a/solutions/2130. Maximum Twin Sum of a Linked List/2130.py b/solutions/2130. Maximum Twin Sum of a Linked List/2130.py
index ae8a68cf0e7..19e69eabbc0 100644
--- a/solutions/2130. Maximum Twin Sum of a Linked List/2130.py	
+++ b/solutions/2130. Maximum Twin Sum of a Linked List/2130.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def pairSum(self, head: ListNode | None) -> int:
+  def pairSum(self, head: Optional[ListNode]) -> int:
     def reverseList(head: ListNode) -> ListNode:
       prev = None
       while head:
diff --git a/solutions/2131. Longest Palindrome by Concatenating Two Letter Words/2131.py b/solutions/2131. Longest Palindrome by Concatenating Two Letter Words/2131.py
index 482ba1a9b65..eab3214a82d 100644
--- a/solutions/2131. Longest Palindrome by Concatenating Two Letter Words/2131.py	
+++ b/solutions/2131. Longest Palindrome by Concatenating Two Letter Words/2131.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestPalindrome(self, words: list[str]) -> int:
+  def longestPalindrome(self, words: List[str]) -> int:
     ans = 0
     count = [[0] * 26 for _ in range(26)]
 
diff --git a/solutions/2132. Stamping the Grid/2132.py b/solutions/2132. Stamping the Grid/2132.py
index b122811d444..3c5834cec9d 100644
--- a/solutions/2132. Stamping the Grid/2132.py	
+++ b/solutions/2132. Stamping the Grid/2132.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def possibleToStamp(
-      self,
-      grid: list[list[int]],
-      stampHeight: int,
-      stampWidth: int,
-  ) -> bool:
+  def possibleToStamp(self, grid: List[List[int]], stampHeight: int, stampWidth: int) -> bool:
     m = len(grid)
     n = len(grid[0])
     # A[i][j] := the number of 1s in grid[0..i)[0..j)
diff --git a/solutions/2133. Check if Every Row and Column Contains All Numbers/2133.py b/solutions/2133. Check if Every Row and Column Contains All Numbers/2133.py
index be7cf585db1..a69eaace326 100644
--- a/solutions/2133. Check if Every Row and Column Contains All Numbers/2133.py	
+++ b/solutions/2133. Check if Every Row and Column Contains All Numbers/2133.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def checkValid(self, matrix: list[list[int]]) -> bool:
+  def checkValid(self, matrix: List[List[int]]) -> bool:
     return all(min(len(set(row)), len(set(col))) == len(matrix)
                for row, col in zip(matrix, zip(*matrix)))
diff --git a/solutions/2134. Minimum Swaps to Group All 1's Together II/2134.py b/solutions/2134. Minimum Swaps to Group All 1's Together II/2134.py
index 88f66bfc86b..66368530b36 100644
--- a/solutions/2134. Minimum Swaps to Group All 1's Together II/2134.py	
+++ b/solutions/2134. Minimum Swaps to Group All 1's Together II/2134.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minSwaps(self, nums: list[int]) -> int:
+  def minSwaps(self, nums: List[int]) -> int:
     n = len(nums)
     k = nums.count(1)
     ones = 0  # the number of ones in the window
diff --git a/solutions/2135. Count Words Obtained After Adding a Letter/2135.py b/solutions/2135. Count Words Obtained After Adding a Letter/2135.py
index fcd34485e70..2d0b34b6639 100644
--- a/solutions/2135. Count Words Obtained After Adding a Letter/2135.py	
+++ b/solutions/2135. Count Words Obtained After Adding a Letter/2135.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def wordCount(self, startWords: list[str], targetWords: list[str]) -> int:
+  def wordCount(self, startWords: List[str], targetWords: List[str]) -> int:
     def getMask(s: str) -> int:
       mask = 0
       for c in s:
diff --git a/solutions/2136. Earliest Possible Day of Full Bloom/2136.cpp b/solutions/2136. Earliest Possible Day of Full Bloom/2136.cpp
index 1ea534eee1a..de3b1bec0af 100644
--- a/solutions/2136. Earliest Possible Day of Full Bloom/2136.cpp	
+++ b/solutions/2136. Earliest Possible Day of Full Bloom/2136.cpp	
@@ -1,6 +1,7 @@
 struct Seed {
   int p;
   int g;
+  Seed(int p, int g) : p(p), g(g) {}
 };
 
 class Solution {
@@ -13,8 +14,7 @@ class Solution {
     for (int i = 0; i < plantTime.size(); ++i)
       seeds.emplace_back(plantTime[i], growTime[i]);
 
-    ranges::sort(seeds, ranges::greater{},
-                 [](const Seed& seed) { return seed.g; });
+    ranges::sort(seeds, [](const Seed& a, const Seed& b) { return a.g > b.g; });
 
     for (const auto& [p, g] : seeds) {
       time += p;
diff --git a/solutions/2136. Earliest Possible Day of Full Bloom/2136.java b/solutions/2136. Earliest Possible Day of Full Bloom/2136.java
index 06d7446427d..f0e4b90c605 100644
--- a/solutions/2136. Earliest Possible Day of Full Bloom/2136.java	
+++ b/solutions/2136. Earliest Possible Day of Full Bloom/2136.java	
@@ -1,7 +1,14 @@
+class Seed {
+  public int p;
+  public int g;
+  public Seed(int p, int g) {
+    this.p = p;
+    this.g = g;
+  }
+};
+
 class Solution {
   public int earliestFullBloom(int[] plantTime, int[] growTime) {
-    record Seed(int p, int g) {}
-    final int n = plantTime.length;
     int ans = 0;
     int time = 0;
     Seed[] seeds = new Seed[n];
@@ -9,7 +16,7 @@ record Seed(int p, int g) {}
     for (int i = 0; i < plantTime.length; ++i)
       seeds[i] = new Seed(plantTime[i], growTime[i]);
 
-    Arrays.sort(seeds, Comparator.comparingInt(Seed::g).reversed());
+    Arrays.sort(seeds, (a, b) -> b.g - a.g);
 
     for (Seed seed : seeds) {
       time += seed.p;
diff --git a/solutions/2136. Earliest Possible Day of Full Bloom/2136.py b/solutions/2136. Earliest Possible Day of Full Bloom/2136.py
index a0f3c4d1e25..6f2ab5753e0 100644
--- a/solutions/2136. Earliest Possible Day of Full Bloom/2136.py	
+++ b/solutions/2136. Earliest Possible Day of Full Bloom/2136.py	
@@ -1,11 +1,9 @@
 class Solution:
-  def earliestFullBloom(self, plantTime: list[int], growTime: list[int]) -> int:
+  def earliestFullBloom(self, plantTime: List[int], growTime: List[int]) -> int:
     ans = 0
     time = 0
 
-    for p, g in sorted(
-        [(p, g) for (p, g) in zip(plantTime, growTime)],
-            key=lambda x: -x[1]):
+    for p, g in sorted([(p, g) for (p, g) in zip(plantTime, growTime)], key=lambda x: -x[1]):
       time += p
       ans = max(ans, time + g)
 
diff --git a/solutions/2137. Pour Water Between Buckets to Make Water Levels Equal/2137.java b/solutions/2137. Pour Water Between Buckets to Make Water Levels Equal/2137.java
index d5bd09506a9..98850737cf4 100644
--- a/solutions/2137. Pour Water Between Buckets to Make Water Levels Equal/2137.java	
+++ b/solutions/2137. Pour Water Between Buckets to Make Water Levels Equal/2137.java	
@@ -1,13 +1,13 @@
 class Solution {
   public double equalizeWater(int[] buckets, int loss) {
-    final double ERR = 1e-5;
-    final double PERCENTAGE = (100 - loss) / (double) 100;
+    final double kErr = 1e-5;
+    final double kPercentage = (100 - loss) / (double) 100;
     double l = 0.0;
     double r = Arrays.stream(buckets).max().getAsInt();
 
-    while (r - l > ERR) {
+    while (r - l > kErr) {
       final double m = (l + r) / 2;
-      if (canFill(buckets, m, PERCENTAGE))
+      if (canFill(buckets, m, kPercentage))
         l = m;
       else
         r = m;
@@ -16,7 +16,7 @@ public double equalizeWater(int[] buckets, int loss) {
     return l;
   }
 
-  private boolean canFill(int[] buckets, double target, double PERCENTAGE) {
+  private boolean canFill(int[] buckets, double target, double kPercentage) {
     double extra = 0.0;
     double need = 0.0;
     for (final int bucket : buckets)
@@ -24,6 +24,6 @@ private boolean canFill(int[] buckets, double target, double PERCENTAGE) {
         extra += bucket - target;
       else
         need += target - bucket;
-    return extra * PERCENTAGE >= need;
+    return extra * kPercentage >= need;
   };
 }
diff --git a/solutions/2137. Pour Water Between Buckets to Make Water Levels Equal/2137.py b/solutions/2137. Pour Water Between Buckets to Make Water Levels Equal/2137.py
index d4f8e13b7b6..d5f688eb38b 100644
--- a/solutions/2137. Pour Water Between Buckets to Make Water Levels Equal/2137.py	
+++ b/solutions/2137. Pour Water Between Buckets to Make Water Levels Equal/2137.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def equalizeWater(self, buckets: list[int], loss: int) -> float:
-    ERR = 1e-5
-    PERCENTAGE = (100 - loss) / 100
+  def equalizeWater(self, buckets: List[int], loss: int) -> float:
+    kErr = 1e-5
+    kPercentage = (100 - loss) / 100
     l = 0.0
     r = max(buckets)
 
@@ -13,9 +13,9 @@ def canFill(target: float) -> bool:
           extra += bucket - target
         else:
           need += target - bucket
-      return extra * PERCENTAGE >= need
+      return extra * kPercentage >= need
 
-    while r - l > ERR:
+    while r - l > kErr:
       m = (l + r) / 2
       if canFill(m):
         l = m
diff --git a/solutions/2138. Divide a String Into Groups of Size k/2138.py b/solutions/2138. Divide a String Into Groups of Size k/2138.py
index 1d37f92e5bc..d0aacfad611 100644
--- a/solutions/2138. Divide a String Into Groups of Size k/2138.py	
+++ b/solutions/2138. Divide a String Into Groups of Size k/2138.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def divideString(self, s: str, k: int, fill: str) -> list[str]:
+  def divideString(self, s: str, k: int, fill: str) -> List[str]:
     return [
         s[i:] + fill * (i + k - len(s)) if i + k > len(s)
         else s[i:i + k]
diff --git a/solutions/214. Shortest Palindrome/214.cpp b/solutions/214. Shortest Palindrome/214.cpp
index 419c2889edd..e8e7be45482 100644
--- a/solutions/214. Shortest Palindrome/214.cpp	
+++ b/solutions/214. Shortest Palindrome/214.cpp	
@@ -1,7 +1,9 @@
 class Solution {
  public:
   string shortestPalindrome(string s) {
-    const string t = {s.rbegin(), s.rend()};
+    string t = s;
+    reverse(t.begin(), t.end());
+
     const string_view sv_s(s);
     const string_view sv_t(t);
 
diff --git a/solutions/2140. Solving Questions With Brainpower/2140.py b/solutions/2140. Solving Questions With Brainpower/2140.py
index e174231403f..6b451f17e68 100644
--- a/solutions/2140. Solving Questions With Brainpower/2140.py	
+++ b/solutions/2140. Solving Questions With Brainpower/2140.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def mostPoints(self, questions: list[list[int]]) -> int:
+  def mostPoints(self, questions: List[List[int]]) -> int:
     n = len(questions)
     # dp[i] := the maximum points starting from questions[i]
     dp = [0] * (n + 1)
diff --git a/solutions/2141. Maximum Running Time of N Computers/2141.py b/solutions/2141. Maximum Running Time of N Computers/2141.py
index 04fe69de3a4..ed104a4c252 100644
--- a/solutions/2141. Maximum Running Time of N Computers/2141.py	
+++ b/solutions/2141. Maximum Running Time of N Computers/2141.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxRunTime(self, n: int, batteries: list[int]) -> int:
+  def maxRunTime(self, n: int, batteries: List[int]) -> int:
     summ = sum(batteries)
 
     batteries.sort()
diff --git a/solutions/2142. The Number of Passengers in Each Bus I/2142.sql b/solutions/2142. The Number of Passengers in Each Bus I/2142.sql
index dcdf73072e2..8e8e798b797 100644
--- a/solutions/2142. The Number of Passengers in Each Bus I/2142.sql	
+++ b/solutions/2142. The Number of Passengers in Each Bus I/2142.sql	
@@ -1,5 +1,5 @@
-WITH RECURSIVE
-  BusesNeighbors AS (
+WITH
+  RECURSIVE BusesNeighbors AS (
     SELECT
       bus_id,
       arrival_time,
diff --git a/solutions/2143. Choose Numbers From Two Arrays in Range/2143.cpp b/solutions/2143. Choose Numbers From Two Arrays in Range/2143.cpp
index f0c8cd84a1a..58601d2a17a 100644
--- a/solutions/2143. Choose Numbers From Two Arrays in Range/2143.cpp	
+++ b/solutions/2143. Choose Numbers From Two Arrays in Range/2143.cpp	
@@ -22,7 +22,7 @@ class Solution {
         newDp[prevSum - nums2[i]] %= kMod;
       }
 
-      dp = std::move(newDp);
+      dp = move(newDp);
       if (const auto it = dp.find(0); it != dp.cend()) {
         ans += it->second;
         ans %= kMod;
diff --git a/solutions/2143. Choose Numbers From Two Arrays in Range/2143.java b/solutions/2143. Choose Numbers From Two Arrays in Range/2143.java
index 67c7459b17c..f695edbca35 100644
--- a/solutions/2143. Choose Numbers From Two Arrays in Range/2143.java	
+++ b/solutions/2143. Choose Numbers From Two Arrays in Range/2143.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int countSubranges(int[] nums1, int[] nums2) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int ans = 0;
     // {sum, count}, add if choose from nums1, minus if choose from nums2
     Map<Integer, Integer> dp = new HashMap<>();
@@ -15,15 +15,15 @@ public int countSubranges(int[] nums1, int[] nums2) {
       for (final int prevSum : dp.keySet()) {
         final int count = dp.get(prevSum);
         final int chooseNums1 = prevSum + nums1[i];
-        newDp.put(chooseNums1, (newDp.getOrDefault(chooseNums1, 0) + count) % MOD);
+        newDp.put(chooseNums1, (newDp.getOrDefault(chooseNums1, 0) + count) % kMod);
         final int chooseNums2 = prevSum - nums2[i];
-        newDp.put(chooseNums2, (newDp.getOrDefault(chooseNums2, 0) + count) % MOD);
+        newDp.put(chooseNums2, (newDp.getOrDefault(chooseNums2, 0) + count) % kMod);
       }
 
       dp = newDp;
       if (dp.containsKey(0)) {
         ans += dp.get(0);
-        ans %= MOD;
+        ans %= kMod;
       }
     }
 
diff --git a/solutions/2143. Choose Numbers From Two Arrays in Range/2143.py b/solutions/2143. Choose Numbers From Two Arrays in Range/2143.py
index 96cfb4a33d8..a9958cc35e5 100644
--- a/solutions/2143. Choose Numbers From Two Arrays in Range/2143.py	
+++ b/solutions/2143. Choose Numbers From Two Arrays in Range/2143.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def countSubranges(self, nums1: list[int], nums2: list[int]) -> int:
-    MOD = 1_000_000_007
+  def countSubranges(self, nums1: List[int], nums2: List[int]) -> int:
+    kMod = 1_000_000_007
     ans = 0
     # {sum, count}, add if choose from nums1, minus if choose from nums2
     dp = collections.Counter()
@@ -13,13 +13,13 @@ def countSubranges(self, nums1: list[int], nums2: list[int]) -> int:
       for prevSum, count in dp.items():
         # Choose nums1[i]
         newDp[prevSum + a] += count
-        newDp[prevSum + a] %= MOD
+        newDp[prevSum + a] %= kMod
         # Choose nums2[i]
         newDp[prevSum - b] += count
-        newDp[prevSum - b] %= MOD
+        newDp[prevSum - b] %= kMod
 
       dp = newDp
       ans += dp[0]
-      ans %= MOD
+      ans %= kMod
 
     return ans
diff --git a/solutions/2144. Minimum Cost of Buying Candies With Discount/2144.cpp b/solutions/2144. Minimum Cost of Buying Candies With Discount/2144.cpp
index fe9d8a0c959..cc8cc279b9f 100644
--- a/solutions/2144. Minimum Cost of Buying Candies With Discount/2144.cpp	
+++ b/solutions/2144. Minimum Cost of Buying Candies With Discount/2144.cpp	
@@ -3,7 +3,7 @@ class Solution {
   int minimumCost(vector<int>& cost) {
     int ans = 0;
 
-    ranges::sort(cost, greater<>());
+    ranges::sort(cost, [](const int a, const int b) { return a > b; });
 
     for (int i = 0; i < cost.size(); ++i)
       if (i % 3 != 2)
diff --git a/solutions/2144. Minimum Cost of Buying Candies With Discount/2144.py b/solutions/2144. Minimum Cost of Buying Candies With Discount/2144.py
index 51c9303d447..d9110aa1cac 100644
--- a/solutions/2144. Minimum Cost of Buying Candies With Discount/2144.py	
+++ b/solutions/2144. Minimum Cost of Buying Candies With Discount/2144.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def minimumCost(self, cost: list[int]) -> int:
+  def minimumCost(self, cost: List[int]) -> int:
     return sum(cost) - sum(sorted(cost)[-3::-3])
diff --git a/solutions/2145. Count the Hidden Sequences/2145-2.py b/solutions/2145. Count the Hidden Sequences/2145-2.py
index cbe65be4f65..1ae326959c8 100644
--- a/solutions/2145. Count the Hidden Sequences/2145-2.py	
+++ b/solutions/2145. Count the Hidden Sequences/2145-2.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def numberOfArrays(
-      self,
-      differences: list[int],
-      lower: int,
-      upper: int,
-  ) -> int:
+  def numberOfArrays(self, differences: List[int], lower: int, upper: int) -> int:
     prefix = 0
     mn = 0  # Starts from 0.
     mx = 0  # Starts from 0.
diff --git a/solutions/2145. Count the Hidden Sequences/2145.py b/solutions/2145. Count the Hidden Sequences/2145.py
index 81e9046c83c..f4046a1dbe1 100644
--- a/solutions/2145. Count the Hidden Sequences/2145.py	
+++ b/solutions/2145. Count the Hidden Sequences/2145.py	
@@ -1,9 +1,4 @@
 class Solution:
-  def numberOfArrays(
-      self,
-      differences: list[int],
-      lower: int,
-      upper: int,
-  ) -> int:
-    prefix = list(itertools.accumulate(differences, initial=0))
+  def numberOfArrays(self, differences: List[int], lower: int, upper: int) -> int:
+    prefix = [0] + list(itertools.accumulate(differences))
     return max(0, (upper - lower) - (max(prefix) - min(prefix)) + 1)
diff --git a/solutions/2146. K Highest Ranked Items Within a Price Range/2146.cpp b/solutions/2146. K Highest Ranked Items Within a Price Range/2146.cpp
index f82747ace52..658affc00fe 100644
--- a/solutions/2146. K Highest Ranked Items Within a Price Range/2146.cpp	
+++ b/solutions/2146. K Highest Ranked Items Within a Price Range/2146.cpp	
@@ -3,7 +3,7 @@ class Solution {
   vector<vector<int>> highestRankedKItems(vector<vector<int>>& grid,
                                           vector<int>& pricing,
                                           vector<int>& start, int k) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = grid.size();
     const int n = grid[0].size();
     const int low = pricing[0];
@@ -27,7 +27,7 @@ class Solution {
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/2146. K Highest Ranked Items Within a Price Range/2146.java b/solutions/2146. K Highest Ranked Items Within a Price Range/2146.java
index 4cf4ba809ef..922f2a9ac5b 100644
--- a/solutions/2146. K Highest Ranked Items Within a Price Range/2146.java	
+++ b/solutions/2146. K Highest Ranked Items Within a Price Range/2146.java	
@@ -1,6 +1,6 @@
 class Solution {
   public List<List<Integer>> highestRankedKItems(int[][] grid, int[] pricing, int[] start, int k) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = grid.length;
     final int n = grid[0].length;
     final int low = pricing[0];
@@ -15,7 +15,7 @@ public List<List<Integer>> highestRankedKItems(int[][] grid, int[] pricing, int[
         return ans;
     }
 
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(row, col)));
+    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(Arrays.asList(new Pair<>(row, col)));
     boolean[][] seen = new boolean[m][n];
     seen[row][col] = true; // Mark as visited.
 
@@ -24,7 +24,7 @@ public List<List<Integer>> highestRankedKItems(int[][] grid, int[] pricing, int[
       for (int sz = q.size(); sz > 0; --sz) {
         final int i = q.peek().getKey();
         final int j = q.poll().getValue();
-        for (int[] dir : DIRS) {
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/2146. K Highest Ranked Items Within a Price Range/2146.py b/solutions/2146. K Highest Ranked Items Within a Price Range/2146.py
index 84bf03ca39d..889f79fbc15 100644
--- a/solutions/2146. K Highest Ranked Items Within a Price Range/2146.py	
+++ b/solutions/2146. K Highest Ranked Items Within a Price Range/2146.py	
@@ -1,12 +1,6 @@
 class Solution:
-  def highestRankedKItems(
-      self,
-      grid: list[list[int]],
-      pricing: list[int],
-      start: list[int],
-      k: int
-  ) -> list[list[int]]:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def highestRankedKItems(self, grid: List[List[int]], pricing: List[int], start: List[int], k: int) -> List[List[int]]:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
     low, high = pricing
@@ -26,8 +20,8 @@ def highestRankedKItems(
       for _ in range(len(q)):
         i, j = q.popleft()
         for t in range(4):
-          x = i + DIRS[t][0]
-          y = j + DIRS[t][1]
+          x = i + dirs[t]
+          y = j + dirs[t + 1]
           if x < 0 or x == m or y < 0 or y == n:
             continue
           if not grid[x][y] or (x, y) in seen:
diff --git a/solutions/2147. Number of Ways to Divide a Long Corridor/2147.java b/solutions/2147. Number of Ways to Divide a Long Corridor/2147.java
index cfbd3e8d3a5..cee0b36e572 100644
--- a/solutions/2147. Number of Ways to Divide a Long Corridor/2147.java	
+++ b/solutions/2147. Number of Ways to Divide a Long Corridor/2147.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numberOfWays(String corridor) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long ans = 1;
     int prevSeat = -1;
     int numSeats = 0;
@@ -8,7 +8,7 @@ public int numberOfWays(String corridor) {
     for (int i = 0; i < corridor.length(); ++i) {
       if (corridor.charAt(i) == 'S') {
         if (++numSeats > 2 && numSeats % 2 == 1)
-          ans = ans * (i - prevSeat) % MOD;
+          ans = ans * (i - prevSeat) % kMod;
         prevSeat = i;
       }
     }
diff --git a/solutions/2147. Number of Ways to Divide a Long Corridor/2147.py b/solutions/2147. Number of Ways to Divide a Long Corridor/2147.py
index 5a8f7a1b897..056c6de2638 100644
--- a/solutions/2147. Number of Ways to Divide a Long Corridor/2147.py	
+++ b/solutions/2147. Number of Ways to Divide a Long Corridor/2147.py	
@@ -1,6 +1,6 @@
 class Solution:
   def numberOfWays(self, corridor: str) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     ans = 1
     prevSeat = -1
     numSeats = 0
@@ -9,7 +9,7 @@ def numberOfWays(self, corridor: str) -> int:
       if c == 'S':
         numSeats += 1
         if numSeats > 2 and numSeats % 2 == 1:
-          ans = ans * (i - prevSeat) % MOD
+          ans = ans * (i - prevSeat) % kMod
         prevSeat = i
 
     return ans if numSeats > 1 and numSeats % 2 == 0 else 0
diff --git a/solutions/2148. Count Elements With Strictly Smaller and Greater Elements/2148.py b/solutions/2148. Count Elements With Strictly Smaller and Greater Elements/2148.py
index 37c00a6aa99..2a7e8912413 100644
--- a/solutions/2148. Count Elements With Strictly Smaller and Greater Elements/2148.py	
+++ b/solutions/2148. Count Elements With Strictly Smaller and Greater Elements/2148.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countElements(self, nums: list[int]) -> int:
+  def countElements(self, nums: List[int]) -> int:
     mn = min(nums)
     mx = max(nums)
     return sum(mn < num < mx for num in nums)
diff --git a/solutions/2149. Rearrange Array Elements by Sign/2149.py b/solutions/2149. Rearrange Array Elements by Sign/2149.py
index e20324cea14..fbb5e80e670 100644
--- a/solutions/2149. Rearrange Array Elements by Sign/2149.py	
+++ b/solutions/2149. Rearrange Array Elements by Sign/2149.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def rearrangeArray(self, nums: list[int]) -> list[int]:
+  def rearrangeArray(self, nums: List[int]) -> List[int]:
     ans = []
     pos = []
     neg = []
diff --git a/solutions/215. Kth Largest Element in an Array/215-2.py b/solutions/215. Kth Largest Element in an Array/215-2.py
index 07bf678a4f7..a04c40c8904 100644
--- a/solutions/215. Kth Largest Element in an Array/215-2.py	
+++ b/solutions/215. Kth Largest Element in an Array/215-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findKthLargest(self, nums: list[int], k: int) -> int:
+  def findKthLargest(self, nums: List[int], k: int) -> int:
     def quickSelect(l: int, r: int, k: int) -> int:
       pivot = nums[r]
 
diff --git a/solutions/215. Kth Largest Element in an Array/215-3.py b/solutions/215. Kth Largest Element in an Array/215-3.py
index 73c661c213d..6dcfa95578a 100644
--- a/solutions/215. Kth Largest Element in an Array/215-3.py	
+++ b/solutions/215. Kth Largest Element in an Array/215-3.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findKthLargest(self, nums: list[int], k: int) -> int:
+  def findKthLargest(self, nums: List[int], k: int) -> int:
     def quickSelect(l: int, r: int, k: int) -> int:
       randIndex = random.randint(0, r - l) + l
       nums[randIndex], nums[r] = nums[r], nums[randIndex]
diff --git a/solutions/215. Kth Largest Element in an Array/215.py b/solutions/215. Kth Largest Element in an Array/215.py
index 003f894a2ed..467d599478f 100644
--- a/solutions/215. Kth Largest Element in an Array/215.py	
+++ b/solutions/215. Kth Largest Element in an Array/215.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findKthLargest(self, nums: list[int], k: int) -> int:
+  def findKthLargest(self, nums: List[int], k: int) -> int:
     minHeap = []
 
     for num in nums:
diff --git a/solutions/2150. Find All Lonely Numbers in the Array/2150.py b/solutions/2150. Find All Lonely Numbers in the Array/2150.py
index 0e2d47ddefc..9171642c704 100644
--- a/solutions/2150. Find All Lonely Numbers in the Array/2150.py	
+++ b/solutions/2150. Find All Lonely Numbers in the Array/2150.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLonely(self, nums: list[int]) -> list[int]:
+  def findLonely(self, nums: List[int]) -> List[int]:
     count = collections.Counter(nums)
     return [num for num, freq in count.items()
             if freq == 1 and
diff --git a/solutions/2151. Maximum Good People Based on Statements/2151-2.py b/solutions/2151. Maximum Good People Based on Statements/2151-2.py
index 1be1c193d1e..485213d3b4d 100644
--- a/solutions/2151. Maximum Good People Based on Statements/2151-2.py	
+++ b/solutions/2151. Maximum Good People Based on Statements/2151-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumGood(self, statements: list[list[int]]) -> int:
+  def maximumGood(self, statements: List[List[int]]) -> int:
     n = len(statements)
 
     def isValid(mask: int) -> bool:
diff --git a/solutions/2151. Maximum Good People Based on Statements/2151.cpp b/solutions/2151. Maximum Good People Based on Statements/2151.cpp
index a7f1dad9c88..adcbf78d4a6 100644
--- a/solutions/2151. Maximum Good People Based on Statements/2151.cpp	
+++ b/solutions/2151. Maximum Good People Based on Statements/2151.cpp	
@@ -16,9 +16,9 @@ class Solution {
     }
 
     good.push_back(0);  // Assume the i-th person is bad.
-    dfs(statements, std::move(good), i + 1, count, ans);
+    dfs(statements, move(good), i + 1, count, ans);
     good.back() = 1;  // Assume the i-th person is good.
-    dfs(statements, std::move(good), i + 1, count + 1, ans);
+    dfs(statements, move(good), i + 1, count + 1, ans);
     good.pop_back();
   }
 
diff --git a/solutions/2151. Maximum Good People Based on Statements/2151.py b/solutions/2151. Maximum Good People Based on Statements/2151.py
index 76a1d678fa2..47906a6d6c1 100644
--- a/solutions/2151. Maximum Good People Based on Statements/2151.py	
+++ b/solutions/2151. Maximum Good People Based on Statements/2151.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def maximumGood(self, statements: list[list[int]]) -> int:
+  def maximumGood(self, statements: List[List[int]]) -> int:
     n = len(statements)
     ans = 0
 
-    def isValid(good: list[int]) -> bool:
+    def isValid(good: List[int]) -> bool:
       for i, g in enumerate(good):
         if not g:  # The i-th person is bad, so no need to check.
           continue
@@ -14,7 +14,7 @@ def isValid(good: list[int]) -> bool:
             return False
       return True
 
-    def dfs(good: list[int], i: int, count: int) -> None:
+    def dfs(good: List[int], i: int, count: int) -> None:
       nonlocal ans
       if i == n:
         if isValid(good):
diff --git a/solutions/2152. Minimum Number of Lines to Cover Points/2152.cpp b/solutions/2152. Minimum Number of Lines to Cover Points/2152.cpp
index 9638ce79bf4..2e4c688816d 100644
--- a/solutions/2152. Minimum Number of Lines to Cover Points/2152.cpp	
+++ b/solutions/2152. Minimum Number of Lines to Cover Points/2152.cpp	
@@ -29,7 +29,7 @@ class Solution {
         for (int k = 0; k < n; ++k)
           if (getSlope(points[i], points[k]) == slope)
             newCovered |= 1 << k;
-        ans = min(ans, 1 + dfs(points, newCovered, allCovered, std::move(mem)));
+        ans = min(ans, 1 + dfs(points, newCovered, allCovered, move(mem)));
       }
     }
 
diff --git a/solutions/2152. Minimum Number of Lines to Cover Points/2152.py b/solutions/2152. Minimum Number of Lines to Cover Points/2152.py
index 510e5987888..e03704e3722 100644
--- a/solutions/2152. Minimum Number of Lines to Cover Points/2152.py	
+++ b/solutions/2152. Minimum Number of Lines to Cover Points/2152.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def minimumLines(self, points: list[list[int]]) -> int:
+  def minimumLines(self, points: List[List[int]]) -> int:
     n = len(points)
     allCovered = (1 << n) - 1
     maxLines = n // 2 + (n & 1)
 
-    def getSlope(p: list[int], q: list[int]) -> tuple[int, int]:
+    def getSlope(p: List[int], q: List[int]) -> Tuple[int, int]:
       dx = p[0] - q[0]
       dy = p[1] - q[1]
       if dx == 0:
diff --git a/solutions/2153. The Number of Passengers in Each Bus II/2153.sql b/solutions/2153. The Number of Passengers in Each Bus II/2153.sql
index 8c4bed91d16..158b3ecbd41 100644
--- a/solutions/2153. The Number of Passengers in Each Bus II/2153.sql	
+++ b/solutions/2153. The Number of Passengers in Each Bus II/2153.sql	
@@ -1,5 +1,5 @@
-WITH RECURSIVE
-  BusesNeighbors AS (
+WITH
+  RECURSIVE BusesNeighbors AS (
     SELECT
       bus_id,
       arrival_time,
diff --git a/solutions/2154. Keep Multiplying Found Values by Two/2155-2.py b/solutions/2154. Keep Multiplying Found Values by Two/2155-2.py
index 044c31901a1..40de32f8af0 100644
--- a/solutions/2154. Keep Multiplying Found Values by Two/2155-2.py	
+++ b/solutions/2154. Keep Multiplying Found Values by Two/2155-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findFinalValue(self, nums: list[int], original: int) -> int:
+  def findFinalValue(self, nums: List[int], original: int) -> int:
     seen = [False] * 1001
 
     for num in nums:
diff --git a/solutions/2154. Keep Multiplying Found Values by Two/2155.cpp b/solutions/2154. Keep Multiplying Found Values by Two/2155.cpp
index 6f37ad6a74a..2302e75d0c9 100644
--- a/solutions/2154. Keep Multiplying Found Values by Two/2155.cpp	
+++ b/solutions/2154. Keep Multiplying Found Values by Two/2155.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int findFinalValue(vector<int>& nums, int original) {
-    unordered_set<int> numsSet{nums.begin(), nums.end()};
+    unordered_set<int> numsSet(nums.begin(), nums.end());
     while (numsSet.contains(original))
       original *= 2;
     return original;
diff --git a/solutions/2154. Keep Multiplying Found Values by Two/2155.py b/solutions/2154. Keep Multiplying Found Values by Two/2155.py
index 9541785783d..e9c418a40e1 100644
--- a/solutions/2154. Keep Multiplying Found Values by Two/2155.py	
+++ b/solutions/2154. Keep Multiplying Found Values by Two/2155.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findFinalValue(self, nums: list[int], original: int) -> int:
+  def findFinalValue(self, nums: List[int], original: int) -> int:
     numsSet = set(nums)
     while original in numsSet:
       original *= 2
diff --git a/solutions/2155. All Divisions With the Highest Score of a Binary Array/2155.java b/solutions/2155. All Divisions With the Highest Score of a Binary Array/2155.java
index ea9769dd37d..1c2f8dc471f 100644
--- a/solutions/2155. All Divisions With the Highest Score of a Binary Array/2155.java	
+++ b/solutions/2155. All Divisions With the Highest Score of a Binary Array/2155.java	
@@ -3,7 +3,7 @@ public List<Integer> maxScoreIndices(int[] nums) {
     final int ones = Arrays.stream(nums).sum();
     final int zeros = nums.length - ones;
     // the division at index 0
-    List<Integer> ans = new ArrayList<>(List.of(0));
+    List<Integer> ans = new ArrayList<>(Arrays.asList(0));
     int leftZeros = 0;
     int leftOnes = 0;
     int maxScore = ones; // `leftZeros` + `rightOnes`
@@ -17,7 +17,7 @@ public List<Integer> maxScoreIndices(int[] nums) {
         ans.add(i + 1);
       } else if (maxScore < score) {
         maxScore = score;
-        ans = new ArrayList<>(List.of(i + 1));
+        ans = new ArrayList<>(Arrays.asList(i + 1));
       }
     }
 
diff --git a/solutions/2155. All Divisions With the Highest Score of a Binary Array/2155.py b/solutions/2155. All Divisions With the Highest Score of a Binary Array/2155.py
index 552c4728380..74b3101aab3 100644
--- a/solutions/2155. All Divisions With the Highest Score of a Binary Array/2155.py	
+++ b/solutions/2155. All Divisions With the Highest Score of a Binary Array/2155.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxScoreIndices(self, nums: list[int]) -> list[int]:
+  def maxScoreIndices(self, nums: List[int]) -> List[int]:
     zeros = nums.count(0)
     ones = len(nums) - zeros
     ans = [0]  # the division at index 0
diff --git a/solutions/2156. Find Substring With Given Hash Value/2156.py b/solutions/2156. Find Substring With Given Hash Value/2156.py
index 51f0c4f2091..05d0e125796 100644
--- a/solutions/2156. Find Substring With Given Hash Value/2156.py	
+++ b/solutions/2156. Find Substring With Given Hash Value/2156.py	
@@ -1,12 +1,5 @@
 class Solution:
-  def subStrHash(
-      self,
-      s: str,
-      power: int,
-      modulo: int,
-      k: int,
-      hashValue: int,
-  ) -> str:
+  def subStrHash(self, s: str, power: int, modulo: int, k: int, hashValue: int) -> str:
     maxPower = pow(power, k, modulo)
     hash = 0
 
diff --git a/solutions/2157. Groups of Strings/2157.py b/solutions/2157. Groups of Strings/2157.py
index fdd9598f4c8..2f967580312 100644
--- a/solutions/2157. Groups of Strings/2157.py	
+++ b/solutions/2157. Groups of Strings/2157.py	
@@ -24,7 +24,7 @@ def _find(self, u: int) -> int:
 
 
 class Solution:
-  def groupStrings(self, words: list[str]) -> list[int]:
+  def groupStrings(self, words: List[str]) -> List[int]:
     uf = UnionFind(len(words))
 
     def getMask(s: str) -> int:
diff --git a/solutions/2158. Amount of New Area Painted Each Day/2158.cpp b/solutions/2158. Amount of New Area Painted Each Day/2158.cpp
index 68713146d59..803defe885f 100644
--- a/solutions/2158. Amount of New Area Painted Each Day/2158.cpp	
+++ b/solutions/2158. Amount of New Area Painted Each Day/2158.cpp	
@@ -12,9 +12,13 @@ class Solution {
   vector<int> amountPainted(vector<vector<int>>& paint) {
     const int n = paint.size();
     const int minDay = (*ranges::min_element(
-        paint, ranges::less{}, [](const vector<int>& p) { return p[0]; }))[0];
+        paint, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] < b[0];
+    }))[0];
     const int maxDay = (*ranges::max_element(
-        paint, ranges::less{}, [](const vector<int>& p) { return p[1]; }))[1];
+        paint, [](const vector<int>& a, const vector<int>& b) {
+      return a[1] < b[1];
+    }))[1];
     vector<int> ans(n);
     vector<Event> events;
     // Stores the indices of paints that are available now.
diff --git a/solutions/2158. Amount of New Area Painted Each Day/2158.java b/solutions/2158. Amount of New Area Painted Each Day/2158.java
index 32492fc83f4..d40eead37b4 100644
--- a/solutions/2158. Amount of New Area Painted Each Day/2158.java	
+++ b/solutions/2158. Amount of New Area Painted Each Day/2158.java	
@@ -1,8 +1,18 @@
-enum Type { ENTERING, LEAVING }
+enum Type { kEntering, kLeaving }
+
+class Event {
+  public int day;
+  public int index;
+  public Type type;
+  public Event(int day, int index, Type type) {
+    this.day = day;
+    this.index = index;
+    this.type = type;
+  }
+}
 
 class Solution {
   public int[] amountPainted(int[][] paint) {
-    record Event(int day, int index, Type type) {}
     final int n = paint.length;
     final int minDay = Arrays.stream(paint).mapToInt(x -> x[0]).min().getAsInt();
     final int maxDay = Arrays.stream(paint).mapToInt(x -> x[1]).max().getAsInt();
@@ -14,16 +24,16 @@ record Event(int day, int index, Type type) {}
     for (int i = 0; i < n; ++i) {
       final int start = paint[i][0];
       final int end = paint[i][1];
-      events.add(new Event(start, i, Type.ENTERING)); // 1 := entering
-      events.add(new Event(end, i, Type.LEAVING));    // -1 := leaving
+      events.add(new Event(start, i, Type.kEntering)); // 1 := entering
+      events.add(new Event(end, i, Type.kLeaving));    // -1 := leaving
     }
 
-    Collections.sort(events, Comparator.comparingInt(Event::day));
+    Collections.sort(events, (a, b) -> a.day - b.day);
 
     int i = 0; // events' index
     for (int day = minDay; day < maxDay; ++day) {
       while (i < events.size() && events.get(i).day == day) {
-        if (events.get(i).type == Type.ENTERING)
+        if (events.get(i).type == Type.kEntering)
           runningIndices.add(events.get(i).index);
         else
           runningIndices.remove(events.get(i).index);
diff --git a/solutions/2158. Amount of New Area Painted Each Day/2158.py b/solutions/2158. Amount of New Area Painted Each Day/2158.py
index 53d9c177533..29c0a669c0e 100644
--- a/solutions/2158. Amount of New Area Painted Each Day/2158.py	
+++ b/solutions/2158. Amount of New Area Painted Each Day/2158.py	
@@ -2,7 +2,7 @@
 
 
 class Solution:
-  def amountPainted(self, paint: list[list[int]]) -> list[int]:
+  def amountPainted(self, paint: List[List[int]]) -> List[int]:
     minDay = min(s for s, e in paint)
     maxDay = max(e for s, e in paint)
     ans = [0] * len(paint)
diff --git a/solutions/216. Combination Sum III/216.cpp b/solutions/216. Combination Sum III/216.cpp
index 2df6e5511b4..88ccc6798f8 100644
--- a/solutions/216. Combination Sum III/216.cpp	
+++ b/solutions/216. Combination Sum III/216.cpp	
@@ -17,7 +17,7 @@ class Solution {
 
     for (int i = s; i <= 9; ++i) {
       path.push_back(i);
-      dfs(k - 1, n - i, i + 1, std::move(path), ans);
+      dfs(k - 1, n - i, i + 1, move(path), ans);
       path.pop_back();
     }
   }
diff --git a/solutions/216. Combination Sum III/216.py b/solutions/216. Combination Sum III/216.py
index c27960db1c3..1b4e2da0ae2 100644
--- a/solutions/216. Combination Sum III/216.py	
+++ b/solutions/216. Combination Sum III/216.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def combinationSum3(self, k: int, n: int) -> list[list[int]]:
+  def combinationSum3(self, k: int, n: int) -> List[List[int]]:
     ans = []
 
-    def dfs(k: int, n: int, s: int, path: list[int]) -> None:
+    def dfs(k: int, n: int, s: int, path: List[int]) -> None:
       if k == 0 and n == 0:
         ans.append(path)
         return
diff --git a/solutions/2161. Partition Array According to Given Pivot/2161.py b/solutions/2161. Partition Array According to Given Pivot/2161.py
index 746b02d746f..51faccbaeb5 100644
--- a/solutions/2161. Partition Array According to Given Pivot/2161.py	
+++ b/solutions/2161. Partition Array According to Given Pivot/2161.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def pivotArray(self, nums: list[int], pivot: int) -> list[int]:
-    return ([num for num in nums if num < pivot] +
-            [num for num in nums if num == pivot] +
-            [num for num in nums if num > pivot])
+  def pivotArray(self, nums: List[int], pivot: int) -> List[int]:
+    return [num for num in nums if num < pivot] + \
+        [num for num in nums if num == pivot] + \
+        [num for num in nums if num > pivot]
diff --git a/solutions/2162. Minimum Cost to Set Cooking Time/2162.py b/solutions/2162. Minimum Cost to Set Cooking Time/2162.py
index 134c45895e8..3de2bac0b9f 100644
--- a/solutions/2162. Minimum Cost to Set Cooking Time/2162.py	
+++ b/solutions/2162. Minimum Cost to Set Cooking Time/2162.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def minCostSetTime(
-      self,
-      startAt: int,
-      moveCost: int,
-      pushCost: int,
-      targetSeconds: int,
-  ) -> int:
+  def minCostSetTime(self, startAt: int, moveCost: int, pushCost: int, targetSeconds: int) -> int:
     ans = math.inf
     mins = 99 if targetSeconds > 5999 else targetSeconds // 60
     secs = targetSeconds - mins * 60
diff --git a/solutions/2163. Minimum Difference in Sums After Removal of Elements/2163.py b/solutions/2163. Minimum Difference in Sums After Removal of Elements/2163.py
index ac951afd3e7..75ff684e304 100644
--- a/solutions/2163. Minimum Difference in Sums After Removal of Elements/2163.py	
+++ b/solutions/2163. Minimum Difference in Sums After Removal of Elements/2163.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumDifference(self, nums: list[int]) -> int:
+  def minimumDifference(self, nums: List[int]) -> int:
     n = len(nums) // 3
     ans = math.inf
     leftSum = 0
diff --git a/solutions/2164. Sort Even and Odd Indices Independently/2164-2.py b/solutions/2164. Sort Even and Odd Indices Independently/2164-2.py
index be819a83a97..1ea2668764a 100644
--- a/solutions/2164. Sort Even and Odd Indices Independently/2164-2.py	
+++ b/solutions/2164. Sort Even and Odd Indices Independently/2164-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sortEvenOdd(self, nums: list[int]) -> list[int]:
+  def sortEvenOdd(self, nums: List[int]) -> List[int]:
     nums[::2] = sorted(nums[::2])
     nums[1::2] = sorted(nums[1::2])[::-1]
     return nums
diff --git a/solutions/2164. Sort Even and Odd Indices Independently/2164.py b/solutions/2164. Sort Even and Odd Indices Independently/2164.py
index 7adcf58a143..34548ea79d1 100644
--- a/solutions/2164. Sort Even and Odd Indices Independently/2164.py	
+++ b/solutions/2164. Sort Even and Odd Indices Independently/2164.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sortEvenOdd(self, nums: list[int]) -> list[int]:
+  def sortEvenOdd(self, nums: List[int]) -> List[int]:
     ans = [0] * len(nums)
     evenCount = collections.Counter(nums[::2])
     oddCount = collections.Counter(nums[1::2])
diff --git a/solutions/2167. Minimum Time to Remove All Cars Containing Illegal Goods/2167-2.py b/solutions/2167. Minimum Time to Remove All Cars Containing Illegal Goods/2167-2.py
index 7f2c8fb498f..77d6e2ab525 100644
--- a/solutions/2167. Minimum Time to Remove All Cars Containing Illegal Goods/2167-2.py	
+++ b/solutions/2167. Minimum Time to Remove All Cars Containing Illegal Goods/2167-2.py	
@@ -5,7 +5,7 @@ def minimumTime(self, s: str) -> int:
     left = 0  # the minimum time to remove the illegal cars so far
 
     for i, c in enumerate(s):
-      left = min(left + int(c) * 2, i + 1)
+      left = min(left + (ord(c) - ord('0')) * 2, i + 1)
       ans = min(ans, left + n - 1 - i)
 
     return ans
diff --git a/solutions/2167. Minimum Time to Remove All Cars Containing Illegal Goods/2167.py b/solutions/2167. Minimum Time to Remove All Cars Containing Illegal Goods/2167.py
index 20b64f9ceb8..053b283970f 100644
--- a/solutions/2167. Minimum Time to Remove All Cars Containing Illegal Goods/2167.py	
+++ b/solutions/2167. Minimum Time to Remove All Cars Containing Illegal Goods/2167.py	
@@ -3,7 +3,7 @@ def minimumTime(self, s: str) -> int:
     n = len(s)
     # left[i] := the minimum time to remove the illegal cars of s[0..i]
     left = [0] * n
-    left[0] = int(s[0])
+    left[0] = ord(s[0]) - ord('0')
     # dp[i] := the minimum time to remove the illegal cars of s[0..i] optimally
     # + the time to remove the illegal cars of s[i + 1..n) consecutively
     # Note that the way to remove the illegal cars in the right part
@@ -14,7 +14,7 @@ def minimumTime(self, s: str) -> int:
     dp[0] = left[0] + n - 1
 
     for i in range(1, n):
-      left[i] = min(left[i - 1] + int(s[i]) * 2, i + 1)
+      left[i] = min(left[i - 1] + (ord(s[i]) - ord('0')) * 2, i + 1)
       dp[i] = min(dp[i], left[i] + n - 1 - i)
 
     return min(dp)
diff --git a/solutions/2168. Unique Substrings With Equal Digit Frequency/2168.cpp b/solutions/2168. Unique Substrings With Equal Digit Frequency/2168.cpp
index e87586380d3..5f471dc88a8 100644
--- a/solutions/2168. Unique Substrings With Equal Digit Frequency/2168.cpp	
+++ b/solutions/2168. Unique Substrings With Equal Digit Frequency/2168.cpp	
@@ -1,62 +1,39 @@
 class Solution {
  public:
   int equalDigitFrequency(string s) {
-    vector<vector<int>> counts;  // counts[i] := the counter map of s[0..i]
-    vector<int> count(10);
-    vector<long> pows{1};  // pows[i] := kBase^i % kHash
-    // hash[i] = the hash of the first i letters of s, where hash[i] =
-    // (26^(i - 1) * s[0] + 26^(i - 2) * s[1] + ... + s[i - 1]) % kHash
-    vector<long> hash{0};
+    const string_view sv(s);
     unordered_set<int> seen;
 
-    for (const char c : s) {
-      ++count[c - '0'];
-      counts.push_back(count);
-      pows.push_back(pows.back() * kBase % kHash);
-      hash.push_back((hash.back() * kBase + val(c)) % kHash);
-    }
-
     for (int i = 0; i < s.length(); ++i)
       for (int j = i; j < s.length(); ++j)
-        if (isSameFreq(counts, i, j))
-          seen.insert(getRollingHash(i, j + 1, hash, pows));
+        if (isUnique(sv.substr(i, j - i + 1)))
+          seen.insert(getRollingHash(sv.substr(i, j - i + 1)));
 
     return seen.size();
   }
 
  private:
-  static constexpr int kMax = 1001;
-  static constexpr int kBase = 11;
-  static constexpr int kHash = 1'000'000'007;
+  static constexpr int power = 11;
+  static constexpr int kMod = 1'000'000'007;
 
-  static constexpr int val(char c) {
-    return c - '0' + 1;
-  }
-
-  // Returns true if s[i..j] has the same digit frequency.j
-  bool isSameFreq(const vector<vector<int>>& counts, int i, int j) {
-    vector<int> count = counts[j];
-    if (i > 0)
-      for (int num = 0; num < 10; ++num)
-        count[num] -= counts[i - 1][num];
-    return equalFreq(count);
+  bool isUnique(const string_view& sv) {
+    vector<int> count(10);
+    int unique = 0;
+    for (const char c : sv)
+      if (++count[c - '0'] == 1)
+        ++unique;
+    const int maxCount = ranges::max(count);
+    return maxCount * unique == sv.length();
   }
 
-  bool equalFreq(const vector<int>& count) {
-    int minfreq = kMax;
-    int maxfreq = 0;
-    for (const int freq : count)
-      if (freq > 0) {
-        minfreq = min(minfreq, freq);
-        maxfreq = max(maxfreq, freq);
-      }
-    return minfreq == maxfreq;
+  int getRollingHash(const string_view& sv) {
+    long hash = 0;
+    for (const char c : sv)
+      hash = (hash * power + val(c)) % kMod;
+    return hash;
   }
 
-  // Returns the rolling hash of s[l..r).
-  int getRollingHash(int l, int r, const vector<long>& hash,
-                     const vector<long>& pows) {
-    const long h = (hash[r] - hash[l] * pows[r - l]) % kHash;
-    return h < 0 ? h + kHash : h;
+  constexpr int val(char c) {
+    return c - '0' + 1;
   }
 };
diff --git a/solutions/2168. Unique Substrings With Equal Digit Frequency/2168.java b/solutions/2168. Unique Substrings With Equal Digit Frequency/2168.java
index 15d574e9c85..35dcccd7b5c 100644
--- a/solutions/2168. Unique Substrings With Equal Digit Frequency/2168.java	
+++ b/solutions/2168. Unique Substrings With Equal Digit Frequency/2168.java	
@@ -1,62 +1,36 @@
 class Solution {
   public int equalDigitFrequency(String s) {
-    final int n = s.length();
-    int[][] counts = new int[n][]; // counts[i] := the counter map of s[0..i]
-    int[] count = new int[10];
-    long[] pows = new long[n + 1]; // pows[i] := BASE^i % HASH
-    // hash[i] = the hash of the first i letters of s, where hash[i] =
-    // (26^(i - 1) * s[0] + 26^(i - 2) * s[1] + ... + s[i - 1]) % HASH
-    long[] hash = new long[n + 1];
     Set<Integer> seen = new HashSet<>();
 
-    pows[0] = 1;
-
-    for (int i = 0; i < n; ++i) {
-      ++count[s.charAt(i) - '0'];
-      counts[i] = count.clone();
-      pows[i + 1] = pows[i] * BASE % HASH;
-      hash[i + 1] = (hash[i] * BASE + val(s.charAt(i))) % HASH;
-    }
-
-    for (int i = 0; i < n; ++i)
-      for (int j = i; j < n; ++j)
-        if (isSameFreq(counts, i, j))
-          seen.add(getRollingHash(i, j + 1, hash, pows));
+    for (int i = 0; i < s.length(); ++i)
+      for (int j = i; j < s.length(); ++j)
+        if (isUnique(s, i, j))
+          seen.add(getRollingHash(s, i, j));
 
     return seen.size();
   }
 
-  private static final int MAX = 1001;
-  private static final int BASE = 11;
-  private static final int HASH = 1_000_000_007;
-
-  private static int val(char c) {
-    return c - '0' + 1;
-  }
+  private static final int power = 11;
+  private static final int kMod = 1_000_000_007;
 
-  // Returns true if s[i..j] has the same digit frequency.j
-  private boolean isSameFreq(int[][] counts, int i, int j) {
-    int[] count = counts[j].clone();
-    if (i > 0)
-      for (int num = 0; num < 10; ++num)
-        count[num] -= counts[i - 1][num];
-    return equalFreq(count);
+  private boolean isUnique(final String s, int i, int j) {
+    int[] count = new int[10];
+    int unique = 0;
+    for (int k = i; k <= j; ++k)
+      if (++count[s.charAt(k) - '0'] == 1)
+        ++unique;
+    final int maxCount = Arrays.stream(count).max().getAsInt();
+    return maxCount * unique == j - i + 1;
   }
 
-  private boolean equalFreq(int[] count) {
-    int minfreq = MAX;
-    int maxfreq = 0;
-    for (final int freq : count)
-      if (freq > 0) {
-        minfreq = Math.min(minfreq, freq);
-        maxfreq = Math.max(maxfreq, freq);
-      }
-    return minfreq == maxfreq;
+  private int getRollingHash(final String s, int i, int j) {
+    long hash = 0;
+    for (int k = i; k <= j; ++k)
+      hash = (hash * power + val(s.charAt(k))) % kMod;
+    return (int) hash;
   }
 
-  // Returns the rolling hash of s[l..r).
-  private int getRollingHash(int l, int r, long[] hash, long[] pows) {
-    final long h = (hash[r] - hash[l] * pows[r - l]) % HASH;
-    return (int) (h < 0 ? h + HASH : h);
+  private int val(char c) {
+    return c - '0' + 1;
   }
 }
diff --git a/solutions/2168. Unique Substrings With Equal Digit Frequency/2168.py b/solutions/2168. Unique Substrings With Equal Digit Frequency/2168.py
index 987da28f096..2987e08049b 100644
--- a/solutions/2168. Unique Substrings With Equal Digit Frequency/2168.py	
+++ b/solutions/2168. Unique Substrings With Equal Digit Frequency/2168.py	
@@ -1,38 +1,31 @@
 class Solution:
   def equalDigitFrequency(self, s: str) -> int:
-    BASE = 11
-    HASH = 1_000_000_007
-    counts: list[dict] = []  # counts[i] := the counter map of s[0..i]
-    count = collections.Counter()
-    pows = [1]  # pows[i] := BASE^i % HASH
-    # hash[i] = the hash of the first i letters of s, where hash[i] =
-    # (26^(i - 1) * s[0] + 26^(i - 2) * s[1] + ... + s[i - 1]) % HASH
-    hash = [0]
+    power = 11
+    kMod = 1_000_000_007
+    seen = set()
 
-    def val(c: str) -> int:
-      return int(c) + 1
+    def isUnique(s: str, i: int, j: int) -> bool:
+      count = [0] * 10
+      unique = 0
+      for k in range(i, j + 1):
+        count[ord(s[k]) - ord('0')] += 1
+        if count[ord(s[k]) - ord('0')] == 1:
+          unique += 1
+      maxCount = max(count)
+      return maxCount * unique == j - i + 1
 
-    for c in s:
-      count[c] += 1
-      counts.append(count.copy())
-      pows.append(pows[-1] * BASE % HASH)
-      hash.append((hash[-1] * BASE + val(c)) % HASH)
+    def getRollingHash(s: str, i: int, j: int) -> int:
+      hash = 0
+      for k in range(i, j + 1):
+        hash = (hash * power + val(s[k])) % kMod
+      return hash
 
-    def getRollingHash(l: int, r: int) -> int:
-      """Returns the rolling hash of s[l..r)."""
-      h = (hash[r] - hash[l] * pows[r - l]) % HASH
-      return h + HASH if h < 0 else h
+    def val(c: str) -> int:
+      return ord(c) - ord('0') + 1
 
-    return len({getRollingHash(i, j + 1)
-                for i in range(len(s))
-                for j in range(i, len(s))
-                if self._isSameFreq(counts, i, j)})
+    for i in range(len(s)):
+      for j in range(i, len(s)):
+        if isUnique(s, i, j):
+          seen.add(getRollingHash(s, i, j))
 
-  def _isSameFreq(self, counts: list[dict], i: int, j: int) -> bool:
-    count = counts[j].copy()
-    if i > 0:
-      for c, freq in counts[i - 1].items():
-        count[c] -= freq
-        if count[c] == 0:
-          del count[c]
-    return min(count.values()) == max(count.values())
+    return len(seen)
diff --git a/solutions/217. Contains Duplicate/217.py b/solutions/217. Contains Duplicate/217.py
index ea61d981fec..2e7f4294f53 100644
--- a/solutions/217. Contains Duplicate/217.py	
+++ b/solutions/217. Contains Duplicate/217.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def containsDuplicate(self, nums: list[int]) -> bool:
+  def containsDuplicate(self, nums: List[int]) -> bool:
     return len(nums) != len(set(nums))
diff --git a/solutions/2170. Minimum Operations to Make the Array Alternating/2170.py b/solutions/2170. Minimum Operations to Make the Array Alternating/2170.py
index bc5d6d860cf..eff502397fc 100644
--- a/solutions/2170. Minimum Operations to Make the Array Alternating/2170.py	
+++ b/solutions/2170. Minimum Operations to Make the Array Alternating/2170.py	
@@ -8,7 +8,7 @@ def __init__(self):
 
 
 class Solution:
-  def minimumOperations(self, nums: list[int]) -> int:
+  def minimumOperations(self, nums: List[int]) -> int:
     # 0 := odd indices, 1 := even indices
     ts = [T() for _ in range(2)]
 
diff --git a/solutions/2171. Removing Minimum Number of Magic Beans/2171.py b/solutions/2171. Removing Minimum Number of Magic Beans/2171.py
index 5375b7ddb5a..096a8f742dd 100644
--- a/solutions/2171. Removing Minimum Number of Magic Beans/2171.py	
+++ b/solutions/2171. Removing Minimum Number of Magic Beans/2171.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumRemoval(self, beans: list[int]) -> int:
+  def minimumRemoval(self, beans: List[int]) -> int:
     n = len(beans)
     summ = sum(beans)
     return min(summ - (n - i) * bean
diff --git a/solutions/2172. Maximum AND Sum of Array/2172.java b/solutions/2172. Maximum AND Sum of Array/2172.java
index e1b924e8570..13904529203 100644
--- a/solutions/2172. Maximum AND Sum of Array/2172.java	
+++ b/solutions/2172. Maximum AND Sum of Array/2172.java	
@@ -5,14 +5,14 @@ public int maximumANDSum(int[] nums, int numSlots) {
     // dp[i] := the maximum value, where i is the bitmask of the selected
     // numbers
     int[] dp = new int[nSelected];
-    int[] arr = Arrays.copyOf(nums, n);
+    int[] A = Arrays.copyOf(nums, n);
 
     for (int mask = 1; mask < nSelected; ++mask) {
       final int selected = Integer.bitCount(mask);
       final int slot = (selected + 1) / 2; // (1, 2) -> 1, (3, 4) -> 2
       for (int i = 0; i < n; ++i)
-        if ((mask >> i & 1) == 1) // Assign `arr[i]` to the `slot`-th slot.
-          dp[mask] = Math.max(dp[mask], dp[mask ^ 1 << i] + (slot & arr[i]));
+        if ((mask >> i & 1) == 1) // Assign `A[i]` to the `slot`-th slot.
+          dp[mask] = Math.max(dp[mask], dp[mask ^ 1 << i] + (slot & A[i]));
     }
 
     return dp[nSelected - 1];
diff --git a/solutions/2172. Maximum AND Sum of Array/2172.py b/solutions/2172. Maximum AND Sum of Array/2172.py
index 462e05b9491..76605b40e70 100644
--- a/solutions/2172. Maximum AND Sum of Array/2172.py	
+++ b/solutions/2172. Maximum AND Sum of Array/2172.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumANDSum(self, nums: list[int], numSlots: int) -> int:
+  def maximumANDSum(self, nums: List[int], numSlots: int) -> int:
     n = 2 * numSlots
     nSelected = 1 << n
     # dp[i] := the maximum value, where i is the bitmask of the selected
diff --git a/solutions/2174. Remove All Ones With Row and Column Flips II/2174-2.cpp b/solutions/2174. Remove All Ones With Row and Column Flips II/2174-2.cpp
index 4097b83a54d..40790379275 100644
--- a/solutions/2174. Remove All Ones With Row and Column Flips II/2174-2.cpp	
+++ b/solutions/2174. Remove All Ones With Row and Column Flips II/2174-2.cpp	
@@ -13,14 +13,14 @@ class Solution {
       for (int i = 0; i < m; ++i)
         for (int j = 0; j < n; ++j)
           if (grid[i][j] == 1) {
-            int newMask = mask;
+            int nextMask = mask;
             // Set the cells in the same row with 0.
             for (int k = 0; k < n; ++k)
-              newMask &= ~(1 << i * n + k);
+              nextMask &= ~(1 << i * n + k);
             // Set the cells in the same column with 0.
             for (int k = 0; k < m; ++k)
-              newMask &= ~(1 << k * n + j);
-            dp[mask] = min(dp[mask], 1 + dp[newMask]);
+              nextMask &= ~(1 << k * n + j);
+            dp[mask] = min(dp[mask], 1 + dp[nextMask]);
           }
 
     return dp[encode(grid, m, n)];
diff --git a/solutions/2174. Remove All Ones With Row and Column Flips II/2174-2.java b/solutions/2174. Remove All Ones With Row and Column Flips II/2174-2.java
index a39b5d9d5fd..1406aab29cb 100644
--- a/solutions/2174. Remove All Ones With Row and Column Flips II/2174-2.java	
+++ b/solutions/2174. Remove All Ones With Row and Column Flips II/2174-2.java	
@@ -13,14 +13,14 @@ public int removeOnes(int[][] grid) {
       for (int i = 0; i < m; ++i)
         for (int j = 0; j < n; ++j)
           if (grid[i][j] == 1) {
-            int newMask = mask;
+            int nextMask = mask;
             // Set the cells in the same row with 0.
             for (int k = 0; k < n; ++k)
-              newMask &= ~(1 << i * n + k);
+              nextMask &= ~(1 << i * n + k);
             // Set the cells in the same column with 0.
             for (int k = 0; k < m; ++k)
-              newMask &= ~(1 << k * n + j);
-            dp[mask] = Math.min(dp[mask], 1 + dp[newMask]);
+              nextMask &= ~(1 << k * n + j);
+            dp[mask] = Math.min(dp[mask], 1 + dp[nextMask]);
           }
 
     return dp[encode(grid, m, n)];
diff --git a/solutions/2174. Remove All Ones With Row and Column Flips II/2174-2.py b/solutions/2174. Remove All Ones With Row and Column Flips II/2174-2.py
index b4ecf5c9168..2f023fdc905 100644
--- a/solutions/2174. Remove All Ones With Row and Column Flips II/2174-2.py	
+++ b/solutions/2174. Remove All Ones With Row and Column Flips II/2174-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def removeOnes(self, grid: list[list[int]]) -> int:
+  def removeOnes(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
     maxMask = 1 << m * n
@@ -12,18 +12,18 @@ def removeOnes(self, grid: list[list[int]]) -> int:
       for i in range(m):
         for j in range(n):
           if grid[i][j] == 1:
-            newMask = mask
+            nextMask = mask
             # Set the cells in the same row with 0.
             for k in range(n):
-              newMask &= ~(1 << i * n + k)
+              nextMask &= ~(1 << i * n + k)
             # Set the cells in the same column with 0.
             for k in range(m):
-              newMask &= ~(1 << k * n + j)
-            dp[mask] = min(dp[mask], 1 + dp[newMask])
+              nextMask &= ~(1 << k * n + j)
+            dp[mask] = min(dp[mask], 1 + dp[nextMask])
 
     return dp[self.encode(grid, m, n)]
 
-  def encode(self, grid: list[list[int]], m: int, n: int) -> int:
+  def encode(self, grid: List[List[int]], m: int, n: int) -> int:
     encoded = 0
     for i in range(m):
       for j in range(n):
diff --git a/solutions/2174. Remove All Ones With Row and Column Flips II/2174.cpp b/solutions/2174. Remove All Ones With Row and Column Flips II/2174.cpp
index f0c06652dc8..a23e484fd84 100644
--- a/solutions/2174. Remove All Ones With Row and Column Flips II/2174.cpp	
+++ b/solutions/2174. Remove All Ones With Row and Column Flips II/2174.cpp	
@@ -19,14 +19,14 @@ class Solution {
     for (int i = 0; i < m; ++i)
       for (int j = 0; j < n; ++j)
         if (mask >> i * n + j & 1) {  // grid[i][j] == 1
-          int newMask = mask;
+          int nextMask = mask;
           // Set the cells in the same row with 0.
           for (int k = 0; k < n; ++k)
-            newMask &= ~(1 << i * n + k);
+            nextMask &= ~(1 << i * n + k);
           // Set the cells in the same column with 0.
           for (int k = 0; k < m; ++k)
-            newMask &= ~(1 << k * n + j);
-          mem[mask] = min(mem[mask], 1 + removeOnes(newMask, m, n, mem));
+            nextMask &= ~(1 << k * n + j);
+          mem[mask] = min(mem[mask], 1 + removeOnes(nextMask, m, n, mem));
         }
 
     return mem[mask];
diff --git a/solutions/2174. Remove All Ones With Row and Column Flips II/2174.java b/solutions/2174. Remove All Ones With Row and Column Flips II/2174.java
index a35c2859f32..0cdf13cd6c5 100644
--- a/solutions/2174. Remove All Ones With Row and Column Flips II/2174.java	
+++ b/solutions/2174. Remove All Ones With Row and Column Flips II/2174.java	
@@ -18,14 +18,14 @@ private int removeOnes(int mask, int m, int n, int[] mem) {
     for (int i = 0; i < m; ++i)
       for (int j = 0; j < n; ++j)
         if ((mask >> i * n + j & 1) == 1) { // grid[i][j] == 1
-          int newMask = mask;
+          int nextMask = mask;
           // Set the cells in the same row with 0.
           for (int k = 0; k < n; ++k)
-            newMask &= ~(1 << i * n + k);
+            nextMask &= ~(1 << i * n + k);
           // Set the cells in the same column with 0.
           for (int k = 0; k < m; ++k)
-            newMask &= ~(1 << k * n + j);
-          mem[mask] = Math.min(mem[mask], 1 + removeOnes(newMask, m, n, mem));
+            nextMask &= ~(1 << k * n + j);
+          mem[mask] = Math.min(mem[mask], 1 + removeOnes(nextMask, m, n, mem));
         }
 
     return mem[mask];
diff --git a/solutions/2174. Remove All Ones With Row and Column Flips II/2174.py b/solutions/2174. Remove All Ones With Row and Column Flips II/2174.py
index 9ab97dc89ea..b20a3de3a8c 100644
--- a/solutions/2174. Remove All Ones With Row and Column Flips II/2174.py	
+++ b/solutions/2174. Remove All Ones With Row and Column Flips II/2174.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def removeOnes(self, grid: list[list[int]]) -> int:
+  def removeOnes(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
 
@@ -15,17 +15,17 @@ def dp(mask: int) -> int:
       for i in range(m):
         for j in range(n):
           if mask >> i * n + j & 1:  # grid[i][j] == 1
-            newMask = mask
+            nextMask = mask
             for k in range(n):  # Set the cells in the same row with 0.
-              newMask &= ~(1 << i * n + k)
+              nextMask &= ~(1 << i * n + k)
             for k in range(m):  # Set the cells in the same column with 0.
-              newMask &= ~(1 << k * n + j)
-            ans = min(ans, 1 + dp(newMask))
+              nextMask &= ~(1 << k * n + j)
+            ans = min(ans, 1 + dp(nextMask))
       return ans
 
     return dp(self.encode(grid, m, n))
 
-  def encode(self, grid: list[list[int]], m: int, n: int) -> int:
+  def encode(self, grid: List[List[int]], m: int, n: int) -> int:
     encoded = 0
     for i in range(m):
       for j in range(n):
diff --git a/solutions/2176. Count Equal and Divisible Pairs in an Array/2176.py b/solutions/2176. Count Equal and Divisible Pairs in an Array/2176.py
index f3c7942aeb7..0f8340cba45 100644
--- a/solutions/2176. Count Equal and Divisible Pairs in an Array/2176.py	
+++ b/solutions/2176. Count Equal and Divisible Pairs in an Array/2176.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countPairs(self, nums: list[int], k: int) -> int:
+  def countPairs(self, nums: List[int], k: int) -> int:
     ans = 0
     numToIndices = collections.defaultdict(list)
 
diff --git a/solutions/2177. Find Three Consecutive Integers That Sum to a Given Number/2177.py b/solutions/2177. Find Three Consecutive Integers That Sum to a Given Number/2177.py
index 21b97d3c1a7..4a15f67f195 100644
--- a/solutions/2177. Find Three Consecutive Integers That Sum to a Given Number/2177.py	
+++ b/solutions/2177. Find Three Consecutive Integers That Sum to a Given Number/2177.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sumOfThree(self, num: int) -> list[int]:
+  def sumOfThree(self, num: int) -> List[int]:
     if num % 3:
       return []
     x = num // 3
diff --git a/solutions/2178. Maximum Split of Positive Even Integers/2178.py b/solutions/2178. Maximum Split of Positive Even Integers/2178.py
index 2937f8fe522..ab5715541d1 100644
--- a/solutions/2178. Maximum Split of Positive Even Integers/2178.py	
+++ b/solutions/2178. Maximum Split of Positive Even Integers/2178.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumEvenSplit(self, finalSum: int) -> list[int]:
+  def maximumEvenSplit(self, finalSum: int) -> List[int]:
     if finalSum % 2 == 1:
       return []
 
diff --git a/solutions/2179. Count Good Triplets in an Array/2179.cpp b/solutions/2179. Count Good Triplets in an Array/2179.cpp
index 123a13be389..09b99515e20 100644
--- a/solutions/2179. Count Good Triplets in an Array/2179.cpp	
+++ b/solutions/2179. Count Good Triplets in an Array/2179.cpp	
@@ -32,10 +32,10 @@ class Solution {
     const int n = nums1.size();
     long ans = 0;
     unordered_map<int, int> numToIndex;
-    vector<int> arr;
-    // leftSmaller[i] := the number of arr[j] < arr[i], where 0 <= j < i
+    vector<int> A;
+    // leftSmaller[i] := the number of A[j] < A[i], where 0 <= j < i
     vector<int> leftSmaller(n);
-    // rightLarger[i] := the number of arr[j] > arr[i], where i < j < n
+    // rightLarger[i] := the number of A[j] > A[i], where i < j < n
     vector<int> rightLarger(n);
     FenwickTree tree1(n);  // Calculates `leftSmaller`.
     FenwickTree tree2(n);  // Calculates `rightLarger`.
@@ -43,19 +43,19 @@ class Solution {
     for (int i = 0; i < n; ++i)
       numToIndex[nums1[i]] = i;
 
-    // Remap each number in `nums2` to the according index in `nums1` as `arr`.
-    // So the problem is to find the number of increasing tripets in `arr`.
+    // Remap each number in `nums2` to the according index in `nums1` as `A`.
+    // Rephrase the problem as finding the number of increasing tripets in `A`.
     for (const int num : nums2)
-      arr.push_back(numToIndex[num]);
+      A.push_back(numToIndex[num]);
 
     for (int i = 0; i < n; ++i) {
-      leftSmaller[i] = tree1.get(arr[i]);
-      tree1.add(arr[i] + 1, 1);
+      leftSmaller[i] = tree1.get(A[i]);
+      tree1.add(A[i] + 1, 1);
     }
 
     for (int i = n - 1; i >= 0; --i) {
-      rightLarger[i] = tree2.get(n) - tree2.get(arr[i]);
-      tree2.add(arr[i] + 1, 1);
+      rightLarger[i] = tree2.get(n) - tree2.get(A[i]);
+      tree2.add(A[i] + 1, 1);
     }
 
     for (int i = 0; i < n; ++i)
diff --git a/solutions/2179. Count Good Triplets in an Array/2179.java b/solutions/2179. Count Good Triplets in an Array/2179.java
index f70339e968d..bc8e3316a8c 100644
--- a/solutions/2179. Count Good Triplets in an Array/2179.java	
+++ b/solutions/2179. Count Good Triplets in an Array/2179.java	
@@ -31,10 +31,10 @@ public long goodTriplets(int[] nums1, int[] nums2) {
     final int n = nums1.length;
     long ans = 0;
     Map<Integer, Integer> numToIndex = new HashMap<>();
-    int[] arr = new int[n];
-    // leftSmaller[i] := the number of arr[j] < arr[i], where 0 <= j < i
+    int[] A = new int[n];
+    // leftSmaller[i] := the number of A[j] < A[i], where 0 <= j < i
     int[] leftSmaller = new int[n];
-    // rightLarger[i] := the number of arr[j] > arr[i], where i < j < n
+    // rightLarger[i] := the number of A[j] > A[i], where i < j < n
     int[] rightLarger = new int[n];
     FenwickTree tree1 = new FenwickTree(n); // Calculates `leftSmaller`.
     FenwickTree tree2 = new FenwickTree(n); // Calculates `rightLarger`.
@@ -42,19 +42,19 @@ public long goodTriplets(int[] nums1, int[] nums2) {
     for (int i = 0; i < n; ++i)
       numToIndex.put(nums1[i], i);
 
-    // Remap each number in `nums2` to the according index in `nums1` as `arr`.
-    // So the problem is to find the number of increasing tripets in `arr`.
+    // Remap each number in `nums2` to the according index in `nums1` as `A`.
+    // Rephrase the problem as finding the number of increasing tripets in `A`.
     for (int i = 0; i < n; ++i)
-      arr[i] = numToIndex.get(nums2[i]);
+      A[i] = numToIndex.get(nums2[i]);
 
     for (int i = 0; i < n; ++i) {
-      leftSmaller[i] = tree1.get(arr[i]);
-      tree1.add(arr[i] + 1, 1);
+      leftSmaller[i] = tree1.get(A[i]);
+      tree1.add(A[i] + 1, 1);
     }
 
     for (int i = n - 1; i >= 0; --i) {
-      rightLarger[i] = tree2.get(n) - tree2.get(arr[i]);
-      tree2.add(arr[i] + 1, 1);
+      rightLarger[i] = tree2.get(n) - tree2.get(A[i]);
+      tree2.add(A[i] + 1, 1);
     }
 
     for (int i = 0; i < n; ++i)
diff --git a/solutions/2179. Count Good Triplets in an Array/2179.py b/solutions/2179. Count Good Triplets in an Array/2179.py
index f55f336756d..8bfb39a61f5 100644
--- a/solutions/2179. Count Good Triplets in an Array/2179.py	
+++ b/solutions/2179. Count Good Triplets in an Array/2179.py	
@@ -20,24 +20,24 @@ def lowbit(i: int) -> int:
 
 
 class Solution:
-  def goodTriplets(self, nums1: list[int], nums2: list[int]) -> int:
+  def goodTriplets(self, nums1: List[int], nums2: List[int]) -> int:
     n = len(nums1)
     numToIndex = {num: i for i, num in enumerate(nums1)}
-    # Remap each number in `nums2` to the according index in `nums1` as `arr`.
-    # So the problem is to find the number of increasing tripets in `arr`.
-    arr = [numToIndex[num] for num in nums2]
-    # leftSmaller[i] := the number of arr[j] < arr[i], where 0 <= j < i
+    # Remap each number in `nums2` to the according index in `nums1` as `A`.
+    # Rephrase the problem as finding the number of increasing tripets in `A`.
+    A = [numToIndex[num] for num in nums2]
+    # leftSmaller[i] := the number of A[j] < A[i], where 0 <= j < i
     leftSmaller = [0] * n
-    # rightLarger[i] := the number of arr[j] > arr[i], where i < j < n
+    # rightLarger[i] := the number of A[j] > A[i], where i < j < n
     rightLarger = [0] * n
     tree1 = FenwickTree(n)  # Calculates `leftSmaller`.
     tree2 = FenwickTree(n)  # Calculates `rightLarger`.
 
-    for i, a in enumerate(arr):
+    for i, a in enumerate(A):
       leftSmaller[i] = tree1.get(a)
       tree1.add(a + 1, 1)
 
-    for i, a in reversed(list(enumerate(arr))):
+    for i, a in reversed(list(enumerate(A))):
       rightLarger[i] = tree2.get(n) - tree2.get(a)
       tree2.add(a + 1, 1)
 
diff --git a/solutions/218. The Skyline Problem/218-2.cpp b/solutions/218. The Skyline Problem/218-2.cpp
index 53d44625e28..823f524674a 100644
--- a/solutions/218. The Skyline Problem/218-2.cpp	
+++ b/solutions/218. The Skyline Problem/218-2.cpp	
@@ -9,8 +9,8 @@ class Solution {
       events.push_back({b[1], -b[2]});  // Minus means leaving.
     }
 
-    ranges::sort(events, ranges::less{}, [](const vector<int>& event) {
-      return pair<int, int>{event[0], -event[1]};
+    ranges::sort(events, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] == b[0] ? a[1] > b[1] : a[0] < b[0];
     });
 
     for (const vector<int>& event : events) {
diff --git a/solutions/218. The Skyline Problem/218.java b/solutions/218. The Skyline Problem/218.java
index 65442b3ea2c..fa064c6c673 100644
--- a/solutions/218. The Skyline Problem/218.java	
+++ b/solutions/218. The Skyline Problem/218.java	
@@ -8,8 +8,8 @@ public List<List<Integer>> getSkyline(int[][] buildings) {
       final int right = buildings[0][1];
       final int height = buildings[0][2];
       List<List<Integer>> ans = new ArrayList<>();
-      ans.add(new ArrayList<>(List.of(left, height)));
-      ans.add(new ArrayList<>(List.of(right, 0)));
+      ans.add(new ArrayList<>(Arrays.asList(left, height)));
+      ans.add(new ArrayList<>(Arrays.asList(right, 0)));
       return ans;
     }
 
@@ -51,6 +51,6 @@ private void addPoint(List<List<Integer>> ans, int x, int y) {
     }
     if (!ans.isEmpty() && ans.get(ans.size() - 1).get(1) == y)
       return;
-    ans.add(new ArrayList<>(List.of(x, y)));
+    ans.add(new ArrayList<>(Arrays.asList(x, y)));
   }
 }
diff --git a/solutions/218. The Skyline Problem/218.py b/solutions/218. The Skyline Problem/218.py
index e637b39b748..60102389ff2 100644
--- a/solutions/218. The Skyline Problem/218.py	
+++ b/solutions/218. The Skyline Problem/218.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getSkyline(self, buildings: list[list[int]]) -> list[list[int]]:
+  def getSkyline(self, buildings: List[List[int]]) -> List[List[int]]:
     n = len(buildings)
     if n == 0:
       return []
@@ -11,8 +11,7 @@ def getSkyline(self, buildings: list[list[int]]) -> list[list[int]]:
     right = self.getSkyline(buildings[n // 2:])
     return self._merge(left, right)
 
-  def _merge(self, left: list[list[int]],
-             right: list[list[int]]) -> list[list[int]]:
+  def _merge(self, left: List[List[int]], right: List[List[int]]) -> List[List[int]]:
     ans = []
     i = 0  # left's index
     j = 0  # right's index
@@ -40,7 +39,7 @@ def _merge(self, left: list[list[int]],
 
     return ans
 
-  def _addPoint(self, ans: list[list[int]], x: int, y: int) -> None:
+  def _addPoint(self, ans: List[List[int]], x: int, y: int) -> None:
     if ans and ans[-1][0] == x:
       ans[-1][1] = y
       return
diff --git a/solutions/2181. Merge Nodes in Between Zeros/2181-2.cpp b/solutions/2181. Merge Nodes in Between Zeros/2181-2.cpp
index 1668c2f49cf..f2b395e6203 100644
--- a/solutions/2181. Merge Nodes in Between Zeros/2181-2.cpp	
+++ b/solutions/2181. Merge Nodes in Between Zeros/2181-2.cpp	
@@ -3,10 +3,10 @@ class Solution {
   ListNode* mergeNodes(ListNode* head) {
     ListNode* curr = head->next;
 
-    while (curr != nullptr) {
+    while (curr) {
       ListNode* running = curr;
       int sum = 0;
-      while (running->val > 0) {
+      while (running->val) {
         sum += running->val;
         running = running->next;
       }
diff --git a/solutions/2181. Merge Nodes in Between Zeros/2181-2.py b/solutions/2181. Merge Nodes in Between Zeros/2181-2.py
index d12582c0e72..04fee1ad371 100644
--- a/solutions/2181. Merge Nodes in Between Zeros/2181-2.py	
+++ b/solutions/2181. Merge Nodes in Between Zeros/2181-2.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def mergeNodes(self, head: ListNode | None) -> ListNode | None:
+  def mergeNodes(self, head: Optional[ListNode]) -> Optional[ListNode]:
     curr = head.next
 
     while curr:
       running = curr
       summ = 0
-      while running.val > 0:
+      while running.val:
         summ += running.val
         running = running.next
 
diff --git a/solutions/2181. Merge Nodes in Between Zeros/2181.py b/solutions/2181. Merge Nodes in Between Zeros/2181.py
index 6405a463d67..342fcb4e661 100644
--- a/solutions/2181. Merge Nodes in Between Zeros/2181.py	
+++ b/solutions/2181. Merge Nodes in Between Zeros/2181.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def mergeNodes(self, head: ListNode | None) -> ListNode | None:
+  def mergeNodes(self, head: Optional[ListNode]) -> Optional[ListNode]:
     if not head:
       return None
     if not head.next.val:
diff --git a/solutions/2183. Count Array Pairs Divisible by K/2183.py b/solutions/2183. Count Array Pairs Divisible by K/2183.py
index 5b77fcbb710..ac3b6b7a7cf 100644
--- a/solutions/2183. Count Array Pairs Divisible by K/2183.py	
+++ b/solutions/2183. Count Array Pairs Divisible by K/2183.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countPairs(self, nums: list[int], k: int) -> int:
+  def countPairs(self, nums: List[int], k: int) -> int:
     ans = 0
     gcds = collections.Counter()
 
diff --git a/solutions/2184. Number of Ways to Build Sturdy Brick Wall/2184.cpp b/solutions/2184. Number of Ways to Build Sturdy Brick Wall/2184.cpp
index 2dcfcdf27d0..cbbcd410bd5 100644
--- a/solutions/2184. Number of Ways to Build Sturdy Brick Wall/2184.cpp	
+++ b/solutions/2184. Number of Ways to Build Sturdy Brick Wall/2184.cpp	
@@ -25,7 +25,7 @@ class Solution {
           newDp[i] += dp[v];
           newDp[i] %= kMod;
         }
-      dp = std::move(newDp);
+      dp = move(newDp);
     }
 
     return accumulate(dp.begin(), dp.end(), 0L) % kMod;
diff --git a/solutions/2184. Number of Ways to Build Sturdy Brick Wall/2184.java b/solutions/2184. Number of Ways to Build Sturdy Brick Wall/2184.java
index b31bb87eb65..7645a7a661e 100644
--- a/solutions/2184. Number of Ways to Build Sturdy Brick Wall/2184.java	
+++ b/solutions/2184. Number of Ways to Build Sturdy Brick Wall/2184.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int buildWall(int height, int width, int[] bricks) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // Stores the valid rows in bitmask.
     List<Integer> rows = new ArrayList<>();
     buildRows(width, bricks, 0, rows);
@@ -12,7 +12,9 @@ public int buildWall(int height, int width, int[] bricks) {
     List<Integer>[] graph = new List[n];
 
     Arrays.fill(dp, 1);
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int i = 0; i < n; ++i)
       for (int j = 0; j < n; ++j)
@@ -24,12 +26,12 @@ public int buildWall(int height, int width, int[] bricks) {
       for (int i = 0; i < n; ++i)
         for (final int v : graph[i]) {
           newDp[i] += dp[v];
-          newDp[i] %= MOD;
+          newDp[i] %= kMod;
         }
       dp = newDp;
     }
 
-    return (int) (Arrays.stream(dp).sum() % MOD);
+    return (int) (Arrays.stream(dp).sum() % kMod);
   }
 
   private void buildRows(int width, int[] bricks, int path, List<Integer> rows) {
diff --git a/solutions/2184. Number of Ways to Build Sturdy Brick Wall/2184.py b/solutions/2184. Number of Ways to Build Sturdy Brick Wall/2184.py
index 763c7aab28e..04b577ec1b6 100644
--- a/solutions/2184. Number of Ways to Build Sturdy Brick Wall/2184.py	
+++ b/solutions/2184. Number of Ways to Build Sturdy Brick Wall/2184.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def buildWall(self, height: int, width: int, bricks: list[int]) -> int:
-    MOD = 1_000_000_007
+  def buildWall(self, height: int, width: int, bricks: List[int]) -> int:
+    kMod = 1_000_000_007
     # Stores the valid rows in bitmask.
     rows = []
     self._buildRows(width, bricks, 0, rows)
@@ -21,18 +21,12 @@ def buildWall(self, height: int, width: int, bricks: list[int]) -> int:
       for i in range(n):
         for v in graph[i]:
           newDp[i] += dp[v]
-          newDp[i] %= MOD
+          newDp[i] %= kMod
       dp = newDp
 
-    return sum(dp) % MOD
+    return sum(dp) % kMod
 
-  def _buildRows(
-      self,
-      width: int,
-      bricks: list[int],
-      path: int,
-      rows: list[int],
-  ):
+  def _buildRows(self, width: int, bricks: List[int], path: int, rows: List[int]):
     for brick in bricks:
       if brick == width:
         rows.append(path)
diff --git a/solutions/2185. Counting Words With a Given Prefix/2185.py b/solutions/2185. Counting Words With a Given Prefix/2185.py
index 726d3d9eb66..60675f7fd17 100644
--- a/solutions/2185. Counting Words With a Given Prefix/2185.py	
+++ b/solutions/2185. Counting Words With a Given Prefix/2185.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def prefixCount(self, words: list[str], pref: str) -> int:
+  def prefixCount(self, words: List[str], pref: str) -> int:
     return sum(word.startswith(pref) for word in words)
diff --git a/solutions/2186. Minimum Number of Steps to Make Two Strings Anagram II/2186.cpp b/solutions/2186. Minimum Number of Steps to Make Two Strings Anagram II/2186.cpp
index bdb8ed47aae..18b7ee1cd4d 100644
--- a/solutions/2186. Minimum Number of Steps to Make Two Strings Anagram II/2186.cpp	
+++ b/solutions/2186. Minimum Number of Steps to Make Two Strings Anagram II/2186.cpp	
@@ -10,6 +10,6 @@ class Solution {
       --count[c - 'a'];
 
     return accumulate(count.begin(), count.end(), 0,
-                      [](int acc, int c) { return acc + abs(c); });
+                      [](int subtotal, int c) { return subtotal + abs(c); });
   }
 };
diff --git a/solutions/2187. Minimum Time to Complete Trips/2187.cpp b/solutions/2187. Minimum Time to Complete Trips/2187.cpp
index 1209b8cd3c2..69ad592997a 100644
--- a/solutions/2187. Minimum Time to Complete Trips/2187.cpp	
+++ b/solutions/2187. Minimum Time to Complete Trips/2187.cpp	
@@ -17,6 +17,6 @@ class Solution {
 
   long numTrips(const vector<int>& times, long m) {
     return accumulate(times.begin(), times.end(), 0L,
-                      [&](long acc, int t) { return acc + m / t; });
+                      [&](long subtotal, int t) { return subtotal + m / t; });
   }
 };
diff --git a/solutions/2187. Minimum Time to Complete Trips/2187.java b/solutions/2187. Minimum Time to Complete Trips/2187.java
index ba893da645c..87fbb0ee424 100644
--- a/solutions/2187. Minimum Time to Complete Trips/2187.java	
+++ b/solutions/2187. Minimum Time to Complete Trips/2187.java	
@@ -1,7 +1,7 @@
 class Solution {
   public long minimumTime(int[] time, int totalTrips) {
     long l = 1;
-    long r = (long) Arrays.stream(time).min().getAsInt() * totalTrips;
+    long r = Arrays.stream(time).min().getAsInt() * (long) totalTrips;
 
     while (l < r) {
       final long m = (l + r) / 2;
diff --git a/solutions/2187. Minimum Time to Complete Trips/2187.py b/solutions/2187. Minimum Time to Complete Trips/2187.py
index a6709e3a795..4bfee060a3d 100644
--- a/solutions/2187. Minimum Time to Complete Trips/2187.py	
+++ b/solutions/2187. Minimum Time to Complete Trips/2187.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumTime(self, time: list[int], totalTrips: int) -> int:
+  def minimumTime(self, time: List[int], totalTrips: int) -> int:
     l = 1
     r = min(time) * totalTrips
 
diff --git a/solutions/2188. Minimum Time to Finish the Race/2188.py b/solutions/2188. Minimum Time to Finish the Race/2188.py
index 17a63c5a454..c7251ed72c1 100644
--- a/solutions/2188. Minimum Time to Finish the Race/2188.py	
+++ b/solutions/2188. Minimum Time to Finish the Race/2188.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minimumFinishTime(
-      self,
-      tires: list[list[int]],
-      changeTime: int,
-      numLaps: int,
-  ) -> int:
+  def minimumFinishTime(self, tires: List[List[int]], changeTime: int, numLaps: int) -> int:
     # singleTire[i] := the minimum time to finish i laps without changing tire
     singleTire = [math.inf] * (numLaps + 1)
     # dp[i] := the minimum time to finish i laps
diff --git a/solutions/219. Contains Duplicate II/219.py b/solutions/219. Contains Duplicate II/219.py
index 966db58d1f1..1d01e1640c3 100644
--- a/solutions/219. Contains Duplicate II/219.py	
+++ b/solutions/219. Contains Duplicate II/219.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def containsNearbyDuplicate(self, nums: list[int], k: int) -> bool:
+  def containsNearbyDuplicate(self, nums: List[int], k: int) -> bool:
     seen = set()
 
     for i, num in enumerate(nums):
diff --git a/solutions/2190. Most Frequent Number Following Key In an Array/2190.py b/solutions/2190. Most Frequent Number Following Key In an Array/2190.py
index 6a99f24aa1f..2807af78cc4 100644
--- a/solutions/2190. Most Frequent Number Following Key In an Array/2190.py	
+++ b/solutions/2190. Most Frequent Number Following Key In an Array/2190.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def mostFrequent(self, nums: list[int], key: int) -> int:
+  def mostFrequent(self, nums: List[int], key: int) -> int:
     count = collections.Counter()
 
-    for a, b in itertools.pairwise(nums):
+    for a, b in zip(nums, nums[1:]):
       if a == key:
         count[b] += 1
 
-    return max(count, key=lambda num: count[num])
+    return max(count, key=lambda k: count[k])
diff --git a/solutions/2191. Sort the Jumbled Numbers/2191.java b/solutions/2191. Sort the Jumbled Numbers/2191.java
index cd4c6d08e81..64fb559fbb0 100644
--- a/solutions/2191. Sort the Jumbled Numbers/2191.java	
+++ b/solutions/2191. Sort the Jumbled Numbers/2191.java	
@@ -6,8 +6,7 @@ public int[] sortJumbled(int[] mapping, int[] nums) {
     for (int i = 0; i < nums.length; ++i)
       A.add(new int[] {getMapped(nums[i], mapping), i, nums[i]});
 
-    Collections.sort(
-        A, Comparator.comparingInt((int[] a) -> a[0]).thenComparingInt((int[] a) -> a[1]));
+    Collections.sort(A, (a, b) -> a[0] == b[0] ? a[1] - b[1] : a[0] - b[0]);
     return A.stream().mapToInt(a -> a[2]).toArray();
   }
 
diff --git a/solutions/2191. Sort the Jumbled Numbers/2191.py b/solutions/2191. Sort the Jumbled Numbers/2191.py
index 74628aeb8ec..d47e7727e59 100644
--- a/solutions/2191. Sort the Jumbled Numbers/2191.py	
+++ b/solutions/2191. Sort the Jumbled Numbers/2191.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def sortJumbled(self, mapping: list[int], nums: list[int]) -> list[int]:
+  def sortJumbled(self, mapping: List[int], nums: List[int]) -> List[int]:
     def getMapped(num: int) -> int:
       mapped = []
       for c in str(num):
-        mapped.append(str(mapping[int(c)]))
+        mapped.append(str(mapping[ord(c) - ord('0')]))
       return int(''.join(mapped))
     A = [(getMapped(num), i, num) for i, num in enumerate(nums)]
     return [num for _, i, num in sorted(A)]
diff --git a/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192-2.cpp b/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192-2.cpp
index 49f3a2a5eb3..36cf6e07461 100644
--- a/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192-2.cpp	
+++ b/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192-2.cpp	
@@ -20,7 +20,7 @@ class Solution {
       if (inDegrees[i] == 0)
         q.push(i);
 
-    while (!q.empty())
+    while (!q.empty()) {
       for (int sz = q.size(); sz > 0; --sz) {
         const int u = q.front();
         q.pop();
@@ -32,6 +32,7 @@ class Solution {
             q.push(v);
         }
       }
+    }
 
     for (const set<int>& nodes : ancestors)
       ans.push_back({nodes.begin(), nodes.end()});
diff --git a/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192-2.java b/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192-2.java
index c714fb40aaa..6daea16a43e 100644
--- a/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192-2.java	
+++ b/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192-2.java	
@@ -24,7 +24,7 @@ public List<List<Integer>> getAncestors(int n, int[][] edges) {
                            .boxed()
                            .collect(Collectors.toCollection(ArrayDeque::new));
 
-    while (!q.isEmpty())
+    while (!q.isEmpty()) {
       for (int sz = q.size(); sz > 0; --sz) {
         final int u = q.poll();
         for (final int v : graph[u]) {
@@ -34,6 +34,7 @@ public List<List<Integer>> getAncestors(int n, int[][] edges) {
             q.offer(v);
         }
       }
+    }
 
     for (TreeSet<Integer> nodes : ancestors)
       ans.add(new ArrayList<>(nodes));
diff --git a/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192-2.py b/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192-2.py
index ed9d2caea00..62db54928a1 100644
--- a/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192-2.py	
+++ b/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getAncestors(self, n: int, edges: list[list[int]]) -> list[list[int]]:
+  def getAncestors(self, n: int, edges: List[List[int]]) -> List[List[int]]:
     ans = [set() for _ in range(n)]
     graph = [[] for _ in range(n)]
     inDegrees = [0] * n
diff --git a/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192.cpp b/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192.cpp
index 9b62cbf2bee..db46a73b0ba 100644
--- a/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192.cpp	
+++ b/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192.cpp	
@@ -24,7 +24,7 @@ class Solution {
       if (seen[v])
         continue;
       ans[v].push_back(ancestor);
-      dfs(graph, v, ancestor, std::move(seen), ans);
+      dfs(graph, v, ancestor, move(seen), ans);
     }
   }
 };
diff --git a/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192.py b/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192.py
index 960724087d0..499cfe2b32b 100644
--- a/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192.py	
+++ b/solutions/2192. All Ancestors of a Node in a Directed Acyclic Graph/2192.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def getAncestors(self, n: int, edges: list[list[int]]) -> list[list[int]]:
+  def getAncestors(self, n: int, edges: List[List[int]]) -> List[List[int]]:
     ans = [[] for _ in range(n)]
     graph = [[] for _ in range(n)]
 
     for u, v in edges:
       graph[u].append(v)
 
-    def dfs(u: int, ancestor: int, seen: set[int]) -> None:
+    def dfs(u: int, ancestor: int, seen: Set[int]) -> None:
       seen.add(u)
       for v in graph[u]:
         if v in seen:
diff --git a/solutions/2194. Cells in a Range on an Excel Sheet/2194.py b/solutions/2194. Cells in a Range on an Excel Sheet/2194.py
index 46c4ce5339a..58adc917507 100644
--- a/solutions/2194. Cells in a Range on an Excel Sheet/2194.py	
+++ b/solutions/2194. Cells in a Range on an Excel Sheet/2194.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def cellsInRange(self, s: str) -> list[str]:
+  def cellsInRange(self, s: str) -> List[str]:
     ans = []
     startCol, startRow, _, endCol, endRow = s
 
diff --git a/solutions/2195. Append K Integers With Minimal Sum/2195.py b/solutions/2195. Append K Integers With Minimal Sum/2195.py
index d5d8fd2c60c..5567d5f0c77 100644
--- a/solutions/2195. Append K Integers With Minimal Sum/2195.py	
+++ b/solutions/2195. Append K Integers With Minimal Sum/2195.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimalKSum(self, nums: list[int], k: int) -> int:
+  def minimalKSum(self, nums: List[int], k: int) -> int:
     ans = 0
     nums.append(0)
     nums.sort()
diff --git a/solutions/2196. Create Binary Tree From Descriptions/2196.py b/solutions/2196. Create Binary Tree From Descriptions/2196.py
index 24f8ee99d2f..007f4d78cae 100644
--- a/solutions/2196. Create Binary Tree From Descriptions/2196.py	
+++ b/solutions/2196. Create Binary Tree From Descriptions/2196.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def createBinaryTree(self, descriptions: list[list[int]]) -> TreeNode | None:
+  def createBinaryTree(self, descriptions: List[List[int]]) -> Optional[TreeNode]:
     children = set()
     valToNode = {}
 
diff --git a/solutions/2197. Replace Non-Coprime Numbers in Array/2197.py b/solutions/2197. Replace Non-Coprime Numbers in Array/2197.py
index 5e73bce6c58..729bf261132 100644
--- a/solutions/2197. Replace Non-Coprime Numbers in Array/2197.py	
+++ b/solutions/2197. Replace Non-Coprime Numbers in Array/2197.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def replaceNonCoprimes(self, nums: list[int]) -> list[int]:
+  def replaceNonCoprimes(self, nums: List[int]) -> List[int]:
     ans = []
 
     for num in nums:
diff --git a/solutions/2198. Number of Single Divisor Triplets/2198.java b/solutions/2198. Number of Single Divisor Triplets/2198.java
index e49e045aedd..7bfe9ce2ba0 100644
--- a/solutions/2198. Number of Single Divisor Triplets/2198.java	
+++ b/solutions/2198. Number of Single Divisor Triplets/2198.java	
@@ -1,15 +1,15 @@
 class Solution {
   public long singleDivisorTriplet(int[] nums) {
-    final int MAX = 100;
+    final int kMax = 100;
     long ans = 0;
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (final int num : nums)
       ++count[num];
 
-    for (int a = 1; a <= MAX; ++a)
-      for (int b = a; count[a] > 0 && b <= MAX; ++b)
-        for (int c = b; count[b] > 0 && c <= MAX; ++c) {
+    for (int a = 1; a <= kMax; ++a)
+      for (int b = a; count[a] > 0 && b <= kMax; ++b)
+        for (int c = b; count[b] > 0 && c <= kMax; ++c) {
           final int sum = a + b + c;
           if (divisible(sum, a) + divisible(sum, b) + divisible(sum, c) != 1)
             continue;
diff --git a/solutions/2198. Number of Single Divisor Triplets/2198.py b/solutions/2198. Number of Single Divisor Triplets/2198.py
index d012610ea41..7c398d949c8 100644
--- a/solutions/2198. Number of Single Divisor Triplets/2198.py	
+++ b/solutions/2198. Number of Single Divisor Triplets/2198.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def singleDivisorTriplet(self, nums: list[int]) -> int:
+  def singleDivisorTriplet(self, nums: List[int]) -> int:
     ans = 0
     count = collections.Counter(nums)
 
diff --git a/solutions/22. Generate Parentheses/22.cpp b/solutions/22. Generate Parentheses/22.cpp
index c8724c1c917..9d5fae5fe07 100644
--- a/solutions/22. Generate Parentheses/22.cpp	
+++ b/solutions/22. Generate Parentheses/22.cpp	
@@ -15,12 +15,12 @@ class Solution {
 
     if (l > 0) {
       path.push_back('(');
-      dfs(l - 1, r, std::move(path), ans);
+      dfs(l - 1, r, move(path), ans);
       path.pop_back();
     }
     if (l < r) {
       path.push_back(')');
-      dfs(l, r - 1, std::move(path), ans);
+      dfs(l, r - 1, move(path), ans);
       path.pop_back();
     }
   }
diff --git a/solutions/22. Generate Parentheses/22.py b/solutions/22. Generate Parentheses/22.py
index 82f1c8e3e35..4ae6e8ff488 100644
--- a/solutions/22. Generate Parentheses/22.py	
+++ b/solutions/22. Generate Parentheses/22.py	
@@ -2,7 +2,7 @@ class Solution:
   def generateParenthesis(self, n):
     ans = []
 
-    def dfs(l: int, r: int, s: list[str]) -> None:
+    def dfs(l: int, r: int, s: List[str]) -> None:
       if l == 0 and r == 0:
         ans.append(''.join(s))
       if l > 0:
diff --git a/solutions/220. Contains Duplicate III/220-2.py b/solutions/220. Contains Duplicate III/220-2.py
index 0eb69aae289..2e1f8fa4598 100644
--- a/solutions/220. Contains Duplicate III/220-2.py	
+++ b/solutions/220. Contains Duplicate III/220-2.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def containsNearbyAlmostDuplicate(
-      self,
-      nums: list[int],
-      indexDiff: int,
-      valueDiff: int,
-  ) -> bool:
+  def containsNearbyAlmostDuplicate(self, nums: List[int], indexDiff: int, valueDiff: int) -> bool:
     if not nums or indexDiff <= 0 or valueDiff < 0:
       return False
 
diff --git a/solutions/2200. Find All K-Distant Indices in an Array/2200.py b/solutions/2200. Find All K-Distant Indices in an Array/2200.py
index 6c9f4041d55..41e98c03e5a 100644
--- a/solutions/2200. Find All K-Distant Indices in an Array/2200.py	
+++ b/solutions/2200. Find All K-Distant Indices in an Array/2200.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findKDistantIndices(self, nums: list[int], key: int, k: int) -> list[int]:
+  def findKDistantIndices(self, nums: List[int], key: int, k: int) -> List[int]:
     n = len(nums)
     ans = []
 
diff --git a/solutions/2201. Count Artifacts That Can Be Extracted/2201.py b/solutions/2201. Count Artifacts That Can Be Extracted/2201.py
index c618b865f0f..18f4b776241 100644
--- a/solutions/2201. Count Artifacts That Can Be Extracted/2201.py	
+++ b/solutions/2201. Count Artifacts That Can Be Extracted/2201.py	
@@ -1,13 +1,8 @@
 class Solution:
-  def digArtifacts(
-      self,
-      n: int,
-      artifacts: list[list[int]],
-      dig: list[list[int]],
-  ) -> int:
+  def digArtifacts(self, n: int, artifacts: List[List[int]], dig: List[List[int]]) -> int:
     digged = set((r, c) for r, c in dig)
 
-    def canExtract(a: list[int]) -> bool:
+    def canExtract(a: List[int]) -> bool:
       for i in range(a[0], a[2] + 1):
         for j in range(a[1], a[3] + 1):
           if (i, j) not in digged:
diff --git a/solutions/2202. Maximize the Topmost Element After K Moves/2202.java b/solutions/2202. Maximize the Topmost Element After K Moves/2202.java
index cba9118d8eb..57192bce426 100644
--- a/solutions/2202. Maximize the Topmost Element After K Moves/2202.java	
+++ b/solutions/2202. Maximize the Topmost Element After K Moves/2202.java	
@@ -9,13 +9,13 @@ public int maximumTop(int[] nums, int k) {
     if (n == 1)
       return k % 2 == 0 ? nums[0] : -1;
     // Take min(n, k - 1) elements and put the largest one back.
-    final int mx = firstMAX(nums, k - 1);
+    final int mx = firstKMax(nums, k - 1);
     if (k >= n)
       return mx;
     return Math.max(mx, nums[k]);
   }
 
-  private int firstMAX(int[] nums, int k) {
+  private int firstKMax(int[] nums, int k) {
     int mx = 0;
     for (int i = 0; i < nums.length && i < k; ++i)
       mx = Math.max(mx, nums[i]);
diff --git a/solutions/2202. Maximize the Topmost Element After K Moves/2202.py b/solutions/2202. Maximize the Topmost Element After K Moves/2202.py
index 4d51657be93..e5bed15a7d2 100644
--- a/solutions/2202. Maximize the Topmost Element After K Moves/2202.py	
+++ b/solutions/2202. Maximize the Topmost Element After K Moves/2202.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumTop(self, nums: list[int], k: int) -> int:
+  def maximumTop(self, nums: List[int], k: int) -> int:
     n = len(nums)
     # After taking k elements, if we're left something, then we return nums[k]
     # Otherwise, return -1.
diff --git a/solutions/2203. Minimum Weighted Subgraph With the Required Paths/2203.cpp b/solutions/2203. Minimum Weighted Subgraph With the Required Paths/2203.cpp
index 75947d83b1a..c8603c06076 100644
--- a/solutions/2203. Minimum Weighted Subgraph With the Required Paths/2203.cpp	
+++ b/solutions/2203. Minimum Weighted Subgraph With the Required Paths/2203.cpp	
@@ -32,10 +32,10 @@ class Solution {
 
   vector<long> dijkstra(const vector<vector<pair<int, int>>>& graph, int src) {
     vector<long> dist(graph.size(), kMax);
-
-    dist[src] = 0;
     using P = pair<long, int>;  // (d, u)
     priority_queue<P, vector<P>, greater<>> minHeap;
+
+    dist[src] = 0;
     minHeap.emplace(dist[src], src);
 
     while (!minHeap.empty()) {
diff --git a/solutions/2203. Minimum Weighted Subgraph With the Required Paths/2203.java b/solutions/2203. Minimum Weighted Subgraph With the Required Paths/2203.java
index 8f06ea9accb..e727a9fe3ec 100644
--- a/solutions/2203. Minimum Weighted Subgraph With the Required Paths/2203.java	
+++ b/solutions/2203. Minimum Weighted Subgraph With the Required Paths/2203.java	
@@ -19,30 +19,27 @@ public long minimumWeight(int n, int[][] edges, int src1, int src2, int dest) {
     long[] fromSrc1 = dijkstra(graph, src1);
     long[] fromSrc2 = dijkstra(graph, src2);
     long[] fromDest = dijkstra(reversedGraph, dest);
-    long ans = MAX;
+    long ans = kMax;
 
     for (int i = 0; i < n; ++i) {
-      if (fromSrc1[i] == MAX || fromSrc2[i] == MAX || fromDest[i] == MAX)
+      if (fromSrc1[i] == kMax || fromSrc2[i] == kMax || fromDest[i] == kMax)
         continue;
       ans = Math.min(ans, fromSrc1[i] + fromSrc2[i] + fromDest[i]);
     }
 
-    return ans == MAX ? -1 : ans;
+    return ans == kMax ? -1 : ans;
   }
 
-  private static long MAX = (long) 1e10;
+  private static long kMax = (long) 1e10;
 
   private long[] dijkstra(List<Pair<Integer, Integer>>[] graph, int src) {
     long[] dist = new long[graph.length];
-    Arrays.fill(dist, MAX);
+    Arrays.fill(dist, kMax);
+    // (d, u)
+    Queue<Pair<Long, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
 
     dist[src] = 0;
-    Queue<Pair<Long, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingLong(Pair::getKey)) {
-          {
-            offer(new Pair<>(dist[src], src)); // (d, u)
-          }
-        };
+    minHeap.offer(new Pair<>(dist[src], src));
 
     while (!minHeap.isEmpty()) {
       final long d = minHeap.peek().getKey();
diff --git a/solutions/2203. Minimum Weighted Subgraph With the Required Paths/2203.py b/solutions/2203. Minimum Weighted Subgraph With the Required Paths/2203.py
index 0a226940d4b..15a8552bd95 100644
--- a/solutions/2203. Minimum Weighted Subgraph With the Required Paths/2203.py	
+++ b/solutions/2203. Minimum Weighted Subgraph With the Required Paths/2203.py	
@@ -1,12 +1,5 @@
 class Solution:
-  def minimumWeight(
-      self,
-      n: int,
-      edges: list[list[int]],
-      src1: int,
-      src2: int,
-      dest: int,
-  ) -> int:
+  def minimumWeight(self, n: int, edges: List[List[int]], src1: int, src2: int, dest: int) -> int:
     graph = [[] for _ in range(n)]
     reversedGraph = [[] for _ in range(n)]
 
@@ -20,11 +13,7 @@ def minimumWeight(
     minWeight = min(a + b + c for a, b, c in zip(fromSrc1, fromSrc2, fromDest))
     return -1 if minWeight == math.inf else minWeight
 
-  def _dijkstra(
-      self,
-      graph: list[list[tuple[int, int]]],
-      src: int,
-  ) -> list[int]:
+  def _dijkstra(self, graph: List[List[Tuple[int, int]]], src: int) -> List[int]:
     dist = [math.inf] * len(graph)
 
     dist[src] = 0
diff --git a/solutions/2204. Distance to a Cycle in Undirected Graph/2204.cpp b/solutions/2204. Distance to a Cycle in Undirected Graph/2204.cpp
index 92977b233e7..ded5e8c202d 100644
--- a/solutions/2204. Distance to a Cycle in Undirected Graph/2204.cpp	
+++ b/solutions/2204. Distance to a Cycle in Undirected Graph/2204.cpp	
@@ -23,7 +23,9 @@ class Solution {
       seen[u] = true;
     }
 
-    for (int step = 1; !q.empty(); ++step)
+    int dist = 0;
+    while (!q.empty()) {
+      ++dist;
       for (int sz = q.size(); sz > 0; --sz) {
         const int u = q.front();
         q.pop();
@@ -32,9 +34,10 @@ class Solution {
             continue;
           q.push(v);
           seen[v] = true;
-          ans[v] = step;
+          ans[v] = dist;
         }
       }
+    }
 
     return ans;
   }
@@ -55,8 +58,7 @@ class Solution {
       // Visited || parent (that's why NO_RANK = -2 instead of -1)
       if (rank[v] == rank.size() || rank[v] == currRank - 1)
         continue;
-      const int nextRank =
-          getRank(graph, v, currRank + 1, std::move(rank), cycle);
+      const int nextRank = getRank(graph, v, currRank + 1, move(rank), cycle);
       // NextRank should > currRank if there's no cycle
       if (nextRank <= currRank)
         cycle.push_back(v);
diff --git a/solutions/2204. Distance to a Cycle in Undirected Graph/2204.java b/solutions/2204. Distance to a Cycle in Undirected Graph/2204.java
index 247e261ab2d..7cdb2db2e92 100644
--- a/solutions/2204. Distance to a Cycle in Undirected Graph/2204.java	
+++ b/solutions/2204. Distance to a Cycle in Undirected Graph/2204.java	
@@ -2,7 +2,9 @@ class Solution {
   public int[] distanceToCycle(int n, int[][] edges) {
     int[] ans = new int[n];
     List<Integer>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
@@ -23,7 +25,9 @@ public int[] distanceToCycle(int n, int[][] edges) {
     for (final int u : cycle)
       seen[u] = true;
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    int dist = 0;
+    while (!q.isEmpty()) {
+      ++dist;
       for (int sz = q.size(); sz > 0; --sz) {
         final int u = q.poll();
         for (final int v : graph[u]) {
@@ -31,9 +35,10 @@ public int[] distanceToCycle(int n, int[][] edges) {
             continue;
           q.offer(v);
           seen[v] = true;
-          ans[v] = step;
+          ans[v] = dist;
         }
       }
+    }
 
     return ans;
   }
diff --git a/solutions/2204. Distance to a Cycle in Undirected Graph/2204.py b/solutions/2204. Distance to a Cycle in Undirected Graph/2204.py
index d9660453be0..0b84d2dafb2 100644
--- a/solutions/2204. Distance to a Cycle in Undirected Graph/2204.py	
+++ b/solutions/2204. Distance to a Cycle in Undirected Graph/2204.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def distanceToCycle(self, n: int, edges: list[list[int]]) -> list[int]:
+  def distanceToCycle(self, n: int, edges: List[List[int]]) -> List[int]:
     ans = [0] * n
     graph = [[] for _ in range(n)]
 
@@ -10,7 +10,7 @@ def distanceToCycle(self, n: int, edges: list[list[int]]) -> list[int]:
     NO_RANK = -2
 
     # The minRank that u can reach with forward edges
-    def getRank(u: int, currRank: int, rank: list[int]) -> int:
+    def getRank(u: int, currRank: int, rank: List[int]) -> int:
       if rank[u] != NO_RANK:  # The rank is already determined
         return rank[u]
 
@@ -38,8 +38,9 @@ def getRank(u: int, currRank: int, rank: list[int]) -> int:
     q = collections.deque(cycle)
     seen = set(cycle)
 
-    step = 1
+    dist = 0
     while q:
+      dist += 1
       for _ in range(len(q)):
         u = q.popleft()
         for v in graph[u]:
@@ -47,7 +48,6 @@ def getRank(u: int, currRank: int, rank: list[int]) -> int:
             continue
           q.append(v)
           seen.add(v)
-          ans[v] = step
-      step += 1
+          ans[v] = dist
 
     return ans
diff --git a/solutions/2206. Divide Array Into Equal Pairs/2206.py b/solutions/2206. Divide Array Into Equal Pairs/2206.py
index 86e8fbe813e..ffd328dc2f0 100644
--- a/solutions/2206. Divide Array Into Equal Pairs/2206.py	
+++ b/solutions/2206. Divide Array Into Equal Pairs/2206.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def divideArray(self, nums: list[int]) -> bool:
+  def divideArray(self, nums: List[int]) -> bool:
     return all(value % 2 == 0 for value in collections.Counter(nums).values())
diff --git a/solutions/2208. Minimum Operations to Halve Array Sum/2208.py b/solutions/2208. Minimum Operations to Halve Array Sum/2208.py
index cc5239d8d12..77524566955 100644
--- a/solutions/2208. Minimum Operations to Halve Array Sum/2208.py	
+++ b/solutions/2208. Minimum Operations to Halve Array Sum/2208.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def halveArray(self, nums: list[int]) -> int:
+  def halveArray(self, nums: List[int]) -> int:
     halfSum = sum(nums) / 2
     ans = 0
     runningSum = 0.0
diff --git a/solutions/2209. Minimum White Tiles After Covering With Carpets/2209-2.py b/solutions/2209. Minimum White Tiles After Covering With Carpets/2209-2.py
index 5e29dbac8b0..b30d5c3f932 100644
--- a/solutions/2209. Minimum White Tiles After Covering With Carpets/2209-2.py	
+++ b/solutions/2209. Minimum White Tiles After Covering With Carpets/2209-2.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minimumWhiteTiles(
-      self,
-      floor: str,
-      numCarpets: int,
-      carpetLen: int,
-  ) -> int:
+  def minimumWhiteTiles(self, floor: str, numCarpets: int, carpetLen: int) -> int:
     n = len(floor)
     # dp[i][j] := the minimum number of visible white tiles of floor[i..n)
     # after covering at most j carpets
diff --git a/solutions/2209. Minimum White Tiles After Covering With Carpets/2209.java b/solutions/2209. Minimum White Tiles After Covering With Carpets/2209.java
index ccbec3040fd..ed4f3dc0d5a 100644
--- a/solutions/2209. Minimum White Tiles After Covering With Carpets/2209.java	
+++ b/solutions/2209. Minimum White Tiles After Covering With Carpets/2209.java	
@@ -1,20 +1,20 @@
 class Solution {
   public int minimumWhiteTiles(String floor, int numCarpets, int carpetLen) {
     int[][] mem = new int[floor.length() + 1][numCarpets + 1];
-    Arrays.stream(mem).forEach(A -> Arrays.fill(A, MAX));
+    Arrays.stream(mem).forEach(A -> Arrays.fill(A, kMax));
     return minimumWhiteTiles(floor, 0, numCarpets, carpetLen, mem);
   }
 
-  private static final int MAX = 1000;
+  private static final int kMax = 1000;
 
   // Returns the minimum number of visible white tiles of floor[i..n) after
   // covering at most j carpets.
   int minimumWhiteTiles(final String floor, int i, int j, int carpetLen, int[][] mem) {
     if (j < 0)
-      return MAX;
+      return kMax;
     if (i >= floor.length())
       return 0;
-    if (mem[i][j] != MAX)
+    if (mem[i][j] != kMax)
       return mem[i][j];
     return mem[i][j] =
                Math.min(minimumWhiteTiles(floor, i + carpetLen, j - 1, carpetLen, mem),
diff --git a/solutions/2209. Minimum White Tiles After Covering With Carpets/2209.py b/solutions/2209. Minimum White Tiles After Covering With Carpets/2209.py
index 4a4489d742e..5906ad0eed5 100644
--- a/solutions/2209. Minimum White Tiles After Covering With Carpets/2209.py	
+++ b/solutions/2209. Minimum White Tiles After Covering With Carpets/2209.py	
@@ -1,11 +1,6 @@
 class Solution:
-  def minimumWhiteTiles(
-      self,
-      floor: str,
-      numCarpets: int,
-      carpetLen: int,
-  ) -> int:
-    MAX = 1000
+  def minimumWhiteTiles(self, floor: str, numCarpets: int, carpetLen: int) -> int:
+    kMax = 1000
 
     @functools.lru_cache(None)
     def dp(i: int, j: int) -> int:
@@ -14,7 +9,7 @@ def dp(i: int, j: int) -> int:
       covering at most j carpets.
       """
       if j < 0:
-        return MAX
+        return kMax
       if i >= len(floor):
         return 0
       return min(dp(i + carpetLen, j - 1),
diff --git a/solutions/221. Maximal Square/221-2.py b/solutions/221. Maximal Square/221-2.py
index 8f2b11efe46..0a302e91510 100644
--- a/solutions/221. Maximal Square/221-2.py	
+++ b/solutions/221. Maximal Square/221-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximalSquare(self, matrix: list[list[str]]) -> int:
+  def maximalSquare(self, matrix: List[List[chr]]) -> int:
     m = len(matrix)
     n = len(matrix[0])
     dp = [0] * n
diff --git a/solutions/221. Maximal Square/221.py b/solutions/221. Maximal Square/221.py
index e18b2d258dd..3df2de1e5b6 100644
--- a/solutions/221. Maximal Square/221.py	
+++ b/solutions/221. Maximal Square/221.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximalSquare(self, matrix: list[list[str]]) -> int:
+  def maximalSquare(self, matrix: List[List[str]]) -> int:
     m = len(matrix)
     n = len(matrix[0])
     dp = [[0] * n for _ in range(m)]
diff --git a/solutions/2210. Count Hills and Valleys in an Array/2210.cpp b/solutions/2210. Count Hills and Valleys in an Array/2210.cpp
index 3c1e57646dc..2de632baaea 100644
--- a/solutions/2210. Count Hills and Valleys in an Array/2210.cpp	
+++ b/solutions/2210. Count Hills and Valleys in an Array/2210.cpp	
@@ -1,6 +1,6 @@
 class Solution {
  public:
-  int countHillValley(vector<int>& nums) {
+  int countthe hillthe valley(vector<int>& nums) {
     int ans = 0;
     int left = nums[0];
 
diff --git a/solutions/2210. Count Hills and Valleys in an Array/2210.java b/solutions/2210. Count Hills and Valleys in an Array/2210.java
index 0ca2e28faba..24e6d261ed3 100644
--- a/solutions/2210. Count Hills and Valleys in an Array/2210.java	
+++ b/solutions/2210. Count Hills and Valleys in an Array/2210.java	
@@ -1,5 +1,5 @@
 class Solution {
-  public int countHillValley(int[] nums) {
+  public int countthe hillthe valley(int[] nums) {
     int ans = 0;
     int left = nums[0];
 
diff --git a/solutions/2210. Count Hills and Valleys in an Array/2210.py b/solutions/2210. Count Hills and Valleys in an Array/2210.py
index 706d0023936..f504b63a62c 100644
--- a/solutions/2210. Count Hills and Valleys in an Array/2210.py	
+++ b/solutions/2210. Count Hills and Valleys in an Array/2210.py	
@@ -1,11 +1,12 @@
 class Solution:
-  def countHillValley(self, nums: list[int]) -> int:
+  def countthe hillthe valley(self, nums: List[int]) -> int:
     ans = 0
     left = nums[0]
 
     for i in range(1, len(nums) - 1):
-      if (left < nums[i] and nums[i] > nums[i + 1] or  # the hill
-              left > nums[i] and nums[i] < nums[i + 1]):  # the valley
+      # the hill or valley
+      if left < nums[i] and nums[i] > nums[i + 1] or \
+              left > nums[i] and nums[i] < nums[i + 1]:
         ans += 1
         left = nums[i]
 
diff --git a/solutions/2212. Maximum Points in an Archery Competition/2212.cpp b/solutions/2212. Maximum Points in an Archery Competition/2212.cpp
index b47da31eed0..0180c9a3523 100644
--- a/solutions/2212. Maximum Points in an Archery Competition/2212.cpp	
+++ b/solutions/2212. Maximum Points in an Archery Competition/2212.cpp	
@@ -1,11 +1,11 @@
 class Solution {
  public:
   vector<int> maximumBobPoints(int numArrows, vector<int>& aliceArrows) {
-    constexpr int kFullMask = (1 << 12) - 1;
+    constexpr int allMask = (1 << 12) - 1;
     int maxPoint = 0;
     int maxMask = 0;
 
-    for (int mask = 0; mask < kFullMask; ++mask) {
+    for (int mask = 0; mask < allMask; ++mask) {
       const auto& [shotable, point] =
           getShotableAndPoint(mask, numArrows, aliceArrows);
       if (shotable && point > maxPoint) {
diff --git a/solutions/2212. Maximum Points in an Archery Competition/2212.java b/solutions/2212. Maximum Points in an Archery Competition/2212.java
index b2a447e5da6..77bf274a618 100644
--- a/solutions/2212. Maximum Points in an Archery Competition/2212.java	
+++ b/solutions/2212. Maximum Points in an Archery Competition/2212.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int[] maximumBobPoints(int numArrows, int[] aliceArrows) {
-    final int FULL_MASK = (1 << 12) - 1;
+    final int allMask = (1 << 12) - 1;
     int maxPoint = 0;
     int maxMask = 0;
 
-    for (int mask = 0; mask < FULL_MASK; ++mask) {
+    for (int mask = 0; mask < allMask; ++mask) {
       Pair<Boolean, Integer> pair = getShotableAndPoint(mask, numArrows, aliceArrows);
       final boolean shotable = pair.getKey();
       final int point = pair.getValue();
diff --git a/solutions/2212. Maximum Points in an Archery Competition/2212.py b/solutions/2212. Maximum Points in an Archery Competition/2212.py
index b749767614e..fcd1e4baf76 100644
--- a/solutions/2212. Maximum Points in an Archery Competition/2212.py	
+++ b/solutions/2212. Maximum Points in an Archery Competition/2212.py	
@@ -1,14 +1,10 @@
 class Solution:
-  def maximumBobPoints(
-      self,
-      numArrows: int,
-      aliceArrows: list[int],
-  ) -> list[int]:
-    FULL_MASK = (1 << 12) - 1
+  def maximumBobPoints(self, numArrows: int, aliceArrows: List[int]) -> List[int]:
+    allMask = (1 << 12) - 1
     maxPoint = 0
     maxMask = 0
 
-    def getShotableAndPoint(mask: int, leftArrows: int) -> tuple[bool, int]:
+    def getShotableAndPoint(mask: int, leftArrows: int) -> Tuple[bool, int]:
       point = 0
       for i in range(12):
         if mask >> i & 1:
@@ -16,13 +12,13 @@ def getShotableAndPoint(mask: int, leftArrows: int) -> tuple[bool, int]:
           point += i
       return leftArrows >= 0, point
 
-    for mask in range(FULL_MASK):
+    for mask in range(allMask):
       shotable, point = getShotableAndPoint(mask, numArrows)
       if shotable and point > maxPoint:
         maxPoint = point
         maxMask = mask
 
-    def getBobsArrows(mask: int, leftArrows: int) -> list[int]:
+    def getBobsArrows(mask: int, leftArrows: int) -> List[int]:
       bobsArrows = [0] * 12
       for i in range(12):
         if mask >> i & 1:
diff --git a/solutions/2214. Minimum Health to Beat Game/2214.py b/solutions/2214. Minimum Health to Beat Game/2214.py
index 1438e5e4fa0..7a70232a1a4 100644
--- a/solutions/2214. Minimum Health to Beat Game/2214.py	
+++ b/solutions/2214. Minimum Health to Beat Game/2214.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def minimumHealth(self, damage: list[int], armor: int) -> int:
+  def minimumHealth(self, damage: List[int], armor: int) -> int:
     return 1 + sum(damage) - min(max(damage), armor)
diff --git a/solutions/2215. Find the Difference of Two Arrays/2215.py b/solutions/2215. Find the Difference of Two Arrays/2215.py
index eab3d5c6837..aa19edb75ab 100644
--- a/solutions/2215. Find the Difference of Two Arrays/2215.py	
+++ b/solutions/2215. Find the Difference of Two Arrays/2215.py	
@@ -1,6 +1,5 @@
 class Solution:
-  def findDifference(self, nums1: list[int],
-                     nums2: list[int]) -> list[list[int]]:
+  def findDifference(self, nums1: List[int], nums2: List[int]) -> List[List[int]]:
     set1 = set(nums1)
     set2 = set(nums2)
     return [set1 - set2, set2 - set1]
diff --git a/solutions/2216. Minimum Deletions to Make Array Beautiful/2216.py b/solutions/2216. Minimum Deletions to Make Array Beautiful/2216.py
index 920ececbbdc..be90c1e8697 100644
--- a/solutions/2216. Minimum Deletions to Make Array Beautiful/2216.py	
+++ b/solutions/2216. Minimum Deletions to Make Array Beautiful/2216.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minDeletion(self, nums: list[int]) -> int:
+  def minDeletion(self, nums: List[int]) -> int:
     ans = 0
 
     for i in range(len(nums) - 1):
diff --git a/solutions/2217. Find Palindrome With Fixed Length/2217.cpp b/solutions/2217. Find Palindrome With Fixed Length/2217.cpp
index 0e12c926552..c9d7982f123 100644
--- a/solutions/2217. Find Palindrome With Fixed Length/2217.cpp	
+++ b/solutions/2217. Find Palindrome With Fixed Length/2217.cpp	
@@ -23,7 +23,7 @@ class Solution {
 
   long reverse(int num) {
     long res = 0;
-    while (num > 0) {
+    while (num) {
       res = res * 10 + num % 10;
       num /= 10;
     }
diff --git a/solutions/2217. Find Palindrome With Fixed Length/2217.py b/solutions/2217. Find Palindrome With Fixed Length/2217.py
index dd86875a194..326e6d3bf0d 100644
--- a/solutions/2217. Find Palindrome With Fixed Length/2217.py	
+++ b/solutions/2217. Find Palindrome With Fixed Length/2217.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def kthPalindrome(self, queries: list[int], intLength: int) -> list[int]:
+  def kthPalindrome(self, queries: List[int], intLength: int) -> List[int]:
     start = pow(10, (intLength + 1) // 2 - 1)
     end = pow(10, (intLength + 1) // 2)
     mul = pow(10, intLength // 2)
@@ -13,8 +13,7 @@ def reverse(num: int) -> int:
 
     def getKthPalindrome(query: int) -> int:
       prefix = start + query - 1
-      return prefix * mul + reverse(prefix
-                                    if intLength % 2 == 0 else prefix // 10)
+      return prefix * mul + reverse(prefix if intLength % 2 == 0 else prefix//10)
 
     return [-1 if start + query > end else getKthPalindrome(query)
             for query in queries]
diff --git a/solutions/2218. Maximum Value of K Coins From Piles/2218.py b/solutions/2218. Maximum Value of K Coins From Piles/2218.py
index 74ce0cc5188..9d928a7b594 100644
--- a/solutions/2218. Maximum Value of K Coins From Piles/2218.py	
+++ b/solutions/2218. Maximum Value of K Coins From Piles/2218.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxValueOfCoins(self, piles: list[list[int]], k: int) -> int:
+  def maxValueOfCoins(self, piles: List[List[int]], k: int) -> int:
     @functools.lru_cache(None)
     def dp(i: int, k: int) -> int:
       """Returns the maximum value of picking k coins from piles[i..n)."""
diff --git a/solutions/2219. Maximum Sum Score of Array/2219.py b/solutions/2219. Maximum Sum Score of Array/2219.py
index 28730c5d3bb..93b52246fb9 100644
--- a/solutions/2219. Maximum Sum Score of Array/2219.py	
+++ b/solutions/2219. Maximum Sum Score of Array/2219.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumSumScore(self, nums: list[int]) -> int:
+  def maximumSumScore(self, nums: List[int]) -> int:
     ans = -math.inf
     prefix = 0
     summ = sum(nums)
diff --git a/solutions/222. Count Complete Tree Nodes/222-2.py b/solutions/222. Count Complete Tree Nodes/222-2.py
index 6e152c26fc0..e1de8344949 100644
--- a/solutions/222. Count Complete Tree Nodes/222-2.py	
+++ b/solutions/222. Count Complete Tree Nodes/222-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countNodes(self, root: TreeNode | None) -> int:
+  def countNodes(self, root: Optional[TreeNode]) -> int:
     if not root:
       return 0
 
diff --git a/solutions/222. Count Complete Tree Nodes/222.py b/solutions/222. Count Complete Tree Nodes/222.py
index 938a188e41a..255c6f2db0a 100644
--- a/solutions/222. Count Complete Tree Nodes/222.py	
+++ b/solutions/222. Count Complete Tree Nodes/222.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countNodes(self, root: TreeNode | None) -> int:
+  def countNodes(self, root: Optional[TreeNode]) -> int:
     if not root:
       return 0
     return 1 + self.countNodes(root.left) + self.countNodes(root.right)
diff --git a/solutions/2221. Find Triangular Sum of an Array/2221.py b/solutions/2221. Find Triangular Sum of an Array/2221.py
index e90c741fd67..ab07fe83d0e 100644
--- a/solutions/2221. Find Triangular Sum of an Array/2221.py	
+++ b/solutions/2221. Find Triangular Sum of an Array/2221.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def triangularSum(self, nums: list[int]) -> int:
+  def triangularSum(self, nums: List[int]) -> int:
     for sz in range(len(nums), 0, -1):
       for i in range(sz - 1):
         nums[i] = (nums[i] + nums[i + 1]) % 10
diff --git a/solutions/2222. Number of Ways to Select Buildings/2222.py b/solutions/2222. Number of Ways to Select Buildings/2222.py
index 78c66cadd1c..a72199c2200 100644
--- a/solutions/2222. Number of Ways to Select Buildings/2222.py	
+++ b/solutions/2222. Number of Ways to Select Buildings/2222.py	
@@ -9,7 +9,7 @@ def numberOfWays(self, s: str) -> int:
     after[1] = len(s) - after[0]
 
     for c in s:
-      num = int(c)
+      num = ord(c) - ord('0')
       after[num] -= 1
       if num == 0:
         ans += before[1] * after[1]
diff --git a/solutions/2225. Find Players With Zero or One Losses/2225.py b/solutions/2225. Find Players With Zero or One Losses/2225.py
index 201b794674f..0b415444d42 100644
--- a/solutions/2225. Find Players With Zero or One Losses/2225.py	
+++ b/solutions/2225. Find Players With Zero or One Losses/2225.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findWinners(self, matches: list[list[int]]) -> list[list[int]]:
+  def findWinners(self, matches: List[List[int]]) -> List[List[int]]:
     ans = [[] for _ in range(2)]
     lossesCount = collections.Counter()
 
diff --git a/solutions/2226. Maximum Candies Allocated to K Children/2226.cpp b/solutions/2226. Maximum Candies Allocated to K Children/2226.cpp
index f682712849f..b21c85fda9c 100644
--- a/solutions/2226. Maximum Candies Allocated to K Children/2226.cpp	
+++ b/solutions/2226. Maximum Candies Allocated to K Children/2226.cpp	
@@ -18,6 +18,6 @@ class Solution {
  private:
   long numChildren(const vector<int>& candies, int m) {
     return accumulate(candies.begin(), candies.end(), 0L,
-                      [&](long acc, int c) { return acc + c / m; });
+                      [&](long subtotal, int c) { return subtotal + c / m; });
   };
 };
diff --git a/solutions/2226. Maximum Candies Allocated to K Children/2226.py b/solutions/2226. Maximum Candies Allocated to K Children/2226.py
index c892b23030e..a3c245035a7 100644
--- a/solutions/2226. Maximum Candies Allocated to K Children/2226.py	
+++ b/solutions/2226. Maximum Candies Allocated to K Children/2226.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumCandies(self, candies: list[int], k: int) -> int:
+  def maximumCandies(self, candies: List[int], k: int) -> int:
     l = 1
     r = sum(candies) // k
 
diff --git a/solutions/2227. Encrypt and Decrypt Strings/2227-2.py b/solutions/2227. Encrypt and Decrypt Strings/2227-2.py
index 6d8d14558d7..a2a3804cddc 100644
--- a/solutions/2227. Encrypt and Decrypt Strings/2227-2.py	
+++ b/solutions/2227. Encrypt and Decrypt Strings/2227-2.py	
@@ -1,5 +1,5 @@
 class Encrypter:
-  def __init__(self, keys: list[str], values: list[str], dictionary: list[str]):
+  def __init__(self, keys: List[str], values: List[str], dictionary: List[str]):
     self.keyToValue = {k: v for k, v in zip(keys, values)}
     self.decrypt = collections.Counter(self.encrypt(word)
                                        for word in dictionary).__getitem__
diff --git a/solutions/2227. Encrypt and Decrypt Strings/2227.cpp b/solutions/2227. Encrypt and Decrypt Strings/2227.cpp
index bff67226d47..b6a4456ca32 100644
--- a/solutions/2227. Encrypt and Decrypt Strings/2227.cpp	
+++ b/solutions/2227. Encrypt and Decrypt Strings/2227.cpp	
@@ -53,9 +53,8 @@ class Encrypter {
     int ans = 0;
     if (i + 2 == word.length()) {
       for (const char key : valueToKeys[value]) {
-        shared_ptr<TrieNode>& child = node->children[key - 'a'];
-        if (child != nullptr && child->isWord)
-          ++ans;
+        const auto& child = node->children[key - 'a'];
+        ans += child && child->isWord;
       }
       return ans;
     }
diff --git a/solutions/2227. Encrypt and Decrypt Strings/2227.py b/solutions/2227. Encrypt and Decrypt Strings/2227.py
index 029b59fb2f5..7b371957a32 100644
--- a/solutions/2227. Encrypt and Decrypt Strings/2227.py	
+++ b/solutions/2227. Encrypt and Decrypt Strings/2227.py	
@@ -1,11 +1,11 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = collections.defaultdict(TrieNode)
     self.isWord = False
 
 
 class Encrypter:
-  def __init__(self, keys: list[str], values: list[str], dictionary: list[str]):
+  def __init__(self, keys: List[str], values: List[str], dictionary: List[str]):
     self.keyToValue = {k: v for k, v in zip(keys, values)}
     self.valueToKeys = collections.defaultdict(list)
     self.root = TrieNode()
@@ -34,8 +34,7 @@ def _find(self, word: str, i: int, node: TrieNode) -> int:
     ans = 0
     if i + 2 == len(word):
       for key in self.valueToKeys[value]:
-        if key in node.children and node.children[key].isWord:
-          ans += 1
+        ans += node.children[key].isWord
       return ans
 
     for key in self.valueToKeys[value]:
diff --git a/solutions/2229. Check if an Array Is Consecutive/2229.py b/solutions/2229. Check if an Array Is Consecutive/2229.py
index 28b9d21c08b..0e120086192 100644
--- a/solutions/2229. Check if an Array Is Consecutive/2229.py	
+++ b/solutions/2229. Check if an Array Is Consecutive/2229.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def isConsecutive(self, nums: list[int]) -> bool:
+  def isConsecutive(self, nums: List[int]) -> bool:
     return max(nums) - min(nums) + 1 == len(set(nums)) == len(nums)
diff --git a/solutions/223. Rectangle Area/223.py b/solutions/223. Rectangle Area/223.py
index 1ce04eb3418..fd6ac77c285 100644
--- a/solutions/223. Rectangle Area/223.py	
+++ b/solutions/223. Rectangle Area/223.py	
@@ -1,7 +1,5 @@
 class Solution:
-  def computeArea(self,
-                  A: int, B: int, C: int, D: int,
-                  E: int, F: int, G: int, H: int) -> int:
+  def computeArea(self, A: int, B: int, C: int, D: int, E: int, F: int, G: int, H: int) -> int:
     x = min(C, G) - max(A, E) if max(A, E) < min(C, G) else 0
     y = min(D, H) - max(B, F) if max(B, F) < min(D, H) else 0
     return (C - A) * (D - B) + (G - E) * (H - F) - x * y
diff --git a/solutions/2231. Largest Number After Digit Swaps by Parity/2231.py b/solutions/2231. Largest Number After Digit Swaps by Parity/2231.py
index 38a6d3de5eb..cf13692cab9 100644
--- a/solutions/2231. Largest Number After Digit Swaps by Parity/2231.py	
+++ b/solutions/2231. Largest Number After Digit Swaps by Parity/2231.py	
@@ -7,11 +7,11 @@ def largestInteger(self, num: int) -> int:
     maxHeap = [[] for _ in range(2)]
 
     for c in s:
-      digit = int(c)
+      digit = ord(c) - ord('0')
       heapq.heappush(maxHeap[digit % 2], -digit)
 
     for c in s:
-      i = int(c) & 1
+      i = ord(c) - ord('0') & 1
       ans = (ans * 10 - heapq.heappop(maxHeap[i]))
 
     return ans
diff --git a/solutions/2232. Minimize Result by Adding Parentheses to Expression/2232.py b/solutions/2232. Minimize Result by Adding Parentheses to Expression/2232.py
index e14937045d8..4ec90471ae9 100644
--- a/solutions/2232. Minimize Result by Adding Parentheses to Expression/2232.py	
+++ b/solutions/2232. Minimize Result by Adding Parentheses to Expression/2232.py	
@@ -16,8 +16,8 @@ def minimizeResult(self, expression: str) -> str:
         val = a * (b + c) * d
         if val < mn:
           mn = val
-          ans = (('' if i == 0 else str(a)) +
-                 '(' + str(b) + '+' + str(c) + ')' +
-                 ('' if j == len(right) - 1 else str(d)))
+          ans = ('' if i == 0 else str(a)) + \
+              '(' + str(b) + '+' + str(c) + ')' + \
+                ('' if j == len(right) - 1 else str(d))
 
     return ans
diff --git a/solutions/2233. Maximum Product After K Increments/2233.java b/solutions/2233. Maximum Product After K Increments/2233.java
index 4d342cabcf7..e04be16a746 100644
--- a/solutions/2233. Maximum Product After K Increments/2233.java	
+++ b/solutions/2233. Maximum Product After K Increments/2233.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int maximumProduct(int[] nums, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long ans = 1;
     Queue<Integer> minHeap = new PriorityQueue<>();
 
@@ -14,7 +14,7 @@ public int maximumProduct(int[] nums, int k) {
 
     while (!minHeap.isEmpty()) {
       ans *= minHeap.poll();
-      ans %= MOD;
+      ans %= kMod;
     }
 
     return (int) ans;
diff --git a/solutions/2233. Maximum Product After K Increments/2233.py b/solutions/2233. Maximum Product After K Increments/2233.py
index ae3f1cd4ee8..b3cb648f6d1 100644
--- a/solutions/2233. Maximum Product After K Increments/2233.py	
+++ b/solutions/2233. Maximum Product After K Increments/2233.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def maximumProduct(self, nums: list[int], k: int) -> int:
-    MOD = 1_000_000_007
+  def maximumProduct(self, nums: List[int], k: int) -> int:
+    kMod = 1_000_000_007
     ans = 1
     minHeap = nums.copy()
     heapq.heapify(minHeap)
@@ -11,6 +11,6 @@ def maximumProduct(self, nums: list[int], k: int) -> int:
 
     while minHeap:
       ans *= heapq.heappop(minHeap)
-      ans %= MOD
+      ans %= kMod
 
     return ans
diff --git a/solutions/2234. Maximum Total Beauty of the Gardens/2234.py b/solutions/2234. Maximum Total Beauty of the Gardens/2234.py
index bafe9a97fe1..549fe66fb62 100644
--- a/solutions/2234. Maximum Total Beauty of the Gardens/2234.py	
+++ b/solutions/2234. Maximum Total Beauty of the Gardens/2234.py	
@@ -1,12 +1,5 @@
 class Solution:
-  def maximumBeauty(
-      self,
-      flowers: list[int],
-      newFlowers: int,
-      target: int,
-      full: int,
-      partial: int,
-  ) -> int:
+  def maximumBeauty(self, flowers: List[int], newFlowers: int, target: int, full: int, partial: int) -> int:
     n = len(flowers)
 
     # If a garden is already complete, clamp it to the target.
diff --git a/solutions/2236. Root Equals Sum of Children/2236.py b/solutions/2236. Root Equals Sum of Children/2236.py
index d82455871d5..957214c1962 100644
--- a/solutions/2236. Root Equals Sum of Children/2236.py	
+++ b/solutions/2236. Root Equals Sum of Children/2236.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def checkTree(self, root: TreeNode | None) -> bool:
+  def checkTree(self, root: Optional[TreeNode]) -> bool:
     return root.val == root.left.val + root.right.val
diff --git a/solutions/2237. Count Positions on Street With Required Brightness/2237.py b/solutions/2237. Count Positions on Street With Required Brightness/2237.py
index 469e0df587f..3fd9093507f 100644
--- a/solutions/2237. Count Positions on Street With Required Brightness/2237.py	
+++ b/solutions/2237. Count Positions on Street With Required Brightness/2237.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def meetRequirement(
-      self,
-      n: int,
-      lights: list[list[int]],
-      requirement: list[int],
-  ) -> int:
+  def meetRequirement(self, n: int, lights: List[List[int]], requirement: List[int]) -> int:
     ans = 0
     currBrightness = 0
     change = [0] * (n + 1)
diff --git a/solutions/2239. Find Closest Number to Zero/2239.py b/solutions/2239. Find Closest Number to Zero/2239.py
index 862c1ffab15..c25957440f5 100644
--- a/solutions/2239. Find Closest Number to Zero/2239.py	
+++ b/solutions/2239. Find Closest Number to Zero/2239.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def findClosestNumber(self, nums: list[int]) -> int:
+  def findClosestNumber(self, nums: List[int]) -> int:
     nums.sort(key=lambda x: (abs(x), -x))
     return nums[0]
diff --git a/solutions/224. Basic Calculator/224.py b/solutions/224. Basic Calculator/224.py
index 499482db06b..283070ea5a4 100644
--- a/solutions/224. Basic Calculator/224.py	
+++ b/solutions/224. Basic Calculator/224.py	
@@ -7,7 +7,7 @@ def calculate(self, s: str) -> int:
 
     for c in s:
       if c.isdigit():
-        num = num * 10 + int(c)
+        num = num * 10 + (ord(c) - ord('0'))
       elif c == '(':
         stack.append(sign)
       elif c == ')':
diff --git a/solutions/2241. Design an ATM Machine/2241.py b/solutions/2241. Design an ATM Machine/2241.py
index 8bd778bba0a..1d1bbbb0a85 100644
--- a/solutions/2241. Design an ATM Machine/2241.py	
+++ b/solutions/2241. Design an ATM Machine/2241.py	
@@ -3,11 +3,11 @@ def __init__(self):
     self.banknotes = [20, 50, 100, 200, 500]
     self.bank = [0] * 5
 
-  def deposit(self, banknotesCount: list[int]) -> None:
+  def deposit(self, banknotesCount: List[int]) -> None:
     for i in range(5):
       self.bank[i] += banknotesCount[i]
 
-  def withdraw(self, amount: int) -> list[int]:
+  def withdraw(self, amount: int) -> List[int]:
     withdrew = [0] * 5
 
     for i in reversed(range(5)):
diff --git a/solutions/2242. Maximum Score of a Node Sequence/2242.java b/solutions/2242. Maximum Score of a Node Sequence/2242.java
index bb95efc4ccd..3d7f4b035e1 100644
--- a/solutions/2242. Maximum Score of a Node Sequence/2242.java	
+++ b/solutions/2242. Maximum Score of a Node Sequence/2242.java	
@@ -5,7 +5,7 @@ public int maximumScore(int[] scores, int[][] edges) {
     Queue<Integer>[] graph = new Queue[n];
 
     for (int i = 0; i < n; ++i)
-      graph[i] = new PriorityQueue<>(Comparator.comparingInt(a -> scores[a]));
+      graph[i] = new PriorityQueue<>((a, b) -> scores[a] - scores[b]);
 
     for (int[] edge : edges) {
       final int u = edge[0];
diff --git a/solutions/2242. Maximum Score of a Node Sequence/2242.py b/solutions/2242. Maximum Score of a Node Sequence/2242.py
index d92b87c22d4..a2075e6c3a3 100644
--- a/solutions/2242. Maximum Score of a Node Sequence/2242.py	
+++ b/solutions/2242. Maximum Score of a Node Sequence/2242.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumScore(self, scores: list[int], edges: list[list[int]]) -> int:
+  def maximumScore(self, scores: List[int], edges: List[List[int]]) -> int:
     n = len(scores)
     ans = -1
     graph = [[] for _ in range(n)]
diff --git a/solutions/2243. Calculate Digit Sum of a String/2243.cpp b/solutions/2243. Calculate Digit Sum of a String/2243.cpp
index f41dbfeb145..152eb8f326b 100644
--- a/solutions/2243. Calculate Digit Sum of a String/2243.cpp	
+++ b/solutions/2243. Calculate Digit Sum of a String/2243.cpp	
@@ -6,8 +6,8 @@ class Solution {
       for (int i = 0; i < s.length(); ++i)
         next += to_string(accumulate(
             s.begin() + i, s.begin() + min(static_cast<int>(s.length()), i + k),
-            0, [](int acc, char c) { return acc + c - '0'; }));
-      s = std::move(next);
+            0, [](int subtotal, char c) { return subtotal + c - '0'; }));
+      s = move(next);
     }
     return s;
   }
diff --git a/solutions/2243. Calculate Digit Sum of a String/2243.py b/solutions/2243. Calculate Digit Sum of a String/2243.py
index 39992b38e48..54c17ef676d 100644
--- a/solutions/2243. Calculate Digit Sum of a String/2243.py	
+++ b/solutions/2243. Calculate Digit Sum of a String/2243.py	
@@ -5,7 +5,7 @@ def digitSum(self, s: str, k: int) -> str:
       for i in range(0, len(s), k):
         summ = 0
         for j in range(i, min(len(s), i + k)):
-          summ += int(s[j])
+          summ += ord(s[j]) - ord('0')
         next.append(str(summ))
       s = ''.join(next)
     return s
diff --git a/solutions/2244. Minimum Rounds to Complete All Tasks/2244.py b/solutions/2244. Minimum Rounds to Complete All Tasks/2244.py
index d2437e4eee9..c432b832286 100644
--- a/solutions/2244. Minimum Rounds to Complete All Tasks/2244.py	
+++ b/solutions/2244. Minimum Rounds to Complete All Tasks/2244.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def minimumRounds(self, tasks: list[int]) -> int:
+  def minimumRounds(self, tasks: List[int]) -> int:
     freqs = collections.Counter(tasks).values()
     return -1 if 1 in freqs else sum((f + 2) // 3 for f in freqs)
diff --git a/solutions/2245. Maximum Trailing Zeros in a Cornered Path/2245.py b/solutions/2245. Maximum Trailing Zeros in a Cornered Path/2245.py
index 05d3f78c38d..619e4c2cbf2 100644
--- a/solutions/2245. Maximum Trailing Zeros in a Cornered Path/2245.py	
+++ b/solutions/2245. Maximum Trailing Zeros in a Cornered Path/2245.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxTrailingZeros(self, grid: list[list[int]]) -> int:
+  def maxTrailingZeros(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
     # leftPrefix2[i][j] := the number of 2 in grid[i][0..j]
diff --git a/solutions/2246. Longest Path With Different Adjacent Characters/2246.java b/solutions/2246. Longest Path With Different Adjacent Characters/2246.java
index 0d3e62e0b48..da0c2561045 100644
--- a/solutions/2246. Longest Path With Different Adjacent Characters/2246.java	
+++ b/solutions/2246. Longest Path With Different Adjacent Characters/2246.java	
@@ -2,7 +2,9 @@ class Solution {
   public int longestPath(int[] parent, String s) {
     final int n = parent.length;
     List<Integer>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int i = 1; i < n; ++i)
       graph[parent[i]].add(i);
diff --git a/solutions/2246. Longest Path With Different Adjacent Characters/2246.py b/solutions/2246. Longest Path With Different Adjacent Characters/2246.py
index 674ddc45227..4ef71cf5313 100644
--- a/solutions/2246. Longest Path With Different Adjacent Characters/2246.py	
+++ b/solutions/2246. Longest Path With Different Adjacent Characters/2246.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestPath(self, parent: list[int], s: str) -> int:
+  def longestPath(self, parent: List[int], s: str) -> int:
     n = len(parent)
     ans = 0
     graph = [[] for _ in range(n)]
diff --git a/solutions/2247. Maximum Cost of Trip With K Highways/2247.java b/solutions/2247. Maximum Cost of Trip With K Highways/2247.java
index 4fcf3c100f5..80da967ae61 100644
--- a/solutions/2247. Maximum Cost of Trip With K Highways/2247.java	
+++ b/solutions/2247. Maximum Cost of Trip With K Highways/2247.java	
@@ -6,7 +6,9 @@ public int maximumCost(int n, int[][] highways, int k) {
     int ans = -1;
     Integer[][] mem = new Integer[n][1 << n];
     List<Pair<Integer, Integer>>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] h : highways) {
       final int u = h[0];
diff --git a/solutions/2247. Maximum Cost of Trip With K Highways/2247.py b/solutions/2247. Maximum Cost of Trip With K Highways/2247.py
index 6cc3f80fe13..d7ab46d36a5 100644
--- a/solutions/2247. Maximum Cost of Trip With K Highways/2247.py	
+++ b/solutions/2247. Maximum Cost of Trip With K Highways/2247.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumCost(self, n: int, highways: list[list[int]], k: int) -> int:
+  def maximumCost(self, n: int, highways: List[List[int]], k: int) -> int:
     if k + 1 > n:
       return -1
 
diff --git a/solutions/2248. Intersection of Multiple Arrays/2248.cpp b/solutions/2248. Intersection of Multiple Arrays/2248.cpp
index 0d80611d3b2..0fe8da241f7 100644
--- a/solutions/2248. Intersection of Multiple Arrays/2248.cpp	
+++ b/solutions/2248. Intersection of Multiple Arrays/2248.cpp	
@@ -1,15 +1,14 @@
 class Solution {
  public:
   vector<int> intersection(vector<vector<int>>& nums) {
-    constexpr int kMax = 1000;
     vector<int> ans;
-    vector<int> count(kMax + 1);
+    vector<int> count(1001);
 
-    for (const vector<int>& row : nums)
-      for (const int a : row)
+    for (const vector<int>& A : nums)
+      for (const int a : A)
         ++count[a];
 
-    for (int i = 1; i <= kMax; ++i)
+    for (int i = 1; i < 1001; ++i)
       if (count[i] == nums.size())
         ans.push_back(i);
 
diff --git a/solutions/2248. Intersection of Multiple Arrays/2248.java b/solutions/2248. Intersection of Multiple Arrays/2248.java
index d088ab87c9f..974a7219ff3 100644
--- a/solutions/2248. Intersection of Multiple Arrays/2248.java	
+++ b/solutions/2248. Intersection of Multiple Arrays/2248.java	
@@ -1,14 +1,13 @@
 class Solution {
   public List<Integer> intersection(int[][] nums) {
-    final int MAX = 1000;
     List<Integer> ans = new ArrayList<>();
-    int[] count = new int[MAX + 1];
+    int[] count = new int[1001];
 
-    for (int[] arr : nums)
-      for (final int a : arr)
+    for (int[] A : nums)
+      for (final int a : A)
         ++count[a];
 
-    for (int i = 1; i <= MAX; ++i)
+    for (int i = 1; i < 1001; ++i)
       if (count[i] == nums.length)
         ans.add(i);
 
diff --git a/solutions/2248. Intersection of Multiple Arrays/2248.py b/solutions/2248. Intersection of Multiple Arrays/2248.py
index c8a1b2f65d4..16a22074579 100644
--- a/solutions/2248. Intersection of Multiple Arrays/2248.py	
+++ b/solutions/2248. Intersection of Multiple Arrays/2248.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def intersection(self, nums: list[list[int]]) -> list[int]:
+  def intersection(self, nums: List[List[int]]) -> List[int]:
     count = [0] * 1001
 
-    for row in nums:
-      for a in row:
+    for A in nums:
+      for a in A:
         count[a] += 1
 
     return [i for i, c in enumerate(count)
diff --git a/solutions/2249. Count Lattice Points Inside a Circle/2249-2.py b/solutions/2249. Count Lattice Points Inside a Circle/2249-2.py
index c5fe2f92867..e44fab59b85 100644
--- a/solutions/2249. Count Lattice Points Inside a Circle/2249-2.py	
+++ b/solutions/2249. Count Lattice Points Inside a Circle/2249-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countLatticePoints(self, circles: list[list[int]]) -> int:
+  def countLatticePoints(self, circles: List[List[int]]) -> int:
     points = set()
 
     # dx := relative to x
diff --git a/solutions/2249. Count Lattice Points Inside a Circle/2249.cpp b/solutions/2249. Count Lattice Points Inside a Circle/2249.cpp
index 8a74169efde..cde0b38eefe 100644
--- a/solutions/2249. Count Lattice Points Inside a Circle/2249.cpp	
+++ b/solutions/2249. Count Lattice Points Inside a Circle/2249.cpp	
@@ -5,7 +5,7 @@ class Solution {
 
     for (int x = 0; x < 201; ++x)
       for (int y = 0; y < 201; ++y)
-        ans += ranges::any_of(circles, [x, y](const auto& c) {
+        ans += ranges::any_of(circles, [&](const auto& c) {
           return (c[0] - x) * (c[0] - x) + (c[1] - y) * (c[1] - y) <=
                  c[2] * c[2];
         });
diff --git a/solutions/2249. Count Lattice Points Inside a Circle/2249.py b/solutions/2249. Count Lattice Points Inside a Circle/2249.py
index 26c424944ae..6a9d664dfa8 100644
--- a/solutions/2249. Count Lattice Points Inside a Circle/2249.py	
+++ b/solutions/2249. Count Lattice Points Inside a Circle/2249.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countLatticePoints(self, circles: list[list[int]]) -> int:
+  def countLatticePoints(self, circles: List[List[int]]) -> int:
     return sum(any((xc - x)**2 + (yc - y)**2 <= r**2 for xc, yc, r in circles)
                for x in range(201)
                for y in range(201))
diff --git a/solutions/2250. Count Number of Rectangles Containing Each Point/2250.py b/solutions/2250. Count Number of Rectangles Containing Each Point/2250.py
index 67c18ae4a61..88ecb1e3a57 100644
--- a/solutions/2250. Count Number of Rectangles Containing Each Point/2250.py	
+++ b/solutions/2250. Count Number of Rectangles Containing Each Point/2250.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def countRectangles(
-      self,
-      rectangles: list[list[int]],
-      points: list[list[int]],
-  ) -> list[int]:
+  def countRectangles(self, rectangles: List[List[int]], points: List[List[int]]) -> List[int]:
     ans = []
     yToXs = [[] for _ in range(101)]
 
diff --git a/solutions/2251. Number of Flowers in Full Bloom/2251.java b/solutions/2251. Number of Flowers in Full Bloom/2251.java
index f0e2b995684..d8cca4b13f6 100644
--- a/solutions/2251. Number of Flowers in Full Bloom/2251.java	
+++ b/solutions/2251. Number of Flowers in Full Bloom/2251.java	
@@ -21,12 +21,12 @@ public int[] fullBloomFlowers(int[][] flowers, int[] persons) {
     return ans;
   }
 
-  private int firstGreater(List<Integer> arr, int target) {
+  private int firstGreater(List<Integer> A, int target) {
     int l = 0;
-    int r = arr.size();
+    int r = A.size();
     while (l < r) {
       final int m = (l + r) / 2;
-      if (arr.get(m) > target)
+      if (A.get(m) > target)
         r = m;
       else
         l = m + 1;
@@ -34,12 +34,12 @@ private int firstGreater(List<Integer> arr, int target) {
     return l;
   }
 
-  private int firstGreaterEqual(List<Integer> arr, int target) {
+  private int firstGreaterEqual(List<Integer> A, int target) {
     int l = 0;
-    int r = arr.size();
+    int r = A.size();
     while (l < r) {
       final int m = (l + r) / 2;
-      if (arr.get(m) >= target)
+      if (A.get(m) >= target)
         r = m;
       else
         l = m + 1;
diff --git a/solutions/2251. Number of Flowers in Full Bloom/2251.py b/solutions/2251. Number of Flowers in Full Bloom/2251.py
index d868c6e47c3..b806a15282f 100644
--- a/solutions/2251. Number of Flowers in Full Bloom/2251.py	
+++ b/solutions/2251. Number of Flowers in Full Bloom/2251.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def fullBloomFlowers(
-      self,
-      flowers: list[list[int]],
-      persons: list[int],
-  ) -> list[int]:
+  def fullBloomFlowers(self, flowers: List[List[int]], persons: List[int]) -> List[int]:
     starts = sorted(s for s, _ in flowers)
     ends = sorted(e for _, e in flowers)
     return [bisect.bisect_right(starts, person) -
diff --git a/solutions/2254. Design Video Sharing Platform/2254.py b/solutions/2254. Design Video Sharing Platform/2254.py
index 2c8e6c39db6..5b8bb371f2b 100644
--- a/solutions/2254. Design Video Sharing Platform/2254.py	
+++ b/solutions/2254. Design Video Sharing Platform/2254.py	
@@ -35,7 +35,7 @@ def dislike(self, videoId: int) -> None:
     if videoId in self.videoIdToVideo:
       self.videoIdToDislikes[videoId] += 1
 
-  def getLikesAndDislikes(self, videoId: int) -> list[int]:
+  def getLikesAndDislikes(self, videoId: int) -> List[int]:
     if videoId in self.videoIdToVideo:
       return [self.videoIdToLikes[videoId], self.videoIdToDislikes[videoId]]
     return [-1]
diff --git a/solutions/2255. Count Prefixes of a Given String/2255.py b/solutions/2255. Count Prefixes of a Given String/2255.py
index 35f793a1cb5..799c69184af 100644
--- a/solutions/2255. Count Prefixes of a Given String/2255.py	
+++ b/solutions/2255. Count Prefixes of a Given String/2255.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def countPrefixes(self, words: list[str], s: str) -> int:
+  def countPrefixes(self, words: List[str], s: str) -> int:
     return sum(map(s.startswith, words))
diff --git a/solutions/2256. Minimum Average Difference/2256.py b/solutions/2256. Minimum Average Difference/2256.py
index af0352d816c..a30ae73e13a 100644
--- a/solutions/2256. Minimum Average Difference/2256.py	
+++ b/solutions/2256. Minimum Average Difference/2256.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumAverageDifference(self, nums: list[int]) -> int:
+  def minimumAverageDifference(self, nums: List[int]) -> int:
     n = len(nums)
     ans = 0
     minDiff = inf
diff --git a/solutions/2257. Count Unguarded Cells in the Grid/2257.py b/solutions/2257. Count Unguarded Cells in the Grid/2257.py
index fe3b9a6892b..cb6da6c8eaf 100644
--- a/solutions/2257. Count Unguarded Cells in the Grid/2257.py	
+++ b/solutions/2257. Count Unguarded Cells in the Grid/2257.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def countUnguarded(
-      self,
-      m: int,
-      n: int,
-      guards: list[list[int]],
-      walls: list[list[int]],
-  ) -> int:
+  def countUnguarded(self, m: int, n: int, guards: List[List[int]], walls: List[List[int]]) -> int:
     ans = 0
     grid = [[0] * n for _ in range(m)]
     left = [[0] * n for _ in range(m)]
@@ -49,8 +43,8 @@ def countUnguarded(
 
     for i in range(m):
       for j in range(n):
-        if (grid[i][j] == 0 and left[i][j] != 'G' and right[i][j] != 'G' and
-                up[i][j] != 'G' and down[i][j] != 'G'):
+        if grid[i][j] == 0 and left[i][j] != 'G' and right[i][j] != 'G' and \
+                up[i][j] != 'G' and down[i][j] != 'G':
           ans += 1
 
     return ans
diff --git a/solutions/2258. Escape the Spreading Fire/2258.cpp b/solutions/2258. Escape the Spreading Fire/2258.cpp
index b698d2b2336..81c523db16d 100644
--- a/solutions/2258. Escape the Spreading Fire/2258.cpp	
+++ b/solutions/2258. Escape the Spreading Fire/2258.cpp	
@@ -1,10 +1,11 @@
 class Solution {
  public:
   int maximumMinutes(vector<vector<int>>& grid) {
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int kMax = grid.size() * grid[0].size();
     vector<vector<int>> fireMinute(grid.size(),
                                    vector<int>(grid[0].size(), -1));
-    buildFireGrid(grid, fireMinute);
+    buildFireGrid(grid, fireMinute, dirs);
 
     int ans = -1;
     int l = 0;
@@ -12,7 +13,7 @@ class Solution {
 
     while (l <= r) {
       const int m = (l + r) / 2;
-      if (canStayFor(grid, fireMinute, m)) {
+      if (canStayFor(grid, fireMinute, m, dirs)) {
         ans = m;
         l = m + 1;
       } else {
@@ -20,14 +21,13 @@ class Solution {
       }
     }
 
-    return ans == kMax ? 1'000'000'000 : ans;
+    return ans == kMax ? 1e9 : ans;
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-
   void buildFireGrid(const vector<vector<int>>& grid,
-                     vector<vector<int>>& fireMinute) {
+                     vector<vector<int>>& fireMinute, const vector<int>& dirs) {
+    int minuteFromFire = 0;
     queue<pair<int, int>> q;
 
     for (int i = 0; i < grid.size(); ++i)
@@ -37,11 +37,12 @@ class Solution {
           fireMinute[i][j] = 0;
         }
 
-    for (int minuteFromFire = 1; !q.empty(); ++minuteFromFire)
+    while (!q.empty()) {
+      ++minuteFromFire;
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == grid.size() || y < 0 || y == grid[0].size())
@@ -54,10 +55,12 @@ class Solution {
           q.emplace(x, y);
         }
       }
+    }
   }
 
   bool canStayFor(const vector<vector<int>>& grid,
-                  const vector<vector<int>>& fireMinute, int minute) {
+                  const vector<vector<int>>& fireMinute, int minute,
+                  const vector<int>& dirs) {
     queue<pair<int, int>> q{{{0, 0}}};  // the start position
     vector<vector<bool>> seen(grid.size(), vector<bool>(grid[0].size()));
     seen[0][0] = true;
@@ -67,7 +70,7 @@ class Solution {
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == grid.size() || y < 0 || y == grid[0].size())
diff --git a/solutions/2258. Escape the Spreading Fire/2258.java b/solutions/2258. Escape the Spreading Fire/2258.java
index 6678cdf61ed..e32838947a1 100644
--- a/solutions/2258. Escape the Spreading Fire/2258.java	
+++ b/solutions/2258. Escape the Spreading Fire/2258.java	
@@ -1,17 +1,18 @@
 class Solution {
   public int maximumMinutes(int[][] grid) {
-    final int MAX = grid.length * grid[0].length;
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int kMax = grid.length * grid[0].length;
     int[][] fireMinute = new int[grid.length][grid[0].length];
     Arrays.stream(fireMinute).forEach(A -> Arrays.fill(A, -1));
-    buildFireGrid(grid, fireMinute);
+    buildFireGrid(grid, fireMinute, dirs);
 
     int ans = -1;
     int l = 0;
-    int r = MAX;
+    int r = kMax;
 
     while (l <= r) {
       final int m = (l + r) / 2;
-      if (canStayFor(grid, fireMinute, m)) {
+      if (canStayFor(grid, fireMinute, m, dirs)) {
         ans = m;
         l = m + 1;
       } else {
@@ -19,12 +20,11 @@ public int maximumMinutes(int[][] grid) {
       }
     }
 
-    return ans == MAX ? 1_000_000_000 : ans;
+    return ans == kMax ? (int) 1e9 : ans;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-
-  private void buildFireGrid(int[][] grid, int[][] fireMinute) {
+  private void buildFireGrid(int[][] grid, int[][] fireMinute, final int[] dirs) {
+    int minuteFromFire = 0;
     Queue<Pair<Integer, Integer>> q = new ArrayDeque<>();
 
     for (int i = 0; i < grid.length; ++i)
@@ -34,11 +34,12 @@ private void buildFireGrid(int[][] grid, int[][] fireMinute) {
           fireMinute[i][j] = 0;
         }
 
-    for (int minuteFromFire = 1; !q.isEmpty(); ++minuteFromFire)
+    while (!q.isEmpty()) {
+      ++minuteFromFire;
       for (int sz = q.size(); sz > 0; --sz) {
         final int i = q.peek().getKey();
         final int j = q.poll().getValue();
-        for (int[] dir : DIRS) {
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == grid.length || y < 0 || y == grid[0].length)
@@ -51,11 +52,12 @@ private void buildFireGrid(int[][] grid, int[][] fireMinute) {
           q.offer(new Pair<>(x, y));
         }
       }
+    }
   }
 
-  boolean canStayFor(int[][] grid, int[][] fireMinute, int minute) {
+  boolean canStayFor(int[][] grid, int[][] fireMinute, int minute, final int[] dirs) {
     Queue<Pair<Integer, Integer>> q =
-        new ArrayDeque<>(List.of(new Pair<>(0, 0))); // the start position
+        new ArrayDeque<>(Arrays.asList(new Pair<>(0, 0))); // the start position
     boolean[][] seen = new boolean[grid.length][grid[0].length];
     seen[0][0] = true;
 
@@ -64,7 +66,7 @@ boolean canStayFor(int[][] grid, int[][] fireMinute, int minute) {
       for (int sz = q.size(); sz > 0; --sz) {
         final int i = q.peek().getKey();
         final int j = q.poll().getValue();
-        for (int[] dir : DIRS) {
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == grid.length || y < 0 || y == grid[0].length)
diff --git a/solutions/2258. Escape the Spreading Fire/2258.py b/solutions/2258. Escape the Spreading Fire/2258.py
index bfcd55d6321..a03abf69518 100644
--- a/solutions/2258. Escape the Spreading Fire/2258.py	
+++ b/solutions/2258. Escape the Spreading Fire/2258.py	
@@ -1,30 +1,25 @@
 class Solution:
-  def maximumMinutes(self, grid: list[list[int]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
-    MAX = len(grid) * len(grid[0])
+  def maximumMinutes(self, grid: List[List[int]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
+    kMax = len(grid) * len(grid[0])
     fireGrid = [[-1] * len(grid[0]) for _ in range(len(grid[0]))]
-    self._buildFireGrid(grid, fireGrid, DIRS)
+    self._buildFireGrid(grid, fireGrid, dirs)
 
     ans = -1
     l = 0
-    r = MAX
+    r = kMax
 
     while l <= r:
       m = (l + r) // 2
-      if self._canStayFor(grid, fireGrid, m, DIRS):
+      if self._canStayFor(grid, fireGrid, m, dirs):
         ans = m
         l = m + 1
       else:
         r = m - 1
 
-    return 1e9 if ans == MAX else ans
+    return 1e9 if ans == kMax else ans
 
-  def _buildFireGrid(
-      self,
-      grid: list[list[int]],
-      fireMinute: list[list[int]],
-      DIRS: list[int],
-  ) -> None:
+  def _buildFireGrid(self, grid: List[List[int]], fireMinute: List[List[int]], dirs: List[int]) -> None:
     minuteFromFire = 0
     q = collections.deque()
 
@@ -38,7 +33,7 @@ def _buildFireGrid(
       minuteFromFire += 1
       for _ in range(len(q)):
         i, j = q.popleft()
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == len(grid) or y < 0 or y == len(grid[0]):
@@ -50,12 +45,7 @@ def _buildFireGrid(
           fireMinute[x][y] = minuteFromFire
           q.append((x, y))
 
-  def _canStayFor(
-      self,
-      grid: list[list[int]],
-      fireMinute: list[list[int]],
-      minute: int, DIRS: list[int],
-  ) -> bool:
+  def _canStayFor(self, grid: List[List[int]], fireMinute: List[List[int]], minute: int, dirs: List[int]) -> bool:
     q = collections.deque([(0, 0)])  # the start position
     seen = {(0, 0)}
 
@@ -63,7 +53,7 @@ def _canStayFor(
       minute += 1
       for _ in range(len(q)):
         i, j = q.popleft()
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == len(grid) or y < 0 or y == len(grid[0]):
diff --git a/solutions/226. Invert Binary Tree/226.py b/solutions/226. Invert Binary Tree/226.py
index aeba3cdd1e2..5112bb2ca2c 100644
--- a/solutions/226. Invert Binary Tree/226.py	
+++ b/solutions/226. Invert Binary Tree/226.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def invertTree(self, root: TreeNode | None) -> TreeNode | None:
+  def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
     if not root:
       return None
 
diff --git a/solutions/2260. Minimum Consecutive Cards to Pick Up/2260.py b/solutions/2260. Minimum Consecutive Cards to Pick Up/2260.py
index 6055599cb90..b6942f834fa 100644
--- a/solutions/2260. Minimum Consecutive Cards to Pick Up/2260.py	
+++ b/solutions/2260. Minimum Consecutive Cards to Pick Up/2260.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumCardPickup(self, cards: list[int]) -> int:
+  def minimumCardPickup(self, cards: List[int]) -> int:
     ans = math.inf
     lastSeen = {}
 
diff --git a/solutions/2261. K Divisible Elements Subarrays/2261.py b/solutions/2261. K Divisible Elements Subarrays/2261.py
index 1904865172e..2ff4d449b5a 100644
--- a/solutions/2261. K Divisible Elements Subarrays/2261.py	
+++ b/solutions/2261. K Divisible Elements Subarrays/2261.py	
@@ -1,11 +1,11 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[int, TrieNode] = {}
+    self.children: Dict[int, TrieNode] = {}
     self.count = 0
 
 
 class Solution:
-  def countDistinct(self, nums: list[int], k: int, p: int) -> int:
+  def countDistinct(self, nums: List[int], k: int, p: int) -> int:
     ans = 0
     root = TrieNode()
 
diff --git a/solutions/2263. Make Array Non-decreasing or Non-increasing/2263.cpp b/solutions/2263. Make Array Non-decreasing or Non-increasing/2263.cpp
index a8b4050838d..87494ce89e8 100644
--- a/solutions/2263. Make Array Non-decreasing or Non-increasing/2263.cpp	
+++ b/solutions/2263. Make Array Non-decreasing or Non-increasing/2263.cpp	
@@ -22,9 +22,9 @@ class Solution {
   }
 
   vector<int> negative(const vector<int>& nums) {
-    vector<int> arr(nums);
-    for (int& a : arr)
+    vector<int> A(nums);
+    for (int& a : A)
       a *= -1;
-    return arr;
+    return A;
   }
 };
diff --git a/solutions/2263. Make Array Non-decreasing or Non-increasing/2263.java b/solutions/2263. Make Array Non-decreasing or Non-increasing/2263.java
index b0944a79a80..62df5c3fba6 100644
--- a/solutions/2263. Make Array Non-decreasing or Non-increasing/2263.java	
+++ b/solutions/2263. Make Array Non-decreasing or Non-increasing/2263.java	
@@ -20,9 +20,9 @@ private int cost(int[] nums) {
   }
 
   private int[] negative(int[] nums) {
-    int[] arr = nums.clone();
-    for (int i = 0; i < arr.length; ++i)
-      arr[i] *= -1;
-    return arr;
+    int[] A = nums.clone();
+    for (int i = 0; i < A.length; ++i)
+      A[i] *= -1;
+    return A;
   }
 }
diff --git a/solutions/2263. Make Array Non-decreasing or Non-increasing/2263.py b/solutions/2263. Make Array Non-decreasing or Non-increasing/2263.py
index 794e6d0f672..228120da5c8 100644
--- a/solutions/2263. Make Array Non-decreasing or Non-increasing/2263.py	
+++ b/solutions/2263. Make Array Non-decreasing or Non-increasing/2263.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def convertArray(self, nums: list[int]) -> int:
-    def cost(nums: list[int]) -> int:
+  def convertArray(self, nums: List[int]) -> int:
+    def cost(nums: List[int]) -> int:
       ans = 0
       minHeap = []
 
diff --git a/solutions/2265. Count Nodes Equal to Average of Subtree/2265.py b/solutions/2265. Count Nodes Equal to Average of Subtree/2265.py
index 9c05e9bcd7d..a8c05bb7834 100644
--- a/solutions/2265. Count Nodes Equal to Average of Subtree/2265.py	
+++ b/solutions/2265. Count Nodes Equal to Average of Subtree/2265.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def averageOfSubtree(self, root: TreeNode | None) -> int:
+  def averageOfSubtree(self, root: Optional[TreeNode]) -> int:
     ans = 0
 
-    def dfs(root: TreeNode | None) -> tuple[int, int]:
+    def dfs(root: Optional[TreeNode]) -> Tuple[int, int]:
       nonlocal ans
       if not root:
         return (0, 0)
diff --git a/solutions/2266. Count Number of Texts/2266.java b/solutions/2266. Count Number of Texts/2266.java
index afa90fce2ff..6c74b6f3a25 100644
--- a/solutions/2266. Count Number of Texts/2266.java	
+++ b/solutions/2266. Count Number of Texts/2266.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int countTexts(String pressedKeys) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = pressedKeys.length();
     // dp[i] := the number of possible text messages of pressedKeys[i..n)
     long[] dp = new long[n + 1];
@@ -15,7 +15,7 @@ public int countTexts(String pressedKeys) {
       if ((pressedKeys.charAt(i) == '7' || pressedKeys.charAt(i) == '9') &&
           isSame(pressedKeys, i, 4))
         dp[i] += dp[i + 4];
-      dp[i] %= MOD;
+      dp[i] %= kMod;
     }
 
     return (int) dp[0];
diff --git a/solutions/2266. Count Number of Texts/2266.py b/solutions/2266. Count Number of Texts/2266.py
index 2ec6c33961b..44ba42b8243 100644
--- a/solutions/2266. Count Number of Texts/2266.py	
+++ b/solutions/2266. Count Number of Texts/2266.py	
@@ -1,6 +1,6 @@
 class Solution:
   def countTexts(self, pressedKeys: str) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     n = len(pressedKeys)
     # dp[i] := the number of possible text messages of pressedKeys[i..n)
     dp = [0] * n + [1]
@@ -20,9 +20,9 @@ def isSame(s: str, i: int, k: int) -> bool:
         dp[i] += dp[i + 2]
       if isSame(pressedKeys, i, 3):
         dp[i] += dp[i + 3]
-      if ((pressedKeys[i] == '7' or pressedKeys[i] == '9') and
-              isSame(pressedKeys, i, 4)):
+      if (pressedKeys[i] == '7' or pressedKeys[i] == '9') and \
+              isSame(pressedKeys, i, 4):
         dp[i] += dp[i + 4]
-      dp[i] %= MOD
+      dp[i] %= kMod
 
     return dp[0]
diff --git a/solutions/2267. Check if There Is a Valid Parentheses String Path/2267.py b/solutions/2267. Check if There Is a Valid Parentheses String Path/2267.py
index 0dd9cdb7494..e937df818a4 100644
--- a/solutions/2267. Check if There Is a Valid Parentheses String Path/2267.py	
+++ b/solutions/2267. Check if There Is a Valid Parentheses String Path/2267.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def hasValidPath(self, grid: list[list[str]]) -> bool:
+  def hasValidPath(self, grid: List[List[str]]) -> bool:
     @functools.lru_cache(None)
     def dp(i: int, j: int, k: int) -> bool:
       """
diff --git a/solutions/2268. Minimum Number of Keypresses/2268.java b/solutions/2268. Minimum Number of Keypresses/2268.java
index f3aebf3411e..a6293282d6b 100644
--- a/solutions/2268. Minimum Number of Keypresses/2268.java	
+++ b/solutions/2268. Minimum Number of Keypresses/2268.java	
@@ -7,7 +7,7 @@ public int minimumKeypresses(String s) {
     for (final char c : s.toCharArray())
       ++count[c - 'a'];
 
-    Arrays.sort(count, Comparator.reverseOrder());
+    Arrays.sort(count, (a, b) -> b - a);
 
     for (int i = 0; i < 26; ++i)
       ans += count[i] * (i / 9 + 1);
diff --git a/solutions/2270. Number of Ways to Split Array/2270.py b/solutions/2270. Number of Ways to Split Array/2270.py
index 3a2e4a89bfb..3b4b644abcd 100644
--- a/solutions/2270. Number of Ways to Split Array/2270.py	
+++ b/solutions/2270. Number of Ways to Split Array/2270.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def waysToSplitArray(self, nums: list[int]) -> int:
+  def waysToSplitArray(self, nums: List[int]) -> int:
     ans = 0
     prefix = 0
     suffix = sum(nums)
diff --git a/solutions/2271. Maximum White Tiles Covered by a Carpet/2271.java b/solutions/2271. Maximum White Tiles Covered by a Carpet/2271.java
index 3f3ab65e25e..5bc2bc702aa 100644
--- a/solutions/2271. Maximum White Tiles Covered by a Carpet/2271.java	
+++ b/solutions/2271. Maximum White Tiles Covered by a Carpet/2271.java	
@@ -7,7 +7,7 @@ public int maximumWhiteTiles(int[][] tiles, int carpetLen) {
     List<Integer> starts = new ArrayList<>();
     int[] prefix = new int[tiles.length + 1];
 
-    Arrays.sort(tiles, Comparator.comparingInt(tile -> tile[0]));
+    Arrays.sort(tiles, (a, b) -> a[0] - b[0]);
 
     for (int[] tile : tiles)
       starts.add(tile[0]);
@@ -28,8 +28,8 @@ public int maximumWhiteTiles(int[][] tiles, int carpetLen) {
     return ans;
   }
 
-  private int firstGreater(List<Integer> arr, int target) {
-    final int i = Collections.binarySearch(arr, target + 1);
+  private int firstGreater(List<Integer> A, int target) {
+    final int i = Collections.binarySearch(A, target + 1);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/2271. Maximum White Tiles Covered by a Carpet/2271.py b/solutions/2271. Maximum White Tiles Covered by a Carpet/2271.py
index 1011d6f1235..94bf92a5a48 100644
--- a/solutions/2271. Maximum White Tiles Covered by a Carpet/2271.py	
+++ b/solutions/2271. Maximum White Tiles Covered by a Carpet/2271.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumWhiteTiles(self, tiles: list[list[int]], carpetLen: int) -> int:
+  def maximumWhiteTiles(self, tiles: List[List[int]], carpetLen: int) -> int:
     if any(tile[1] - tile[0] + 1 >= carpetLen for tile in tiles):
       return carpetLen
 
diff --git a/solutions/2273. Find Resultant Array After Removing Anagrams/2273.py b/solutions/2273. Find Resultant Array After Removing Anagrams/2273.py
index a2e586ca87d..5d06487e3b4 100644
--- a/solutions/2273. Find Resultant Array After Removing Anagrams/2273.py	
+++ b/solutions/2273. Find Resultant Array After Removing Anagrams/2273.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def removeAnagrams(self, words: list[str]) -> list[str]:
+  def removeAnagrams(self, words: List[str]) -> List[str]:
     ans = []
 
     def isAnagram(a: str, b: str) -> bool:
diff --git a/solutions/2274. Maximum Consecutive Floors Without Special Floors/2274.py b/solutions/2274. Maximum Consecutive Floors Without Special Floors/2274.py
index 71dec4439e9..b764554fd42 100644
--- a/solutions/2274. Maximum Consecutive Floors Without Special Floors/2274.py	
+++ b/solutions/2274. Maximum Consecutive Floors Without Special Floors/2274.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxConsecutive(self, bottom: int, top: int, special: list[int]) -> int:
+  def maxConsecutive(self, bottom: int, top: int, special: List[int]) -> int:
     ans = 0
 
     special.sort()
diff --git a/solutions/2275. Largest Combination With Bitwise AND Greater Than Zero/2275.java b/solutions/2275. Largest Combination With Bitwise AND Greater Than Zero/2275.java
index 1f3e6bfe9f9..7c7c96b6fab 100644
--- a/solutions/2275. Largest Combination With Bitwise AND Greater Than Zero/2275.java	
+++ b/solutions/2275. Largest Combination With Bitwise AND Greater Than Zero/2275.java	
@@ -1,9 +1,9 @@
 class Solution {
   public int largestCombination(int[] candidates) {
-    final int MAX_BIT = 24;
+    final int kMaxBit = 24;
     int ans = 0;
 
-    for (int i = 0; i < MAX_BIT; ++i) {
+    for (int i = 0; i < kMaxBit; ++i) {
       int count = 0;
       for (final int candidate : candidates)
         if ((candidate >> i & 1) == 1)
diff --git a/solutions/2275. Largest Combination With Bitwise AND Greater Than Zero/2275.py b/solutions/2275. Largest Combination With Bitwise AND Greater Than Zero/2275.py
index 8dd45fb189f..23fc7eafdec 100644
--- a/solutions/2275. Largest Combination With Bitwise AND Greater Than Zero/2275.py	
+++ b/solutions/2275. Largest Combination With Bitwise AND Greater Than Zero/2275.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def largestCombination(self, candidates: list[int]) -> int:
+  def largestCombination(self, candidates: List[int]) -> int:
     return max(sum(c >> i & 1 for c in candidates) for i in range(24))
diff --git a/solutions/2277. Closest Node to Path in Tree/2277.cpp b/solutions/2277. Closest Node to Path in Tree/2277.cpp
index edec3672f51..1d4c5288179 100644
--- a/solutions/2277. Closest Node to Path in Tree/2277.cpp	
+++ b/solutions/2277. Closest Node to Path in Tree/2277.cpp	
@@ -16,10 +16,10 @@ class Solution {
     for (int i = 0; i < n; ++i)
       fillDist(tree, i, i, 0, dist);
 
-    for (const vector<int>& query : queries) {
-      const int start = query[0];
-      const int end = query[1];
-      const int node = query[2];
+    for (const vector<int>& q : query) {
+      const int start = q[0];
+      const int end = q[1];
+      const int node = q[2];
       ans.push_back(findClosest(tree, dist, start, end, node, start));
     }
 
diff --git a/solutions/2277. Closest Node to Path in Tree/2277.py b/solutions/2277. Closest Node to Path in Tree/2277.py
index c291a053f84..9de1bde6010 100644
--- a/solutions/2277. Closest Node to Path in Tree/2277.py	
+++ b/solutions/2277. Closest Node to Path in Tree/2277.py	
@@ -1,10 +1,6 @@
 class Solution:
-  def closestNode(
-      self,
-      n: int,
-      edges: list[list[int]],
-      query: list[list[int]],
-  ) -> list[int]:
+  def closestNode(self, n: int, edges: List[List[int]], query: List[List[int]]) -> List[int]:
+    ans = []
     tree = [[] for _ in range(n)]
     dist = [[-1] * n for _ in range(n)]
 
@@ -24,8 +20,7 @@ def fillDist(start: int, u: int, d: int) -> None:
     def findClosest(u: int, end: int, node: int, ans: int) -> int:
       for v in tree[u]:
         if dist[v][end] < dist[u][end]:
-          return findClosest(
-              v, end, node, ans if dist[ans][node] < dist[v][node] else v)
+          return findClosest(v, end, node, ans if dist[ans][node] < dist[v][node] else v)
       return ans
 
     return [findClosest(start, end, node, start)
diff --git a/solutions/2279. Maximum Bags With Full Capacity of Rocks/2279.py b/solutions/2279. Maximum Bags With Full Capacity of Rocks/2279.py
index 8f3a572c182..b0b1784891a 100644
--- a/solutions/2279. Maximum Bags With Full Capacity of Rocks/2279.py	
+++ b/solutions/2279. Maximum Bags With Full Capacity of Rocks/2279.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def maximumBags(
-      self,
-      capacity: list[int],
-      rocks: list[int],
-      additionalRocks: int,
-  ) -> int:
+  def maximumBags(self, capacity: List[int], rocks: List[int], additionalRocks: int) -> int:
     for i, d in enumerate(sorted([c - r for c, r in zip(capacity, rocks)])):
       if d > additionalRocks:
         return i
diff --git a/solutions/228. Summary Ranges/228.py b/solutions/228. Summary Ranges/228.py
index 486ced95dd7..eccf562aed3 100644
--- a/solutions/228. Summary Ranges/228.py	
+++ b/solutions/228. Summary Ranges/228.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def summaryRanges(self, nums: list[int]) -> list[str]:
+  def summaryRanges(self, nums: List[int]) -> List[str]:
     ans = []
 
     i = 0
diff --git a/solutions/2280. Minimum Lines to Represent a Line Chart/2280.java b/solutions/2280. Minimum Lines to Represent a Line Chart/2280.java
index cf7125e4005..695bd1c4d6e 100644
--- a/solutions/2280. Minimum Lines to Represent a Line Chart/2280.java	
+++ b/solutions/2280. Minimum Lines to Represent a Line Chart/2280.java	
@@ -2,7 +2,7 @@ class Solution {
   public int minimumLines(int[][] stockPrices) {
     int ans = 0;
 
-    Arrays.sort(stockPrices, Comparator.comparingInt(stockPrice -> stockPrice[0]));
+    Arrays.sort(stockPrices, (a, b) -> a[0] - b[0]);
 
     for (int i = 2; i < stockPrices.length; ++i) {
       Pair<Integer, Integer> a = getSlope(stockPrices[i - 2], stockPrices[i - 1]);
diff --git a/solutions/2280. Minimum Lines to Represent a Line Chart/2280.py b/solutions/2280. Minimum Lines to Represent a Line Chart/2280.py
index fe94a514390..06bc490a071 100644
--- a/solutions/2280. Minimum Lines to Represent a Line Chart/2280.py	
+++ b/solutions/2280. Minimum Lines to Represent a Line Chart/2280.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def minimumLines(self, stockPrices: list[list[int]]) -> int:
+  def minimumLines(self, stockPrices: List[List[int]]) -> int:
     ans = 0
 
     stockPrices.sort()
 
-    def getSlope(p: list[int], q: list[int]) -> tuple[int, int]:
+    def getSlope(p: List[int], q: List[int]) -> Tuple[int, int]:
       dx = p[0] - q[0]
       dy = p[1] - q[1]
       if dx == 0:
diff --git a/solutions/2281. Sum of Total Strength of Wizards/2281.java b/solutions/2281. Sum of Total Strength of Wizards/2281.java
index 88be49491e2..23f2b0e447a 100644
--- a/solutions/2281. Sum of Total Strength of Wizards/2281.java	
+++ b/solutions/2281. Sum of Total Strength of Wizards/2281.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int totalStrength(int[] strength) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = strength.length;
     long[] prefix = new long[n];
     long[] prefixOfPrefix = new long[n + 1];
@@ -15,10 +15,10 @@ public int totalStrength(int[] strength) {
     Deque<Integer> stack = new ArrayDeque<>();
 
     for (int i = 0; i < n; ++i)
-      prefix[i] = i == 0 ? strength[0] : (strength[i] + prefix[i - 1]) % MOD;
+      prefix[i] = i == 0 ? strength[0] : (strength[i] + prefix[i - 1]) % kMod;
 
     for (int i = 0; i < n; ++i)
-      prefixOfPrefix[i + 1] = (prefixOfPrefix[i] + prefix[i]) % MOD;
+      prefixOfPrefix[i + 1] = (prefixOfPrefix[i] + prefix[i]) % kMod;
 
     for (int i = n - 1; i >= 0; --i) {
       while (!stack.isEmpty() && strength[stack.peek()] >= strength[i])
@@ -44,8 +44,8 @@ public int totalStrength(int[] strength) {
       final long rightSum = prefixOfPrefix[r] - prefixOfPrefix[i];
       final int leftLen = i - l;
       final int rightLen = r - i;
-      ans += strength[i] * (rightSum * leftLen % MOD - leftSum * rightLen % MOD + MOD) % MOD;
-      ans %= MOD;
+      ans += strength[i] * (rightSum * leftLen % kMod - leftSum * rightLen % kMod + kMod) % kMod;
+      ans %= kMod;
     }
 
     return (int) ans;
diff --git a/solutions/2281. Sum of Total Strength of Wizards/2281.py b/solutions/2281. Sum of Total Strength of Wizards/2281.py
index c2b76ff99f4..6481b706089 100644
--- a/solutions/2281. Sum of Total Strength of Wizards/2281.py	
+++ b/solutions/2281. Sum of Total Strength of Wizards/2281.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def totalStrength(self, strength: list[int]) -> int:
-    MOD = 1_000_000_007
+  def totalStrength(self, strength: List[int]) -> int:
+    kMod = 1_000_000_007
     n = len(strength)
     # left[i] := the next index on the left (if any)
     #            s.t. nums[left[i]] <= nums[i]
@@ -32,6 +32,6 @@ def totalStrength(self, strength: list[int]) -> int:
       rightSum = prefixOfPrefix[r] - prefixOfPrefix[i]
       leftLen = i - l
       rightLen = r - i
-      ans += strength[i] * (rightSum * leftLen - leftSum * rightLen) % MOD
+      ans += strength[i] * (rightSum * leftLen - leftSum * rightLen) % kMod
 
-    return ans % MOD
+    return ans % kMod
diff --git a/solutions/2282. Number of People That Can Be Seen in a Grid/2282.py b/solutions/2282. Number of People That Can Be Seen in a Grid/2282.py
index de50bd64d4d..fd3f9ce7449 100644
--- a/solutions/2282. Number of People That Can Be Seen in a Grid/2282.py	
+++ b/solutions/2282. Number of People That Can Be Seen in a Grid/2282.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def seePeople(self, heights: list[list[int]]) -> list[list[int]]:
+  def seePeople(self, heights: List[List[int]]) -> List[List[int]]:
     m = len(heights)
     n = len(heights[0])
     ans = [[0] * n for _ in range(m)]
diff --git a/solutions/2284. Sender With Largest Word Count/2284.py b/solutions/2284. Sender With Largest Word Count/2284.py
index 068f84f1bb3..ba637000761 100644
--- a/solutions/2284. Sender With Largest Word Count/2284.py	
+++ b/solutions/2284. Sender With Largest Word Count/2284.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestWordCount(self, messages: list[str], senders: list[str]) -> str:
+  def largestWordCount(self, messages: List[str], senders: List[str]) -> str:
     n = len(messages)
     ans = ''
     maxWordsSent = 0
diff --git a/solutions/2285. Maximum Total Importance of Roads/2285.py b/solutions/2285. Maximum Total Importance of Roads/2285.py
index a8058e90ca0..53f6bb7e3ce 100644
--- a/solutions/2285. Maximum Total Importance of Roads/2285.py	
+++ b/solutions/2285. Maximum Total Importance of Roads/2285.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumImportance(self, n: int, roads: list[list[int]]) -> int:
+  def maximumImportance(self, n: int, roads: List[List[int]]) -> int:
     count = [0] * n
 
     for u, v in roads:
diff --git a/solutions/2286. Booking Concert Tickets in Groups/2286.cpp b/solutions/2286. Booking Concert Tickets in Groups/2286.cpp
index aa6a8033e83..ad0fede2c95 100644
--- a/solutions/2286. Booking Concert Tickets in Groups/2286.cpp	
+++ b/solutions/2286. Booking Concert Tickets in Groups/2286.cpp	
@@ -1,23 +1,23 @@
 struct SegmentTreeNode {
   int lo;
   int hi;
-  std::unique_ptr<SegmentTreeNode> left;
-  std::unique_ptr<SegmentTreeNode> right;
+  unique_ptr<SegmentTreeNode> left;
+  unique_ptr<SegmentTreeNode> right;
   int mx;
   long sum;
-  SegmentTreeNode(int lo, int hi, std::unique_ptr<SegmentTreeNode>&& left,
-                  std::unique_ptr<SegmentTreeNode>&& right, int mx, long sum)
+  SegmentTreeNode(int lo, int hi, unique_ptr<SegmentTreeNode>&& left,
+                  unique_ptr<SegmentTreeNode>&& right, int mx, long sum)
       : lo(lo),
         hi(hi),
-        left(std::move(left)),
-        right(std::move(right)),
+        left(move(left)),
+        right(move(right)),
         mx(mx),
         sum(sum) {}
 };
 
 class SegmentTree {
  public:
-  explicit SegmentTree(int n, int m) : m(m), root(std::move(build(0, n - 1))) {}
+  explicit SegmentTree(int n, int m) : m(m), root(move(build(0, n - 1))) {}
 
   vector<int> maxRange(int k, int maxRow) {
     return maxRange(root, k, maxRow);
@@ -34,21 +34,20 @@ class SegmentTree {
 
  private:
   const int m;
-  std::unique_ptr<SegmentTreeNode> root;
+  unique_ptr<SegmentTreeNode> root;
 
-  std::unique_ptr<SegmentTreeNode> build(int l, int r) {
+  unique_ptr<SegmentTreeNode> build(int l, int r) {
     if (l == r)
       return make_unique<SegmentTreeNode>(l, r, nullptr, nullptr, m, m);
     const int mid = (l + r) / 2;
-    std::unique_ptr<SegmentTreeNode> left = build(l, mid);
-    std::unique_ptr<SegmentTreeNode> right = build(mid + 1, r);
-    return make_unique<SegmentTreeNode>(l, r, std::move(left), std::move(right),
+    unique_ptr<SegmentTreeNode> left = build(l, mid);
+    unique_ptr<SegmentTreeNode> right = build(mid + 1, r);
+    return make_unique<SegmentTreeNode>(l, r, move(left), move(right),
                                         max(left->mx, right->mx),
                                         left->sum + right->sum);
   }
 
-  vector<int> maxRange(std::unique_ptr<SegmentTreeNode>& root, int k,
-                       int maxRow) {
+  vector<int> maxRange(unique_ptr<SegmentTreeNode>& root, int k, int maxRow) {
     if (root->lo == root->hi) {
       if (root->sum < k || root->lo > maxRow)
         return {};
@@ -60,7 +59,7 @@ class SegmentTree {
     return maxRange(root->right, k, maxRow);
   }
 
-  long sumRange(std::unique_ptr<SegmentTreeNode>& root, int i, int j) {
+  long sumRange(unique_ptr<SegmentTreeNode>& root, int i, int j) {
     if (root->lo == i && root->hi == j)
       return root->sum;
     const int mid = (root->lo + root->hi) / 2;
@@ -71,7 +70,7 @@ class SegmentTree {
     return sumRange(root->left, i, mid) + sumRange(root->right, mid + 1, j);
   }
 
-  void substract(std::unique_ptr<SegmentTreeNode>& root, int row, int k) {
+  void substract(unique_ptr<SegmentTreeNode>& root, int row, int k) {
     if (root == nullptr)
       return;
     if (root->lo == root->hi && root->hi == row) {
diff --git a/solutions/2288. Apply Discount to Prices/2288.java b/solutions/2288. Apply Discount to Prices/2288.java
index 262ce82a77b..5e99ac3005d 100644
--- a/solutions/2288. Apply Discount to Prices/2288.java	
+++ b/solutions/2288. Apply Discount to Prices/2288.java	
@@ -1,6 +1,6 @@
 class Solution {
   public String discountPrices(String sentence, int discount) {
-    final int PRECISION = 2;
+    final int kPrecision = 2;
     StringBuilder sb = new StringBuilder();
 
     for (final String word : sentence.split(" "))
@@ -9,7 +9,7 @@ public String discountPrices(String sentence, int discount) {
         if (digits.chars().allMatch(c -> Character.isDigit(c))) {
           final double val = Double.parseDouble(digits) * (100 - discount) / 100;
           final String s = String.format("%.2f", val);
-          final String trimmed = s.substring(0, s.indexOf(".") + PRECISION + 1);
+          final String trimmed = s.substring(0, s.indexOf(".") + kPrecision + 1);
           sb.append("$").append(trimmed).append(" ");
         } else {
           sb.append(word).append(" ");
diff --git a/solutions/2288. Apply Discount to Prices/2288.py b/solutions/2288. Apply Discount to Prices/2288.py
index 43fa84f5cce..938449ea468 100644
--- a/solutions/2288. Apply Discount to Prices/2288.py	
+++ b/solutions/2288. Apply Discount to Prices/2288.py	
@@ -1,6 +1,6 @@
 class Solution:
   def discountPrices(self, sentence: str, discount: int) -> str:
-    PRECISION = 2
+    kPrecision = 2
     ans = []
 
     for word in sentence.split():
@@ -9,7 +9,7 @@ def discountPrices(self, sentence: str, discount: int) -> str:
         if all(digit.isdigit() for digit in digits):
           val = float(digits) * (100 - discount) / 100
           s = f'{val:.2f}'
-          trimmed = s[:s.index('.') + PRECISION + 1]
+          trimmed = s[:s.index('.') + kPrecision + 1]
           ans.append('$' + trimmed)
         else:
           ans.append(word)
diff --git a/solutions/2289. Steps to Make Array Non-decreasing/2289.py b/solutions/2289. Steps to Make Array Non-decreasing/2289.py
index 47035d2308f..d6724fcab5e 100644
--- a/solutions/2289. Steps to Make Array Non-decreasing/2289.py	
+++ b/solutions/2289. Steps to Make Array Non-decreasing/2289.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def totalSteps(self, nums: list[int]) -> int:
+  def totalSteps(self, nums: List[int]) -> int:
     # dp[i] := the number of steps to remove nums[i]
     dp = [0] * len(nums)
     stack = []
diff --git a/solutions/229. Majority Element II/229.py b/solutions/229. Majority Element II/229.py
index 9b48b31559c..e3226e63f92 100644
--- a/solutions/229. Majority Element II/229.py	
+++ b/solutions/229. Majority Element II/229.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def majorityElement(self, nums: list[int]) -> list[int]:
+  def majorityElement(self, nums: List[int]) -> List[int]:
     ans1 = 0
     ans2 = 1
     count1 = 0
diff --git a/solutions/2290. Minimum Obstacle Removal to Reach Corner/2290.cpp b/solutions/2290. Minimum Obstacle Removal to Reach Corner/2290.cpp
index a618a82b24a..199be0d6c87 100644
--- a/solutions/2290. Minimum Obstacle Removal to Reach Corner/2290.cpp	
+++ b/solutions/2290. Minimum Obstacle Removal to Reach Corner/2290.cpp	
@@ -3,7 +3,7 @@ class Solution {
   int minimumObstacles(vector<vector<int>>& grid) {
     const int m = grid.size();
     const int n = grid[0].size();
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     using T = tuple<int, int, int>;  // (d, i, j)
     priority_queue<T, vector<T>, greater<>> minHeap;
     vector<vector<int>> dist(m, vector<int>(n, INT_MAX));
@@ -16,7 +16,7 @@ class Solution {
       minHeap.pop();
       if (i == m - 1 && j == n - 1)
         return d;
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/2290. Minimum Obstacle Removal to Reach Corner/2290.java b/solutions/2290. Minimum Obstacle Removal to Reach Corner/2290.java
index cef99a3bb93..12c5caf9ea7 100644
--- a/solutions/2290. Minimum Obstacle Removal to Reach Corner/2290.java	
+++ b/solutions/2290. Minimum Obstacle Removal to Reach Corner/2290.java	
@@ -1,13 +1,14 @@
 class Solution {
   public int minimumObstacles(int[][] grid) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = grid.length;
     final int n = grid[0].length;
-    Queue<int[]> minHeap = new PriorityQueue<>(Comparator.comparingInt(a -> a[0])) {
-      { offer(new int[] {grid[0][0], 0, 0}); } // (d, i, j)
-    };
+    // (d, i, j)
+    Queue<int[]> minHeap = new PriorityQueue<>((a, b) -> a[0] - b[0]);
     int[][] dist = new int[m][n];
     Arrays.stream(dist).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE));
+
+    minHeap.offer(new int[] {grid[0][0], 0, 0});
     dist[0][0] = grid[0][0];
 
     while (!minHeap.isEmpty()) {
@@ -16,7 +17,7 @@ public int minimumObstacles(int[][] grid) {
       final int j = minHeap.poll()[2];
       if (i == m - 1 && j == n - 1)
         return d;
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/2290. Minimum Obstacle Removal to Reach Corner/2290.py b/solutions/2290. Minimum Obstacle Removal to Reach Corner/2290.py
index 394024cd46e..d3509551417 100644
--- a/solutions/2290. Minimum Obstacle Removal to Reach Corner/2290.py	
+++ b/solutions/2290. Minimum Obstacle Removal to Reach Corner/2290.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def minimumObstacles(self, grid: list[list[int]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def minimumObstacles(self, grid: List[List[int]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
     minHeap = [(grid[0][0], 0, 0)]  # (d, i, j)
@@ -11,7 +11,7 @@ def minimumObstacles(self, grid: list[list[int]]) -> int:
       d, i, j = heapq.heappop(minHeap)
       if i == m - 1 and j == n - 1:
         return d
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/2291. Maximum Profit From Trading Stocks/2291-2.py b/solutions/2291. Maximum Profit From Trading Stocks/2291-2.py
index 07b6e30fc4e..d57f17c6177 100644
--- a/solutions/2291. Maximum Profit From Trading Stocks/2291-2.py	
+++ b/solutions/2291. Maximum Profit From Trading Stocks/2291-2.py	
@@ -1,10 +1,6 @@
 class Solution:
-  def maximumProfit(
-      self,
-      present: list[int],
-      future: list[int],
-      budget: int,
-  ) -> int:
+  def maximumProfit(self, present: List[int], future: List[int], budget: int) -> int:
+    n = len(present)
     # dp[i] := the maximum profit of buying present so far with i budget
     dp = [0] * (budget + 1)
 
diff --git a/solutions/2291. Maximum Profit From Trading Stocks/2291.py b/solutions/2291. Maximum Profit From Trading Stocks/2291.py
index 02c7110a72c..126621c5aa0 100644
--- a/solutions/2291. Maximum Profit From Trading Stocks/2291.py	
+++ b/solutions/2291. Maximum Profit From Trading Stocks/2291.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def maximumProfit(
-      self,
-      present: list[int],
-      future: list[int],
-      budget: int,
-  ) -> int:
+  def maximumProfit(self, present: List[int], future: List[int], budget: int) -> int:
     n = len(present)
     # dp[i][j] := the maximum profit of buying present[0..i) with j budget
     dp = [[0] * (budget + 1) for _ in range(n + 1)]
diff --git a/solutions/2293. Min Max Game/2293.py b/solutions/2293. Min Max Game/2293.py
index 72502113c71..5f1048d0d86 100644
--- a/solutions/2293. Min Max Game/2293.py	
+++ b/solutions/2293. Min Max Game/2293.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minMaxGame(self, nums: list[int]) -> int:
+  def minMaxGame(self, nums: List[int]) -> int:
     if len(nums) == 1:
       return nums[0]
 
diff --git a/solutions/2294. Partition Array Such That Maximum Difference Is K/2294.py b/solutions/2294. Partition Array Such That Maximum Difference Is K/2294.py
index 1dc62996fac..fcc4f9552ae 100644
--- a/solutions/2294. Partition Array Such That Maximum Difference Is K/2294.py	
+++ b/solutions/2294. Partition Array Such That Maximum Difference Is K/2294.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def partitionArray(self, nums: list[int], k: int) -> int:
+  def partitionArray(self, nums: List[int], k: int) -> int:
     nums.sort()
 
     ans = 1
diff --git a/solutions/2295. Replace Elements in an Array/2295.py b/solutions/2295. Replace Elements in an Array/2295.py
index 1d6a597a9b4..36a04fcb8a8 100644
--- a/solutions/2295. Replace Elements in an Array/2295.py	
+++ b/solutions/2295. Replace Elements in an Array/2295.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def arrayChange(
-      self,
-      nums: list[int],
-      operations: list[list[int]],
-  ) -> list[int]:
+  def arrayChange(self, nums: List[int], operations: List[List[int]]) -> List[int]:
     numToIndex = {num: i for i, num in enumerate(nums)}
 
     for original, replaced in operations:
diff --git a/solutions/2297. Jump Game IX/2297.py b/solutions/2297. Jump Game IX/2297.py
index 17c06d18b0c..c3b3ceec741 100644
--- a/solutions/2297. Jump Game IX/2297.py	
+++ b/solutions/2297. Jump Game IX/2297.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minCost(self, nums: list[int], costs: list[int]) -> int:
+  def minCost(self, nums: List[int], costs: List[int]) -> int:
     # dp[i] := the minimum cost to jump to i
     dp = [math.inf] * len(nums)
     maxStack = []
diff --git a/solutions/23. Merge k Sorted Lists/23.java b/solutions/23. Merge k Sorted Lists/23.java
index 237f8b814b5..148d1809a5f 100644
--- a/solutions/23. Merge k Sorted Lists/23.java	
+++ b/solutions/23. Merge k Sorted Lists/23.java	
@@ -2,7 +2,7 @@ class Solution {
   public ListNode mergeKLists(ListNode[] lists) {
     ListNode dummy = new ListNode(0);
     ListNode curr = dummy;
-    Queue<ListNode> minHeap = new PriorityQueue<>(Comparator.comparingInt(a -> a.val));
+    Queue<ListNode> minHeap = new PriorityQueue<>((a, b) -> a.val - b.val);
 
     for (final ListNode list : lists)
       if (list != null)
diff --git a/solutions/23. Merge k Sorted Lists/23.py b/solutions/23. Merge k Sorted Lists/23.py
index cb56e2c0125..abe295f4a67 100644
--- a/solutions/23. Merge k Sorted Lists/23.py	
+++ b/solutions/23. Merge k Sorted Lists/23.py	
@@ -2,7 +2,7 @@
 
 
 class Solution:
-  def mergeKLists(self, lists: list[ListNode]) -> ListNode:
+  def mergeKLists(self, lists: List[ListNode]) -> ListNode:
     dummy = ListNode(0)
     curr = dummy
     pq = PriorityQueue()
diff --git a/solutions/230. Kth Smallest Element in a BST/230-2.py b/solutions/230. Kth Smallest Element in a BST/230-2.py
index 9aedb66bd14..877fceb8130 100644
--- a/solutions/230. Kth Smallest Element in a BST/230-2.py	
+++ b/solutions/230. Kth Smallest Element in a BST/230-2.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def kthSmallest(self, root: TreeNode | None, k: int) -> int:
+  def kthSmallest(self, root: Optional[TreeNode], k: int) -> int:
     rank = 0
     ans = 0
 
-    def traverse(root: TreeNode | None) -> None:
+    def traverse(root: Optional[TreeNode]) -> None:
       nonlocal rank
       nonlocal ans
       if not root:
diff --git a/solutions/230. Kth Smallest Element in a BST/230-3.cpp b/solutions/230. Kth Smallest Element in a BST/230-3.cpp
index 6345b0de7ca..3bc598bb5e4 100644
--- a/solutions/230. Kth Smallest Element in a BST/230-3.cpp	
+++ b/solutions/230. Kth Smallest Element in a BST/230-3.cpp	
@@ -3,7 +3,7 @@ class Solution {
   int kthSmallest(TreeNode* root, int k) {
     stack<TreeNode*> stack;
 
-    while (root != nullptr) {
+    while (root) {
       stack.push(root);
       root = root->left;
     }
@@ -11,7 +11,7 @@ class Solution {
     for (int i = 0; i < k - 1; ++i) {
       root = stack.top(), stack.pop();
       root = root->right;
-      while (root != nullptr) {
+      while (root) {
         stack.push(root);
         root = root->left;
       }
diff --git a/solutions/230. Kth Smallest Element in a BST/230-3.py b/solutions/230. Kth Smallest Element in a BST/230-3.py
index 33203d8241a..63197452dc4 100644
--- a/solutions/230. Kth Smallest Element in a BST/230-3.py	
+++ b/solutions/230. Kth Smallest Element in a BST/230-3.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def kthSmallest(self, root: TreeNode | None, k: int) -> int:
+  def kthSmallest(self, root: Optional[TreeNode], k: int) -> int:
     stack = []
 
     while root:
diff --git a/solutions/230. Kth Smallest Element in a BST/230.py b/solutions/230. Kth Smallest Element in a BST/230.py
index 87e8d427c0e..3dd11381def 100644
--- a/solutions/230. Kth Smallest Element in a BST/230.py	
+++ b/solutions/230. Kth Smallest Element in a BST/230.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def kthSmallest(self, root: TreeNode | None, k: int) -> int:
-    def countNodes(root: TreeNode | None) -> int:
+  def kthSmallest(self, root: Optional[TreeNode], k: int) -> int:
+    def countNodes(root: Optional[TreeNode]) -> int:
       if not root:
         return 0
       return 1 + countNodes(root.left) + countNodes(root.right)
diff --git a/solutions/2300. Successful Pairs of Spells and Potions/2300.py b/solutions/2300. Successful Pairs of Spells and Potions/2300.py
index 5e97d34df8f..26a162e4b7e 100644
--- a/solutions/2300. Successful Pairs of Spells and Potions/2300.py	
+++ b/solutions/2300. Successful Pairs of Spells and Potions/2300.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def successfulPairs(
-      self,
-      spells: list[int],
-      potions: list[int],
-      success: int,
-  ) -> list[int]:
+  def successfulPairs(self, spells: List[int], potions: List[int], success: int) -> List[int]:
     potions.sort()
 
     def firstIndexSuccess(spell: int):
diff --git a/solutions/2301. Match Substring After Replacement/2301.py b/solutions/2301. Match Substring After Replacement/2301.py
index 02bb9b39d02..873005f8288 100644
--- a/solutions/2301. Match Substring After Replacement/2301.py	
+++ b/solutions/2301. Match Substring After Replacement/2301.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def matchReplacement(
-      self,
-      s: str,
-      sub: str,
-      mappings: list[list[str]],
-  ) -> bool:
+  def matchReplacement(self, s: str, sub: str, mappings: List[List[str]]) -> bool:
     isMapped = [[False] * 128 for _ in range(128)]
 
     for old, new in mappings:
@@ -16,13 +11,7 @@ def matchReplacement(
 
     return False
 
-  def _canTransform(
-      self,
-      s: str,
-      start: int,
-      sub: str,
-      isMapped: list[list[bool]],
-  ) -> bool:
+  def _canTransform(self, s: str, start: int, sub: str, isMapped: List[List[bool]]) -> bool:
     if start + len(sub) > len(s):
       return False
 
diff --git a/solutions/2302. Count Subarrays With Score Less Than K/2302.py b/solutions/2302. Count Subarrays With Score Less Than K/2302.py
index a23e60dc9c7..a687853fd7a 100644
--- a/solutions/2302. Count Subarrays With Score Less Than K/2302.py	
+++ b/solutions/2302. Count Subarrays With Score Less Than K/2302.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countSubarrays(self, nums: list[int], k: int) -> int:
+  def countSubarrays(self, nums: List[int], k: int) -> int:
     ans = 0
     summ = 0
 
diff --git a/solutions/2303. Calculate Amount Paid in Taxes/2303.py b/solutions/2303. Calculate Amount Paid in Taxes/2303.py
index ea3c0dc55d7..13c94a3185c 100644
--- a/solutions/2303. Calculate Amount Paid in Taxes/2303.py	
+++ b/solutions/2303. Calculate Amount Paid in Taxes/2303.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def calculateTax(self, brackets: list[list[int]], income: int) -> float:
+  def calculateTax(self, brackets: List[List[int]], income: int) -> float:
     ans = 0
     prev = 0
 
diff --git a/solutions/2304. Minimum Path Cost in a Grid/2304.py b/solutions/2304. Minimum Path Cost in a Grid/2304.py
index 4afc2c4d5c2..e6664d012e6 100644
--- a/solutions/2304. Minimum Path Cost in a Grid/2304.py	
+++ b/solutions/2304. Minimum Path Cost in a Grid/2304.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def minPathCost(
-      self,
-      grid: list[list[int]],
-      moveCost: list[list[int]],
-  ) -> int:
+  def minPathCost(self, grid: List[List[int]], moveCost: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
     # dp[i][j] := the minimum cost to reach grid[i][j]
diff --git a/solutions/2305. Fair Distribution of Cookies/2305.cpp b/solutions/2305. Fair Distribution of Cookies/2305.cpp
index 4cf623b7db3..fa5753b1a1d 100644
--- a/solutions/2305. Fair Distribution of Cookies/2305.cpp	
+++ b/solutions/2305. Fair Distribution of Cookies/2305.cpp	
@@ -16,7 +16,7 @@ class Solution {
 
     for (int i = 0; i < k; ++i) {
       children[i] += cookies[s];
-      dfs(cookies, s + 1, k, std::move(children), ans);
+      dfs(cookies, s + 1, k, move(children), ans);
       children[i] -= cookies[s];
     }
   }
diff --git a/solutions/2305. Fair Distribution of Cookies/2305.py b/solutions/2305. Fair Distribution of Cookies/2305.py
index 0601491f8b3..d0effb864f8 100644
--- a/solutions/2305. Fair Distribution of Cookies/2305.py	
+++ b/solutions/2305. Fair Distribution of Cookies/2305.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def distributeCookies(self, cookies: list[int], k: int) -> int:
+  def distributeCookies(self, cookies: List[int], k: int) -> int:
     ans = math.inf
 
-    def dfs(s: int, children: list[int]) -> None:
+    def dfs(s: int, children: List[int]) -> None:
       nonlocal ans
       if s == len(cookies):
         ans = min(ans, max(children))
diff --git a/solutions/2306. Naming a Company/2306.py b/solutions/2306. Naming a Company/2306.py
index e61ddf4c1df..dccca475e47 100644
--- a/solutions/2306. Naming a Company/2306.py	
+++ b/solutions/2306. Naming a Company/2306.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def distinctNames(self, ideas: list[str]) -> int:
+  def distinctNames(self, ideas: List[str]) -> int:
     ans = 0
     # suffixes[i] := the set of strings omitting the first letter, where the
     # first letter is ('a' + i)
@@ -8,8 +8,9 @@ def distinctNames(self, ideas: list[str]) -> int:
     for idea in ideas:
       suffixes[ord(idea[0]) - ord('a')].add(idea[1:])
 
-    for i, j in itertools.combinations(range(26), 2):
-      count = len(suffixes[i] & suffixes[j])
-      ans += 2 * (len(suffixes[i]) - count) * (len(suffixes[j]) - count)
+    for i in range(25):
+      for j in range(i + 1, 26):
+        count = len(suffixes[i] & suffixes[j])
+        ans += 2 * (len(suffixes[i]) - count) * (len(suffixes[j]) - count)
 
     return ans
diff --git a/solutions/2307. Check for Contradictions in Equations/2307.py b/solutions/2307. Check for Contradictions in Equations/2307.py
index 46c120336cd..b606fd943fc 100644
--- a/solutions/2307. Check for Contradictions in Equations/2307.py	
+++ b/solutions/2307. Check for Contradictions in Equations/2307.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def checkContradictions(
-      self,
-      equations: list[list[str]],
-      values: list[float],
-  ) -> bool:
+  def checkContradictions(self, equations: List[List[str]], values: List[float]) -> bool:
     # Convert `string` to `int` for a better perfermance.
     strToInt = {}
 
diff --git a/solutions/2309. Greatest English Letter in Upper and Lower Case/2309.py b/solutions/2309. Greatest English Letter in Upper and Lower Case/2309.py
index 44aee8315bf..de949ff9d1d 100644
--- a/solutions/2309. Greatest English Letter in Upper and Lower Case/2309.py	
+++ b/solutions/2309. Greatest English Letter in Upper and Lower Case/2309.py	
@@ -3,8 +3,8 @@ def greatestLetter(self, s: str) -> str:
     seen = set(s)
 
     for i in range(25, -1, -1):
-      if (chr(ord('a') + i) in seen and
-              chr(ord('A') + i) in seen):
+      if chr(ord('a') + i) in seen and \
+              chr(ord('A') + i) in seen:
         return chr(ord('A') + i)
 
     return ''
diff --git a/solutions/2312. Selling Pieces of Wood/2312.py b/solutions/2312. Selling Pieces of Wood/2312.py
index 5fa2440c63d..54d4aa7e99e 100644
--- a/solutions/2312. Selling Pieces of Wood/2312.py	
+++ b/solutions/2312. Selling Pieces of Wood/2312.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sellingWood(self, m: int, n: int, prices: list[list[int]]) -> int:
+  def sellingWood(self, m: int, n: int, prices: List[List[int]]) -> int:
     # dp[i][j] := the maximum money of cutting i x j piece of wood
     dp = [[0] * (n + 1) for _ in range(m + 1)]
 
diff --git a/solutions/2313. Minimum Flips in Binary Tree to Get Result/2313.py b/solutions/2313. Minimum Flips in Binary Tree to Get Result/2313.py
index f423c3b126f..cfa287febd0 100644
--- a/solutions/2313. Minimum Flips in Binary Tree to Get Result/2313.py	
+++ b/solutions/2313. Minimum Flips in Binary Tree to Get Result/2313.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def minimumFlips(self, root: TreeNode | None, result: bool) -> int:
+  def minimumFlips(self, root: Optional[TreeNode], result: bool) -> int:
     @functools.lru_cache(None)
-    def dp(root: TreeNode | None, target: bool) -> int:
+    def dp(root: Optional[TreeNode], target: bool) -> int:
       """Returns the minimum flips to make the subtree root become target."""
       if root.val in (0, 1):  # the leaf
         return 0 if root.val == target else 1
diff --git a/solutions/2316. Count Unreachable Pairs of Nodes in an Undirected Graph/2316.cpp b/solutions/2316. Count Unreachable Pairs of Nodes in an Undirected Graph/2316.cpp
index cd9b4bae737..0dab07cf4fc 100644
--- a/solutions/2316. Count Unreachable Pairs of Nodes in an Undirected Graph/2316.cpp	
+++ b/solutions/2316. Count Unreachable Pairs of Nodes in an Undirected Graph/2316.cpp	
@@ -26,8 +26,8 @@ class Solution {
     if (seen[u])
       return 0;
     seen[u] = true;
-    return accumulate(graph[u].begin(), graph[u].end(), 1, [&](int acc, int v) {
-      return acc + dfs(graph, v, seen);
-    });
+    return accumulate(
+        graph[u].begin(), graph[u].end(), 1,
+        [&](int subtotal, int v) { return subtotal + dfs(graph, v, seen); });
   }
 };
diff --git a/solutions/2316. Count Unreachable Pairs of Nodes in an Undirected Graph/2316.java b/solutions/2316. Count Unreachable Pairs of Nodes in an Undirected Graph/2316.java
index f2b6c4fb6d1..1d42391e26c 100644
--- a/solutions/2316. Count Unreachable Pairs of Nodes in an Undirected Graph/2316.java	
+++ b/solutions/2316. Count Unreachable Pairs of Nodes in an Undirected Graph/2316.java	
@@ -4,7 +4,9 @@ public long countPairs(int n, int[][] edges) {
     List<Integer>[] graph = new List[n];
     boolean[] seen = new boolean[n];
     int unreached = n;
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
diff --git a/solutions/2316. Count Unreachable Pairs of Nodes in an Undirected Graph/2316.py b/solutions/2316. Count Unreachable Pairs of Nodes in an Undirected Graph/2316.py
index 126359a43d4..aea02a4e95b 100644
--- a/solutions/2316. Count Unreachable Pairs of Nodes in an Undirected Graph/2316.py	
+++ b/solutions/2316. Count Unreachable Pairs of Nodes in an Undirected Graph/2316.py	
@@ -1,24 +1,27 @@
 class Solution:
-  def countPairs(self, n: int, edges: list[list[int]]) -> int:
+  def countPairs(self, n: int, edges: List[List[int]]) -> int:
     ans = 0
-    graph = [[] for _ in range(n)]
+    graph = [0] * n
     seen = [0] * n
     unreached = n
 
-    for u, v in edges:
+    for e in edges:
+      u = e[0]
+      v = e[1]
       graph[u].append(v)
       graph[v].append(u)
 
     for i in range(n):
-      reached = self._dfs(graph, i, seen)
+      reached = dfs(graph, i, seen)
       unreached -= reached
-      ans += unreached * reached
+      ans += static_cast < long > (unreached) * reached
 
     return ans
 
-  def _dfs(self, graph: list[list[int]], u: int, seen: list[bool]) -> int:
+  def dfs(self, graph: List[List[int]], u: int, seen: List[bool]) -> int:
     if seen[u]:
       return 0
     seen[u] = True
-    return functools.reduce(lambda subtotal, v:
-                            subtotal + self._dfs(graph, v, seen), graph[u], 1)
+    return accumulate(
+        begin(graph[u]), end(graph[u]), 1,
+        [ & ](subtotal, v) [return subtotal + dfs(graph, v, seen)])
diff --git a/solutions/2317. Maximum XOR After Operations/2317.py b/solutions/2317. Maximum XOR After Operations/2317.py
index d7671b6d20a..447a6175d7f 100644
--- a/solutions/2317. Maximum XOR After Operations/2317.py	
+++ b/solutions/2317. Maximum XOR After Operations/2317.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumXOR(self, nums: list[int]) -> int:
+  def maximumXOR(self, nums: List[int]) -> int:
     # 1. nums[i] & (nums[i] ^ x) enables you to turn 1-bit to 0-bit from
     #    nums[i] since x is arbitrary.
     # 2. The i-th bit of the XOR of all the elements is 1 if the i-th bit is 1
diff --git a/solutions/2318. Number of Distinct Roll Sequences/2318.java b/solutions/2318. Number of Distinct Roll Sequences/2318.java
index 4c204b1b124..4ffb6979539 100644
--- a/solutions/2318. Number of Distinct Roll Sequences/2318.java	
+++ b/solutions/2318. Number of Distinct Roll Sequences/2318.java	
@@ -4,7 +4,7 @@ public int distinctSequences(int n) {
     return distinctSequences(n, 0, 0);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of distinct sequences for n dices with `prev` and
   // `prevPrev`.
@@ -17,7 +17,7 @@ private int distinctSequences(int n, int prev, int prevPrev, int[][][] mem) {
     for (int dice = 1; dice <= 6; ++dice)
       if (dice != prev && dice != prevPrev && (prev == 0 || gcd(dice, prev) == 1)) {
         mem[n][prev][prevPrev] += distinctSequences(n - 1, dice, prev, mem);
-        mem[n][prev][prevPrev] %= MOD;
+        mem[n][prev][prevPrev] %= kMod;
       }
 
     return mem[n][prev][prevPrev];
diff --git a/solutions/2318. Number of Distinct Roll Sequences/2318.py b/solutions/2318. Number of Distinct Roll Sequences/2318.py
index a1dbd31d0ed..1e83ef8d327 100644
--- a/solutions/2318. Number of Distinct Roll Sequences/2318.py	
+++ b/solutions/2318. Number of Distinct Roll Sequences/2318.py	
@@ -1,6 +1,6 @@
 class Solution:
   def distinctSequences(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
 
     @functools.lru_cache(None)
     def dp(n: int, prev: int, prevPrev: int) -> int:
@@ -12,10 +12,10 @@ def dp(n: int, prev: int, prevPrev: int) -> int:
         return 1
       res = 0
       for dice in range(1, 7):
-        if (dice not in (prev, prevPrev) and
-                (prev == 0 or math.gcd(dice, prev) == 1)):
+        if dice != prev and dice != prevPrev and \
+                (prev == 0 or math.gcd(dice, prev) == 1):
           res += dp(n - 1, dice, prev)
-          res %= MOD
+          res %= kMod
       return res
 
     return dp(n, 0, 0)
diff --git a/solutions/2319. Check if Matrix Is X-Matrix/2319.py b/solutions/2319. Check if Matrix Is X-Matrix/2319.py
index 80daf33290c..b9a59cf4574 100644
--- a/solutions/2319. Check if Matrix Is X-Matrix/2319.py	
+++ b/solutions/2319. Check if Matrix Is X-Matrix/2319.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def checkXMatrix(self, grid: list[list[int]]) -> bool:
+  def checkXMatrix(self, grid: List[List[int]]) -> bool:
     n = len(grid)
 
     for i in range(n):
diff --git a/solutions/2320. Count Number of Ways to Place Houses/2320.java b/solutions/2320. Count Number of Ways to Place Houses/2320.java
index fd69cb4431e..1e8b0d3785d 100644
--- a/solutions/2320. Count Number of Ways to Place Houses/2320.java	
+++ b/solutions/2320. Count Number of Ways to Place Houses/2320.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int countHousePlacements(int n) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int house = 1; // the number of ways ending in a house
     int space = 1; // the number of ways ending in a space
     int total = house + space;
@@ -8,9 +8,9 @@ public int countHousePlacements(int n) {
     for (int i = 2; i <= n; ++i) {
       house = space;
       space = total;
-      total = (house + space) % MOD;
+      total = (house + space) % kMod;
     }
 
-    return (int) ((long) total * total % MOD);
+    return (int) ((long) total * total % kMod);
   }
 }
diff --git a/solutions/2320. Count Number of Ways to Place Houses/2320.py b/solutions/2320. Count Number of Ways to Place Houses/2320.py
index 300def6d029..1b66f4257e8 100644
--- a/solutions/2320. Count Number of Ways to Place Houses/2320.py	
+++ b/solutions/2320. Count Number of Ways to Place Houses/2320.py	
@@ -1,6 +1,6 @@
 class Solution:
   def countHousePlacements(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     house = 1  # the number of ways ending in a house
     space = 1  # the number of ways ending in a space
     total = house + space
@@ -8,6 +8,6 @@ def countHousePlacements(self, n: int) -> int:
     for _ in range(2, n + 1):
       house = space
       space = total
-      total = (house + space) % MOD
+      total = (house + space) % kMod
 
-    return total**2 % MOD
+    return total**2 % kMod
diff --git a/solutions/2321. Maximum Score Of Spliced Array/2321.py b/solutions/2321. Maximum Score Of Spliced Array/2321.py
index 9fd476702cd..5ad9545ef4d 100644
--- a/solutions/2321. Maximum Score Of Spliced Array/2321.py	
+++ b/solutions/2321. Maximum Score Of Spliced Array/2321.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def maximumsSplicedArray(self, nums1: list[int], nums2: list[int]) -> int:
-    def kadane(nums1: list[int], nums2: list[int]) -> int:
+  def maximumsSplicedArray(self, nums1: List[int], nums2: List[int]) -> int:
+    def kadane(nums1: List[int], nums2: List[int]) -> int:
       """
       Returns the maximum gain of swapping some numbers in `nums1` with some
       numbers in `nums2`.
diff --git a/solutions/2322. Minimum Score After Removals on a Tree/2322.cpp b/solutions/2322. Minimum Score After Removals on a Tree/2322.cpp
index 2c8fb41e57a..0fa6d1b5091 100644
--- a/solutions/2322. Minimum Score After Removals on a Tree/2322.cpp	
+++ b/solutions/2322. Minimum Score After Removals on a Tree/2322.cpp	
@@ -47,10 +47,10 @@ class Solution {
 
  private:
   pair<int, unordered_set<int>> dfs(const vector<vector<int>>& tree, int u,
-                                    int prev, vector<int>& subXors,
+                                    int parent, vector<int>& subXors,
                                     vector<unordered_set<int>>& children) {
     for (const int v : tree[u]) {
-      if (v == prev)
+      if (v == parent)
         continue;
       const auto& [vXor, vChildren] = dfs(tree, v, u, subXors, children);
       subXors[u] ^= vXor;
diff --git a/solutions/2322. Minimum Score After Removals on a Tree/2322.java b/solutions/2322. Minimum Score After Removals on a Tree/2322.java
index e108abad5ae..3c2777da83e 100644
--- a/solutions/2322. Minimum Score After Removals on a Tree/2322.java	
+++ b/solutions/2322. Minimum Score After Removals on a Tree/2322.java	
@@ -54,10 +54,10 @@ else if (a != c && children[c].contains(a))
     return ans;
   }
 
-  private Pair<Integer, Set<Integer>> dfs(List<Integer>[] tree, int u, int prev, int[] subXors,
+  private Pair<Integer, Set<Integer>> dfs(List<Integer>[] tree, int u, int parent, int[] subXors,
                                           Set<Integer>[] children) {
     for (final int v : tree[u]) {
-      if (v == prev)
+      if (v == parent)
         continue;
       final Pair<Integer, Set<Integer>> pair = dfs(tree, v, u, subXors, children);
       final int vXor = pair.getKey();
diff --git a/solutions/2322. Minimum Score After Removals on a Tree/2322.py b/solutions/2322. Minimum Score After Removals on a Tree/2322.py
index bc6d2b38f1b..2b9aed52773 100644
--- a/solutions/2322. Minimum Score After Removals on a Tree/2322.py	
+++ b/solutions/2322. Minimum Score After Removals on a Tree/2322.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumScore(self, nums: list[int], edges: list[list[int]]) -> int:
+  def minimumScore(self, nums: List[int], edges: List[List[int]]) -> int:
     n = len(nums)
     xors = functools.reduce(operator.xor, nums)
     subXors = nums[:]
@@ -10,9 +10,9 @@ def minimumScore(self, nums: list[int], edges: list[list[int]]) -> int:
       tree[u].append(v)
       tree[v].append(u)
 
-    def dfs(u: int, prev: int) -> tuple[int, set[int]]:
+    def dfs(u: int, parent: int) -> Tuple[int, Set[int]]:
       for v in tree[u]:
-        if v == prev:
+        if v == parent:
           continue
         vXor, vChildren = dfs(v, u)
         subXors[u] ^= vXor
diff --git a/solutions/2323. Find Minimum Time to Finish All Jobs II/2323.py b/solutions/2323. Find Minimum Time to Finish All Jobs II/2323.py
index d8afbcc1be3..f4522041237 100644
--- a/solutions/2323. Find Minimum Time to Finish All Jobs II/2323.py	
+++ b/solutions/2323. Find Minimum Time to Finish All Jobs II/2323.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumTime(self, jobs: list[int], workers: list[int]) -> int:
+  def minimumTime(self, jobs: List[int], workers: List[int]) -> int:
     ans = 0
 
     jobs.sort()
diff --git a/solutions/2326. Spiral Matrix IV/2326.cpp b/solutions/2326. Spiral Matrix IV/2326.cpp
index 691e9aea200..34954fbf504 100644
--- a/solutions/2326. Spiral Matrix IV/2326.cpp	
+++ b/solutions/2326. Spiral Matrix IV/2326.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   vector<vector<int>> spiralMatrix(int m, int n, ListNode* head) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     vector<vector<int>> ans(m, vector<int>(n, -1));
     int x = 0;  // the current x position
     int y = 0;  // the current y position
@@ -9,11 +9,11 @@ class Solution {
 
     for (ListNode* curr = head; curr; curr = curr->next) {
       ans[x][y] = curr->val;
-      if (x + kDirs[d][0] < 0 || x + kDirs[d][0] == m || y + kDirs[d][1] < 0 ||
-          y + kDirs[d][1] == n || ans[x + kDirs[d][0]][y + kDirs[d][1]] != -1)
+      if (x + dirs[d] < 0 || x + dirs[d] == m || y + dirs[d + 1] < 0 ||
+          y + dirs[d + 1] == n || ans[x + dirs[d]][y + dirs[d + 1]] != -1)
         d = (d + 1) % 4;
-      x += kDirs[d][0];
-      y += kDirs[d][1];
+      x += dirs[d];
+      y += dirs[d + 1];
     }
 
     return ans;
diff --git a/solutions/2326. Spiral Matrix IV/2326.java b/solutions/2326. Spiral Matrix IV/2326.java
index 7f8b0d76482..fbeb3e37319 100644
--- a/solutions/2326. Spiral Matrix IV/2326.java	
+++ b/solutions/2326. Spiral Matrix IV/2326.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int[][] spiralMatrix(int m, int n, ListNode head) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     int[][] ans = new int[m][n];
     Arrays.stream(ans).forEach(A -> Arrays.fill(A, -1));
     int x = 0; // the current x position
@@ -9,11 +9,11 @@ public int[][] spiralMatrix(int m, int n, ListNode head) {
 
     for (ListNode curr = head; curr != null; curr = curr.next) {
       ans[x][y] = curr.val;
-      if (x + DIRS[d][0] < 0 || x + DIRS[d][0] == m || y + DIRS[d][1] < 0 || //
-          y + DIRS[d][1] == n || ans[x + DIRS[d][0]][y + DIRS[d][1]] != -1)
+      if (x + dirs[d] < 0 || x + dirs[d] == m || y + dirs[d + 1] < 0 || y + dirs[d + 1] == n ||
+          ans[x + dirs[d]][y + dirs[d + 1]] != -1)
         d = (d + 1) % 4;
-      x += DIRS[d][0];
-      y += DIRS[d][1];
+      x += dirs[d];
+      y += dirs[d + 1];
     }
 
     return ans;
diff --git a/solutions/2326. Spiral Matrix IV/2326.py b/solutions/2326. Spiral Matrix IV/2326.py
index 62f6bddec5f..366642eadb3 100644
--- a/solutions/2326. Spiral Matrix IV/2326.py	
+++ b/solutions/2326. Spiral Matrix IV/2326.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def spiralMatrix(self, m: int, n: int, head: ListNode | None) -> list[list[int]]:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def spiralMatrix(self, m: int, n: int, head: Optional[ListNode]) -> List[List[int]]:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     ans = [[-1] * n for _ in range(m)]
     x = 0  # the current x position
     y = 0  # the current y position
@@ -9,11 +9,11 @@ def spiralMatrix(self, m: int, n: int, head: ListNode | None) -> list[list[int]]
     curr = head
     while curr:
       ans[x][y] = curr.val
-      if (x + DIRS[d][0] < 0 or x + DIRS[d][0] == m or y + DIRS[d][1] < 0 or
-              y + DIRS[d][1] == n or ans[x + DIRS[d][0]][y + DIRS[d][1]] != -1):
+      if x + dirs[d] < 0 or x + dirs[d] == m or y + dirs[d + 1] < 0 or \
+              y + dirs[d + 1] == n or ans[x + dirs[d]][y + dirs[d + 1]] != -1:
         d = (d + 1) % 4
-      x += DIRS[d][0]
-      y += DIRS[d][1]
+      x += dirs[d]
+      y += dirs[d + 1]
       curr = curr.next
 
     return ans
diff --git a/solutions/2327. Number of People Aware of a Secret/2327.cpp b/solutions/2327. Number of People Aware of a Secret/2327.cpp
index 9ff00e80f68..a7bcade599e 100644
--- a/solutions/2327. Number of People Aware of a Secret/2327.cpp	
+++ b/solutions/2327. Number of People Aware of a Secret/2327.cpp	
@@ -18,7 +18,8 @@ class Solution {
     }
 
     // People before day `n - forget - 1` already forget the secret.
-    return accumulate(dp.end() - forget, dp.end(), 0,
-                      [&](int acc, int d) { return (acc + d) % kMod; });
+    return accumulate(dp.end() - forget, dp.end(), 0, [&](int subtotal, int d) {
+      return (subtotal + d) % kMod;
+    });
   }
 };
diff --git a/solutions/2327. Number of People Aware of a Secret/2327.java b/solutions/2327. Number of People Aware of a Secret/2327.java
index 0fa107ba396..04f38ef4d96 100644
--- a/solutions/2327. Number of People Aware of a Secret/2327.java	
+++ b/solutions/2327. Number of People Aware of a Secret/2327.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int peopleAwareOfSecret(int n, int delay, int forget) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long share = 0;
     // dp[i] := the number of people know the secret at day i
     int[] dp = new int[n]; // Maps day i to i + 1.
@@ -11,15 +11,15 @@ public int peopleAwareOfSecret(int n, int delay, int forget) {
         share += dp[i - delay];
       if (i - forget >= 0)
         share -= dp[i - forget];
-      share += MOD;
-      share %= MOD;
+      share += kMod;
+      share %= kMod;
       dp[i] = (int) share;
     }
 
     // People before day `n - forget - 1` already forget the secret.
     int ans = 0;
     for (int i = n - forget; i < n; ++i)
-      ans = (ans + dp[i]) % MOD;
+      ans = (ans + dp[i]) % kMod;
     return ans;
   }
 }
diff --git a/solutions/2327. Number of People Aware of a Secret/2327.py b/solutions/2327. Number of People Aware of a Secret/2327.py
index da62bb41aae..499be073d44 100644
--- a/solutions/2327. Number of People Aware of a Secret/2327.py	
+++ b/solutions/2327. Number of People Aware of a Secret/2327.py	
@@ -1,6 +1,6 @@
 class Solution:
   def peopleAwareOfSecret(self, n: int, delay: int, forget: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     share = 0
     # dp[i] := the number of people know the secret at day i
     dp = [0] * n  # Maps day i to i + 1.
@@ -11,9 +11,9 @@ def peopleAwareOfSecret(self, n: int, delay: int, forget: int) -> int:
         share += dp[i - delay]
       if i - forget >= 0:
         share -= dp[i - forget]
-      share += MOD
-      share %= MOD
+      share += kMod
+      share %= kMod
       dp[i] = share
 
     # People before day `n - forget - 1` already forget the secret.
-    return sum(dp[-forget:]) % MOD
+    return sum(dp[-forget:]) % kMod
diff --git a/solutions/2328. Number of Increasing Paths in a Grid/2328.cpp b/solutions/2328. Number of Increasing Paths in a Grid/2328.cpp
index a38b7eb2ff0..0cd71149848 100644
--- a/solutions/2328. Number of Increasing Paths in a Grid/2328.cpp	
+++ b/solutions/2328. Number of Increasing Paths in a Grid/2328.cpp	
@@ -17,7 +17,7 @@ class Solution {
 
  private:
   static constexpr int kMod = 1'000'000'007;
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   // Returns the number of increasing paths starting from (i, j).
   int countPaths(const vector<vector<int>>& grid, int i, int j,
@@ -27,7 +27,7 @@ class Solution {
 
     mem[i][j] = 1;  // The current cell contributes 1 length.
 
-    for (const auto& [dx, dy] : kDirs) {
+    for (const auto& [dx, dy] : dirs) {
       const int x = i + dx;
       const int y = j + dy;
       if (x < 0 || x == grid.size() || y < 0 || y == grid[0].size())
diff --git a/solutions/2328. Number of Increasing Paths in a Grid/2328.java b/solutions/2328. Number of Increasing Paths in a Grid/2328.java
index e3fb53aacb2..defc0776620 100644
--- a/solutions/2328. Number of Increasing Paths in a Grid/2328.java	
+++ b/solutions/2328. Number of Increasing Paths in a Grid/2328.java	
@@ -8,14 +8,14 @@ public int countPaths(int[][] grid) {
     for (int i = 0; i < m; ++i)
       for (int j = 0; j < n; ++j) {
         ans += countPaths(grid, i, j, mem);
-        ans %= MOD;
+        ans %= kMod;
       }
 
     return ans;
   }
 
-  private static final int MOD = 1_000_000_007;
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int kMod = 1_000_000_007;
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   // Returns the number of increasing paths starting from (i, j).
   private int countPaths(int[][] grid, int i, int j, Integer[][] mem) {
@@ -24,7 +24,7 @@ private int countPaths(int[][] grid, int i, int j, Integer[][] mem) {
 
     mem[i][j] = 1; // The current cell contributes 1 length.
 
-    for (int[] dir : DIRS) {
+    for (int[] dir : dirs) {
       int x = i + dir[0];
       int y = j + dir[1];
       if (x < 0 || x == grid.length || y < 0 || y == grid[0].length)
@@ -32,7 +32,7 @@ private int countPaths(int[][] grid, int i, int j, Integer[][] mem) {
       if (grid[x][y] <= grid[i][j])
         continue;
       mem[i][j] += countPaths(grid, x, y, mem);
-      mem[i][j] %= MOD;
+      mem[i][j] %= kMod;
     }
 
     return mem[i][j];
diff --git a/solutions/2328. Number of Increasing Paths in a Grid/2328.py b/solutions/2328. Number of Increasing Paths in a Grid/2328.py
index 78fe2a4bbed..606a5e8d1c9 100644
--- a/solutions/2328. Number of Increasing Paths in a Grid/2328.py	
+++ b/solutions/2328. Number of Increasing Paths in a Grid/2328.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def countPaths(self, grid: list[list[int]]) -> int:
-    MOD = 1_000_000_007
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def countPaths(self, grid: List[List[int]]) -> int:
+    kMod = 1_000_000_007
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
 
@@ -9,7 +9,7 @@ def countPaths(self, grid: list[list[int]]) -> int:
     def dp(i: int, j: int) -> int:
       """Returns the number of increasing paths starting from (i, j)."""
       ans = 1  # The current cell contributes 1 length.
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
@@ -17,9 +17,9 @@ def dp(i: int, j: int) -> int:
         if grid[x][y] <= grid[i][j]:
           continue
         ans += dp(x, y)
-        ans %= MOD
+        ans %= kMod
       return ans
 
     return sum(dp(i, j)
                for i in range(m)
-               for j in range(n)) % MOD
+               for j in range(n)) % kMod
diff --git a/solutions/2331. Evaluate Boolean Binary Tree/2331.py b/solutions/2331. Evaluate Boolean Binary Tree/2331.py
index 26a05f33111..085ae384c81 100644
--- a/solutions/2331. Evaluate Boolean Binary Tree/2331.py	
+++ b/solutions/2331. Evaluate Boolean Binary Tree/2331.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def evaluateTree(self, root: TreeNode | None) -> bool:
+  def evaluateTree(self, root: Optional[TreeNode]) -> bool:
     if root.val < 2:
       return root.val
     if root.val == 2:  # OR
diff --git a/solutions/2332. The Latest Time to Catch a Bus/2332.py b/solutions/2332. The Latest Time to Catch a Bus/2332.py
index 1f6d5a0925b..3d6f9695f6d 100644
--- a/solutions/2332. The Latest Time to Catch a Bus/2332.py	
+++ b/solutions/2332. The Latest Time to Catch a Bus/2332.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def latestTimeCatchTheBus(
-      self,
-      buses: list[int],
-      passengers: list[int],
-      capacity: int,
-  ) -> int:
+  def latestTimeCatchTheBus(self, buses: List[int], passengers: List[int], capacity: int) -> int:
     buses.sort()
     passengers.sort()
 
diff --git a/solutions/2333. Minimum Sum of Squared Difference/2333.java b/solutions/2333. Minimum Sum of Squared Difference/2333.java
index 8ffe091f28d..0805f48b30b 100644
--- a/solutions/2333. Minimum Sum of Squared Difference/2333.java	
+++ b/solutions/2333. Minimum Sum of Squared Difference/2333.java	
@@ -7,8 +7,7 @@ public long minSumSquareDiff(int[] nums1, int[] nums2, int k1, int k2) {
 
     Map<Integer, Integer> count = new HashMap<>();
     // (num, freq)
-    Queue<Pair<Integer, Integer>> maxHeap =
-        new PriorityQueue<>(Comparator.comparing(Pair::getKey, Comparator.reverseOrder()));
+    Queue<Pair<Integer, Integer>> maxHeap = new PriorityQueue<>((a, b) -> b.getKey() - a.getKey());
 
     for (final int d : diff)
       if (d != 0)
diff --git a/solutions/2334. Subarray With Elements Greater Than Varying Threshold/2334.py b/solutions/2334. Subarray With Elements Greater Than Varying Threshold/2334.py
index 1a874792e65..9096a72edc7 100644
--- a/solutions/2334. Subarray With Elements Greater Than Varying Threshold/2334.py	
+++ b/solutions/2334. Subarray With Elements Greater Than Varying Threshold/2334.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Similar to 907. Sum of Subarray Minimums
-  def validSubarraySize(self, nums: list[int], threshold: int) -> int:
+  def validSubarraySize(self, nums: List[int], threshold: int) -> int:
     n = len(nums)
     ans = 0
     # prev[i] := the index k s.t. nums[k] is the previous minimum in nums[0..n)
diff --git a/solutions/2335. Minimum Amount of Time to Fill Cups/2335.py b/solutions/2335. Minimum Amount of Time to Fill Cups/2335.py
index 7940035322c..c95e6ca7beb 100644
--- a/solutions/2335. Minimum Amount of Time to Fill Cups/2335.py	
+++ b/solutions/2335. Minimum Amount of Time to Fill Cups/2335.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def fillCups(self, amount: list[int]) -> int:
+  def fillCups(self, amount: List[int]) -> int:
     return max(max(amount), (sum(amount) + 1) // 2)
diff --git a/solutions/234. Palindrome Linked List/234.cpp b/solutions/234. Palindrome Linked List/234.cpp
index 35043e044ca..a0b552a5639 100644
--- a/solutions/234. Palindrome Linked List/234.cpp	
+++ b/solutions/234. Palindrome Linked List/234.cpp	
@@ -13,7 +13,7 @@ class Solution {
       slow = slow->next;
     slow = reverseList(slow);
 
-    while (slow != nullptr) {
+    while (slow) {
       if (slow->val != head->val)
         return false;
       slow = slow->next;
@@ -26,12 +26,14 @@ class Solution {
  private:
   ListNode* reverseList(ListNode* head) {
     ListNode* prev = nullptr;
-    while (head != nullptr) {
+
+    while (head) {
       ListNode* next = head->next;
       head->next = prev;
       prev = head;
       head = next;
     }
+
     return prev;
   }
 };
diff --git a/solutions/234. Palindrome Linked List/234.java b/solutions/234. Palindrome Linked List/234.java
index 0044094cb52..7a343ce2c28 100644
--- a/solutions/234. Palindrome Linked List/234.java	
+++ b/solutions/234. Palindrome Linked List/234.java	
@@ -24,12 +24,14 @@ public boolean isPalindrome(ListNode head) {
 
   private ListNode reverseList(ListNode head) {
     ListNode prev = null;
+
     while (head != null) {
       ListNode next = head.next;
       head.next = prev;
       prev = head;
       head = next;
     }
+
     return prev;
   }
 }
diff --git a/solutions/234. Palindrome Linked List/234.py b/solutions/234. Palindrome Linked List/234.py
index b8d95721873..4d770b0ee39 100644
--- a/solutions/234. Palindrome Linked List/234.py	
+++ b/solutions/234. Palindrome Linked List/234.py	
@@ -3,11 +3,13 @@ def isPalindrome(self, head: ListNode) -> bool:
     def reverseList(head: ListNode) -> ListNode:
       prev = None
       curr = head
+
       while curr:
         next = curr.next
         curr.next = prev
         prev = curr
         curr = next
+
       return prev
 
     slow = head
diff --git a/solutions/2340. Minimum Adjacent Swaps to Make a Valid Array/2340.py b/solutions/2340. Minimum Adjacent Swaps to Make a Valid Array/2340.py
index 8b8814ad76b..56225aa363e 100644
--- a/solutions/2340. Minimum Adjacent Swaps to Make a Valid Array/2340.py	
+++ b/solutions/2340. Minimum Adjacent Swaps to Make a Valid Array/2340.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def minimumSwaps(self, nums: list[int]) -> int:
+  def minimumSwaps(self, nums: List[int]) -> int:
     minIndex = self._getLeftmostMinIndex(nums)
     maxIndex = self._getRightmostMaxIndex(nums)
     swaps = minIndex + (len(nums) - 1 - maxIndex)
     return swaps if minIndex <= maxIndex else swaps - 1
 
-  def _getLeftmostMinIndex(self, nums: list[int]) -> int:
+  def _getLeftmostMinIndex(self, nums: List[int]) -> int:
     mn = nums[0]
     minIndex = 0
     for i in range(1, len(nums)):
@@ -14,7 +14,7 @@ def _getLeftmostMinIndex(self, nums: list[int]) -> int:
         minIndex = i
     return minIndex
 
-  def _getRightmostMaxIndex(self, nums: list[int]) -> int:
+  def _getRightmostMaxIndex(self, nums: List[int]) -> int:
     mx = nums[-1]
     maxIndex = len(nums) - 1
     for i in range(len(nums) - 2, -1, -1):
diff --git a/solutions/2341. Maximum Number of Pairs in Array/2341.java b/solutions/2341. Maximum Number of Pairs in Array/2341.java
index b0f0373e627..574ad7da2f7 100644
--- a/solutions/2341. Maximum Number of Pairs in Array/2341.java	
+++ b/solutions/2341. Maximum Number of Pairs in Array/2341.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int[] numberOfPairs(int[] nums) {
-    final int MAX = 100;
+    final int kMax = 100;
     int[] ans = new int[2];
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (final int num : nums)
       ++count[num];
 
-    for (int i = 0; i <= MAX; ++i) {
+    for (int i = 0; i <= kMax; ++i) {
       ans[0] += count[i] / 2;
       if (count[i] % 2 == 1)
         ++ans[1];
diff --git a/solutions/2341. Maximum Number of Pairs in Array/2341.py b/solutions/2341. Maximum Number of Pairs in Array/2341.py
index a2a3795ed42..67cd796ce58 100644
--- a/solutions/2341. Maximum Number of Pairs in Array/2341.py	
+++ b/solutions/2341. Maximum Number of Pairs in Array/2341.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfPairs(self, nums: list[int]) -> list[int]:
+  def numberOfPairs(self, nums: List[int]) -> List[int]:
     ans = [0] * 2
     count = collections.Counter(nums)
 
diff --git a/solutions/2342. Max Sum of a Pair With Equal Sum of Digits/2342.java b/solutions/2342. Max Sum of a Pair With Equal Sum of Digits/2342.java
index 6e186e51871..497202f278c 100644
--- a/solutions/2342. Max Sum of a Pair With Equal Sum of Digits/2342.java	
+++ b/solutions/2342. Max Sum of a Pair With Equal Sum of Digits/2342.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int maximumSum(int[] nums) {
-    final int MAX = 9 * 9; // 999,999,999
+    final int kMax = 9 * 9; // 999,999,999
     int ans = -1;
-    List<Integer>[] count = new List[MAX + 1];
+    List<Integer>[] count = new List[kMax + 1];
 
-    for (int i = 0; i <= MAX; ++i)
+    for (int i = 0; i <= kMax; ++i)
       count[i] = new ArrayList<>();
 
     for (final int num : nums)
diff --git a/solutions/2342. Max Sum of a Pair With Equal Sum of Digits/2342.py b/solutions/2342. Max Sum of a Pair With Equal Sum of Digits/2342.py
index 33c7460eed6..7941db283a2 100644
--- a/solutions/2342. Max Sum of a Pair With Equal Sum of Digits/2342.py	
+++ b/solutions/2342. Max Sum of a Pair With Equal Sum of Digits/2342.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def maximumSum(self, nums: list[int]) -> int:
-    MAX = 9 * 9  # 999,999,999
+  def maximumSum(self, nums: List[int]) -> int:
+    kMax = 9 * 9  # 999,999,999
     ans = -1
-    count = [[] for _ in range(MAX + 1)]
+    count = [[] for _ in range(kMax + 1)]
 
     for num in nums:
       count[self._getDigitSum(num)].append(num)
diff --git a/solutions/2344. Minimum Deletions to Make Array Divisible/2344.py b/solutions/2344. Minimum Deletions to Make Array Divisible/2344.py
index 83dbac31c61..b2a1cedb8b0 100644
--- a/solutions/2344. Minimum Deletions to Make Array Divisible/2344.py	
+++ b/solutions/2344. Minimum Deletions to Make Array Divisible/2344.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums: list[int], numsDivide: list[int]) -> int:
+  def minOperations(self, nums: List[int], numsDivide: List[int]) -> int:
     gcd = functools.reduce(math.gcd, numsDivide)
 
     for i, num in enumerate(sorted(nums)):
diff --git a/solutions/2345. Finding the Number of Visible Mountains/2345-2.cpp b/solutions/2345. Finding the Number of Visible Mountains/2345-2.cpp
new file mode 100644
index 00000000000..009d5111bf9
--- /dev/null
+++ b/solutions/2345. Finding the Number of Visible Mountains/2345-2.cpp	
@@ -0,0 +1,26 @@
+class Solution {
+ public:
+  int visibleMountains(vector<vector<int>>& peaks) {
+    ranges::sort(peaks, [](const vector<int>& a, const vector<int>& b) {
+      const int leftFootA = a[0] - a[1];
+      const int leftFootB = b[0] - b[1];
+      return leftFootA != leftFootB ? leftFootA < leftFootB : a[0] > b[0];
+    });
+
+    int maxRightFoot = 0;
+    int result = 0;
+
+    for (int i = 0; i < peaks.size(); ++i) {
+      const bool overlapWithNext =
+          i + 1 < peaks.size() && peaks[i] == peaks[i + 1];
+      const int currRightFoot = peaks[i][0] + peaks[i][1];
+      if (currRightFoot > maxRightFoot) {
+        if (overlapWithNext == nullptr)
+          ++result;
+        maxRightFoot = currRightFoot;
+      }
+    }
+
+    return result;
+  }
+};
diff --git a/solutions/2345. Finding the Number of Visible Mountains/2345.cpp b/solutions/2345. Finding the Number of Visible Mountains/2345.cpp
index 3b3f49e0f05..4d9fb99d8b4 100644
--- a/solutions/2345. Finding the Number of Visible Mountains/2345.cpp	
+++ b/solutions/2345. Finding the Number of Visible Mountains/2345.cpp	
@@ -1,24 +1,45 @@
 class Solution {
  public:
   int visibleMountains(vector<vector<int>>& peaks) {
-    int ans = 0;
-    int maxRightFoot = 0;
-
-    ranges::sort(peaks, ranges::less{}, [](const vector<int>& peak) {
-      return pair<int, int>(peak[0] - peak[1], -peak[0]);
-    });
-
-    for (int i = 0; i < peaks.size(); ++i) {
-      const bool overlapWithNext =
-          i + 1 < peaks.size() && peaks[i] == peaks[i + 1];
-      const int currRightFoot = peaks[i][0] + peaks[i][1];
-      if (currRightFoot > maxRightFoot) {
-        if (!overlapWithNext)
-          ++ans;
-        maxRightFoot = currRightFoot;
-      }
+    const vector<pair<int, int>> A = deDuplicates(peaks);
+    stack<int> stack;
+
+    for (int i = 0; i < A.size(); ++i) {
+      while (!stack.empty() && isHidden(A[stack.top()], A[i]))
+        stack.pop();
+      if (!stack.empty() && isHidden(A[i], A[stack.top()]))
+        continue;
+      stack.push(i);
     }
 
-    return ans;
+    return stack.size();
+  }
+
+ private:
+  vector<pair<int, int>> deDuplicates(const vector<vector<int>>& peaks) {
+    vector<pair<int, int>> A;
+    unordered_map<pair<int, int>, int, PairHash> count;
+
+    for (const vector<int>& peak : peaks)
+      ++count[{peak[0], peak[1]}];
+
+    for (const auto& [k, v] : count)
+      if (v == 1)
+        A.push_back(k);
+
+    ranges::sort(A);
+    return A;
+  }
+
+  bool isHidden(const pair<int, int>& peak1, const pair<int, int>& peak2) {
+    const auto& [x1, y1] = peak1;
+    const auto& [x2, y2] = peak2;
+    return x1 - y1 >= x2 - y2 && x1 + y1 <= x2 + y2;
   }
+
+  struct PairHash {
+    size_t operator()(const pair<int, int>& p) const {
+      return p.first ^ p.second;
+    }
+  };
 };
diff --git a/solutions/2345. Finding the Number of Visible Mountains/2345.java b/solutions/2345. Finding the Number of Visible Mountains/2345.java
index 6a3329802d0..bbe1727dbfc 100644
--- a/solutions/2345. Finding the Number of Visible Mountains/2345.java	
+++ b/solutions/2345. Finding the Number of Visible Mountains/2345.java	
@@ -1,21 +1,39 @@
 class Solution {
   public int visibleMountains(int[][] peaks) {
-    int ans = 0;
-    int maxRightFoot = 0;
+    List<Pair<Integer, Integer>> A = deDuplicates(peaks);
+    Deque<Integer> stack = new ArrayDeque<>();
 
-    Arrays.sort(peaks, Comparator.comparingInt((int[] peak) -> peak[0] - peak[1])
-                           .thenComparing((int[] peak) -> peak[0], Comparator.reverseOrder()));
-
-    for (int i = 0; i < peaks.length; ++i) {
-      final boolean overlapWithNext = i + 1 < peaks.length && Arrays.equals(peaks[i], peaks[i + 1]);
-      final int currRightFoot = peaks[i][0] + peaks[i][1];
-      if (currRightFoot > maxRightFoot) {
-        if (!overlapWithNext)
-          ++ans;
-        maxRightFoot = currRightFoot;
-      }
+    for (int i = 0; i < A.size(); ++i) {
+      while (!stack.isEmpty() && isHidden(A.get(stack.peek()), A.get(i)))
+        stack.pop();
+      if (!stack.isEmpty() && isHidden(A.get(i), A.get(stack.peek())))
+        continue;
+      stack.push(i);
     }
 
-    return ans;
+    return stack.size();
+  }
+
+  private List<Pair<Integer, Integer>> deDuplicates(int[][] peaks) {
+    List<Pair<Integer, Integer>> A = new ArrayList<>();
+    Map<Pair<Integer, Integer>, Integer> count = new HashMap<>();
+
+    for (int[] peak : peaks)
+      count.merge(new Pair<>(peak[0], peak[1]), 1, Integer::sum);
+
+    for (Map.Entry<Pair<Integer, Integer>, Integer> entry : count.entrySet())
+      if (entry.getValue() == 1)
+        A.add(entry.getKey());
+
+    Collections.sort(A, Comparator.comparing(Pair::getKey));
+    return A;
+  }
+
+  boolean isHidden(Pair<Integer, Integer> peak1, Pair<Integer, Integer> peak2) {
+    final int x1 = peak1.getKey();
+    final int y1 = peak1.getValue();
+    final int x2 = peak2.getKey();
+    final int y2 = peak2.getValue();
+    return x1 - y1 >= x2 - y2 && x1 + y1 <= x2 + y2;
   }
 }
diff --git a/solutions/2345. Finding the Number of Visible Mountains/2345.py b/solutions/2345. Finding the Number of Visible Mountains/2345.py
index 6edbe76f6f6..f3d1de416f8 100644
--- a/solutions/2345. Finding the Number of Visible Mountains/2345.py	
+++ b/solutions/2345. Finding the Number of Visible Mountains/2345.py	
@@ -1,16 +1,20 @@
 class Solution:
-  def visibleMountains(self, peaks: list[list[int]]) -> int:
-    ans = 0
-    maxRightFoot = 0
+  def visibleMountains(self, peaks: List[List[int]]) -> int:
+    count = collections.Counter((x, y) for x, y in peaks)
+    peaks = sorted([k for k, v in count.items() if v == 1])
+    stack = []
 
-    peaks.sort(key=lambda x: (x[0] - x[1], -x[0]))
+    # Returns True if `peak1` is hidden by `peak2`
+    def isHidden(peak1: List[int], peak2: List[int]) -> bool:
+      x1, y1 = peak1
+      x2, y2 = peak2
+      return x1 - y1 >= x2 - y2 and x1 + y1 <= x2 + y2
 
     for i, peak in enumerate(peaks):
-      overlapWithNext = i + 1 < len(peaks) and peak == peaks[i + 1]
-      currRightFoot = peak[0] + peak[1]
-      if currRightFoot > maxRightFoot:
-        if not overlapWithNext:
-          ans += 1
-        maxRightFoot = currRightFoot
+      while stack and isHidden(peaks[stack[-1]], peak):
+        stack.pop()
+      if stack and isHidden(peak, peaks[stack[-1]]):
+        continue
+      stack.append(i)
 
-    return ans
+    return len(stack)
diff --git a/solutions/2347. Best Poker Hand/2347.java b/solutions/2347. Best Poker Hand/2347.java
index a3beb15d9de..34fbb72462c 100644
--- a/solutions/2347. Best Poker Hand/2347.java	
+++ b/solutions/2347. Best Poker Hand/2347.java	
@@ -3,8 +3,8 @@ public String bestHand(int[] ranks, char[] suits) {
     if (new String(suits).chars().allMatch(s -> s == suits[0]))
       return "Flush";
 
-    final int MAX = 13;
-    int[] count = new int[MAX + 1];
+    final int kMax = 13;
+    int[] count = new int[kMax + 1];
 
     for (final int rank : ranks)
       ++count[rank];
diff --git a/solutions/2347. Best Poker Hand/2347.py b/solutions/2347. Best Poker Hand/2347.py
index ad704c44bf7..7edecd9fd4d 100644
--- a/solutions/2347. Best Poker Hand/2347.py	
+++ b/solutions/2347. Best Poker Hand/2347.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def bestHand(self, ranks: list[int], suits: list[str]) -> str:
+  def bestHand(self, ranks: List[int], suits: List[str]) -> str:
     if all(suit == suits[0] for suit in suits):
       return 'Flush'
 
diff --git a/solutions/2348. Number of Zero-Filled Subarrays/2348.py b/solutions/2348. Number of Zero-Filled Subarrays/2348.py
index 23a88d8f0cc..cc1e608dbbf 100644
--- a/solutions/2348. Number of Zero-Filled Subarrays/2348.py	
+++ b/solutions/2348. Number of Zero-Filled Subarrays/2348.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def zeroFilledSubarray(self, nums: list[int]) -> int:
+  def zeroFilledSubarray(self, nums: List[int]) -> int:
     ans = 0
     indexBeforeZero = -1
 
diff --git a/solutions/235. Lowest Common Ancestor of a Binary Search Tree/235.py b/solutions/235. Lowest Common Ancestor of a Binary Search Tree/235.py
index fc5b06ee586..a6c70ba4d0d 100644
--- a/solutions/235. Lowest Common Ancestor of a Binary Search Tree/235.py	
+++ b/solutions/235. Lowest Common Ancestor of a Binary Search Tree/235.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def lowestCommonAncestor(
-      self,
-      root: 'TreeNode',
-      p: 'TreeNode',
-      q: 'TreeNode',
-  ) -> 'TreeNode':
+  def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
     if root.val > max(p.val, q.val):
       return self.lowestCommonAncestor(root.left, p, q)
     if root.val < min(p.val, q.val):
diff --git a/solutions/2350. Shortest Impossible Sequence of Rolls/2350.py b/solutions/2350. Shortest Impossible Sequence of Rolls/2350.py
index fa6c9b8c69c..501cb49eb31 100644
--- a/solutions/2350. Shortest Impossible Sequence of Rolls/2350.py	
+++ b/solutions/2350. Shortest Impossible Sequence of Rolls/2350.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def shortestSequence(self, rolls: list[int], k: int) -> int:
+  def shortestSequence(self, rolls: List[int], k: int) -> int:
     ans = 1  # the the next target length
     seen = set()
 
diff --git a/solutions/2352. Equal Row and Column Pairs/2352.py b/solutions/2352. Equal Row and Column Pairs/2352.py
index 7ddfdf1fc89..5aee75750d1 100644
--- a/solutions/2352. Equal Row and Column Pairs/2352.py	
+++ b/solutions/2352. Equal Row and Column Pairs/2352.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def equalPairs(self, grid: list[list[int]]) -> int:
+  def equalPairs(self, grid: List[List[int]]) -> int:
     n = len(grid)
     ans = 0
 
diff --git a/solutions/2353. Design a Food Rating System/2353.java b/solutions/2353. Design a Food Rating System/2353.java
index 7e7753a701e..1dfdcdbba54 100644
--- a/solutions/2353. Design a Food Rating System/2353.java	
+++ b/solutions/2353. Design a Food Rating System/2353.java	
@@ -3,9 +3,9 @@ public FoodRatings(String[] foods, String[] cuisines, int[] ratings) {
     for (int i = 0; i < foods.length; ++i) {
       cuisineToRatingAndFoods.putIfAbsent(
           cuisines[i],
-          new TreeSet<>(
-              Comparator.comparing(Pair<Integer, String>::getKey, Comparator.reverseOrder())
-                  .thenComparing(Pair<Integer, String>::getValue)));
+          new TreeSet<>((a, b)
+                            -> a.getKey().equals(b.getKey()) ? a.getValue().compareTo(b.getValue())
+                                                             : b.getKey() - a.getKey()));
       cuisineToRatingAndFoods.get(cuisines[i]).add(new Pair<>(ratings[i], foods[i]));
       foodToCuisine.put(foods[i], cuisines[i]);
       foodToRating.put(foods[i], ratings[i]);
diff --git a/solutions/2353. Design a Food Rating System/2353.py b/solutions/2353. Design a Food Rating System/2353.py
index eb6c4808b0b..0a98c196348 100644
--- a/solutions/2353. Design a Food Rating System/2353.py	
+++ b/solutions/2353. Design a Food Rating System/2353.py	
@@ -2,7 +2,7 @@
 
 
 class FoodRatings:
-  def __init__(self, foods: list[str], cuisines: list[str], ratings: list[int]):
+  def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int]):
     self.cuisineToRatingAndFoods = collections.defaultdict(
         lambda: SortedSet(key=lambda x: (-x[0], x[1])))
     self.foodToCuisine = {}
diff --git a/solutions/2354. Number of Excellent Pairs/2354.java b/solutions/2354. Number of Excellent Pairs/2354.java
index e03f728bb32..d0426309a24 100644
--- a/solutions/2354. Number of Excellent Pairs/2354.java	
+++ b/solutions/2354. Number of Excellent Pairs/2354.java	
@@ -1,15 +1,15 @@
 class Solution {
   public long countExcellentPairs(int[] nums, int k) {
-    final int MAX_BIT = 30;
+    final int kMaxBit = 30;
     // bits(num1 | num2) + bits(num1 & num2) = bits(num1) + bits(num2)
     long ans = 0;
-    long[] count = new long[MAX_BIT];
+    long[] count = new long[kMaxBit];
 
     for (final int num : Arrays.stream(nums).boxed().collect(Collectors.toSet()))
       ++count[Integer.bitCount(num)];
 
-    for (int i = 0; i < MAX_BIT; ++i)
-      for (int j = 0; j < MAX_BIT; ++j)
+    for (int i = 0; i < kMaxBit; ++i)
+      for (int j = 0; j < kMaxBit; ++j)
         if (i + j >= k)
           ans += count[i] * count[j];
 
diff --git a/solutions/2354. Number of Excellent Pairs/2354.py b/solutions/2354. Number of Excellent Pairs/2354.py
index 90d1d254910..4472d12d042 100644
--- a/solutions/2354. Number of Excellent Pairs/2354.py	
+++ b/solutions/2354. Number of Excellent Pairs/2354.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countExcellentPairs(self, nums: list[int], k: int) -> int:
+  def countExcellentPairs(self, nums: List[int], k: int) -> int:
     count = collections.Counter(map(int.bit_count, set(nums)))
     return sum(count[i] * count[j]
                for i in count
diff --git a/solutions/2355. Maximum Number of Books You Can Take/2355.py b/solutions/2355. Maximum Number of Books You Can Take/2355.py
index db37416a3b8..ccf931e482c 100644
--- a/solutions/2355. Maximum Number of Books You Can Take/2355.py	
+++ b/solutions/2355. Maximum Number of Books You Can Take/2355.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumBooks(self, books: list[int]) -> int:
+  def maximumBooks(self, books: List[int]) -> int:
     # dp[i] := the maximum the number of books we can take from books[0..i] with taking all of
     # books[i]
     dp = [0] * len(books)
diff --git a/solutions/2357. Make Array Zero by Subtracting Equal Amounts/2357.py b/solutions/2357. Make Array Zero by Subtracting Equal Amounts/2357.py
index 50f2e4ddb9e..ac7e2fcf8c4 100644
--- a/solutions/2357. Make Array Zero by Subtracting Equal Amounts/2357.py	
+++ b/solutions/2357. Make Array Zero by Subtracting Equal Amounts/2357.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def minimumOperations(self, nums: list[int]) -> int:
+  def minimumOperations(self, nums: List[int]) -> int:
     return len(set(nums) - {0})
diff --git a/solutions/2358. Maximum Number of Groups Entering a Competition/2358.py b/solutions/2358. Maximum Number of Groups Entering a Competition/2358.py
index 900652c04de..a0fc0c20315 100644
--- a/solutions/2358. Maximum Number of Groups Entering a Competition/2358.py	
+++ b/solutions/2358. Maximum Number of Groups Entering a Competition/2358.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumGroups(self, grades: list[int]) -> int:
+  def maximumGroups(self, grades: List[int]) -> int:
     # Sort grades, then we can seperate the students into groups of sizes 1, 2,
     # 3, ..., k, s.t. the i-th group < the (i + 1)-th group for both sum and
     # size. So, we can rephrase the problem into:
diff --git a/solutions/2359. Find Closest Node to Given Two Nodes/2359.java b/solutions/2359. Find Closest Node to Given Two Nodes/2359.java
index b705a9ef346..b9a5f76ccd8 100644
--- a/solutions/2359. Find Closest Node to Given Two Nodes/2359.java	
+++ b/solutions/2359. Find Closest Node to Given Two Nodes/2359.java	
@@ -1,9 +1,9 @@
 class Solution {
   public int closestMeetingNode(int[] edges, int node1, int node2) {
-    final int MAX = 10000;
+    final int kMax = 10000;
     final int[] dist1 = getDist(edges, node1);
     final int[] dist2 = getDist(edges, node2);
-    int minDist = MAX;
+    int minDist = kMax;
     int ans = -1;
 
     for (int i = 0; i < edges.length; ++i)
diff --git a/solutions/2359. Find Closest Node to Given Two Nodes/2359.py b/solutions/2359. Find Closest Node to Given Two Nodes/2359.py
index d1400108f3e..5fed5d53a2c 100644
--- a/solutions/2359. Find Closest Node to Given Two Nodes/2359.py	
+++ b/solutions/2359. Find Closest Node to Given Two Nodes/2359.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def closestMeetingNode(self, edges: list[int], node1: int, node2: int) -> int:
-    MAX = 10000
+  def closestMeetingNode(self, edges: List[int], node1: int, node2: int) -> int:
+    kMax = 10000
     dist1 = self._getDist(edges, node1)
     dist2 = self._getDist(edges, node2)
-    minDist = MAX
+    minDist = kMax
     ans = -1
 
     for i, (d1, d2) in enumerate(zip(dist1, dist2)):
@@ -15,7 +15,7 @@ def closestMeetingNode(self, edges: list[int], node1: int, node2: int) -> int:
 
     return ans
 
-  def _getDist(self, edges: list[int], u: int) -> list[int]:
+  def _getDist(self, edges: List[int], u: int) -> List[int]:
     dist = [-1] * len(edges)
     d = 0
     while u != -1 and dist[u] == -1:
diff --git a/solutions/236. Lowest Common Ancestor of a Binary Tree/236-2.cpp b/solutions/236. Lowest Common Ancestor of a Binary Tree/236-2.cpp
index 73c535dc809..0d8764457c4 100644
--- a/solutions/236. Lowest Common Ancestor of a Binary Tree/236-2.cpp	
+++ b/solutions/236. Lowest Common Ancestor of a Binary Tree/236-2.cpp	
@@ -19,7 +19,7 @@ class Solution {
     }
 
     // Insert all the p's ancestors.
-    while (p != nullptr) {
+    while (p) {
       ancestors.insert(p);
       p = parent[p];  // `p` becomes nullptr in the end.
     }
diff --git a/solutions/236. Lowest Common Ancestor of a Binary Tree/236-2.java b/solutions/236. Lowest Common Ancestor of a Binary Tree/236-2.java
index f1772b8e676..9e1591e18dc 100644
--- a/solutions/236. Lowest Common Ancestor of a Binary Tree/236-2.java	
+++ b/solutions/236. Lowest Common Ancestor of a Binary Tree/236-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
-    Queue<TreeNode> q_ = new ArrayDeque<>(List.of(root));
+    Queue<TreeNode> q_ = new ArrayDeque<>(Arrays.asList(root));
     Map<TreeNode, TreeNode> parent = new HashMap<>();
     parent.put(root, null);
     Set<TreeNode> ancestors = new HashSet<>(); // p's ancestors
diff --git a/solutions/236. Lowest Common Ancestor of a Binary Tree/236-2.py b/solutions/236. Lowest Common Ancestor of a Binary Tree/236-2.py
index 7acb51f1302..ce66e351d2f 100644
--- a/solutions/236. Lowest Common Ancestor of a Binary Tree/236-2.py	
+++ b/solutions/236. Lowest Common Ancestor of a Binary Tree/236-2.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def lowestCommonAncestor(
-      self,
-      root: TreeNode | None,
-      p: TreeNode | None,
-      q: TreeNode | None,
-  ) -> TreeNode | None:
+  def lowestCommonAncestor(self, root: Optional[TreeNode], p: Optional[TreeNode], q: Optional[TreeNode]) -> Optional[TreeNode]:
     q_ = collections.deque([root])
     parent = {root: None}
     ancestors = set()  # p's ancestors
diff --git a/solutions/236. Lowest Common Ancestor of a Binary Tree/236.py b/solutions/236. Lowest Common Ancestor of a Binary Tree/236.py
index 9c61d8c23d5..bf3b300fa02 100644
--- a/solutions/236. Lowest Common Ancestor of a Binary Tree/236.py	
+++ b/solutions/236. Lowest Common Ancestor of a Binary Tree/236.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def lowestCommonAncestor(
-      self,
-      root: 'TreeNode',
-      p: 'TreeNode',
-      q: 'TreeNode',
-  ) -> 'TreeNode':
+  def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
     if not root or root == p or root == q:
       return root
     left = self.lowestCommonAncestor(root.left, p, q)
diff --git a/solutions/2360. Longest Cycle in a Graph/2360.py b/solutions/2360. Longest Cycle in a Graph/2360.py
index d3fb7ac8d81..745d9ffa815 100644
--- a/solutions/2360. Longest Cycle in a Graph/2360.py	
+++ b/solutions/2360. Longest Cycle in a Graph/2360.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestCycle(self, edges: list[int]) -> int:
+  def longestCycle(self, edges: List[int]) -> int:
     ans = -1
     time = 1
     timeVisited = [0] * len(edges)
diff --git a/solutions/2361. Minimum Costs Using the Train Line/2361.py b/solutions/2361. Minimum Costs Using the Train Line/2361.py
index 8a928afed3d..23b4707948d 100644
--- a/solutions/2361. Minimum Costs Using the Train Line/2361.py	
+++ b/solutions/2361. Minimum Costs Using the Train Line/2361.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minimumCosts(
-      self,
-      regular: list[int],
-      express: list[int],
-      expressCost: int,
-  ) -> list[int]:
+  def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]:
     n = len(regular)
     ans = [0] * n
     # the minimum cost to reach the current stop in a regular route
diff --git a/solutions/2363. Merge Similar Items/2363.java b/solutions/2363. Merge Similar Items/2363.java
index 9bc90a68503..048e8273250 100644
--- a/solutions/2363. Merge Similar Items/2363.java	
+++ b/solutions/2363. Merge Similar Items/2363.java	
@@ -1,8 +1,8 @@
 class Solution {
   public List<List<Integer>> mergeSimilarItems(int[][] items1, int[][] items2) {
-    final int MAX = 1000;
+    final int kMax = 1000;
     List<List<Integer>> ans = new ArrayList<>();
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (int[] item : items1)
       count[item[0]] += item[1];
@@ -10,7 +10,7 @@ public List<List<Integer>> mergeSimilarItems(int[][] items1, int[][] items2) {
     for (int[] item : items2)
       count[item[0]] += item[1];
 
-    for (int i = 1; i <= MAX; ++i)
+    for (int i = 1; i <= kMax; ++i)
       if (count[i] > 0)
         ans.add(Arrays.asList(i, count[i]));
 
diff --git a/solutions/2363. Merge Similar Items/2363.py b/solutions/2363. Merge Similar Items/2363.py
index 426f322eaaa..e9fd729e1a4 100644
--- a/solutions/2363. Merge Similar Items/2363.py	
+++ b/solutions/2363. Merge Similar Items/2363.py	
@@ -1,5 +1,3 @@
 class Solution:
-  def mergeSimilarItems(self, items1: list[list[int]],
-                        items2: list[list[int]]) -> list[list[int]]:
-    return sorted(
-        (Counter(dict(items1)) + collections.Counter(dict(items2))).items())
+  def mergeSimilarItems(self, items1: List[List[int]], items2: List[List[int]]) -> List[List[int]]:
+    return sorted((Counter(dict(items1)) + collections.Counter(dict(items2))).items())
diff --git a/solutions/2364. Count Number of Bad Pairs/2364.py b/solutions/2364. Count Number of Bad Pairs/2364.py
index 463d3befa51..43e49c7bbcb 100644
--- a/solutions/2364. Count Number of Bad Pairs/2364.py	
+++ b/solutions/2364. Count Number of Bad Pairs/2364.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countBadPairs(self, nums: list[int]) -> int:
+  def countBadPairs(self, nums: List[int]) -> int:
     ans = 0
     count = collections.Counter()  # (nums[i] - i)
 
diff --git a/solutions/2365. Task Scheduler II/2365.py b/solutions/2365. Task Scheduler II/2365.py
index dbdbd6b41a2..2b4bf384f7e 100644
--- a/solutions/2365. Task Scheduler II/2365.py	
+++ b/solutions/2365. Task Scheduler II/2365.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def taskSchedulerII(self, tasks: list[int], space: int) -> int:
+  def taskSchedulerII(self, tasks: List[int], space: int) -> int:
     taskToNextAvailable = collections.defaultdict(int)
     ans = 0
 
diff --git a/solutions/2366. Minimum Replacements to Sort the Array/2366.py b/solutions/2366. Minimum Replacements to Sort the Array/2366.py
index ebf0dfd0fab..15ca47957b1 100644
--- a/solutions/2366. Minimum Replacements to Sort the Array/2366.py	
+++ b/solutions/2366. Minimum Replacements to Sort the Array/2366.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumReplacement(self, nums: list[int]) -> int:
+  def minimumReplacement(self, nums: List[int]) -> int:
     ans = 0
     mx = nums[-1]
 
diff --git a/solutions/2367. Number of Arithmetic Triplets/2367.java b/solutions/2367. Number of Arithmetic Triplets/2367.java
index fa9b59aee6f..602c8f827b1 100644
--- a/solutions/2367. Number of Arithmetic Triplets/2367.java	
+++ b/solutions/2367. Number of Arithmetic Triplets/2367.java	
@@ -1,8 +1,8 @@
 class Solution {
   public int arithmeticTriplets(int[] nums, int diff) {
-    final int MAX = 200;
+    final int kMax = 200;
     int ans = 0;
-    boolean[] count = new boolean[MAX + 1];
+    boolean[] count = new boolean[kMax + 1];
 
     for (final int num : nums) {
       if (num >= 2 * diff && count[num - diff] && count[num - 2 * diff])
diff --git a/solutions/2367. Number of Arithmetic Triplets/2367.py b/solutions/2367. Number of Arithmetic Triplets/2367.py
index d8a0aed2a85..3a7d84aa5a5 100644
--- a/solutions/2367. Number of Arithmetic Triplets/2367.py	
+++ b/solutions/2367. Number of Arithmetic Triplets/2367.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def arithmeticTriplets(self, nums: list[int], diff: int) -> int:
-    MAX = 200
+  def arithmeticTriplets(self, nums: List[int], diff: int) -> int:
+    kMax = 200
     ans = 0
-    count = [False] * (MAX + 1)
+    count = [False] * (kMax + 1)
 
     for num in nums:
       if num >= 2 * diff and count[num - diff] and count[num - 2 * diff]:
diff --git a/solutions/2368. Reachable Nodes With Restrictions/2368.py b/solutions/2368. Reachable Nodes With Restrictions/2368.py
index 14c7333a447..ea21f10ad5d 100644
--- a/solutions/2368. Reachable Nodes With Restrictions/2368.py	
+++ b/solutions/2368. Reachable Nodes With Restrictions/2368.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def reachableNodes(
-      self,
-      n: int,
-      edges: list[list[int]],
-      restricted: list[int],
-  ) -> int:
+  def reachableNodes(self, n: int, edges: List[List[int]], restricted: List[int]) -> int:
     tree = [[] for _ in range(n)]
     seen = set(restricted)
 
diff --git a/solutions/2369. Check if There is a Valid Partition For The Array/2369.py b/solutions/2369. Check if There is a Valid Partition For The Array/2369.py
index 665a963863b..9a534999863 100644
--- a/solutions/2369. Check if There is a Valid Partition For The Array/2369.py	
+++ b/solutions/2369. Check if There is a Valid Partition For The Array/2369.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def validPartition(self, nums: list[int]) -> bool:
+  def validPartition(self, nums: List[int]) -> bool:
     n = len(nums)
     # dp[i] := True if there's a valid partition for the first i numbers
     dp = [False] * (n + 1)
@@ -7,13 +7,8 @@ def validPartition(self, nums: list[int]) -> bool:
     dp[2] = nums[0] == nums[1]
 
     for i in range(3, n + 1):
-      dp[i] = (
-          dp[i - 2] and nums[i - 2] == nums[i - 1]) or (
-          dp[i - 3]
-          and (
-              (nums[i - 3] == nums[i - 2] and nums[i - 2] == nums[i - 1])
-              or (
-                  nums[i - 3] + 1 == nums[i - 2] and nums[i - 2] + 1 == nums
-                  [i - 1])))
+      dp[i] = (dp[i - 2] and nums[i - 2] == nums[i - 1]) or \
+          (dp[i - 3] and ((nums[i - 3] == nums[i - 2] and nums[i - 2] == nums[i - 1]) or
+                          (nums[i - 3] + 1 == nums[i - 2] and nums[i - 2] + 1 == nums[i - 1])))
 
     return dp[n]
diff --git a/solutions/2370. Longest Ideal Subsequence/2370.py b/solutions/2370. Longest Ideal Subsequence/2370.py
index 802773fe23e..e63cef8061e 100644
--- a/solutions/2370. Longest Ideal Subsequence/2370.py	
+++ b/solutions/2370. Longest Ideal Subsequence/2370.py	
@@ -9,7 +9,7 @@ def longestIdealString(self, s: str, k: int) -> int:
 
     return max(dp)
 
-  def _getMaxReachable(self, dp: list[int], i: int, k: int) -> int:
+  def _getMaxReachable(self, dp: List[int], i: int, k: int) -> int:
     first = max(0, i - k)
     last = min(25, i + k)
     maxReachable = 0
diff --git a/solutions/2371. Minimize Maximum Value in a Grid/2371.java b/solutions/2371. Minimize Maximum Value in a Grid/2371.java
index 3e5ffd14bad..16fe9e4c024 100644
--- a/solutions/2371. Minimize Maximum Value in a Grid/2371.java	
+++ b/solutions/2371. Minimize Maximum Value in a Grid/2371.java	
@@ -11,7 +11,12 @@ public int[][] minScore(int[][] grid) {
       for (int j = 0; j < n; ++j)
         valAndIndices.add(new int[] {grid[i][j], i, j});
 
-    Collections.sort(valAndIndices, Comparator.comparingInt(valAndIndex -> valAndIndex[0]));
+    Collections.sort(valAndIndices, new Comparator<int[]>() {
+      @Override
+      public int compare(int[] a, int[] b) {
+        return Integer.compare(a[0], b[0]);
+      }
+    });
 
     for (int[] valAndIndex : valAndIndices) {
       final int i = valAndIndex[1];
diff --git a/solutions/2371. Minimize Maximum Value in a Grid/2371.py b/solutions/2371. Minimize Maximum Value in a Grid/2371.py
index 28be5ac85b1..fbcc1f98a2d 100644
--- a/solutions/2371. Minimize Maximum Value in a Grid/2371.py	
+++ b/solutions/2371. Minimize Maximum Value in a Grid/2371.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minScore(self, grid: list[list[int]]) -> list[list[int]]:
+  def minScore(self, grid: List[List[int]]) -> List[List[int]]:
     m = len(grid)
     n = len(grid[0])
     ans = [[0] * n for _ in range(m)]
diff --git a/solutions/2373. Largest Local Values in a Matrix/2373.py b/solutions/2373. Largest Local Values in a Matrix/2373.py
index df987ef77ee..9730e6418b9 100644
--- a/solutions/2373. Largest Local Values in a Matrix/2373.py	
+++ b/solutions/2373. Largest Local Values in a Matrix/2373.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestLocal(self, grid: list[list[int]]) -> list[list[int]]:
+  def largestLocal(self, grid: List[List[int]]) -> List[List[int]]:
     n = len(grid)
     ans = [[0] * (n - 2) for _ in range(n - 2)]
 
diff --git a/solutions/2374. Node With Highest Edge Score/2374.py b/solutions/2374. Node With Highest Edge Score/2374.py
index a0fc4175e8b..97d06332b90 100644
--- a/solutions/2374. Node With Highest Edge Score/2374.py	
+++ b/solutions/2374. Node With Highest Edge Score/2374.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def edgeScore(self, edges: list[int]) -> int:
+  def edgeScore(self, edges: List[int]) -> int:
     scores = [0] * len(edges)
     for i, edge in enumerate(edges):
       scores[edge] += i
diff --git a/solutions/2375. Construct Smallest Number From DI String/2375.java b/solutions/2375. Construct Smallest Number From DI String/2375.java
index ebc6ae49785..234a46e2ed0 100644
--- a/solutions/2375. Construct Smallest Number From DI String/2375.java	
+++ b/solutions/2375. Construct Smallest Number From DI String/2375.java	
@@ -1,7 +1,7 @@
 class Solution {
   public String smallestNumber(String pattern) {
     StringBuilder sb = new StringBuilder();
-    Deque<Character> stack = new ArrayDeque<>(List.of('1'));
+    Deque<Character> stack = new ArrayDeque<>(Arrays.asList('1'));
 
     for (final char c : pattern.toCharArray()) {
       char maxSorFar = stack.peek();
diff --git a/solutions/2376. Count Special Integers/2376.cpp b/solutions/2376. Count Special Integers/2376.cpp
index 916d40f4fbd..2ab9a7ee128 100644
--- a/solutions/2376. Count Special Integers/2376.cpp	
+++ b/solutions/2376. Count Special Integers/2376.cpp	
@@ -10,30 +10,30 @@ class Solution {
 
  private:
   // Returns the number of special integers, considering the i-th digit, where
-  // `used` is the bitmask of the used digits, and `tight` indicates if the
+  // `used` is the bitmask of the used digits, and `isTight` indicates if the
   // current digit is tightly bound.
-  int count(const string& s, int i, int used, bool tight,
+  int count(const string& s, int i, int used, bool isTight,
             vector<vector<vector<int>>>& mem) {
     if (i == s.length())
       return 1;
-    if (mem[i][used][tight] != -1)
-      return mem[i][used][tight];
+    if (mem[i][used][isTight] != -1)
+      return mem[i][used][isTight];
 
     int res = 0;
-    const int maxDigit = tight ? s[i] - '0' : 9;
 
+    const int maxDigit = isTight ? s[i] - '0' : 9;
     for (int d = 0; d <= maxDigit; ++d) {
       // `d` is used.
       if (used >> d & 1)
         continue;
       // Use `d` now.
-      const bool nextTight = tight && (d == maxDigit);
+      const bool nextIsTight = isTight && (d == maxDigit);
       if (used == 0 && d == 0)  // Don't count leading 0s as used.
-        res += count(s, i + 1, used, nextTight, mem);
+        res += count(s, i + 1, used, nextIsTight, mem);
       else
-        res += count(s, i + 1, used | 1 << d, nextTight, mem);
+        res += count(s, i + 1, used | 1 << d, nextIsTight, mem);
     }
 
-    return mem[i][used][tight] = res;
+    return mem[i][used][isTight] = res;
   }
 };
diff --git a/solutions/2376. Count Special Integers/2376.java b/solutions/2376. Count Special Integers/2376.java
index 54474851f5b..bec613fe3b7 100644
--- a/solutions/2376. Count Special Integers/2376.java	
+++ b/solutions/2376. Count Special Integers/2376.java	
@@ -7,29 +7,29 @@ public int countSpecialNumbers(int n) {
   }
 
   // Returns the number of special integers, considering the i-th digit, where
-  // `used` is the bitmask of the used digits, and `tight` indicates if the
+  // `used` is the bitmask of the used digits, and `isTight` indicates if the
   // current digit is tightly bound.
-  private int count(final String s, int i, int used, boolean tight, Integer[][][] mem) {
+  private int count(final String s, int i, int used, boolean isTight, Integer[][][] mem) {
     if (i == s.length())
       return 1;
-    if (mem[i][used][tight ? 1 : 0] != null)
-      return mem[i][used][tight ? 1 : 0];
+    if (mem[i][used][isTight ? 1 : 0] != null)
+      return mem[i][used][isTight ? 1 : 0];
 
     int res = 0;
-    final int maxDigit = tight ? s.charAt(i) - '0' : 9;
 
+    final int maxDigit = isTight ? s.charAt(i) - '0' : 9;
     for (int d = 0; d <= maxDigit; ++d) {
       // `d` is used.
       if ((used >> d & 1) == 1)
         continue;
       // Use `d` now.
-      final boolean nextTight = tight && (d == maxDigit);
+      final boolean nextIsTight = isTight && (d == maxDigit);
       if (used == 0 && d == 0) // Don't count leading 0s as used.
-        res += count(s, i + 1, used, nextTight, mem);
+        res += count(s, i + 1, used, nextIsTight, mem);
       else
-        res += count(s, i + 1, used | 1 << d, nextTight, mem);
+        res += count(s, i + 1, used | 1 << d, nextIsTight, mem);
     }
 
-    return mem[i][used][tight ? 1 : 0] = res;
+    return mem[i][used][isTight ? 1 : 0] = res;
   }
 }
diff --git a/solutions/2376. Count Special Integers/2376.py b/solutions/2376. Count Special Integers/2376.py
index b497bd3419d..bbdc001daee 100644
--- a/solutions/2376. Count Special Integers/2376.py	
+++ b/solutions/2376. Count Special Integers/2376.py	
@@ -4,28 +4,28 @@ def countSpecialNumbers(self, n: int) -> int:
     s = str(n)
 
     @functools.lru_cache(None)
-    def dp(i: int, used: int, tight: bool) -> int:
+    def dp(i: int, used: int, isTight: bool) -> int:
       """
       Returns the number of special integers, considering the i-th digit, where
-      `used` is the bitmask of the used digits, and `tight` indicates if the
+      `used` is the bitmask of the used digits, and `isTight` indicates if the
       current digit is tightly bound.
       """
       if i == len(s):
         return 1
 
       res = 0
-      maxDigit = int(s[i]) if tight else 9
 
+      maxDigit = int(s[i]) if isTight else 9
       for d in range(maxDigit + 1):
         # `d` is used.
         if used >> d & 1:
           continue
         # Use `d` now.
-        nextTight = tight and (d == maxDigit)
+        nextIsTight = isTight and (d == maxDigit)
         if used == 0 and d == 0:  # Don't count leading 0s as used.
-          res += dp(i + 1, used, nextTight)
+          res += dp(i + 1, used, nextIsTight)
         else:
-          res += dp(i + 1, used | 1 << d, nextTight)
+          res += dp(i + 1, used | 1 << d, nextIsTight)
 
       return res
 
diff --git a/solutions/2378. Choose Edges to Maximize Score in a Tree/2378.java b/solutions/2378. Choose Edges to Maximize Score in a Tree/2378.java
index 0530d6613df..6a3fc411044 100644
--- a/solutions/2378. Choose Edges to Maximize Score in a Tree/2378.java	
+++ b/solutions/2378. Choose Edges to Maximize Score in a Tree/2378.java	
@@ -2,7 +2,9 @@ class Solution {
   public long maxScore(int[][] edges) {
     final int n = edges.length;
     List<Pair<Integer, Integer>>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int i = 0; i < n; ++i) {
       final int parent = edges[i][0];
@@ -26,9 +28,9 @@ private Pair<Long, Long> dfs(List<Pair<Integer, Integer>>[] graph, int u) {
     for (Pair<Integer, Integer> pair : graph[u]) {
       final int v = pair.getKey();
       final int w = pair.getValue();
-      Pair<Long, Long> res = dfs(graph, v);
-      final long takeV = res.getKey();
-      final long notTakeV = res.getValue();
+      Pair<Long, Long> pair = dfs(graph, v);
+      final long takeV = pair.getKey();
+      final long notTakeV = pair.getValue();
       bestEdge = Math.max(bestEdge, w + notTakeV - takeV);
       notTakeU += takeV;
     }
diff --git a/solutions/2378. Choose Edges to Maximize Score in a Tree/2378.py b/solutions/2378. Choose Edges to Maximize Score in a Tree/2378.py
index ff0a35c52c5..55d887bea39 100644
--- a/solutions/2378. Choose Edges to Maximize Score in a Tree/2378.py	
+++ b/solutions/2378. Choose Edges to Maximize Score in a Tree/2378.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxScore(self, edges: list[list[int]]) -> int:
+  def maxScore(self, edges: List[List[int]]) -> int:
     n = len(edges)
     graph = [[] for _ in range(n)]
 
@@ -10,7 +10,7 @@ def maxScore(self, edges: list[list[int]]) -> int:
     takeRoot, notTakeRoot = self._dfs(graph, 0)
     return max(takeRoot, notTakeRoot)
 
-  def _dfs(self, graph: list[list[int]], u: int) -> tuple[int, int]:
+  def _dfs(self, graph: List[List[int]], u: int) -> Tuple[int, int]:
     """
     Returns (the maximum sum at u if we take one u->v edge,
              the maximum sum at u if we don't take any child edge).
diff --git a/solutions/238. Product of Array Except Self/238-2.py b/solutions/238. Product of Array Except Self/238-2.py
index addf57e9035..1fbe220643e 100644
--- a/solutions/238. Product of Array Except Self/238-2.py	
+++ b/solutions/238. Product of Array Except Self/238-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def productExceptSelf(self, nums: list[int]) -> list[int]:
+  def productExceptSelf(self, nums: List[int]) -> List[int]:
     n = len(nums)
     ans = [1] * n
 
diff --git a/solutions/238. Product of Array Except Self/238.py b/solutions/238. Product of Array Except Self/238.py
index cbbf6102929..bdf7e6ddf88 100644
--- a/solutions/238. Product of Array Except Self/238.py	
+++ b/solutions/238. Product of Array Except Self/238.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def productExceptSelf(self, nums: list[int]) -> list[int]:
+  def productExceptSelf(self, nums: List[int]) -> List[int]:
     n = len(nums)
     prefix = [1] * n  # prefix product
     suffix = [1] * n  # suffix product
diff --git a/solutions/2381. Shifting Letters II/2381.cpp b/solutions/2381. Shifting Letters II/2381.cpp
index bf6e27c09d6..ab283f9178d 100644
--- a/solutions/2381. Shifting Letters II/2381.cpp	
+++ b/solutions/2381. Shifting Letters II/2381.cpp	
@@ -2,19 +2,19 @@ class Solution {
  public:
   string shiftingLetters(string s, vector<vector<int>>& shifts) {
     int currShift = 0;
-    vector<int> line(s.length() + 1);
+    vector<int> timeline(s.length() + 1);
 
     for (const vector<int>& shift : shifts) {
       const int start = shift[0];
       const int end = shift[1];
       const int direction = shift[2];
       const int diff = direction ? 1 : -1;
-      line[start] += diff;
-      line[end + 1] -= diff;
+      timeline[start] += diff;
+      timeline[end + 1] -= diff;
     }
 
     for (int i = 0; i < s.length(); ++i) {
-      currShift = (currShift + line[i]) % 26;
+      currShift = (currShift + timeline[i]) % 26;
       const int num = (s[i] - 'a' + currShift + 26) % 26;
       s[i] = 'a' + num;
     }
diff --git a/solutions/2381. Shifting Letters II/2381.java b/solutions/2381. Shifting Letters II/2381.java
index eb585d04fa9..b047aa194c5 100644
--- a/solutions/2381. Shifting Letters II/2381.java	
+++ b/solutions/2381. Shifting Letters II/2381.java	
@@ -2,19 +2,19 @@ class Solution {
   public String shiftingLetters(String s, int[][] shifts) {
     StringBuilder sb = new StringBuilder();
     int currShift = 0;
-    int[] line = new int[s.length() + 1];
+    int[] timeline = new int[s.length() + 1];
 
     for (int[] shift : shifts) {
       final int start = shift[0];
       final int end = shift[1];
       final int direction = shift[2];
       final int diff = direction == 1 ? 1 : -1;
-      line[start] += diff;
-      line[end + 1] -= diff;
+      timeline[start] += diff;
+      timeline[end + 1] -= diff;
     }
 
     for (int i = 0; i < s.length(); ++i) {
-      currShift = (currShift + line[i]) % 26;
+      currShift = (currShift + timeline[i]) % 26;
       final int num = (s.charAt(i) - 'a' + currShift + 26) % 26;
       sb.append((char) ('a' + num));
     }
diff --git a/solutions/2381. Shifting Letters II/2381.py b/solutions/2381. Shifting Letters II/2381.py
index 57816c46301..5eb4868a8c8 100644
--- a/solutions/2381. Shifting Letters II/2381.py	
+++ b/solutions/2381. Shifting Letters II/2381.py	
@@ -1,16 +1,16 @@
 class Solution:
-  def shiftingLetters(self, s: str, shifts: list[list[int]]) -> str:
+  def shiftingLetters(self, s: str, shifts: List[List[int]]) -> str:
     ans = []
     currShift = 0
-    line = [0] * (len(s) + 1)
+    timeline = [0] * (len(s) + 1)
 
     for start, end, direction in shifts:
       diff = 1 if direction else -1
-      line[start] += diff
-      line[end + 1] -= diff
+      timeline[start] += diff
+      timeline[end + 1] -= diff
 
     for i, c in enumerate(s):
-      currShift = (currShift + line[i]) % 26
+      currShift = (currShift + timeline[i]) % 26
       num = (ord(c) - ord('a') + currShift + 26) % 26
       ans.append(chr(ord('a') + num))
 
diff --git a/solutions/2382. Maximum Segment Sum After Removals/2382.py b/solutions/2382. Maximum Segment Sum After Removals/2382.py
index aa462a903fd..1665b7929b7 100644
--- a/solutions/2382. Maximum Segment Sum After Removals/2382.py	
+++ b/solutions/2382. Maximum Segment Sum After Removals/2382.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def maximumSegmentSum(
-      self,
-      nums: list[int],
-      removeQueries: list[int],
-  ) -> list[int]:
+  def maximumSegmentSum(self, nums: List[int], removeQueries: List[int]) -> List[int]:
     n = len(nums)
     maxSum = 0
     ans = [0] * n
diff --git a/solutions/2383. Minimum Hours of Training to Win a Competition/2383.py b/solutions/2383. Minimum Hours of Training to Win a Competition/2383.py
index 13285a9f3ca..c55ccffdd70 100644
--- a/solutions/2383. Minimum Hours of Training to Win a Competition/2383.py	
+++ b/solutions/2383. Minimum Hours of Training to Win a Competition/2383.py	
@@ -1,22 +1,12 @@
 class Solution:
-  def minNumberOfHours(
-      self,
-      initialEnergy: int,
-      initialExperience: int,
-      energy: list[int],
-      experience: list[int],
-  ) -> int:
-    return (self._getRequiredEnergy(initialEnergy, energy) +
-            self._getRequiredExperience(initialExperience, experience))
+  def minNumberOfHours(self, initialEnergy: int, initialExperience: int, energy: List[int], experience: List[int]) -> int:
+    return self._getRequiredEnergy(initialEnergy, energy) + \
+        self._getRequiredExperience(initialExperience, experience)
 
-  def _getRequiredEnergy(self, initialEnergy: int, energy: list[int]) -> int:
+  def _getRequiredEnergy(self, initialEnergy: int, energy: List[int]) -> int:
     return max(0, sum(energy) + 1 - initialEnergy)
 
-  def _getRequiredExperience(
-      self,
-      currentExperience: int,
-      experience: list[int],
-  ) -> int:
+  def _getRequiredExperience(self, currentExperience: int, experience: List[int]) -> int:
     requiredExperience = 0
     for e in experience:
       if e >= currentExperience:
diff --git a/solutions/2384. Largest Palindromic Number/2384.py b/solutions/2384. Largest Palindromic Number/2384.py
index e864a7d49ef..4926e816668 100644
--- a/solutions/2384. Largest Palindromic Number/2384.py	
+++ b/solutions/2384. Largest Palindromic Number/2384.py	
@@ -5,7 +5,7 @@ def largestPalindromic(self, num: str) -> str:
     mid = self._getMid(count)
     return (firstHalf + mid + firstHalf[::-1]) or '0'
 
-  def _getMid(self, count: dict[str, int]) -> str:
+  def _getMid(self, count: Dict[str, int]) -> str:
     for c in '9876543210':
       if count[c] & 1:
         return c
diff --git a/solutions/2385. Amount of Time for Binary Tree to Be Infected/2385.java b/solutions/2385. Amount of Time for Binary Tree to Be Infected/2385.java
index 30391d9f439..23a37edd0d6 100644
--- a/solutions/2385. Amount of Time for Binary Tree to Be Infected/2385.java	
+++ b/solutions/2385. Amount of Time for Binary Tree to Be Infected/2385.java	
@@ -2,7 +2,7 @@ class Solution {
   public int amountOfTime(TreeNode root, int start) {
     int ans = -1;
     Map<Integer, List<Integer>> graph = getGraph(root);
-    Queue<Integer> q = new ArrayDeque<>(List.of(start));
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(start));
     Set<Integer> seen = new HashSet<>(Arrays.asList(start));
 
     for (; !q.isEmpty(); ++ans) {
@@ -25,7 +25,7 @@ public int amountOfTime(TreeNode root, int start) {
   private Map<Integer, List<Integer>> getGraph(TreeNode root) {
     Map<Integer, List<Integer>> graph = new HashMap<>();
     // (node, parent)
-    Queue<Pair<TreeNode, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(root, -1)));
+    Queue<Pair<TreeNode, Integer>> q = new ArrayDeque<>(Arrays.asList(new Pair<>(root, -1)));
 
     while (!q.isEmpty()) {
       Pair<TreeNode, Integer> pair = q.poll();
diff --git a/solutions/2385. Amount of Time for Binary Tree to Be Infected/2385.py b/solutions/2385. Amount of Time for Binary Tree to Be Infected/2385.py
index 6166a179b19..d0da30f1026 100644
--- a/solutions/2385. Amount of Time for Binary Tree to Be Infected/2385.py	
+++ b/solutions/2385. Amount of Time for Binary Tree to Be Infected/2385.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def amountOfTime(self, root: TreeNode | None, start: int) -> int:
+  def amountOfTime(self, root: Optional[TreeNode], start: int) -> int:
     ans = -1
     graph = self._getGraph(root)
     q = collections.deque([start])
@@ -19,7 +19,7 @@ def amountOfTime(self, root: TreeNode | None, start: int) -> int:
 
     return ans
 
-  def _getGraph(self, root: TreeNode | None) -> dict[int, list[int]]:
+  def _getGraph(self, root: Optional[TreeNode]) -> Dict[int, List[int]]:
     graph = collections.defaultdict(list)
     q = collections.deque([(root, -1)])  # (node, parent)
 
diff --git a/solutions/2386. Find the K-Sum of an Array/2386.py b/solutions/2386. Find the K-Sum of an Array/2386.py
index d7e4d941cfa..01cad6f2445 100644
--- a/solutions/2386. Find the K-Sum of an Array/2386.py	
+++ b/solutions/2386. Find the K-Sum of an Array/2386.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def kSum(self, nums: list[int], k: int) -> int:
+  def kSum(self, nums: List[int], k: int) -> int:
     maxSum = sum(num for num in nums if num > 0)
     absNums = sorted(abs(num) for num in nums)
     # (the next maximum sum, the next index i)
diff --git a/solutions/2387. Median of a Row Wise Sorted Matrix/2387.cpp b/solutions/2387. Median of a Row Wise Sorted Matrix/2387.cpp
index 0cd679ebb40..bcb0d1a4d4b 100644
--- a/solutions/2387. Median of a Row Wise Sorted Matrix/2387.cpp	
+++ b/solutions/2387. Median of a Row Wise Sorted Matrix/2387.cpp	
@@ -3,7 +3,7 @@ class Solution {
   int matrixMedian(vector<vector<int>>& grid) {
     const int noGreaterThanMedianCount = grid.size() * grid[0].size() / 2 + 1;
     int l = 1;
-    int r = 1'000'000;
+    int r = 1e6;
 
     while (l < r) {
       const int m = (l + r) / 2;
diff --git a/solutions/2387. Median of a Row Wise Sorted Matrix/2387.java b/solutions/2387. Median of a Row Wise Sorted Matrix/2387.java
index 8794bd60785..ba77ab74451 100644
--- a/solutions/2387. Median of a Row Wise Sorted Matrix/2387.java	
+++ b/solutions/2387. Median of a Row Wise Sorted Matrix/2387.java	
@@ -2,7 +2,7 @@ class Solution {
   public int matrixMedian(int[][] grid) {
     final int noGreaterThanMedianCount = grid.length * grid[0].length / 2 + 1;
     int l = 1;
-    int r = 1_000_000;
+    int r = (int) 1e6;
 
     while (l < r) {
       final int m = (l + r) / 2;
@@ -22,12 +22,12 @@ private int numsNoGreaterThan(int[][] grid, int m) {
     return count;
   }
 
-  private int firstGreater(int[] arr, int target) {
+  private int firstGreater(int[] A, int target) {
     int l = 0;
-    int r = arr.length;
+    int r = A.length;
     while (l < r) {
       final int m = (l + r) / 2;
-      if (arr[m] > target)
+      if (A[m] > target)
         r = m;
       else
         l = m + 1;
diff --git a/solutions/2387. Median of a Row Wise Sorted Matrix/2387.py b/solutions/2387. Median of a Row Wise Sorted Matrix/2387.py
index 8efd81e80ce..314d32d7940 100644
--- a/solutions/2387. Median of a Row Wise Sorted Matrix/2387.py	
+++ b/solutions/2387. Median of a Row Wise Sorted Matrix/2387.py	
@@ -1,13 +1,13 @@
 class Solution:
-  def matrixMedian(self, grid: list[list[int]]) -> int:
+  def matrixMedian(self, grid: List[List[int]]) -> int:
     noGreaterThanMedianCount = len(grid) * len(grid[0]) // 2 + 1
     l = 1
-    r = 1_000_000
+    r = int(1e6)
 
     while l < r:
       m = (l + r) // 2
-      if (sum(bisect.bisect_right(row, m) for row in grid) >=
-              noGreaterThanMedianCount):
+      if sum(bisect_right(row, m) for row in grid) >= \
+              noGreaterThanMedianCount:
         r = m
       else:
         l = m + 1
diff --git a/solutions/2389. Longest Subsequence With Limited Sum/2389.py b/solutions/2389. Longest Subsequence With Limited Sum/2389.py
index 1809e962726..b66f6971ff7 100644
--- a/solutions/2389. Longest Subsequence With Limited Sum/2389.py	
+++ b/solutions/2389. Longest Subsequence With Limited Sum/2389.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def answerQueries(self, nums: list[int], queries: list[int]) -> list[int]:
+  def answerQueries(self, nums: List[int], queries: List[int]) -> List[int]:
     nums.sort()
 
     def numOfElementsLessThan(query: int) -> int:
diff --git a/solutions/239. Sliding Window Maximum/239.py b/solutions/239. Sliding Window Maximum/239.py
index 7612102a95b..09d9cc3d9b8 100644
--- a/solutions/239. Sliding Window Maximum/239.py	
+++ b/solutions/239. Sliding Window Maximum/239.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSlidingWindow(self, nums: list[int], k: int) -> list[int]:
+  def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
     ans = []
     maxQ = collections.deque()
 
diff --git a/solutions/2391. Minimum Amount of Time to Collect Garbage/2391.py b/solutions/2391. Minimum Amount of Time to Collect Garbage/2391.py
index 572fcebe76c..22821f6ab91 100644
--- a/solutions/2391. Minimum Amount of Time to Collect Garbage/2391.py	
+++ b/solutions/2391. Minimum Amount of Time to Collect Garbage/2391.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def garbageCollection(self, garbage: list[str], travel: list[int]) -> int:
+  def garbageCollection(self, garbage: List[str], travel: List[int]) -> int:
     prefix = list(itertools.accumulate(travel))
 
     def getTime(c: str) -> int:
diff --git a/solutions/2392. Build a Matrix With Conditions/2392.py b/solutions/2392. Build a Matrix With Conditions/2392.py
index fdbbf4ca17e..764b4c6dfbf 100644
--- a/solutions/2392. Build a Matrix With Conditions/2392.py	
+++ b/solutions/2392. Build a Matrix With Conditions/2392.py	
@@ -1,6 +1,5 @@
 class Solution:
-  def buildMatrix(self, k: int, rowConditions: list[list[int]],
-                  colConditions: list[list[int]]) -> list[list[int]]:
+  def buildMatrix(self, k: int, rowConditions: List[List[int]], colConditions: List[List[int]]) -> List[List[int]]:
     rowOrder = self._topologicalSort(rowConditions, k)
     if not rowOrder:
       return []
@@ -21,7 +20,7 @@ def buildMatrix(self, k: int, rowConditions: list[list[int]],
 
     return ans
 
-  def _topologicalSort(self, conditions: list[list[int]], n: int) -> list[int]:
+  def _topologicalSort(self, conditions: List[List[int]], n: int) -> List[int]:
     order = []
     graph = [[] for _ in range(n + 1)]
     inDegrees = [0] * (n + 1)
diff --git a/solutions/2393. Count Strictly Increasing Subarrays/2393.py b/solutions/2393. Count Strictly Increasing Subarrays/2393.py
index 805a130023a..bcf6f152e01 100644
--- a/solutions/2393. Count Strictly Increasing Subarrays/2393.py	
+++ b/solutions/2393. Count Strictly Increasing Subarrays/2393.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countSubarrays(self, nums: list[int]) -> int:
+  def countSubarrays(self, nums: List[int]) -> int:
     ans = 0
 
     j = -1
diff --git a/solutions/2395. Find Subarrays With Equal Sum/2395.py b/solutions/2395. Find Subarrays With Equal Sum/2395.py
index a678c95c063..03a69f24229 100644
--- a/solutions/2395. Find Subarrays With Equal Sum/2395.py	
+++ b/solutions/2395. Find Subarrays With Equal Sum/2395.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findSubarrays(self, nums: list[int]) -> bool:
+  def findSubarrays(self, nums: List[int]) -> bool:
     seen = set()
 
     for a, b in zip(nums, nums[1:]):
diff --git a/solutions/2397. Maximum Rows Covered by Columns/2397.py b/solutions/2397. Maximum Rows Covered by Columns/2397.py
index 5d390b3e259..cf68f93a688 100644
--- a/solutions/2397. Maximum Rows Covered by Columns/2397.py	
+++ b/solutions/2397. Maximum Rows Covered by Columns/2397.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumRows(self, matrix: list[list[int]], numSelect: int) -> int:
+  def maximumRows(self, matrix: List[List[int]], numSelect: int) -> int:
     ans = 0
 
     def dfs(colIndex: int, leftColsCount: int, mask: int):
@@ -19,12 +19,12 @@ def dfs(colIndex: int, leftColsCount: int, mask: int):
     dfs(0, numSelect, 0)
     return ans
 
-  def _getAllZerosRowCount(self, matrix: list[list[int]], mask: int) -> int:
+  def _getAllZerosRowCount(self, matrix: List[List[int]], mask: int) -> int:
     count = 0
     for row in matrix:
       isAllZeros = True
-      for i, num in enumerate(row):
-        if num == 1 and (mask >> i & 1) == 0:
+      for i, cell in enumerate(row):
+        if cell == 1 and (mask >> i & 1) == 0:
           isAllZeros = False
           break
       if isAllZeros:
diff --git a/solutions/2398. Maximum Number of Robots Within Budget/2398.py b/solutions/2398. Maximum Number of Robots Within Budget/2398.py
index 66852208fc3..cfd784c7742 100644
--- a/solutions/2398. Maximum Number of Robots Within Budget/2398.py	
+++ b/solutions/2398. Maximum Number of Robots Within Budget/2398.py	
@@ -1,16 +1,10 @@
 class Solution:
-  def maximumRobots(
-      self,
-      chargeTimes: list[int],
-      runningCosts: list[int],
-      budget: int,
-  ) -> int:
+  def maximumRobots(self, chargeTimes: List[int], runningCosts: List[int], budget: int) -> int:
     cost = 0
     maxQ = collections.deque()  # Stores `chargeTimes[i]`.
 
     j = 0  # window's range := [i..j], so k = i - j + 1
-    for i, (chargeTime, runningCost) in enumerate(
-            zip(chargeTimes, runningCosts)):
+    for i, (chargeTime, runningCost) in enumerate(zip(chargeTimes, runningCosts)):
       cost += runningCost
       while maxQ and maxQ[-1] < chargeTime:
         maxQ.pop()
diff --git a/solutions/2399. Check Distances Between Same Letters/2399.py b/solutions/2399. Check Distances Between Same Letters/2399.py
index d887dc694e5..e34669871a3 100644
--- a/solutions/2399. Check Distances Between Same Letters/2399.py	
+++ b/solutions/2399. Check Distances Between Same Letters/2399.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def checkDistances(self, s: str, distance: list[int]) -> bool:
+  def checkDistances(self, s: str, distance: List[int]) -> bool:
     firstSeenIndex = [-1] * 26
 
     for i, c in enumerate(s):
diff --git a/solutions/240. Search a 2D Matrix II/240.py b/solutions/240. Search a 2D Matrix II/240.py
index cd9be4b0cea..3ad108e5310 100644
--- a/solutions/240. Search a 2D Matrix II/240.py	
+++ b/solutions/240. Search a 2D Matrix II/240.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def searchMatrix(self, matrix: list[list[int]], target: int) -> bool:
+  def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
     r = 0
     c = len(matrix[0]) - 1
 
diff --git a/solutions/2400. Number of Ways to Reach a Position After Exactly k Steps/2400.java b/solutions/2400. Number of Ways to Reach a Position After Exactly k Steps/2400.java
index 18b1a800dd3..df837813c4e 100644
--- a/solutions/2400. Number of Ways to Reach a Position After Exactly k Steps/2400.java	
+++ b/solutions/2400. Number of Ways to Reach a Position After Exactly k Steps/2400.java	
@@ -16,7 +16,7 @@ public int numberOfWays(int startPos, int endPos, int k) {
 
   // C(n, k) = C(n - 1, k) + C(n - 1, k - 1)
   private int nCk(int n, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i] := C(n so far, i)
     int[] dp = new int[k + 1];
     dp[0] = 1;
@@ -24,7 +24,7 @@ private int nCk(int n, int k) {
     while (n-- > 0) // Calculate n times.
       for (int j = k; j > 0; --j) {
         dp[j] += dp[j - 1];
-        dp[j] %= MOD;
+        dp[j] %= kMod;
       }
 
     return dp[k];
diff --git a/solutions/2400. Number of Ways to Reach a Position After Exactly k Steps/2400.py b/solutions/2400. Number of Ways to Reach a Position After Exactly k Steps/2400.py
index 421c3aeaa2f..68fb1fdb813 100644
--- a/solutions/2400. Number of Ways to Reach a Position After Exactly k Steps/2400.py	
+++ b/solutions/2400. Number of Ways to Reach a Position After Exactly k Steps/2400.py	
@@ -15,13 +15,13 @@ def numberOfWays(self, startPos: int, endPos: int, k: int) -> int:
 
   # C(n, k) = C(n - 1, k) + C(n - 1, k - 1)
   def _nCk(self, n: int, k: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # dp[i] := C(n so far, i)
     dp = [1] + [0] * k
 
     for _ in range(n):  # Calculate n times.
       for j in range(k, 0, -1):
         dp[j] += dp[j - 1]
-        dp[j] %= MOD
+        dp[j] %= kMod
 
     return dp[k]
diff --git a/solutions/2401. Longest Nice Subarray/2401.py b/solutions/2401. Longest Nice Subarray/2401.py
index 80da293dab8..4643cac2196 100644
--- a/solutions/2401. Longest Nice Subarray/2401.py	
+++ b/solutions/2401. Longest Nice Subarray/2401.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestNiceSubarray(self, nums: list[int]) -> int:
+  def longestNiceSubarray(self, nums: List[int]) -> int:
     ans = 0
     used = 0
 
diff --git a/solutions/2402. Meeting Rooms III/2402.java b/solutions/2402. Meeting Rooms III/2402.java
index fbdcf115f37..fc8ba7ccda8 100644
--- a/solutions/2402. Meeting Rooms III/2402.java	
+++ b/solutions/2402. Meeting Rooms III/2402.java	
@@ -1,12 +1,22 @@
+class T {
+  public long endTime;
+  public int roomId;
+  public T(long endTime, int roomId) {
+    this.endTime = endTime;
+    this.roomId = roomId;
+  }
+}
+
 class Solution {
   public int mostBooked(int n, int[][] meetings) {
-    record T(long endTime, int roomId) {}
     int[] count = new int[n];
 
-    Arrays.sort(meetings, Comparator.comparingInt(meeting -> meeting[0]));
+    Arrays.sort(meetings, (a, b) -> a[0] - b[0]);
 
     Queue<T> occupied =
-        new PriorityQueue<>(Comparator.comparingLong(T::endTime).thenComparingInt(T::roomId));
+        new PriorityQueue<>((a, b)
+                                -> a.endTime == b.endTime ? Integer.compare(a.roomId, b.roomId)
+                                                          : Long.compare(a.endTime, b.endTime));
     Queue<Integer> availableRoomIds = new PriorityQueue<>();
 
     for (int i = 0; i < n; ++i)
diff --git a/solutions/2402. Meeting Rooms III/2402.py b/solutions/2402. Meeting Rooms III/2402.py
index ac01706c512..d83f4284f1a 100644
--- a/solutions/2402. Meeting Rooms III/2402.py	
+++ b/solutions/2402. Meeting Rooms III/2402.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def mostBooked(self, n: int, meetings: list[list[int]]) -> int:
+  def mostBooked(self, n: int, meetings: List[List[int]]) -> int:
     count = [0] * n
 
     meetings.sort()
diff --git a/solutions/2403. Minimum Time to Kill All Monsters/2403.py b/solutions/2403. Minimum Time to Kill All Monsters/2403.py
index 74e8e489921..4ee2ded2aa4 100644
--- a/solutions/2403. Minimum Time to Kill All Monsters/2403.py	
+++ b/solutions/2403. Minimum Time to Kill All Monsters/2403.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumTime(self, power: list[int]) -> int:
+  def minimumTime(self, power: List[int]) -> int:
     n = len(power)
     maxMask = 1 << n
     # dp[i] := the minimum number of days needed to defeat the monsters, where
diff --git a/solutions/2404. Most Frequent Even Element/2404.py b/solutions/2404. Most Frequent Even Element/2404.py
index 3d4eb2462b9..f154308ee3e 100644
--- a/solutions/2404. Most Frequent Even Element/2404.py	
+++ b/solutions/2404. Most Frequent Even Element/2404.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def mostFrequentEven(self, nums: list[int]) -> int:
+  def mostFrequentEven(self, nums: List[int]) -> int:
     ans = -1
     count = collections.Counter()
 
diff --git a/solutions/2406. Divide Intervals Into Minimum Number of Groups/2406.cpp b/solutions/2406. Divide Intervals Into Minimum Number of Groups/2406.cpp
index 60bf0962a34..62bbab38c93 100644
--- a/solutions/2406. Divide Intervals Into Minimum Number of Groups/2406.cpp	
+++ b/solutions/2406. Divide Intervals Into Minimum Number of Groups/2406.cpp	
@@ -8,9 +8,8 @@ class Solution {
     ranges::sort(intervals);
 
     for (const vector<int>& interval : intervals) {
-      // There's no overlap, so we can reuse the same group.
       if (!minHeap.empty() && interval[0] > minHeap.top())
-        minHeap.pop();
+        minHeap.pop();  // There is no overlaps, so we can reuse the same group.
       minHeap.push(interval[1]);
     }
 
diff --git a/solutions/2406. Divide Intervals Into Minimum Number of Groups/2406.java b/solutions/2406. Divide Intervals Into Minimum Number of Groups/2406.java
index 25ef4e113f3..8cf1405dca4 100644
--- a/solutions/2406. Divide Intervals Into Minimum Number of Groups/2406.java	
+++ b/solutions/2406. Divide Intervals Into Minimum Number of Groups/2406.java	
@@ -2,14 +2,13 @@ class Solution {
   // Similar to 253. Meeting Rooms II
   public int minGroups(int[][] intervals) {
     // Stores `right`s.
-    Queue<Integer> minHeap = new PriorityQueue<>();
+    Queue<Integer> minHeap = new PriorityQueue<>((a, b) -> a - b);
 
-    Arrays.sort(intervals, Comparator.comparingInt(interval -> interval[0]));
+    Arrays.sort(intervals, (a, b) -> (a[0] - b[0]));
 
     for (int[] interval : intervals) {
-      // There's no overlap, so we can reuse the same group.
       if (!minHeap.isEmpty() && interval[0] > minHeap.peek())
-        minHeap.poll();
+        minHeap.poll(); // There is no overlaps, so we can reuse the same group.
       minHeap.offer(interval[1]);
     }
 
diff --git a/solutions/2406. Divide Intervals Into Minimum Number of Groups/2406.py b/solutions/2406. Divide Intervals Into Minimum Number of Groups/2406.py
index 0c4d6e54351..389e13add76 100644
--- a/solutions/2406. Divide Intervals Into Minimum Number of Groups/2406.py	
+++ b/solutions/2406. Divide Intervals Into Minimum Number of Groups/2406.py	
@@ -1,11 +1,11 @@
 class Solution:
   # Similar to 253. Meeting Rooms II
-  def minGroups(self, intervals: list[list[int]]) -> int:
+  def minGroups(self, intervals: List[List[int]]) -> int:
     minHeap = []  # Stores `right`s.
 
     for left, right in sorted(intervals):
-      # There's no overlap, so we can reuse the same group.
       if minHeap and left > minHeap[0]:
+        # There is no overlaps, so we can reuse the same group.
         heapq.heappop(minHeap)
       heapq.heappush(minHeap, right)
 
diff --git a/solutions/2407. Longest Increasing Subsequence II/2407.cpp b/solutions/2407. Longest Increasing Subsequence II/2407.cpp
index dabc95f47bd..bddad980981 100644
--- a/solutions/2407. Longest Increasing Subsequence II/2407.cpp	
+++ b/solutions/2407. Longest Increasing Subsequence II/2407.cpp	
@@ -2,17 +2,17 @@ struct SegmentTreeNode {
   int lo;
   int hi;
   int maxLength;
-  std::unique_ptr<SegmentTreeNode> left;
-  std::unique_ptr<SegmentTreeNode> right;
+  unique_ptr<SegmentTreeNode> left;
+  unique_ptr<SegmentTreeNode> right;
   // maxLength := the maximum length of LIS ending in [lo..hi]
   SegmentTreeNode(int lo, int hi, int maxLength,
-                  std::unique_ptr<SegmentTreeNode> left = nullptr,
-                  std::unique_ptr<SegmentTreeNode> right = nullptr)
+                  unique_ptr<SegmentTreeNode> left = nullptr,
+                  unique_ptr<SegmentTreeNode> right = nullptr)
       : lo(lo),
         hi(hi),
         maxLength(maxLength),
-        left(std::move(left)),
-        right(std::move(right)) {}
+        left(move(left)),
+        right(move(right)) {}
 };
 
 class SegmentTree {
@@ -23,7 +23,7 @@ class SegmentTree {
     update(root, i, j, maxLength);
   }
 
-  // Returns the maximum length of LIS ending in [i..j].
+  // queryRange(i, j) := the maximum length of LIS ending in [i..j]
   int queryRange(int i, int j) {
     return query(root, i, j);
   }
@@ -31,8 +31,7 @@ class SegmentTree {
  private:
   std::unique_ptr<SegmentTreeNode> root;
 
-  void update(std::unique_ptr<SegmentTreeNode>& root, int i, int j,
-              int maxLength) {
+  void update(unique_ptr<SegmentTreeNode>& root, int i, int j, int maxLength) {
     if (root->lo == i && root->hi == j) {
       root->maxLength = maxLength;
       root->left = nullptr;
@@ -53,10 +52,10 @@ class SegmentTree {
       update(root->left, i, mid, maxLength);
       update(root->right, mid + 1, j, maxLength);
     }
-    root->maxLength = merge(root->left->maxLength, root->right->maxLength);
+    root->maxLength = max(root->left->maxLength, root->right->maxLength);
   }
 
-  int query(std::unique_ptr<SegmentTreeNode>& root, int i, int j) {
+  int query(unique_ptr<SegmentTreeNode>& root, int i, int j) {
     if (root->left == nullptr)
       return root->maxLength;
     if (root->lo == i && root->hi == j)
@@ -66,12 +65,8 @@ class SegmentTree {
       return query(root->left, i, j);
     if (i > mid)
       return query(root->right, i, j);
-    return merge(query(root->left, i, mid), query(root->right, mid + 1, j));
+    return max(query(root->left, i, mid), query(root->right, mid + 1, j));
   }
-
-  int merge(int left, int right) const {
-    return max(left, right);
-  };
 };
 
 class Solution {
@@ -85,7 +80,7 @@ class Solution {
       const int right = num - 1;
       // the maximum length of LIS ending in [left..right] + the current number
       const int maxLength = tree.queryRange(left, right) + 1;
-      ans = max(ans, maxLength);
+      ans = std::max(ans, maxLength);
       tree.updateRange(num, num, maxLength);
     }
 
diff --git a/solutions/2408. Design SQL/2408.py b/solutions/2408. Design SQL/2408.py
index cf11042becc..1826a3d0ff8 100644
--- a/solutions/2408. Design SQL/2408.py	
+++ b/solutions/2408. Design SQL/2408.py	
@@ -1,8 +1,8 @@
 class SQL:
-  def __init__(self, names: list[str], columns: list[int]):
-    self.db: dict[str, list[list[str]]] = collections.defaultdict(list)
+  def __init__(self, names: List[str], columns: List[int]):
+    self.db: Dict[str, List[List[str]]] = collections.defaultdict(list)
 
-  def insertRow(self, name: str, row: list[str]) -> None:
+  def insertRow(self, name: str, row: List[str]) -> None:
     self.db[name].append(row)
 
   def deleteRow(self, name: str, rowId: int) -> None:
diff --git a/solutions/2409. Count Days Spent Together/2409.py b/solutions/2409. Count Days Spent Together/2409.py
index 17f9cc3e100..46719964d22 100644
--- a/solutions/2409. Count Days Spent Together/2409.py	
+++ b/solutions/2409. Count Days Spent Together/2409.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def countDaysTogether(
-      self,
-      arriveAlice: str,
-      leaveAlice: str,
-      arriveBob: str,
-      leaveBob: str,
-  ) -> int:
+  def countDaysTogether(self, arriveAlice: str, leaveAlice: str, arriveBob: str, leaveBob: str) -> int:
     days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
 
     def toDays(s: str) -> int:
diff --git a/solutions/241. Different Ways to Add Parentheses/241.cpp b/solutions/241. Different Ways to Add Parentheses/241.cpp
index a093daefaae..087085841c1 100644
--- a/solutions/241. Different Ways to Add Parentheses/241.cpp	
+++ b/solutions/241. Different Ways to Add Parentheses/241.cpp	
@@ -13,8 +13,8 @@ class Solution {
 
     for (int i = 0; i < s.length(); ++i)
       if (ispunct(s[i]))
-        for (const int a : ways(s.substr(0, i), std::move(mem)))
-          for (const int b : ways(s.substr(i + 1), std::move(mem)))
+        for (const int a : ways(s.substr(0, i), move(mem)))
+          for (const int b : ways(s.substr(i + 1), move(mem)))
             if (s[i] == '+')
               ans.push_back(a + b);
             else if (s[i] == '-')
diff --git a/solutions/241. Different Ways to Add Parentheses/241.py b/solutions/241. Different Ways to Add Parentheses/241.py
index 6d5e9b53396..0ba047fa217 100644
--- a/solutions/241. Different Ways to Add Parentheses/241.py	
+++ b/solutions/241. Different Ways to Add Parentheses/241.py	
@@ -1,6 +1,6 @@
 class Solution:
   @functools.lru_cache(None)
-  def diffWaysToCompute(self, expression: str) -> list[int]:
+  def diffWaysToCompute(self, expression: str) -> List[int]:
     ans = []
 
     for i, c in enumerate(expression):
diff --git a/solutions/2410. Maximum Matching of Players With Trainers/2410.py b/solutions/2410. Maximum Matching of Players With Trainers/2410.py
index 2b965138b5a..37ad0270ea1 100644
--- a/solutions/2410. Maximum Matching of Players With Trainers/2410.py	
+++ b/solutions/2410. Maximum Matching of Players With Trainers/2410.py	
@@ -1,18 +1,16 @@
 class Solution:
-  def matchPlayersAndTrainers(
-      self,
-      players: list[int],
-      trainers: list[int],
-  ) -> int:
+  def matchPlayersAndTrainers(self, players: List[int], trainers: List[int]) -> int:
     ans = 0
 
     players.sort()
     trainers.sort()
 
     for i, trainer in enumerate(trainers):
-      if players[ans] <= trainer:
+      if players[ans] <= trainers[i]:
         ans += 1
         if ans == len(players):
           return ans
 
     return ans
+  
+
diff --git a/solutions/2411. Smallest Subarrays With Maximum Bitwise OR/2411.java b/solutions/2411. Smallest Subarrays With Maximum Bitwise OR/2411.java
index 8f4e676ca00..31de60044b6 100644
--- a/solutions/2411. Smallest Subarrays With Maximum Bitwise OR/2411.java	
+++ b/solutions/2411. Smallest Subarrays With Maximum Bitwise OR/2411.java	
@@ -1,14 +1,14 @@
 class Solution {
   public int[] smallestSubarrays(int[] nums) {
-    final int MAX_BIT = 30;
+    final int kMaxBit = 30;
     int[] ans = new int[nums.length];
     // closest[j] := the closest index i s.t. the j-th bit of nums[i] is 1
-    int[] closest = new int[MAX_BIT];
+    int[] closest = new int[kMaxBit];
 
     Arrays.fill(ans, 1);
 
     for (int i = nums.length - 1; i >= 0; --i)
-      for (int j = 0; j < MAX_BIT; ++j) {
+      for (int j = 0; j < kMaxBit; ++j) {
         if ((nums[i] >> j & 1) == 1)
           closest[j] = i;
         ans[i] = Math.max(ans[i], closest[j] - i + 1);
diff --git a/solutions/2411. Smallest Subarrays With Maximum Bitwise OR/2411.py b/solutions/2411. Smallest Subarrays With Maximum Bitwise OR/2411.py
index eddf8325ad7..678ac577da8 100644
--- a/solutions/2411. Smallest Subarrays With Maximum Bitwise OR/2411.py	
+++ b/solutions/2411. Smallest Subarrays With Maximum Bitwise OR/2411.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def smallestSubarrays(self, nums: list[int]) -> list[int]:
-    MAX_BIT = 30
+  def smallestSubarrays(self, nums: List[int]) -> List[int]:
+    kMaxBit = 30
     ans = [1] * len(nums)
     # closest[j] := the closest index i s.t. the j-th bit of nums[i] is 1
-    closest = [0] * MAX_BIT
+    closest = [0] * kMaxBit
 
     for i in reversed(range(len(nums))):
-      for j in range(MAX_BIT):
+      for j in range(kMaxBit):
         if nums[i] >> j & 1:
           closest[j] = i
         ans[i] = max(ans[i], closest[j] - i + 1)
diff --git a/solutions/2412. Minimum Money Required Before Transactions/2412.py b/solutions/2412. Minimum Money Required Before Transactions/2412.py
index abf780fffcb..77623f0a1af 100644
--- a/solutions/2412. Minimum Money Required Before Transactions/2412.py	
+++ b/solutions/2412. Minimum Money Required Before Transactions/2412.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumMoney(self, transactions: list[list[int]]) -> int:
+  def minimumMoney(self, transactions: List[List[int]]) -> int:
     ans = 0
     losses = 0
 
diff --git a/solutions/2415. Reverse Odd Levels of Binary Tree/2415.py b/solutions/2415. Reverse Odd Levels of Binary Tree/2415.py
index 92d65fe149b..a0715637c04 100644
--- a/solutions/2415. Reverse Odd Levels of Binary Tree/2415.py	
+++ b/solutions/2415. Reverse Odd Levels of Binary Tree/2415.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def reverseOddLevels(self, root: TreeNode | None) -> TreeNode | None:
-    def dfs(left: TreeNode | None, right: TreeNode | None, isOddLevel: bool) -> None:
+  def reverseOddLevels(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
+    def dfs(left: Optional[TreeNode], right: Optional[TreeNode], isOddLevel: bool) -> None:
       if not left:
         return
       if isOddLevel:
diff --git a/solutions/2416. Sum of Prefix Scores of Strings/2416.java b/solutions/2416. Sum of Prefix Scores of Strings/2416.java
index a1bdadf8316..d397b07d903 100644
--- a/solutions/2416. Sum of Prefix Scores of Strings/2416.java	
+++ b/solutions/2416. Sum of Prefix Scores of Strings/2416.java	
@@ -18,7 +18,7 @@ public int[] sumPrefixScores(String[] words) {
 
   private TrieNode root = new TrieNode();
 
-  private void insert(final String word) {
+  private void insert(String word) {
     TrieNode node = root;
     for (final char c : word.toCharArray()) {
       final int i = c - 'a';
@@ -29,7 +29,7 @@ private void insert(final String word) {
     }
   }
 
-  private int getScore(final String word) {
+  private int getScore(String word) {
     TrieNode node = root;
     int score = 0;
     for (final char c : word.toCharArray()) {
diff --git a/solutions/2416. Sum of Prefix Scores of Strings/2416.py b/solutions/2416. Sum of Prefix Scores of Strings/2416.py
index f82f46c7111..1dd8791b125 100644
--- a/solutions/2416. Sum of Prefix Scores of Strings/2416.py	
+++ b/solutions/2416. Sum of Prefix Scores of Strings/2416.py	
@@ -1,11 +1,11 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
     self.count = 0
 
 
 class Solution:
-  def sumPrefixScores(self, words: list[str]) -> list[int]:
+  def sumPrefixScores(self, words: List[str]) -> List[int]:
     root = TrieNode()
 
     def insert(word: str) -> None:
diff --git a/solutions/2417. Closest Fair Integer/2417.py b/solutions/2417. Closest Fair Integer/2417.py
index 3101089fa76..4ee7437016c 100644
--- a/solutions/2417. Closest Fair Integer/2417.py	
+++ b/solutions/2417. Closest Fair Integer/2417.py	
@@ -1,8 +1,8 @@
 class Solution:
   def closestFair(self, n: int) -> int:
     digitsCount = len(str(n))
-    return (self._getEvenDigits(n) if digitsCount % 2 == 0 else
-            self._getOddDigits(digitsCount))
+    return self._getEvenDigits(n) if digitsCount % 2 == 0 \
+        else self._getOddDigits(digitsCount)
 
   def _getOddDigits(self, digitsCount: int) -> int:
     zeros = (digitsCount + 1) // 2
@@ -20,5 +20,5 @@ def _getEvenDigits(self, n: int) -> int:
   def _isValidNum(self, num: int) -> bool:
     count = 0
     for c in str(num):
-      count += 1 if int(c) % 2 == 0 else -1
+      count += 1 if (ord(c) - ord('0')) % 2 == 0 else -1
     return count == 0
diff --git a/solutions/2418. Sort the People/2418.java b/solutions/2418. Sort the People/2418.java
index d062fc77ba3..a8d925335a2 100644
--- a/solutions/2418. Sort the People/2418.java	
+++ b/solutions/2418. Sort the People/2418.java	
@@ -5,7 +5,7 @@ public String[] sortPeople(String[] names, int[] heights) {
     for (int i = 0; i < names.length; ++i)
       heightAndNames.add(new Pair<>(heights[i], names[i]));
 
-    Collections.sort(heightAndNames, (a, b) -> b.getKey().compareTo(a.getKey()));
+    Collections.sort(heightAndNames, (a, b) -> b.getKey() - a.getKey());
 
     for (int i = 0; i < heightAndNames.size(); ++i)
       names[i] = heightAndNames.get(i).getValue();
diff --git a/solutions/2418. Sort the People/2418.py b/solutions/2418. Sort the People/2418.py
index cb628c70343..eec2c7ec488 100644
--- a/solutions/2418. Sort the People/2418.py	
+++ b/solutions/2418. Sort the People/2418.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def sortPeople(self, names: list[str], heights: list[int]) -> list[str]:
+  def sortPeople(self, names: List[str], heights: List[int]) -> List[str]:
     return [height for _, height in
             sorted([(height, name) for name, height in zip(names, heights)], reverse=True)]
diff --git a/solutions/2419. Longest Subarray With Maximum Bitwise AND/2419.py b/solutions/2419. Longest Subarray With Maximum Bitwise AND/2419.py
index 28f034f952f..ee935b1aa76 100644
--- a/solutions/2419. Longest Subarray With Maximum Bitwise AND/2419.py	
+++ b/solutions/2419. Longest Subarray With Maximum Bitwise AND/2419.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestSubarray(self, nums: list[int]) -> int:
+  def longestSubarray(self, nums: List[int]) -> int:
     ans = 0
     maxIndex = 0
     sameNumLength = 0
diff --git a/solutions/2420. Find All Good Indices/2420.py b/solutions/2420. Find All Good Indices/2420.py
index ea44a5f121d..3a8eaabe594 100644
--- a/solutions/2420. Find All Good Indices/2420.py	
+++ b/solutions/2420. Find All Good Indices/2420.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 2100. Find Good Days to Rob the Bank
-  def goodIndices(self, nums: list[int], k: int) -> list[int]:
+  def goodIndices(self, nums: List[int], k: int) -> List[int]:
     n = len(nums)
     dec = [1] * n  # 1 + the number of continuous decreasing numbers before i
     inc = [1] * n  # 1 + the number of continuous increasing numbers after i
diff --git a/solutions/2422. Merge Operations to Turn Array Into a Palindrome/2422.py b/solutions/2422. Merge Operations to Turn Array Into a Palindrome/2422.py
index 0d1abb1d390..33e16c14be4 100644
--- a/solutions/2422. Merge Operations to Turn Array Into a Palindrome/2422.py	
+++ b/solutions/2422. Merge Operations to Turn Array Into a Palindrome/2422.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumOperations(self, nums: list[int]) -> int:
+  def minimumOperations(self, nums: List[int]) -> int:
     ans = 0
     l = 0
     r = len(nums) - 1
diff --git a/solutions/2423. Remove Letter To Equalize Frequency/2423.java b/solutions/2423. Remove Letter To Equalize Frequency/2423.java
index be567fc242c..bc6195ae4c5 100644
--- a/solutions/2423. Remove Letter To Equalize Frequency/2423.java	
+++ b/solutions/2423. Remove Letter To Equalize Frequency/2423.java	
@@ -17,10 +17,10 @@ public boolean equalFrequency(String word) {
     return false;
   }
 
-  private static final int MAX = 101;
+  private static final int kMax = 101;
 
   private boolean equalFreq(int[] count) {
-    int minfreq = MAX;
+    int minfreq = kMax;
     int maxfreq = 0;
     for (final int freq : count)
       if (freq > 0) {
diff --git a/solutions/2425. Bitwise XOR of All Pairings/2425.py b/solutions/2425. Bitwise XOR of All Pairings/2425.py
index 3623e356fee..ff3b479e029 100644
--- a/solutions/2425. Bitwise XOR of All Pairings/2425.py	
+++ b/solutions/2425. Bitwise XOR of All Pairings/2425.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def xorAllNums(self, nums1: list[int], nums2: list[int]) -> int:
+  def xorAllNums(self, nums1: List[int], nums2: List[int]) -> int:
     xors1 = functools.reduce(operator.xor, nums1)
     xors2 = functools.reduce(operator.xor, nums2)
     # If the size of nums1 is m and the size of nums2 is n, then each number in
diff --git a/solutions/2426. Number of Pairs Satisfying Inequality/2426.cpp b/solutions/2426. Number of Pairs Satisfying Inequality/2426.cpp
index ed204fa21ab..fe059d6d5aa 100644
--- a/solutions/2426. Number of Pairs Satisfying Inequality/2426.cpp	
+++ b/solutions/2426. Number of Pairs Satisfying Inequality/2426.cpp	
@@ -3,35 +3,35 @@ class Solution {
   long long numberOfPairs(vector<int>& nums1, vector<int>& nums2, int diff) {
     // nums1[i] - nums1[j] <= nums2[i] - nums2[j] + diff
     // nums1[i] - nums2[i] <= nums1[j] - nums2[j] + diff
-    // Define arr[i] := nums1[i] - nums2[i] -> arr[i] <= arr[j] + diff
-    vector<int> arr;
+    // Define A[i] := nums1[i] - nums2[i] -> A[i] <= A[j] + diff
+    vector<int> A;
 
     for (int i = 0; i < nums1.size(); ++i)
-      arr.push_back(nums1[i] - nums2[i]);
+      A.push_back(nums1[i] - nums2[i]);
 
     long ans = 0;
-    mergeSort(arr, 0, arr.size() - 1, diff, ans);
+    mergeSort(A, 0, A.size() - 1, diff, ans);
     return ans;
   }
 
  private:
-  void mergeSort(vector<int>& arr, int l, int r, int diff, long& ans) {
+  void mergeSort(vector<int>& A, int l, int r, int diff, long& ans) {
     if (l >= r)
       return;
 
     const int m = (l + r) / 2;
-    mergeSort(arr, l, m, diff, ans);
-    mergeSort(arr, m + 1, r, diff, ans);
-    merge(arr, l, m, r, diff, ans);
+    mergeSort(A, l, m, diff, ans);
+    mergeSort(A, m + 1, r, diff, ans);
+    merge(A, l, m, r, diff, ans);
   }
 
-  void merge(vector<int>& arr, int l, int m, int r, int diff, long& ans) {
+  void merge(vector<int>& A, int l, int m, int r, int diff, long& ans) {
     const int lo = m + 1;
-    int hi = m + 1;  // the first index s.t. arr[i] <= arr[hi] + diff
+    int hi = m + 1;  // the first index s.t. A[i] <= A[hi] + diff
 
     // For each index i in the range [l, m], add `r - hi + 1` to `ans`.
     for (int i = l; i <= m; ++i) {
-      while (hi <= r && arr[i] > arr[hi] + diff)
+      while (hi <= r && A[i] > A[hi] + diff)
         ++hi;
       ans += r - hi + 1;
     }
@@ -42,19 +42,19 @@ class Solution {
     int j = m + 1;  // right's index
 
     while (i <= m && j <= r)
-      if (arr[i] < arr[j])
-        sorted[k++] = arr[i++];
+      if (A[i] < A[j])
+        sorted[k++] = A[i++];
       else
-        sorted[k++] = arr[j++];
+        sorted[k++] = A[j++];
 
     // Put the possible remaining left part into the sorted array.
     while (i <= m)
-      sorted[k++] = arr[i++];
+      sorted[k++] = A[i++];
 
     // Put the possible remaining right part into the sorted array.
     while (j <= r)
-      sorted[k++] = arr[j++];
+      sorted[k++] = A[j++];
 
-    copy(sorted.begin(), sorted.end(), arr.begin() + l);
+    copy(sorted.begin(), sorted.end(), A.begin() + l);
   }
 };
diff --git a/solutions/2427. Number of Common Factors/2427.py b/solutions/2427. Number of Common Factors/2427.py
index 9d607299727..3185ad1b42b 100644
--- a/solutions/2427. Number of Common Factors/2427.py	
+++ b/solutions/2427. Number of Common Factors/2427.py	
@@ -3,3 +3,4 @@ def commonFactors(self, a: int, b: int) -> int:
     gcd = math.gcd(a, b)
     return sum(a % i == 0 and b % i == 0
                for i in range(1, gcd + 1))
+  
\ No newline at end of file
diff --git a/solutions/2428. Maximum Sum of an Hourglass/2428.java b/solutions/2428. Maximum Sum of an Hourglass/2428.java
index d89015cd9d5..5dc845de5f3 100644
--- a/solutions/2428. Maximum Sum of an Hourglass/2428.java	
+++ b/solutions/2428. Maximum Sum of an Hourglass/2428.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public int maxSum(int[][] grid) {
     int ans = 0;
 
diff --git a/solutions/2428. Maximum Sum of an Hourglass/2428.py b/solutions/2428. Maximum Sum of an Hourglass/2428.py
index efdd9f1f8f2..450cd4fda86 100644
--- a/solutions/2428. Maximum Sum of an Hourglass/2428.py	
+++ b/solutions/2428. Maximum Sum of an Hourglass/2428.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def maxSum(self, grid: list[list[int]]) -> int:
-    return max(
-        grid[i - 1][j - 1] + grid[i - 1][j] + grid[i - 1][j + 1] + grid[i][j] +
-        grid[i + 1][j - 1] + grid[i + 1][j] + grid[i + 1][j + 1]
-        for i in range(1, len(grid) - 1) for j in range(1, len(grid[0]) - 1))
+  def maxSum(self, grid: List[List[int]]) -> int:
+    return max(grid[i - 1][j - 1] + grid[i - 1][j] + grid[i - 1][j + 1] + grid[i][j] +
+               grid[i + 1][j - 1] + grid[i + 1][j] + grid[i + 1][j + 1]
+               for i in range(1, len(grid) - 1)
+               for j in range(1, len(grid[0]) - 1))
diff --git a/solutions/2429. Minimize XOR/2429.java b/solutions/2429. Minimize XOR/2429.java
index c1ef940f012..b2fdc6cf7b0 100644
--- a/solutions/2429. Minimize XOR/2429.java	
+++ b/solutions/2429. Minimize XOR/2429.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int minimizeXor(int num1, int num2) {
-    final int MAX_BIT = 30;
+    final int kMaxBit = 30;
     int bits = Integer.bitCount(num2);
     // Can turn off all the bits in `num1`.
     if (Integer.bitCount(num1) == bits)
@@ -9,7 +9,7 @@ public int minimizeXor(int num1, int num2) {
     int ans = 0;
 
     // Turn off the MSB if we have `bits` quota.
-    for (int i = MAX_BIT - 1; i >= 0; --i)
+    for (int i = kMaxBit - 1; i >= 0; --i)
       if ((num1 >> i & 1) == 1) {
         ans |= 1 << i;
         if (--bits == 0)
@@ -17,7 +17,7 @@ public int minimizeXor(int num1, int num2) {
       }
 
     // Turn on the LSB if we still have `bits`.
-    for (int i = 0; i < MAX_BIT; ++i)
+    for (int i = 0; i < kMaxBit; ++i)
       if ((num1 >> i & 1) == 0) {
         ans |= 1 << i;
         if (--bits == 0)
diff --git a/solutions/2429. Minimize XOR/2429.py b/solutions/2429. Minimize XOR/2429.py
index ade9dce1094..895005048b1 100644
--- a/solutions/2429. Minimize XOR/2429.py	
+++ b/solutions/2429. Minimize XOR/2429.py	
@@ -1,6 +1,6 @@
 class Solution:
   def minimizeXor(self, num1: int, num2: int) -> int:
-    MAX_BIT = 30
+    kMaxBit = 30
     bits = num2.bit_count()
     # Can turn off all the bits in `num1`.
     if num1.bit_count() == bits:
@@ -9,7 +9,7 @@ def minimizeXor(self, num1: int, num2: int) -> int:
     ans = 0
 
     # Turn off the MSB if we have `bits` quota.
-    for i in reversed(range(MAX_BIT)):
+    for i in reversed(range(kMaxBit)):
       if num1 >> i & 1:
         ans |= 1 << i
         bits -= 1
@@ -17,7 +17,7 @@ def minimizeXor(self, num1: int, num2: int) -> int:
           return ans
 
     # Turn on the LSB if we still have `bits`.
-    for i in range(MAX_BIT):
+    for i in range(kMaxBit):
       if (num1 >> i & 1) == 0:
         ans |= 1 << i
         bits -= 1
diff --git a/solutions/243. Shortest Word Distance/243.py b/solutions/243. Shortest Word Distance/243.py
index d8e7fc1ef51..926445c8376 100644
--- a/solutions/243. Shortest Word Distance/243.py	
+++ b/solutions/243. Shortest Word Distance/243.py	
@@ -1,13 +1,8 @@
 class Solution:
-  def shortestDistance(
-      self,
-      wordsDict: list[str],
-      word1: str,
-      word2: str,
-  ) -> int:
+  def shortestDistance(self, wordsDict: List[str], word1: str, word2: str) -> int:
     ans = len(wordsDict)
-    index1 = -1  # wordsdict[index1] == word1
-    index2 = -1  # wordsdict[index2] == word2
+    index1 = -1  # wordsDict[index1] == word1
+    index2 = -1  # wordsDict[index2] == word2
 
     for i, word in enumerate(wordsDict):
       if word == word1:
diff --git a/solutions/2430. Maximum Deletions on a String/2430.py b/solutions/2430. Maximum Deletions on a String/2430.py
index 1ec2fad4187..2627d15b3b5 100644
--- a/solutions/2430. Maximum Deletions on a String/2430.py	
+++ b/solutions/2430. Maximum Deletions on a String/2430.py	
@@ -6,7 +6,7 @@ def deleteString(self, s: str) -> int:
     # dp[i] := the maximum number of operations needed to delete s[i..n)
     dp = [1] * n
 
-    for i in range(n - 1, -1, -1):
+    for i in reversed(range(n)):
       for j in range(i + 1, n):
         if s[i] == s[j]:
           lcs[i][j] = lcs[i + 1][j + 1] + 1
diff --git a/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431-2.py b/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431-2.py
index 006452425fa..a6b3cd30d87 100644
--- a/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431-2.py	
+++ b/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431-2.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def maxTastiness(
-      self,
-      price: list[int],
-      tastiness: list[int],
-      maxAmount: int,
-      maxCoupons: int,
-  ) -> int:
+  def maxTastiness(self, price: List[int], tastiness: List[int], maxAmount: int, maxCoupons: int) -> int:
     # dp[j][k] := the maximum tastiness of price so far with j amount of money and k coupons
     dp = [[0] * (maxCoupons + 1) for _ in range(maxAmount + 1)]
 
diff --git a/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431.cpp b/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431.cpp
index 4381c7d8817..dccda970db7 100644
--- a/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431.cpp	
+++ b/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431.cpp	
@@ -3,8 +3,8 @@ class Solution {
   int maxTastiness(vector<int>& price, vector<int>& tastiness, int maxAmount,
                    int maxCoupons) {
     const int n = price.size();
-    // dp[i][j][k] := the maximum tastiness of the first i price with j amount
-    // of money and k coupons
+    // dp[i][j][k] := the maximum tastiness of first i price with j amount of
+    // money and k coupons
     vector<vector<vector<int>>> dp(
         n + 1, vector<vector<int>>(maxAmount + 1, vector<int>(maxCoupons + 1)));
 
diff --git a/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431.java b/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431.java
index 5aca50301d9..42ce17da256 100644
--- a/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431.java	
+++ b/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431.java	
@@ -1,8 +1,7 @@
 class Solution {
   public int maxTastiness(int[] price, int[] tastiness, int maxAmount, int maxCoupons) {
     final int n = price.length;
-    // dp[i][j][k] := the maximum tastiness of the first i price with j amount
-    // of money and k coupons
+    // dp[i][j][k] := the maximum tastiness of first i price with j amount of money and k coupons
     int[][][] dp = new int[price.length + 1][maxAmount + 1][maxCoupons + 1];
 
     for (int i = 1; i <= n; ++i) {
diff --git a/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431.py b/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431.py
index 319db8bcb84..e695b42d5e1 100644
--- a/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431.py	
+++ b/solutions/2431. Maximize Total Tastiness of Purchased Fruits/2431.py	
@@ -1,14 +1,7 @@
 class Solution:
-  def maxTastiness(
-      self,
-      price: list[int],
-      tastiness: list[int],
-      maxAmount: int,
-      maxCoupons: int,
-  ) -> int:
+  def maxTastiness(self, price: List[int], tastiness: List[int], maxAmount: int, maxCoupons: int) -> int:
     n = len(price)
-    # dp[i][j][k] := the maximum tastiness of the first i price with j amount of
-    # money and k coupons
+    # dp[i][j][k] := the maximum tastiness of first i price with j amount of money and k coupons
     dp = [[[0] * (maxCoupons + 1)
            for j in range(maxAmount + 1)]
           for i in range(n + 1)]
diff --git a/solutions/2432. The Employee That Worked on the Longest Task/2432.py b/solutions/2432. The Employee That Worked on the Longest Task/2432.py
index 967693f746d..e7de3cf972b 100644
--- a/solutions/2432. The Employee That Worked on the Longest Task/2432.py	
+++ b/solutions/2432. The Employee That Worked on the Longest Task/2432.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def hardestWorker(self, n: int, logs: list[list[int]]) -> int:
+  def hardestWorker(self, n: int, logs: List[List[int]]) -> int:
     ans = logs[0][0]
     maxWorkingTime = logs[0][1]
 
diff --git a/solutions/2433. Find The Original Array of Prefix Xor/2433.py b/solutions/2433. Find The Original Array of Prefix Xor/2433.py
index 2de218ec033..25ab584f81c 100644
--- a/solutions/2433. Find The Original Array of Prefix Xor/2433.py	
+++ b/solutions/2433. Find The Original Array of Prefix Xor/2433.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findArray(self, pref: list[int]) -> list[int]:
+  def findArray(self, pref: List[int]) -> List[int]:
     ans = [0] * len(pref)
 
     ans[0] = pref[0]
diff --git a/solutions/2434. Using a Robot to Print the Lexicographically Smallest String/2434.py b/solutions/2434. Using a Robot to Print the Lexicographically Smallest String/2434.py
index 177711ee099..3e8f95d7400 100644
--- a/solutions/2434. Using a Robot to Print the Lexicographically Smallest String/2434.py	
+++ b/solutions/2434. Using a Robot to Print the Lexicographically Smallest String/2434.py	
@@ -13,7 +13,7 @@ def robotWithString(self, s: str) -> str:
 
     return ''.join(ans + stack[::-1])
 
-  def _getMinChar(self, count: list[int]) -> str:
+  def _getMinChar(self, count: List[int]) -> str:
     for c in string.ascii_lowercase:
       if count[c]:
         return c
diff --git a/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435-2.java b/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435-2.java
index 182d6988ca1..5aa7d792b14 100644
--- a/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435-2.java	
+++ b/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numberOfPaths(int[][] grid, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int m = grid.length;
     final int n = grid[0].length;
     // dp[i][j][sum] : = the number of paths to(i, j), where the sum / k == sum
@@ -15,7 +15,7 @@ public int numberOfPaths(int[][] grid, int k) {
             dp[i][j][newSum] += dp[i - 1][j][sum];
           if (j > 0)
             dp[i][j][newSum] += dp[i][j - 1][sum];
-          dp[i][j][newSum] %= MOD;
+          dp[i][j][newSum] %= kMod;
         }
 
     return dp[m - 1][n - 1][0];
diff --git a/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435-2.py b/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435-2.py
index 9dad850452e..09b91ae5dd0 100644
--- a/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435-2.py	
+++ b/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435-2.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def numberOfPaths(self, grid: list[list[int]], k: int) -> int:
-    MOD = 1_000_000_007
+  def numberOfPaths(self, grid: List[List[int]], k: int) -> int:
+    kMod = 1_000_000_007
     m = len(grid)
     n = len(grid[0])
     # dp[i][j][sum] := the number of paths to (i, j), where the sum / k == sum
@@ -15,6 +15,6 @@ def numberOfPaths(self, grid: list[list[int]], k: int) -> int:
             dp[i][j][newSum] += dp[i - 1][j][summ]
           if j > 0:
             dp[i][j][newSum] += dp[i][j - 1][summ]
-          dp[i][j][newSum] %= MOD
+          dp[i][j][newSum] %= kMod
 
     return dp[m - 1][n - 1][0]
diff --git a/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435.java b/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435.java
index 616aa4e08b6..57df780c29c 100644
--- a/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435.java	
+++ b/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435.java	
@@ -4,7 +4,7 @@ public int numberOfPaths(int[][] grid, int k) {
     return numberOfPaths(grid, 0, 0, 0, k, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of paths to (i, j), where the sum / k == `sum`.
   private int numberOfPaths(int[][] grid, int i, int j, int sum, int k, Integer[][][] mem) {
@@ -17,6 +17,6 @@ private int numberOfPaths(int[][] grid, int i, int j, int sum, int k, Integer[][
     final int newSum = (sum + grid[i][j]) % k;
     return mem[i][j][sum] = (numberOfPaths(grid, i + 1, j, newSum, k, mem) +
                              numberOfPaths(grid, i, j + 1, newSum, k, mem)) %
-                            MOD;
+                            kMod;
   }
 }
diff --git a/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435.py b/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435.py
index 4d8d41adb07..ef6fd0af0a7 100644
--- a/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435.py	
+++ b/solutions/2435. Paths in Matrix Whose Sum Is Divisible by K/2435.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def numberOfPaths(self, grid: list[list[int]], k: int) -> int:
-    MOD = 1_000_000_007
+  def numberOfPaths(self, grid: List[List[int]], k: int) -> int:
+    kMod = 1_000_000_007
     m = len(grid)
     n = len(grid[0])
 
@@ -14,6 +14,6 @@ def dp(i: int, j: int, summ: int) -> int:
       if i == m - 1 and j == n - 1:
         return 1 if (summ + grid[i][j]) % k == 0 else 0
       newSum = (summ + grid[i][j]) % k
-      return (dp(i + 1, j, newSum) + dp(i, j + 1, newSum)) % MOD
+      return (dp(i + 1, j, newSum) + dp(i, j + 1, newSum)) % kMod
 
     return dp(0, 0, 0)
diff --git a/solutions/2436. Minimum Split Into Subarrays With GCD Greater Than One/2436.py b/solutions/2436. Minimum Split Into Subarrays With GCD Greater Than One/2436.py
index 3e36c74f3e2..f33a7df268d 100644
--- a/solutions/2436. Minimum Split Into Subarrays With GCD Greater Than One/2436.py	
+++ b/solutions/2436. Minimum Split Into Subarrays With GCD Greater Than One/2436.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumSplits(self, nums: list[int]) -> int:
+  def minimumSplits(self, nums: List[int]) -> int:
     ans = 1
     gcd = nums[0]
 
diff --git a/solutions/2438. Range Product Queries of Powers/2438.cpp b/solutions/2438. Range Product Queries of Powers/2438.cpp
index 9625027fb10..9d94aac5441 100644
--- a/solutions/2438. Range Product Queries of Powers/2438.cpp	
+++ b/solutions/2438. Range Product Queries of Powers/2438.cpp	
@@ -4,18 +4,18 @@ class Solution {
     constexpr int kMod = 1'000'000'007;
     constexpr int kMaxBit = 30;
     vector<int> ans;
-    vector<int> pows;
+    vector<int> powers;
 
     for (int i = 0; i < kMaxBit; ++i)
       if (n >> i & 1)
-        pows.push_back(1 << i);
+        powers.push_back(1 << i);
 
     for (const vector<int>& query : queries) {
       const int left = query[0];
       const int right = query[1];
       long prod = 1;
       for (int i = left; i <= right; ++i) {
-        prod *= pows[i];
+        prod *= powers[i];
         prod %= kMod;
       }
       ans.push_back(prod);
diff --git a/solutions/2438. Range Product Queries of Powers/2438.java b/solutions/2438. Range Product Queries of Powers/2438.java
index 02ff6e0871a..19226f1e997 100644
--- a/solutions/2438. Range Product Queries of Powers/2438.java	
+++ b/solutions/2438. Range Product Queries of Powers/2438.java	
@@ -1,21 +1,21 @@
 class Solution {
   public int[] productQueries(int n, int[][] queries) {
-    final int MOD = 1_000_000_007;
-    final int MAX_BIT = 30;
+    final int kMod = 1_000_000_007;
+    final int kMaxBit = 30;
     int[] ans = new int[queries.length];
-    List<Integer> pows = new ArrayList<>();
+    List<Integer> powers = new ArrayList<>();
 
-    for (int i = 0; i < MAX_BIT; ++i)
+    for (int i = 0; i < kMaxBit; ++i)
       if ((n >> i & 1) == 1)
-        pows.add(1 << i);
+        powers.add(1 << i);
 
     for (int i = 0; i < queries.length; ++i) {
       final int left = queries[i][0];
       final int right = queries[i][1];
       long prod = 1;
       for (int j = left; j <= right; ++j) {
-        prod *= pows.get(j);
-        prod %= MOD;
+        prod *= powers.get(j);
+        prod %= kMod;
       }
       ans[i] = (int) prod;
     }
diff --git a/solutions/2438. Range Product Queries of Powers/2438.py b/solutions/2438. Range Product Queries of Powers/2438.py
index 6417e039cca..5068a4ad581 100644
--- a/solutions/2438. Range Product Queries of Powers/2438.py	
+++ b/solutions/2438. Range Product Queries of Powers/2438.py	
@@ -1,15 +1,15 @@
 class Solution:
-  def productQueries(self, n: int, queries: list[list[int]]) -> list[int]:
-    MOD = 1_000_000_007
-    MAX_BIT = 30
+  def productQueries(self, n: int, queries: List[List[int]]) -> List[int]:
+    kMod = 1_000_000_007
+    kMaxBit = 30
     ans = []
-    pows = [1 << i for i in range(MAX_BIT) if n >> i & 1]
+    powers = [1 << i for i in range(kMaxBit) if n >> i & 1]
 
     for left, right in queries:
       prod = 1
       for i in range(left, right + 1):
-        prod *= pows[i]
-        prod %= MOD
+        prod *= powers[i]
+        prod %= kMod
       ans.append(prod)
 
     return ans
diff --git a/solutions/2439. Minimize Maximum of Array/2439.py b/solutions/2439. Minimize Maximum of Array/2439.py
index 0677245b27c..4d678f5833c 100644
--- a/solutions/2439. Minimize Maximum of Array/2439.py	
+++ b/solutions/2439. Minimize Maximum of Array/2439.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimizeArrayValue(self, nums: list[int]) -> int:
+  def minimizeArrayValue(self, nums: List[int]) -> int:
     ans = 0
     prefix = 0
 
diff --git a/solutions/244. Shortest Word Distance II/244.py b/solutions/244. Shortest Word Distance II/244.py
index a4779c0b362..026af61eea4 100644
--- a/solutions/244. Shortest Word Distance II/244.py	
+++ b/solutions/244. Shortest Word Distance II/244.py	
@@ -1,5 +1,5 @@
 class WordDistance:
-  def __init__(self, wordsDict: list[str]):
+  def __init__(self, wordsDict: List[str]):
     self.wordToIndices = collections.defaultdict(list)
     for i, word in enumerate(wordsDict):
       self.wordToIndices[word].append(i)
diff --git a/solutions/2440. Create Components With Same Value/2440.cpp b/solutions/2440. Create Components With Same Value/2440.cpp
index e3947096c8f..d196a289f5d 100644
--- a/solutions/2440. Create Components With Same Value/2440.cpp	
+++ b/solutions/2440. Create Components With Same Value/2440.cpp	
@@ -33,7 +33,7 @@ class Solution {
     for (const int v : tree[u]) {
       if (seen[v])
         continue;
-      sum += dfs(nums, tree, v, target, std::move(seen));
+      sum += dfs(nums, tree, v, target, move(seen));
       if (sum > target)
         return kMax;
     }
diff --git a/solutions/2440. Create Components With Same Value/2440.java b/solutions/2440. Create Components With Same Value/2440.java
index fbf8fbe7e25..22d851067ea 100644
--- a/solutions/2440. Create Components With Same Value/2440.java	
+++ b/solutions/2440. Create Components With Same Value/2440.java	
@@ -22,7 +22,7 @@ public int componentValue(int[] nums, int[][] edges) {
     return 0;
   }
 
-  private static final int MAX = 1_000_000_000;
+  private static final int kMax = 1_000_000_000;
 
   // Returns the sum of the subtree rooted at u substracting the sum of the deleted subtrees.
   private int dfs(int[] nums, List<Integer>[] tree, int u, int target, boolean[] seen) {
@@ -34,7 +34,7 @@ private int dfs(int[] nums, List<Integer>[] tree, int u, int target, boolean[] s
         continue;
       sum += dfs(nums, tree, v, target, seen);
       if (sum > target)
-        return MAX;
+        return kMax;
     }
 
     // Delete the tree that has sum == target.
diff --git a/solutions/2440. Create Components With Same Value/2440.py b/solutions/2440. Create Components With Same Value/2440.py
index 8295a29e8ae..70368f28ac5 100644
--- a/solutions/2440. Create Components With Same Value/2440.py	
+++ b/solutions/2440. Create Components With Same Value/2440.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def componentValue(self, nums: list[int], edges: list[list[int]]) -> int:
-    MAX = 1_000_000_000
+  def componentValue(self, nums: List[int], edges: List[List[int]]) -> int:
+    kMax = 1_000_000_000
     n = len(nums)
     summ = sum(nums)
     tree = [[] for _ in range(n)]
@@ -9,7 +9,7 @@ def componentValue(self, nums: list[int], edges: list[list[int]]) -> int:
       tree[u].append(v)
       tree[v].append(u)
 
-    def dfs(u: int, target: int, seen: set[bool]) -> int:
+    def dfs(u: int, target: int, seen: Set[bool]) -> int:
       """
       Returns the sum of the subtree rooted at u substracting the sum of the
       deleted subtrees.
@@ -22,7 +22,7 @@ def dfs(u: int, target: int, seen: set[bool]) -> int:
           continue
         summ += dfs(v, target, seen)
         if summ > target:
-          return MAX
+          return kMax
 
       # Delete the tree that has sum == target.
       if summ == target:
diff --git a/solutions/2441. Largest Positive Integer That Exists With Its Negative/2441.java b/solutions/2441. Largest Positive Integer That Exists With Its Negative/2441.java
index 9287101059a..7562eb82950 100644
--- a/solutions/2441. Largest Positive Integer That Exists With Its Negative/2441.java	
+++ b/solutions/2441. Largest Positive Integer That Exists With Its Negative/2441.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public int findMaxK(int[] nums) {
     int ans = -1;
     Set<Integer> seen = new HashSet<>();
diff --git a/solutions/2441. Largest Positive Integer That Exists With Its Negative/2441.py b/solutions/2441. Largest Positive Integer That Exists With Its Negative/2441.py
index ffa0005adc7..b111af4ef8c 100644
--- a/solutions/2441. Largest Positive Integer That Exists With Its Negative/2441.py	
+++ b/solutions/2441. Largest Positive Integer That Exists With Its Negative/2441.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaxK(self, nums: list[int]) -> int:
+  def findMaxK(self, nums: List[int]) -> int:
     ans = -1
     seen = set()
 
diff --git a/solutions/2444. Count Subarrays With Fixed Bounds/2444.py b/solutions/2444. Count Subarrays With Fixed Bounds/2444.py
index 61f627397f3..c4b33cea3f9 100644
--- a/solutions/2444. Count Subarrays With Fixed Bounds/2444.py	
+++ b/solutions/2444. Count Subarrays With Fixed Bounds/2444.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countSubarrays(self, nums: list[int], minK: int, maxK: int) -> int:
+  def countSubarrays(self, nums: List[int], minK: int, maxK: int) -> int:
     ans = 0
     j = -1
     prevMinKIndex = -1
diff --git a/solutions/2445. Number of Nodes With Value One/2445.py b/solutions/2445. Number of Nodes With Value One/2445.py
index dec10acb6fd..522ba044d4d 100644
--- a/solutions/2445. Number of Nodes With Value One/2445.py	
+++ b/solutions/2445. Number of Nodes With Value One/2445.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfNodes(self, n: int, queries: list[int]) -> int:
+  def numberOfNodes(self, n: int, queries: List[int]) -> int:
     # flipped[i] := True if we should flip all the values in the subtree rooted
     # at i
     flipped = [False] * (n + 1)
diff --git a/solutions/2447. Number of Subarrays With GCD Equal to K/2447.cpp b/solutions/2447. Number of Subarrays With GCD Equal to K/2447.cpp
index 16567a33ad1..d7eaf9df9cf 100644
--- a/solutions/2447. Number of Subarrays With GCD Equal to K/2447.cpp	
+++ b/solutions/2447. Number of Subarrays With GCD Equal to K/2447.cpp	
@@ -10,7 +10,7 @@ class Solution {
         for (const auto& [prevGcd, count] : gcds)
           nextGcds[gcd(prevGcd, num)] += count;
         ans += nextGcds[k];
-        gcds = std::move(nextGcds);
+        gcds = move(nextGcds);
       } else {
         // The GCD streak stops, so fresh start from the next number.
         gcds.clear();
diff --git a/solutions/2447. Number of Subarrays With GCD Equal to K/2447.py b/solutions/2447. Number of Subarrays With GCD Equal to K/2447.py
index 3f53a324540..aa4917c62b0 100644
--- a/solutions/2447. Number of Subarrays With GCD Equal to K/2447.py	
+++ b/solutions/2447. Number of Subarrays With GCD Equal to K/2447.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def subarrayGCD(self, nums: list[int], k: int) -> int:
+  def subarrayGCD(self, nums: List[int], k: int) -> int:
     ans = 0
     gcds = collections.Counter()
 
diff --git a/solutions/2448. Minimum Cost to Make Array Equal/2448.py b/solutions/2448. Minimum Cost to Make Array Equal/2448.py
index 70dd512f67a..77592de0bae 100644
--- a/solutions/2448. Minimum Cost to Make Array Equal/2448.py	
+++ b/solutions/2448. Minimum Cost to Make Array Equal/2448.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minCost(self, nums: list[int], cost: list[int]) -> int:
+  def minCost(self, nums: List[int], cost: List[int]) -> int:
     ans = 0
     l = min(nums)
     r = max(nums)
diff --git a/solutions/2449. Minimum Number of Operations to Make Arrays Similar/2449.py b/solutions/2449. Minimum Number of Operations to Make Arrays Similar/2449.py
index 346ae553466..a65fb7a00b1 100644
--- a/solutions/2449. Minimum Number of Operations to Make Arrays Similar/2449.py	
+++ b/solutions/2449. Minimum Number of Operations to Make Arrays Similar/2449.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def makeSimilar(self, nums: list[int], target: list[int]) -> int:
+  def makeSimilar(self, nums: List[int], target: List[int]) -> int:
     nums.sort(key=lambda x: (x % 2, x))
     target.sort(key=lambda x: (x % 2, x))
     return sum(abs(a - b) for a, b in zip(nums, target)) // 4
diff --git a/solutions/245. Shortest Word Distance III/245.py b/solutions/245. Shortest Word Distance III/245.py
index cb6b1c7018f..3788da11cb2 100644
--- a/solutions/245. Shortest Word Distance III/245.py	
+++ b/solutions/245. Shortest Word Distance III/245.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def shortestWordDistance(
-      self,
-      wordsDict: list[str],
-      word1: str,
-      word2: str,
-  ) -> int:
+  def shortestWordDistance(self, wordsDict: List[str], word1: str, word2: str) -> int:
     isSame = word1 == word2
     ans = math.inf
     # If word1 == word2, index1 is the newest index.
diff --git a/solutions/2450. Number of Distinct Binary Strings After Applying Operations/2450.java b/solutions/2450. Number of Distinct Binary Strings After Applying Operations/2450.java
index cc06fbe0467..4f44125777d 100644
--- a/solutions/2450. Number of Distinct Binary Strings After Applying Operations/2450.java	
+++ b/solutions/2450. Number of Distinct Binary Strings After Applying Operations/2450.java	
@@ -5,13 +5,13 @@ public int countDistinctStrings(String s, int k) {
     return (int) modPow(2, s.length() - k + 1);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2);
+      return x * modPow(x, n - 1) % kMod;
+    return modPow(x * x % kMod, n / 2);
   }
 }
diff --git a/solutions/2451. Odd String Difference/2451.py b/solutions/2451. Odd String Difference/2451.py
index c4670be3437..5c00f09a884 100644
--- a/solutions/2451. Odd String Difference/2451.py	
+++ b/solutions/2451. Odd String Difference/2451.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def oddString(self, words: list[str]) -> str:
-    def getDiff(s: str) -> list[int]:
+  def oddString(self, words: List[str]) -> str:
+    def getDiff(s: str) -> List[int]:
       return [ord(b) - ord(a) for a, b in zip(s, s[1:])]
 
     wordAndDiffTuples = [(word, tuple(getDiff(word))) for word in words]
diff --git a/solutions/2452. Words Within Two Edits of Dictionary/2452.py b/solutions/2452. Words Within Two Edits of Dictionary/2452.py
index 7c58c6d1d93..9769340dff8 100644
--- a/solutions/2452. Words Within Two Edits of Dictionary/2452.py	
+++ b/solutions/2452. Words Within Two Edits of Dictionary/2452.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def twoEditWords(
-      self,
-      queries: list[str],
-      dictionary: list[str],
-  ) -> list[str]:
+  def twoEditWords(self, queries: List[str], dictionary: List[str]) -> List[str]:
     return [query for query in queries
             if any(sum(a != b for a, b in zip(query, word)) < 3
                    for word in dictionary)]
diff --git a/solutions/2453. Destroy Sequential Targets/2453.py b/solutions/2453. Destroy Sequential Targets/2453.py
index c6ccff58884..1a83c79b22c 100644
--- a/solutions/2453. Destroy Sequential Targets/2453.py	
+++ b/solutions/2453. Destroy Sequential Targets/2453.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def destroyTargets(self, nums: list[int], space: int) -> int:
+  def destroyTargets(self, nums: List[int], space: int) -> int:
     count = collections.Counter([num % space for num in nums])
     maxCount = max(count.values())
     return min(num for num in nums if count[num % space] == maxCount)
diff --git a/solutions/2454. Next Greater Element IV/2454.py b/solutions/2454. Next Greater Element IV/2454.py
index 2def328ecca..ff66edb5ce5 100644
--- a/solutions/2454. Next Greater Element IV/2454.py	
+++ b/solutions/2454. Next Greater Element IV/2454.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def secondGreaterElement(self, nums: list[int]) -> list[int]:
+  def secondGreaterElement(self, nums: List[int]) -> List[int]:
     ans = [-1] * len(nums)
     # a decreasing stack that stores indices that met the first greater number.
     prevStack = []
diff --git a/solutions/2455. Average Value of Even Numbers That Are Divisible by Three/2455.py b/solutions/2455. Average Value of Even Numbers That Are Divisible by Three/2455.py
index 9f616500398..4c66263f931 100644
--- a/solutions/2455. Average Value of Even Numbers That Are Divisible by Three/2455.py	
+++ b/solutions/2455. Average Value of Even Numbers That Are Divisible by Three/2455.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def averageValue(self, nums: list[int]) -> int:
+  def averageValue(self, nums: List[int]) -> int:
     summ = 0
     count = 0
 
diff --git a/solutions/2456. Most Popular Video Creator/2456.py b/solutions/2456. Most Popular Video Creator/2456.py
index 7031c8150af..dd25f23dd17 100644
--- a/solutions/2456. Most Popular Video Creator/2456.py	
+++ b/solutions/2456. Most Popular Video Creator/2456.py	
@@ -6,9 +6,7 @@ def __init__(self, popularity: int, videoId: str, maxView: int):
 
 
 class Solution:
-  def mostPopularCreator(self, creators: list[str],
-                         ids: list[str],
-                         views: list[int]) -> list[list[str]]:
+  def mostPopularCreator(self, creators: List[str], ids: List[str], views: List[int]) -> List[List[str]]:
     ans = []
     maxPopularity = 0
     nameToCreator = {}
@@ -21,8 +19,8 @@ def mostPopularCreator(self, creators: list[str],
       creator = nameToCreator[name]
       creator.popularity += view
       maxPopularity = max(maxPopularity, creator.popularity)
-      if (creator.maxView < view or
-              creator.maxView == view and creator.videoId > id):
+      if creator.maxView < view or \
+              creator.maxView == view and creator.videoId > id:
         creator.videoId = id
         creator.maxView = view
 
diff --git a/solutions/2458. Height of Binary Tree After Subtree Removal Queries/2458.py b/solutions/2458. Height of Binary Tree After Subtree Removal Queries/2458.py
index ba5040d2239..771b15faa3b 100644
--- a/solutions/2458. Height of Binary Tree After Subtree Removal Queries/2458.py	
+++ b/solutions/2458. Height of Binary Tree After Subtree Removal Queries/2458.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def treeQueries(self, root: TreeNode | None, queries: list[int]) -> list[int]:
+  def treeQueries(self, root: Optional[TreeNode], queries: List[int]) -> List[int]:
     @lru_cache(None)
-    def height(root: TreeNode | None) -> int:
+    def height(root: Optional[TreeNode]) -> int:
       if not root:
         return 0
       return 1 + max(height(root.left), height(root.right))
@@ -10,7 +10,7 @@ def height(root: TreeNode | None) -> int:
     valToMaxHeight = {}
 
     # maxHeight := the maximum height without the current node `root`
-    def dfs(root: TreeNode | None, depth: int, maxHeight: int) -> None:
+    def dfs(root: Optional[TreeNode], depth: int, maxHeight: int) -> None:
       if not root:
         return
       valToMaxHeight[root.val] = maxHeight
diff --git a/solutions/2459. Sort Array by Moving Items to Empty Space/2459.py b/solutions/2459. Sort Array by Moving Items to Empty Space/2459.py
index 495074265e5..b62a307d7e7 100644
--- a/solutions/2459. Sort Array by Moving Items to Empty Space/2459.py	
+++ b/solutions/2459. Sort Array by Moving Items to Empty Space/2459.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def sortArray(self, nums: list[int]) -> int:
+  def sortArray(self, nums: List[int]) -> int:
     n = len(nums)
     numToIndex = [0] * n
 
     for i, num in enumerate(nums):
       numToIndex[num] = i
 
-    def minOps(numToIndex: list[int], zeroInBeginning: bool) -> int:
+    def minOps(numToIndex: List[int], zeroInBeginning: bool) -> int:
       ops = 0
       num = 1
       # If zeroInBeginning, the correct index of each num is num.
@@ -14,8 +14,8 @@ def minOps(numToIndex: list[int], zeroInBeginning: bool) -> int:
       offset = 0 if zeroInBeginning else 1
       while num < n:
         # 0 is in the correct index, so swap 0 with the first `numInWrongIndex`.
-        if (zeroInBeginning and numToIndex[0] == 0 or
-                not zeroInBeginning and numToIndex[0] == n - 1):
+        if zeroInBeginning and numToIndex[0] == 0 or \
+                not zeroInBeginning and numToIndex[0] == n - 1:
           while numToIndex[num] == num - offset:  # num is in correct position
             num += 1
             if num == n:
@@ -25,8 +25,8 @@ def minOps(numToIndex: list[int], zeroInBeginning: bool) -> int:
         # in nums[2] because nums[2] == 0.
         else:
           numInWrongIndex = numToIndex[0] + offset
-        numToIndex[0], numToIndex[numInWrongIndex] = (
-            numToIndex[numInWrongIndex], numToIndex[0])
+        numToIndex[0], numToIndex[numInWrongIndex] = \
+            numToIndex[numInWrongIndex], numToIndex[0]
         ops += 1
 
     return min(minOps(numToIndex.copy(), True),
diff --git a/solutions/2460. Apply Operations to an Array/2460-2.py b/solutions/2460. Apply Operations to an Array/2460-2.py
index 52d4996aa86..4fd85c2860d 100644
--- a/solutions/2460. Apply Operations to an Array/2460-2.py	
+++ b/solutions/2460. Apply Operations to an Array/2460-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def applyOperations(self, nums: list[int]) -> list[int]:
+  def applyOperations(self, nums: List[int]) -> List[int]:
     j = 0
     for i in range(len(nums)):
       if i + 1 < len(nums) and nums[i] == nums[i + 1]:
diff --git a/solutions/2460. Apply Operations to an Array/2460.py b/solutions/2460. Apply Operations to an Array/2460.py
index fc815576427..b96dde83d52 100644
--- a/solutions/2460. Apply Operations to an Array/2460.py	
+++ b/solutions/2460. Apply Operations to an Array/2460.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def applyOperations(self, nums: list[int]) -> list[int]:
+  def applyOperations(self, nums: List[int]) -> List[int]:
     ans = [0] * len(nums)
 
     for i in range(len(nums) - 1):
diff --git a/solutions/2461. Maximum Sum of Distinct Subarrays With Length K/2461.py b/solutions/2461. Maximum Sum of Distinct Subarrays With Length K/2461.py
index 5dd89dd5482..a83e281627b 100644
--- a/solutions/2461. Maximum Sum of Distinct Subarrays With Length K/2461.py	
+++ b/solutions/2461. Maximum Sum of Distinct Subarrays With Length K/2461.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumSubarraySum(self, nums: list[int], k: int) -> int:
+  def maximumSubarraySum(self, nums: List[int], k: int) -> int:
     ans = 0
     summ = 0
     distinct = 0
diff --git a/solutions/2462. Total Cost to Hire K Workers/2462.py b/solutions/2462. Total Cost to Hire K Workers/2462.py
index c34b82046fc..20c8696500b 100644
--- a/solutions/2462. Total Cost to Hire K Workers/2462.py	
+++ b/solutions/2462. Total Cost to Hire K Workers/2462.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def totalCost(self, costs: list[int], k: int, candidates: int) -> int:
+  def totalCost(self, costs: List[int], k: int, candidates: int) -> int:
     ans = 0
     i = 0
     j = len(costs) - 1
diff --git a/solutions/2463. Minimum Total Distance Traveled/2463.java b/solutions/2463. Minimum Total Distance Traveled/2463.java
index eaeefb768a9..a0c917d0b65 100644
--- a/solutions/2463. Minimum Total Distance Traveled/2463.java	
+++ b/solutions/2463. Minimum Total Distance Traveled/2463.java	
@@ -1,7 +1,7 @@
 class Solution {
   public long minimumTotalDistance(List<Integer> robot, int[][] factory) {
     Collections.sort(robot);
-    Arrays.sort(factory, Comparator.comparingInt(a -> a[0]));
+    Arrays.sort(factory, (a, b) -> (a[0] - b[0]));
     long[][][] mem = new long[robot.size()][factory.length][robot.size()];
     return minimumTotalDistance(robot, factory, 0, 0, 0, mem);
   }
diff --git a/solutions/2463. Minimum Total Distance Traveled/2463.py b/solutions/2463. Minimum Total Distance Traveled/2463.py
index 25ec3d4b246..0b5862bf5af 100644
--- a/solutions/2463. Minimum Total Distance Traveled/2463.py	
+++ b/solutions/2463. Minimum Total Distance Traveled/2463.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def minimumTotalDistance(
-      self,
-      robot: list[int],
-      factory: list[list[int]],
-  ) -> int:
+  def minimumTotalDistance(self, robot: List[int], factory: List[List[int]]) -> int:
     robot.sort()
     factory.sort()
 
@@ -19,8 +15,8 @@ def dp(i: int, j: int, k: int) -> int:
         return math.inf
       skipFactory = dp(i, j + 1, 0)
       position, limit = factory[j]
-      useFactory = (dp(i + 1, j, k + 1) + abs(robot[i] - position)
-                    if limit > k else math.inf)
+      useFactory = dp(i + 1, j, k + 1) + abs(robot[i] - position) \
+          if limit > k else math.inf
       return min(skipFactory, useFactory)
 
     return dp(0, 0, 0)
diff --git a/solutions/2464. Minimum Subarrays in a Valid Split/2464.java b/solutions/2464. Minimum Subarrays in a Valid Split/2464.java
index e2abd779266..83b9b2436d6 100644
--- a/solutions/2464. Minimum Subarrays in a Valid Split/2464.java	
+++ b/solutions/2464. Minimum Subarrays in a Valid Split/2464.java	
@@ -1,17 +1,17 @@
 class Solution {
   public int validSubarraySplit(int[] nums) {
-    final int MAX = Integer.MAX_VALUE / 2;
+    final int kMax = Integer.MAX_VALUE / 2;
     final int n = nums.length;
     // dp[i] := the minimum number of subarrays to validly split nums[0..i]
     int[] dp = new int[n];
-    Arrays.fill(dp, MAX);
+    Arrays.fill(dp, kMax);
 
     for (int i = 0; i < n; ++i)
       for (int j = 0; j <= i; ++j)
         if (gcd(nums[j], nums[i]) > 1)
           dp[i] = Math.min(dp[i], j == 0 ? 1 : dp[j - 1] + 1);
 
-    return dp[n - 1] == MAX ? -1 : dp[n - 1];
+    return dp[n - 1] == kMax ? -1 : dp[n - 1];
   }
 
   private int gcd(int a, int b) {
diff --git a/solutions/2464. Minimum Subarrays in a Valid Split/2464.py b/solutions/2464. Minimum Subarrays in a Valid Split/2464.py
index 7bc19337604..7dce5e2d5cd 100644
--- a/solutions/2464. Minimum Subarrays in a Valid Split/2464.py	
+++ b/solutions/2464. Minimum Subarrays in a Valid Split/2464.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def validSubarraySplit(self, nums: list[int]) -> int:
+  def validSubarraySplit(self, nums: List[int]) -> int:
     # dp[i] := the minimum number of subarrays to validly split nums[0..i]
     dp = [math.inf] * len(nums)
 
diff --git a/solutions/2465. Number of Distinct Averages/2465.py b/solutions/2465. Number of Distinct Averages/2465.py
index b595482e802..be771bfd7f7 100644
--- a/solutions/2465. Number of Distinct Averages/2465.py	
+++ b/solutions/2465. Number of Distinct Averages/2465.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def distinctAverages(self, nums: list[int]) -> int:
+  def distinctAverages(self, nums: List[int]) -> int:
     n = len(nums)
     sums = set()
 
diff --git a/solutions/2466. Count Ways To Build Good Strings/2466.java b/solutions/2466. Count Ways To Build Good Strings/2466.java
index de946da79ef..883a8980a76 100644
--- a/solutions/2466. Count Ways To Build Good Strings/2466.java	
+++ b/solutions/2466. Count Ways To Build Good Strings/2466.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int countGoodStrings(int low, int high, int zero, int one) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int ans = 0;
     // dp[i] := the number of good strings with length i
     int[] dp = new int[high + 1];
@@ -8,11 +8,11 @@ public int countGoodStrings(int low, int high, int zero, int one) {
 
     for (int i = 1; i <= high; ++i) {
       if (i >= zero)
-        dp[i] = (dp[i] + dp[i - zero]) % MOD;
+        dp[i] = (dp[i] + dp[i - zero]) % kMod;
       if (i >= one)
-        dp[i] = (dp[i] + dp[i - one]) % MOD;
+        dp[i] = (dp[i] + dp[i - one]) % kMod;
       if (i >= low)
-        ans = (ans + dp[i]) % MOD;
+        ans = (ans + dp[i]) % kMod;
     }
 
     return ans;
diff --git a/solutions/2466. Count Ways To Build Good Strings/2466.py b/solutions/2466. Count Ways To Build Good Strings/2466.py
index f12a7c4881d..7d78cb0f352 100644
--- a/solutions/2466. Count Ways To Build Good Strings/2466.py	
+++ b/solutions/2466. Count Ways To Build Good Strings/2466.py	
@@ -1,16 +1,16 @@
 class Solution:
   def countGoodStrings(self, low: int, high: int, zero: int, one: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     ans = 0
     # dp[i] := the number of good strings with length i
     dp = [1] + [0] * high
 
     for i in range(1, high + 1):
       if i >= zero:
-        dp[i] = (dp[i] + dp[i - zero]) % MOD
+        dp[i] = (dp[i] + dp[i - zero]) % kMod
       if i >= one:
-        dp[i] = (dp[i] + dp[i - one]) % MOD
+        dp[i] = (dp[i] + dp[i - one]) % kMod
       if i >= low:
-        ans = (ans + dp[i]) % MOD
+        ans = (ans + dp[i]) % kMod
 
     return ans
diff --git a/solutions/2467. Most Profitable Path in a Tree/2467.py b/solutions/2467. Most Profitable Path in a Tree/2467.py
index 038758f8bab..2e250588d28 100644
--- a/solutions/2467. Most Profitable Path in a Tree/2467.py	
+++ b/solutions/2467. Most Profitable Path in a Tree/2467.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def mostProfitablePath(
-      self,
-      edges: list[list[int]],
-      bob: int,
-      amount: list[int],
-  ) -> int:
+  def mostProfitablePath(self, edges: List[List[int]], bob: int, amount: List[int]) -> int:
     n = len(amount)
     tree = [[] for _ in range(n)]
     parent = [0] * n
@@ -40,13 +35,7 @@ def dfs(u: int, prev: int, d: int) -> None:
 
     return self._getMoney(tree, 0, -1, amount)
 
-  def _getMoney(
-      self,
-      tree: list[list[int]],
-      u: int,
-      prev: int,
-      amount: list[int],
-  ) -> int:
+  def _getMoney(self, tree: List[List[int]], u: int, prev: int, amount: List[int]) -> int:
     # a leaf node
     if len(tree[u]) == 1 and tree[u][0] == prev:
       return amount[u]
diff --git a/solutions/2468. Split Message Based on Limit/2468.java b/solutions/2468. Split Message Based on Limit/2468.java
index 1de63540794..6d9748a244e 100644
--- a/solutions/2468. Split Message Based on Limit/2468.java	
+++ b/solutions/2468. Split Message Based on Limit/2468.java	
@@ -1,13 +1,13 @@
 class Solution {
   public String[] splitMessage(String message, int limit) {
-    final int MESSAGE_LENGTH = message.length();
+    final int kMessageLength = message.length();
     int b = 1;
     // the total length of a: initialized with the length of "1"
     int aLength = sz(1);
 
     // the total length of b := b * sz(b)
     // The total length of "</>" := b * 3
-    while (b * limit < b * (sz(b) + 3) + aLength + MESSAGE_LENGTH) {
+    while (b * limit < b * (sz(b) + 3) + aLength + kMessageLength) {
       // If the length of the last suffix "<b/b>" := sz(b) * 2 + 3 >= limit,
       // then it's impossible that the length of "*<b/b>" <= limit.
       if (sz(b) * 2 + 3 >= limit)
diff --git a/solutions/2468. Split Message Based on Limit/2468.py b/solutions/2468. Split Message Based on Limit/2468.py
index 69d63708abe..df3777b2691 100644
--- a/solutions/2468. Split Message Based on Limit/2468.py	
+++ b/solutions/2468. Split Message Based on Limit/2468.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def splitMessage(self, message: str, limit: int) -> list[str]:
-    MESSAGE_LENGTH = len(message)
+  def splitMessage(self, message: str, limit: int) -> List[str]:
+    kMessageLength = len(message)
 
     def sz(num: int):
       return len(str(num))
@@ -11,7 +11,7 @@ def sz(num: int):
 
     # the total length of b := b * sz(b)
     # The total length of "</>" := b * 3
-    while b * limit < b * (sz(b) + 3) + aLength + MESSAGE_LENGTH:
+    while b * limit < b * (sz(b) + 3) + aLength + kMessageLength:
       # If the length of the last suffix "<b/b>" := sz(b) * 2 + 3 >= limit,
       # then it's impossible that the length of "*<b/b>" <= limit.
       if sz(b) * 2 + 3 >= limit:
diff --git a/solutions/2469. Convert the Temperature/2469.py b/solutions/2469. Convert the Temperature/2469.py
index 30834cd38b7..8bbe237567a 100644
--- a/solutions/2469. Convert the Temperature/2469.py	
+++ b/solutions/2469. Convert the Temperature/2469.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def convertTemperature(self, celsius: float) -> list[float]:
+  def convertTemperature(self, celsius: float) -> List[float]:
     return [celsius + 273.15, celsius * 1.8 + 32]
diff --git a/solutions/247. Strobogrammatic Number II/247.java b/solutions/247. Strobogrammatic Number II/247.java
index 5ad5bc7e14f..8e6a9b4b85b 100644
--- a/solutions/247. Strobogrammatic Number II/247.java	
+++ b/solutions/247. Strobogrammatic Number II/247.java	
@@ -5,9 +5,9 @@ public List<String> findStrobogrammatic(int n) {
 
   private List<String> helper(int n, int k) {
     if (n == 0)
-      return List.of("");
+      return new ArrayList<>(Arrays.asList(""));
     if (n == 1)
-      return List.of("0", "1", "8");
+      return new ArrayList<>(Arrays.asList("0", "1", "8"));
 
     List<String> ans = new ArrayList<>();
 
diff --git a/solutions/247. Strobogrammatic Number II/247.py b/solutions/247. Strobogrammatic Number II/247.py
index b5f92b6a103..3fb71f318e0 100644
--- a/solutions/247. Strobogrammatic Number II/247.py	
+++ b/solutions/247. Strobogrammatic Number II/247.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def findStrobogrammatic(self, n: int) -> list[str]:
-    def helper(n: int, k: int) -> list[str]:
+  def findStrobogrammatic(self, n: int) -> List[str]:
+    def helper(n: int, k: int) -> List[str]:
       if n == 0:
         return ['']
       if n == 1:
diff --git a/solutions/2470. Number of Subarrays With LCM Equal to K/2470.py b/solutions/2470. Number of Subarrays With LCM Equal to K/2470.py
index e7b015eff40..12bc8bce5ef 100644
--- a/solutions/2470. Number of Subarrays With LCM Equal to K/2470.py	
+++ b/solutions/2470. Number of Subarrays With LCM Equal to K/2470.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def subarrayLCM(self, nums: list[int], k: int) -> int:
+  def subarrayLCM(self, nums: List[int], k: int) -> int:
     ans = 0
 
     for i, runningLcm in enumerate(nums):
diff --git a/solutions/2471. Minimum Number of Operations to Sort a Binary Tree by Level/2471.py b/solutions/2471. Minimum Number of Operations to Sort a Binary Tree by Level/2471.py
index e5ecc3d8d37..2dd0b192a75 100644
--- a/solutions/2471. Minimum Number of Operations to Sort a Binary Tree by Level/2471.py	
+++ b/solutions/2471. Minimum Number of Operations to Sort a Binary Tree by Level/2471.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumOperations(self, root: TreeNode | None) -> int:
+  def minimumOperations(self, root: Optional[TreeNode]) -> int:
     ans = 0
     q = collections.deque([root])
 
diff --git a/solutions/2473. Minimum Cost to Buy Apples/2473.cpp b/solutions/2473. Minimum Cost to Buy Apples/2473.cpp
index 0af395e35f7..476d6948c4a 100644
--- a/solutions/2473. Minimum Cost to Buy Apples/2473.cpp	
+++ b/solutions/2473. Minimum Cost to Buy Apples/2473.cpp	
@@ -20,29 +20,27 @@ class Solution {
   }
 
  private:
-  long dijkstra(const vector<vector<pair<int, long>>>& graph, int src,
+  long dijkstra(const vector<vector<pair<int, long>>>& graph, int i,
                 const vector<int>& appleCost, int k) {
-    long ans = LONG_MAX;
-    vector<long> dist(graph.size(), LONG_MAX);
+    vector<long> forwardCost(graph.size(), LONG_MAX);
+    vector<long> totalCost(graph.size(), LONG_MAX);
+    forwardCost[i] = 0;
+    queue<int> q{{i}};
 
-    dist[src] = 0;
-    using P = pair<long, int>;  // (d, u)
-    priority_queue<P, vector<P>, greater<>> minHeap;
-    minHeap.emplace(dist[src], src);
-
-    while (!minHeap.empty()) {
-      const auto [d, u] = minHeap.top();
-      minHeap.pop();
-      if (d > dist[u])
-        continue;
-      ans = min(ans, appleCost[u] + (k + 1) * d);
-      for (const auto& [v, w] : graph[u])
-        if (d + w < dist[v]) {
-          dist[v] = d + w;
-          minHeap.emplace(dist[v], v);
-        }
+    while (!q.empty()) {
+      const int u = q.front();
+      q.pop();
+      for (const auto& [v, w] : graph[u]) {
+        const long nextCost = forwardCost[u] + w;
+        if (nextCost >= forwardCost[v])
+          continue;
+        forwardCost[v] = nextCost;
+        // Take apple at city v and return back to city i.
+        totalCost[v] = (k + 1) * nextCost + appleCost[v];
+        q.push(v);
+      }
     }
 
-    return ans;
+    return min(static_cast<long>(appleCost[i]), ranges::min(totalCost));
   }
 };
diff --git a/solutions/2473. Minimum Cost to Buy Apples/2473.java b/solutions/2473. Minimum Cost to Buy Apples/2473.java
index f354b6157e4..c0ec03d40ba 100644
--- a/solutions/2473. Minimum Cost to Buy Apples/2473.java	
+++ b/solutions/2473. Minimum Cost to Buy Apples/2473.java	
@@ -2,7 +2,9 @@ class Solution {
   public long[] minCost(int n, int[][] roads, int[] appleCost, int k) {
     long[] ans = new long[n];
     List<Pair<Integer, Integer>>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] road : roads) {
       final int u = road[0] - 1;
@@ -19,32 +21,28 @@ public long[] minCost(int n, int[][] roads, int[] appleCost, int k) {
   }
 
   private long dijkstra(List<Pair<Integer, Integer>>[] graph, int i, int[] appleCost, int k) {
-    long ans = Long.MAX_VALUE;
-    long[] dist = new long[graph.length];
-    Arrays.fill(dist, Long.MAX_VALUE);
+    long[] forwardCost = new long[graph.length];
+    long[] totalCost = new long[graph.length];
+    Arrays.fill(forwardCost, Long.MAX_VALUE);
+    Arrays.fill(totalCost, Long.MAX_VALUE);
+    forwardCost[i] = 0;
+    Queue<Integer> q = new LinkedList<>(Arrays.asList(i));
 
-    dist[i] = 0;
-    Queue<Pair<Long, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingLong(Pair::getKey)) {
-          { offer(new Pair<>(dist[i], i)); } // (d, u)
-        };
-
-    while (!minHeap.isEmpty()) {
-      final long d = minHeap.peek().getKey();
-      final int u = minHeap.poll().getValue();
-      if (d > dist[u])
-        continue;
-      ans = Math.min(ans, appleCost[u] + (k + 1) * d);
+    while (!q.isEmpty()) {
+      final int u = q.poll();
       for (Pair<Integer, Integer> pair : graph[u]) {
         final int v = pair.getKey();
         final int w = pair.getValue();
-        if (d + w < dist[v]) {
-          dist[v] = d + w;
-          minHeap.offer(new Pair<>(dist[v], v));
-        }
+        final long nextCost = forwardCost[u] + w;
+        if (nextCost >= forwardCost[v])
+          continue;
+        forwardCost[v] = nextCost;
+        // Take apple at city v and return back to city i.
+        totalCost[v] = (k + 1) * nextCost + appleCost[v];
+        q.offer(v);
       }
     }
 
-    return ans;
+    return Math.min(appleCost[i], Arrays.stream(totalCost).min().getAsLong());
   }
 }
diff --git a/solutions/2473. Minimum Cost to Buy Apples/2473.py b/solutions/2473. Minimum Cost to Buy Apples/2473.py
index 743850009ad..11eacbbb499 100644
--- a/solutions/2473. Minimum Cost to Buy Apples/2473.py	
+++ b/solutions/2473. Minimum Cost to Buy Apples/2473.py	
@@ -1,40 +1,28 @@
 class Solution:
-  def minCost(
-      self,
-      n: int,
-      roads: list[list[int]],
-      appleCost: list[int],
-      k: int,
-  ) -> list[int]:
+  def minCost(self, n: int, roads: List[List[int]], appleCost: List[int], k: int) -> List[int]:
     graph = [[] for _ in range(n)]
 
     for u, v, w in roads:
       graph[u - 1].append((v - 1, w))
       graph[v - 1].append((u - 1, w))
 
-    return [self._dijkstra(graph, i, appleCost, k) for i in range(n)]
+    def dijkstra(i: int) -> int:
+      forwardCost = [math.inf] * n
+      totalCost = [math.inf] * n
+      forwardCost[i] = 0
+      q = collections.deque([i])
 
-  def _dijkstra(
-      self,
-      graph: list[list[tuple[int, int]]],
-      src: int,
-      appleCost: list[int],
-      k: int
-  ) -> int:
-    ans = math.inf
-    dist = [math.inf] * len(graph)
+      while q:
+        u = q.popleft()
+        for v, w in graph[u]:
+          nextCost = forwardCost[u] + w
+          if nextCost >= forwardCost[v]:
+            continue
+          forwardCost[v] = nextCost
+          # Take apple at city v and return back to city i.
+          totalCost[v] = (k + 1) * nextCost + appleCost[v]
+          q.append(v)
 
-    dist[src] = 0
-    minHeap = [(dist[src], src)]  # (d, u)
+      return min(appleCost[i], min(totalCost))
 
-    while minHeap:
-      d, u = heapq.heappop(minHeap)
-      if d > dist[u]:
-        continue
-      ans = min(ans, appleCost[u] + (k + 1) * d)
-      for v, w in graph[u]:
-        if d + w < dist[v]:
-          dist[v] = d + w
-          heapq.heappush(minHeap, (dist[v], v))
-
-    return ans
+    return [dijkstra(i) for i in range(n)]
diff --git a/solutions/2475. Number of Unequal Triplets in Array/2475.py b/solutions/2475. Number of Unequal Triplets in Array/2475.py
index 7f749e178ed..80b638e536e 100644
--- a/solutions/2475. Number of Unequal Triplets in Array/2475.py	
+++ b/solutions/2475. Number of Unequal Triplets in Array/2475.py	
@@ -16,7 +16,7 @@
 # (cnt[a] + cnt[b] + cnt[c]) * cnt[d] * (0)
 
 class Solution:
-  def unequalTriplets(self, nums: list[int]) -> int:
+  def unequalTriplets(self, nums: List[int]) -> int:
     ans = 0
     prev = 0
     next = len(nums)
diff --git a/solutions/2476. Closest Nodes Queries in a Binary Search Tree/2476.py b/solutions/2476. Closest Nodes Queries in a Binary Search Tree/2476.py
index 3cfd5ac0a78..1e249be5eab 100644
--- a/solutions/2476. Closest Nodes Queries in a Binary Search Tree/2476.py	
+++ b/solutions/2476. Closest Nodes Queries in a Binary Search Tree/2476.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def closestNodes(self, root: TreeNode | None, queries: list[int]) -> list[list[int]]:
+  def closestNodes(self, root: Optional[TreeNode], queries: List[int]) -> List[List[int]]:
     sortedVals = []
     self._inorder(root, sortedVals)
 
-    def getClosestPair(query: int) -> list[int]:
+    def getClosestPair(query: int) -> List[int]:
       i = bisect_left(sortedVals, query)
       # query is presented in the tree, so just use [query, query].
       if i != len(sortedVals) and sortedVals[i] == query:
@@ -14,7 +14,7 @@ def getClosestPair(query: int) -> list[int]:
 
     return [getClosestPair(query) for query in queries]
 
-  def _inorder(self, root: TreeNode | None, sortedVals: list[int]) -> None:
+  def _inorder(self, root: Optional[TreeNode], sortedVals: List[int]) -> None:
     """Walks the BST to collect the sorted numbers."""
     if not root:
       return
diff --git a/solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.cpp b/solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.cpp
index 30837b1312c..11534e7a1d0 100644
--- a/solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.cpp	
+++ b/solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.cpp	
@@ -19,9 +19,11 @@ class Solution {
   int dfs(const vector<vector<int>>& tree, int u, int prev, int seats,
           long& ans) {
     int people = 1;
-    for (const int v : tree[u])
-      if (v != prev)
-        people += dfs(tree, v, u, seats, ans);
+    for (const int v : tree[u]) {
+      if (v == prev)
+        continue;
+      people += dfs(tree, v, u, seats, ans);
+    }
     if (u > 0)
       // the number of cars needed = ceil(people / seats)
       ans += (people + seats - 1) / seats;
diff --git a/solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.java b/solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.java
index c7131ac2bb6..ef89448ab0c 100644
--- a/solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.java	
+++ b/solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.java	
@@ -20,9 +20,11 @@ public long minimumFuelCost(int[][] roads, int seats) {
 
   private int dfs(List<Integer>[] tree, int u, int prev, int seats) {
     int people = 1;
-    for (final int v : tree[u])
-      if (v != prev)
-        people += dfs(tree, v, u, seats);
+    for (final int v : tree[u]) {
+      if (v == prev)
+        continue;
+      people += dfs(tree, v, u, seats);
+    }
     if (u > 0)
       // the number of cars needed = ceil(people / seats)
       ans += (people + seats - 1) / seats;
diff --git a/solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.py b/solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.py
index 5c53ef50d4f..5bad778b224 100644
--- a/solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.py	
+++ b/solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumFuelCost(self, roads: list[list[int]], seats: int) -> int:
+  def minimumFuelCost(self, roads: List[List[int]], seats: int) -> int:
     ans = 0
     tree = [[] for _ in range(len(roads) + 1)]
 
@@ -9,7 +9,11 @@ def minimumFuelCost(self, roads: list[list[int]], seats: int) -> int:
 
     def dfs(u: int, prev: int) -> int:
       nonlocal ans
-      people = 1 + sum(dfs(v, u) for v in tree[u] if v != prev)
+      people = 1
+      for v in tree[u]:
+        if v == prev:
+          continue
+        people += dfs(v, u)
       if u > 0:
         # the number of cars needed
         ans += int(math.ceil(people / seats))
diff --git a/solutions/2478. Number of Beautiful Partitions/2478.java b/solutions/2478. Number of Beautiful Partitions/2478.java
index 70ee7414f71..0a054e6f1fd 100644
--- a/solutions/2478. Number of Beautiful Partitions/2478.java	
+++ b/solutions/2478. Number of Beautiful Partitions/2478.java	
@@ -6,7 +6,7 @@ public int beautifulPartitions(String s, int k, int minLength) {
     return beautifulPartitions(s, minLength, k - 1, minLength, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of beautiful partitions of s[i..n) with k bars (|) left.
   private int beautifulPartitions(final String s, int i, int k, int minLength, Integer[][] mem) {
@@ -18,13 +18,13 @@ private int beautifulPartitions(final String s, int i, int k, int minLength, Int
       return mem[i][k];
 
     // Don't split between s[i - 1] and s[i].
-    int ans = beautifulPartitions(s, i + 1, k, minLength, mem) % MOD;
+    int ans = beautifulPartitions(s, i + 1, k, minLength, mem) % kMod;
 
     // Split between s[i - 1] and s[i].
     if (isPrime(s.charAt(i)) && !isPrime(s.charAt(i - 1)))
       ans += beautifulPartitions(s, i + minLength, k - 1, minLength, mem);
 
-    return mem[i][k] = ans % MOD;
+    return mem[i][k] = ans % kMod;
   }
 
   private boolean isPrime(char c) {
diff --git a/solutions/2478. Number of Beautiful Partitions/2478.py b/solutions/2478. Number of Beautiful Partitions/2478.py
index bd2029c546b..8e289d797fb 100644
--- a/solutions/2478. Number of Beautiful Partitions/2478.py	
+++ b/solutions/2478. Number of Beautiful Partitions/2478.py	
@@ -6,7 +6,7 @@ def isPrime(c: str) -> bool:
     if not isPrime(s[0]) or isPrime(s[-1]):
       return 0
 
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
 
     @lru_cache(None)
     def dp(i: int, k: int) -> int:
@@ -20,12 +20,12 @@ def dp(i: int, k: int) -> int:
         return 0
 
       # Don't split between s[i - 1] and s[i].
-      ans = dp(i + 1, k) % MOD
+      ans = dp(i + 1, k) % kMod
 
       # Split between s[i - 1] and s[i].
       if isPrime(s[i]) and not isPrime(s[i - 1]):
         ans += dp(i + minLength, k - 1)
 
-      return ans % MOD
+      return ans % kMod
 
     return dp(minLength, k - 1)
diff --git a/solutions/2479. Maximum XOR of Two Non-Overlapping Subtrees/2479.cpp b/solutions/2479. Maximum XOR of Two Non-Overlapping Subtrees/2479.cpp
index d3c46fb0b28..fb7d311be2b 100644
--- a/solutions/2479. Maximum XOR of Two Non-Overlapping Subtrees/2479.cpp	
+++ b/solutions/2479. Maximum XOR of Two Non-Overlapping Subtrees/2479.cpp	
@@ -68,9 +68,11 @@ class Solution {
   long getTreeSum(const vector<vector<int>>& tree, int u, int prev,
                   vector<long>& treeSums, const vector<int>& values) {
     long treeSum = values[u];
-    for (const int v : tree[u])
-      if (v != prev)
-        treeSum += getTreeSum(tree, v, u, treeSums, values);
+    for (const int v : tree[u]) {
+      if (v == prev)
+        continue;
+      treeSum += getTreeSum(tree, v, u, treeSums, values);
+    }
     treeSums[u] = treeSum;
     return treeSum;
   }
@@ -83,7 +85,7 @@ class Solution {
       // Preorder to get the ans.
       ans = max(ans, bitTrie.getMaxXor(treeSums[v]));
       // Recursively call on the subtree rooted at node v.
-      dfs(tree, v, u, treeSums, std::move(bitTrie), ans);
+      dfs(tree, v, u, treeSums, move(bitTrie), ans);
       // Postorder insert the tree sum rooted at node v.
       bitTrie.insert(treeSums[v]);
     }
diff --git a/solutions/2479. Maximum XOR of Two Non-Overlapping Subtrees/2479.java b/solutions/2479. Maximum XOR of Two Non-Overlapping Subtrees/2479.java
index 7232af2bad3..1f6e1769e5b 100644
--- a/solutions/2479. Maximum XOR of Two Non-Overlapping Subtrees/2479.java	
+++ b/solutions/2479. Maximum XOR of Two Non-Overlapping Subtrees/2479.java	
@@ -67,9 +67,11 @@ public long maxXor(int n, int[][] edges, int[] values) {
   // Gets the tree sum rooted at node u.
   private long getTreeSum(List<Integer>[] tree, int u, int prev, long[] treeSums, int[] values) {
     long treeSum = values[u];
-    for (final int v : tree[u])
-      if (v != prev)
-        treeSum += getTreeSum(tree, v, u, treeSums, values);
+    for (final int v : tree[u]) {
+      if (v == prev)
+        continue;
+      treeSum += getTreeSum(tree, v, u, treeSums, values);
+    }
     treeSums[u] = treeSum;
     return treeSum;
   }
diff --git a/solutions/2479. Maximum XOR of Two Non-Overlapping Subtrees/2479.py b/solutions/2479. Maximum XOR of Two Non-Overlapping Subtrees/2479.py
index 53aaaf95329..f32c5305977 100644
--- a/solutions/2479. Maximum XOR of Two Non-Overlapping Subtrees/2479.py	
+++ b/solutions/2479. Maximum XOR of Two Non-Overlapping Subtrees/2479.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: list[TrieNode | None] = [None] * 2
+    self.children: List[Optional[TrieNode]] = [None] * 2
 
 
 class BitTrie:
@@ -33,7 +33,7 @@ def getMaxXor(self, num: int) -> int:
 
 
 class Solution:
-  def maxXor(self, n: int, edges: list[list[int]], values: list[int]) -> int:
+  def maxXor(self, n: int, edges: List[List[int]], values: List[int]) -> int:
     ans = 0
     tree = [[] for _ in range(n)]
     treeSums = [0] * n
@@ -44,7 +44,11 @@ def maxXor(self, n: int, edges: list[list[int]], values: list[int]) -> int:
 
     # Gets the tree sum rooted at node u.
     def getTreeSum(u: int, prev: int) -> int:
-      treeSum = values[u] + sum(getTreeSum(v, u) for v in tree[u] if v != prev)
+      treeSum = values[u]
+      for v in tree[u]:
+        if v == prev:
+          continue
+        treeSum += getTreeSum(v, u)
       treeSums[u] = treeSum
       return treeSum
 
diff --git a/solutions/248. Strobogrammatic Number III/248.py b/solutions/248. Strobogrammatic Number III/248.py
index ea9ab834cfb..922bf59beaa 100644
--- a/solutions/248. Strobogrammatic Number III/248.py	
+++ b/solutions/248. Strobogrammatic Number III/248.py	
@@ -3,7 +3,7 @@ def strobogrammaticInRange(self, low: str, high: str) -> int:
     pairs = [['0', '0'], ['1', '1'], ['6', '9'], ['8', '8'], ['9', '6']]
     ans = 0
 
-    def dfs(s: list[str], l: int, r: int) -> None:
+    def dfs(s: List[chr], l: int, r: int) -> None:
       nonlocal ans
       if l > r:
         if len(s) == len(low) and ''.join(s) < low:
diff --git a/solutions/2482. Difference Between Ones and Zeros in Row and Column/2482.py b/solutions/2482. Difference Between Ones and Zeros in Row and Column/2482.py
index c6a98331cc7..2390623f0e2 100644
--- a/solutions/2482. Difference Between Ones and Zeros in Row and Column/2482.py	
+++ b/solutions/2482. Difference Between Ones and Zeros in Row and Column/2482.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def onesMinusZeros(self, grid: list[list[int]]) -> list[list[int]]:
+  def onesMinusZeros(self, grid: List[List[int]]) -> List[List[int]]:
     m = len(grid)
     n = len(grid[0])
     ans = [[0] * n for _ in range(m)]
@@ -8,7 +8,7 @@ def onesMinusZeros(self, grid: list[list[int]]) -> list[list[int]]:
 
     for i in range(m):
       for j in range(n):
-        ans[i][j] = (onesRow[i] + onesCol[j] -
-                     (n - onesRow[i]) - (m - onesCol[j]))
+        ans[i][j] = onesRow[i] + onesCol[j] - \
+            (n - onesRow[i]) - (m - onesCol[j])
 
     return ans
diff --git a/solutions/2484. Count Palindromic Subsequences/2484.java b/solutions/2484. Count Palindromic Subsequences/2484.java
index 6df2382e7c0..348e0d18546 100644
--- a/solutions/2484. Count Palindromic Subsequences/2484.java	
+++ b/solutions/2484. Count Palindromic Subsequences/2484.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int countPalindromes(String s) {
-    final int MOD = 1_000_000_007;
-    final int PATTERN_SIZE = 5;
+    final int kMod = 1_000_000_007;
+    final int kPatternSize = 5;
     long ans = 0;
 
     for (char a = '0'; a <= '9'; ++a)
@@ -9,14 +9,14 @@ public int countPalindromes(String s) {
         char[] pattern = {a, b, '.', b, a};
         // dp[i] := the number of subsequences of pattern[i..n) in s, where
         // pattern[2] can be any character
-        long[] dp = new long[PATTERN_SIZE + 1];
-        dp[PATTERN_SIZE] = 1;
+        long[] dp = new long[kPatternSize + 1];
+        dp[kPatternSize] = 1;
         for (final char c : s.toCharArray())
-          for (int i = 0; i < PATTERN_SIZE; ++i)
+          for (int i = 0; i < kPatternSize; ++i)
             if (pattern[i] == '.' || pattern[i] == c)
               dp[i] += dp[i + 1];
         ans += dp[0];
-        ans %= MOD;
+        ans %= kMod;
       }
 
     return (int) ans;
diff --git a/solutions/2484. Count Palindromic Subsequences/2484.py b/solutions/2484. Count Palindromic Subsequences/2484.py
index b88ea247a20..77992693e04 100644
--- a/solutions/2484. Count Palindromic Subsequences/2484.py	
+++ b/solutions/2484. Count Palindromic Subsequences/2484.py	
@@ -1,6 +1,6 @@
 class Solution:
   def countPalindromes(self, s: str) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     ans = 0
 
     for a in range(10):
@@ -14,6 +14,6 @@ def countPalindromes(self, s: str) -> int:
             if p == '.' or p == c:
               dp[i] += dp[i + 1]
         ans += dp[0]
-        ans %= MOD
+        ans %= kMod
 
     return ans
diff --git a/solutions/2487. Remove Nodes From Linked List/2487.py b/solutions/2487. Remove Nodes From Linked List/2487.py
index a953d35e6a4..921b2fbfc86 100644
--- a/solutions/2487. Remove Nodes From Linked List/2487.py	
+++ b/solutions/2487. Remove Nodes From Linked List/2487.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def removeNodes(self, head: ListNode | None) -> ListNode | None:
+  def removeNodes(self, head: Optional[ListNode]) -> Optional[ListNode]:
     if not head:
       return None
     head.next = self.removeNodes(head.next)
diff --git a/solutions/2488. Count Subarrays With Median K/2488.java b/solutions/2488. Count Subarrays With Median K/2488.java
index 065c76ef247..99e6aa4c389 100644
--- a/solutions/2488. Count Subarrays With Median K/2488.java	
+++ b/solutions/2488. Count Subarrays With Median K/2488.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int countSubarrays(int[] nums, int k) {
-    final int INDEX = find(nums, k);
+    final int kIndex = find(nums, k);
     int ans = 0;
     Map<Integer, Integer> count = new HashMap<>();
 
-    for (int i = INDEX, balance = 0; i >= 0; --i) {
+    for (int i = kIndex, balance = 0; i >= 0; --i) {
       if (nums[i] < k)
         --balance;
       else if (nums[i] > k)
@@ -12,7 +12,7 @@ else if (nums[i] > k)
       count.merge(balance, 1, Integer::sum);
     }
 
-    for (int i = INDEX, balance = 0; i < nums.length; ++i) {
+    for (int i = kIndex, balance = 0; i < nums.length; ++i) {
       if (nums[i] < k)
         --balance;
       else if (nums[i] > k)
diff --git a/solutions/2488. Count Subarrays With Median K/2488.py b/solutions/2488. Count Subarrays With Median K/2488.py
index b897c15a236..58ed3db0cbf 100644
--- a/solutions/2488. Count Subarrays With Median K/2488.py	
+++ b/solutions/2488. Count Subarrays With Median K/2488.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def countSubarrays(self, nums: list[int], k: int) -> int:
-    INDEX = nums.index(k)
+  def countSubarrays(self, nums: List[int], k: int) -> int:
+    kIndex = nums.index(k)
     ans = 0
     count = collections.Counter()
 
     balance = 0
-    for i in range(INDEX, -1, -1):
+    for i in range(kIndex, -1, -1):
       if nums[i] < k:
         balance -= 1
       elif nums[i] > k:
@@ -13,7 +13,7 @@ def countSubarrays(self, nums: list[int], k: int) -> int:
       count[balance] += 1
 
     balance = 0
-    for i in range(INDEX, len(nums)):
+    for i in range(kIndex, len(nums)):
       if nums[i] < k:
         balance -= 1
       elif nums[i] > k:
diff --git a/solutions/249. Group Shifted Strings/249.py b/solutions/249. Group Shifted Strings/249.py
index bca2488257e..a8a9e7a12b5 100644
--- a/solutions/249. Group Shifted Strings/249.py	
+++ b/solutions/249. Group Shifted Strings/249.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def groupStrings(self, strings: list[str]) -> list[list[str]]:
+  def groupStrings(self, strings: List[str]) -> List[List[str]]:
     keyToStrings = collections.defaultdict(list)
 
     def getKey(s: str) -> str:
diff --git a/solutions/2491. Divide Players Into Teams of Equal Skill/2491.py b/solutions/2491. Divide Players Into Teams of Equal Skill/2491.py
index 72655fb3b25..936db871e06 100644
--- a/solutions/2491. Divide Players Into Teams of Equal Skill/2491.py	
+++ b/solutions/2491. Divide Players Into Teams of Equal Skill/2491.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def dividePlayers(self, skill: list[int]) -> int:
+  def dividePlayers(self, skill: List[int]) -> int:
     n = len(skill)
     teamSkill = sum(skill) // (n // 2)
     ans = 0
diff --git a/solutions/2492. Minimum Score of a Path Between Two Cities/2492.java b/solutions/2492. Minimum Score of a Path Between Two Cities/2492.java
index db9241cbf99..32d1c2b3625 100644
--- a/solutions/2492. Minimum Score of a Path Between Two Cities/2492.java	
+++ b/solutions/2492. Minimum Score of a Path Between Two Cities/2492.java	
@@ -2,10 +2,12 @@ class Solution {
   public int minScore(int n, int[][] roads) {
     int ans = Integer.MAX_VALUE;
     List<Pair<Integer, Integer>>[] graph = new List[n]; // graph[u] := [(v, distance)]
-    Queue<Integer> q = new ArrayDeque<>(List.of(0));
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(0));
     boolean[] seen = new boolean[n];
     seen[0] = true;
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (final int[] r : roads) {
       final int u = r[0] - 1;
diff --git a/solutions/2492. Minimum Score of a Path Between Two Cities/2492.py b/solutions/2492. Minimum Score of a Path Between Two Cities/2492.py
index 9f4edda14e7..8f343d66485 100644
--- a/solutions/2492. Minimum Score of a Path Between Two Cities/2492.py	
+++ b/solutions/2492. Minimum Score of a Path Between Two Cities/2492.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minScore(self, n: int, roads: list[list[int]]) -> int:
+  def minScore(self, n: int, roads: List[List[int]]) -> int:
     ans = math.inf
     graph = [[] for _ in range(n + 1)]  # graph[u] := [(v, distance)]
     q = collections.deque([1])
diff --git a/solutions/2495. Number of Subarrays Having Even Product/2495.py b/solutions/2495. Number of Subarrays Having Even Product/2495.py
index 7da1c1addc0..52c04b2c146 100644
--- a/solutions/2495. Number of Subarrays Having Even Product/2495.py	
+++ b/solutions/2495. Number of Subarrays Having Even Product/2495.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def evenProduct(self, nums: list[int]) -> int:
+  def evenProduct(self, nums: List[int]) -> int:
     ans = 0
     numsBeforeEven = 0  # inclusively
 
diff --git a/solutions/2496. Maximum Value of a String in an Array/2496.py b/solutions/2496. Maximum Value of a String in an Array/2496.py
index 458b498c967..7193c8e2c44 100644
--- a/solutions/2496. Maximum Value of a String in an Array/2496.py	
+++ b/solutions/2496. Maximum Value of a String in an Array/2496.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def maximumValue(self, strs: list[str]) -> int:
+  def maximumValue(self, strs: List[str]) -> int:
     return max(len(s) if any(c.isalpha() for c in s) else int(s)
                for s in strs)
diff --git a/solutions/2497. Maximum Star Sum of a Graph/2497.java b/solutions/2497. Maximum Star Sum of a Graph/2497.java
index 4f7d7749104..6da23be315b 100644
--- a/solutions/2497. Maximum Star Sum of a Graph/2497.java	
+++ b/solutions/2497. Maximum Star Sum of a Graph/2497.java	
@@ -3,7 +3,9 @@ public int maxStarSum(int[] vals, int[][] edges, int k) {
     final int n = vals.length;
     int ans = Integer.MIN_VALUE;
     List<Pair<Integer, Integer>>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
diff --git a/solutions/2497. Maximum Star Sum of a Graph/2497.py b/solutions/2497. Maximum Star Sum of a Graph/2497.py
index 50cfade534a..de7141de7a5 100644
--- a/solutions/2497. Maximum Star Sum of a Graph/2497.py	
+++ b/solutions/2497. Maximum Star Sum of a Graph/2497.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxStarSum(self, vals: list[int], edges: list[list[int]], k: int) -> int:
+  def maxStarSum(self, vals: List[int], edges: List[List[int]], k: int) -> int:
     n = len(vals)
     ans = -math.inf
     graph = [[] for _ in range(n)]
diff --git a/solutions/2498. Frog Jump II/2498.py b/solutions/2498. Frog Jump II/2498.py
index 1bca9d9c591..bb0e90988f5 100644
--- a/solutions/2498. Frog Jump II/2498.py	
+++ b/solutions/2498. Frog Jump II/2498.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxJump(self, stones: list[int]) -> int:
+  def maxJump(self, stones: List[int]) -> int:
     # Let's denote the forwarding path as F and the backwarding path as B.
     # 'F1 B2 B1 F2' is no better than 'F1 B2 F2 B1' since the distance between
     # F1 and F2 increase, resulting a larger `ans`.
diff --git a/solutions/2499. Minimum Total Cost to Make Arrays Unequal/2499.py b/solutions/2499. Minimum Total Cost to Make Arrays Unequal/2499.py
index 69b2e736669..0d883b99b3f 100644
--- a/solutions/2499. Minimum Total Cost to Make Arrays Unequal/2499.py	
+++ b/solutions/2499. Minimum Total Cost to Make Arrays Unequal/2499.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumTotalCost(self, nums1: list[int], nums2: list[int]) -> int:
+  def minimumTotalCost(self, nums1: List[int], nums2: List[int]) -> int:
     n = len(nums1)
     ans = 0
     maxFreq = 0
diff --git a/solutions/25. Reverse Nodes in k-Group/25.py b/solutions/25. Reverse Nodes in k-Group/25.py
index b43030baf95..ea3b4c5e8ae 100644
--- a/solutions/25. Reverse Nodes in k-Group/25.py	
+++ b/solutions/25. Reverse Nodes in k-Group/25.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def reverseKGroup(self, head: ListNode | None, k: int) -> ListNode | None:
+  def reverseKGroup(self, head: Optional[ListNode], k: int) -> Optional[ListNode]:
     if not head:
       return None
 
@@ -15,11 +15,7 @@ def reverseKGroup(self, head: ListNode | None, k: int) -> ListNode | None:
     head.next = self.reverseKGroup(tail, k)
     return newHead
 
-  def _reverse(
-      self,
-      head: ListNode | None,
-      tail: ListNode | None,
-  ) -> ListNode | None:
+  def _reverse(self, head: Optional[ListNode], tail: Optional[ListNode]) -> Optional[ListNode]:
     """Reverses [head, tail)."""
     prev = None
     curr = head
diff --git a/solutions/250. Count Univalue Subtrees/250.py b/solutions/250. Count Univalue Subtrees/250.py
index f3a3d427fc0..ad303ef59a8 100644
--- a/solutions/250. Count Univalue Subtrees/250.py	
+++ b/solutions/250. Count Univalue Subtrees/250.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def countUnivalSubtrees(self, root: TreeNode | None) -> int:
+  def countUnivalSubtrees(self, root: Optional[TreeNode]) -> int:
     ans = 0
 
-    def isUnival(root: TreeNode | None, val: int) -> bool:
+    def isUnival(root: Optional[TreeNode], val: int) -> bool:
       nonlocal ans
       if not root:
         return True
diff --git a/solutions/2500. Delete Greatest Value in Each Row/2500.py b/solutions/2500. Delete Greatest Value in Each Row/2500.py
index 5d2020ac092..70a1d08cd20 100644
--- a/solutions/2500. Delete Greatest Value in Each Row/2500.py	
+++ b/solutions/2500. Delete Greatest Value in Each Row/2500.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def deleteGreatestValue(self, grid: list[list[int]]) -> int:
+  def deleteGreatestValue(self, grid: List[List[int]]) -> int:
     for row in grid:
       row.sort()
     return sum(max(col) for col in zip(*grid))
diff --git a/solutions/2503. Maximum Number of Points From Grid Queries/2503.cpp b/solutions/2503. Maximum Number of Points From Grid Queries/2503.cpp
index 26e8c899d30..87fe6e2f38e 100644
--- a/solutions/2503. Maximum Number of Points From Grid Queries/2503.cpp	
+++ b/solutions/2503. Maximum Number of Points From Grid Queries/2503.cpp	
@@ -7,12 +7,13 @@ struct T {
   int i;
   int j;
   int val;  // grid[i][j]
+  T(int i, int j, int val) : i(i), j(j), val(val) {}
 };
 
 class Solution {
  public:
   vector<int> maxPoints(vector<vector<int>>& grid, vector<int>& queries) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = grid.size();
     const int n = grid[0].size();
     vector<int> ans(queries.size());
@@ -35,7 +36,7 @@ class Solution {
           break;
         }
         ++accumulate;
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
@@ -57,9 +58,10 @@ class Solution {
     vector<IndexedQuery> indexedQueries;
     for (int i = 0; i < queries.size(); ++i)
       indexedQueries.push_back({i, queries[i]});
-    ranges::sort(
-        indexedQueries, ranges::less{},
-        [](const IndexedQuery& indexedQuery) { return indexedQuery.query; });
+    ranges::sort(indexedQueries,
+                 [](const IndexedQuery& a, const IndexedQuery& b) {
+      return a.query < b.query;
+    });
     return indexedQueries;
   }
 };
diff --git a/solutions/2503. Maximum Number of Points From Grid Queries/2503.java b/solutions/2503. Maximum Number of Points From Grid Queries/2503.java
index f5b0ab5cd70..a47529fa348 100644
--- a/solutions/2503. Maximum Number of Points From Grid Queries/2503.java	
+++ b/solutions/2503. Maximum Number of Points From Grid Queries/2503.java	
@@ -1,11 +1,21 @@
+class T {
+  public int i;
+  public int j;
+  public int val; // grid[i][j]
+  public T(int i, int j, int val) {
+    this.i = i;
+    this.j = j;
+    this.val = val;
+  }
+}
+
 class Solution {
   public int[] maxPoints(int[][] grid, int[] queries) {
-    record T(int i, int j, int val) {}
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = grid.length;
     final int n = grid[0].length;
     int[] ans = new int[queries.length];
-    Queue<T> minHeap = new PriorityQueue<>(Comparator.comparingInt(T::val));
+    Queue<T> minHeap = new PriorityQueue<>((a, b) -> a.val - b.val);
     boolean[][] seen = new boolean[m][n];
 
     minHeap.offer(new T(0, 0, grid[0][0]));
@@ -26,7 +36,7 @@ record T(int i, int j, int val) {}
           break;
         }
         ++accumulate;
-        for (int[] dir : DIRS) {
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == m || y < 0 || y == n)
@@ -43,13 +53,13 @@ record T(int i, int j, int val) {}
     return ans;
   }
 
-  private record IndexedQuery(int queryIndex, int query) {}
+  private record IndexedQuery(int queryIndex, int query){};
 
   private IndexedQuery[] getIndexedQueries(int[] queries) {
     IndexedQuery[] indexedQueries = new IndexedQuery[queries.length];
     for (int i = 0; i < queries.length; ++i)
       indexedQueries[i] = new IndexedQuery(i, queries[i]);
-    Arrays.sort(indexedQueries, Comparator.comparingInt(IndexedQuery::query));
+    Arrays.sort(indexedQueries, (a, b) -> a.query - b.query);
     return indexedQueries;
   }
 }
diff --git a/solutions/2503. Maximum Number of Points From Grid Queries/2503.py b/solutions/2503. Maximum Number of Points From Grid Queries/2503.py
index 592981bedb1..f66d8a1437d 100644
--- a/solutions/2503. Maximum Number of Points From Grid Queries/2503.py	
+++ b/solutions/2503. Maximum Number of Points From Grid Queries/2503.py	
@@ -1,10 +1,7 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
 class IndexedQuery:
-  queryIndex: int
-  query: int
+  def __init__(self, queryIndex: int, query: int):
+    self.queryIndex = queryIndex
+    self.query = query
 
   def __iter__(self):
     yield self.queryIndex
@@ -12,8 +9,8 @@ def __iter__(self):
 
 
 class Solution:
-  def maxPoints(self, grid: list[list[int]], queries: list[int]) -> list[int]:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def maxPoints(self, grid: List[List[int]], queries: List[int]) -> List[int]:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
     ans = [0] * len(queries)
@@ -23,7 +20,7 @@ def maxPoints(self, grid: list[list[int]], queries: list[int]) -> list[int]:
 
     for queryIndex, query in sorted([IndexedQuery(i, query)
                                      for i, query in enumerate(queries)],
-                                    key=lambda x: x.query):
+                                    key=lambda iq: iq.query):
       while minHeap:
         val, i, j = heapq.heappop(minHeap)
         if val >= query:
@@ -32,7 +29,7 @@ def maxPoints(self, grid: list[list[int]], queries: list[int]) -> list[int]:
           heapq.heappush(minHeap, (val, i, j))
           break
         accumulate += 1
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/2505. Bitwise OR of All Subsequence Sums/2505.py b/solutions/2505. Bitwise OR of All Subsequence Sums/2505.py
index 3938b2947c5..e2c29f88b2b 100644
--- a/solutions/2505. Bitwise OR of All Subsequence Sums/2505.py	
+++ b/solutions/2505. Bitwise OR of All Subsequence Sums/2505.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def subsequenceSumOr(self, nums: list[int]) -> int:
+  def subsequenceSumOr(self, nums: List[int]) -> int:
     ans = 0
     prefix = 0
 
diff --git a/solutions/2506. Count Pairs Of Similar Strings/2506-2.py b/solutions/2506. Count Pairs Of Similar Strings/2506-2.py
index 34e0841434f..47dc1f3740e 100644
--- a/solutions/2506. Count Pairs Of Similar Strings/2506-2.py	
+++ b/solutions/2506. Count Pairs Of Similar Strings/2506-2.py	
@@ -1,4 +1,5 @@
 class Solution:
-  def similarPairs(self, words: list[str]) -> int:
+  def similarPairs(self, words: List[str]) -> int:
     return sum(set(words[i]) == set(words[j])
-               for i, j in itertools.combinations(range(len(words)), 2))
+               for i in range(len(words))
+               for j in range(i + 1, len(words)))
diff --git a/solutions/2506. Count Pairs Of Similar Strings/2506.java b/solutions/2506. Count Pairs Of Similar Strings/2506.java
index f8c9079cac3..cd2fcc522ea 100644
--- a/solutions/2506. Count Pairs Of Similar Strings/2506.java	
+++ b/solutions/2506. Count Pairs Of Similar Strings/2506.java	
@@ -16,7 +16,7 @@ public int similarPairs(String[] words) {
 
   private int getMask(final String word) {
     int mask = 0;
-    for (final char c : word.toCharArray())
+    for (const char c : word.toCharArray())
       mask |= 1 << c - 'a';
     return mask;
   }
diff --git a/solutions/2506. Count Pairs Of Similar Strings/2506.py b/solutions/2506. Count Pairs Of Similar Strings/2506.py
index b56d01e0b56..25471a903e3 100644
--- a/solutions/2506. Count Pairs Of Similar Strings/2506.py	
+++ b/solutions/2506. Count Pairs Of Similar Strings/2506.py	
@@ -1,11 +1,18 @@
 class Solution:
-  def similarPairs(self, words: list[str]) -> int:
-    masks = [self._getMask(word) for word in words]
-    return sum(masks[i] == masks[j]
-               for i, j in itertools.combinations(range(len(masks)), 2))
-
-  def _getMask(self, word: str) -> int:
-    mask = 0
-    for c in word:
-      mask |= 1 << ord(c) - ord('a')
-    return mask
+  def similarPairs(self, words: List[str]) -> int:
+    ans = 0
+
+    def getMask(word: str) -> int:
+      mask = 0
+      for c in word:
+        mask |= 1 << ord(c) - ord('a')
+      return mask
+
+    masks = [getMask(word) for word in words]
+
+    for i in range(len(masks)):
+      for j in range(i + 1, len(masks)):
+        if masks[i] == masks[j]:
+          ans += 1
+
+    return ans
diff --git a/solutions/2508. Add Edges to Make Degrees of All Nodes Even/2508.py b/solutions/2508. Add Edges to Make Degrees of All Nodes Even/2508.py
index 3324e7274f3..5513d6e03ab 100644
--- a/solutions/2508. Add Edges to Make Degrees of All Nodes Even/2508.py	
+++ b/solutions/2508. Add Edges to Make Degrees of All Nodes Even/2508.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isPossible(self, n: int, edges: list[list[int]]) -> bool:
+  def isPossible(self, n: int, edges: List[List[int]]) -> bool:
     graph = [set() for _ in range(n)]
 
     for u, v in edges:
@@ -15,7 +15,7 @@ def isPossible(self, n: int, edges: list[list[int]]) -> bool:
       return any(a not in graph[i] and b not in graph[i] for i in range(n))
     if len(oddNodes) == 4:
       a, b, c, d = oddNodes
-      return ((b not in graph[a] and d not in graph[c]) or
-              (c not in graph[a] and d not in graph[b]) or
-              (d not in graph[a] and c not in graph[b]))
+      return (b not in graph[a] and d not in graph[c]) or \
+          (c not in graph[a] and d not in graph[b]) or \
+          (d not in graph[a] and c not in graph[b])
     return False
diff --git a/solutions/2509. Cycle Length Queries in a Tree/2509.py b/solutions/2509. Cycle Length Queries in a Tree/2509.py
index 75a71ac349c..d04bf2b6490 100644
--- a/solutions/2509. Cycle Length Queries in a Tree/2509.py	
+++ b/solutions/2509. Cycle Length Queries in a Tree/2509.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def cycleLengthQueries(self, n: int, queries: list[list[int]]) -> list[int]:
+  def cycleLengthQueries(self, n: int, queries: List[List[int]]) -> List[int]:
     def getCycleLength(a: int, b: int):
       cycleLength = 1
       while a != b:
diff --git a/solutions/251. Flatten 2D Vector/251.cpp b/solutions/251. Flatten 2D Vector/251.cpp
index cad5fcb2d8d..6e4c394a8c3 100644
--- a/solutions/251. Flatten 2D Vector/251.cpp	
+++ b/solutions/251. Flatten 2D Vector/251.cpp	
@@ -1,8 +1,8 @@
 class Vector2D {
  public:
   Vector2D(vector<vector<int>>& vec) {
-    for (const vector<int>& arr : vec)
-      for (const int a : arr)
+    for (const vector<int>& A : vec)
+      for (const int a : A)
         this->vec.push_back(a);
   }
 
diff --git a/solutions/251. Flatten 2D Vector/251.java b/solutions/251. Flatten 2D Vector/251.java
index 78a78da8340..70d4ffd7b3c 100644
--- a/solutions/251. Flatten 2D Vector/251.java	
+++ b/solutions/251. Flatten 2D Vector/251.java	
@@ -1,7 +1,7 @@
 class Vector2D {
   public Vector2D(int[][] vec) {
-    for (int[] arr : vec)
-      for (final int a : arr)
+    for (int[] A : vec)
+      for (final int a : A)
         this.vec.add(a);
   }
 
diff --git a/solutions/251. Flatten 2D Vector/251.py b/solutions/251. Flatten 2D Vector/251.py
index fb44d6ff740..bef70b8c014 100644
--- a/solutions/251. Flatten 2D Vector/251.py	
+++ b/solutions/251. Flatten 2D Vector/251.py	
@@ -1,10 +1,10 @@
 class Vector2D:
-  def __init__(self, vec: list[list[int]]):
+  def __init__(self, vec: List[List[int]]):
     self.vec = []
     self.i = 0
 
-    for arr in vec:
-      self.vec += arr
+    for A in vec:
+      self.vec += A
 
   def next(self) -> int:
     ans = self.vec[self.i]
diff --git a/solutions/2510. Check if There is a Path With Equal Number of 0's And 1's/2510.py b/solutions/2510. Check if There is a Path With Equal Number of 0's And 1's/2510.py
index 046a82cefa5..eee9ce7bdf7 100644
--- a/solutions/2510. Check if There is a Path With Equal Number of 0's And 1's/2510.py	
+++ b/solutions/2510. Check if There is a Path With Equal Number of 0's And 1's/2510.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isThereAPath(self, grid: list[list[int]]) -> bool:
+  def isThereAPath(self, grid: List[List[int]]) -> bool:
     m = len(grid)
     n = len(grid[0])
     if m + n - 1 & 1:
diff --git a/solutions/2511. Maximum Enemy Forts That Can Be Captured/2511.py b/solutions/2511. Maximum Enemy Forts That Can Be Captured/2511.py
index 927d3cb38a7..70a942793be 100644
--- a/solutions/2511. Maximum Enemy Forts That Can Be Captured/2511.py	
+++ b/solutions/2511. Maximum Enemy Forts That Can Be Captured/2511.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def captureForts(self, forts: list[int]) -> int:
+  def captureForts(self, forts: List[int]) -> int:
     ans = 0
 
     j = 0
diff --git a/solutions/2512. Reward Top K Students/2512.java b/solutions/2512. Reward Top K Students/2512.java
index 6dc0f521ee5..12d75b5a88d 100644
--- a/solutions/2512. Reward Top K Students/2512.java	
+++ b/solutions/2512. Reward Top K Students/2512.java	
@@ -18,8 +18,9 @@ public List<Integer> topStudents(String[] positive_feedback, String[] negative_f
     }
 
     Arrays.sort(scoreAndIds,
-                Comparator.comparing(Pair<Integer, Integer>::getKey, Comparator.reverseOrder())
-                    .thenComparing(Pair<Integer, Integer>::getValue));
+                (a, b)
+                    -> a.getKey().equals(b.getKey()) ? a.getValue() - b.getValue()
+                                                     : b.getKey() - a.getKey());
 
     for (int i = 0; i < k; ++i)
       ans.add(scoreAndIds[i].getValue());
diff --git a/solutions/2512. Reward Top K Students/2512.py b/solutions/2512. Reward Top K Students/2512.py
index 29b42d14eaf..e581522c133 100644
--- a/solutions/2512. Reward Top K Students/2512.py	
+++ b/solutions/2512. Reward Top K Students/2512.py	
@@ -1,12 +1,5 @@
 class Solution:
-  def topStudents(
-      self,
-      positive_feedback: list[str],
-      negative_feedback: list[str],
-      report: list[str],
-      student_id: list[int],
-      k: int,
-  ) -> list[int]:
+  def topStudents(self, positive_feedback: List[str], negative_feedback: List[str], report: List[str], student_id: List[int], k: int) -> List[int]:
     scoreAndIds = []
     pos = set(positive_feedback)
     neg = set(negative_feedback)
diff --git a/solutions/2513. Minimize the Maximum of Two Arrays/2513.py b/solutions/2513. Minimize the Maximum of Two Arrays/2513.py
index 26a9ff21c7e..f15e32b6bbd 100644
--- a/solutions/2513. Minimize the Maximum of Two Arrays/2513.py	
+++ b/solutions/2513. Minimize the Maximum of Two Arrays/2513.py	
@@ -1,26 +1,17 @@
 class Solution:
-  def minimizeSet(
-      self,
-      divisor1: int,
-      divisor2: int,
-      uniqueCnt1: int,
-      uniqueCnt2: int,
-  ) -> int:
+  def minimizeSet(self, divisor1: int, divisor2: int, uniqueCnt1: int, uniqueCnt2: int) -> int:
     divisorLcm = math.lcm(divisor1, divisor2)
     l = 0
     r = 2**31 - 1
 
+    # True if we can take uniqueCnt1 integers from [1..m] to arr1 and take
+    # uniqueCnt2 integers from [1..m] to arr2.
     def isPossible(m: int) -> bool:
-      """
-      Returns True if we can take uniqueCnt1 integers from [1..m] to arr1 and
-      take uniqueCnt2 integers from [1..m] to arr2.
-      """
       cnt1 = m - m // divisor1
       cnt2 = m - m // divisor2
       totalCnt = m - m // divisorLcm
-      return (cnt1 >= uniqueCnt1 and
-              cnt2 >= uniqueCnt2 and
-              totalCnt >= uniqueCnt1 + uniqueCnt2)
+      return cnt1 >= uniqueCnt1 and cnt2 >= uniqueCnt2 and \
+          totalCnt >= uniqueCnt1 + uniqueCnt2
 
     while l < r:
       m = (l + r) // 2
diff --git a/solutions/2514. Count Anagrams/2514.java b/solutions/2514. Count Anagrams/2514.java
index 252e4a4e52e..3d78a8eafaf 100644
--- a/solutions/2514. Count Anagrams/2514.java	
+++ b/solutions/2514. Count Anagrams/2514.java	
@@ -7,18 +7,18 @@ public int countAnagrams(String s) {
     long ans = 1;
 
     for (final String word : s.split(" ")) {
-      ans = ans * fact[word.length()] % MOD;
+      ans = ans * fact[word.length()] % kMod;
       int[] count = new int[26];
       for (final char c : word.toCharArray())
         ++count[c - 'a'];
       for (final int freq : count)
-        ans = ans * invFact[freq] % MOD;
+        ans = ans * invFact[freq] % kMod;
     }
 
     return (int) ans;
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long[][] getFactAndInvFact(int n) {
     long[] fact = new long[n + 1];
@@ -28,9 +28,9 @@ private long[][] getFactAndInvFact(int n) {
     inv[0] = inv[1] = 1;
     for (int i = 1; i <= n; ++i) {
       if (i >= 2)
-        inv[i] = MOD - MOD / i * inv[MOD % i] % MOD;
-      fact[i] = fact[i - 1] * i % MOD;
-      invFact[i] = invFact[i - 1] * inv[i] % MOD;
+        inv[i] = kMod - kMod / i * inv[kMod % i] % kMod;
+      fact[i] = fact[i - 1] * i % kMod;
+      invFact[i] = invFact[i - 1] * inv[i] % kMod;
     }
     return new long[][] {fact, invFact};
   }
diff --git a/solutions/2515. Shortest Distance to Target String in a Circular Array/2515.py b/solutions/2515. Shortest Distance to Target String in a Circular Array/2515.py
index 015831c06b1..2a3f9b47b46 100644
--- a/solutions/2515. Shortest Distance to Target String in a Circular Array/2515.py	
+++ b/solutions/2515. Shortest Distance to Target String in a Circular Array/2515.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def closetTarget(self, words: list[str], target: str, startIndex: int) -> int:
+  def closetTarget(self, words: List[str], target: str, startIndex: int) -> int:
     n = len(words)
 
     for i in range(n):
diff --git a/solutions/2517. Maximum Tastiness of Candy Basket/2517.cpp b/solutions/2517. Maximum Tastiness of Candy Basket/2517.cpp
index b04c6855c88..0c7494647a4 100644
--- a/solutions/2517. Maximum Tastiness of Candy Basket/2517.cpp	
+++ b/solutions/2517. Maximum Tastiness of Candy Basket/2517.cpp	
@@ -8,10 +8,10 @@ class Solution {
 
     while (l < r) {
       const int m = (l + r) / 2;
-      if (numBaskets(price, m) < k)
-        r = m;
-      else
+      if (numBaskets(price, m) >= k)
         l = m + 1;
+      else
+        r = m;
     }
 
     return l - 1;
diff --git a/solutions/2517. Maximum Tastiness of Candy Basket/2517.py b/solutions/2517. Maximum Tastiness of Candy Basket/2517.py
index 640b6d09e63..5a0b5a5397e 100644
--- a/solutions/2517. Maximum Tastiness of Candy Basket/2517.py	
+++ b/solutions/2517. Maximum Tastiness of Candy Basket/2517.py	
@@ -1,17 +1,17 @@
 class Solution:
-  def maximumTastiness(self, price: list[int], k: int) -> int:
+  def maximumTastiness(self, price: List[int], k: int) -> int:
     price.sort()
 
-    def numBaskets(m: int) -> int:
-      """Returns the number of baskets we can pick for m tastiness."""
+    def cantPick(m: int) -> bool:
+      """Returns True if we can't pick k distinct candies for m tastiness."""
       baskets = 0
       prevPrice = -m
       for p in price:
         if p >= prevPrice + m:
           prevPrice = p
           baskets += 1
-      return baskets
+      return baskets < k
 
     l = bisect.bisect_left(range(max(price) - min(price) + 1), True,
-                           key=lambda m: numBaskets(m) < k)
+                           key=lambda m: cantPick(m))
     return l - 1
diff --git a/solutions/2518. Number of Great Partitions/2518.java b/solutions/2518. Number of Great Partitions/2518.java
index db35c9c57bc..6094b381fef 100644
--- a/solutions/2518. Number of Great Partitions/2518.java	
+++ b/solutions/2518. Number of Great Partitions/2518.java	
@@ -1,15 +1,15 @@
 class Solution {
   public int countPartitions(int[] nums, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final long sum = Arrays.stream(nums).asLongStream().sum();
-    long ans = modPow(2, nums.length, MOD); // 2^n % MOD
+    long ans = modPow(2, nums.length, kMod); // 2^n % kMod
     long[] dp = new long[k + 1];
     dp[0] = 1;
 
     for (final int num : nums)
       for (int i = k; i >= num; --i) {
         dp[i] += dp[i - num];
-        dp[i] %= MOD;
+        dp[i] %= kMod;
       }
 
     // Substract the cases that're not satisfied.
@@ -19,13 +19,13 @@ public int countPartitions(int[] nums, int k) {
       else
         ans -= dp[i] * 2;
 
-    return (int) ((ans % MOD + MOD) % MOD);
+    return (int) ((ans % kMod + kMod) % kMod);
   }
 
-  private int modPow(int x, int n, int MOD) {
+  private int modPow(int x, int n, int kMod) {
     int res = 1;
     for (int i = 0; i < n; ++i)
-      res = res * x % MOD;
+      res = res * x % kMod;
     return res;
   }
 }
diff --git a/solutions/2518. Number of Great Partitions/2518.py b/solutions/2518. Number of Great Partitions/2518.py
index 7493ea04ba7..04a9969216e 100644
--- a/solutions/2518. Number of Great Partitions/2518.py	
+++ b/solutions/2518. Number of Great Partitions/2518.py	
@@ -1,14 +1,14 @@
 class Solution:
-  def countPartitions(self, nums: list[int], k: int) -> int:
-    MOD = 1_000_000_007
+  def countPartitions(self, nums: List[int], k: int) -> int:
+    kMod = 1_000_000_007
     summ = sum(nums)
-    ans = pow(2, len(nums), MOD)  # 2^n % MOD
+    ans = pow(2, len(nums), kMod)  # 2^n % kMod
     dp = [1] + [0] * k
 
     for num in nums:
       for i in range(k, num - 1, -1):
         dp[i] += dp[i - num]
-        dp[i] %= MOD
+        dp[i] %= kMod
 
     # Substract the cases that're not satisfied.
     for i in range(k):
@@ -17,4 +17,4 @@ def countPartitions(self, nums: list[int], k: int) -> int:
       else:
         ans -= dp[i] * 2
 
-    return ans % MOD
+    return ans % kMod
diff --git a/solutions/2519. Count the Number of K-Big Indices/2519.py b/solutions/2519. Count the Number of K-Big Indices/2519.py
index 657137bb8a9..b3612f7f2a5 100644
--- a/solutions/2519. Count the Number of K-Big Indices/2519.py	
+++ b/solutions/2519. Count the Number of K-Big Indices/2519.py	
@@ -20,7 +20,7 @@ def lowbit(i: int) -> int:
 
 
 class Solution:
-  def kBigIndices(self, nums: list[int], k: int) -> int:
+  def kBigIndices(self, nums: List[int], k: int) -> int:
     n = len(nums)
     leftTree = FenwickTree(n)
     rightTree = FenwickTree(n)
diff --git a/solutions/252. Meeting Rooms/252.java b/solutions/252. Meeting Rooms/252.java
index 0a3a92a2f8e..9c40bc0bc12 100644
--- a/solutions/252. Meeting Rooms/252.java	
+++ b/solutions/252. Meeting Rooms/252.java	
@@ -1,6 +1,6 @@
 class Solution {
   public boolean canAttendMeetings(int[][] intervals) {
-    Arrays.sort(intervals, Comparator.comparingInt(interval -> interval[0]));
+    Arrays.sort(intervals, (a, b) -> a[0] - b[0]);
 
     for (int i = 1; i < intervals.length; ++i)
       if (intervals[i - 1][1] > intervals[i][0])
diff --git a/solutions/252. Meeting Rooms/252.py b/solutions/252. Meeting Rooms/252.py
index 91b12ad7a5d..ff5f023d41b 100644
--- a/solutions/252. Meeting Rooms/252.py	
+++ b/solutions/252. Meeting Rooms/252.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canAttendMeetings(self, intervals: list[list[int]]) -> bool:
+  def canAttendMeetings(self, intervals: List[List[int]]) -> bool:
     intervals.sort()
 
     for i in range(1, len(intervals)):
diff --git a/solutions/2521. Distinct Prime Factors of Product of Array/2521.py b/solutions/2521. Distinct Prime Factors of Product of Array/2521.py
index 343706bde35..e94c39ca5f6 100644
--- a/solutions/2521. Distinct Prime Factors of Product of Array/2521.py	
+++ b/solutions/2521. Distinct Prime Factors of Product of Array/2521.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def distinctPrimeFactors(self, nums: list[int]) -> int:
+  def distinctPrimeFactors(self, nums: List[int]) -> int:
     primes = set()
 
     for num in nums:
@@ -7,7 +7,7 @@ def distinctPrimeFactors(self, nums: list[int]) -> int:
 
     return len(primes)
 
-  def _addPrimeFactors(self, primes: set[int], num: int) -> None:
+  def _addPrimeFactors(self, primes: Set[int], num: int) -> None:
     for divisor in range(2, num + 1):
       if num % divisor == 0:
         primes.add(divisor)
diff --git a/solutions/2523. Closest Prime Numbers in Range/2523.py b/solutions/2523. Closest Prime Numbers in Range/2523.py
index c6c4ff2e19a..b375b19080f 100644
--- a/solutions/2523. Closest Prime Numbers in Range/2523.py	
+++ b/solutions/2523. Closest Prime Numbers in Range/2523.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def closestPrimes(self, left: int, right: int) -> list[int]:
+  def closestPrimes(self, left: int, right: int) -> List[int]:
     isPrime = self._sieveEratosthenes(right + 1)
     primes = [i for i in range(left, right + 1) if isPrime[i]]
 
@@ -19,7 +19,7 @@ def closestPrimes(self, left: int, right: int) -> list[int]:
 
     return [num1, num2]
 
-  def _sieveEratosthenes(self, n: int) -> list[bool]:
+  def _sieveEratosthenes(self, n: int) -> List[bool]:
     isPrime = [True] * n
     isPrime[0] = False
     isPrime[1] = False
diff --git a/solutions/2524. Maximum Frequency Score of a Subarray/2524.java b/solutions/2524. Maximum Frequency Score of a Subarray/2524.java
index 4b0e3df029d..b75d6702272 100644
--- a/solutions/2524. Maximum Frequency Score of a Subarray/2524.java	
+++ b/solutions/2524. Maximum Frequency Score of a Subarray/2524.java	
@@ -11,32 +11,32 @@ public int maxFrequencyScore(int[] nums, int k) {
     for (int i = k; i < nums.length; ++i) {
       // Remove the leftmost number that's out-of-window.
       final int leftNum = nums[i - k];
-      sum = (sum - modPow(leftNum, count.get(leftNum)) + MOD) % MOD;
+      sum = (sum - modPow(leftNum, count.get(leftNum)) + kMod) % kMod;
       // After decreasing its frequency, if it's still > 0, then add it back.
       if (count.merge(leftNum, -1, Integer::sum) > 0)
-        sum = (sum + modPow(leftNum, count.get(leftNum))) % MOD;
+        sum = (sum + modPow(leftNum, count.get(leftNum))) % kMod;
       // Otherwise, remove it from the count map.
       else
         count.remove(leftNum);
       // Add the current number. Similarly, remove the current score like above.
       final int rightNum = nums[i];
       if (count.getOrDefault(rightNum, 0) > 0)
-        sum = (sum - modPow(rightNum, count.get(rightNum)) + MOD) % MOD;
-      sum = (sum + modPow(rightNum, count.merge(rightNum, 1, Integer::sum))) % MOD;
+        sum = (sum - modPow(rightNum, count.get(rightNum)) + kMod) % kMod;
+      sum = (sum + modPow(rightNum, count.merge(rightNum, 1, Integer::sum))) % kMod;
       ans = Math.max(ans, sum);
     }
 
     return ans;
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private int getInitialSum(Map<Integer, Integer> count) {
     int sum = 0;
     for (Map.Entry<Integer, Integer> entry : count.entrySet()) {
       final int num = entry.getKey();
       final int freq = entry.getValue();
-      sum = (sum + modPow(num, freq)) % MOD;
+      sum = (sum + modPow(num, freq)) % kMod;
     }
     return sum;
   }
@@ -45,7 +45,7 @@ private int modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return (int) (x * modPow(x % MOD, (n - 1)) % MOD);
-    return modPow(x * x % MOD, (n / 2)) % MOD;
+      return (int) (x * modPow(x % kMod, (n - 1)) % kMod);
+    return modPow(x * x % kMod, (n / 2)) % kMod;
   }
 }
diff --git a/solutions/2524. Maximum Frequency Score of a Subarray/2524.py b/solutions/2524. Maximum Frequency Score of a Subarray/2524.py
index 050c139a367..98c7feee12a 100644
--- a/solutions/2524. Maximum Frequency Score of a Subarray/2524.py	
+++ b/solutions/2524. Maximum Frequency Score of a Subarray/2524.py	
@@ -1,33 +1,33 @@
 class Solution:
-  def maxFrequencyScore(self, nums: list[int], k: int) -> int:
-    MOD = 1_000_000_007
+  def maxFrequencyScore(self, nums: List[int], k: int) -> int:
+    kMod = 1_000_000_007
     count = collections.Counter(nums[:k])
-    summ = self._getInitialSumm(count, MOD)
+    summ = self._getInitialSumm(count, kMod)
     ans = summ
 
     for i in range(k, len(nums)):
       # Remove the leftmost number that's out-of-window.
       leftNum = nums[i - k]
-      summ = (summ - pow(leftNum, count[leftNum], MOD) + MOD) % MOD
+      summ = (summ - pow(leftNum, count[leftNum], kMod) + kMod) % kMod
       # After decreasing its frequency, if it's still > 0, then add it back.
       count[leftNum] -= 1
       if count[leftNum] > 0:
-        summ = (summ + pow(leftNum, count[leftNum], MOD)) % MOD
+        summ = (summ + pow(leftNum, count[leftNum], kMod)) % kMod
       # Otherwise, remove it from the count map.
       else:
         del count[leftNum]
       # Add the current number. Similarly, remove the current score like above.
       rightNum = nums[i]
       if count[rightNum] > 0:
-        summ = (summ - pow(rightNum, count[rightNum], MOD) + MOD) % MOD
+        summ = (summ - pow(rightNum, count[rightNum], kMod) + kMod) % kMod
       count[rightNum] += 1
-      summ = (summ + pow(rightNum, count[rightNum], MOD)) % MOD
+      summ = (summ + pow(rightNum, count[rightNum], kMod)) % kMod
       ans = max(ans, summ)
 
     return ans
 
-  def _getInitialSumm(self, count: dict[int, int], MOD: int) -> int:
+  def _getInitialSumm(self, count: Dict[int, int], kMod: int) -> int:
     summ = 0
     for num, freq in count.items():
-      summ = (summ + pow(num, freq, MOD)) % MOD
+      summ = (summ + pow(num, freq, kMod)) % kMod
     return summ
diff --git a/solutions/2525. Categorize Box According to Criteria/2525.py b/solutions/2525. Categorize Box According to Criteria/2525.py
index 6e69a5c3211..9bdf708ef49 100644
--- a/solutions/2525. Categorize Box According to Criteria/2525.py	
+++ b/solutions/2525. Categorize Box According to Criteria/2525.py	
@@ -1,14 +1,7 @@
 class Solution:
-  def categorizeBox(
-      self,
-      length: int,
-      width: int,
-      height: int,
-      mass: int,
-  ) -> str:
-    isBulky = (length >= 10000 or
-               width >= 10000 or height >= 10000 or
-               length * width * height >= 1_000_000_000)
+  def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:
+    isBulky = length >= 10000 or width >= 10000 or height >= 10000 or length * \
+        width * height >= 1_000_000_000
     isHeavy = mass >= 100
     if isBulky and isHeavy:
       return 'Both'
diff --git a/solutions/2527. Find Xor-Beauty of Array/2527.py b/solutions/2527. Find Xor-Beauty of Array/2527.py
index b939b54cbb5..88d7a91227b 100644
--- a/solutions/2527. Find Xor-Beauty of Array/2527.py	
+++ b/solutions/2527. Find Xor-Beauty of Array/2527.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def xorBeauty(self, nums: list[int]) -> int:
+  def xorBeauty(self, nums: List[int]) -> int:
     return functools.reduce(operator.xor, nums)
diff --git a/solutions/2528. Maximize the Minimum Powered City/2528.py b/solutions/2528. Maximize the Minimum Powered City/2528.py
index 88953f661b0..53414ab8adf 100644
--- a/solutions/2528. Maximize the Minimum Powered City/2528.py	
+++ b/solutions/2528. Maximize the Minimum Powered City/2528.py	
@@ -1,12 +1,10 @@
 class Solution:
-  def maxPower(self, stations: list[int], r: int, k: int) -> int:
+  def maxPower(self, stations: List[int], r: int, k: int) -> int:
     n = len(stations)
     left = min(stations)
     right = sum(stations) + k + 1
 
-    def check(
-            stations: list[int],
-            additionalStations: int, minPower: int) -> bool:
+    def check(stations: List[int], additionalStations: int, minPower: int) -> bool:
       """Returns True if each city can have at least `minPower`."""
       # Initilaize `power` as the 0-th city's power - stations[r].
       power = sum(stations[:r])
diff --git a/solutions/2529. Maximum Count of Positive Integer and Negative Integer/2529.py b/solutions/2529. Maximum Count of Positive Integer and Negative Integer/2529.py
index e7a704486d0..ee45ea08a7e 100644
--- a/solutions/2529. Maximum Count of Positive Integer and Negative Integer/2529.py	
+++ b/solutions/2529. Maximum Count of Positive Integer and Negative Integer/2529.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def maximumCount(self, nums: list[int]) -> int:
+  def maximumCount(self, nums: List[int]) -> int:
     return max(sum(num > 0 for num in nums), sum(num < 0 for num in nums))
diff --git a/solutions/253. Meeting Rooms II/253-2.py b/solutions/253. Meeting Rooms II/253-2.py
index 91e1f424e40..61a668b0f6f 100644
--- a/solutions/253. Meeting Rooms II/253-2.py	
+++ b/solutions/253. Meeting Rooms II/253-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minMeetingRooms(self, intervals: list[list[int]]) -> int:
+  def minMeetingRooms(self, intervals: List[List[int]]) -> int:
     n = len(intervals)
     ans = 0
     starts = []
diff --git a/solutions/253. Meeting Rooms II/253.cpp b/solutions/253. Meeting Rooms II/253.cpp
index 7d4330f64cb..77f4dca56ee 100644
--- a/solutions/253. Meeting Rooms II/253.cpp	
+++ b/solutions/253. Meeting Rooms II/253.cpp	
@@ -1,11 +1,11 @@
 class Solution {
  public:
   int minMeetingRooms(vector<vector<int>>& intervals) {
+    ranges::sort(intervals);
+
     // Store the end times of each room.
     priority_queue<int, vector<int>, greater<>> minHeap;
 
-    ranges::sort(intervals);
-
     for (const vector<int>& interval : intervals) {
       // There's no overlap, so we can reuse the same room.
       if (!minHeap.empty() && interval[0] >= minHeap.top())
diff --git a/solutions/253. Meeting Rooms II/253.java b/solutions/253. Meeting Rooms II/253.java
index 776acf59e82..35fbdcb8f5a 100644
--- a/solutions/253. Meeting Rooms II/253.java	
+++ b/solutions/253. Meeting Rooms II/253.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int minMeetingRooms(int[][] intervals) {
+    Arrays.sort(intervals, (a, b) -> (a[0] - b[0]));
+
     // Store the end times of each room.
     Queue<Integer> minHeap = new PriorityQueue<>();
 
-    Arrays.sort(intervals, Comparator.comparingInt(interval -> interval[0]));
-
     for (int[] interval : intervals) {
       // There's no overlap, so we can reuse the same room.
       if (!minHeap.isEmpty() && interval[0] >= minHeap.peek())
diff --git a/solutions/253. Meeting Rooms II/253.py b/solutions/253. Meeting Rooms II/253.py
index 0d430c26dd6..fb4256cd79c 100644
--- a/solutions/253. Meeting Rooms II/253.py	
+++ b/solutions/253. Meeting Rooms II/253.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minMeetingRooms(self, intervals: list[list[int]]) -> int:
+  def minMeetingRooms(self, intervals: List[List[int]]) -> int:
     minHeap = []  # Store the end times of each room.
 
     for start, end in sorted(intervals):
diff --git a/solutions/2530. Maximal Score After Applying K Operations/2530.py b/solutions/2530. Maximal Score After Applying K Operations/2530.py
index 9ce1475e7aa..351c716110f 100644
--- a/solutions/2530. Maximal Score After Applying K Operations/2530.py	
+++ b/solutions/2530. Maximal Score After Applying K Operations/2530.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxKelements(self, nums: list[int], k: int) -> int:
+  def maxKelements(self, nums: List[int], k: int) -> int:
     ans = 0
     maxHeap = [-num for num in nums]
     heapq.heapify(maxHeap)
diff --git a/solutions/2532. Time to Cross a Bridge/2532.java b/solutions/2532. Time to Cross a Bridge/2532.java
index 32af30ff40d..311530713cf 100644
--- a/solutions/2532. Time to Cross a Bridge/2532.java	
+++ b/solutions/2532. Time to Cross a Bridge/2532.java	
@@ -55,13 +55,14 @@ public int findCrossingTime(int n, int k, int[][] time) {
   }
 
   private Queue<Pair<Integer, Integer>> createMaxHeap() {
-    return new PriorityQueue<>(
-        Comparator.comparing(Pair<Integer, Integer>::getKey, Comparator.reverseOrder())
-            .thenComparing(Pair<Integer, Integer>::getValue, Comparator.reverseOrder()));
+    return new PriorityQueue<>((a, b)
+                                   -> a.getKey().equals(b.getKey()) ? b.getValue() - a.getValue()
+                                                                    : b.getKey() - a.getKey());
   }
 
   private Queue<Pair<Integer, Integer>> createMinHeap() {
-    return new PriorityQueue<>(Comparator.comparingInt(Pair<Integer, Integer>::getKey)
-                                   .thenComparingInt(Pair<Integer, Integer>::getValue));
+    return new PriorityQueue<>((a, b)
+                                   -> a.getKey().equals(b.getKey()) ? a.getValue() - b.getValue()
+                                                                    : a.getKey() - b.getKey());
   }
 }
diff --git a/solutions/2532. Time to Cross a Bridge/2532.py b/solutions/2532. Time to Cross a Bridge/2532.py
index 7863d8f2520..f581a7c105c 100644
--- a/solutions/2532. Time to Cross a Bridge/2532.py	
+++ b/solutions/2532. Time to Cross a Bridge/2532.py	
@@ -1,10 +1,9 @@
 class Solution:
-  def findCrossingTime(self, n: int, k: int, time: list[list[int]]) -> int:
+  def findCrossingTime(self, n: int, k: int, time: List[List[int]]) -> int:
     ans = 0
     # (leftToRight + rightToLeft, i)
-    leftBridgeQueue = [
-        (-leftToRight - rightToLeft, -i) for i,
-        (leftToRight, pickOld, rightToLeft, pickNew) in enumerate(time)]
+    leftBridgeQueue = [(-leftToRight - rightToLeft, -i)
+                       for i, (leftToRight, pickOld, rightToLeft, pickNew) in enumerate(time)]
     rightBridgeQueue = []
     # (time to be idle, i)
     leftWorkers = []
diff --git a/solutions/2533. Number of Good Binary Strings/2533.java b/solutions/2533. Number of Good Binary Strings/2533.java
index 3ee818a774f..5d232e87c7d 100644
--- a/solutions/2533. Number of Good Binary Strings/2533.java	
+++ b/solutions/2533. Number of Good Binary Strings/2533.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int goodBinaryStrings(int minLength, int maxLength, int oneGroup, int zeroGroup) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i] := the number of good binary strings with length i
     int[] dp = new int[maxLength + 1];
     dp[0] = 1; // ""
@@ -12,19 +12,19 @@ public int goodBinaryStrings(int minLength, int maxLength, int oneGroup, int zer
         final int appendZeros = i + zeroGroup;
         if (appendZeros <= maxLength) {
           dp[appendZeros] += dp[i];
-          dp[appendZeros] %= MOD;
+          dp[appendZeros] %= kMod;
         }
         final int appendOnes = i + oneGroup;
         if (appendOnes <= maxLength) {
           dp[appendOnes] += dp[i];
-          dp[appendOnes] %= MOD;
+          dp[appendOnes] %= kMod;
         }
       }
 
     int ans = 0;
     for (int i = minLength; i <= maxLength; ++i) {
       ans += dp[i];
-      ans %= MOD;
+      ans %= kMod;
     }
     return ans;
   }
diff --git a/solutions/2533. Number of Good Binary Strings/2533.py b/solutions/2533. Number of Good Binary Strings/2533.py
index 01f4d03f0f4..fd175fd9c74 100644
--- a/solutions/2533. Number of Good Binary Strings/2533.py	
+++ b/solutions/2533. Number of Good Binary Strings/2533.py	
@@ -1,12 +1,6 @@
 class Solution:
-  def goodBinaryStrings(
-      self,
-      minLength: int,
-      maxLength: int,
-      oneGroup: int,
-      zeroGroup: int,
-  ) -> int:
-    MOD = 1_000_000_007
+  def goodBinaryStrings(self, minLength: int, maxLength: int, oneGroup: int, zeroGroup: int) -> int:
+    kMod = 1_000_000_007
     # dp[i] := the number of good binary strings with length i
     dp = [1] + [0] * maxLength
 
@@ -17,10 +11,10 @@ def goodBinaryStrings(
         appendZeros = i + zeroGroup
         if appendZeros <= maxLength:
           dp[appendZeros] += dp[i]
-          dp[appendZeros] %= MOD
+          dp[appendZeros] %= kMod
         appendOnes = i + oneGroup
         if appendOnes <= maxLength:
           dp[appendOnes] += dp[i]
-          dp[appendOnes] %= MOD
+          dp[appendOnes] %= kMod
 
-    return sum(dp[minLength:]) % MOD
+    return sum(dp[minLength:]) % kMod
diff --git a/solutions/2534. Time Taken to Cross the Door/2534.cpp b/solutions/2534. Time Taken to Cross the Door/2534.cpp
index 55072022a64..4a71b381973 100644
--- a/solutions/2534. Time Taken to Cross the Door/2534.cpp	
+++ b/solutions/2534. Time Taken to Cross the Door/2534.cpp	
@@ -3,9 +3,10 @@ class Solution {
   vector<int> timeTaken(vector<int>& arrival, vector<int>& state) {
     const int n = arrival.size();
     vector<int> ans(n);
-    vector<queue<int>> qs(2);  // qs[0] := enter queue, qs[1] := exit queue
+    // qs[0] := enter, qs[1] := exit
+    vector<queue<int>> qs(2);
     int time = 0;
-    int d = 1;  // 0 := enter, 1 := exit
+    int d = 1;
 
     for (int i = 0; i < n; ++i) {
       popQueues(time, d, arrival[i], qs, ans);
@@ -28,7 +29,8 @@ class Solution {
     while (arrivalTime > time && (!qs[0].empty() || !qs[1].empty())) {
       if (qs[d].empty())
         d ^= 1;
-      ans[qs[d].front()] = time++, qs[d].pop();
+      ans[qs[d].front()] = time, qs[d].pop();
+      ++time;
     }
   }
 };
diff --git a/solutions/2534. Time Taken to Cross the Door/2534.java b/solutions/2534. Time Taken to Cross the Door/2534.java
deleted file mode 100644
index d2e0d766d4e..00000000000
--- a/solutions/2534. Time Taken to Cross the Door/2534.java	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution {
-  public int[] timeTaken(int[] arrival, int[] state) {
-    final int n = arrival.length;
-    int[] ans = new int[n];
-    Queue<Integer>[] qs = new Queue[2];
-    qs[0] = new LinkedList<>(); // enter queue
-    qs[1] = new LinkedList<>(); // exit queue
-
-    for (int i = 0; i < n; ++i) {
-      popQueues(arrival[i], qs, ans);
-      // If the door was not used in the previous second, then the person who
-      // wants to exit goes first.
-      if (arrival[i] > time) {
-        time = arrival[i]; // Forward `time` to now.
-        d = 1;             // Reset priority to exit.
-      }
-      qs[state[i]].offer(i);
-    }
-
-    popQueues(200000, qs, ans);
-    return ans;
-  }
-
-  private int time = 0;
-  private int d = 1; // 0: enter, 1: exit
-
-  private void popQueues(int arrivalTime, Queue<Integer>[] qs, int[] ans) {
-    while (arrivalTime > time && (!qs[0].isEmpty() || !qs[1].isEmpty())) {
-      if (qs[d].isEmpty())
-        d ^= 1; // Toggle between enter (0) and exit (1)
-      ans[qs[d].poll()] = time++;
-    }
-  }
-}
diff --git a/solutions/2535. Difference Between Element Sum and Digit Sum of an Array/2535.py b/solutions/2535. Difference Between Element Sum and Digit Sum of an Array/2535.py
index 2030dd610c5..b84de08efc9 100644
--- a/solutions/2535. Difference Between Element Sum and Digit Sum of an Array/2535.py	
+++ b/solutions/2535. Difference Between Element Sum and Digit Sum of an Array/2535.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def differenceOfSum(self, nums: list[int]) -> int:
+  def differenceOfSum(self, nums: List[int]) -> int:
     elementSum = sum(nums)
     digitSum = self._getAllDigitSum(nums)
     return abs(elementSum - digitSum)
 
-  def _getAllDigitSum(self, nums: list[int]) -> int:
+  def _getAllDigitSum(self, nums: List[int]) -> int:
     return sum(self._getDigitSum(num) for num in nums)
 
   def _getDigitSum(self, num: int) -> int:
diff --git a/solutions/2538. Difference Between Maximum and Minimum Price Sum/2538.cpp b/solutions/2538. Difference Between Maximum and Minimum Price Sum/2538.cpp
index ddd9b11f06a..b89c91ecdb8 100644
--- a/solutions/2538. Difference Between Maximum and Minimum Price Sum/2538.cpp	
+++ b/solutions/2538. Difference Between Maximum and Minimum Price Sum/2538.cpp	
@@ -24,7 +24,7 @@ class Solution {
              vector<int>& maxSums, const vector<int>& price) {
     int maxChildSum = 0;
     for (const int v : tree[u])
-      if (v != prev)
+      if (prev != v)
         maxChildSum = max(maxChildSum, maxSum(tree, v, u, maxSums, price));
     return maxSums[u] = price[u] + maxChildSum;
   }
diff --git a/solutions/2538. Difference Between Maximum and Minimum Price Sum/2538.java b/solutions/2538. Difference Between Maximum and Minimum Price Sum/2538.java
index fb3342d17a1..34126c73e39 100644
--- a/solutions/2538. Difference Between Maximum and Minimum Price Sum/2538.java	
+++ b/solutions/2538. Difference Between Maximum and Minimum Price Sum/2538.java	
@@ -25,7 +25,7 @@ public long maxOutput(int n, int[][] edges, int[] price) {
   private int maxSum(List<Integer>[] tree, int u, int prev, int[] maxSums, int[] price) {
     int maxChildSum = 0;
     for (final int v : tree[u])
-      if (v != prev)
+      if (prev != v)
         maxChildSum = Math.max(maxChildSum, maxSum(tree, v, u, maxSums, price));
     return maxSums[u] = price[u] + maxChildSum;
   }
diff --git a/solutions/2538. Difference Between Maximum and Minimum Price Sum/2538.py b/solutions/2538. Difference Between Maximum and Minimum Price Sum/2538.py
index e4ffb71e12c..2ba8d6d2828 100644
--- a/solutions/2538. Difference Between Maximum and Minimum Price Sum/2538.py	
+++ b/solutions/2538. Difference Between Maximum and Minimum Price Sum/2538.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxOutput(self, n: int, edges: list[list[int]], price: list[int]) -> int:
+  def maxOutput(self, n: int, edges: List[List[int]], price: List[int]) -> int:
     ans = 0
     tree = [[] for _ in range(n)]
     maxSums = [0] * n  # maxSums[i] := the maximum the sum of path rooted at i
@@ -11,7 +11,7 @@ def maxOutput(self, n: int, edges: list[list[int]], price: list[int]) -> int:
     def maxSum(u: int, prev: int) -> int:
       maxChildSum = 0
       for v in tree[u]:
-        if v != prev:
+        if prev != v:
           maxChildSum = max(maxChildSum, maxSum(v, u))
       maxSums[u] = price[u] + maxChildSum
       return maxSums[u]
@@ -41,9 +41,9 @@ def reroot(u: int, prev: int, parentSum: int) -> None:
       for v in tree[u]:
         if v == prev:
           continue
-        nextParentSum = (
-            price[u] + max(parentSum, maxSubtreeSum2) if v == maxNode else
-            price[u] + max(parentSum, maxSubtreeSum1))
+        nextParentSum = \
+            price[u] + max(parentSum, maxSubtreeSum2) if v == maxNode else \
+            price[u] + max(parentSum, maxSubtreeSum1)
         reroot(v, u, nextParentSum)
 
     reroot(0, -1, 0)
diff --git a/solutions/2539. Count the Number of Good Subsequences/2539.java b/solutions/2539. Count the Number of Good Subsequences/2539.java
index 78a55dedd7a..d56e6d625cd 100644
--- a/solutions/2539. Count the Number of Good Subsequences/2539.java	
+++ b/solutions/2539. Count the Number of Good Subsequences/2539.java	
@@ -16,7 +16,7 @@ public int countGoodSubsequences(String s) {
     // the number of good subsequences for f = 2 = 1 since we need to exclude "".
     //
     // Therefore, the number of good subsequences for "aab" = 5 + 1 = 6.
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int ans = 0;
     int[] count = new int[26];
 
@@ -34,15 +34,15 @@ public int countGoodSubsequences(String s) {
         if (charFreq >= freq)
           numSubseqs = (numSubseqs + //
                         numSubseqs * nCk(charFreq, freq, fact, invFact)) %
-                       MOD;
+                       kMod;
       ans += numSubseqs - 1; // Minus "".
-      ans %= MOD;
+      ans %= kMod;
     }
 
     return ans;
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long[][] getFactAndInvFact(int n) {
     long[] fact = new long[n + 1];
@@ -52,14 +52,14 @@ private long[][] getFactAndInvFact(int n) {
     inv[0] = inv[1] = 1;
     for (int i = 1; i <= n; ++i) {
       if (i >= 2)
-        inv[i] = MOD - MOD / i * inv[MOD % i] % MOD;
-      fact[i] = fact[i - 1] * i % MOD;
-      invFact[i] = invFact[i - 1] * inv[i] % MOD;
+        inv[i] = kMod - kMod / i * inv[kMod % i] % kMod;
+      fact[i] = fact[i - 1] * i % kMod;
+      invFact[i] = invFact[i - 1] * inv[i] % kMod;
     }
     return new long[][] {fact, invFact};
   }
 
   private int nCk(int n, int k, long[] fact, long[] invFact) {
-    return (int) (fact[n] * invFact[k] % MOD * invFact[n - k] % MOD);
+    return (int) (fact[n] * invFact[k] % kMod * invFact[n - k] % kMod);
   }
 }
diff --git a/solutions/2539. Count the Number of Good Subsequences/2539.py b/solutions/2539. Count the Number of Good Subsequences/2539.py
index fb79a3fc3cb..6b4d373ae53 100644
--- a/solutions/2539. Count the Number of Good Subsequences/2539.py	
+++ b/solutions/2539. Count the Number of Good Subsequences/2539.py	
@@ -1,27 +1,27 @@
 class Solution:
   def countGoodSubsequences(self, s: str) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     ans = 0
     count = collections.Counter(s)
 
     @functools.lru_cache(None)
     def fact(i: int) -> int:
-      return 1 if i <= 1 else i * fact(i - 1) % MOD
+      return 1 if i <= 1 else i * fact(i - 1) % kMod
 
     @functools.lru_cache(None)
     def inv(i: int) -> int:
-      return pow(i, MOD - 2, MOD)
+      return pow(i, kMod - 2, kMod)
 
     @functools.lru_cache(None)
     def nCk(n: int, k: int) -> int:
-      return fact(n) * inv(fact(k)) * inv(fact(n - k)) % MOD
+      return fact(n) * inv(fact(k)) * inv(fact(n - k)) % kMod
 
     for freq in range(1, max(count.values()) + 1):
       numSubseqs = 1  # ""
       for charFreq in count.values():
         if charFreq >= freq:
-          numSubseqs = numSubseqs * (1 + nCk(charFreq, freq)) % MOD
+          numSubseqs = numSubseqs * (1 + nCk(charFreq, freq)) % kMod
       ans += numSubseqs - 1  # Minus "".
-      ans %= MOD
+      ans %= kMod
 
     return ans
diff --git a/solutions/254. Factor Combinations/254.cpp b/solutions/254. Factor Combinations/254.cpp
index dd9243213a8..dd29f934f55 100644
--- a/solutions/254. Factor Combinations/254.cpp	
+++ b/solutions/254. Factor Combinations/254.cpp	
@@ -17,7 +17,7 @@ class Solution {
     for (int i = s; i <= n; ++i)
       if (n % i == 0) {
         path.push_back(i);
-        dfs(n / i, i, std::move(path), ans);
+        dfs(n / i, i, move(path), ans);
         path.pop_back();
       }
   }
diff --git a/solutions/254. Factor Combinations/254.py b/solutions/254. Factor Combinations/254.py
index a0e554cfec5..9fefc4043fc 100644
--- a/solutions/254. Factor Combinations/254.py	
+++ b/solutions/254. Factor Combinations/254.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def getFactors(self, n: int) -> list[list[int]]:
+  def getFactors(self, n: int) -> List[List[int]]:
     ans = []
 
-    def dfs(n: int, s: int, path: list[int]) -> None:
+    def dfs(n: int, s: int, path: List[int]) -> None:
       if n <= 1:
         if len(path) > 1:
           ans.append(path.copy())
diff --git a/solutions/2540. Minimum Common Value/2540.py b/solutions/2540. Minimum Common Value/2540.py
index 14ffe802ee5..68b7af63a65 100644
--- a/solutions/2540. Minimum Common Value/2540.py	
+++ b/solutions/2540. Minimum Common Value/2540.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getCommon(self, nums1: list[int], nums2: list[int]) -> int:
+  def getCommon(self, nums1: List[int], nums2: List[int]) -> int:
     i = 0  # nums1's index
     j = 0  # nums2's index
 
diff --git a/solutions/2541. Minimum Operations to Make Array Equal II/2541.py b/solutions/2541. Minimum Operations to Make Array Equal II/2541.py
index 0811b8b0230..fcae122d3f2 100644
--- a/solutions/2541. Minimum Operations to Make Array Equal II/2541.py	
+++ b/solutions/2541. Minimum Operations to Make Array Equal II/2541.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums1: list[int], nums2: list[int], k: int) -> int:
+  def minOperations(self, nums1: List[int], nums2: List[int], k: int) -> int:
     if k == 0:
       return 0 if nums1 == nums2 else -1
 
diff --git a/solutions/2542. Maximum Subsequence Score/2542.java b/solutions/2542. Maximum Subsequence Score/2542.java
index ffc3059c76e..2cbe18cce6f 100644
--- a/solutions/2542. Maximum Subsequence Score/2542.java	
+++ b/solutions/2542. Maximum Subsequence Score/2542.java	
@@ -10,7 +10,7 @@ public long maxScore(int[] nums1, int[] nums2, int k) {
     for (int i = 0; i < nums1.length; ++i)
       A[i] = new Pair<>(nums2[i], nums1[i]);
 
-    Arrays.sort(A, Comparator.comparing(Pair::getKey, Comparator.reverseOrder()));
+    Arrays.sort(A, (a, b) -> Integer.compare(b.getKey(), a.getKey()));
 
     for (Pair<Integer, Integer> a : A) {
       final int num2 = a.getKey();
diff --git a/solutions/2542. Maximum Subsequence Score/2542.py b/solutions/2542. Maximum Subsequence Score/2542.py
index 8b4c36698bf..41c391a09cb 100644
--- a/solutions/2542. Maximum Subsequence Score/2542.py	
+++ b/solutions/2542. Maximum Subsequence Score/2542.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 1383. Maximum Performance of a Team
-  def maxScore(self, nums1: list[int], nums2: list[int], k: int) -> int:
+  def maxScore(self, nums1: List[int], nums2: List[int], k: int) -> int:
     ans = 0
     summ = 0
     # (nums2[i], nums1[i]) sorted by nums2[i] in descending order
diff --git a/solutions/2545. Sort the Students by Their Kth Score/2545.java b/solutions/2545. Sort the Students by Their Kth Score/2545.java
index fe32185391c..7c0a741647e 100644
--- a/solutions/2545. Sort the Students by Their Kth Score/2545.java	
+++ b/solutions/2545. Sort the Students by Their Kth Score/2545.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int[][] sortTheStudents(int[][] score, int k) {
-    Arrays.sort(score, Comparator.comparingInt(a -> - a[k]));
+    Arrays.sort(score, (a, b) -> b[k] - a[k]);
     return score;
   }
 }
diff --git a/solutions/2545. Sort the Students by Their Kth Score/2545.py b/solutions/2545. Sort the Students by Their Kth Score/2545.py
index efed05ea05c..c8c0ad21557 100644
--- a/solutions/2545. Sort the Students by Their Kth Score/2545.py	
+++ b/solutions/2545. Sort the Students by Their Kth Score/2545.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def sortTheStudents(self, score: list[list[int]], k: int) -> list[list[int]]:
-    return sorted(score, key=lambda x: -x[k])
+  def sortTheStudents(self, score: List[List[int]], k: int) -> List[List[int]]:
+    return sorted(score, key=lambda a: -a[k])
diff --git a/solutions/2547. Minimum Cost to Split an Array/2547.java b/solutions/2547. Minimum Cost to Split an Array/2547.java
index 7f2bf084022..3d6ef7f19ea 100644
--- a/solutions/2547. Minimum Cost to Split an Array/2547.java	
+++ b/solutions/2547. Minimum Cost to Split an Array/2547.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int minCost(int[] nums, int k) {
-    final int MAX = 1001;
+    final int kMax = 1001;
     final int n = nums.length;
     // trimmedLength[i][j] := trimmed(nums[i..j]).length
     int[][] trimmedLength = new int[n][n];
@@ -10,7 +10,7 @@ public int minCost(int[] nums, int k) {
 
     for (int i = 0; i < n; ++i) {
       int length = 0;
-      int[] count = new int[MAX];
+      int[] count = new int[kMax];
       for (int j = i; j < n; ++j) {
         if (++count[nums[j]] == 2)
           length += 2;
diff --git a/solutions/2547. Minimum Cost to Split an Array/2547.py b/solutions/2547. Minimum Cost to Split an Array/2547.py
index 1f864127de2..2add2241166 100644
--- a/solutions/2547. Minimum Cost to Split an Array/2547.py	
+++ b/solutions/2547. Minimum Cost to Split an Array/2547.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def minCost(self, nums: list[int], k: int) -> int:
-    MAX = 1001
+  def minCost(self, nums: List[int], k: int) -> int:
+    kMax = 1001
     n = len(nums)
     # trimmedLength[i][j] := trimmed(nums[i..j]).length
     trimmedLength = [[0] * n for _ in range(n)]
@@ -9,7 +9,7 @@ def minCost(self, nums: list[int], k: int) -> int:
 
     for i in range(n):
       length = 0
-      count = [0] * MAX
+      count = [0] * kMax
       for j in range(i, n):
         count[nums[j]] += 1
         if count[nums[j]] == 2:
diff --git a/solutions/2548. Maximum Price to Fill a Bag/2548.cpp b/solutions/2548. Maximum Price to Fill a Bag/2548.cpp
index 6ee16914415..42c1c534d17 100644
--- a/solutions/2548. Maximum Price to Fill a Bag/2548.cpp	
+++ b/solutions/2548. Maximum Price to Fill a Bag/2548.cpp	
@@ -4,8 +4,9 @@ class Solution {
     double ans = 0;
 
     // Sort items based on price/weight.
-    ranges::sort(items, ranges::greater{}, [](const vector<int>& item) {
-      return static_cast<double>(item[0]) / item[1];
+    ranges::sort(items, [](const vector<int>& a, const vector<int>& b) {
+      return static_cast<double>(a[0]) / a[1] >
+             static_cast<double>(b[0]) / b[1];
     });
 
     for (const vector<int>& item : items) {
diff --git a/solutions/2548. Maximum Price to Fill a Bag/2548.py b/solutions/2548. Maximum Price to Fill a Bag/2548.py
index 0c08d39b159..c4953f6dbf1 100644
--- a/solutions/2548. Maximum Price to Fill a Bag/2548.py	
+++ b/solutions/2548. Maximum Price to Fill a Bag/2548.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxPrice(self, items: list[list[int]], capacity: int) -> float:
+  def maxPrice(self, items: List[List[int]], capacity: int) -> float:
     ans = 0
 
     # Sort items based on price//weight.
diff --git a/solutions/255. Verify Preorder Sequence in Binary Search Tree/255-2.py b/solutions/255. Verify Preorder Sequence in Binary Search Tree/255-2.py
index eab872c0b98..ebee86a92cf 100644
--- a/solutions/255. Verify Preorder Sequence in Binary Search Tree/255-2.py	
+++ b/solutions/255. Verify Preorder Sequence in Binary Search Tree/255-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def verifyPreorder(self, preorder: list[int]) -> list[int]:
+  def verifyPreorder(self, preorder: List[int]) -> List[int]:
     low = -math.inf
     stack = []
 
diff --git a/solutions/255. Verify Preorder Sequence in Binary Search Tree/255-3.py b/solutions/255. Verify Preorder Sequence in Binary Search Tree/255-3.py
index 75ce27d9725..13da28e6782 100644
--- a/solutions/255. Verify Preorder Sequence in Binary Search Tree/255-3.py	
+++ b/solutions/255. Verify Preorder Sequence in Binary Search Tree/255-3.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def verifyPreorder(self, preorder: list[int]) -> bool:
+  def verifyPreorder(self, preorder: List[int]) -> bool:
     low = -math.inf
     i = -1
 
diff --git a/solutions/255. Verify Preorder Sequence in Binary Search Tree/255.py b/solutions/255. Verify Preorder Sequence in Binary Search Tree/255.py
index 2ef37e7f19e..c1e9b414e99 100644
--- a/solutions/255. Verify Preorder Sequence in Binary Search Tree/255.py	
+++ b/solutions/255. Verify Preorder Sequence in Binary Search Tree/255.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def verifyPreorder(self, preorder: list[int]) -> bool:
+  def verifyPreorder(self, preorder: List[int]) -> bool:
     i = 0
 
     def dfs(min: int, max: int) -> None:
diff --git a/solutions/2550. Count Collisions of Monkeys on a Polygon/2550.java b/solutions/2550. Count Collisions of Monkeys on a Polygon/2550.java
index 53965714a48..c1575212329 100644
--- a/solutions/2550. Count Collisions of Monkeys on a Polygon/2550.java	
+++ b/solutions/2550. Count Collisions of Monkeys on a Polygon/2550.java	
@@ -1,16 +1,16 @@
 class Solution {
   public int monkeyMove(int n) {
     final int res = (int) modPow(2, n) - 2;
-    return res < 0 ? res + MOD : res;
+    return res < 0 ? res + kMod : res;
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2);
+      return x * modPow(x, n - 1) % kMod;
+    return modPow(x * x % kMod, n / 2);
   }
 }
diff --git a/solutions/2550. Count Collisions of Monkeys on a Polygon/2550.py b/solutions/2550. Count Collisions of Monkeys on a Polygon/2550.py
index a4fa14efb49..2c129346427 100644
--- a/solutions/2550. Count Collisions of Monkeys on a Polygon/2550.py	
+++ b/solutions/2550. Count Collisions of Monkeys on a Polygon/2550.py	
@@ -1,5 +1,5 @@
 class Solution:
   def monkeyMove(self, n: int) -> int:
-    MOD = 1_000_000_007
-    res = pow(2, n, MOD) - 2
-    return res + MOD if res < 0 else res
+    kMod = 1_000_000_007
+    res = pow(2, n, kMod) - 2
+    return res + kMod if res < 0 else res
diff --git a/solutions/2551. Put Marbles in Bags/2551.cpp b/solutions/2551. Put Marbles in Bags/2551.cpp
index d047d421d41..0f15342cc26 100644
--- a/solutions/2551. Put Marbles in Bags/2551.cpp	
+++ b/solutions/2551. Put Marbles in Bags/2551.cpp	
@@ -6,18 +6,18 @@ class Solution {
     // the cost. Also, no matter how we cut, weights[0] and weights[n - 1] will
     // be counted. So, the goal is to find the max/min k - 1 weights[i] +
     // weights[i + 1].
-    vector<int> arr;  // weights[i] + weights[i + 1]
+    vector<int> A;  // weights[i] + weights[i + 1]
     long mn = 0;
     long mx = 0;
 
     for (int i = 0; i + 1 < weights.size(); ++i)
-      arr.push_back(weights[i] + weights[i + 1]);
+      A.push_back(weights[i] + weights[i + 1]);
 
-    ranges::sort(arr);
+    ranges::sort(A);
 
     for (int i = 0; i < k - 1; ++i) {
-      mn += arr[i];
-      mx += arr[arr.size() - 1 - i];
+      mn += A[i];
+      mx += A[A.size() - 1 - i];
     }
 
     return mx - mn;
diff --git a/solutions/2551. Put Marbles in Bags/2551.java b/solutions/2551. Put Marbles in Bags/2551.java
index 934c68ebab2..bbed37a254a 100644
--- a/solutions/2551. Put Marbles in Bags/2551.java	
+++ b/solutions/2551. Put Marbles in Bags/2551.java	
@@ -5,18 +5,18 @@ public long putMarbles(int[] weights, int k) {
     // the cost. Also, no matter how we cut, weights[0] and weights[n - 1] will
     // be counted. So, the goal is to find the max/min k - 1 weights[i] +
     // weights[i + 1].
-    int[] arr = new int[weights.length - 1]; // weights[i] + weights[i + 1]
+    int[] A = new int[weights.length - 1]; // weights[i] + weights[i + 1]
     long mn = 0;
     long mx = 0;
 
-    for (int i = 0; i < arr.length; ++i)
-      arr[i] = weights[i] + weights[i + 1];
+    for (int i = 0; i < A.length; ++i)
+      A[i] = weights[i] + weights[i + 1];
 
-    Arrays.sort(arr);
+    Arrays.sort(A);
 
     for (int i = 0; i < k - 1; ++i) {
-      mn += arr[i];
-      mx += arr[arr.length - 1 - i];
+      mn += A[i];
+      mx += A[A.length - 1 - i];
     }
 
     return mx - mn;
diff --git a/solutions/2551. Put Marbles in Bags/2551.py b/solutions/2551. Put Marbles in Bags/2551.py
index 6a45634366c..7790b22bef6 100644
--- a/solutions/2551. Put Marbles in Bags/2551.py	
+++ b/solutions/2551. Put Marbles in Bags/2551.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def putMarbles(self, weights: list[int], k: int) -> int:
+  def putMarbles(self, weights: List[int], k: int) -> int:
     # To distribute marbles into k bags, there will be k - 1 cuts. If there's a
     # cut after weights[i], then weights[i] and weights[i + 1] will be added to
     # the cost. Also, no matter how we cut, weights[0] and weights[n - 1] will
@@ -7,5 +7,5 @@ def putMarbles(self, weights: list[int], k: int) -> int:
     # weights[i + 1].
 
     # weights[i] + weights[i + 1]
-    arr = [a + b for a, b in itertools.pairwise(weights)]
-    return sum(heapq.nlargest(k - 1, arr)) - sum(heapq.nsmallest(k - 1, arr))
+    A = [a + b for a, b in itertools.pairwise(weights)]
+    return sum(heapq.nlargest(k - 1, A)) - sum(heapq.nsmallest(k - 1, A))
diff --git a/solutions/2552. Count Increasing Quadruplets/2552.py b/solutions/2552. Count Increasing Quadruplets/2552.py
index f3b0b1dac00..2eab02fb761 100644
--- a/solutions/2552. Count Increasing Quadruplets/2552.py	
+++ b/solutions/2552. Count Increasing Quadruplets/2552.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countQuadruplets(self, nums: list[int]) -> int:
+  def countQuadruplets(self, nums: List[int]) -> int:
     ans = 0
     # dp[j] := the number of triplets (i, j, k) where i < j < k and nums[i] < nums[k] <
     # nums[j]. Keep this information for l to use later.
diff --git a/solutions/2553. Separate the Digits in an Array/2553.py b/solutions/2553. Separate the Digits in an Array/2553.py
index d595c7d6390..222099e9849 100644
--- a/solutions/2553. Separate the Digits in an Array/2553.py	
+++ b/solutions/2553. Separate the Digits in an Array/2553.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def separateDigits(self, nums: list[int]) -> list[int]:
+  def separateDigits(self, nums: List[int]) -> List[int]:
     return [int(c) for num in nums for c in str(num)]
diff --git a/solutions/2554. Maximum Number of Integers to Choose From a Range I/2554.py b/solutions/2554. Maximum Number of Integers to Choose From a Range I/2554.py
index 1ba25bd892b..d2ef1ccb9db 100644
--- a/solutions/2554. Maximum Number of Integers to Choose From a Range I/2554.py	
+++ b/solutions/2554. Maximum Number of Integers to Choose From a Range I/2554.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxCount(self, banned: list[int], n: int, maxSum: int) -> int:
+  def maxCount(self, banned: List[int], n: int, maxSum: int) -> int:
     ans = 0
     summ = 0
     bannedSet = set(banned)
diff --git a/solutions/2555. Maximize Win From Two Segments/2555.py b/solutions/2555. Maximize Win From Two Segments/2555.py
index 3308aecc90d..bc3fd3f0a25 100644
--- a/solutions/2555. Maximize Win From Two Segments/2555.py	
+++ b/solutions/2555. Maximize Win From Two Segments/2555.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximizeWin(self, prizePositions: list[int], k: int) -> int:
+  def maximizeWin(self, prizePositions: List[int], k: int) -> int:
     ans = 0
     # dp[i] := the maximum number of prizes to choose the first i
     # `prizePositions`
diff --git a/solutions/2556. Disconnect Path in a Binary Matrix by at Most One Flip/2556.py b/solutions/2556. Disconnect Path in a Binary Matrix by at Most One Flip/2556.py
index 969ca56b9bf..30f1f4beb2f 100644
--- a/solutions/2556. Disconnect Path in a Binary Matrix by at Most One Flip/2556.py	
+++ b/solutions/2556. Disconnect Path in a Binary Matrix by at Most One Flip/2556.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isPossibleToCutPath(self, grid: list[list[int]]) -> bool:
+  def isPossibleToCutPath(self, grid: List[List[int]]) -> bool:
     # Returns True is there's a path from (0, 0) to (m - 1, n - 1).
     # Also marks the visited path as 0 except (m - 1, n - 1).
     def hasPath(i: int, j: int) -> bool:
diff --git a/solutions/2557. Maximum Number of Integers to Choose From a Range II/2557.py b/solutions/2557. Maximum Number of Integers to Choose From a Range II/2557.py
index 288ccd177c5..2cdfb19f6d9 100644
--- a/solutions/2557. Maximum Number of Integers to Choose From a Range II/2557.py	
+++ b/solutions/2557. Maximum Number of Integers to Choose From a Range II/2557.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxCount(self, banned: list[int], n: int, maxSum: int) -> int:
+  def maxCount(self, banned: List[int], n: int, maxSum: int) -> int:
     bannedSet = set(banned)
     l = 1
     r = n
@@ -14,5 +14,5 @@ def maxCount(self, banned: list[int], n: int, maxSum: int) -> int:
     return l - sum(b <= l for b in banned)
 
   # Returns sum([1..m]) - sum(bannedSet).
-  def _getSum(self, bannedSet: set[int], m: int) -> int:
+  def _getSum(self, bannedSet: Set[int], m: int) -> int:
     return m * (m + 1) // 2 - sum(b for b in bannedSet if b <= m)
diff --git a/solutions/2558. Take Gifts From the Richest Pile/2558.py b/solutions/2558. Take Gifts From the Richest Pile/2558.py
index 6a75a54cc52..8cac95b187c 100644
--- a/solutions/2558. Take Gifts From the Richest Pile/2558.py	
+++ b/solutions/2558. Take Gifts From the Richest Pile/2558.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def pickGifts(self, gifts: list[int], k: int) -> int:
+  def pickGifts(self, gifts: List[int], k: int) -> int:
     maxHeap = [-gift for gift in gifts]
     heapq.heapify(maxHeap)
 
diff --git a/solutions/2559. Count Vowel Strings in Ranges/2559.py b/solutions/2559. Count Vowel Strings in Ranges/2559.py
index 678e7b66947..2a07fa92754 100644
--- a/solutions/2559. Count Vowel Strings in Ranges/2559.py	
+++ b/solutions/2559. Count Vowel Strings in Ranges/2559.py	
@@ -1,15 +1,11 @@
 class Solution:
-  def vowelStrings(
-      self,
-      words: list[str],
-      queries: list[list[int]],
-  ) -> list[int]:
-    VOWELS = 'aeiou'
+  def vowelStrings(self, words: List[str], queries: List[List[int]]) -> List[int]:
+    kVowels = 'aeiou'
     # prefix[i] := the number of the first i words that start with and end in a vowel
     prefix = [0] * (len(words) + 1)
 
     for i, word in enumerate(words):
-      prefix[i + 1] += prefix[i] + (word[0] in VOWELS and word[-1] in VOWELS)
+      prefix[i + 1] += prefix[i] + (word[0] in kVowels and word[-1] in kVowels)
 
     return [prefix[r + 1] - prefix[l]
             for l, r in queries]
diff --git a/solutions/256. Paint House/256.py b/solutions/256. Paint House/256.py
index 8cac76eff0c..75d91582c91 100644
--- a/solutions/256. Paint House/256.py	
+++ b/solutions/256. Paint House/256.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minCost(self, costs: list[list[int]]) -> list[list[int]]:
+  def minCost(self, costs: List[List[int]]) -> List[List[int]]:
     for i in range(1, len(costs)):
       costs[i][0] += min(costs[i - 1][1], costs[i - 1][2])
       costs[i][1] += min(costs[i - 1][0], costs[i - 1][2])
diff --git a/solutions/2560. House Robber IV/2560.py b/solutions/2560. House Robber IV/2560.py
index 71dfb59d698..3e5b3aa1564 100644
--- a/solutions/2560. House Robber IV/2560.py	
+++ b/solutions/2560. House Robber IV/2560.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minCapability(self, nums: list[int], k: int) -> int:
+  def minCapability(self, nums: List[int], k: int) -> int:
     def numStolenHouses(capacity: int) -> int:
       stolenHouses = 0
       i = 0
@@ -10,4 +10,5 @@ def numStolenHouses(capacity: int) -> int:
         i += 1
       return stolenHouses
 
-    return bisect.bisect_left(range(max(nums)), k, key=numStolenHouses)
+    return bisect.bisect_left(range(max(nums)), k,
+                              key=lambda m: numStolenHouses(m))
diff --git a/solutions/2561. Rearranging Fruits/2561.cpp b/solutions/2561. Rearranging Fruits/2561.cpp
index cc075f9e9ad..d7965278fb2 100644
--- a/solutions/2561. Rearranging Fruits/2561.cpp	
+++ b/solutions/2561. Rearranging Fruits/2561.cpp	
@@ -20,8 +20,9 @@ class Solution {
     const int minNum = min(ranges::min(basket1), ranges::min(basket2));
     const auto midIt = swapped.begin() + swapped.size() / 2;
     nth_element(swapped.begin(), midIt, swapped.end());
-    return accumulate(swapped.begin(), midIt, 0L, [minNum](long acc, int num) {
-      return acc + min(2 * minNum, num);
+    return accumulate(swapped.begin(), midIt, 0L,
+                      [minNum](long subtotal, int num) {
+      return subtotal + min(2 * minNum, num);
     });
   }
 };
diff --git a/solutions/2561. Rearranging Fruits/2561.py b/solutions/2561. Rearranging Fruits/2561.py
index 8f25e7e148a..9070bd04275 100644
--- a/solutions/2561. Rearranging Fruits/2561.py	
+++ b/solutions/2561. Rearranging Fruits/2561.py	
@@ -1,17 +1,18 @@
 class Solution:
-  def minCost(self, basket1: list[int], basket2: list[int]) -> int:
+  def minCost(self, basket1: List[int], basket2: List[int]) -> int:
     swapped = []
     count = collections.Counter(basket1)
     count.subtract(collections.Counter(basket2))
-
+    
     for num, freq in count.items():
       if freq % 2 != 0:
         return -1
       swapped += [num] * abs(freq // 2)
-
+    
     swapped.sort()
     minNum = min(min(basket1), min(basket2))
     # Other than directly swap basket1[i] and basket2[j], we can swap basket1[i]
     # with `minNum` first then swap `minNum` with basket2[j], and vice versa.
     # That's why we take min(2 * minNum, num) in the below.
     return sum(min(2 * minNum, num) for num in swapped[0:len(swapped) // 2])
+  
\ No newline at end of file
diff --git a/solutions/2563. Count the Number of Fair Pairs/2563.py b/solutions/2563. Count the Number of Fair Pairs/2563.py
index a051b2a7862..2e9c41d2ded 100644
--- a/solutions/2563. Count the Number of Fair Pairs/2563.py	
+++ b/solutions/2563. Count the Number of Fair Pairs/2563.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countFairPairs(self, nums: list[int], lower: int, upper: int) -> int:
+  def countFairPairs(self, nums: List[int], lower: int, upper: int) -> int:
     # nums[i] + nums[j] == nums[j] + nums[i], so the condition that i < j
     # degrades to i != j and we can sort the array.
     nums.sort()
diff --git a/solutions/2564. Substring XOR Queries/2564.java b/solutions/2564. Substring XOR Queries/2564.java
index 19011dcec03..60feb4c56d2 100644
--- a/solutions/2564. Substring XOR Queries/2564.java	
+++ b/solutions/2564. Substring XOR Queries/2564.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int[][] substringXorQueries(String s, int[][] queries) {
-    final int MAX_BIT = 30;
+    final int kMaxBit = 30;
     int[][] ans = new int[queries.length][2];
     // {val: (left, right)} := s[left..right]'s decimal value = val
     Map<Integer, Pair<Integer, Integer>> valToLeftAndRight = new HashMap<>();
@@ -13,7 +13,7 @@ public int[][] substringXorQueries(String s, int[][] queries) {
           valToLeftAndRight.put(val, new Pair<>(left, left));
         continue;
       }
-      final int maxRight = Math.min(s.length(), left + MAX_BIT);
+      final int maxRight = Math.min(s.length(), left + kMaxBit);
       for (int right = left; right < maxRight; ++right) {
         val = val * 2 + s.charAt(right) - '0';
         if (!valToLeftAndRight.containsKey(val))
diff --git a/solutions/2564. Substring XOR Queries/2564.py b/solutions/2564. Substring XOR Queries/2564.py
index ee9c114c7da..82be4f92a50 100644
--- a/solutions/2564. Substring XOR Queries/2564.py	
+++ b/solutions/2564. Substring XOR Queries/2564.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def substringXorQueries(self, s: str, queries: list[list[int]]) -> list[list[int]]:
-    MAX_BIT = 30
+  def substringXorQueries(self, s: str, queries: List[List[int]]) -> List[List[int]]:
+    kMaxBit = 30
     # {val: [left, right]} := s[left..right]'s decimal value = val
     valToLeftAndRight = collections.defaultdict(lambda: [-1, -1])
 
@@ -11,7 +11,7 @@ def substringXorQueries(self, s: str, queries: list[list[int]]) -> list[list[int
         if 0 not in valToLeftAndRight:
           valToLeftAndRight[0] = [left, left]
         continue
-      for right in range(left, min(len(s), left + MAX_BIT)):
+      for right in range(left, min(len(s), left + kMaxBit)):
         val = val * 2 + int(s[right])
         if val not in valToLeftAndRight:
           valToLeftAndRight[val] = [left, right]
diff --git a/solutions/2567. Minimum Score by Changing Two Elements/2567.py b/solutions/2567. Minimum Score by Changing Two Elements/2567.py
index 4242b8e4dd3..86ae2f8170a 100644
--- a/solutions/2567. Minimum Score by Changing Two Elements/2567.py	
+++ b/solutions/2567. Minimum Score by Changing Two Elements/2567.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimizeSum(self, nums: list[int]) -> int:
+  def minimizeSum(self, nums: List[int]) -> int:
     nums.sort()
     # Can always change the number to any other number in `nums`, so `low` becomes 0.
     # Thus, rephrase the problem as finding the minimum `high`.
diff --git a/solutions/2568. Minimum Impossible OR/2568.py b/solutions/2568. Minimum Impossible OR/2568.py
index d046d29a5d2..aadedca8333 100644
--- a/solutions/2568. Minimum Impossible OR/2568.py	
+++ b/solutions/2568. Minimum Impossible OR/2568.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minImpossibleOR(self, nums: list[int]) -> int:
+  def minImpossibleOR(self, nums: List[int]) -> int:
     ans = 1
     numsSet = set(nums)
 
diff --git a/solutions/257. Binary Tree Paths/257.cpp b/solutions/257. Binary Tree Paths/257.cpp
index ec800b60e42..ead8b4b5988 100644
--- a/solutions/257. Binary Tree Paths/257.cpp	
+++ b/solutions/257. Binary Tree Paths/257.cpp	
@@ -16,8 +16,8 @@ class Solution {
     }
 
     path.push_back(to_string(root->val) + "->");
-    dfs(root->left, std::move(path), ans);
-    dfs(root->right, std::move(path), ans);
+    dfs(root->left, move(path), ans);
+    dfs(root->right, move(path), ans);
     path.pop_back();
   }
 
diff --git a/solutions/257. Binary Tree Paths/257.py b/solutions/257. Binary Tree Paths/257.py
index 1f11b6d5df0..e467253b8d0 100644
--- a/solutions/257. Binary Tree Paths/257.py	
+++ b/solutions/257. Binary Tree Paths/257.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def binaryTreePaths(self, root: TreeNode | None) -> list[str]:
+  def binaryTreePaths(self, root: Optional[TreeNode]) -> List[str]:
     ans = []
 
-    def dfs(root: TreeNode | None, path: list[str]) -> None:
+    def dfs(root: Optional[TreeNode], path: List[str]) -> None:
       if not root:
         return
       if not root.left and not root.right:
diff --git a/solutions/2570. Merge Two 2D Arrays by Summing Values/2570.java b/solutions/2570. Merge Two 2D Arrays by Summing Values/2570.java
index 257e44785fd..04ad4af2056 100644
--- a/solutions/2570. Merge Two 2D Arrays by Summing Values/2570.java	
+++ b/solutions/2570. Merge Two 2D Arrays by Summing Values/2570.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int[][] mergeArrays(int[][] nums1, int[][] nums2) {
-    final int MAX = 1000;
+    final int kMax = 1000;
     List<int[]> ans = new ArrayList<>();
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     addCount(nums1, count);
     addCount(nums2, count);
 
-    for (int i = 1; i <= MAX; ++i)
+    for (int i = 1; i <= kMax; ++i)
       if (count[i] > 0)
         ans.add(new int[] {i, count[i]});
 
diff --git a/solutions/2570. Merge Two 2D Arrays by Summing Values/2570.py b/solutions/2570. Merge Two 2D Arrays by Summing Values/2570.py
index ef16936b203..22ae0618ec5 100644
--- a/solutions/2570. Merge Two 2D Arrays by Summing Values/2570.py	
+++ b/solutions/2570. Merge Two 2D Arrays by Summing Values/2570.py	
@@ -1,11 +1,10 @@
 class Solution:
-  def mergeArrays(self, nums1: list[list[int]],
-                  nums2: list[list[int]]) -> list[list[int]]:
+  def mergeArrays(self, nums1: List[List[int]], nums2: List[List[int]]) -> List[List[int]]:
     count = [0] * (1001)
     self._addCount(nums1, count)
     self._addCount(nums2, count)
     return [[i, c] for i, c in enumerate(count) if c > 0]
 
-  def _addCount(self, nums: list[list[int]], count: list[int]) -> None:
+  def _addCount(self, nums: List[List[int]], count: List[int]) -> None:
     for id_, val in nums:
       count[id_] += val
diff --git a/solutions/2572. Count the Number of Square-Free Subsets/2572.java b/solutions/2572. Count the Number of Square-Free Subsets/2572.java
index b04f3d82cff..dc58cebf3e5 100644
--- a/solutions/2572. Count the Number of Square-Free Subsets/2572.java	
+++ b/solutions/2572. Count the Number of Square-Free Subsets/2572.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int squareFreeSubsets(int[] nums) {
-    Integer[][] mem = new Integer[nums.length][1 << (PRIMES_COUNT + 1)];
+    Integer[][] mem = new Integer[nums.length][1 << (kPrimesCount + 1)];
     int[] masks = new int[nums.length];
 
     for (int i = 0; i < nums.length; ++i)
@@ -8,11 +8,11 @@ public int squareFreeSubsets(int[] nums) {
 
     // -1 means that we take no number.
     // `used` is initialized to 1 so that -1 & 1 = 1 instead of 0.
-    return (squareFreeSubsets(masks, 0, /*used=*/1, mem) - 1 + MOD) % MOD;
+    return (squareFreeSubsets(masks, 0, /*used=*/1, mem) - 1 + kMod) % kMod;
   }
 
-  private static final int MOD = 1_000_000_007;
-  private static final int PRIMES_COUNT = 10;
+  private static final int kMod = 1_000_000_007;
+  private static final int kPrimesCount = 10;
   private static final int[] primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};
 
   private int squareFreeSubsets(int[] masks, int i, int used, Integer[][] mem) {
@@ -23,7 +23,7 @@ private int squareFreeSubsets(int[] masks, int i, int used, Integer[][] mem) {
     final int pick =
         (masks[i] & used) == 0 ? squareFreeSubsets(masks, i + 1, used | masks[i], mem) : 0;
     final int skip = squareFreeSubsets(masks, i + 1, used, mem);
-    return mem[i][used] = (pick + skip) % MOD;
+    return mem[i][used] = (pick + skip) % kMod;
   }
 
   // e.g. num = 10 = 2 * 5, so mask = 0b101 -> 0b1010 (append a 0)
diff --git a/solutions/2572. Count the Number of Square-Free Subsets/2572.py b/solutions/2572. Count the Number of Square-Free Subsets/2572.py
index 914770cb688..39528fbb353 100644
--- a/solutions/2572. Count the Number of Square-Free Subsets/2572.py	
+++ b/solutions/2572. Count the Number of Square-Free Subsets/2572.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def squareFreeSubsets(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
+  def squareFreeSubsets(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
     primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
 
     def getMask(num: int) -> int:
@@ -29,8 +29,8 @@ def dp(i: int, used: int) -> int:
         return 1
       pick = dp(i + 1, used | masks[i]) if (masks[i] & used) == 0 else 0
       skip = dp(i + 1, used)
-      return (pick + skip) % MOD
+      return (pick + skip) % kMod
 
     # -1 means that we take no number.
     # `used` is initialized to 1 so that -1 & 1 = 1 instead of 0.
-    return (dp(0, 1) - 1 + MOD) % MOD
+    return (dp(0, 1) - 1 + kMod) % kMod
diff --git a/solutions/2574. Left and Right Sum Differences/2574-2.py b/solutions/2574. Left and Right Sum Differences/2574-2.py
index f9102bc3ee1..235bec998ee 100644
--- a/solutions/2574. Left and Right Sum Differences/2574-2.py	
+++ b/solutions/2574. Left and Right Sum Differences/2574-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def leftRigthDifference(self, nums: list[int]) -> list[int]:
+  def leftRigthDifference(self, nums: List[int]) -> List[int]:
     ans = []
     leftSum = 0
     rightSum = sum(nums)
diff --git a/solutions/2574. Left and Right Sum Differences/2574.py b/solutions/2574. Left and Right Sum Differences/2574.py
index dc62dc78a09..03c52541a3a 100644
--- a/solutions/2574. Left and Right Sum Differences/2574.py	
+++ b/solutions/2574. Left and Right Sum Differences/2574.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def leftRigthDifference(self, nums: list[int]) -> list[int]:
+  def leftRigthDifference(self, nums: List[int]) -> List[int]:
     n = len(nums)
     leftSum = [0] * n
     rightSum = [0] * n
diff --git a/solutions/2575. Find the Divisibility Array of a String/2575.py b/solutions/2575. Find the Divisibility Array of a String/2575.py
index 234886d668c..66ea7b8c472 100644
--- a/solutions/2575. Find the Divisibility Array of a String/2575.py	
+++ b/solutions/2575. Find the Divisibility Array of a String/2575.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def divisibilityArray(self, word: str, m: int) -> list[int]:
+  def divisibilityArray(self, word: str, m: int) -> List[int]:
     ans = []
     prevRemainder = 0
 
diff --git a/solutions/2576. Find the Maximum Number of Marked Indices/2576-2.py b/solutions/2576. Find the Maximum Number of Marked Indices/2576-2.py
index b02502802ac..2479d620cf2 100644
--- a/solutions/2576. Find the Maximum Number of Marked Indices/2576-2.py	
+++ b/solutions/2576. Find the Maximum Number of Marked Indices/2576-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxNumOfMarkedIndices(self, nums: list[int]) -> int:
+  def maxNumOfMarkedIndices(self, nums: List[int]) -> int:
     nums.sort()
 
     i = 0
diff --git a/solutions/2576. Find the Maximum Number of Marked Indices/2576.py b/solutions/2576. Find the Maximum Number of Marked Indices/2576.py
index 3ca0e0490c3..8996de0b969 100644
--- a/solutions/2576. Find the Maximum Number of Marked Indices/2576.py	
+++ b/solutions/2576. Find the Maximum Number of Marked Indices/2576.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxNumOfMarkedIndices(self, nums: list[int]) -> int:
+  def maxNumOfMarkedIndices(self, nums: List[int]) -> int:
     nums.sort()
 
     def isPossible(m: int) -> bool:
diff --git a/solutions/2577. Minimum Time to Visit a Cell In a Grid/2577.cpp b/solutions/2577. Minimum Time to Visit a Cell In a Grid/2577.cpp
index b25dce0b116..f7ce480fe84 100644
--- a/solutions/2577. Minimum Time to Visit a Cell In a Grid/2577.cpp	
+++ b/solutions/2577. Minimum Time to Visit a Cell In a Grid/2577.cpp	
@@ -4,7 +4,7 @@ class Solution {
     if (grid[0][1] > 1 && grid[1][0] > 1)
       return -1;
 
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = grid.size();
     const int n = grid[0].size();
     using T = tuple<int, int, int>;  // (time, i, j)
@@ -19,7 +19,7 @@ class Solution {
       minHeap.pop();
       if (i == m - 1 && j == n - 1)
         return time;
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/2577. Minimum Time to Visit a Cell In a Grid/2577.java b/solutions/2577. Minimum Time to Visit a Cell In a Grid/2577.java
index bb6cad38299..87f74ef36cd 100644
--- a/solutions/2577. Minimum Time to Visit a Cell In a Grid/2577.java	
+++ b/solutions/2577. Minimum Time to Visit a Cell In a Grid/2577.java	
@@ -3,13 +3,14 @@ public int minimumTime(int[][] grid) {
     if (grid[0][1] > 1 && grid[1][0] > 1)
       return -1;
 
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = grid.length;
     final int n = grid[0].length;
-    Queue<int[]> minHeap = new PriorityQueue<>(Comparator.comparingInt(a -> a[0])) {
-      { offer(new int[] {0, 0, 0}); } // (time, i, j)
-    };
+    // (time, i, j)
+    Queue<int[]> minHeap = new PriorityQueue<>((a, b) -> a[0] - b[0]);
     boolean[][] seen = new boolean[m][n];
+
+    minHeap.offer(new int[] {0, 0, 0});
     seen[0][0] = true;
 
     while (!minHeap.isEmpty()) {
@@ -18,7 +19,7 @@ public int minimumTime(int[][] grid) {
       final int j = minHeap.poll()[2];
       if (i == m - 1 && j == n - 1)
         return time;
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/2577. Minimum Time to Visit a Cell In a Grid/2577.py b/solutions/2577. Minimum Time to Visit a Cell In a Grid/2577.py
index b8278588e34..9845e7a147b 100644
--- a/solutions/2577. Minimum Time to Visit a Cell In a Grid/2577.py	
+++ b/solutions/2577. Minimum Time to Visit a Cell In a Grid/2577.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def minimumTime(self, grid: list[list[int]]) -> int:
+  def minimumTime(self, grid: List[List[int]]) -> int:
     if grid[0][1] > 1 and grid[1][0] > 1:
       return -1
 
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
     minHeap = [(0, 0, 0)]  # (time, i, j)
@@ -13,7 +13,7 @@ def minimumTime(self, grid: list[list[int]]) -> int:
       time, i, j = heapq.heappop(minHeap)
       if i == m - 1 and j == n - 1:
         return time
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/2580. Count Ways to Group Overlapping Ranges/2580.java b/solutions/2580. Count Ways to Group Overlapping Ranges/2580.java
index 1978f911218..9ef61d62baf 100644
--- a/solutions/2580. Count Ways to Group Overlapping Ranges/2580.java	
+++ b/solutions/2580. Count Ways to Group Overlapping Ranges/2580.java	
@@ -1,16 +1,16 @@
 class Solution {
   public int countWays(int[][] ranges) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int ans = 1;
     int prevEnd = -1;
 
-    Arrays.sort(ranges, Comparator.comparingInt(range -> range[0]));
+    Arrays.sort(ranges, (a, b) -> a[0] - b[0]);
 
     for (int[] range : ranges) {
       final int start = range[0];
       final int end = range[1];
       if (start > prevEnd)
-        ans = ans * 2 % MOD;
+        ans = ans * 2 % kMod;
       prevEnd = Math.max(prevEnd, end);
     }
 
diff --git a/solutions/2580. Count Ways to Group Overlapping Ranges/2580.py b/solutions/2580. Count Ways to Group Overlapping Ranges/2580.py
index 0ff7b443cc0..2684dbd191c 100644
--- a/solutions/2580. Count Ways to Group Overlapping Ranges/2580.py	
+++ b/solutions/2580. Count Ways to Group Overlapping Ranges/2580.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def countWays(self, ranges: list[list[int]]) -> int:
-    MOD = 1_000_000_007
+  def countWays(self, ranges: List[List[int]]) -> int:
+    kMod = 1_000_000_007
     ans = 1
     prevEnd = -1
 
     for start, end in sorted(ranges):
       if start > prevEnd:
-        ans = ans * 2 % MOD
+        ans = ans * 2 % kMod
       prevEnd = max(prevEnd, end)
 
     return ans
diff --git a/solutions/2581. Count Number of Possible Root Nodes/2581.py b/solutions/2581. Count Number of Possible Root Nodes/2581.py
index 691fe186ab4..d938935ff37 100644
--- a/solutions/2581. Count Number of Possible Root Nodes/2581.py	
+++ b/solutions/2581. Count Number of Possible Root Nodes/2581.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def rootCount(
-      self,
-      edges: list[list[int]],
-      guesses: list[list[int]],
-      k: int,
-  ) -> int:
+  def rootCount(self, edges: List[List[int]], guesses: List[List[int]], k: int) -> int:
     ans = 0
     n = len(edges) + 1
     graph = [[] for _ in range(n)]
diff --git a/solutions/2583. Kth Largest Sum in a Binary Tree/2583.py b/solutions/2583. Kth Largest Sum in a Binary Tree/2583.py
index b9eb9b12ab7..e84dee17aca 100644
--- a/solutions/2583. Kth Largest Sum in a Binary Tree/2583.py	
+++ b/solutions/2583. Kth Largest Sum in a Binary Tree/2583.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def kthLargestLevelSum(self, root: TreeNode | None, k: int) -> int:
+  def kthLargestLevelSum(self, root: Optional[TreeNode], k: int) -> int:
     levelSums = []
 
-    def dfs(root: TreeNode | None, level: int) -> None:
+    def dfs(root: Optional[TreeNode], level: int) -> None:
       if not root:
         return
       if len(levelSums) == level:
diff --git a/solutions/2584. Split the Array to Make Coprime Products/2584.py b/solutions/2584. Split the Array to Make Coprime Products/2584.py
index aee676c569f..66906c3eaf8 100644
--- a/solutions/2584. Split the Array to Make Coprime Products/2584.py	
+++ b/solutions/2584. Split the Array to Make Coprime Products/2584.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def findValidSplit(self, nums: list[int]) -> int:
+  def findValidSplit(self, nums: List[int]) -> int:
     leftPrimeFactors = collections.Counter()
     rightPrimeFactors = collections.Counter()
 
-    def getPrimeFactors(num: int) -> list[int]:
+    def getPrimeFactors(num: int) -> List[int]:
       """Gets the prime factors under sqrt(10^6)."""
       primeFactors = []
       for divisor in range(2, min(1000, num) + 1):
diff --git a/solutions/2585. Number of Ways to Earn Points/2585-2.java b/solutions/2585. Number of Ways to Earn Points/2585-2.java
index 1dce1b9e23d..8d36c1d1408 100644
--- a/solutions/2585. Number of Ways to Earn Points/2585-2.java	
+++ b/solutions/2585. Number of Ways to Earn Points/2585-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int waysToReachTarget(int target, int[][] types) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[j] := the number of ways to earn j points with the types so far
     int[] dp = new int[target + 1];
     dp[0] = 1;
@@ -12,7 +12,7 @@ public int waysToReachTarget(int target, int[][] types) {
         for (int solved = 1; solved <= count; ++solved)
           if (j - solved * mark >= 0) {
             dp[j] += dp[j - solved * mark];
-            dp[j] %= MOD;
+            dp[j] %= kMod;
           }
     }
 
diff --git a/solutions/2585. Number of Ways to Earn Points/2585-2.py b/solutions/2585. Number of Ways to Earn Points/2585-2.py
index 99ba972cdcd..bb68e9a9fc8 100644
--- a/solutions/2585. Number of Ways to Earn Points/2585-2.py	
+++ b/solutions/2585. Number of Ways to Earn Points/2585-2.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def waysToReachTarget(self, target: int, types: list[list[int]]) -> int:
-    MOD = 1_000_000_007
+  def waysToReachTarget(self, target: int, types: List[List[int]]) -> int:
+    kMod = 1_000_000_007
     # dp[j] := the number of ways to earn j points with the types so far
     dp = [1] + [0] * target
 
@@ -9,6 +9,6 @@ def waysToReachTarget(self, target: int, types: list[list[int]]) -> int:
         for solved in range(1, count + 1):
           if j - solved * mark >= 0:
             dp[j] += dp[j - solved * mark]
-            dp[j] %= MOD
+            dp[j] %= kMod
 
     return dp[target]
diff --git a/solutions/2585. Number of Ways to Earn Points/2585.java b/solutions/2585. Number of Ways to Earn Points/2585.java
index 7fe351ac9dd..43125eca9c5 100644
--- a/solutions/2585. Number of Ways to Earn Points/2585.java	
+++ b/solutions/2585. Number of Ways to Earn Points/2585.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int waysToReachTarget(int target, int[][] types) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i][j] := the number of ways to earn j points with the first i types
     int[][] dp = new int[types.length + 1][target + 1];
     dp[0][0] = 1;
@@ -12,7 +12,7 @@ public int waysToReachTarget(int target, int[][] types) {
         for (int solved = 0; solved <= count; ++solved)
           if (j - solved * mark >= 0) {
             dp[i][j] += dp[i - 1][j - solved * mark];
-            dp[i][j] %= MOD;
+            dp[i][j] %= kMod;
           }
     }
 
diff --git a/solutions/2585. Number of Ways to Earn Points/2585.py b/solutions/2585. Number of Ways to Earn Points/2585.py
index 82438ae0940..d3e5330ce18 100644
--- a/solutions/2585. Number of Ways to Earn Points/2585.py	
+++ b/solutions/2585. Number of Ways to Earn Points/2585.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def waysToReachTarget(self, target: int, types: list[list[int]]) -> int:
-    MOD = 1_000_000_007
+  def waysToReachTarget(self, target: int, types: List[List[int]]) -> int:
+    kMod = 1_000_000_007
     # dp[i][j] := the number of ways to earn j points with the first i types
     dp = [[0] * (target + 1) for _ in range(len(types) + 1)]
     dp[0][0] = 1
@@ -12,6 +12,6 @@ def waysToReachTarget(self, target: int, types: list[list[int]]) -> int:
         for solved in range(count + 1):
           if j - solved * mark >= 0:
             dp[i][j] += dp[i - 1][j - solved * mark]
-            dp[i][j] %= MOD
+            dp[i][j] %= kMod
 
     return dp[len(types)][target]
diff --git a/solutions/2586. Count the Number of Vowel Strings in Range/2586.cpp b/solutions/2586. Count the Number of Vowel Strings in Range/2586.cpp
index ffeff3997f6..2e209ea4e06 100644
--- a/solutions/2586. Count the Number of Vowel Strings in Range/2586.cpp	
+++ b/solutions/2586. Count the Number of Vowel Strings in Range/2586.cpp	
@@ -2,7 +2,7 @@ class Solution {
  public:
   int vowelStrings(vector<string>& words, int left, int right) {
     return count_if(words.begin() + left, words.begin() + right + 1,
-                    [this](const string& word) {
+                    [=](const string& word) {
       return isVowel(word.front()) && isVowel(word.back());
     });
   }
diff --git a/solutions/2586. Count the Number of Vowel Strings in Range/2586.py b/solutions/2586. Count the Number of Vowel Strings in Range/2586.py
index 10338f792bd..577c92feb68 100644
--- a/solutions/2586. Count the Number of Vowel Strings in Range/2586.py	
+++ b/solutions/2586. Count the Number of Vowel Strings in Range/2586.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def vowelStrings(self, words: list[str], left: int, right: int) -> int:
-    VOWELS = 'aeiou'
-    return sum(word[0] in VOWELS and word[-1] in VOWELS
+  def vowelStrings(self, words: List[str], left: int, right: int) -> int:
+    kVowels = 'aeiou'
+    return sum(word[0] in kVowels and word[-1] in kVowels
                for word in words[left:right + 1])
diff --git a/solutions/2587. Rearrange Array to Maximize Prefix Score/2587.py b/solutions/2587. Rearrange Array to Maximize Prefix Score/2587.py
index 22bba77e1c2..05d88fa7c47 100644
--- a/solutions/2587. Rearrange Array to Maximize Prefix Score/2587.py	
+++ b/solutions/2587. Rearrange Array to Maximize Prefix Score/2587.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def maxScore(self, nums: list[int]) -> int:
+  def maxScore(self, nums: List[int]) -> int:
     return sum(num > 0
                for num in itertools.accumulate(sorted(nums, reverse=True)))
diff --git a/solutions/2588. Count the Number of Beautiful Subarrays/2588.py b/solutions/2588. Count the Number of Beautiful Subarrays/2588.py
index a79ebb93d8d..b08ee4aaf9d 100644
--- a/solutions/2588. Count the Number of Beautiful Subarrays/2588.py	
+++ b/solutions/2588. Count the Number of Beautiful Subarrays/2588.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def beautifulSubarrays(self, nums: list[int]) -> int:
+  def beautifulSubarrays(self, nums: List[int]) -> int:
     # A subarray is beautiful if xor(subarray) = 0.
     ans = 0
     prefix = 0
diff --git a/solutions/2589. Minimum Time to Complete All Tasks/2589.java b/solutions/2589. Minimum Time to Complete All Tasks/2589.java
index 762960a8712..7d8b1472ec2 100644
--- a/solutions/2589. Minimum Time to Complete All Tasks/2589.java	
+++ b/solutions/2589. Minimum Time to Complete All Tasks/2589.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int findMinimumTime(int[][] tasks) {
-    final int MAX = 2000;
-    boolean[] running = new boolean[MAX + 1];
+    final int kMax = 2000;
+    boolean[] running = new boolean[kMax + 1];
 
     // Sort tasks by end.
-    Arrays.sort(tasks, Comparator.comparingInt(task -> task[1]));
+    Arrays.sort(tasks, (a, b) -> a[1] - b[1]);
 
     for (int[] task : tasks) {
       final int start = task[0];
diff --git a/solutions/2589. Minimum Time to Complete All Tasks/2589.py b/solutions/2589. Minimum Time to Complete All Tasks/2589.py
index 3ae6cc09f20..5e88a8dd9cf 100644
--- a/solutions/2589. Minimum Time to Complete All Tasks/2589.py	
+++ b/solutions/2589. Minimum Time to Complete All Tasks/2589.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def findMinimumTime(self, tasks: list[list[int]]) -> int:
-    MAX = 2000
-    running = [False] * (MAX + 1)
+  def findMinimumTime(self, tasks: List[List[int]]) -> int:
+    kMax = 2000
+    running = [False] * (kMax + 1)
 
     # Sort tasks by end.
     for start, end, duration in sorted(tasks, key=lambda x: x[1]):
-      neededDuration = (duration -
-                        sum(running[i] for i in range(start, end + 1)))
+      neededDuration = duration - \
+          sum(running[i] for i in range(start, end + 1))
       # Greedily run the task as late as possible so that later tasks can run
       # simultaneously.
       i = end
diff --git a/solutions/259. 3Sum Smaller/259.py b/solutions/259. 3Sum Smaller/259.py
index 90723640011..35474ec85d2 100644
--- a/solutions/259. 3Sum Smaller/259.py	
+++ b/solutions/259. 3Sum Smaller/259.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def threeSumSmaller(self, nums: list[int], target: int) -> int:
+  def threeSumSmaller(self, nums: List[int], target: int) -> int:
     if len(nums) < 3:
       return 0
 
diff --git a/solutions/2590. Design a Todo List/2590.java b/solutions/2590. Design a Todo List/2590.java
index 75fcccc505b..136919bd0cf 100644
--- a/solutions/2590. Design a Todo List/2590.java	
+++ b/solutions/2590. Design a Todo List/2590.java	
@@ -41,7 +41,7 @@ private record Task(String taskDescription, int dueDate, List<String> tags) {}
   private List<Task> getTasksSortedByDueDate(int userId) {
     if (!userIdToTaskIdToTasks.containsKey(userId))
       return new ArrayList<>();
-    TreeSet<Task> tasks = new TreeSet<>(Comparator.comparingInt(Task::dueDate));
+    TreeSet<Task> tasks = new TreeSet<>((a, b) -> a.dueDate - b.dueDate);
     for (Task task : userIdToTaskIdToTasks.get(userId).values())
       tasks.add(task);
     return new ArrayList<>(tasks);
diff --git a/solutions/2590. Design a Todo List/2590.py b/solutions/2590. Design a Todo List/2590.py
index 44c8aac08c0..38e20163e7e 100644
--- a/solutions/2590. Design a Todo List/2590.py	
+++ b/solutions/2590. Design a Todo List/2590.py	
@@ -5,28 +5,27 @@
 class Task:
   taskDescription: str
   dueDate: int
-  tags: list[str]
+  tags: List[str]
 
 
 class TodoList:
   def __init__(self):
     self.taskId = 0
     self.taskIds = set()
-    self.userIdToTaskIdToTasks: dict[int, dict[int, list[Task]]] = {}
+    self.userIdToTaskIdToTasks: Dict[int, Dict[int, List[Task]]] = {}
 
-  def addTask(self, userId: int, taskDescription: str, dueDate: int,
-              tags: list[str]) -> int:
+  def addTask(self, userId: int, taskDescription: str, dueDate: int, tags: List[str]) -> int:
     self.taskId += 1
     taskIdToTasks = self.userIdToTaskIdToTasks.setdefault(userId, {})
     taskIdToTasks[self.taskId] = Task(taskDescription, dueDate, tags)
     self.taskIds.add(self.taskId)
     return self.taskId
 
-  def getAllTasks(self, userId: int) -> list[str]:
+  def getAllTasks(self, userId: int) -> List[str]:
     return [task.taskDescription
             for task in self._getTasksSortedByDueDate(userId)]
 
-  def getTasksForTag(self, userId: int, tag: str) -> list[str]:
+  def getTasksForTag(self, userId: int, tag: str) -> List[str]:
     return [task.taskDescription
             for task in self._getTasksSortedByDueDate(userId)
             if tag in task.tags]
@@ -41,10 +40,8 @@ def completeTask(self, userId: int, taskId: int) -> None:
       return
     del taskIdToTasks[taskId]
 
-  def _getTasksSortedByDueDate(self, userId: int) -> list[Task]:
+  def _getTasksSortedByDueDate(self, userId: int) -> List[Task]:
     if userId not in self.userIdToTaskIdToTasks:
       return []
     taskIdToTasks = self.userIdToTaskIdToTasks[userId]
-    return sorted(
-        [task for task in taskIdToTasks.values()],
-        key=lambda x: x.dueDate)
+    return sorted([task for task in taskIdToTasks.values()], key=lambda x: x.dueDate)
diff --git a/solutions/2592. Maximize Greatness of an Array/2592.py b/solutions/2592. Maximize Greatness of an Array/2592.py
index 53219b7b332..ad2e9907c5d 100644
--- a/solutions/2592. Maximize Greatness of an Array/2592.py	
+++ b/solutions/2592. Maximize Greatness of an Array/2592.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximizeGreatness(self, nums: list[int]) -> int:
+  def maximizeGreatness(self, nums: List[int]) -> int:
     ans = 0
 
     nums.sort()
diff --git a/solutions/2593. Find Score of an Array After Marking All Elements/2593.cpp b/solutions/2593. Find Score of an Array After Marking All Elements/2593.cpp
index b35740bf266..129aa128b7f 100644
--- a/solutions/2593. Find Score of an Array After Marking All Elements/2593.cpp	
+++ b/solutions/2593. Find Score of an Array After Marking All Elements/2593.cpp	
@@ -2,13 +2,13 @@ class Solution {
  public:
   long long findScore(vector<int>& nums) {
     long ans = 0;
-    set<pair<int, int>> numAndIndexes;
+    set<pair<int, int>> numAndIndices;
     vector<bool> seen(nums.size());
 
     for (int i = 0; i < nums.size(); ++i)
-      numAndIndexes.insert({nums[i], i});
+      numAndIndices.insert({nums[i], i});
 
-    for (const auto& [num, i] : numAndIndexes) {
+    for (const auto& [num, i] : numAndIndices) {
       if (seen[i])
         continue;
       if (i > 0)
diff --git a/solutions/2593. Find Score of an Array After Marking All Elements/2593.java b/solutions/2593. Find Score of an Array After Marking All Elements/2593.java
index a6b6b20a151..5106bef22b5 100644
--- a/solutions/2593. Find Score of an Array After Marking All Elements/2593.java	
+++ b/solutions/2593. Find Score of an Array After Marking All Elements/2593.java	
@@ -1,15 +1,16 @@
 class Solution {
   public long findScore(int[] nums) {
     long ans = 0;
-    TreeSet<Pair<Integer, Integer>> numAndIndexes =
-        new TreeSet<>(Comparator.comparingInt(Pair<Integer, Integer>::getKey)
-                          .thenComparingInt(Pair<Integer, Integer>::getValue));
+    TreeSet<Pair<Integer, Integer>> numAndIndices =
+        new TreeSet<>((a, b)
+                          -> a.getKey().equals(b.getKey()) ? a.getValue() - b.getValue()
+                                                           : a.getKey() - b.getKey());
     boolean[] seen = new boolean[nums.length];
 
     for (int i = 0; i < nums.length; ++i)
-      numAndIndexes.add(new Pair<>(nums[i], i));
+      numAndIndices.add(new Pair<>(nums[i], i));
 
-    for (Pair<Integer, Integer> pair : numAndIndexes) {
+    for (Pair<Integer, Integer> pair : numAndIndices) {
       final int num = pair.getKey();
       final int i = pair.getValue();
       if (seen[i])
diff --git a/solutions/2593. Find Score of an Array After Marking All Elements/2593.py b/solutions/2593. Find Score of an Array After Marking All Elements/2593.py
index d2636dc2d94..be70ee6ceb5 100644
--- a/solutions/2593. Find Score of an Array After Marking All Elements/2593.py	
+++ b/solutions/2593. Find Score of an Array After Marking All Elements/2593.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findScore(self, nums: list[int]) -> int:
+  def findScore(self, nums: List[int]) -> int:
     ans = 0
     seen = set()
 
diff --git a/solutions/2594. Minimum Time to Repair Cars/2594.py b/solutions/2594. Minimum Time to Repair Cars/2594.py
index 9d4525075c2..97171e890dd 100644
--- a/solutions/2594. Minimum Time to Repair Cars/2594.py	
+++ b/solutions/2594. Minimum Time to Repair Cars/2594.py	
@@ -1,9 +1,10 @@
 class Solution:
-  def repairCars(self, ranks: list[int], cars: int) -> int:
+  def repairCars(self, ranks: List[int], cars: int) -> int:
     def numCarsFixed(minutes: int) -> int:
       #    r * n^2 = minutes
       # -> n = sqrt(minutes / r)
       return sum(math.isqrt(minutes // rank) for rank in ranks)
 
-    return bisect.bisect_left(range(min(ranks) * cars**2), cars,
-                              key=numCarsFixed)
+    return bisect.bisect_left(
+        range(0, min(ranks) * cars**2), cars,
+        key=lambda m: numCarsFixed(m))
diff --git a/solutions/2595. Number of Even and Odd Bits/2595.py b/solutions/2595. Number of Even and Odd Bits/2595.py
index 01a80adb2bc..5b84ec319f8 100644
--- a/solutions/2595. Number of Even and Odd Bits/2595.py	
+++ b/solutions/2595. Number of Even and Odd Bits/2595.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def evenOddBit(self, n: int) -> list[int]:
+  def evenOddBit(self, n: int) -> List[int]:
     ans = [0] * 2
     i = 0  # 0 := even, 1 := odd
 
diff --git a/solutions/2596. Check Knight Tour Configuration/2596.cpp b/solutions/2596. Check Knight Tour Configuration/2596.cpp
index 43d6087807d..d201c1794a6 100644
--- a/solutions/2596. Check Knight Tour Configuration/2596.cpp	
+++ b/solutions/2596. Check Knight Tour Configuration/2596.cpp	
@@ -1,9 +1,6 @@
 class Solution {
  public:
   bool checkValidGrid(vector<vector<int>>& grid) {
-    if (grid[0][0] != 0)
-      return false;
-
     const int n = grid.size();
     int i = 0;
     int j = 0;
@@ -21,14 +18,14 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[8][2] = {{-2, 1}, {-1, 2}, {1, 2},   {2, 1},
-                                      {2, -1}, {1, -2}, {-1, -2}, {-2, -1}};
+  const vector<pair<int, int>> dirs{{-2, 1}, {-1, 2}, {1, 2},   {2, 1},
+                                    {2, -1}, {1, -2}, {-1, -2}, {-2, -1}};
 
   // Returns (x, y), where grid[x][y] == target if (i, j) can reach target.
   pair<int, int> nextGrid(const vector<vector<int>>& grid, int i, int j,
                           int target) {
     const int n = grid.size();
-    for (const auto& [dx, dy] : kDirs) {
+    for (const auto& [dx, dy] : dirs) {
       const int x = i + dx;
       const int y = j + dy;
       if (x < 0 || x >= n || y < 0 || y >= n)
diff --git a/solutions/2596. Check Knight Tour Configuration/2596.java b/solutions/2596. Check Knight Tour Configuration/2596.java
index 8e735b1d02f..11e12d33346 100644
--- a/solutions/2596. Check Knight Tour Configuration/2596.java	
+++ b/solutions/2596. Check Knight Tour Configuration/2596.java	
@@ -1,8 +1,5 @@
 class Solution {
   public boolean checkValidGrid(int[][] grid) {
-    if (grid[0][0] != 0)
-      return false;
-
     final int n = grid.length;
     int i = 0;
     int j = 0;
@@ -21,13 +18,13 @@ public boolean checkValidGrid(int[][] grid) {
     return true;
   }
 
-  private static final int[][] DIRS = {{-2, 1}, {-1, 2}, {1, 2},   {2, 1},
+  private static final int[][] dirs = {{-2, 1}, {-1, 2}, {1, 2},   {2, 1},
                                        {2, -1}, {1, -2}, {-1, -2}, {-2, -1}};
 
   // Returns (x, y), where grid[x][y] == target if (i, j) can reach target.
   private Pair<Integer, Integer> nextGrid(int[][] grid, int i, int j, int target) {
     final int n = grid.length;
-    for (int[] dir : DIRS) {
+    for (int[] dir : dirs) {
       final int x = i + dir[0];
       final int y = j + dir[1];
       if (x < 0 || x >= n || y < 0 || y >= n)
diff --git a/solutions/2596. Check Knight Tour Configuration/2596.py b/solutions/2596. Check Knight Tour Configuration/2596.py
index 88f6b5ccb09..8413b5155c6 100644
--- a/solutions/2596. Check Knight Tour Configuration/2596.py	
+++ b/solutions/2596. Check Knight Tour Configuration/2596.py	
@@ -1,19 +1,16 @@
 class Solution:
-  def checkValidGrid(self, grid: list[list[int]]) -> bool:
-    if grid[0][0] != 0:
-      return False
-
-    DIRS = ((1, 2), (2, 1), (2, -1), (1, -2),
+  def checkValidGrid(self, grid: List[List[int]]) -> bool:
+    dirs = ((1, 2), (2, 1), (2, -1), (1, -2),
             (-1, -2), (-2, -1), (-2, 1), (-1, 2))
     n = len(grid)
     i = 0
     j = 0
 
-    def nextGrid(i: int, j: int, target: int) -> tuple[int, int]:
+    def nextGrid(i: int, j: int, target: int) -> Tuple[int, int]:
       """
       Returns (x, y), where grid[x][y] == target if (i, j) can reach target.
       """
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x >= n or y < 0 or y >= n:
diff --git a/solutions/2597. The Number of Beautiful Subsets/2597.cpp b/solutions/2597. The Number of Beautiful Subsets/2597.cpp
index 5324dc01dd2..c4377e73d86 100644
--- a/solutions/2597. The Number of Beautiful Subsets/2597.cpp	
+++ b/solutions/2597. The Number of Beautiful Subsets/2597.cpp	
@@ -31,8 +31,8 @@
 class Solution {
  public:
   int beautifulSubsets(vector<int>& nums, int k) {
-    constexpr int kMax = 1000;
-    vector<int> count(kMax + 1);
+    constexpr int kMaxNum = 1000;
+    vector<int> count(kMaxNum + 1);
     unordered_map<int, set<int>> modToSubset;
 
     for (const int num : nums) {
diff --git a/solutions/2597. The Number of Beautiful Subsets/2597.java b/solutions/2597. The Number of Beautiful Subsets/2597.java
index 5ce0b1437de..7f0d8e7ac38 100644
--- a/solutions/2597. The Number of Beautiful Subsets/2597.java	
+++ b/solutions/2597. The Number of Beautiful Subsets/2597.java	
@@ -30,8 +30,8 @@
 
 class Solution {
   public int beautifulSubsets(int[] nums, int k) {
-    final int MAX = 1000;
-    int[] count = new int[MAX + 1];
+    final int kMaxNum = 1000;
+    int[] count = new int[kMaxNum + 1];
     Map<Integer, Set<Integer>> modToSubset = new HashMap<>();
 
     for (final int num : nums) {
diff --git a/solutions/2597. The Number of Beautiful Subsets/2597.py b/solutions/2597. The Number of Beautiful Subsets/2597.py
index 5f9c7cd67ff..1bc10edb3be 100644
--- a/solutions/2597. The Number of Beautiful Subsets/2597.py	
+++ b/solutions/2597. The Number of Beautiful Subsets/2597.py	
@@ -29,7 +29,7 @@
 # So, ans = skip + pick = 9
 
 class Solution:
-  def beautifulSubsets(self, nums: list[int], k: int) -> int:
+  def beautifulSubsets(self, nums: List[int], k: int) -> int:
     count = collections.Counter(nums)
     modToSubset = collections.defaultdict(set)
 
@@ -43,9 +43,8 @@ def beautifulSubsets(self, nums: list[int], k: int) -> int:
     for subset in modToSubset.values():
       for num in sorted(subset):
         nonEmptyCount = 2**count[num] - 1
-        skip, pick = (skip + pick,
-                      nonEmptyCount *
-                      (1 + skip + (0 if num - prevNum == k else pick)))
+        skip, pick = skip + pick, nonEmptyCount * \
+            (1 + skip + (0 if num - prevNum == k else pick))
         prevNum = num
 
     return skip + pick
diff --git a/solutions/2598. Smallest Missing Non-negative Integer After Operations/2598.py b/solutions/2598. Smallest Missing Non-negative Integer After Operations/2598.py
index 0ef421baad3..7baf255dd1c 100644
--- a/solutions/2598. Smallest Missing Non-negative Integer After Operations/2598.py	
+++ b/solutions/2598. Smallest Missing Non-negative Integer After Operations/2598.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findSmallestInteger(self, nums: list[int], value: int) -> int:
+  def findSmallestInteger(self, nums: List[int], value: int) -> int:
     count = collections.Counter([num % value for num in nums])
 
     for i in range(len(nums)):
diff --git a/solutions/2599. Make the Prefix Sum Non-negative/2599.py b/solutions/2599. Make the Prefix Sum Non-negative/2599.py
index c889c6be198..18bd8613762 100644
--- a/solutions/2599. Make the Prefix Sum Non-negative/2599.py	
+++ b/solutions/2599. Make the Prefix Sum Non-negative/2599.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def makePrefSumNonNegative(self, nums: list[int]) -> int:
+  def makePrefSumNonNegative(self, nums: List[int]) -> int:
     ans = 0
     prefix = 0
     minHeap = []
diff --git a/solutions/26. Remove Duplicates from Sorted Array/26.py b/solutions/26. Remove Duplicates from Sorted Array/26.py
index 03caf273ddd..0359fbdfe2e 100644
--- a/solutions/26. Remove Duplicates from Sorted Array/26.py	
+++ b/solutions/26. Remove Duplicates from Sorted Array/26.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def removeDuplicates(self, nums: list[int]) -> int:
+  def removeDuplicates(self, nums: List[int]) -> int:
     i = 0
 
     for num in nums:
diff --git a/solutions/260. Single Number III/260.py b/solutions/260. Single Number III/260.py
index 5b69f7314ae..c58e343b08e 100644
--- a/solutions/260. Single Number III/260.py	
+++ b/solutions/260. Single Number III/260.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def singleNumber(self, nums: list[int]) -> list[int]:
+  def singleNumber(self, nums: List[int]) -> List[int]:
     xors = functools.reduce(operator.xor, nums)
     lowbit = xors & -xors
     ans = [0, 0]
diff --git a/solutions/2600. K Items With the Maximum Sum/2600.py b/solutions/2600. K Items With the Maximum Sum/2600.py
index bc7db8487e4..7ca76c6806f 100644
--- a/solutions/2600. K Items With the Maximum Sum/2600.py	
+++ b/solutions/2600. K Items With the Maximum Sum/2600.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def kItemsWithMaximumSum(
-      self,
-      numOnes: int,
-      numZeros: int,
-      numNegOnes: int,
-      k: int,
-  ) -> int:
+  def kItemsWithMaximumSum(self, numOnes: int, numZeros: int, numNegOnes: int, k: int) -> int:
     if k <= numOnes:
       return k
     if k <= numOnes + numZeros:
diff --git a/solutions/2601. Prime Subtraction Operation/2601.java b/solutions/2601. Prime Subtraction Operation/2601.java
index 9902f7cf93c..b90bd240371 100644
--- a/solutions/2601. Prime Subtraction Operation/2601.java	
+++ b/solutions/2601. Prime Subtraction Operation/2601.java	
@@ -1,7 +1,7 @@
 class Solution {
   public boolean primeSubOperation(int[] nums) {
-    final int MAX = 1000;
-    final List<Integer> primes = sieveEratosthenes(MAX);
+    final int kMax = 1000;
+    final List<Integer> primes = sieveEratosthenes(kMax);
 
     int prevNum = 0;
     for (int num : nums) {
diff --git a/solutions/2601. Prime Subtraction Operation/2601.py b/solutions/2601. Prime Subtraction Operation/2601.py
index afa822eb7bb..e63bae879de 100644
--- a/solutions/2601. Prime Subtraction Operation/2601.py	
+++ b/solutions/2601. Prime Subtraction Operation/2601.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def primeSubOperation(self, nums: list[int]) -> bool:
-    MAX = 1000
-    primes = self._sieveEratosthenes(MAX)
+  def primeSubOperation(self, nums: List[int]) -> bool:
+    kMax = 1000
+    primes = self._sieveEratosthenes(kMax)
 
     prevNum = 0
     for num in nums:
@@ -15,7 +15,7 @@ def primeSubOperation(self, nums: list[int]) -> bool:
 
     return True
 
-  def _sieveEratosthenes(self, n: int) -> list[int]:
+  def _sieveEratosthenes(self, n: int) -> List[int]:
     isPrime = [True] * n
     isPrime[0] = False
     isPrime[1] = False
diff --git a/solutions/2602. Minimum Operations to Make All Array Elements Equal/2602.py b/solutions/2602. Minimum Operations to Make All Array Elements Equal/2602.py
index f1f5606c132..35a5e4c8223 100644
--- a/solutions/2602. Minimum Operations to Make All Array Elements Equal/2602.py	
+++ b/solutions/2602. Minimum Operations to Make All Array Elements Equal/2602.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def minOperations(self, nums: list[int], queries: list[int]) -> list[int]:
+  def minOperations(self, nums: List[int], queries: List[int]) -> List[int]:
     n = len(nums)
     nums.sort()
-    prefix = list(itertools.accumulate(nums, initial=0))
+    prefix = [0] + list(itertools.accumulate(nums))
     splits = [(query, bisect.bisect_right(nums, query)) for query in queries]
     return [(query * i - prefix[i]) +
             (prefix[-1] - prefix[i] - query * (n - i))
diff --git a/solutions/2603. Collect Coins in a Tree/2603.cpp b/solutions/2603. Collect Coins in a Tree/2603.cpp
index 1ff68367f47..c77639132ca 100644
--- a/solutions/2603. Collect Coins in a Tree/2603.cpp	
+++ b/solutions/2603. Collect Coins in a Tree/2603.cpp	
@@ -43,8 +43,8 @@ class Solution {
       }
 
     return accumulate(tree.begin(), tree.end(), 0,
-                      [](int acc, const unordered_set<int>& children) {
-      return acc + children.size();
+                      [](int subtotal, const unordered_set<int>& children) {
+      return subtotal + children.size();
     });
   }
 };
diff --git a/solutions/2603. Collect Coins in a Tree/2603.py b/solutions/2603. Collect Coins in a Tree/2603.py
index 214cb48a737..06dad336151 100644
--- a/solutions/2603. Collect Coins in a Tree/2603.py	
+++ b/solutions/2603. Collect Coins in a Tree/2603.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def collectTheCoins(self, coins: list[int], edges: list[list[int]]) -> int:
+  def collectTheCoins(self, coins: List[int], edges: List[List[int]]) -> int:
     n = len(coins)
     tree = [set() for _ in range(n)]
     leavesToBeRemoved = collections.deque()
diff --git a/solutions/2604. Minimum Time to Eat All Grains/2604.java b/solutions/2604. Minimum Time to Eat All Grains/2604.java
index 8071e7aa75b..96b3369f7d8 100644
--- a/solutions/2604. Minimum Time to Eat All Grains/2604.java	
+++ b/solutions/2604. Minimum Time to Eat All Grains/2604.java	
@@ -42,8 +42,8 @@ private boolean canEat(int[] hens, int[] grains, int time) {
     return false;
   }
 
-  private int firstGreater(int[] arr, int target) {
-    final int i = Arrays.binarySearch(arr, target + 1);
+  private int firstGreater(int[] A, int target) {
+    final int i = Arrays.binarySearch(A, target + 1);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/2604. Minimum Time to Eat All Grains/2604.py b/solutions/2604. Minimum Time to Eat All Grains/2604.py
index 3a618e91fb8..298b86d7937 100644
--- a/solutions/2604. Minimum Time to Eat All Grains/2604.py	
+++ b/solutions/2604. Minimum Time to Eat All Grains/2604.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumTime(self, hens: list[int], grains: list[int]) -> int:
+  def minimumTime(self, hens: List[int], grains: List[int]) -> int:
     hens.sort()
     grains.sort()
 
@@ -22,4 +22,4 @@ def canEat(time: int) -> bool:
       return False
 
     maxMoves = int(1.5 * (max(hens + grains) - min(hens + grains)))
-    return bisect.bisect_left(range(maxMoves), True, key=canEat)
+    return bisect.bisect_left(range(maxMoves), True, key=lambda m: canEat(m))
diff --git a/solutions/2605. Form Smallest Number From Two Digit Arrays/2605.py b/solutions/2605. Form Smallest Number From Two Digit Arrays/2605.py
index d19bf776306..de06896348b 100644
--- a/solutions/2605. Form Smallest Number From Two Digit Arrays/2605.py	
+++ b/solutions/2605. Form Smallest Number From Two Digit Arrays/2605.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minNumber(self, nums1: list[int], nums2: list[int]) -> int:
+  def minNumber(self, nums1: List[int], nums2: List[int]) -> int:
     return min(a if a == b else min(a, b) * 10 + max(a, b)
                for a in nums1
                for b in nums2)
diff --git a/solutions/2606. Find the Substring With Maximum Cost/2606.py b/solutions/2606. Find the Substring With Maximum Cost/2606.py
index 8479ccc988a..23ac4184ae5 100644
--- a/solutions/2606. Find the Substring With Maximum Cost/2606.py	
+++ b/solutions/2606. Find the Substring With Maximum Cost/2606.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumCostSubstring(self, s: str, chars: str, vals: list[int]) -> int:
+  def maximumCostSubstring(self, s: str, chars: str, vals: List[int]) -> int:
     ans = 0
     cost = 0
     costs = [i for i in range(1, 27)]  # costs[i] := the cost of 'a' + i
diff --git a/solutions/2607. Make K-Subarray Sums Equal/2607.py b/solutions/2607. Make K-Subarray Sums Equal/2607.py
index 7c6142d8fdc..cf7db4640cc 100644
--- a/solutions/2607. Make K-Subarray Sums Equal/2607.py	
+++ b/solutions/2607. Make K-Subarray Sums Equal/2607.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def makeSubKSumEqual(self, arr: list[int], k: int) -> int:
+  def makeSubKSumEqual(self, arr: List[int], k: int) -> int:
     # If the sum of each subarray of length k is equal, then `arr` must have a
     # repeated pattern of size k. e.g. arr = [1, 2, 3, ...] and k = 3, to have
     # sum([1, 2, 3)] == sum([2, 3, x]), x must be 1. Therefore, arr[i] ==
diff --git a/solutions/2608. Shortest Cycle in a Graph/2608.java b/solutions/2608. Shortest Cycle in a Graph/2608.java
index 2402a6f9588..02c73f509b3 100644
--- a/solutions/2608. Shortest Cycle in a Graph/2608.java	
+++ b/solutions/2608. Shortest Cycle in a Graph/2608.java	
@@ -1,8 +1,10 @@
 class Solution {
   public int findShortestCycle(int n, int[][] edges) {
-    int ans = INF;
+    int ans = kInf;
     List<Integer>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
@@ -14,22 +16,22 @@ public int findShortestCycle(int n, int[][] edges) {
     for (int i = 0; i < n; ++i)
       ans = Math.min(ans, bfs(graph, i));
 
-    return ans == INF ? -1 : ans;
+    return ans == kInf ? -1 : ans;
   }
 
-  private static final int INF = 1001;
+  private static final int kInf = 1001;
 
   // Returns the length of the minimum cycle by starting BFS from node `i`.
-  // Returns `INF` if there's no cycle.
+  // Returns `kInf` if there's no cycle.
   private int bfs(List<Integer>[] graph, int i) {
     int[] dist = new int[graph.length];
-    Arrays.fill(dist, INF);
-    Queue<Integer> q = new ArrayDeque<>(List.of(i));
+    Arrays.fill(dist, kInf);
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(i));
     dist[i] = 0;
     while (!q.isEmpty()) {
       final int u = q.poll();
       for (final int v : graph[u]) {
-        if (dist[v] == INF) {
+        if (dist[v] == kInf) {
           dist[v] = dist[u] + 1;
           q.offer(v);
         } else if (dist[v] + 1 != dist[u]) { // v is not a parent u.
@@ -37,6 +39,6 @@ private int bfs(List<Integer>[] graph, int i) {
         }
       }
     }
-    return INF;
+    return kInf;
   }
 }
diff --git a/solutions/2608. Shortest Cycle in a Graph/2608.py b/solutions/2608. Shortest Cycle in a Graph/2608.py
index 81019a64089..9a36bf1bcf0 100644
--- a/solutions/2608. Shortest Cycle in a Graph/2608.py	
+++ b/solutions/2608. Shortest Cycle in a Graph/2608.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def findShortestCycle(self, n: int, edges: list[list[int]]) -> int:
-    INF = 1001
-    ans = INF
+  def findShortestCycle(self, n: int, edges: List[List[int]]) -> int:
+    kInf = 1001
+    ans = kInf
     graph = [[] for _ in range(n)]
 
     for u, v in edges:
@@ -11,20 +11,20 @@ def findShortestCycle(self, n: int, edges: list[list[int]]) -> int:
     def bfs(i: int) -> int:
       """Returns the length of the minimum cycle by starting BFS from node `i`.
 
-      Returns `INF` if there's no cycle.
+      Returns `kInf` if there's no cycle.
       """
-      dist = [INF] * n
+      dist = [kInf] * n
       q = collections.deque([i])
       dist[i] = 0
       while q:
         u = q.popleft()
         for v in graph[u]:
-          if dist[v] == INF:
+          if dist[v] == kInf:
             dist[v] = dist[u] + 1
             q.append(v)
           elif dist[v] + 1 != dist[u]:   # v is not a parent u.
             return dist[v] + dist[u] + 1
-      return INF
+      return kInf
 
     ans = min(map(bfs, range(n)))
-    return -1 if ans == INF else ans
+    return -1 if ans == kInf else ans
diff --git a/solutions/2609. Find the Longest Balanced Substring of a Binary String/2609-2.cpp b/solutions/2609. Find the Longest Balanced Substring of a Binary String/2609-2.cpp
index f846e6c790c..b873e3590c7 100644
--- a/solutions/2609. Find the Longest Balanced Substring of a Binary String/2609-2.cpp	
+++ b/solutions/2609. Find the Longest Balanced Substring of a Binary String/2609-2.cpp	
@@ -2,18 +2,18 @@ class Solution {
  public:
   int findTheLongestBalancedSubstring(string s) {
     int ans = 0;
-    int zeros = 0;
-    int ones = 0;
+    int count0 = 0;
+    int count1 = 0;
 
     for (const char c : s) {
       if (c == '0') {
-        zeros = ones > 0 ? 1 : zeros + 1;
-        ones = 0;
+        count0 = count1 > 0 ? 1 : count0 + 1;
+        count1 = 0;
       } else {  // c == '1'
-        ++ones;
+        ++count1;
       }
-      if (zeros >= ones)
-        ans = max(ans, ones);
+      if (count0 >= count1)
+        ans = max(ans, count1);
     }
 
     return ans * 2;
diff --git a/solutions/261. Graph Valid Tree/261-2.py b/solutions/261. Graph Valid Tree/261-2.py
index c2b4cdf6845..f65e6305946 100644
--- a/solutions/261. Graph Valid Tree/261-2.py	
+++ b/solutions/261. Graph Valid Tree/261-2.py	
@@ -25,7 +25,7 @@ def _find(self, u: int) -> int:
 
 
 class Solution:
-  def validTree(self, n: int, edges: list[list[int]]) -> bool:
+  def validTree(self, n: int, edges: List[List[int]]) -> bool:
     if n == 0 or len(edges) != n - 1:
       return False
 
diff --git a/solutions/261. Graph Valid Tree/261.java b/solutions/261. Graph Valid Tree/261.java
index bf99199cdac..e436431babe 100644
--- a/solutions/261. Graph Valid Tree/261.java	
+++ b/solutions/261. Graph Valid Tree/261.java	
@@ -4,9 +4,11 @@ public boolean validTree(int n, int[][] edges) {
       return false;
 
     List<Integer>[] graph = new List[n];
-    Queue<Integer> q = new ArrayDeque<>(List.of(0));
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(0));
     Set<Integer> seen = new HashSet<>(Arrays.asList(0));
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
diff --git a/solutions/261. Graph Valid Tree/261.py b/solutions/261. Graph Valid Tree/261.py
index 72382c64896..db53184ce16 100644
--- a/solutions/261. Graph Valid Tree/261.py	
+++ b/solutions/261. Graph Valid Tree/261.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def validTree(self, n: int, edges: list[list[int]]) -> bool:
+  def validTree(self, n: int, edges: List[List[int]]) -> bool:
     if n == 0 or len(edges) != n - 1:
       return False
 
diff --git a/solutions/2610. Convert an Array Into a 2D Array With Conditions/2610.py b/solutions/2610. Convert an Array Into a 2D Array With Conditions/2610.py
index 677b641fc77..f3f49282250 100644
--- a/solutions/2610. Convert an Array Into a 2D Array With Conditions/2610.py	
+++ b/solutions/2610. Convert an Array Into a 2D Array With Conditions/2610.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMatrix(self, nums: list[int]) -> list[list[int]]:
+  def findMatrix(self, nums: List[int]) -> List[List[int]]:
     # The number of rows we need equals the maximum frequency.
     ans = []
     count = [0] * (len(nums) + 1)
diff --git a/solutions/2611. Mice and Cheese/2611.py b/solutions/2611. Mice and Cheese/2611.py
index 6235e339f81..bddaf272e40 100644
--- a/solutions/2611. Mice and Cheese/2611.py	
+++ b/solutions/2611. Mice and Cheese/2611.py	
@@ -1,9 +1,3 @@
 class Solution:
-  def miceAndCheese(
-      self,
-      reward1: list[int],
-      reward2: list[int],
-      k: int,
-  ) -> int:
-    return (sum(reward2) +
-            sum(heapq.nlargest(k, (a - b for a, b in zip(reward1, reward2)))))
+  def miceAndCheese(self, reward1: List[int], reward2: List[int], k: int) -> int:
+    return sum(reward2) + sum(heapq.nlargest(k, (a - b for a, b in zip(reward1, reward2))))
diff --git a/solutions/2612. Minimum Reverse Operations/2612.java b/solutions/2612. Minimum Reverse Operations/2612.java
index c7e5f594dbd..6b1b334c96b 100644
--- a/solutions/2612. Minimum Reverse Operations/2612.java	
+++ b/solutions/2612. Minimum Reverse Operations/2612.java	
@@ -13,7 +13,7 @@ public int[] minReverseOperations(int n, int p, int[] banned, int k) {
         unseen[num % 2].add(num);
 
     // Perform BFS from `p`.
-    Queue<Integer> q = new ArrayDeque<>(List.of(p));
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(p));
     ans[p] = 0;
 
     while (!q.isEmpty()) {
diff --git a/solutions/2612. Minimum Reverse Operations/2612.py b/solutions/2612. Minimum Reverse Operations/2612.py
index 28fb16ff163..6a0c35cedaf 100644
--- a/solutions/2612. Minimum Reverse Operations/2612.py	
+++ b/solutions/2612. Minimum Reverse Operations/2612.py	
@@ -2,13 +2,7 @@
 
 
 class Solution:
-  def minReverseOperations(
-      self,
-      n: int,
-      p: int,
-      banned: list[int],
-      k: int,
-  ) -> list[int]:
+  def minReverseOperations(self, n: int, p: int, banned: List[int], k: int) -> List[int]:
     bannedSet = set(banned)
     ans = [-1] * n
     # unseen[i] := the unseen numbers that % 2 == i
diff --git a/solutions/2613. Beautiful Pairs/2613.cpp b/solutions/2613. Beautiful Pairs/2613.cpp
index 30e8cad7ed7..012c169d6ae 100644
--- a/solutions/2613. Beautiful Pairs/2613.cpp	
+++ b/solutions/2613. Beautiful Pairs/2613.cpp	
@@ -1,7 +1,7 @@
 class SegmentTree {
  public:
   explicit SegmentTree(const vector<int>& nums)
-      : maxNum(nums.size()), nums(std::move(nums)), tree(4 * maxNum, -1) {}
+      : maxNum(nums.size()), nums(move(nums)), tree(4 * maxNum, -1) {}
 
   // Updates the value of the node to be the index of the smaller number between
   // the old value stored at the node and the new value `index`, where `i` is
diff --git a/solutions/2614. Prime In Diagonal/2614.py b/solutions/2614. Prime In Diagonal/2614.py
index 2e31d4d0463..e773a7e0af2 100644
--- a/solutions/2614. Prime In Diagonal/2614.py	
+++ b/solutions/2614. Prime In Diagonal/2614.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def diagonalPrime(self, nums: list[list[int]]) -> int:
+  def diagonalPrime(self, nums: List[List[int]]) -> int:
     def isPrime(n: int) -> bool:
       if n <= 1:
         return False
@@ -10,7 +10,7 @@ def isPrime(n: int) -> bool:
 
     primes1 = [row[i]
                for i, row in enumerate(nums) if isPrime(row[i])]
-    primes2 = [row[-1 - i]
-               for i, row in enumerate(nums) if isPrime(row[-1 - i])]
+    primes2 = [row[-i - 1]
+               for i, row in enumerate(nums) if isPrime(row[-i - 1])]
     return max(max(primes1) if primes1 else 0,
                max(primes2) if primes2 else 0)
diff --git a/solutions/2615. Sum of Distances/2615.java b/solutions/2615. Sum of Distances/2615.java
index cecbfab8bda..70528bf8363 100644
--- a/solutions/2615. Sum of Distances/2615.java	
+++ b/solutions/2615. Sum of Distances/2615.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public long[] distance(int[] nums) {
     long[] ans = new long[nums.length];
     Map<Integer, List<Integer>> numToIndices = new HashMap<>();
@@ -13,7 +13,7 @@ public long[] distance(int[] nums) {
       if (n == 1) {
         continue;
       }
-      long sumSoFar = indices.stream().mapToLong(Integer::longValue).sum();
+      long sumSoFar = indices.stream().mapToLong(Integer::intValue).sum();
       int prevIndex = 0;
       for (int i = 0; i < n; ++i) {
         sumSoFar += (i - 1) * (indices.get(i) - prevIndex);
diff --git a/solutions/2615. Sum of Distances/2615.py b/solutions/2615. Sum of Distances/2615.py
index 1e3f61e0404..a06c9c5cb24 100644
--- a/solutions/2615. Sum of Distances/2615.py	
+++ b/solutions/2615. Sum of Distances/2615.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def distance(self, nums: list[int]) -> list[int]:
+  def distance(self, nums: List[int]) -> List[int]:
     ans = [0] * len(nums)
     numToIndices = collections.defaultdict(list)
 
diff --git a/solutions/2616. Minimize the Maximum Difference of Pairs/2616.py b/solutions/2616. Minimize the Maximum Difference of Pairs/2616.py
index a1aaa54cb50..2c80fafb95d 100644
--- a/solutions/2616. Minimize the Maximum Difference of Pairs/2616.py	
+++ b/solutions/2616. Minimize the Maximum Difference of Pairs/2616.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimizeMax(self, nums: list[int], p: int) -> int:
+  def minimizeMax(self, nums: List[int], p: int) -> int:
     nums.sort()
 
     def numPairs(maxDiff: int) -> int:
@@ -18,4 +18,6 @@ def numPairs(maxDiff: int) -> int:
           i += 1
       return pairs
 
-    return bisect.bisect_left(range(nums[-1] - nums[0]), p, key=numPairs)
+    return bisect.bisect_left(
+        range(0, nums[-1] - nums[0]), p,
+        key=lambda m: numPairs(m))
diff --git a/solutions/2617. Minimum Number of Visited Cells in a Grid/2617.cpp b/solutions/2617. Minimum Number of Visited Cells in a Grid/2617.cpp
index 53e11053220..84f91e16c7b 100644
--- a/solutions/2617. Minimum Number of Visited Cells in a Grid/2617.cpp	
+++ b/solutions/2617. Minimum Number of Visited Cells in a Grid/2617.cpp	
@@ -8,7 +8,7 @@ class SegmentTree {
   }
 
   // Returns min(nums[i..j]).
-  int query(int i, int j) const {
+  int query(int i, int j) {
     return query(0, 0, n - 1, i, j);
   }
 
@@ -30,7 +30,7 @@ class SegmentTree {
     tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
   }
 
-  int query(int treeIndex, int lo, int hi, int i, int j) const {
+  int query(int treeIndex, int lo, int hi, int i, int j) {
     if (i <= lo && hi <= j)  // [lo, hi] lies completely inside [i, j].
       return tree[treeIndex];
     if (j < lo || hi < i)  // [lo, hi] lies completely outside [i, j].
@@ -40,8 +40,9 @@ class SegmentTree {
                  query(treeIndex * 2 + 2, mid + 1, hi, i, j));
   }
 
-  int merge(int left, int right) const {
-    return min(left, right);
+  // Merges the result of the left node and the right node.
+  int merge(int a, int b) {
+    return min(a, b);
   }
 };
 
diff --git a/solutions/2638. Count the Number of K-Free Subsets/2638.py b/solutions/2638. Count the Number of K-Free Subsets/2638.py
index 21d4f55c229..48e8f652aff 100644
--- a/solutions/2638. Count the Number of K-Free Subsets/2638.py	
+++ b/solutions/2638. Count the Number of K-Free Subsets/2638.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countTheNumOfKFreeSubsets(self, nums: list[int], k: int) -> int:
+  def countTheNumOfKFreeSubsets(self, nums: List[int], k: int) -> int:
     modToSubset = collections.defaultdict(set)
 
     for num in nums:
@@ -11,8 +11,8 @@ def countTheNumOfKFreeSubsets(self, nums: list[int], k: int) -> int:
 
     for subset in modToSubset.values():
       for num in sorted(subset):
-        skip, pick = (skip + pick,
-                      1 + skip + (0 if num - prevNum == k else pick))
+        skip, pick = skip + pick, \
+            1 + skip + (0 if num - prevNum == k else pick)
         prevNum = num
 
     return 1 + skip + pick
diff --git a/solutions/2639. Find the Width of Columns of a Grid/2639.py b/solutions/2639. Find the Width of Columns of a Grid/2639.py
index 973f01ed3cd..fcd259b2ee9 100644
--- a/solutions/2639. Find the Width of Columns of a Grid/2639.py	
+++ b/solutions/2639. Find the Width of Columns of a Grid/2639.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def findColumnWidth(self, grid: list[list[int]]) -> list[int]:
+  def findColumnWidth(self, grid: List[List[int]]) -> List[int]:
     return [max(map(len, map(str, col))) for col in zip(*grid)]
diff --git a/solutions/2640. Find the Score of All Prefixes of an Array/2640.py b/solutions/2640. Find the Score of All Prefixes of an Array/2640.py
index bfa31d1fba3..c9d48d34120 100644
--- a/solutions/2640. Find the Score of All Prefixes of an Array/2640.py	
+++ b/solutions/2640. Find the Score of All Prefixes of an Array/2640.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findPrefixScore(self, nums: list[int]) -> list[int]:
+  def findPrefixScore(self, nums: List[int]) -> List[int]:
     conver = []
     mx = 0
 
diff --git a/solutions/2641. Cousins in Binary Tree II/2641.py b/solutions/2641. Cousins in Binary Tree II/2641.py
index 6a7abad7a0a..d310a507b73 100644
--- a/solutions/2641. Cousins in Binary Tree II/2641.py	
+++ b/solutions/2641. Cousins in Binary Tree II/2641.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def replaceValueInTree(self, root: TreeNode | None) -> TreeNode | None:
+  def replaceValueInTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
     levelSums = []
 
-    def dfs(root: TreeNode | None, level: int) -> None:
+    def dfs(root: Optional[TreeNode], level: int) -> None:
       if not root:
         return
       if len(levelSums) == level:
@@ -11,15 +11,11 @@ def dfs(root: TreeNode | None, level: int) -> None:
       dfs(root.left, level + 1)
       dfs(root.right, level + 1)
 
-    def replace(
-        root: TreeNode | None,
-        level: int, curr: TreeNode | None,
-    ) -> TreeNode | None:
+    def replace(root: Optional[TreeNode], level: int, curr: Optional[TreeNode]) -> Optional[TreeNode]:
       nextLevel = level + 1
-      nextLevelCousinsSum = (
-          (levelSums[nextLevel] if nextLevel < len(levelSums) else 0) -
-          (root.left.val if root.left else 0) -
-          (root.right.val if root.right else 0))
+      nextLevelCousinsSum = (levelSums[nextLevel] if nextLevel < len(levelSums) else 0) - \
+          (root.left.val if root.left else 0) - \
+          (root.right.val if root.right else 0)
       if root.left:
         curr.left = TreeNode(nextLevelCousinsSum)
         replace(root.left, level + 1, curr.left)
diff --git a/solutions/2642. Design Graph With Shortest Path Calculator/2642.java b/solutions/2642. Design Graph With Shortest Path Calculator/2642.java
index 29d0a5f6c64..4460478a31b 100644
--- a/solutions/2642. Design Graph With Shortest Path Calculator/2642.java	
+++ b/solutions/2642. Design Graph With Shortest Path Calculator/2642.java	
@@ -1,7 +1,8 @@
 class Graph {
   public Graph(int n, int[][] edges) {
     graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
     for (int[] edge : edges)
       addEdge(edge);
   }
@@ -17,8 +18,7 @@ public int shortestPath(int node1, int node2) {
     int[] dist = new int[graph.length];
     Arrays.fill(dist, Integer.MAX_VALUE);
     // (d, u)
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey));
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
 
     dist[node1] = 0;
     minHeap.offer(new Pair<>(dist[node1], node1));
diff --git a/solutions/2642. Design Graph With Shortest Path Calculator/2642.py b/solutions/2642. Design Graph With Shortest Path Calculator/2642.py
index b0fdd65a37b..42a12762e75 100644
--- a/solutions/2642. Design Graph With Shortest Path Calculator/2642.py	
+++ b/solutions/2642. Design Graph With Shortest Path Calculator/2642.py	
@@ -1,10 +1,10 @@
 class Graph:
-  def __init__(self, n: int, edges: list[list[int]]):
+  def __init__(self, n: int, edges: List[List[int]]):
     self.graph = [[] for _ in range(n)]
     for edge in edges:
       self.addEdge(edge)
 
-  def addEdge(self, edge: list[int]):
+  def addEdge(self, edge: List[int]):
     u, v, w = edge
     self.graph[u].append((v, w))
 
diff --git a/solutions/2643. Row With Maximum Ones/2643.py b/solutions/2643. Row With Maximum Ones/2643.py
index 65665e427a1..0b43d9a2ed9 100644
--- a/solutions/2643. Row With Maximum Ones/2643.py	
+++ b/solutions/2643. Row With Maximum Ones/2643.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def rowAndMaximumOnes(self, mat: list[list[int]]) -> list[int]:
+  def rowAndMaximumOnes(self, mat: List[List[int]]) -> List[int]:
     ans = [0, 0]
 
     for i, row in enumerate(mat):
diff --git a/solutions/2644. Find the Maximum Divisibility Score/2644.py b/solutions/2644. Find the Maximum Divisibility Score/2644.py
index fb90dfbf1b6..8fb00598e4a 100644
--- a/solutions/2644. Find the Maximum Divisibility Score/2644.py	
+++ b/solutions/2644. Find the Maximum Divisibility Score/2644.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxDivScore(self, nums: list[int], divisors: list[int]) -> int:
+  def maxDivScore(self, nums: List[int], divisors: List[int]) -> int:
     ans = -1
     maxScore = -1
 
diff --git a/solutions/2646. Minimize the Total Price of the Trips/2646.py b/solutions/2646. Minimize the Total Price of the Trips/2646.py
index 2c7813fc437..8a885f0b90b 100644
--- a/solutions/2646. Minimize the Total Price of the Trips/2646.py	
+++ b/solutions/2646. Minimize the Total Price of the Trips/2646.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def minimumTotalPrice(self, n: int, edges: list[list[int]], price: list[int],
-                        trips: list[list[int]]) -> int:
+  def minimumTotalPrice(self, n: int, edges: List[List[int]], price: List[int],
+                        trips: List[List[int]]) -> int:
     graph = [[] for _ in range(n)]
 
     for u, v in edges:
@@ -10,7 +10,7 @@ def minimumTotalPrice(self, n: int, edges: list[list[int]], price: list[int],
     # count[i] := the number of times i is traversed
     count = [0] * n
 
-    def dfsCount(u: int, prev: int, end: int, path: list[int]) -> None:
+    def dfsCount(u: int, prev: int, end: int, path: List[int]) -> None:
       path.append(u)
       if u == end:
         for i in path:
diff --git a/solutions/2647. Color the Triangle Red/2647.py b/solutions/2647. Color the Triangle Red/2647.py
index 48627cd8439..014b88bc4b6 100644
--- a/solutions/2647. Color the Triangle Red/2647.py	
+++ b/solutions/2647. Color the Triangle Red/2647.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def colorRed(self, n: int) -> list[list[int]]:
+  def colorRed(self, n: int) -> List[List[int]]:
     ans = []
     tipSize = n % 4
 
diff --git a/solutions/265. Paint House II/265.py b/solutions/265. Paint House II/265.py
index 68053254523..ecf1d1fede1 100644
--- a/solutions/265. Paint House II/265.py	
+++ b/solutions/265. Paint House II/265.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minCostII(self, costs: list[list[int]]) -> int:
+  def minCostII(self, costs: List[List[int]]) -> int:
     prevIndex = -1  # the previous minimum index
     prevMin1 = 0  # the minimum cost so far
     prevMin2 = 0  # the second minimum cost so far
diff --git a/solutions/2652. Sum Multiples/2652-2.java b/solutions/2652. Sum Multiples/2652-2.java
index 1bb92bcec8d..605e22a2f45 100644
--- a/solutions/2652. Sum Multiples/2652-2.java	
+++ b/solutions/2652. Sum Multiples/2652-2.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public int sumOfMultiples(int n) {
     return sumOfMultiples(n, 3) + sumOfMultiples(n, 5) + sumOfMultiples(n, 7) -
         (sumOfMultiples(n, 15) + sumOfMultiples(n, 21) + sumOfMultiples(n, 35)) +
diff --git a/solutions/2652. Sum Multiples/2652-2.py b/solutions/2652. Sum Multiples/2652-2.py
index 0f619569d38..2fabf80a3ad 100644
--- a/solutions/2652. Sum Multiples/2652-2.py	
+++ b/solutions/2652. Sum Multiples/2652-2.py	
@@ -1,12 +1,12 @@
 class Solution:
   def sumOfMultiples(self, n: int) -> int:
+    # Returns the sum of multiples of value in [1, n].
     def sumOfMultiples(value: int) -> int:
-      """Returns the sum of multiples of value in [1, n]."""
       lo = value
       hi = (n // value) * value
       count = (hi - lo) // value + 1
       return (lo + hi) * count // 2
 
-    return (sumOfMultiples(3) + sumOfMultiples(5) + sumOfMultiples(7) -
-            (sumOfMultiples(15) + sumOfMultiples(21) + sumOfMultiples(35)) +
-            sumOfMultiples(105))
+    return sumOfMultiples(3) + sumOfMultiples(5) + sumOfMultiples(7) \
+        - (sumOfMultiples(15) + sumOfMultiples(21) + sumOfMultiples(35)) \
+        + sumOfMultiples(105)
diff --git a/solutions/2653. Sliding Subarray Beauty/2653.py b/solutions/2653. Sliding Subarray Beauty/2653.py
index d524b22bfc0..fda8f66c70c 100644
--- a/solutions/2653. Sliding Subarray Beauty/2653.py	
+++ b/solutions/2653. Sliding Subarray Beauty/2653.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getSubarrayBeauty(self, nums: list[int], k: int, x: int) -> list[int]:
+  def getSubarrayBeauty(self, nums: List[int], k: int, x: int) -> List[int]:
     ans = []
     count = [0] * 50  # count[i] := the frequency of (i + 50)
 
@@ -13,7 +13,7 @@ def getSubarrayBeauty(self, nums: list[int], k: int, x: int) -> list[int]:
 
     return ans
 
-  def _getXthSmallestNum(self, count: list[int], x: int) -> int:
+  def _getXthSmallestNum(self, count: List[int], x: int) -> int:
     prefix = 0
     for i in range(50):
       prefix += count[i]
diff --git a/solutions/2654. Minimum Number of Operations to Make All Array Elements Equal to 1/2654.py b/solutions/2654. Minimum Number of Operations to Make All Array Elements Equal to 1/2654.py
index 51b6ae1f0de..33cbf7dcb4f 100644
--- a/solutions/2654. Minimum Number of Operations to Make All Array Elements Equal to 1/2654.py	
+++ b/solutions/2654. Minimum Number of Operations to Make All Array Elements Equal to 1/2654.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums: list[int]) -> int:
+  def minOperations(self, nums: List[int]) -> int:
     n = len(nums)
     ones = nums.count(1)
     if ones > 0:
diff --git a/solutions/2655. Find Maximal Uncovered Ranges/2655.java b/solutions/2655. Find Maximal Uncovered Ranges/2655.java
index 6bbdf61f206..208d7380a3c 100644
--- a/solutions/2655. Find Maximal Uncovered Ranges/2655.java	
+++ b/solutions/2655. Find Maximal Uncovered Ranges/2655.java	
@@ -3,7 +3,7 @@ public int[][] findMaximalUncoveredRanges(int n, int[][] ranges) {
     List<int[]> ans = new ArrayList<>();
     int start = 0;
 
-    Arrays.sort(ranges, Comparator.comparingInt(range -> range[0]));
+    Arrays.sort(ranges, (a, b) -> a[0] - b[0]);
 
     for (int[] range : ranges) {
       final int l = range[0];
diff --git a/solutions/2655. Find Maximal Uncovered Ranges/2655.py b/solutions/2655. Find Maximal Uncovered Ranges/2655.py
index 34b0fb92a50..fb1c35a1b02 100644
--- a/solutions/2655. Find Maximal Uncovered Ranges/2655.py	
+++ b/solutions/2655. Find Maximal Uncovered Ranges/2655.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaximalUncoveredRanges(self, n: int, ranges: list[list[int]]) -> list[list[int]]:
+  def findMaximalUncoveredRanges(self, n: int, ranges: List[List[int]]) -> List[List[int]]:
     ans = []
     start = 0
 
diff --git a/solutions/2656. Maximum Sum With Exactly K Elements/2656.py b/solutions/2656. Maximum Sum With Exactly K Elements/2656.py
index ebd221ca390..3a52363e53a 100644
--- a/solutions/2656. Maximum Sum With Exactly K Elements/2656.py	
+++ b/solutions/2656. Maximum Sum With Exactly K Elements/2656.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def maximizeSum(self, nums: list[int], k: int) -> int:
+  def maximizeSum(self, nums: List[int], k: int) -> int:
     return max(nums) * k + k * (k - 1) // 2
diff --git a/solutions/2657. Find the Prefix Common Array of Two Arrays/2657.py b/solutions/2657. Find the Prefix Common Array of Two Arrays/2657.py
index 1fddb4adbbf..9f588dd4fd4 100644
--- a/solutions/2657. Find the Prefix Common Array of Two Arrays/2657.py	
+++ b/solutions/2657. Find the Prefix Common Array of Two Arrays/2657.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findThePrefixCommonArray(self, A: list[int], B: list[int]) -> list[int]:
+  def findThePrefixCommonArray(self, A: List[int], B: List[int]) -> List[int]:
     n = len(A)
     prefixCommon = 0
     ans = []
diff --git a/solutions/2658. Maximum Number of Fish in a Grid/2658.py b/solutions/2658. Maximum Number of Fish in a Grid/2658.py
index 0efb37b2e5d..a3a84864dc0 100644
--- a/solutions/2658. Maximum Number of Fish in a Grid/2658.py	
+++ b/solutions/2658. Maximum Number of Fish in a Grid/2658.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaxFish(self, grid: list[list[int]]) -> int:
+  def findMaxFish(self, grid: List[List[int]]) -> int:
     def dfs(i: int, j: int) -> int:
       if i < 0 or i == len(grid) or j < 0 or j == len(grid[0]):
         return 0
@@ -7,9 +7,9 @@ def dfs(i: int, j: int) -> int:
         return 0
       caughtFish = grid[i][j]
       grid[i][j] = 0  # Mark 0 as visited
-      return (caughtFish +
-              dfs(i + 1, j) + dfs(i - 1, j) +
-              dfs(i, j + 1) + dfs(i, j - 1))
+      return caughtFish + \
+          dfs(i + 1, j) + dfs(i - 1, j) + \
+          dfs(i, j + 1) + dfs(i, j - 1)
 
     return max(dfs(i, j)
                for i in range(len(grid))
diff --git a/solutions/2659. Make Array Empty/2659.py b/solutions/2659. Make Array Empty/2659.py
index b640f3b4756..2a2394416e2 100644
--- a/solutions/2659. Make Array Empty/2659.py	
+++ b/solutions/2659. Make Array Empty/2659.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countOperationsToEmptyArray(self, nums: list[int]) -> int:
+  def countOperationsToEmptyArray(self, nums: List[int]) -> int:
     n = len(nums)
     ans = n
     numToIndex = {}
diff --git a/solutions/2660. Determine the Winner of a Bowling Game/2660.java b/solutions/2660. Determine the Winner of a Bowling Game/2660.java
index aed943abab7..d9587bae378 100644
--- a/solutions/2660. Determine the Winner of a Bowling Game/2660.java	
+++ b/solutions/2660. Determine the Winner of a Bowling Game/2660.java	
@@ -10,9 +10,9 @@ public int isWinner(int[] player1, int[] player2) {
   }
 
   private int getScore(int[] player) {
-    final int INVALID = -3;
+    final int kInvalid = -3;
     int score = 0;
-    int last10 = INVALID;
+    int last10 = kInvalid;
     for (int i = 0; i < player.length; ++i) {
       score += i - last10 > 2 ? player[i] : player[i] * 2;
       if (player[i] == 10)
diff --git a/solutions/2660. Determine the Winner of a Bowling Game/2660.py b/solutions/2660. Determine the Winner of a Bowling Game/2660.py
index bd84257c1df..2dfbb152c64 100644
--- a/solutions/2660. Determine the Winner of a Bowling Game/2660.py	
+++ b/solutions/2660. Determine the Winner of a Bowling Game/2660.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def isWinner(self, player1: list[int], player2: list[int]) -> int:
-    def getScore(player: list[int]) -> int:
-      INVALID = -3
+  def isWinner(self, player1: List[int], player2: List[int]) -> int:
+    def getScore(player: List[int]) -> int:
+      kInvalid = -3
       score = 0
-      last10 = INVALID
+      last10 = kInvalid
       for i, p in enumerate(player):
         score += p if i - last10 > 2 else p * 2
         if p == 10:
diff --git a/solutions/2661. First Completely Painted Row or Column/2661.py b/solutions/2661. First Completely Painted Row or Column/2661.py
index 0a627005541..38561b63bfa 100644
--- a/solutions/2661. First Completely Painted Row or Column/2661.py	
+++ b/solutions/2661. First Completely Painted Row or Column/2661.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def firstCompleteIndex(self, arr: list[int], mat: list[list[int]]) -> int:
+  def firstCompleteIndex(self, arr: List[int], mat: List[List[int]]) -> int:
     m = len(mat)
     n = len(mat[0])
     # rows[i] := the number of painted grid in the i-th row
diff --git a/solutions/2662. Minimum Cost of a Path With Special Roads/2662.java b/solutions/2662. Minimum Cost of a Path With Special Roads/2662.java
index fd05aac71d5..3a9de6f3836 100644
--- a/solutions/2662. Minimum Cost of a Path With Special Roads/2662.java	
+++ b/solutions/2662. Minimum Cost of a Path With Special Roads/2662.java	
@@ -10,8 +10,7 @@ private int dijkstra(int[][] specialRoads, int srcX, int srcY, int dstX, int dst
     int[] dist = new int[n];
     Arrays.fill(dist, Integer.MAX_VALUE);
     // (d, u), where u := the i-th specialRoads
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey));
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
 
     // (srcX, srcY) -> (x1, y1) to cost -> (x2, y2)
     for (int u = 0; u < n; ++u) {
diff --git a/solutions/2662. Minimum Cost of a Path With Special Roads/2662.py b/solutions/2662. Minimum Cost of a Path With Special Roads/2662.py
index 2ff117a854d..ba78e0e6ead 100644
--- a/solutions/2662. Minimum Cost of a Path With Special Roads/2662.py	
+++ b/solutions/2662. Minimum Cost of a Path With Special Roads/2662.py	
@@ -1,24 +1,12 @@
 class Solution:
-  def minimumCost(
-      self,
-      start: list[int],
-      target: list[int],
-      specialRoads: list[list[int]],
-  ) -> int:
+  def minimumCost(self, start: List[int], target: List[int], specialRoads: List[List[int]]) -> int:
     return self.dijkstra(specialRoads, *start, *target)
 
-  def dijkstra(
-      self,
-      specialRoads: list[list[int]],
-      srcX: int,
-      srcY: int,
-      dstX: int,
-      dstY: int,
-  ) -> int:
+  def dijkstra(self, specialRoads: List[List[int]], srcX: int, srcY: int, dstX: int, dstY: int) -> int:
     n = len(specialRoads)
     # dist[i] := the minimum distance of (srcX, srcY) to specialRoads[i](x2, y2)
     dist = [math.inf] * n
-    minHeap = []  # (d, u), where u := the i-th specialRoads
+    minHeap = []  # (d, u),(d, u), where u := the i-th specialRoads
 
     # (srcX, srcY) -> (x1, y1) to cost -> (x2, y2)
     for u, (x1, y1, _, _, cost) in enumerate(specialRoads):
diff --git a/solutions/2663. Lexicographically Smallest Beautiful String/2663.java b/solutions/2663. Lexicographically Smallest Beautiful String/2663.java
index 34b005763b9..238cfdb9993 100644
--- a/solutions/2663. Lexicographically Smallest Beautiful String/2663.java	
+++ b/solutions/2663. Lexicographically Smallest Beautiful String/2663.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public String smallestBeautifulString(String s, int k) {
     StringBuilder sb = new StringBuilder(s);
 
diff --git a/solutions/2663. Lexicographically Smallest Beautiful String/2663.py b/solutions/2663. Lexicographically Smallest Beautiful String/2663.py
index f9e28470181..02e92f6bdd6 100644
--- a/solutions/2663. Lexicographically Smallest Beautiful String/2663.py	
+++ b/solutions/2663. Lexicographically Smallest Beautiful String/2663.py	
@@ -13,12 +13,12 @@ def smallestBeautifulString(self, s: str, k: int) -> str:
 
     return ''
 
-  def _containsPalindrome(self, chars: list[str], i: int) -> bool:
+  def _containsPalindrome(self, chars: List[str], i: int) -> bool:
     """Returns True if chars[0..i] contains palindrome."""
-    return ((i > 0 and chars[i] == chars[i - 1]) or
-            (i > 1 and chars[i] == chars[i - 2]))
+    return (i > 0 and chars[i] == chars[i - 1]) or \
+        (i > 1 and chars[i] == chars[i - 2])
 
-  def _changeSuffix(self, chars: list[str], i: int) -> str:
+  def _changeSuffix(self, chars: List[str], i: int) -> str:
     """
     Returns a string, where replacing sb[i..n) with the smallest possible
     letters don't form any palindrome substring.
diff --git "a/solutions/2664. The Knight\342\200\231s Tour/2664.cpp" "b/solutions/2664. The Knight\342\200\231s Tour/2664.cpp"
index 763d37eed0d..268e387b9ee 100644
--- "a/solutions/2664. The Knight\342\200\231s Tour/2664.cpp"	
+++ "b/solutions/2664. The Knight\342\200\231s Tour/2664.cpp"	
@@ -7,8 +7,8 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[8][2] = {{1, 2},   {2, 1},   {2, -1}, {1, -2},
-                                      {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
+  static constexpr int dirs[8][2] = {{1, 2},   {2, 1},   {2, -1}, {1, -2},
+                                     {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
 
   bool dfs(int m, int n, int i, int j, int step, vector<vector<int>>& ans) {
     if (step == m * n)
@@ -18,7 +18,7 @@ class Solution {
     if (ans[i][j] != -1)
       return false;
     ans[i][j] = step;
-    for (const auto& [dx, dy] : kDirs)
+    for (const auto& [dx, dy] : dirs)
       if (dfs(m, n, i + dx, j + dy, step + 1, ans))
         return true;
     ans[i][j] = -1;
diff --git "a/solutions/2664. The Knight\342\200\231s Tour/2664.java" "b/solutions/2664. The Knight\342\200\231s Tour/2664.java"
index 237264c4982..6e32e91615b 100644
--- "a/solutions/2664. The Knight\342\200\231s Tour/2664.java"	
+++ "b/solutions/2664. The Knight\342\200\231s Tour/2664.java"	
@@ -6,7 +6,7 @@ public int[][] tourOfKnight(int m, int n, int r, int c) {
     return ans;
   }
 
-  private static final int[][] DIRS = {{1, 2},   {2, 1},   {2, -1}, {1, -2},
+  private static final int[][] dirs = {{1, 2},   {2, 1},   {2, -1}, {1, -2},
                                        {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
 
   private boolean dfs(int m, int n, int i, int j, int step, int[][] ans) {
@@ -17,7 +17,7 @@ private boolean dfs(int m, int n, int i, int j, int step, int[][] ans) {
     if (ans[i][j] != -1)
       return false;
     ans[i][j] = step;
-    for (int[] dir : DIRS)
+    for (int[] dir : dirs)
       if (dfs(m, n, i + dir[0], j + dir[1], step + 1, ans))
         return true;
     ans[i][j] = -1;
diff --git "a/solutions/2664. The Knight\342\200\231s Tour/2664.py" "b/solutions/2664. The Knight\342\200\231s Tour/2664.py"
index 9cc09802c48..316f3e18700 100644
--- "a/solutions/2664. The Knight\342\200\231s Tour/2664.py"	
+++ "b/solutions/2664. The Knight\342\200\231s Tour/2664.py"	
@@ -1,6 +1,6 @@
 class Solution:
-  def tourOfKnight(self, m: int, n: int, r: int, c: int) -> list[list[int]]:
-    DIRS = ((1, 2), (2, 1), (2, -1), (1, -2),
+  def tourOfKnight(self, m: int, n: int, r: int, c: int) -> List[List[int]]:
+    dirs = ((1, 2), (2, 1), (2, -1), (1, -2),
             (-1, -2), (-2, -1), (-2, 1), (-1, 2))
     ans = [[-1] * n for _ in range(m)]
 
@@ -12,7 +12,7 @@ def dfs(i: int, j: int, step: int) -> bool:
       if ans[i][j] != -1:
         return False
       ans[i][j] = step
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         if dfs(i + dx, j + dy, step + 1):
           return True
       ans[i][j] = -1
diff --git a/solutions/267. Palindrome Permutation II/267.cpp b/solutions/267. Palindrome Permutation II/267.cpp
index ae201a27d00..018d92ee966 100644
--- a/solutions/267. Palindrome Permutation II/267.cpp	
+++ b/solutions/267. Palindrome Permutation II/267.cpp	
@@ -39,7 +39,7 @@ class Solution {
            vector<bool>&& used, string&& path, vector<string>& ans) {
     if (path.length() == candidates.size()) {
       string secondHalf = path;
-      ranges::reverse(secondHalf);
+      reverse(secondHalf.begin(), secondHalf.end());
       ans.push_back(path + mid + secondHalf);
       return;
     }
@@ -51,7 +51,7 @@ class Solution {
         continue;
       used[i] = true;
       path.push_back(candidates[i]);
-      dfs(candidates, mid, std::move(used), std::move(path), ans);
+      dfs(candidates, mid, move(used), move(path), ans);
       path.pop_back();
       used[i] = false;
     }
diff --git a/solutions/267. Palindrome Permutation II/267.py b/solutions/267. Palindrome Permutation II/267.py
index 1f7ec8a578d..40f0438eded 100644
--- a/solutions/267. Palindrome Permutation II/267.py	
+++ b/solutions/267. Palindrome Permutation II/267.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def generatePalindromes(self, s: str) -> list[str]:
+  def generatePalindromes(self, s: str) -> List[str]:
     count = collections.Counter(s)
 
     # Count odd ones.
@@ -20,7 +20,7 @@ def generatePalindromes(self, s: str) -> list[str]:
       for _ in range(value // 2):
         candidates.append(key)
 
-    def dfs(used: list[bool], path: list[str]) -> None:
+    def dfs(used: List[bool], path: List[chr]) -> None:
       """Generates all the unique palindromes from the candidates."""
       if len(path) == len(candidates):
         ans.append(''.join(path) + mid + ''.join(reversed(path)))
diff --git a/solutions/2670. Find the Distinct Difference Array/2670.java b/solutions/2670. Find the Distinct Difference Array/2670.java
index 77d465952d1..f3ffe3e0f2e 100644
--- a/solutions/2670. Find the Distinct Difference Array/2670.java	
+++ b/solutions/2670. Find the Distinct Difference Array/2670.java	
@@ -1,9 +1,9 @@
 class Solution {
   public int[] distinctDifferenceArray(int[] nums) {
-    final int MAX = 50;
+    final int kMax = 50;
     int[] ans = new int[nums.length];
-    int[] prefixCount = new int[MAX + 1];
-    int[] suffixCount = new int[MAX + 1];
+    int[] prefixCount = new int[kMax + 1];
+    int[] suffixCount = new int[kMax + 1];
     int distinctPrefix = 0;
     int distinctSuffix = 0;
 
diff --git a/solutions/2670. Find the Distinct Difference Array/2670.py b/solutions/2670. Find the Distinct Difference Array/2670.py
index 69cfc773259..4509d468d27 100644
--- a/solutions/2670. Find the Distinct Difference Array/2670.py	
+++ b/solutions/2670. Find the Distinct Difference Array/2670.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def distinctDifferenceArray(self, nums: list[int]) -> list[int]:
-    MAX = 50
+  def distinctDifferenceArray(self, nums: List[int]) -> List[int]:
+    kMax = 50
     ans = []
-    prefixCount = [0] * (MAX + 1)
-    suffixCount = [0] * (MAX + 1)
+    prefixCount = [0] * (kMax + 1)
+    suffixCount = [0] * (kMax + 1)
     distinctPrefix = 0
     distinctSuffix = 0
 
diff --git a/solutions/2672. Number of Adjacent Elements With the Same Color/2672.py b/solutions/2672. Number of Adjacent Elements With the Same Color/2672.py
index 346d3efd857..c4fbd471e68 100644
--- a/solutions/2672. Number of Adjacent Elements With the Same Color/2672.py	
+++ b/solutions/2672. Number of Adjacent Elements With the Same Color/2672.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def colorTheArray(self, n: int, queries: list[list[int]]) -> list[int]:
+  def colorTheArray(self, n: int, queries: List[List[int]]) -> List[int]:
     ans = []
     arr = [0] * n
     sameColors = 0
diff --git a/solutions/2673. Make Costs of Paths Equal in a Binary Tree/2673.py b/solutions/2673. Make Costs of Paths Equal in a Binary Tree/2673.py
index 97aab34d543..0e0735fee98 100644
--- a/solutions/2673. Make Costs of Paths Equal in a Binary Tree/2673.py	
+++ b/solutions/2673. Make Costs of Paths Equal in a Binary Tree/2673.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minIncrements(self, n: int, cost: list[int]) -> int:
+  def minIncrements(self, n: int, cost: List[int]) -> int:
     ans = 0
 
     for i in range(n // 2 - 1, -1, -1):
diff --git a/solutions/2674. Split a Circular Linked List/2674.py b/solutions/2674. Split a Circular Linked List/2674.py
index 803e2bb79d4..136d1b00cce 100644
--- a/solutions/2674. Split a Circular Linked List/2674.py	
+++ b/solutions/2674. Split a Circular Linked List/2674.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def splitCircularLinkedList(self, list: ListNode | None) -> list[ListNode | None]:
+  def splitCircularLinkedList(self, list: Optional[ListNode]) -> List[Optional[ListNode]]:
     slow = list
     fast = list
 
diff --git a/solutions/2678. Number of Senior Citizens/2678.py b/solutions/2678. Number of Senior Citizens/2678.py
index 2cf2fb3b298..71402ed87a4 100644
--- a/solutions/2678. Number of Senior Citizens/2678.py	
+++ b/solutions/2678. Number of Senior Citizens/2678.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def countSeniors(self, details: list[str]) -> int:
+  def countSeniors(self, details: List[str]) -> int:
     return sum(int(detail[11:13]) > 60 for detail in details)
diff --git a/solutions/2679. Sum in a Matrix/2679.py b/solutions/2679. Sum in a Matrix/2679.py
index e8e2525b38b..6d452086627 100644
--- a/solutions/2679. Sum in a Matrix/2679.py	
+++ b/solutions/2679. Sum in a Matrix/2679.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def matrixSum(self, nums: list[list[int]]) -> int:
+  def matrixSum(self, nums: List[List[int]]) -> int:
     for row in nums:
       row.sort()
 
diff --git a/solutions/268. Missing Number/268.py b/solutions/268. Missing Number/268.py
index 5e4602b0945..81f92ee1ecd 100644
--- a/solutions/268. Missing Number/268.py	
+++ b/solutions/268. Missing Number/268.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def missingNumber(self, nums: list[int]) -> int:
+  def missingNumber(self, nums: List[int]) -> int:
     ans = len(nums)
 
     for i, num in enumerate(nums):
diff --git a/solutions/2680. Maximum OR/2680.py b/solutions/2680. Maximum OR/2680.py
index ef169f99a71..682ecc90748 100644
--- a/solutions/2680. Maximum OR/2680.py	
+++ b/solutions/2680. Maximum OR/2680.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumOr(self, nums: list[int], k: int) -> int:
+  def maximumOr(self, nums: List[int], k: int) -> int:
     n = len(nums)
     # prefix[i] := nums[0] | nums[1] | ... | nums[i - 1]
     prefix = [0] * n
diff --git a/solutions/2681. Power of Heroes/2681.java b/solutions/2681. Power of Heroes/2681.java
index d85dad64a93..d05a230c125 100644
--- a/solutions/2681. Power of Heroes/2681.java	
+++ b/solutions/2681. Power of Heroes/2681.java	
@@ -1,14 +1,14 @@
 class Solution {
   public int sumOfPower(int[] nums) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long ans = 0;
     long sum = 0;
 
     Arrays.sort(nums);
 
     for (final int num : nums) {
-      ans = (ans + (num + sum) * num % MOD * num % MOD) % MOD;
-      sum = (sum * 2 + num) % MOD;
+      ans = (ans + (num + sum) * num % kMod * num % kMod) % kMod;
+      sum = (sum * 2 + num) % kMod;
     }
 
     return (int) ans;
diff --git a/solutions/2681. Power of Heroes/2681.py b/solutions/2681. Power of Heroes/2681.py
index 034ced7dc9b..fcab09d39e5 100644
--- a/solutions/2681. Power of Heroes/2681.py	
+++ b/solutions/2681. Power of Heroes/2681.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def sumOfPower(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
+  def sumOfPower(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
     ans = 0
     summ = 0
 
     for num in sorted(nums):
       ans += (num + summ) * num**2
-      ans %= MOD
-      summ = (summ * 2 + num) % MOD
+      ans %= kMod
+      summ = (summ * 2 + num) % kMod
 
     return ans
diff --git a/solutions/2682. Find the Losers of the Circular Game/2682.py b/solutions/2682. Find the Losers of the Circular Game/2682.py
index 4863ac77b9b..5dc1f768bd6 100644
--- a/solutions/2682. Find the Losers of the Circular Game/2682.py	
+++ b/solutions/2682. Find the Losers of the Circular Game/2682.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def circularGameLosers(self, n: int, k: int) -> list[int]:
+  def circularGameLosers(self, n: int, k: int) -> List[int]:
     seen = [False] * n
     friendIndex = 0
     turn = 1
diff --git a/solutions/2683. Neighboring Bitwise XOR/2683.py b/solutions/2683. Neighboring Bitwise XOR/2683.py
index b7468beb68b..ae1d4e3890b 100644
--- a/solutions/2683. Neighboring Bitwise XOR/2683.py	
+++ b/solutions/2683. Neighboring Bitwise XOR/2683.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def doesValidArrayExist(self, derived: list[int]) -> bool:
+  def doesValidArrayExist(self, derived: List[int]) -> bool:
     return functools.reduce(operator.xor, derived) == 0
diff --git a/solutions/2684. Maximum Number of Moves in a Grid/2684.py b/solutions/2684. Maximum Number of Moves in a Grid/2684.py
index 5a836726d77..47f83e5c2f5 100644
--- a/solutions/2684. Maximum Number of Moves in a Grid/2684.py	
+++ b/solutions/2684. Maximum Number of Moves in a Grid/2684.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxMoves(self, grid: list[list[int]]) -> int:
+  def maxMoves(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
     # dp[i][j] := the maximum number of moves you can perform from (i, j)
diff --git a/solutions/2685. Count the Number of Complete Components/2685.py b/solutions/2685. Count the Number of Complete Components/2685.py
index c247183a5b0..c29d602ffa1 100644
--- a/solutions/2685. Count the Number of Complete Components/2685.py	
+++ b/solutions/2685. Count the Number of Complete Components/2685.py	
@@ -35,7 +35,7 @@ def isComplete(self, u):
 
 
 class Solution:
-  def countCompleteComponents(self, n: int, edges: list[list[int]]) -> int:
+  def countCompleteComponents(self, n: int, edges: List[List[int]]) -> int:
     ans = 0
     uf = UnionFind(n)
     parents = set()
diff --git a/solutions/2687. Bikes Last Time Used/2687.sql b/solutions/2687. Bikes Last Time Used/2687.sql
index af501f62a54..5b16e4c5db3 100644
--- a/solutions/2687. Bikes Last Time Used/2687.sql	
+++ b/solutions/2687. Bikes Last Time Used/2687.sql	
@@ -1,4 +1,3 @@
 SELECT bike_number, MAX(end_time) AS end_time
 FROM Bikes
-GROUP BY 1
-ORDER BY 2 DESC;
+GROUP BY 1;
diff --git a/solutions/2689. Extract Kth Character From The Rope Tree/2589-2.py b/solutions/2689. Extract Kth Character From The Rope Tree/2589-2.py
index 6114946be46..3d2b7556050 100644
--- a/solutions/2689. Extract Kth Character From The Rope Tree/2589-2.py	
+++ b/solutions/2689. Extract Kth Character From The Rope Tree/2589-2.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def getKthCharacter(self, root: object | None, k: int) -> str:
-    """:type root: RopeTreeNode | None"""
+  def getKthCharacter(self, root: Optional[object], k: int) -> str:
+    """:type root: Optional[RopeTreeNode]"""
     while root.len > 0:
-      leftLen = (0 if not root.left
-                 else max(root.left.len, len(root.left.val)))
+      leftLen = 0 if root.left is None \
+          else max(root.left.len, len(root.left.val))
       if leftLen >= k:
         root = root.left
       else:
diff --git a/solutions/2689. Extract Kth Character From The Rope Tree/2689.py b/solutions/2689. Extract Kth Character From The Rope Tree/2689.py
index 831dc3dcba2..a3633f2302d 100644
--- a/solutions/2689. Extract Kth Character From The Rope Tree/2689.py	
+++ b/solutions/2689. Extract Kth Character From The Rope Tree/2689.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def getKthCharacter(self, root: object | None, k: int) -> str:
-    """:type root: RopeTreeNode | None"""
+  def getKthCharacter(self, root: Optional[object], k: int) -> str:
+    """:type root: Optional[RopeTreeNode]"""
     if root.len == 0:
       return root.val[k - 1]
-    leftLen = (0 if not root.left
-               else max(root.left.len, len(root.left.val)))
+    leftLen = 0 if root.left is None \
+        else max(root.left.len, len(root.left.val))
     if leftLen >= k:
       return self.getKthCharacter(root.left, k)
     return self.getKthCharacter(root.right, k - leftLen)
diff --git a/solutions/269. Alien Dictionary/269.py b/solutions/269. Alien Dictionary/269.py
index 9dc1cc39a5a..ba03d055a7f 100644
--- a/solutions/269. Alien Dictionary/269.py	
+++ b/solutions/269. Alien Dictionary/269.py	
@@ -1,17 +1,12 @@
 class Solution:
-  def alienOrder(self, words: list[str]) -> str:
+  def alienOrder(self, words: List[str]) -> str:
     graph = {}
     inDegrees = [0] * 26
 
     self._buildGraph(graph, words, inDegrees)
     return self._topology(graph, inDegrees)
 
-  def _buildGraph(
-      self,
-      graph: dict[str, set[str]],
-      words: list[str],
-      inDegrees: list[int],
-  ) -> None:
+  def _buildGraph(self, graph: Dict[chr, Set[chr]], words: List[str], inDegrees: List[int]) -> None:
     # Create a node for each character in each word.
     for word in words:
       for c in word:
@@ -33,7 +28,7 @@ def _buildGraph(
           graph.clear()
           return
 
-  def _topology(self, graph: dict[str, set[str]], inDegrees: list[int]) -> str:
+  def _topology(self, graph: Dict[chr, Set[chr]], inDegrees: List[int]) -> str:
     s = ''
     q = collections.deque()
 
diff --git a/solutions/2698. Find the Punishment Number of an Integer/2698.java b/solutions/2698. Find the Punishment Number of an Integer/2698.java
index f470fd4fc0d..faf844a532d 100644
--- a/solutions/2698. Find the Punishment Number of an Integer/2698.java	
+++ b/solutions/2698. Find the Punishment Number of an Integer/2698.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public int punishmentNumber(int n) {
     int ans = 0;
     for (int i = 1; i <= n; ++i)
diff --git a/solutions/2698. Find the Punishment Number of an Integer/2698.py b/solutions/2698. Find the Punishment Number of an Integer/2698.py
index 51ed0bb782d..a75a96a214d 100644
--- a/solutions/2698. Find the Punishment Number of an Integer/2698.py	
+++ b/solutions/2698. Find the Punishment Number of an Integer/2698.py	
@@ -1,8 +1,6 @@
 class Solution:
   def punishmentNumber(self, n: int) -> int:
-    def isPossible(
-            accumulate: int, running: int, numChars: list[str],
-            s: int, target: int) -> bool:
+    def isPossible(accumulate: int, running: int, numChars: List[str], s: int, target: int) -> bool:
       """
       Returns True if the sum of any split of `numChars` equals to the target.
       """
diff --git a/solutions/2699. Modify Graph Edge Weights/2699.cpp b/solutions/2699. Modify Graph Edge Weights/2699.cpp
index dbb2e8727a7..9941bff3651 100644
--- a/solutions/2699. Modify Graph Edge Weights/2699.cpp	
+++ b/solutions/2699. Modify Graph Edge Weights/2699.cpp	
@@ -53,10 +53,10 @@ class Solution {
  private:
   int dijkstra(const vector<vector<pair<int, int>>>& graph, int src, int dst) {
     vector<int> dist(graph.size(), INT_MAX);
-
-    dist[src] = 0;
     using P = pair<int, int>;  // (d, u)
     priority_queue<P, vector<P>, greater<>> minHeap;
+
+    dist[src] = 0;
     minHeap.emplace(dist[src], src);
 
     while (!minHeap.empty()) {
diff --git a/solutions/2699. Modify Graph Edge Weights/2699.java b/solutions/2699. Modify Graph Edge Weights/2699.java
index 9ace864cc64..86b90feed18 100644
--- a/solutions/2699. Modify Graph Edge Weights/2699.java	
+++ b/solutions/2699. Modify Graph Edge Weights/2699.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int[][] modifiedGraphEdges(int n, int[][] edges, int source, int destination, int target) {
-    final int MAX = 2_000_000_000;
+    final int kMax = 2_000_000_000;
     List<Pair<Integer, Integer>>[] graph = new List[n];
 
     for (int i = 0; i < n; i++)
@@ -23,7 +23,7 @@ public int[][] modifiedGraphEdges(int n, int[][] edges, int source, int destinat
       // Change the weights of negative edges to an impossible value.
       for (int[] edge : edges)
         if (edge[2] == -1)
-          edge[2] = MAX;
+          edge[2] = kMax;
       return edges;
     }
 
@@ -42,7 +42,7 @@ public int[][] modifiedGraphEdges(int n, int[][] edges, int source, int destinat
         // Change the weights of negative edges to an impossible value.
         for (int j = i + 1; j < edges.length; ++j)
           if (edges[j][2] == -1)
-            edges[j][2] = MAX;
+            edges[j][2] = kMax;
         return edges;
       }
     }
@@ -53,12 +53,11 @@ public int[][] modifiedGraphEdges(int n, int[][] edges, int source, int destinat
   private int dijkstra(List<Pair<Integer, Integer>>[] graph, int src, int dst) {
     int[] dist = new int[graph.length];
     Arrays.fill(dist, Integer.MAX_VALUE);
+    // (d, u)
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>((a, b) -> a.getKey() - b.getKey());
 
     dist[src] = 0;
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey)) {
-          { offer(new Pair<>(dist[src], src)); } // (d, u)
-        };
+    minHeap.offer(new Pair<>(dist[src], src));
 
     while (!minHeap.isEmpty()) {
       final int d = minHeap.peek().getKey();
diff --git a/solutions/2699. Modify Graph Edge Weights/2699.py b/solutions/2699. Modify Graph Edge Weights/2699.py
index d2ed4a7597e..df20700a1dc 100644
--- a/solutions/2699. Modify Graph Edge Weights/2699.py	
+++ b/solutions/2699. Modify Graph Edge Weights/2699.py	
@@ -1,6 +1,7 @@
+
 class Solution:
-  def modifiedGraphEdges(self, n: int, edges: list[list[int]], source: int, destination: int, target: int) -> list[list[int]]:
-    MAX = 2_000_000_000
+  def modifiedGraphEdges(self, n: int, edges: List[List[int]], source: int, destination: int, target: int) -> List[List[int]]:
+    kMax = 2_000_000_000
     graph = [[] for _ in range(n)]
 
     for u, v, w in edges:
@@ -16,7 +17,7 @@ def modifiedGraphEdges(self, n: int, edges: list[list[int]], source: int, destin
       # Change the weights of negative edges to an impossible value.
       for edge in edges:
         if edge[2] == -1:
-          edge[2] = MAX
+          edge[2] = kMax
       return edges
 
     for i, (u, v, w) in enumerate(edges):
@@ -31,16 +32,17 @@ def modifiedGraphEdges(self, n: int, edges: list[list[int]], source: int, destin
         # Change the weights of negative edges to an impossible value.
         for j in range(i + 1, len(edges)):
           if edges[j][2] == -1:
-            edges[j][2] = MAX
+            edges[j][2] = kMax
         return edges
 
     return []
 
-  def _dijkstra(self, graph: list[list[int]], src: int, dst: int) -> int:
+  def _dijkstra(self, graph: List[List[int]], src: int, dst: int) -> int:
     dist = [math.inf] * len(graph)
+    minHeap = []  # (d, u)
 
     dist[src] = 0
-    minHeap = [(dist[src], src)]  # (d, u)
+    heapq.heappush(minHeap, (dist[src], src))
 
     while minHeap:
       d, u = heapq.heappop(minHeap)
diff --git a/solutions/27. Remove Element/27.py b/solutions/27. Remove Element/27.py
index 76f1635f2ae..9700bb7cce1 100644
--- a/solutions/27. Remove Element/27.py	
+++ b/solutions/27. Remove Element/27.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def removeElement(self, nums: list[int], val: int) -> int:
+  def removeElement(self, nums: List[int], val: int) -> int:
     i = 0
 
     for num in nums:
diff --git a/solutions/270. Closest Binary Search Tree Value/270.py b/solutions/270. Closest Binary Search Tree Value/270.py
index ce3315caffd..5fad40b1977 100644
--- a/solutions/270. Closest Binary Search Tree Value/270.py	
+++ b/solutions/270. Closest Binary Search Tree Value/270.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def closestValue(self, root: TreeNode | None, target: float) -> int:
+  def closestValue(self, root: Optional[TreeNode], target: float) -> int:
     # If target < root.val, search the left subtree.
     if target < root.val and root.left:
       left = self.closestValue(root.left, target)
diff --git a/solutions/2702. Minimum Operations to Make Numbers Non-positive/2702.py b/solutions/2702. Minimum Operations to Make Numbers Non-positive/2702.py
index 07dd68bddbe..bf597516830 100644
--- a/solutions/2702. Minimum Operations to Make Numbers Non-positive/2702.py	
+++ b/solutions/2702. Minimum Operations to Make Numbers Non-positive/2702.py	
@@ -9,4 +9,5 @@ def isPossible(m: int) -> bool:
       return sum(max(0, math.ceil((num - y * m) / (x - y)))
                  for num in nums) <= m
 
-    return bisect.bisect_left(range(max(nums)), True, key=isPossible)
+    return bisect.bisect_left(range(max(nums)), True,
+                              key=isPossible)
diff --git a/solutions/2706. Buy Two Chocolates/2706.py b/solutions/2706. Buy Two Chocolates/2706.py
index f17e4c345dc..db98bce87ec 100644
--- a/solutions/2706. Buy Two Chocolates/2706.py	
+++ b/solutions/2706. Buy Two Chocolates/2706.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def buyChoco(self, prices: list[int], money: int) -> int:
+  def buyChoco(self, prices: List[int], money: int) -> int:
     min1 = math.inf
     min2 = math.inf
 
diff --git a/solutions/2707. Extra Characters in a String/2707.py b/solutions/2707. Extra Characters in a String/2707.py
index 0f84edbcb09..b12b92ec1b2 100644
--- a/solutions/2707. Extra Characters in a String/2707.py	
+++ b/solutions/2707. Extra Characters in a String/2707.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Similar to 139. Word Break
-  def minExtraChar(self, s: str, dictionary: list[str]) -> int:
+  def minExtraChar(self, s: str, dictionary: List[str]) -> int:
     n = len(s)
     dictionarySet = set(dictionary)
     # dp[i] := the minimum extra letters if breaking up s[0..i) optimally
diff --git a/solutions/2708. Maximum Strength of a Group/2708.py b/solutions/2708. Maximum Strength of a Group/2708.py
index fab72c0be87..b001ed4eb8b 100644
--- a/solutions/2708. Maximum Strength of a Group/2708.py	
+++ b/solutions/2708. Maximum Strength of a Group/2708.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxStrength(self, nums: list[int]) -> int:
+  def maxStrength(self, nums: List[int]) -> int:
     posProd = 1
     negProd = 1
     maxNeg = -math.inf
diff --git a/solutions/2709. Greatest Common Divisor Traversal/2709.cpp b/solutions/2709. Greatest Common Divisor Traversal/2709.cpp
index c13ddea8409..a8923bc2e41 100644
--- a/solutions/2709. Greatest Common Divisor Traversal/2709.cpp	
+++ b/solutions/2709. Greatest Common Divisor Traversal/2709.cpp	
@@ -35,8 +35,8 @@ class Solution {
  public:
   bool canTraverseAllPairs(vector<int>& nums) {
     const int n = nums.size();
-    const int mx = ranges::max(nums);
-    const vector<int> minPrimeFactors = sieveEratosthenes(mx + 1);
+    const int maxNum = ranges::max(nums);
+    const vector<int> minPrimeFactors = sieveEratosthenes(maxNum + 1);
     unordered_map<int, int> primeToFirstIndex;
     UnionFind uf(n);
 
diff --git a/solutions/2709. Greatest Common Divisor Traversal/2709.java b/solutions/2709. Greatest Common Divisor Traversal/2709.java
index f4d7197566c..cd67b9c84a9 100644
--- a/solutions/2709. Greatest Common Divisor Traversal/2709.java	
+++ b/solutions/2709. Greatest Common Divisor Traversal/2709.java	
@@ -37,8 +37,8 @@ private int find(int u) {
 class Solution {
   public boolean canTraverseAllPairs(int[] nums) {
     final int n = nums.length;
-    final int mx = Arrays.stream(nums).max().getAsInt();
-    final int[] minPrimeFactors = sieveEratosthenes(mx + 1);
+    final int maxNum = Arrays.stream(nums).max().getAsInt();
+    final int[] minPrimeFactors = sieveEratosthenes(maxNum + 1);
     Map<Integer, Integer> primeToFirstIndex = new HashMap<>();
     UnionFind uf = new UnionFind(n);
 
diff --git a/solutions/2709. Greatest Common Divisor Traversal/2709.py b/solutions/2709. Greatest Common Divisor Traversal/2709.py
index 82330207bd3..edc2bfadf8d 100644
--- a/solutions/2709. Greatest Common Divisor Traversal/2709.py	
+++ b/solutions/2709. Greatest Common Divisor Traversal/2709.py	
@@ -25,10 +25,10 @@ def _find(self, u: int) -> int:
 
 
 class Solution:
-  def canTraverseAllPairs(self, nums: list[int]) -> bool:
+  def canTraverseAllPairs(self, nums: List[int]) -> bool:
     n = len(nums)
-    mx = max(nums)
-    maxPrimeFactor = self._sieveEratosthenes(mx + 1)
+    max_num = max(nums)
+    maxPrimeFactor = self._sieveEratosthenes(max_num + 1)
     primeToFirstIndex = collections.defaultdict(int)
     uf = UnionFind(n)
 
@@ -41,7 +41,7 @@ def canTraverseAllPairs(self, nums: list[int]) -> bool:
 
     return any(uf.getSize(i) == n for i in range(n))
 
-  def _sieveEratosthenes(self, n: int) -> list[int]:
+  def _sieveEratosthenes(self, n: int) -> List[int]:
     """Gets the minimum prime factor of i, where 1 < i <= n."""
     minPrimeFactors = [i for i in range(n + 1)]
     for i in range(2, int(n**0.5) + 1):
@@ -50,7 +50,7 @@ def _sieveEratosthenes(self, n: int) -> list[int]:
           minPrimeFactors[j] = min(minPrimeFactors[j], i)
     return minPrimeFactors
 
-  def _getPrimeFactors(self, num: int, minPrimeFactors: list[int]) -> list[int]:
+  def _getPrimeFactors(self, num: int, minPrimeFactors: List[int]) -> List[int]:
     primeFactors = []
     while num > 1:
       divisor = minPrimeFactors[num]
diff --git a/solutions/271. Encode and Decode Strings/271.py b/solutions/271. Encode and Decode Strings/271.py
index 7a0c93109a6..6419f663d7f 100644
--- a/solutions/271. Encode and Decode Strings/271.py	
+++ b/solutions/271. Encode and Decode Strings/271.py	
@@ -1,9 +1,9 @@
 class Codec:
-  def encode(self, strs: list[str]) -> str:
+  def encode(self, strs: List[str]) -> str:
     """Encodes a list of strings to a single string."""
     return ''.join(str(len(s)) + '/' + s for s in strs)
 
-  def decode(self, s: str) -> list[str]:
+  def decode(self, s: str) -> List[str]:
     """Decodes a single string to a list of strings."""
     decoded = []
 
diff --git a/solutions/2711. Difference of Number of Distinct Values on Diagonals/2711.py b/solutions/2711. Difference of Number of Distinct Values on Diagonals/2711.py
index 332336c779f..0a151e14d78 100644
--- a/solutions/2711. Difference of Number of Distinct Values on Diagonals/2711.py	
+++ b/solutions/2711. Difference of Number of Distinct Values on Diagonals/2711.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def differenceOfDistinctValues(self, grid: list[list[int]]) -> list[list[int]]:
+  def differenceOfDistinctValues(self, grid: List[List[int]]) -> List[List[int]]:
     m = len(grid)
     n = len(grid[0])
     ans = [[0] * n for _ in range(m)]
diff --git a/solutions/2713. Maximum Strictly Increasing Cells in a Matrix/2713.py b/solutions/2713. Maximum Strictly Increasing Cells in a Matrix/2713.py
index 48837910b8b..749789bf0a7 100644
--- a/solutions/2713. Maximum Strictly Increasing Cells in a Matrix/2713.py	
+++ b/solutions/2713. Maximum Strictly Increasing Cells in a Matrix/2713.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxIncreasingCells(self, mat: list[list[int]]) -> int:
+  def maxIncreasingCells(self, mat: List[List[int]]) -> int:
     m = len(mat)
     n = len(mat[0])
     rows = [0] * m  # rows[i] := the maximum path length for the i-th row
diff --git a/solutions/2714. Find Shortest Path with K Hops/2714.cpp b/solutions/2714. Find Shortest Path with K Hops/2714.cpp
index 3675b2d8fe3..e0a41748f2a 100644
--- a/solutions/2714. Find Shortest Path with K Hops/2714.cpp	
+++ b/solutions/2714. Find Shortest Path with K Hops/2714.cpp	
@@ -20,10 +20,10 @@ class Solution {
   int dijkstra(const vector<vector<pair<int, int>>>& graph, int src, int dst,
                int k) {
     vector<vector<int>> dist(graph.size(), vector<int>(k + 1, INT_MAX));
-
-    dist[src][k] = 0;
     using T = tuple<int, int, int>;  // (d, u, hops)
     priority_queue<T, vector<T>, greater<>> minHeap;
+
+    dist[src][k] = 0;
     minHeap.emplace(dist[src][k], src, k);
 
     while (!minHeap.empty()) {
diff --git a/solutions/2714. Find Shortest Path with K Hops/2714.java b/solutions/2714. Find Shortest Path with K Hops/2714.java
index 6317b299fed..8e954cf7ff6 100644
--- a/solutions/2714. Find Shortest Path with K Hops/2714.java	
+++ b/solutions/2714. Find Shortest Path with K Hops/2714.java	
@@ -20,11 +20,11 @@ public int shortestPathWithHops(int n, int[][] edges, int s, int d, int k) {
   private int dijkstra(List<Pair<Integer, Integer>>[] graph, int src, int dst, int k) {
     int[][] dist = new int[graph.length][k + 1];
     Arrays.stream(dist).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE));
+    // (d, u, hops)
+    Queue<int[]> minHeap = new PriorityQueue<>((a, b) -> a[0] - b[0]);
 
     dist[src][k] = 0;
-    Queue<int[]> minHeap = new PriorityQueue<>(Comparator.comparingInt(a -> a[0])) {
-      { offer(new int[] {dist[src][k], src, k}); } // (d, u, hops)
-    };
+    minHeap.offer(new int[] {dist[src][k], src, k});
 
     while (!minHeap.isEmpty()) {
       final int d = minHeap.peek()[0];
diff --git a/solutions/2714. Find Shortest Path with K Hops/2714.py b/solutions/2714. Find Shortest Path with K Hops/2714.py
index 4a034abb922..b92834a2f63 100644
--- a/solutions/2714. Find Shortest Path with K Hops/2714.py	
+++ b/solutions/2714. Find Shortest Path with K Hops/2714.py	
@@ -1,13 +1,6 @@
 class Solution:
   # Similar to 787. Cheapest Flights Within K Stops
-  def shortestPathWithHops(
-      self,
-      n: int,
-      edges: list[list[int]],
-      s: int,
-      d: int,
-      k: int,
-  ) -> int:
+  def shortestPathWithHops(self, n: int, edges: List[List[int]], s: int, d: int, k: int) -> int:
     graph = [[] for _ in range(n)]
 
     for u, v, w in edges:
@@ -16,13 +9,7 @@ def shortestPathWithHops(
 
     return self._dijkstra(graph, s, d, k)
 
-  def _dijkstra(
-      self,
-      graph: list[list[tuple[int, int]]],
-      src: int,
-      dst: int,
-      k: int,
-  ) -> int:
+  def _dijkstra(self, graph: List[List[Tuple[int, int]]], src: int, dst: int, k: int) -> int:
     dist = [[math.inf for _ in range(k + 1)] for _ in range(len(graph))]
 
     dist[src][k] = 0
diff --git a/solutions/2717. Semi-Ordered Permutation/2717.py b/solutions/2717. Semi-Ordered Permutation/2717.py
index 6454f688edd..75ea131f50a 100644
--- a/solutions/2717. Semi-Ordered Permutation/2717.py	
+++ b/solutions/2717. Semi-Ordered Permutation/2717.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def semiOrderedPermutation(self, nums: list[int]) -> int:
+  def semiOrderedPermutation(self, nums: List[int]) -> int:
     n = len(nums)
     index1 = nums.index(1)
     indexN = nums.index(n)
diff --git a/solutions/2718. Sum of Matrix After Queries/2718.py b/solutions/2718. Sum of Matrix After Queries/2718.py
index d8255d37668..97239354293 100644
--- a/solutions/2718. Sum of Matrix After Queries/2718.py	
+++ b/solutions/2718. Sum of Matrix After Queries/2718.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def matrixSumQueries(self, n: int, queries: list[list[int]]) -> int:
+  def matrixSumQueries(self, n: int, queries: List[List[int]]) -> int:
     ans = 0
     # seen[0] := row, seen[1] := col
     seen = [[False] * n for _ in range(2)]
diff --git a/solutions/2719. Count of Integers/2719.cpp b/solutions/2719. Count of Integers/2719.cpp
index 994bf62080a..9ca82eb1cf1 100644
--- a/solutions/2719. Count of Integers/2719.cpp	
+++ b/solutions/2719. Count of Integers/2719.cpp	
@@ -17,29 +17,30 @@ class Solution {
   static constexpr int kMod = 1'000'000'007;
 
   // Returns the number of valid integers, considering the i-th digit, where
-  // `sum` is the maximum digit sum, `tight1` indicates if the current digit
-  // is tightly bound for `num1` and `tight2` indicates if the current digit
+  // `sum` is the maximum digit sum, `isTight1` indicates if the current digit
+  // is tightly bound for `num1` and `isTight2` indicates if the current digit
   // is tightly bound for `num2`
-  int count(const string& num1, const string& num2, int i, int sum, bool tight1,
-            bool tight2, vector<vector<vector<vector<int>>>>& mem) {
+  int count(const string& num1, const string& num2, int i, int sum,
+            bool isTight1, bool isTight2,
+            vector<vector<vector<vector<int>>>>& mem) {
     if (sum < 0)
       return 0;
     if (i == num2.length())
       return 1;
-    if (mem[i][sum][tight1][tight2] != -1)
-      return mem[i][sum][tight1][tight2];
+    if (mem[i][sum][isTight1][isTight2] != -1)
+      return mem[i][sum][isTight1][isTight2];
 
     int res = 0;
 
-    const int minDigit = tight1 ? num1[i] - '0' : 0;
-    const int maxDigit = tight2 ? num2[i] - '0' : 9;
+    const int minDigit = isTight1 ? num1[i] - '0' : 0;
+    const int maxDigit = isTight2 ? num2[i] - '0' : 9;
     for (int d = minDigit; d <= maxDigit; ++d) {
-      const bool nextTight1 = tight1 && (d == minDigit);
-      const bool nextTight2 = tight2 && (d == maxDigit);
-      res += count(num1, num2, i + 1, sum - d, nextTight1, nextTight2, mem);
+      const bool nextIsTight1 = isTight1 && (d == minDigit);
+      const bool nextIsTight2 = isTight2 && (d == maxDigit);
+      res += count(num1, num2, i + 1, sum - d, nextIsTight1, nextIsTight2, mem);
       res %= kMod;
     }
 
-    return mem[i][sum][tight1][tight2] = res;
+    return mem[i][sum][isTight1][isTight2] = res;
   }
 };
diff --git a/solutions/272. Closest Binary Search Tree Value II/272.py b/solutions/272. Closest Binary Search Tree Value II/272.py
index f059497e0e5..d01554ca159 100644
--- a/solutions/272. Closest Binary Search Tree Value II/272.py	
+++ b/solutions/272. Closest Binary Search Tree Value II/272.py	
@@ -1,13 +1,8 @@
 class Solution:
-  def closestKValues(
-      self,
-      root: TreeNode | None,
-      target: float,
-      k: int,
-  ) -> list[int]:
+  def closestKValues(self, root: Optional[TreeNode], target: float, k: int) -> List[int]:
     dq = collections.deque()
 
-    def inorder(root: TreeNode | None) -> None:
+    def inorder(root: Optional[TreeNode]) -> None:
       if not root:
         return
 
diff --git a/solutions/273. Integer to English Words/273.py b/solutions/273. Integer to English Words/273.py
index 2ced2b547f3..101beb7b3b0 100644
--- a/solutions/273. Integer to English Words/273.py	
+++ b/solutions/273. Integer to English Words/273.py	
@@ -1,29 +1,32 @@
 class Solution:
   def numberToWords(self, num: int) -> str:
     if num == 0:
-      return 'Zero'
+      return "Zero"
 
-    belowTwenty = ['',        'One',       'Two',      'Three',
-                   'Four',    'Five',      'Six',      'Seven',
-                   'Eight',   'Nine',      'Ten',      'Eleven',
-                   'Twelve',  'Thirteen',  'Fourteen', 'Fifteen',
-                   'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen']
-    tens = ['',      'Ten',   'Twenty',  'Thirty', 'Forty',
-            'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety']
+    belowTwenty = ["",        "One",       "Two",      "Three",
+                   "Four",    "Five",      "Six",      "Seven",
+                   "Eight",   "Nine",      "Ten",      "Eleven",
+                   "Twelve",  "Thirteen",  "Fourteen", "Fifteen",
+                   "Sixteen", "Seventeen", "Eighteen", "Nineteen"]
+    tens = ["",      "Ten",   "Twenty",  "Thirty", "Forty",
+            "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"]
 
     def helper(num: int) -> str:
       if num < 20:
         s = belowTwenty[num]
       elif num < 100:
-        s = tens[num // 10] + ' ' + belowTwenty[num % 10]
+        s = tens[num // 10] + " " + belowTwenty[num % 10]
       elif num < 1000:
-        s = helper(num // 100) + ' Hundred ' + helper(num % 100)
+        s = helper(num // 100) + " Hundred " + helper(num % 100)
       elif num < 1000000:
-        s = helper(num // 1000) + ' Thousand ' + helper(num % 1000)
+        s = helper(num // 1000) + " Thousand " + helper(num % 1000)
       elif num < 1000000000:
-        s = helper(num // 1000000) + ' Million ' + helper(num % 1000000)
+        s = helper(num // 1000000) + " Million " + \
+            helper(num % 1000000)
       else:
-        s = helper(num // 1000000000) + ' Billion ' + helper(num % 1000000000)
+        s = helper(num // 1000000000) + " Billion " + \
+            helper(num % 1000000000)
+
       return s.strip()
 
     return helper(num)
diff --git a/solutions/2731. Movement of Robots/2731.java b/solutions/2731. Movement of Robots/2731.java
index 4c259e2327e..dd70189aa12 100644
--- a/solutions/2731. Movement of Robots/2731.java	
+++ b/solutions/2731. Movement of Robots/2731.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int sumDistance(int[] nums, String s, int d) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = nums.length;
     int ans = 0;
     int prefix = 0;
@@ -15,8 +15,8 @@ public int sumDistance(int[] nums, String s, int d) {
     Arrays.sort(pos);
 
     for (int i = 0; i < n; ++i) {
-      ans = (int) (((ans + 1L * i * pos[i] - prefix) % MOD + MOD) % MOD);
-      prefix = (int) (((0L + prefix + pos[i]) % MOD + MOD) % MOD);
+      ans = (int) (((ans + 1L * i * pos[i] - prefix) % kMod + kMod) % kMod);
+      prefix = (int) (((0L + prefix + pos[i]) % kMod + kMod) % kMod);
     }
 
     return ans;
diff --git a/solutions/2731. Movement of Robots/2731.py b/solutions/2731. Movement of Robots/2731.py
index 9dfdb45c845..a76af26c5b0 100644
--- a/solutions/2731. Movement of Robots/2731.py	
+++ b/solutions/2731. Movement of Robots/2731.py	
@@ -1,13 +1,13 @@
 class Solution:
-  def sumDistance(self, nums: list[int], s: str, d: int) -> int:
-    MOD = 1_000_000_007
+  def sumDistance(self, nums: List[int], s: str, d: int) -> int:
+    kMod = 1_000_000_007
     ans = 0
     prefix = 0
     pos = sorted([num - d if c == 'L' else num + d
                   for num, c in zip(nums, s)])
 
     for i, p in enumerate(pos):
-      ans = ((ans + i * p - prefix) % MOD + MOD) % MOD
-      prefix = ((prefix + p) % MOD + MOD) % MOD
+      ans = ((ans + i * p - prefix) % kMod + kMod) % kMod
+      prefix = ((prefix + p) % kMod + kMod) % kMod
 
     return ans
diff --git a/solutions/2732. Find a Good Subset of the Matrix/2732.java b/solutions/2732. Find a Good Subset of the Matrix/2732.java
index fa1c7495510..b7208f09c3d 100644
--- a/solutions/2732. Find a Good Subset of the Matrix/2732.java	
+++ b/solutions/2732. Find a Good Subset of the Matrix/2732.java	
@@ -1,13 +1,13 @@
 class Solution {
   public List<Integer> goodSubsetofBinaryMatrix(int[][] grid) {
-    final int MAX_BIT = 30;
+    final int kMaxBit = 30;
     Map<Integer, Integer> maskToIndex = new HashMap<>();
 
     for (int i = 0; i < grid.length; ++i) {
       final int mask = getMask(grid[i]);
       if (mask == 0)
         return List.of(i);
-      for (int prevMask = 1; prevMask < MAX_BIT; ++prevMask)
+      for (int prevMask = 1; prevMask < kMaxBit; ++prevMask)
         if ((mask & prevMask) == 0 && maskToIndex.containsKey(prevMask))
           return List.of(maskToIndex.get(prevMask), i);
       maskToIndex.put(mask, i);
diff --git a/solutions/2732. Find a Good Subset of the Matrix/2732.py b/solutions/2732. Find a Good Subset of the Matrix/2732.py
index c84e51fdd74..8726547cd3e 100644
--- a/solutions/2732. Find a Good Subset of the Matrix/2732.py	
+++ b/solutions/2732. Find a Good Subset of the Matrix/2732.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def goodSubsetofBinaryMatrix(self, grid: list[list[int]]) -> list[int]:
-    MAX_BIT = 30
+  def goodSubsetofBinaryMatrix(self, grid: List[List[int]]) -> List[int]:
+    kMaxBit = 30
     maskToIndex = {}
 
-    def getMask(row: list[int]) -> int:
+    def getMask(row: List[int]) -> int:
       mask = 0
       for i, num in enumerate(row):
         if num == 1:
@@ -14,7 +14,7 @@ def getMask(row: list[int]) -> int:
       mask = getMask(row)
       if mask == 0:
         return [i]
-      for prevMask in range(1, MAX_BIT):
+      for prevMask in range(1, kMaxBit):
         if (mask & prevMask) == 0 and prevMask in maskToIndex:
           return [maskToIndex[prevMask], i]
       maskToIndex[mask] = i
diff --git a/solutions/2733. Neither Minimum nor Maximum/2733.py b/solutions/2733. Neither Minimum nor Maximum/2733.py
index 14ae604b94f..7f2c6ad5951 100644
--- a/solutions/2733. Neither Minimum nor Maximum/2733.py	
+++ b/solutions/2733. Neither Minimum nor Maximum/2733.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def findNonMinOrMax(self, nums: list[int]) -> int:
+  def findNonMinOrMax(self, nums: List[int]) -> int:
     return -1 if len(nums) < 3 else sorted(nums[:3])[1]
diff --git a/solutions/2734. Lexicographically Smallest String After Substring Operation/2734.java b/solutions/2734. Lexicographically Smallest String After Substring Operation/2734.java
index c2553d5acaa..086a704e96f 100644
--- a/solutions/2734. Lexicographically Smallest String After Substring Operation/2734.java	
+++ b/solutions/2734. Lexicographically Smallest String After Substring Operation/2734.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public String smallestString(String s) {
     char[] charArray = s.toCharArray();
     final int n = s.length();
diff --git a/solutions/2735. Collecting Chocolates/2735.java b/solutions/2735. Collecting Chocolates/2735.java
index 95f0a185751..221b19a4a10 100644
--- a/solutions/2735. Collecting Chocolates/2735.java	
+++ b/solutions/2735. Collecting Chocolates/2735.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public long minCost(int[] nums, long x) {
     int n = nums.length;
     long ans = Long.MAX_VALUE;
diff --git a/solutions/2735. Collecting Chocolates/2735.py b/solutions/2735. Collecting Chocolates/2735.py
index c32a084948f..4a778966220 100644
--- a/solutions/2735. Collecting Chocolates/2735.py	
+++ b/solutions/2735. Collecting Chocolates/2735.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minCost(self, nums: list[int], x: int) -> int:
+  def minCost(self, nums: List[int], x: int) -> int:
     n = len(nums)
     ans = math.inf
     # minCost[i] := the minimum cost to collect the i-th type
diff --git a/solutions/2736. Maximum Sum Queries/2736.cpp b/solutions/2736. Maximum Sum Queries/2736.cpp
index 701cd5ea407..2ff83b559d8 100644
--- a/solutions/2736. Maximum Sum Queries/2736.cpp	
+++ b/solutions/2736. Maximum Sum Queries/2736.cpp	
@@ -41,8 +41,7 @@ class Solution {
     vector<Pair> pairs;
     for (int i = 0; i < nums1.size(); ++i)
       pairs.push_back({nums1[i], nums2[i]});
-    ranges::sort(pairs, ranges::greater{},
-                 [](const Pair& pair) { return pair.x; });
+    ranges::sort(pairs, [](const Pair& a, const Pair& b) { return a.x > b.x; });
     return pairs;
   }
 
diff --git a/solutions/2736. Maximum Sum Queries/2736.java b/solutions/2736. Maximum Sum Queries/2736.java
index e78487af609..d248164de63 100644
--- a/solutions/2736. Maximum Sum Queries/2736.java	
+++ b/solutions/2736. Maximum Sum Queries/2736.java	
@@ -49,7 +49,7 @@ private MyPair[] getPairs(int[] nums1, int[] nums2) {
     MyPair[] pairs = new MyPair[nums1.length];
     for (int i = 0; i < nums1.length; ++i)
       pairs[i] = new MyPair(nums1[i], nums2[i]);
-    Arrays.sort(pairs, Comparator.comparing(MyPair::x, Comparator.reverseOrder()));
+    Arrays.sort(pairs, (a, b) -> b.x - a.x);
     return pairs;
   }
 
@@ -57,8 +57,7 @@ private IndexedQuery[] getIndexedQueries(int[][] queries) {
     IndexedQuery[] indexedQueries = new IndexedQuery[queries.length];
     for (int i = 0; i < queries.length; ++i)
       indexedQueries[i] = new IndexedQuery(i, queries[i][0], queries[i][1]);
-    Arrays.sort(indexedQueries,
-                Comparator.comparing(IndexedQuery::minX, Comparator.reverseOrder()));
+    Arrays.sort(indexedQueries, (a, b) -> b.minX - a.minX);
     return indexedQueries;
   }
 }
diff --git a/solutions/2736. Maximum Sum Queries/2736.py b/solutions/2736. Maximum Sum Queries/2736.py
index d8fedb15346..97f757577ca 100644
--- a/solutions/2736. Maximum Sum Queries/2736.py	
+++ b/solutions/2736. Maximum Sum Queries/2736.py	
@@ -1,21 +1,18 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
 class Pair:
-  x: int
-  y: int
+  def __init__(self, x: int, y: int):
+    self.x = x
+    self.y = y
 
   def __iter__(self):
     yield self.x
     yield self.y
 
 
-@dataclass(frozen=True)
 class IndexedQuery:
-  queryIndex: int
-  minX: int
-  minY: int
+  def __init__(self, queryIndex: int, minX: int, minY: int):
+    self.queryIndex = queryIndex
+    self.minX = minX
+    self.minY = minY
 
   def __iter__(self):
     yield self.queryIndex
@@ -24,21 +21,16 @@ def __iter__(self):
 
 
 class Solution:
-  def maximumSumQueries(
-      self,
-      nums1: list[int],
-      nums2: list[int],
-      queries: list[list[int]],
-  ) -> list[int]:
+  def maximumSumQueries(self, nums1: List[int], nums2: List[int], queries: List[List[int]]) -> List[int]:
     pairs = sorted([Pair(nums1[i], nums2[i])
-                   for i in range(len(nums1))], key=lambda x: x.x, reverse=True)
+                   for i in range(len(nums1))], key=lambda p: p.x, reverse=True)
     ans = [0] * len(queries)
     stack = []  # [(y, x + y)]
 
     pairsIndex = 0
     for queryIndex, minX, minY in sorted([IndexedQuery(i, query[0], query[1])
                                           for i, query in enumerate(queries)],
-                                         key=lambda x: -x.minX):
+                                         key=lambda iq: -iq.minX):
       while pairsIndex < len(pairs) and pairs[pairsIndex].x >= minX:
         # x + y is a better candidate. Given that x is decreasing, the
         # condition "x + y >= stack[-1][1]" suggests that y is relatively
@@ -54,7 +46,7 @@ def maximumSumQueries(
 
     return ans
 
-  def _firstGreaterEqual(self, A: list[tuple[int, int]], target: int) -> int:
+  def _firstGreaterEqual(self, A: List[Tuple[int, int]], target: int) -> int:
     l = 0
     r = len(A)
     while l < r:
diff --git a/solutions/2737. Find the Closest Marked Node/2737.cpp b/solutions/2737. Find the Closest Marked Node/2737.cpp
index 1bf92582bf5..31a0545d521 100644
--- a/solutions/2737. Find the Closest Marked Node/2737.cpp	
+++ b/solutions/2737. Find the Closest Marked Node/2737.cpp	
@@ -23,10 +23,10 @@ class Solution {
  private:
   vector<int> dijkstra(const vector<vector<pair<int, int>>>& graph, int src) {
     vector<int> dist(graph.size(), INT_MAX);
-
-    dist[src] = 0;
     using P = pair<int, int>;  // (d, u)
     priority_queue<P, vector<P>, greater<>> minHeap;
+
+    dist[src] = 0;
     minHeap.emplace(dist[src], src);
 
     while (!minHeap.empty()) {
diff --git a/solutions/2737. Find the Closest Marked Node/2737.java b/solutions/2737. Find the Closest Marked Node/2737.java
index 2196d6c8a62..4e2183839b5 100644
--- a/solutions/2737. Find the Closest Marked Node/2737.java	
+++ b/solutions/2737. Find the Closest Marked Node/2737.java	
@@ -24,14 +24,11 @@ public int minimumDistance(int n, List<List<Integer>> edges, int s, int[] marked
   private int[] dijkstra(List<Pair<Integer, Integer>>[] graph, int src) {
     int[] dist = new int[graph.length];
     Arrays.fill(dist, Integer.MAX_VALUE);
+    // (d, u)
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
 
     dist[src] = 0;
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey)) {
-          {
-            offer(new Pair<>(dist[src], src)); // (d, u)
-          }
-        };
+    minHeap.offer(new Pair<>(dist[src], src));
 
     while (!minHeap.isEmpty()) {
       final int d = minHeap.peek().getKey();
diff --git a/solutions/2737. Find the Closest Marked Node/2737.py b/solutions/2737. Find the Closest Marked Node/2737.py
index ed6859c129d..b863ec36416 100644
--- a/solutions/2737. Find the Closest Marked Node/2737.py	
+++ b/solutions/2737. Find the Closest Marked Node/2737.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def minimumDistance(
-      self,
-      n: int,
-      edges: list[list[int]],
-      s: int,
-      marked: list[int],
-  ) -> int:
+  def minimumDistance(self, n: int, edges: List[List[int]], s: int, marked: List[int]) -> int:
     graph = [[] for _ in range(n)]
 
     for u, v, w in edges:
@@ -15,11 +9,7 @@ def minimumDistance(
     ans = min(dist[u] for u in marked)
     return -1 if ans == math.inf else ans
 
-  def _dijkstra(
-      self,
-      graph: list[list[tuple[int, int]]],
-      src: int,
-  ) -> list[int]:
+  def _dijkstra(self, graph: List[List[Tuple[int, int]]], src: int) -> List[int]:
     dist = [math.inf] * len(graph)
 
     dist[src] = 0
diff --git a/solutions/274. H-Index/274-2.py b/solutions/274. H-Index/274-2.py
index 2e3610c5457..0787cbd3874 100644
--- a/solutions/274. H-Index/274-2.py	
+++ b/solutions/274. H-Index/274-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def hIndex(self, citations: list[int]) -> int:
+  def hIndex(self, citations: List[int]) -> int:
     n = len(citations)
 
     citations.sort()
diff --git a/solutions/274. H-Index/274.py b/solutions/274. H-Index/274.py
index a097bc1cca3..707e3a57292 100644
--- a/solutions/274. H-Index/274.py	
+++ b/solutions/274. H-Index/274.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def hIndex(self, citations: list[int]) -> int:
+  def hIndex(self, citations: List[int]) -> int:
     n = len(citations)
     accumulate = 0
     count = [0] * (n + 1)
diff --git a/solutions/2740. Find the Value of the Partition/2740.py b/solutions/2740. Find the Value of the Partition/2740.py
index b88a61a7dd9..aa4b6ea2c0c 100644
--- a/solutions/2740. Find the Value of the Partition/2740.py	
+++ b/solutions/2740. Find the Value of the Partition/2740.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def findValueOfPartition(self, nums: list[int]) -> int:
+  def findValueOfPartition(self, nums: List[int]) -> int:
     return min(b - a for a, b in itertools.pairwise(sorted(nums)))
diff --git a/solutions/2741. Special Permutations/2741.java b/solutions/2741. Special Permutations/2741.java
index de590f96639..0ca483d26ab 100644
--- a/solutions/2741. Special Permutations/2741.java	
+++ b/solutions/2741. Special Permutations/2741.java	
@@ -7,13 +7,13 @@ public int specialPerm(int[] nums) {
 
     for (int i = 0; i < n; ++i) {
       ans += specialPerm(nums, i, 1 << i, maxMask, mem);
-      ans %= MOD;
+      ans %= kMod;
     }
 
     return ans;
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of special permutations, where the previous number is
   // nums[i] and `mask` is the bitmask of the used numbers.
@@ -30,7 +30,7 @@ private int specialPerm(int[] nums, int prev, int mask, int maxMask, int[][] mem
         continue;
       if (nums[i] % nums[prev] == 0 || nums[prev] % nums[i] == 0) {
         res += specialPerm(nums, i, mask | 1 << i, maxMask, mem);
-        res %= MOD;
+        res %= kMod;
       }
     }
 
diff --git a/solutions/2741. Special Permutations/2741.py b/solutions/2741. Special Permutations/2741.py
index 4a8e8739d37..8a9fc705bfc 100644
--- a/solutions/2741. Special Permutations/2741.py	
+++ b/solutions/2741. Special Permutations/2741.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def specialPerm(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
+  def specialPerm(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
     maxMask = 1 << len(nums)
 
     @functools.lru_cache(None)
@@ -19,9 +19,9 @@ def dp(prev: int, mask: int) -> int:
           continue
         if num % nums[prev] == 0 or nums[prev] % num == 0:
           res += dp(i, mask | 1 << i)
-          res %= MOD
+          res %= kMod
 
       return res
 
     return sum(dp(i, 1 << i)
-               for i in range(len(nums))) % MOD
+               for i in range(len(nums))) % kMod
diff --git a/solutions/2742. Painting the Walls/2742-2.java b/solutions/2742. Painting the Walls/2742-2.java
index 416b69b44ad..a29053e1f25 100644
--- a/solutions/2742. Painting the Walls/2742-2.java	
+++ b/solutions/2742. Painting the Walls/2742-2.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int paintWalls(int[] cost, int[] time) {
-    final int MAX = 500_000_000;
+    final int kMax = 500_000_000;
     final int n = cost.length;
     // dp[i] := the minimum cost to paint i walls by the painters so far
     int[] dp = new int[n + 1];
-    Arrays.fill(dp, MAX);
+    Arrays.fill(dp, kMax);
     dp[0] = 0;
 
     for (int i = 0; i < n; ++i)
diff --git a/solutions/2742. Painting the Walls/2742-2.py b/solutions/2742. Painting the Walls/2742-2.py
index d74766bf940..7d813e66c1f 100644
--- a/solutions/2742. Painting the Walls/2742-2.py	
+++ b/solutions/2742. Painting the Walls/2742-2.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def paintWalls(self, cost: list[int], time: list[int]) -> int:
-    MAX = 500_000_000
+  def paintWalls(self, cost: List[int], time: List[int]) -> int:
+    kMax = 500_000_000
     n = len(cost)
     # dp[i] := the minimum cost to paint i walls by the painters so far
-    dp = [0] + [MAX] * n
+    dp = [0] + [kMax] * n
 
     for c, t in zip(cost, time):
       for walls in range(n, 0, -1):
diff --git a/solutions/2742. Painting the Walls/2742.java b/solutions/2742. Painting the Walls/2742.java
index b2b765eb5ef..3866b31047b 100644
--- a/solutions/2742. Painting the Walls/2742.java	
+++ b/solutions/2742. Painting the Walls/2742.java	
@@ -5,14 +5,14 @@ public int paintWalls(int[] cost, int[] time) {
     return paintWalls(cost, time, 0, time.length, mem);
   }
 
-  private static final int MAX = 500_000_000;
+  private static final int kMax = 500_000_000;
 
   // Returns the minimum cost to paint j walls by painters[i..n).
   private int paintWalls(int[] cost, int[] time, int i, int walls, int[][] mem) {
     if (walls <= 0)
       return 0;
     if (i == cost.length)
-      return MAX;
+      return kMax;
     if (mem[i][walls] > 0)
       return mem[i][walls];
     final int pick = cost[i] + paintWalls(cost, time, i + 1, walls - time[i] - 1, mem);
diff --git a/solutions/2742. Painting the Walls/2742.py b/solutions/2742. Painting the Walls/2742.py
index 84af060e54b..5be2c323d91 100644
--- a/solutions/2742. Painting the Walls/2742.py	
+++ b/solutions/2742. Painting the Walls/2742.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def paintWalls(self, cost: list[int], time: list[int]) -> int:
+  def paintWalls(self, cost: List[int], time: List[int]) -> int:
     n = len(cost)
 
     @functools.lru_cache(None)
diff --git a/solutions/2744. Find Maximum Number of String Pairs/2744.py b/solutions/2744. Find Maximum Number of String Pairs/2744.py
index 76403dae249..1d8a504951a 100644
--- a/solutions/2744. Find Maximum Number of String Pairs/2744.py	
+++ b/solutions/2744. Find Maximum Number of String Pairs/2744.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumNumberOfStringPairs(self, words: list[str]) -> int:
+  def maximumNumberOfStringPairs(self, words: List[str]) -> int:
     ans = 0
     seen = [False] * (26 * 26)
 
diff --git a/solutions/2746. Decremental String Concatenation/2746.py b/solutions/2746. Decremental String Concatenation/2746.py
index b79b54bd704..1fa1a3ad078 100644
--- a/solutions/2746. Decremental String Concatenation/2746.py	
+++ b/solutions/2746. Decremental String Concatenation/2746.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimizeConcatenatedLength(self, words: list[str]) -> int:
+  def minimizeConcatenatedLength(self, words: List[str]) -> int:
     @functools.lru_cache(None)
     def dp(i: int, first: str, last: str) -> int:
       """
diff --git a/solutions/2747. Count Zero Request Servers/2747.cpp b/solutions/2747. Count Zero Request Servers/2747.cpp
index 7f30606891a..1451c96f36e 100644
--- a/solutions/2747. Count Zero Request Servers/2747.cpp	
+++ b/solutions/2747. Count Zero Request Servers/2747.cpp	
@@ -10,8 +10,9 @@ class Solution {
     vector<int> ans(queries.size());
     vector<int> count(n + 1);
 
-    ranges::sort(logs, ranges::less{},
-                 [](const vector<int>& log) { return log[1]; });
+    ranges::sort(logs, [](const vector<int>& a, const vector<int>& b) {
+      return a[1] < b[1];
+    });
 
     int i = 0;
     int j = 0;
diff --git a/solutions/2747. Count Zero Request Servers/2747.java b/solutions/2747. Count Zero Request Servers/2747.java
index 70470ddc6af..ce6360f05f4 100644
--- a/solutions/2747. Count Zero Request Servers/2747.java	
+++ b/solutions/2747. Count Zero Request Servers/2747.java	
@@ -3,7 +3,7 @@ public int[] countServers(int n, int[][] logs, int x, int[] queries) {
     int[] ans = new int[queries.length];
     int[] count = new int[n + 1];
 
-    Arrays.sort(logs, Comparator.comparingInt(log -> log[1]));
+    Arrays.sort(logs, (a, b) -> Integer.compare(a[1], b[1]));
 
     int i = 0;
     int j = 0;
@@ -31,7 +31,7 @@ private IndexedQuery[] getIndexedQueries(int[] queries) {
     IndexedQuery[] indexedQueries = new IndexedQuery[queries.length];
     for (int i = 0; i < queries.length; ++i)
       indexedQueries[i] = new IndexedQuery(i, queries[i]);
-    Arrays.sort(indexedQueries, Comparator.comparingInt(IndexedQuery::query));
+    Arrays.sort(indexedQueries, (a, b) -> a.query - b.query);
     return indexedQueries;
   }
 }
diff --git a/solutions/2747. Count Zero Request Servers/2747.py b/solutions/2747. Count Zero Request Servers/2747.py
index 0a7dac68d4c..0722b14b01c 100644
--- a/solutions/2747. Count Zero Request Servers/2747.py	
+++ b/solutions/2747. Count Zero Request Servers/2747.py	
@@ -1,10 +1,7 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
 class IndexedQuery:
-  queryIndex: int
-  query: int
+  def __init__(self, queryIndex: int, query: int):
+    self.queryIndex = queryIndex
+    self.query = query
 
   def __iter__(self):
     yield self.queryIndex
@@ -12,17 +9,11 @@ def __iter__(self):
 
 
 class Solution:
-  def countServers(
-      self,
-      n: int,
-      logs: list[list[int]],
-      x: int,
-      queries: list[int],
-  ) -> list[int]:
+  def countServers(self, n: int, logs: List[List[int]], x: int, queries: List[int]) -> List[int]:
     ans = [0] * len(queries)
     count = [0] * (n + 1)
 
-    logs.sort(key=lambda x: x[1])
+    logs.sort(key=lambda log: log[1])
 
     i = 0
     j = 0
@@ -31,7 +22,7 @@ def countServers(
     # For each query, we care about logs[i..j].
     for queryIndex, query in sorted([IndexedQuery(i, query)
                                      for i, query in enumerate(queries)],
-                                    key=lambda x: x.query):
+                                    key=lambda iq: iq.query):
       while j < len(logs) and logs[j][1] <= query:
         count[logs[j][0]] += 1
         if count[logs[j][0]] == 1:
diff --git a/solutions/2748. Number of Beautiful Pairs/2748.py b/solutions/2748. Number of Beautiful Pairs/2748.py
index ce6d9e0a517..36a1ab36ec2 100644
--- a/solutions/2748. Number of Beautiful Pairs/2748.py	
+++ b/solutions/2748. Number of Beautiful Pairs/2748.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countBeautifulPairs(self, nums: list[int]) -> int:
+  def countBeautifulPairs(self, nums: List[int]) -> int:
     def firstDigit(num: int) -> int:
       return int(str(num)[0])
 
@@ -7,4 +7,5 @@ def lastDigit(num: int) -> int:
       return num % 10
 
     return sum(math.gcd(firstDigit(nums[i]), lastDigit(nums[j])) == 1
-               for i, j in itertools.combinations(range(len(nums)), 2))
+               for i in range(len(nums))
+               for j in range(i + 1, len(nums)))
diff --git a/solutions/275. H-Index II/275.cpp b/solutions/275. H-Index II/275.cpp
index 84fae07db33..58874384131 100644
--- a/solutions/275. H-Index II/275.cpp	
+++ b/solutions/275. H-Index II/275.cpp	
@@ -7,7 +7,7 @@ class Solution {
 
     while (l < r) {
       const int m = (l + r) / 2;
-      if (citations[m] + m >= n)
+      if (citations[m] >= n - m)
         r = m;
       else
         l = m + 1;
diff --git a/solutions/275. H-Index II/275.java b/solutions/275. H-Index II/275.java
index 7ed82df6961..3fe0dec18fb 100644
--- a/solutions/275. H-Index II/275.java	
+++ b/solutions/275. H-Index II/275.java	
@@ -6,7 +6,7 @@ public int hIndex(int[] citations) {
 
     while (l < r) {
       final int m = (l + r) / 2;
-      if (citations[m] + m >= n)
+      if (citations[m] >= n - m)
         r = m;
       else
         l = m + 1;
diff --git a/solutions/275. H-Index II/275.py b/solutions/275. H-Index II/275.py
index 39b19fbf049..8ac43f1b707 100644
--- a/solutions/275. H-Index II/275.py	
+++ b/solutions/275. H-Index II/275.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def hIndex(self, citations: list[int]) -> int:
+  def hIndex(self, citations: List[int]) -> int:
     n = len(citations)
     return n - bisect.bisect_left(range(n), n,
                                   key=lambda m: citations[m] + m)
diff --git a/solutions/2750. Ways to Split Array Into Good Subarrays/2750.cpp b/solutions/2750. Ways to Split Array Into Good Subarrays/2750.cpp
index f2b0aae51a8..2b01896b728 100644
--- a/solutions/2750. Ways to Split Array Into Good Subarrays/2750.cpp	
+++ b/solutions/2750. Ways to Split Array Into Good Subarrays/2750.cpp	
@@ -11,7 +11,7 @@ class Solution {
     for (int i = 0; i < nums.size(); ++i)
       if (nums[i] == 1) {
         if (prev != -1)
-          ans = static_cast<long>(ans) * (i - prev) % kMod;
+          ans = ans * static_cast<long>(i - prev) % kMod;
         prev = i;
       }
 
diff --git a/solutions/2750. Ways to Split Array Into Good Subarrays/2750.java b/solutions/2750. Ways to Split Array Into Good Subarrays/2750.java
index 2d092579616..373cdb61491 100644
--- a/solutions/2750. Ways to Split Array Into Good Subarrays/2750.java	
+++ b/solutions/2750. Ways to Split Array Into Good Subarrays/2750.java	
@@ -3,14 +3,14 @@ public int numberOfGoodSubarraySplits(int[] nums) {
     if (Arrays.stream(nums).filter(num -> num == 1).count() == 0)
       return 0;
 
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int prev = -1; // the previous index of 1
     int ans = 1;
 
     for (int i = 0; i < nums.length; ++i)
       if (nums[i] == 1) {
         if (prev != -1)
-          ans = (int) ((long) ans * (i - prev) % MOD);
+          ans = (int) ((long) ans * (i - prev) % kMod);
         prev = i;
       }
 
diff --git a/solutions/2750. Ways to Split Array Into Good Subarrays/2750.py b/solutions/2750. Ways to Split Array Into Good Subarrays/2750.py
index 49eef440e75..bf6ac6be447 100644
--- a/solutions/2750. Ways to Split Array Into Good Subarrays/2750.py	
+++ b/solutions/2750. Ways to Split Array Into Good Subarrays/2750.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def numberOfGoodSubarraySplits(self, nums: list[int]) -> int:
+  def numberOfGoodSubarraySplits(self, nums: List[int]) -> int:
     if 1 not in nums:
       return 0
 
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     prev = -1  # the previous index of 1
     ans = 1
 
@@ -11,7 +11,7 @@ def numberOfGoodSubarraySplits(self, nums: list[int]) -> int:
       if num == 1:
         if prev != -1:
           ans *= i - prev
-          ans %= MOD
+          ans %= kMod
         prev = i
 
     return ans
diff --git a/solutions/2751. Robot Collisions/2751.cpp b/solutions/2751. Robot Collisions/2751.cpp
index a37a56637fb..fe5ee795cfe 100644
--- a/solutions/2751. Robot Collisions/2751.cpp	
+++ b/solutions/2751. Robot Collisions/2751.cpp	
@@ -16,8 +16,9 @@ class Solution {
     for (int i = 0; i < positions.size(); ++i)
       robots.push_back(Robot{i, positions[i], healths[i], directions[i]});
 
-    ranges::sort(robots, ranges::less{},
-                 [](const Robot& robot) { return robot.position; });
+    ranges::sort(robots, [](const Robot& a, const Robot& b) {
+      return a.position < b.position;
+    });
 
     for (Robot& robot : robots) {
       if (robot.direction == 'R') {
@@ -42,8 +43,9 @@ class Solution {
         stack.push_back(robot);
     }
 
-    ranges::sort(stack, ranges::less{},
-                 [](const Robot& robot) { return robot.index; });
+    ranges::sort(stack, [](const Robot& a, const Robot& b) {
+      return a.index < b.index;
+    });
 
     for (const Robot& robot : stack)
       ans.push_back(robot.health);
diff --git a/solutions/2751. Robot Collisions/2751.java b/solutions/2751. Robot Collisions/2751.java
index 4c30b3775b4..68acb36731b 100644
--- a/solutions/2751. Robot Collisions/2751.java	
+++ b/solutions/2751. Robot Collisions/2751.java	
@@ -20,7 +20,7 @@ public List<Integer> survivedRobotsHealths(int[] positions, int[] healths, Strin
     for (int i = 0; i < positions.length; ++i)
       robots[i] = new Robot(i, positions[i], healths[i], directions.charAt(i));
 
-    Arrays.sort(robots, Comparator.comparingInt((Robot robot) -> robot.position));
+    Arrays.sort(robots, (a, b) -> a.position - b.position);
 
     for (Robot robot : robots) {
       if (robot.direction == 'R') {
@@ -44,7 +44,7 @@ public List<Integer> survivedRobotsHealths(int[] positions, int[] healths, Strin
         stack.add(robot);
     }
 
-    stack.sort(Comparator.comparingInt((Robot robot) -> robot.index));
+    stack.sort((a, b) -> a.index - b.index);
 
     for (Robot robot : stack)
       ans.add(robot.health);
diff --git a/solutions/2751. Robot Collisions/2751.py b/solutions/2751. Robot Collisions/2751.py
index dfd60aa6d10..839cf55d4f6 100644
--- a/solutions/2751. Robot Collisions/2751.py	
+++ b/solutions/2751. Robot Collisions/2751.py	
@@ -1,6 +1,3 @@
-from dataclasses import dataclass
-
-
 @dataclass
 class Robot:
   index: int
@@ -10,17 +7,12 @@ class Robot:
 
 
 class Solution:
-  def survivedRobotsHealths(
-      self,
-      positions: list[int],
-      healths: list[int],
-      directions: str,
-  ) -> list[int]:
+  def survivedRobotsHealths(self, positions: List[int], healths: List[int], directions: str) -> List[int]:
     robots = sorted([Robot(index, position, health, direction)
                      for index, (position, health, direction) in
                      enumerate(zip(positions, healths, directions))],
-                    key=lambda x: x.position)
-    stack: list[Robot] = []  # running robots
+                    key=lambda robot: robot.position)
+    stack: List[Robot] = []  # running robots
 
     for robot in robots:
       if robot.direction == 'R':
diff --git a/solutions/2760. Longest Even Odd Subarray With Threshold/2760.py b/solutions/2760. Longest Even Odd Subarray With Threshold/2760.py
index ff07cc77f00..104b6a11d1f 100644
--- a/solutions/2760. Longest Even Odd Subarray With Threshold/2760.py	
+++ b/solutions/2760. Longest Even Odd Subarray With Threshold/2760.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestAlternatingSubarray(self, nums: list[int], threshold: int) -> int:
+  def longestAlternatingSubarray(self, nums: List[int], threshold: int) -> int:
     ans = 0
     dp = 0
 
diff --git a/solutions/2761. Prime Pairs With Target Sum/2761.py b/solutions/2761. Prime Pairs With Target Sum/2761.py
index cf2acc2ffe4..ca4516887d0 100644
--- a/solutions/2761. Prime Pairs With Target Sum/2761.py	
+++ b/solutions/2761. Prime Pairs With Target Sum/2761.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def findPrimePairs(self, n: int) -> list[list[int]]:
+  def findPrimePairs(self, n: int) -> List[List[int]]:
     isPrime = self._sieveEratosthenes(n + 1)
     return [[i, n - i] for i in range(2, n // 2 + 1)
             if isPrime[i] and isPrime[n - i]]
 
-  def _sieveEratosthenes(self, n: int) -> list[bool]:
+  def _sieveEratosthenes(self, n: int) -> List[bool]:
     isPrime = [True] * n
     isPrime[0] = False
     isPrime[1] = False
@@ -13,6 +13,4 @@ def _sieveEratosthenes(self, n: int) -> list[bool]:
         for j in range(i * i, n, i):
           isPrime[j] = False
     return isPrime
-
-
 j
diff --git a/solutions/2762. Continuous Subarrays/2762.py b/solutions/2762. Continuous Subarrays/2762.py
index 9e2b95a89c0..793fa3356d0 100644
--- a/solutions/2762. Continuous Subarrays/2762.py	
+++ b/solutions/2762. Continuous Subarrays/2762.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def continuousSubarrays(self, nums: list[int]) -> int:
+  def continuousSubarrays(self, nums: List[int]) -> int:
     ans = 1  # [nums[0]]
     left = nums[0] - 2
     right = nums[0] + 2
diff --git a/solutions/2763. Sum of Imbalance Numbers of All Subarrays/2763-2.py b/solutions/2763. Sum of Imbalance Numbers of All Subarrays/2763-2.py
index 4ff1646a4c4..506862551d5 100644
--- a/solutions/2763. Sum of Imbalance Numbers of All Subarrays/2763-2.py	
+++ b/solutions/2763. Sum of Imbalance Numbers of All Subarrays/2763-2.py	
@@ -2,7 +2,7 @@ class Solution:
   # If sorted(nums)[i + 1] - sorted(nums)[i] > 1, then there's a gap. Instead
   # of determining the number of gaps in each subarray, let's find out how many
   # subarrays contain each gap.
-  def sumImbalanceNumbers(self, nums: list[int]) -> int:
+  def sumImbalanceNumbers(self, nums: List[int]) -> int:
     n = len(nums)
     # Note that to avoid double counting, only `left` needs to check nums[i].
     # This adjustment ensures that i represents the position of the leftmost
diff --git "a/solutions/2764. is Array a Preorder of Some \342\200\214Binary Tree/2764.py" "b/solutions/2764. is Array a Preorder of Some \342\200\214Binary Tree/2764.py"
index d8305d97408..3cf68be355f 100644
--- "a/solutions/2764. is Array a Preorder of Some \342\200\214Binary Tree/2764.py"	
+++ "b/solutions/2764. is Array a Preorder of Some \342\200\214Binary Tree/2764.py"	
@@ -1,5 +1,5 @@
 class Solution:
-  def isPreorder(self, nodes: list[list[int]]) -> bool:
+  def isPreorder(self, nodes: List[List[int]]) -> bool:
     stack = []  # Stores `id`s.
 
     for id, parentId in nodes:
diff --git a/solutions/2765. Longest Alternating Subarray/2765.py b/solutions/2765. Longest Alternating Subarray/2765.py
index 5a2c9038a3a..70ee11c4673 100644
--- a/solutions/2765. Longest Alternating Subarray/2765.py	
+++ b/solutions/2765. Longest Alternating Subarray/2765.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def alternatingSubarray(self, nums: list[int]) -> int:
+  def alternatingSubarray(self, nums: List[int]) -> int:
     ans = 1
     dp = 1
 
diff --git a/solutions/2766. Relocate Marbles/2766.py b/solutions/2766. Relocate Marbles/2766.py
index 6dba9225bfb..f8705b371a4 100644
--- a/solutions/2766. Relocate Marbles/2766.py	
+++ b/solutions/2766. Relocate Marbles/2766.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def relocateMarbles(
-      self,
-      nums: list[int],
-      moveFrom: list[int],
-      moveTo: list[int],
-  ) -> list[int]:
+  def relocateMarbles(self, nums: List[int], moveFrom: List[int], moveTo: List[int]) -> List[int]:
     numsSet = set(nums)
 
     for f, t in zip(moveFrom, moveTo):
diff --git a/solutions/2768. Number of Black Blocks/2768.py b/solutions/2768. Number of Black Blocks/2768.py
index 01a7cebf583..f2add9473f0 100644
--- a/solutions/2768. Number of Black Blocks/2768.py	
+++ b/solutions/2768. Number of Black Blocks/2768.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def countBlackBlocks(
-      self,
-      m: int,
-      n: int,
-      coordinates: list[list[int]],
-  ) -> list[int]:
+  def countBlackBlocks(self, m: int, n: int, coordinates: List[List[int]]) -> List[int]:
     ans = [0] * 5
     # count[i * n + j] := the number of black cells in
     # (i - 1, j - 1), (i - 1, j), (i, j - 1), (i, j)
diff --git a/solutions/2770. Maximum Number of Jumps to Reach the Last Index/2770.py b/solutions/2770. Maximum Number of Jumps to Reach the Last Index/2770.py
index 254251dbe33..84c8fa28039 100644
--- a/solutions/2770. Maximum Number of Jumps to Reach the Last Index/2770.py	
+++ b/solutions/2770. Maximum Number of Jumps to Reach the Last Index/2770.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumJumps(self, nums: list[int], target: int) -> int:
+  def maximumJumps(self, nums: List[int], target: int) -> int:
     n = len(nums)
     # dp[i] := the maximum number of jumps to reach i from 0
     dp = [-1] * n
diff --git a/solutions/2771. Longest Non-decreasing Subarray From Two Arrays/2771.py b/solutions/2771. Longest Non-decreasing Subarray From Two Arrays/2771.py
index aab8d11e746..d1884a1a2ea 100644
--- a/solutions/2771. Longest Non-decreasing Subarray From Two Arrays/2771.py	
+++ b/solutions/2771. Longest Non-decreasing Subarray From Two Arrays/2771.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxNonDecreasingLength(self, nums1: list[int], nums2: list[int]) -> int:
+  def maxNonDecreasingLength(self, nums1: List[int], nums2: List[int]) -> int:
     ans = 1
     dp1 = 1  # the longest subarray that ends in nums1[i] so far
     dp2 = 1  # the longest subarray that ends in nums2[i] so far
diff --git a/solutions/2772. Apply Operations to Make All Array Elements Equal to Zero/2772.py b/solutions/2772. Apply Operations to Make All Array Elements Equal to Zero/2772.py
index 0b4590e37a8..5e2562994ca 100644
--- a/solutions/2772. Apply Operations to Make All Array Elements Equal to Zero/2772.py	
+++ b/solutions/2772. Apply Operations to Make All Array Elements Equal to Zero/2772.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def checkArray(self, nums: list[int], k: int) -> bool:
+  def checkArray(self, nums: List[int], k: int) -> bool:
     if k == 1:
       return True
 
diff --git a/solutions/2773. Height of Special Binary Tree/2773.py b/solutions/2773. Height of Special Binary Tree/2773.py
index c8fc6074eae..eb8aaa43c19 100644
--- a/solutions/2773. Height of Special Binary Tree/2773.py	
+++ b/solutions/2773. Height of Special Binary Tree/2773.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def heightOfTree(self, root: TreeNode | None) -> int:
+  def heightOfTree(self, root: Optional[TreeNode]) -> int:
     if not root:
       return 0
     # a leaf node
diff --git a/solutions/2778. Sum of Squares of Special Elements/2778.py b/solutions/2778. Sum of Squares of Special Elements/2778.py
index 71db88b3c90..b1eef001640 100644
--- a/solutions/2778. Sum of Squares of Special Elements/2778.py	
+++ b/solutions/2778. Sum of Squares of Special Elements/2778.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def sumOfSquares(self, nums: list[int]) -> int:
+  def sumOfSquares(self, nums: List[int]) -> int:
     return sum(num**2 for i, num in enumerate(nums)
                if len(nums) % (i + 1) == 0)
diff --git a/solutions/2779. Maximum Beauty of an Array After Applying Operation/2779-2.py b/solutions/2779. Maximum Beauty of an Array After Applying Operation/2779-2.py
index f747ee47dd5..58ca8cd4db6 100644
--- a/solutions/2779. Maximum Beauty of an Array After Applying Operation/2779-2.py	
+++ b/solutions/2779. Maximum Beauty of an Array After Applying Operation/2779-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumBeauty(self, nums: list[int], k: int) -> int:
+  def maximumBeauty(self, nums: List[int], k: int) -> int:
     nums.sort()
 
     # l and r track the maximum window instead of the valid window.
diff --git a/solutions/2779. Maximum Beauty of an Array After Applying Operation/2779.py b/solutions/2779. Maximum Beauty of an Array After Applying Operation/2779.py
index 60e2aeef69b..f14bf31a0c0 100644
--- a/solutions/2779. Maximum Beauty of an Array After Applying Operation/2779.py	
+++ b/solutions/2779. Maximum Beauty of an Array After Applying Operation/2779.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumBeauty(self, nums: list[int], k: int) -> int:
+  def maximumBeauty(self, nums: List[int], k: int) -> int:
     ans = 0
 
     nums.sort()
diff --git a/solutions/2780. Minimum Index of a Valid Split/2780.py b/solutions/2780. Minimum Index of a Valid Split/2780.py
index 6dada453019..f98917f103f 100644
--- a/solutions/2780. Minimum Index of a Valid Split/2780.py	
+++ b/solutions/2780. Minimum Index of a Valid Split/2780.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumIndex(self, nums: list[int]) -> int:
+  def minimumIndex(self, nums: List[int]) -> int:
     count1 = collections.Counter()
     count2 = collections.Counter(nums)
 
diff --git a/solutions/2781. Length of the Longest Valid Substring/2781-2.java b/solutions/2781. Length of the Longest Valid Substring/2781-2.java
index 705b82ac059..5aae246cc80 100644
--- a/solutions/2781. Length of the Longest Valid Substring/2781-2.java	
+++ b/solutions/2781. Length of the Longest Valid Substring/2781-2.java	
@@ -4,7 +4,7 @@ class TrieNode {
 }
 
 class Trie {
-  public void insert(final String word) {
+  public void insert(String word) {
     TrieNode node = root;
     for (final char c : word.toCharArray()) {
       final int i = c - 'a';
@@ -15,7 +15,7 @@ public void insert(final String word) {
     node.isWord = true;
   }
 
-  public boolean search(final String word, int l, int r) {
+  public boolean search(String word, int l, int r) {
     TrieNode node = root;
     for (int j = l; j <= r; ++j) {
       final int i = word.charAt(j) - 'a';
diff --git a/solutions/2781. Length of the Longest Valid Substring/2781-2.py b/solutions/2781. Length of the Longest Valid Substring/2781-2.py
index dddaecb90b3..305887afcea 100644
--- a/solutions/2781. Length of the Longest Valid Substring/2781-2.py	
+++ b/solutions/2781. Length of the Longest Valid Substring/2781-2.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
     self.isWord = False
 
 
@@ -24,7 +24,7 @@ def search(self, word: str, l: int, r: int) -> bool:
 
 
 class Solution:
-  def longestValidSubstring(self, word: str, forbidden: list[str]) -> int:
+  def longestValidSubstring(self, word: str, forbidden: List[str]) -> int:
     ans = 0
     trie = Trie()
 
diff --git a/solutions/2781. Length of the Longest Valid Substring/2781.py b/solutions/2781. Length of the Longest Valid Substring/2781.py
index 3405d669d3e..fd110db46ad 100644
--- a/solutions/2781. Length of the Longest Valid Substring/2781.py	
+++ b/solutions/2781. Length of the Longest Valid Substring/2781.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestValidSubstring(self, word: str, forbidden: list[str]) -> int:
+  def longestValidSubstring(self, word: str, forbidden: List[str]) -> int:
     forbiddenSet = set(forbidden)
     ans = 0
     r = len(word) - 1  # rightmost index of the valid substring
diff --git a/solutions/2782. Number of Unique Categories/2782.py b/solutions/2782. Number of Unique Categories/2782.py
index 73a2438fb6c..17f051c8729 100644
--- a/solutions/2782. Number of Unique Categories/2782.py	
+++ b/solutions/2782. Number of Unique Categories/2782.py	
@@ -4,11 +4,7 @@
 #     pass
 
 class Solution:
-  def numberOfCategories(
-      self,
-      n: int,
-      categoryHandler: Optional['CategoryHandler'],
-  ) -> int:
+  def numberOfCategories(self, n: int, categoryHandler: Optional['CategoryHandler']) -> int:
     ans = 0
 
     for i in range(n):
diff --git a/solutions/2784. Check if Array is Good/2784.java b/solutions/2784. Check if Array is Good/2784.java
index a94c75d861c..4653105d7f4 100644
--- a/solutions/2784. Check if Array is Good/2784.java	
+++ b/solutions/2784. Check if Array is Good/2784.java	
@@ -1,8 +1,8 @@
-class Solution {
+public class Solution {
   public boolean isGood(int[] nums) {
-    final int MAX = 200;
+    final int kMax = 200;
     final int n = nums.length - 1;
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (final int num : nums)
       ++count[num];
diff --git a/solutions/2784. Check if Array is Good/2784.py b/solutions/2784. Check if Array is Good/2784.py
index 919ad32ba55..4d72ccb12bc 100644
--- a/solutions/2784. Check if Array is Good/2784.py	
+++ b/solutions/2784. Check if Array is Good/2784.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isGood(self, nums: list[int]) -> bool:
+  def isGood(self, nums: List[int]) -> bool:
     n = len(nums) - 1
     count = collections.Counter(nums)
     return all(count[i] == 1 for i in range(1, n)) and count[n] == 2
diff --git a/solutions/2785. Sort Vowels in a String/2785.py b/solutions/2785. Sort Vowels in a String/2785.py
index 52daa87d1ab..9a40c69ea15 100644
--- a/solutions/2785. Sort Vowels in a String/2785.py	
+++ b/solutions/2785. Sort Vowels in a String/2785.py	
@@ -1,12 +1,12 @@
 class Solution:
   def sortVowels(self, s: str) -> str:
-    VOWELS = 'aeiouAEIOU'
+    kVowels = 'aeiouAEIOU'
     ans = []
-    vowels = sorted([c for c in s if c in VOWELS])
+    vowels = sorted([c for c in s if c in kVowels])
 
     i = 0  # vowels' index
     for c in s:
-      if c in VOWELS:
+      if c in kVowels:
         ans.append(vowels[i])
         i += 1
       else:
diff --git a/solutions/2786. Visit Array Positions to Maximize Score/2786.py b/solutions/2786. Visit Array Positions to Maximize Score/2786.py
index e994a198016..2e09e164d0e 100644
--- a/solutions/2786. Visit Array Positions to Maximize Score/2786.py	
+++ b/solutions/2786. Visit Array Positions to Maximize Score/2786.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxScore(self, nums: list[int], x: int) -> int:
+  def maxScore(self, nums: List[int], x: int) -> int:
     # Note that we always need to take nums[0], so the initial definition might
     # not hold true.
 
diff --git a/solutions/2787. Ways to Express an Integer as Sum of Powers/2787.java b/solutions/2787. Ways to Express an Integer as Sum of Powers/2787.java
index fc67a465690..909df6c76d5 100644
--- a/solutions/2787. Ways to Express an Integer as Sum of Powers/2787.java	
+++ b/solutions/2787. Ways to Express an Integer as Sum of Powers/2787.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numberOfWays(int n, int x) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i] := the number of ways to express i
     int[] dp = new int[n + 1];
     int ax; // a^x
@@ -10,7 +10,7 @@ public int numberOfWays(int n, int x) {
     for (int a = 1; (ax = (int) Math.pow(a, x)) <= n; ++a)
       for (int i = n; i >= ax; --i) {
         dp[i] += dp[i - ax];
-        dp[i] %= MOD;
+        dp[i] %= kMod;
       }
 
     return dp[n];
diff --git a/solutions/2787. Ways to Express an Integer as Sum of Powers/2787.py b/solutions/2787. Ways to Express an Integer as Sum of Powers/2787.py
index 629ce23933e..3e7cc0bf5fa 100644
--- a/solutions/2787. Ways to Express an Integer as Sum of Powers/2787.py	
+++ b/solutions/2787. Ways to Express an Integer as Sum of Powers/2787.py	
@@ -1,6 +1,6 @@
 class Solution:
   def numberOfWays(self, n: int, x: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # dp[i] := the number of ways to express i
     dp = [1] + [0] * n
 
@@ -10,6 +10,6 @@ def numberOfWays(self, n: int, x: int) -> int:
         break
       for i in range(n, ax - 1, -1):
         dp[i] += dp[i - ax]
-        dp[i] %= MOD
+        dp[i] %= kMod
 
     return dp[n]
diff --git a/solutions/2788. Split Strings by Separator/2788.java b/solutions/2788. Split Strings by Separator/2788.java
index 4115ac06a8b..fb5116af964 100644
--- a/solutions/2788. Split Strings by Separator/2788.java	
+++ b/solutions/2788. Split Strings by Separator/2788.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public List<String> splitWordsBySeparator(List<String> words, char separator) {
     return words.stream()
         .flatMap(word -> Arrays.stream(word.split("\\" + separator)))
diff --git a/solutions/2788. Split Strings by Separator/2788.py b/solutions/2788. Split Strings by Separator/2788.py
index 3f63a7e8401..5b271150bc5 100644
--- a/solutions/2788. Split Strings by Separator/2788.py	
+++ b/solutions/2788. Split Strings by Separator/2788.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def splitWordsBySeparator(
-      self,
-      words: list[str],
-      separator: str,
-  ) -> list[str]:
+  def splitWordsBySeparator(self, words: List[str], separator: str) -> List[str]:
     return [splitWord
             for word in words
             for splitWord in word.split(separator)
diff --git a/solutions/2789. Largest Element in an Array after Merge Operations/2789.py b/solutions/2789. Largest Element in an Array after Merge Operations/2789.py
index 8fa23976f3c..530f9249664 100644
--- a/solutions/2789. Largest Element in an Array after Merge Operations/2789.py	
+++ b/solutions/2789. Largest Element in an Array after Merge Operations/2789.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxArrayValue(self, nums: list[int]) -> int:
+  def maxArrayValue(self, nums: List[int]) -> int:
     ans = nums[-1]
 
     for i in range(len(nums) - 2, -1, -1):
diff --git a/solutions/2790. Maximum Number of Groups With Increasing Length/2790.cpp b/solutions/2790. Maximum Number of Groups With Increasing Length/2790.cpp
index b22f8622260..113c4ba7695 100644
--- a/solutions/2790. Maximum Number of Groups With Increasing Length/2790.cpp	
+++ b/solutions/2790. Maximum Number of Groups With Increasing Length/2790.cpp	
@@ -9,7 +9,7 @@ class Solution {
     for (const int usageLimit : usageLimits) {
       availableLimits += usageLimit;
       // Can create groups 1, 2, ..., ans.
-      if (availableLimits >= static_cast<long>(ans) * (ans + 1) / 2)
+      if (availableLimits >= ans * static_cast<long>(ans + 1) / 2)
         ++ans;
     }
 
diff --git a/solutions/2790. Maximum Number of Groups With Increasing Length/2790.py b/solutions/2790. Maximum Number of Groups With Increasing Length/2790.py
index 0da133469cd..526fcf580f1 100644
--- a/solutions/2790. Maximum Number of Groups With Increasing Length/2790.py	
+++ b/solutions/2790. Maximum Number of Groups With Increasing Length/2790.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxIncreasingGroups(self, usageLimits: list[int]) -> int:
+  def maxIncreasingGroups(self, usageLimits: List[int]) -> int:
     ans = 1  # the next target length
     availableLimits = 0
 
diff --git a/solutions/2791. Count Paths That Can Form a Palindrome in a Tree/2791.cpp b/solutions/2791. Count Paths That Can Form a Palindrome in a Tree/2791.cpp
index 716a44eec96..7f931434684 100644
--- a/solutions/2791. Count Paths That Can Form a Palindrome in a Tree/2791.cpp	
+++ b/solutions/2791. Count Paths That Can Form a Palindrome in a Tree/2791.cpp	
@@ -32,7 +32,7 @@ class Solution {
       res += maskToCount[mask ^ 0]++;
     }
     for (const int v : tree[u])
-      res += dfs(tree, v, mask, s, std::move(maskToCount));
+      res += dfs(tree, v, mask, s, move(maskToCount));
     return res;
   }
 };
diff --git a/solutions/2791. Count Paths That Can Form a Palindrome in a Tree/2791.py b/solutions/2791. Count Paths That Can Form a Palindrome in a Tree/2791.py
index 0065a9ca231..2e73f3224f4 100644
--- a/solutions/2791. Count Paths That Can Form a Palindrome in a Tree/2791.py	
+++ b/solutions/2791. Count Paths That Can Form a Palindrome in a Tree/2791.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def countPalindromePaths(self, parent: list[int], s: str) -> int:
+  def countPalindromePaths(self, parent: List[int], s: str) -> int:
     # A valid (u, v) has at most 1 letter with odd frequency on its path. The
     # frequency of a letter on the u-v path is equal to the sum of its
     # frequencies on the root-u and root-v paths substract twice of its
     # frequency on the root-LCA(u, v) path. Considering only the parity
     # (even/odd), the part involving root-LCA(u, v) can be ignored, making it
     # possible to calculate both parts easily using a simple DFS.
-    tree = [[] for _ in parent]
+    tree = collections.defaultdict(list)
     maskToCount = collections.Counter({0: 1})
 
     for i in range(1, len(parent)):
diff --git a/solutions/2792. Count Nodes That Are Great Enough/2792.py b/solutions/2792. Count Nodes That Are Great Enough/2792.py
index 79b1087f7ec..7e79c9b4024 100644
--- a/solutions/2792. Count Nodes That Are Great Enough/2792.py	
+++ b/solutions/2792. Count Nodes That Are Great Enough/2792.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def countGreatEnoughNodes(self, root: TreeNode | None, k: int) -> int:
+  def countGreatEnoughNodes(self, root: Optional[TreeNode], k: int) -> int:
     ans = 0
 
-    def dfs(root: TreeNode | None) -> list[int]:
+    def dfs(root: Optional[TreeNode]) -> List[int]:
       nonlocal ans
       if not root:
         return []
diff --git a/solutions/2798. Number of Employees Who Met the Target/2798.py b/solutions/2798. Number of Employees Who Met the Target/2798.py
index 591223a532b..f233028ecc6 100644
--- a/solutions/2798. Number of Employees Who Met the Target/2798.py	
+++ b/solutions/2798. Number of Employees Who Met the Target/2798.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def numberOfEmployeesWhoMetTarget(self, hours: list[int], target: int) -> int:
+  def numberOfEmployeesWhoMetTarget(self, hours: List[int], target: int) -> int:
     return sum(hour >= target for hour in hours)
diff --git a/solutions/2799. Count Complete Subarrays in an Array/2799.java b/solutions/2799. Count Complete Subarrays in an Array/2799.java
index aee2b90ae5a..603b7551f35 100644
--- a/solutions/2799. Count Complete Subarrays in an Array/2799.java	
+++ b/solutions/2799. Count Complete Subarrays in an Array/2799.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int countCompleteSubarrays(int[] nums) {
-    final int MAX = 2000;
+    final int kMax = 2000;
     final int totalDistinct = Arrays.stream(nums).boxed().collect(Collectors.toSet()).size();
     int ans = 0;
     int distinct = 0;
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     int l = 0;
     for (final int num : nums) {
diff --git a/solutions/2799. Count Complete Subarrays in an Array/2799.py b/solutions/2799. Count Complete Subarrays in an Array/2799.py
index 02e654c3cd2..2d6fbde073c 100644
--- a/solutions/2799. Count Complete Subarrays in an Array/2799.py	
+++ b/solutions/2799. Count Complete Subarrays in an Array/2799.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countCompleteSubarrays(self, nums: list[int]) -> int:
+  def countCompleteSubarrays(self, nums: List[int]) -> int:
     ans = 0
     distinct = len(set(nums))
     count = collections.Counter()
diff --git a/solutions/280. Wiggle Sort/280.py b/solutions/280. Wiggle Sort/280.py
index e35a17dd7af..e4ff916bebb 100644
--- a/solutions/280. Wiggle Sort/280.py	
+++ b/solutions/280. Wiggle Sort/280.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def wiggleSort(self, nums: list[int]) -> None:
+  def wiggleSort(self, nums: List[int]) -> None:
     # 1. If i is even, then nums[i] <= nums[i - 1].
     # 2. If i is odd, then nums[i] >= nums[i - 1].
     for i in range(1, len(nums)):
-      if (i % 2 == 0 and nums[i] > nums[i - 1] or
-              i % 2 == 1 and nums[i] < nums[i - 1]):
+      if i % 2 == 0 and nums[i] > nums[i - 1] or \
+              i % 2 == 1 and nums[i] < nums[i - 1]:
         nums[i], nums[i - 1] = nums[i - 1], nums[i]
diff --git a/solutions/2800. Shortest String That Contains Three Strings/2800.java b/solutions/2800. Shortest String That Contains Three Strings/2800.java
index e87d1491e6a..d7ccc0f2dbc 100644
--- a/solutions/2800. Shortest String That Contains Three Strings/2800.java	
+++ b/solutions/2800. Shortest String That Contains Three Strings/2800.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public String minimumString(String a, String b, String c) {
     final String abc = merge(a, merge(b, c));
     final String acb = merge(a, merge(c, b));
diff --git a/solutions/2800. Shortest String That Contains Three Strings/2800.py b/solutions/2800. Shortest String That Contains Three Strings/2800.py
index 29a66e28301..bfa7dacf80e 100644
--- a/solutions/2800. Shortest String That Contains Three Strings/2800.py	
+++ b/solutions/2800. Shortest String That Contains Three Strings/2800.py	
@@ -19,7 +19,7 @@ def merge(a: str, b: str) -> str:
     cba = merge(c, merge(b, a))
     return self._getMin([abc, acb, bac, bca, cab, cba])
 
-  def _getMin(self, words: list[str]) -> str:
+  def _getMin(self, words: List[str]) -> str:
     """Returns the lexicographically smallest string."""
 
     def getMin(a: str, b: str) -> str:
diff --git a/solutions/2801. Count Stepping Numbers in Range/2801.cpp b/solutions/2801. Count Stepping Numbers in Range/2801.cpp
index a3141403935..0bdf3f168ff 100644
--- a/solutions/2801. Count Stepping Numbers in Range/2801.cpp	
+++ b/solutions/2801. Count Stepping Numbers in Range/2801.cpp	
@@ -14,34 +14,35 @@ class Solution {
   static constexpr int kMod = 1'000'000'007;
 
   // Returns the number of valid integers, considering the i-th digit, where
-  // `prevDigit` is the previous digit, `tight1` indicates if the current
-  // digit is tightly bound for `low`, and `tight2` indicates if the current
+  // `prevDigit` is the previous digit, `isTight1` indicates if the current
+  // digit is tightly bound for `low`, and `isTight2` indicates if the current
   // digit is tightly bound for `high`.
   int count(const string& low, const string& high, int i, int prevDigit,
-            bool isLeadingZero, bool tight1, bool tight2,
+            bool isLeadingZero, bool isTight1, bool isTight2,
             vector<vector<vector<vector<int>>>>& mem) {
     if (i == high.length())
       return 1;
-    if (mem[i][prevDigit][tight1][tight2] != -1)
-      return mem[i][prevDigit][tight1][tight2];
+    if (mem[i][prevDigit][isTight1][isTight2] != -1)
+      return mem[i][prevDigit][isTight1][isTight2];
 
     int res = 0;
-    const int minDigit = tight1 ? low[i] - '0' : 0;
-    const int maxDigit = tight2 ? high[i] - '0' : 9;
+    const int minDigit = isTight1 ? low[i] - '0' : 0;
+    const int maxDigit = isTight2 ? high[i] - '0' : 9;
 
     for (int d = minDigit; d <= maxDigit; ++d) {
-      const bool nextTight1 = tight1 && (d == minDigit);
-      const bool nextTight2 = tight2 && (d == maxDigit);
+      const bool nextIsTight1 = isTight1 && (d == minDigit);
+      const bool nextIsTight2 = isTight2 && (d == maxDigit);
       if (isLeadingZero)
         // Can place any digit in [minDigit, maxDigit].
-        res += count(low, high, i + 1, d, isLeadingZero && d == 0, nextTight1,
-                     nextTight2, mem);
+        res += count(low, high, i + 1, d, isLeadingZero && d == 0, nextIsTight1,
+                     nextIsTight2, mem);
       else if (abs(d - prevDigit) == 1)
         // Can only place prevDigit - 1 or prevDigit + 1.
-        res += count(low, high, i + 1, d, false, nextTight1, nextTight2, mem);
+        res +=
+            count(low, high, i + 1, d, false, nextIsTight1, nextIsTight2, mem);
       res %= kMod;
     }
 
-    return mem[i][prevDigit][tight1][tight2] = res;
+    return mem[i][prevDigit][isTight1][isTight2] = res;
   }
 };
diff --git a/solutions/2801. Count Stepping Numbers in Range/2801.java b/solutions/2801. Count Stepping Numbers in Range/2801.java
index 0bd5f794dda..a1ab30c486e 100644
--- a/solutions/2801. Count Stepping Numbers in Range/2801.java	
+++ b/solutions/2801. Count Stepping Numbers in Range/2801.java	
@@ -6,35 +6,36 @@ public int countSteppingNumbers(String low, String high) {
     return count(lowWithLeadingZeros, high, 0, 10, /*isLeadingZero=*/true, true, true, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of valid integers, considering the i-th digit, where
-  // `prevDigit` is the previous digit, `tight1` indicates if the current
-  // digit is tightly bound for `low`, and `tight2` indicates if the current
+  // `prevDigit` is the previous digit, `isTight1` indicates if the current
+  // digit is tightly bound for `low`, and `isTight2` indicates if the current
   // digit is tightly bound for `high`.
   private int count(final String low, final String high, int i, int prevDigit,
-                    boolean isLeadingZero, boolean tight1, boolean tight2, Integer[][][][] mem) {
+                    boolean isLeadingZero, boolean isTight1, boolean isTight2,
+                    Integer[][][][] mem) {
     if (i == high.length())
       return 1;
-    if (mem[i][prevDigit][tight1 ? 1 : 0][tight2 ? 1 : 0] != null)
-      return mem[i][prevDigit][tight1 ? 1 : 0][tight2 ? 1 : 0];
+    if (mem[i][prevDigit][isTight1 ? 1 : 0][isTight2 ? 1 : 0] != null)
+      return mem[i][prevDigit][isTight1 ? 1 : 0][isTight2 ? 1 : 0];
 
     int res = 0;
-    final int minDigit = tight1 ? low.charAt(i) - '0' : 0;
-    final int maxDigit = tight2 ? high.charAt(i) - '0' : 9;
+    final int minDigit = isTight1 ? low.charAt(i) - '0' : 0;
+    final int maxDigit = isTight2 ? high.charAt(i) - '0' : 9;
 
     for (int d = minDigit; d <= maxDigit; ++d) {
-      final boolean nextTight1 = tight1 && (d == minDigit);
-      final boolean nextTight2 = tight2 && (d == maxDigit);
+      final boolean nextIsTight1 = isTight1 && (d == minDigit);
+      final boolean nextIsTight2 = isTight2 && (d == maxDigit);
       if (isLeadingZero)
         // Can place any digit in [minDigit, maxDigit].
-        res += count(low, high, i + 1, d, isLeadingZero && d == 0, nextTight1, nextTight2, mem);
+        res += count(low, high, i + 1, d, isLeadingZero && d == 0, nextIsTight1, nextIsTight2, mem);
       else if (Math.abs(d - prevDigit) == 1)
         // Can only place prevDigit - 1 or prevDigit + 1.
-        res += count(low, high, i + 1, d, false, nextTight1, nextTight2, mem);
-      res %= MOD;
+        res += count(low, high, i + 1, d, false, nextIsTight1, nextIsTight2, mem);
+      res %= kMod;
     }
 
-    return mem[i][prevDigit][tight1 ? 1 : 0][tight2 ? 1 : 0] = res;
+    return mem[i][prevDigit][isTight1 ? 1 : 0][isTight2 ? 1 : 0] = res;
   }
 }
diff --git a/solutions/2801. Count Stepping Numbers in Range/2801.py b/solutions/2801. Count Stepping Numbers in Range/2801.py
index 2468239f192..f58320b78bd 100644
--- a/solutions/2801. Count Stepping Numbers in Range/2801.py	
+++ b/solutions/2801. Count Stepping Numbers in Range/2801.py	
@@ -1,39 +1,33 @@
 class Solution:
   def countSteppingNumbers(self, low: str, high: str) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     low = '0' * (len(high) - len(low)) + low
 
     @functools.lru_cache(None)
-    def dp(
-        i: int,
-        prevDigit: int,
-        isLeadingZero: bool,
-        tight1: bool,
-        tight2: bool,
-    ) -> int:
+    def dp(i: int, prevDigit: int, isLeadingZero: bool, isTight1: bool, isTight2: bool) -> int:
       """
       Returns the number of valid integers, considering the i-th digit, where
-      `prevDigit` is the previous digit, `tight1` indicates if the current
-      digit is tightly bound for `low`, and `tight2` indicates if the current
+      `prevDigit` is the previous digit, `isTight1` indicates if the current
+      digit is tightly bound for `low`, and `isTight2` indicates if the current
       digit is tightly bound for `high`.
       """
       if i == len(high):
         return 1
 
       res = 0
-      minDigit = int(low[i]) if tight1 else 0
-      maxDigit = int(high[i]) if tight2 else 9
+      minDigit = int(low[i]) if isTight1 else 0
+      maxDigit = int(high[i]) if isTight2 else 9
 
       for d in range(minDigit, maxDigit + 1):
-        nextTight1 = tight1 and (d == minDigit)
-        nextTight2 = tight2 and (d == maxDigit)
+        nextIsTight1 = isTight1 and (d == minDigit)
+        nextIsTight2 = isTight2 and (d == maxDigit)
         if isLeadingZero:
           # Can place any digit in [minDigit, maxDigit].
           res += dp(i + 1, d, isLeadingZero and d ==
-                    0, nextTight1, nextTight2)
+                    0, nextIsTight1, nextIsTight2)
         elif abs(d - prevDigit) == 1:
-          res += dp(i + 1, d, False, nextTight1, nextTight2)
-        res %= MOD
+          res += dp(i + 1, d, False, nextIsTight1, nextIsTight2)
+        res %= kMod
 
       return res
 
diff --git a/solutions/2802. Find The K-th Lucky Number/2802.cpp b/solutions/2802. Find The K-th Lucky Number/2802.cpp
index 2c24f088e85..a320f74335a 100644
--- a/solutions/2802. Find The K-th Lucky Number/2802.cpp	
+++ b/solutions/2802. Find The K-th Lucky Number/2802.cpp	
@@ -6,7 +6,7 @@ class Solution {
     for (int i = k + 1; i > 0; i /= 2)
       ans += i % 2 == 0 ? '4' : '7';
 
-    ranges::reverse(ans);
+    reverse(ans.begin(), ans.end());
     return ans.substr(1);
   }
 };
diff --git a/solutions/2807. Insert Greatest Common Divisors in Linked List/2807.py b/solutions/2807. Insert Greatest Common Divisors in Linked List/2807.py
index b4f029cdf30..29f67dd68e7 100644
--- a/solutions/2807. Insert Greatest Common Divisors in Linked List/2807.py	
+++ b/solutions/2807. Insert Greatest Common Divisors in Linked List/2807.py	
@@ -1,7 +1,5 @@
 class Solution:
-  def insertGreatestCommonDivisors(
-      self, head: ListNode | None
-  ) -> ListNode | None:
+  def insertGreatestCommonDivisors(self, head: Optional[ListNode]) -> Optional[ListNode]:
     curr = head
     while curr.next:
       inserted = ListNode(math.gcd(curr.val, curr.next.val), curr.next)
diff --git a/solutions/2808. Minimum Seconds to Equalize a Circular Array/2808.py b/solutions/2808. Minimum Seconds to Equalize a Circular Array/2808.py
index 18c41b31ba1..5390dcc5793 100644
--- a/solutions/2808. Minimum Seconds to Equalize a Circular Array/2808.py	
+++ b/solutions/2808. Minimum Seconds to Equalize a Circular Array/2808.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumSeconds(self, nums: list[int]) -> int:
+  def minimumSeconds(self, nums: List[int]) -> int:
     n = len(nums)
     ans = n
     numToIndices = collections.defaultdict(list)
diff --git a/solutions/2809. Minimum Time to Make Array Sum At Most x/2809-2.java b/solutions/2809. Minimum Time to Make Array Sum At Most x/2809-2.java
index 7979e7ef91c..2b3febab66b 100644
--- a/solutions/2809. Minimum Time to Make Array Sum At Most x/2809-2.java	
+++ b/solutions/2809. Minimum Time to Make Array Sum At Most x/2809-2.java	
@@ -11,7 +11,7 @@ public int minimumTime(List<Integer> nums1, List<Integer> nums2, int x) {
     for (int i = 0; i < n; ++i)
       sortedNums.add(new Pair<>(nums2.get(i), nums1.get(i)));
 
-    sortedNums.sort(Comparator.comparingInt(Pair::getKey));
+    sortedNums.sort(Comparator.comparingInt(a -> a.getKey()));
 
     for (int i = 1; i <= n; ++i) {
       final int num2 = sortedNums.get(i - 1).getKey();
diff --git a/solutions/2809. Minimum Time to Make Array Sum At Most x/2809-2.py b/solutions/2809. Minimum Time to Make Array Sum At Most x/2809-2.py
index 267b1492bd4..466d65d8ee8 100644
--- a/solutions/2809. Minimum Time to Make Array Sum At Most x/2809-2.py	
+++ b/solutions/2809. Minimum Time to Make Array Sum At Most x/2809-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumTime(self, nums1: list[int], nums2: list[int], x: int) -> int:
+  def minimumTime(self, nums1: List[int], nums2: List[int], x: int) -> int:
     n = len(nums1)
     # dp[j] := the maximum reduced value if we do j operations on the numbers
     # so far
diff --git a/solutions/2809. Minimum Time to Make Array Sum At Most x/2809.java b/solutions/2809. Minimum Time to Make Array Sum At Most x/2809.java
index 98acd84f171..dd500ee3c06 100644
--- a/solutions/2809. Minimum Time to Make Array Sum At Most x/2809.java	
+++ b/solutions/2809. Minimum Time to Make Array Sum At Most x/2809.java	
@@ -11,7 +11,7 @@ public int minimumTime(List<Integer> nums1, List<Integer> nums2, int x) {
     for (int i = 0; i < n; ++i)
       sortedNums.add(new Pair<>(nums2.get(i), nums1.get(i)));
 
-    sortedNums.sort(Comparator.comparingInt(Pair::getKey));
+    sortedNums.sort(Comparator.comparingInt(a -> a.getKey()));
 
     for (int i = 1; i <= n; ++i) {
       final int num2 = sortedNums.get(i - 1).getKey();
diff --git a/solutions/2809. Minimum Time to Make Array Sum At Most x/2809.py b/solutions/2809. Minimum Time to Make Array Sum At Most x/2809.py
index d1d83d2ca1a..e72f984fcae 100644
--- a/solutions/2809. Minimum Time to Make Array Sum At Most x/2809.py	
+++ b/solutions/2809. Minimum Time to Make Array Sum At Most x/2809.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumTime(self, nums1: list[int], nums2: list[int], x: int) -> int:
+  def minimumTime(self, nums1: List[int], nums2: List[int], x: int) -> int:
     n = len(nums1)
     # dp[i][j] := the maximum reduced value if we do j operations on the first
     # i numbers
diff --git a/solutions/281. Zigzag Iterator/281.py b/solutions/281. Zigzag Iterator/281.py
index bcafe8b8725..ca308ea1649 100644
--- a/solutions/281. Zigzag Iterator/281.py	
+++ b/solutions/281. Zigzag Iterator/281.py	
@@ -1,5 +1,5 @@
 class ZigzagIterator:
-  def __init__(self, v1: list[int], v2: list[int]):
+  def __init__(self, v1: List[int], v2: List[int]):
     def vals():
       for i in itertools.count():
         for v in v1, v2:
diff --git a/solutions/2810. Faulty Keyboard/2810.java b/solutions/2810. Faulty Keyboard/2810.java
index 40d6e7f9f45..dd92407688d 100644
--- a/solutions/2810. Faulty Keyboard/2810.java	
+++ b/solutions/2810. Faulty Keyboard/2810.java	
@@ -8,9 +8,9 @@ public String finalString(String s) {
       if (c == 'i')
         inversed = !inversed;
       else if (inversed)
-        dq.offerFirst(c);
+        dq.addFirst(c);
       else
-        dq.offerLast(c);
+        dq.addLast(c);
 
     while (!dq.isEmpty())
       sb.append(dq.pollFirst());
diff --git a/solutions/2811. Check if it is Possible to Split Array/2811.py b/solutions/2811. Check if it is Possible to Split Array/2811.py
index a66fd75e3ce..5cdf48ad6fe 100644
--- a/solutions/2811. Check if it is Possible to Split Array/2811.py	
+++ b/solutions/2811. Check if it is Possible to Split Array/2811.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def canSplitArray(self, nums: list[int], m: int) -> bool:
+  def canSplitArray(self, nums: List[int], m: int) -> bool:
     return len(nums) < 3 or any(a + b >= m for a, b in itertools.pairwise(nums))
diff --git a/solutions/2812. Find the Safest Path in a Grid/2812.cpp b/solutions/2812. Find the Safest Path in a Grid/2812.cpp
index a458e883ab9..b64d8b35f71 100644
--- a/solutions/2812. Find the Safest Path in a Grid/2812.cpp	
+++ b/solutions/2812. Find the Safest Path in a Grid/2812.cpp	
@@ -17,7 +17,7 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   bool hasValidPath(const vector<vector<int>>& distToThief, int safeness) {
     if (distToThief[0][0] < safeness)
@@ -35,7 +35,7 @@ class Solution {
         continue;
       if (i == n - 1 && j == n - 1)
         return true;
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == n || y < 0 || y == n)
@@ -68,7 +68,7 @@ class Solution {
         const auto [i, j] = q.front();
         q.pop();
         distToThief[i][j] = dist;
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == n || y < 0 || y == n)
diff --git a/solutions/2812. Find the Safest Path in a Grid/2812.java b/solutions/2812. Find the Safest Path in a Grid/2812.java
index b1a0540196d..aab689f6977 100644
--- a/solutions/2812. Find the Safest Path in a Grid/2812.java	
+++ b/solutions/2812. Find the Safest Path in a Grid/2812.java	
@@ -15,14 +15,14 @@ public int maximumSafenessFactor(List<List<Integer>> grid) {
     return l - 1;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private boolean hasValidPath(int[][] distToThief, int safeness) {
     if (distToThief[0][0] < safeness)
       return false;
 
     final int n = distToThief.length;
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(0, 0)));
+    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(Arrays.asList(new Pair<>(0, 0)));
     boolean[][] seen = new boolean[n][n];
     seen[0][0] = true;
 
@@ -33,7 +33,7 @@ private boolean hasValidPath(int[][] distToThief, int safeness) {
         continue;
       if (i == n - 1 && j == n - 1)
         return true;
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == n || y < 0 || y == n)
@@ -66,7 +66,7 @@ private int[][] getDistToThief(List<List<Integer>> grid) {
         final int i = q.peek().getKey();
         final int j = q.poll().getValue();
         distToThief[i][j] = dist;
-        for (int[] dir : DIRS) {
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == n || y < 0 || y == n)
diff --git a/solutions/2812. Find the Safest Path in a Grid/2812.py b/solutions/2812. Find the Safest Path in a Grid/2812.py
index 45d86e49607..aeffa3e5de3 100644
--- a/solutions/2812. Find the Safest Path in a Grid/2812.py	
+++ b/solutions/2812. Find the Safest Path in a Grid/2812.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def maximumSafenessFactor(self, grid: list[list[int]]) -> int:
-    self.DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def maximumSafenessFactor(self, grid: List[List[int]]) -> int:
+    self.dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     n = len(grid)
     distToThief = self._getDistToThief(grid)
 
@@ -17,7 +17,7 @@ def hasValidPath(safeness: int) -> bool:
           continue
         if i == n - 1 and j == n - 1:
           return True
-        for dx, dy in self.DIRS:
+        for dx, dy in self.dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == n or y < 0 or y == n:
@@ -32,7 +32,7 @@ def hasValidPath(safeness: int) -> bool:
     return bisect.bisect_left(range(n * 2), True,
                               key=lambda m: not hasValidPath(m)) - 1
 
-  def _getDistToThief(self, grid: list[list[int]]) -> list[list[int]]:
+  def _getDistToThief(self, grid: List[List[int]]) -> List[List[int]]:
     n = len(grid)
     distToThief = [[0] * n for _ in range(n)]
     q = collections.deque()
@@ -49,7 +49,7 @@ def _getDistToThief(self, grid: list[list[int]]) -> list[list[int]]:
       for _ in range(len(q)):
         i, j = q.popleft()
         distToThief[i][j] = dist
-        for dx, dy in self.DIRS:
+        for dx, dy in self.dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == n or y < 0 or y == n:
diff --git a/solutions/2813. Maximum Elegance of a K-Length Subsequence/2813.java b/solutions/2813. Maximum Elegance of a K-Length Subsequence/2813.java
index 154c9b825b5..5af3762786b 100644
--- a/solutions/2813. Maximum Elegance of a K-Length Subsequence/2813.java	
+++ b/solutions/2813. Maximum Elegance of a K-Length Subsequence/2813.java	
@@ -5,7 +5,7 @@ public long findMaximumElegance(int[][] items, int k) {
     Set<Integer> seenCategories = new HashSet<>();
     Deque<Integer> decreasingDuplicateProfits = new ArrayDeque<>();
 
-    Arrays.sort(items, Comparator.comparingInt(item -> - item[0]));
+    Arrays.sort(items, (a, b) -> b[0] - a[0]);
 
     for (int i = 0; i < k; ++i) {
       final int profit = items[i][0];
diff --git a/solutions/2813. Maximum Elegance of a K-Length Subsequence/2813.py b/solutions/2813. Maximum Elegance of a K-Length Subsequence/2813.py
index 1e957ffa326..fba87128680 100644
--- a/solutions/2813. Maximum Elegance of a K-Length Subsequence/2813.py	
+++ b/solutions/2813. Maximum Elegance of a K-Length Subsequence/2813.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaximumElegance(self, items: list[list[int]], k: int) -> int:
+  def findMaximumElegance(self, items: List[List[int]], k: int) -> int:
     ans = 0
     totalProfit = 0
     seenCategories = set()
diff --git a/solutions/2814. Minimum Time Takes to Reach Destination Without Drowning/2814.cpp b/solutions/2814. Minimum Time Takes to Reach Destination Without Drowning/2814.cpp
index 92818847136..3b2ce9c2788 100644
--- a/solutions/2814. Minimum Time Takes to Reach Destination Without Drowning/2814.cpp	
+++ b/solutions/2814. Minimum Time Takes to Reach Destination Without Drowning/2814.cpp	
@@ -18,7 +18,7 @@ class Solution {
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
@@ -36,7 +36,7 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   vector<vector<int>> getFloodDist(const vector<vector<string>>& land) {
     const int m = land.size();
@@ -57,7 +57,7 @@ class Solution {
         const auto [i, j] = q.front();
         q.pop();
         dist[i][j] = d;
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/2814. Minimum Time Takes to Reach Destination Without Drowning/2814.java b/solutions/2814. Minimum Time Takes to Reach Destination Without Drowning/2814.java
index ee7e14a6227..a7ee38ea815 100644
--- a/solutions/2814. Minimum Time Takes to Reach Destination Without Drowning/2814.java	
+++ b/solutions/2814. Minimum Time Takes to Reach Destination Without Drowning/2814.java	
@@ -17,7 +17,7 @@ public int minimumSeconds(List<List<String>> land) {
       for (int sz = q.size(); sz > 0; --sz) {
         final int i = q.peek().getKey();
         final int j = q.poll().getValue();
-        for (int[] dir : DIRS) {
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == m || y < 0 || y == n)
@@ -34,7 +34,7 @@ public int minimumSeconds(List<List<String>> land) {
     return -1;
   }
 
-  private final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private int[][] getFloodDist(List<List<String>> land) {
     final int m = land.size();
@@ -57,7 +57,7 @@ private int[][] getFloodDist(List<List<String>> land) {
         final int i = q.peek().getKey();
         final int j = q.poll().getValue();
         dist[i][j] = d;
-        for (int[] dir : DIRS) {
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/2814. Minimum Time Takes to Reach Destination Without Drowning/2814.py b/solutions/2814. Minimum Time Takes to Reach Destination Without Drowning/2814.py
index 5e0d0f1be5a..ccd91f612b2 100644
--- a/solutions/2814. Minimum Time Takes to Reach Destination Without Drowning/2814.py	
+++ b/solutions/2814. Minimum Time Takes to Reach Destination Without Drowning/2814.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def minimumSeconds(self, land: list[list[str]]) -> int:
-    self.DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def minimumSeconds(self, land: List[List[str]]) -> int:
+    self.dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(land)
     n = len(land[0])
     floodDist = self._getFloodDist(land)
@@ -13,7 +13,7 @@ def minimumSeconds(self, land: list[list[str]]) -> int:
     while q:
       for _ in range(len(q)):
         i, j = q.popleft()
-        for dx, dy in self.DIRS:
+        for dx, dy in self.dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == m or y < 0 or y == n:
@@ -28,7 +28,7 @@ def minimumSeconds(self, land: list[list[str]]) -> int:
 
     return -1
 
-  def _getFloodDist(self, land: list[list[str]]) -> list[list[int]]:
+  def _getFloodDist(self, land: List[List[str]]) -> List[List[int]]:
     m = len(land)
     n = len(land[0])
     dist = [[math.inf] * n for _ in range(m)]
@@ -46,7 +46,7 @@ def _getFloodDist(self, land: list[list[str]]) -> list[list[int]]:
       for _ in range(len(q)):
         i, j = q.popleft()
         dist[i][j] = d
-        for dx, dy in self.DIRS:
+        for dx, dy in self.dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == m or y < 0 or y == n:
@@ -59,7 +59,7 @@ def _getFloodDist(self, land: list[list[str]]) -> list[list[int]]:
 
     return dist
 
-  def _getStartPos(self, land: list[list[str]], c: str) -> tuple[int, int]:
+  def _getStartPos(self, land: List[List[str]], c: str) -> Tuple[int, int]:
     for i, row in enumerate(land):
       for j, cell in enumerate(row):
         if cell == c:
diff --git a/solutions/2815. Max Pair Sum in an Array/2815.py b/solutions/2815. Max Pair Sum in an Array/2815.py
index bd5fd19e668..9a08588886f 100644
--- a/solutions/2815. Max Pair Sum in an Array/2815.py	
+++ b/solutions/2815. Max Pair Sum in an Array/2815.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSum(self, nums: list[int]) -> int:
+  def maxSum(self, nums: List[int]) -> int:
     ans = 0
     # maxNum[i] := the maximum num we met so far with the maximum digit i
     maxNum = [0] * 10
diff --git a/solutions/2816. Double a Number Represented as a Linked List/2816-2.py b/solutions/2816. Double a Number Represented as a Linked List/2816-2.py
index 4b7361de051..a5f0c548224 100644
--- a/solutions/2816. Double a Number Represented as a Linked List/2816-2.py	
+++ b/solutions/2816. Double a Number Represented as a Linked List/2816-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def doubleIt(self, head: ListNode | None) -> ListNode | None:
+  def doubleIt(self, head: Optional[ListNode]) -> Optional[ListNode]:
     if head.val >= 5:
       head = ListNode(0, head)
 
diff --git a/solutions/2816. Double a Number Represented as a Linked List/2816.py b/solutions/2816. Double a Number Represented as a Linked List/2816.py
index 44e31bd6bd9..08e97eb9b27 100644
--- a/solutions/2816. Double a Number Represented as a Linked List/2816.py	
+++ b/solutions/2816. Double a Number Represented as a Linked List/2816.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def doubleIt(self, head: ListNode | None) -> ListNode | None:
-    def getCarry(node: ListNode | None) -> ListNode | None:
+  def doubleIt(self, head: Optional[ListNode]) -> Optional[ListNode]:
+    def getCarry(node: Optional[ListNode]) -> Optional[ListNode]:
       val = node.val * 2
       if node.next:
         val += getCarry(node.next)
diff --git a/solutions/2817. Minimum Absolute Difference Between Elements With Constraint/2817.py b/solutions/2817. Minimum Absolute Difference Between Elements With Constraint/2817.py
index d257ee483a4..bcccc761070 100644
--- a/solutions/2817. Minimum Absolute Difference Between Elements With Constraint/2817.py	
+++ b/solutions/2817. Minimum Absolute Difference Between Elements With Constraint/2817.py	
@@ -2,7 +2,7 @@
 
 
 class Solution:
-  def minAbsoluteDifference(self, nums: list[int], x: int) -> int:
+  def minAbsoluteDifference(self, nums: List[int], x: int) -> int:
     ans = math.inf
     seen = SortedSet()
 
diff --git a/solutions/2818. Apply Operations to Maximize Score/2818.cpp b/solutions/2818. Apply Operations to Maximize Score/2818.cpp
index 8cde71c498b..cb794ebe404 100644
--- a/solutions/2818. Apply Operations to Maximize Score/2818.cpp	
+++ b/solutions/2818. Apply Operations to Maximize Score/2818.cpp	
@@ -2,8 +2,8 @@ class Solution {
  public:
   int maximumScore(vector<int>& nums, int k) {
     const int n = nums.size();
-    const int mx = ranges::max(nums);
-    const vector<int> minPrimeFactors = sieveEratosthenes(mx + 1);
+    const int maxNum = ranges::max(nums);
+    const vector<int> minPrimeFactors = sieveEratosthenes(maxNum + 1);
     const vector<int> primeScores = getPrimeScores(nums, minPrimeFactors);
     int ans = 1;
     // left[i] := the next index on the left (if any) s.t.
@@ -45,10 +45,10 @@ class Solution {
       // nums[i] is the maximum value in the range [left[i] + 1, right[i] - 1]
       // So, there are (i - left[i]) * (right[i] - 1) ranges where nums[i] will
       // be chosen.
-      const long rangeCount = static_cast<long>(i - left[i]) * (right[i] - i);
-      const long actualCount = min(rangeCount, static_cast<long>(k));
+      const int rangeCount = (i - left[i]) * (right[i] - i);
+      const int actualCount = min(rangeCount, k);
       k -= actualCount;
-      ans = static_cast<long>(ans) * modPow(num, actualCount) % kMod;
+      ans = (static_cast<long>(ans) * modPow(num, actualCount)) % kMod;
     }
 
     return ans;
diff --git a/solutions/2818. Apply Operations to Maximize Score/2818.java b/solutions/2818. Apply Operations to Maximize Score/2818.java
index a577a712407..48e25280803 100644
--- a/solutions/2818. Apply Operations to Maximize Score/2818.java	
+++ b/solutions/2818. Apply Operations to Maximize Score/2818.java	
@@ -1,8 +1,8 @@
 class Solution {
   public int maximumScore(List<Integer> nums, int k) {
     final int n = nums.size();
-    final int mx = Collections.max(nums);
-    final int[] minPrimeFactors = sieveEratosthenes(mx + 1);
+    final int maxNum = Collections.max(nums);
+    final int[] minPrimeFactors = sieveEratosthenes(maxNum + 1);
     final int[] primeScores = getPrimeScores(nums, minPrimeFactors);
     int ans = 1;
     // left[i] := the next index on the left (if any)
@@ -37,8 +37,9 @@ public int maximumScore(List<Integer> nums, int k) {
       numAndIndexes[i] = new Pair<>(nums.get(i), i);
 
     Arrays.sort(numAndIndexes,
-                Comparator.comparing(Pair<Integer, Integer>::getKey, Comparator.reverseOrder())
-                    .thenComparingInt(Pair<Integer, Integer>::getValue));
+                (a, b)
+                    -> a.getKey().equals(b.getKey()) ? a.getValue() - b.getValue()
+                                                     : b.getKey() - a.getKey());
 
     for (Pair<Integer, Integer> numAndIndex : numAndIndexes) {
       final int num = numAndIndex.getKey();
@@ -46,23 +47,23 @@ public int maximumScore(List<Integer> nums, int k) {
       // nums[i] is the maximum value in the range [left[i] + 1, right[i] - 1]
       // So, there are (i - left[i]) * (right[i] - 1) ranges where nums[i] will
       // be chosen.
-      final long rangeCount = (long) (i - left[i]) * (right[i] - i);
-      final long actualCount = Math.min(rangeCount, (long) k);
+      final int rangeCount = (i - left[i]) * (right[i] - i);
+      final int actualCount = Math.min(rangeCount, k);
       k -= actualCount;
-      ans = (int) ((1L * ans * modPow(num, actualCount)) % MOD);
+      ans = (int) ((1L * ans * modPow(num, actualCount)) % kMod);
     }
 
     return ans;
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2);
+      return x * modPow(x, n - 1) % kMod;
+    return modPow(x * x % kMod, n / 2);
   }
 
   // Gets the minimum prime factor of i, where 1 < i <= n.
diff --git a/solutions/2818. Apply Operations to Maximize Score/2818.py b/solutions/2818. Apply Operations to Maximize Score/2818.py
index 420ad21dd40..6d2a5dcb425 100644
--- a/solutions/2818. Apply Operations to Maximize Score/2818.py	
+++ b/solutions/2818. Apply Operations to Maximize Score/2818.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def maximumScore(self, nums: list[int], k: int) -> int:
-    MOD = 1_000_000_007
+  def maximumScore(self, nums: List[int], k: int) -> int:
+    kMod = 1_000_000_007
     n = len(nums)
     ans = 1
     minPrimeFactors = self._sieveEratosthenes(max(nums) + 1)
@@ -33,8 +33,8 @@ def modPow(x: int, n: int) -> int:
       if n == 0:
         return 1
       if n % 2 == 1:
-        return x * modPow(x, n - 1) % MOD
-      return modPow(x * x % MOD, n // 2)
+        return x * modPow(x, n - 1) % kMod
+      return modPow(x * x % kMod, n // 2)
 
     for num, i in sorted(numAndIndexes, key=lambda x: (-x[0], x[1])):
       # nums[i] is the maximum value in the range [left[i] + 1, right[i] - 1]
@@ -44,11 +44,11 @@ def modPow(x: int, n: int) -> int:
       actualCount = min(rangeCount, k)
       k -= actualCount
       ans *= modPow(num, actualCount)
-      ans %= MOD
+      ans %= kMod
 
     return ans
 
-  def _sieveEratosthenes(self, n: int) -> list[int]:
+  def _sieveEratosthenes(self, n: int) -> List[int]:
     """Gets the minimum prime factor of i, where 2 <= i <= n."""
     minPrimeFactors = [i for i in range(n + 1)]
     for i in range(2, int(n**0.5) + 1):
@@ -57,7 +57,7 @@ def _sieveEratosthenes(self, n: int) -> list[int]:
           minPrimeFactors[j] = min(minPrimeFactors[j], i)
     return minPrimeFactors
 
-  def _getPrimeScore(self, num: int, minPrimeFactors: list[int]) -> int:
+  def _getPrimeScore(self, num: int, minPrimeFactors: List[int]) -> int:
     primeFactors = set()
     while num > 1:
       divisor = minPrimeFactors[num]
diff --git a/solutions/2819. Minimum Relative Loss After Buying Chocolates/2819.cpp b/solutions/2819. Minimum Relative Loss After Buying Chocolates/2819.cpp
index 8ad06a0177e..ebf0e3b894c 100644
--- a/solutions/2819. Minimum Relative Loss After Buying Chocolates/2819.cpp	
+++ b/solutions/2819. Minimum Relative Loss After Buying Chocolates/2819.cpp	
@@ -14,7 +14,7 @@ class Solution {
     for (const vector<int>& query : queries) {
       const int k = query[0];
       const int m = query[1];
-      const int countFront = getCountFront(k, m, prices);
+      const int countFront = getCountFront(k, m, prices, prefix);
       const int countBack = m - countFront;
       ans.push_back(getRelativeLoss(countFront, countBack, k, prefix));
     }
@@ -41,7 +41,8 @@ class Solution {
   // To determine the optimal `left` in each iteration, we simply compare
   // `loss[left]` with `loss[n - right]`; if `loss[left] < loss[n - right]`,
   // it's worth increasing `left`.
-  int getCountFront(int k, int m, const vector<int>& prices) {
+  int getCountFront(int k, int m, const vector<int>& prices,
+                    const vector<long long>& prefix) {
     const int n = prices.size();
     const int countNoGreaterThanK =
         ranges::upper_bound(prices, k) - prices.begin();
diff --git a/solutions/2819. Minimum Relative Loss After Buying Chocolates/2819.java b/solutions/2819. Minimum Relative Loss After Buying Chocolates/2819.java
index 6fd2f056f04..63475d33d51 100644
--- a/solutions/2819. Minimum Relative Loss After Buying Chocolates/2819.java	
+++ b/solutions/2819. Minimum Relative Loss After Buying Chocolates/2819.java	
@@ -12,7 +12,7 @@ long[] minimumRelativeLosses(int[] prices, int[][] queries) {
     for (int i = 0; i < queries.length; ++i) {
       final int k = queries[i][0];
       final int m = queries[i][1];
-      final int countFront = getCountFront(k, m, prices);
+      final int countFront = getCountFront(k, m, prices, prefix);
       final int countBack = m - countFront;
       ans[i] = getRelativeLoss(countFront, countBack, k, prefix);
     }
@@ -38,7 +38,7 @@ long[] minimumRelativeLosses(int[] prices, int[][] queries) {
   // To determine the optimal `left` in each iteration, we simply compare
   // `loss[left]` with `loss[n - right]`; if `loss[left] < loss[n - right]`,
   // it's worth increasing `left`.
-  private int getCountFront(int k, int m, int[] prices) {
+  private int getCountFront(int k, int m, int[] prices, long[] prefix) {
     final int n = prices.length;
     final int countNoGreaterThanK = firstGreater(prices, k);
     int l = 0;
@@ -57,8 +57,8 @@ private int getCountFront(int k, int m, int[] prices) {
     return l;
   }
 
-  private int firstGreater(int[] arr, int target) {
-    final int i = Arrays.binarySearch(arr, target + 1);
+  private int firstGreater(int[] A, int target) {
+    final int i = Arrays.binarySearch(A, target + 1);
     return i < 0 ? -i - 1 : i;
   }
 
diff --git a/solutions/2819. Minimum Relative Loss After Buying Chocolates/2819.py b/solutions/2819. Minimum Relative Loss After Buying Chocolates/2819.py
index 4b376dead79..762fa8b3572 100644
--- a/solutions/2819. Minimum Relative Loss After Buying Chocolates/2819.py	
+++ b/solutions/2819. Minimum Relative Loss After Buying Chocolates/2819.py	
@@ -1,30 +1,22 @@
 class Solution:
-  def minimumRelativeLosses(
-      self,
-      prices: list[int],
-      queries: list[list[int]],
-  ) -> list[int]:
+  def minimumRelativeLosses(self, prices: List[int], queries: List[List[int]]) -> List[int]:
     ans = []
 
     prices.sort()
 
-    prefix = list(itertools.accumulate(prices, initial=0))
+    prefix = [0] + list(itertools.accumulate(prices))
 
     for k, m in queries:
-      countFront = self._getCountFront(k, m, prices)
+      countFront = self._getCountFront(k, m, prices, prefix)
       countBack = m - countFront
       ans.append(self._getRelativeLoss(countFront, countBack, k, prefix))
 
     return ans
 
-  def _getCountFront(
-      self,
-      k: int,
-      m: int,
-      prices: list[int],
-  ) -> int:
+  def _getCountFront(self, k: int, m: int, prices: List[int], prefix: List[int]) -> int:
     """Returns `countFront` for query (k, m).
 
+
     Returns `countFront` for query (k, m) s.t. picking the first `countFront`
     and the last `m - countFront` chocolates is optimal.
 
@@ -60,17 +52,8 @@ def _getCountFront(
 
     return l
 
-  def _getRelativeLoss(
-      self,
-      countFront: int,
-      countBack: int,
-      k: int,
-      prefix: list[int],
-  ) -> int:
-    """
-    Returns the relative loss of picking `countFront` and `countBack` 
-    chocolates.
-    """
+  def _getRelativeLoss(self, countFront: int, countBack: int, k: int, prefix: List[int]) -> int:
+    """Returns the relative loss of picking `countFront` and `countBack` chocolates."""
     lossFront = prefix[countFront]
     lossBack = 2 * k * countBack - (prefix[-1] - prefix[-countBack - 1])
     return lossFront + lossBack
diff --git a/solutions/282. Expression Add Operators/282.cpp b/solutions/282. Expression Add Operators/282.cpp
index b0b88e33888..c75120025f4 100644
--- a/solutions/282. Expression Add Operators/282.cpp	
+++ b/solutions/282. Expression Add Operators/282.cpp	
@@ -29,18 +29,18 @@ class Solution {
       const long curr = stol(s);
       if (start == 0) {
         path.push_back(s);
-        dfs(num, target, i + 1, curr, curr, std::move(path), ans);
+        dfs(num, target, i + 1, curr, curr, move(path), ans);
         path.pop_back();
       } else {
         for (const string& op : {"+", "-", "*"}) {
           path.push_back(op + s);
           if (op == "+")
-            dfs(num, target, i + 1, curr, eval + curr, std::move(path), ans);
+            dfs(num, target, i + 1, curr, eval + curr, move(path), ans);
           else if (op == "-")
-            dfs(num, target, i + 1, -curr, eval - curr, std::move(path), ans);
+            dfs(num, target, i + 1, -curr, eval - curr, move(path), ans);
           else
             dfs(num, target, i + 1, prev * curr, eval - prev + prev * curr,
-                std::move(path), ans);
+                move(path), ans);
           path.pop_back();
         }
       }
diff --git a/solutions/282. Expression Add Operators/282.py b/solutions/282. Expression Add Operators/282.py
index 311847a69f9..6ba5e1408a4 100644
--- a/solutions/282. Expression Add Operators/282.py	
+++ b/solutions/282. Expression Add Operators/282.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def addOperators(self, num: str, target: int) -> list[str]:
+  def addOperators(self, num: str, target: int) -> List[str]:
     ans = []
 
-    def dfs(start: int, prev: int, eval: int, path: list[str]) -> None:
+    def dfs(start: int, prev: int, eval: int, path: List[str]) -> None:
       if start == len(num):
         if eval == target:
           ans.append(''.join(path))
diff --git a/solutions/2823. Deep Object Filter/2823.ts b/solutions/2823. Deep Object Filter/2823.ts
index 7a3e64a6e29..470c6784a78 100644
--- a/solutions/2823. Deep Object Filter/2823.ts	
+++ b/solutions/2823. Deep Object Filter/2823.ts	
@@ -5,26 +5,24 @@ type JSONValue =
   | string
   | JSONValue[]
   | { [key: string]: JSONValue };
-type Obj = JSONValue | Record<string, JSONValue> | Array<JSONValue>;
+type Obj = Record<string, JSONValue> | Array<JSONValue>;
 
-function deepFilter(obj: Obj, fn: (x: JSONValue) => boolean): Obj | undefined {
+function deepFilter(obj: Obj, fn: Function): Obj | undefined {
+  if (obj === null || typeof obj !== 'object') {
+    return fn(obj) ? obj : undefined;
+  }
   if (Array.isArray(obj)) {
-    const filteredArr = obj
+    const ans = (obj as Obj[])
       .map((item) => deepFilter(item, fn))
       .filter((item) => item !== undefined);
-    return filteredArr.length > 0 ? filteredArr : undefined;
+    return ans.length > 0 ? ans : undefined;
   }
-
-  if (typeof obj === 'object' && obj !== null) {
-    const filteredObj: Record<string, JSONValue> = {};
-    for (const key in obj) {
-      const filteredValue = deepFilter(obj[key], fn);
-      if (filteredValue !== undefined) {
-        filteredObj[key] = filteredValue;
-      }
+  let ans = {};
+  for (const [key, value] of Object.entries(obj)) {
+    const ans = deepFilter(value as Obj, fn);
+    if (ans !== undefined) {
+      ans[key] = ans;
     }
-    return Object.keys(filteredObj).length > 0 ? filteredObj : undefined;
   }
-
-  return fn(obj) ? obj : undefined;
+  return Object.keys(ans).length > 0 ? ans : undefined;
 }
diff --git a/solutions/2824. Count Pairs Whose Sum is Less than Target/2824.py b/solutions/2824. Count Pairs Whose Sum is Less than Target/2824.py
index 83e60b8743f..acf630b7b24 100644
--- a/solutions/2824. Count Pairs Whose Sum is Less than Target/2824.py	
+++ b/solutions/2824. Count Pairs Whose Sum is Less than Target/2824.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countPairs(self, nums: list[int], target: int) -> int:
+  def countPairs(self, nums: List[int], target: int) -> int:
     return sum(nums[i] + nums[j] < target
                for i in range(len(nums))
                for j in range(i + 1, len(nums)))
diff --git a/solutions/2825. Make String a Subsequence Using Cyclic Increments/2825.py b/solutions/2825. Make String a Subsequence Using Cyclic Increments/2825.py
index a1988538183..d702fe94505 100644
--- a/solutions/2825. Make String a Subsequence Using Cyclic Increments/2825.py	
+++ b/solutions/2825. Make String a Subsequence Using Cyclic Increments/2825.py	
@@ -3,8 +3,7 @@ def canMakeSubsequence(self, str1: str, str2: str) -> bool:
     i = 0  # str2's index
 
     for c in str1:
-      if c == str2[i] or chr(
-              ord('a') + (ord(c) - ord('a') + 1) % 26) == str2[i]:
+      if c == str2[i] or chr(ord('a') + ((ord(c) - ord('a') + 1) % 26)) == str2[i]:
         i += 1
         if i == len(str2):
           return True
diff --git a/solutions/2826. Sorting Three Groups/2826.py b/solutions/2826. Sorting Three Groups/2826.py
index 6c12c32b436..dc4d2e50086 100644
--- a/solutions/2826. Sorting Three Groups/2826.py	
+++ b/solutions/2826. Sorting Three Groups/2826.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumOperations(self, nums: list[int]) -> int:
+  def minimumOperations(self, nums: List[int]) -> int:
     # dp[i] := the longest non-decreasing subsequence so far with numbers in [1..i]
     dp = [0] * 4
 
diff --git a/solutions/2827. Number of Beautiful Integers in the Range/2827.cpp b/solutions/2827. Number of Beautiful Integers in the Range/2827.cpp
index 07768af14a6..2069e9877c6 100644
--- a/solutions/2827. Number of Beautiful Integers in the Range/2827.cpp	
+++ b/solutions/2827. Number of Beautiful Integers in the Range/2827.cpp	
@@ -18,32 +18,32 @@ class Solution {
  private:
   // Returns the number of beautiful integers, considering the i-th digit with
   // counts of even `even` digits and odd `odd` digits, where the current number
-  // modulo k equals remainder, `tight1` indicates if the current digit is
-  // tightly bound for `low` and `tight2` indicates if the current digit is
+  // modulo k equals remainder, `isTight1` indicates if the current digit is
+  // tightly bound for `low` and `isTight2` indicates if the current digit is
   // tightly bound for `high`
   int count(const string& low, const string& high, int k, int i, int even,
-            int odd, int remainder, bool isLeadingZero, bool tight1,
-            bool tight2,
+            int odd, int remainder, bool isLeadingZero, bool isTight1,
+            bool isTight2,
             vector<vector<vector<vector<vector<vector<int>>>>>>& mem) {
     if (i == high.length())
       return !isLeadingZero && even == odd && remainder == 0;
-    if (mem[i][even][odd][remainder][tight1][tight2] != -1)
-      return mem[i][even][odd][remainder][tight1][tight2];
+    if (mem[i][even][odd][remainder][isTight1][isTight2] != -1)
+      return mem[i][even][odd][remainder][isTight1][isTight2];
 
     int res = 0;
-    const int minDigit = tight1 ? low[i] - '0' : 0;
-    const int maxDigit = tight2 ? high[i] - '0' : 9;
+    const int minDigit = isTight1 ? low[i] - '0' : 0;
+    const int maxDigit = isTight2 ? high[i] - '0' : 9;
 
     for (int d = minDigit; d <= maxDigit; ++d) {
       const int nextEven = even + ((!isLeadingZero || d > 0) && d % 2 == 0);
       const int nextOdd = odd + (d % 2 == 1);
       const int nextRemainder = (remainder * 10 + d) % k;
-      const bool nextTight1 = tight1 && (d == minDigit);
-      const bool nextTight2 = tight2 && (d == maxDigit);
+      const bool nextIsTight1 = isTight1 && (d == minDigit);
+      const bool nextIsTight2 = isTight2 && (d == maxDigit);
       res += count(low, high, k, i + 1, nextEven, nextOdd, nextRemainder,
-                   isLeadingZero && d == 0, nextTight1, nextTight2, mem);
+                   isLeadingZero && d == 0, nextIsTight1, nextIsTight2, mem);
     }
 
-    return mem[i][even][odd][remainder][tight1][tight2] = res;
+    return mem[i][even][odd][remainder][isTight1][isTight2] = res;
   }
 };
diff --git a/solutions/2828. Check if a String Is an Acronym of Words/2828.py b/solutions/2828. Check if a String Is an Acronym of Words/2828.py
index 0514c15d656..1c1559732d4 100644
--- a/solutions/2828. Check if a String Is an Acronym of Words/2828.py	
+++ b/solutions/2828. Check if a String Is an Acronym of Words/2828.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def isAcronym(self, words: list[str], s: str) -> bool:
-    return (len(words) == len(s) and
-            all(word[0] == c for word, c in zip(words, s)))
+  def isAcronym(self, words: List[str], s: str) -> bool:
+    return len(words) == len(s) and \
+        all(word[0] == c for word, c in zip(words, s))
diff --git a/solutions/283. Move Zeroes/283.py b/solutions/283. Move Zeroes/283.py
index 3797d0898a7..92e782d20c5 100644
--- a/solutions/283. Move Zeroes/283.py	
+++ b/solutions/283. Move Zeroes/283.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def moveZeroes(self, nums: list[int]) -> None:
+  def moveZeroes(self, nums: List[int]) -> None:
     j = 0
     for num in nums:
       if num != 0:
diff --git a/solutions/2830. Maximize the Profit as the Salesman/2830.py b/solutions/2830. Maximize the Profit as the Salesman/2830.py
index 14f4c36ecd7..74599c9a64b 100644
--- a/solutions/2830. Maximize the Profit as the Salesman/2830.py	
+++ b/solutions/2830. Maximize the Profit as the Salesman/2830.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximizeTheProfit(self, n: int, offers: list[list[int]]) -> int:
+  def maximizeTheProfit(self, n: int, offers: List[List[int]]) -> int:
     # dp[i] := the maximum amount of gold of selling the first i houses
     dp = [0] * (n + 1)
     endToStartAndGolds = [[] for _ in range(n)]
diff --git a/solutions/2831. Find the Longest Equal Subarray/2831-2.py b/solutions/2831. Find the Longest Equal Subarray/2831-2.py
index 94b44d17ccc..dbbbab06233 100644
--- a/solutions/2831. Find the Longest Equal Subarray/2831-2.py	
+++ b/solutions/2831. Find the Longest Equal Subarray/2831-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestEqualSubarray(self, nums: list[int], k: int) -> int:
+  def longestEqualSubarray(self, nums: List[int], k: int) -> int:
     ans = 0
     count = collections.Counter()
 
diff --git a/solutions/2831. Find the Longest Equal Subarray/2831.py b/solutions/2831. Find the Longest Equal Subarray/2831.py
index bb111e24e5d..73a6cf9de81 100644
--- a/solutions/2831. Find the Longest Equal Subarray/2831.py	
+++ b/solutions/2831. Find the Longest Equal Subarray/2831.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestEqualSubarray(self, nums: list[int], k: int) -> int:
+  def longestEqualSubarray(self, nums: List[int], k: int) -> int:
     ans = 0
     count = collections.Counter()
 
diff --git a/solutions/2832. Maximal Range That Each Element Is Maximum in It/2832.py b/solutions/2832. Maximal Range That Each Element Is Maximum in It/2832.py
index 14a7ba4b487..86d16b3cb5e 100644
--- a/solutions/2832. Maximal Range That Each Element Is Maximum in It/2832.py	
+++ b/solutions/2832. Maximal Range That Each Element Is Maximum in It/2832.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumLengthOfRanges(self, nums: list[int]) -> list[int]:
+  def maximumLengthOfRanges(self, nums: List[int]) -> List[int]:
     ans = [0] * len(nums)
     stack = []  # a decreasing stack
 
diff --git a/solutions/2834. Find the Minimum Possible Sum of a Beautiful Array/2834.java b/solutions/2834. Find the Minimum Possible Sum of a Beautiful Array/2834.java
index 208f7fb65e3..b8b98cae9ca 100644
--- a/solutions/2834. Find the Minimum Possible Sum of a Beautiful Array/2834.java	
+++ b/solutions/2834. Find the Minimum Possible Sum of a Beautiful Array/2834.java	
@@ -9,10 +9,10 @@ public int minimumPossibleSum(int n, int target) {
     final int mid = target / 2; // floor(k / 2)
     if (n <= mid)
       return (int) trapezoid(1, n);
-    return (int) ((trapezoid(1, mid) + trapezoid(target, target + (n - mid - 1))) % MOD);
+    return (int) ((trapezoid(1, mid) + trapezoid(target, target + (n - mid - 1))) % kMod);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns sum(a..b).
   private long trapezoid(long a, long b) {
diff --git a/solutions/2834. Find the Minimum Possible Sum of a Beautiful Array/2834.py b/solutions/2834. Find the Minimum Possible Sum of a Beautiful Array/2834.py
index c76842f4a96..b51c9a63ea9 100644
--- a/solutions/2834. Find the Minimum Possible Sum of a Beautiful Array/2834.py	
+++ b/solutions/2834. Find the Minimum Possible Sum of a Beautiful Array/2834.py	
@@ -6,7 +6,7 @@ def minimumPossibleSum(self, n: int, target: int) -> int:
     # Our optimal strategy is to select 1, 2, ..., floor(k // 2), and then
     # choose k, k + 1, ... if necessary, as selecting any number in the range
     # [ceil(k // 2), k - 1] will result in a pair summing up to k.
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
 
     def trapezoid(a: int, b: int) -> int:
       """Returns sum(a..b)."""
@@ -15,4 +15,4 @@ def trapezoid(a: int, b: int) -> int:
     mid = target // 2  # floor(k // 2)
     if n <= mid:
       return trapezoid(1, n)
-    return (trapezoid(1, mid) + trapezoid(target, target + (n - mid - 1))) % MOD
+    return (trapezoid(1, mid) + trapezoid(target, target + (n - mid - 1))) % kMod
diff --git a/solutions/2835. Minimum Operations to Form Subsequence With Target Sum/2835.java b/solutions/2835. Minimum Operations to Form Subsequence With Target Sum/2835.java
index 468730dd7ce..200d4b13745 100644
--- a/solutions/2835. Minimum Operations to Form Subsequence With Target Sum/2835.java	
+++ b/solutions/2835. Minimum Operations to Form Subsequence With Target Sum/2835.java	
@@ -1,9 +1,9 @@
-class Solution {
+public class Solution {
   public int minOperations(List<Integer> nums, int target) {
-    final int NO_MISSING_BIT = 31;
+    final int kNoMissingBit = 31;
     final int maxBit = 31;
     int ans = 0;
-    int minMissingBit = NO_MISSING_BIT;
+    int minMissingBit = kNoMissingBit;
     // count[i] := the number of occurrences of 2^i
     int[] count = new int[maxBit + 1];
 
@@ -20,17 +20,17 @@ public int minOperations(List<Integer> nums, int target) {
           minMissingBit = Math.min(minMissingBit, bit);
       }
       // If we previously missed a bit and there are available bits.
-      if (minMissingBit != NO_MISSING_BIT && count[bit] > 0) {
+      if (minMissingBit != kNoMissingBit && count[bit] > 0) {
         --count[bit];
         // Count the operations to break `bit` into `minMissingBit`.
         ans += bit - minMissingBit;
-        minMissingBit = NO_MISSING_BIT; // Set it to an the invalid value.
+        minMissingBit = kNoMissingBit; // Set it to an the invalid value.
       }
       // Combining smaller numbers costs nothing.
       count[bit + 1] += count[bit] / 2;
     }
 
     // Check if all target bits have been covered, otherwise return -1.
-    return minMissingBit == NO_MISSING_BIT ? ans : -1;
+    return minMissingBit == kNoMissingBit ? ans : -1;
   }
 }
diff --git a/solutions/2835. Minimum Operations to Form Subsequence With Target Sum/2835.py b/solutions/2835. Minimum Operations to Form Subsequence With Target Sum/2835.py
index 2b5177731f2..a13f0a672e3 100644
--- a/solutions/2835. Minimum Operations to Form Subsequence With Target Sum/2835.py	
+++ b/solutions/2835. Minimum Operations to Form Subsequence With Target Sum/2835.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def minOperations(self, nums: list[int], target: int) -> int:
-    NO_MISSING_BIT = 31
+  def minOperations(self, nums: List[int], target: int) -> int:
+    kNoMissingBit = 31
     maxBit = 31
     ans = 0
-    minMissingBit = NO_MISSING_BIT
+    minMissingBit = kNoMissingBit
     # count[i] := the number of occurrences of 2^i
     count = collections.Counter(int(math.log2(num)) for num in nums)
 
@@ -16,11 +16,11 @@ def minOperations(self, nums: list[int], target: int) -> int:
         else:
           minMissingBit = min(minMissingBit, bit)
       # If we previously missed a bit and there are available bits.
-      if minMissingBit != NO_MISSING_BIT and count[bit] > 0:
+      if minMissingBit != kNoMissingBit and count[bit] > 0:
         count[bit] -= 1
         # Count the operations to break `bit` into `minMissingBit`.
         ans += bit - minMissingBit
-        minMissingBit = NO_MISSING_BIT  # Set it to an the invalid value.
+        minMissingBit = kNoMissingBit  # Set it to an the invalid value.
       # Combining smaller numbers costs nothing.
       count[bit + 1] += count[bit] // 2
 
diff --git a/solutions/2836. Maximize Value of Function in a Ball Passing Game/2836.py b/solutions/2836. Maximize Value of Function in a Ball Passing Game/2836.py
index 81eacedafe5..77cb70722e9 100644
--- a/solutions/2836. Maximize Value of Function in a Ball Passing Game/2836.py	
+++ b/solutions/2836. Maximize Value of Function in a Ball Passing Game/2836.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getMaxFunctionValue(self, receiver: list[int], k: int) -> int:
+  def getMaxFunctionValue(self, receiver: List[int], k: int) -> int:
     n = len(receiver)
     m = int(math.log2(k)) + 1
     ans = 0
diff --git a/solutions/2838. Maximum Coins Heroes Can Collect/2838.java b/solutions/2838. Maximum Coins Heroes Can Collect/2838.java
index 13b1020259d..ffc77a22ec5 100644
--- a/solutions/2838. Maximum Coins Heroes Can Collect/2838.java	
+++ b/solutions/2838. Maximum Coins Heroes Can Collect/2838.java	
@@ -17,7 +17,7 @@ private Pair<Integer, Integer>[] getSortedMonsterAndCoins(int[] monsters, int[]
     Pair<Integer, Integer>[] monsterAndCoins = new Pair[monsters.length];
     for (int i = 0; i < monsters.length; ++i)
       monsterAndCoins[i] = new Pair<>(monsters[i], coins[i]);
-    Arrays.sort(monsterAndCoins, Comparator.comparingInt(Pair::getKey));
+    Arrays.sort(monsterAndCoins, (a, b) -> a.getKey() - b.getKey());
     return monsterAndCoins;
   }
 
diff --git a/solutions/2838. Maximum Coins Heroes Can Collect/2838.py b/solutions/2838. Maximum Coins Heroes Can Collect/2838.py
index aef4ad8c34a..620a7ee1ac4 100644
--- a/solutions/2838. Maximum Coins Heroes Can Collect/2838.py	
+++ b/solutions/2838. Maximum Coins Heroes Can Collect/2838.py	
@@ -1,22 +1,11 @@
 class Solution:
-  def maximumCoins(
-      self,
-      heroes: list[int],
-      monsters: list[int],
-      coins: list[int]
-  ) -> list[int]:
+  def maximumCoins(self, heroes: List[int], monsters: List[int], coins: List[int]) -> List[int]:
     monsterAndCoins = sorted(list(zip(monsters, coins)))
-    coinsPrefix = list(itertools.accumulate(
-        (coin for _, coin in monsterAndCoins),
-        initial=0))
-    return [coinsPrefix[self._firstGreaterEqual(monsterAndCoins, hero)]
-            for hero in heroes]
+    coinsPrefix = [0] + \
+        list(itertools.accumulate(coin for _, coin in monsterAndCoins))
+    return [coinsPrefix[self._firstGreaterEqual(monsterAndCoins, hero)] for hero in heroes]
 
-  def _firstGreaterEqual(
-      self,
-      monsterAndCoins: list[tuple[int, int]],
-      hero: int,
-  ) -> int:
+  def _firstGreaterEqual(self, monsterAndCoins: List[tuple[int, int]], hero: int) -> int:
     l, r = 0, len(monsterAndCoins)
     while l < r:
       m = (l + r) // 2
diff --git a/solutions/2839. Check if Strings Can be Made Equal With Operations I/2839.py b/solutions/2839. Check if Strings Can be Made Equal With Operations I/2839.py
index 02a9f2caa66..571189d86c6 100644
--- a/solutions/2839. Check if Strings Can be Made Equal With Operations I/2839.py	
+++ b/solutions/2839. Check if Strings Can be Made Equal With Operations I/2839.py	
@@ -1,6 +1,6 @@
 class Solution:
   def canBeEqual(self, s1: str, s2: str) -> bool:
-    def swappedStrings(s: str) -> list[str]:
+    def swappedStrings(s: str) -> List[str]:
       chars = list(s)
       return [chars,
               ''.join([chars[2], chars[1], chars[0], chars[3]]),
diff --git a/solutions/284. Peeking Iterator/284.java b/solutions/284. Peeking Iterator/284.java
index e20d2eb6447..fbf2e161921 100644
--- a/solutions/284. Peeking Iterator/284.java	
+++ b/solutions/284. Peeking Iterator/284.java	
@@ -1,5 +1,5 @@
 // Java Iterator interface reference:
-// https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html
+// Https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html
 
 class PeekingIterator implements Iterator<Integer> {
   public PeekingIterator(Iterator<Integer> iterator) {
diff --git a/solutions/2840. Check if Strings Can be Made Equal With Operations II/2840.py b/solutions/2840. Check if Strings Can be Made Equal With Operations II/2840.py
index 91ac267d3f4..811a1cb0877 100644
--- a/solutions/2840. Check if Strings Can be Made Equal With Operations II/2840.py	
+++ b/solutions/2840. Check if Strings Can be Made Equal With Operations II/2840.py	
@@ -6,5 +6,5 @@ def checkStrings(self, s1: str, s2: str) -> bool:
       count[i % 2][a] += 1
       count[i % 2][b] -= 1
 
-    return (all(freq == 0 for freq in count[0].values()) and
-            all(freq == 0 for freq in count[1].values()))
+    return all(freq == 0 for freq in count[0].values()) \
+        and all(freq == 0 for freq in count[1].values())
diff --git a/solutions/2841. Maximum Sum of Almost Unique Subarray/2841.java b/solutions/2841. Maximum Sum of Almost Unique Subarray/2841.java
index f8f6d7c5a12..71f91ea53bd 100644
--- a/solutions/2841. Maximum Sum of Almost Unique Subarray/2841.java	
+++ b/solutions/2841. Maximum Sum of Almost Unique Subarray/2841.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public long maxSum(List<Integer> nums, int m, int k) {
     long ans = 0;
     long sum = 0;
diff --git a/solutions/2841. Maximum Sum of Almost Unique Subarray/2841.py b/solutions/2841. Maximum Sum of Almost Unique Subarray/2841.py
index 42a09eca097..d68e9ca8f8a 100644
--- a/solutions/2841. Maximum Sum of Almost Unique Subarray/2841.py	
+++ b/solutions/2841. Maximum Sum of Almost Unique Subarray/2841.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSum(self, nums: list[int], m: int, k: int) -> int:
+  def maxSum(self, nums: List[int], m: int, k: int) -> int:
     ans = 0
     summ = 0
     count = collections.Counter()
diff --git a/solutions/2842. Count K-Subsequences of a String With Maximum Beauty Solved/2842.cpp b/solutions/2842. Count K-Subsequences of a String With Maximum Beauty Solved/2842.cpp
index 6a6791e921b..05ee03ae3da 100644
--- a/solutions/2842. Count K-Subsequences of a String With Maximum Beauty Solved/2842.cpp	
+++ b/solutions/2842. Count K-Subsequences of a String With Maximum Beauty Solved/2842.cpp	
@@ -34,9 +34,9 @@ class Solution {
     vector<pair<int, int>> freqCountPairs;
     for (const auto& [fc, numOfChars] : freqCount)
       freqCountPairs.emplace_back(fc, numOfChars);
-    ranges::sort(freqCountPairs, ranges::greater{},
-                 [](const pair<int, int>& freqCountPair) {
-      return freqCountPair.first;
+    ranges::sort(freqCountPairs,
+                 [](const pair<int, int>& a, const pair<int, int>& b) {
+      return b.first < a.first;
     });
     return freqCountPairs;
   }
diff --git a/solutions/2842. Count K-Subsequences of a String With Maximum Beauty Solved/2842.java b/solutions/2842. Count K-Subsequences of a String With Maximum Beauty Solved/2842.java
index f8b126e3faf..5136c94d476 100644
--- a/solutions/2842. Count K-Subsequences of a String With Maximum Beauty Solved/2842.java	
+++ b/solutions/2842. Count K-Subsequences of a String With Maximum Beauty Solved/2842.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public int countKSubsequencesWithMaxBeauty(String s, int k) {
     Map<Character, Integer> count = new HashMap<>();
     for (final char c : s.toCharArray())
@@ -13,17 +13,17 @@ public int countKSubsequencesWithMaxBeauty(String s, int k) {
       final int numOfChars = pair.getValue();
       if (numOfChars >= k) {
         ans *= nCk(numOfChars, k) * modPow(fc, k);
-        return (int) (ans % MOD);
+        return (int) (ans % kMod);
       }
       ans *= modPow(fc, numOfChars);
-      ans %= MOD;
+      ans %= kMod;
       k -= numOfChars;
     }
 
     return (int) ans;
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private List<Pair<Integer, Integer>> getFreqCountPairs(Map<Character, Integer> count) {
     // freqCount := (f(c), # of chars with f(c))
@@ -33,7 +33,7 @@ private List<Pair<Integer, Integer>> getFreqCountPairs(Map<Character, Integer> c
     List<Pair<Integer, Integer>> freqCountPairs = new ArrayList<>();
     for (Map.Entry<Integer, Integer> entry : freqCount.entrySet())
       freqCountPairs.add(new Pair<>(entry.getKey(), entry.getValue()));
-    freqCountPairs.sort((a, b) -> b.getKey().compareTo(a.getKey()));
+    freqCountPairs.sort((a, b) -> b.getKey() - a.getKey());
     return freqCountPairs;
   }
 
@@ -48,7 +48,7 @@ private int modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return (int) (x * modPow(x % MOD, (n - 1)) % MOD);
-    return modPow(x * x % MOD, (n / 2)) % MOD;
+      return (int) (x * modPow(x % kMod, (n - 1)) % kMod);
+    return modPow(x * x % kMod, (n / 2)) % kMod;
   }
 }
diff --git a/solutions/2842. Count K-Subsequences of a String With Maximum Beauty Solved/2842.py b/solutions/2842. Count K-Subsequences of a String With Maximum Beauty Solved/2842.py
index 6b2855cdac8..d64d741c09e 100644
--- a/solutions/2842. Count K-Subsequences of a String With Maximum Beauty Solved/2842.py	
+++ b/solutions/2842. Count K-Subsequences of a String With Maximum Beauty Solved/2842.py	
@@ -1,6 +1,6 @@
 class Solution:
   def countKSubsequencesWithMaxBeauty(self, s: str, k: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     count = collections.Counter(s)
     if len(count) < k:
       return 0
@@ -11,8 +11,8 @@ def countKSubsequencesWithMaxBeauty(self, s: str, k: int) -> int:
 
     for fc, numOfChars in list(sorted(freqCount.items(), reverse=True)):
       if numOfChars >= k:
-        ans *= math.comb(numOfChars, k) * pow(fc, k, MOD)
-        return ans % MOD
-      ans *= pow(fc, numOfChars, MOD)
-      ans %= MOD
+        ans *= math.comb(numOfChars, k) * pow(fc, k, kMod)
+        return ans % kMod
+      ans *= pow(fc, numOfChars, kMod)
+      ans %= kMod
       k -= numOfChars
diff --git a/solutions/2845. Count of Interesting Subarrays/2845.py b/solutions/2845. Count of Interesting Subarrays/2845.py
index f9728547977..986943367dd 100644
--- a/solutions/2845. Count of Interesting Subarrays/2845.py	
+++ b/solutions/2845. Count of Interesting Subarrays/2845.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def countInterestingSubarrays(
-      self,
-      nums: list[int],
-      modulo: int,
-      k: int,
-  ) -> int:
+  def countInterestingSubarrays(self, nums: List[int], modulo: int, k: int) -> int:
     ans = 0
     prefix = 0  # (number of nums[i] % modulo == k so far) % modulo
     prefixCount = collections.Counter({0: 1})
diff --git a/solutions/2846. Minimum Edge Weight Equilibrium Queries in a Tree/2846.cpp b/solutions/2846. Minimum Edge Weight Equilibrium Queries in a Tree/2846.cpp
index 4eaaafd47c4..43711aefb42 100644
--- a/solutions/2846. Minimum Edge Weight Equilibrium Queries in a Tree/2846.cpp	
+++ b/solutions/2846. Minimum Edge Weight Equilibrium Queries in a Tree/2846.cpp	
@@ -3,15 +3,15 @@ class Solution {
   vector<int> minOperationsQueries(int n, vector<vector<int>>& edges,
                                    vector<vector<int>>& queries) {
     constexpr int kMax = 26;
-    const int m = ceil(log2(n));
+    const int m = log2(n) + 1;
     vector<int> ans;
     vector<vector<pair<int, int>>> graph(n);
-    // jump[i][j] := the 2^j-th ancestor of i
+    // jump[i][j] := the node you reach after jumping 2^j from i
     vector<vector<int>> jump(n, vector<int>(m));
-    // depth[i] := the depth of i
-    vector<int> depth(n);
     // count[i][j] := the count of j from root to i, where 1 <= j <= 26
     vector<vector<int>> count(n);
+    // depth[i] := the depth of i
+    vector<int> depth(n);
 
     for (const vector<int>& edge : edges) {
       const int u = edge[0];
@@ -22,8 +22,9 @@ class Solution {
     }
 
     count[0] = vector<int>(kMax + 1);
-    dfs(graph, 0, /*prev=*/-1, jump, depth, count);
+    dfs(graph, 0, /*prev=*/-1, 0, jump, count, depth);
 
+    // Calculate binary lifting.
     for (int j = 1; j < m; ++j)
       for (int i = 0; i < n; ++i)
         jump[i][j] = jump[jump[i][j - 1]][j - 1];
@@ -45,21 +46,24 @@ class Solution {
   }
 
  private:
-  void dfs(const vector<vector<pair<int, int>>>& graph, int u, int prev,
-           vector<vector<int>>& jump, vector<int>& depth,
-           vector<vector<int>>& count) {
+  void dfs(const vector<vector<pair<int, int>>>& graph, int u, int prev, int d,
+           vector<vector<int>>& jump, vector<vector<int>>& count,
+           vector<int>& depth) {
+    if (prev != -1)
+      jump[u][0] = prev;
+    depth[u] = d;
     for (const auto& [v, w] : graph[u]) {
       if (v == prev)
         continue;
-      jump[v][0] = u;
-      depth[v] = depth[u] + 1;
+      // Inherit the count from the parent.
       count[v] = count[u];
+      // Add one to this edge.
       ++count[v][w];
-      dfs(graph, v, u, jump, depth, count);
+      dfs(graph, v, u, d + 1, jump, count, depth);
     }
   }
 
-  // Returns the lca(u, v) by binary jump.
+  // Returns the lca(u, v) via Calculate binary lifting.
   int getLCA(int u, int v, const vector<vector<int>>& jump,
              const vector<int>& depth) {
     // v is always deeper than u.
diff --git a/solutions/2846. Minimum Edge Weight Equilibrium Queries in a Tree/2846.java b/solutions/2846. Minimum Edge Weight Equilibrium Queries in a Tree/2846.java
index 1700148f461..a86041311bf 100644
--- a/solutions/2846. Minimum Edge Weight Equilibrium Queries in a Tree/2846.java	
+++ b/solutions/2846. Minimum Edge Weight Equilibrium Queries in a Tree/2846.java	
@@ -1,16 +1,18 @@
 class Solution {
   public int[] minOperationsQueries(int n, int[][] edges, int[][] queries) {
-    final int MAX = 26;
-    final int m = (int) Math.ceil(Math.log(n) / Math.log(2));
+    final int kMax = 26;
+    final int m = (int) (Math.log(n) / Math.log(2)) + 1;
     int[] ans = new int[queries.length];
     List<Pair<Integer, Integer>>[] graph = new List[n];
-    // jump[i][j] := the 2^j-th ancestor of i
+    // jump[i][j] := the node you reach after jumping 2^j from i
     int[][] jump = new int[n][m];
+    // count[i][j] := the count of j from root to i, where 1 <= j <= 26
+    int[][] count = new int[n][];
     // depth[i] := the depth of i
     int[] depth = new int[n];
-    // count[i][j] := the count of j from root to i, where 1 <= j <= 26
-    int[][] count = new int[n][MAX + 1];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
@@ -20,9 +22,10 @@ public int[] minOperationsQueries(int n, int[][] edges, int[][] queries) {
       graph[v].add(new Pair<>(u, w));
     }
 
-    count[0] = new int[MAX + 1];
-    dfs(graph, 0, /*prev=*/-1, jump, depth, count);
+    count[0] = new int[kMax + 1];
+    dfs(graph, 0, /*prev=*/-1, 0, jump, count, depth);
 
+    // Calculate binary lifting.
     for (int j = 1; j < m; ++j)
       for (int i = 0; i < n; ++i)
         jump[i][j] = jump[jump[i][j - 1]][j - 1];
@@ -35,7 +38,7 @@ public int[] minOperationsQueries(int n, int[][] edges, int[][] queries) {
       final int numEdges = depth[u] + depth[v] - 2 * depth[lca];
       // the maximum frequency of edges between (u, v)
       int maxFreq = 0;
-      for (int j = 1; j <= MAX; ++j)
+      for (int j = 1; j <= kMax; ++j)
         maxFreq = Math.max(maxFreq, count[u][j] + count[v][j] - 2 * count[lca][j]);
       ans[i] = numEdges - maxFreq;
     }
@@ -43,22 +46,25 @@ public int[] minOperationsQueries(int n, int[][] edges, int[][] queries) {
     return ans;
   }
 
-  private void dfs(List<Pair<Integer, Integer>>[] graph, int u, int prev, int[][] jump, int[] depth,
-                   int[][] count) {
+  private void dfs(List<Pair<Integer, Integer>>[] graph, int u, int prev, int d, int[][] jump,
+                   int[][] count, int[] depth) {
+    if (prev != -1)
+      jump[u][0] = prev;
+    depth[u] = d;
     for (Pair<Integer, Integer> pair : graph[u]) {
       final int v = pair.getKey();
       final int w = pair.getValue();
       if (v == prev)
         continue;
-      jump[v][0] = u;
-      depth[v] = depth[u] + 1;
+      // Inherit the count from the parent.
       count[v] = count[u].clone();
+      // Add one to this edge.
       ++count[v][w];
-      dfs(graph, v, u, jump, depth, count);
+      dfs(graph, v, u, d + 1, jump, count, depth);
     }
   }
 
-  // Returns the lca(u, v) by binary jump.
+  // Returns the lca(u, v) via Calculate binary lifting.
   private int getLCA(int u, int v, int[][] jump, int[] depth) {
     // v is always deeper than u.
     if (depth[u] > depth[v])
diff --git a/solutions/2846. Minimum Edge Weight Equilibrium Queries in a Tree/2846.py b/solutions/2846. Minimum Edge Weight Equilibrium Queries in a Tree/2846.py
index cefa2fd5fcf..30ab2bcd51b 100644
--- a/solutions/2846. Minimum Edge Weight Equilibrium Queries in a Tree/2846.py	
+++ b/solutions/2846. Minimum Edge Weight Equilibrium Queries in a Tree/2846.py	
@@ -1,84 +1,66 @@
 class Solution:
-  def minOperationsQueries(
-      self,
-      n: int,
-      edges: list[list[int]],
-      queries: list[list[int]],
-  ) -> list[int]:
-    MAX = 26
-    m = math.ceil(math.log2(n))
+  def minOperationsQueries(self, n: int, edges: List[List[int]], queries: List[List[int]]) -> List[int]:
+    kMax = 26
+    m = int(math.log2(n)) + 1
+    ans = []
     graph = [[] for _ in range(n)]
-    # jump[i][j] := the 2^j-th ancestor of i
+    # jump[i][j] := the node you reach after jumping 2^j from i
     jump = [[0] * m for _ in range(n)]
-    # depth[i] := the depth of i
-    depth = [0] * n
     # count[i][j] := the count of j from root to i, where 1 <= j <= 26
     count = [[] for _ in range(n)]
+    # depth[i] := the depth of i
+    depth = [0] * n
 
     for u, v, w in edges:
       graph[u].append((v, w))
       graph[v].append((u, w))
 
-    count[0] = [0] * (MAX + 1)
-    self._dfs(graph, 0, -1, jump, depth, count)
+    def dfs(u: int, prev: int, d: int):
+      if prev != -1:
+        jump[u][0] = prev
+      depth[u] = d
+      for v, w in graph[u]:
+        if v == prev:
+          continue
+        # Inherit the count from the parent.
+        count[v] = count[u][:]
+        # Add one to this edge.
+        count[v][w] += 1
+        dfs(v, u, d + 1)
 
+    count[0] = [0] * (kMax + 1)
+    dfs(0, -1, 0)
+
+    # Calculate binary lifting.
     for j in range(1, m):
       for i in range(n):
         jump[i][j] = jump[jump[i][j - 1]][j - 1]
 
-    def getMinOperations(u: int, v: int) -> int:
-      """
-      Returns the minimum number of operations to make the edge weight
-      equilibrium between (u, v).
-      """
-      lca = self._getLCA(u, v, jump, depth)
+    def getLCA(u: int, v: int) -> int:
+      """Returns the lca(u, v) via Calculate binary lifting."""
+      # v is always deeper than u.
+      if depth[u] > depth[v]:
+        return getLCA(v, u)
+      # Jump v to the same height of u.
+      for j in range(m):
+        if depth[v] - depth[u] >> j & 1:
+          v = jump[v][j]
+      if u == v:
+        return u
+      # Jump u and v to the node right below the lca.
+      for j in range(m - 1, -1, -1):
+        if jump[u][j] != jump[v][j]:
+          u = jump[u][j]
+          v = jump[v][j]
+      return jump[v][0]
+
+    for u, v in queries:
+      lca = getLCA(u, v)
       # the number of edges between (u, v).
       numEdges = depth[u] + depth[v] - 2 * depth[lca]
       # the maximum frequency of edges between (u, v)
       maxFreq = max(count[u][j] + count[v][j] - 2 * count[lca][j]
-                    for j in range(1, MAX + 1))
-      return numEdges - maxFreq
-
-    return [getMinOperations(u, v) for u, v in queries]
-
-  def _dfs(
-      self,
-      graph: list[list[tuple[int, int]]],
-      u: int,
-      prev: int,
-      jump: list[list[int]],
-      depth: list[int],
-      count: list[list[int]]
-  ) -> None:
-    for v, w in graph[u]:
-      if v == prev:
-        continue
-      jump[v][0] = u
-      depth[v] = depth[u] + 1
-      count[v] = count[u][:]
-      count[v][w] += 1
-      self._dfs(graph, v, u, jump, depth, count)
+                    for j in range(1, kMax + 1))
+      ans.append(numEdges - maxFreq)
 
-  def _getLCA(
-      self,
-      u: int,
-      v: int,
-      jump: list[list[int]],
-      depth: list[int]
-  ) -> int:
-    """Returns the lca(u, v) by binary jump."""
-    # v is always deeper than u.
-    if depth[u] > depth[v]:
-      return self._getLCA(v, u, jump, depth)
-    # Jump v to the same height of u.
-    for j in range(len(jump[0])):
-      if depth[v] - depth[u] >> j & 1:
-        v = jump[v][j]
-    if u == v:
-      return u
-    # Jump u and v to the node right below the lca.
-    for j in range(len(jump[0]) - 1, -1, -1):
-      if jump[u][j] != jump[v][j]:
-        u = jump[u][j]
-        v = jump[v][j]
-    return jump[u][0]
+    return ans
diff --git a/solutions/2848. Points That Intersect With Cars/2848.java b/solutions/2848. Points That Intersect With Cars/2848.java
index b91598c3c65..4613c083243 100644
--- a/solutions/2848. Points That Intersect With Cars/2848.java	
+++ b/solutions/2848. Points That Intersect With Cars/2848.java	
@@ -1,9 +1,9 @@
 class Solution {
   public int numberOfPoints(List<List<Integer>> nums) {
-    final int MAX = 100;
+    final int kMax = 100;
     int ans = 0;
     int runningSum = 0;
-    int[] count = new int[MAX + 2];
+    int[] count = new int[kMax + 2];
 
     for (List<Integer> num : nums) {
       final int start = num.get(0);
@@ -12,7 +12,7 @@ public int numberOfPoints(List<List<Integer>> nums) {
       --count[end + 1];
     }
 
-    for (int i = 1; i <= MAX; i++) {
+    for (int i = 1; i <= kMax; i++) {
       runningSum += count[i];
       if (runningSum > 0)
         ++ans;
diff --git a/solutions/2848. Points That Intersect With Cars/2848.py b/solutions/2848. Points That Intersect With Cars/2848.py
index 3fb4c46c6fc..6e5fed57ff6 100644
--- a/solutions/2848. Points That Intersect With Cars/2848.py	
+++ b/solutions/2848. Points That Intersect With Cars/2848.py	
@@ -1,15 +1,15 @@
 class Solution:
-  def numberOfPoints(self, nums: list[list[int]]) -> int:
-    MAX = 100
+  def numberOfPoints(self, nums: List[List[int]]) -> int:
+    kMax = 100
     ans = 0
     runningSum = 0
-    count = [0] * (MAX + 2)
+    count = [0] * (kMax + 2)
 
     for start, end in nums:
       count[start] += 1
       count[end + 1] -= 1
 
-    for i in range(1, MAX + 1):
+    for i in range(1, kMax + 1):
       runningSum += count[i]
       if runningSum > 0:
         ans += 1
diff --git a/solutions/2849. Determine if a Cell Is Reachable at a Given Time/2849.py b/solutions/2849. Determine if a Cell Is Reachable at a Given Time/2849.py
index 9cb40a0e64f..c2320879e47 100644
--- a/solutions/2849. Determine if a Cell Is Reachable at a Given Time/2849.py	
+++ b/solutions/2849. Determine if a Cell Is Reachable at a Given Time/2849.py	
@@ -1,11 +1,4 @@
 class Solution:
-  def isReachableAtTime(
-      self,
-      sx: int,
-      sy: int,
-      fx: int,
-      fy: int,
-      t: int,
-  ) -> bool:
+  def isReachableAtTime(self, sx: int, sy: int, fx: int, fy: int, t: int) -> bool:
     minStep = max(abs(sx - fx), abs(sy - fy))
     return t != 1 if minStep == 0 else minStep <= t
diff --git a/solutions/285. Inorder Successor in BST/285.py b/solutions/285. Inorder Successor in BST/285.py
index 8e9ba65554b..2c4325630c3 100644
--- a/solutions/285. Inorder Successor in BST/285.py	
+++ b/solutions/285. Inorder Successor in BST/285.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def inorderSuccessor(
-      self,
-      root: TreeNode | None,
-      p: TreeNode | None,
-  ) -> TreeNode | None:
+  def inorderSuccessor(self, root: Optional[TreeNode], p: Optional[TreeNode]) -> Optional[TreeNode]:
     if not root:
       return None
     if root.val <= p.val:
diff --git a/solutions/2850. Minimum Moves to Spread Stones Over Grid/2850.cpp b/solutions/2850. Minimum Moves to Spread Stones Over Grid/2850.cpp
index 556c84dafce..208c05a54e1 100644
--- a/solutions/2850. Minimum Moves to Spread Stones Over Grid/2850.cpp	
+++ b/solutions/2850. Minimum Moves to Spread Stones Over Grid/2850.cpp	
@@ -2,8 +2,8 @@ class Solution {
  public:
   int minimumMoves(vector<vector<int>>& grid) {
     const int zeroCount = accumulate(grid.begin(), grid.end(), 0,
-                                     [](int acc, const vector<int>& row) {
-      return acc + ranges::count(row, 0);
+                                     [](int subtotal, const vector<int>& row) {
+      return subtotal + ranges::count(row, 0);
     });
     if (zeroCount == 0)
       return 0;
diff --git a/solutions/2850. Minimum Moves to Spread Stones Over Grid/2850.py b/solutions/2850. Minimum Moves to Spread Stones Over Grid/2850.py
index 0419e522d94..628ea92d9ff 100644
--- a/solutions/2850. Minimum Moves to Spread Stones Over Grid/2850.py	
+++ b/solutions/2850. Minimum Moves to Spread Stones Over Grid/2850.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumMoves(self, grid: list[list[int]]) -> int:
+  def minimumMoves(self, grid: List[List[int]]) -> int:
     if sum(row.count(0) for row in grid) == 0:
       return 0
 
diff --git a/solutions/2851. String Transformation/2851.cpp b/solutions/2851. String Transformation/2851.cpp
index 1a64bb120b9..b81a8036473 100644
--- a/solutions/2851. String Transformation/2851.cpp	
+++ b/solutions/2851. String Transformation/2851.cpp	
@@ -28,8 +28,8 @@ class Solution {
             modPow(n, kMod - 2) % kMod;
     dp[0] = (dp[1] + negOnePowK + kMod) % kMod;
     return accumulate(indices.begin(), indices.end(), 0L,
-                      [&](long acc, int index) {
-      return (acc + dp[index == 0 ? 0 : 1]) % kMod;
+                      [&](long subtotal, int index) {
+      return (subtotal + dp[index == 0 ? 0 : 1]) % kMod;
     });
   }
 
diff --git a/solutions/2851. String Transformation/2851.java b/solutions/2851. String Transformation/2851.java
index 1fccce193e9..eb06e2984fa 100644
--- a/solutions/2851. String Transformation/2851.java	
+++ b/solutions/2851. String Transformation/2851.java	
@@ -23,24 +23,24 @@ public int numberOfWays(String s, String t, long k) {
     final int[] z = zFunction(s + t + t);
     final List<Integer> indices = getIndices(z, n);
     int[] dp = new int[2]; // dp[0] := dp[k][0]; dp[1] := dp[k][!0]
-    dp[1] = (int) ((modPow(n - 1, k) - negOnePowK + MOD) % MOD * modPow(n, MOD - 2) % MOD);
-    dp[0] = (int) ((dp[1] + negOnePowK + MOD) % MOD);
+    dp[1] = (int) ((modPow(n - 1, k) - negOnePowK + kMod) % kMod * modPow(n, kMod - 2) % kMod);
+    dp[0] = (int) ((dp[1] + negOnePowK + kMod) % kMod);
     int ans = 0;
     for (final int index : getIndices(z, n)) {
       ans += dp[index == 0 ? 0 : 1];
-      ans %= MOD;
+      ans %= kMod;
     }
     return ans;
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2);
+      return x * modPow(x, n - 1) % kMod;
+    return modPow(x * x % kMod, n / 2);
   }
 
   // Returns the z array, where z[i] is the length of the longest prefix of
diff --git a/solutions/2851. String Transformation/2851.py b/solutions/2851. String Transformation/2851.py
index 88297f5980a..68de62c62b8 100644
--- a/solutions/2851. String Transformation/2851.py	
+++ b/solutions/2851. String Transformation/2851.py	
@@ -18,7 +18,7 @@ class Solution:
   #   * dp[k][!0] = ((n - 1)^k - (-1)^k) / n
   #   * dp[k][0] = dp[k][!0] + (-1)^k
   def numberOfWays(self, s: str, t: str, k: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     n = len(s)
     negOnePowK = 1 if k % 2 == 0 else -1  # (-1)^k
     z = self._zFunction(s + t + t)
@@ -26,11 +26,11 @@ def numberOfWays(self, s: str, t: str, k: int) -> int:
     # `s[i..n) + s[0..i) = t`.
     indices = [i - n for i in range(n, n + n) if z[i] >= n]
     dp = [0] * 2  # dp[0] := dp[k][0]; dp[1] := dp[k][!0]
-    dp[1] = (pow(n - 1, k, MOD) - negOnePowK) * pow(n, MOD - 2, MOD)
+    dp[1] = (pow(n - 1, k, kMod) - negOnePowK) * pow(n, kMod - 2, kMod)
     dp[0] = dp[1] + negOnePowK
-    return sum(dp[0] if index == 0 else dp[1] for index in indices) % MOD
+    return sum(dp[0] if index == 0 else dp[1] for index in indices) % kMod
 
-  def _zFunction(self, s: str) -> list[int]:
+  def _zFunction(self, s: str) -> List[int]:
     """
     Returns the z array, where z[i] is the length of the longest prefix of
     s[i..n) which is also a prefix of s.
diff --git a/solutions/2852. Sum of Remoteness of All Cells/2852.cpp b/solutions/2852. Sum of Remoteness of All Cells/2852.cpp
index 044ebea0d54..a17f82e505a 100644
--- a/solutions/2852. Sum of Remoteness of All Cells/2852.cpp	
+++ b/solutions/2852. Sum of Remoteness of All Cells/2852.cpp	
@@ -2,10 +2,11 @@ class Solution {
  public:
   long long sumRemoteness(vector<vector<int>>& grid) {
     const long sum = accumulate(grid.begin(), grid.end(), 0L,
-                                [](long acc, const vector<int>& row) {
-      return acc +
-             accumulate(row.begin(), row.end(), 0L,
-                        [](long acc, int num) { return acc + max(0, num); });
+                                [](long subtotal, const vector<int>& row) {
+      return subtotal + accumulate(row.begin(), row.end(), 0L,
+                                   [](long subtotal, const int cell) {
+        return subtotal + max(0, cell);
+      });
     });
 
     long ans = 0;
@@ -21,7 +22,7 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   // Returns the (count, componentSum) of the connected component that contains
   // (x, y).
@@ -35,7 +36,7 @@ class Solution {
     long componentSum = grid[i][j];
     grid[i][j] = -1;  // Mark as visited.;
 
-    for (const auto& [dx, dy] : kDirs) {
+    for (const auto& [dx, dy] : dirs) {
       const int x = i + dx;
       const int y = j + dy;
       const auto [nextCount, nextComponentSum] = dfs(grid, x, y);
diff --git a/solutions/2852. Sum of Remoteness of All Cells/2852.java b/solutions/2852. Sum of Remoteness of All Cells/2852.java
index f3700e3f4ac..4bb58d9623e 100644
--- a/solutions/2852. Sum of Remoteness of All Cells/2852.java	
+++ b/solutions/2852. Sum of Remoteness of All Cells/2852.java	
@@ -19,7 +19,7 @@ public long sumRemoteness(int[][] grid) {
     return ans;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   // Returns the (count, componentSum) of the connected component that contains
   // (x, y).
@@ -33,7 +33,7 @@ private long[] dfs(int[][] grid, int i, int j) {
     long componentSum = grid[i][j];
     grid[i][j] = -1; // Mark as visited.;
 
-    for (int[] dir : DIRS) {
+    for (int[] dir : dirs) {
       final int x = i + dir[0];
       final int y = j + dir[1];
       long[] nextRes = dfs(grid, x, y);
diff --git a/solutions/2852. Sum of Remoteness of All Cells/2852.py b/solutions/2852. Sum of Remoteness of All Cells/2852.py
index 0d41d0c1967..9027a3575da 100644
--- a/solutions/2852. Sum of Remoteness of All Cells/2852.py	
+++ b/solutions/2852. Sum of Remoteness of All Cells/2852.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def sumRemoteness(self, grid: list[list[int]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def sumRemoteness(self, grid: List[List[int]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     n = len(grid)
     summ = sum(max(0, cell) for row in grid for cell in row)
     ans = 0
 
-    def dfs(i: int, j: int) -> tuple[int, int]:
+    def dfs(i: int, j: int) -> Tuple[int, int]:
       """
       Returns the (count, componentSum) of the connected component that contains
       (x, y).
@@ -19,7 +19,7 @@ def dfs(i: int, j: int) -> tuple[int, int]:
       componentSum = grid[i][j]
       grid[i][j] = -1  # Mark as visited.
 
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         nextCount, nextComponentSum = dfs(x, y)
diff --git a/solutions/2855. Minimum Right Shifts to Sort the Array/2855.py b/solutions/2855. Minimum Right Shifts to Sort the Array/2855.py
index edf4fb18fb4..d01fd7d6d41 100644
--- a/solutions/2855. Minimum Right Shifts to Sort the Array/2855.py	
+++ b/solutions/2855. Minimum Right Shifts to Sort the Array/2855.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumRightShifts(self, nums: list[int]) -> int:
+  def minimumRightShifts(self, nums: List[int]) -> int:
     count = 0
 
     for i, (a, b) in enumerate(itertools.pairwise(nums)):
diff --git a/solutions/2856. Minimum Array Length After Pair Removals/2856.py b/solutions/2856. Minimum Array Length After Pair Removals/2856.py
index eaf411a2fa4..ce6e9a7465b 100644
--- a/solutions/2856. Minimum Array Length After Pair Removals/2856.py	
+++ b/solutions/2856. Minimum Array Length After Pair Removals/2856.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minLengthAfterRemovals(self, nums: list[int]) -> int:
+  def minLengthAfterRemovals(self, nums: List[int]) -> int:
     n = len(nums)
     count = collections.Counter(nums)
     maxFreq = max(count.values())
diff --git a/solutions/2857. Count Pairs of Points With Distance k/2857.py b/solutions/2857. Count Pairs of Points With Distance k/2857.py
index a9cc82f74b7..953b903a29e 100644
--- a/solutions/2857. Count Pairs of Points With Distance k/2857.py	
+++ b/solutions/2857. Count Pairs of Points With Distance k/2857.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countPairs(self, coordinates: list[list[int]], k: int) -> int:
+  def countPairs(self, coordinates: List[List[int]], k: int) -> int:
     ans = 0
 
     for x in range(k + 1):
diff --git a/solutions/2858. Minimum Edge Reversals So Every Node Is Reachable/2858.py b/solutions/2858. Minimum Edge Reversals So Every Node Is Reachable/2858.py
index 1c63c254990..457b05b1219 100644
--- a/solutions/2858. Minimum Edge Reversals So Every Node Is Reachable/2858.py	
+++ b/solutions/2858. Minimum Edge Reversals So Every Node Is Reachable/2858.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minEdgeReversals(self, n: int, edges: list[list[int]]) -> list[int]:
+  def minEdgeReversals(self, n: int, edges: List[List[int]]) -> List[int]:
     graph = [[] for _ in range(n)]
 
     for u, v in edges:
diff --git a/solutions/2859. Sum of Values at Indices With K Set Bits/2859.py b/solutions/2859. Sum of Values at Indices With K Set Bits/2859.py
index 90f35db0237..07efd82ae29 100644
--- a/solutions/2859. Sum of Values at Indices With K Set Bits/2859.py	
+++ b/solutions/2859. Sum of Values at Indices With K Set Bits/2859.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def sumIndicesWithKSetBits(self, nums: list[int], k: int) -> int:
+  def sumIndicesWithKSetBits(self, nums: List[int], k: int) -> int:
     return sum(num for i, num in enumerate(nums)
                if i.bit_count() == k)
diff --git a/solutions/286. Walls and Gates/286.cpp b/solutions/286. Walls and Gates/286.cpp
index 2784b6adb46..685e49b089d 100644
--- a/solutions/286. Walls and Gates/286.cpp	
+++ b/solutions/286. Walls and Gates/286.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   void wallsAndGates(vector<vector<int>>& rooms) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = rooms.size();
     const int n = rooms[0].size();
     queue<pair<int, int>> q;
@@ -14,7 +14,7 @@ class Solution {
     while (!q.empty()) {
       const auto [i, j] = q.front();
       q.pop();
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/286. Walls and Gates/286.java b/solutions/286. Walls and Gates/286.java
index c6c90d9ca0d..caf76246de3 100644
--- a/solutions/286. Walls and Gates/286.java	
+++ b/solutions/286. Walls and Gates/286.java	
@@ -1,19 +1,20 @@
 class Solution {
   public void wallsAndGates(int[][] rooms) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = rooms.length;
     final int n = rooms[0].length;
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>();
+    Queue<int[]> q = new ArrayDeque<>();
 
     for (int i = 0; i < m; ++i)
       for (int j = 0; j < n; ++j)
         if (rooms[i][j] == 0)
-          q.offer(new Pair<>(i, j));
+          q.offer(new int[] {i, j});
 
     while (!q.isEmpty()) {
-      final int i = q.peek().getKey();
-      final int j = q.poll().getValue();
-      for (int[] dir : DIRS) {
+      int[] p = q.poll();
+      final int i = p[0];
+      final int j = p[1];
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == m || y < 0 || y == n)
@@ -21,7 +22,7 @@ public void wallsAndGates(int[][] rooms) {
         if (rooms[x][y] != Integer.MAX_VALUE)
           continue;
         rooms[x][y] = rooms[i][j] + 1;
-        q.offer(new Pair<>(x, y));
+        q.offer(new int[] {x, y});
       }
     }
   }
diff --git a/solutions/286. Walls and Gates/286.py b/solutions/286. Walls and Gates/286.py
index 35712a306ef..1a5eadebbf0 100644
--- a/solutions/286. Walls and Gates/286.py	
+++ b/solutions/286. Walls and Gates/286.py	
@@ -1,22 +1,24 @@
 class Solution:
-  def wallsAndGates(self, rooms: list[list[int]]) -> None:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
-    INF = 2**31 - 1
+  def wallsAndGates(self, rooms: List[List[int]]) -> None:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
+    kInf = 2**31 - 1
     m = len(rooms)
     n = len(rooms[0])
-    q = collections.deque((i, j)
-                          for i in range(m)
-                          for j in range(n)
-                          if rooms[i][j] == 0)
+    q = collections.deque()
+
+    for i in range(m):
+      for j in range(n):
+        if rooms[i][j] == 0:
+          q.append((i, j))
 
     while q:
       i, j = q.popleft()
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
           continue
-        if rooms[x][y] != INF:
+        if rooms[x][y] != kInf:
           continue
         rooms[x][y] = rooms[i][j] + 1
         q.append((x, y))
diff --git a/solutions/2860. Happy Students/2860.py b/solutions/2860. Happy Students/2860.py
index f9cb81d1bd8..a7645dace6b 100644
--- a/solutions/2860. Happy Students/2860.py	
+++ b/solutions/2860. Happy Students/2860.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countWays(self, nums: list[int]) -> int:
+  def countWays(self, nums: List[int]) -> int:
     return sum(a < i < b
                for i, (a, b) in  # i := the number of the selected numbers
                enumerate(itertools.pairwise([-1] + sorted(nums) + [math.inf])))
diff --git a/solutions/2861. Maximum Number of Alloys/2861.py b/solutions/2861. Maximum Number of Alloys/2861.py
index 17da61bb84d..db57669771c 100644
--- a/solutions/2861. Maximum Number of Alloys/2861.py	
+++ b/solutions/2861. Maximum Number of Alloys/2861.py	
@@ -1,7 +1,7 @@
 class Solution:
   def maxNumberOfAlloys(self, n: int, k: int, budget: int,
-                        composition: list[list[int]], stock: list[int],
-                        costs: list[int]) -> int:
+                        composition: List[List[int]], stock: List[int],
+                        costs: List[int]) -> int:
     l = 1
     r = 1_000_000_000
 
diff --git a/solutions/2862. Maximum Element-Sum of a Complete Subset of Indices/2862-2.py b/solutions/2862. Maximum Element-Sum of a Complete Subset of Indices/2862-2.py
index de55c9133d2..97b2a4cdfbc 100644
--- a/solutions/2862. Maximum Element-Sum of a Complete Subset of Indices/2862-2.py	
+++ b/solutions/2862. Maximum Element-Sum of a Complete Subset of Indices/2862-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumSum(self, nums: list[int]) -> int:
+  def maximumSum(self, nums: List[int]) -> int:
     ans = 0
 
     for oddPower in range(1, len(nums) + 1):
diff --git a/solutions/2862. Maximum Element-Sum of a Complete Subset of Indices/2862.py b/solutions/2862. Maximum Element-Sum of a Complete Subset of Indices/2862.py
index 33717cf2553..3dbc3ef85e0 100644
--- a/solutions/2862. Maximum Element-Sum of a Complete Subset of Indices/2862.py	
+++ b/solutions/2862. Maximum Element-Sum of a Complete Subset of Indices/2862.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumSum(self, nums: list[int]) -> int:
+  def maximumSum(self, nums: List[int]) -> int:
     ans = 0
     oddPowerToSum = collections.Counter()
 
diff --git a/solutions/2863. Maximum Length of Semi-Decreasing Subarrays/2863.py b/solutions/2863. Maximum Length of Semi-Decreasing Subarrays/2863.py
index 8e116b9fcca..5a16f595ded 100644
--- a/solutions/2863. Maximum Length of Semi-Decreasing Subarrays/2863.py	
+++ b/solutions/2863. Maximum Length of Semi-Decreasing Subarrays/2863.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSubarrayLength(self, nums: list[int]) -> int:
+  def maxSubarrayLength(self, nums: List[int]) -> int:
     ans = 0
     stack = []
 
diff --git a/solutions/2865. Beautiful Towers I/2865.cpp b/solutions/2865. Beautiful Towers I/2865.cpp
index 36764e34b00..0c7617190a2 100644
--- a/solutions/2865. Beautiful Towers I/2865.cpp	
+++ b/solutions/2865. Beautiful Towers I/2865.cpp	
@@ -1,39 +1,39 @@
 class Solution {
  public:
-  long long maximumSumOfHeights(vector<int>& heights) {
-    const int n = heights.size();
+  long long maximumSumOfHeights(vector<int>& maxHeights) {
+    const int n = maxHeights.size();
     vector<long> maxSum(n);  // maxSum[i] := the maximum sum with peak i
 
     stack<int> stack{{-1}};
-    long sum = 0;
+    long summ = 0;
 
     for (int i = 0; i < n; ++i) {
-      sum = process(stack, heights, i, sum);
-      maxSum[i] = sum;
+      summ = process(stack, maxHeights, i, summ);
+      maxSum[i] = summ;
     }
 
     stack = std::stack<int>{{n}};
-    sum = 0;
+    summ = 0;
 
     for (int i = n - 1; i >= 0; --i) {
-      sum = process(stack, heights, i, sum);
-      maxSum[i] += sum - heights[i];
+      summ = process(stack, maxHeights, i, summ);
+      maxSum[i] += summ - maxHeights[i];
     }
 
     return ranges::max(maxSum);
   }
 
  private:
-  long process(stack<int>& stack, const vector<int>& heights, int i, long sum) {
-    while (stack.size() > 1 && heights[stack.top()] > heights[i]) {
-      const int j = stack.top();
+  long process(stack<int>& stack, vector<int>& maxHeights, int i, long summ) {
+    while (stack.size() > 1 && maxHeights[stack.top()] > maxHeights[i]) {
+      int j = stack.top();
       stack.pop();
-      // The last abs(j - stack.top()) heights are `heights[j]`.
-      sum -= static_cast<long>(abs(j - stack.top())) * heights[j];
+      // The last abs(j - stack.top()) heights are maxHeights[j].
+      summ -= abs(j - stack.top()) * static_cast<long>(maxHeights[j]);
     }
-    // Put abs(i - stack.top()) * heights[i] in `heights`.
-    sum += static_cast<long>(abs(i - stack.top())) * heights[i];
+    // Put abs(i - stack.top()) * maxHeights[i] in `heights`.
+    summ += abs(i - stack.top()) * static_cast<long>(maxHeights[i]);
     stack.push(i);
-    return sum;
+    return summ;
   }
 };
diff --git a/solutions/2865. Beautiful Towers I/2865.java b/solutions/2865. Beautiful Towers I/2865.java
index d8dcd5ace08..9e8cf45b065 100644
--- a/solutions/2865. Beautiful Towers I/2865.java	
+++ b/solutions/2865. Beautiful Towers I/2865.java	
@@ -1,36 +1,37 @@
 class Solution {
-  public long maximumSumOfHeights(int[] heights) {
-    final int n = heights.length;
+  public long maximumSumOfHeights(List<Integer> maxHeights) {
+    final int n = maxHeights.size();
     long[] maxSum = new long[n]; // maxSum[i] := the maximum sum with peak i
 
-    Deque<Integer> stack = new ArrayDeque<>(List.of(-1));
-    long sum = 0;
+    Deque<Integer> stack = new ArrayDeque<>(Arrays.asList(-1));
+    stack.push(-1);
+    long summ = 0;
 
-    for (int i = 0; i < n; i++) {
-      sum = process(stack, heights, i, sum);
-      maxSum[i] = sum;
+    for (int i = 0; i < n; ++i) {
+      summ = process(stack, maxHeights, i, summ);
+      maxSum[i] = summ;
     }
 
-    stack = new ArrayDeque<>(List.of(n));
-    sum = 0;
+    stack = new ArrayDeque<>(Arrays.asList(n));
+    summ = 0;
 
-    for (int i = n - 1; i >= 0; i--) {
-      sum = process(stack, heights, i, sum);
-      maxSum[i] += sum - heights[i];
+    for (int i = n - 1; i >= 0; --i) {
+      summ = process(stack, maxHeights, i, summ);
+      maxSum[i] += summ - maxHeights.get(i);
     }
 
     return Arrays.stream(maxSum).max().getAsLong();
   }
 
-  private long process(Deque<Integer> stack, int[] heights, int i, long sum) {
-    while (stack.size() > 1 && heights[stack.peek()] > heights[i]) {
-      int j = stack.pop();
-      // The last abs(j - stack.peek()) heights are `heights[j]`.
-      sum -= (long) Math.abs(j - stack.peek()) * heights[j];
+  private long process(Deque<Integer> stack, List<Integer> maxHeights, int i, long summ) {
+    while (stack.size() > 1 && maxHeights.get(stack.peek()) > maxHeights.get(i)) {
+      final int j = stack.pop();
+      // The last abs(j - stack.peek()) heights are maxHeights.get(j).
+      summ -= Math.abs(j - stack.peek()) * (long) maxHeights.get(j);
     }
-    // Put abs(i - stack.peek()) * heights[i] in `heights`.
-    sum += (long) Math.abs(i - stack.peek()) * heights[i];
+    // Put abs(i - stack.peek()) `maxHeights.get(i)` in heights.
+    summ += Math.abs(i - stack.peek()) * (long) maxHeights.get(i);
     stack.push(i);
-    return sum;
+    return summ;
   }
 }
diff --git a/solutions/2865. Beautiful Towers I/2865.py b/solutions/2865. Beautiful Towers I/2865.py
index 62e455dccd5..10082b55f67 100644
--- a/solutions/2865. Beautiful Towers I/2865.py	
+++ b/solutions/2865. Beautiful Towers I/2865.py	
@@ -1,21 +1,21 @@
 class Solution:
-  def maximumSumOfHeights(self, heights: list[int]) -> int:
-    n = len(heights)
+  def maximumSumOfHeights(self, maxHeights: List[int]) -> int:
+    n = len(maxHeights)
     maxSum = [0] * n  # maxSum[i] := the maximum sum with peak i
 
-    def process(stack: list[int], i: int, summ: int) -> int:
-      while len(stack) > 1 and heights[stack[-1]] > heights[i]:
+    def process(stack: List[int], i: int, summ: int) -> int:
+      while len(stack) > 1 and maxHeights[stack[-1]] > maxHeights[i]:
         j = stack.pop()
-        # The last abs(j - stack[-1]) heights are heights[j].
-        summ -= abs(j - stack[-1]) * heights[j]
+        # The last abs(j - stack[-1]) heights are maxHeights[j].
+        summ -= abs(j - stack[-1]) * maxHeights[j]
       # Put abs(i - stack[-1]) `maxHeight` in heights.
-      summ += abs(i - stack[-1]) * heights[i]
+      summ += abs(i - stack[-1]) * maxHeights[i]
       stack.append(i)
       return summ
 
     stack = [-1]
     summ = 0
-    for i in range(len(heights)):
+    for i in range(len(maxHeights)):
       summ = process(stack, i, summ)
       maxSum[i] = summ
 
@@ -23,6 +23,6 @@ def process(stack: list[int], i: int, summ: int) -> int:
     summ = 0
     for i in range(n - 1, -1, -1):
       summ = process(stack, i, summ)
-      maxSum[i] += summ - heights[i]
+      maxSum[i] += summ - maxHeights[i]
 
     return max(maxSum)
diff --git a/solutions/2866. Beautiful Towers II/2866.cpp b/solutions/2866. Beautiful Towers II/2866.cpp
index 167656f92eb..37fbf047e56 100644
--- a/solutions/2866. Beautiful Towers II/2866.cpp	
+++ b/solutions/2866. Beautiful Towers II/2866.cpp	
@@ -6,36 +6,35 @@ class Solution {
     vector<long> maxSum(n);  // maxSum[i] := the maximum sum with peak i
 
     stack<int> stack{{-1}};
-    long sum = 0;
+    long summ = 0;
 
     for (int i = 0; i < n; ++i) {
-      sum = process(stack, maxHeights, i, sum);
-      maxSum[i] = sum;
+      summ = process(stack, maxHeights, i, summ);
+      maxSum[i] = summ;
     }
 
     stack = std::stack<int>{{n}};
-    sum = 0;
+    summ = 0;
 
     for (int i = n - 1; i >= 0; --i) {
-      sum = process(stack, maxHeights, i, sum);
-      maxSum[i] += sum - maxHeights[i];
+      summ = process(stack, maxHeights, i, summ);
+      maxSum[i] += summ - maxHeights[i];
     }
 
     return ranges::max(maxSum);
   }
 
  private:
-  long process(stack<int>& stack, const vector<int>& maxHeights, int i,
-               long sum) {
+  long process(stack<int>& stack, vector<int>& maxHeights, int i, long summ) {
     while (stack.size() > 1 && maxHeights[stack.top()] > maxHeights[i]) {
-      const int j = stack.top();
+      int j = stack.top();
       stack.pop();
-      // The last abs(j - stack.top()) maxHeights are `maxHeights[j]`.
-      sum -= static_cast<long>(abs(j - stack.top())) * maxHeights[j];
+      // The last abs(j - stack.top()) heights are maxHeights[j].
+      summ -= abs(j - stack.top()) * static_cast<long>(maxHeights[j]);
     }
-    // Put abs(i - stack.top()) * maxHeights[i] in `maxHeights`.
-    sum += static_cast<long>(abs(i - stack.top())) * maxHeights[i];
+    // Put abs(i - stack.top()) * maxHeights[i] in `heights`.
+    summ += abs(i - stack.top()) * static_cast<long>(maxHeights[i]);
     stack.push(i);
-    return sum;
+    return summ;
   }
 };
diff --git a/solutions/2866. Beautiful Towers II/2866.java b/solutions/2866. Beautiful Towers II/2866.java
index 6e7a9846f93..9f3b9ce7228 100644
--- a/solutions/2866. Beautiful Towers II/2866.java	
+++ b/solutions/2866. Beautiful Towers II/2866.java	
@@ -4,34 +4,35 @@ public long maximumSumOfHeights(List<Integer> maxHeights) {
     final int n = maxHeights.size();
     long[] maxSum = new long[n]; // maxSum[i] := the maximum sum with peak i
 
-    Deque<Integer> stack = new ArrayDeque<>(List.of(-1));
-    long sum = 0;
+    Deque<Integer> stack = new ArrayDeque<>(Arrays.asList(-1));
+    stack.push(-1);
+    long summ = 0;
 
     for (int i = 0; i < n; ++i) {
-      sum = process(stack, maxHeights, i, sum);
-      maxSum[i] = sum;
+      summ = process(stack, maxHeights, i, summ);
+      maxSum[i] = summ;
     }
 
-    stack = new ArrayDeque<>(List.of(n));
-    sum = 0;
+    stack = new ArrayDeque<>(Arrays.asList(n));
+    summ = 0;
 
     for (int i = n - 1; i >= 0; --i) {
-      sum = process(stack, maxHeights, i, sum);
-      maxSum[i] += sum - maxHeights.get(i);
+      summ = process(stack, maxHeights, i, summ);
+      maxSum[i] += summ - maxHeights.get(i);
     }
 
     return Arrays.stream(maxSum).max().getAsLong();
   }
 
-  private long process(Deque<Integer> stack, List<Integer> maxHeights, int i, long sum) {
+  private long process(Deque<Integer> stack, List<Integer> maxHeights, int i, long summ) {
     while (stack.size() > 1 && maxHeights.get(stack.peek()) > maxHeights.get(i)) {
-      int j = stack.pop();
-      // The last abs(j - stack.peek()) maxHeights are `maxHeights[j]`.
-      sum -= (long) Math.abs(j - stack.peek()) * maxHeights.get(j);
+      final int j = stack.pop();
+      // The last abs(j - stack.peek()) heights are maxHeights.get(j).
+      summ -= Math.abs(j - stack.peek()) * (long) maxHeights.get(j);
     }
-    // Put abs(i - stack.peek()) * maxHeights[i] in `maxHeights`.
-    sum += (long) Math.abs(i - stack.peek()) * maxHeights.get(i);
+    // Put abs(i - stack.peek()) `maxHeights.get(i)` in heights.
+    summ += Math.abs(i - stack.peek()) * (long) maxHeights.get(i);
     stack.push(i);
-    return sum;
+    return summ;
   }
 }
diff --git a/solutions/2866. Beautiful Towers II/2866.py b/solutions/2866. Beautiful Towers II/2866.py
index 3c2fe993c2a..52630e8f1f8 100644
--- a/solutions/2866. Beautiful Towers II/2866.py	
+++ b/solutions/2866. Beautiful Towers II/2866.py	
@@ -1,10 +1,10 @@
 class Solution:
   # Same as 2865. Beautiful Towers I
-  def maximumSumOfHeights(self, maxHeights: list[int]) -> int:
+  def maximumSumOfHeights(self, maxHeights: List[int]) -> int:
     n = len(maxHeights)
     maxSum = [0] * n  # maxSum[i] := the maximum sum with peak i
 
-    def process(stack: list[int], i: int, summ: int) -> int:
+    def process(stack: List[int], i: int, summ: int) -> int:
       while len(stack) > 1 and maxHeights[stack[-1]] > maxHeights[i]:
         j = stack.pop()
         # The last abs(j - stack[-1]) heights are maxHeights[j].
diff --git a/solutions/2867. Count Valid Paths in a Tree/2867.py b/solutions/2867. Count Valid Paths in a Tree/2867.py
index 89cfcba431c..2a498f9bea9 100644
--- a/solutions/2867. Count Valid Paths in a Tree/2867.py	
+++ b/solutions/2867. Count Valid Paths in a Tree/2867.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countPaths(self, n: int, edges: list[list[int]]) -> int:
+  def countPaths(self, n: int, edges: List[List[int]]) -> int:
     ans = 0
     isPrime = self._sieveEratosthenes(n + 1)
     graph = [[] for _ in range(n + 1)]
@@ -8,7 +8,7 @@ def countPaths(self, n: int, edges: list[list[int]]) -> int:
       graph[u].append(v)
       graph[v].append(u)
 
-    def dfs(u: int, prev: int) -> tuple[int, int]:
+    def dfs(u: int, prev: int) -> Tuple[int, int]:
       nonlocal ans
       countZeroPrimePath = int(not isPrime[u])
       countOnePrimePath = int(isPrime[u])
@@ -17,8 +17,8 @@ def dfs(u: int, prev: int) -> tuple[int, int]:
         if v == prev:
           continue
         countZeroPrimeChildPath, countOnePrimeChildPath = dfs(v, u)
-        ans += (countZeroPrimePath * countOnePrimeChildPath +
-                countOnePrimePath * countZeroPrimeChildPath)
+        ans += countZeroPrimePath * countOnePrimeChildPath + \
+            countOnePrimePath * countZeroPrimeChildPath
         if isPrime[u]:
           countOnePrimePath += countZeroPrimeChildPath
         else:
@@ -30,7 +30,7 @@ def dfs(u: int, prev: int) -> tuple[int, int]:
     dfs(1, -1)
     return ans
 
-  def _sieveEratosthenes(self, n: int) -> list[bool]:
+  def _sieveEratosthenes(self, n: int) -> List[bool]:
     isPrime = [True] * n
     isPrime[0] = False
     isPrime[1] = False
diff --git a/solutions/2868. The Wording Game/2868.py b/solutions/2868. The Wording Game/2868.py
index 4b75915c761..b327e43d807 100644
--- a/solutions/2868. The Wording Game/2868.py	
+++ b/solutions/2868. The Wording Game/2868.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canAliceWin(self, a: list[str], b: list[str]) -> bool:
+  def canAliceWin(self, a: List[str], b: List[str]) -> bool:
     # words[0][i] := the biggest word starting with ('a' + i) for Alice
     # words[1][i] := the biggest word starting with ('a' + i) for Bob
     words = [[''] * 26 for _ in range(2)]
diff --git a/solutions/2869. Minimum Operations to Collect Elements/2869.py b/solutions/2869. Minimum Operations to Collect Elements/2869.py
index 5d6634d43fb..8c2e2f1a6a6 100644
--- a/solutions/2869. Minimum Operations to Collect Elements/2869.py	
+++ b/solutions/2869. Minimum Operations to Collect Elements/2869.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums: list[int], k: int) -> int:
+  def minOperations(self, nums: List[int], k: int) -> int:
     seen = set()
 
     for i, num in enumerate(reversed(nums)):
diff --git a/solutions/287. Find the Duplicate Number/287.py b/solutions/287. Find the Duplicate Number/287.py
index 1e5d9851997..cac285cc91f 100644
--- a/solutions/287. Find the Duplicate Number/287.py	
+++ b/solutions/287. Find the Duplicate Number/287.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findDuplicate(self, nums: list[int]) -> int:
+  def findDuplicate(self, nums: List[int]) -> int:
     slow = nums[nums[0]]
     fast = nums[nums[nums[0]]]
 
diff --git a/solutions/2870. Minimum Number of Operations to Make Array Empty/2870.py b/solutions/2870. Minimum Number of Operations to Make Array Empty/2870.py
index 897f12f52be..f1189d8b243 100644
--- a/solutions/2870. Minimum Number of Operations to Make Array Empty/2870.py	
+++ b/solutions/2870. Minimum Number of Operations to Make Array Empty/2870.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums: list[int]) -> int:
+  def minOperations(self, nums: List[int]) -> int:
     count = collections.Counter(nums)
     if 1 in count.values():
       return -1
diff --git a/solutions/2871. Split Array Into Maximum Number of Subarrays/2871.py b/solutions/2871. Split Array Into Maximum Number of Subarrays/2871.py
index 09a0fe227ee..fff5175bc2a 100644
--- a/solutions/2871. Split Array Into Maximum Number of Subarrays/2871.py	
+++ b/solutions/2871. Split Array Into Maximum Number of Subarrays/2871.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSubarrays(self, nums: list[int]) -> int:
+  def maxSubarrays(self, nums: List[int]) -> int:
     ans = 0
     score = 0
 
diff --git a/solutions/2872. Maximum Number of K-Divisible Components/2872.py b/solutions/2872. Maximum Number of K-Divisible Components/2872.py
index e8d248ac4c5..7dc63b06f8a 100644
--- a/solutions/2872. Maximum Number of K-Divisible Components/2872.py	
+++ b/solutions/2872. Maximum Number of K-Divisible Components/2872.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def maxKDivisibleComponents(
-      self,
-      n: int,
-      edges: list[list[int]],
-      values: list[int],
-      k: int,
-  ) -> int:
+  def maxKDivisibleComponents(self, n: int, edges: List[List[int]], values: List[int], k: int) -> int:
     ans = 0
     graph = [[] for _ in range(n)]
 
diff --git a/solutions/2873. Maximum Value of an Ordered Triplet I/2873.py b/solutions/2873. Maximum Value of an Ordered Triplet I/2873.py
index 3b6fc5df795..5f5177e7a9a 100644
--- a/solutions/2873. Maximum Value of an Ordered Triplet I/2873.py	
+++ b/solutions/2873. Maximum Value of an Ordered Triplet I/2873.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumTripletValue(self, nums: list[int]) -> int:
+  def maximumTripletValue(self, nums: List[int]) -> int:
     ans = 0
     maxDiff = 0  # max(nums[i] - nums[j])
     maxNum = 0   # max(nums[i])
diff --git a/solutions/2874. Maximum Value of an Ordered Triplet II/2874.py b/solutions/2874. Maximum Value of an Ordered Triplet II/2874.py
index 284c1046a41..b68419ab7a8 100644
--- a/solutions/2874. Maximum Value of an Ordered Triplet II/2874.py	
+++ b/solutions/2874. Maximum Value of an Ordered Triplet II/2874.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 2873. Maximum Value of an Ordered Triplet I
-  def maximumTripletValue(self, nums: list[int]) -> int:
+  def maximumTripletValue(self, nums: List[int]) -> int:
     ans = 0
     maxDiff = 0  # max(nums[i] - nums[j])
     maxNum = 0   # max(nums[i])
diff --git a/solutions/2875. Minimum Size Subarray in Infinite Array/2875.py b/solutions/2875. Minimum Size Subarray in Infinite Array/2875.py
index d1f495bde24..b8c8e83f9b6 100644
--- a/solutions/2875. Minimum Size Subarray in Infinite Array/2875.py	
+++ b/solutions/2875. Minimum Size Subarray in Infinite Array/2875.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minSizeSubarray(self, nums: list[int], target: int) -> int:
+  def minSizeSubarray(self, nums: List[int], target: int) -> int:
     summ = sum(nums)
     n = len(nums)
     remainingTarget = target % summ
diff --git a/solutions/2876. Count Visited Nodes in a Directed Graph/2876.java b/solutions/2876. Count Visited Nodes in a Directed Graph/2876.java
index 83bb0330d7b..ef7fbe6549d 100644
--- a/solutions/2876. Count Visited Nodes in a Directed Graph/2876.java	
+++ b/solutions/2876. Count Visited Nodes in a Directed Graph/2876.java	
@@ -17,7 +17,7 @@ public int[] countVisitedNodes(List<Integer> edges) {
 
     // Push non-cyclic nodes to stack.
     while (!q.isEmpty()) {
-      final int u = q.poll();
+      int u = q.poll();
       if (--inDegrees[edges.get(u)] == 0)
         q.add(edges.get(u));
       stack.push(u);
@@ -31,7 +31,7 @@ public int[] countVisitedNodes(List<Integer> edges) {
 
     // Fill the length of non-cyclic nodes.
     while (!stack.isEmpty()) {
-      final int u = stack.pop();
+      int u = stack.pop();
       ans[u] = ans[edges.get(u)] + 1;
     }
 
diff --git a/solutions/2876. Count Visited Nodes in a Directed Graph/2876.py b/solutions/2876. Count Visited Nodes in a Directed Graph/2876.py
index 28cb5c2fb4f..e194f7bc2a7 100644
--- a/solutions/2876. Count Visited Nodes in a Directed Graph/2876.py	
+++ b/solutions/2876. Count Visited Nodes in a Directed Graph/2876.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countVisitedNodes(self, edges: list[int]) -> list[int]:
+  def countVisitedNodes(self, edges: List[int]) -> List[int]:
     n = len(edges)
     ans = [0] * n
     inDegrees = [0] * n
@@ -33,13 +33,7 @@ def countVisitedNodes(self, edges: list[int]) -> list[int]:
 
     return ans
 
-  def _fillCycle(
-      self,
-      edges: list[int],
-      start: int,
-      seen: list[bool],
-      ans: list[int],
-  ) -> None:
+  def _fillCycle(self, edges: List[int], start: int, seen: List[bool], ans: List[int]) -> None:
     cycleLength = 0
     u = start
     while not seen[u]:
diff --git a/solutions/2877. Create a DataFrame from List/2877.py b/solutions/2877. Create a DataFrame from List/2877.py
index dc6dbcd846a..ce25d2be239 100644
--- a/solutions/2877. Create a DataFrame from List/2877.py	
+++ b/solutions/2877. Create a DataFrame from List/2877.py	
@@ -1,5 +1,5 @@
 import pandas as pd
 
 
-def createDataframe(student_data: list[list[int]]) -> pd.DataFrame:
+def createDataframe(student_data: List[List[int]]) -> pd.DataFrame:
   return pd.DataFrame(student_data, columns=['student_id', 'age'])
diff --git a/solutions/2878. Get the Size of a DataFrame/2878.py b/solutions/2878. Get the Size of a DataFrame/2878.py
index 87366cba3e9..be5a18ba55a 100644
--- a/solutions/2878. Get the Size of a DataFrame/2878.py	
+++ b/solutions/2878. Get the Size of a DataFrame/2878.py	
@@ -1,5 +1,5 @@
 import pandas as pd
 
 
-def getDataframeSize(players: pd.DataFrame) -> list[int]:
+def getDataframeSize(players: pd.DataFrame) -> List[int]:
   return [*players.shape]
diff --git a/solutions/288. Unique Word Abbreviation/288.py b/solutions/288. Unique Word Abbreviation/288.py
index ab503d4982f..1ada8d7f1ff 100644
--- a/solutions/288. Unique Word Abbreviation/288.py	
+++ b/solutions/288. Unique Word Abbreviation/288.py	
@@ -1,5 +1,5 @@
 class ValidWordAbbr:
-  def __init__(self, dictionary: list[str]):
+  def __init__(self, dictionary: List[str]):
     self.dict = set(dictionary)
     # T := unique, F := not unique
     self.abbrUnique = {}
diff --git a/solutions/289. Game of Life/289.py b/solutions/289. Game of Life/289.py
index 4f6ac5ce961..8992eac6b00 100644
--- a/solutions/289. Game of Life/289.py	
+++ b/solutions/289. Game of Life/289.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def gameOfLife(self, board: list[list[int]]) -> None:
+  def gameOfLife(self, board: List[List[int]]) -> None:
     m = len(board)
     n = len(board[0])
 
diff --git a/solutions/2892. Minimizing Array After Replacing Pairs With Their Product/2892.py b/solutions/2892. Minimizing Array After Replacing Pairs With Their Product/2892.py
index 64556ea03ff..ffcbca07824 100644
--- a/solutions/2892. Minimizing Array After Replacing Pairs With Their Product/2892.py	
+++ b/solutions/2892. Minimizing Array After Replacing Pairs With Their Product/2892.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minArrayLength(self, nums: list[int], k: int) -> int:
+  def minArrayLength(self, nums: List[int], k: int) -> int:
     count = 0
     prod = -1
 
diff --git a/solutions/2895. Minimum Processing Time/2895.py b/solutions/2895. Minimum Processing Time/2895.py
index b911d4adb75..137ff9f7e88 100644
--- a/solutions/2895. Minimum Processing Time/2895.py	
+++ b/solutions/2895. Minimum Processing Time/2895.py	
@@ -1,10 +1,4 @@
 class Solution:
-  def minProcessingTime(
-      self,
-      processorTime: list[int],
-      tasks: list[int],
-  ) -> int:
+  def minProcessingTime(self, processorTime: List[int], tasks: List[int]) -> int:
     return max(time + task
-               for (time, task) in zip(
-                   sorted(processorTime),
-                   sorted(tasks)[:: -4]))
+               for (time, task) in zip(sorted(processorTime), sorted(tasks)[::-4]))
diff --git a/solutions/2897. Apply Operations on Array to Maximize Sum of Squares/2897.java b/solutions/2897. Apply Operations on Array to Maximize Sum of Squares/2897.java
index 5e9ca28f1c1..48d5282e5c8 100644
--- a/solutions/2897. Apply Operations on Array to Maximize Sum of Squares/2897.java	
+++ b/solutions/2897. Apply Operations on Array to Maximize Sum of Squares/2897.java	
@@ -1,20 +1,20 @@
 class Solution {
   public int maxSum(List<Integer> nums, int k) {
-    final int MOD = 1_000_000_007;
-    final int MAX_BIT = 30;
+    final int kMod = 1_000_000_007;
+    final int kMaxBit = 30;
     int ans = 0;
     // minIndices[i] := the minimum index in `optimalNums` that the i-th bit
     // should be moved to
-    int[] minIndices = new int[MAX_BIT];
+    int[] minIndices = new int[kMaxBit];
     int[] optimalNums = new int[nums.size()];
 
     for (final int num : nums)
-      for (int i = 0; i < MAX_BIT; i++)
+      for (int i = 0; i < kMaxBit; i++)
         if ((num >> i & 1) == 1)
           optimalNums[minIndices[i]++] |= 1 << i;
 
     for (int i = 0; i < k; i++)
-      ans = (int) ((ans + (long) optimalNums[i] * optimalNums[i]) % MOD);
+      ans = (int) (((long) ans + (long) optimalNums[i] * optimalNums[i]) % kMod);
 
     return ans;
   }
diff --git a/solutions/2897. Apply Operations on Array to Maximize Sum of Squares/2897.py b/solutions/2897. Apply Operations on Array to Maximize Sum of Squares/2897.py
index d3952caa821..1e88d5df858 100644
--- a/solutions/2897. Apply Operations on Array to Maximize Sum of Squares/2897.py	
+++ b/solutions/2897. Apply Operations on Array to Maximize Sum of Squares/2897.py	
@@ -1,21 +1,21 @@
 class Solution:
-  def maxSum(self, nums: list[int], k: int) -> int:
-    MOD = 1_000_000_007
-    MAX_BIT = 30
+  def maxSum(self, nums: List[int], k: int) -> int:
+    kMod = 1_000_000_007
+    kMaxBit = 30
     ans = 0
     # minIndices[i] := the minimum index in `optimalNums` that the i-th bit
     # should be moved to
-    minIndices = [0] * MAX_BIT
+    minIndices = [0] * kMaxBit
     optimalNums = [0] * len(nums)
 
     for num in nums:
-      for i in range(MAX_BIT):
+      for i in range(kMaxBit):
         if num >> i & 1:
           optimalNums[minIndices[i]] |= 1 << i
           minIndices[i] += 1
 
     for i in range(k):
       ans += optimalNums[i]**2
-      ans %= MOD
+      ans %= kMod
 
     return ans
diff --git a/solutions/2898. Maximum Linear Stock Score/2898.cpp b/solutions/2898. Maximum Linear Stock Score/2898.cpp
index 8479483b1b8..97ead2d2201 100644
--- a/solutions/2898. Maximum Linear Stock Score/2898.cpp	
+++ b/solutions/2898. Maximum Linear Stock Score/2898.cpp	
@@ -1,10 +1,10 @@
 class Solution {
  public:
   long long maxScore(vector<int>& prices) {
-    //    prices[indices[j]] - prices[indices[j - 1]]
-    // == indices[j] - indices[j - 1]
-    //    prices[indices[j]] - indices[j]
-    // == prices[indices[j - 1]] - indices[j - 1]
+    //    prices[indexes[j]] - prices[indexes[j - 1]]
+    // == indexes[j] - indexes[j - 1]
+    //    prices[indexes[j]] - indexes[j]
+    // == prices[indexes[j - 1]] - indexes[j - 1]
     //
     // So, elements in the same subsequence must have the same prices[i] - i.
     unordered_map<int, long> groupIdToSum;
diff --git a/solutions/2898. Maximum Linear Stock Score/2898.java b/solutions/2898. Maximum Linear Stock Score/2898.java
index 0913d2d1d19..219470ec47c 100644
--- a/solutions/2898. Maximum Linear Stock Score/2898.java	
+++ b/solutions/2898. Maximum Linear Stock Score/2898.java	
@@ -1,9 +1,9 @@
 class Solution {
   public long maxScore(int[] prices) {
-    //    prices[indices[j]] - prices[indices[j - 1]]
-    // == indices[j] - indices[j - 1]
-    //    prices[indices[j]] - indices[j]
-    // == prices[indices[j - 1]] - indices[j - 1]
+    //    prices[indexes[j]] - prices[indexes[j - 1]]
+    // == indexes[j] - indexes[j - 1]
+    //    prices[indexes[j]] - indexes[j]
+    // == prices[indexes[j - 1]] - indexes[j - 1]
     //
     // So, elements in the same subsequence must have the same prices[i] - i.
     Map<Integer, Long> groupIdToSum = new HashMap<>();
diff --git a/solutions/2898. Maximum Linear Stock Score/2898.py b/solutions/2898. Maximum Linear Stock Score/2898.py
index bf2f7eb7518..9fa42bbfc88 100644
--- a/solutions/2898. Maximum Linear Stock Score/2898.py	
+++ b/solutions/2898. Maximum Linear Stock Score/2898.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxScore(self, prices: list[int]) -> int:
+  def maxScore(self, prices: List[int]) -> int:
     groupIdToSum = collections.defaultdict(int)
 
     for i, price in enumerate(prices):
diff --git a/solutions/2899. Last Visited Integers/2899.py b/solutions/2899. Last Visited Integers/2899.py
index ba83998a3da..2299796cdc5 100644
--- a/solutions/2899. Last Visited Integers/2899.py	
+++ b/solutions/2899. Last Visited Integers/2899.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def lastVisitedIntegers(self, words: list[str]) -> list[int]:
+  def lastVisitedIntegers(self, words: List[str]) -> List[int]:
     ans = []
     nums = []
     k = 0
diff --git a/solutions/2900. Longest Unequal Adjacent Groups Subsequence I/2900.py b/solutions/2900. Longest Unequal Adjacent Groups Subsequence I/2900.py
index bf94ff86e05..938737ff8d9 100644
--- a/solutions/2900. Longest Unequal Adjacent Groups Subsequence I/2900.py	
+++ b/solutions/2900. Longest Unequal Adjacent Groups Subsequence I/2900.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def getWordsInLongestSubsequence(
-      self,
-      n: int,
-      words: list[str],
-      groups: list[int],
-  ) -> list[str]:
+  def getWordsInLongestSubsequence(self, n: int, words: List[str], groups: List[int]) -> List[str]:
     ans = []
     groupId = -1
 
diff --git a/solutions/2901. Longest Unequal Adjacent Groups Subsequence II/2901.cpp b/solutions/2901. Longest Unequal Adjacent Groups Subsequence II/2901.cpp
index a48750aeca3..ca76d7c8550 100644
--- a/solutions/2901. Longest Unequal Adjacent Groups Subsequence II/2901.cpp	
+++ b/solutions/2901. Longest Unequal Adjacent Groups Subsequence II/2901.cpp	
@@ -29,8 +29,7 @@ class Solution {
       index = prev[index];
     }
 
-    ranges::reverse(ans);
-    return ans;
+    return {ans.rbegin(), ans.rend()};
   }
 
  private:
diff --git a/solutions/2901. Longest Unequal Adjacent Groups Subsequence II/2901.py b/solutions/2901. Longest Unequal Adjacent Groups Subsequence II/2901.py
index 8dab357b860..522527a1ade 100644
--- a/solutions/2901. Longest Unequal Adjacent Groups Subsequence II/2901.py	
+++ b/solutions/2901. Longest Unequal Adjacent Groups Subsequence II/2901.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def getWordsInLongestSubsequence(
-      self,
-      n: int,
-      words: list[str],
-      groups: list[int],
-  ) -> list[str]:
+  def getWordsInLongestSubsequence(self, n: int, words: List[str], groups: List[int]) -> List[str]:
     ans = []
     # dp[i] := the length of the longest subsequence ending in `words[i]`
     dp = [1] * n
diff --git a/solutions/2902. Count of Sub-Multisets With Bounded Sum/2902.java b/solutions/2902. Count of Sub-Multisets With Bounded Sum/2902.java
index a4c63bea09a..b220dde3214 100644
--- a/solutions/2902. Count of Sub-Multisets With Bounded Sum/2902.java	
+++ b/solutions/2902. Count of Sub-Multisets With Bounded Sum/2902.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int countSubMultisets(List<Integer> nums, int l, int r) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i] := the number of submultisets of `nums` with sum i
     long[] dp = new long[r + 1];
     dp[0] = 1;
@@ -21,14 +21,14 @@ public int countSubMultisets(List<Integer> nums, int l, int r) {
       for (int i = r; i > 0; --i)
         if (i >= num * (freq + 1))
           // dp[i] + dp[i - num] + dp[i - freq * num]
-          dp[i] = (stride[i] - stride[i - num * (freq + 1)]) % MOD;
+          dp[i] = (stride[i] - stride[i - num * (freq + 1)]) % kMod;
         else
-          dp[i] = stride[i] % MOD;
+          dp[i] = stride[i] % kMod;
     }
 
     long ans = 0;
     for (int i = l; i <= r; ++i)
-      ans = (ans + dp[i]) % MOD;
-    return (int) (((zeros + 1) * ans) % MOD);
+      ans = (ans + dp[i]) % kMod;
+    return (int) (((zeros + 1) * ans) % kMod);
   }
 }
diff --git a/solutions/2902. Count of Sub-Multisets With Bounded Sum/2902.py b/solutions/2902. Count of Sub-Multisets With Bounded Sum/2902.py
index 6f2349378c5..b365d5edeb6 100644
--- a/solutions/2902. Count of Sub-Multisets With Bounded Sum/2902.py	
+++ b/solutions/2902. Count of Sub-Multisets With Bounded Sum/2902.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def countSubMultisets(self, nums: list[int], l: int, r: int) -> int:
-    MOD = 1_000_000_007
+  def countSubMultisets(self, nums: List[int], l: int, r: int) -> int:
+    kMod = 1_000_000_007
     # dp[i] := the number of submultisets of `nums` with sum i
     dp = [1] + [0] * r
     count = collections.Counter(nums)
@@ -18,4 +18,4 @@ def countSubMultisets(self, nums: list[int], l: int, r: int) -> int:
         else:
           dp[i] = stride[i]
 
-    return (zeros + 1) * sum(dp[l:r + 1]) % MOD
+    return (zeros + 1) * sum(dp[l:r + 1]) % kMod
diff --git a/solutions/2903. Find Indices With Index and Value Difference I/2903.py b/solutions/2903. Find Indices With Index and Value Difference I/2903.py
index 37ede45ed31..fceb0cc0988 100644
--- a/solutions/2903. Find Indices With Index and Value Difference I/2903.py	
+++ b/solutions/2903. Find Indices With Index and Value Difference I/2903.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def findIndices(
-      self,
-      nums: list[int],
-      indexDifference: int,
-      valueDifference: int,
-  ) -> list[int]:
+  def findIndices(self, nums: List[int], indexDifference: int, valueDifference: int) -> List[int]:
     # nums[minIndex] := the minimum number with enough index different from the
     # current number
     minIndex = 0
diff --git a/solutions/2905. Find Indices With Index and Value Difference II/2905.py b/solutions/2905. Find Indices With Index and Value Difference II/2905.py
index ec5e9b96e33..2556a20e12d 100644
--- a/solutions/2905. Find Indices With Index and Value Difference II/2905.py	
+++ b/solutions/2905. Find Indices With Index and Value Difference II/2905.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def findIndices(
-      self,
-      nums: list[int],
-      indexDifference: int,
-      valueDifference: int,
-  ) -> list[int]:
+  def findIndices(self, nums: List[int], indexDifference: int, valueDifference: int) -> List[int]:
     # nums[minIndex] := the minimum number with enough index different from the current number
     minIndex = 0
     # nums[maxIndex] := the maximum number with enough index different from the current number
diff --git a/solutions/2906. Construct Product Matrix/2906.cpp b/solutions/2906. Construct Product Matrix/2906.cpp
index c0ecc7c543b..0704a7f1c61 100644
--- a/solutions/2906. Construct Product Matrix/2906.cpp	
+++ b/solutions/2906. Construct Product Matrix/2906.cpp	
@@ -9,8 +9,8 @@ class Solution {
     int suffix = 1;
 
     for (const vector<int>& row : grid)
-      for (const int num : row)
-        prefix.push_back(static_cast<long>(prefix.back()) * num % kMod);
+      for (const int cell : row)
+        prefix.push_back(static_cast<long>(prefix.back()) * cell % kMod);
 
     for (int i = m - 1; i >= 0; --i)
       for (int j = n - 1; j >= 0; --j) {
diff --git a/solutions/2906. Construct Product Matrix/2906.java b/solutions/2906. Construct Product Matrix/2906.java
index 9dd53defbf7..0f8fce57ef6 100644
--- a/solutions/2906. Construct Product Matrix/2906.java	
+++ b/solutions/2906. Construct Product Matrix/2906.java	
@@ -1,20 +1,20 @@
 class Solution {
   public int[][] constructProductMatrix(int[][] grid) {
-    final int MOD = 12345;
+    final int kMod = 12345;
     final int m = grid.length;
     final int n = grid[0].length;
     int[][] ans = new int[m][n];
-    List<Integer> prefix = new ArrayList<>(List.of(1));
+    List<Integer> prefix = new ArrayList<>(Arrays.asList(1));
     int suffix = 1;
 
     for (int[] row : grid)
-      for (int num : row)
-        prefix.add((int) ((long) prefix.get(prefix.size() - 1) * num % MOD));
+      for (int cell : row)
+        prefix.add((int) ((long) prefix.get(prefix.size() - 1) * cell % kMod));
 
     for (int i = m - 1; i >= 0; i--)
       for (int j = n - 1; j >= 0; j--) {
-        ans[i][j] = (int) ((long) prefix.get(i * n + j) * suffix % MOD);
-        suffix = (int) ((long) suffix * grid[i][j] % MOD);
+        ans[i][j] = (int) ((long) prefix.get(i * n + j) * suffix % kMod);
+        suffix = (int) ((long) suffix * grid[i][j] % kMod);
       }
 
     return ans;
diff --git a/solutions/2906. Construct Product Matrix/2906.py b/solutions/2906. Construct Product Matrix/2906.py
index d360bb5f7e4..da7d0d4362d 100644
--- a/solutions/2906. Construct Product Matrix/2906.py	
+++ b/solutions/2906. Construct Product Matrix/2906.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def constructProductMatrix(self, grid: list[list[int]]) -> list[list[int]]:
-    MOD = 12345
+  def constructProductMatrix(self, grid: List[List[int]]) -> List[List[int]]:
+    kMod = 12345
     m = len(grid)
     n = len(grid[0])
     ans = [[0] * n for _ in range(m)]
@@ -8,12 +8,12 @@ def constructProductMatrix(self, grid: list[list[int]]) -> list[list[int]]:
     suffix = 1
 
     for row in grid:
-      for num in row:
-        prefix.append(prefix[-1] * num % MOD)
+      for cell in row:
+        prefix.append(prefix[-1] * cell % kMod)
 
     for i in reversed(range(m)):
       for j in reversed(range(n)):
-        ans[i][j] = prefix[i * n + j] * suffix % MOD
-        suffix = suffix * grid[i][j] % MOD
+        ans[i][j] = prefix[i * n + j] * suffix % kMod
+        suffix = suffix * grid[i][j] % kMod
 
     return ans
diff --git a/solutions/2907. Maximum Profitable Triplets With Increasing Prices I/2907.py b/solutions/2907. Maximum Profitable Triplets With Increasing Prices I/2907.py
index 7ccf17b19e3..fc975091ac9 100644
--- a/solutions/2907. Maximum Profitable Triplets With Increasing Prices I/2907.py	
+++ b/solutions/2907. Maximum Profitable Triplets With Increasing Prices I/2907.py	
@@ -20,7 +20,7 @@ def lowbit(i: int) -> int:
 
 
 class Solution:
-  def maxProfit(self, prices: list[int], profits: list[int]) -> int:
+  def maxProfit(self, prices: List[int], profits: List[int]) -> int:
     ans = -1
     maxPrice = max(prices)
     maxProfitTree1 = FenwickTree(maxPrice)
diff --git a/solutions/2908. Minimum Sum of Mountain Triplets I/2908.cpp b/solutions/2908. Minimum Sum of Mountain Triplets I/2908.cpp
index a73ea280f92..7c3ce106dad 100644
--- a/solutions/2908. Minimum Sum of Mountain Triplets I/2908.cpp	
+++ b/solutions/2908. Minimum Sum of Mountain Triplets I/2908.cpp	
@@ -10,7 +10,7 @@ class Solution {
                 [](int x, int y) { return min(x, y); });
     partial_sum(nums.rbegin(), nums.rend(), minSuffix.begin(),
                 [](int x, int y) { return min(x, y); });
-    ranges::reverse(minSuffix);
+    reverse(minSuffix.begin(), minSuffix.end());
 
     for (int i = 0; i < n; ++i)
       if (nums[i] > minPrefix[i] && nums[i] > minSuffix[i])
diff --git a/solutions/2908. Minimum Sum of Mountain Triplets I/2908.py b/solutions/2908. Minimum Sum of Mountain Triplets I/2908.py
index 515516768c8..56b58bcb112 100644
--- a/solutions/2908. Minimum Sum of Mountain Triplets I/2908.py	
+++ b/solutions/2908. Minimum Sum of Mountain Triplets I/2908.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 2908. Minimum Sum of Mountain Triplets I
-  def minimumSum(self, nums: list[int]) -> int:
+  def minimumSum(self, nums: List[int]) -> int:
     ans = math.inf
     minPrefix = list(itertools.accumulate(nums, min))
     minSuffix = list(itertools.accumulate(reversed(nums), min))[::-1]
diff --git a/solutions/2909. Minimum Sum of Mountain Triplets II/2909.cpp b/solutions/2909. Minimum Sum of Mountain Triplets II/2909.cpp
index c260c66298f..f36d6d9f8b6 100644
--- a/solutions/2909. Minimum Sum of Mountain Triplets II/2909.cpp	
+++ b/solutions/2909. Minimum Sum of Mountain Triplets II/2909.cpp	
@@ -11,7 +11,7 @@ class Solution {
                 [](int x, int y) { return min(x, y); });
     partial_sum(nums.rbegin(), nums.rend(), minSuffix.begin(),
                 [](int x, int y) { return min(x, y); });
-    ranges::reverse(minSuffix);
+    reverse(minSuffix.begin(), minSuffix.end());
 
     for (int i = 0; i < n; ++i)
       if (nums[i] > minPrefix[i] && nums[i] > minSuffix[i])
diff --git a/solutions/2909. Minimum Sum of Mountain Triplets II/2909.py b/solutions/2909. Minimum Sum of Mountain Triplets II/2909.py
index 515516768c8..56b58bcb112 100644
--- a/solutions/2909. Minimum Sum of Mountain Triplets II/2909.py	
+++ b/solutions/2909. Minimum Sum of Mountain Triplets II/2909.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 2908. Minimum Sum of Mountain Triplets I
-  def minimumSum(self, nums: list[int]) -> int:
+  def minimumSum(self, nums: List[int]) -> int:
     ans = math.inf
     minPrefix = list(itertools.accumulate(nums, min))
     minSuffix = list(itertools.accumulate(reversed(nums), min))[::-1]
diff --git a/solutions/291. Word Pattern II/291.cpp b/solutions/291. Word Pattern II/291.cpp
index 4c65cf4e70a..88846ec9d75 100644
--- a/solutions/291. Word Pattern II/291.cpp	
+++ b/solutions/291. Word Pattern II/291.cpp	
@@ -23,8 +23,8 @@ class Solution {
         return false;
 
       // If there's a match, continue to match the rest.
-      return isMatch(pattern, i + 1, s, j + t.length(), std::move(charToString),
-                     std::move(seen));
+      return isMatch(pattern, i + 1, s, j + t.length(), move(charToString),
+                     move(seen));
     }
 
     for (int k = j; k < s.length(); ++k) {
@@ -37,8 +37,7 @@ class Solution {
       charToString[c] = t;
       seen.insert(t);
 
-      if (isMatch(pattern, i + 1, s, k + 1, std::move(charToString),
-                  std::move(seen)))
+      if (isMatch(pattern, i + 1, s, k + 1, move(charToString), move(seen)))
         return true;
 
       // Backtrack.
diff --git a/solutions/291. Word Pattern II/291.py b/solutions/291. Word Pattern II/291.py
index d148f965b6c..15b263351e5 100644
--- a/solutions/291. Word Pattern II/291.py	
+++ b/solutions/291. Word Pattern II/291.py	
@@ -1,8 +1,6 @@
 class Solution:
   def wordPatternMatch(self, pattern: str, s: str) -> bool:
-    def isMatch(
-            i: int, j: int, charToString: dict[str, str],
-            seen: set[str]) -> bool:
+    def isMatch(i: int, j: int, charToString: Dict[chr, str], seen: Set[str]) -> bool:
       if i == len(pattern) and j == len(s):
         return True
       if i == len(pattern) or j == len(s):
diff --git a/solutions/2910. Minimum Number of Groups to Create a Valid Assignment/2910.py b/solutions/2910. Minimum Number of Groups to Create a Valid Assignment/2910.py
index c9c0ac673c6..bc3f53f5281 100644
--- a/solutions/2910. Minimum Number of Groups to Create a Valid Assignment/2910.py	
+++ b/solutions/2910. Minimum Number of Groups to Create a Valid Assignment/2910.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minGroupsForValidAssignment(self, nums: list[int]) -> int:
+  def minGroupsForValidAssignment(self, nums: List[int]) -> int:
     count = collections.Counter(nums)
     minFreq = min(count.values())
 
@@ -10,7 +10,7 @@ def minGroupsForValidAssignment(self, nums: list[int]) -> int:
 
     raise ValueError("Invalid argument")
 
-  def getNumGroups(self, count: dict[int, int], groupSize: int) -> int:
+  def getNumGroups(self, count: Dict[int, int], groupSize: int) -> int:
     """Returns the number of groups if each group's size is `groupSize` or `groupSize + 1`."""
     numGroups = 0
     for freq in count.values():
diff --git a/solutions/2911. Minimum Changes to Make K Semi-palindromes/2911.java b/solutions/2911. Minimum Changes to Make K Semi-palindromes/2911.java
index d4cbe6087b7..c9683dc6f56 100644
--- a/solutions/2911. Minimum Changes to Make K Semi-palindromes/2911.java	
+++ b/solutions/2911. Minimum Changes to Make K Semi-palindromes/2911.java	
@@ -22,7 +22,7 @@ public int minimumChanges(String s, int k) {
   private List<Integer>[] getFactors(int n) {
     List<Integer>[] factors = new List[n + 1];
     for (int i = 1; i <= n; ++i)
-      factors[i] = new ArrayList<>(List.of(1));
+      factors[i] = new ArrayList<>(Arrays.asList(1));
     for (int d = 2; d < n; ++d)
       for (int i = d * 2; i <= n; i += d)
         factors[i].add(d);
diff --git a/solutions/2911. Minimum Changes to Make K Semi-palindromes/2911.py b/solutions/2911. Minimum Changes to Make K Semi-palindromes/2911.py
index bf84856ce11..8c731fd1680 100644
--- a/solutions/2911. Minimum Changes to Make K Semi-palindromes/2911.py	
+++ b/solutions/2911. Minimum Changes to Make K Semi-palindromes/2911.py	
@@ -17,21 +17,22 @@ def minimumChanges(self, s: str, k: int) -> int:
 
     return dp[0][k]
 
-  def _getFactors(self, n: int) -> list[list[int]]:
+  def _getFactors(self, n: int) -> List[List[int]]:
     factors = [[1] for _ in range(n + 1)]
     for d in range(2, n):
       for i in range(d * 2, n + 1, d):
         factors[i].append(d)
     return factors
 
-  def _getCost(self, s: str, n: int, factors: list[list[int]]) -> list[list[int]]:
+  def _getCost(self, s: str, n: int, factors: List[List[int]]) -> List[List[int]]:
     cost = [[0] * n for _ in range(n)]
-    for i, j in itertools.combinations(range(n), 2):
-      length = j - i + 1
-      minCost = length
-      for d in factors[length]:
-        minCost = min(minCost, self._getCostD(s, i, j, d))
-      cost[i][j] = minCost
+    for i in range(n):
+      for j in range(i + 1, n):
+        length = j - i + 1
+        minCost = length
+        for d in factors[length]:
+          minCost = min(minCost, self._getCostD(s, i, j, d))
+        cost[i][j] = minCost
     return cost
 
   def _getCostD(self, s: str, i: int, j: int, d: int) -> int:
diff --git a/solutions/2912. Number of Ways to Reach Destination in the Grid/2912-2.java b/solutions/2912. Number of Ways to Reach Destination in the Grid/2912-2.java
index a999bbf1ab7..09a08c8ddc9 100644
--- a/solutions/2912. Number of Ways to Reach Destination in the Grid/2912-2.java	
+++ b/solutions/2912. Number of Ways to Reach Destination in the Grid/2912-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numberOfWays(int n, int m, int k, int[] source, int[] dest) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // the number of ways of `source` to `dest` using steps so far
     int ans = (source[0] == dest[0] && source[1] == dest[1]) ? 1 : 0;
     // the number of ways of `source` to dest's row using steps so far
@@ -11,19 +11,19 @@ public int numberOfWays(int n, int m, int k, int[] source, int[] dest) {
     int others = (source[0] != dest[0] && source[1] != dest[1]) ? 1 : 0;
 
     for (int i = 0; i < k; ++i) {
-      final int nextAns = (row + col) % MOD;
+      final int nextAns = (row + col) % kMod;
       final int nextRow = (int) ((ans * (m - 1L) + // -self
                                   row * (m - 2L) + //-self, -center
                                   others) %
-                                 MOD);
+                                 kMod);
       final int nextCol = (int) ((ans * (n - 1L) + // -self
                                   col * (n - 2L) + // -self, -center
                                   others) %
-                                 MOD);
+                                 kMod);
       final int nextOthers = (int) ((row * (n - 1L) +             // -self
                                      col * (m - 1L) +             // -self
                                      others * (m + n - 1 - 3L)) % // -self, -row, -col
-                                    MOD);
+                                    kMod);
       ans = nextAns;
       row = nextRow;
       col = nextCol;
diff --git a/solutions/2912. Number of Ways to Reach Destination in the Grid/2912-2.py b/solutions/2912. Number of Ways to Reach Destination in the Grid/2912-2.py
index b41b8bff236..b247dcd024d 100644
--- a/solutions/2912. Number of Ways to Reach Destination in the Grid/2912-2.py	
+++ b/solutions/2912. Number of Ways to Reach Destination in the Grid/2912-2.py	
@@ -1,13 +1,6 @@
 class Solution:
-  def numberOfWays(
-      self,
-      n: int,
-      m: int,
-      k: int,
-      source: list[int],
-      dest: list[int],
-  ) -> int:
-    MOD = 1_000_000_007
+  def numberOfWays(self, n: int, m: int, k: int, source: List[int], dest: List[int]) -> int:
+    kMod = 1_000_000_007
     # the number of ways of `source` to `dest` using steps so far
     ans = int(source == dest)
     # the number of ways of `source` to dest's row using steps so far
@@ -18,16 +11,16 @@ def numberOfWays(
     others = int(source[0] != dest[0] and source[1] != dest[1])
 
     for _ in range(k):
-      nextAns = (row + col) % MOD
+      nextAns = (row + col) % kMod
       nextRow = (ans * (m - 1) +  # -self
                  row * (m - 2) +  # -self, -center
-                 others) % MOD
+                 others) % kMod
       nextCol = (ans * (n - 1) +  # -self
                  col * (n - 2) +  # -self, -center
-                 others) % MOD
+                 others) % kMod
       nextOthers = (row * (n - 1) +  # -self
                     col * (m - 1) +  # -self
-                    others * (m + n - 1 - 3)) % MOD  # -self, -row, -col
+                    others * (m + n - 1 - 3)) % kMod  # -self, -row, -col
       ans = nextAns
       row = nextRow
       col = nextCol
diff --git a/solutions/2912. Number of Ways to Reach Destination in the Grid/2912.java b/solutions/2912. Number of Ways to Reach Destination in the Grid/2912.java
index f8f2dd6cd97..45a1b241cd3 100644
--- a/solutions/2912. Number of Ways to Reach Destination in the Grid/2912.java	
+++ b/solutions/2912. Number of Ways to Reach Destination in the Grid/2912.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numberOfWays(int n, int m, int k, int[] source, int[] dest) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i][0] := the the number of ways of `source` to `dest` using i steps
     // dp[i][1] := the the number of ways of `source` to dest's row using i steps
     // dp[i][2] := the the number of ways of `source` to dest's col using i steps
@@ -16,19 +16,19 @@ else if (source[1] == dest[1])
       dp[0][3] = 1;
 
     for (int i = 1; i <= k; i++) {
-      dp[i][0] = (dp[i - 1][1] + dp[i - 1][2]) % MOD;
+      dp[i][0] = (dp[i - 1][1] + dp[i - 1][2]) % kMod;
       dp[i][1] = (int) ((dp[i - 1][0] * (m - 1L) + // -self
                          dp[i - 1][1] * (m - 2L) + // -self, -center
                          dp[i - 1][3]) %
-                        MOD);
+                        kMod);
       dp[i][2] = (int) ((dp[i - 1][0] * (n - 1L) + // -self
                          dp[i - 1][2] * (n - 2L) + // -self, -center
                          dp[i - 1][3]) %
-                        MOD);
+                        kMod);
       dp[i][3] = (int) ((dp[i - 1][1] * (n - 1L) +        // -self
                          dp[i - 1][2] * (m - 1L) +        // -self
                          dp[i - 1][3] * (m + n - 1 - 3L)) // -self, -row, -col
-                        % MOD);
+                        % kMod);
     }
 
     return dp[k][0];
diff --git a/solutions/2912. Number of Ways to Reach Destination in the Grid/2912.py b/solutions/2912. Number of Ways to Reach Destination in the Grid/2912.py
index 0e50d51ff8a..933bc2e7c16 100644
--- a/solutions/2912. Number of Ways to Reach Destination in the Grid/2912.py	
+++ b/solutions/2912. Number of Ways to Reach Destination in the Grid/2912.py	
@@ -1,13 +1,6 @@
 class Solution:
-  def numberOfWays(
-      self,
-      n: int,
-      m: int,
-      k: int,
-      source: list[int],
-      dest: list[int],
-  ) -> int:
-    MOD = 1_000_000_007
+  def numberOfWays(self, n: int, m: int, k: int, source: List[int], dest: List[int]) -> int:
+    kMod = 1_000_000_007
     # dp[i][0] := the the number of ways of `source` to `dest` using i steps
     # dp[i][1] := the the number of ways of `source` to dest's row using i steps
     # dp[i][2] := the the number of ways of `source` to dest's col using i steps
@@ -23,15 +16,15 @@ def numberOfWays(
       dp[0][3] = 1
 
     for i in range(1, k + 1):
-      dp[i][0] = (dp[i - 1][1] + dp[i - 1][2]) % MOD
+      dp[i][0] = (dp[i - 1][1] + dp[i - 1][2]) % kMod
       dp[i][1] = (dp[i - 1][0] * (m - 1) +  # -self
                   dp[i - 1][1] * (m - 2) +  # -self, -center
-                  dp[i - 1][3]) % MOD
+                  dp[i - 1][3]) % kMod
       dp[i][2] = (dp[i - 1][0] * (n - 1) +  # -self
                   dp[i - 1][2] * (n - 2) +  # -self, -center
-                  dp[i - 1][3]) % MOD
+                  dp[i - 1][3]) % kMod
       dp[i][3] = (dp[i - 1][1] * (n - 1) +  # -self
                   dp[i - 1][2] * (m - 1) +  # -self
-                  dp[i - 1][3] * (m + n - 1 - 3)) % MOD  # -self, -row, -col
+                  dp[i - 1][3] * (m + n - 1 - 3)) % kMod  # -self, -row, -col
 
     return dp[k][0]
diff --git a/solutions/2913. Subarrays Distinct Element Sum of Squares I/2913.cpp b/solutions/2913. Subarrays Distinct Element Sum of Squares I/2913.cpp
index c49e94c7d8e..d18ec48a592 100644
--- a/solutions/2913. Subarrays Distinct Element Sum of Squares I/2913.cpp	
+++ b/solutions/2913. Subarrays Distinct Element Sum of Squares I/2913.cpp	
@@ -1,6 +1,6 @@
-class LazySegmentTree {
+class SegmentTree {
  public:
-  LazySegmentTree(int n, int kMod)
+  SegmentTree(int n, int kMod)
       : n(n), kMod(kMod), lazy(4 * n), sums(4 * n), squaredSums(4 * n) {}
 
   void updateRange(int l, int r) {
@@ -58,7 +58,7 @@ class Solution {
     const int n = nums.size();
     int ans = 0;
     unordered_map<int, int> lastSeen;
-    LazySegmentTree tree(n, kMod);
+    SegmentTree tree(n, kMod);
 
     for (int r = 0; r < n; ++r) {
       const int l = lastSeen.contains(nums[r]) ? lastSeen[nums[r]] + 1 : 0;
diff --git a/solutions/2915. Length of the Longest Subsequence That Sums to Target/2915-2.py b/solutions/2915. Length of the Longest Subsequence That Sums to Target/2915-2.py
index 4c626e03717..d3b43251e2e 100644
--- a/solutions/2915. Length of the Longest Subsequence That Sums to Target/2915-2.py	
+++ b/solutions/2915. Length of the Longest Subsequence That Sums to Target/2915-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def lengthOfLongestSubsequence(self, nums: list[int], target: int) -> int:
+  def lengthOfLongestSubsequence(self, nums: List[int], target: int) -> int:
     # dp[i] := the maximum length of any subsequence of numbers so far that
     # sum to j
     dp = [0] * (target + 1)
diff --git a/solutions/2915. Length of the Longest Subsequence That Sums to Target/2915.py b/solutions/2915. Length of the Longest Subsequence That Sums to Target/2915.py
index c62d7c27b05..ad565643abe 100644
--- a/solutions/2915. Length of the Longest Subsequence That Sums to Target/2915.py	
+++ b/solutions/2915. Length of the Longest Subsequence That Sums to Target/2915.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def lengthOfLongestSubsequence(self, nums: list[int], target: int) -> int:
+  def lengthOfLongestSubsequence(self, nums: List[int], target: int) -> int:
     n = len(nums)
     # dp[i][j] := the maximum length of any subsequence of the first i numbers
     # that sum to j
diff --git a/solutions/2916. Subarrays Distinct Element Sum of Squares II/2916.cpp b/solutions/2916. Subarrays Distinct Element Sum of Squares II/2916.cpp
index c49e94c7d8e..d18ec48a592 100644
--- a/solutions/2916. Subarrays Distinct Element Sum of Squares II/2916.cpp	
+++ b/solutions/2916. Subarrays Distinct Element Sum of Squares II/2916.cpp	
@@ -1,6 +1,6 @@
-class LazySegmentTree {
+class SegmentTree {
  public:
-  LazySegmentTree(int n, int kMod)
+  SegmentTree(int n, int kMod)
       : n(n), kMod(kMod), lazy(4 * n), sums(4 * n), squaredSums(4 * n) {}
 
   void updateRange(int l, int r) {
@@ -58,7 +58,7 @@ class Solution {
     const int n = nums.size();
     int ans = 0;
     unordered_map<int, int> lastSeen;
-    LazySegmentTree tree(n, kMod);
+    SegmentTree tree(n, kMod);
 
     for (int r = 0; r < n; ++r) {
       const int l = lastSeen.contains(nums[r]) ? lastSeen[nums[r]] + 1 : 0;
diff --git a/solutions/2917. Find the K-or of an Array/2917.java b/solutions/2917. Find the K-or of an Array/2917.java
index f6eed8625db..b50954ad388 100644
--- a/solutions/2917. Find the K-or of an Array/2917.java	
+++ b/solutions/2917. Find the K-or of an Array/2917.java	
@@ -1,9 +1,9 @@
 class Solution {
   public int findKOr(int[] nums, int k) {
-    final int MAX_BIT = 30;
+    final int kMaxBit = 30;
     int ans = 0;
 
-    for (int i = 0; i <= MAX_BIT; ++i) {
+    for (int i = 0; i <= kMaxBit; ++i) {
       final int finalI = i;
       final int count = (int) Arrays.stream(nums)
                             .filter(num -> (num >> finalI & 1) == 1) //
diff --git a/solutions/2917. Find the K-or of an Array/2917.py b/solutions/2917. Find the K-or of an Array/2917.py
index 33201496f9d..d601923776f 100644
--- a/solutions/2917. Find the K-or of an Array/2917.py	
+++ b/solutions/2917. Find the K-or of an Array/2917.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def findKOr(self, nums: list[int], k: int) -> int:
-    MAX_BIT = 30
+  def findKOr(self, nums: List[int], k: int) -> int:
+    kMaxBit = 30
     return sum(2**i
-               for i in range(MAX_BIT + 1)
+               for i in range(kMaxBit + 1)
                if sum(num >> i & 1 for num in nums) >= k)
diff --git a/solutions/2918. Minimum Equal Sum of Two Arrays After Replacing Zeros/2918.java b/solutions/2918. Minimum Equal Sum of Two Arrays After Replacing Zeros/2918.java
index 982745ea382..a145de17a9d 100644
--- a/solutions/2918. Minimum Equal Sum of Two Arrays After Replacing Zeros/2918.java	
+++ b/solutions/2918. Minimum Equal Sum of Two Arrays After Replacing Zeros/2918.java	
@@ -1,9 +1,9 @@
 class Solution {
   public long minSum(int[] nums1, int[] nums2) {
-    final long sum1 = Arrays.stream(nums1).asLongStream().sum();
-    final long sum2 = Arrays.stream(nums2).asLongStream().sum();
-    final long zero1 = Arrays.stream(nums1).filter(num -> num == 0).count();
-    final long zero2 = Arrays.stream(nums2).filter(num -> num == 0).count();
+    long sum1 = Arrays.stream(nums1).asLongStream().sum();
+    long sum2 = Arrays.stream(nums2).asLongStream().sum();
+    long zero1 = Arrays.stream(nums1).filter(num -> num == 0).count();
+    long zero2 = Arrays.stream(nums2).filter(num -> num == 0).count();
     if (zero1 == 0 && sum1 < sum2 + zero2)
       return -1;
     if (zero2 == 0 && sum2 < sum1 + zero1)
diff --git a/solutions/2918. Minimum Equal Sum of Two Arrays After Replacing Zeros/2918.py b/solutions/2918. Minimum Equal Sum of Two Arrays After Replacing Zeros/2918.py
index 8d26bb8f24a..3101aa5a75c 100644
--- a/solutions/2918. Minimum Equal Sum of Two Arrays After Replacing Zeros/2918.py	
+++ b/solutions/2918. Minimum Equal Sum of Two Arrays After Replacing Zeros/2918.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minSum(self, nums1: list[int], nums2: list[int]) -> int:
+  def minSum(self, nums1: List[int], nums2: List[int]) -> int:
     sum1 = sum(nums1)
     sum2 = sum(nums2)
     zero1 = nums1.count(0)
diff --git a/solutions/2919. Minimum Increment Operations to Make Array Beautiful/2919.py b/solutions/2919. Minimum Increment Operations to Make Array Beautiful/2919.py
index 1437bc351d3..cbb4350b17d 100644
--- a/solutions/2919. Minimum Increment Operations to Make Array Beautiful/2919.py	
+++ b/solutions/2919. Minimum Increment Operations to Make Array Beautiful/2919.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minIncrementOperations(self, nums: list[int], k: int) -> int:
+  def minIncrementOperations(self, nums: List[int], k: int) -> int:
     # the minimum operations to increase nums[i - 3] and nums[0..i - 3)
     prev3 = 0
     # the minimum operations to increase nums[i - 2] and nums[0..i - 2)
diff --git a/solutions/2920. Maximum Points After Collecting Coins From All Nodes/2920.java b/solutions/2920. Maximum Points After Collecting Coins From All Nodes/2920.java
index 5fc1885af72..658486cd2e2 100644
--- a/solutions/2920. Maximum Points After Collecting Coins From All Nodes/2920.java	
+++ b/solutions/2920. Maximum Points After Collecting Coins From All Nodes/2920.java	
@@ -2,9 +2,11 @@ class Solution {
   public int maximumPoints(int[][] edges, int[] coins, int k) {
     final int n = coins.length;
     List<Integer>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
 
-    Integer[][] mem = new Integer[n][MAX_HALVED + 1];
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
+
+    Integer[][] mem = new Integer[n][kMaxHalved + 1];
 
     for (int[] edge : edges) {
       final int u = edge[0];
@@ -16,13 +18,13 @@ public int maximumPoints(int[][] edges, int[] coins, int k) {
     return dfs(graph, 0, /*prev=*/-1, coins, k, /*halved=*/0, mem);
   }
 
-  private static final int MAX_COIN = 10000;
-  private static final int MAX_HALVED = (int) (Math.log(MAX_COIN) / Math.log(2)) + 1;
+  private static final int kMaxCoin = 10000;
+  private static final int kMaxHalved = (int) (Math.log(kMaxCoin) / Math.log(2)) + 1;
 
   private int dfs(List<Integer>[] graph, int u, int prev, int[] coins, int k, int halved,
                   Integer[][] mem) {
     // All the children will be 0, so no need to explore.
-    if (halved > MAX_HALVED)
+    if (halved > kMaxHalved)
       return 0;
     if (mem[u][halved] != null)
       return mem[u][halved];
diff --git a/solutions/2920. Maximum Points After Collecting Coins From All Nodes/2920.py b/solutions/2920. Maximum Points After Collecting Coins From All Nodes/2920.py
index a34f8113ec6..8bf45b113a4 100644
--- a/solutions/2920. Maximum Points After Collecting Coins From All Nodes/2920.py	
+++ b/solutions/2920. Maximum Points After Collecting Coins From All Nodes/2920.py	
@@ -1,12 +1,7 @@
 class Solution:
-  def maximumPoints(
-      self,
-      edges: list[list[int]],
-      coins: list[int],
-      k: int,
-  ) -> int:
-    MAX_COIN = 10000
-    MAX_HALVED = int(MAX_COIN).bit_length()
+  def maximumPoints(self, edges: List[List[int]], coins: List[int], k: int) -> int:
+    kMaxCoin = 10000
+    kMaxHalved = int(kMaxCoin).bit_length()
     n = len(coins)
     graph = [[] for _ in range(n)]
 
@@ -17,7 +12,7 @@ def maximumPoints(
     @functools.lru_cache(None)
     def dfs(u: int, prev: int, halved: int) -> int:
       # All the children will be 0, so no need to explore.
-      if halved > MAX_HALVED:
+      if halved > kMaxHalved:
         return 0
 
       val = coins[u] // (1 << halved)
diff --git a/solutions/2921. Maximum Profitable Triplets With Increasing Prices II/2921.py b/solutions/2921. Maximum Profitable Triplets With Increasing Prices II/2921.py
index 446304c791c..779a8389bdd 100644
--- a/solutions/2921. Maximum Profitable Triplets With Increasing Prices II/2921.py	
+++ b/solutions/2921. Maximum Profitable Triplets With Increasing Prices II/2921.py	
@@ -21,7 +21,7 @@ def lowbit(i: int) -> int:
 
 class Solution:
   # Same as 2907. Maximum Profitable Triplets With Increasing Prices I
-  def maxProfit(self, prices: list[int], profits: list[int]) -> int:
+  def maxProfit(self, prices: List[int], profits: List[int]) -> int:
     ans = -1
     maxPrice = max(prices)
     maxProfitTree1 = FenwickTree(maxPrice)
diff --git a/solutions/2923. Find Champion I/2923-2.py b/solutions/2923. Find Champion I/2923-2.py
index faf472e0a9b..20664a23447 100644
--- a/solutions/2923. Find Champion I/2923-2.py	
+++ b/solutions/2923. Find Champion I/2923-2.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def findChampion(self, grid: list[list[int]]) -> int:
-    return max(range(len(grid)), key=lambda x: sum(grid[x]))
+  def findChampion(self, grid: List[List[int]]) -> int:
+    return max(range(len(grid)), key=lambda i: sum(grid[i]))
diff --git a/solutions/2923. Find Champion I/2923.py b/solutions/2923. Find Champion I/2923.py
index 5a12201a930..1ca13e9ee0f 100644
--- a/solutions/2923. Find Champion I/2923.py	
+++ b/solutions/2923. Find Champion I/2923.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findChampion(self, grid: list[list[int]]) -> int:
+  def findChampion(self, grid: List[List[int]]) -> int:
     n = len(grid)
     inDegrees = [0] * n
 
@@ -12,5 +12,5 @@ def findChampion(self, grid: list[list[int]]) -> int:
         else:
           inDegrees[i] += 1
 
-    return (-1 if inDegrees.count(0) > 1
-            else inDegrees.index(0))
+    return -1 if inDegrees.count(0) > 1 \
+        else inDegrees.index(0)
diff --git a/solutions/2924. Find Champion II/2924.py b/solutions/2924. Find Champion II/2924.py
index b30cbcd0e32..5d2cef17ed9 100644
--- a/solutions/2924. Find Champion II/2924.py	
+++ b/solutions/2924. Find Champion II/2924.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def findChampion(self, n: int, edges: list[list[int]]) -> int:
+  def findChampion(self, n: int, edges: List[List[int]]) -> int:
     inDegrees = [0] * n
 
     for _, v in edges:
       inDegrees[v] += 1
 
-    return (-1 if inDegrees.count(0) > 1
-            else inDegrees.index(0))
+    return -1 if inDegrees.count(0) > 1 \
+        else inDegrees.index(0)
diff --git a/solutions/2925. Maximum Score After Applying Operations on a Tree/2925.py b/solutions/2925. Maximum Score After Applying Operations on a Tree/2925.py
index 0322e74d7b4..321790e00c3 100644
--- a/solutions/2925. Maximum Score After Applying Operations on a Tree/2925.py	
+++ b/solutions/2925. Maximum Score After Applying Operations on a Tree/2925.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def maximumScoreAfterOperations(
-      self,
-      edges: list[list[int]],
-      values: list[int],
-  ) -> int:
+  def maximumScoreAfterOperations(self, edges: List[List[int]], values: List[int]) -> int:
     tree = [[] for _ in values]
 
     for u, v in edges:
diff --git a/solutions/2926. Maximum Balanced Subsequence Sum/2926.py b/solutions/2926. Maximum Balanced Subsequence Sum/2926.py
index d13abd7ca82..9ff9faf4342 100644
--- a/solutions/2926. Maximum Balanced Subsequence Sum/2926.py	
+++ b/solutions/2926. Maximum Balanced Subsequence Sum/2926.py	
@@ -22,7 +22,7 @@ def lowbit(i: int) -> int:
 
 
 class Solution:
-  def maxBalancedSubsequenceSum(self, nums: list[int]) -> int:
+  def maxBalancedSubsequenceSum(self, nums: List[int]) -> int:
     # Let's define maxSum[i] := subsequence with the maximum sum ending in i
     # By observation:
     #    nums[i] - nums[j] >= i - j
diff --git a/solutions/2927. Distribute Candies Among Children III/2927.py b/solutions/2927. Distribute Candies Among Children III/2927.py
index 9ced73e6f2c..f0d98aa8670 100644
--- a/solutions/2927. Distribute Candies Among Children III/2927.py	
+++ b/solutions/2927. Distribute Candies Among Children III/2927.py	
@@ -14,7 +14,7 @@ def ways(n: int) -> int:
     twoChildrenExceedLimit = ways(n - 2 * limitPlusOne)
     threeChildrenExceedLimit = ways(n - 3 * limitPlusOne)
     # Principle of Inclusion-Exclusion (PIE)
-    return (ways(n)
-            - 3 * oneChildExceedsLimit
-            + 3 * twoChildrenExceedLimit
-            - threeChildrenExceedLimit)
+    return ways(n) \
+        - 3 * oneChildExceedsLimit \
+        + 3 * twoChildrenExceedLimit \
+        - threeChildrenExceedLimit
diff --git a/solutions/2928. Distribute Candies Among Children I/2928.py b/solutions/2928. Distribute Candies Among Children I/2928.py
index 9ced73e6f2c..f0d98aa8670 100644
--- a/solutions/2928. Distribute Candies Among Children I/2928.py	
+++ b/solutions/2928. Distribute Candies Among Children I/2928.py	
@@ -14,7 +14,7 @@ def ways(n: int) -> int:
     twoChildrenExceedLimit = ways(n - 2 * limitPlusOne)
     threeChildrenExceedLimit = ways(n - 3 * limitPlusOne)
     # Principle of Inclusion-Exclusion (PIE)
-    return (ways(n)
-            - 3 * oneChildExceedsLimit
-            + 3 * twoChildrenExceedLimit
-            - threeChildrenExceedLimit)
+    return ways(n) \
+        - 3 * oneChildExceedsLimit \
+        + 3 * twoChildrenExceedLimit \
+        - threeChildrenExceedLimit
diff --git a/solutions/2929. Distribute Candies Among Children II/2929.py b/solutions/2929. Distribute Candies Among Children II/2929.py
index 9ced73e6f2c..f0d98aa8670 100644
--- a/solutions/2929. Distribute Candies Among Children II/2929.py	
+++ b/solutions/2929. Distribute Candies Among Children II/2929.py	
@@ -14,7 +14,7 @@ def ways(n: int) -> int:
     twoChildrenExceedLimit = ways(n - 2 * limitPlusOne)
     threeChildrenExceedLimit = ways(n - 3 * limitPlusOne)
     # Principle of Inclusion-Exclusion (PIE)
-    return (ways(n)
-            - 3 * oneChildExceedsLimit
-            + 3 * twoChildrenExceedLimit
-            - threeChildrenExceedLimit)
+    return ways(n) \
+        - 3 * oneChildExceedsLimit \
+        + 3 * twoChildrenExceedLimit \
+        - threeChildrenExceedLimit
diff --git a/solutions/293. Flip Game/293.py b/solutions/293. Flip Game/293.py
index aa74538d5fc..ea71eeb577a 100644
--- a/solutions/293. Flip Game/293.py	
+++ b/solutions/293. Flip Game/293.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def generatePossibleNextMoves(self, currentState: str) -> list[str]:
+  def generatePossibleNextMoves(self, currentState: str) -> List[str]:
     return [currentState[:i] + '--' + currentState[i + 2:]
             for i, (a, b) in enumerate(zip(currentState, currentState[1:]))
             if a == '+' and b == '+']
diff --git a/solutions/2930. Number of Strings Which Can Be Rearranged to Contain Substring/2930.java b/solutions/2930. Number of Strings Which Can Be Rearranged to Contain Substring/2930.java
index 630cdfb1007..7f77296033c 100644
--- a/solutions/2930. Number of Strings Which Can Be Rearranged to Contain Substring/2930.java	
+++ b/solutions/2930. Number of Strings Which Can Be Rearranged to Contain Substring/2930.java	
@@ -15,16 +15,16 @@ public int stringCount(int n) {
     final long ac = modPow(24, n);
     final long bc = modPow(24, n) + n * modPow(24, n - 1);
     final long abc = modPow(23, n) + n * modPow(23, n - 1);
-    return (int) (((allCount - a - b - c + ab + ac + bc - abc) % MOD + MOD) % MOD);
+    return (int) (((allCount - a - b - c + ab + ac + bc - abc) % kMod + kMod) % kMod);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2);
+      return x * modPow(x, n - 1) % kMod;
+    return modPow(x * x % kMod, n / 2);
   }
 }
diff --git a/solutions/2930. Number of Strings Which Can Be Rearranged to Contain Substring/2930.py b/solutions/2930. Number of Strings Which Can Be Rearranged to Contain Substring/2930.py
index 657342794ea..c976d227ab9 100644
--- a/solutions/2930. Number of Strings Which Can Be Rearranged to Contain Substring/2930.py	
+++ b/solutions/2930. Number of Strings Which Can Be Rearranged to Contain Substring/2930.py	
@@ -7,13 +7,13 @@ def stringCount(self, n: int) -> int:
     #
     # By Principle of Inclusion-Exclusion (PIE):
     #   ans = allCount - a - b - c + ab + ac + bc - abc
-    MOD = 1_000_000_007
-    allCount = pow(26, n, MOD)
-    a = pow(25, n, MOD)
-    b = pow(25, n, MOD)
-    c = pow(25, n, MOD) + n * pow(25, n - 1, MOD)
-    ab = pow(24, n, MOD) + n * pow(24, n - 1, MOD)
-    ac = pow(24, n, MOD)
-    bc = pow(24, n, MOD) + n * pow(24, n - 1, MOD)
-    abc = pow(23, n, MOD) + n * pow(23, n - 1, MOD)
-    return (allCount - a - b - c + ab + ac + bc - abc) % MOD
+    kMod = 1_000_000_007
+    allCount = pow(26, n, kMod)
+    a = pow(25, n, kMod)
+    b = pow(25, n, kMod)
+    c = pow(25, n, kMod) + n * pow(25, n - 1, kMod)
+    ab = pow(24, n, kMod) + n * pow(24, n - 1, kMod)
+    ac = pow(24, n, kMod)
+    bc = pow(24, n, kMod) + n * pow(24, n - 1, kMod)
+    abc = pow(23, n, kMod) + n * pow(23, n - 1, kMod)
+    return (allCount - a - b - c + ab + ac + bc - abc) % kMod
diff --git a/solutions/2931. Maximum Spending After Buying Items/2931.py b/solutions/2931. Maximum Spending After Buying Items/2931.py
index 2a96fec2baa..9781f52a41e 100644
--- a/solutions/2931. Maximum Spending After Buying Items/2931.py	
+++ b/solutions/2931. Maximum Spending After Buying Items/2931.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def maxSpending(self, values: list[list[int]]) -> int:
+  def maxSpending(self, values: List[List[int]]) -> int:
     items = sorted(item for shop in values for item in shop)
     return sum(item * d for d, item in enumerate(items, 1))
diff --git a/solutions/2932. Maximum Strong Pair XOR I/2932.py b/solutions/2932. Maximum Strong Pair XOR I/2932.py
index c58bba9caf3..dbdfce7d697 100644
--- a/solutions/2932. Maximum Strong Pair XOR I/2932.py	
+++ b/solutions/2932. Maximum Strong Pair XOR I/2932.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: list[TrieNode | None] = [None] * 2
+    self.children: List[Optional[TrieNode]] = [None] * 2
     self.mn = math.inf
     self.mx = -math.inf
 
@@ -35,9 +35,9 @@ def getMaxXor(self, x: int) -> int:
       # node that satisfies the condition to ensure that x <= y among x and y.
       # If `node.children[toggleBit].mn <= 2 * x`, it means there's a number in
       # the node that satisfies the condition for a valid y.
-      if (node.children[toggleBit] and
-          node.children[toggleBit].mx > x and
-              node.children[toggleBit].mn <= 2 * x):
+      if node.children[toggleBit] \
+              and node.children[toggleBit].mx > x \
+              and node.children[toggleBit].mn <= 2 * x:
         maxXor = maxXor | 1 << i
         node = node.children[toggleBit]
       elif node.children[bit]:
@@ -49,7 +49,7 @@ def getMaxXor(self, x: int) -> int:
 
 class Solution:
   # Similar to 421. Maximum XOR of Two Numbers in an Array
-  def maximumStrongPairXor(self, nums: list[int]) -> int:
+  def maximumStrongPairXor(self, nums: List[int]) -> int:
     maxNum = max(nums)
     maxBit = int(math.log2(maxNum))
     bitTrie = BitTrie(maxBit)
diff --git a/solutions/2933. High-Access Employees/2933.py b/solutions/2933. High-Access Employees/2933.py
index 5f93b1ca516..dbcd5e62ce4 100644
--- a/solutions/2933. High-Access Employees/2933.py	
+++ b/solutions/2933. High-Access Employees/2933.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findHighAccessEmployees(self, access_times: list[list[str]]) -> list[str]:
+  def findHighAccessEmployees(self, access_times: List[List[str]]) -> List[str]:
     ans = set()
 
     access_times.sort()
diff --git a/solutions/2934. Minimum Operations to Maximize Last Elements in Arrays/2934.py b/solutions/2934. Minimum Operations to Maximize Last Elements in Arrays/2934.py
index e4219933897..df854383989 100644
--- a/solutions/2934. Minimum Operations to Maximize Last Elements in Arrays/2934.py	
+++ b/solutions/2934. Minimum Operations to Maximize Last Elements in Arrays/2934.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums1: list[int], nums2: list[int]) -> int:
+  def minOperations(self, nums1: List[int], nums2: List[int]) -> int:
     n = len(nums1)
     mn = min(nums1[-1], nums2[-1])
     mx = max(nums1[-1], nums2[-1])
diff --git a/solutions/2935. Maximum Strong Pair XOR II/2935.py b/solutions/2935. Maximum Strong Pair XOR II/2935.py
index c2cc2eba364..67c9f0db4c9 100644
--- a/solutions/2935. Maximum Strong Pair XOR II/2935.py	
+++ b/solutions/2935. Maximum Strong Pair XOR II/2935.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: list[TrieNode | None] = [None] * 2
+    self.children: List[Optional[TrieNode]] = [None] * 2
     self.mn = math.inf
     self.mx = -math.inf
 
@@ -35,9 +35,9 @@ def getMaxXor(self, x: int) -> int:
       # node that satisfies the condition to ensure that x <= y among x and y.
       # If `node.children[toggleBit].mn <= 2 * x`, it means there's a number in
       # the node that satisfies the condition for a valid y.
-      if (node.children[toggleBit] and
-          node.children[toggleBit].mx > x and
-              node.children[toggleBit].mn <= 2 * x):
+      if node.children[toggleBit] \
+              and node.children[toggleBit].mx > x \
+              and node.children[toggleBit].mn <= 2 * x:
         maxXor = maxXor | 1 << i
         node = node.children[toggleBit]
       elif node.children[bit]:
@@ -49,7 +49,7 @@ def getMaxXor(self, x: int) -> int:
 
 class Solution:
   # Same as 2932. Maximum Strong Pair XOR I
-  def maximumStrongPairXor(self, nums: list[int]) -> int:
+  def maximumStrongPairXor(self, nums: List[int]) -> int:
     maxNum = max(nums)
     maxBit = int(math.log2(maxNum))
     bitTrie = BitTrie(maxBit)
diff --git a/solutions/2936. Number of Equal Numbers Blocks/2936.py b/solutions/2936. Number of Equal Numbers Blocks/2936.py
index 82a33a012d9..2d76f16e0ca 100644
--- a/solutions/2936. Number of Equal Numbers Blocks/2936.py	
+++ b/solutions/2936. Number of Equal Numbers Blocks/2936.py	
@@ -15,8 +15,8 @@ def countBlocks(l: int, r: int, leftValue: int, rightValue: int) -> int:
         return 2
       m = (l + r) // 2
       midValue = nums.at(m)
-      return (countBlocks(l, m, leftValue, midValue) +
-              countBlocks(m, r, midValue, rightValue) - 1)
+      return countBlocks(l, m, leftValue, midValue) + countBlocks(m, r, midValue, rightValue) - 1
+
     # Substract nums[m], which will be counted twice.
     return countBlocks(0, nums.size() - 1,
                        nums.at(0), nums.at(nums.size() - 1))
diff --git a/solutions/2939. Maximum Xor Product/2939.java b/solutions/2939. Maximum Xor Product/2939.java
index cc64c99ec4a..7fdcf047ebf 100644
--- a/solutions/2939. Maximum Xor Product/2939.java	
+++ b/solutions/2939. Maximum Xor Product/2939.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int maximumXorProduct(long a, long b, int n) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     if (n > 0)
       for (long bit = 1L << (n - 1); bit > 0; bit >>= 1)
         // Pick a bit if it makes Math.min(a, b) larger.
@@ -8,6 +8,6 @@ public int maximumXorProduct(long a, long b, int n) {
           a ^= bit;
           b ^= bit;
         }
-    return (int) (a % MOD * (b % MOD) % MOD);
+    return (int) (a % kMod * (b % kMod) % kMod);
   }
 }
diff --git a/solutions/2939. Maximum Xor Product/2939.py b/solutions/2939. Maximum Xor Product/2939.py
index 322279c17a1..4a02c6d2599 100644
--- a/solutions/2939. Maximum Xor Product/2939.py	
+++ b/solutions/2939. Maximum Xor Product/2939.py	
@@ -1,9 +1,9 @@
 class Solution:
   def maximumXorProduct(self, a: int, b: int, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     for bit in (2**i for i in range(n)):
       # Pick a bit if it makes min(a, b) larger.
       if a * b < (a ^ bit) * (b ^ bit):
         a ^= bit
         b ^= bit
-    return a * b % MOD
+    return a * b % kMod
diff --git a/solutions/2940. Find Building Where Alice and Bob Can Meet/2940.java b/solutions/2940. Find Building Where Alice and Bob Can Meet/2940.java
index a1c940422ac..2b00b8aa8d9 100644
--- a/solutions/2940. Find Building Where Alice and Bob Can Meet/2940.java	
+++ b/solutions/2940. Find Building Where Alice and Bob Can Meet/2940.java	
@@ -65,7 +65,7 @@ private IndexedQuery[] getIndexedQueries(int[][] queries) {
       final int b = Math.max(queries[i][0], queries[i][1]);
       indexedQueries[i] = new IndexedQuery(i, a, b);
     }
-    Arrays.sort(indexedQueries, Comparator.comparing(IndexedQuery::b, Comparator.reverseOrder()));
+    Arrays.sort(indexedQueries, (a, b) -> b.b - a.b);
     return indexedQueries;
   }
 }
diff --git a/solutions/2940. Find Building Where Alice and Bob Can Meet/2940.py b/solutions/2940. Find Building Where Alice and Bob Can Meet/2940.py
index 2baa519f05b..4acaa372ebb 100644
--- a/solutions/2940. Find Building Where Alice and Bob Can Meet/2940.py	
+++ b/solutions/2940. Find Building Where Alice and Bob Can Meet/2940.py	
@@ -1,11 +1,8 @@
-from dataclasses import dataclass
-
-
-@dataclass
 class IndexedQuery:
-  queryIndex: int
-  a: int  # Alice's index
-  b: int  # Bob's index
+  def __init__(self, queryIndex: int, a: int, b: int):
+    self.queryIndex = queryIndex
+    self.a = a  # Alice's index
+    self.b = b  # Bob's index
 
   def __iter__(self):
     yield self.queryIndex
@@ -15,11 +12,7 @@ def __iter__(self):
 
 class Solution:
   # Similar to 2736. Maximum Sum Queries
-  def leftmostBuildingQueries(
-      self,
-      heights: list[int],
-      queries: list[list[int]],
-  ) -> list[int]:
+  def leftmostBuildingQueries(self, heights: List[int], queries: List[List[int]]) -> List[int]:
     ans = [-1] * len(queries)
     # Store indices (heightsIndex) of heights with heights[heightsIndex] in
     # descending order.
@@ -29,7 +22,7 @@ def leftmostBuildingQueries(
     heightsIndex = len(heights) - 1
     for queryIndex, a, b in sorted([IndexedQuery(i, min(a, b), max(a, b))
                                     for i, (a, b) in enumerate(queries)],
-                                   key=lambda x: -x.b):
+                                   key=lambda iq: -iq.b):
       if a == b or heights[a] < heights[b]:
         # 1. Alice and Bob are already in the same index (a == b) or
         # 2. Alice can jump from a -> b (heights[a] < heights[b]).
@@ -54,7 +47,7 @@ def leftmostBuildingQueries(
 
     return ans
 
-  def _lastGreater(self, A: list[int], target: int, heights: list[int]):
+  def _lastGreater(self, A: List[int], target: int, heights: List[int]):
     """
     Returns the last index i in A s.t. heights[A.get(i)] is > heights[target].
     """
diff --git a/solutions/2941. Maximum GCD-Sum of a Subarray/2941.cpp b/solutions/2941. Maximum GCD-Sum of a Subarray/2941.cpp
index af4ee414eff..d2e8ead43af 100644
--- a/solutions/2941. Maximum GCD-Sum of a Subarray/2941.cpp	
+++ b/solutions/2941. Maximum GCD-Sum of a Subarray/2941.cpp	
@@ -17,7 +17,7 @@ class Solution {
             nextStartIndexAndGcds.back().second != nextGcd)  // Skip duplicates.
           nextStartIndexAndGcds.emplace_back(startIndex, nextGcd);
       }
-      startIndexAndGcds = std::move(nextStartIndexAndGcds);
+      startIndexAndGcds = move(nextStartIndexAndGcds);
       startIndexAndGcds.emplace_back(i, nums[i]);
       for (const auto& [startIndex, gcd] : startIndexAndGcds)
         if (i - startIndex + 1 >= k)
diff --git a/solutions/2941. Maximum GCD-Sum of a Subarray/2941.py b/solutions/2941. Maximum GCD-Sum of a Subarray/2941.py
index 2681ddbde00..2f34b4785c6 100644
--- a/solutions/2941. Maximum GCD-Sum of a Subarray/2941.py	
+++ b/solutions/2941. Maximum GCD-Sum of a Subarray/2941.py	
@@ -1,16 +1,16 @@
 class Solution:
-  def maxGcdSum(self, nums: list[int], k: int) -> int:
+  def maxGcdSum(self, nums: List[int], k: int) -> int:
     ans = 0
     # [(startIndex, gcd of subarray starting at startIndex)]
     startIndexAndGcds = []
-    prefix = list(itertools.accumulate(nums, initial=0))
+    prefix = [0] + list(itertools.accumulate(nums))
 
     for i, num in enumerate(nums):
       nextStartIndexAndGcds = []
       for startIndex, gcd in startIndexAndGcds:
         nextGcd = math.gcd(gcd, nums[i])
-        if (not nextStartIndexAndGcds or
-                nextStartIndexAndGcds[-1][1] != nextGcd):  # Skip duplicates.
+        if not nextStartIndexAndGcds or \
+                nextStartIndexAndGcds[-1][1] != nextGcd:  # Skip duplicates.
           nextStartIndexAndGcds.append((startIndex, nextGcd))
       startIndexAndGcds = nextStartIndexAndGcds
       startIndexAndGcds.append((i, nums[i]))
diff --git a/solutions/2944. Minimum Number of Coins for Fruits/2944-2.java b/solutions/2944. Minimum Number of Coins for Fruits/2944-2.java
index 3042c5b2011..4e8da664b5e 100644
--- a/solutions/2944. Minimum Number of Coins for Fruits/2944-2.java	
+++ b/solutions/2944. Minimum Number of Coins for Fruits/2944-2.java	
@@ -4,10 +4,8 @@ public int minimumCoins(int[] prices) {
     int ans = 0;
     // Stores (dp[i], i), where dp[i] := the minimum number of coins to acquire
     // fruits[i:] (0-indexed).
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey)) {
-          { offer(new Pair<>(0, n)); }
-        };
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
+    minHeap.offer(new Pair<>(0, n));
 
     for (int i = n - 1; i >= 0; --i) {
       while (!minHeap.isEmpty() && minHeap.peek().getValue() > (i + 1) * 2)
diff --git a/solutions/2944. Minimum Number of Coins for Fruits/2944-2.py b/solutions/2944. Minimum Number of Coins for Fruits/2944-2.py
index dc6c7297f94..696ecd68d56 100644
--- a/solutions/2944. Minimum Number of Coins for Fruits/2944-2.py	
+++ b/solutions/2944. Minimum Number of Coins for Fruits/2944-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumCoins(self, prices: list[int]) -> int:
+  def minimumCoins(self, prices: List[int]) -> int:
     n = len(prices)
     # Stores (dp[i], i), where dp[i] is the minimum number of coins to acquire
     # fruits[i:] (0-indexed).
diff --git a/solutions/2944. Minimum Number of Coins for Fruits/2944-3.java b/solutions/2944. Minimum Number of Coins for Fruits/2944-3.java
index 98dde213a9a..1d416989c82 100644
--- a/solutions/2944. Minimum Number of Coins for Fruits/2944-3.java	
+++ b/solutions/2944. Minimum Number of Coins for Fruits/2944-3.java	
@@ -4,9 +4,8 @@ public int minimumCoins(int[] prices) {
     int ans = Integer.MAX_VALUE;
     // Stores (dp[i], i), where dp[i] := the minimum number of coins to acquire
     // fruits[i:] (0-indexed) in ascending order.
-    Deque<Pair<Integer, Integer>> minQ = new ArrayDeque<>() {
-      { offerFirst(new Pair<>(0, n)); }
-    };
+    Deque<Pair<Integer, Integer>> minQ = new ArrayDeque<>();
+    minQ.offerFirst(new Pair<>(0, n));
 
     for (int i = n - 1; i >= 0; --i) {
       while (!minQ.isEmpty() && minQ.peekFirst().getValue() > (i + 1) * 2)
diff --git a/solutions/2944. Minimum Number of Coins for Fruits/2944-3.py b/solutions/2944. Minimum Number of Coins for Fruits/2944-3.py
index a11195b28f8..e120e8e56b6 100644
--- a/solutions/2944. Minimum Number of Coins for Fruits/2944-3.py	
+++ b/solutions/2944. Minimum Number of Coins for Fruits/2944-3.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumCoins(self, prices: list[int]) -> int:
+  def minimumCoins(self, prices: List[int]) -> int:
     n = len(prices)
     ans = math.inf
     # Stores (dp[i], i), where dp[i] := the minimum number of coins to acquire
diff --git a/solutions/2944. Minimum Number of Coins for Fruits/2944.py b/solutions/2944. Minimum Number of Coins for Fruits/2944.py
index 471627ff871..430ac15807b 100644
--- a/solutions/2944. Minimum Number of Coins for Fruits/2944.py	
+++ b/solutions/2944. Minimum Number of Coins for Fruits/2944.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumCoins(self, prices: list[int]) -> int:
+  def minimumCoins(self, prices: List[int]) -> int:
     n = len(prices)
     # Convert to 0-indexed for easy computation.
     # dp[i] := the minimum number of coins to acquire fruits[i:]
diff --git a/solutions/2945. Find Maximum Non-decreasing Array Length/2945-2.py b/solutions/2945. Find Maximum Non-decreasing Array Length/2945-2.py
index 1462a184fdc..8f5a87d55cc 100644
--- a/solutions/2945. Find Maximum Non-decreasing Array Length/2945-2.py	
+++ b/solutions/2945. Find Maximum Non-decreasing Array Length/2945-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaximumLength(self, nums: list[int]) -> int:
+  def findMaximumLength(self, nums: List[int]) -> int:
     n = len(nums)
     # prefix[i] := the sum of the first i nums
     prefix = list(itertools.accumulate(nums, initial=0))
diff --git a/solutions/2945. Find Maximum Non-decreasing Array Length/2945.py b/solutions/2945. Find Maximum Non-decreasing Array Length/2945.py
index 151b567271f..cf448561a85 100644
--- a/solutions/2945. Find Maximum Non-decreasing Array Length/2945.py	
+++ b/solutions/2945. Find Maximum Non-decreasing Array Length/2945.py	
@@ -1,14 +1,14 @@
 class Solution:
-  def findMaximumLength(self, nums: list[int]) -> int:
+  def findMaximumLength(self, nums: List[int]) -> int:
     n = len(nums)
-    INF = 10_000_000_000
+    kInf = 10_000_000_000
     # prefix[i] := the sum of the first i nums
     prefix = list(itertools.accumulate(nums, initial=0))
     # dp[i] := the maximum number of elements in the increasing
     # sequence after processing the first i nums
     dp = [0] * (n + 1)
     # last[i] := the last sum after processing the first i nums
-    last = [0] + [INF] * n
+    last = [0] + [kInf] * n
 
     for i in range(n):
       j = self._findIndex(i, prefix, last)
@@ -17,7 +17,7 @@ def findMaximumLength(self, nums: list[int]) -> int:
 
     return dp[n]
 
-  def _findIndex(self, i: int, prefix: list[int], last: list[int]) -> int:
+  def _findIndex(self, i: int, prefix: List[int], last: List[int]) -> int:
     """Returns the index in [0..i].
 
     Returns the maximum index j in [0..i] s.t.
diff --git a/solutions/2946. Matrix Similarity After Cyclic Shifts/2946.py b/solutions/2946. Matrix Similarity After Cyclic Shifts/2946.py
index 41f9536c150..c12214bca25 100644
--- a/solutions/2946. Matrix Similarity After Cyclic Shifts/2946.py	
+++ b/solutions/2946. Matrix Similarity After Cyclic Shifts/2946.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def areSimilar(self, mat: list[list[int]], k: int) -> bool:
+  def areSimilar(self, mat: List[List[int]], k: int) -> bool:
     n = len(mat[0])
     for row in mat:
       for j in range(n):
diff --git a/solutions/2947. Count Beautiful Substrings I/2947.py b/solutions/2947. Count Beautiful Substrings I/2947.py
index 4c0f561ce95..956837c5136 100644
--- a/solutions/2947. Count Beautiful Substrings I/2947.py	
+++ b/solutions/2947. Count Beautiful Substrings I/2947.py	
@@ -1,6 +1,6 @@
 class Solution:
   def beautifulSubstrings(self, s: str, k: int) -> int:
-    VOWELS = 'aeiou'
+    kVowels = 'aeiou'
     root = self._getRoot(k)
     ans = 0
     vowels = 0
@@ -9,7 +9,7 @@ def beautifulSubstrings(self, s: str, k: int) -> int:
     prefixCount = collections.Counter({(0, 0): 1})
 
     for c in s:
-      if c in VOWELS:
+      if c in kVowels:
         vowelsMinusConsonants += 1
         vowels = (vowels + 1) % root
       else:
diff --git a/solutions/2948. Make Lexicographically Smallest Array by Swapping Elements/2948.java b/solutions/2948. Make Lexicographically Smallest Array by Swapping Elements/2948.java
index c6ce995069c..e652c85bd58 100644
--- a/solutions/2948. Make Lexicographically Smallest Array by Swapping Elements/2948.java	
+++ b/solutions/2948. Make Lexicographically Smallest Array by Swapping Elements/2948.java	
@@ -37,7 +37,7 @@ private Pair<Integer, Integer>[] getNumAndIndexes(int[] nums) {
     Pair<Integer, Integer>[] numAndIndexes = new Pair[nums.length];
     for (int i = 0; i < nums.length; ++i)
       numAndIndexes[i] = new Pair<>(nums[i], i);
-    Arrays.sort(numAndIndexes, Comparator.comparingInt(Pair::getKey));
+    Arrays.sort(numAndIndexes, (a, b) -> Integer.compare(a.getKey(), b.getKey()));
     return numAndIndexes;
   }
 }
diff --git a/solutions/2948. Make Lexicographically Smallest Array by Swapping Elements/2948.py b/solutions/2948. Make Lexicographically Smallest Array by Swapping Elements/2948.py
index 7c8f10be354..5e84927dd88 100644
--- a/solutions/2948. Make Lexicographically Smallest Array by Swapping Elements/2948.py	
+++ b/solutions/2948. Make Lexicographically Smallest Array by Swapping Elements/2948.py	
@@ -1,18 +1,13 @@
 class Solution:
-  def lexicographicallySmallestArray(
-      self,
-      nums: list[int],
-      limit: int,
-  ) -> list[int]:
+  def lexicographicallySmallestArray(self, nums: List[int], limit: int) -> List[int]:
     ans = [0] * len(nums)
     numAndIndexes = sorted([(num, i) for i, num in enumerate(nums)])
     # [[(num, index)]], where the difference between in each pair in each
     # `[(num, index)]` group <= `limit`
-    numAndIndexesGroups: list[list[tuple[int, int]]] = []
+    numAndIndexesGroups: List[List[Tuple[int, int]]] = []
 
     for numAndIndex in numAndIndexes:
-      if (not numAndIndexesGroups or
-              numAndIndex[0] - numAndIndexesGroups[-1][-1][0] > limit):
+      if not numAndIndexesGroups or numAndIndex[0] - numAndIndexesGroups[-1][-1][0] > limit:
         # Start a new group.
         numAndIndexesGroups.append([numAndIndex])
       else:
diff --git a/solutions/2949. Count Beautiful Substrings II/2949.py b/solutions/2949. Count Beautiful Substrings II/2949.py
index fa83b123344..15e2f638f04 100644
--- a/solutions/2949. Count Beautiful Substrings II/2949.py	
+++ b/solutions/2949. Count Beautiful Substrings II/2949.py	
@@ -1,7 +1,7 @@
 class Solution:
   # Same as 2947. Count Beautiful Substrings I
   def beautifulSubstrings(self, s: str, k: int) -> int:
-    VOWELS = 'aeiou'
+    kVowels = 'aeiou'
     root = self._getRoot(k)
     ans = 0
     vowels = 0
@@ -10,7 +10,7 @@ def beautifulSubstrings(self, s: str, k: int) -> int:
     prefixCount = collections.Counter({(0, 0): 1})
 
     for c in s:
-      if c in VOWELS:
+      if c in kVowels:
         vowelsMinusConsonants += 1
         vowels = (vowels + 1) % root
       else:
diff --git a/solutions/2951. Find the Peaks/2951.py b/solutions/2951. Find the Peaks/2951.py
index a870e093800..3738f1d2204 100644
--- a/solutions/2951. Find the Peaks/2951.py	
+++ b/solutions/2951. Find the Peaks/2951.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def findPeaks(self, mountain: list[int]) -> list[int]:
+  def findPeaks(self, mountain: List[int]) -> List[int]:
     return [i for i in range(1, len(mountain) - 1)
             if mountain[i - 1] < mountain[i] > mountain[i + 1]]
diff --git a/solutions/2952. Minimum Number of Coins to be Added/2952.py b/solutions/2952. Minimum Number of Coins to be Added/2952.py
index 06ed4efab66..4ba88d2a65b 100644
--- a/solutions/2952. Minimum Number of Coins to be Added/2952.py	
+++ b/solutions/2952. Minimum Number of Coins to be Added/2952.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 330. Patching Array
-  def minimumAddedCoins(self, coins: list[int], target: int) -> int:
+  def minimumAddedCoins(self, coins: List[int], target: int) -> int:
     ans = 0
     i = 0  # coins' index
     miss = 1  # the minimum sum in [1, n] we might miss
diff --git a/solutions/2954. Count the Number of Infection Sequences/2954.java b/solutions/2954. Count the Number of Infection Sequences/2954.java
index bd9d1370235..f38ccfbd50d 100644
--- a/solutions/2954. Count the Number of Infection Sequences/2954.java	
+++ b/solutions/2954. Count the Number of Infection Sequences/2954.java	
@@ -14,23 +14,23 @@ public int numberOfSequence(int n, int[] sick) {
       if (nonInfected == 0)
         continue;
       ans *= invFact[nonInfected];
-      ans %= MOD;
+      ans %= kMod;
       if (i > 0) {
         // There're two choices per second since the children at the two
         // endpoints can both be the infect candidates. So, there are
         // 2^{nonInfected - 1} ways to infect all children in the current
         // segment.
         ans *= modPow(2, nonInfected - 1);
-        ans %= MOD;
+        ans %= kMod;
       }
     }
 
     final int nonInfected = n - sick[sick.length - 1] - 1;
     ans *= invFact[nonInfected];
-    return (int) (ans % MOD);
+    return (int) (ans % kMod);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long[][] getFactAndInvFact(int n) {
     long[] fact = new long[n + 1];
@@ -40,9 +40,9 @@ private long[][] getFactAndInvFact(int n) {
     inv[0] = inv[1] = 1;
     for (int i = 1; i <= n; ++i) {
       if (i >= 2)
-        inv[i] = MOD - MOD / i * inv[MOD % i] % MOD;
-      fact[i] = fact[i - 1] * i % MOD;
-      invFact[i] = invFact[i - 1] * inv[i] % MOD;
+        inv[i] = kMod - kMod / i * inv[kMod % i] % kMod;
+      fact[i] = fact[i - 1] * i % kMod;
+      invFact[i] = invFact[i - 1] * inv[i] % kMod;
     }
     return new long[][] {fact, invFact};
   }
@@ -51,7 +51,7 @@ private long modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return x * modPow(x % MOD, (n - 1)) % MOD;
-    return modPow(x * x % MOD, (n / 2)) % MOD;
+      return x * modPow(x % kMod, (n - 1)) % kMod;
+    return modPow(x * x % kMod, (n / 2)) % kMod;
   }
 }
diff --git a/solutions/2954. Count the Number of Infection Sequences/2954.py b/solutions/2954. Count the Number of Infection Sequences/2954.py
index 9413dffaeb2..307e9632e67 100644
--- a/solutions/2954. Count the Number of Infection Sequences/2954.py	
+++ b/solutions/2954. Count the Number of Infection Sequences/2954.py	
@@ -1,14 +1,14 @@
 class Solution:
-  def numberOfSequence(self, n: int, sick: list[int]) -> int:
-    MOD = 1_000_000_007
+  def numberOfSequence(self, n: int, sick: List[int]) -> int:
+    kMod = 1_000_000_007
 
     @functools.lru_cache(None)
     def fact(i: int) -> int:
-      return 1 if i <= 1 else i * fact(i - 1) % MOD
+      return 1 if i <= 1 else i * fact(i - 1) % kMod
 
     @functools.lru_cache(None)
     def inv(i: int) -> int:
-      return pow(i, MOD - 2, MOD)
+      return pow(i, kMod - 2, kMod)
 
     ans = fact(n - len(sick))  # the number of infected children
     prevSick = -1
@@ -21,13 +21,13 @@ def inv(i: int) -> int:
       if nonInfected == 0:
         continue
       ans *= inv(fact(nonInfected))
-      ans %= MOD
+      ans %= kMod
       if i > 0:
         # There're two choices per second since the children at the two
         # endpoints can both be the infect candidates. So, there are
         # 2^[nonInfected - 1] ways to infect all children in the current
         # segment.
-        ans *= pow(2, nonInfected - 1, MOD)
+        ans *= pow(2, nonInfected - 1, kMod)
 
     nonInfected = n - sick[-1] - 1
-    return ans * inv(fact(nonInfected)) % MOD
+    return ans * inv(fact(nonInfected)) % kMod
diff --git a/solutions/2955. Number of Same-End Substrings/2955.py b/solutions/2955. Number of Same-End Substrings/2955.py
index 3bd0b15ae3f..683c1ce21fd 100644
--- a/solutions/2955. Number of Same-End Substrings/2955.py	
+++ b/solutions/2955. Number of Same-End Substrings/2955.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def sameEndSubstringCount(
-      self,
-      s: str,
-      queries: list[list[int]],
-  ) -> list[int]:
+  def sameEndSubstringCount(self, s: str, queries: List[List[int]]) -> List[int]:
     count = collections.Counter()
     # counts[i] := the count of s[0..i)
     counts = [count.copy()]
diff --git a/solutions/2956. Find Common Elements Between Two Arrays/2956.py b/solutions/2956. Find Common Elements Between Two Arrays/2956.py
index dbe2b10d0a9..6a44990c107 100644
--- a/solutions/2956. Find Common Elements Between Two Arrays/2956.py	
+++ b/solutions/2956. Find Common Elements Between Two Arrays/2956.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def findIntersectionValues(
-      self,
-      nums1: list[int],
-      nums2: list[int],
-  ) -> list[int]:
+  def findIntersectionValues(self, nums1: List[int], nums2: List[int]) -> List[int]:
     nums1Set = set(nums1)
     nums2Set = set(nums2)
     return [sum(num in nums2Set for num in nums1),
diff --git a/solutions/2958. Length of Longest Subarray With at Most K Frequency/2958.py b/solutions/2958. Length of Longest Subarray With at Most K Frequency/2958.py
index 97036c5e4ef..65f1060d64b 100644
--- a/solutions/2958. Length of Longest Subarray With at Most K Frequency/2958.py	
+++ b/solutions/2958. Length of Longest Subarray With at Most K Frequency/2958.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSubarrayLength(self, nums: list[int], k: int) -> int:
+  def maxSubarrayLength(self, nums: List[int], k: int) -> int:
     ans = 0
     count = collections.Counter()
 
diff --git a/solutions/2959. Number of Possible Sets of Closing Branches/2959.py b/solutions/2959. Number of Possible Sets of Closing Branches/2959.py
index 087678d5235..50e00d3b04a 100644
--- a/solutions/2959. Number of Possible Sets of Closing Branches/2959.py	
+++ b/solutions/2959. Number of Possible Sets of Closing Branches/2959.py	
@@ -1,20 +1,10 @@
 class Solution:
-  def numberOfSets(
-      self,
-      n: int,
-      maxDistance: int,
-      roads: list[list[int]],
-  ) -> int:
+  def numberOfSets(self, n: int, maxDistance: int, roads: List[List[int]]) -> int:
     return sum(self._floydWarshall(n, maxDistance, roads, mask) <= maxDistance
                for mask in range(1 << n))
 
-  def _floydWarshall(
-      self,
-      n: int,
-      maxDistanceThreshold: int,
-      roads: list[list[int]],
-      mask: int,
-  ) -> list[list[int]]:
+  def _floydWarshall(self, n: int, maxDistanceThreshold: int,
+                     roads: List[List[int]], mask: int) -> List[List[int]]:
     """
     Returns the maximum distance between any two branches, where the mask
     represents the selected branches.
diff --git a/solutions/296. Best Meeting Point/296.py b/solutions/296. Best Meeting Point/296.py
index 4b05ae71680..e2fd0525cb8 100644
--- a/solutions/296. Best Meeting Point/296.py	
+++ b/solutions/296. Best Meeting Point/296.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minTotalDistance(self, grid: list[list[int]]) -> int:
+  def minTotalDistance(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
     # i indices s.t. grid[i][j] == 1
@@ -7,7 +7,7 @@ def minTotalDistance(self, grid: list[list[int]]) -> int:
     # j indices s.t. grid[i][j] == 1
     J = [j for j in range(n) for i in range(m) if grid[i][j]]
 
-    def minTotalDistance(grid: list[int]) -> int:
+    def minTotalDistance(grid: List[int]) -> int:
       summ = 0
       i = 0
       j = len(grid) - 1
diff --git a/solutions/2960. Count Tested Devices After Test Operations/2960.py b/solutions/2960. Count Tested Devices After Test Operations/2960.py
index e74f8c07368..4791c670b64 100644
--- a/solutions/2960. Count Tested Devices After Test Operations/2960.py	
+++ b/solutions/2960. Count Tested Devices After Test Operations/2960.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countTestedDevices(self, batteryPercentages: list[int]) -> int:
+  def countTestedDevices(self, batteryPercentages: List[int]) -> int:
     ans = 0
 
     for batteryPercentage in batteryPercentages:
diff --git a/solutions/2961. Double Modular Exponentiation/2961.py b/solutions/2961. Double Modular Exponentiation/2961.py
index e736f255c6f..3878962e9a7 100644
--- a/solutions/2961. Double Modular Exponentiation/2961.py	
+++ b/solutions/2961. Double Modular Exponentiation/2961.py	
@@ -1,8 +1,4 @@
 class Solution:
-  def getGoodIndices(
-      self,
-      variables: list[list[int]],
-      target: int,
-  ) -> list[int]:
+  def getGoodIndices(self, variables: List[List[int]], target: int) -> List[int]:
     return [i for i, (a, b, c, m) in enumerate(variables)
             if pow(pow(a, b, 10), c, m) == target]
diff --git a/solutions/2962. Count Subarrays Where Max Element Appears at Least K Times/2962.py b/solutions/2962. Count Subarrays Where Max Element Appears at Least K Times/2962.py
index 1c78504c3c5..04ee1730912 100644
--- a/solutions/2962. Count Subarrays Where Max Element Appears at Least K Times/2962.py	
+++ b/solutions/2962. Count Subarrays Where Max Element Appears at Least K Times/2962.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countSubarrays(self, nums: list[int], k: int) -> int:
+  def countSubarrays(self, nums: List[int], k: int) -> int:
     maxNum = max(nums)
     ans = 0
     count = 0
diff --git a/solutions/2963. Count the Number of Good Partitions/2963.java b/solutions/2963. Count the Number of Good Partitions/2963.java
index 03b53293a30..557b2552c42 100644
--- a/solutions/2963. Count the Number of Good Partitions/2963.java	
+++ b/solutions/2963. Count the Number of Good Partitions/2963.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numberOfGoodPartitions(int[] nums) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int ans = 1;
 
     // lastSeen[num] := the index of the last time `num` appeared
@@ -17,7 +17,7 @@ public int numberOfGoodPartitions(int[] nums) {
       if (i > maxRight)
         // Start a new partition that starts from nums[i].
         // Each partition doubles the total number of good partitions.
-        ans = (int) ((ans * 2L) % MOD);
+        ans = (int) ((ans * 2L) % kMod);
       maxRight = Math.max(maxRight, lastSeen.get(nums[i]));
     }
 
diff --git a/solutions/2963. Count the Number of Good Partitions/2963.py b/solutions/2963. Count the Number of Good Partitions/2963.py
index b04018b146a..ebca68f0104 100644
--- a/solutions/2963. Count the Number of Good Partitions/2963.py	
+++ b/solutions/2963. Count the Number of Good Partitions/2963.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def numberOfGoodPartitions(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
+  def numberOfGoodPartitions(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
     ans = 1
     # lastSeen[num] := the index of the last time `num` appeared
     lastSeen = {}
@@ -15,7 +15,7 @@ def numberOfGoodPartitions(self, nums: list[int]) -> int:
       if i > maxRight:
         # Start a new partition that starts from nums[i].
         # Each partition doubles the total number of good partitions.
-        ans = ans * 2 % MOD
+        ans = ans * 2 % kMod
       maxRight = max(maxRight, lastSeen[num])
 
     return ans
diff --git a/solutions/2964. Number of Divisible Triplet Sums/2964.py b/solutions/2964. Number of Divisible Triplet Sums/2964.py
index b0c3fec42e2..cb613d23935 100644
--- a/solutions/2964. Number of Divisible Triplet Sums/2964.py	
+++ b/solutions/2964. Number of Divisible Triplet Sums/2964.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Similar to 1995. Count Special Quadruplets
-  def divisibleTripletCount(self, nums: list[int], d: int) -> int:
+  def divisibleTripletCount(self, nums: List[int], d: int) -> int:
     ans = 0
     count = collections.Counter()
 
diff --git a/solutions/2965. Find Missing and Repeated Values/2965.py b/solutions/2965. Find Missing and Repeated Values/2965.py
index 88aa5602a58..a46daed276a 100644
--- a/solutions/2965. Find Missing and Repeated Values/2965.py	
+++ b/solutions/2965. Find Missing and Repeated Values/2965.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMissingAndRepeatedValues(self, grid: list[list[int]]) -> list[int]:
+  def findMissingAndRepeatedValues(self, grid: List[List[int]]) -> List[int]:
     count = [1] + [0] * len(grid)**2  # padding for 1-indexed
 
     for row in grid:
diff --git a/solutions/2966. Divide Array Into Arrays With Max Difference/2966.py b/solutions/2966. Divide Array Into Arrays With Max Difference/2966.py
index a85a4e9819b..23d83872818 100644
--- a/solutions/2966. Divide Array Into Arrays With Max Difference/2966.py	
+++ b/solutions/2966. Divide Array Into Arrays With Max Difference/2966.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def divideArray(self, nums: list[int], k: int) -> list[list[int]]:
+  def divideArray(self, nums: List[int], k: int) -> List[List[int]]:
     ans = []
 
     nums.sort()
diff --git a/solutions/2967. Minimum Cost to Make Array Equalindromic/2967.cpp b/solutions/2967. Minimum Cost to Make Array Equalindromic/2967.cpp
index 026aa060334..d596dd7438c 100644
--- a/solutions/2967. Minimum Cost to Make Array Equalindromic/2967.cpp	
+++ b/solutions/2967. Minimum Cost to Make Array Equalindromic/2967.cpp	
@@ -12,8 +12,8 @@ class Solution {
   // Returns the cost to change all the numbers to `palindrome`.
   long cost(const vector<int>& nums, int palindrome) {
     return accumulate(nums.begin(), nums.end(), 0L,
-                      [palindrome](long acc, int num) {
-      return acc + abs(palindrome - num);
+                      [palindrome](long subtotal, int num) {
+      return subtotal + abs(palindrome - num);
     });
   }
 
diff --git a/solutions/2967. Minimum Cost to Make Array Equalindromic/2967.py b/solutions/2967. Minimum Cost to Make Array Equalindromic/2967.py
index 078b7ea6043..2c96b466302 100644
--- a/solutions/2967. Minimum Cost to Make Array Equalindromic/2967.py	
+++ b/solutions/2967. Minimum Cost to Make Array Equalindromic/2967.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumCost(self, nums: list[int]) -> int:
+  def minimumCost(self, nums: List[int]) -> int:
     nums.sort()
     median = nums[len(nums) // 2]
     nextPalindrome = self._getPalindrome(median, delta=1)
@@ -7,7 +7,7 @@ def minimumCost(self, nums: list[int]) -> int:
     return min(self._cost(nums, nextPalindrome),
                self._cost(nums, prevPalindrome))
 
-  def _cost(self, nums: list[int], palindrome: int) -> int:
+  def _cost(self, nums: List[int], palindrome: int) -> int:
     """Returns the cost to change all the numbers to `palindrome`."""
     return sum(abs(palindrome - num) for num in nums)
 
diff --git a/solutions/2968. Apply Operations to Maximize Frequency Score/2968.py b/solutions/2968. Apply Operations to Maximize Frequency Score/2968.py
index ffc4e3acf4b..747000a76a2 100644
--- a/solutions/2968. Apply Operations to Maximize Frequency Score/2968.py	
+++ b/solutions/2968. Apply Operations to Maximize Frequency Score/2968.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxFrequencyScore(self, nums: list[int], k: int) -> int:
+  def maxFrequencyScore(self, nums: List[int], k: int) -> int:
     nums.sort()
     ans = 0
     cost = 0
diff --git a/solutions/2969. Minimum Number of Coins for Fruits II/2969-2.java b/solutions/2969. Minimum Number of Coins for Fruits II/2969-2.java
index 951a374612b..b51ee80c14c 100644
--- a/solutions/2969. Minimum Number of Coins for Fruits II/2969-2.java	
+++ b/solutions/2969. Minimum Number of Coins for Fruits II/2969-2.java	
@@ -5,10 +5,8 @@ public int minimumCoins(int[] prices) {
     int ans = 0;
     // Stores (dp[i], i), where dp[i] := the minimum number of coins to acquire
     // fruits[i:] (0-indexed).
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey)) {
-          { offer(new Pair<>(0, n)); }
-        };
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
+    minHeap.offer(new Pair<>(0, n));
 
     for (int i = n - 1; i >= 0; --i) {
       while (!minHeap.isEmpty() && minHeap.peek().getValue() > (i + 1) * 2)
diff --git a/solutions/2969. Minimum Number of Coins for Fruits II/2969-2.py b/solutions/2969. Minimum Number of Coins for Fruits II/2969-2.py
index fdf62aea235..37ed472e77a 100644
--- a/solutions/2969. Minimum Number of Coins for Fruits II/2969-2.py	
+++ b/solutions/2969. Minimum Number of Coins for Fruits II/2969-2.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 2944. Minimum Number of Coins for Fruits
-  def minimumCoins(self, prices: list[int]) -> int:
+  def minimumCoins(self, prices: List[int]) -> int:
     n = len(prices)
     # Stores (dp[i], i), where dp[i] is the minimum number of coins to acquire
     # fruits[i:] (0-indexed).
diff --git a/solutions/2969. Minimum Number of Coins for Fruits II/2969-3.java b/solutions/2969. Minimum Number of Coins for Fruits II/2969-3.java
index 6ee92ebdbdf..18e3cc55f8c 100644
--- a/solutions/2969. Minimum Number of Coins for Fruits II/2969-3.java	
+++ b/solutions/2969. Minimum Number of Coins for Fruits II/2969-3.java	
@@ -5,9 +5,8 @@ public int minimumCoins(int[] prices) {
     int ans = Integer.MAX_VALUE;
     // Stores (dp[i], i), where dp[i] := the minimum number of coins to acquire
     // fruits[i:] (0-indexed) in ascending order.
-    Deque<Pair<Integer, Integer>> minQ = new ArrayDeque<>() {
-      { offerFirst(new Pair<>(0, n)); }
-    };
+    Deque<Pair<Integer, Integer>> minQ = new ArrayDeque<>();
+    minQ.offerFirst(new Pair<>(0, n));
 
     for (int i = n - 1; i >= 0; --i) {
       while (!minQ.isEmpty() && minQ.peekFirst().getValue() > (i + 1) * 2)
diff --git a/solutions/2969. Minimum Number of Coins for Fruits II/2969-3.py b/solutions/2969. Minimum Number of Coins for Fruits II/2969-3.py
index 66c294623a8..2b62821d39b 100644
--- a/solutions/2969. Minimum Number of Coins for Fruits II/2969-3.py	
+++ b/solutions/2969. Minimum Number of Coins for Fruits II/2969-3.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 2944. Minimum Number of Coins for Fruits
-  def minimumCoins(self, prices: list[int]) -> int:
+  def minimumCoins(self, prices: List[int]) -> int:
     n = len(prices)
     ans = math.inf
     # Stores (dp[i], i), where dp[i] := the minimum number of coins to acquire
diff --git a/solutions/2969. Minimum Number of Coins for Fruits II/2969.py b/solutions/2969. Minimum Number of Coins for Fruits II/2969.py
index c705b0bbcbe..cc94cc15c7d 100644
--- a/solutions/2969. Minimum Number of Coins for Fruits II/2969.py	
+++ b/solutions/2969. Minimum Number of Coins for Fruits II/2969.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 2944. Minimum Number of Coins for Fruits
-  def minimumCoins(self, prices: list[int]) -> int:
+  def minimumCoins(self, prices: List[int]) -> int:
     n = len(prices)
     # Convert to 0-indexed for easy computation.
     # dp[i] := the minimum number of coins to acquire fruits[i:]
diff --git a/solutions/297. Serialize and Deserialize Binary Tree/297-2.java b/solutions/297. Serialize and Deserialize Binary Tree/297-2.java
index 1ebd725870f..5fbdb49aef7 100644
--- a/solutions/297. Serialize and Deserialize Binary Tree/297-2.java	
+++ b/solutions/297. Serialize and Deserialize Binary Tree/297-2.java	
@@ -9,7 +9,7 @@ public String serialize(TreeNode root) {
   // Decodes your encoded data to tree.
   public TreeNode deserialize(String data) {
     final String[] vals = data.split(" ");
-    Queue<String> q = new ArrayDeque<>(List.of(vals));
+    Queue<String> q = new ArrayDeque<>(Arrays.asList(vals));
     return preorder(q);
   }
 
diff --git a/solutions/2970. Count the Number of Incremovable Subarrays I/2970-2.java b/solutions/2970. Count the Number of Incremovable Subarrays I/2970-2.java
index e456d776a04..2baf0c3254c 100644
--- a/solutions/2970. Count the Number of Incremovable Subarrays I/2970-2.java	
+++ b/solutions/2970. Count the Number of Incremovable Subarrays I/2970-2.java	
@@ -35,8 +35,8 @@ private int getStartIndexOfSuffix(int[] nums) {
     return 0;
   }
 
-  private int firstGreater(int[] arr, int startIndex, int target) {
-    final int i = Arrays.binarySearch(arr, startIndex, arr.length, target + 1);
+  private int firstGreater(int[] A, int startIndex, int target) {
+    final int i = Arrays.binarySearch(A, startIndex, A.length, target + 1);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/2970. Count the Number of Incremovable Subarrays I/2970-2.py b/solutions/2970. Count the Number of Incremovable Subarrays I/2970-2.py
index 67a6cee05b1..f7ed01ae480 100644
--- a/solutions/2970. Count the Number of Incremovable Subarrays I/2970-2.py	
+++ b/solutions/2970. Count the Number of Incremovable Subarrays I/2970-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def incremovableSubarrayCount(self, nums: list[int]) -> int:
+  def incremovableSubarrayCount(self, nums: List[int]) -> int:
     n = len(nums)
     startIndex = self._getStartIndexOfSuffix(nums)
     # If the complete array is strictly increasing, the total number of ways we
@@ -25,7 +25,7 @@ def incremovableSubarrayCount(self, nums: list[int]) -> int:
 
     return ans
 
-  def _getStartIndexOfSuffix(self, nums: list[int]) -> int:
+  def _getStartIndexOfSuffix(self, nums: List[int]) -> int:
     for i in range(len(nums) - 2, -1, -1):
       if nums[i] >= nums[i + 1]:
         return i + 1
diff --git a/solutions/2970. Count the Number of Incremovable Subarrays I/2970.java b/solutions/2970. Count the Number of Incremovable Subarrays I/2970.java
index b25c345f05b..1998ea82f46 100644
--- a/solutions/2970. Count the Number of Incremovable Subarrays I/2970.java	
+++ b/solutions/2970. Count the Number of Incremovable Subarrays I/2970.java	
@@ -33,8 +33,8 @@ private int getStartIndexOfSuffix(int[] nums) {
     return 0;
   }
 
-  private int firstGreater(int[] arr, int startIndex, int target) {
-    final int i = Arrays.binarySearch(arr, startIndex, arr.length, target + 1);
+  private int firstGreater(int[] A, int startIndex, int target) {
+    final int i = Arrays.binarySearch(A, startIndex, A.length, target + 1);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/2970. Count the Number of Incremovable Subarrays I/2970.py b/solutions/2970. Count the Number of Incremovable Subarrays I/2970.py
index 781252f2a3c..7d7bb206de7 100644
--- a/solutions/2970. Count the Number of Incremovable Subarrays I/2970.py	
+++ b/solutions/2970. Count the Number of Incremovable Subarrays I/2970.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def incremovableSubarrayCount(self, nums: list[int]) -> int:
+  def incremovableSubarrayCount(self, nums: List[int]) -> int:
     n = len(nums)
     startIndex = self._getStartIndexOfSuffix(nums)
     # If the complete array is strictly increasing, the total number of ways we
@@ -22,7 +22,7 @@ def incremovableSubarrayCount(self, nums: list[int]) -> int:
 
     return ans
 
-  def _getStartIndexOfSuffix(self, nums: list[int]) -> int:
+  def _getStartIndexOfSuffix(self, nums: List[int]) -> int:
     for i in range(len(nums) - 2, -1, -1):
       if nums[i] >= nums[i + 1]:
         return i + 1
diff --git a/solutions/2971. Find Polygon With the Largest Perimeter/2971.py b/solutions/2971. Find Polygon With the Largest Perimeter/2971.py
index b3ee84c591c..20b261d0f2a 100644
--- a/solutions/2971. Find Polygon With the Largest Perimeter/2971.py	
+++ b/solutions/2971. Find Polygon With the Largest Perimeter/2971.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestPerimeter(self, nums: list[int]) -> int:
+  def largestPerimeter(self, nums: List[int]) -> int:
     prefix = sum(nums)
 
     for num in sorted(nums, reverse=True):
diff --git a/solutions/2972. Count the Number of Incremovable Subarrays II/2972-2.java b/solutions/2972. Count the Number of Incremovable Subarrays II/2972-2.java
index 151a5f51e0b..5a7342bb89c 100644
--- a/solutions/2972. Count the Number of Incremovable Subarrays II/2972-2.java	
+++ b/solutions/2972. Count the Number of Incremovable Subarrays II/2972-2.java	
@@ -36,8 +36,8 @@ private int getStartIndexOfSuffix(int[] nums) {
     return 0;
   }
 
-  private int firstGreater(int[] arr, int startIndex, int target) {
-    final int i = Arrays.binarySearch(arr, startIndex, arr.length, target + 1);
+  private int firstGreater(int[] A, int startIndex, int target) {
+    final int i = Arrays.binarySearch(A, startIndex, A.length, target + 1);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/2972. Count the Number of Incremovable Subarrays II/2972-2.py b/solutions/2972. Count the Number of Incremovable Subarrays II/2972-2.py
index 8f59b618913..d9a2d0b0244 100644
--- a/solutions/2972. Count the Number of Incremovable Subarrays II/2972-2.py	
+++ b/solutions/2972. Count the Number of Incremovable Subarrays II/2972-2.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 2970. Count the Number of Incremovable Subarrays I
-  def incremovableSubarrayCount(self, nums: list[int]) -> int:
+  def incremovableSubarrayCount(self, nums: List[int]) -> int:
     n = len(nums)
     startIndex = self._getStartIndexOfSuffix(nums)
     # If the complete array is strictly increasing, the total number of ways we
@@ -26,7 +26,7 @@ def incremovableSubarrayCount(self, nums: list[int]) -> int:
 
     return ans
 
-  def _getStartIndexOfSuffix(self, nums: list[int]) -> int:
+  def _getStartIndexOfSuffix(self, nums: List[int]) -> int:
     for i in range(len(nums) - 2, -1, -1):
       if nums[i] >= nums[i + 1]:
         return i + 1
diff --git a/solutions/2972. Count the Number of Incremovable Subarrays II/2972.java b/solutions/2972. Count the Number of Incremovable Subarrays II/2972.java
index ac5b7730fac..61f22b103c0 100644
--- a/solutions/2972. Count the Number of Incremovable Subarrays II/2972.java	
+++ b/solutions/2972. Count the Number of Incremovable Subarrays II/2972.java	
@@ -34,8 +34,8 @@ private int getStartIndexOfSuffix(int[] nums) {
     return 0;
   }
 
-  private int firstGreater(int[] arr, int startIndex, int target) {
-    final int i = Arrays.binarySearch(arr, startIndex, arr.length, target + 1);
+  private int firstGreater(int[] A, int startIndex, int target) {
+    final int i = Arrays.binarySearch(A, startIndex, A.length, target + 1);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/2972. Count the Number of Incremovable Subarrays II/2972.py b/solutions/2972. Count the Number of Incremovable Subarrays II/2972.py
index f6afcb1be90..7584a7e940f 100644
--- a/solutions/2972. Count the Number of Incremovable Subarrays II/2972.py	
+++ b/solutions/2972. Count the Number of Incremovable Subarrays II/2972.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 2970. Count the Number of Incremovable Subarrays I
-  def incremovableSubarrayCount(self, nums: list[int]) -> int:
+  def incremovableSubarrayCount(self, nums: List[int]) -> int:
     n = len(nums)
     startIndex = self._getStartIndexOfSuffix(nums)
     # If the complete array is strictly increasing, the total number of ways we
@@ -23,7 +23,7 @@ def incremovableSubarrayCount(self, nums: list[int]) -> int:
 
     return ans
 
-  def _getStartIndexOfSuffix(self, nums: list[int]) -> int:
+  def _getStartIndexOfSuffix(self, nums: List[int]) -> int:
     for i in range(len(nums) - 2, -1, -1):
       if nums[i] >= nums[i + 1]:
         return i + 1
diff --git a/solutions/2973. Find Number of Coins to Place in Tree Nodes/2973.py b/solutions/2973. Find Number of Coins to Place in Tree Nodes/2973.py
index 65f038e3e23..e0036cb25ab 100644
--- a/solutions/2973. Find Number of Coins to Place in Tree Nodes/2973.py	
+++ b/solutions/2973. Find Number of Coins to Place in Tree Nodes/2973.py	
@@ -28,7 +28,7 @@ def maxProduct(self) -> int:
 
 
 class Solution:
-  def placedCoins(self, edges: list[list[int]], cost: list[int]) -> list[int]:
+  def placedCoins(self, edges: List[List[int]], cost: List[int]) -> List[int]:
     n = len(cost)
     ans = [0] * n
     tree = [[] for _ in range(n)]
diff --git a/solutions/2974. Minimum Number Game/2974.py b/solutions/2974. Minimum Number Game/2974.py
index 8033b94e9f4..072fc212619 100644
--- a/solutions/2974. Minimum Number Game/2974.py	
+++ b/solutions/2974. Minimum Number Game/2974.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberGame(self, nums: list[int]) -> list[int]:
+  def numberGame(self, nums: List[int]) -> List[int]:
     nums.sort()
     return [nums[i + 1] if i % 2 == 0
             else nums[i - 1]
diff --git a/solutions/2975. Maximum Square Area by Removing Fences From a Field/2975.java b/solutions/2975. Maximum Square Area by Removing Fences From a Field/2975.java
index 887c1b14258..72a4c26b3cd 100644
--- a/solutions/2975. Maximum Square Area by Removing Fences From a Field/2975.java	
+++ b/solutions/2975. Maximum Square Area by Removing Fences From a Field/2975.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int maximizeSquareArea(int m, int n, int[] hFences, int[] vFences) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
 
     hFences = Arrays.copyOf(hFences, hFences.length + 2);
     vFences = Arrays.copyOf(vFences, vFences.length + 2);
@@ -21,7 +21,7 @@ public int maximizeSquareArea(int m, int n, int[] hFences, int[] vFences) {
       if (vGaps.contains(hGap))
         maxGap = Math.max(maxGap, hGap);
 
-    return maxGap == -1 ? -1 : (int) ((long) maxGap * maxGap % MOD);
+    return maxGap == -1 ? -1 : (int) ((long) maxGap * maxGap % kMod);
   }
 
   private Set<Integer> getGaps(int[] fences) {
diff --git a/solutions/2975. Maximum Square Area by Removing Fences From a Field/2975.py b/solutions/2975. Maximum Square Area by Removing Fences From a Field/2975.py
index 35ee5d20778..32fa01ff080 100644
--- a/solutions/2975. Maximum Square Area by Removing Fences From a Field/2975.py	
+++ b/solutions/2975. Maximum Square Area by Removing Fences From a Field/2975.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def maximizeSquareArea(
-      self,
-      m: int,
-      n: int,
-      hFences: list[int],
-      vFences: list[int],
-  ) -> int:
+  def maximizeSquareArea(self, m: int, n: int, hFences: List[int], vFences: List[int]) -> int:
     hFences = sorted(hFences + [1, m])
     vFences = sorted(vFences + [1, n])
     hGaps = {hFences[i] - hFences[j]
diff --git a/solutions/2976. Minimum Cost to Convert String I/2976.py b/solutions/2976. Minimum Cost to Convert String I/2976.py
index 882c474a0b6..13ff0788117 100644
--- a/solutions/2976. Minimum Cost to Convert String I/2976.py	
+++ b/solutions/2976. Minimum Cost to Convert String I/2976.py	
@@ -1,12 +1,5 @@
 class Solution:
-  def minimumCost(
-      self,
-      source: str,
-      target: str,
-      original: list[str],
-      changed: list[str],
-      cost: list[int],
-  ) -> int:
+  def minimumCost(self, source: str, target: str, original: List[str], changed: List[str], cost: List[int]) -> int:
     ans = 0
     # dist[u][v] := the minimum distance to change ('a' + u) to ('a' + v)
     dist = [[math.inf] * 26 for _ in range(26)]
diff --git a/solutions/2977. Minimum Cost to Convert String II/2977.py b/solutions/2977. Minimum Cost to Convert String II/2977.py
index 0a2b1ec75e1..e561c966ed9 100644
--- a/solutions/2977. Minimum Cost to Convert String II/2977.py	
+++ b/solutions/2977. Minimum Cost to Convert String II/2977.py	
@@ -1,12 +1,5 @@
 class Solution:
-  def minimumCost(
-      self,
-      source: str,
-      target: str,
-      original: list[str],
-      changed: list[str],
-      cost: list[int],
-  ) -> int:
+  def minimumCost(self, source: str, target: str, original: List[str], changed: List[str], cost: List[int]) -> int:
     subLengths = set(len(s) for s in original)
     subToId = self._getSubToId(original, changed)
     subCount = len(subToId)
@@ -50,7 +43,7 @@ def minimumCost(
 
     return -1 if dp[len(source)] == math.inf else dp[len(source)]
 
-  def _getSubToId(self, original: str, changed: str) -> dict[str, int]:
+  def _getSubToId(self, original: str, changed: str) -> Dict[str, int]:
     subToId = {}
     for s in original + changed:
       if s not in subToId:
diff --git a/solutions/298. Binary Tree Longest Consecutive Sequence/298.py b/solutions/298. Binary Tree Longest Consecutive Sequence/298.py
index 6acbc9ed6e6..72d17655ad3 100644
--- a/solutions/298. Binary Tree Longest Consecutive Sequence/298.py	
+++ b/solutions/298. Binary Tree Longest Consecutive Sequence/298.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def longestConsecutive(self, root: TreeNode | None) -> int:
+  def longestConsecutive(self, root: Optional[TreeNode]) -> int:
     if not root:
       return 0
 
-    def dfs(root: TreeNode | None, target: int, length: int, maxLength: int) -> int:
+    def dfs(root: Optional[TreeNode], target: int, length: int, maxLength: int) -> int:
       if not root:
         return maxLength
       if root.val == target:
diff --git a/solutions/2980. Check if Bitwise OR Has Trailing Zeros/2980.py b/solutions/2980. Check if Bitwise OR Has Trailing Zeros/2980.py
index f2c14e932ef..8263ea835c1 100644
--- a/solutions/2980. Check if Bitwise OR Has Trailing Zeros/2980.py	
+++ b/solutions/2980. Check if Bitwise OR Has Trailing Zeros/2980.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def hasTrailingZeros(self, nums: list[int]) -> bool:
+  def hasTrailingZeros(self, nums: List[int]) -> bool:
     return sum(num % 2 == 0 for num in nums) >= 2
diff --git a/solutions/2981. Find Longest Special Substring That Occurs Thrice I/2981.py b/solutions/2981. Find Longest Special Substring That Occurs Thrice I/2981.py
index fc67361cacd..29e9623ab36 100644
--- a/solutions/2981. Find Longest Special Substring That Occurs Thrice I/2981.py	
+++ b/solutions/2981. Find Longest Special Substring That Occurs Thrice I/2981.py	
@@ -15,7 +15,7 @@ def maximumLength(self, s: str) -> int:
         counts[ord(c) - ord('a')][runningLen] += 1
         prevLetter = c
 
-    def getMaxFreq(count: list[int]) -> int:
+    def getMaxFreq(count: List[int]) -> int:
       """Returns the maximum frequency that occurs more than three times."""
       times = 0
       for freq in range(n, 0, -1):
diff --git a/solutions/2982. Find Longest Special Substring That Occurs Thrice II/2982.py b/solutions/2982. Find Longest Special Substring That Occurs Thrice II/2982.py
index fc67361cacd..29e9623ab36 100644
--- a/solutions/2982. Find Longest Special Substring That Occurs Thrice II/2982.py	
+++ b/solutions/2982. Find Longest Special Substring That Occurs Thrice II/2982.py	
@@ -15,7 +15,7 @@ def maximumLength(self, s: str) -> int:
         counts[ord(c) - ord('a')][runningLen] += 1
         prevLetter = c
 
-    def getMaxFreq(count: list[int]) -> int:
+    def getMaxFreq(count: List[int]) -> int:
       """Returns the maximum frequency that occurs more than three times."""
       times = 0
       for freq in range(n, 0, -1):
diff --git a/solutions/2983. Palindrome Rearrangement Queries/2983.py b/solutions/2983. Palindrome Rearrangement Queries/2983.py
index d865dd26b3e..694d59aa4af 100644
--- a/solutions/2983. Palindrome Rearrangement Queries/2983.py	
+++ b/solutions/2983. Palindrome Rearrangement Queries/2983.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def canMakePalindromeQueries(
-      self,
-      s: str,
-      queries: list[list[int]],
-  ) -> list[bool]:
+  def canMakePalindromeQueries(self, s: str, queries: List[List[int]]) -> List[bool]:
     n = len(s)
     # mirroredDiffs[i] := the number of different letters between the first i
     # letters of s[0..n / 2) and the first i letters of s[n / 2..n)[::-1]
@@ -12,7 +8,7 @@ def canMakePalindromeQueries(
     counts = self._getCounts(s)
     ans = []
 
-    def subtractArrays(a: list[int], b: list[int]):
+    def subtractArrays(a: List[int], b: List[int]):
       return [x - y for x, y in zip(a, b)]
 
     for a, b, c, d in queries:
@@ -26,11 +22,10 @@ def subtractArrays(a: list[int], b: list[int]):
       rc = n - c  # the reflected index of c in s[n / 2..n)
       rd = n - d  # the reflected index of d in s[n / 2..n)
       # No difference is allowed outside the query ranges.
-      if ((min(a, rd) > 0 and mirroredDiffs[min(a, rd)] > 0) or
-         (n // 2 > max(b, rc) and
-          mirroredDiffs[n // 2] - mirroredDiffs[max(b, rc)] > 0) or
-         (rd > b and mirroredDiffs[rd] - mirroredDiffs[b] > 0) or
-         (a > rc and mirroredDiffs[a] - mirroredDiffs[rc] > 0)):
+      if (min(a, rd) > 0 and mirroredDiffs[min(a, rd)] > 0) or \
+         (n // 2 > max(b, rc) and mirroredDiffs[n // 2] - mirroredDiffs[max(b, rc)] > 0) or \
+         (rd > b and mirroredDiffs[rd] - mirroredDiffs[b] > 0) or \
+         (a > rc and mirroredDiffs[a] - mirroredDiffs[rc] > 0):
         ans.append(False)
       else:
         # The `count` map of the intersection of [a, b) and [rd, rc) in
@@ -56,7 +51,7 @@ def subtractArrays(a: list[int], b: list[int]):
 
     return ans
 
-  def _getMirroredDiffs(self, s: str) -> list[int]:
+  def _getMirroredDiffs(self, s: str) -> List[int]:
     diffs = [0]
     for i, j in zip(range(len(s)), reversed(range(len(s)))):
       if i >= j:
@@ -64,7 +59,7 @@ def _getMirroredDiffs(self, s: str) -> list[int]:
       diffs.append(diffs[-1] + (s[i] != s[j]))
     return diffs
 
-  def _getCounts(self, s: str) -> list[list[int]]:
+  def _getCounts(self, s: str) -> List[List[int]]:
     count = [0] * 26
     counts = [count.copy()]
     for c in s:
diff --git a/solutions/2996. Smallest Missing Integer Greater Than Sequential Prefix Sum/2996.py b/solutions/2996. Smallest Missing Integer Greater Than Sequential Prefix Sum/2996.py
index db5e48ac7e1..c1594d5c3f9 100644
--- a/solutions/2996. Smallest Missing Integer Greater Than Sequential Prefix Sum/2996.py	
+++ b/solutions/2996. Smallest Missing Integer Greater Than Sequential Prefix Sum/2996.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def missingInteger(self, nums: list[int]) -> int:
+  def missingInteger(self, nums: List[int]) -> int:
     numsSet = set(nums)
     ans = nums[0]
 
diff --git a/solutions/2997. Minimum Number of Operations to Make Array XOR Equal to K/2997.py b/solutions/2997. Minimum Number of Operations to Make Array XOR Equal to K/2997.py
index 3a220096c1d..aabeb5b24d9 100644
--- a/solutions/2997. Minimum Number of Operations to Make Array XOR Equal to K/2997.py	
+++ b/solutions/2997. Minimum Number of Operations to Make Array XOR Equal to K/2997.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def minOperations(self, nums: list[int], k: int) -> int:
+  def minOperations(self, nums: List[int], k: int) -> int:
     return functools.reduce(operator.xor, nums, k).bit_count()
diff --git a/solutions/2998. Minimum Number of Operations to Make X and Y Equal/2998.java b/solutions/2998. Minimum Number of Operations to Make X and Y Equal/2998.java
index 0dcf896b233..f254d7a8a19 100644
--- a/solutions/2998. Minimum Number of Operations to Make X and Y Equal/2998.java	
+++ b/solutions/2998. Minimum Number of Operations to Make X and Y Equal/2998.java	
@@ -3,7 +3,7 @@ public int minimumOperationsToMakeEqual(int x, int y) {
     if (x <= y)
       return y - x;
 
-    Queue<Integer> q = new ArrayDeque<>(List.of(x));
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(x));
     Set<Integer> seen = new HashSet<>();
 
     for (int ans = 0; !q.isEmpty(); ++ans) {
diff --git a/solutions/2999. Count the Number of Powerful Integers/2999.cpp b/solutions/2999. Count the Number of Powerful Integers/2999.cpp
index 7f9a24489f4..680c5eace7a 100644
--- a/solutions/2999. Count the Number of Powerful Integers/2999.cpp	
+++ b/solutions/2999. Count the Number of Powerful Integers/2999.cpp	
@@ -13,37 +13,37 @@ class Solution {
 
  private:
   // Returns the number of powerful integers, considering the i-th digit, where
-  // `tight1` indicates if the current digit is tightly bound for `a` and
-  // `tight2` indicates if the current digit is tightly bound for `b`.
+  // `isTight1` indicates if the current digit is tightly bound for `a` and
+  // `isTight2` indicates if the current digit is tightly bound for `b`.
   long count(const string& a, const string& b, int i, int limit,
-             const string& s, bool tight1, bool tight2,
+             const string& s, bool isTight1, bool isTight2,
              vector<vector<vector<long>>>& mem) {
     if (i + s.length() == b.length()) {
-      const string aMinSuffix = tight1
+      const string aMinSuffix = isTight1
                                     ? std::string(a.end() - s.length(), a.end())
                                     : string(s.length(), '0');
-      const string bMaxSuffix = tight2
+      const string bMaxSuffix = isTight2
                                     ? std::string(b.end() - s.length(), b.end())
                                     : string(s.length(), '9');
       const long suffix = stoll(s);
       return stoll(aMinSuffix) <= suffix && suffix <= stoll(bMaxSuffix);
     }
 
-    if (mem[i][tight1][tight2] != -1)
-      return mem[i][tight1][tight2];
+    if (mem[i][isTight1][isTight2] != -1)
+      return mem[i][isTight1][isTight2];
 
     long res = 0;
-    const int minDigit = tight1 ? a[i] - '0' : 0;
-    const int maxDigit = tight2 ? b[i] - '0' : 9;
+    const int minDigit = isTight1 ? a[i] - '0' : 0;
+    const int maxDigit = isTight2 ? b[i] - '0' : 9;
 
     for (int d = minDigit; d <= maxDigit; ++d) {
       if (d > limit)
         continue;
-      const bool nextTight1 = tight1 && (d == minDigit);
-      const bool nextTight2 = tight2 && (d == maxDigit);
-      res += count(a, b, i + 1, limit, s, nextTight1, nextTight2, mem);
+      const bool nextIsTight1 = isTight1 && (d == minDigit);
+      const bool nextIsTight2 = isTight2 && (d == maxDigit);
+      res += count(a, b, i + 1, limit, s, nextIsTight1, nextIsTight2, mem);
     }
 
-    return mem[i][tight1][tight2] = res;
+    return mem[i][isTight1][isTight2] = res;
   }
 };
diff --git a/solutions/30. Substring with Concatenation of All Words/30.py b/solutions/30. Substring with Concatenation of All Words/30.py
index cab2c9db995..b207cea2015 100644
--- a/solutions/30. Substring with Concatenation of All Words/30.py	
+++ b/solutions/30. Substring with Concatenation of All Words/30.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findSubstring(self, s: str, words: list[str]) -> list[int]:
+  def findSubstring(self, s: str, words: List[str]) -> List[int]:
     if len(s) == 0 or words == []:
       return []
 
diff --git a/solutions/300. Longest Increasing Subsequence/300-2.cpp b/solutions/300. Longest Increasing Subsequence/300-2.cpp
index 941467f040c..5f130db1e9c 100644
--- a/solutions/300. Longest Increasing Subsequence/300-2.cpp	
+++ b/solutions/300. Longest Increasing Subsequence/300-2.cpp	
@@ -15,7 +15,7 @@ class Solution {
   }
 
  private:
-  int firstGreaterEqual(const vector<int>& arr, int target) {
-    return ranges::lower_bound(arr, target) - arr.begin();
+  int firstGreaterEqual(const vector<int>& A, int target) {
+    return ranges::lower_bound(A, target) - A.begin();
   }
 };
diff --git a/solutions/300. Longest Increasing Subsequence/300-2.java b/solutions/300. Longest Increasing Subsequence/300-2.java
index bf19bdb5e92..b8a3306cbdb 100644
--- a/solutions/300. Longest Increasing Subsequence/300-2.java	
+++ b/solutions/300. Longest Increasing Subsequence/300-2.java	
@@ -13,8 +13,8 @@ public int lengthOfLIS(int[] nums) {
     return tails.size();
   }
 
-  private int firstGreaterEqual(List<Integer> arr, int target) {
-    final int i = Collections.binarySearch(arr, target);
+  private int firstGreaterEqual(List<Integer> A, int target) {
+    final int i = Collections.binarySearch(A, target);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/300. Longest Increasing Subsequence/300-2.py b/solutions/300. Longest Increasing Subsequence/300-2.py
index 9c92beb6c5f..de534335d9b 100644
--- a/solutions/300. Longest Increasing Subsequence/300-2.py	
+++ b/solutions/300. Longest Increasing Subsequence/300-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def lengthOfLIS(self, nums: list[int]) -> int:
+  def lengthOfLIS(self, nums: List[int]) -> int:
     # tails[i] := the minimum tails of all the increasing subsequences having
     # length i + 1
     tails = []
diff --git a/solutions/300. Longest Increasing Subsequence/300.py b/solutions/300. Longest Increasing Subsequence/300.py
index 9cf139e99bf..fb0d4b218d1 100644
--- a/solutions/300. Longest Increasing Subsequence/300.py	
+++ b/solutions/300. Longest Increasing Subsequence/300.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def lengthOfLIS(self, nums: list[int]) -> int:
+  def lengthOfLIS(self, nums: List[int]) -> int:
     if not nums:
       return 0
 
-    # dp[i] := the length of LIS ending in nums[i]
+    # dp[i] the length of LIS ending in nums[i]
     dp = [1] * len(nums)
 
     for i in range(1, len(nums)):
diff --git a/solutions/3000. Maximum Area of Longest Diagonal Rectangle/3000.java b/solutions/3000. Maximum Area of Longest Diagonal Rectangle/3000.java
index 4fcbf68da6b..3c31207338b 100644
--- a/solutions/3000. Maximum Area of Longest Diagonal Rectangle/3000.java	
+++ b/solutions/3000. Maximum Area of Longest Diagonal Rectangle/3000.java	
@@ -1,10 +1,12 @@
 class Solution {
   public int areaOfMaxDiagonal(int[][] dimensions) {
-    int[] maxDimension = Arrays.stream(dimensions)
-                             .max(Comparator.comparingInt((int[] d) -> d[0] * d[0] + d[1] * d[1])
-                                      .thenComparingInt((int[] d) -> d[0] * d[1]))
-
-                             .orElseThrow();
+    int[] maxDimension =
+        Arrays.stream(dimensions)
+            .max((a, b)
+                     -> a[0] * a[0] + a[1] * a[1] == b[0] * b[0] + b[1] * b[1]
+                            ? Integer.compare(a[0] * a[1], b[0] * b[1])
+                            : Integer.compare(a[0] * a[0] + a[1] * a[1], b[0] * b[0] + b[1] * b[1]))
+            .orElseThrow();
     return maxDimension[0] * maxDimension[1];
   }
 }
diff --git a/solutions/3000. Maximum Area of Longest Diagonal Rectangle/3000.py b/solutions/3000. Maximum Area of Longest Diagonal Rectangle/3000.py
index f4f17a0cb93..6ae78343eb2 100644
--- a/solutions/3000. Maximum Area of Longest Diagonal Rectangle/3000.py	
+++ b/solutions/3000. Maximum Area of Longest Diagonal Rectangle/3000.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def areaOfMaxDiagonal(self, dimensions: list[list[int]]) -> int:
+  def areaOfMaxDiagonal(self, dimensions: List[List[int]]) -> int:
     a, b = max(dimensions, key=lambda x: (x[0]**2 + x[1]**2, x[0] * x[1]))
     return a * b
diff --git a/solutions/3001. Minimum Moves to Capture The Queen/3001.py b/solutions/3001. Minimum Moves to Capture The Queen/3001.py
index a1e455655c1..6122f8fa30f 100644
--- a/solutions/3001. Minimum Moves to Capture The Queen/3001.py	
+++ b/solutions/3001. Minimum Moves to Capture The Queen/3001.py	
@@ -1,7 +1,5 @@
 class Solution:
-  def minMovesToCaptureTheQueen(
-      self, a: int, b: int, c: int, d: int, e: int, f: int,
-  ) -> int:
+  def minMovesToCaptureTheQueen(self, a: int, b: int, c: int, d: int, e: int, f: int) -> int:
     # The rook is in the same row as the queen.
     if a == e:
       # The bishop blocks the rook or not.
diff --git a/solutions/3002. Maximum Size of a Set After Removals/3002.py b/solutions/3002. Maximum Size of a Set After Removals/3002.py
index 82fdd12449e..8239168004b 100644
--- a/solutions/3002. Maximum Size of a Set After Removals/3002.py	
+++ b/solutions/3002. Maximum Size of a Set After Removals/3002.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumSetSize(self, nums1: list[int], nums2: list[int]) -> int:
+  def maximumSetSize(self, nums1: List[int], nums2: List[int]) -> int:
     set1 = set(nums1)
     set2 = set(nums2)
     common = set1.intersection(set2)
diff --git a/solutions/3003. Maximize the Number of Partitions After Operations/3003.cpp b/solutions/3003. Maximize the Number of Partitions After Operations/3003.cpp
index 731e827e633..1f82a9b74d0 100644
--- a/solutions/3003. Maximize the Number of Partitions After Operations/3003.cpp	
+++ b/solutions/3003. Maximize the Number of Partitions After Operations/3003.cpp	
@@ -32,11 +32,11 @@ class Solution {
 
   int getRes(const string& s, int i, bool nextCanChange, unsigned mask,
              int newBit, int k, unordered_map<long, int>& mem) {
-    const unsigned newMask = mask | newBit;
-    if (popcount(newMask) > k)  // fresh start
+    const unsigned nextMask = mask | newBit;
+    if (popcount(nextMask) > k)  // fresh start
       return 1 + maxPartitionsAfterOperations(s, i + 1, nextCanChange, newBit,
                                               k, mem);
-    return maxPartitionsAfterOperations(s, i + 1, nextCanChange, newMask, k,
+    return maxPartitionsAfterOperations(s, i + 1, nextCanChange, nextMask, k,
                                         mem);
   }
 };
diff --git a/solutions/3003. Maximize the Number of Partitions After Operations/3003.java b/solutions/3003. Maximize the Number of Partitions After Operations/3003.java
index 14abf3a0276..4f87f305847 100644
--- a/solutions/3003. Maximize the Number of Partitions After Operations/3003.java	
+++ b/solutions/3003. Maximize the Number of Partitions After Operations/3003.java	
@@ -30,9 +30,9 @@ private int maxPartitionsAfterOperations(final String s, int i, boolean canChang
 
   private int getRes(final String s, int i, boolean nextCanChange, int mask, int newBit, int k,
                      Map<Long, Integer> mem) {
-    final int newMask = mask | newBit;
-    if (Integer.bitCount(newMask) > k) // fresh start
+    final int nextMask = mask | newBit;
+    if (Integer.bitCount(nextMask) > k) // fresh start
       return 1 + maxPartitionsAfterOperations(s, i + 1, nextCanChange, newBit, k, mem);
-    return maxPartitionsAfterOperations(s, i + 1, nextCanChange, newMask, k, mem);
+    return maxPartitionsAfterOperations(s, i + 1, nextCanChange, nextMask, k, mem);
   }
 }
diff --git a/solutions/3003. Maximize the Number of Partitions After Operations/3003.py b/solutions/3003. Maximize the Number of Partitions After Operations/3003.py
index 8134f834c29..0c8210e653c 100644
--- a/solutions/3003. Maximize the Number of Partitions After Operations/3003.py	
+++ b/solutions/3003. Maximize the Number of Partitions After Operations/3003.py	
@@ -11,10 +11,10 @@ def dp(i: int, canChange: bool, mask: int) -> int:
         return 0
 
       def getRes(newBit: int, nextCanChange: bool) -> int:
-        newMask = mask | newBit
-        if newMask.bit_count() > k:
+        nextMask = mask | newBit
+        if nextMask.bit_count() > k:
           return 1 + dp(i + 1, nextCanChange, newBit)
-        return dp(i + 1, nextCanChange, newMask)
+        return dp(i + 1, nextCanChange, nextMask)
 
       # Initialize the result based on the current letter.
       res = getRes(1 << (ord(s[i]) - ord('a')), canChange)
diff --git a/solutions/3004. Maximum Subtree of the Same Color/3004.py b/solutions/3004. Maximum Subtree of the Same Color/3004.py
index 27749151b58..78c852b14c9 100644
--- a/solutions/3004. Maximum Subtree of the Same Color/3004.py	
+++ b/solutions/3004. Maximum Subtree of the Same Color/3004.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def maximumSubtreeSize(
-      self,
-      edges: list[list[int]],
-      colors: list[int],
-  ) -> int:
+  def maximumSubtreeSize(self, edges: List[List[int]], colors: List[int]) -> int:
     ans = 1
     tree = [[] for _ in range(len(colors))]
 
diff --git a/solutions/3005. Count Elements With Maximum Frequency/3005.java b/solutions/3005. Count Elements With Maximum Frequency/3005.java
index 7cb6e434b20..148e1199ee2 100644
--- a/solutions/3005. Count Elements With Maximum Frequency/3005.java	
+++ b/solutions/3005. Count Elements With Maximum Frequency/3005.java	
@@ -1,8 +1,8 @@
 class Solution {
   public int maxFrequencyElements(int[] nums) {
-    final int MAX = 100;
+    final int kMax = 100;
     int ans = 0;
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (final int num : nums)
       ++count[num];
diff --git a/solutions/3005. Count Elements With Maximum Frequency/3005.py b/solutions/3005. Count Elements With Maximum Frequency/3005.py
index 33edf30048e..875c14f9f5d 100644
--- a/solutions/3005. Count Elements With Maximum Frequency/3005.py	
+++ b/solutions/3005. Count Elements With Maximum Frequency/3005.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxFrequencyElements(self, nums: list[int]) -> int:
+  def maxFrequencyElements(self, nums: List[int]) -> int:
     count = collections.Counter(nums)
     maxFreq = max(count.values())
     return sum(freq == maxFreq for freq in count.values()) * maxFreq
diff --git a/solutions/3006. Find Beautiful Indices in the Given Array I/3006.cpp b/solutions/3006. Find Beautiful Indices in the Given Array I/3006.cpp
index 58512f87b33..bbfaf9e4517 100644
--- a/solutions/3006. Find Beautiful Indices in the Given Array I/3006.cpp	
+++ b/solutions/3006. Find Beautiful Indices in the Given Array I/3006.cpp	
@@ -34,7 +34,9 @@ class Solution {
           res.push_back(i - j);
           j = lps[j - 1];
         }
-      } else if (j > 0) {  // Mismatch after j matches.
+      }
+      // Mismatch after j matches.
+      else if (j > 0) {
         // Don't match lps[0..lps[j - 1]] since they will match anyway.
         j = lps[j - 1];
       } else {
diff --git a/solutions/3006. Find Beautiful Indices in the Given Array I/3006.java b/solutions/3006. Find Beautiful Indices in the Given Array I/3006.java
index adc82243188..2dd3280a72d 100644
--- a/solutions/3006. Find Beautiful Indices in the Given Array I/3006.java	
+++ b/solutions/3006. Find Beautiful Indices in the Given Array I/3006.java	
@@ -31,7 +31,9 @@ private List<Integer> kmp(final String s, final String pattern) {
           res.add(i - j);
           j = lps[j - 1];
         }
-      } else if (j != 0) { // Mismatch after j matches.
+      }
+      // Mismatch after j matches.
+      else if (j != 0) {
         // Don't match lps[0..lps[j - 1]] since they will match anyway.
         j = lps[j - 1];
       } else {
diff --git a/solutions/3006. Find Beautiful Indices in the Given Array I/3006.py b/solutions/3006. Find Beautiful Indices in the Given Array I/3006.py
index f88a078005b..fbb1e445569 100644
--- a/solutions/3006. Find Beautiful Indices in the Given Array I/3006.py	
+++ b/solutions/3006. Find Beautiful Indices in the Given Array I/3006.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def beautifulIndices(self, s: str, a: str, b: str, k: int) -> list[int]:
+  def beautifulIndices(self, s: str, a: str, b: str, k: int) -> List[int]:
     ans = []
     indicesA = self._kmp(s, a)
     indicesB = self._kmp(s, b)
@@ -15,10 +15,10 @@ def beautifulIndices(self, s: str, a: str, b: str, k: int) -> list[int]:
 
     return ans
 
-  def _kmp(self, s: str, pattern: str) -> list[int]:
+  def _kmp(self, s: str, pattern: str) -> List[int]:
     """Returns the starting indices of all occurrences of the pattern in `s`."""
 
-    def getLPS(pattern: str) -> list[int]:
+    def getLPS(pattern: str) -> List[int]:
       """
       Returns the lps array, where lps[i] is the length of the longest prefix of
       pattern[0..i] which is also a suffix of this substring.
@@ -44,8 +44,9 @@ def getLPS(pattern: str) -> list[int]:
         if j == len(pattern):
           res.append(i - j)
           j = lps[j - 1]
-      elif j != 0:  # Mismatch after j matches.
-        # Don't match lps[0..lps[j - 1]] since they will match anyway.
+      # Mismatch after j matches.
+      elif j != 0:
+          # Don't match lps[0..lps[j - 1]] since they will match anyway.
         j = lps[j - 1]
       else:
         i += 1
diff --git a/solutions/3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K/3007.cpp b/solutions/3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K/3007.cpp
index 4ef2f068553..158b1433a88 100644
--- a/solutions/3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K/3007.cpp	
+++ b/solutions/3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K/3007.cpp	
@@ -6,10 +6,10 @@ class Solution {
 
     while (l < r) {
       const long m = (l + r + 1) / 2;
-      if (getSumPrices(m, x) <= k)
-        l = m;
-      else
+      if (getSumPrices(m, x) > k)
         r = m - 1;
+      else
+        l = m;
     }
 
     return l;
@@ -21,7 +21,7 @@ class Solution {
     long sumPrices = 0;
     // Increment `num` to account the 0-th row in the count of groups.
     ++num;
-    for (int i = std::bit_width(static_cast<unsigned long>(num)); i > 0; --i)
+    for (int i = leftmostColumnIndex(num); i > 0; --i)
       // If the current column is valid, count the number of 1s in this column.
       if (i % x == 0) {
         const long groupSize = 1L << i;
@@ -31,4 +31,9 @@ class Solution {
       }
     return sumPrices;
   }
+
+  // Returns the leftmost column index in 1-indexed.
+  int leftmostColumnIndex(long num) {
+    return 63 - __builtin_clzl(num) + 1;
+  }
 };
diff --git a/solutions/3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K/3007.java b/solutions/3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K/3007.java
index 9da88846635..ced7a956e3c 100644
--- a/solutions/3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K/3007.java	
+++ b/solutions/3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K/3007.java	
@@ -17,8 +17,8 @@ public long findMaximumNumber(long k, int x) {
   // Returns the sum of prices of all numbers from 1 to `num`.
   private long getSumPrices(long num, int x) {
     long sumPrices = 0;
-    ++num; // Increment `num` to account the 0-th row in the count of groups.
-    for (int i = bitLength(num); i > 0; --i)
+    num++; // Increment `num` to account the 0-th row in the count of groups.
+    for (int i = leftmostColumnIndex(num); i > 0; --i)
       if (i % x == 0) {
         final long groupSize = 1L << i;
         final long halfGroupSize = 1L << i - 1;
@@ -28,7 +28,8 @@ private long getSumPrices(long num, int x) {
     return sumPrices;
   }
 
-  private int bitLength(long num) {
-    return Long.SIZE - Long.numberOfLeadingZeros(num);
+  // Returns the leftmost column index in 1-indexed.
+  private int leftmostColumnIndex(long num) {
+    return 63 - Long.numberOfLeadingZeros(num) + 1;
   }
 }
diff --git a/solutions/3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K/3007.py b/solutions/3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K/3007.py
index 47eb4d43bb8..8f3257f824b 100644
--- a/solutions/3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K/3007.py	
+++ b/solutions/3007. Maximum Number That Sum of the Prices Is Less Than or Equal to K/3007.py	
@@ -13,6 +13,5 @@ def getSumPrices(num: int) -> int:
           sumPrices += max(0, (num % groupSize) - halfGroupSize)
       return sumPrices
 
-    l = 1
-    r = 10**15
-    return bisect.bisect_right(range(l, r + 1), k, key=getSumPrices) - 1 + l
+    return bisect.bisect_right(range(1, 10**15), k,
+                               key=lambda m: getSumPrices(m))
diff --git a/solutions/3008. Find Beautiful Indices in the Given Array II/3008.cpp b/solutions/3008. Find Beautiful Indices in the Given Array II/3008.cpp
index a503c6ff863..0c915b72510 100644
--- a/solutions/3008. Find Beautiful Indices in the Given Array II/3008.cpp	
+++ b/solutions/3008. Find Beautiful Indices in the Given Array II/3008.cpp	
@@ -35,7 +35,9 @@ class Solution {
           res.push_back(i - j);
           j = lps[j - 1];
         }
-      } else if (j > 0) {  // Mismatch after j matches.
+      }
+      // Mismatch after j matches.
+      else if (j > 0) {
         // Don't match lps[0..lps[j - 1]] since they will match anyway.
         j = lps[j - 1];
       } else {
diff --git a/solutions/3008. Find Beautiful Indices in the Given Array II/3008.java b/solutions/3008. Find Beautiful Indices in the Given Array II/3008.java
index bfdca05da3f..f1d78a64b93 100644
--- a/solutions/3008. Find Beautiful Indices in the Given Array II/3008.java	
+++ b/solutions/3008. Find Beautiful Indices in the Given Array II/3008.java	
@@ -32,7 +32,9 @@ private List<Integer> kmp(final String s, final String pattern) {
           res.add(i - j);
           j = lps[j - 1];
         }
-      } else if (j != 0) { // Mismatch after j matches.
+      }
+      // Mismatch after j matches.
+      else if (j != 0) {
         // Don't match lps[0..lps[j - 1]] since they will match anyway.
         j = lps[j - 1];
       } else {
diff --git a/solutions/3008. Find Beautiful Indices in the Given Array II/3008.py b/solutions/3008. Find Beautiful Indices in the Given Array II/3008.py
index 24405ca57ca..b0b3a233a71 100644
--- a/solutions/3008. Find Beautiful Indices in the Given Array II/3008.py	
+++ b/solutions/3008. Find Beautiful Indices in the Given Array II/3008.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 3006. Find Beautiful Indices in the Given Array I
-  def beautifulIndices(self, s: str, a: str, b: str, k: int) -> list[int]:
+  def beautifulIndices(self, s: str, a: str, b: str, k: int) -> List[int]:
     ans = []
     indicesA = self._kmp(s, a)
     indicesB = self._kmp(s, b)
@@ -16,10 +16,10 @@ def beautifulIndices(self, s: str, a: str, b: str, k: int) -> list[int]:
 
     return ans
 
-  def _kmp(self, s: str, pattern: str) -> list[int]:
+  def _kmp(self, s: str, pattern: str) -> List[int]:
     """Returns the starting indices of all occurrences of the pattern in `s`."""
 
-    def getLPS(pattern: str) -> list[int]:
+    def getLPS(pattern: str) -> List[int]:
       """
       Returns the lps array, where lps[i] is the length of the longest prefix of
       pattern[0..i] which is also a suffix of this substring.
@@ -45,8 +45,9 @@ def getLPS(pattern: str) -> list[int]:
         if j == len(pattern):
           res.append(i - j)
           j = lps[j - 1]
-      elif j != 0:  # Mismatch after j matches.
-        # Don't match lps[0..lps[j - 1]] since they will match anyway.
+      # Mismatch after j matches.
+      elif j != 0:
+          # Don't match lps[0..lps[j - 1]] since they will match anyway.
         j = lps[j - 1]
       else:
         i += 1
diff --git a/solutions/3009. Maximum Number of Intersections on the Chart/3009.py b/solutions/3009. Maximum Number of Intersections on the Chart/3009.py
index a75c40701f3..747a2dc2afa 100644
--- a/solutions/3009. Maximum Number of Intersections on the Chart/3009.py	
+++ b/solutions/3009. Maximum Number of Intersections on the Chart/3009.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxIntersectionCount(self, y: list[int]) -> int:
+  def maxIntersectionCount(self, y: List[int]) -> int:
     ans = 0
     intersectionCount = 0
     line = collections.Counter()
diff --git a/solutions/301. Remove Invalid Parentheses/301.py b/solutions/301. Remove Invalid Parentheses/301.py
index 84cb949ea60..2f3af74e142 100644
--- a/solutions/301. Remove Invalid Parentheses/301.py	
+++ b/solutions/301. Remove Invalid Parentheses/301.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def removeInvalidParentheses(self, s: str) -> list[str]:
+  def removeInvalidParentheses(self, s: str) -> List[str]:
     # Similar to 921. Minimum Add to Make Parentheses Valid
-    def getLeftAndRightCounts(s: str) -> tuple[int, int]:
+    def getLeftAndRightCounts(s: str) -> Tuple[int, int]:
       """Returns how many '(' and ')' need to be deleted."""
       l = 0
       r = 0
diff --git a/solutions/3010. Divide an Array Into Subarrays With Minimum Cost I/3010.java b/solutions/3010. Divide an Array Into Subarrays With Minimum Cost I/3010.java
index 8db76e3ea29..3241101a1c2 100644
--- a/solutions/3010. Divide an Array Into Subarrays With Minimum Cost I/3010.java	
+++ b/solutions/3010. Divide an Array Into Subarrays With Minimum Cost I/3010.java	
@@ -1,8 +1,8 @@
 class Solution {
   public int minimumCost(int[] nums) {
-    final int MAX = 50;
-    int min1 = MAX;
-    int min2 = MAX;
+    final int kMax = 50;
+    int min1 = kMax;
+    int min2 = kMax;
 
     for (int i = 1; i < nums.length; ++i)
       if (nums[i] < min1) {
diff --git a/solutions/3010. Divide an Array Into Subarrays With Minimum Cost I/3010.py b/solutions/3010. Divide an Array Into Subarrays With Minimum Cost I/3010.py
index 0865fea22ce..db78187ed58 100644
--- a/solutions/3010. Divide an Array Into Subarrays With Minimum Cost I/3010.py	
+++ b/solutions/3010. Divide an Array Into Subarrays With Minimum Cost I/3010.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def minimumCost(self, nums: list[int]) -> int:
-    MAX = 50
-    min1 = MAX
-    min2 = MAX
+  def minimumCost(self, nums: List[int]) -> int:
+    kMax = 50
+    min1 = kMax
+    min2 = kMax
 
     for i in range(1, len(nums)):
       if nums[i] < min1:
diff --git a/solutions/3011. Find if Array Can Be Sorted/3011.py b/solutions/3011. Find if Array Can Be Sorted/3011.py
index 906c8e3bd03..85a8077f6ae 100644
--- a/solutions/3011. Find if Array Can Be Sorted/3011.py	
+++ b/solutions/3011. Find if Array Can Be Sorted/3011.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canSortArray(self, nums: list[int]) -> int:
+  def canSortArray(self, nums: List[int]) -> int:
     # Divide the array into distinct segments where each segment is comprised
     # of consecutive elements sharing an equal number of set bits. Ensure that
     # for each segment, when moving from left to right, the maximum of a
diff --git a/solutions/3012. Minimize Length of Array Using Operations/3012.py b/solutions/3012. Minimize Length of Array Using Operations/3012.py
index f8b7403c7b9..006966a05cb 100644
--- a/solutions/3012. Minimize Length of Array Using Operations/3012.py	
+++ b/solutions/3012. Minimize Length of Array Using Operations/3012.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumArrayLength(self, nums: list[int]) -> int:
+  def minimumArrayLength(self, nums: List[int]) -> int:
     # Let the minimum number in the array `nums` be x.
     # * If there exists any element nums[i] where nums[i] % x > 0, a new
     #   minimum can be generated and all other numbers can be removed.
diff --git a/solutions/3013. Divide an Array Into Subarrays With Minimum Cost II/3013.py b/solutions/3013. Divide an Array Into Subarrays With Minimum Cost II/3013.py
index 257f5d3f449..acae3dc4f9a 100644
--- a/solutions/3013. Divide an Array Into Subarrays With Minimum Cost II/3013.py	
+++ b/solutions/3013. Divide an Array Into Subarrays With Minimum Cost II/3013.py	
@@ -2,7 +2,7 @@
 
 
 class Solution:
-  def minimumCost(self, nums: list[int], k: int, dist: int) -> int:
+  def minimumCost(self, nums: List[int], k: int, dist: int) -> int:
     # Equivalently, the problem is to find nums[0] + the minimum sum of the top
     # k - 1 numbers in nums[i..i + dist], where i > 0 and i + dist < n.
     windowSum = sum(nums[i] for i in range(1, dist + 2))
diff --git a/solutions/3015. Count the Number of Houses at a Certain Distance I/3015.py b/solutions/3015. Count the Number of Houses at a Certain Distance I/3015.py
index 0dc33737b3f..ce25d7a24d3 100644
--- a/solutions/3015. Count the Number of Houses at a Certain Distance I/3015.py	
+++ b/solutions/3015. Count the Number of Houses at a Certain Distance I/3015.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def countOfPairs(self, n: int, x: int, y: int) -> list[int]:
+  def countOfPairs(self, n: int, x: int, y: int) -> List[int]:
     if x > y:
       x, y = y, x
 
-    def bothInRing(ringLen: int) -> list[int]:
+    def bothInRing(ringLen: int) -> List[int]:
       """
       Returns the contribution from the scenario where two houses are located
       in the ring.
@@ -15,7 +15,7 @@ def bothInRing(ringLen: int) -> list[int]:
         res[ringLen // 2 - 1] += ringLen // 2
       return res
 
-    def bothInTheSameLine(lineLen: int) -> list[int]:
+    def bothInTheSameLine(lineLen: int) -> List[int]:
       """
       Returns the contribution from the scenario where two houses are either
       located in the left line [1, x) or the right line (y, n].
@@ -25,7 +25,7 @@ def bothInTheSameLine(lineLen: int) -> list[int]:
         res[k - 1] += lineLen - k
       return res
 
-    def lineToRing(lineLen: int, ringLen: int) -> list[int]:
+    def lineToRing(lineLen: int, ringLen: int) -> List[int]:
       """
       Returns the contribution from the scenario where one house is either
       located in the left line [1, x) or the right line (y, n] and the
@@ -59,7 +59,7 @@ def lineToRing(lineLen: int, ringLen: int) -> list[int]:
             res[k - 1] -= 1
       return res
 
-    def lineToLine(leftLineLen: int, rightLineLen: int) -> list[int]:
+    def lineToLine(leftLineLen: int, rightLineLen: int) -> List[int]:
       """
       Returns the contribution from the scenario where one house is in the left
       line [1, x) and the other house is in the right line (y, n].
diff --git a/solutions/3017. Count the Number of Houses at a Certain Distance II/3017.py b/solutions/3017. Count the Number of Houses at a Certain Distance II/3017.py
index 39456dec4e9..d31aeadc9d5 100644
--- a/solutions/3017. Count the Number of Houses at a Certain Distance II/3017.py	
+++ b/solutions/3017. Count the Number of Houses at a Certain Distance II/3017.py	
@@ -1,10 +1,10 @@
 class Solution:
   # Same as 3015. Count the Number of Houses at a Certain Distance I
-  def countOfPairs(self, n: int, x: int, y: int) -> list[int]:
+  def countOfPairs(self, n: int, x: int, y: int) -> List[int]:
     if x > y:
       x, y = y, x
 
-    def bothInRing(ringLen: int) -> list[int]:
+    def bothInRing(ringLen: int) -> List[int]:
       """
       Returns the contribution from the scenario where two houses are located
       in the ring.
@@ -16,7 +16,7 @@ def bothInRing(ringLen: int) -> list[int]:
         res[ringLen // 2 - 1] += ringLen // 2
       return res
 
-    def bothInTheSameLine(lineLen: int) -> list[int]:
+    def bothInTheSameLine(lineLen: int) -> List[int]:
       """
       Returns the contribution from the scenario where two houses are either
       located in the left line [1, x) or the right line (y, n].
@@ -26,7 +26,7 @@ def bothInTheSameLine(lineLen: int) -> list[int]:
         res[k - 1] += lineLen - k
       return res
 
-    def lineToRing(lineLen: int, ringLen: int) -> list[int]:
+    def lineToRing(lineLen: int, ringLen: int) -> List[int]:
       """
       Returns the contribution from the scenario where one house is either
       located in the left line [1, x) or the right line (y, n] and the
@@ -60,7 +60,7 @@ def lineToRing(lineLen: int, ringLen: int) -> list[int]:
             res[k - 1] -= 1
       return res
 
-    def lineToLine(leftLineLen: int, rightLineLen: int) -> list[int]:
+    def lineToLine(leftLineLen: int, rightLineLen: int) -> List[int]:
       """
       Returns the contribution from the scenario where one house is in the left
       line [1, x) and the other house is in the right line (y, n].
diff --git a/solutions/3018. Maximum Number of Removal Queries That Can Be Processed I/3018.py b/solutions/3018. Maximum Number of Removal Queries That Can Be Processed I/3018.py
index 22061875dcf..8cccf8a19a0 100644
--- a/solutions/3018. Maximum Number of Removal Queries That Can Be Processed I/3018.py	
+++ b/solutions/3018. Maximum Number of Removal Queries That Can Be Processed I/3018.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def maximumProcessableQueries(
-      self,
-      nums: list[int],
-      queries: list[int],
-  ) -> int:
+  def maximumProcessableQueries(self, nums: List[int], queries: List[int]) -> int:
     n = len(nums)
     # dp[i][j] := the maximum number of queries processed if nums[i..j] are not
     # removed after processing dp[i][j] queries
diff --git a/solutions/302. Smallest Rectangle Enclosing Black Pixels/302-2.py b/solutions/302. Smallest Rectangle Enclosing Black Pixels/302-2.py
index bb460489b64..18b7c288811 100644
--- a/solutions/302. Smallest Rectangle Enclosing Black Pixels/302-2.py	
+++ b/solutions/302. Smallest Rectangle Enclosing Black Pixels/302-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minArea(self, image: list[list[str]], x: int, y: int) -> int:
+  def minArea(self, image: List[List[str]], x: int, y: int) -> int:
     def firstAnyOne(l: int, r: int, allZeros: Callable[[int], bool]) -> int:
       while l < r:
         m = (l + r) // 2
diff --git a/solutions/302. Smallest Rectangle Enclosing Black Pixels/302.cpp b/solutions/302. Smallest Rectangle Enclosing Black Pixels/302.cpp
index 350dfee20d2..baf45cdffdf 100644
--- a/solutions/302. Smallest Rectangle Enclosing Black Pixels/302.cpp	
+++ b/solutions/302. Smallest Rectangle Enclosing Black Pixels/302.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int minArea(vector<vector<char>>& image, int x, int y) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = image.size();
     const int n = image[0].size();
     vector<int> topLeft{x, y};
@@ -12,7 +12,7 @@ class Solution {
     while (!q.empty()) {
       const auto [i, j] = q.front();
       q.pop();
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int r = i + dx;
         const int c = j + dy;
         if (r < 0 || r == m || c < 0 || c == n)
diff --git a/solutions/302. Smallest Rectangle Enclosing Black Pixels/302.java b/solutions/302. Smallest Rectangle Enclosing Black Pixels/302.java
index 6c23e0ff023..39d03afa96a 100644
--- a/solutions/302. Smallest Rectangle Enclosing Black Pixels/302.java	
+++ b/solutions/302. Smallest Rectangle Enclosing Black Pixels/302.java	
@@ -1,17 +1,17 @@
 class Solution {
   public int minArea(char[][] image, int x, int y) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = image.length;
     final int n = image[0].length;
     int[] topLeft = {x, y};
     int[] bottomRight = {x, y};
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(x, y)));
+    Queue<int[]> q = new ArrayDeque<>(Arrays.asList(new int[] {x, y}));
     image[x][y] = '2'; // Mark as visited.
 
     while (!q.isEmpty()) {
-      final int i = q.peek().getKey();
-      final int j = q.poll().getValue();
-      for (int[] dir : DIRS) {
+      final int i = q.peek()[0];
+      final int j = q.poll()[1];
+      for (int[] dir : dirs) {
         final int r = i + dir[0];
         final int c = j + dir[1];
         if (r < 0 || r == m || c < 0 || c == n)
@@ -22,7 +22,7 @@ public int minArea(char[][] image, int x, int y) {
         topLeft[1] = Math.min(topLeft[1], c);
         bottomRight[0] = Math.max(bottomRight[0], r);
         bottomRight[1] = Math.max(bottomRight[1], c);
-        q.offer(new Pair<>(r, c));
+        q.offer(new int[] {r, c});
         image[r][c] = '2';
       }
     }
diff --git a/solutions/302. Smallest Rectangle Enclosing Black Pixels/302.py b/solutions/302. Smallest Rectangle Enclosing Black Pixels/302.py
index 4488c708fed..c70689b37e1 100644
--- a/solutions/302. Smallest Rectangle Enclosing Black Pixels/302.py	
+++ b/solutions/302. Smallest Rectangle Enclosing Black Pixels/302.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def minArea(self, image: list[list[str]], x: int, y: int) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def minArea(self, image: List[List[str]], x: int, y: int) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(image)
     n = len(image[0])
     topLeft = [x, y]
@@ -10,7 +10,7 @@ def minArea(self, image: list[list[str]], x: int, y: int) -> int:
 
     while q:
       i, j = q.popleft()
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         r = i + dx
         c = j + dy
         if r < 0 or r == m or c < 0 or c == n:
diff --git a/solutions/3020. Find the Maximum Number of Elements in Subset/3020.py b/solutions/3020. Find the Maximum Number of Elements in Subset/3020.py
index 43342ca7254..6d0df4b0fb4 100644
--- a/solutions/3020. Find the Maximum Number of Elements in Subset/3020.py	
+++ b/solutions/3020. Find the Maximum Number of Elements in Subset/3020.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumLength(self, nums: list[int]) -> int:
+  def maximumLength(self, nums: List[int]) -> int:
     maxNum = max(nums)
     count = collections.Counter(nums)
     ans = count[1] - (count[1] % 2 == 0) if 1 in count else 1
diff --git a/solutions/3022. Minimize OR of Remaining Elements Using Operations/3022.java b/solutions/3022. Minimize OR of Remaining Elements Using Operations/3022.java
index 581f9b2ad28..17e88d50cce 100644
--- a/solutions/3022. Minimize OR of Remaining Elements Using Operations/3022.java	
+++ b/solutions/3022. Minimize OR of Remaining Elements Using Operations/3022.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int minOrAfterOperations(int[] nums, int k) {
-    final int MAX_BIT = 30;
+    final int kMaxBit = 30;
     int ans = 0;
     int prefixMask = 0; // Grows like: 10000 -> 11000 -> ... -> 11111.
 
-    for (int i = MAX_BIT; i >= 0; --i) {
+    for (int i = kMaxBit; i >= 0; --i) {
       // Add the i-th bit to `prefixMask` and attempt to "turn off" the
       // currently added bit within k operations. If it's impossible, then we
       // add the i-th bit to the answer.
diff --git a/solutions/3022. Minimize OR of Remaining Elements Using Operations/3022.py b/solutions/3022. Minimize OR of Remaining Elements Using Operations/3022.py
index 6fe8bed471e..5ce51bf6056 100644
--- a/solutions/3022. Minimize OR of Remaining Elements Using Operations/3022.py	
+++ b/solutions/3022. Minimize OR of Remaining Elements Using Operations/3022.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def minOrAfterOperations(self, nums: list[int], k: int) -> int:
-    MAX_BIT = 30
+  def minOrAfterOperations(self, nums: List[int], k: int) -> int:
+    kMaxBit = 30
     ans = 0
     prefixMask = 0  # Grows like: 10000 -> 11000 -> ... -> 11111
 
-    for i in range(MAX_BIT, -1, -1):
+    for i in range(kMaxBit, -1, -1):
       # Add the i-th bit to `prefixMask` and attempt to "turn off" the
       # currently added bit within k operations. If it's impossible, then we
       # add the i-th bit to the answer.
@@ -14,7 +14,7 @@ def minOrAfterOperations(self, nums: list[int], k: int) -> int:
 
     return ans
 
-  def _getMergeOps(self, nums: list[int], prefixMask: int, target: int) -> int:
+  def _getMergeOps(self, nums: List[int], prefixMask: int, target: int) -> int:
     """
     Returns the number of merge operations to turn `prefixMask` to the target
     by ANDing `nums`.
diff --git a/solutions/3023. Find Pattern in Infinite Stream I/3023.py b/solutions/3023. Find Pattern in Infinite Stream I/3023.py
index 3eaeab5e57e..03bb3a71cc5 100644
--- a/solutions/3023. Find Pattern in Infinite Stream I/3023.py	
+++ b/solutions/3023. Find Pattern in Infinite Stream I/3023.py	
@@ -4,11 +4,7 @@
 #     pass
 
 class Solution:
-  def findPattern(
-      self,
-      stream: Optional['InfiniteStream'],
-      pattern: list[int],
-  ) -> int:
+  def findPattern(self, stream: Optional['InfiniteStream'], pattern: List[int]) -> int:
     lps = self._getLPS(pattern)
     i = 0  # stream's index
     j = 0  # pattern's index
@@ -32,7 +28,7 @@ def findPattern(
         i += 1
         readNext = False
 
-  def _getLPS(self, pattern: list[int]) -> list[int]:
+  def _getLPS(self, pattern: List[int]) -> List[int]:
     """
     Returns the lps array, where lps[i] is the length of the longest prefix of
     pattern[0..i] which is also a suffix of this substring.
diff --git a/solutions/3024. Type of Triangle II Easy/3024.py b/solutions/3024. Type of Triangle II Easy/3024.py
index c985665586c..68c19d52cda 100644
--- a/solutions/3024. Type of Triangle II Easy/3024.py	
+++ b/solutions/3024. Type of Triangle II Easy/3024.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def triangleType(self, nums: list[int]) -> str:
+  def triangleType(self, nums: List[int]) -> str:
     nums.sort()
     if nums[0] + nums[1] <= nums[2]:
       return 'none'
diff --git a/solutions/3025. Find the Number of Ways to Place People I/3025.cpp b/solutions/3025. Find the Number of Ways to Place People I/3025.cpp
index 72a76a1dd21..b4284af1e75 100644
--- a/solutions/3025. Find the Number of Ways to Place People I/3025.cpp	
+++ b/solutions/3025. Find the Number of Ways to Place People I/3025.cpp	
@@ -3,10 +3,8 @@ class Solution {
   int numberOfPairs(vector<vector<int>>& points) {
     int ans = 0;
 
-    ranges::sort(points, ranges::less{}, [](const vector<int>& point) {
-      const int x = point[0];
-      const int y = point[1];
-      return pair<int, int>{x, -y};
+    ranges::sort(points, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] < b[0] || (a[0] == b[0] && a[1] > b[1]);
     });
 
     for (int i = 0; i < points.size(); ++i) {
diff --git a/solutions/3025. Find the Number of Ways to Place People I/3025.java b/solutions/3025. Find the Number of Ways to Place People I/3025.java
index cf239f2cf9e..ca465d25dbb 100644
--- a/solutions/3025. Find the Number of Ways to Place People I/3025.java	
+++ b/solutions/3025. Find the Number of Ways to Place People I/3025.java	
@@ -2,8 +2,7 @@ class Solution {
   public int numberOfPairs(int[][] points) {
     int ans = 0;
 
-    Arrays.sort(points, Comparator.comparingInt((int[] point) -> point[0])
-                            .thenComparingInt((int[] point) -> - point[1]));
+    Arrays.sort(points, (a, b) -> a[0] == b[0] ? b[1] - a[1] : a[0] - b[0]);
 
     for (int i = 0; i < points.length; ++i) {
       int maxY = Integer.MIN_VALUE;
diff --git a/solutions/3025. Find the Number of Ways to Place People I/3025.py b/solutions/3025. Find the Number of Ways to Place People I/3025.py
index ef1334075f5..7412f29fde5 100644
--- a/solutions/3025. Find the Number of Ways to Place People I/3025.py	
+++ b/solutions/3025. Find the Number of Ways to Place People I/3025.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfPairs(self, points: list[list[int]]) -> int:
+  def numberOfPairs(self, points: List[List[int]]) -> int:
     ans = 0
 
     points.sort(key=lambda x: (x[0], -x[1]))
diff --git a/solutions/3026. Maximum Good Subarray Sum/3026.py b/solutions/3026. Maximum Good Subarray Sum/3026.py
index 8cc5bf0d0c5..2252e9c4807 100644
--- a/solutions/3026. Maximum Good Subarray Sum/3026.py	
+++ b/solutions/3026. Maximum Good Subarray Sum/3026.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumSubarraySum(self, nums: list[int], k: int) -> int:
+  def maximumSubarraySum(self, nums: List[int], k: int) -> int:
     ans = -math.inf
     prefix = 0
     numToMinPrefix = {}
diff --git a/solutions/3027. Find the Number of Ways to Place People II/3027.cpp b/solutions/3027. Find the Number of Ways to Place People II/3027.cpp
index 6feb9950c64..16ed4c797d3 100644
--- a/solutions/3027. Find the Number of Ways to Place People II/3027.cpp	
+++ b/solutions/3027. Find the Number of Ways to Place People II/3027.cpp	
@@ -4,10 +4,8 @@ class Solution {
   int numberOfPairs(vector<vector<int>>& points) {
     int ans = 0;
 
-    ranges::sort(points, ranges::less{}, [](const vector<int>& point) {
-      const int x = point[0];
-      const int y = point[1];
-      return pair<int, int>{x, -y};
+    ranges::sort(points, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] < b[0] || (a[0] == b[0] && a[1] > b[1]);
     });
 
     for (int i = 0; i < points.size(); ++i) {
diff --git a/solutions/3027. Find the Number of Ways to Place People II/3027.java b/solutions/3027. Find the Number of Ways to Place People II/3027.java
index cdff6d471a6..dcffe54f736 100644
--- a/solutions/3027. Find the Number of Ways to Place People II/3027.java	
+++ b/solutions/3027. Find the Number of Ways to Place People II/3027.java	
@@ -3,8 +3,7 @@ class Solution {
   public int numberOfPairs(int[][] points) {
     int ans = 0;
 
-    Arrays.sort(points, Comparator.comparingInt((int[] point) -> point[0])
-                            .thenComparingInt((int[] point) -> - point[1]));
+    Arrays.sort(points, (a, b) -> a[0] == b[0] ? b[1] - a[1] : a[0] - b[0]);
 
     for (int i = 0; i < points.length; ++i) {
       int maxY = Integer.MIN_VALUE;
diff --git a/solutions/3027. Find the Number of Ways to Place People II/3027.py b/solutions/3027. Find the Number of Ways to Place People II/3027.py
index e8a341434e0..704e6acb8ef 100644
--- a/solutions/3027. Find the Number of Ways to Place People II/3027.py	
+++ b/solutions/3027. Find the Number of Ways to Place People II/3027.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 3025. Find the Number of Ways to Place People I
-  def numberOfPairs(self, points: list[list[int]]) -> int:
+  def numberOfPairs(self, points: List[List[int]]) -> int:
     ans = 0
 
     points.sort(key=lambda x: (x[0], -x[1]))
diff --git a/solutions/3028. Ant on the Boundary/3028.py b/solutions/3028. Ant on the Boundary/3028.py
index 08cc9892ba4..6c7ff82dd3f 100644
--- a/solutions/3028. Ant on the Boundary/3028.py	
+++ b/solutions/3028. Ant on the Boundary/3028.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def returnToBoundaryCount(self, nums: list[int]) -> int:
+  def returnToBoundaryCount(self, nums: List[int]) -> int:
     return sum(prefix == 0 for prefix in itertools.accumulate(nums))
diff --git a/solutions/3029. Minimum Time to Revert Word to Initial State I/3029.py b/solutions/3029. Minimum Time to Revert Word to Initial State I/3029.py
index 52cbd331c76..8d4dd7419d9 100644
--- a/solutions/3029. Minimum Time to Revert Word to Initial State I/3029.py	
+++ b/solutions/3029. Minimum Time to Revert Word to Initial State I/3029.py	
@@ -11,7 +11,7 @@ def minimumTimeToInitialState(self, word: str, k: int) -> int:
 
     return maxOps
 
-  def _zFunction(self, s: str) -> list[int]:
+  def _zFunction(self, s: str) -> List[int]:
     """
     Returns the z array, where z[i] is the length of the longest prefix of
     s[i..n) which is also a prefix of s.
diff --git a/solutions/303. Range Sum Query - Immutable/303.py b/solutions/303. Range Sum Query - Immutable/303.py
index 2e3e74d91ee..430c4af588d 100644
--- a/solutions/303. Range Sum Query - Immutable/303.py	
+++ b/solutions/303. Range Sum Query - Immutable/303.py	
@@ -1,6 +1,6 @@
 class NumArray:
-  def __init__(self, nums: list[int]):
-    self.prefix = list(itertools.accumulate(nums, initial=0))
+  def __init__(self, nums: List[int]):
+    self.prefix = [0] + list(itertools.accumulate(nums))
 
   def sumRange(self, left: int, right: int) -> int:
     return self.prefix[right + 1] - self.prefix[left]
diff --git a/solutions/3030. Find the Grid of Region Average/3030.py b/solutions/3030. Find the Grid of Region Average/3030.py
index 058b74feb1d..721cfdfa076 100644
--- a/solutions/3030. Find the Grid of Region Average/3030.py	
+++ b/solutions/3030. Find the Grid of Region Average/3030.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def resultGrid(
-      self,
-      image: list[list[int]],
-      threshold: int,
-  ) -> list[list[int]]:
+  def resultGrid(self, image: List[List[int]], threshold: int) -> List[List[int]]:
     m = len(image)
     n = len(image[0])
     sums = [[0] * n for _ in range(m)]
@@ -27,13 +23,7 @@ def resultGrid(
 
     return image
 
-  def _isRegion(
-      self,
-      image: list[list[int]],
-      i: int,
-      j: int,
-      threshold: int,
-  ) -> bool:
+  def _isRegion(self, image: List[List[int]], i: int, j: int, threshold: int) -> bool:
     """Returns True if image[i..i + 2][j..j + 2] is a region."""
     for x in range(i, i + 3):
       for y in range(j, j + 3):
diff --git a/solutions/3031. Minimum Time to Revert Word to Initial State II/3031.py b/solutions/3031. Minimum Time to Revert Word to Initial State II/3031.py
index 52cbd331c76..8d4dd7419d9 100644
--- a/solutions/3031. Minimum Time to Revert Word to Initial State II/3031.py	
+++ b/solutions/3031. Minimum Time to Revert Word to Initial State II/3031.py	
@@ -11,7 +11,7 @@ def minimumTimeToInitialState(self, word: str, k: int) -> int:
 
     return maxOps
 
-  def _zFunction(self, s: str) -> list[int]:
+  def _zFunction(self, s: str) -> List[int]:
     """
     Returns the z array, where z[i] is the length of the longest prefix of
     s[i..n) which is also a prefix of s.
diff --git a/solutions/3033. Modify the Matrix/3033.py b/solutions/3033. Modify the Matrix/3033.py
index 5aa9c728e09..c5b636d5956 100644
--- a/solutions/3033. Modify the Matrix/3033.py	
+++ b/solutions/3033. Modify the Matrix/3033.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def modifiedMatrix(self, matrix: list[list[int]]) -> list[list[int]]:
+  def modifiedMatrix(self, matrix: List[List[int]]) -> List[List[int]]:
     m = len(matrix)
     n = len(matrix[0])
     ans = matrix.copy()
diff --git a/solutions/3034. Number of Subarrays That Match a Pattern I/3034.cpp b/solutions/3034. Number of Subarrays That Match a Pattern I/3034.cpp
index 8a4478958a1..f537274672c 100644
--- a/solutions/3034. Number of Subarrays That Match a Pattern I/3034.cpp	
+++ b/solutions/3034. Number of Subarrays That Match a Pattern I/3034.cpp	
@@ -35,7 +35,9 @@ class Solution {
           ++res;
           j = lps[j - 1];
         }
-      } else if (j > 0) {  // Mismatch after j matches.
+      }
+      // Mismatch after j matches.
+      else if (j > 0) {
         // Don't match lps[0..lps[j - 1]] since they will match anyway.
         j = lps[j - 1];
       } else {
diff --git a/solutions/3034. Number of Subarrays That Match a Pattern I/3034.java b/solutions/3034. Number of Subarrays That Match a Pattern I/3034.java
index 154a9e3105d..37a7b49c5ab 100644
--- a/solutions/3034. Number of Subarrays That Match a Pattern I/3034.java	
+++ b/solutions/3034. Number of Subarrays That Match a Pattern I/3034.java	
@@ -33,7 +33,9 @@ private int kmp(int[] nums, int[] pattern) {
           ++res;
           j = lps[j - 1];
         }
-      } else if (j > 0) { // Mismatch after j matches.
+      }
+      // Mismatch after j matches.
+      else if (j > 0) {
         // Don't match lps[0..lps[j - 1]] since they will match anyway.
         j = lps[j - 1];
       } else {
diff --git a/solutions/3034. Number of Subarrays That Match a Pattern I/3034.py b/solutions/3034. Number of Subarrays That Match a Pattern I/3034.py
index a1cf469e856..5ed7e51c211 100644
--- a/solutions/3034. Number of Subarrays That Match a Pattern I/3034.py	
+++ b/solutions/3034. Number of Subarrays That Match a Pattern I/3034.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countMatchingSubarrays(self, nums: list[int], pattern: list[int]) -> int:
+  def countMatchingSubarrays(self, nums: List[int], pattern: List[int]) -> int:
     def getNum(a: int, b: int) -> int:
       if a < b:
         return 1
@@ -10,10 +10,10 @@ def getNum(a: int, b: int) -> int:
     numsPattern = [getNum(a, b) for a, b in itertools.pairwise(nums)]
     return self._kmp(numsPattern, pattern)
 
-  def _kmp(self, nums: list[int], pattern: list[int]) -> int:
+  def _kmp(self, nums: List[int], pattern: List[int]) -> int:
     """Returns the number of occurrences of the pattern in `nums`."""
 
-    def getLPS(nums: list[int]) -> list[int]:
+    def getLPS(nums: List[int]) -> List[int]:
       """
       Returns the lps array, where lps[i] is the length of the longest prefix of
       nums[0..i] which is also a suffix of this substring.
@@ -39,8 +39,9 @@ def getLPS(nums: list[int]) -> list[int]:
         if j == len(pattern):
           res += 1
           j = lps[j - 1]
-      elif j != 0:  # Mismatch after j matches.
-        # Don't match lps[0..lps[j - 1]] since they will match anyway.
+      # Mismatch after j matches.
+      elif j != 0:
+          # Don't match lps[0..lps[j - 1]] since they will match anyway.
         j = lps[j - 1]
       else:
         i += 1
diff --git a/solutions/3035. Maximum Palindromes After Operations/3035.py b/solutions/3035. Maximum Palindromes After Operations/3035.py
index 16bb89a95df..f132ada303c 100644
--- a/solutions/3035. Maximum Palindromes After Operations/3035.py	
+++ b/solutions/3035. Maximum Palindromes After Operations/3035.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxPalindromesAfterOperations(self, words: list[str]) -> int:
+  def maxPalindromesAfterOperations(self, words: List[str]) -> int:
     ans = 0
     count = collections.Counter(''.join(words))
     pairs = sum(value // 2 for value in count.values())
diff --git a/solutions/3036. Number of Subarrays That Match a Pattern II/3036.cpp b/solutions/3036. Number of Subarrays That Match a Pattern II/3036.cpp
index 3939e2e00d0..5daa441bfbe 100644
--- a/solutions/3036. Number of Subarrays That Match a Pattern II/3036.cpp	
+++ b/solutions/3036. Number of Subarrays That Match a Pattern II/3036.cpp	
@@ -36,7 +36,9 @@ class Solution {
           ++res;
           j = lps[j - 1];
         }
-      } else if (j > 0) {  // Mismatch after j matches.
+      }
+      // Mismatch after j matches.
+      else if (j > 0) {
         // Don't match lps[0..lps[j - 1]] since they will match anyway.
         j = lps[j - 1];
       } else {
diff --git a/solutions/3036. Number of Subarrays That Match a Pattern II/3036.java b/solutions/3036. Number of Subarrays That Match a Pattern II/3036.java
index 580352d60b3..e03d9cf999b 100644
--- a/solutions/3036. Number of Subarrays That Match a Pattern II/3036.java	
+++ b/solutions/3036. Number of Subarrays That Match a Pattern II/3036.java	
@@ -34,7 +34,9 @@ private int kmp(int[] nums, int[] pattern) {
           ++res;
           j = lps[j - 1];
         }
-      } else if (j > 0) { // Mismatch after j matches.
+      }
+      // Mismatch after j matches.
+      else if (j > 0) {
         // Don't match lps[0..lps[j - 1]] since they will match anyway.
         j = lps[j - 1];
       } else {
diff --git a/solutions/3036. Number of Subarrays That Match a Pattern II/3036.py b/solutions/3036. Number of Subarrays That Match a Pattern II/3036.py
index 403fa16964d..589539121ec 100644
--- a/solutions/3036. Number of Subarrays That Match a Pattern II/3036.py	
+++ b/solutions/3036. Number of Subarrays That Match a Pattern II/3036.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 3034. Number of Subarrays That Match a Pattern I
-  def countMatchingSubarrays(self, nums: list[int], pattern: list[int]) -> int:
+  def countMatchingSubarrays(self, nums: List[int], pattern: List[int]) -> int:
     def getNum(a: int, b: int) -> int:
       if a < b:
         return 1
@@ -11,10 +11,10 @@ def getNum(a: int, b: int) -> int:
     numsPattern = [getNum(a, b) for a, b in itertools.pairwise(nums)]
     return self._kmp(numsPattern, pattern)
 
-  def _kmp(self, nums: list[int], pattern: list[int]) -> int:
+  def _kmp(self, nums: List[int], pattern: List[int]) -> int:
     """Returns the number of occurrences of the pattern in `nums`."""
 
-    def getLPS(nums: list[int]) -> list[int]:
+    def getLPS(nums: List[int]) -> List[int]:
       """
       Returns the lps array, where lps[i] is the length of the longest prefix of
       nums[0..i] which is also a suffix of this substring.
@@ -40,8 +40,9 @@ def getLPS(nums: list[int]) -> list[int]:
         if j == len(pattern):
           res += 1
           j = lps[j - 1]
-      elif j != 0:  # Mismatch after j matches.
-        # Don't match lps[0..lps[j - 1]] since they will match anyway.
+      # Mismatch after j matches.
+      elif j != 0:
+          # Don't match lps[0..lps[j - 1]] since they will match anyway.
         j = lps[j - 1]
       else:
         i += 1
diff --git a/solutions/3037. Find Pattern in Infinite Stream II/3037.py b/solutions/3037. Find Pattern in Infinite Stream II/3037.py
index c991f2f48a5..063c33d1299 100644
--- a/solutions/3037. Find Pattern in Infinite Stream II/3037.py	
+++ b/solutions/3037. Find Pattern in Infinite Stream II/3037.py	
@@ -5,11 +5,7 @@
 
 class Solution:
   # Same as 3023. Find Pattern in Infinite Stream I
-  def findPattern(
-      self,
-      stream: Optional['InfiniteStream'],
-      pattern: list[int]
-  ) -> int:
+  def findPattern(self, stream: Optional['InfiniteStream'], pattern: List[int]) -> int:
     lps = self._getLPS(pattern)
     i = 0  # stream's index
     j = 0  # pattern's index
@@ -33,7 +29,7 @@ def findPattern(
         i += 1
         readNext = False
 
-  def _getLPS(self, pattern: list[int]) -> list[int]:
+  def _getLPS(self, pattern: List[int]) -> List[int]:
     """
     Returns the lps array, where lps[i] is the length of the longest prefix of
     pattern[0..i] which is also a suffix of this substring.
diff --git a/solutions/3038. Maximum Number of Operations With the Same Score I/3038.py b/solutions/3038. Maximum Number of Operations With the Same Score I/3038.py
index 116b94505cb..cd0c6575e47 100644
--- a/solutions/3038. Maximum Number of Operations With the Same Score I/3038.py	
+++ b/solutions/3038. Maximum Number of Operations With the Same Score I/3038.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxOperations(self, nums: list[int]) -> int:
+  def maxOperations(self, nums: List[int]) -> int:
     ans = 1
     summ = nums[0] + nums[1]
 
diff --git a/solutions/3039. Apply Operations to Make String Empty/3039.cpp b/solutions/3039. Apply Operations to Make String Empty/3039.cpp
index 46b05d01293..5e734374242 100644
--- a/solutions/3039. Apply Operations to Make String Empty/3039.cpp	
+++ b/solutions/3039. Apply Operations to Make String Empty/3039.cpp	
@@ -13,7 +13,6 @@ class Solution {
       if (count[s[i] - 'a']-- == maxFreq)
         ans += s[i];
 
-    ranges::reverse(ans);
-    return ans;
+    return {ans.rbegin(), ans.rend()};
   }
 };
diff --git a/solutions/304. Range Sum Query 2D - Immutable/304.py b/solutions/304. Range Sum Query 2D - Immutable/304.py
index 149bca6a6e9..dfac8bb754e 100644
--- a/solutions/304. Range Sum Query 2D - Immutable/304.py	
+++ b/solutions/304. Range Sum Query 2D - Immutable/304.py	
@@ -1,5 +1,5 @@
 class NumMatrix:
-  def __init__(self, matrix: list[list[int]]):
+  def __init__(self, matrix: List[List[int]]):
     if not matrix:
       return
 
@@ -10,9 +10,10 @@ def __init__(self, matrix: list[list[int]]):
 
     for i in range(m):
       for j in range(n):
-        self.prefix[i + 1][j + 1] = (matrix[i][j] + self.prefix[i][j + 1] +
-                                     self.prefix[i + 1][j] - self.prefix[i][j])
+        self.prefix[i + 1][j + 1] = \
+            matrix[i][j] + self.prefix[i][j + 1] + \
+            self.prefix[i + 1][j] - self.prefix[i][j]
 
   def sumRegion(self, row1: int, col1: int, row2: int, col2: int) -> int:
-    return (self.prefix[row2 + 1][col2 + 1] - self.prefix[row1][col2 + 1] -
-            self.prefix[row2 + 1][col1] + self.prefix[row1][col1])
+    return self.prefix[row2 + 1][col2 + 1] - self.prefix[row1][col2 + 1] - \
+        self.prefix[row2 + 1][col1] + self.prefix[row1][col1]
diff --git a/solutions/3040. Maximum Number of Operations With the Same Score II/3040.py b/solutions/3040. Maximum Number of Operations With the Same Score II/3040.py
index ad6ca7d576b..0e75fe960e2 100644
--- a/solutions/3040. Maximum Number of Operations With the Same Score II/3040.py	
+++ b/solutions/3040. Maximum Number of Operations With the Same Score II/3040.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxOperations(self, nums: list[int]) -> int:
+  def maxOperations(self, nums: List[int]) -> int:
     @functools.lru_cache(None)
     def dp(i: int, j: int, score: int) -> int:
       """
@@ -8,12 +8,12 @@ def dp(i: int, j: int, score: int) -> int:
       """
       if i >= j:
         return 0
-      deleteFirstTwo = (1 + dp(i + 2, j, score)
-                        if nums[i] + nums[i + 1] == score else 0)
-      deleteLastTwo = (1 + dp(i, j - 2, score)
-                       if nums[j] + nums[j - 1] == score else 0)
-      deleteFirstAndLast = (1 + dp(i + 1, j - 1, score)
-                            if nums[i] + nums[j] == score else 0)
+      deleteFirstTwo = 1 + dp(i + 2, j, score) \
+          if nums[i] + nums[i + 1] == score else 0
+      deleteLastTwo = 1 + dp(i, j - 2, score) \
+          if nums[j] + nums[j - 1] == score else 0
+      deleteFirstAndLast = 1 + dp(i + 1, j - 1, score) \
+          if nums[i] + nums[j] == score else 0
       return max(deleteFirstTwo, deleteLastTwo, deleteFirstAndLast)
 
     n = len(nums)
diff --git a/solutions/3041. Maximize Consecutive Elements in an Array After Modification/3041-2.py b/solutions/3041. Maximize Consecutive Elements in an Array After Modification/3041-2.py
index 6e3a168f3e3..a5ea6c77382 100644
--- a/solutions/3041. Maximize Consecutive Elements in an Array After Modification/3041-2.py	
+++ b/solutions/3041. Maximize Consecutive Elements in an Array After Modification/3041-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSelectedElements(self, nums: list[int]) -> int:
+  def maxSelectedElements(self, nums: List[int]) -> int:
     ans = 1
     prev = -math.inf
     # the length of the longest consecutive elements (seq0) ending in the
diff --git a/solutions/3041. Maximize Consecutive Elements in an Array After Modification/3041.py b/solutions/3041. Maximize Consecutive Elements in an Array After Modification/3041.py
index 986a05aba39..e99b2e77042 100644
--- a/solutions/3041. Maximize Consecutive Elements in an Array After Modification/3041.py	
+++ b/solutions/3041. Maximize Consecutive Elements in an Array After Modification/3041.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSelectedElements(self, nums: list[int]) -> int:
+  def maxSelectedElements(self, nums: List[int]) -> int:
     ans = 0
     # {num: the length of the longest consecutive elements ending in num}
     dp = {}
diff --git a/solutions/3042. Count Prefix and Suffix Pairs I/3042.py b/solutions/3042. Count Prefix and Suffix Pairs I/3042.py
index f8c4917966c..9f46b9ff675 100644
--- a/solutions/3042. Count Prefix and Suffix Pairs I/3042.py	
+++ b/solutions/3042. Count Prefix and Suffix Pairs I/3042.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[tuple[str, str], TrieNode] = {}
+    self.children: Dict[Tuple[str, str], TrieNode] = {}
     self.count = 0
 
 
@@ -12,7 +12,7 @@ def insert(self, word: str) -> int:
     node = self.root
     count = 0
     for i, prefix in enumerate(word):
-      suffix = word[-1 - i]
+      suffix = word[-i - 1]
       node = node.children.setdefault((prefix, suffix), TrieNode())
       count += node.count
     node.count += 1
@@ -20,6 +20,6 @@ def insert(self, word: str) -> int:
 
 
 class Solution:
-  def countPrefixSuffixPairs(self, words: list[str]) -> int:
+  def countPrefixSuffixPairs(self, words: List[str]) -> int:
     trie = Trie()
     return sum(trie.insert(word) for word in words)
diff --git a/solutions/3043. Find the Length of the Longest Common Prefix/3043.py b/solutions/3043. Find the Length of the Longest Common Prefix/3043.py
index de9e4ea7988..717b541eddd 100644
--- a/solutions/3043. Find the Length of the Longest Common Prefix/3043.py	
+++ b/solutions/3043. Find the Length of the Longest Common Prefix/3043.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
 
 
 class Trie:
@@ -25,7 +25,7 @@ def search(self, word: str) -> int:
 
 
 class Solution:
-  def longestCommonPrefix(self, arr1: list[int], arr2: list[int]) -> int:
+  def longestCommonPrefix(self, arr1: List[int], arr2: List[int]) -> int:
     trie = Trie()
 
     for num in arr1:
diff --git a/solutions/3044. Most Frequent Prime/3044.cpp b/solutions/3044. Most Frequent Prime/3044.cpp
index e26267e9de5..cb7320074dd 100644
--- a/solutions/3044. Most Frequent Prime/3044.cpp	
+++ b/solutions/3044. Most Frequent Prime/3044.cpp	
@@ -1,8 +1,8 @@
 class Solution {
  public:
   int mostFrequentPrime(vector<vector<int>>& mat) {
-    constexpr int kDirs[8][2] = {{1, 0},  {1, -1}, {0, -1}, {-1, -1},
-                                 {-1, 0}, {-1, 1}, {0, 1},  {1, 1}};
+    constexpr int dirs[8][2] = {{1, 0},  {1, -1}, {0, -1}, {-1, -1},
+                                {-1, 0}, {-1, 1}, {0, 1},  {1, 1}};
     const int m = mat.size();
     const int n = mat[0].size();
     int ans = -1;
@@ -11,7 +11,7 @@ class Solution {
 
     for (int i = 0; i < m; ++i)
       for (int j = 0; j < n; ++j)
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           int num = 0;
           for (int x = i, y = j; 0 <= x && x < m && 0 <= y && y < n;
                x += dx, y += dy) {
diff --git a/solutions/3044. Most Frequent Prime/3044.java b/solutions/3044. Most Frequent Prime/3044.java
index 71f717955bc..b2b86b703b6 100644
--- a/solutions/3044. Most Frequent Prime/3044.java	
+++ b/solutions/3044. Most Frequent Prime/3044.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int mostFrequentPrime(int[][] mat) {
-    final int[][] DIRS = {{1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}, {0, 1}, {1, 1}};
+    final int[][] dirs = {{1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}, {0, 1}, {1, 1}};
     final int m = mat.length;
     final int n = mat[0].length;
     int ans = -1;
@@ -9,7 +9,7 @@ public int mostFrequentPrime(int[][] mat) {
 
     for (int i = 0; i < m; ++i)
       for (int j = 0; j < n; ++j)
-        for (int[] dir : DIRS) {
+        for (int[] dir : dirs) {
           int num = 0;
           int x = i;
           int y = j;
diff --git a/solutions/3044. Most Frequent Prime/3044.py b/solutions/3044. Most Frequent Prime/3044.py
index 6628e80f933..8012cf20197 100644
--- a/solutions/3044. Most Frequent Prime/3044.py	
+++ b/solutions/3044. Most Frequent Prime/3044.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def mostFrequentPrime(self, mat: list[list[int]]) -> int:
-    DIRS = ((1, 0), (1, -1), (0, -1), (-1, -1),
+  def mostFrequentPrime(self, mat: List[List[int]]) -> int:
+    dirs = ((1, 0), (1, -1), (0, -1), (-1, -1),
             (-1, 0), (-1, 1), (0, 1), (1, 1))
     m = len(mat)
     n = len(mat[0])
@@ -11,7 +11,7 @@ def isPrime(num: int) -> bool:
 
     for i in range(m):
       for j in range(n):
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           num = 0
           x = i
           y = j
diff --git a/solutions/3045. Count Prefix and Suffix Pairs II/3045.py b/solutions/3045. Count Prefix and Suffix Pairs II/3045.py
index 8ad9961f778..06a49b9170b 100644
--- a/solutions/3045. Count Prefix and Suffix Pairs II/3045.py	
+++ b/solutions/3045. Count Prefix and Suffix Pairs II/3045.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[tuple[str, str], TrieNode] = {}
+    self.children: Dict[Tuple[str, str], TrieNode] = {}
     self.count = 0
 
 
@@ -12,7 +12,7 @@ def insert(self, word: str) -> int:
     node = self.root
     count = 0
     for i, prefix in enumerate(word):
-      suffix = word[-1 - i]
+      suffix = word[-i - 1]
       node = node.children.setdefault((prefix, suffix), TrieNode())
       count += node.count
     node.count += 1
@@ -21,6 +21,6 @@ def insert(self, word: str) -> int:
 
 class Solution:
   # Same as 3045. Count Prefix and Suffix Pairs II
-  def countPrefixSuffixPairs(self, words: list[str]) -> int:
+  def countPrefixSuffixPairs(self, words: List[str]) -> int:
     trie = Trie()
     return sum(trie.insert(word) for word in words)
diff --git a/solutions/3046. Split the Array/3046.java b/solutions/3046. Split the Array/3046.java
index e064441ecc3..492e2ad76a9 100644
--- a/solutions/3046. Split the Array/3046.java	
+++ b/solutions/3046. Split the Array/3046.java	
@@ -1,7 +1,7 @@
 class Solution {
   public boolean isPossibleToSplit(int[] nums) {
-    final int MAX = 100;
-    int[] count = new int[MAX + 1];
+    final int kMax = 100;
+    int[] count = new int[kMax + 1];
 
     for (final int num : nums)
       ++count[num];
diff --git a/solutions/3046. Split the Array/3046.py b/solutions/3046. Split the Array/3046.py
index 3b9cea4867f..6298f4ceb9d 100644
--- a/solutions/3046. Split the Array/3046.py	
+++ b/solutions/3046. Split the Array/3046.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def isPossibleToSplit(self, nums: list[int]) -> bool:
+  def isPossibleToSplit(self, nums: List[int]) -> bool:
     return all(freq <= 2 for freq in collections.Counter(nums).values())
diff --git a/solutions/3047. Find the Largest Area of Square Inside Two Rectangles/3047.py b/solutions/3047. Find the Largest Area of Square Inside Two Rectangles/3047.py
index 772e76e1246..2006d3aab8f 100644
--- a/solutions/3047. Find the Largest Area of Square Inside Two Rectangles/3047.py	
+++ b/solutions/3047. Find the Largest Area of Square Inside Two Rectangles/3047.py	
@@ -1,13 +1,8 @@
 class Solution:
-  def largestSquareArea(
-      self,
-      bottomLeft: list[list[int]],
-      topRight: list[list[int]],
-  ) -> int:
+  def largestSquareArea(self, bottomLeft: List[List[int]], topRight: List[List[int]]) -> int:
     minSide = 0
 
-    for ((ax1, ay1), (ax2, ay2)), ((bx1, by1), (bx2, by2)) in (
-            itertools.combinations(zip(bottomLeft, topRight), 2)):
+    for ((ax1, ay1), (ax2, ay2)), ((bx1, by1), (bx2, by2)) in itertools.combinations(zip(bottomLeft, topRight), 2):
       overlapX = min(ax2, bx2) - max(ax1, bx1)
       overlapY = min(ay2, by2) - max(ay1, by1)
       minSide = max(minSide, min(overlapX, overlapY))
diff --git a/solutions/3048. Earliest Second to Mark Indices I/3048.py b/solutions/3048. Earliest Second to Mark Indices I/3048.py
index 2cbdee7333c..bf240ee4f78 100644
--- a/solutions/3048. Earliest Second to Mark Indices I/3048.py	
+++ b/solutions/3048. Earliest Second to Mark Indices I/3048.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def earliestSecondToMarkIndices(
-      self,
-      nums: list[int],
-      changeIndices: list[int],
-  ) -> int:
+  def earliestSecondToMarkIndices(self, nums: List[int], changeIndices: List[int]) -> int:
     def canMark(second: int) -> bool:
       """
       Returns True if all indices of `nums` can be marked within `second`.
@@ -30,7 +26,6 @@ def canMark(second: int) -> bool:
 
       return numMarked == len(nums)
 
-    l = 1
-    r = len(changeIndices) + 1
-    ans = bisect.bisect_left(range(l, r), True, key=canMark) + l
-    return ans if ans <= len(changeIndices) else -1
+    l = bisect.bisect_left(range(1, len(changeIndices) + 1), True,
+                           key=lambda m: canMark(m)) + 1
+    return l if l <= len(changeIndices) else -1
diff --git a/solutions/3049. Earliest Second to Mark Indices II/3049.py b/solutions/3049. Earliest Second to Mark Indices II/3049.py
index fe60424d3c3..76e80d70238 100644
--- a/solutions/3049. Earliest Second to Mark Indices II/3049.py	
+++ b/solutions/3049. Earliest Second to Mark Indices II/3049.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def earliestSecondToMarkIndices(
-      self,
-      nums: list[int],
-      changeIndices: list[int],
-  ) -> int:
+  def earliestSecondToMarkIndices(self, nums: List[int], changeIndices: List[int]) -> int:
     # {the second: the index of nums can be zeroed at the current second}
     secondToIndex = self._getSecondToIndex(nums, changeIndices)
     numsSum = sum(nums)
@@ -36,21 +32,16 @@ def canMark(maxSecond: int) -> bool:
           # So, the current second will be used to mark an index.
           marks += 1
 
-      decrementAndMarkCost = ((numsSum - sum(minHeap)) +
-                              (len(nums) - len(minHeap)))
+      decrementAndMarkCost = (numsSum - sum(minHeap)) + \
+          (len(nums) - len(minHeap))
       zeroAndMarkCost = len(minHeap) + len(minHeap)
       return decrementAndMarkCost + zeroAndMarkCost <= maxSecond
 
-    l = 0
-    r = len(changeIndices) + 1
-    ans = bisect.bisect_left(range(l, r), True, key=canMark) + l
-    return ans if ans <= len(changeIndices) else -1
+    l = bisect.bisect_left(range(1, len(changeIndices) + 1), True,
+                           key=lambda m: canMark(m)) + 1
+    return l if l <= len(changeIndices) else -1
 
-  def _getSecondToIndex(
-      self,
-      nums: list[int],
-      changeIndices: list[int],
-  ) -> dict[int, int]:
+  def _getSecondToIndex(self, nums: List[int], changeIndices: List[int]) -> Dict[int, int]:
     # {the `index` of nums: the earliest second to zero out nums[index]}
     indexToFirstSecond = {}
     for zeroIndexedSecond, oneIndexedIndex in enumerate(changeIndices):
diff --git a/solutions/305. Number of Islands II/305.cpp b/solutions/305. Number of Islands II/305.cpp
index ced98b402eb..1acbff2b2ec 100644
--- a/solutions/305. Number of Islands II/305.cpp	
+++ b/solutions/305. Number of Islands II/305.cpp	
@@ -30,7 +30,7 @@ class UnionFind {
 class Solution {
  public:
   vector<int> numIslands2(int m, int n, vector<vector<int>>& positions) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     vector<int> ans;
     vector<vector<bool>> seen(m, vector<bool>(n));
     UnionFind uf(m * n);
@@ -47,7 +47,7 @@ class Solution {
       const int id = getId(i, j, n);
       uf.id[id] = id;
       ++count;
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/305. Number of Islands II/305.java b/solutions/305. Number of Islands II/305.java
index c3422a6634d..17607703624 100644
--- a/solutions/305. Number of Islands II/305.java	
+++ b/solutions/305. Number of Islands II/305.java	
@@ -31,7 +31,7 @@ public int find(int u) {
 
 class Solution {
   public List<Integer> numIslands2(int m, int n, int[][] positions) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     List<Integer> ans = new ArrayList<>();
     boolean[][] seen = new boolean[m][n];
     UnionFind uf = new UnionFind(m * n);
@@ -48,7 +48,7 @@ public List<Integer> numIslands2(int m, int n, int[][] positions) {
       final int id = getId(i, j, n);
       uf.id[id] = id;
       ++count;
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/305. Number of Islands II/305.py b/solutions/305. Number of Islands II/305.py
index 101847ce5b3..a7b5e04833e 100644
--- a/solutions/305. Number of Islands II/305.py	
+++ b/solutions/305. Number of Islands II/305.py	
@@ -23,13 +23,8 @@ def find(self, u: int) -> int:
 
 
 class Solution:
-  def numIslands2(
-      self,
-      m: int,
-      n: int,
-      positions: list[list[int]],
-  ) -> list[int]:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def numIslands2(self, m: int, n: int, positions: List[List[int]]) -> List[int]:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     ans = []
     seen = [[False] * n for _ in range(m)]
     uf = UnionFind(m * n)
@@ -46,7 +41,7 @@ def getId(i: int, j: int, n: int) -> int:
       id = getId(i, j, n)
       uf.id[id] = id
       count += 1
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/306. Additive Number/306.py b/solutions/306. Additive Number/306.py
index c3642af60b1..1df82a17d37 100644
--- a/solutions/306. Additive Number/306.py	
+++ b/solutions/306. Additive Number/306.py	
@@ -9,8 +9,7 @@ def dfs(firstNum: int, secondNum: int, s: int) -> bool:
       thirdNum = firstNum + secondNum
       thirdNumStr = str(thirdNum)
 
-      return (num.find(thirdNumStr, s) == s and
-              dfs(secondNum, thirdNum, s + len(thirdNumStr)))
+      return num.find(thirdNumStr, s) == s and dfs(secondNum, thirdNum, s + len(thirdNumStr))
 
     # num[0..i] = firstNum
     for i in range(n // 2):
diff --git a/solutions/3062. Winner of the Linked List Game/3062.py b/solutions/3062. Winner of the Linked List Game/3062.py
index cf0c170527d..294df3bd6dd 100644
--- a/solutions/3062. Winner of the Linked List Game/3062.py	
+++ b/solutions/3062. Winner of the Linked List Game/3062.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def gameResult(self, head: ListNode | None) -> str:
+  def gameResult(self, head: Optional[ListNode]) -> str:
     even = 0
     odd = 0
 
diff --git a/solutions/3063. Linked List Frequency/3063.py b/solutions/3063. Linked List Frequency/3063.py
index 5f89c84c16e..91e18ddb9c0 100644
--- a/solutions/3063. Linked List Frequency/3063.py	
+++ b/solutions/3063. Linked List Frequency/3063.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def frequenciesOfElements(self, head: ListNode | None) -> ListNode | None:
+  def frequenciesOfElements(self, head: Optional[ListNode]) -> Optional[ListNode]:
     count = collections.Counter()
     curr = head
 
diff --git a/solutions/3064. Guess the Number Using Bitwise Questions I/3064.java b/solutions/3064. Guess the Number Using Bitwise Questions I/3064.java
index c203d7abd1a..736592dfae7 100644
--- a/solutions/3064. Guess the Number Using Bitwise Questions I/3064.java	
+++ b/solutions/3064. Guess the Number Using Bitwise Questions I/3064.java	
@@ -5,9 +5,9 @@
 
 public class Solution extends Problem {
   public int findNumber() {
-    final int MAX_BIT = 30;
+    final int kMaxBit = 30;
     int ans = 0;
-    for (int i = 0; i <= MAX_BIT; ++i)
+    for (int i = 0; i <= kMaxBit; ++i)
       if (commonSetBits(1 << i) == 1)
         ans |= 1 << i;
     return ans;
diff --git a/solutions/3065. Minimum Operations to Exceed Threshold Value I/3065.py b/solutions/3065. Minimum Operations to Exceed Threshold Value I/3065.py
index 14e94f10a2f..4b050c9da61 100644
--- a/solutions/3065. Minimum Operations to Exceed Threshold Value I/3065.py	
+++ b/solutions/3065. Minimum Operations to Exceed Threshold Value I/3065.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def minOperations(self, nums: list[int], k: int) -> int:
+  def minOperations(self, nums: List[int], k: int) -> int:
     return sum(num < k for num in nums)
diff --git a/solutions/3066. Minimum Operations to Exceed Threshold Value II/3066.py b/solutions/3066. Minimum Operations to Exceed Threshold Value II/3066.py
index 3d2299bc93e..55866e8ecc8 100644
--- a/solutions/3066. Minimum Operations to Exceed Threshold Value II/3066.py	
+++ b/solutions/3066. Minimum Operations to Exceed Threshold Value II/3066.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums: list[int], k: int) -> int:
+  def minOperations(self, nums: List[int], k: int) -> int:
     ans = 0
     minHeap = nums.copy()
     heapq.heapify(minHeap)
diff --git a/solutions/3067. Count Pairs of Connectable Servers in a Weighted Tree Network/3067.cpp b/solutions/3067. Count Pairs of Connectable Servers in a Weighted Tree Network/3067.cpp
index 431b0df5b27..ab16631238a 100644
--- a/solutions/3067. Count Pairs of Connectable Servers in a Weighted Tree Network/3067.cpp	
+++ b/solutions/3067. Count Pairs of Connectable Servers in a Weighted Tree Network/3067.cpp	
@@ -40,9 +40,11 @@ class Solution {
   int dfs(const vector<vector<pair<int, int>>>& tree, int u, int prev, int dist,
           int signalSpeed) {
     int count = 0;
-    for (const auto& [v, w] : tree[u])
-      if (v != prev)
-        count += dfs(tree, v, u, dist + w, signalSpeed);
+    for (const auto& [v, w] : tree[u]) {
+      if (v == prev)
+        continue;
+      count += dfs(tree, v, u, dist + w, signalSpeed);
+    }
     return (dist % signalSpeed == 0 ? 1 : 0) + count;
   }
 };
diff --git a/solutions/3067. Count Pairs of Connectable Servers in a Weighted Tree Network/3067.java b/solutions/3067. Count Pairs of Connectable Servers in a Weighted Tree Network/3067.java
index cb96a8efc9a..f4b438e2cfa 100644
--- a/solutions/3067. Count Pairs of Connectable Servers in a Weighted Tree Network/3067.java	
+++ b/solutions/3067. Count Pairs of Connectable Servers in a Weighted Tree Network/3067.java	
@@ -45,8 +45,9 @@ private int dfs(List<Pair<Integer, Integer>>[] graph, int u, int prev, int dist,
     for (Pair<Integer, Integer> pair : graph[u]) {
       final int v = pair.getKey();
       final int w = pair.getValue();
-      if (v != prev)
-        count += dfs(graph, v, u, dist + w, signalSpeed);
+      if (v == prev)
+        continue;
+      count += dfs(graph, v, u, dist + w, signalSpeed);
     }
     return (dist % signalSpeed == 0 ? 1 : 0) + count;
   }
diff --git a/solutions/3067. Count Pairs of Connectable Servers in a Weighted Tree Network/3067.py b/solutions/3067. Count Pairs of Connectable Servers in a Weighted Tree Network/3067.py
index 053b9edde02..5194bb2743a 100644
--- a/solutions/3067. Count Pairs of Connectable Servers in a Weighted Tree Network/3067.py	
+++ b/solutions/3067. Count Pairs of Connectable Servers in a Weighted Tree Network/3067.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def countPairsOfConnectableServers(
-      self,
-      edges: list[list[int]],
-      signalSpeed: int,
-  ) -> list[int]:
+  def countPairsOfConnectableServers(self, edges: List[List[int]], signalSpeed: int) -> List[int]:
     n = len(edges) + 1
     tree = [[] for _ in range(n)]
 
@@ -21,9 +17,9 @@ def connectablePairsRootedAt(u: int) -> int:
       return pairs
 
     def dfs(u: int, prev: int, dist: int) -> int:
-      return (int(dist % signalSpeed == 0) +
-              sum(dfs(v, u, dist + w)
+      return int(dist % signalSpeed == 0) + \
+          sum(dfs(v, u, dist + w)
               for v, w in tree[u]
-              if v != prev))
+              if v != prev)
 
     return [connectablePairsRootedAt(i) for i in range(n)]
diff --git a/solutions/3068. Find the Maximum Sum of Node Values/3068.py b/solutions/3068. Find the Maximum Sum of Node Values/3068.py
index 9aea91814e7..b8ae8f4661c 100644
--- a/solutions/3068. Find the Maximum Sum of Node Values/3068.py	
+++ b/solutions/3068. Find the Maximum Sum of Node Values/3068.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def maximumValueSum(
-      self,
-      nums: list[int],
-      k: int,
-      edges: list[list[int]],
-  ) -> int:
+  def maximumValueSum(self, nums: List[int], k: int, edges: List[List[int]]) -> int:
     maxSum = sum(max(num, num ^ k) for num in nums)
     changedCount = sum((num ^ k) > num for num in nums)
     if changedCount % 2 == 0:
diff --git a/solutions/3069. Distribute Elements Into Two Arrays I/3069.java b/solutions/3069. Distribute Elements Into Two Arrays I/3069.java
index badddd0b33b..31bf3ceb819 100644
--- a/solutions/3069. Distribute Elements Into Two Arrays I/3069.java	
+++ b/solutions/3069. Distribute Elements Into Two Arrays I/3069.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int[] resultArray(int[] nums) {
-    List<Integer> arr1 = new ArrayList<>(List.of(nums[0]));
-    List<Integer> arr2 = new ArrayList<>(List.of(nums[1]));
+    List<Integer> arr1 = new ArrayList<>(Arrays.asList(nums[0]));
+    List<Integer> arr2 = new ArrayList<>(Arrays.asList(nums[1]));
 
     for (int i = 2; i < nums.length; ++i)
       if (arr1.get(arr1.size() - 1) > arr2.get(arr2.size() - 1))
diff --git a/solutions/3069. Distribute Elements Into Two Arrays I/3069.py b/solutions/3069. Distribute Elements Into Two Arrays I/3069.py
index e2f564a360a..aff3d0a6a80 100644
--- a/solutions/3069. Distribute Elements Into Two Arrays I/3069.py	
+++ b/solutions/3069. Distribute Elements Into Two Arrays I/3069.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def resultArray(self, nums: list[int]) -> list[int]:
+  def resultArray(self, nums: List[int]) -> List[int]:
     arr1 = [nums[0]]
     arr2 = [nums[1]]
 
diff --git a/solutions/307. Range Sum Query - Mutable/307-2.cpp b/solutions/307. Range Sum Query - Mutable/307-2.cpp
index aa4df5e2725..d7648cb3791 100644
--- a/solutions/307. Range Sum Query - Mutable/307-2.cpp	
+++ b/solutions/307. Range Sum Query - Mutable/307-2.cpp	
@@ -10,7 +10,7 @@ class SegmentTree {
   }
 
   // Returns sum(nums[i..j]).
-  int query(int i, int j) const {
+  int query(int i, int j) {
     return query(0, 0, n - 1, i, j);
   }
 
@@ -42,7 +42,7 @@ class SegmentTree {
     tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
   }
 
-  int query(int treeIndex, int lo, int hi, int i, int j) const {
+  int query(int treeIndex, int lo, int hi, int i, int j) {
     if (i <= lo && hi <= j)  // [lo, hi] lies completely inside [i, j].
       return tree[treeIndex];
     if (j < lo || hi < i)  // [lo, hi] lies completely outside [i, j].
@@ -52,8 +52,9 @@ class SegmentTree {
                  query(treeIndex * 2 + 2, mid + 1, hi, i, j));
   }
 
-  int merge(int left, int right) const {
-    return left + right;
+  // Merges the result of the left node and the right node.
+  int merge(int a, int b) const {
+    return a + b;
   }
 };
 
diff --git a/solutions/307. Range Sum Query - Mutable/307-3.cpp b/solutions/307. Range Sum Query - Mutable/307-3.cpp
index 1d9047697a6..33043dd1337 100644
--- a/solutions/307. Range Sum Query - Mutable/307-3.cpp	
+++ b/solutions/307. Range Sum Query - Mutable/307-3.cpp	
@@ -60,11 +60,7 @@ class SegmentTree {
     // [lo, hi] lies completely outside [i, j].
     if (j < root->lo || root->hi < i)
       return 0;
-    return merge(query(root->left, i, j), query(root->right, i, j));
-  }
-
-  int merge(int left, int right) const {
-    return left + right;
+    return query(root->left, i, j) + query(root->right, i, j);
   }
 };
 
diff --git a/solutions/307. Range Sum Query - Mutable/307.py b/solutions/307. Range Sum Query - Mutable/307.py
index 4814f976644..c53e3cda74a 100644
--- a/solutions/307. Range Sum Query - Mutable/307.py	
+++ b/solutions/307. Range Sum Query - Mutable/307.py	
@@ -20,7 +20,7 @@ def lowbit(i: int) -> int:
 
 
 class NumArray:
-  def __init__(self, nums: list[int]):
+  def __init__(self, nums: List[int]):
     self.nums = nums
     self.tree = FenwickTree(len(nums))
     for i, num in enumerate(nums):
diff --git a/solutions/3070. Count Submatrices with Top-Left Element and Sum Less Than k/3070.py b/solutions/3070. Count Submatrices with Top-Left Element and Sum Less Than k/3070.py
index 3361a76c91d..7eee9f4e040 100644
--- a/solutions/3070. Count Submatrices with Top-Left Element and Sum Less Than k/3070.py	
+++ b/solutions/3070. Count Submatrices with Top-Left Element and Sum Less Than k/3070.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countSubmatrices(self, grid: list[list[int]], k: int) -> int:
+  def countSubmatrices(self, grid: List[List[int]], k: int) -> int:
     m = len(grid)
     n = len(grid[0])
     ans = 0
@@ -8,8 +8,9 @@ def countSubmatrices(self, grid: list[list[int]], k: int) -> int:
 
     for i in range(m):
       for j in range(n):
-        prefix[i + 1][j + 1] = (grid[i][j] + prefix[i][j + 1] +
-                                prefix[i + 1][j] - prefix[i][j])
+        prefix[i + 1][j + 1] = \
+            grid[i][j] + prefix[i][j + 1] + \
+            prefix[i + 1][j] - prefix[i][j]
         if prefix[i + 1][j + 1] <= k:
           ans += 1
 
diff --git a/solutions/3071. Minimum Operations to Write the Letter Y on a Grid/3071.py b/solutions/3071. Minimum Operations to Write the Letter Y on a Grid/3071.py
index dac0f3ecf29..c453d5389a0 100644
--- a/solutions/3071. Minimum Operations to Write the Letter Y on a Grid/3071.py	
+++ b/solutions/3071. Minimum Operations to Write the Letter Y on a Grid/3071.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumOperationsToWriteY(self, grid: list[list[int]]) -> int:
+  def minimumOperationsToWriteY(self, grid: List[List[int]]) -> int:
     n = len(grid)
     mid = n // 2
 
diff --git a/solutions/3072. Distribute Elements Into Two Arrays II/3072.py b/solutions/3072. Distribute Elements Into Two Arrays II/3072.py
index 0f8e1a4a022..8af40ab54dd 100644
--- a/solutions/3072. Distribute Elements Into Two Arrays II/3072.py	
+++ b/solutions/3072. Distribute Elements Into Two Arrays II/3072.py	
@@ -20,14 +20,14 @@ def lowbit(i: int) -> int:
 
 
 class Solution:
-  def resultArray(self, nums: list[int]) -> list[int]:
+  def resultArray(self, nums: List[int]) -> List[int]:
     arr1 = []
     arr2 = []
     ranks = self._getRanks(nums)
     tree1 = FenwickTree(len(ranks))
     tree2 = FenwickTree(len(ranks))
 
-    def add(num: int, arr: list[int], tree: FenwickTree) -> None:
+    def add(num: int, arr: List[int], tree: FenwickTree) -> None:
       arr.append(num)
       tree.add(ranks[num], 1)
 
@@ -48,7 +48,7 @@ def add(num: int, arr: list[int], tree: FenwickTree) -> None:
 
     return arr1 + arr2
 
-  def _getRanks(self, nums: list[int]) -> dict[int, int]:
+  def _getRanks(self, nums: List[int]) -> Dict[int, int]:
     ranks = collections.Counter()
     rank = 0
     for num in sorted(set(nums)):
diff --git a/solutions/3073. Maximum Increasing Triplet Value/3073.py b/solutions/3073. Maximum Increasing Triplet Value/3073.py
index 797ea57e6e2..85bcc346119 100644
--- a/solutions/3073. Maximum Increasing Triplet Value/3073.py	
+++ b/solutions/3073. Maximum Increasing Triplet Value/3073.py	
@@ -2,7 +2,7 @@
 
 
 class Solution:
-  def maximumTripletValue(self, nums: list[int]) -> int:
+  def maximumTripletValue(self, nums: List[int]) -> int:
     ans = 0
     rightMax = [0] * len(nums)  # rightMax[i] := max(nums[i + 1..n))
     leftSortedSet = SortedSet([nums[0]])
diff --git a/solutions/3074. Apple Redistribution into Boxes/3074.py b/solutions/3074. Apple Redistribution into Boxes/3074.py
index 3fc93c828fc..f6fede073ef 100644
--- a/solutions/3074. Apple Redistribution into Boxes/3074.py	
+++ b/solutions/3074. Apple Redistribution into Boxes/3074.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumBoxes(self, apple: list[int], capacity: list[int]) -> int:
+  def minimumBoxes(self, apple: List[int], capacity: List[int]) -> int:
     appleSum = sum(apple)
     capacitySum = 0
 
diff --git a/solutions/3075. Maximize Happiness of Selected Children/3075.py b/solutions/3075. Maximize Happiness of Selected Children/3075.py
index e4700f3579b..0e3c14b0003 100644
--- a/solutions/3075. Maximize Happiness of Selected Children/3075.py	
+++ b/solutions/3075. Maximize Happiness of Selected Children/3075.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumHappinessSum(self, happiness: list[int], k: int) -> int:
+  def maximumHappinessSum(self, happiness: List[int], k: int) -> int:
     ans = 0
     decremented = 0
 
diff --git a/solutions/3076. Shortest Uncommon Substring in an Array/3076.py b/solutions/3076. Shortest Uncommon Substring in an Array/3076.py
index eabaa39deaa..9f559fa0641 100644
--- a/solutions/3076. Shortest Uncommon Substring in an Array/3076.py	
+++ b/solutions/3076. Shortest Uncommon Substring in an Array/3076.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def shortestSubstrings(self, arr: list[str]) -> list[str]:
+  def shortestSubstrings(self, arr: List[str]) -> List[str]:
     ans = []
     count = collections.Counter()
 
@@ -23,9 +23,9 @@ def getMinSub(s: str) -> str:
       for sub in getSubstrings(s):
         if count[sub] > 0:
           continue
-        if minSub == ('' or
-                      len(sub) < len(minSub) or
-                      len(sub) == len(minSub) and sub < minSub):
+        if minSub == '' or \
+                len(sub) < len(minSub) or \
+                len(sub) == len(minSub) and sub < minSub:
           minSub = sub
       return minSub
 
diff --git a/solutions/3077. Maximum Strength of K Disjoint Subarrays/3077.java b/solutions/3077. Maximum Strength of K Disjoint Subarrays/3077.java
index 3a955bfd436..f083c1a89d1 100644
--- a/solutions/3077. Maximum Strength of K Disjoint Subarrays/3077.java	
+++ b/solutions/3077. Maximum Strength of K Disjoint Subarrays/3077.java	
@@ -4,23 +4,23 @@ public long maximumStrength(int[] nums, int k) {
     return maximumStrength(nums, 0, k, /*fresh=*/true, mem);
   }
 
-  private static final long MIN = Long.MIN_VALUE / 2;
+  private static final long kMin = Long.MIN_VALUE / 2;
 
   // Returns the maximum strength of nums[i..n) with k operations left, where
   // `fresh` means we're starting a new subarray.
   private long maximumStrength(int[] nums, int i, int k, boolean fresh, Long[][][] mem) {
     if (nums.length - i < k)
-      return MIN;
+      return kMin;
     if (k == 0)
       return 0;
     if (i == nums.length)
-      return k == 0 ? 0 : MIN;
+      return k == 0 ? 0 : kMin;
     if (mem[i][k][fresh ? 1 : 0] != null)
       return mem[i][k][fresh ? 1 : 0];
     // If it's not fresh, we can't skip the current number and consider it as a
     // fresh start, since the case where it's fresh is already covered by
     // `includeAndFreshStart`.
-    final long skip = fresh ? maximumStrength(nums, i + 1, k, true, mem) : MIN;
+    final long skip = fresh ? maximumStrength(nums, i + 1, k, true, mem) : kMin;
     final long gain = (k % 2 == 0 ? -1 : 1) * 1L * nums[i] * k;
     final long includeAndContinue = maximumStrength(nums, i + 1, k, false, mem) + gain;
     final long includeAndFreshStart = maximumStrength(nums, i + 1, k - 1, true, mem) + gain;
diff --git a/solutions/3077. Maximum Strength of K Disjoint Subarrays/3077.py b/solutions/3077. Maximum Strength of K Disjoint Subarrays/3077.py
index d8804d4d4d0..caf23f366c1 100644
--- a/solutions/3077. Maximum Strength of K Disjoint Subarrays/3077.py	
+++ b/solutions/3077. Maximum Strength of K Disjoint Subarrays/3077.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumStrength(self, nums: list[int], k: int) -> int:
+  def maximumStrength(self, nums: List[int], k: int) -> int:
 
     @functools.lru_cache(None)
     def dp(i: int, k: int, fresh: bool) -> int:
diff --git a/solutions/3078. Match Alphanumerical Pattern in Matrix I/3078.py b/solutions/3078. Match Alphanumerical Pattern in Matrix I/3078.py
index 463eff4aeaf..58c6ce698d5 100644
--- a/solutions/3078. Match Alphanumerical Pattern in Matrix I/3078.py	
+++ b/solutions/3078. Match Alphanumerical Pattern in Matrix I/3078.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def findPattern(
-      self,
-      board: list[list[int]],
-      pattern: list[str],
-  ) -> list[int]:
+  def findPattern(self, board: List[List[int]], pattern: List[str]) -> List[int]:
     def isMatch(x: int, y: int) -> bool:
       digitToLetter = {}
       letterToDigit = {}
diff --git a/solutions/3079. Find the Sum of Encrypted Integers/3079.py b/solutions/3079. Find the Sum of Encrypted Integers/3079.py
index 63d8d3a6c91..cf8f4013ead 100644
--- a/solutions/3079. Find the Sum of Encrypted Integers/3079.py	
+++ b/solutions/3079. Find the Sum of Encrypted Integers/3079.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sumOfEncryptedInt(self, nums: list[int]) -> int:
+  def sumOfEncryptedInt(self, nums: List[int]) -> int:
     def getEncrypted(num: int) -> int:
       maxDigit = 0
       base = 0
diff --git a/solutions/308. Range Sum Query 2D - Mutable/308.py b/solutions/308. Range Sum Query 2D - Mutable/308.py
index b693d7d93d8..887bee7c227 100644
--- a/solutions/308. Range Sum Query 2D - Mutable/308.py	
+++ b/solutions/308. Range Sum Query 2D - Mutable/308.py	
@@ -28,7 +28,7 @@ def lowbit(i: int) -> int:
 
 
 class NumMatrix:
-  def __init__(self, matrix: list[list[int]]):
+  def __init__(self, matrix: List[List[int]]):
     self.matrix = matrix
     self.tree = FenwickTree(len(matrix), len(matrix[0]))
 
@@ -41,5 +41,5 @@ def update(self, row: int, col: int, val: int) -> None:
     self.matrix[row][col] = val
 
   def sumRegion(self, row1: int, col1: int, row2: int, col2: int) -> int:
-    return (self.tree.get(row2 + 1, col2 + 1) - self.tree.get(row1, col2 + 1) -
-            self.tree.get(row2 + 1, col1) + self.tree.get(row1, col1))
+    return self.tree.get(row2 + 1, col2 + 1) - self.tree.get(row1, col2 + 1) - \
+        self.tree.get(row2 + 1, col1) + self.tree.get(row1, col1)
diff --git a/solutions/3080. Mark Elements on Array by Performing Queries/3080.java b/solutions/3080. Mark Elements on Array by Performing Queries/3080.java
index 2e991124d6c..07cac7af2ac 100644
--- a/solutions/3080. Mark Elements on Array by Performing Queries/3080.java	
+++ b/solutions/3080. Mark Elements on Array by Performing Queries/3080.java	
@@ -4,9 +4,10 @@ public long[] unmarkedSumArray(int[] nums, int[][] queries) {
     boolean[] marked = new boolean[nums.length];
     long sum = Arrays.stream(nums).asLongStream().sum();
     // (nums[i], i)
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair<Integer, Integer>::getKey)
-                                .thenComparingInt(Pair<Integer, Integer>::getValue));
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>(
+        (a, b)
+            -> a.getKey().equals(b.getKey()) ? a.getValue().compareTo(b.getValue())
+                                             : a.getKey().compareTo(b.getKey()));
 
     for (int i = 0; i < nums.length; ++i)
       minHeap.offer(new Pair<>(nums[i], i));
diff --git a/solutions/3080. Mark Elements on Array by Performing Queries/3080.py b/solutions/3080. Mark Elements on Array by Performing Queries/3080.py
index c2965d791ba..434ebc2d096 100644
--- a/solutions/3080. Mark Elements on Array by Performing Queries/3080.py	
+++ b/solutions/3080. Mark Elements on Array by Performing Queries/3080.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def unmarkedSumArray(
-      self,
-      nums: list[int],
-      queries: list[list[int]],
-  ) -> list[int]:
+  def unmarkedSumArray(self, nums: List[int], queries: List[List[int]]) -> List[int]:
     ans = []
     marked = set()
     summ = sum(nums)
diff --git a/solutions/3081. Replace Question Marks in String to Minimize Its Value/3081.py b/solutions/3081. Replace Question Marks in String to Minimize Its Value/3081.py
index 26452d8914a..97b2e0bd07b 100644
--- a/solutions/3081. Replace Question Marks in String to Minimize Its Value/3081.py	
+++ b/solutions/3081. Replace Question Marks in String to Minimize Its Value/3081.py	
@@ -6,7 +6,7 @@ def minimizeStringValue(self, s: str) -> str:
 
     del count['?']
 
-    def getMinFreqLetter(count: dict[str, int]) -> str:
+    def getMinFreqLetter(count: Dict[str, int]) -> str:
       minFreqLetter = 'a'
       for c in string.ascii_lowercase:
         if count[c] < count[minFreqLetter]:
diff --git a/solutions/3082. Find the Sum of the Power of All Subsequences/3082-2.java b/solutions/3082. Find the Sum of the Power of All Subsequences/3082-2.java
index aa590109334..9e6e3b36117 100644
--- a/solutions/3082. Find the Sum of the Power of All Subsequences/3082-2.java	
+++ b/solutions/3082. Find the Sum of the Power of All Subsequences/3082-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int sumOfPower(int[] nums, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = nums.length;
     // dp[i][j] := the number of subsequences in nums[0..i) that sums to k
     int[][] dp = new int[n + 1][k + 1];
@@ -12,12 +12,12 @@ public int sumOfPower(int[] nums, int k) {
         if (j < num)
           // 1. Exclude nums[i] in the subsequence.
           // 2. Include nums[i] in the subsequence and skip it.
-          dp[i][j] = (int) ((dp[i - 1][j] * 2L) % MOD);
+          dp[i][j] = (int) ((dp[i - 1][j] * 2L) % kMod);
         else
           // 1. Exclude nums[i] in the subsequence.
           // 2. Include nums[i] in the subsequence and skip it.
           // 3. Include nums[i] in the subsequence and pick it.
-          dp[i][j] = (int) ((dp[i - 1][j] * 2L + dp[i - 1][j - num]) % MOD);
+          dp[i][j] = (int) ((dp[i - 1][j] * 2L + dp[i - 1][j - num]) % kMod);
     }
 
     return dp[n][k];
diff --git a/solutions/3082. Find the Sum of the Power of All Subsequences/3082-2.py b/solutions/3082. Find the Sum of the Power of All Subsequences/3082-2.py
index 6509250db73..bb5591b690d 100644
--- a/solutions/3082. Find the Sum of the Power of All Subsequences/3082-2.py	
+++ b/solutions/3082. Find the Sum of the Power of All Subsequences/3082-2.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def sumOfPower(self, nums: list[int], k: int) -> int:
-    MOD = 1_000_000_007
+  def sumOfPower(self, nums: List[int], k: int) -> int:
+    kMod = 1_000_000_007
     n = len(nums)
     # dp[i][j] := the number of subsequences in nums[0..i) that sums to k
     dp = [[0] * (k + 1) for _ in range(n + 1)]
@@ -12,11 +12,11 @@ def sumOfPower(self, nums: list[int], k: int) -> int:
         if j < num:
           # 1. Exclude nums[i] in the subsequence.
           # 2. Include nums[i] in the subsequence and skip it.
-          dp[i][j] = (dp[i - 1][j] * 2) % MOD
+          dp[i][j] = (dp[i - 1][j] * 2) % kMod
         else:
           # 1. Exclude nums[i] in the subsequence.
           # 2. Include nums[i] in the subsequence and skip it.
           # 3. Include nums[i] in the subsequence and pick it.
-          dp[i][j] = (dp[i - 1][j] * 2 + dp[i - 1][j - num]) % MOD
+          dp[i][j] = (dp[i - 1][j] * 2 + dp[i - 1][j - num]) % kMod
 
     return dp[n][k]
diff --git a/solutions/3082. Find the Sum of the Power of All Subsequences/3082-3.java b/solutions/3082. Find the Sum of the Power of All Subsequences/3082-3.java
index fb634226b5d..9f7daefd772 100644
--- a/solutions/3082. Find the Sum of the Power of All Subsequences/3082-3.java	
+++ b/solutions/3082. Find the Sum of the Power of All Subsequences/3082-3.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int sumOfPower(int[] nums, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i] := the number of subsequences in nums so far that sums to k
     int[] dp = new int[k + 1];
     dp[0] = 1;
@@ -10,12 +10,12 @@ public int sumOfPower(int[] nums, int k) {
         if (i < num)
           // 1. Exclude nums[i] in the subsequence.
           // 2. Include nums[i] in the subsequence and skip it.
-          dp[i] = (int) ((dp[i] * 2L) % MOD);
+          dp[i] = (int) ((dp[i] * 2L) % kMod);
         else
           // 1. Exclude nums[i] in the subsequence.
           // 2. Include nums[i] in the subsequence and skip it.
           // 3. Include nums[i] in the subsequence and pick it.
-          dp[i] = (int) ((dp[i] * 2L + dp[i - num]) % MOD);
+          dp[i] = (int) ((dp[i] * 2L + dp[i - num]) % kMod);
 
     return dp[k];
   }
diff --git a/solutions/3082. Find the Sum of the Power of All Subsequences/3082-3.py b/solutions/3082. Find the Sum of the Power of All Subsequences/3082-3.py
index cba367e4a2c..d35e92214f4 100644
--- a/solutions/3082. Find the Sum of the Power of All Subsequences/3082-3.py	
+++ b/solutions/3082. Find the Sum of the Power of All Subsequences/3082-3.py	
@@ -1,14 +1,14 @@
 class Solution:
-  def sumOfPower(self, nums: list[int], k: int) -> int:
-    MOD = 1_000_000_007
+  def sumOfPower(self, nums: List[int], k: int) -> int:
+    kMod = 1_000_000_007
     # dp[i] := the number of subsequences in nums so far that sums to k
     dp = [1] + [0] * k
 
     for num in nums:
       for i in range(k, -1, -1):
         if i < num:
-          dp[i] = (dp[i] * 2) % MOD
+          dp[i] = (dp[i] * 2) % kMod
         else:
-          dp[i] = (dp[i] * 2 + dp[i - num]) % MOD
+          dp[i] = (dp[i] * 2 + dp[i - num]) % kMod
 
     return dp[k]
diff --git a/solutions/3082. Find the Sum of the Power of All Subsequences/3082.java b/solutions/3082. Find the Sum of the Power of All Subsequences/3082.java
index a0a033a35d2..405af3c8044 100644
--- a/solutions/3082. Find the Sum of the Power of All Subsequences/3082.java	
+++ b/solutions/3082. Find the Sum of the Power of All Subsequences/3082.java	
@@ -4,7 +4,7 @@ public int sumOfPower(int[] nums, int k) {
     return sumOfPower(nums, 0, k, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of subsequences in nums[i..n) that sums to j.
   private int sumOfPower(int[] nums, int i, int j, Integer[][] mem) {
@@ -20,14 +20,14 @@ private int sumOfPower(int[] nums, int i, int j, Integer[][] mem) {
     // 3. Exclude nums[i] in the subsequence.
     return mem[i][j] = (int) ((sumOfPower(nums, i + 1, j - nums[i], mem) + //
                                2L * sumOfPower(nums, i + 1, j, mem)) %
-                              MOD);
+                              kMod);
   }
 
   private long modPow(long x, long n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return x * modPow(x % MOD, (n - 1)) % MOD;
-    return modPow(x * x % MOD, (n / 2)) % MOD;
+      return x * modPow(x % kMod, (n - 1)) % kMod;
+    return modPow(x * x % kMod, (n / 2)) % kMod;
   }
 }
diff --git a/solutions/3082. Find the Sum of the Power of All Subsequences/3082.py b/solutions/3082. Find the Sum of the Power of All Subsequences/3082.py
index 56648527e41..d88582b4fc8 100644
--- a/solutions/3082. Find the Sum of the Power of All Subsequences/3082.py	
+++ b/solutions/3082. Find the Sum of the Power of All Subsequences/3082.py	
@@ -1,18 +1,18 @@
 class Solution:
-  def sumOfPower(self, nums: list[int], k: int) -> int:
-    MOD = 1_000_000_007
+  def sumOfPower(self, nums: List[int], k: int) -> int:
+    kMod = 1_000_000_007
 
     @functools.lru_cache(None)
     def dp(i: int, j: int) -> int:
       """Returns the number of subsequences in nums[i..n) that sums to j."""
       if j == 0:
         # For each of the remaining number, we can either pick it or skip it.
-        return pow(2, len(nums) - i, MOD)
+        return pow(2, len(nums) - i, kMod)
       if i == len(nums) or j < 0:
         return 0
         # 1. Include nums[i] in the subsequence and pick it.
         # 2. Include nums[i] in the subsequence and skip it.
         # 3. Exclude nums[i] in the subsequence.
-      return (dp(i + 1, j - nums[i]) + 2 * dp(i + 1, j)) % MOD
+      return (dp(i + 1, j - nums[i]) + 2 * dp(i + 1, j)) % kMod
 
     return dp(0, k)
diff --git a/solutions/3086. Minimum Moves to Pick K Ones/3086.java b/solutions/3086. Minimum Moves to Pick K Ones/3086.java
index 0601e57afb9..26bfec67a3c 100644
--- a/solutions/3086. Minimum Moves to Pick K Ones/3086.java	
+++ b/solutions/3086. Minimum Moves to Pick K Ones/3086.java	
@@ -22,7 +22,7 @@ public long minimumMoves(int[] nums, int k, int maxChanges) {
     // a distance <= 1 from dylanIndex, implying that we'll be taking at most
     // `maxOnesByTwo + 3` using Action 2. Any more Action 2 is not optimal and
     // should be replaced with Action 1.
-    final int NUM_OF_INDICES_WITHIN_ONE_DISTANCE = 3;
+    final int kNumOfIndicesWithinOneDistance = 3;
     long ans = Long.MAX_VALUE;
     List<Integer> oneIndices = new ArrayList<>(); // the indices of 1s
     List<Long> prefix = new ArrayList<>();        // the accumulated indices of 1s
@@ -37,7 +37,7 @@ public long minimumMoves(int[] nums, int k, int maxChanges) {
 
     final int minOnesByTwo = Math.max(0, k - maxChanges);
     final int maxOnesByTwo =
-        Math.min(k, Math.min(minOnesByTwo + NUM_OF_INDICES_WITHIN_ONE_DISTANCE, oneIndices.size()));
+        Math.min(k, Math.min(minOnesByTwo + kNumOfIndicesWithinOneDistance, oneIndices.size()));
 
     for (int onesByTwo = minOnesByTwo; onesByTwo <= maxOnesByTwo; ++onesByTwo)
       for (int l = 0; l + onesByTwo < prefix.size(); ++l) {
diff --git a/solutions/3086. Minimum Moves to Pick K Ones/3086.py b/solutions/3086. Minimum Moves to Pick K Ones/3086.py
index c24a9c8fad8..00da63d2a96 100644
--- a/solutions/3086. Minimum Moves to Pick K Ones/3086.py	
+++ b/solutions/3086. Minimum Moves to Pick K Ones/3086.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumMoves(self, nums: list[int], k: int, maxChanges: int) -> int:
+  def minimumMoves(self, nums: List[int], k: int, maxChanges: int) -> int:
     # Dylan has two actions for collecting '1's in a sequence:
     # Action 1: Put a '1' next to him and pick it up.
     #           The cost is 2.
@@ -22,21 +22,21 @@ def minimumMoves(self, nums: list[int], k: int, maxChanges: int) -> int:
     # a distance <= 1 from dylanIndex, implying that we'll be taking at most
     # `maxOnesByTwo + 3` using Action 2. Any more Action 2 is not optimal and
     # should be replaced with Action 1.
-    NUM_OF_INDICES_WITHIN_ONE_DISTANCE = 3
+    kNumOfIndicesWithinOneDistance = 3
     ans = math.inf
     oneIndices = [i for i, num in enumerate(nums) if num == 1]
     prefix = list(itertools.accumulate(oneIndices, initial=0))
 
     minOnesByTwo = max(0, k - maxChanges)
     maxOnesByTwo = min(
-        k, minOnesByTwo + NUM_OF_INDICES_WITHIN_ONE_DISTANCE, len(oneIndices))
+        k, minOnesByTwo + kNumOfIndicesWithinOneDistance, len(oneIndices))
 
     for onesByTwo in range(minOnesByTwo, maxOnesByTwo + 1):
       for l in range(len(prefix) - onesByTwo):
         r = l + onesByTwo  # Collect 1s in oneIndices[l - 1..r - 1].
         cost1 = (k - onesByTwo) * 2
-        cost2 = ((prefix[r] - prefix[(l + r) // 2]) -
-                 (prefix[(l + r + 1) // 2] - prefix[l]))
+        cost2 = (prefix[r] - prefix[(l + r) // 2]) - \
+            (prefix[(l + r + 1) // 2] - prefix[l])
         ans = min(ans, cost1 + cost2)
 
     return ans
diff --git a/solutions/3088. Make String Anti-palindrome/3088.cpp b/solutions/3088. Make String Anti-palindrome/3088.cpp
index a022196fe1c..edde7782295 100644
--- a/solutions/3088. Make String Anti-palindrome/3088.cpp	
+++ b/solutions/3088. Make String Anti-palindrome/3088.cpp	
@@ -4,11 +4,11 @@ class Solution {
     const int n = s.length();
     int i = n / 2;
     ranges::sort(s);
-    if (s[i] != s[n - 1 - i])
+    if (s[i] != s[n - i - 1])
       return s;
 
     int j = getFirstDiffIndexInSecondHalf(s);
-    while (s[i] == s[n - 1 - i]) {
+    while (s[i] == s[n - i - 1]) {
       if (j == n)
         return "-1";
       swap(s[i++], s[j++]);
diff --git a/solutions/3088. Make String Anti-palindrome/3088.java b/solutions/3088. Make String Anti-palindrome/3088.java
index bc273c06156..9257348e94b 100644
--- a/solutions/3088. Make String Anti-palindrome/3088.java	
+++ b/solutions/3088. Make String Anti-palindrome/3088.java	
@@ -4,11 +4,11 @@ public String makeAntiPalindrome(String s) {
     int i = n / 2;
     char[] chars = s.toCharArray();
     Arrays.sort(chars);
-    if (chars[i] != chars[n - 1 - i])
+    if (chars[i] != chars[n - i - 1])
       return new String(chars);
 
     int j = getFirstDiffIndexInSecondHalf(chars);
-    while (chars[i] == chars[n - 1 - i]) {
+    while (chars[i] == chars[n - i - 1]) {
       if (j == n)
         return "-1";
       final char temp = chars[i];
diff --git a/solutions/3088. Make String Anti-palindrome/3088.py b/solutions/3088. Make String Anti-palindrome/3088.py
index 48fb1b41e78..3ae049c0dc4 100644
--- a/solutions/3088. Make String Anti-palindrome/3088.py	
+++ b/solutions/3088. Make String Anti-palindrome/3088.py	
@@ -3,11 +3,11 @@ def makeAntiPalindrome(self, s: str) -> str:
     n = len(s)
     i = n // 2
     chars = sorted(list(s))
-    if chars[i] != chars[n - 1 - i]:
+    if chars[i] != chars[n - i - 1]:
       return ''.join(chars)
 
     j = self._getFirstDiffIndexInSecondHalf(chars)
-    while chars[i] == chars[n - 1 - i]:
+    while chars[i] == chars[n - i - 1]:
       if j == n:
         return '-1'
       chars[i], chars[j] = chars[j], chars[i]
@@ -16,7 +16,7 @@ def makeAntiPalindrome(self, s: str) -> str:
 
     return ''.join(chars)
 
-  def _getFirstDiffIndexInSecondHalf(self, chars: list[str]) -> int:
+  def _getFirstDiffIndexInSecondHalf(self, chars: List[str]) -> int:
     """
     Returns the first index in chars[n / 2..n) that is different from the first
     letter of the second half, chars[n / 2].
diff --git a/solutions/3089. Find Bursty Behavior/3089.sql b/solutions/3089. Find Bursty Behavior/3089.sql
index 83fb761385e..969dad67cda 100644
--- a/solutions/3089. Find Bursty Behavior/3089.sql	
+++ b/solutions/3089. Find Bursty Behavior/3089.sql	
@@ -1,29 +1,34 @@
 WITH
-  SevenDayPostCounts AS (
-    SELECT
-      Post1.user_id,
-      COUNT(*) AS post_count
-    FROM Posts AS Post1
-    INNER JOIN Posts AS Post2
-      USING (user_id)
-    WHERE Post2.post_date BETWEEN Post1.post_date AND DATE_ADD(Post1.post_date, INTERVAL 6 DAY)
-    GROUP BY Post1.user_id, Post1.post_id
-  ),
-  AverageWeeklyPosts AS (
-    SELECT
-      user_id,
-      COUNT(*) / 4 AS avg_weekly_posts
+  FilteredPosts AS (
+    SELECT *
     FROM Posts
     WHERE post_date BETWEEN '2024-02-01' AND '2024-02-28'
+  ),
+  AvgWeeklyPosts AS (
+    SELECT user_id, COUNT(*) / 4.0 AS avg_weekly_posts
+    FROM FilteredPosts
+    GROUP BY 1
+  ),
+  UserTo7dayPosts AS (
+    SELECT
+      FirstPost.user_id,
+      COUNT(*) AS sevenday_posts
+    FROM Posts AS FirstPost
+    INNER JOIN Posts AS FollowingPost
+      ON (
+        FirstPost.user_id = FollowingPost.user_id
+        AND FollowingPost.post_date BETWEEN FirstPost.post_date
+        AND DATE_ADD(FirstPost.post_date, INTERVAL 6 DAY))
+    GROUP BY FirstPost.user_id, FirstPost.post_date
+  ),
+  UserToMax7dayPosts AS (
+    SELECT user_id, MAX(sevenday_posts) AS max_7day_posts
+    FROM UserTo7dayPosts
     GROUP BY 1
   )
-SELECT
-  SevenDayPostCounts.user_id,
-  MAX(SevenDayPostCounts.post_count) AS max_7day_posts,
-  AverageWeeklyPosts.avg_weekly_posts
-FROM SevenDayPostCounts
-INNER JOIN AverageWeeklyPosts
+SELECT *
+FROM UserToMax7dayPosts
+INNER JOIN AvgWeeklyPosts
   USING (user_id)
-GROUP BY 1
-HAVING max_7day_posts >= avg_weekly_posts * 2
-ORDER BY 1;
+WHERE UserToMax7dayPosts.max_7day_posts >= 2 * AvgWeeklyPosts.avg_weekly_posts
+ORDER BY user_id;
diff --git a/solutions/309. Best Time to Buy and Sell Stock with Cooldown/309.py b/solutions/309. Best Time to Buy and Sell Stock with Cooldown/309.py
index db9a32b8d16..3a6a4c7d076 100644
--- a/solutions/309. Best Time to Buy and Sell Stock with Cooldown/309.py	
+++ b/solutions/309. Best Time to Buy and Sell Stock with Cooldown/309.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxProfit(self, prices: list[int]) -> int:
+  def maxProfit(self, prices: List[int]) -> int:
     sell = 0
     hold = -math.inf
     prev = 0
diff --git a/solutions/3092. Most Frequent IDs/3092.py b/solutions/3092. Most Frequent IDs/3092.py
index fd651fb48fe..220e6c4b396 100644
--- a/solutions/3092. Most Frequent IDs/3092.py	
+++ b/solutions/3092. Most Frequent IDs/3092.py	
@@ -2,7 +2,7 @@
 
 
 class Solution:
-  def mostFrequentIDs(self, nums: list[int], freq: list[int]) -> list[int]:
+  def mostFrequentIDs(self, nums: List[int], freq: List[int]) -> List[int]:
     ans = []
     numCount = collections.Counter()  # {num: freq}
     freqCount = SortedDict()  # {num's freq: freq}
diff --git a/solutions/3093. Longest Common Suffix Queries/3093.cpp b/solutions/3093. Longest Common Suffix Queries/3093.cpp
index 44876508c0b..9002df81f27 100644
--- a/solutions/3093. Longest Common Suffix Queries/3093.cpp	
+++ b/solutions/3093. Longest Common Suffix Queries/3093.cpp	
@@ -32,10 +32,10 @@ class Solution {
   void insert(const string& word, int index) {
     shared_ptr<TrieNode> node = root;
     for (int i = word.length() - 1; i >= 0; --i) {
-      const int index = word[i] - 'a';
-      if (node->children[index] == nullptr)
-        node->children[index] = make_shared<TrieNode>();
-      node = node->children[index];
+      const int j = word[i] - 'a';
+      if (node->children[j] == nullptr)
+        node->children[j] = make_shared<TrieNode>();
+      node = node->children[j];
       if (node->length > word.length()) {
         node->length = word.length();
         node->index = index;
@@ -46,10 +46,10 @@ class Solution {
   int search(const string& word) {
     shared_ptr<TrieNode> node = root;
     for (int i = word.length() - 1; i >= 0; --i) {
-      const int index = word[i] - 'a';
-      if (node->children[index] == nullptr)
+      const int j = word[i] - 'a';
+      if (node->children[j] == nullptr)
         return node->index;
-      node = node->children[index];
+      node = node->children[j];
     }
     return node->index;
   }
diff --git a/solutions/3093. Longest Common Suffix Queries/3093.java b/solutions/3093. Longest Common Suffix Queries/3093.java
index 37f216dbfe5..e2998eb8051 100644
--- a/solutions/3093. Longest Common Suffix Queries/3093.java	
+++ b/solutions/3093. Longest Common Suffix Queries/3093.java	
@@ -29,10 +29,10 @@ public int[] stringIndices(String[] wordsContainer, String[] wordsQuery) {
   private void insert(final String word, int index) {
     TrieNode node = root;
     for (int i = word.length() - 1; i >= 0; --i) {
-      final int index = word.charAt(i) - 'a';
-      if (node.children[index] == null)
-        node.children[index] = new TrieNode();
-      node = node.children[index];
+      final int j = word.charAt(i) - 'a';
+      if (node.children[j] == null)
+        node.children[j] = new TrieNode();
+      node = node.children[j];
       if (node.length > word.length()) {
         node.length = word.length();
         node.index = index;
@@ -43,10 +43,10 @@ private void insert(final String word, int index) {
   private int search(final String word) {
     TrieNode node = root;
     for (int i = word.length() - 1; i >= 0; --i) {
-      final int index = word.charAt(i) - 'a';
-      if (node.children[index] == null)
+      final int j = word.charAt(i) - 'a';
+      if (node.children[j] == null)
         return node.index;
-      node = node.children[index];
+      node = node.children[j];
     }
     return node.index;
   }
diff --git a/solutions/3093. Longest Common Suffix Queries/3093.py b/solutions/3093. Longest Common Suffix Queries/3093.py
index 70e16f6312e..e42d980093d 100644
--- a/solutions/3093. Longest Common Suffix Queries/3093.py	
+++ b/solutions/3093. Longest Common Suffix Queries/3093.py	
@@ -1,17 +1,13 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
     self.isWord = False
     self.length = math.inf
     self.index = -1
 
 
 class Solution:
-  def stringIndices(
-      self,
-      wordsContainer: list[str],
-      wordsQuery: list[str],
-  ) -> list[int]:
+  def stringIndices(self, wordsContainer: List[str], wordsQuery: List[str]) -> List[int]:
     ans = []
     root = TrieNode()
     minIndex = min(enumerate(wordsContainer), key=lambda x: len(x[1]))[0]
diff --git a/solutions/3094. Guess the Number Using Bitwise Questions II/3094-2.java b/solutions/3094. Guess the Number Using Bitwise Questions II/3094-2.java
index 2574aba63af..3cc0b9ee6f8 100644
--- a/solutions/3094. Guess the Number Using Bitwise Questions II/3094-2.java	
+++ b/solutions/3094. Guess the Number Using Bitwise Questions II/3094-2.java	
@@ -5,10 +5,10 @@
 
 public class Solution extends Problem {
   public int findNumber() {
-    final int MAX_BIT = 30;
+    final int kMaxBit = 30;
     int ans = 0;
 
-    for (int i = 0; i <= MAX_BIT; ++i)
+    for (int i = 0; i <= kMaxBit; ++i)
       if (commonBits(1 << i) > commonBits(1 << i))
         ans |= 1 << i;
 
diff --git a/solutions/3094. Guess the Number Using Bitwise Questions II/3094.java b/solutions/3094. Guess the Number Using Bitwise Questions II/3094.java
index 309a241afd5..65c48c6a6c2 100644
--- a/solutions/3094. Guess the Number Using Bitwise Questions II/3094.java	
+++ b/solutions/3094. Guess the Number Using Bitwise Questions II/3094.java	
@@ -5,11 +5,11 @@
 
 public class Solution extends Problem {
   public int findNumber() {
-    final int MAX_BIT = 30;
+    final int kMaxBit = 30;
     final int sameCount = commonBits(0);
     int ans = 0;
 
-    for (int i = 0; i <= MAX_BIT; ++i) {
+    for (int i = 0; i <= kMaxBit; ++i) {
       if (commonBits(1 << i) > sameCount)
         ans |= 1 << i;
       commonBits(1 << i); // Revert the XOR.
diff --git a/solutions/3095. Shortest Subarray With OR at Least K I/3095.java b/solutions/3095. Shortest Subarray With OR at Least K I/3095.java
index 2401b9c494b..660fd8afe69 100644
--- a/solutions/3095. Shortest Subarray With OR at Least K I/3095.java	
+++ b/solutions/3095. Shortest Subarray With OR at Least K I/3095.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int minimumSubarrayLength(int[] nums, int k) {
-    final int MAX = 50;
+    final int kMax = 50;
     final int n = nums.length;
     int ans = n + 1;
     int ors = 0;
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (int l = 0, r = 0; r < n; ++r) {
       ors = orNum(ors, nums[r], count);
@@ -18,17 +18,17 @@ public int minimumSubarrayLength(int[] nums, int k) {
     return (ans == n + 1) ? -1 : ans;
   }
 
-  private static final int MAX_BIT = 30;
+  private static final int kMaxBit = 30;
 
   private int orNum(int ors, int num, int[] count) {
-    for (int i = 0; i < MAX_BIT; ++i)
+    for (int i = 0; i < kMaxBit; ++i)
       if ((num >> i & 1) == 1 && ++count[i] == 1)
         ors += 1 << i;
     return ors;
   }
 
   private int undoOrNum(int ors, int num, int[] count) {
-    for (int i = 0; i < MAX_BIT; ++i)
+    for (int i = 0; i < kMaxBit; ++i)
       if ((num >> i & 1) == 1 && --count[i] == 0)
         ors -= 1 << i;
     return ors;
diff --git a/solutions/3095. Shortest Subarray With OR at Least K I/3095.py b/solutions/3095. Shortest Subarray With OR at Least K I/3095.py
index e0b07c45657..96a740f1a5d 100644
--- a/solutions/3095. Shortest Subarray With OR at Least K I/3095.py	
+++ b/solutions/3095. Shortest Subarray With OR at Least K I/3095.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumSubarrayLength(self, nums: list[int], k: int) -> int:
+  def minimumSubarrayLength(self, nums: List[int], k: int) -> int:
     ans = len(nums) + 1
     ors = 0
     count = collections.Counter()
@@ -14,7 +14,7 @@ def minimumSubarrayLength(self, nums: list[int], k: int) -> int:
 
     return -1 if ans == len(nums) + 1 else ans
 
-  def _orNum(self, ors: int, num: int, count: dict[int, int]) -> int:
+  def _orNum(self, ors: int, num: int, count: Dict[int, int]) -> int:
     for i in range(30):
       if num >> i & 1:
         count[i] += 1
@@ -22,7 +22,7 @@ def _orNum(self, ors: int, num: int, count: dict[int, int]) -> int:
           ors += 1 << i
     return ors
 
-  def _undoOrNum(self, ors: int, num: int, count: dict[int, int]) -> int:
+  def _undoOrNum(self, ors: int, num: int, count: Dict[int, int]) -> int:
     for i in range(30):
       if num >> i & 1:
         count[i] -= 1
diff --git a/solutions/3096. Minimum Levels to Gain More Points/3096.py b/solutions/3096. Minimum Levels to Gain More Points/3096.py
index 14e539f914c..3fd9e98fcda 100644
--- a/solutions/3096. Minimum Levels to Gain More Points/3096.py	
+++ b/solutions/3096. Minimum Levels to Gain More Points/3096.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumLevels(self, possible: list[int]) -> int:
+  def minimumLevels(self, possible: List[int]) -> int:
     n = len(possible)
     nums = [num if num == 1 else -1 for num in possible]
     prefix = list(itertools.accumulate(nums, initial=0))
diff --git a/solutions/3097. Shortest Subarray With OR at Least K II/3097.java b/solutions/3097. Shortest Subarray With OR at Least K II/3097.java
index 24018e93041..6f79b999a29 100644
--- a/solutions/3097. Shortest Subarray With OR at Least K II/3097.java	
+++ b/solutions/3097. Shortest Subarray With OR at Least K II/3097.java	
@@ -1,11 +1,11 @@
 class Solution {
   // Same as 3095. Shortest Subarray With OR at Least K I
   public int minimumSubarrayLength(int[] nums, int k) {
-    final int MAX = 50;
+    final int kMax = 50;
     final int n = nums.length;
     int ans = n + 1;
     int ors = 0;
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (int l = 0, r = 0; r < n; ++r) {
       ors = orNum(ors, nums[r], count);
@@ -19,17 +19,17 @@ public int minimumSubarrayLength(int[] nums, int k) {
     return (ans == n + 1) ? -1 : ans;
   }
 
-  private static final int MAX_BIT = 30;
+  private static final int kMaxBit = 30;
 
   private int orNum(int ors, int num, int[] count) {
-    for (int i = 0; i < MAX_BIT; ++i)
+    for (int i = 0; i < kMaxBit; ++i)
       if ((num >> i & 1) == 1 && ++count[i] == 1)
         ors += 1 << i;
     return ors;
   }
 
   private int undoOrNum(int ors, int num, int[] count) {
-    for (int i = 0; i < MAX_BIT; ++i)
+    for (int i = 0; i < kMaxBit; ++i)
       if ((num >> i & 1) == 1 && --count[i] == 0)
         ors -= 1 << i;
     return ors;
diff --git a/solutions/3097. Shortest Subarray With OR at Least K II/3097.py b/solutions/3097. Shortest Subarray With OR at Least K II/3097.py
index 6972117b9bb..b73376cca3f 100644
--- a/solutions/3097. Shortest Subarray With OR at Least K II/3097.py	
+++ b/solutions/3097. Shortest Subarray With OR at Least K II/3097.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 3095. Shortest Subarray With OR at Least K I
-  def minimumSubarrayLength(self, nums: list[int], k: int) -> int:
+  def minimumSubarrayLength(self, nums: List[int], k: int) -> int:
     ans = len(nums) + 1
     ors = 0
     count = collections.Counter()
@@ -15,7 +15,7 @@ def minimumSubarrayLength(self, nums: list[int], k: int) -> int:
 
     return -1 if ans == len(nums) + 1 else ans
 
-  def _orNum(self, ors: int, num: int, count: dict[int, int]) -> int:
+  def _orNum(self, ors: int, num: int, count: Dict[int, int]) -> int:
     for i in range(30):
       if num >> i & 1:
         count[i] += 1
@@ -23,7 +23,7 @@ def _orNum(self, ors: int, num: int, count: dict[int, int]) -> int:
           ors += 1 << i
     return ors
 
-  def _undoOrNum(self, ors: int, num: int, count: dict[int, int]) -> int:
+  def _undoOrNum(self, ors: int, num: int, count: Dict[int, int]) -> int:
     for i in range(30):
       if num >> i & 1:
         count[i] -= 1
diff --git a/solutions/3098. Find the Sum of Subsequence Powers/3098-2.py b/solutions/3098. Find the Sum of Subsequence Powers/3098-2.py
index 213524be80b..cf547a69409 100644
--- a/solutions/3098. Find the Sum of Subsequence Powers/3098-2.py	
+++ b/solutions/3098. Find the Sum of Subsequence Powers/3098-2.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def sumOfPowers(self, nums: list[int], k: int) -> int:
-    MOD = 1_000_000_007
+  def sumOfPowers(self, nums: List[int], k: int) -> int:
+    kMod = 1_000_000_007
     n = len(nums)
 
     nums.sort()
@@ -11,10 +11,10 @@ def dp(i: int, k: int, lastPickIndex: int, minDiff: int) -> int:
         return minDiff
       if i == n:
         return 0
-      newMinDiff = (minDiff if lastPickIndex == - 1
-                    else min(minDiff, nums[i] - nums[lastPickIndex]))
+      newMinDiff = minDiff if lastPickIndex == - 1 \
+          else min(minDiff, nums[i] - nums[lastPickIndex])
       pick = dp(i + 1, k - 1, i, newMinDiff)
       skip = dp(i + 1, k, lastPickIndex, minDiff)
-      return (pick + skip) % MOD
+      return (pick + skip) % kMod
 
     return dp(0, k, -1, math.inf)
diff --git a/solutions/3098. Find the Sum of Subsequence Powers/3098.java b/solutions/3098. Find the Sum of Subsequence Powers/3098.java
index 85ac65260fa..5857bc56d9d 100644
--- a/solutions/3098. Find the Sum of Subsequence Powers/3098.java	
+++ b/solutions/3098. Find the Sum of Subsequence Powers/3098.java	
@@ -6,7 +6,7 @@ public int sumOfPowers(int[] nums, int k) {
     return sumOfPowers(nums, 0, k, -1, -1, -1, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the sum of powers of all subsequences of nums[i..n) which
   // have length equal to k, where `lastPickedIndex` is the index of the last
@@ -35,7 +35,7 @@ private int sumOfPowers(int[] nums, int i, int k, int lastPickedIndex, int first
     }
     final int pick = sumOfPowers(nums, i + 1, k - 1, i, newFirstIndex, newSecondIndex, mem);
     final int skip = sumOfPowers(nums, i + 1, k, lastPickedIndex, firstIndex, secondIndex, mem);
-    return mem[a][b][c][k] = (pick + skip) % MOD;
+    return mem[a][b][c][k] = (pick + skip) % kMod;
   }
 
   private int hash(int x) {
diff --git a/solutions/3098. Find the Sum of Subsequence Powers/3098.py b/solutions/3098. Find the Sum of Subsequence Powers/3098.py
index 6962ecaada3..20d60216cf4 100644
--- a/solutions/3098. Find the Sum of Subsequence Powers/3098.py	
+++ b/solutions/3098. Find the Sum of Subsequence Powers/3098.py	
@@ -1,16 +1,10 @@
 class Solution:
-  def sumOfPowers(self, nums: list[int], k: int) -> int:
-    MOD = 1_000_000_007
+  def sumOfPowers(self, nums: List[int], k: int) -> int:
+    kMod = 1_000_000_007
     nums.sort()
 
     @functools.lru_cache(None)
-    def dp(
-        i: int,
-        k: int,
-        lastPickedIndex: int,
-        firstIndex: int,
-        secondIndex: int
-    ) -> int:
+    def dp(i: int, k: int, lastPickedIndex: int, firstIndex: int, secondIndex: int) -> int:
       if k == 0:
         return nums[secondIndex] - nums[firstIndex]
       if i == len(nums):
@@ -26,6 +20,6 @@ def dp(
         newSecondIndex = i
       pick = dp(i + 1, k - 1, i, newFirstIndex, newSecondIndex)
       skip = dp(i + 1, k, lastPickedIndex, firstIndex, secondIndex)
-      return (pick + skip) % MOD
+      return (pick + skip) % kMod
 
     return dp(0, k, -1, -1, -1)
diff --git a/solutions/31. Next Permutation/31.py b/solutions/31. Next Permutation/31.py
index e79cb003e3e..b372fd25b82 100644
--- a/solutions/31. Next Permutation/31.py	
+++ b/solutions/31. Next Permutation/31.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def nextPermutation(self, nums: list[int]) -> None:
+  def nextPermutation(self, nums: List[int]) -> None:
     n = len(nums)
 
     # From back to front, find the first number < nums[i + 1].
@@ -16,7 +16,7 @@ def nextPermutation(self, nums: list[int]) -> None:
           nums[i], nums[j] = nums[j], nums[i]
           break
 
-    def reverse(nums: list[int], l: int, r: int) -> None:
+    def reverse(nums: List[int], l: int, r: int) -> None:
       while l < r:
         nums[l], nums[r] = nums[r], nums[l]
         l += 1
diff --git a/solutions/310. Minimum Height Trees/310.java b/solutions/310. Minimum Height Trees/310.java
index 88f4bececfb..f5dde02d4ad 100644
--- a/solutions/310. Minimum Height Trees/310.java	
+++ b/solutions/310. Minimum Height Trees/310.java	
@@ -1,7 +1,7 @@
 class Solution {
   public List<Integer> findMinHeightTrees(int n, int[][] edges) {
     if (n == 0 || edges.length == 0)
-      return List.of(0);
+      return new ArrayList<>(Arrays.asList(0));
 
     List<Integer> ans = new ArrayList<>();
     Map<Integer, Set<Integer>> graph = new HashMap<>();
diff --git a/solutions/310. Minimum Height Trees/310.py b/solutions/310. Minimum Height Trees/310.py
index 517132af929..c21f85c4b4e 100644
--- a/solutions/310. Minimum Height Trees/310.py	
+++ b/solutions/310. Minimum Height Trees/310.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMinHeightTrees(self, n: int, edges: list[list[int]]) -> list[int]:
+  def findMinHeightTrees(self, n: int, edges: List[List[int]]) -> List[int]:
     if n == 1 or not edges:
       return [0]
 
diff --git a/solutions/3101. Count Alternating Subarrays/3101.py b/solutions/3101. Count Alternating Subarrays/3101.py
index 2ea52b49e0c..df33b4f961d 100644
--- a/solutions/3101. Count Alternating Subarrays/3101.py	
+++ b/solutions/3101. Count Alternating Subarrays/3101.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countAlternatingSubarrays(self, nums: list[int]) -> int:
+  def countAlternatingSubarrays(self, nums: List[int]) -> int:
     # dp[i] := the number of alternating subarrays ending in index i
     dp = [1] * len(nums)
 
diff --git a/solutions/3102. Minimize Manhattan Distances/3102.py b/solutions/3102. Minimize Manhattan Distances/3102.py
index ea465b56c6d..d96c8f61cdb 100644
--- a/solutions/3102. Minimize Manhattan Distances/3102.py	
+++ b/solutions/3102. Minimize Manhattan Distances/3102.py	
@@ -1,16 +1,12 @@
 class Solution:
-  def minimumDistance(self, points: list[list[int]]) -> int:
+  def minimumDistance(self, points: List[List[int]]) -> int:
     i, j = self._maxManhattanDistance(points, -1)
     xi, yi = self._maxManhattanDistance(points, i)
     xj, yj = self._maxManhattanDistance(points, j)
     return min(self._manhattan(points, xi, yi),
                self._manhattan(points, xj, yj))
 
-  def _maxManhattanDistance(
-      self,
-      points: list[list[int]],
-      excludedIndex: int,
-  ) -> int:
+  def _maxManhattanDistance(self, points: List[List[int]], excludedIndex: int) -> int:
     minSum = math.inf
     maxSum = -math.inf
     minDiff = math.inf
@@ -38,8 +34,8 @@ def _maxManhattanDistance(
         maxDiff = diff
         maxDiffIndex = i
 
-    return ([minSumIndex, maxSumIndex] if maxSum - minSum >= maxDiff - minDiff
-            else [minDiffIndex, maxDiffIndex])
+    return [minSumIndex, maxSumIndex] if maxSum - minSum >= maxDiff - minDiff \
+        else [minDiffIndex, maxDiffIndex]
 
-  def _manhattan(self, points: list[list[int]], i: int, j: int) -> int:
+  def _manhattan(self, points: List[List[int]], i: int, j: int) -> int:
     return abs(points[i][0] - points[j][0]) + abs(points[i][1] - points[j][1])
diff --git a/solutions/3103. Find Trending Hashtags II/3103.sql b/solutions/3103. Find Trending Hashtags II/3103.sql
index 3bae67687eb..88961da9304 100644
--- a/solutions/3103. Find Trending Hashtags II/3103.sql	
+++ b/solutions/3103. Find Trending Hashtags II/3103.sql	
@@ -1,5 +1,5 @@
-WITH RECURSIVE
-  FebruaryTweets AS (
+WITH
+  RECURSIVE FebruaryTweets AS (
     SELECT * FROM Tweets
     WHERE YEAR(tweet_date) = 2024 AND MONTH(tweet_date) = 2
   ),
diff --git a/solutions/3105. Longest Strictly Increasing or Strictly Decreasing Subarray/3105.py b/solutions/3105. Longest Strictly Increasing or Strictly Decreasing Subarray/3105.py
index 232513228f9..15b8d16a6fd 100644
--- a/solutions/3105. Longest Strictly Increasing or Strictly Decreasing Subarray/3105.py	
+++ b/solutions/3105. Longest Strictly Increasing or Strictly Decreasing Subarray/3105.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Similar to 978. Longest Turbulent Subarray
-  def longestMonotonicSubarray(self, nums: list[int]) -> int:
+  def longestMonotonicSubarray(self, nums: List[int]) -> int:
     ans = 1
     increasing = 1
     decreasing = 1
diff --git a/solutions/3107. Minimum Operations to Make Median of Array Equal to K/3107.py b/solutions/3107. Minimum Operations to Make Median of Array Equal to K/3107.py
index 889d3eaf810..6c9cb7c3eca 100644
--- a/solutions/3107. Minimum Operations to Make Median of Array Equal to K/3107.py	
+++ b/solutions/3107. Minimum Operations to Make Median of Array Equal to K/3107.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperationsToMakeMedianK(self, nums: list[int], k: int) -> int:
+  def minOperationsToMakeMedianK(self, nums: List[int], k: int) -> int:
     n = len(nums)
     ans = 0
 
diff --git a/solutions/3108. Minimum Cost Walk in Weighted Graph/3108.cpp b/solutions/3108. Minimum Cost Walk in Weighted Graph/3108.cpp
index 51b7aecf70e..31fa4f73a2d 100644
--- a/solutions/3108. Minimum Cost Walk in Weighted Graph/3108.cpp	
+++ b/solutions/3108. Minimum Cost Walk in Weighted Graph/3108.cpp	
@@ -55,9 +55,9 @@ class Solution {
       uf.unionByRank(u, v, w);
     }
 
-    for (const vector<int>& query : queries) {
-      const int u = query[0];
-      const int v = query[1];
+    for (const vector<int>& q : query) {
+      const int u = q[0];
+      const int v = q[1];
       ans.push_back(uf.getMinCost(u, v));
     }
 
diff --git a/solutions/3108. Minimum Cost Walk in Weighted Graph/3108.py b/solutions/3108. Minimum Cost Walk in Weighted Graph/3108.py
index b4dce7007fa..11f454e0c82 100644
--- a/solutions/3108. Minimum Cost Walk in Weighted Graph/3108.py	
+++ b/solutions/3108. Minimum Cost Walk in Weighted Graph/3108.py	
@@ -35,12 +35,7 @@ def _find(self, u: int) -> int:
 
 
 class Solution:
-  def minimumCost(
-      self,
-      n: int,
-      edges: list[list[int]],
-      query: list[list[int]],
-  ) -> list[int]:
+  def minimumCost(self, n: int, edges: List[List[int]], query: List[List[int]]) -> List[int]:
     uf = UnionFind(n)
 
     for u, v, w in edges:
diff --git a/solutions/3109. Find the Index of Permutation/3109.java b/solutions/3109. Find the Index of Permutation/3109.java
index 698eef8c4f5..6b848ef5795 100644
--- a/solutions/3109. Find the Index of Permutation/3109.java	
+++ b/solutions/3109. Find the Index of Permutation/3109.java	
@@ -28,7 +28,7 @@ private static int lowbit(int i) {
 
 class Solution {
   public int getPermutationIndex(int[] perm) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = perm.length;
     int ans = 0;
     FenwickTree tree = new FenwickTree(n);
@@ -36,14 +36,14 @@ public int getPermutationIndex(int[] perm) {
     Arrays.fill(fact, 1);
 
     for (int i = 2; i <= n; ++i)
-      fact[i] = (int) ((fact[i - 1] * (long) i) % MOD);
+      fact[i] = (int) ((fact[i - 1] * (long) i) % kMod);
 
     for (int i = 0; i < n; ++i) {
       final int num = perm[i];
       // the number of unused numbers less than `num`
       final int unusedNums = num - 1 - tree.get(num - 1);
       final int suffixLength = fact[n - 1 - i];
-      ans = (int) ((ans + unusedNums * (long) suffixLength) % MOD);
+      ans = (int) ((ans + unusedNums * (long) suffixLength) % kMod);
       tree.add(num, 1);
     }
 
diff --git a/solutions/3109. Find the Index of Permutation/3109.py b/solutions/3109. Find the Index of Permutation/3109.py
index c2456a57e8d..489db276007 100644
--- a/solutions/3109. Find the Index of Permutation/3109.py	
+++ b/solutions/3109. Find the Index of Permutation/3109.py	
@@ -20,22 +20,22 @@ def lowbit(i: int) -> int:
 
 
 class Solution:
-  def getPermutationIndex(self, perm: list[int]) -> int:
-    MOD = 1_000_000_007
+  def getPermutationIndex(self, perm: List[int]) -> int:
+    kMod = 1_000_000_007
     n = len(perm)
     ans = 0
     tree = FenwickTree(n)
     fact = [1] * (n + 1)  # fact[i] := i!
 
     for i in range(2, n + 1):
-      fact[i] = (fact[i - 1] * i) % MOD
+      fact[i] = (fact[i - 1] * i) % kMod
 
     for i, num in enumerate(perm):
       # the number of unused numbers less than `num`
       unusedNums = num - 1 - tree.get(num - 1)
       suffixLength = fact[n - 1 - i]
       ans += unusedNums * suffixLength
-      ans %= MOD
+      ans %= kMod
       tree.add(num, 1)
 
     return ans
diff --git a/solutions/311. Sparse Matrix Multiplication/311-2.py b/solutions/311. Sparse Matrix Multiplication/311-2.py
index b07cd3f0938..3932108ffda 100644
--- a/solutions/311. Sparse Matrix Multiplication/311-2.py	
+++ b/solutions/311. Sparse Matrix Multiplication/311-2.py	
@@ -1,6 +1,5 @@
 class Solution:
-  def multiply(self, mat1: list[list[int]],
-               mat2: list[list[int]]) -> list[list[int]]:
+  def multiply(self, mat1: List[List[int]], mat2: List[List[int]]) -> List[List[int]]:
     m = len(mat1)
     n = len(mat2)
     l = len(mat2[0])
diff --git a/solutions/311. Sparse Matrix Multiplication/311.py b/solutions/311. Sparse Matrix Multiplication/311.py
index 6ab9ebe4633..efccc3c658d 100644
--- a/solutions/311. Sparse Matrix Multiplication/311.py	
+++ b/solutions/311. Sparse Matrix Multiplication/311.py	
@@ -1,6 +1,5 @@
 class Solution:
-  def multiply(self, mat1: list[list[int]],
-               mat2: list[list[int]]) -> list[list[int]]:
+  def multiply(self, mat1: List[List[int]], mat2: List[List[int]]) -> List[List[int]]:
     m = len(mat1)
     n = len(mat2)
     l = len(mat2[0])
diff --git a/solutions/3111. Minimum Rectangles to Cover Points/3111.py b/solutions/3111. Minimum Rectangles to Cover Points/3111.py
index 11cc90c9f88..19b4c06955c 100644
--- a/solutions/3111. Minimum Rectangles to Cover Points/3111.py	
+++ b/solutions/3111. Minimum Rectangles to Cover Points/3111.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minRectanglesToCoverPoints(self, points: list[list[int]], w: int) -> int:
+  def minRectanglesToCoverPoints(self, points: List[List[int]], w: int) -> int:
     ans = 0
     prevX = -w - 1
     xs = sorted([x for x, _ in points])
diff --git a/solutions/3112. Minimum Time to Visit Disappearing Nodes/3112.cpp b/solutions/3112. Minimum Time to Visit Disappearing Nodes/3112.cpp
index 4c412dd3fb1..c28a1a1eeb4 100644
--- a/solutions/3112. Minimum Time to Visit Disappearing Nodes/3112.cpp	
+++ b/solutions/3112. Minimum Time to Visit Disappearing Nodes/3112.cpp	
@@ -19,10 +19,10 @@ class Solution {
   vector<int> dijkstra(const vector<vector<pair<int, int>>>& graph, int src,
                        const vector<int>& disappear) {
     vector<int> dist(graph.size(), INT_MAX);
-
-    dist[src] = 0;
     using P = pair<int, int>;  // (d, u)
     priority_queue<P, vector<P>, greater<>> minHeap;
+
+    dist[src] = 0;
     minHeap.emplace(dist[src], src);
 
     while (!minHeap.empty()) {
diff --git a/solutions/3112. Minimum Time to Visit Disappearing Nodes/3112.java b/solutions/3112. Minimum Time to Visit Disappearing Nodes/3112.java
index e6d4956e57d..27a98641e9d 100644
--- a/solutions/3112. Minimum Time to Visit Disappearing Nodes/3112.java	
+++ b/solutions/3112. Minimum Time to Visit Disappearing Nodes/3112.java	
@@ -19,12 +19,11 @@ public int[] minimumTime(int n, int[][] edges, int[] disappear) {
   private int[] dijkstra(List<Pair<Integer, Integer>>[] graph, int src, int[] disappear) {
     int[] dist = new int[graph.length];
     Arrays.fill(dist, Integer.MAX_VALUE);
+    // (d, u)
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
 
     dist[src] = 0;
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey)) {
-          { offer(new Pair<>(dist[src], src)); } // (d, u)
-        };
+    minHeap.offer(new Pair<>(dist[src], src));
 
     while (!minHeap.isEmpty()) {
       final int d = minHeap.peek().getKey();
diff --git a/solutions/3112. Minimum Time to Visit Disappearing Nodes/3112.py b/solutions/3112. Minimum Time to Visit Disappearing Nodes/3112.py
index 7c66b20bc4c..3f2c2924178 100644
--- a/solutions/3112. Minimum Time to Visit Disappearing Nodes/3112.py	
+++ b/solutions/3112. Minimum Time to Visit Disappearing Nodes/3112.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minimumTime(
-      self,
-      n: int,
-      edges: list[list[int]],
-      disappear: list[int],
-  ) -> list[int]:
+  def minimumTime(self, n: int, edges: List[List[int]], disappear: List[int]) -> List[int]:
     graph = [[] for _ in range(n)]
 
     for u, v, w in edges:
@@ -13,12 +8,7 @@ def minimumTime(
 
     return self._dijkstra(graph, 0, disappear)
 
-  def _dijkstra(
-      self,
-      graph: list[list[tuple[int, int]]],
-      src: int,
-      disappear: list[int],
-  ) -> list[int]:
+  def _dijkstra(self, graph: List[List[Tuple[int, int]]], src: int, disappear: List[int]) -> List[int]:
     dist = [math.inf] * len(graph)
 
     dist[src] = 0
diff --git a/solutions/3113. Find the Number of Subarrays Where Boundary Elements Are Maximum/3113.py b/solutions/3113. Find the Number of Subarrays Where Boundary Elements Are Maximum/3113.py
index d91afc9aa32..5d62c9e7c10 100644
--- a/solutions/3113. Find the Number of Subarrays Where Boundary Elements Are Maximum/3113.py	
+++ b/solutions/3113. Find the Number of Subarrays Where Boundary Elements Are Maximum/3113.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfSubarrays(self, nums: list[int]) -> int:
+  def numberOfSubarrays(self, nums: List[int]) -> int:
     ans = 0
     stack = []
 
diff --git a/solutions/3115. Maximum Prime Difference/3115.java b/solutions/3115. Maximum Prime Difference/3115.java
index 897eb9e5495..b39cc5a5624 100644
--- a/solutions/3115. Maximum Prime Difference/3115.java	
+++ b/solutions/3115. Maximum Prime Difference/3115.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int maximumPrimeDifference(int[] nums) {
-    final int MAX = 100;
-    boolean[] isPrime = sieveEratosthenes(MAX + 1);
+    final int kMax = 100;
+    boolean[] isPrime = sieveEratosthenes(kMax + 1);
     int minPrimeIndex = -1;
     int maxPrimeIndex = -1;
 
diff --git a/solutions/3115. Maximum Prime Difference/3115.py b/solutions/3115. Maximum Prime Difference/3115.py
index 564a4daf08f..fc9dfe62e41 100644
--- a/solutions/3115. Maximum Prime Difference/3115.py	
+++ b/solutions/3115. Maximum Prime Difference/3115.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def maximumPrimeDifference(self, nums: list[int]) -> int:
-    MAX = 100
-    isPrime = self._sieveEratosthenes(MAX + 1)
+  def maximumPrimeDifference(self, nums: List[int]) -> int:
+    kMax = 100
+    isPrime = self._sieveEratosthenes(kMax + 1)
     minPrimeIndex = -1
     maxPrimeIndex = -1
 
@@ -13,7 +13,7 @@ def maximumPrimeDifference(self, nums: list[int]) -> int:
 
     return maxPrimeIndex - minPrimeIndex
 
-  def _sieveEratosthenes(self, n: int) -> list[bool]:
+  def _sieveEratosthenes(self, n: int) -> List[bool]:
     isPrime = [True] * n
     isPrime[0] = False
     isPrime[1] = False
diff --git a/solutions/3116. Kth Smallest Amount With Single Denomination Combination/3116.py b/solutions/3116. Kth Smallest Amount With Single Denomination Combination/3116.py
index 8b65f69bc1d..50cfa6bde4c 100644
--- a/solutions/3116. Kth Smallest Amount With Single Denomination Combination/3116.py	
+++ b/solutions/3116. Kth Smallest Amount With Single Denomination Combination/3116.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findKthSmallest(self, coins: list[int], k: int) -> int:
+  def findKthSmallest(self, coins: List[int], k: int) -> int:
     sizeToLcms = self._getSizeToLcms(coins)
 
     def count(m: int) -> int:
@@ -11,9 +11,10 @@ def count(m: int) -> int:
           res += m // lcm * pow(-1, sz + 1)
       return res
 
-    return bisect.bisect_left(range(k * min(coins)), k, key=count)
+    return bisect.bisect_left(range(0, k * min(coins)), k,
+                              key=lambda m: count(m))
 
-  def _getSizeToLcms(self, coins: list[int]) -> list[list[int]]:
+  def _getSizeToLcms(self, coins: List[int]) -> List[List[int]]:
     # Returns the LCMs for each number of combination of coins.
     sizeToLcms = [[] for _ in range(len(coins) + 1)]
     for sz in range(1, len(coins) + 1):
diff --git a/solutions/3117. Minimum Sum of Values by Dividing Array/3117.cpp b/solutions/3117. Minimum Sum of Values by Dividing Array/3117.cpp
index 570becd030b..b485df55524 100644
--- a/solutions/3117. Minimum Sum of Values by Dividing Array/3117.cpp	
+++ b/solutions/3117. Minimum Sum of Values by Dividing Array/3117.cpp	
@@ -3,13 +3,13 @@ class Solution {
   int minimumValueSum(vector<int>& nums, vector<int>& andValues) {
     vector<vector<unordered_map<int, int>>> mem(
         nums.size(), vector<unordered_map<int, int>>(andValues.size()));
-    const int ans = minimumValueSum(nums, andValues, 0, 0, kFullMask, mem);
+    const int ans = minimumValueSum(nums, andValues, 0, 0, kAllMask, mem);
     return ans == kInf ? -1 : ans;
   }
 
  private:
   static constexpr int kInf = 1'000'000'000;
-  static constexpr int kFullMask = (1 << 17) - 1;
+  static constexpr int kAllMask = (1 << 17) - 1;
 
   // Returns the minimum value sum of nums[i..n) and andValues[j..m), where
   // `mask` is the running value of the current subarray.
@@ -31,7 +31,7 @@ class Solution {
       return mem[i][j][mask] =
                  min(minimumValueSum(nums, andValues, i + 1, j, mask, mem),
                      nums[i] + minimumValueSum(nums, andValues, i + 1, j + 1,
-                                               kFullMask, mem));
+                                               kAllMask, mem));
     // Keep going.
     return mem[i][j][mask] =
                minimumValueSum(nums, andValues, i + 1, j, mask, mem);
diff --git a/solutions/3117. Minimum Sum of Values by Dividing Array/3117.java b/solutions/3117. Minimum Sum of Values by Dividing Array/3117.java
index 7061d377f9e..03e4fce3b1f 100644
--- a/solutions/3117. Minimum Sum of Values by Dividing Array/3117.java	
+++ b/solutions/3117. Minimum Sum of Values by Dividing Array/3117.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int minimumValueSum(int[] nums, int[] andValues) {
     Map<Integer, Integer>[][] mem = new Map[nums.length][andValues.length];
-    Arrays.stream(mem).forEach(A -> Arrays.setAll(A, j -> new HashMap<>()));
-    final int ans = minimumValueSum(nums, andValues, 0, 0, FULL_MASK, mem);
-    return ans == INF ? -1 : ans;
+    Arrays.stream(mem).forEach(row -> Arrays.setAll(row, j -> new HashMap<>()));
+    final int ans = minimumValueSum(nums, andValues, 0, 0, kAllMask, mem);
+    return ans == kInf ? -1 : ans;
   }
 
-  private static final int INF = 1_000_000_000;
-  private static final int FULL_MASK = (1 << 17) - 1;
+  private static final int kInf = 1_000_000_000;
+  private static final int kAllMask = (1 << 17) - 1;
 
   // Returns the minimum value sum of nums[i..n) and andValues[j..m), where
   // `mask` is the running value of the current subarray.
@@ -16,20 +16,20 @@ private int minimumValueSum(int[] nums, int[] andValues, int i, int j, int mask,
     if (i == nums.length && j == andValues.length)
       return 0;
     if (i == nums.length || j == andValues.length)
-      return INF;
+      return kInf;
     if (mem[i][j].containsKey(mask))
       return mem[i][j].get(mask);
     mask &= nums[i];
     if (mask < andValues[j]) {
-      mem[i][j].put(mask, INF);
-      return INF;
+      mem[i][j].put(mask, kInf);
+      return kInf;
     }
     if (mask == andValues[j]) {
       // 1. Keep going.
       // 2. End the subarray here and pick nums[i], then fresh start.
       final int res =
           Math.min(minimumValueSum(nums, andValues, i + 1, j, mask, mem),
-                   nums[i] + minimumValueSum(nums, andValues, i + 1, j + 1, FULL_MASK, mem));
+                   nums[i] + minimumValueSum(nums, andValues, i + 1, j + 1, kAllMask, mem));
       mem[i][j].put(mask, res);
       return res;
     }
diff --git a/solutions/3117. Minimum Sum of Values by Dividing Array/3117.py b/solutions/3117. Minimum Sum of Values by Dividing Array/3117.py
index 87876ea9127..6ae1528627b 100644
--- a/solutions/3117. Minimum Sum of Values by Dividing Array/3117.py	
+++ b/solutions/3117. Minimum Sum of Values by Dividing Array/3117.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumValueSum(self, nums: list[int], andValues: list[int]) -> int:
+  def minimumValueSum(self, nums: List[int], andValues: List[int]) -> int:
     n = len(nums)
     m = len(andValues)
 
diff --git a/solutions/3118. Friday Purchase III/3118.sql b/solutions/3118. Friday Purchase III/3118.sql
index e31a68292c4..45f1ea0b4fe 100644
--- a/solutions/3118. Friday Purchase III/3118.sql	
+++ b/solutions/3118. Friday Purchase III/3118.sql	
@@ -1,5 +1,5 @@
-WITH RECURSIVE
-  Fridays AS (
+WITH
+  RECURSIVE Fridays AS (
     SELECT 1 AS week_of_month, '2023-11-03' AS purchase_date
     UNION ALL
     SELECT week_of_month + 1, DATE_ADD(purchase_date, INTERVAL 7 DAY)
diff --git a/solutions/312. Burst Balloons/312-2.java b/solutions/312. Burst Balloons/312-2.java
index 0077adb202b..f813569a33e 100644
--- a/solutions/312. Burst Balloons/312-2.java	
+++ b/solutions/312. Burst Balloons/312-2.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int maxCoins(int[] nums) {
     final int n = nums.length;
-    // dp[i][j] := maxCoins(arr[i..j])
+    // dp[i][j] := maxCoins(A[i..j])
     int[][] dp = new int[n + 2][n + 2];
-    int[] arr = new int[n + 2];
+    int[] A = new int[n + 2];
 
-    System.arraycopy(nums, 0, arr, 1, n);
-    arr[0] = 1;
-    arr[n + 1] = 1;
+    System.arraycopy(nums, 0, A, 1, n);
+    A[0] = 1;
+    A[n + 1] = 1;
 
     for (int d = 0; d < n; ++d)
       for (int i = 1; i + d <= n; ++i) {
@@ -15,7 +15,7 @@ public int maxCoins(int[] nums) {
         for (int k = i; k <= j; ++k)
           dp[i][j] = Math.max(dp[i][j],                     //
                               dp[i][k - 1] + dp[k + 1][j] + //
-                                  arr[i - 1] * arr[k] * arr[j + 1]);
+                                  A[i - 1] * A[k] * A[j + 1]);
       }
 
     return dp[1][n];
diff --git a/solutions/312. Burst Balloons/312-2.py b/solutions/312. Burst Balloons/312-2.py
index 21065aa44e8..811328472d0 100644
--- a/solutions/312. Burst Balloons/312-2.py	
+++ b/solutions/312. Burst Balloons/312-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxCoins(self, nums: list[int]) -> int:
+  def maxCoins(self, nums: List[int]) -> int:
     n = len(nums)
     # dp[i][j] := maxCoins(nums[i..j])
     dp = [[0] * (n + 2) for _ in range(n + 2)]
diff --git a/solutions/312. Burst Balloons/312.py b/solutions/312. Burst Balloons/312.py
index b2068a82c23..57db7a9cf8c 100644
--- a/solutions/312. Burst Balloons/312.py	
+++ b/solutions/312. Burst Balloons/312.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxCoins(self, nums: list[int]) -> int:
+  def maxCoins(self, nums: List[int]) -> int:
     n = len(nums)
     nums = [1] + nums + [1]
 
diff --git a/solutions/3122. Minimum Number of Operations to Satisfy Conditions/3122.py b/solutions/3122. Minimum Number of Operations to Satisfy Conditions/3122.py
index 58740ad49e2..3be44ba02ed 100644
--- a/solutions/3122. Minimum Number of Operations to Satisfy Conditions/3122.py	
+++ b/solutions/3122. Minimum Number of Operations to Satisfy Conditions/3122.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumOperations(self, grid: list[list[int]]) -> int:
+  def minimumOperations(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
     count = [[0] * 10 for _ in range(n)]
diff --git a/solutions/3123. Find Edges in Shortest Paths/3123.cpp b/solutions/3123. Find Edges in Shortest Paths/3123.cpp
index d4ab3b462ab..c592d91cab2 100644
--- a/solutions/3123. Find Edges in Shortest Paths/3123.cpp	
+++ b/solutions/3123. Find Edges in Shortest Paths/3123.cpp	
@@ -32,10 +32,10 @@ class Solution {
 
   vector<int> dijkstra(const vector<vector<pair<int, int>>>& graph, int src) {
     vector<int> dist(graph.size(), kMax);
-
-    dist[src] = 0;
     using P = pair<int, int>;  // (d, u)
     priority_queue<P, vector<P>, greater<>> minHeap;
+
+    dist[src] = 0;
     minHeap.emplace(dist[src], src);
 
     while (!minHeap.empty()) {
diff --git a/solutions/3123. Find Edges in Shortest Paths/3123.java b/solutions/3123. Find Edges in Shortest Paths/3123.java
index c8c25a920a2..d67d8c2d737 100644
--- a/solutions/3123. Find Edges in Shortest Paths/3123.java	
+++ b/solutions/3123. Find Edges in Shortest Paths/3123.java	
@@ -3,7 +3,9 @@ class Solution {
   public boolean[] findAnswer(int n, int[][] edges) {
     boolean[] ans = new boolean[edges.length];
     List<Pair<Integer, Integer>>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
@@ -27,17 +29,16 @@ public boolean[] findAnswer(int n, int[][] edges) {
     return ans;
   }
 
-  private static int MAX = 1_000_000_000;
+  private static int kMax = 1_000_000_000;
 
   private int[] dijkstra(List<Pair<Integer, Integer>>[] graph, int src) {
     int[] dist = new int[graph.length];
-    Arrays.fill(dist, MAX);
+    Arrays.fill(dist, kMax);
+    // (d, u)
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
 
     dist[src] = 0;
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey)) {
-          { offer(new Pair<>(dist[src], src)); } // (d, u)
-        };
+    minHeap.offer(new Pair<>(dist[src], src));
 
     while (!minHeap.isEmpty()) {
       final int d = minHeap.peek().getKey();
diff --git a/solutions/3123. Find Edges in Shortest Paths/3123.py b/solutions/3123. Find Edges in Shortest Paths/3123.py
index 9dc295c855d..961c82b6986 100644
--- a/solutions/3123. Find Edges in Shortest Paths/3123.py	
+++ b/solutions/3123. Find Edges in Shortest Paths/3123.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Similar to 2203. Minimum Weighted Subgraph With the Required Paths
-  def findAnswer(self, n: int, edges: list[list[int]]) -> list[bool]:
+  def findAnswer(self, n: int, edges: List[List[int]]) -> List[bool]:
     graph = [[] for _ in range(n)]
 
     for u, v, w in edges:
@@ -13,11 +13,7 @@ def findAnswer(self, n: int, edges: list[list[int]]) -> list[bool]:
             from0[v] + w + from1[u] == from0[-1]
             for u, v, w in edges]
 
-  def _dijkstra(
-      self,
-      graph: list[list[tuple[int, int]]],
-      src: int,
-  ) -> list[int]:
+  def _dijkstra(self, graph: List[List[Tuple[int, int]]], src: int) -> List[int]:
     dist = [10**9] * len(graph)
 
     dist[src] = 0
diff --git a/solutions/3124. Find Longest Calls/3124.sql b/solutions/3124. Find Longest Calls/3124.sql
index fdb4c56f5dd..abe1318510a 100644
--- a/solutions/3124. Find Longest Calls/3124.sql	
+++ b/solutions/3124. Find Longest Calls/3124.sql	
@@ -22,4 +22,4 @@ SELECT
   ) AS duration_formatted
 FROM RankedCalls
 WHERE `rank` <= 3
-ORDER BY type DESC, duration DESC, first_name DESC;
+ORDER BY type, duration DESC, first_name DESC;
diff --git a/solutions/3127. Make a Square with the Same Color/3127.py b/solutions/3127. Make a Square with the Same Color/3127.py
index 708a7f64d74..7f8a643683d 100644
--- a/solutions/3127. Make a Square with the Same Color/3127.py	
+++ b/solutions/3127. Make a Square with the Same Color/3127.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canMakeSquare(self, grid: list[list[str]]) -> bool:
+  def canMakeSquare(self, grid: List[List[str]]) -> bool:
     for i in range(2):
       for j in range(2):
         black = 0
diff --git a/solutions/3128. Right Triangles/3128.py b/solutions/3128. Right Triangles/3128.py
index 460ea446b9a..e283ef747e9 100644
--- a/solutions/3128. Right Triangles/3128.py	
+++ b/solutions/3128. Right Triangles/3128.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfRightTriangles(self, grid: list[list[int]]) -> int:
+  def numberOfRightTriangles(self, grid: List[List[int]]) -> int:
     rows = [0] * len(grid)
     cols = [0] * len(grid[0])
 
diff --git a/solutions/3129. Find All Possible Stable Binary Arrays I/3129.java b/solutions/3129. Find All Possible Stable Binary Arrays I/3129.java
index 1db2c12d8f5..b66101757d8 100644
--- a/solutions/3129. Find All Possible Stable Binary Arrays I/3129.java	
+++ b/solutions/3129. Find All Possible Stable Binary Arrays I/3129.java	
@@ -1,7 +1,7 @@
 class Solution {
   // Same as 3129. Find All Possible Stable Binary Arrays I
   public int numberOfStableArrays(int zero, int one, int limit) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i][j][k] := the number of stable arrays, where the number of
     // occurrences of 0 is i and the number of occurrences of 1 is j and the last
     // number is k (0/1)
@@ -16,13 +16,13 @@ public int numberOfStableArrays(int zero, int one, int limit) {
     for (int i = 1; i <= zero; ++i)
       for (int j = 1; j <= one; ++j) {
         dp[i][j][0] = (dp[i - 1][j][0] + dp[i - 1][j][1] -
-                       (i - limit < 1 ? 0 : dp[i - limit - 1][j][1]) + MOD) %
-                      MOD;
+                       (i - limit < 1 ? 0 : dp[i - limit - 1][j][1]) + kMod) %
+                      kMod;
         dp[i][j][1] = (dp[i][j - 1][0] + dp[i][j - 1][1] -
-                       (j - limit < 1 ? 0 : dp[i][j - limit - 1][0]) + MOD) %
-                      MOD;
+                       (j - limit < 1 ? 0 : dp[i][j - limit - 1][0]) + kMod) %
+                      kMod;
       }
 
-    return (int) ((dp[zero][one][0] + dp[zero][one][1]) % MOD);
+    return (int) ((dp[zero][one][0] + dp[zero][one][1]) % kMod);
   }
 }
diff --git a/solutions/3129. Find All Possible Stable Binary Arrays I/3129.py b/solutions/3129. Find All Possible Stable Binary Arrays I/3129.py
index 0e43e020f37..79f4e4120e3 100644
--- a/solutions/3129. Find All Possible Stable Binary Arrays I/3129.py	
+++ b/solutions/3129. Find All Possible Stable Binary Arrays I/3129.py	
@@ -1,7 +1,7 @@
 class Solution:
   # Same as 3129. Find All Possible Stable Binary Arrays I
   def numberOfStableArrays(self, zero: int, one: int, limit: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # dp[i][j][k] := the number of stable arrays, where the number of
     # occurrences of 0 is i and the number of occurrences of 1 is j and the last
     # number is k (0/1)
@@ -17,11 +17,9 @@ def numberOfStableArrays(self, zero: int, one: int, limit: int) -> int:
 
     for i in range(1, zero + 1):
       for j in range(1, one + 1):
-        dp[i][j][0] = (
-            dp[i - 1][j][0] + dp[i - 1][j][1] -
-            (dp[i - limit - 1][j][1] if i - limit >= 1 else 0) + MOD) % MOD
-        dp[i][j][1] = (
-            dp[i][j - 1][0] + dp[i][j - 1][1] -
-            (dp[i][j - limit - 1][0] if j - limit >= 1 else 0) + MOD) % MOD
+        dp[i][j][0] = (dp[i - 1][j][0] + dp[i - 1][j][1] -
+                       (dp[i - limit - 1][j][1] if i - limit >= 1 else 0) + kMod) % kMod
+        dp[i][j][1] = (dp[i][j - 1][0] + dp[i][j - 1][1] -
+                       (dp[i][j - limit - 1][0] if j - limit >= 1 else 0) + kMod) % kMod
 
-    return (dp[zero][one][0] + dp[zero][one][1]) % MOD
+    return (dp[zero][one][0] + dp[zero][one][1]) % kMod
diff --git a/solutions/313. Super Ugly Number/313-2.cpp b/solutions/313. Super Ugly Number/313-2.cpp
index 43465800205..1f038d6c298 100644
--- a/solutions/313. Super Ugly Number/313-2.cpp	
+++ b/solutions/313. Super Ugly Number/313-2.cpp	
@@ -25,7 +25,7 @@ class Solution {
         const auto [prime, index, _] = minHeap.top();
         minHeap.pop();
         minHeap.emplace(prime, index + 1,
-                        static_cast<long>(prime) * uglyNums[index]);
+                        prime * static_cast<long>(uglyNums[index]));
       }
     }
 
diff --git a/solutions/313. Super Ugly Number/313-2.java b/solutions/313. Super Ugly Number/313-2.java
index a0547cd4dfd..25a766859af 100644
--- a/solutions/313. Super Ugly Number/313-2.java	
+++ b/solutions/313. Super Ugly Number/313-2.java	
@@ -1,20 +1,28 @@
+class UglyNum {
+  public int prime;
+  public int index; // the next index in `uglyNums`
+  public int value; // prime * uglyNums[index]
+  public UglyNum(int prime, int index, int value) {
+    this.prime = prime;
+    this.index = index;
+    this.value = value;
+  }
+}
+
 class Solution {
   public int nthSuperUglyNumber(int n, int[] primes) {
-    // index := the next index in `uglyNums`
-    // value := prime * uglyNums[index]
-    record UglyNum(int prime, int index, long value) {}
-    Queue<UglyNum> minHeap = new PriorityQueue<>(Comparator.comparingLong(UglyNum::value));
+    Queue<UglyNum> minHeap = new PriorityQueue<>((a, b) -> a.value - b.value);
     int[] uglyNums = new int[n];
     uglyNums[0] = 1;
 
     for (final int prime : primes)
-      minHeap.offer(new UglyNum(prime, 1, (long) prime * uglyNums[0]));
+      minHeap.offer(new UglyNum(prime, 1, prime * uglyNums[0]));
 
     for (int i = 1; i < n; ++i) {
-      uglyNums[i] = (int) minHeap.peek().value;
+      uglyNums[i] = minHeap.peek().value;
       while (minHeap.peek().value == uglyNums[i]) {
         final UglyNum u = minHeap.poll();
-        minHeap.offer(new UglyNum(u.prime, u.index + 1, (long) u.prime * uglyNums[u.index]));
+        minHeap.offer(new UglyNum(u.prime, u.index + 1, u.prime * uglyNums[u.index]));
       }
     }
 
diff --git a/solutions/313. Super Ugly Number/313-2.py b/solutions/313. Super Ugly Number/313-2.py
index 810796d45d2..cdfabac31ae 100644
--- a/solutions/313. Super Ugly Number/313-2.py	
+++ b/solutions/313. Super Ugly Number/313-2.py	
@@ -6,7 +6,7 @@ def __init__(self, prime: int, index: int, value: int):
 
 
 class Solution:
-  def nthSuperUglyNumber(self, n: int, primes: list[int]) -> int:
+  def nthSuperUglyNumber(self, n: int, primes: List[int]) -> int:
     minHeap = []  # (value, prime, index)
     uglyNums = [1]
 
diff --git a/solutions/313. Super Ugly Number/313.py b/solutions/313. Super Ugly Number/313.py
index c6dbd2a27ed..a9befe86af4 100644
--- a/solutions/313. Super Ugly Number/313.py	
+++ b/solutions/313. Super Ugly Number/313.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def nthSuperUglyNumber(self, n: int, primes: list[int]) -> int:
+  def nthSuperUglyNumber(self, n: int, primes: List[int]) -> int:
     k = len(primes)
     nums = [1]
     indices = [0] * k
diff --git a/solutions/3130. Find All Possible Stable Binary Arrays II/3130.java b/solutions/3130. Find All Possible Stable Binary Arrays II/3130.java
index 1db2c12d8f5..b66101757d8 100644
--- a/solutions/3130. Find All Possible Stable Binary Arrays II/3130.java	
+++ b/solutions/3130. Find All Possible Stable Binary Arrays II/3130.java	
@@ -1,7 +1,7 @@
 class Solution {
   // Same as 3129. Find All Possible Stable Binary Arrays I
   public int numberOfStableArrays(int zero, int one, int limit) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i][j][k] := the number of stable arrays, where the number of
     // occurrences of 0 is i and the number of occurrences of 1 is j and the last
     // number is k (0/1)
@@ -16,13 +16,13 @@ public int numberOfStableArrays(int zero, int one, int limit) {
     for (int i = 1; i <= zero; ++i)
       for (int j = 1; j <= one; ++j) {
         dp[i][j][0] = (dp[i - 1][j][0] + dp[i - 1][j][1] -
-                       (i - limit < 1 ? 0 : dp[i - limit - 1][j][1]) + MOD) %
-                      MOD;
+                       (i - limit < 1 ? 0 : dp[i - limit - 1][j][1]) + kMod) %
+                      kMod;
         dp[i][j][1] = (dp[i][j - 1][0] + dp[i][j - 1][1] -
-                       (j - limit < 1 ? 0 : dp[i][j - limit - 1][0]) + MOD) %
-                      MOD;
+                       (j - limit < 1 ? 0 : dp[i][j - limit - 1][0]) + kMod) %
+                      kMod;
       }
 
-    return (int) ((dp[zero][one][0] + dp[zero][one][1]) % MOD);
+    return (int) ((dp[zero][one][0] + dp[zero][one][1]) % kMod);
   }
 }
diff --git a/solutions/3130. Find All Possible Stable Binary Arrays II/3130.py b/solutions/3130. Find All Possible Stable Binary Arrays II/3130.py
index 76f6ca98b36..79f4e4120e3 100644
--- a/solutions/3130. Find All Possible Stable Binary Arrays II/3130.py	
+++ b/solutions/3130. Find All Possible Stable Binary Arrays II/3130.py	
@@ -1,12 +1,12 @@
 class Solution:
   # Same as 3129. Find All Possible Stable Binary Arrays I
   def numberOfStableArrays(self, zero: int, one: int, limit: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # dp[i][j][k] := the number of stable arrays, where the number of
     # occurrences of 0 is i and the number of occurrences of 1 is j and the last
     # number is k (0/1)
     dp = [[[0] * 2
-          for _ in range(one + 1)]
+           for _ in range(one + 1)]
           for _ in range(zero + 1)]
 
     for i in range(min(zero, limit) + 1):
@@ -17,11 +17,9 @@ def numberOfStableArrays(self, zero: int, one: int, limit: int) -> int:
 
     for i in range(1, zero + 1):
       for j in range(1, one + 1):
-        dp[i][j][0] = (
-            dp[i - 1][j][0] + dp[i - 1][j][1] -
-            (dp[i - limit - 1][j][1] if i - limit >= 1 else 0) + MOD) % MOD
-        dp[i][j][1] = (
-            dp[i][j - 1][0] + dp[i][j - 1][1] -
-            (dp[i][j - limit - 1][0] if j - limit >= 1 else 0) + MOD) % MOD
+        dp[i][j][0] = (dp[i - 1][j][0] + dp[i - 1][j][1] -
+                       (dp[i - limit - 1][j][1] if i - limit >= 1 else 0) + kMod) % kMod
+        dp[i][j][1] = (dp[i][j - 1][0] + dp[i][j - 1][1] -
+                       (dp[i][j - limit - 1][0] if j - limit >= 1 else 0) + kMod) % kMod
 
-    return (dp[zero][one][0] + dp[zero][one][1]) % MOD
+    return (dp[zero][one][0] + dp[zero][one][1]) % kMod
diff --git a/solutions/3131. Find the Integer Added to Array I/3131.py b/solutions/3131. Find the Integer Added to Array I/3131.py
index 4e2433947a0..fda4f9fb8f5 100644
--- a/solutions/3131. Find the Integer Added to Array I/3131.py	
+++ b/solutions/3131. Find the Integer Added to Array I/3131.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def addedInteger(self, nums1: list[int], nums2: list[int]) -> int:
+  def addedInteger(self, nums1: List[int], nums2: List[int]) -> int:
     return min(nums2) - min(nums1)
diff --git a/solutions/3132. Find the Integer Added to Array II/3132.py b/solutions/3132. Find the Integer Added to Array II/3132.py
index 730d2d09a44..a0d25199233 100644
--- a/solutions/3132. Find the Integer Added to Array II/3132.py	
+++ b/solutions/3132. Find the Integer Added to Array II/3132.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumAddedInteger(self, nums1: list[int], nums2: list[int]) -> int:
+  def minimumAddedInteger(self, nums1: List[int], nums2: List[int]) -> int:
     # After removing two elements from nums1, either nums1[0], nums1[1], or
     # nums1[2] will persist. Therefore, the difference between nums1 (with two
     # elements removed) and nums2 is represented by nums2[0] - nums1[i], where
@@ -16,7 +16,7 @@ def minimumAddedInteger(self, nums1: list[int], nums2: list[int]) -> int:
 
     return ans
 
-  def _isValidDiff(self, nums1: list[int], nums2: list[int], inc: int) -> bool:
+  def _isValidDiff(self, nums1: List[int], nums2: List[int], inc: int) -> bool:
     """
     Returns True if it's possible to increase nums1 (with two elements removed)
     by `inc` to nums2.
diff --git a/solutions/3133. Minimum Array End/3133.java b/solutions/3133. Minimum Array End/3133.java
index 7e5808fe896..d94ab8e8554 100644
--- a/solutions/3133. Minimum Array End/3133.java	
+++ b/solutions/3133. Minimum Array End/3133.java	
@@ -2,17 +2,17 @@ class Solution {
   public long minEnd(int n, int x) {
     // Set x's 0s with (n - 1)'s LSb-to-MSb bits, preserving x's 1s. This
     // operation increase x for (n - 1) iterations while preserving x's 1s.
-    final int MAX_BIT = bitLength(n) + bitLength(x);
+    final int kMaxBit = bitLength(n) + bitLength(x);
     final long k = n - 1;
     long ans = x;
-    int BINARY_INDEX = 0;
+    int kBinaryIndex = 0;
 
-    for (int i = 0; i < MAX_BIT; ++i) {
+    for (int i = 0; i < kMaxBit; ++i) {
       if ((ans >> i & 1) == 0) {
         // Set x's 0 with k's bit if the running bit of k is 1.
-        if ((k >> BINARY_INDEX & 1) == 1)
+        if ((k >> kBinaryIndex & 1) == 1)
           ans |= 1L << i;
-        ++BINARY_INDEX;
+        ++kBinaryIndex;
       }
     }
 
@@ -20,6 +20,6 @@ public long minEnd(int n, int x) {
   }
 
   private int bitLength(int n) {
-    return Integer.SIZE - Integer.numberOfLeadingZeros(n);
+    return 32 - Integer.numberOfLeadingZeros(n);
   }
 }
diff --git a/solutions/3133. Minimum Array End/3133.py b/solutions/3133. Minimum Array End/3133.py
index 9792c35de2c..9ac90fe7be8 100644
--- a/solutions/3133. Minimum Array End/3133.py	
+++ b/solutions/3133. Minimum Array End/3133.py	
@@ -2,15 +2,15 @@ class Solution:
   def minEnd(self, n: int, x: int) -> int:
     # Set x's 0s with (n - 1)'s LSb-to-MSb bits, preserving x's 1s. This
     # operation increase x for (n - 1) iterations while preserving x's 1s.
-    MAX_BIT = n.bit_length() + x.bit_length()
+    kMaxBit = n.bit_length() + x.bit_length()
     k = n - 1
-    BINARY_INDEX = 0
+    kBinaryIndex = 0
 
-    for i in range(MAX_BIT):
+    for i in range(kMaxBit):
       if x >> i & 1 == 0:
         # Set x's 0 with k's bit if the running bit of k is 1.
-        if k >> BINARY_INDEX & 1:
+        if k >> kBinaryIndex & 1:
           x |= 1 << i
-        BINARY_INDEX += 1
+        kBinaryIndex += 1
 
     return x
diff --git a/solutions/3134. Find the Median of the Uniqueness Array/3134.py b/solutions/3134. Find the Median of the Uniqueness Array/3134.py
index 14ed8a2a6b0..4fdd2756b80 100644
--- a/solutions/3134. Find the Median of the Uniqueness Array/3134.py	
+++ b/solutions/3134. Find the Median of the Uniqueness Array/3134.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def medianOfUniquenessArray(self, nums: list[int]):
+  def medianOfUniquenessArray(self, nums: List[int]):
     n = len(nums)
     subarrayCount = n * (n + 1) // 2
     medianCount = (subarrayCount + 1) // 2
@@ -23,7 +23,6 @@ def subarraysWithAtMostKDistinct(k: int) -> int:
 
       return res
 
-    l = 1
-    r = n
-    return bisect.bisect_left(range(l, r), medianCount,
-                              key=subarraysWithAtMostKDistinct) + l
+    return bisect.bisect_left(
+        range(1, n), medianCount,
+        key=lambda m: subarraysWithAtMostKDistinct(m)) + 1
diff --git a/solutions/3135. Equalize Strings by Adding or Removing Characters at Ends/3135.cpp b/solutions/3135. Equalize Strings by Adding or Removing Characters at Ends/3135.cpp
index 13a19d75965..18de095c34f 100644
--- a/solutions/3135. Equalize Strings by Adding or Removing Characters at Ends/3135.cpp	
+++ b/solutions/3135. Equalize Strings by Adding or Removing Characters at Ends/3135.cpp	
@@ -11,9 +11,9 @@ class Solution {
         if (initial[i - 1] == target[j - 1])
           dp[i][j] = 1 + dp[i - 1][j - 1];
 
-    const int maxCommonLength = accumulate(dp.begin(), dp.end(), 0,
-                                           [](int acc, const vector<int>& row) {
-      return max(acc, ranges::max(row));
+    const int maxCommonLength = accumulate(
+        dp.begin(), dp.end(), 0, [](int subtotal, const vector<int>& row) {
+      return max(subtotal, ranges::max(row));
     });
     return m + n - 2 * maxCommonLength;
   }
diff --git a/solutions/3136. Valid Word/3136.py b/solutions/3136. Valid Word/3136.py
index f2b94b38c44..54a4546f83c 100644
--- a/solutions/3136. Valid Word/3136.py	
+++ b/solutions/3136. Valid Word/3136.py	
@@ -1,11 +1,11 @@
 class Solution:
   def isValid(self, word: str) -> bool:
-    VOWELS = 'aeiouAEIOU'
+    kVowels = 'aeiouAEIOU'
 
     def isConsonant(c: str) -> bool:
-      return c.isalpha() and c not in VOWELS
+      return c.isalpha() and c not in kVowels
 
-    return (len(word) >= 3 and
-            all(c.isalnum() for c in word) and
-            any(c in VOWELS for c in word) and
-            any(isConsonant(c) for c in word))
+    return len(word) >= 3 and \
+        all(c.isalnum() for c in word) and \
+        any(c in kVowels for c in word) and \
+        any(isConsonant(c) for c in word)
diff --git a/solutions/3139. Minimum Cost to Equalize Array/3139.java b/solutions/3139. Minimum Cost to Equalize Array/3139.java
index 41da71c9d67..6a44893c784 100644
--- a/solutions/3139. Minimum Cost to Equalize Array/3139.java	
+++ b/solutions/3139. Minimum Cost to Equalize Array/3139.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int minCostToEqualizeArray(int[] nums, int cost1, int cost2) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = nums.length;
     final int minNum = Arrays.stream(nums).min().getAsInt();
     final int maxNum = Arrays.stream(nums).max().getAsInt();
@@ -9,7 +9,7 @@ public int minCostToEqualizeArray(int[] nums, int cost1, int cost2) {
 
     if (cost1 * 2 <= cost2 || n < 3) {
       final long totalGap = 1L * maxNum * n - sum;
-      return (int) ((cost1 * totalGap) % MOD);
+      return (int) ((cost1 * totalGap) % kMod);
     }
 
     for (int target = maxNum; target < 2 * maxNum; ++target) {
@@ -19,6 +19,6 @@ public int minCostToEqualizeArray(int[] nums, int cost1, int cost2) {
       ans = Math.min(ans, cost1 * (totalGap - 2 * pairs) + cost2 * pairs);
     }
 
-    return (int) (ans % MOD);
+    return (int) (ans % kMod);
   }
 }
diff --git a/solutions/3139. Minimum Cost to Equalize Array/3139.py b/solutions/3139. Minimum Cost to Equalize Array/3139.py
index 1f3de19208b..f82b9477e3d 100644
--- a/solutions/3139. Minimum Cost to Equalize Array/3139.py	
+++ b/solutions/3139. Minimum Cost to Equalize Array/3139.py	
@@ -1,11 +1,6 @@
 class Solution:
-  def minCostToEqualizeArray(
-      self,
-      nums: list[int],
-      cost1: int,
-      cost2: int,
-  ) -> int:
-    MOD = 1_000_000_007
+  def minCostToEqualizeArray(self, nums: List[int], cost1: int, cost2: int) -> int:
+    kMod = 1_000_000_007
     n = len(nums)
     minNum = min(nums)
     maxNum = max(nums)
@@ -13,7 +8,7 @@ def minCostToEqualizeArray(
 
     if cost1 * 2 <= cost2 or n < 3:
       totalGap = maxNum * n - summ
-      return (cost1 * totalGap) % MOD
+      return (cost1 * totalGap) % kMod
 
     def getMinCost(target: int) -> int:
       """Returns the minimum cost to make all numbers equal to `target`."""
@@ -25,4 +20,4 @@ def getMinCost(target: int) -> int:
       return cost1 * (totalGap - 2 * pairs) + cost2 * pairs
 
     return min(getMinCost(target)
-               for target in range(maxNum, 2 * maxNum)) % MOD
+               for target in range(maxNum, 2 * maxNum)) % kMod
diff --git a/solutions/314. Binary Tree Vertical Order Traversal/314.py b/solutions/314. Binary Tree Vertical Order Traversal/314.py
index 7a72c177aea..d21a919018a 100644
--- a/solutions/314. Binary Tree Vertical Order Traversal/314.py	
+++ b/solutions/314. Binary Tree Vertical Order Traversal/314.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def verticalOrder(self, root: TreeNode | None) -> list[list[int]]:
+  def verticalOrder(self, root: Optional[TreeNode]) -> List[List[int]]:
     if not root:
       return []
 
     range_ = [0] * 2
 
-    def getRange(root: TreeNode | None, x: int) -> None:
+    def getRange(root: Optional[TreeNode], x: int) -> None:
       if not root:
         return
 
diff --git a/solutions/3141. Maximum Hamming Distances/3141.cpp b/solutions/3141. Maximum Hamming Distances/3141.cpp
index e97e93125e1..2cf4fe92d4d 100644
--- a/solutions/3141. Maximum Hamming Distances/3141.cpp	
+++ b/solutions/3141. Maximum Hamming Distances/3141.cpp	
@@ -1,19 +1,19 @@
 class Solution {
  public:
   vector<int> maxHammingDistances(vector<int>& nums, int m) {
-    const int maxMask = 1 << m;
+    const int kMaxMask = 1 << m;
     vector<int> ans;
     // dp[i] := the maximum hamming distance from i to any number in `nums`
-    vector<int> dp(maxMask, INT_MIN);
+    vector<int> dp(kMaxMask, INT_MIN);
 
     for (const int num : nums)
       dp[num] = 0;
 
     for (int bit = 0; bit < m; ++bit) {
-      vector<int> newDp(maxMask);
-      for (int mask = 0; mask < maxMask; ++mask)
+      vector<int> newDp(kMaxMask);
+      for (int mask = 0; mask < kMaxMask; ++mask)
         newDp[mask] = max(dp[mask], dp[mask ^ (1 << bit)] + 1);
-      dp = std::move(newDp);
+      dp = move(newDp);
     }
 
     for (const int num : nums)
diff --git a/solutions/3141. Maximum Hamming Distances/3141.java b/solutions/3141. Maximum Hamming Distances/3141.java
index 043a1601dfb..9c393a9180e 100644
--- a/solutions/3141. Maximum Hamming Distances/3141.java	
+++ b/solutions/3141. Maximum Hamming Distances/3141.java	
@@ -1,17 +1,17 @@
 class Solution {
   public int[] maxHammingDistances(int[] nums, int m) {
-    final int MAX_MASK = 1 << m;
+    final int kMaxMask = 1 << m;
     int[] ans = new int[nums.length];
     // dp[i] := the maximum hamming distance from i to any number in `nums`
-    int[] dp = new int[MAX_MASK];
+    int[] dp = new int[kMaxMask];
     Arrays.fill(dp, Integer.MIN_VALUE);
 
     for (final int num : nums)
       dp[num] = 0;
 
     for (int bit = 0; bit < m; ++bit) {
-      int[] newDp = new int[MAX_MASK];
-      for (int mask = 0; mask < MAX_MASK; ++mask)
+      int[] newDp = new int[kMaxMask];
+      for (int mask = 0; mask < kMaxMask; ++mask)
         newDp[mask] = Math.max(dp[mask], dp[mask ^ (1 << bit)] + 1);
       dp = newDp;
     }
diff --git a/solutions/3141. Maximum Hamming Distances/3141.py b/solutions/3141. Maximum Hamming Distances/3141.py
index 5e77f2b16d9..6ef4590bdbc 100644
--- a/solutions/3141. Maximum Hamming Distances/3141.py	
+++ b/solutions/3141. Maximum Hamming Distances/3141.py	
@@ -1,15 +1,15 @@
 class Solution:
-  def maxHammingDistances(self, nums: list[int], m: int) -> list[int]:
-    MAX_MASK = 1 << m
+  def maxHammingDistances(self, nums: List[int], m: int) -> List[int]:
+    kMaxMask = 1 << m
     # dp[i] := the maximum hamming distance from i to any number in `nums`
-    dp = [-math.inf] * MAX_MASK
+    dp = [-math.inf] * kMaxMask
 
     for num in nums:
       dp[num] = 0
 
     for bit in range(m):
-      newDp = [0] * MAX_MASK
-      for mask in range(MAX_MASK):
+      newDp = [0] * kMaxMask
+      for mask in range(kMaxMask):
         newDp[mask] = max(dp[mask], dp[mask ^ (1 << bit)] + 1)
       dp = newDp
 
diff --git a/solutions/3142. Check if Grid Satisfies Conditions/3142.py b/solutions/3142. Check if Grid Satisfies Conditions/3142.py
index a7a9e07a2b4..b3ff7c219a9 100644
--- a/solutions/3142. Check if Grid Satisfies Conditions/3142.py	
+++ b/solutions/3142. Check if Grid Satisfies Conditions/3142.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def satisfiesConditions(self, grid: list[list[int]]) -> bool:
+  def satisfiesConditions(self, grid: List[List[int]]) -> bool:
     m = len(grid)
     n = len(grid[0])
-    return (all(grid[i][j] == grid[i + 1][j]
-                for i in range(m - 1)
-                for j in range(n)) and
-            all(grid[i][j] != grid[i][j + 1]
-                for i in range(m)
-                for j in range(n - 1)))
+    return all(grid[i][j] == grid[i + 1][j]
+               for i in range(m - 1)
+               for j in range(n)) and \
+        all(grid[i][j] != grid[i][j + 1]
+            for i in range(m)
+            for j in range(n - 1))
diff --git a/solutions/3143. Maximum Points Inside the Square/3143.py b/solutions/3143. Maximum Points Inside the Square/3143.py
index 0b62632a349..4f164874ab1 100644
--- a/solutions/3143. Maximum Points Inside the Square/3143.py	
+++ b/solutions/3143. Maximum Points Inside the Square/3143.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxPointsInsideSquare(self, points: list[list[int]], s: str) -> int:
+  def maxPointsInsideSquare(self, points: List[List[int]], s: str) -> int:
     secondMinSize = math.inf
     minSizes = {}
 
diff --git a/solutions/3144. Minimum Substring Partition of Equal Character Frequency/3144.java b/solutions/3144. Minimum Substring Partition of Equal Character Frequency/3144.java
index f0d75e937bc..dc0cfed40c2 100644
--- a/solutions/3144. Minimum Substring Partition of Equal Character Frequency/3144.java	
+++ b/solutions/3144. Minimum Substring Partition of Equal Character Frequency/3144.java	
@@ -17,11 +17,11 @@ public int minimumSubstringsInPartition(String s) {
     return dp[n - 1];
   }
 
-  private static final int MAX = 1001;
+  private static final int kMax = 1001;
 
   // Returns true if all non-zero frequencies are the same.
   private boolean isBalanced(int[] count) {
-    int minfreq = MAX;
+    int minfreq = kMax;
     int maxfreq = 0;
     for (final int freq : count)
       if (freq > 0) {
diff --git a/solutions/3145. Find Products of Elements of Big Array/3145.cpp b/solutions/3145. Find Products of Elements of Big Array/3145.cpp
index 3f2dbee1dba..b32d46b2e37 100644
--- a/solutions/3145. Find Products of Elements of Big Array/3145.cpp	
+++ b/solutions/3145. Find Products of Elements of Big Array/3145.cpp	
@@ -70,7 +70,7 @@ class Solution {
     return sumPowers;
   }
 
-  long modPow(long x, long n, int mod) {
+  int modPow(long x, long n, int mod) {
     if (n == 0)
       return 1 % mod;
     if (n % 2 == 1)
diff --git a/solutions/3145. Find Products of Elements of Big Array/3145.java b/solutions/3145. Find Products of Elements of Big Array/3145.java
index 443688008f2..2a6af4bb8ff 100644
--- a/solutions/3145. Find Products of Elements of Big Array/3145.java	
+++ b/solutions/3145. Find Products of Elements of Big Array/3145.java	
@@ -76,6 +76,6 @@ private long modPow(long x, long n, int mod) {
   }
 
   private int bitLength(long x) {
-    return Long.SIZE - Long.numberOfLeadingZeros(x);
+    return x == 0 ? 0 : 64 - Long.numberOfLeadingZeros(x);
   }
 }
diff --git a/solutions/3145. Find Products of Elements of Big Array/3145.py b/solutions/3145. Find Products of Elements of Big Array/3145.py
index 9695efcc628..f6b53f7f6bb 100644
--- a/solutions/3145. Find Products of Elements of Big Array/3145.py	
+++ b/solutions/3145. Find Products of Elements of Big Array/3145.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findProductsOfElements(self, queries: list[list[int]]) -> list[int]:
+  def findProductsOfElements(self, queries: List[List[int]]) -> List[int]:
     def sumBitsTill(x: int) -> int:
       """Returns sum(i.bit_count()), where 1 <= i <= x."""
       sumBits = 0
diff --git a/solutions/3147. Taking Maximum Energy From the Mystic Dungeon/3147.py b/solutions/3147. Taking Maximum Energy From the Mystic Dungeon/3147.py
index 1b3e453fdfd..cbd2ff928ca 100644
--- a/solutions/3147. Taking Maximum Energy From the Mystic Dungeon/3147.py	
+++ b/solutions/3147. Taking Maximum Energy From the Mystic Dungeon/3147.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumEnergy(self, energy: list[int], k: int) -> int:
+  def maximumEnergy(self, energy: List[int], k: int) -> int:
     # dp[i] := the sum of energy starting at i
     dp = energy.copy()
     for i in range(len(energy) - 1 - k, -1, -1):
diff --git a/solutions/3148. Maximum Difference Score in a Grid/3148.java b/solutions/3148. Maximum Difference Score in a Grid/3148.java
index ce0ad1f820f..4f26b87af63 100644
--- a/solutions/3148. Maximum Difference Score in a Grid/3148.java	
+++ b/solutions/3148. Maximum Difference Score in a Grid/3148.java	
@@ -1,12 +1,12 @@
 class Solution {
   public int maxScore(List<List<Integer>> grid) {
-    final int MAX = 200_000;
-    int ans = -MAX;
+    final int kMax = 200_000;
+    int ans = -kMax;
 
     for (int i = 0; i < grid.size(); ++i)
       for (int j = 0; j < grid.get(0).size(); ++j) {
-        final int prevMin = Math.min(i > 0 ? grid.get(i - 1).get(j) : MAX, //
-                                     j > 0 ? grid.get(i).get(j - 1) : MAX);
+        final int prevMin = Math.min(i > 0 ? grid.get(i - 1).get(j) : kMax, //
+                                     j > 0 ? grid.get(i).get(j - 1) : kMax);
         ans = Math.max(ans, grid.get(i).get(j) - prevMin);
         if (prevMin < grid.get(i).get(j))
           grid.get(i).set(j, prevMin);
diff --git a/solutions/3148. Maximum Difference Score in a Grid/3148.py b/solutions/3148. Maximum Difference Score in a Grid/3148.py
index 353adae03c6..021c325e74b 100644
--- a/solutions/3148. Maximum Difference Score in a Grid/3148.py	
+++ b/solutions/3148. Maximum Difference Score in a Grid/3148.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def maxScore(self, grid: list[list[int]]) -> int:
-    MAX = 200000
-    ans = -MAX
+  def maxScore(self, grid: List[List[int]]) -> int:
+    kMax = 200000
+    ans = -kMax
 
     for i, row in enumerate(grid):
       for j, num in enumerate(row):
-        prevMin = min(grid[i - 1][j] if i > 0 else MAX,
-                      grid[i][j - 1] if j > 0 else MAX)
+        prevMin = min(grid[i - 1][j] if i > 0 else kMax,
+                      grid[i][j - 1] if j > 0 else kMax)
         ans = max(ans, num - prevMin)
         grid[i][j] = min(num, prevMin)
 
diff --git a/solutions/3149. Find the Minimum Cost Array Permutation/3149.py b/solutions/3149. Find the Minimum Cost Array Permutation/3149.py
index 1199c2e0753..82cae395f4c 100644
--- a/solutions/3149. Find the Minimum Cost Array Permutation/3149.py	
+++ b/solutions/3149. Find the Minimum Cost Array Permutation/3149.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findPermutation(self, nums: list[int]) -> list[int]:
+  def findPermutation(self, nums: List[int]) -> List[int]:
     n = len(nums)
     bestPick = [[0] * (1 << n) for _ in range(n)]
 
@@ -22,7 +22,7 @@ def getScore(last: int, mask: int) -> int:
     getScore(0, 1)
     return self._construct(bestPick)
 
-  def _construct(self, bestPick: list[list[int]]) -> list[int]:
+  def _construct(self, bestPick: List[List[int]]) -> List[int]:
     ans = []
     last = 0
     mask = 1
diff --git a/solutions/315. Count of Smaller Numbers After Self/315-2.cpp b/solutions/315. Count of Smaller Numbers After Self/315-2.cpp
index b0aa4a9496b..373bed805a0 100644
--- a/solutions/315. Count of Smaller Numbers After Self/315-2.cpp	
+++ b/solutions/315. Count of Smaller Numbers After Self/315-2.cpp	
@@ -10,7 +10,7 @@ class SegmentTree {
   }
 
   // Returns sum(nums[i..j]).
-  int query(int i, int j) const {
+  int query(int i, int j) {
     return query(0, 0, n - 1, i, j);
   }
 
@@ -42,7 +42,7 @@ class SegmentTree {
     tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
   }
 
-  int query(int treeIndex, int lo, int hi, int i, int j) const {
+  int query(int treeIndex, int lo, int hi, int i, int j) {
     if (i <= lo && hi <= j)  // [lo, hi] lies completely inside [i, j].
       return tree[treeIndex];
     if (j < lo || hi < i)  // [lo, hi] lies completely outside [i, j].
@@ -52,8 +52,9 @@ class SegmentTree {
                  query(treeIndex * 2 + 2, mid + 1, hi, i, j));
   }
 
-  int merge(int left, int right) const {
-    return left + right;
+  // Merges the result of the left node and the right node.
+  int merge(int a, int b) const {
+    return a + b;
   }
 };
 
diff --git a/solutions/315. Count of Smaller Numbers After Self/315-3.cpp b/solutions/315. Count of Smaller Numbers After Self/315-3.cpp
index eb65838e66c..a02a659cd03 100644
--- a/solutions/315. Count of Smaller Numbers After Self/315-3.cpp	
+++ b/solutions/315. Count of Smaller Numbers After Self/315-3.cpp	
@@ -62,10 +62,6 @@ class SegmentTree {
       return 0;
     return query(root->left, i, j) + query(root->right, i, j);
   }
-
-  int merge(int left, int right) const {
-    return left + right;
-  }
 };
 
 class Solution {
diff --git a/solutions/315. Count of Smaller Numbers After Self/315-4.cpp b/solutions/315. Count of Smaller Numbers After Self/315-4.cpp
index 9a2b7609880..7b08bf91238 100644
--- a/solutions/315. Count of Smaller Numbers After Self/315-4.cpp	
+++ b/solutions/315. Count of Smaller Numbers After Self/315-4.cpp	
@@ -1,6 +1,7 @@
 struct Item {
   int num;
   int index;
+  Item(int num = 0, int index = 0) : num(num), index(index) {}
 };
 
 class Solution {
diff --git a/solutions/315. Count of Smaller Numbers After Self/315-4.java b/solutions/315. Count of Smaller Numbers After Self/315-4.java
index 1cbf0da9d71..7ede66a25d6 100644
--- a/solutions/315. Count of Smaller Numbers After Self/315-4.java	
+++ b/solutions/315. Count of Smaller Numbers After Self/315-4.java	
@@ -1,3 +1,12 @@
+class Item {
+  public int num;
+  public int index;
+  public Item(int num, int index) {
+    this.num = num;
+    this.index = index;
+  }
+}
+
 class Solution {
   public List<Integer> countSmaller(int[] nums) {
     final int n = nums.length;
@@ -11,8 +20,6 @@ public List<Integer> countSmaller(int[] nums) {
     return Arrays.stream(ans).boxed().collect(Collectors.toList());
   }
 
-  private record Item(int num, int index) {}
-
   private void mergeSort(Item[] items, int l, int r, int[] ans) {
     if (l >= r)
       return;
diff --git a/solutions/315. Count of Smaller Numbers After Self/315-4.py b/solutions/315. Count of Smaller Numbers After Self/315-4.py
index 64327b8a360..0e2a26d3825 100644
--- a/solutions/315. Count of Smaller Numbers After Self/315-4.py	
+++ b/solutions/315. Count of Smaller Numbers After Self/315-4.py	
@@ -1,14 +1,11 @@
-from dataclasses import dataclass
-
-
-@dataclass
 class Item:
-  num: int = 0
-  index: int = 0
+  def __init__(self, num: int = 0, index: int = 0):
+    self.num = num
+    self.index = index
 
 
 class Solution:
-  def countSmaller(self, nums: list[int]) -> list[int]:
+  def countSmaller(self, nums: List[int]) -> List[int]:
     n = len(nums)
     ans = [0] * n
     items = [Item(num, i) for i, num in enumerate(nums)]
@@ -16,13 +13,7 @@ def countSmaller(self, nums: list[int]) -> list[int]:
     self._mergeSort(items, 0, n - 1, ans)
     return ans
 
-  def _mergeSort(
-      self,
-      items: list[Item],
-      l: int,
-      r: int,
-      ans: list[int],
-  ) -> None:
+  def _mergeSort(self, items: List[Item], l: int, r: int, ans: List[int]) -> None:
     if l >= r:
       return
 
@@ -31,14 +22,7 @@ def _mergeSort(
     self._mergeSort(items, m + 1, r, ans)
     self._merge(items, l, m, r, ans)
 
-  def _merge(
-      self,
-      items: list[Item],
-      l: int,
-      m: int,
-      r: int,
-      ans: list[int],
-  ) -> None:
+  def _merge(self, items: List[Item], l: int, m: int, r: int, ans: List[int]) -> None:
     sorted = [Item()] * (r - l + 1)
     k = 0  # sorted's index
     i = l  # left's index
diff --git a/solutions/315. Count of Smaller Numbers After Self/315.py b/solutions/315. Count of Smaller Numbers After Self/315.py
index ad0ae97cfc3..ef19fc1f409 100644
--- a/solutions/315. Count of Smaller Numbers After Self/315.py	
+++ b/solutions/315. Count of Smaller Numbers After Self/315.py	
@@ -20,7 +20,7 @@ def lowbit(i: int) -> int:
 
 
 class Solution:
-  def countSmaller(self, nums: list[int]) -> list[int]:
+  def countSmaller(self, nums: List[int]) -> List[int]:
     ans = []
     ranks = self._getRanks(nums)
     tree = FenwickTree(len(ranks))
@@ -31,7 +31,7 @@ def countSmaller(self, nums: list[int]) -> list[int]:
 
     return ans[::-1]
 
-  def _getRanks(self, nums: list[int]) -> dict[int, int]:
+  def _getRanks(self, nums: List[int]) -> Dict[int, int]:
     ranks = collections.Counter()
     rank = 0
     for num in sorted(set(nums)):
diff --git a/solutions/3151. Special Array I/3151.py b/solutions/3151. Special Array I/3151.py
index 9246b2eb9d4..618f1438e32 100644
--- a/solutions/3151. Special Array I/3151.py	
+++ b/solutions/3151. Special Array I/3151.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def isArraySpecial(self, nums: list[int]) -> bool:
+  def isArraySpecial(self, nums: List[int]) -> bool:
     return all(a % 2 != b % 2 for a, b in itertools.pairwise(nums))
diff --git a/solutions/3152. Special Array II/3152.py b/solutions/3152. Special Array II/3152.py
index 791dc76c775..4fea2a2a3e1 100644
--- a/solutions/3152. Special Array II/3152.py	
+++ b/solutions/3152. Special Array II/3152.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def isArraySpecial(
-      self,
-      nums: list[int],
-      queries: list[list[int]],
-  ) -> list[bool]:
+  def isArraySpecial(self, nums: List[int], queries: List[List[int]]) -> List[bool]:
     ans = []
     id = 0
     # parityIds[i] := the id of the parity group that nums[i] belongs to
diff --git a/solutions/3153. Sum of Digit Differences of All Pairs/3153.py b/solutions/3153. Sum of Digit Differences of All Pairs/3153.py
index 0bccaa13aa3..e5e0690220e 100644
--- a/solutions/3153. Sum of Digit Differences of All Pairs/3153.py	
+++ b/solutions/3153. Sum of Digit Differences of All Pairs/3153.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sumDigitDifferences(self, nums: list[int]) -> int:
+  def sumDigitDifferences(self, nums: List[int]) -> int:
     n = len(nums)
     digitSize = len(str(nums[0]))
     ans = 0
diff --git a/solutions/3154. Find Number of Ways to Reach the K-th Stair/3154.java b/solutions/3154. Find Number of Ways to Reach the K-th Stair/3154.java
index 0c4cba63704..1ef79c364e2 100644
--- a/solutions/3154. Find Number of Ways to Reach the K-th Stair/3154.java	
+++ b/solutions/3154. Find Number of Ways to Reach the K-th Stair/3154.java	
@@ -8,11 +8,11 @@ public int waysToReachStair(int k) {
     // positions (before and after each `jump`) for  `down`. The maximum jump is
     // 29, as it satisfies the condition down = 2^jump - k <= jump + 1, with k
     // being the maximum value of 10^9.
-    final int MAX_JUMP = 29;
-    final int[][] comb = getComb(MAX_JUMP + 1, MAX_JUMP + 1);
+    final int kMaxJump = 29;
+    final int[][] comb = getComb(kMaxJump + 1, kMaxJump + 1);
     int ans = 0;
 
-    for (int jump = 0; jump <= MAX_JUMP; ++jump) {
+    for (int jump = 0; jump <= kMaxJump; ++jump) {
       final int down = (1 << jump) - k;
       if (down < 0 || down > jump + 1)
         continue;
@@ -25,6 +25,7 @@ public int waysToReachStair(int k) {
   // C(n, k) = C(n - 1, k) + C(n - 1, k - 1)
   private int[][] getComb(int n, int k) {
     int[][] comb = new int[n + 1][k + 1];
+
     for (int i = 0; i <= n; ++i)
       comb[i][0] = 1;
     for (int i = 1; i <= n; ++i)
diff --git a/solutions/3154. Find Number of Ways to Reach the K-th Stair/3154.py b/solutions/3154. Find Number of Ways to Reach the K-th Stair/3154.py
index 16ddbcc36db..88b748e8210 100644
--- a/solutions/3154. Find Number of Ways to Reach the K-th Stair/3154.py	
+++ b/solutions/3154. Find Number of Ways to Reach the K-th Stair/3154.py	
@@ -8,10 +8,10 @@ def waysToReachStair(self, k: int) -> int:
     # positions (before and after each `jump`) for  `down`. The maximum jump is
     # 29, as it satisfies the condition down = 2^jump - k <= jump + 1, with k
     # being the maximum value of 10^9.
-    MAX_JUMP = 29
+    kMaxJump = 29
     ans = 0
 
-    for jump in range(MAX_JUMP + 1):
+    for jump in range(kMaxJump + 1):
       down = (1 << jump) - k
       if down < 0 or down > jump + 1:
         continue
diff --git a/solutions/3155. Maximum Number of Upgradable Servers/3155.py b/solutions/3155. Maximum Number of Upgradable Servers/3155.py
index 788e997177b..072589eef81 100644
--- a/solutions/3155. Maximum Number of Upgradable Servers/3155.py	
+++ b/solutions/3155. Maximum Number of Upgradable Servers/3155.py	
@@ -1,13 +1,6 @@
 class Solution:
-  def maxUpgrades(
-      self,
-      count: list[int],
-      upgrade: list[int],
-      sell: list[int],
-      money: list[int],
-  ) -> list[int]:
+  def maxUpgrades(self, count: List[int], upgrade: List[int], sell: List[int], money: List[int]) -> List[int]:
     # If there's enough money, upgrade all servers; otherwise, optimize by
     # upgrading x servers. We have x * upgrade <= money + (count - x) * sell.
     # Therefore, x = (money + count * sell) / (sell + upgrade).
-    return [min(c, (m + c * s) // (s + u))
-            for c, u, s, m in zip(count, upgrade, sell, money)]
+    return [min(c, (m + c * s) // (s + u)) for c, u, s, m in zip(count, upgrade, sell, money)]
diff --git a/solutions/3156. Employee Task Duration and Concurrent Tasks/3156.sql b/solutions/3156. Employee Task Duration and Concurrent Tasks/3156.sql
index 03d21dd91ba..878b445bd06 100644
--- a/solutions/3156. Employee Task Duration and Concurrent Tasks/3156.sql	
+++ b/solutions/3156. Employee Task Duration and Concurrent Tasks/3156.sql	
@@ -6,14 +6,23 @@ WITH
     SELECT DISTINCT employee_id, end_time AS `time`
     FROM Tasks
   ),
+  RankedEmployeeTimes AS (
+    SELECT
+      *,
+      ROW_NUMBER() OVER(
+        PARTITION BY employee_id
+        ORDER BY `time`
+      ) AS `row_number`
+    FROM EmployeeTimes
+  ),
   Segments AS (
     SELECT
       employee_id,
       `time` AS start_time,
       LEAD(`time`) OVER(PARTITION BY employee_id ORDER BY `time`) AS end_time
-    FROM EmployeeTimes
+    FROM RankedEmployeeTimes
   ),
-  SegmentsCount AS (
+  WorkingSegments AS (
     SELECT
       Segments.*,
       COUNT(*) AS concurrent_count
@@ -33,6 +42,6 @@ SELECT
     )
   ) AS total_task_hours,
   MAX(concurrent_count) AS max_concurrent_tasks
-FROM SegmentsCount
+FROM WorkingSegments
 GROUP BY 1
 ORDER BY 1;
diff --git a/solutions/3157. Find the Level of Tree with Minimum Sum/3157-2.py b/solutions/3157. Find the Level of Tree with Minimum Sum/3157-2.py
index 7402eb3c823..c056b0a761b 100644
--- a/solutions/3157. Find the Level of Tree with Minimum Sum/3157-2.py	
+++ b/solutions/3157. Find the Level of Tree with Minimum Sum/3157-2.py	
@@ -1,10 +1,10 @@
 class Solution:
   # Similar to 1161. Maximum Level Sum of a Binary Tree
-  def minimumLevel(self, root: TreeNode | None) -> int:
+  def minimumLevel(self, root: Optional[TreeNode]) -> int:
     # levelSums[i] := the sum of level (i + 1) (1-indexed)
     levelSums = []
 
-    def dfs(root: TreeNode | None, level: int) -> None:
+    def dfs(root: Optional[TreeNode], level: int) -> None:
       if not root:
         return
       if len(levelSums) == level:
diff --git a/solutions/3157. Find the Level of Tree with Minimum Sum/3157.py b/solutions/3157. Find the Level of Tree with Minimum Sum/3157.py
index d3db0157dd4..257bba20163 100644
--- a/solutions/3157. Find the Level of Tree with Minimum Sum/3157.py	
+++ b/solutions/3157. Find the Level of Tree with Minimum Sum/3157.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Similar to 1161. Maximum Level Sum of a Binary Tree
-  def minimumLevel(self, root: TreeNode | None) -> int:
+  def minimumLevel(self, root: Optional[TreeNode]) -> int:
     ans = 0
     minLevelSum = math.inf
     q = collections.deque([root])
diff --git a/solutions/3158. Find the XOR of Numbers Which Appear Twice/3158.java b/solutions/3158. Find the XOR of Numbers Which Appear Twice/3158.java
index 4c82acf30a5..9b73c33378b 100644
--- a/solutions/3158. Find the XOR of Numbers Which Appear Twice/3158.java	
+++ b/solutions/3158. Find the XOR of Numbers Which Appear Twice/3158.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int duplicateNumbersXOR(int[] nums) {
-    final int MAX = 50;
+    final int kMax = 50;
     int ans = 0;
-    int[] count = new int[MAX + 1];
+    int[] count = new int[kMax + 1];
 
     for (final int num : nums)
       ++count[num];
 
-    for (int num = 1; num <= MAX; ++num)
+    for (int num = 1; num <= kMax; ++num)
       if (count[num] == 2)
         ans ^= num;
 
diff --git a/solutions/3158. Find the XOR of Numbers Which Appear Twice/3158.py b/solutions/3158. Find the XOR of Numbers Which Appear Twice/3158.py
index 89d1eba3552..7ce28f5facb 100644
--- a/solutions/3158. Find the XOR of Numbers Which Appear Twice/3158.py	
+++ b/solutions/3158. Find the XOR of Numbers Which Appear Twice/3158.py	
@@ -1,6 +1,5 @@
 class Solution:
   def duplicateNumbersXOR(self, nums):
     count = collections.Counter(nums)
-    return functools.reduce(
-        operator.xor, [num for num, freq in count.items() if freq == 2],
-        0)
+    return functools.reduce(operator.xor,
+                            [num for num, freq in count.items() if freq == 2], 0)
diff --git a/solutions/3159. Find Occurrences of an Element in an Array/3159.py b/solutions/3159. Find Occurrences of an Element in an Array/3159.py
index 75fc01b8151..7f31820af69 100644
--- a/solutions/3159. Find Occurrences of an Element in an Array/3159.py	
+++ b/solutions/3159. Find Occurrences of an Element in an Array/3159.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def occurrencesOfElement(
-      self,
-      nums: list[int],
-      queries: list[int],
-      x: int,
-  ) -> list[int]:
+  def occurrencesOfElement(self, nums: List[int], queries: List[int], x: int) -> List[int]:
     indices = [i for i, num in enumerate(nums) if num == x]
     return [indices[query - 1] if query <= len(indices) else -1
             for query in queries]
diff --git a/solutions/3160. Find the Number of Distinct Colors Among the Balls/3160.py b/solutions/3160. Find the Number of Distinct Colors Among the Balls/3160.py
index d11739790fb..41ede3caeee 100644
--- a/solutions/3160. Find the Number of Distinct Colors Among the Balls/3160.py	
+++ b/solutions/3160. Find the Number of Distinct Colors Among the Balls/3160.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def queryResults(self, limit: int, queries: list[list[int]]) -> list[int]:
+  def queryResults(self, limit: int, queries: List[List[int]]) -> List[int]:
     ans = []
     ballToColor = {}
     colorCount = collections.Counter()
diff --git a/solutions/3161. Block Placement Queries/3161.cpp b/solutions/3161. Block Placement Queries/3161.cpp
index 9f3ac16bdde..255f943f8b9 100644
--- a/solutions/3161. Block Placement Queries/3161.cpp	
+++ b/solutions/3161. Block Placement Queries/3161.cpp	
@@ -64,7 +64,6 @@ class Solution {
       }
     }
 
-    ranges::reverse(ans);
-    return ans;
+    return {ans.rbegin(), ans.rend()};
   }
 };
diff --git a/solutions/3161. Block Placement Queries/3161.py b/solutions/3161. Block Placement Queries/3161.py
index b884aed3615..b31fac6b418 100644
--- a/solutions/3161. Block Placement Queries/3161.py	
+++ b/solutions/3161. Block Placement Queries/3161.py	
@@ -23,7 +23,7 @@ def lowtree(i: int) -> int:
 
 
 class Solution:
-  def getResults(self, queries: list[list[int]]) -> list[bool]:
+  def getResults(self, queries: List[List[int]]) -> List[bool]:
     n = min(50000, len(queries) * 3)
     ans = []
     tree = FenwickTree(n + 1)
diff --git a/solutions/3162. Find the Number of Good Pairs I/3162.py b/solutions/3162. Find the Number of Good Pairs I/3162.py
index dc0c108e981..b5d53f50c70 100644
--- a/solutions/3162. Find the Number of Good Pairs I/3162.py	
+++ b/solutions/3162. Find the Number of Good Pairs I/3162.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfPairs(self, nums1: list[int], nums2: list[int], k: int) -> int:
+  def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:
     return sum(num1 % (num2 * k) == 0
                for num1 in nums1
                for num2 in nums2)
diff --git a/solutions/3164. Find the Number of Good Pairs II/3164.py b/solutions/3164. Find the Number of Good Pairs II/3164.py
index 29db544f448..8db6cbd6633 100644
--- a/solutions/3164. Find the Number of Good Pairs II/3164.py	
+++ b/solutions/3164. Find the Number of Good Pairs II/3164.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfPairs(self, nums1: list[int], nums2: list[int], k: int) -> int:
+  def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:
     count = collections.Counter(num * k for num in nums2)
     ans = 0
 
diff --git a/solutions/3169. Count Days Without Meetings/3169.java b/solutions/3169. Count Days Without Meetings/3169.java
index 05da0152955..86b760c4802 100644
--- a/solutions/3169. Count Days Without Meetings/3169.java	
+++ b/solutions/3169. Count Days Without Meetings/3169.java	
@@ -3,7 +3,7 @@ public int countDays(int days, int[][] meetings) {
     int freeDays = 0;
     int prevEnd = 0;
 
-    Arrays.sort(meetings, Comparator.comparingInt(meeting -> meeting[0]));
+    Arrays.sort(meetings, (a, b) -> a[0] - b[0]);
 
     for (int[] meeting : meetings) {
       final int start = meeting[0];
diff --git a/solutions/3169. Count Days Without Meetings/3169.py b/solutions/3169. Count Days Without Meetings/3169.py
index b2630134def..78114e02d06 100644
--- a/solutions/3169. Count Days Without Meetings/3169.py	
+++ b/solutions/3169. Count Days Without Meetings/3169.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countDays(self, days: int, meetings: list[list[int]]) -> int:
+  def countDays(self, days: int, meetings: List[List[int]]) -> int:
     freeDays = 0
     prevEnd = 0
 
diff --git a/solutions/317. Shortest Distance from All Buildings/317.cpp b/solutions/317. Shortest Distance from All Buildings/317.cpp
index fb2e408ee32..66a78dd6f2f 100644
--- a/solutions/317. Shortest Distance from All Buildings/317.cpp	
+++ b/solutions/317. Shortest Distance from All Buildings/317.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int shortestDistance(vector<vector<int>>& grid) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = grid.size();
     const int n = grid[0].size();
     const int nBuildings = getBuildingsCount(grid);
@@ -16,13 +16,15 @@ class Solution {
       queue<pair<int, int>> q{{{row, col}}};
       vector<vector<bool>> seen(m, vector<bool>(n));
       seen[row][col] = true;
+      int depth = 0;
       int seenBuildings = 1;
 
-      for (int step = 1; !q.empty(); ++step)
+      while (!q.empty()) {
+        ++depth;
         for (int sz = q.size(); sz > 0; --sz) {
           const auto [i, j] = q.front();
           q.pop();
-          for (const auto& [dx, dy] : kDirs) {
+          for (const auto& [dx, dy] : dirs) {
             const int x = i + dx;
             const int y = j + dy;
             if (x < 0 || x == m || y < 0 || y == n)
@@ -31,7 +33,7 @@ class Solution {
               continue;
             seen[x][y] = true;
             if (!grid[x][y]) {
-              dist[x][y] += step;
+              dist[x][y] += depth;
               ++reachCount[x][y];
               q.emplace(x, y);
             } else if (grid[x][y] == 1) {
@@ -39,6 +41,7 @@ class Solution {
             }
           }
         }
+      }
 
       return seenBuildings == nBuildings;
     };
@@ -59,8 +62,9 @@ class Solution {
 
  private:
   int getBuildingsCount(vector<vector<int>>& grid) {
-    return accumulate(
-        grid.begin(), grid.end(), 0,
-        [](int acc, vector<int>& row) { return acc + ranges::count(row, 1); });
+    return accumulate(grid.begin(), grid.end(), 0,
+                      [](int subtotal, vector<int>& row) {
+      return subtotal + ranges::count(row, 1);
+    });
   }
 };
diff --git a/solutions/317. Shortest Distance from All Buildings/317.java b/solutions/317. Shortest Distance from All Buildings/317.java
index 506c6d5676d..2579e3ed868 100644
--- a/solutions/317. Shortest Distance from All Buildings/317.java	
+++ b/solutions/317. Shortest Distance from All Buildings/317.java	
@@ -24,22 +24,25 @@ public int shortestDistance(int[][] grid) {
     return ans == Integer.MAX_VALUE ? -1 : ans;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private boolean bfs(int[][] grid, int row, int col, int[][] dist, int[][] reachCount,
                       int nBuildings) {
     final int m = grid.length;
     final int n = grid[0].length;
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(row, col)));
+
+    Queue<int[]> q = new ArrayDeque<>(Arrays.asList(new int[] {row, col}));
     boolean[][] seen = new boolean[m][n];
     seen[row][col] = true;
+    int depth = 0;
     int seenBuildings = 1;
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++depth;
       for (int sz = q.size(); sz > 0; --sz) {
-        final int i = q.peek().getKey();
-        final int j = q.poll().getValue();
-        for (int[] dir : DIRS) {
+        final int i = q.peek()[0];
+        final int j = q.poll()[1];
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == m || y < 0 || y == n)
@@ -48,14 +51,16 @@ private boolean bfs(int[][] grid, int row, int col, int[][] dist, int[][] reachC
             continue;
           seen[x][y] = true;
           if (grid[x][y] == 0) {
-            dist[x][y] += step;
+
+            dist[x][y] += depth;
             ++reachCount[x][y];
-            q.offer(new Pair<>(x, y));
+            q.offer(new int[] {x, y});
           } else if (grid[x][y] == 1) {
             ++seenBuildings;
           }
         }
       }
+    }
 
     return seenBuildings == nBuildings;
   }
diff --git a/solutions/317. Shortest Distance from All Buildings/317.py b/solutions/317. Shortest Distance from All Buildings/317.py
index 1e118e4f854..2b1c3d48214 100644
--- a/solutions/317. Shortest Distance from All Buildings/317.py	
+++ b/solutions/317. Shortest Distance from All Buildings/317.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def shortestDistance(self, grid: list[list[int]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def shortestDistance(self, grid: List[List[int]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(grid)
     n = len(grid[0])
     nBuildings = sum(a == 1 for row in grid for a in row)
@@ -14,13 +14,14 @@ def shortestDistance(self, grid: list[list[int]]) -> int:
     def bfs(row: int, col: int) -> bool:
       q = collections.deque([(row, col)])
       seen = {(row, col)}
+      depth = 0
       seenBuildings = 1
 
-      step = 1
       while q:
+        depth += 1
         for _ in range(len(q)):
           i, j = q.popleft()
-          for dx, dy in DIRS:
+          for dx, dy in dirs:
             x = i + dx
             y = j + dy
             if x < 0 or x == m or y < 0 or y == n:
@@ -29,12 +30,11 @@ def bfs(row: int, col: int) -> bool:
               continue
             seen.add((x, y))
             if not grid[x][y]:
-              dist[x][y] += step
+              dist[x][y] += depth
               reachCount[x][y] += 1
               q.append((x, y))
             elif grid[x][y] == 1:
               seenBuildings += 1
-        step += 1
 
       # True if all the buildings (1) are connected
       return seenBuildings == nBuildings
diff --git a/solutions/3171. Find Subarray With Bitwise AND Closest to K/3171.cpp b/solutions/3171. Find Subarray With Bitwise AND Closest to K/3171.cpp
index d730264f7e6..d441869159d 100644
--- a/solutions/3171. Find Subarray With Bitwise AND Closest to K/3171.cpp	
+++ b/solutions/3171. Find Subarray With Bitwise AND Closest to K/3171.cpp	
@@ -1,6 +1,6 @@
 class Solution {
  public:
-  // Similar to 1521. Find a Value of a Mysterious Function Closest to Target
+  // Same as 1521. Find a Value of a Mysterious Function Closest to Target
   int minimumDifference(vector<int>& nums, int k) {
     int ans = INT_MAX;
     // all the values of subarrays that end in the previous number
@@ -9,13 +9,13 @@ class Solution {
     for (const int num : nums) {
       unordered_set<int> next{num};
       // Extend each subarray that ends in the previous number. Due to
-      // monotonicity of the OR operation, the size of `next` will be at most
+      // monotonicity of the AND operation, the size of `next` will be at most
       // num.bit_count() + 1.
       for (const int val : prev)
-        next.insert(val | num);
+        next.insert(val & num);
       for (const int val : next)
         ans = min(ans, abs(k - val));
-      prev = std::move(next);
+      prev = move(next);
     }
 
     return ans;
diff --git a/solutions/3171. Find Subarray With Bitwise AND Closest to K/3171.java b/solutions/3171. Find Subarray With Bitwise AND Closest to K/3171.java
index 756db3389eb..8bbfa5ab292 100644
--- a/solutions/3171. Find Subarray With Bitwise AND Closest to K/3171.java	
+++ b/solutions/3171. Find Subarray With Bitwise AND Closest to K/3171.java	
@@ -1,5 +1,5 @@
 class Solution {
-  // Similar to 1521. Find a Value of a Mysterious Function Closest to Target
+  // Same as 1521. Find a Value of a Mysterious Function Closest to Target
   public int minimumDifference(int[] nums, int k) {
     int ans = Integer.MAX_VALUE;
     // all the values of subarrays that end in the previous number
@@ -8,10 +8,10 @@ public int minimumDifference(int[] nums, int k) {
     for (final int num : nums) {
       HashSet<Integer> next = new HashSet<>(Arrays.asList(num));
       // Extend each subarray that ends in the previous number. Due to
-      // monotonicity of the OR operation, the size of `next` will be at most
+      // monotonicity of the AND operation, the size of `next` will be at most
       // Integer.bitCount(num) + 1.
       for (final int val : prev)
-        next.add(val | num);
+        next.add(val & num);
       for (final int val : next)
         ans = Math.min(ans, Math.abs(k - val));
       prev = next;
diff --git a/solutions/3171. Find Subarray With Bitwise AND Closest to K/3171.py b/solutions/3171. Find Subarray With Bitwise AND Closest to K/3171.py
index e3b02676589..35fb2c01390 100644
--- a/solutions/3171. Find Subarray With Bitwise AND Closest to K/3171.py	
+++ b/solutions/3171. Find Subarray With Bitwise AND Closest to K/3171.py	
@@ -1,14 +1,14 @@
 class Solution:
-  # Similar to 1521. Find a Value of a Mysterious Function Closest to Target
-  def minimumDifference(self, nums: list[int], k: int) -> int:
+  # Same as 1521. Find a Value of a Mysterious Function Closest to Target
+  def minimumDifference(self, nums: List[int], k: int) -> int:
     ans = math.inf
     dp = set()  # all the values of subarrays that end in the current number
 
     for num in nums:
       # Extend each subarray that ends in the dpious number. Due to
-      # monotonicity of the OR operation, the size of `next_set` will be at most
+      # monotonicity of the AND operation, the size of `next_set` will be at most
       # bin(num).count('1') + 1.
-      dp = {num} | {val | num for val in dp}
+      dp = {num} | {val & num for val in dp}
       ans = min(ans, min(abs(k - val) for val in dp))
 
     return ans
diff --git a/solutions/3173. Bitwise OR of Adjacent Elements/3173.py b/solutions/3173. Bitwise OR of Adjacent Elements/3173.py
index ac280ece0f8..eadbb576103 100644
--- a/solutions/3173. Bitwise OR of Adjacent Elements/3173.py	
+++ b/solutions/3173. Bitwise OR of Adjacent Elements/3173.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def orArray(self, nums: list[int]) -> list[int]:
+  def orArray(self, nums: List[int]) -> List[int]:
     return [a | b for a, b in itertools.pairwise(nums)]
diff --git a/solutions/3175. Find The First Player to win K Games in a Row/3175.py b/solutions/3175. Find The First Player to win K Games in a Row/3175.py
index e0f6668017f..d8f70060337 100644
--- a/solutions/3175. Find The First Player to win K Games in a Row/3175.py	
+++ b/solutions/3175. Find The First Player to win K Games in a Row/3175.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Similar to 1535. Find the Winner of an Array Game
-  def findWinningPlayer(self, skills: list[int], k: int) -> int:
+  def findWinningPlayer(self, skills: List[int], k: int) -> int:
     ans = 0
     wins = 0
 
diff --git a/solutions/3176. Find the Maximum Length of a Good Subsequence I/3176.py b/solutions/3176. Find the Maximum Length of a Good Subsequence I/3176.py
index 394171a378e..d357753f479 100644
--- a/solutions/3176. Find the Maximum Length of a Good Subsequence I/3176.py	
+++ b/solutions/3176. Find the Maximum Length of a Good Subsequence I/3176.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumLength(self, nums: list[int], k: int) -> int:
+  def maximumLength(self, nums: List[int], k: int) -> int:
     # dp[count][num] := the maximum length of a good subsequence with at most
     # `count` indices where seq[i] != seq[i + 1] and it ends in `num`.
     dp = [collections.Counter() for _ in range(k + 1)]
diff --git a/solutions/3177. Find the Maximum Length of a Good Subsequence II/3177.py b/solutions/3177. Find the Maximum Length of a Good Subsequence II/3177.py
index 43df6dfddc2..bd71fdf442a 100644
--- a/solutions/3177. Find the Maximum Length of a Good Subsequence II/3177.py	
+++ b/solutions/3177. Find the Maximum Length of a Good Subsequence II/3177.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 3176. Find the Maximum Length of a Good Subsequence I
-  def maximumLength(self, nums: list[int], k: int) -> int:
+  def maximumLength(self, nums: List[int], k: int) -> int:
     # dp[count][num] := the maximum length of a good subsequence with at most
     # `count` indices where seq[i] != seq[i + 1] and it ends in `num`.
     dp = [collections.Counter() for _ in range(k + 1)]
diff --git a/solutions/3179. Find the N-th Value After K Seconds/3179.java b/solutions/3179. Find the N-th Value After K Seconds/3179.java
index 503c999bac2..c4e2daa6583 100644
--- a/solutions/3179. Find the N-th Value After K Seconds/3179.java	
+++ b/solutions/3179. Find the N-th Value After K Seconds/3179.java	
@@ -6,7 +6,7 @@ public int valueAfterKSeconds(int n, int k) {
     return nCk(n + k - 1, n - 1, fact, invFact);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private long[][] getFactAndInvFact(int n) {
     long[] fact = new long[n + 1];
@@ -16,14 +16,14 @@ private long[][] getFactAndInvFact(int n) {
     inv[0] = inv[1] = 1;
     for (int i = 1; i <= n; ++i) {
       if (i >= 2)
-        inv[i] = MOD - MOD / i * inv[MOD % i] % MOD;
-      fact[i] = fact[i - 1] * i % MOD;
-      invFact[i] = invFact[i - 1] * inv[i] % MOD;
+        inv[i] = kMod - kMod / i * inv[kMod % i] % kMod;
+      fact[i] = fact[i - 1] * i % kMod;
+      invFact[i] = invFact[i - 1] * inv[i] % kMod;
     }
     return new long[][] {fact, invFact};
   }
 
   private int nCk(int n, int k, long[] fact, long[] invFact) {
-    return (int) (fact[n] * invFact[k] % MOD * invFact[n - k] % MOD);
+    return (int) (fact[n] * invFact[k] % kMod * invFact[n - k] % kMod);
   }
 }
diff --git a/solutions/318. Maximum Product of Word Lengths/318.py b/solutions/318. Maximum Product of Word Lengths/318.py
index ca0c8e9ca11..ac5a08edb62 100644
--- a/solutions/318. Maximum Product of Word Lengths/318.py	
+++ b/solutions/318. Maximum Product of Word Lengths/318.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxProduct(self, words: list[str]) -> int:
+  def maxProduct(self, words: List[str]) -> int:
     ans = 0
 
     def getMask(word: str) -> int:
diff --git a/solutions/3180. Maximum Total Reward Using Operations I/3180.py b/solutions/3180. Maximum Total Reward Using Operations I/3180.py
index 3b6fa897c89..5a3112662bc 100644
--- a/solutions/3180. Maximum Total Reward Using Operations I/3180.py	
+++ b/solutions/3180. Maximum Total Reward Using Operations I/3180.py	
@@ -25,7 +25,7 @@
 # Therefore, the maximum total reward is 7.
 
 class Solution:
-  def maxTotalReward(self, rewardValues: list[int]) -> int:
+  def maxTotalReward(self, rewardValues: List[int]) -> int:
     dp = 1  # the possible rewards (initially, 0 is achievable)
 
     for num in sorted(rewardValues):
diff --git a/solutions/3181. Maximum Total Reward Using Operations II/3181.py b/solutions/3181. Maximum Total Reward Using Operations II/3181.py
index 5b98bc4be25..12df724a959 100644
--- a/solutions/3181. Maximum Total Reward Using Operations II/3181.py	
+++ b/solutions/3181. Maximum Total Reward Using Operations II/3181.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 3180. Maximum Total Reward Using Operations I
-  def maxTotalReward(self, rewardValues: list[int]) -> int:
+  def maxTotalReward(self, rewardValues: List[int]) -> int:
     dp = 1  # the possible rewards (initially, 0 is achievable)
 
     for num in sorted(rewardValues):
diff --git a/solutions/3183. The Number of Ways to Make the Sum/3183.java b/solutions/3183. The Number of Ways to Make the Sum/3183.java
index 3a168570090..96deea6a8c8 100644
--- a/solutions/3183. The Number of Ways to Make the Sum/3183.java	
+++ b/solutions/3183. The Number of Ways to Make the Sum/3183.java	
@@ -1,19 +1,19 @@
 class Solution {
   public int numberOfWays(int n) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i] := the number of ways to make the sum of i using coins 1, 2, and 6
     int[] dp = new int[n + 1];
     dp[0] = 1;
 
     for (final int coin : new int[] {1, 2, 6})
       for (int i = coin; i <= n; ++i)
-        dp[i] = (dp[i] + dp[i - coin]) % MOD;
+        dp[i] = (dp[i] + dp[i - coin]) % kMod;
 
     int ans = dp[n];
     if (n - 4 >= 0)
-      ans = (ans + dp[n - 4]) % MOD;
+      ans = (ans + dp[n - 4]) % kMod;
     if (n - 8 >= 0)
-      ans = (ans + dp[n - 8]) % MOD;
+      ans = (ans + dp[n - 8]) % kMod;
     return ans;
   }
 }
diff --git a/solutions/3183. The Number of Ways to Make the Sum/3183.py b/solutions/3183. The Number of Ways to Make the Sum/3183.py
index 6c57585e8d6..5cdd9477441 100644
--- a/solutions/3183. The Number of Ways to Make the Sum/3183.py	
+++ b/solutions/3183. The Number of Ways to Make the Sum/3183.py	
@@ -1,16 +1,16 @@
 class Solution:
   def numberOfWays(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # dp[i] := the number of ways to make the sum of i using coins 1, 2, and 6
     dp = [1] + [0] * n
 
     for coin in (1, 2, 6):
       for i in range(coin, n + 1):
-        dp[i] = (dp[i] + dp[i - coin]) % MOD
+        dp[i] = (dp[i] + dp[i - coin]) % kMod
 
     ans = dp[n]
     if n - 4 >= 0:
-      ans = (ans + dp[n - 4]) % MOD
+      ans = (ans + dp[n - 4]) % kMod
     if n - 8 >= 0:
-      ans = (ans + dp[n - 8]) % MOD
+      ans = (ans + dp[n - 8]) % kMod
     return ans
diff --git a/solutions/3184. Count Pairs That Form a Complete Day I/3184.py b/solutions/3184. Count Pairs That Form a Complete Day I/3184.py
index 9c764f925e2..a8e565943e4 100644
--- a/solutions/3184. Count Pairs That Form a Complete Day I/3184.py	
+++ b/solutions/3184. Count Pairs That Form a Complete Day I/3184.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countCompleteDayPairs(self, hours: list[int]) -> int:
+  def countCompleteDayPairs(self, hours: List[int]) -> int:
     ans = 0
     count = [0] * 24
 
diff --git a/solutions/3185. Count Pairs That Form a Complete Day II/3185.py b/solutions/3185. Count Pairs That Form a Complete Day II/3185.py
index cd3cffaf25b..28e4c438977 100644
--- a/solutions/3185. Count Pairs That Form a Complete Day II/3185.py	
+++ b/solutions/3185. Count Pairs That Form a Complete Day II/3185.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Same as 3184. Count Pairs That Form a Complete Day I
-  def countCompleteDayPairs(self, hours: list[int]) -> int:
+  def countCompleteDayPairs(self, hours: List[int]) -> int:
     ans = 0
     count = [0] * 24
 
diff --git a/solutions/3186. Maximum Total Damage With Spell Casting/3186.py b/solutions/3186. Maximum Total Damage With Spell Casting/3186.py
index fa82d920952..08b0acbe3a3 100644
--- a/solutions/3186. Maximum Total Damage With Spell Casting/3186.py	
+++ b/solutions/3186. Maximum Total Damage With Spell Casting/3186.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumTotalDamage(self, power: list[int]) -> int:
+  def maximumTotalDamage(self, power: List[int]) -> int:
     count = collections.Counter(power)
     uniqueDamages = sorted(count.keys())
     # dp[i][k] := the maximum damage using uniqueDamages[0..i], where k
diff --git a/solutions/3187. Peaks in Array/3187-2.cpp b/solutions/3187. Peaks in Array/3187-2.cpp
index e9bb3b1cb9f..b90ce295873 100644
--- a/solutions/3187. Peaks in Array/3187-2.cpp	
+++ b/solutions/3187. Peaks in Array/3187-2.cpp	
@@ -10,7 +10,7 @@ class SegmentTree {
   }
 
   // Returns sum(peak[i..j]).
-  int query(int i, int j) const {
+  int query(int i, int j) {
     return query(0, 0, n - 1, i, j);
   }
 
@@ -42,7 +42,7 @@ class SegmentTree {
     tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
   }
 
-  int query(int treeIndex, int lo, int hi, int i, int j) const {
+  int query(int treeIndex, int lo, int hi, int i, int j) {
     if (i <= lo && hi <= j)  // [lo, hi] lies completely inside [i, j].
       return tree[treeIndex];
     if (j < lo || hi < i)  // [lo, hi] lies completely outside [i, j].
@@ -52,8 +52,9 @@ class SegmentTree {
                  query(treeIndex * 2 + 2, mid + 1, hi, i, j));
   }
 
-  int merge(int left, int right) const {
-    return left + right;
+  // Merges the result of the left node and the right node.
+  int merge(int a, int b) const {
+    return a + b;
   }
 };
 
diff --git a/solutions/3187. Peaks in Array/3187.py b/solutions/3187. Peaks in Array/3187.py
index 2c7ff41834f..1c76521eea4 100644
--- a/solutions/3187. Peaks in Array/3187.py	
+++ b/solutions/3187. Peaks in Array/3187.py	
@@ -20,12 +20,7 @@ def lowbit(i: int) -> int:
 
 
 class Solution:
-  def countOfPeaks(
-      self,
-      nums: list[int],
-      queries:
-      list[list[int]],
-  ) -> list[int]:
+  def countOfPeaks(self, nums: List[int], queries: List[List[int]]) -> List[int]:
     ans = []
     peak = [0] + [int(a < b > c)
                   for a, b, c in zip(nums[:-2], nums[1:-1], nums[2:])] + [0]
@@ -61,5 +56,5 @@ def update(i: int) -> None:
 
     return ans
 
-  def _isPeak(self, nums: list[int], i: int) -> bool:
+  def _isPeak(self, nums: List[int], i: int) -> bool:
     return i > 0 and i + 1 < len(nums) and nums[i - 1] < nums[i] > nums[i + 1]
diff --git a/solutions/3189. Minimum Moves to Get a Peaceful Board/3189.cpp b/solutions/3189. Minimum Moves to Get a Peaceful Board/3189.cpp
index e134b2894c3..560da7ba8ba 100644
--- a/solutions/3189. Minimum Moves to Get a Peaceful Board/3189.cpp	
+++ b/solutions/3189. Minimum Moves to Get a Peaceful Board/3189.cpp	
@@ -6,11 +6,13 @@ class Solution {
     vector<vector<int>> sortedByRow(rooks);
     vector<vector<int>> sortedByCol(rooks);
 
-    ranges::sort(sortedByRow, ranges::less{},
-                 [](const vector<int>& rook) { return rook[0]; });
+    ranges::sort(sortedByRow, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] < b[0];
+    });
 
-    ranges::sort(sortedByCol, ranges::less{},
-                 [](const vector<int>& rook) { return rook[1]; });
+    ranges::sort(sortedByCol, [](const vector<int>& a, const vector<int>& b) {
+      return a[1] < b[1];
+    });
 
     for (int i = 0; i < n; ++i) {
       ans += abs(sortedByRow[i][0] - /*targetRow=*/i);
diff --git a/solutions/3189. Minimum Moves to Get a Peaceful Board/3189.java b/solutions/3189. Minimum Moves to Get a Peaceful Board/3189.java
index b2dd1764464..43691b86b7b 100644
--- a/solutions/3189. Minimum Moves to Get a Peaceful Board/3189.java	
+++ b/solutions/3189. Minimum Moves to Get a Peaceful Board/3189.java	
@@ -5,8 +5,8 @@ public int minMoves(int[][] rooks) {
     int[][] sortedByRow = rooks.clone();
     int[][] sortedByCol = rooks.clone();
 
-    Arrays.sort(sortedByRow, Comparator.comparingInt(a -> a[0]));
-    Arrays.sort(sortedByCol, Comparator.comparingInt(a -> a[1]));
+    Arrays.sort(sortedByRow, (a, b) -> Integer.compare(a[0], b[0]));
+    Arrays.sort(sortedByCol, (a, b) -> Integer.compare(a[1], b[1]));
 
     for (int i = 0; i < n; ++i) {
       ans += Math.abs(sortedByRow[i][0] - /*targetRow=*/i);
diff --git a/solutions/3189. Minimum Moves to Get a Peaceful Board/3189.py b/solutions/3189. Minimum Moves to Get a Peaceful Board/3189.py
index 0ec9dbcf585..67cb76f91fb 100644
--- a/solutions/3189. Minimum Moves to Get a Peaceful Board/3189.py	
+++ b/solutions/3189. Minimum Moves to Get a Peaceful Board/3189.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def minMoves(self, rooks: list[list[int]]) -> int:
+  def minMoves(self, rooks: List[List[int]]) -> int:
     n = len(rooks)
     sortedByRow = sorted(rooks, key=lambda x: x[0])
     sortedByCol = sorted(rooks, key=lambda x: x[1])
-    return (sum(abs(i - row) for (i, _), row in zip(sortedByRow, range(n))) +
-            sum(abs(j - col) for (_, j), col in zip(sortedByCol, range(n))))
+    return sum(abs(i - row) for (i, _), row in zip(sortedByRow, range(n))) \
+        + sum(abs(j - col) for (_, j), col in zip(sortedByCol, range(n)))
diff --git a/solutions/3190. Find Minimum Operations to Make All Elements Divisible by Three/3190.py b/solutions/3190. Find Minimum Operations to Make All Elements Divisible by Three/3190.py
index 078a7cff05b..93eae542551 100644
--- a/solutions/3190. Find Minimum Operations to Make All Elements Divisible by Three/3190.py	
+++ b/solutions/3190. Find Minimum Operations to Make All Elements Divisible by Three/3190.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def minimumOperations(self, nums: list[int]) -> int:
+  def minimumOperations(self, nums: List[int]) -> int:
     return sum(num % 3 != 0 for num in nums)
diff --git a/solutions/3191. Minimum Operations to Make Binary Array Elements Equal to One I/3191.py b/solutions/3191. Minimum Operations to Make Binary Array Elements Equal to One I/3191.py
index fe607074083..fb70c3740a8 100644
--- a/solutions/3191. Minimum Operations to Make Binary Array Elements Equal to One I/3191.py	
+++ b/solutions/3191. Minimum Operations to Make Binary Array Elements Equal to One I/3191.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums: list[int]) -> int:
+  def minOperations(self, nums: List[int]) -> int:
     ans = 0
 
     for i in range(len(nums) - 2):
diff --git a/solutions/3192. Minimum Operations to Make Binary Array Elements Equal to One II/3192.py b/solutions/3192. Minimum Operations to Make Binary Array Elements Equal to One II/3192.py
index 70a9af14c78..38c647afedd 100644
--- a/solutions/3192. Minimum Operations to Make Binary Array Elements Equal to One II/3192.py	
+++ b/solutions/3192. Minimum Operations to Make Binary Array Elements Equal to One II/3192.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minOperations(self, nums: list[int]) -> int:
+  def minOperations(self, nums: List[int]) -> int:
     ans = 0
     target = 1
 
diff --git a/solutions/3193. Count the Number of Inversions/3193.java b/solutions/3193. Count the Number of Inversions/3193.java
index 9cd3c860797..d4728a3d049 100644
--- a/solutions/3193. Count the Number of Inversions/3193.java	
+++ b/solutions/3193. Count the Number of Inversions/3193.java	
@@ -1,10 +1,10 @@
 class Solution {
   public int numberOfPermutations(int n, int[][] requirements) {
-    final int MOD = 1_000_000_007;
-    final int MAX_INVERSIONS = 400;
+    final int kMod = 1_000_000_007;
+    final int kMaxInversions = 400;
     // dp[i][j] := the number of ways to arrange the first i numbers of the
     // permutation such that there are j inversions
-    int[][] dp = new int[n + 1][MAX_INVERSIONS + 1];
+    int[][] dp = new int[n + 1][kMaxInversions + 1];
     int[] endToCnt = new int[n + 1];
     Arrays.fill(endToCnt, -1);
 
@@ -19,12 +19,12 @@ public int numberOfPermutations(int n, int[][] requirements) {
 
     for (int i = 2; i <= n; ++i)
       for (int newInversions = 0; newInversions < i; ++newInversions)
-        for (int j = 0; j + newInversions <= MAX_INVERSIONS; ++j) {
+        for (int j = 0; j + newInversions <= kMaxInversions; ++j) {
           final int inversionsAfterInsertion = j + newInversions;
           if (endToCnt[i] != -1 && inversionsAfterInsertion != endToCnt[i])
             continue;
           dp[i][inversionsAfterInsertion] += dp[i - 1][j];
-          dp[i][inversionsAfterInsertion] %= MOD;
+          dp[i][inversionsAfterInsertion] %= kMod;
         }
 
     return dp[n][endToCnt[n]];
diff --git a/solutions/3193. Count the Number of Inversions/3193.py b/solutions/3193. Count the Number of Inversions/3193.py
index aec63151a63..516dc9ceecf 100644
--- a/solutions/3193. Count the Number of Inversions/3193.py	
+++ b/solutions/3193. Count the Number of Inversions/3193.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def numberOfPermutations(self, n: int, requirements: list[list[int]]) -> int:
-    MOD = 1_000_000_007
-    MAX_INVERSIONS = 400
+  def numberOfPermutations(self, n: int, requirements: List[List[int]]) -> int:
+    kMod = 1_000_000_007
+    kMaxInversions = 400
     # dp[i][j] := the number of ways to arrange the first i numbers of the
     # permutation s.t. there are j inversions
-    dp = [[0] * (MAX_INVERSIONS + 1) for _ in range(n + 1)]
+    dp = [[0] * (kMaxInversions + 1) for _ in range(n + 1)]
     endToCnt = {end + 1: cnt for end, cnt in requirements}
 
     # There's only one way to arrange a single number with zero inversions.
@@ -12,11 +12,11 @@ def numberOfPermutations(self, n: int, requirements: list[list[int]]) -> int:
 
     for i in range(2, n + 1):
       for newInversions in range(i):
-        for j in range(MAX_INVERSIONS - newInversions + 1):
+        for j in range(kMaxInversions - newInversions + 1):
           inversionsAfterInsertion = j + newInversions
           if i in endToCnt and inversionsAfterInsertion != endToCnt[i]:
             continue
           dp[i][inversionsAfterInsertion] += dp[i - 1][j]
-          dp[i][inversionsAfterInsertion] %= MOD
+          dp[i][inversionsAfterInsertion] %= kMod
 
     return dp[n][endToCnt[n]]
diff --git a/solutions/3194. Minimum Average of Smallest and Largest Elements/3194.java b/solutions/3194. Minimum Average of Smallest and Largest Elements/3194.java
index 4a86b8855b1..95aaf064f87 100644
--- a/solutions/3194. Minimum Average of Smallest and Largest Elements/3194.java	
+++ b/solutions/3194. Minimum Average of Smallest and Largest Elements/3194.java	
@@ -1,7 +1,7 @@
 class Solution {
   public double minimumAverage(int[] nums) {
-    final int MAX = 50;
-    double ans = MAX;
+    final int kMax = 50;
+    double ans = kMax;
     int i = 0;
     int j = nums.length - 1;
 
diff --git a/solutions/3194. Minimum Average of Smallest and Largest Elements/3194.py b/solutions/3194. Minimum Average of Smallest and Largest Elements/3194.py
index f97ad9be5d8..f0b16f4ca92 100644
--- a/solutions/3194. Minimum Average of Smallest and Largest Elements/3194.py	
+++ b/solutions/3194. Minimum Average of Smallest and Largest Elements/3194.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumAverage(self, nums: list[int]) -> float:
+  def minimumAverage(self, nums: List[int]) -> float:
     nums.sort()
     return min((nums[i] + nums[~i]) / 2
                for i in range(len(nums) // 2 + 1))
diff --git a/solutions/3195. Find the Minimum Area to Cover All Ones I/3195.py b/solutions/3195. Find the Minimum Area to Cover All Ones I/3195.py
index 41ea75af2be..ced1f814842 100644
--- a/solutions/3195. Find the Minimum Area to Cover All Ones I/3195.py	
+++ b/solutions/3195. Find the Minimum Area to Cover All Ones I/3195.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minimumArea(self, grid: list[list[int]]) -> int:
+  def minimumArea(self, grid: List[List[int]]) -> int:
     x1 = math.inf
     y1 = math.inf
     x2 = 0
diff --git a/solutions/3196. Maximize Total Cost of Alternating Subarrays/3196-2.py b/solutions/3196. Maximize Total Cost of Alternating Subarrays/3196-2.py
index f8f0d859fe3..ee16f98dd4d 100644
--- a/solutions/3196. Maximize Total Cost of Alternating Subarrays/3196-2.py	
+++ b/solutions/3196. Maximize Total Cost of Alternating Subarrays/3196-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumTotalCost(self, nums: list[int]) -> int:
+  def maximumTotalCost(self, nums: List[int]) -> int:
     # A small trick so that we don't need to handle the edge case and can use
     # ranged-based for loop.
     keep = -math.inf  # the maximum cost if the last number is kept
diff --git a/solutions/3196. Maximize Total Cost of Alternating Subarrays/3196.py b/solutions/3196. Maximize Total Cost of Alternating Subarrays/3196.py
index 9f9ddf4db04..84e3fbe91b9 100644
--- a/solutions/3196. Maximize Total Cost of Alternating Subarrays/3196.py	
+++ b/solutions/3196. Maximize Total Cost of Alternating Subarrays/3196.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumTotalCost(self, nums: list[int]) -> int:
+  def maximumTotalCost(self, nums: List[int]) -> int:
     keep = nums[0]  # the maximum cost if the last number is kept
     flip = nums[0]  # the maximum cost if the last number is flipped
 
diff --git a/solutions/3197. Find the Minimum Area to Cover All Ones II/3197.py b/solutions/3197. Find the Minimum Area to Cover All Ones II/3197.py
index ebb0cdcbcf2..834a4ad6219 100644
--- a/solutions/3197. Find the Minimum Area to Cover All Ones II/3197.py	
+++ b/solutions/3197. Find the Minimum Area to Cover All Ones II/3197.py	
@@ -1,6 +1,6 @@
 
 class Solution:
-  def minimumSum(self, grid: list[list[int]]) -> int:
+  def minimumSum(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
     ans = m * n
@@ -47,14 +47,7 @@ def minimumSum(self, grid: list[list[int]]) -> int:
 
     return ans
 
-  def _minimumArea(
-      self,
-      grid: list[list[int]],
-      si: int,
-      ei: int,
-      sj: int,
-      ej: int,
-  ) -> int:
+  def _minimumArea(self, grid: List[List[int]], si: int, ei: int, sj: int, ej: int) -> int:
     x1 = math.inf
     y1 = math.inf
     x2 = 0
diff --git a/solutions/3199. Count Triplets with Even XOR Set Bits I/3199.py b/solutions/3199. Count Triplets with Even XOR Set Bits I/3199.py
index 954d78fd14e..84caf2d1991 100644
--- a/solutions/3199. Count Triplets with Even XOR Set Bits I/3199.py	
+++ b/solutions/3199. Count Triplets with Even XOR Set Bits I/3199.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def tripletCount(self, a: list[int], b: list[int], c: list[int]) -> int:
+  def tripletCount(self, a: List[int], b: List[int], c: List[int]) -> int:
     evenA, oddA = self._getEvenOddBitCount(a)
     evenB, oddB = self._getEvenOddBitCount(b)
     evenC, oddC = self._getEvenOddBitCount(c)
     return evenA * oddB * oddC + oddA * evenB * oddC + oddA * oddB * evenC + evenA * evenB * evenC
 
-  def _getEvenOddBitCount(self, nums: list[int]) -> tuple[int, int]:
+  def _getEvenOddBitCount(self, nums: List[int]) -> Tuple[int, int]:
     """
     Returns the count of numbers in the `nums` arrays that have even number of
     ones and odd number of ones in their binary representation.
diff --git a/solutions/320. Generalized Abbreviation/320.cpp b/solutions/320. Generalized Abbreviation/320.cpp
index f3e0e491111..93d436e0750 100644
--- a/solutions/320. Generalized Abbreviation/320.cpp	
+++ b/solutions/320. Generalized Abbreviation/320.cpp	
@@ -15,11 +15,11 @@ class Solution {
     }
 
     // Abbreviate the word[i].
-    dfs(word, i + 1, count + 1, std::move(path), ans);
+    dfs(word, i + 1, count + 1, move(path), ans);
     // Keep the word[i], so consume the count as a string
     path.push_back(getCountString(count) + word[i]);
     // Reset the count to 0.
-    dfs(word, i + 1, 0, std::move(path), ans);
+    dfs(word, i + 1, 0, move(path), ans);
     path.pop_back();
   }
 
diff --git a/solutions/320. Generalized Abbreviation/320.py b/solutions/320. Generalized Abbreviation/320.py
index daed76582cd..3a1483960a6 100644
--- a/solutions/320. Generalized Abbreviation/320.py	
+++ b/solutions/320. Generalized Abbreviation/320.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def generateAbbreviations(self, word: str) -> list[str]:
+  def generateAbbreviations(self, word: str) -> List[str]:
     ans = []
 
     def getCountString(count: int) -> str:
       return str(count) if count > 0 else ''
 
-    def dfs(i: int, count: int, path: list[str]) -> None:
+    def dfs(i: int, count: int, path: List[str]) -> None:
       if i == len(word):
         ans.append(''.join(path) + getCountString(count))
         return
diff --git a/solutions/3200. Maximum Height of a Triangle/3200.py b/solutions/3200. Maximum Height of a Triangle/3200.py
index dd6a627fd68..cf05d0ecc0b 100644
--- a/solutions/3200. Maximum Height of a Triangle/3200.py	
+++ b/solutions/3200. Maximum Height of a Triangle/3200.py	
@@ -18,5 +18,4 @@ def _maxHeight(self, n1: int, n2: int) -> int:
     evenHeight = math.isqrt(4 * n2 + 1) - 1
     # If the difference between the odd and even heights is >= 1, we can add an
     # extra level to the minimum height.
-    return min(oddHeight, evenHeight) + (1 if abs(oddHeight - evenHeight) >= 1
-                                         else 0)
+    return min(oddHeight, evenHeight) + (1 if abs(oddHeight - evenHeight) >= 1 else 0)
diff --git a/solutions/3201. Find the Maximum Length of Valid Subsequence I/3201.py b/solutions/3201. Find the Maximum Length of Valid Subsequence I/3201.py
index ba806f58efd..3322533f5d9 100644
--- a/solutions/3201. Find the Maximum Length of Valid Subsequence I/3201.py	
+++ b/solutions/3201. Find the Maximum Length of Valid Subsequence I/3201.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumLength(self, nums: list[int]) -> int:
+  def maximumLength(self, nums: List[int]) -> int:
     # dp[i][j] := the maximum length of a valid subsequence, where the last
     # number mod k equal to i and the next desired number mod k equal to j
     dp = [[0] * 2 for _ in range(2)]
diff --git a/solutions/3202. Find the Maximum Length of Valid Subsequence II/3202.py b/solutions/3202. Find the Maximum Length of Valid Subsequence II/3202.py
index 93a78f3296b..971d982c017 100644
--- a/solutions/3202. Find the Maximum Length of Valid Subsequence II/3202.py	
+++ b/solutions/3202. Find the Maximum Length of Valid Subsequence II/3202.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Similar to 3201. Find the Maximum Length of Valid Subsequence I
-  def maximumLength(self, nums: list[int], k: int) -> int:
+  def maximumLength(self, nums: List[int], k: int) -> int:
     # dp[i][j] := the maximum length of a valid subsequence, where the last
     # number mod k equal to i and the next desired number mod k equal to j
     dp = [[0] * k for _ in range(k)]
diff --git a/solutions/3203. Find Minimum Diameter After Merging Two Trees/3203.py b/solutions/3203. Find Minimum Diameter After Merging Two Trees/3203.py
index 2d69557526c..5c7c1c0cefd 100644
--- a/solutions/3203. Find Minimum Diameter After Merging Two Trees/3203.py	
+++ b/solutions/3203. Find Minimum Diameter After Merging Two Trees/3203.py	
@@ -1,15 +1,11 @@
 class Solution:
-  def minimumDiameterAfterMerge(
-      self,
-      edges1: list[list[int]],
-      edges2: list[list[int]],
-  ) -> int:
+  def minimumDiameterAfterMerge(self, edges1: List[List[int]], edges2: List[List[int]]) -> int:
     diameter1 = self._getDiameter(edges1)
     diameter2 = self._getDiameter(edges2)
     combinedDiameter = (diameter1 + 1) // 2 + (diameter2 + 1) // 2 + 1
     return max(diameter1, diameter2, combinedDiameter)
 
-  def _getDiameter(self, edges: list[list[int]]) -> int:
+  def _getDiameter(self, edges: List[List[int]]) -> int:
     n = len(edges) + 1
     graph = [[] for _ in range(n)]
 
@@ -22,13 +18,7 @@ def _getDiameter(self, edges: list[list[int]]) -> int:
     return maxDiameter[0]
 
   # Similar to 1522. Diameter of N-Ary Tree
-  def _maxDepth(
-      self,
-      graph: list[list[int]],
-      u: int,
-      prev: int,
-      maxDiameter: list[int],
-  ) -> int:
+  def _maxDepth(self, graph: List[List[int]], u: int, prev: int, maxDiameter: List[int]) -> int:
     """Returns the maximum depth of the subtree rooted at u."""
     maxSubDepth1 = 0
     maxSubDepth2 = 0
diff --git a/solutions/3205. Maximum Array Hopping Score I/3205-2.cpp b/solutions/3205. Maximum Array Hopping Score I/3205-2.cpp
index 0846ba83574..f8b651ecfab 100644
--- a/solutions/3205. Maximum Array Hopping Score I/3205-2.cpp	
+++ b/solutions/3205. Maximum Array Hopping Score I/3205-2.cpp	
@@ -1,13 +1,13 @@
 class Solution {
  public:
   int maxScore(vector<int>& nums) {
-    // The optimal jump is the maximum number in the remaining suffix.
+    // The optimal next step is the highest number in the remaining suffix.
     int ans = 0;
-    int mx = 0;
+    int suffixMax = 0;
 
     for (int i = nums.size() - 1; i > 0; --i) {
-      mx = max(mx, nums[i]);
-      ans += mx;
+      suffixMax = max(suffixMax, nums[i]);
+      ans += suffixMax;
     }
 
     return ans;
diff --git a/solutions/3205. Maximum Array Hopping Score I/3205-2.java b/solutions/3205. Maximum Array Hopping Score I/3205-2.java
index c5408eeef16..6da2a56e24d 100644
--- a/solutions/3205. Maximum Array Hopping Score I/3205-2.java	
+++ b/solutions/3205. Maximum Array Hopping Score I/3205-2.java	
@@ -1,12 +1,12 @@
 class Solution {
   public int maxScore(int[] nums) {
-    // The optimal jump is the maximum number in the remaining suffix.
+    // The optimal next step is the highest number in the remaining suffix.
     int ans = 0;
-    int mx = 0;
+    int suffixMax = 0;
 
     for (int i = nums.length - 1; i > 0; --i) {
-      mx = Math.max(mx, nums[i]);
-      ans += mx;
+      suffixMax = Math.max(suffixMax, nums[i]);
+      ans += suffixMax;
     }
 
     return ans;
diff --git a/solutions/3205. Maximum Array Hopping Score I/3205-2.py b/solutions/3205. Maximum Array Hopping Score I/3205-2.py
index fe86f6a47e6..50823ac884d 100644
--- a/solutions/3205. Maximum Array Hopping Score I/3205-2.py	
+++ b/solutions/3205. Maximum Array Hopping Score I/3205-2.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def maxScore(self, nums: list[int]) -> int:
-    # The optimal jump is the maximum number in the remaining suffix.
+  def maxScore(self, nums: List[int]) -> int:
+    # The optimal next step is the highest number in the remaining suffix.
     return sum(itertools.accumulate(nums[:0:-1], max))
diff --git a/solutions/3205. Maximum Array Hopping Score I/3205.py b/solutions/3205. Maximum Array Hopping Score I/3205.py
index deb27e4a41e..04508dedb37 100644
--- a/solutions/3205. Maximum Array Hopping Score I/3205.py	
+++ b/solutions/3205. Maximum Array Hopping Score I/3205.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def maxScore(self, nums: list[int]) -> int:
+  def maxScore(self, nums: List[int]) -> int:
     n = len(nums)
     # dp[i] := the maximum score to jump from index i to n - 1
     dp = [0] * n
 
-    for i in range(n - 1, -1, -1):
+    for i in reversed(range(n)):
       for j in range(i + 1, n):
         # Jump from i to j, and then jump from j to n - 1.
         dp[i] = max(dp[i], (j - i) * nums[j] + dp[j])
diff --git a/solutions/3206. Alternating Groups I/3206.py b/solutions/3206. Alternating Groups I/3206.py
index 205a7eaf651..6f5542fa29a 100644
--- a/solutions/3206. Alternating Groups I/3206.py	
+++ b/solutions/3206. Alternating Groups I/3206.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfAlternatingGroups(self, colors: list[int]) -> int:
+  def numberOfAlternatingGroups(self, colors: List[int]) -> int:
     n = len(colors)
     return sum(colors[i] != colors[i - 1] and
                colors[i] != colors[(i + 1) % n]
diff --git a/solutions/3207. Maximum Points After Enemy Battles/3207.py b/solutions/3207. Maximum Points After Enemy Battles/3207.py
index 1e4ec3a5ce3..d8b65f6ae67 100644
--- a/solutions/3207. Maximum Points After Enemy Battles/3207.py	
+++ b/solutions/3207. Maximum Points After Enemy Battles/3207.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumPoints(self, enemyEnergies: list[int], currentEnergy: int) -> int:
+  def maximumPoints(self, enemyEnergies: List[int], currentEnergy: int) -> int:
     minEnergy = min(enemyEnergies)
-    return (0 if currentEnergy < minEnergy
-            else (currentEnergy + sum(enemyEnergies) - minEnergy) // minEnergy)
+    return 0 if currentEnergy < minEnergy \
+        else (currentEnergy + sum(enemyEnergies) - minEnergy) // minEnergy
diff --git a/solutions/3208. Alternating Groups II/3208.py b/solutions/3208. Alternating Groups II/3208.py
index 8c69dfb467d..dedb3313f97 100644
--- a/solutions/3208. Alternating Groups II/3208.py	
+++ b/solutions/3208. Alternating Groups II/3208.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def numberOfAlternatingGroups(self, colors: list[int], k: int) -> int:
+  def numberOfAlternatingGroups(self, colors: List[int], k: int) -> int:
     n = len(colors)
     ans = 0
     alternating = 1
 
     for i in range(n + k - 2):
-      alternating = (1 if colors[i % n] == colors[(i - 1) % n]
-                     else alternating + 1)
+      alternating = 1 if colors[i % n] == colors[(i - 1) % n] \
+          else alternating + 1
       if alternating >= k:
         ans += 1
 
diff --git a/solutions/3209. Number of Subarrays With AND Value of K/3209.cpp b/solutions/3209. Number of Subarrays With AND Value of K/3209.cpp
index c79c12d57db..0abdfae4e9a 100644
--- a/solutions/3209. Number of Subarrays With AND Value of K/3209.cpp	
+++ b/solutions/3209. Number of Subarrays With AND Value of K/3209.cpp	
@@ -15,7 +15,7 @@ class Solution {
       for (const auto& [val, freq] : prev)
         curr[val & num] += freq;
       ans += curr.contains(k) ? curr[k] : 0;
-      prev = std::move(curr);
+      prev = move(curr);
     }
 
     return ans;
diff --git a/solutions/3209. Number of Subarrays With AND Value of K/3209.py b/solutions/3209. Number of Subarrays With AND Value of K/3209.py
index b37ecc52c2d..448c4aedc52 100644
--- a/solutions/3209. Number of Subarrays With AND Value of K/3209.py	
+++ b/solutions/3209. Number of Subarrays With AND Value of K/3209.py	
@@ -1,6 +1,6 @@
 class Solution:
   # Similar to 1521. Find a Value of a Mysterious Function Closest to Target
-  def countSubarrays(self, nums: list[int], k: int) -> int:
+  def countSubarrays(self, nums: List[int], k: int) -> int:
     ans = 0
     # the counter of all the values of subarrays that end in the previous
     # number
diff --git a/solutions/321. Create Maximum Number/321.java b/solutions/321. Create Maximum Number/321.java
index 3cf1d9a7f63..6db5542aed6 100644
--- a/solutions/321. Create Maximum Number/321.java	
+++ b/solutions/321. Create Maximum Number/321.java	
@@ -23,7 +23,7 @@ private int[] maxArray(int[] nums, int k) {
       }
       res.add(num);
     }
-    return res.subList(0, k).stream().mapToInt(Integer::intValue).toArray();
+    return res.subList(0, k).stream().mapToInt(i -> i).toArray();
   }
 
   // Merges nums1 and nums2.
diff --git a/solutions/321. Create Maximum Number/321.py b/solutions/321. Create Maximum Number/321.py
index ab1f326b177..64ef2e74775 100644
--- a/solutions/321. Create Maximum Number/321.py	
+++ b/solutions/321. Create Maximum Number/321.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def maxNumber(self, nums1: list[int], nums2: list[int], k: int) -> list[int]:
-    def maxArray(nums: list[int], k: int) -> list[int]:
+  def maxNumber(self, nums1: List[int], nums2: List[int], k: int) -> List[int]:
+    def maxArray(nums: List[int], k: int) -> List[int]:
       res = []
       toTop = len(nums) - k
       for num in nums:
@@ -10,7 +10,7 @@ def maxArray(nums: list[int], k: int) -> list[int]:
         res.append(num)
       return res[:k]
 
-    def merge(nums1: list[int], nums2: list[int]) -> list[int]:
+    def merge(nums1: List[int], nums2: List[int]) -> List[int]:
       return [max(nums1, nums2).pop(0) for _ in nums1 + nums2]
 
     return max(merge(maxArray(nums1, i), maxArray(nums2, k - i))
diff --git a/solutions/3211. Generate Binary Strings Without Adjacent Zeros/3211.cpp b/solutions/3211. Generate Binary Strings Without Adjacent Zeros/3211.cpp
index 1bd1d5c081c..97dd6de47f3 100644
--- a/solutions/3211. Generate Binary Strings Without Adjacent Zeros/3211.cpp	
+++ b/solutions/3211. Generate Binary Strings Without Adjacent Zeros/3211.cpp	
@@ -14,11 +14,11 @@ class Solution {
     }
     if (s.empty() || s.back() == '1') {
       s.push_back('0');
-      dfs(n - 1, std::move(s), ans);
+      dfs(n - 1, move(s), ans);
       s.pop_back();
     }
     s.push_back('1');
-    dfs(n - 1, std::move(s), ans);
+    dfs(n - 1, move(s), ans);
     s.pop_back();
   }
 };
diff --git a/solutions/3211. Generate Binary Strings Without Adjacent Zeros/3211.py b/solutions/3211. Generate Binary Strings Without Adjacent Zeros/3211.py
index 16c0151bd40..d8ba1fee46a 100644
--- a/solutions/3211. Generate Binary Strings Without Adjacent Zeros/3211.py	
+++ b/solutions/3211. Generate Binary Strings Without Adjacent Zeros/3211.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def validStrings(self, n: int) -> list[str]:
+  def validStrings(self, n: int) -> List[str]:
     ans = []
 
-    def dfs(n: int, s: list[str]) -> None:
+    def dfs(n: int, s: List[str]) -> None:
       if n == 0:
         ans.append(''.join(s))
         return
diff --git a/solutions/3212. Count Submatrices With Equal Frequency of X and Y/3212.py b/solutions/3212. Count Submatrices With Equal Frequency of X and Y/3212.py
index bc4e7179cdd..41c9203187e 100644
--- a/solutions/3212. Count Submatrices With Equal Frequency of X and Y/3212.py	
+++ b/solutions/3212. Count Submatrices With Equal Frequency of X and Y/3212.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfSubmatrices(self, grid: list[list[str]]) -> int:
+  def numberOfSubmatrices(self, grid: List[List[str]]) -> int:
     m = len(grid)
     n = len(grid[0])
     ans = 0
diff --git a/solutions/3213. Construct String with Minimum Cost/3213.cpp b/solutions/3213. Construct String with Minimum Cost/3213.cpp
index ce8fd3c2f77..34082448f63 100644
--- a/solutions/3213. Construct String with Minimum Cost/3213.cpp	
+++ b/solutions/3213. Construct String with Minimum Cost/3213.cpp	
@@ -1,30 +1,60 @@
-class Solution {
+class TrieNode {
  public:
-  int minimumCost(string target, vector<string>& words, vector<int>& costs) {
-    constexpr int kMax = 1'000'000'000;
-    const int n = target.length();
-    // dp[i] := the minimum cost to construct target[0..i)
-    vector<int> dp(n + 1, kMax);
-    dp[0] = 0;
-    // minCost[c][word] := the minimum cost to construct word starting with `c`
-    vector<unordered_map<string, int>> minCost(26);
+  vector<shared_ptr<TrieNode>> children;
+  int cost = INT_MAX;
+  TrieNode() : children(26) {}
+};
 
-    for (int i = 0; i < words.size(); ++i) {
-      const int index = words[i][0] - 'a';
-      const string& word = words[i];
-      minCost[index][word] =
-          min(minCost[index].contains(word) ? minCost[index][word] : kMax,
-              costs[i]);
+class Trie {
+ public:
+  // Inserts a word with a cost.
+  void insert(const string& word, int cost) {
+    shared_ptr<TrieNode> node = root;
+    for (const char c : word) {
+      const int i = c - 'a';
+      if (node->children[i] == nullptr)
+        node->children[i] = make_shared<TrieNode>();
+      node = node->children[i];
     }
+    node->cost = min(node->cost, cost);
+  }
 
-    for (int i = 0; i < n; ++i)
-      for (const auto& [word, cost] : minCost[target[i] - 'a']) {
-        const int j = i + word.length();
-        if (j <= n && cost + dp[i] < dp[j] &&
-            string_view(target.data() + i, word.length()) == word)
-          dp[j] = cost + dp[i];
+  // Returns the minimum cost to construct s[i:].
+  int search(const string& word, int i, vector<int>& mem) {
+    if (i == word.size())
+      return 0;
+    if (mem[i] != INT_MAX)
+      return mem[i];
+    int cost = INT_MAX;
+    shared_ptr<TrieNode> node = root;
+    for (int j = i; j < word.length(); ++j) {
+      const int index = word[j] - 'a';
+      if (node->children[index] == nullptr)
+        break;
+      node = node->children[index];
+      if (node->cost != INT_MAX) {
+        const int childCost = search(word, j + 1, mem);
+        if (childCost != INT_MAX)
+          cost = min(cost, node->cost + childCost);
       }
+    }
+    return mem[i] = cost;
+  }
+
+ private:
+  shared_ptr<TrieNode> root = make_shared<TrieNode>();
+};
+
+class Solution {
+ public:
+  int minimumCost(string target, vector<string>& words, vector<int>& costs) {
+    Trie trie;
+
+    for (int i = 0; i < words.size(); ++i)
+      trie.insert(words[i], costs[i]);
 
-    return dp[n] == kMax ? -1 : dp[n];
+    vector<int> mem(target.size(), INT_MAX);
+    const int ans = trie.search(target, 0, mem);
+    return ans == INT_MAX ? -1 : ans;
   }
 };
diff --git a/solutions/3213. Construct String with Minimum Cost/3213.java b/solutions/3213. Construct String with Minimum Cost/3213.java
index b1ace8b4997..f7fe9e69293 100644
--- a/solutions/3213. Construct String with Minimum Cost/3213.java	
+++ b/solutions/3213. Construct String with Minimum Cost/3213.java	
@@ -1,39 +1,54 @@
-class Solution {
-  public int minimumCost(String target, String[] words, int[] costs) {
-    final int kMax = 1_000_000_000;
-    final int n = target.length();
-    // dp[i] := the minimum cost to construct target[0..i)
-    int[] dp = new int[n + 1];
-    Arrays.fill(dp, kMax);
-    dp[0] = 0;
-    // minCost[c][word] := the minimum cost to construct word starting with `c`
-    Map<String, Integer>[] minCost = new HashMap[26];
-
-    for (int i = 0; i < 26; ++i)
-      minCost[i] = new HashMap<>();
+class TrieNode {
+  public TrieNode[] children = new TrieNode[26];
+  public int cost = Integer.MAX_VALUE;
+}
 
-    for (int i = 0; i < words.length; ++i) {
-      final int index = words[i].charAt(0) - 'a';
-      final String word = words[i];
-      minCost[index].put(word, Math.min(minCost[index].getOrDefault(word, kMax), costs[i]));
+class Trie {
+  // Inserts a word with a cost.
+  public void insert(String word, int cost) {
+    TrieNode node = root;
+    for (final char c : word.toCharArray()) {
+      final int i = c - 'a';
+      if (node.children[i] == null)
+        node.children[i] = new TrieNode();
+      node = node.children[i];
     }
+    node.cost = Math.min(node.cost, cost);
+  }
 
-    for (int i = 0; i < n; ++i)
-      for (Map.Entry<String, Integer> entry : minCost[target.charAt(i) - 'a'].entrySet()) {
-        final String word = entry.getKey();
-        final int cost = entry.getValue();
-        final int j = i + word.length();
-        if (j <= n && cost + dp[i] < dp[j] && isMatch(target, i, word))
-          dp[j] = cost + dp[i];
+  // Returns the minimum cost to construct s[i:].
+  public int search(final String word, int i, Integer[] mem) {
+    if (i == word.length())
+      return 0;
+    if (mem[i] != null)
+      return mem[i];
+    int cost = Integer.MAX_VALUE;
+    TrieNode node = root;
+    for (int j = i; j < word.length(); ++j) {
+      final int index = word.charAt(j) - 'a';
+      if (node.children[index] == null)
+        break;
+      node = node.children[index];
+      if (node.cost != Integer.MAX_VALUE) {
+        final int childCost = search(word, j + 1, mem);
+        if (childCost != Integer.MAX_VALUE)
+          cost = Math.min(cost, node.cost + childCost);
       }
-
-    return dp[n] == kMax ? -1 : dp[n];
+    }
+    return mem[i] = cost;
   }
 
-  private boolean isMatch(final String target, int start, final String word) {
-    for (int i = 0; i < word.length(); ++i)
-      if (target.charAt(start + i) != word.charAt(i))
-        return false;
-    return true;
+  private TrieNode root = new TrieNode();
+}
+
+class Solution {
+  public int minimumCost(String target, String[] words, int[] costs) {
+    Trie trie = new Trie();
+
+    for (int i = 0; i < words.length; ++i)
+      trie.insert(words[i], costs[i]);
+
+    final int ans = trie.search(target, 0, new Integer[target.length()]);
+    return ans == Integer.MAX_VALUE ? -1 : ans;
   }
 }
diff --git a/solutions/3213. Construct String with Minimum Cost/3213.py b/solutions/3213. Construct String with Minimum Cost/3213.py
index 9b78aa61af2..2f43325a17e 100644
--- a/solutions/3213. Construct String with Minimum Cost/3213.py	
+++ b/solutions/3213. Construct String with Minimum Cost/3213.py	
@@ -1,19 +1,44 @@
+class TrieNode:
+  def __init__(self):
+    self.children: Dict[str, TrieNode] = {}
+    self.cost = math.inf
+
+
+class Trie:
+  def __init__(self):
+    self.root = TrieNode()
+
+  def insert(self, word: str, cost: int) -> None:
+    """Inserts a word with a cost."""
+    node: TrieNode = self.root
+    for c in word:
+      node = node.children.setdefault(c, TrieNode())
+    node.cost = min(node.cost, cost)
+
+  @functools.lru_cache(None)
+  def search(self, word: str, i: int) -> int:
+    """Returns the minimum cost to construct s[i:]."""
+    if i == len(word):
+      return 0
+    cost = math.inf
+    node = self.root
+    for i in range(i, len(word)):
+      if word[i] not in node.children:
+        break
+      node = node.children[word[i]]
+      if node.cost != math.inf:
+        childCost = self.search(word, i + 1)
+        if childCost != math.inf:
+          cost = min(cost, node.cost + childCost)
+    return cost
+
+
 class Solution:
-  def minimumCost(self, target: str, words: list[str], costs: list[int]) -> int:
-    n = len(target)
-    # dp[i] := the minimum cost to construct target[0..i)
-    dp = [0] + [math.inf] * n
-    # minCost[c][word] := the minimum cost to construct word starting with `c`
-    minCost: dict[str, dict[str, int]] = collections.defaultdict(dict)
+  def minimumCost(self, target: str, words: List[str], costs: List[int]) -> int:
+    trie = Trie()
 
     for word, cost in zip(words, costs):
-      c = word[0]
-      minCost[c][word] = min(minCost[c].get(word, math.inf), cost)
-
-    for i, c in enumerate(target):
-      for word, cost in minCost[c].items():
-        j = i + len(word)
-        if j <= n and cost + dp[i] < dp[j] and target[i:j] == word:
-          dp[j] = cost + dp[i]
+      trie.insert(word, cost)
 
-    return -1 if dp[n] == math.inf else dp[n]
+    ans = trie.search(target, 0)
+    return -1 if ans == math.inf else ans
diff --git a/solutions/3215. Count Triplets with Even XOR Set Bits II/3215.py b/solutions/3215. Count Triplets with Even XOR Set Bits II/3215.py
index 1a7a7fed70a..235ecc9724c 100644
--- a/solutions/3215. Count Triplets with Even XOR Set Bits II/3215.py	
+++ b/solutions/3215. Count Triplets with Even XOR Set Bits II/3215.py	
@@ -1,12 +1,12 @@
 class Solution:
   # Same as 3199. Count Triplets with Even XOR Set Bits I
-  def tripletCount(self, a: list[int], b: list[int], c: list[int]) -> int:
+  def tripletCount(self, a: List[int], b: List[int], c: List[int]) -> int:
     evenA, oddA = self._getEvenOddBitCount(a)
     evenB, oddB = self._getEvenOddBitCount(b)
     evenC, oddC = self._getEvenOddBitCount(c)
     return evenA * oddB * oddC + oddA * evenB * oddC + oddA * oddB * evenC + evenA * evenB * evenC
 
-  def _getEvenOddBitCount(self, nums: list[int]) -> tuple[int, int]:
+  def _getEvenOddBitCount(self, nums: List[int]) -> Tuple[int, int]:
     """
     Returns the count of numbers in the `nums` arrays that have even number of
     ones and odd number of ones in their binary representation.
diff --git a/solutions/3217. Delete Nodes From Linked List Present in Array/3217.py b/solutions/3217. Delete Nodes From Linked List Present in Array/3217.py
index 6804b03dfa1..70ebc930034 100644
--- a/solutions/3217. Delete Nodes From Linked List Present in Array/3217.py	
+++ b/solutions/3217. Delete Nodes From Linked List Present in Array/3217.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def modifiedList(
-      self,
-      nums: list[int],
-      head: ListNode | None,
-  ) -> ListNode | None:
+  def modifiedList(self, nums: List[int], head: Optional[ListNode]) -> Optional[ListNode]:
     dummy = ListNode(0, head)
     numsSet = set(nums)
 
diff --git a/solutions/3218. Minimum Cost for Cutting Cake I/3218.py b/solutions/3218. Minimum Cost for Cutting Cake I/3218.py
index 17de1c5b3ef..437452cc169 100644
--- a/solutions/3218. Minimum Cost for Cutting Cake I/3218.py	
+++ b/solutions/3218. Minimum Cost for Cutting Cake I/3218.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def minimumCost(
-      self,
-      m: int,
-      n: int,
-      horizontalCut: list[int],
-      verticalCut: list[int],
-  ) -> int:
+  def minimumCost(self, m: int, n: int, horizontalCut: List[int], verticalCut: List[int]) -> int:
     ans = 0
     sumH = sum(horizontalCut)
     sumV = sum(verticalCut)
diff --git a/solutions/3219. Minimum Cost for Cutting Cake II/3219.py b/solutions/3219. Minimum Cost for Cutting Cake II/3219.py
index 0e6ab02a03a..43389d74d7b 100644
--- a/solutions/3219. Minimum Cost for Cutting Cake II/3219.py	
+++ b/solutions/3219. Minimum Cost for Cutting Cake II/3219.py	
@@ -1,12 +1,6 @@
 class Solution:
   # Same as 3218. Minimum Cost for Cutting Cake I
-  def minimumCost(
-      self,
-      m: int,
-      n: int,
-      horizontalCut: list[int],
-      verticalCut: list[int],
-  ) -> int:
+  def minimumCost(self, m: int, n: int, horizontalCut: List[int], verticalCut: List[int]) -> int:
     ans = 0
     sumH = sum(horizontalCut)
     sumV = sum(verticalCut)
diff --git a/solutions/322. Coin Change/322.py b/solutions/322. Coin Change/322.py
index 3c7883342dc..3589e5af15b 100644
--- a/solutions/322. Coin Change/322.py	
+++ b/solutions/322. Coin Change/322.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def coinChange(self, coins: list[int], amount: int) -> int:
+  def coinChange(self, coins: List[int], amount: int) -> int:
     # dp[i] := the minimum number Of coins to make up i
     dp = [0] + [amount + 1] * amount
 
diff --git a/solutions/3221. Maximum Array Hopping Score II/3221.cpp b/solutions/3221. Maximum Array Hopping Score II/3221.cpp
index 2e2425cfba5..ae19b7854a9 100644
--- a/solutions/3221. Maximum Array Hopping Score II/3221.cpp	
+++ b/solutions/3221. Maximum Array Hopping Score II/3221.cpp	
@@ -2,13 +2,13 @@ class Solution {
  public:
   // Same as 3205. Maximum Array Hopping Score I
   long long maxScore(vector<int>& nums) {
-    // The optimal jump is the maximum number in the remaining suffix.
+    // The optimal next step is the highest number in the remaining suffix.
     long ans = 0;
-    int mx = 0;
+    int suffixMax = 0;
 
     for (int i = nums.size() - 1; i > 0; --i) {
-      mx = max(mx, nums[i]);
-      ans += mx;
+      suffixMax = max(suffixMax, nums[i]);
+      ans += suffixMax;
     }
 
     return ans;
diff --git a/solutions/3221. Maximum Array Hopping Score II/3221.java b/solutions/3221. Maximum Array Hopping Score II/3221.java
index f28f8b72934..33b101cdf1b 100644
--- a/solutions/3221. Maximum Array Hopping Score II/3221.java	
+++ b/solutions/3221. Maximum Array Hopping Score II/3221.java	
@@ -1,13 +1,13 @@
 class Solution {
   // Same as 3205. Maximum Array Hopping Score I
   public long maxScore(int[] nums) {
-    // The optimal jump is the maximum number in the remaining suffix.
+    // The optimal next step is the highest number in the remaining suffix.
     long ans = 0;
-    int mx = 0;
+    int suffixMax = 0;
 
     for (int i = nums.length - 1; i > 0; --i) {
-      mx = Math.max(mx, nums[i]);
-      ans += mx;
+      suffixMax = Math.max(suffixMax, nums[i]);
+      ans += suffixMax;
     }
 
     return ans;
diff --git a/solutions/3221. Maximum Array Hopping Score II/3221.py b/solutions/3221. Maximum Array Hopping Score II/3221.py
index c314a19f60c..7fb5fb61914 100644
--- a/solutions/3221. Maximum Array Hopping Score II/3221.py	
+++ b/solutions/3221. Maximum Array Hopping Score II/3221.py	
@@ -1,5 +1,5 @@
 class Solution:
   # Same as 3205. Maximum Array Hopping Score I
-  def maxScore(self, nums: list[int]) -> int:
-    # The optimal jump is the maximum number in the remaining suffix.
+  def maxScore(self, nums: List[int]) -> int:
+    # The optimal next step is the highest number in the remaining suffix.
     return sum(itertools.accumulate(nums[:0:-1], max))
diff --git a/solutions/3224. Minimum Array Changes to Make Differences Equal/3224.cpp b/solutions/3224. Minimum Array Changes to Make Differences Equal/3224.cpp
index 63bac3968ef..7c39de4e5f8 100644
--- a/solutions/3224. Minimum Array Changes to Make Differences Equal/3224.cpp	
+++ b/solutions/3224. Minimum Array Changes to Make Differences Equal/3224.cpp	
@@ -4,14 +4,14 @@ class Solution {
     const int n = nums.size();
     const int pairSize = n / 2;
     int ans = n;
-    unordered_map<int, int> diffCount;  // {abs(nums[-1 - i] - nums[i]): freq}
+    unordered_map<int, int> diffCount;  // {abs(nums[-i - 1] - nums[i]): freq}
     // oneChangeCount[i] := the number of pairs that need only one change to to
     // achieve a difference of `i`
     vector<int> oneChangeCount(k + 1);
 
     for (int i = 0; i < pairSize; ++i) {
       const int a = nums[i];
-      const int b = nums[n - 1 - i];
+      const int b = nums[n - i - 1];
       ++diffCount[abs(a - b)];
       ++oneChangeCount[max({a, b, k - a, k - b})];
     }
diff --git a/solutions/3224. Minimum Array Changes to Make Differences Equal/3224.java b/solutions/3224. Minimum Array Changes to Make Differences Equal/3224.java
index 1d965ff38a7..8332b61e706 100644
--- a/solutions/3224. Minimum Array Changes to Make Differences Equal/3224.java	
+++ b/solutions/3224. Minimum Array Changes to Make Differences Equal/3224.java	
@@ -3,14 +3,14 @@ public int minChanges(int[] nums, int k) {
     final int n = nums.length;
     final int pairSize = n / 2;
     int ans = n;
-    Map<Integer, Integer> diffCount = new HashMap<>(); // {abs(nums[-1 - i] - nums[i]): freq}
+    Map<Integer, Integer> diffCount = new HashMap<>(); // {abs(nums[-i - 1] - nums[i]): freq}
     // oneChangeCount[i] := the number of pairs that need only one change to
     // achieve a difference of `i`
     int[] oneChangeCount = new int[k + 1];
 
     for (int i = 0; i < pairSize; ++i) {
       final int a = nums[i];
-      final int b = nums[n - 1 - i];
+      final int b = nums[n - i - 1];
       diffCount.merge(Math.abs(a - b), 1, Integer::sum);
       ++oneChangeCount[Math.max(Math.max(a, b), Math.max(k - a, k - b))];
     }
diff --git a/solutions/3224. Minimum Array Changes to Make Differences Equal/3224.py b/solutions/3224. Minimum Array Changes to Make Differences Equal/3224.py
index 57f095ee6bf..71c437466e1 100644
--- a/solutions/3224. Minimum Array Changes to Make Differences Equal/3224.py	
+++ b/solutions/3224. Minimum Array Changes to Make Differences Equal/3224.py	
@@ -1,14 +1,14 @@
 class Solution:
-  def minChanges(self, nums: list[int], k: int) -> int:
+  def minChanges(self, nums: List[int], k: int) -> int:
     pairSize = len(nums) // 2
-    diffCount = collections.Counter()  # {nums[-1 - i] - nums[i]: freq}
+    diffCount = collections.Counter()  # {nums[-i - 1] - nums[i]: freq}
     # oneChangeCount[i] := the number of pairs that need only one change to
     # to achieve a difference of `i`
     oneChangeCount = [0] * (k + 1)
 
     for i in range(pairSize):
       a = nums[i]
-      b = nums[-1 - i]
+      b = nums[-i - 1]
       diffCount[abs(a - b)] += 1
       oneChangeCount[max(a, b, k - a, k - b)] += 1
 
diff --git a/solutions/3225. Maximum Score From Grid Operations/3225.cpp b/solutions/3225. Maximum Score From Grid Operations/3225.cpp
index 129b26556ab..b797f6270bc 100644
--- a/solutions/3225. Maximum Score From Grid Operations/3225.cpp	
+++ b/solutions/3225. Maximum Score From Grid Operations/3225.cpp	
@@ -36,8 +36,8 @@ class Solution {
             currPick[curr] = max(currPick[curr], prevPick[prev] + score);
             currSkip[curr] = max(currSkip[curr], prevPick[prev]);
           }
-      prevPick = std::move(currPick);
-      prevSkip = std::move(currSkip);
+      prevPick = move(currPick);
+      prevSkip = move(currSkip);
     }
 
     return ranges::max(prevPick);
diff --git a/solutions/3225. Maximum Score From Grid Operations/3225.py b/solutions/3225. Maximum Score From Grid Operations/3225.py
index 5f0f8c8f6b9..2fe2e98d77b 100644
--- a/solutions/3225. Maximum Score From Grid Operations/3225.py	
+++ b/solutions/3225. Maximum Score From Grid Operations/3225.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumScore(self, grid: list[list[int]]) -> int:
+  def maximumScore(self, grid: List[List[int]]) -> int:
     n = len(grid)
     # prefix[j][i] := the sum of the first i elements in the j-th column
     prefix = [[0] * (n + 1) for _ in range(n)]
diff --git a/solutions/3227. Vowels Game in a String/3227.cpp b/solutions/3227. Vowels Game in a String/3227.cpp
index 1378657f804..f6d00f019c8 100644
--- a/solutions/3227. Vowels Game in a String/3227.cpp	
+++ b/solutions/3227. Vowels Game in a String/3227.cpp	
@@ -8,7 +8,7 @@ class Solution {
     // then Bob will either pick a substring containing 0 vowels, resulting in
     // Alice picking the remaining entire string, or Bob couldn't pick at all
     // (the last vowel).
-    return ranges::any_of(s, [this](char c) { return isVowel(c); });
+    return ranges::any_of(s, [=](char c) { return isVowel(c); });
   }
 
  private:
diff --git a/solutions/3227. Vowels Game in a String/3227.py b/solutions/3227. Vowels Game in a String/3227.py
index 4e9eb339cad..76916be4eb7 100644
--- a/solutions/3227. Vowels Game in a String/3227.py	
+++ b/solutions/3227. Vowels Game in a String/3227.py	
@@ -7,5 +7,5 @@ def doesAliceWin(self, s: str) -> bool:
     # then Bob will either pick a substring containing 0 vowels, resulting in
     # Alice picking the remaining entire string, or Bob couldn't pick at all
     # (the last vowel).
-    VOWELS = 'aeiou'
-    return any(c in VOWELS for c in s)
+    kVowels = 'aeiou'
+    return any(c in kVowels for c in s)
diff --git a/solutions/3229. Minimum Operations to Make Array Equal to Target/3229.py b/solutions/3229. Minimum Operations to Make Array Equal to Target/3229.py
index 6adbfdf4687..42624a2c638 100644
--- a/solutions/3229. Minimum Operations to Make Array Equal to Target/3229.py	
+++ b/solutions/3229. Minimum Operations to Make Array Equal to Target/3229.py	
@@ -1,11 +1,10 @@
 class Solution:
   # Similar to 1526. Minimum Number of Increments on Subarrays to Form a Target Array
-  def minimumOperations(self, nums: list[int], target: list[int]) -> int:
+  def minimumOperations(self, nums: List[int], target: List[int]) -> int:
     ans = abs(nums[0] - target[0])
 
-    for (prevNum, prevTarget), (currNum, currTarget) in (
-        itertools.pairwise(zip(nums, target))
-    ):
+    for (prevNum, prevTarget), (currNum, currTarget) in \
+            itertools.pairwise(zip(nums, target)):
       currDiff = currTarget - currNum
       prevDiff = prevTarget - prevNum
       if currDiff >= 0 and prevDiff >= 0:
diff --git a/solutions/323. Number of Connected Components in an Undirected Graph/323-2.java b/solutions/323. Number of Connected Components in an Undirected Graph/323-2.java
index 18a7b86888b..8f512afaac3 100644
--- a/solutions/323. Number of Connected Components in an Undirected Graph/323-2.java	
+++ b/solutions/323. Number of Connected Components in an Undirected Graph/323-2.java	
@@ -3,7 +3,9 @@ public int countComponents(int n, int[][] edges) {
     int ans = 0;
     List<Integer>[] graph = new List[n];
     Set<Integer> seen = new HashSet<>();
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
diff --git a/solutions/323. Number of Connected Components in an Undirected Graph/323-2.py b/solutions/323. Number of Connected Components in an Undirected Graph/323-2.py
index fff80c56718..7b19ca479f3 100644
--- a/solutions/323. Number of Connected Components in an Undirected Graph/323-2.py	
+++ b/solutions/323. Number of Connected Components in an Undirected Graph/323-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countComponents(self, n: int, edges: list[list[int]]) -> int:
+  def countComponents(self, n: int, edges: List[List[int]]) -> int:
     ans = 0
     graph = [[] for _ in range(n)]
     seen = set()
@@ -8,7 +8,7 @@ def countComponents(self, n: int, edges: list[list[int]]) -> int:
       graph[u].append(v)
       graph[v].append(u)
 
-    def dfs(u: int, seen: set[int]) -> None:
+    def dfs(u: int, seen: Set[int]) -> None:
       for v in graph[u]:
         if v not in seen:
           seen.add(v)
diff --git a/solutions/323. Number of Connected Components in an Undirected Graph/323-3.py b/solutions/323. Number of Connected Components in an Undirected Graph/323-3.py
index 5adb91c8f63..a62fcd370ca 100644
--- a/solutions/323. Number of Connected Components in an Undirected Graph/323-3.py	
+++ b/solutions/323. Number of Connected Components in an Undirected Graph/323-3.py	
@@ -25,7 +25,7 @@ def _find(self, u: int) -> int:
 
 
 class Solution:
-  def countComponents(self, n: int, edges: list[list[int]]) -> int:
+  def countComponents(self, n: int, edges: List[List[int]]) -> int:
     uf = UnionFind(n)
 
     for u, v in edges:
diff --git a/solutions/323. Number of Connected Components in an Undirected Graph/323.java b/solutions/323. Number of Connected Components in an Undirected Graph/323.java
index 5ee2b7a3d5a..4d1928c44b1 100644
--- a/solutions/323. Number of Connected Components in an Undirected Graph/323.java	
+++ b/solutions/323. Number of Connected Components in an Undirected Graph/323.java	
@@ -3,7 +3,9 @@ public int countComponents(int n, int[][] edges) {
     int ans = 0;
     List<Integer>[] graph = new List[n];
     Set<Integer> seen = new HashSet<>();
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
@@ -22,7 +24,7 @@ public int countComponents(int n, int[][] edges) {
   }
 
   private void bfs(List<Integer>[] graph, int node, Set<Integer> seen) {
-    Queue<Integer> q = new ArrayDeque<>(List.of(node));
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(node));
     seen.add(node);
 
     while (!q.isEmpty()) {
diff --git a/solutions/323. Number of Connected Components in an Undirected Graph/323.py b/solutions/323. Number of Connected Components in an Undirected Graph/323.py
index 19c907aad97..34bd6895bca 100644
--- a/solutions/323. Number of Connected Components in an Undirected Graph/323.py	
+++ b/solutions/323. Number of Connected Components in an Undirected Graph/323.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countComponents(self, n: int, edges: list[list[int]]) -> int:
+  def countComponents(self, n: int, edges: List[List[int]]) -> int:
     ans = 0
     graph = [[] for _ in range(n)]
     seen = set()
@@ -8,7 +8,7 @@ def countComponents(self, n: int, edges: list[list[int]]) -> int:
       graph[u].append(v)
       graph[v].append(u)
 
-    def bfs(node: int, seen: set[int]) -> None:
+    def bfs(node: int, seen: Set[int]) -> None:
       q = collections.deque([node])
       seen.add(node)
 
diff --git a/solutions/3231. Minimum Number of Increasing Subsequence to Be Removed/3231.cpp b/solutions/3231. Minimum Number of Increasing Subsequence to Be Removed/3231.cpp
index 8a96d2c73a6..06bc63f92f4 100644
--- a/solutions/3231. Minimum Number of Increasing Subsequence to Be Removed/3231.cpp	
+++ b/solutions/3231. Minimum Number of Increasing Subsequence to Be Removed/3231.cpp	
@@ -27,7 +27,7 @@ class Solution {
   }
 
  private:
-  int firstGreater(const vector<int>& arr, int target) {
-    return ranges::upper_bound(arr, target) - arr.begin();
+  int firstGreater(const vector<int>& A, int target) {
+    return ranges::upper_bound(A, target) - A.begin();
   }
 };
diff --git a/solutions/3231. Minimum Number of Increasing Subsequence to Be Removed/3231.java b/solutions/3231. Minimum Number of Increasing Subsequence to Be Removed/3231.java
index 60c99502d56..6d90860cf95 100644
--- a/solutions/3231. Minimum Number of Increasing Subsequence to Be Removed/3231.java	
+++ b/solutions/3231. Minimum Number of Increasing Subsequence to Be Removed/3231.java	
@@ -27,12 +27,12 @@ private int lengthOfLIS(int[] nums) {
     return tails.size();
   }
 
-  private int firstGreater(List<Integer> arr, int target) {
+  private int firstGreater(List<Integer> A, int target) {
     int l = 0;
-    int r = arr.size();
+    int r = A.size();
     while (l < r) {
       final int m = (l + r) / 2;
-      if (arr.get(m) > target)
+      if (A.get(m) > target)
         r = m;
       else
         l = m + 1;
diff --git a/solutions/3231. Minimum Number of Increasing Subsequence to Be Removed/3231.py b/solutions/3231. Minimum Number of Increasing Subsequence to Be Removed/3231.py
index 1a3b56c25fe..c1f4981e1ac 100644
--- a/solutions/3231. Minimum Number of Increasing Subsequence to Be Removed/3231.py	
+++ b/solutions/3231. Minimum Number of Increasing Subsequence to Be Removed/3231.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def minOperations(self, nums: list[int]) -> int:
+  def minOperations(self, nums: List[int]) -> int:
     return self._lengthOfLIS(nums[::-1])
 
-  def _lengthOfLIS(self, nums: list[int]) -> int:
+  def _lengthOfLIS(self, nums: List[int]) -> int:
     # tails[i] := the minimum tail of all the increasing subsequences having
     # length i + 1
     tails = []
diff --git a/solutions/3232. Find if Digit Game Can Be Won/3232.cpp b/solutions/3232. Find if Digit Game Can Be Won/3232.cpp
index 9f79dfe3cfc..2fa071a8a45 100644
--- a/solutions/3232. Find if Digit Game Can Be Won/3232.cpp	
+++ b/solutions/3232. Find if Digit Game Can Be Won/3232.cpp	
@@ -1,8 +1,8 @@
 class Solution {
  public:
   bool canAliceWin(vector<int>& nums) {
-    return accumulate(nums.begin(), nums.end(), 0, [](int acc, int num) {
-      return acc + (num < 10 ? num : -num);
+    return accumulate(nums.begin(), nums.end(), 0, [](int subtotal, int num) {
+      return subtotal + (num < 10 ? num : -num);
     }) != 0;
   }
 };
diff --git a/solutions/3232. Find if Digit Game Can Be Won/3232.py b/solutions/3232. Find if Digit Game Can Be Won/3232.py
index cb5075d43c6..64fabd6c465 100644
--- a/solutions/3232. Find if Digit Game Can Be Won/3232.py	
+++ b/solutions/3232. Find if Digit Game Can Be Won/3232.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def canAliceWin(self, nums: list[int]) -> bool:
+  def canAliceWin(self, nums: List[int]) -> bool:
     return sum(num if num < 10 else -num for num in nums) != 0
diff --git a/solutions/3233. Find the Count of Numbers Which Are Not Special/3233.py b/solutions/3233. Find the Count of Numbers Which Are Not Special/3233.py
index 649c5ff3a10..8ec4189da69 100644
--- a/solutions/3233. Find the Count of Numbers Which Are Not Special/3233.py	
+++ b/solutions/3233. Find the Count of Numbers Which Are Not Special/3233.py	
@@ -10,7 +10,7 @@ def nonSpecialCount(self, l: int, r: int) -> int:
 
     return r - l + 1 - specialCount
 
-  def _sieveEratosthenes(self, n: int) -> list[bool]:
+  def _sieveEratosthenes(self, n: int) -> List[bool]:
     isPrime = [True] * n
     isPrime[0] = False
     isPrime[1] = False
diff --git a/solutions/3234. Count the Number of Substrings With Dominant Ones/3234.cpp b/solutions/3234. Count the Number of Substrings With Dominant Ones/3234.cpp
index d90253b83ac..11c2b017219 100644
--- a/solutions/3234. Count the Number of Substrings With Dominant Ones/3234.cpp	
+++ b/solutions/3234. Count the Number of Substrings With Dominant Ones/3234.cpp	
@@ -21,7 +21,7 @@ class Solution {
             break;  // Cannot remove more characters.
           }
         if (count[0] == zero && count[1] >= zero * zero)
-          // Add valid substrings ending in s[r] to the answer. They are
+          // Add the valid substrings ending in s[r] to the answer. They are
           // s[lastInvalidPos + 1..r], s[lastInvalidPos + 2..r], ..., s[l..r].
           ans += l - lastInvalidPos;
       }
diff --git a/solutions/3234. Count the Number of Substrings With Dominant Ones/3234.java b/solutions/3234. Count the Number of Substrings With Dominant Ones/3234.java
index 959ffffccff..693f75da1a5 100644
--- a/solutions/3234. Count the Number of Substrings With Dominant Ones/3234.java	
+++ b/solutions/3234. Count the Number of Substrings With Dominant Ones/3234.java	
@@ -20,7 +20,7 @@ public int numberOfSubstrings(String s) {
             break; // Cannot remove more characters.
           }
         if (count[0] == zero && count[1] >= zero * zero)
-          // Add valid substrings ending in s[r] to the answer. They are
+          // Add the valid substrings ending in s[r] to the answer. They are
           // s[lastInvalidPos + 1..r], s[lastInvalidPos + 2..r], ..., s[l..r].
           ans += l - lastInvalidPos;
       }
diff --git a/solutions/3234. Count the Number of Substrings With Dominant Ones/3234.py b/solutions/3234. Count the Number of Substrings With Dominant Ones/3234.py
index a92bdfa726f..60f4452be6a 100644
--- a/solutions/3234. Count the Number of Substrings With Dominant Ones/3234.py	
+++ b/solutions/3234. Count the Number of Substrings With Dominant Ones/3234.py	
@@ -12,7 +12,7 @@ def numberOfSubstrings(self, s: str) -> int:
       count = [0, 0]
       l = 0
       for r, c in enumerate(s):
-        count[int(c)] += 1
+        count[ord(c) - ord('0')] += 1
         # Try to shrink the window to maintain the "minimum" length of the
         # valid substring.
         while l < r:
@@ -26,7 +26,7 @@ def numberOfSubstrings(self, s: str) -> int:
           else:
             break  # Cannot remove more characters.
         if count[0] == zero and count[1] >= zero * zero:
-          # Add valid substrings ending in s[r] to the answer. They are
+          # Add the valid substrings ending in s[r] to the answer. They are
           # s[lastInvalidPos + 1..r], s[lastInvalidPos + 2..r], ..., s[l..r].
           ans += l - lastInvalidPos
 
diff --git a/solutions/3235. Check if the Rectangle Corner Is Reachable/3235.py b/solutions/3235. Check if the Rectangle Corner Is Reachable/3235.py
index 8a560e484c4..5748845bcb7 100644
--- a/solutions/3235. Check if the Rectangle Corner Is Reachable/3235.py	
+++ b/solutions/3235. Check if the Rectangle Corner Is Reachable/3235.py	
@@ -23,7 +23,7 @@ def find(self, u: int) -> int:
 
 
 class Solution:
-  def canReachCorner(self, X: int, Y: int, circles: list[list[int]]) -> bool:
+  def canReachCorner(self, X: int, Y: int, circles: List[List[int]]) -> bool:
     n = len(circles)
     # Add two virtual nodes, where node n represents (0, 0) and node n + 1
     # represents (X, Y).
diff --git a/solutions/3236. CEO Subordinate Hierarchy/3236.sql b/solutions/3236. CEO Subordinate Hierarchy/3236.sql
index 431da56e3ee..ade7b4e8e99 100644
--- a/solutions/3236. CEO Subordinate Hierarchy/3236.sql	
+++ b/solutions/3236. CEO Subordinate Hierarchy/3236.sql	
@@ -1,5 +1,5 @@
-WITH RECURSIVE
-  EmployeeHierarchy AS (
+WITH
+  RECURSIVE EmployeeHierarchy AS (
     -- Base case: direct reports to CEO
     SELECT
       employee_id,
diff --git a/solutions/3237. Alt and Tab Simulation/3237.py b/solutions/3237. Alt and Tab Simulation/3237.py
index 81f6f875261..5bd0d16a11e 100644
--- a/solutions/3237. Alt and Tab Simulation/3237.py	
+++ b/solutions/3237. Alt and Tab Simulation/3237.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def simulationResult(
-      self,
-      windows: list[int],
-      queries: list[int],
-  ) -> list[int]:
+  def simulationResult(self, windows: List[int], queries: List[int]) -> List[int]:
     ans = []
     seen = set()
 
diff --git a/solutions/3238. Find the Number of Winning Players/3238.cpp b/solutions/3238. Find the Number of Winning Players/3238.cpp
deleted file mode 100644
index 974dc6cc33f..00000000000
--- a/solutions/3238. Find the Number of Winning Players/3238.cpp	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
- public:
-  int winningPlayerCount(int n, vector<vector<int>>& pick) {
-    constexpr int kMaxColor = 10;
-    int ans = 0;
-    vector<vector<int>> counts(n, vector<int>(kMaxColor + 1));
-
-    for (const vector<int>& p : pick) {
-      const int player = p[0];
-      const int color = p[1];
-      ++counts[player][color];
-    }
-
-    for (int i = 0; i < n; ++i) {
-      int maxCount = 0;
-      for (const int freq : counts[i])
-        maxCount = max(maxCount, freq);
-      if (maxCount > i)
-        ++ans;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3238. Find the Number of Winning Players/3238.java b/solutions/3238. Find the Number of Winning Players/3238.java
deleted file mode 100644
index 5c7bd67bc84..00000000000
--- a/solutions/3238. Find the Number of Winning Players/3238.java	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
-  public int winningPlayerCount(int n, int[][] pick) {
-    final int MAX_COLOR = 10;
-    int ans = 0;
-    int[][] counts = new int[n][MAX_COLOR + 1];
-
-    for (int[] p : pick) {
-      final int player = p[0];
-      final int color = p[1];
-      ++counts[player][color];
-    }
-
-    for (int i = 0; i < n; ++i) {
-      int maxCount = 0;
-      for (final int freq : counts[i])
-        maxCount = Math.max(maxCount, freq);
-      if (maxCount > i)
-        ++ans;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3238. Find the Number of Winning Players/3238.py b/solutions/3238. Find the Number of Winning Players/3238.py
deleted file mode 100644
index 2efad1fa170..00000000000
--- a/solutions/3238. Find the Number of Winning Players/3238.py	
+++ /dev/null
@@ -1,7 +0,0 @@
-class Solution:
-  def winningPlayerCount(self, n: int, pick: list[list[int]]) -> int:
-    counts = [collections.Counter() for _ in range(n)]
-    for player, color in pick:
-      counts[player][color] += 1
-    return sum(max(count.values(), default=0) > i
-               for i, count in enumerate(counts))
diff --git a/solutions/3239. Minimum Number of Flips to Make Binary Grid Palindromic I/3239.cpp b/solutions/3239. Minimum Number of Flips to Make Binary Grid Palindromic I/3239.cpp
deleted file mode 100644
index 0efc0cb1dbb..00000000000
--- a/solutions/3239. Minimum Number of Flips to Make Binary Grid Palindromic I/3239.cpp	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
- public:
-  int minFlips(vector<vector<int>>& grid) {
-    const int m = grid.size();
-    const int n = grid[0].size();
-    int rowFlips = 0;
-    int colFlips = 0;
-
-    for (const vector<int>& row : grid)
-      for (int i = 0; i < n / 2; ++i)
-        if (row[i] != row[n - 1 - i])
-          ++rowFlips;
-
-    for (int j = 0; j < n; ++j)
-      for (int i = 0; i < m / 2; ++i)
-        if (grid[i][j] != grid[m - 1 - i][j])
-          ++colFlips;
-
-    return min(rowFlips, colFlips);
-  }
-};
diff --git a/solutions/3239. Minimum Number of Flips to Make Binary Grid Palindromic I/3239.java b/solutions/3239. Minimum Number of Flips to Make Binary Grid Palindromic I/3239.java
deleted file mode 100644
index 44e628e29e5..00000000000
--- a/solutions/3239. Minimum Number of Flips to Make Binary Grid Palindromic I/3239.java	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
-  public int minFlips(int[][] grid) {
-    final int m = grid.length;
-    final int n = grid[0].length;
-    int rowFlips = 0;
-    int colFlips = 0;
-
-    for (int[] row : grid)
-      for (int i = 0; i < n / 2; ++i)
-        if (row[i] != row[n - 1 - i])
-          ++rowFlips;
-
-    for (int j = 0; j < n; ++j)
-      for (int i = 0; i < m / 2; ++i)
-        if (grid[i][j] != grid[m - 1 - i][j])
-          ++colFlips;
-
-    return Math.min(rowFlips, colFlips);
-  }
-}
diff --git a/solutions/3239. Minimum Number of Flips to Make Binary Grid Palindromic I/3239.py b/solutions/3239. Minimum Number of Flips to Make Binary Grid Palindromic I/3239.py
deleted file mode 100644
index 11369a99651..00000000000
--- a/solutions/3239. Minimum Number of Flips to Make Binary Grid Palindromic I/3239.py	
+++ /dev/null
@@ -1,7 +0,0 @@
-class Solution:
-  def minFlips(self, grid: list[list[int]]) -> int:
-    rowFlips = sum(row[i] != row[-1 - i]
-                   for row in grid for i in range(len(row) // 2))
-    colFlips = sum(col[i] != col[-1 - i] for col in zip(*grid)
-                   for i in range(len(col) // 2))
-    return min(rowFlips, colFlips)
diff --git a/solutions/324. Wiggle Sort II/324.py b/solutions/324. Wiggle Sort II/324.py
index d25eea42ab3..b39588340aa 100644
--- a/solutions/324. Wiggle Sort II/324.py	
+++ b/solutions/324. Wiggle Sort II/324.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def wiggleSort(self, nums: list[int]) -> None:
+  def wiggleSort(self, nums: List[int]) -> None:
     n = len(nums)
     median = self._findKthLargest(nums, (n + 1) // 2)
 
@@ -21,7 +21,7 @@ def A(i: int):
         i += 1
 
   # Same as 215. Kth Largest Element in an Array
-  def _findKthLargest(self, nums: list[int], k: int) -> int:
+  def _findKthLargest(self, nums: List[int], k: int) -> int:
     def quickSelect(l: int, r: int, k: int) -> int:
       randIndex = random.randint(0, r - l) + l
       nums[randIndex], nums[r] = nums[r], nums[randIndex]
diff --git a/solutions/3240. Minimum Number of Flips to Make Binary Grid Palindromic II/3240.cpp b/solutions/3240. Minimum Number of Flips to Make Binary Grid Palindromic II/3240.cpp
deleted file mode 100644
index 674df685b94..00000000000
--- a/solutions/3240. Minimum Number of Flips to Make Binary Grid Palindromic II/3240.cpp	
+++ /dev/null
@@ -1,51 +0,0 @@
-class Solution {
- public:
-  int minFlips(vector<vector<int>>& grid) {
-    const int m = grid.size();
-    const int n = grid[0].size();
-    int ans = 0;
-    int middleOnes = 0;
-    int mismatchedPairs = 0;
-
-    // Handle top-left, top-right, bottom-left, bottom-right cells.
-    for (int i = 0; i < m / 2; ++i)
-      for (int j = 0; j < n / 2; ++j) {
-        const int ones = grid[i][j] + grid[i][n - 1 - j] + grid[m - 1 - i][j] +
-                         grid[m - 1 - i][n - 1 - j];
-        ans += min(ones, 4 - ones);
-      }
-
-    // Handle the middle row if the number of m is odd.
-    if (m % 2 == 1)
-      for (int j = 0; j < n / 2; ++j) {
-        const int leftCell = grid[m / 2][j];
-        const int rightCell = grid[m / 2][n - 1 - j];
-        mismatchedPairs += leftCell ^ rightCell;
-        middleOnes += leftCell + rightCell;
-      }
-
-    // Handle the middle column if the number of columns is odd.
-    if (n % 2 == 1)
-      for (int i = 0; i < m / 2; ++i) {
-        const int topCell = grid[i][n / 2];
-        const int bottomCell = grid[m - 1 - i][n / 2];
-        mismatchedPairs += topCell ^ bottomCell;
-        middleOnes += topCell + bottomCell;
-      }
-
-    if (mismatchedPairs == 0) {
-      // Since there's no mismatched pairs, middleOnes % 4 must be 0 or 2.
-      if (middleOnes % 4 == 2)
-        ans += 2;  // Flip two 1s to 0s.
-    } else {
-      // Flip every mismatched pair 01 to 00 or 11. It doesn't matter.
-      ans += mismatchedPairs;
-    }
-
-    // Handle the center cell if both dimensions are odd.
-    if (m % 2 == 1 && n % 2 == 1)
-      ans += grid[m / 2][n / 2];
-
-    return ans;
-  }
-};
diff --git a/solutions/3240. Minimum Number of Flips to Make Binary Grid Palindromic II/3240.java b/solutions/3240. Minimum Number of Flips to Make Binary Grid Palindromic II/3240.java
deleted file mode 100644
index 91b83a26e2b..00000000000
--- a/solutions/3240. Minimum Number of Flips to Make Binary Grid Palindromic II/3240.java	
+++ /dev/null
@@ -1,51 +0,0 @@
-class Solution {
-  public int minFlips(int[][] grid) {
-    final int m = grid.length;
-    final int n = grid[0].length;
-    int ans = 0;
-    int middleOnes = 0;
-    int mismatchedPairs = 0;
-
-    // Handle top-left, top-right, bottom-left, bottom-right cells.
-    for (int i = 0; i < m / 2; ++i) {
-      for (int j = 0; j < n / 2; ++j) {
-        final int ones =
-            grid[i][j] + grid[i][n - 1 - j] + grid[m - 1 - i][j] + grid[m - 1 - i][n - 1 - j];
-        ans += Math.min(ones, 4 - ones);
-      }
-    }
-
-    // Handle the middle row if the number of m is odd.
-    if (m % 2 == 1)
-      for (int j = 0; j < n / 2; ++j) {
-        final int leftCell = grid[m / 2][j];
-        final int rightCell = grid[m / 2][n - 1 - j];
-        mismatchedPairs += leftCell ^ rightCell;
-        middleOnes += leftCell + rightCell;
-      }
-
-    // Handle the middle column if the number of columns is odd.
-    if (n % 2 == 1)
-      for (int i = 0; i < m / 2; ++i) {
-        final int topCell = grid[i][n / 2];
-        final int bottomCell = grid[m - 1 - i][n / 2];
-        mismatchedPairs += topCell ^ bottomCell;
-        middleOnes += topCell + bottomCell;
-      }
-
-    if (mismatchedPairs == 0) {
-      // Since there's no mismatched pairs, middleOnes % 4 must be 0 or 2.
-      if (middleOnes % 4 == 2)
-        ans += 2; // Flip two 1s to 0s.
-    } else {
-      // Flip every mismatched pair 01 to 00 or 11. It doesn't matter.
-      ans += mismatchedPairs;
-    }
-
-    // Handle the center cell if both dimensions are odd.
-    if (m % 2 == 1 && n % 2 == 1)
-      ans += grid[m / 2][n / 2];
-
-    return ans;
-  }
-}
diff --git a/solutions/3240. Minimum Number of Flips to Make Binary Grid Palindromic II/3240.py b/solutions/3240. Minimum Number of Flips to Make Binary Grid Palindromic II/3240.py
deleted file mode 100644
index 8b361868977..00000000000
--- a/solutions/3240. Minimum Number of Flips to Make Binary Grid Palindromic II/3240.py	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution:
-  def minFlips(self, grid: list[list[int]]) -> int:
-    m = len(grid)
-    n = len(grid[0])
-    ans = 0
-    middleOnes = 0
-    mismatchedPairs = 0
-
-    # Handle top-left, top-right, bottom-left, bottom-right cells.
-    for i in range(m // 2):
-      for j in range(n // 2):
-        ones = (grid[i][j] + grid[i][n - 1 - j] +
-                grid[m - 1 - i][j] + grid[m - 1 - i][n - 1 - j])
-        ans += min(ones, 4 - ones)
-
-    # Handle the middle row if the number of m is odd.
-    if m % 2 == 1:
-      for j in range(n // 2):
-        leftCell = grid[m // 2][j]
-        rightCell = grid[m // 2][n - 1 - j]
-        mismatchedPairs += leftCell ^ rightCell
-        middleOnes += leftCell + rightCell
-
-    # Handle the middle column if the number of columns is odd.
-    if n % 2 == 1:
-      for i in range(m // 2):
-        topCell = grid[i][n // 2]
-        bottomCell = grid[m - 1 - i][n // 2]
-        mismatchedPairs += topCell ^ bottomCell
-        middleOnes += topCell + bottomCell
-
-    if mismatchedPairs == 0:
-      # Since there's no mismatched pairs, middleOnes % 4 must be 0 or 2.
-      if middleOnes % 4 == 2:
-        ans += 2  # Flip two 1s to 0s.
-    else:
-      # Flip every mismatched pair 01 to 00 or 11. It doesn't matter.
-      ans += mismatchedPairs
-
-    # Handle the center cell if both dimensions are odd.
-    if m % 2 == 1 and n % 2 == 1:
-      ans += grid[m // 2][n // 2]
-
-    return ans
diff --git a/solutions/3241. Time Taken to Mark All Nodes/3241.cpp b/solutions/3241. Time Taken to Mark All Nodes/3241.cpp
deleted file mode 100644
index ec0934f0926..00000000000
--- a/solutions/3241. Time Taken to Mark All Nodes/3241.cpp	
+++ /dev/null
@@ -1,82 +0,0 @@
-struct Node {
-  int node = 0;  // the node number
-  int time = 0;  // the time taken to mark the entire subtree rooted at the node
-};
-
-struct Top2 {
-  // the direct child node, where the time taken to mark the entire subtree
-  // rooted at the node is the maximum
-  Node top1;
-  // the direct child node, where the time taken to mark the entire subtree
-  // rooted at the node is the second maximum
-  Node top2;
-};
-
-class Solution {
- public:
-  vector<int> timeTaken(vector<vector<int>>& edges) {
-    const int n = edges.size() + 1;
-    vector<int> ans(n);
-    vector<vector<int>> tree(n);
-    // dp[i] := the top two direct child nodes for subtree rooted at node i,
-    // where each node contains the time taken to mark the entire subtree rooted
-    // at the node itself
-    vector<Top2> dp(n);
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      tree[u].push_back(v);
-      tree[v].push_back(u);
-    }
-
-    dfs(tree, 0, /*prev=*/-1, dp);
-    reroot(tree, 0, /*prev=*/-1, /*maxTime=*/0, dp, ans);
-    return ans;
-  }
-
- private:
-  // Return the time taken to mark node u.
-  int getTime(int u) {
-    return u % 2 == 0 ? 2 : 1;
-  }
-
-  // Performs a DFS traversal of the subtree rooted at node `u`, computes the
-  // time taken to mark all nodes in the subtree, records the top two direct
-  // child nodes, where the time taken to mark the subtree rooted at each of the
-  // child nodes is maximized, and returns the top child node.
-  //
-  // These values are used later in the rerooting process.
-  int dfs(const vector<vector<int>>& tree, int u, int prev, vector<Top2>& dp) {
-    Node top1;
-    Node top2;
-    for (const int v : tree[u]) {
-      if (v == prev)
-        continue;
-      const int time = dfs(tree, v, u, dp) + getTime(v);
-      if (time >= top1.time) {
-        top2 = top1;
-        top1 = Node(v, time);
-      } else if (time > top2.time) {
-        top2 = Node(v, time);
-      }
-    }
-    dp[u] = Top2(top1, top2);
-    return top1.time;
-  }
-
-  // Reroots the tree at node `u` and updates the answer array, where `maxTime`
-  // is the longest path that doesn't go through `u`'s subtree.
-  void reroot(const vector<vector<int>>& tree, int u, int prev, int maxTime,
-              const vector<Top2>& dp, vector<int>& ans) {
-    ans[u] = max(maxTime, dp[u].top1.time);
-    for (const int v : tree[u]) {
-      if (v == prev)
-        continue;
-      const int newMaxTime =
-          getTime(u) + max(maxTime, dp[u].top1.node == v ? dp[u].top2.time
-                                                         : dp[u].top1.time);
-      reroot(tree, v, u, newMaxTime, dp, ans);
-    }
-  }
-};
diff --git a/solutions/3241. Time Taken to Mark All Nodes/3241.java b/solutions/3241. Time Taken to Mark All Nodes/3241.java
deleted file mode 100644
index 8305ecc71ed..00000000000
--- a/solutions/3241. Time Taken to Mark All Nodes/3241.java	
+++ /dev/null
@@ -1,82 +0,0 @@
-class Solution {
-  public int[] timeTaken(int[][] edges) {
-    final int n = edges.length + 1;
-    int[] ans = new int[n];
-    List<Integer>[] tree = new List[n];
-    // dp[i] := the top two direct child nodes for subtree rooted at node i,
-    // where each node contains the time taken to mark the entire subtree rooted
-    // at the node itself
-    Top2[] dp = new Top2[n];
-
-    for (int i = 0; i < n; ++i) {
-      tree[i] = new ArrayList<>();
-      dp[i] = new Top2();
-    }
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      tree[u].add(v);
-      tree[v].add(u);
-    }
-
-    dfs(tree, 0, /*prev=*/-1, dp);
-    reroot(tree, 0, /*prev=*/-1, /*maxTime=*/0, dp, ans);
-    return ans;
-  }
-
-  private record Node(int node, int time) {
-    Node() {
-      this(0, 0);
-    }
-  }
-
-  private record Top2(Node max1, Node max2) {
-    Top2() {
-      this(new Node(), new Node());
-    }
-  }
-
-  // Return the time taken to mark node u.
-  private int getTime(int u) {
-    return u % 2 == 0 ? 2 : 1;
-  }
-
-  // Performs a DFS traversal of the subtree rooted at node `u`, computes the
-  // time taken to mark all nodes in the subtree, records the top two direct
-  // child nodes, where the time taken to mark the subtree rooted at each of the
-  // child nodes is maximized, and returns the top child node.
-  //
-  // These values are used later in the rerooting process.
-  private int dfs(List<Integer>[] tree, int u, int prev, Top2[] dp) {
-    Node max1 = new Node();
-    Node max2 = new Node();
-    for (final int v : tree[u]) {
-      if (v == prev)
-        continue;
-      final int time = dfs(tree, v, u, dp) + getTime(v);
-      if (time >= max1.time()) {
-        max2 = max1;
-        max1 = new Node(v, time);
-      } else if (time > max2.time()) {
-        max2 = new Node(v, time);
-      }
-    }
-    dp[u] = new Top2(max1, max2);
-    return max1.time();
-  }
-
-  // Reroots the tree at node `u` and updates the answer array, where `maxTime`
-  // is the longest path that doesn't go through `u`'s subtree.
-  private void reroot(List<Integer>[] tree, int u, int prev, int maxTime, Top2[] dp, int[] ans) {
-    ans[u] = Math.max(maxTime, dp[u].max1().time());
-    for (final int v : tree[u]) {
-      if (v == prev)
-        continue;
-      final int newMaxTime =
-          getTime(u) +
-          Math.max(maxTime, dp[u].max1().node() == v ? dp[u].max2().time() : dp[u].max1().time());
-      reroot(tree, v, u, newMaxTime, dp, ans);
-    }
-  }
-}
diff --git a/solutions/3241. Time Taken to Mark All Nodes/3241.py b/solutions/3241. Time Taken to Mark All Nodes/3241.py
index 8f9e7878f1c..b77da68475f 100644
--- a/solutions/3241. Time Taken to Mark All Nodes/3241.py	
+++ b/solutions/3241. Time Taken to Mark All Nodes/3241.py	
@@ -1,93 +1,72 @@
-from dataclasses import dataclass
-
-
-@dataclass
-class Node:
-  node: int = 0  # the node number
-  time: int = 0  # the time taken to mark the entire subtree rooted at the node
+class T:
+  def __init__(self, node: int = -1, time: int = 0):
+    self.node = node  # the node number
+    self.time = time  # the time taken to reach this node
 
 
 class Top2:
-  def __init__(self, top1: Node = Node(), top2: Node = Node()):
-    # the direct child node, where the time taken to mark the entire subtree
-    # rooted at the node is the maximum
-    self.top1 = top1
-    # the direct child node, where the time taken to mark the entire subtree
-    # rooted at the node is the second maximum
-    self.top2 = top2
+  def __init__(self, max1: T = T(-1, 0), max2: T = T(-1, 0)):
+    self.max1 = max1  # the node with the maximum time
+    self.max2 = max2  # the node with the second maximum time
 
 
 class Solution:
-  def timeTaken(self, edges: list[list[int]]) -> list[int]:
+  def timeTaken(self, edges: List[List[int]]) -> List[int]:
     n = len(edges) + 1
     ans = [0] * n
-    tree = [[] for _ in range(n)]
-    # dp[i] := the top two direct child nodes for subtree rooted at node i,
-    # where each node contains the time taken to mark the entire subtree rooted
-    # at the node itself
-    dp = [Top2()] * n
+    graph = [[] for _ in range(n)]
 
     for u, v in edges:
-      tree[u].append(v)
-      tree[v].append(u)
+      graph[u].append(v)
+      graph[v].append(u)
 
-    self._dfs(tree, 0, -1, dp)
-    self._reroot(tree, 0, -1, 0, dp, ans)
-    return ans
+    # dp[i] := the top two nodes with maximum times to mark all nodes in the
+    # subtree rooted at node i
+    dp = [Top2()] * n
+
+    def getTime(u: int) -> int:
+      """Returns the time taken to mark node u."""
+      return 2 if u % 2 == 0 else 1
 
-  def _getTime(self, u: int) -> int:
-    """Returns the time taken to mark node u."""
-    return 2 if u % 2 == 0 else 1
+    def dfs(u: int, prev: int) -> int:
+      """
+      Performs a DFS traversal of the tree, computing the maximum time to mark
+      all nodes in the subtree rooted at node u.
 
-  def _dfs(
-      self,
-      tree: list[list[int]],
-      u: int,
-      prev: int,
-      dp: list[Top2]
-  ) -> int:
-    """
-    Performs a DFS traversal of the subtree rooted at node `u`, computes the
-    time taken to mark all nodes in the subtree, records the top two direct
-    child nodes, where the time taken to mark the subtree rooted at each of the
-    child nodes is maximized, and returns the top child node.
+      This function calculates and stores the top two maximum times for each
+      node's subtree. These values are used later in the rerooting process.
+      """
+      max1 = T()
+      max2 = T()
+      for v in graph[u]:
+        if v == prev:
+          continue
+        time = dfs(v, u) + getTime(v)
+        if time >= max1.time:
+          max2 = max1
+          max1 = T(v, time)
+        elif time > max2.time:
+          max2 = T(v, time)
+      dp[u] = Top2(max1, max2)
+      return max1.time
 
-    These values are used later in the rerooting process.
-    """
-    top1 = Node()
-    top2 = Node()
-    for v in tree[u]:
-      if v == prev:
-        continue
-      time = self._dfs(tree, v, u, dp) + self._getTime(v)
-      if time >= top1.time:
-        top2 = top1
-        top1 = Node(v, time)
-      elif time > top2.time:
-        top2 = Node(v, time)
-    dp[u] = Top2(top1, top2)
-    return top1.time
+    dfs(0, -1)
 
-  def _reroot(
-      self,
-      tree: list[list[int]],
-      u: int,
-      prev: int,
-      maxTime: int,
-      dp: list[Top2],
-      ans: list[int]
-  ) -> None:
-    """
-    Reroots the tree at node `u` and updates the answer array, where `maxTime`
-    is the longest path that doesn't go through `u`'s subtree.
-    """
-    ans[u] = max(maxTime, dp[u].top1.time)
+    def reroot(u: int, prev: int, maxTime) -> None:
+      """
+      Reroots the tree at node `u` and updates the answer array, where `maxTime`
+      is the longest path that doesn't go through `u`'s subtree.
+      """
+      ans[u] = max(maxTime, dp[u].max1.time)
 
-    for v in tree[u]:
-      if v == prev:
-        continue
-      newMaxTime = self._getTime(u) + max(
-          maxTime,
-          dp[u].top2.time if dp[u].top1.node == v else dp[u].top1.time
-      )
-      self._reroot(tree, v, u, newMaxTime, dp, ans)
+      for v in graph[u]:
+        if v == prev:
+          continue
+        newMaxTime = getTime(u) + max(
+            maxTime,
+            dp[u].max2.time if dp[u].max1.node == v else dp[u].max1.time
+        )
+        reroot(v, u, newMaxTime)
+
+    reroot(0, -1, 0)
+    return ans
diff --git a/solutions/3242. Design Neighbor Sum Service/3242.cpp b/solutions/3242. Design Neighbor Sum Service/3242.cpp
deleted file mode 100644
index 692937ec991..00000000000
--- a/solutions/3242. Design Neighbor Sum Service/3242.cpp	
+++ /dev/null
@@ -1,34 +0,0 @@
-class neighborSum {
- public:
-  neighborSum(vector<vector<int>>& grid)
-      : n(grid.size()), grid(grid), numToPos(n * n) {
-    for (int i = 0; i < n; ++i)
-      for (int j = 0; j < n; ++j)
-        numToPos[grid[i][j]] = {i, j};
-  }
-
-  int adjacentSum(int value) {
-    const auto& [i, j] = numToPos[value];
-    int sum = 0;
-    for (const auto& [x, y] :
-         vector<pair<int, int>>{{i - 1, j}, {i + 1, j}, {i, j - 1}, {i, j + 1}})
-      if (x >= 0 && x < n && y >= 0 && y < n)
-        sum += grid[x][y];
-    return sum;
-  }
-
-  int diagonalSum(int value) {
-    const auto& [i, j] = numToPos[value];
-    int sum = 0;
-    for (const auto& [x, y] : vector<pair<int, int>>{
-             {i - 1, j - 1}, {i - 1, j + 1}, {i + 1, j - 1}, {i + 1, j + 1}})
-      if (x >= 0 && x < n && y >= 0 && y < n)
-        sum += grid[x][y];
-    return sum;
-  }
-
- private:
-  const int n;
-  vector<vector<int>> grid;
-  vector<pair<int, int>> numToPos;
-};
diff --git a/solutions/3242. Design Neighbor Sum Service/3242.java b/solutions/3242. Design Neighbor Sum Service/3242.java
deleted file mode 100644
index cf80469def7..00000000000
--- a/solutions/3242. Design Neighbor Sum Service/3242.java	
+++ /dev/null
@@ -1,42 +0,0 @@
-class neighborSum {
-  public neighborSum(int[][] grid) {
-    this.n = grid.length;
-    this.grid = grid;
-    this.numToPos = new Pair[n * n];
-    for (int i = 0; i < n; ++i)
-      for (int j = 0; j < n; ++j)
-        numToPos[grid[i][j]] = new Pair<>(i, j);
-  }
-
-  public int adjacentSum(int value) {
-    final int i = numToPos[value].getKey();
-    final int j = numToPos[value].getValue();
-    int sum = 0;
-    int[][] directions = {{i - 1, j}, {i + 1, j}, {i, j - 1}, {i, j + 1}};
-    for (int[] dir : directions) {
-      final int x = dir[0];
-      final int y = dir[1];
-      if (x >= 0 && x < n && y >= 0 && y < n)
-        sum += grid[x][y];
-    }
-    return sum;
-  }
-
-  public int diagonalSum(int value) {
-    final int i = numToPos[value].getKey();
-    final int j = numToPos[value].getValue();
-    int sum = 0;
-    int[][] directions = {{i - 1, j - 1}, {i - 1, j + 1}, {i + 1, j - 1}, {i + 1, j + 1}};
-    for (int[] dir : directions) {
-      final int x = dir[0];
-      final int y = dir[1];
-      if (x >= 0 && x < n && y >= 0 && y < n)
-        sum += grid[x][y];
-    }
-    return sum;
-  }
-
-  private int n;
-  private int[][] grid;
-  private Pair<Integer, Integer>[] numToPos;
-}
diff --git a/solutions/3242. Design Neighbor Sum Service/3242.py b/solutions/3242. Design Neighbor Sum Service/3242.py
deleted file mode 100644
index f0ca4634d5f..00000000000
--- a/solutions/3242. Design Neighbor Sum Service/3242.py	
+++ /dev/null
@@ -1,20 +0,0 @@
-class neighborSum:
-  def __init__(self, grid: list[list[int]]):
-    self.grid = grid
-    self.n = len(grid)
-    self.numToPos = {num: (i, j)
-                     for i, row in enumerate(grid)
-                     for j, num in enumerate(row)}
-
-  def adjacentSum(self, value: int) -> int:
-    i, j = self.numToPos[value]
-    return sum(self.grid[x][y]
-               for x, y in ((i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1))
-               if 0 <= x < self.n and 0 <= y < self.n)
-
-  def diagonalSum(self, value: int) -> int:
-    i, j = self.numToPos[value]
-    return sum(self.grid[x][y]
-               for x, y in ((i - 1, j - 1), (i - 1, j + 1),
-                            (i + 1, j - 1), (i + 1, j + 1))
-               if 0 <= x < self.n and 0 <= y < self.n)
diff --git a/solutions/3243. Shortest Distance After Road Addition Queries I/3243.cpp b/solutions/3243. Shortest Distance After Road Addition Queries I/3243.cpp
deleted file mode 100644
index a3068ef9625..00000000000
--- a/solutions/3243. Shortest Distance After Road Addition Queries I/3243.cpp	
+++ /dev/null
@@ -1,45 +0,0 @@
-class Solution {
- public:
-  vector<int> shortestDistanceAfterQueries(int n,
-                                           vector<vector<int>>& queries) {
-    vector<int> ans;
-    vector<int> dist(n);
-    vector<vector<int>> graph(n);
-
-    iota(dist.begin(), dist.end(), 0);
-
-    for (int i = 0; i < n - 1; ++i)
-      graph[i].push_back(i + 1);
-
-    for (const vector<int>& query : queries) {
-      const int u = query[0];
-      const int v = query[1];
-      graph[u].push_back(v);
-      if (dist[u] + 1 < dist[v]) {
-        dist[v] = dist[u] + 1;
-        bfs(graph, v, dist);
-      }
-      ans.push_back(dist[n - 1]);
-    }
-
-    return ans;
-  }
-
- private:
-  // Performs a BFS to update the shortest distances from the given `start` node
-  // to all other reachable nodes in the graph. It updates the `dist` vector
-  // with the new shortest distances.
-  void bfs(const vector<vector<int>>& graph, int start, vector<int>& dist) {
-    queue<int> q{{start}};
-    while (!q.empty()) {
-      const int u = q.front();
-      q.pop();
-      for (const int v : graph[u]) {
-        if (dist[u] + 1 < dist[v]) {
-          dist[v] = dist[u] + 1;
-          q.push(v);
-        }
-      }
-    }
-  }
-};
diff --git a/solutions/3243. Shortest Distance After Road Addition Queries I/3243.java b/solutions/3243. Shortest Distance After Road Addition Queries I/3243.java
deleted file mode 100644
index 6062db729c8..00000000000
--- a/solutions/3243. Shortest Distance After Road Addition Queries I/3243.java	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution {
-  public int[] shortestDistanceAfterQueries(int n, int[][] queries) {
-    int[] ans = new int[queries.length];
-    int[] dist = new int[n];
-    List<Integer>[] graph = new List[n];
-
-    for (int i = 0; i < n; ++i) {
-      dist[i] = i;
-      graph[i] = new ArrayList<>();
-    }
-
-    for (int i = 0; i < n - 1; ++i)
-      graph[i].add(i + 1);
-
-    for (int i = 0; i < queries.length; ++i) {
-      final int u = queries[i][0];
-      final int v = queries[i][1];
-      graph[u].add(v);
-      if (dist[u] + 1 < dist[v]) {
-        dist[v] = dist[u] + 1;
-        bfs(graph, v, dist);
-      }
-      ans[i] = dist[n - 1];
-    }
-
-    return ans;
-  }
-
-  // Performs a BFS to update the shortest distances from the given `start` node
-  // to all other reachable nodes in the graph. It updates the `dist` vector
-  // with the new shortest distances.
-  private void bfs(List<Integer>[] graph, int start, int[] dist) {
-    Queue<Integer> q = new LinkedList<>(Arrays.asList(start));
-    while (!q.isEmpty()) {
-      final int u = q.poll();
-      for (final int v : graph[u]) {
-        if (dist[u] + 1 < dist[v]) {
-          dist[v] = dist[u] + 1;
-          q.offer(v);
-        }
-      }
-    }
-  }
-}
diff --git a/solutions/3243. Shortest Distance After Road Addition Queries I/3243.py b/solutions/3243. Shortest Distance After Road Addition Queries I/3243.py
deleted file mode 100644
index 7265ffeeae2..00000000000
--- a/solutions/3243. Shortest Distance After Road Addition Queries I/3243.py	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution:
-  def shortestDistanceAfterQueries(
-      self,
-      n: int,
-      queries: list[list[int]],
-  ) -> list[int]:
-    ans = []
-    dist = list(range(n))
-    graph = [[] for _ in range(n)]
-
-    for i in range(n - 1):
-      graph[i].append(i + 1)
-
-    for u, v in queries:
-      graph[u].append(v)
-      if dist[u] + 1 < dist[v]:
-        dist[v] = dist[u] + 1
-        self._bfs(graph, v, dist)
-      ans.append(dist[n - 1])
-
-    return ans
-
-  def _bfs(self, graph: list[list[int]], start: int, dist: list[int]) -> None:
-    """
-    Performs a BFS to update the shortest distances from the given `start` node
-    to all other reachable nodes in the graph. It updates the `dist` vector
-    with the new shortest distances.
-    """
-    q = collections.deque([start])
-    while q:
-      u = q.popleft()
-      for v in graph[u]:
-        if dist[u] + 1 < dist[v]:
-          dist[v] = dist[u] + 1
-          q.append(v)
diff --git a/solutions/3244. Shortest Distance After Road Addition Queries II/3244.cpp b/solutions/3244. Shortest Distance After Road Addition Queries II/3244.cpp
deleted file mode 100644
index bde4f53097b..00000000000
--- a/solutions/3244. Shortest Distance After Road Addition Queries II/3244.cpp	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
- public:
-  vector<int> shortestDistanceAfterQueries(int n,
-                                           vector<vector<int>>& queries) {
-    vector<int> ans;
-    unordered_map<int, int> nodeToFarthestNode;
-
-    for (int i = 0; i < n - 1; ++i)
-      nodeToFarthestNode[i] = i + 1;
-
-    for (const vector<int>& query : queries) {
-      const int u = query[0];
-      const int v = query[1];
-      // If `u` exists in the map and `v` is farther than the current farthest
-      // node for `u`, we need to update the map and remove intermediate nodes.
-      if (nodeToFarthestNode.contains(u) && nodeToFarthestNode[u] < v) {
-        int node = nodeToFarthestNode[u];
-        while (node < v) {
-          const int cache = node;
-          node = nodeToFarthestNode[node];
-          nodeToFarthestNode.erase(cache);
-        }
-        nodeToFarthestNode[u] = v;
-      }
-      ans.push_back(nodeToFarthestNode.size());
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3244. Shortest Distance After Road Addition Queries II/3244.java b/solutions/3244. Shortest Distance After Road Addition Queries II/3244.java
deleted file mode 100644
index 38cef21477a..00000000000
--- a/solutions/3244. Shortest Distance After Road Addition Queries II/3244.java	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
-  public int[] shortestDistanceAfterQueries(int n, int[][] queries) {
-    int[] ans = new int[queries.length];
-    Map<Integer, Integer> nodeToFarthestNode = new HashMap<>();
-
-    for (int i = 0; i < n - 1; ++i)
-      nodeToFarthestNode.put(i, i + 1);
-
-    for (int i = 0; i < queries.length; ++i) {
-      final int u = queries[i][0];
-      final int v = queries[i][1];
-      // If `u` exists in the map and `v` is farther than the current farthest
-      // node for `u`, we need to update the map and remove intermediate nodes.
-      if (nodeToFarthestNode.containsKey(u) && nodeToFarthestNode.get(u) < v) {
-        int node = nodeToFarthestNode.get(u);
-        while (node < v)
-          node = nodeToFarthestNode.remove(node);
-        nodeToFarthestNode.put(u, v);
-      }
-      ans[i] = nodeToFarthestNode.size();
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3244. Shortest Distance After Road Addition Queries II/3244.py b/solutions/3244. Shortest Distance After Road Addition Queries II/3244.py
deleted file mode 100644
index 9d371219b71..00000000000
--- a/solutions/3244. Shortest Distance After Road Addition Queries II/3244.py	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution:
-  def shortestDistanceAfterQueries(
-      self,
-      n: int,
-      queries: list[list[int]],
-  ) -> list[int]:
-    ans = []
-    nodeToFarthestNode = {i: i + 1 for i in range(n - 1)}
-
-    for u, v in queries:
-      # If `u` exists in the map and `v` is farther than the current farthest
-      # node for `u`, we need to update the map and remove intermediate nodes.
-      if u in nodeToFarthestNode and nodeToFarthestNode[u] < v:
-        node = nodeToFarthestNode[u]
-        while node < v:
-          node = nodeToFarthestNode.pop(node)
-        nodeToFarthestNode[u] = v
-      ans.append(len(nodeToFarthestNode))
-
-    return ans
diff --git a/solutions/3245. Alternating Groups III/3245.cpp b/solutions/3245. Alternating Groups III/3245.cpp
deleted file mode 100644
index 4440fd174c6..00000000000
--- a/solutions/3245. Alternating Groups III/3245.cpp	
+++ /dev/null
@@ -1,213 +0,0 @@
-struct SegmentTree {
- public:
-  explicit SegmentTree(int n)
-      : n(n), treeIntervalCounts(4 * n), treeIntervalLengths(4 * n) {}
-
-  // Adds val to intervalCounts[i] and updates intervalLengths[i] accordingly.
-  void add(int i, int val) {
-    add(0, 0, n - 1, i, val);
-  }
-
-  // Returns sum(intervalCounts[i..n - 1]).
-  int queryIntervalCounts(int i) const {
-    return query(treeIntervalCounts, 0, 0, n - 1, i, n - 1);
-  }
-
-  // Returns sum(intervalLengths[i..n - 1]).
-  int queryIntervalLengths(int i) const {
-    return query(treeIntervalLengths, 0, 0, n - 1, i, n - 1);
-  }
-
- private:
-  const int n;
-  vector<int> treeIntervalCounts;
-  vector<int> treeIntervalLengths;
-
-  void add(int treeIndex, int lo, int hi, int i, int val) {
-    if (lo == hi) {
-      treeIntervalCounts[treeIndex] += val;
-      treeIntervalLengths[treeIndex] = treeIntervalCounts[treeIndex] * i;
-      return;
-    }
-    const int mid = (lo + hi) / 2;
-    if (i <= mid)
-      add(2 * treeIndex + 1, lo, mid, i, val);
-    else
-      add(2 * treeIndex + 2, mid + 1, hi, i, val);
-    treeIntervalCounts[treeIndex] =
-        merge(treeIntervalCounts[2 * treeIndex + 1],
-              treeIntervalCounts[2 * treeIndex + 2]);
-    treeIntervalLengths[treeIndex] =
-        merge(treeIntervalLengths[2 * treeIndex + 1],
-              treeIntervalLengths[2 * treeIndex + 2]);
-  }
-
-  int query(const vector<int>& tree, int treeIndex, int lo, int hi, int i,
-            int j) const {
-    if (i <= lo && hi <= j)  // [lo, hi] lies completely inside [i, j].
-      return tree[treeIndex];
-    if (j < lo || hi < i)  // [lo, hi] lies completely outside [i, j].
-      return 0;
-    const int mid = (lo + hi) / 2;
-    return merge(query(tree, treeIndex * 2 + 1, lo, mid, i, j),
-                 query(tree, treeIndex * 2 + 2, mid + 1, hi, i, j));
-  }
-
-  int merge(int left, int right) const {
-    return left + right;
-  }
-};
-
-class Solution {
- public:
-  vector<int> numberOfAlternatingGroups(vector<int>& colors,
-                                        vector<vector<int>>& queries) {
-    const int n = colors.size();
-    vector<int> ans;
-    vector<int> arr{colors};
-    SegmentTree tree(2 * n - 1);
-    set<pair<int, int>> intervals;
-
-    arr.insert(arr.end(), colors.begin(), colors.end());
-
-    // Insert all intervals, each of them is an alternating sequence.
-    int start = 0;
-    for (int i = 1; i < 2 * n - 1; ++i)
-      if (arr[i] == arr[i - 1]) {
-        insert(intervals, {start, i - 1}, tree, n);
-        start = i;
-      }
-    insert(intervals, {start, 2 * n - 2}, tree, n);
-
-    for (const vector<int>& query : queries)
-      if (query[0] == 1) {
-        const int sz = query[1];
-        const pair<int, int>& intervalWithN = findInterval(intervals, n);
-        const int numAlternatingGroups =
-            getNumAlternatingGroups(sz, intervalWithN, tree, n);
-        ans.push_back(numAlternatingGroups);
-      } else {
-        const int index = query[1];
-        const int color = query[2];
-        if (arr[index] == color)
-          continue;
-        update(intervals, index, color, arr, tree, n);
-        if (index < n - 1)
-          update(intervals, index + n, color, arr, tree, n);
-      }
-
-    return ans;
-  }
-
- private:
-  // Returns the number of alternating groups of size `sz`.
-  int getNumAlternatingGroups(int sz, const pair<int, int>& intervalWithN,
-                              const SegmentTree& tree, int n) {
-    const int numIntervals = tree.queryIntervalCounts(sz);
-    const int sumIntervals = tree.queryIntervalLengths(sz);
-    // The number of alternating groups for an interval is |interval| - sz + 1.
-    // Therefore, the number of alternating groups for all intervals is
-    //   sum(|intervals[i]| - sz + 1)
-    // = sum(|intervals[i]) - numIntervals * sz + numIntervals
-    const int numAlternatingGroups =
-        sumIntervals - numIntervals * sz + numIntervals;
-    // We need to check if the interval (l, r) contains n, and if it does, we
-    // need to adjust the number of alternating groups to avoid duplicates.
-    const auto& [l, r] = intervalWithN;
-    // 1. For an interval with l >= n, it wasn't being considered in `insert`
-    // and `remove`.
-    // 2. For an interval with r - l + 1 < sz, it's impossible to form a group
-    // of size `sz`.
-    if (l >= n || r - l + 1 < sz)
-      return numAlternatingGroups;
-    // 3. For an interval with r >= n, it's possible to duplicately count the
-    // groups starting from n.
-    if (r >= n) {  // l < n && r - 1 + 1 >= sz
-      // Groups starting from [l..n) are non-duplicately counted.
-      const int nonDuplicateGroups = n - l;
-      // The number of groups of size `sz` in the interval [l..r].
-      const int numGroups = (r - l + 1) - sz + 1;
-      return numAlternatingGroups - max(0, numGroups - nonDuplicateGroups);
-    }
-    return numAlternatingGroups;
-  }
-
-  // Inserts an interval into `intervals` and updates `tree`.
-  void insert(set<pair<int, int>>& intervals, const pair<int, int>& interval,
-              SegmentTree& tree, int n) {
-    intervals.insert(interval);
-    if (interval.first < n)
-      tree.add(interval.second - interval.first + 1, 1);
-  }
-
-  // Removes an interval from `intervals` and updates `tree`.
-  void remove(set<pair<int, int>>& intervals, const pair<int, int>& interval,
-              SegmentTree& tree, int n) {
-    intervals.erase(interval);
-    if (interval.first < n)
-      tree.add(interval.second - interval.first + 1, -1);
-  }
-
-  // Returns the interval containing the target.
-  pair<int, int> findInterval(const set<pair<int, int>>& intervals,
-                              int target) {
-    auto it = intervals.upper_bound({target, INT_MAX});
-    return (*--it);
-  }
-
-  // Updates the color of the index-th element in `arr` and updates `intervals`
-  // and `tree`.
-  void update(set<pair<int, int>>& intervals, int index, int color,
-              vector<int>& arr, SegmentTree& tree, int n) {
-    arr[index] = color;
-
-    const pair<int, int> intervalWithIndex = findInterval(intervals, index);
-    remove(intervals, intervalWithIndex, tree, n);
-    auto [start, end] = intervalWithIndex;
-
-    // interval [s..i - 1|i|i + 1..e]
-    //    index           ^
-    if (start < index && index < end) {
-      insert(intervals, {start, index - 1}, tree, n);
-      insert(intervals, {index, index}, tree, n);
-      insert(intervals, {index + 1, end}, tree, n);
-      return;
-    }
-
-    // interval [s|s + 1..e]
-    //    index  ^
-    if (start == index && index < end)
-      insert(intervals, {start + 1, end}, tree, n);
-
-    // interval [s..e - 1|e]
-    //    index           ^
-    if (start < index && index == end)
-      insert(intervals, {start, end - 1}, tree, n);
-
-    start = index;
-    end = index;
-    vector<pair<int, int>> intervalsToRemove;
-
-    auto it = intervals.upper_bound({index, INT_MAX});
-
-    for (auto lit = it; lit != intervals.begin();) {
-      --lit;
-      if (arr[lit->second] == arr[start])  // [..lit->second|start..]
-        break;
-      intervalsToRemove.push_back(*lit);
-      start = lit->first;
-    }
-
-    for (auto rit = it; rit != intervals.end(); ++rit) {
-      if (arr[rit->first] == arr[end])  // [..end|rit->first..]
-        break;
-      intervalsToRemove.push_back(*rit);
-      end = rit->second;
-    }
-
-    for (const pair<int, int>& interval : intervalsToRemove)
-      remove(intervals, interval, tree, n);
-
-    insert(intervals, {start, end}, tree, n);
-  }
-};
diff --git a/solutions/3246. Premier League Table Ranking/3246.sql b/solutions/3246. Premier League Table Ranking/3246.sql
deleted file mode 100644
index 4c1a18e0d44..00000000000
--- a/solutions/3246. Premier League Table Ranking/3246.sql	
+++ /dev/null
@@ -1,12 +0,0 @@
-WITH
-  TeamPoints AS (
-    SELECT team_id, team_name, wins * 3 + draws AS points
-    FROM TeamStats
-  ),
-  RankedTeams AS (
-    SELECT *, RANK() OVER(ORDER BY points DESC) AS position
-    FROM TeamPoints
-  )
-SELECT team_id, team_name, points, position
-FROM RankedTeams
-ORDER BY points DESC, team_name;
diff --git a/solutions/3247. Number of Subsequences with Odd Sum/3247.cpp b/solutions/3247. Number of Subsequences with Odd Sum/3247.cpp
deleted file mode 100644
index a827f55bbe0..00000000000
--- a/solutions/3247. Number of Subsequences with Odd Sum/3247.cpp	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
- public:
-  int subsequenceCount(vector<int>& nums) {
-    constexpr int kMod = 1'000'000'007;
-    int even = 0;  // the number of subsequences with even sum
-    int odd = 0;   // the number of subsequences with odd sum
-
-    for (const int num : nums)
-      if (num % 2 == 0) {
-        // Appending an even number to a subsequence doesn't change the parity.
-        // The even number itself is also a valid subsequence.
-        even = (even + even + 1) % kMod;
-        odd = (odd + odd) % kMod;
-      } else {
-        // Appending an odd number to a subsequence changes the parity.
-        // The odd number itself is also a valid subsequence.
-        const int newEven = (even + odd) % kMod;
-        odd = (odd + even + 1) % kMod;
-        even = newEven;
-      }
-
-    return odd % kMod;
-  }
-};
diff --git a/solutions/3247. Number of Subsequences with Odd Sum/3247.java b/solutions/3247. Number of Subsequences with Odd Sum/3247.java
deleted file mode 100644
index a65819b86ac..00000000000
--- a/solutions/3247. Number of Subsequences with Odd Sum/3247.java	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
-  public int subsequenceCount(int[] nums) {
-    final int MOD = 1_000_000_007;
-    int even = 0; // the number of subsequences with even sum
-    int odd = 0;  // the number of subsequences with odd sum
-
-    for (final int num : nums)
-      if (num % 2 == 0) {
-        // Appending an even number to a subsequence doesn't change the parity.
-        // The even number itself is also a valid subsequence.
-        even = (even + even + 1) % MOD;
-        odd = (odd + odd) % MOD;
-      } else {
-        // Appending an odd number to a subsequence changes the parity.
-        // The odd number itself is also a valid subsequence.
-        final int newEven = (even + odd) % MOD;
-        odd = (odd + even + 1) % MOD;
-        even = newEven;
-      }
-
-    return odd % MOD;
-  }
-}
diff --git a/solutions/3247. Number of Subsequences with Odd Sum/3247.py b/solutions/3247. Number of Subsequences with Odd Sum/3247.py
deleted file mode 100644
index 7b0921e3d9e..00000000000
--- a/solutions/3247. Number of Subsequences with Odd Sum/3247.py	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution:
-  def subsequenceCount(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-    even = 0  # the number of subsequences with even sum
-    odd = 0  # the number of subsequences with odd sum
-
-    for num in nums:
-      if num % 2 == 0:
-        # Appending an even number to a subsequence doesn't change the parity.
-        # The even number itself is also a valid subsequence.
-        even, odd = even + even + 1, odd + odd
-      else:
-        # Appending an odd number to a subsequence changes the parity.
-        # The odd number itself is also a valid subsequence.
-        even, odd = even + odd, odd + even + 1
-
-    return odd % MOD
diff --git a/solutions/3248. Snake in Matrix/3248.cpp b/solutions/3248. Snake in Matrix/3248.cpp
deleted file mode 100644
index e566b3bc4e9..00000000000
--- a/solutions/3248. Snake in Matrix/3248.cpp	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
- public:
-  int finalPositionOfSnake(int n, vector<string>& commands) {
-    const unordered_map<string, pair<int, int>> directions = {
-        {"UP", {-1, 0}},
-        {"RIGHT", {0, 1}},
-        {"DOWN", {1, 0}},
-        {"LEFT", {0, -1}}};
-    int i = 0;
-    int j = 0;
-
-    for (const string& command : commands) {
-      const auto& [dx, dy] = directions.at(command);
-      i += dx;
-      j += dy;
-    }
-
-    return i * n + j;
-  }
-};
diff --git a/solutions/3248. Snake in Matrix/3248.java b/solutions/3248. Snake in Matrix/3248.java
deleted file mode 100644
index f786eb39fb4..00000000000
--- a/solutions/3248. Snake in Matrix/3248.java	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
-  public int finalPositionOfSnake(int n, List<String> commands) {
-    Map<String, int[]> directions = Map.of("UP", new int[] {-1, 0},   //
-                                           "RIGHT", new int[] {0, 1}, //
-                                           "DOWN", new int[] {1, 0},  //
-                                           "LEFT", new int[] {0, -1});
-    int i = 0;
-    int j = 0;
-
-    for (final String command : commands) {
-      int[] direction = directions.get(command);
-      i += direction[0];
-      j += direction[1];
-    }
-
-    return i * n + j;
-  }
-}
diff --git a/solutions/3248. Snake in Matrix/3248.py b/solutions/3248. Snake in Matrix/3248.py
deleted file mode 100644
index 5db9217851a..00000000000
--- a/solutions/3248. Snake in Matrix/3248.py	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution:
-  def finalPositionOfSnake(self, n: int, commands: list[str]) -> int:
-    directions = {
-        "UP": (-1, 0),
-        "RIGHT": (0, 1),
-        "DOWN": (1, 0),
-        "LEFT": (0, -1),
-    }
-    i = 0
-    j = 0
-
-    for command in commands:
-      dx, dy = directions[command]
-      i += dx
-      j += dy
-
-    return i * n + j
diff --git a/solutions/3249. Count the Number of Good Nodes/3249.cpp b/solutions/3249. Count the Number of Good Nodes/3249.cpp
deleted file mode 100644
index 96140ab2727..00000000000
--- a/solutions/3249. Count the Number of Good Nodes/3249.cpp	
+++ /dev/null
@@ -1,48 +0,0 @@
-class Solution {
- public:
-  int countGoodNodes(vector<vector<int>>& edges) {
-    const int n = edges.size() + 1;
-    int ans = 0;
-    vector<vector<int>> graph(n);
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      graph[u].push_back(v);
-      graph[v].push_back(u);
-    }
-
-    dfs(graph, 0, /*prev=*/-1, ans);
-    return ans;
-  }
-
- private:
-  int ans = 0;
-
-  // Returns the size of the subtree rooted at u.
-  int dfs(const vector<vector<int>>& graph, int u, int prev, int& ans) {
-    int size = 1;
-    vector<int> childrenSizes;
-
-    for (const int v : graph[u]) {
-      if (v == prev)
-        continue;
-      const int childSize = dfs(graph, v, u, ans);
-      size += childSize;
-      childrenSizes.push_back(childSize);
-    }
-
-    if (childrenSizes.empty() || allSameSizes(childrenSizes))
-      ++ans;
-
-    return size;
-  }
-
- private:
-  bool allSameSizes(const vector<int>& childrenSizes) {
-    for (int i = 1; i < childrenSizes.size(); ++i)
-      if (childrenSizes[i] != childrenSizes[0])
-        return false;
-    return true;
-  }
-};
diff --git a/solutions/3249. Count the Number of Good Nodes/3249.java b/solutions/3249. Count the Number of Good Nodes/3249.java
deleted file mode 100644
index 364824a6fc7..00000000000
--- a/solutions/3249. Count the Number of Good Nodes/3249.java	
+++ /dev/null
@@ -1,45 +0,0 @@
-class Solution {
-  public int countGoodNodes(int[][] edges) {
-    final int n = edges.length + 1;
-    List<Integer>[] graph = new ArrayList<>(n);
-    Arrays.setAll(graph, i -> new ArrayList<>());
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      graph[u].add(v);
-      graph[v].add(u);
-    }
-
-    dfs(graph, 0, -1);
-    return ans;
-  }
-
-  private int ans = 0;
-
-  // Returns the size of the subtree rooted at u.
-  private int dfs(List<Integer>[] graph, int u, int prev) {
-    int size = 1;
-    List<Integer> childrenSizes = new ArrayList<>();
-
-    for (final int v : graph[u]) {
-      if (v == prev)
-        continue;
-      final int childSize = dfs(graph, v, u);
-      size += childSize;
-      childrenSizes.add(childSize);
-    }
-
-    if (childrenSizes.isEmpty() || allSameSizes(childrenSizes))
-      ++ans;
-
-    return size;
-  }
-
-  private boolean allSameSizes(List<Integer> childrenSizes) {
-    for (int i = 1; i < childrenSizes.size(); ++i)
-      if (!childrenSizes.get(i).equals(childrenSizes.get(0)))
-        return false;
-    return true;
-  }
-}
diff --git a/solutions/3249. Count the Number of Good Nodes/3249.py b/solutions/3249. Count the Number of Good Nodes/3249.py
deleted file mode 100644
index 6f801cffef3..00000000000
--- a/solutions/3249. Count the Number of Good Nodes/3249.py	
+++ /dev/null
@@ -1,31 +0,0 @@
-class Solution:
-  def countGoodNodes(self, edges: list[list[int]]) -> int:
-    n = len(edges) + 1
-    graph = [[] for _ in range(n)]
-
-    for u, v in edges:
-      graph[u].append(v)
-      graph[v].append(u)
-
-    ans = 0
-
-    def dfs(u: int, prev: int) -> int:
-      """Returns the size of the subtree rooted at u."""
-      nonlocal ans
-      size = 1
-      childrenSizes = []
-      for v in graph[u]:
-        if v == prev:
-          continue
-        child_size = dfs(v, u)
-        size += child_size
-        childrenSizes.append(child_size)
-
-      if not childrenSizes or all(s == childrenSizes[0]
-                                  for s in childrenSizes):
-        ans += 1
-
-      return size
-
-    dfs(0, -1)
-    return ans
diff --git a/solutions/325. Maximum Size Subarray Sum Equals k/325.py b/solutions/325. Maximum Size Subarray Sum Equals k/325.py
index 65ce3e92147..5d46b6db47e 100644
--- a/solutions/325. Maximum Size Subarray Sum Equals k/325.py	
+++ b/solutions/325. Maximum Size Subarray Sum Equals k/325.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSubArrayLen(self, nums: list[int], k: int) -> int:
+  def maxSubArrayLen(self, nums: List[int], k: int) -> int:
     ans = 0
     prefix = 0
     prefixToIndex = {0: -1}
diff --git a/solutions/3250. Find the Count of Monotonic Pairs I/3250.cpp b/solutions/3250. Find the Count of Monotonic Pairs I/3250.cpp
deleted file mode 100644
index 4f64901e761..00000000000
--- a/solutions/3250. Find the Count of Monotonic Pairs I/3250.cpp	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
- public:
-  int countOfPairs(vector<int>& nums) {
-    constexpr int kMod = 1'000'000'007;
-    constexpr int kMax = 1000;
-    const int n = nums.size();
-    int ans = 0;
-    // dp[i][num] := the number of valid ways to fill the arrays up to index i
-    // with arr1[i] = num
-    vector<vector<int>> dp(n, vector<int>(kMax + 1));
-
-    for (int num = 0; num <= nums[0]; ++num)
-      dp[0][num] = 1;
-
-    for (int i = 1; i < n; ++i) {
-      int ways = 0;
-      int prevNum = 0;
-      // To satisfy arr1, prevNum <= num.
-      // To satisfy arr2, nums[i - 1] - prevNum >= nums[i] - num.
-      //               => prevNum <= min(num, num - (nums[i] - nums[i - 1])).
-      // As we move from `num` to `num + 1`, the range of valid `prevNum` values
-      // becomes prevNum <= min(num + 1, num + 1 - (nums[i] - nums[i - 1])).
-      // Since the range of `prevNum` can only increase by at most 1, there's
-      // no need to iterate through all possible values of `prevNum`. We can
-      // simply increment `prevNum` by 1 if it meets the condition.
-      for (int num = 0; num <= nums[i]; ++num) {
-        if (prevNum <= min(num, num - (nums[i] - nums[i - 1]))) {
-          ways = (ways + dp[i - 1][prevNum]) % kMod;
-          ++prevNum;
-        }
-        dp[i][num] = ways;
-      }
-    }
-
-    for (int i = 0; i <= kMax; ++i)
-      ans = (ans + dp[n - 1][i]) % kMod;
-
-    return ans;
-  }
-};
diff --git a/solutions/3250. Find the Count of Monotonic Pairs I/3250.java b/solutions/3250. Find the Count of Monotonic Pairs I/3250.java
deleted file mode 100644
index ae727edca41..00000000000
--- a/solutions/3250. Find the Count of Monotonic Pairs I/3250.java	
+++ /dev/null
@@ -1,39 +0,0 @@
-class Solution {
-  public int countOfPairs(int[] nums) {
-    final int MOD = 1_000_000_007;
-    final int MAX = 1000;
-    final int n = nums.length;
-    int ans = 0;
-    // dp[i][num] := the number of valid ways to fill the arrays up to index i
-    // with arr1[i] = num
-    int[][] dp = new int[n][MAX + 1];
-
-    for (int num = 0; num <= nums[0]; ++num)
-      dp[0][num] = 1;
-
-    for (int i = 1; i < n; ++i) {
-      int ways = 0;
-      int prevNum = 0;
-      // To satisfy arr1, prevNum <= num.
-      // To satisfy arr2, nums[i - 1] - prevNum >= nums[i] - num.
-      //               => prevNum <= min(num, num - (nums[i] - nums[i - 1])).
-      // As we move from `num` to `num + 1`, the range of valid `prevNum` values
-      // becomes prevNum <= min(num + 1, num + 1 - (nums[i] - nums[i - 1])).
-      // Since the range of `prevNum` can only increase by at most 1, there's
-      // no need to iterate through all possible values of `prevNum`. We can
-      // simply increment `prevNum` by 1 if it meets the condition.
-      for (int num = 0; num <= nums[i]; ++num) {
-        if (prevNum <= Math.min(num, num - (nums[i] - nums[i - 1]))) {
-          ways = (ways + dp[i - 1][prevNum]) % MOD;
-          ++prevNum;
-        }
-        dp[i][num] = ways;
-      }
-    }
-
-    for (int i = 0; i <= MAX; ++i)
-      ans = (ans + dp[n - 1][i]) % MOD;
-
-    return ans;
-  }
-}
diff --git a/solutions/3250. Find the Count of Monotonic Pairs I/3250.py b/solutions/3250. Find the Count of Monotonic Pairs I/3250.py
deleted file mode 100644
index 721bc991bb4..00000000000
--- a/solutions/3250. Find the Count of Monotonic Pairs I/3250.py	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution:
-  def countOfPairs(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-    MAX = 1000
-    n = len(nums)
-    # dp[i][num] := the number of valid ways to fill the arrays up to index i
-    # with arr1[i] = num
-    dp = [[0] * (MAX + 1) for _ in range(n)]
-
-    for num in range(nums[0] + 1):
-      dp[0][num] = 1
-
-    for i in range(1, n):
-      ways = 0
-      prevNum = 0
-      # To satisfy arr1, prevNum <= num.
-      # To satisfy arr2, nums[i - 1] - prevNum >= nums[i] - num.
-      #               => prevNum <= min(num, num - (nums[i] - nums[i - 1])).
-      # As we move from `num` to `num + 1`, the range of valid `prevNum` values
-      # becomes prevNum <= min(num + 1, num + 1 - (nums[i] - nums[i - 1])).
-      # Since the range of `prevNum` can only increase by at most 1, there's
-      # no need to iterate through all possible values of `prevNum`. We can
-      # simply increment `prevNum` by 1 if it meets the condition.
-      for num in range(nums[i] + 1):
-        if prevNum <= min(num, num - (nums[i] - nums[i - 1])):
-          ways = (ways + dp[i - 1][prevNum]) % MOD
-          prevNum += 1
-        dp[i][num] = ways
-
-    return sum(dp[n - 1]) % MOD
diff --git a/solutions/3251. Find the Count of Monotonic Pairs II/3251.cpp b/solutions/3251. Find the Count of Monotonic Pairs II/3251.cpp
deleted file mode 100644
index 3b25f15e6d1..00000000000
--- a/solutions/3251. Find the Count of Monotonic Pairs II/3251.cpp	
+++ /dev/null
@@ -1,41 +0,0 @@
-class Solution {
- public:
-  // Same as 3250. Find the Count of Monotonic Pairs I
-  int countOfPairs(vector<int>& nums) {
-    constexpr int kMod = 1'000'000'007;
-    constexpr int kMax = 1000;
-    const int n = nums.size();
-    int ans = 0;
-    // dp[i][num] := the number of valid ways to fill the arrays up to index i
-    // with arr1[i] = num
-    vector<vector<int>> dp(n, vector<int>(kMax + 1));
-
-    for (int num = 0; num <= nums[0]; ++num)
-      dp[0][num] = 1;
-
-    for (int i = 1; i < n; ++i) {
-      int ways = 0;
-      int prevNum = 0;
-      // To satisfy arr1, prevNum <= num.
-      // To satisfy arr2, nums[i - 1] - prevNum >= nums[i] - num.
-      //               => prevNum <= min(num, num - (nums[i] - nums[i - 1])).
-      // As we move from `num` to `num + 1`, the range of valid `prevNum` values
-      // becomes prevNum <= min(num + 1, num + 1 - (nums[i] - nums[i - 1])).
-      // Since the range of `prevNum` can only increase by at most 1, there's
-      // no need to iterate through all possible values of `prevNum`. We can
-      // simply increment `prevNum` by 1 if it meets the condition.
-      for (int num = 0; num <= nums[i]; ++num) {
-        if (prevNum <= min(num, num - (nums[i] - nums[i - 1]))) {
-          ways = (ways + dp[i - 1][prevNum]) % kMod;
-          ++prevNum;
-        }
-        dp[i][num] = ways;
-      }
-    }
-
-    for (int i = 0; i <= kMax; ++i)
-      ans = (ans + dp[n - 1][i]) % kMod;
-
-    return ans;
-  }
-};
diff --git a/solutions/3251. Find the Count of Monotonic Pairs II/3251.java b/solutions/3251. Find the Count of Monotonic Pairs II/3251.java
deleted file mode 100644
index 7eccdb7d777..00000000000
--- a/solutions/3251. Find the Count of Monotonic Pairs II/3251.java	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
-  // Same as 3250. Find the Count of Monotonic Pairs I
-  public int countOfPairs(int[] nums) {
-    final int MOD = 1_000_000_007;
-    final int MAX = 1000;
-    final int n = nums.length;
-    int ans = 0;
-    // dp[i][num] := the number of valid ways to fill the arrays up to index i
-    // with arr1[i] = num
-    int[][] dp = new int[n][MAX + 1];
-
-    for (int num = 0; num <= nums[0]; ++num)
-      dp[0][num] = 1;
-
-    for (int i = 1; i < n; ++i) {
-      int ways = 0;
-      int prevNum = 0;
-      // To satisfy arr1, prevNum <= num.
-      // To satisfy arr2, nums[i - 1] - prevNum >= nums[i] - num.
-      //               => prevNum <= min(num, num - (nums[i] - nums[i - 1])).
-      // As we move from `num` to `num + 1`, the range of valid `prevNum` values
-      // becomes prevNum <= min(num + 1, num + 1 - (nums[i] - nums[i - 1])).
-      // Since the range of `prevNum` can only increase by at most 1, there's
-      // no need to iterate through all possible values of `prevNum`. We can
-      // simply increment `prevNum` by 1 if it meets the condition.
-      for (int num = 0; num <= nums[i]; ++num) {
-        if (prevNum <= Math.min(num, num - (nums[i] - nums[i - 1]))) {
-          ways = (ways + dp[i - 1][prevNum]) % MOD;
-          ++prevNum;
-        }
-        dp[i][num] = ways;
-      }
-    }
-
-    for (int i = 0; i <= MAX; ++i)
-      ans = (ans + dp[n - 1][i]) % MOD;
-
-    return ans;
-  }
-}
diff --git a/solutions/3251. Find the Count of Monotonic Pairs II/3251.py b/solutions/3251. Find the Count of Monotonic Pairs II/3251.py
deleted file mode 100644
index 84d32f585fe..00000000000
--- a/solutions/3251. Find the Count of Monotonic Pairs II/3251.py	
+++ /dev/null
@@ -1,31 +0,0 @@
-class Solution:
-  # Same as 3250. Find the Count of Monotonic Pairs I
-  def countOfPairs(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-    MAX = 1000
-    n = len(nums)
-    # dp[i][num] := the number of valid ways to fill the arrays up to index i
-    # with arr1[i] = num
-    dp = [[0] * (MAX + 1) for _ in range(n)]
-
-    for num in range(nums[0] + 1):
-      dp[0][num] = 1
-
-    for i in range(1, n):
-      ways = 0
-      prevNum = 0
-      # To satisfy arr1, prevNum <= num.
-      # To satisfy arr2, nums[i - 1] - prevNum >= nums[i] - num.
-      #               => prevNum <= min(num, num - (nums[i] - nums[i - 1])).
-      # As we move from `num` to `num + 1`, the range of valid `prevNum` values
-      # becomes prevNum <= min(num + 1, num + 1 - (nums[i] - nums[i - 1])).
-      # Since the range of `prevNum` can only increase by at most 1, there's
-      # no need to iterate through all possible values of `prevNum`. We can
-      # simply increment `prevNum` by 1 if it meets the condition.
-      for num in range(nums[i] + 1):
-        if prevNum <= min(num, num - (nums[i] - nums[i - 1])):
-          ways = (ways + dp[i - 1][prevNum]) % MOD
-          prevNum += 1
-        dp[i][num] = ways
-
-    return sum(dp[n - 1]) % MOD
diff --git a/solutions/3252. Premier League Table Ranking II/3252.sql b/solutions/3252. Premier League Table Ranking II/3252.sql
deleted file mode 100644
index 1f1d3fe1538..00000000000
--- a/solutions/3252. Premier League Table Ranking II/3252.sql	
+++ /dev/null
@@ -1,27 +0,0 @@
-WITH
-  TeamPoints AS (
-    SELECT team_id, team_name, wins * 3 + draws AS points
-    FROM TeamStats
-  ),
-  RankedTeams AS (
-    SELECT *, RANK() OVER(ORDER BY points DESC) AS position
-    FROM TeamPoints
-  ),
-  Tiers AS (
-    SELECT
-      CEIL(COUNT(*) * 0.33) AS tier1_bound,
-      CEIL(COUNT(*) * 0.67) AS tier2_bound
-    FROM RankedTeams
-  )
-SELECT
-  RankedTeams.team_name,
-  RankedTeams.points,
-  RankedTeams.position,
-  CASE
-    WHEN RankedTeams.position <= Tiers.tier1_bound THEN 'Tier 1'
-    WHEN RankedTeams.position <= Tiers.tier2_bound THEN 'Tier 2'
-    ELSE 'Tier 3'
-  END AS tier
-FROM RankedTeams
-CROSS JOIN Tiers
-ORDER BY points DESC, team_name;
diff --git a/solutions/3253. Construct String with Minimum Cost (Easy)/3253.cpp b/solutions/3253. Construct String with Minimum Cost (Easy)/3253.cpp
deleted file mode 100644
index e859aec5b2a..00000000000
--- a/solutions/3253. Construct String with Minimum Cost (Easy)/3253.cpp	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
- public:
-  int minimumCost(string target, vector<string>& words, vector<int>& costs) {
-    const int n = target.length();
-    // dp[i] := the minimum cost to construct target[0..i)
-    vector<int> dp(n + 1, INT_MAX);
-    dp[0] = 0;
-
-    for (int i = 1; i <= n; ++i)
-      for (int j = 0; j < words.size(); ++j)
-        if (i >= words[j].length() &&
-            target.substr(i - words[j].length(), words[j].length()) ==
-                words[j] &&
-            dp[i - words[j].length()] != INT_MAX)
-          dp[i] = min(dp[i], dp[i - words[j].length()] + costs[j]);
-
-    return dp[n] == INT_MAX ? -1 : dp[n];
-  }
-};
diff --git a/solutions/3253. Construct String with Minimum Cost (Easy)/3253.java b/solutions/3253. Construct String with Minimum Cost (Easy)/3253.java
deleted file mode 100644
index b3b25c3893d..00000000000
--- a/solutions/3253. Construct String with Minimum Cost (Easy)/3253.java	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
-  public int minimumCost(String target, String[] words, int[] costs) {
-    final int n = target.length();
-    // dp[i] := the minimum cost to construct target[0..i)
-    int[] dp = new int[n + 1];
-    Arrays.fill(dp, Integer.MAX_VALUE);
-    dp[0] = 0;
-
-    for (int i = 1; i <= n; ++i)
-      for (int j = 0; j < words.length; ++j)
-        if (i >= words[j].length() && //
-            target.substring(i - words[j].length(), i).equals(words[j]) &&
-            dp[i - words[j].length()] != Integer.MAX_VALUE)
-          dp[i] = Math.min(dp[i], dp[i - words[j].length()] + costs[j]);
-
-    return dp[n] == Integer.MAX_VALUE ? -1 : dp[n];
-  }
-}
diff --git a/solutions/3253. Construct String with Minimum Cost (Easy)/3253.py b/solutions/3253. Construct String with Minimum Cost (Easy)/3253.py
deleted file mode 100644
index 35ebe6beeed..00000000000
--- a/solutions/3253. Construct String with Minimum Cost (Easy)/3253.py	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution:
-  def minimumCost(self, target: str, words: list[str], costs: list[int]) -> int:
-    n = len(target)
-    # dp[i] := the minimum cost to construct target[0:i]
-    dp = [0] + [math.inf] * n
-
-    for i in range(1, n + 1):
-      for j, (word, cost) in enumerate(zip(words, costs)):
-        if (i >= len(word) and
-            target[i - len(word):i] == word and
-                dp[i - len(word)] != math.inf):
-          dp[i] = min(dp[i], dp[i - len(word)] + cost)
-
-    return dp[n] if dp[n] != math.inf else -1
diff --git a/solutions/3254. Find the Power of K-Size Subarrays I/3254.cpp b/solutions/3254. Find the Power of K-Size Subarrays I/3254.cpp
deleted file mode 100644
index 7ba9d096798..00000000000
--- a/solutions/3254. Find the Power of K-Size Subarrays I/3254.cpp	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution {
- public:
-  vector<int> resultsArray(vector<int>& nums, int k) {
-    vector<int> ans;
-    int start = 0;
-
-    for (int i = 0; i < nums.size(); ++i) {
-      if (i > 0 && nums[i] != nums[i - 1] + 1)
-        start = i;
-      if (i >= k - 1)
-        ans.push_back(i - start + 1 >= k ? nums[i] : -1);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3254. Find the Power of K-Size Subarrays I/3254.java b/solutions/3254. Find the Power of K-Size Subarrays I/3254.java
deleted file mode 100644
index 0b3ed895b38..00000000000
--- a/solutions/3254. Find the Power of K-Size Subarrays I/3254.java	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution {
-  public int[] resultsArray(int[] nums, int k) {
-    final int n = nums.length;
-    int[] ans = new int[n - k + 1];
-    int start = 0;
-
-    for (int i = 0; i < n; ++i) {
-      if (i > 0 && nums[i] != nums[i - 1] + 1)
-        start = i;
-      if (i >= k - 1)
-        ans[i - k + 1] = i - start + 1 >= k ? nums[i] : -1;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3254. Find the Power of K-Size Subarrays I/3254.py b/solutions/3254. Find the Power of K-Size Subarrays I/3254.py
deleted file mode 100644
index 4232734e509..00000000000
--- a/solutions/3254. Find the Power of K-Size Subarrays I/3254.py	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution:
-  def resultsArray(self, nums: list[int], k: int) -> list[int]:
-    ans = []
-    start = 0
-
-    for i, num in enumerate(nums):
-      if i > 0 and num != nums[i - 1] + 1:
-        start = i
-      if i >= k - 1:
-        ans.append(num if i - start + 1 >= k else -1)
-
-    return ans
diff --git a/solutions/3255. Find the Power of K-Size Subarrays II/3255.cpp b/solutions/3255. Find the Power of K-Size Subarrays II/3255.cpp
deleted file mode 100644
index 89a8d6ae50d..00000000000
--- a/solutions/3255. Find the Power of K-Size Subarrays II/3255.cpp	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
- public:
-  // Same as 3254. Find the Power of K-Size Subarrays I
-  vector<int> resultsArray(vector<int>& nums, int k) {
-    vector<int> ans;
-    int start = 0;
-
-    for (int i = 0; i < nums.size(); ++i) {
-      if (i > 0 && nums[i] != nums[i - 1] + 1)
-        start = i;
-      if (i >= k - 1)
-        ans.push_back(i - start + 1 >= k ? nums[i] : -1);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3255. Find the Power of K-Size Subarrays II/3255.java b/solutions/3255. Find the Power of K-Size Subarrays II/3255.java
deleted file mode 100644
index 207a5406b1f..00000000000
--- a/solutions/3255. Find the Power of K-Size Subarrays II/3255.java	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
-  // Same as 3254. Find the Power of K-Size Subarrays I
-  public int[] resultsArray(int[] nums, int k) {
-    final int n = nums.length;
-    int[] ans = new int[n - k + 1];
-    int start = 0;
-
-    for (int i = 0; i < n; ++i) {
-      if (i > 0 && nums[i] != nums[i - 1] + 1)
-        start = i;
-      if (i >= k - 1)
-        ans[i - k + 1] = i - start + 1 >= k ? nums[i] : -1;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3255. Find the Power of K-Size Subarrays II/3255.py b/solutions/3255. Find the Power of K-Size Subarrays II/3255.py
deleted file mode 100644
index b69fc2a5220..00000000000
--- a/solutions/3255. Find the Power of K-Size Subarrays II/3255.py	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution:
-  # Same as 3254. Find the Power of K-Size Subarrays I
-  def resultsArray(self, nums: list[int], k: int) -> list[int]:
-    ans = []
-    start = 0
-
-    for i, num in enumerate(nums):
-      if i > 0 and num != nums[i - 1] + 1:
-        start = i
-      if i >= k - 1:
-        ans.append(num if i - start + 1 >= k else -1)
-
-    return ans
diff --git a/solutions/3256. Maximum Value Sum by Placing Three Rooks I/3256.cpp b/solutions/3256. Maximum Value Sum by Placing Three Rooks I/3256.cpp
deleted file mode 100644
index 222011ff0c5..00000000000
--- a/solutions/3256. Maximum Value Sum by Placing Three Rooks I/3256.cpp	
+++ /dev/null
@@ -1,63 +0,0 @@
-class Solution {
- public:
-  long long maximumValueSum(vector<vector<int>>& board) {
-    const int m = board.size();
-    const int n = board[0].size();
-    long ans = LONG_MIN;
-    using T = tuple<long, int, int>;
-    vector<vector<T>> rows(m);  // [(val, i, j)]
-    vector<vector<T>> cols(n);  // [(val, i, j)]
-    set<T> rowSet;              // {(val, i, j)}
-    set<T> colSet;              // {(val, i, j)}
-    set<T> topNine;             // {(val, i, j)}
-
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j) {
-        rows[i].emplace_back(board[i][j], i, j);
-        cols[j].emplace_back(board[i][j], i, j);
-      }
-
-    auto getTop3 = [](vector<T>& row) -> vector<T> {
-      partial_sort(row.begin(),
-                   row.begin() + min(3, static_cast<int>(row.size())),
-                   row.end(), greater<>());
-      row.resize(min(3, (int)row.size()));
-      return row;
-    };
-
-    for (vector<T>& row : rows) {
-      row = getTop3(row);
-      rowSet.insert(row.begin(), row.end());
-    }
-
-    for (vector<T>& col : cols) {
-      col = getTop3(col);
-      colSet.insert(col.begin(), col.end());
-    }
-
-    set_intersection(rowSet.begin(), rowSet.end(), colSet.begin(), colSet.end(),
-                     inserter(topNine, topNine.begin()));
-
-    // At least 9 positions are required on the board to place 3 rooks such that
-    // none can attack another.
-    if (topNine.size() > 9) {
-      auto it = topNine.begin();
-      advance(it, topNine.size() - 9);
-      topNine.erase(topNine.begin(), it);
-    }
-
-    for (auto it1 = topNine.begin(); it1 != topNine.end(); ++it1)
-      for (auto it2 = next(it1); it2 != topNine.end(); ++it2)
-        for (auto it3 = next(it2); it3 != topNine.end(); ++it3) {
-          const auto [val1, i1, j1] = *it1;
-          const auto [val2, i2, j2] = *it2;
-          const auto [val3, i3, j3] = *it3;
-          if (i1 == i2 || i1 == i3 || i2 == i3 ||  //
-              j1 == j2 || j1 == j3 || j2 == j3)
-            continue;
-          ans = max(ans, val1 + val2 + val3);
-        }
-
-    return ans;
-  }
-};
diff --git a/solutions/3256. Maximum Value Sum by Placing Three Rooks I/3256.java b/solutions/3256. Maximum Value Sum by Placing Three Rooks I/3256.java
deleted file mode 100644
index f6162452028..00000000000
--- a/solutions/3256. Maximum Value Sum by Placing Three Rooks I/3256.java	
+++ /dev/null
@@ -1,60 +0,0 @@
-class Solution {
-  public long maximumValueSum(int[][] board) {
-    final int m = board.length;
-    final int n = board[0].length;
-    long ans = Long.MIN_VALUE;
-    List<int[]>[] rows = new ArrayList[m];
-    List<int[]>[] cols = new ArrayList[n];
-    Set<int[]> rowSet = new HashSet<>();
-    Set<int[]> colSet = new HashSet<>();
-    Set<int[]> boardSet = new HashSet<>();
-
-    for (int i = 0; i < m; ++i)
-      rows[i] = new ArrayList<>();
-
-    for (int j = 0; j < n; ++j)
-      cols[j] = new ArrayList<>();
-
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j) {
-        int[] cell = new int[] {board[i][j], i, j};
-        rows[i].add(cell);
-        cols[j].add(cell);
-      }
-
-    Comparator<int[]> comparator = Comparator.comparingInt(a -> - a[0]);
-
-    for (List<int[]> row : rows) {
-      row.sort(comparator);
-      rowSet.addAll(row.subList(0, Math.min(3, row.size())));
-    }
-
-    for (List<int[]> col : cols) {
-      col.sort(comparator);
-      colSet.addAll(col.subList(0, Math.min(3, col.size())));
-    }
-
-    boardSet.addAll(rowSet);
-    boardSet.retainAll(colSet);
-
-    // At least 9 positions are required on the board to place 3 rooks such that
-    // none can attack another.
-    List<int[]> topNine = new ArrayList<>(boardSet);
-    topNine.sort(comparator);
-    topNine = topNine.subList(0, Math.min(9, topNine.size()));
-
-    for (int i = 0; i < topNine.size(); ++i)
-      for (int j = i + 1; j < topNine.size(); ++j)
-        for (int k = j + 1; k < topNine.size(); ++k) {
-          int[] t1 = topNine.get(i);
-          int[] t2 = topNine.get(j);
-          int[] t3 = topNine.get(k);
-          if (t1[1] == t2[1] || t1[1] == t3[1] || t2[1] == t3[1] || //
-              t1[2] == t2[2] || t1[2] == t3[2] || t2[2] == t3[2])
-            continue;
-          ans = Math.max(ans, (long) t1[0] + t2[0] + t3[0]);
-        }
-
-    return ans;
-  }
-}
diff --git a/solutions/3256. Maximum Value Sum by Placing Three Rooks I/3256.py b/solutions/3256. Maximum Value Sum by Placing Three Rooks I/3256.py
deleted file mode 100644
index bd461ae980e..00000000000
--- a/solutions/3256. Maximum Value Sum by Placing Three Rooks I/3256.py	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution:
-  def maximumValueSum(self, board: list[list[int]]) -> int:
-    rows = [heapq.nlargest(3, [(val, i, j)
-            for j, val in enumerate(row)])
-            for i, row in enumerate(board)]
-    cols = [heapq.nlargest(3, [(val, i, j)
-            for i, val in enumerate(col)])
-            for j, col in enumerate(zip(*board))]
-    topNine = heapq.nlargest(9,
-                             set(itertools.chain(*rows)) &
-                             set(itertools.chain(*cols)))
-    return max(
-        (val1 + val2 + val3 for
-         (val1, i1, j1),
-         (val2, i2, j2),
-         (val3, i3, j3) in (itertools.combinations(topNine, 3))
-         if len({i1, i2, i3}) == 3 and len({j1, j2, j3}) == 3))
diff --git a/solutions/3257. Maximum Value Sum by Placing Three Rooks II/3257.cpp b/solutions/3257. Maximum Value Sum by Placing Three Rooks II/3257.cpp
deleted file mode 100644
index d073c8e9786..00000000000
--- a/solutions/3257. Maximum Value Sum by Placing Three Rooks II/3257.cpp	
+++ /dev/null
@@ -1,64 +0,0 @@
-class Solution {
- public:
-  // Same as 3256. Maximum Value Sum by Placing Three Rooks I
-  long long maximumValueSum(vector<vector<int>>& board) {
-    const int m = board.size();
-    const int n = board[0].size();
-    long ans = LONG_MIN;
-    using T = tuple<long, int, int>;
-    vector<vector<T>> rows(m);  // [(val, i, j)]
-    vector<vector<T>> cols(n);  // [(val, i, j)]
-    set<T> rowSet;              // {(val, i, j)}
-    set<T> colSet;              // {(val, i, j)}
-    set<T> topNine;             // {(val, i, j)}
-
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j) {
-        rows[i].emplace_back(board[i][j], i, j);
-        cols[j].emplace_back(board[i][j], i, j);
-      }
-
-    auto getTop3 = [](vector<T>& row) -> vector<T> {
-      partial_sort(row.begin(),
-                   row.begin() + min(3, static_cast<int>(row.size())),
-                   row.end(), greater<>());
-      row.resize(min(3, (int)row.size()));
-      return row;
-    };
-
-    for (vector<T>& row : rows) {
-      row = getTop3(row);
-      rowSet.insert(row.begin(), row.end());
-    }
-
-    for (vector<T>& col : cols) {
-      col = getTop3(col);
-      colSet.insert(col.begin(), col.end());
-    }
-
-    set_intersection(rowSet.begin(), rowSet.end(), colSet.begin(), colSet.end(),
-                     inserter(topNine, topNine.begin()));
-
-    // At least 9 positions are required on the board to place 3 rooks such that
-    // none can attack another.
-    if (topNine.size() > 9) {
-      auto it = topNine.begin();
-      advance(it, topNine.size() - 9);
-      topNine.erase(topNine.begin(), it);
-    }
-
-    for (auto it1 = topNine.begin(); it1 != topNine.end(); ++it1)
-      for (auto it2 = next(it1); it2 != topNine.end(); ++it2)
-        for (auto it3 = next(it2); it3 != topNine.end(); ++it3) {
-          const auto [val1, i1, j1] = *it1;
-          const auto [val2, i2, j2] = *it2;
-          const auto [val3, i3, j3] = *it3;
-          if (i1 == i2 || i1 == i3 || i2 == i3 ||  //
-              j1 == j2 || j1 == j3 || j2 == j3)
-            continue;
-          ans = max(ans, val1 + val2 + val3);
-        }
-
-    return ans;
-  }
-};
diff --git a/solutions/3257. Maximum Value Sum by Placing Three Rooks II/3257.java b/solutions/3257. Maximum Value Sum by Placing Three Rooks II/3257.java
deleted file mode 100644
index b5bb8b5f2f7..00000000000
--- a/solutions/3257. Maximum Value Sum by Placing Three Rooks II/3257.java	
+++ /dev/null
@@ -1,61 +0,0 @@
-class Solution {
-  // Same as 3256. Maximum Value Sum by Placing Three Rooks I
-  public long maximumValueSum(int[][] board) {
-    final int m = board.length;
-    final int n = board[0].length;
-    long ans = Long.MIN_VALUE;
-    List<int[]>[] rows = new ArrayList[m];
-    List<int[]>[] cols = new ArrayList[n];
-    Set<int[]> rowSet = new HashSet<>();
-    Set<int[]> colSet = new HashSet<>();
-    Set<int[]> boardSet = new HashSet<>();
-
-    for (int i = 0; i < m; ++i)
-      rows[i] = new ArrayList<>();
-
-    for (int j = 0; j < n; ++j)
-      cols[j] = new ArrayList<>();
-
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j) {
-        int[] cell = new int[] {board[i][j], i, j};
-        rows[i].add(cell);
-        cols[j].add(cell);
-      }
-
-    Comparator<int[]> comparator = Comparator.comparingInt(a -> - a[0]);
-
-    for (List<int[]> row : rows) {
-      row.sort(comparator);
-      rowSet.addAll(row.subList(0, Math.min(3, row.size())));
-    }
-
-    for (List<int[]> col : cols) {
-      col.sort(comparator);
-      colSet.addAll(col.subList(0, Math.min(3, col.size())));
-    }
-
-    boardSet.addAll(rowSet);
-    boardSet.retainAll(colSet);
-
-    // At least 9 positions are required on the board to place 3 rooks such that
-    // none can attack another.
-    List<int[]> topNine = new ArrayList<>(boardSet);
-    topNine.sort(comparator);
-    topNine = topNine.subList(0, Math.min(9, topNine.size()));
-
-    for (int i = 0; i < topNine.size(); ++i)
-      for (int j = i + 1; j < topNine.size(); ++j)
-        for (int k = j + 1; k < topNine.size(); ++k) {
-          int[] t1 = topNine.get(i);
-          int[] t2 = topNine.get(j);
-          int[] t3 = topNine.get(k);
-          if (t1[1] == t2[1] || t1[1] == t3[1] || t2[1] == t3[1] || //
-              t1[2] == t2[2] || t1[2] == t3[2] || t2[2] == t3[2])
-            continue;
-          ans = Math.max(ans, (long) t1[0] + t2[0] + t3[0]);
-        }
-
-    return ans;
-  }
-}
diff --git a/solutions/3257. Maximum Value Sum by Placing Three Rooks II/3257.py b/solutions/3257. Maximum Value Sum by Placing Three Rooks II/3257.py
deleted file mode 100644
index 95db4d94075..00000000000
--- a/solutions/3257. Maximum Value Sum by Placing Three Rooks II/3257.py	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution:
-  # Same as 3256. Maximum Value Sum by Placing Three Rooks I
-  def maximumValueSum(self, board: list[list[int]]) -> int:
-    rows = [heapq.nlargest(3, [(val, i, j)
-            for j, val in enumerate(row)])
-            for i, row in enumerate(board)]
-    cols = [heapq.nlargest(3, [(val, i, j)
-            for i, val in enumerate(col)])
-            for j, col in enumerate(zip(*board))]
-    topNine = heapq.nlargest(9,
-                             set(itertools.chain(*rows)) &
-                             set(itertools.chain(*cols)))
-    return max(
-        (val1 + val2 + val3 for
-         (val1, i1, j1),
-         (val2, i2, j2),
-         (val3, i3, j3) in (itertools.combinations(topNine, 3))
-         if len({i1, i2, i3}) == 3 and len({j1, j2, j3}) == 3))
diff --git a/solutions/3258. Count Substrings That Satisfy K-Constraint I/3258.cpp b/solutions/3258. Count Substrings That Satisfy K-Constraint I/3258.cpp
deleted file mode 100644
index 29e0b181c2e..00000000000
--- a/solutions/3258. Count Substrings That Satisfy K-Constraint I/3258.cpp	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution {
- public:
-  int countKConstraintSubstrings(string s, int k) {
-    int ans = 0;
-    vector<int> count(2);
-
-    for (int l = 0, r = 0; r < s.length(); ++r) {
-      ++count[s[r] - '0'];
-      while (count[0] > k && count[1] > k)
-        --count[s[l++] - '0'];
-      ans += r - l + 1;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3258. Count Substrings That Satisfy K-Constraint I/3258.java b/solutions/3258. Count Substrings That Satisfy K-Constraint I/3258.java
deleted file mode 100644
index b360e422862..00000000000
--- a/solutions/3258. Count Substrings That Satisfy K-Constraint I/3258.java	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution {
-  public int countKConstraintSubstrings(String s, int k) {
-    int ans = 0;
-    int[] count = new int[2];
-
-    int l = 0;
-    for (int r = 0; r < s.length(); ++r) {
-      ++count[s.charAt(r) - '0'];
-      while (count[0] > k && count[1] > k)
-        --count[s.charAt(l++) - '0'];
-      ans += r - l + 1;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3258. Count Substrings That Satisfy K-Constraint I/3258.py b/solutions/3258. Count Substrings That Satisfy K-Constraint I/3258.py
deleted file mode 100644
index 3f72d0960b7..00000000000
--- a/solutions/3258. Count Substrings That Satisfy K-Constraint I/3258.py	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution:
-  def countKConstraintSubstrings(self, s: str, k: int) -> int:
-    ans = 0
-    count = [0, 0]
-
-    l = 0
-    for r, c in enumerate(s):
-      count[int(c)] += 1
-      while min(count) > k:
-        count[int(s[l])] -= 1
-        l += 1
-      ans += r - l + 1
-
-    return ans
diff --git a/solutions/3259. Maximum Energy Boost From Two Drinks/3259.cpp b/solutions/3259. Maximum Energy Boost From Two Drinks/3259.cpp
deleted file mode 100644
index 4188d7c0a8c..00000000000
--- a/solutions/3259. Maximum Energy Boost From Two Drinks/3259.cpp	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
- public:
-  long long maxEnergyBoost(vector<int>& energyDrinkA,
-                           vector<int>& energyDrinkB) {
-    long dpA = 0;  // the maximum energy boost if the last drink is A
-    long dpB = 0;  // the maximum energy boost if the last drink is B
-
-    for (int i = 0; i < energyDrinkA.size(); ++i) {
-      const long newDpA = max(dpB, dpA + energyDrinkA[i]);
-      const long newDpB = max(dpA, dpB + energyDrinkB[i]);
-      dpA = newDpA;
-      dpB = newDpB;
-    }
-
-    return max(dpA, dpB);
-  }
-};
diff --git a/solutions/3259. Maximum Energy Boost From Two Drinks/3259.java b/solutions/3259. Maximum Energy Boost From Two Drinks/3259.java
deleted file mode 100644
index 2abd110fc06..00000000000
--- a/solutions/3259. Maximum Energy Boost From Two Drinks/3259.java	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution {
-  public long maxEnergyBoost(int[] energyDrinkA, int[] energyDrinkB) {
-    long dpA = 0; // the maximum energy boost if the last drink is A
-    long dpB = 0; // the maximum energy boost if the last drink is B
-
-    for (int i = 0; i < energyDrinkA.length; ++i) {
-      final long newDpA = Math.max(dpB, dpA + energyDrinkA[i]);
-      final long newDpB = Math.max(dpA, dpB + energyDrinkB[i]);
-      dpA = newDpA;
-      dpB = newDpB;
-    }
-
-    return Math.max(dpA, dpB);
-  }
-}
diff --git a/solutions/3259. Maximum Energy Boost From Two Drinks/3259.py b/solutions/3259. Maximum Energy Boost From Two Drinks/3259.py
deleted file mode 100644
index d6fecb629d0..00000000000
--- a/solutions/3259. Maximum Energy Boost From Two Drinks/3259.py	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution:
-  def maxEnergyBoost(
-      self,
-      energyDrinkA: list[int],
-      energyDrinkB: list[int]
-  ) -> int:
-    dpA = 0  # the maximum energy boost if the last drink is A
-    dpB = 0  # the maximum energy boost if the last drink is B
-
-    for a, b in zip(energyDrinkA, energyDrinkB):
-      dpA, dpB = max(dpB, dpA + a), max(dpA, dpB + b)
-
-    return max(dpA, dpB)
diff --git a/solutions/3260. Find the Largest Palindrome Divisible by K/3260.cpp b/solutions/3260. Find the Largest Palindrome Divisible by K/3260.cpp
deleted file mode 100644
index 823aced9dcc..00000000000
--- a/solutions/3260. Find the Largest Palindrome Divisible by K/3260.cpp	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
- public:
-  string largestPalindrome(int n, int k) {
-    switch (k) {
-      case 1:
-        return string(n, '9');
-      case 2:
-        return n <= 2 ? string(n, '8') : "8" + string(n - 2, '9') + "8";
-      case 3:
-      case 9:
-        return string(n, '9');
-      case 4:
-        return n <= 4 ? string(n, '8') : "88" + string(n - 4, '9') + "88";
-      case 5:
-        return n <= 2 ? string(n, '5') : "5" + string(n - 2, '9') + "5";
-      case 6:
-        if (n <= 2) {
-          return string(n, '6');
-        } else if (n % 2 == 1) {
-          const int l = n / 2 - 1;
-          return "8" + string(l, '9') + "8" + string(l, '9') + "8";
-        } else {
-          const int l = n / 2 - 2;
-          return "8" + string(l, '9') + "77" + string(l, '9') + "8";
-        }
-      case 8:
-        return n <= 6 ? string(n, '8') : "888" + string(n - 6, '9') + "888";
-      default:
-        const string middle[] = {"",          "7",          "77",
-                                 "959",       "9779",       "99799",
-                                 "999999",    "9994999",    "99944999",
-                                 "999969999", "9999449999", "99999499999"};
-        const int q = n / 12;
-        const int r = n % 12;
-        return string(q * 6, '9') + middle[r] + string(q * 6, '9');
-    }
-  }
-};
diff --git a/solutions/3260. Find the Largest Palindrome Divisible by K/3260.java b/solutions/3260. Find the Largest Palindrome Divisible by K/3260.java
deleted file mode 100644
index f1e8cb5560e..00000000000
--- a/solutions/3260. Find the Largest Palindrome Divisible by K/3260.java	
+++ /dev/null
@@ -1,67 +0,0 @@
-class Solution {
-  public String largestPalindrome(int n, int k) {
-    StringBuilder sb = new StringBuilder();
-
-    switch (k) {
-      case 1:
-        return "9".repeat(n);
-      case 2:
-        return n <= 2 ? "8".repeat(n)
-                      : sb.append("8") //
-                            .append("9".repeat(n - 2))
-                            .append("8")
-                            .toString();
-      case 3:
-      case 9:
-        return "9".repeat(n);
-      case 4:
-        return n <= 4 ? "8".repeat(n)
-                      : sb.append("88") //
-                            .append("9".repeat(n - 4))
-                            .append("88")
-                            .toString();
-      case 5:
-        return n <= 2 ? "5".repeat(n)
-                      : sb.append("5") //
-                            .append("9".repeat(n - 2))
-                            .append("5")
-                            .toString();
-      case 6:
-        if (n <= 2) {
-          return "6".repeat(n);
-        } else if (n % 2 == 1) {
-          final int l = n / 2 - 1;
-          return sb.append("8")
-              .append("9".repeat(l))
-              .append("8")
-              .append("9".repeat(l))
-              .append("8")
-              .toString();
-        } else {
-          final int l = n / 2 - 2;
-          return sb.append("8")
-              .append("9".repeat(l))
-              .append("77")
-              .append("9".repeat(l))
-              .append("8")
-              .toString();
-        }
-      case 8:
-        return n <= 6 ? "8".repeat(n)
-                      : sb.append("888") //
-                            .append("9".repeat(n - 6))
-                            .append("888")
-                            .toString();
-      default:
-        String[] middle = {"",         "7",         "77",         "959",
-                           "9779",     "99799",     "999999",     "9994999",
-                           "99944999", "999969999", "9999449999", "99999499999"};
-        final int q = n / 12;
-        final int r = n % 12;
-        return sb.append("999999".repeat(q))
-            .append(middle[r])
-            .append("999999".repeat(q))
-            .toString();
-    }
-  }
-}
diff --git a/solutions/3260. Find the Largest Palindrome Divisible by K/3260.py b/solutions/3260. Find the Largest Palindrome Divisible by K/3260.py
deleted file mode 100644
index a4c7c2c29d0..00000000000
--- a/solutions/3260. Find the Largest Palindrome Divisible by K/3260.py	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution:
-  def largestPalindrome(self, n: int, k: int) -> str:
-    match k:
-      case 1:
-        return '9' * n
-      case 2:
-        return '8' * n if n <= 2 else '8' + '9' * (n - 2) + '8'
-      case 3 | 9:
-        return '9' * n
-      case 4:
-        return '8' * n if n <= 4 else '88' + '9' * (n - 4) + '88'
-      case 5:
-        return '5' * n if n <= 2 else '5' + '9' * (n - 2) + '5'
-      case 6:
-        if n <= 2:
-          return '6' * n
-        elif n % 2 == 1:
-          l = n // 2 - 1
-          return '8' + '9' * l + '8' + '9' * l + '8'
-        else:
-          l = n // 2 - 2
-          return '8' + '9' * l + '77' + '9' * l + '8'
-      case 8:
-        return '8' * n if n <= 6 else '888' + '9' * (n - 6) + '888'
-      case _:
-        middle = {
-            0: '', 1: '7', 2: '77', 3: '959', 4: '9779', 5: '99799',
-            6: '999999', 7: '9994999', 8: '99944999', 9: '999969999',
-            10: '9999449999', 11: '99999499999'
-        }
-        q, r = divmod(n, 12)
-        return '999999' * q + middle[r] + '999999' * q
diff --git a/solutions/3261. Count Substrings That Satisfy K-Constraint II/3261.cpp b/solutions/3261. Count Substrings That Satisfy K-Constraint II/3261.cpp
deleted file mode 100644
index 2371ec17136..00000000000
--- a/solutions/3261. Count Substrings That Satisfy K-Constraint II/3261.cpp	
+++ /dev/null
@@ -1,62 +0,0 @@
-class Solution {
- public:
-  vector<long long> countKConstraintSubstrings(string s, int k,
-                                               vector<vector<int>>& queries) {
-    const int n = s.size();
-    vector<long long> ans;
-    vector<int> count(2);
-    // leftToRight[l] : = the maximum right index r s.t.s[l..r] is valid
-    vector<int> leftToRight(n);
-    // rightToLeft[r] := the minimum left index l s.t. s[l..r] is valid
-    vector<int> rightToLeft(n);
-    // prefix[i] := the number of valid substrings ending in [0..i - 1].
-    vector<long> prefix{0};
-
-    for (int l = 0, r = 0; r < n; ++r) {
-      ++count[s[r] - '0'];
-      while (count[0] > k && count[1] > k)
-        --count[s[l++] - '0'];
-      rightToLeft[r] = l;
-    }
-
-    count = vector<int>(2);
-
-    for (int l = n - 1, r = n - 1; l >= 0; --l) {
-      ++count[s[l] - '0'];
-      while (count[0] > k && count[1] > k)
-        --count[s[r--] - '0'];
-      leftToRight[l] = r;
-    }
-
-    for (int r = 0; r < n; ++r)
-      prefix.push_back(prefix.back() + r - rightToLeft[r] + 1);
-
-    for (const vector<int>& query : queries) {
-      const int l = query[0];
-      const int r = query[1];
-      long numValidSubstrings = 0;
-      if (r > leftToRight[l]) {
-        // If r is beyond leftToRight[l], compute the number of valid substrings
-        // from l to leftToRight[l] and add the number of valid substrings
-        // ending in [leftToRight[l] + 1..r].
-        //
-        // prefix[r + 1] := the number of valid substrings ending in [0..r].
-        // prefix[leftToRight[l] + 1] := the number of valid substrings ending
-        // in [0..leftToRight].
-        // => prefix[r + 1] - prefix[leftToRight[l] + 1] := the number of valid
-        // substrings ending in [leftToRight[l] + 1..r].
-        const int sz = leftToRight[l] - l + 1;
-        numValidSubstrings =
-            (sz * (sz + 1)) / 2 + (prefix[r + 1] - prefix[leftToRight[l] + 1]);
-      } else {
-        // If r is within the range of leftToRight[l], compute the number of
-        // valid substrings directly from l to r.
-        const int sz = r - l + 1;
-        numValidSubstrings = (sz * static_cast<long>(sz + 1)) / 2;
-      }
-      ans.push_back(numValidSubstrings);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3261. Count Substrings That Satisfy K-Constraint II/3261.java b/solutions/3261. Count Substrings That Satisfy K-Constraint II/3261.java
deleted file mode 100644
index 51db9dbd433..00000000000
--- a/solutions/3261. Count Substrings That Satisfy K-Constraint II/3261.java	
+++ /dev/null
@@ -1,57 +0,0 @@
-class Solution {
-  public long[] countKConstraintSubstrings(String s, int k, int[][] queries) {
-    final int n = s.length();
-    long[] ans = new long[queries.length];
-    int[] count = new int[2];
-    // leftToRight[l] : = the maximum right index r s.t.s[l..r] is valid
-    int[] leftToRight = new int[n];
-    // rightToLeft[r] := the minimum left index l s.t. s[l..r] is valid
-    int[] rightToLeft = new int[n];
-    // prefix[i] := the number of valid substrings ending in [0..i - 1].
-    long[] prefix = new long[n + 1];
-
-    for (int l = 0, r = 0; r < n; ++r) {
-      ++count[s.charAt(r) - '0'];
-      while (count[0] > k && count[1] > k)
-        --count[s.charAt(l++) - '0'];
-      rightToLeft[r] = l;
-    }
-
-    Arrays.fill(count, 0);
-
-    for (int l = n - 1, r = n - 1; l >= 0; --l) {
-      ++count[s.charAt(l) - '0'];
-      while (count[0] > k && count[1] > k)
-        --count[s.charAt(r--) - '0'];
-      leftToRight[l] = r;
-    }
-
-    for (int r = 0; r < n; ++r)
-      prefix[r + 1] = prefix[r] + r - rightToLeft[r] + 1;
-
-    for (int i = 0; i < queries.length; ++i) {
-      final int l = queries[i][0];
-      final int r = queries[i][1];
-      long numValidSubstrings = 0;
-      if (r > leftToRight[l]) {
-        // If r is beyond leftToRight[l], compute the number of valid substrings
-        // from l to leftToRight[l] and add the number of valid substrings
-        // ending in [leftToRight[l] + 1..r].
-        //
-        // prefix[r + 1] := the number of valid substrings ending in [0..r].
-        // prefix[leftToRight[l] + 1] := the number of valid substrings ending
-        // in [0..leftToRight].
-        // => prefix[r + 1] - prefix[leftToRight[l] + 1] := the number of valid
-        // substrings ending in [leftToRight[l] + 1..r].
-        final int sz = leftToRight[l] - l + 1;
-        numValidSubstrings = (sz * (sz + 1)) / 2 + (prefix[r + 1] - prefix[leftToRight[l] + 1]);
-      } else {
-        final int sz = r - l + 1;
-        numValidSubstrings = (sz * (long) (sz + 1)) / 2;
-      }
-      ans[i] = numValidSubstrings;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3261. Count Substrings That Satisfy K-Constraint II/3261.py b/solutions/3261. Count Substrings That Satisfy K-Constraint II/3261.py
deleted file mode 100644
index e72f174d44f..00000000000
--- a/solutions/3261. Count Substrings That Satisfy K-Constraint II/3261.py	
+++ /dev/null
@@ -1,59 +0,0 @@
-class Solution:
-  def countKConstraintSubstrings(
-      self,
-      s: str,
-      k: int,
-      queries: list[list[int]]
-  ) -> list[int]:
-    n = len(s)
-    ans = []
-    count = [0, 0]
-    # leftToRight[l] := the maximum right index r s.t. s[l..r] is valid
-    leftToRight = [0] * n
-    # rightToLeft[r] := the minimum left index l s.t. s[l..r] is valid
-    rightToLeft = [0] * n
-
-    l = 0
-    for r in range(n):
-      count[int(s[r])] += 1
-      while min(count) > k:
-        count[int(s[l])] -= 1
-        l += 1
-      rightToLeft[r] = l
-
-    count = [0, 0]
-    r = n - 1
-    for l in reversed(range(n)):
-      count[int(s[l])] += 1
-      while min(count) > k:
-        count[int(s[r])] -= 1
-        r -= 1
-      leftToRight[l] = r
-
-    # prefix[i] := the number of valid substrings ending in [0..i - 1].
-    prefix = list(itertools.accumulate((r - l + 1
-                                       for r, l in enumerate(rightToLeft)),
-                                       initial=0))
-
-    for l, r in queries:
-      if r > leftToRight[l]:
-        # If r is beyond leftToRight[l], compute the number of valid substrings
-        # from l to leftToRight[l] and add the number of valid substrings
-        # ending in [leftToRight[l] + 1..r].
-        #
-        # prefix[r + 1] := the number of valid substrings ending in [0..r].
-        # prefix[leftToRight[l] + 1] := the number of valid substrings ending
-        # in [0..leftToRight].
-        # => prefix[r + 1] - prefix[leftToRight[l] + 1] := the number of valid
-        # substrings ending in [leftToRight[l] + 1..r].
-        sz = leftToRight[l] - l + 1
-        numValidSubstrings = sz * (sz + 1) // 2 + (
-            prefix[r + 1] - prefix[leftToRight[l] + 1])
-      else:
-        # If r is within the range of leftToRight[l], compute the number of
-        # valid substrings directly from l to r.
-        sz = r - l + 1
-        numValidSubstrings = sz * (sz + 1) // 2
-      ans.append(numValidSubstrings)
-
-    return ans
diff --git a/solutions/3262. Find Overlapping Shifts/3262.sql b/solutions/3262. Find Overlapping Shifts/3262.sql
deleted file mode 100644
index b97b736d087..00000000000
--- a/solutions/3262. Find Overlapping Shifts/3262.sql	
+++ /dev/null
@@ -1,11 +0,0 @@
-SELECT
-  Shift1.employee_id,
-  COUNT(*) AS overlapping_shifts
-FROM EmployeeShifts AS Shift1
-INNER JOIN EmployeeShifts AS Shift2
-  USING (employee_id)
-WHERE
-  Shift1.start_time < Shift2.start_time
-  AND Shift2.start_time < Shift1.end_time
-GROUP BY 1
-ORDER BY 1;
diff --git a/solutions/3263. Convert Doubly Linked List to Array I/3263.cpp b/solutions/3263. Convert Doubly Linked List to Array I/3263.cpp
deleted file mode 100644
index b13c212fed0..00000000000
--- a/solutions/3263. Convert Doubly Linked List to Array I/3263.cpp	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
- public:
-  vector<int> toArray(Node* head) {
-    vector<int> ans;
-    Node* curr = head;
-
-    while (curr != nullptr) {
-      ans.push_back(curr->val);
-      curr = curr->next;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3263. Convert Doubly Linked List to Array I/3263.java b/solutions/3263. Convert Doubly Linked List to Array I/3263.java
deleted file mode 100644
index 6503cbb5efb..00000000000
--- a/solutions/3263. Convert Doubly Linked List to Array I/3263.java	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution {
-  public int[] toArray(Node head) {
-    List<Integer> ans = new ArrayList<>();
-    Node curr = head;
-
-    while (curr != null) {
-      ans.add(curr.val);
-      curr = curr.next;
-    }
-
-    return ans.stream().mapToInt(Integer::intValue).toArray();
-  }
-}
diff --git a/solutions/3263. Convert Doubly Linked List to Array I/3263.py b/solutions/3263. Convert Doubly Linked List to Array I/3263.py
deleted file mode 100644
index 3a2a819231e..00000000000
--- a/solutions/3263. Convert Doubly Linked List to Array I/3263.py	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution:
-  def toArray(self, head: 'Optional[Node]') -> list[int]:
-    ans = []
-    curr = head
-
-    while curr:
-      ans.append(curr.val)
-      curr = curr.next
-
-    return ans
diff --git a/solutions/3264. Final Array State After K Multiplication Operations I/3264.cpp b/solutions/3264. Final Array State After K Multiplication Operations I/3264.cpp
deleted file mode 100644
index e9600b81675..00000000000
--- a/solutions/3264. Final Array State After K Multiplication Operations I/3264.cpp	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
- public:
-  vector<int> getFinalState(vector<int>& nums, int k, int multiplier) {
-    vector<int> ans(nums.size());
-    using P = pair<int, int>;  // (nums[i], i)
-    priority_queue<P, vector<P>, greater<>> minHeap;
-
-    for (int i = 0; i < nums.size(); ++i)
-      minHeap.emplace(nums[i], i);
-
-    while (k-- > 0) {
-      const auto [num, i] = minHeap.top();
-      minHeap.pop();
-      minHeap.emplace(num * multiplier, i);
-    }
-
-    while (!minHeap.empty()) {
-      const auto [num, i] = minHeap.top();
-      minHeap.pop();
-      ans[i] = num;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3264. Final Array State After K Multiplication Operations I/3264.java b/solutions/3264. Final Array State After K Multiplication Operations I/3264.java
deleted file mode 100644
index 0a34b9bf779..00000000000
--- a/solutions/3264. Final Array State After K Multiplication Operations I/3264.java	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution {
-  public int[] getFinalState(int[] nums, int k, int multiplier) {
-    int[] ans = new int[nums.length];
-    // (nums[i], i)
-    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>(
-        new PriorityQueue<>(Comparator.comparingInt(Pair<Integer, Integer>::getKey)
-                                .thenComparingInt(Pair<Integer, Integer>::getValue)));
-
-    for (int i = 0; i < nums.length; ++i)
-      minHeap.offer(new Pair<>(nums[i], i));
-
-    while (k-- > 0) {
-      final int num = minHeap.peek().getKey();
-      final int i = minHeap.poll().getValue();
-      minHeap.offer(new Pair<>(num * multiplier, i));
-    }
-
-    while (!minHeap.isEmpty()) {
-      final int num = minHeap.peek().getKey();
-      final int i = minHeap.poll().getValue();
-      ans[i] = num;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3264. Final Array State After K Multiplication Operations I/3264.py b/solutions/3264. Final Array State After K Multiplication Operations I/3264.py
deleted file mode 100644
index 96a7b668ed7..00000000000
--- a/solutions/3264. Final Array State After K Multiplication Operations I/3264.py	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution:
-  def getFinalState(
-      self,
-      nums: list[int],
-      k: int,
-      multiplier: int
-  ) -> list[int]:
-    ans = [0] * len(nums)
-    minHeap = [(num, i) for i, num in enumerate(nums)]
-    heapq.heapify(minHeap)
-
-    for _ in range(k):
-      num, i = heapq.heappop(minHeap)
-      heapq.heappush(minHeap, (num * multiplier, i))
-
-    for num, i in minHeap:
-      ans[i] = num
-
-    return ans
diff --git a/solutions/3265. Count Almost Equal Pairs I/3265.cpp b/solutions/3265. Count Almost Equal Pairs I/3265.cpp
deleted file mode 100644
index bc8b14654f5..00000000000
--- a/solutions/3265. Count Almost Equal Pairs I/3265.cpp	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution {
- public:
-  int countPairs(vector<int>& nums) {
-    int ans = 0;
-    unordered_map<int, int> count;
-    const int maxLen = to_string(ranges::max(nums)).length();
-
-    for (const int num : nums) {
-      const string digits =
-          string(maxLen - to_string(num).length(), '0') + to_string(num);
-      for (const int swap : getSwaps(digits))
-        ans += count[swap];
-      ++count[num];
-    }
-
-    return ans;
-  }
-
- private:
-  // Returns all possible numbers after 1 swap.
-  unordered_set<int> getSwaps(const string& digits) {
-    const int n = digits.length();
-    unordered_set<int> swaps{{stoi(digits)}};
-
-    for (int i = 0; i < n; ++i)
-      for (int j = i + 1; j < n; ++j) {
-        string newDigits = digits;
-        swap(newDigits[i], newDigits[j]);
-        swaps.insert(stoi(newDigits));
-      }
-
-    return swaps;
-  }
-};
diff --git a/solutions/3265. Count Almost Equal Pairs I/3265.java b/solutions/3265. Count Almost Equal Pairs I/3265.java
deleted file mode 100644
index 19d3337cc01..00000000000
--- a/solutions/3265. Count Almost Equal Pairs I/3265.java	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution {
-  public int countPairs(int[] nums) {
-    int ans = 0;
-    Map<Integer, Integer> count = new HashMap<>();
-    final int maxLen = String.valueOf(Arrays.stream(nums).max().getAsInt()).length();
-
-    for (final int num : nums) {
-      final String digits = String.format("%0" + maxLen + "d", num);
-      for (final int swap : getSwaps(digits))
-        ans += count.getOrDefault(swap, 0);
-      count.merge(num, 1, Integer::sum);
-    }
-
-    return ans;
-  }
-
-  // Returns all possible numbers after 1 swap.
-  private Set<Integer> getSwaps(final String digits) {
-    final int n = digits.length();
-    Set<Integer> swaps = new HashSet<>(Arrays.asList(Integer.parseInt(digits)));
-
-    for (int i = 0; i < n; ++i)
-      for (int j = i + 1; j < n; ++j) {
-        char[] newDigits = digits.toCharArray();
-        char temp = newDigits[i];
-        newDigits[i] = newDigits[j];
-        newDigits[j] = temp;
-        swaps.add(Integer.parseInt(new String(newDigits)));
-      }
-
-    return swaps;
-  }
-}
diff --git a/solutions/3265. Count Almost Equal Pairs I/3265.py b/solutions/3265. Count Almost Equal Pairs I/3265.py
deleted file mode 100644
index 1aa9fb6617b..00000000000
--- a/solutions/3265. Count Almost Equal Pairs I/3265.py	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution:
-  def countPairs(self, nums: list[int]) -> int:
-    ans = 0
-    count = collections.Counter()
-    maxLen = len(str(max(nums)))
-
-    for num in nums:
-      digits = list(str(num).zfill(maxLen))
-      for swap in self._getSwaps(digits):
-        ans += count[swap]
-      count[num] += 1
-
-    return ans
-
-  def _getSwaps(self, digits: str) -> set[int]:
-    """Returns all possible numbers after 1 swap."""
-    n = len(digits)
-    swaps = set([int(''.join(digits))])
-
-    for i, j in itertools.combinations(range(n), 2):
-      newDigits = digits[:]
-      newDigits[i], newDigits[j] = newDigits[j], newDigits[i]
-      swaps.add(int(''.join(newDigits)))
-
-    return swaps
diff --git a/solutions/3266. Final Array State After K Multiplication Operations II/3266.cpp b/solutions/3266. Final Array State After K Multiplication Operations II/3266.cpp
deleted file mode 100644
index 8748451d825..00000000000
--- a/solutions/3266. Final Array State After K Multiplication Operations II/3266.cpp	
+++ /dev/null
@@ -1,62 +0,0 @@
-class Solution {
- public:
-  vector<int> getFinalState(vector<int>& nums, int k, int multiplier) {
-    if (multiplier == 1)
-      return nums;
-
-    const int n = nums.size();
-    const int maxNum = ranges::max(nums);
-    vector<int> ans(n);
-    using P = pair<int, int>;  // (nums[i], i)
-    priority_queue<P, vector<P>, greater<>> minHeap;
-
-    for (int i = 0; i < n; ++i)
-      minHeap.emplace(nums[i], i);
-
-    // Keep multiplying the minimum number as close as possible to the maximum
-    // number in the array. After that, stop multiplying the minimum number
-    // because it will be greater than the maximum number in the array and break
-    // the circularity.
-    while (k > 0 &&
-           static_cast<long>(minHeap.top().first) * multiplier <= maxNum) {
-      const auto [num, i] = minHeap.top();
-      minHeap.pop();
-      minHeap.emplace(num * multiplier, i);
-      --k;
-    }
-
-    vector<pair<int, int>> sortedIndexedNums;
-    while (!minHeap.empty())
-      sortedIndexedNums.push_back(minHeap.top()), minHeap.pop();
-
-    const int multipliesPerNum = k / n;
-    const int remainingK = k % n;
-
-    // Evenly distribute the remaining multiplications to each number by using
-    // fast exponentiation.
-    for (auto& [num, _] : sortedIndexedNums)
-      num = (num * modPow(multiplier, multipliesPerNum)) % kMod;
-
-    // Distribute the remaining multiplications to the minimum `remainingK`
-    // numbers.
-    for (int i = 0; i < remainingK; ++i)
-      sortedIndexedNums[i].first =
-          (static_cast<long>(sortedIndexedNums[i].first) * multiplier % kMod);
-
-    for (const auto& [num, i] : sortedIndexedNums)
-      ans[i] = num;
-
-    return ans;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x, n - 1) % kMod;
-    return modPow(x * x % kMod, n / 2);
-  }
-};
diff --git a/solutions/3266. Final Array State After K Multiplication Operations II/3266.java b/solutions/3266. Final Array State After K Multiplication Operations II/3266.java
deleted file mode 100644
index c23118c32cb..00000000000
--- a/solutions/3266. Final Array State After K Multiplication Operations II/3266.java	
+++ /dev/null
@@ -1,63 +0,0 @@
-class Solution {
-  public int[] getFinalState(int[] nums, int k, int multiplier) {
-    if (multiplier == 1)
-      return nums;
-
-    final int n = nums.length;
-    final int maxNum = Arrays.stream(nums).max().getAsInt();
-    int[] ans = new int[n];
-    // (nums[i], i)
-    Queue<int[]> minHeap = new PriorityQueue<>(
-        Comparator.comparingInt((int[] a) -> a[0]).thenComparingInt((int[] a) -> a[1]));
-
-    for (int i = 0; i < n; ++i)
-      minHeap.offer(new int[] {nums[i], i});
-
-    // Keep multiplying the minimum number as close as possible to the maximum
-    // number in the array. After that, stop multiplying the minimum number
-    // because it will be greater than the maximum number in the array and break
-    // the circularity.
-    while (k > 0 && (long) minHeap.peek()[0] * multiplier <= maxNum) {
-      final int num = minHeap.peek()[0];
-      final int i = minHeap.poll()[1];
-      minHeap.offer(new int[] {num * multiplier, i});
-      --k;
-    }
-
-    List<int[]> sortedIndexedNums = new ArrayList<>(minHeap);
-    Collections.sort(sortedIndexedNums,
-                     Comparator.comparingInt((int[] sortedIndexedNum) -> sortedIndexedNum[0])
-                         .thenComparingInt((int[] sortedIndexedNum) -> sortedIndexedNum[1]));
-
-    final int multipliesPerNum = k / n;
-    final int remainingK = k % n;
-
-    // Evenly distribute the remaining multiplications to each number by using
-    // fast exponentiation.
-    for (int[] indexedNums : sortedIndexedNums)
-      indexedNums[0] = (int) ((long) indexedNums[0] * modPow(multiplier, multipliesPerNum) % MOD);
-
-    // Distribute the remaining multiplications to the minimum `remainingK`
-    // numbers.
-    for (int i = 0; i < remainingK; ++i)
-      sortedIndexedNums.get(i)[0] = (int) ((long) sortedIndexedNums.get(i)[0] * multiplier % MOD);
-
-    for (int[] indexedNums : sortedIndexedNums) {
-      final int num = indexedNums[0];
-      final int i = indexedNums[1];
-      ans[i] = num;
-    }
-
-    return ans;
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  private long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2);
-  }
-}
diff --git a/solutions/3266. Final Array State After K Multiplication Operations II/3266.py b/solutions/3266. Final Array State After K Multiplication Operations II/3266.py
deleted file mode 100644
index 7ce566b9db7..00000000000
--- a/solutions/3266. Final Array State After K Multiplication Operations II/3266.py	
+++ /dev/null
@@ -1,48 +0,0 @@
-class Solution:
-  def getFinalState(
-      self,
-      nums: list[int],
-      k: int,
-      multiplier: int
-  ) -> list[int]:
-    if multiplier == 1:
-      return nums
-
-    MOD = 1_000_000_007
-    n = len(nums)
-    maxNum = max(nums)
-    ans = [0] * n
-    minHeap = [(num, i) for i, num in enumerate(nums)]
-
-    heapq.heapify(minHeap)
-
-    # Keep multiplying the minimum number as close as possible to the maximum
-    # number in the array. After that, stop multiplying the minimum number
-    # because it will be greater than the maximum number in the array and break
-    # the circularity.
-    while k > 0 and minHeap[0][0] * multiplier <= maxNum:
-      num, i = heapq.heappop(minHeap)
-      heapq.heappush(minHeap, (num * multiplier, i))
-      k -= 1
-
-    sortedIndexedNums = sorted(minHeap)
-    multipliesPerNum, remainingK = divmod(k, n)
-
-    # Evenly distribute the remaining multiplications to each number by using
-    # fast exponentiation.
-    for index, (num, i) in enumerate(sortedIndexedNums):
-      sortedIndexedNums[index] = (
-          sortedIndexedNums[index][0] *
-          pow(multiplier, multipliesPerNum, MOD) % MOD, i)
-
-    # Distribute the remaining multiplications to the minimum `remainingK`
-    # numbers.
-    for index in range(remainingK):
-      sortedIndexedNums[index] = (
-          sortedIndexedNums[index][0] * multiplier % MOD,
-          sortedIndexedNums[index][1])
-
-    for num, i in sortedIndexedNums:
-      ans[i] = num
-
-    return ans
diff --git a/solutions/3267. Count Almost Equal Pairs II/3267.cpp b/solutions/3267. Count Almost Equal Pairs II/3267.cpp
deleted file mode 100644
index 5c523689960..00000000000
--- a/solutions/3267. Count Almost Equal Pairs II/3267.cpp	
+++ /dev/null
@@ -1,47 +0,0 @@
-class Solution {
- public:
-  // Similar to 3265. Count Almost Equal Pairs I
-  int countPairs(vector<int>& nums) {
-    int ans = 0;
-    unordered_map<int, int> count;
-    const int maxLen = to_string(ranges::max(nums)).length();
-
-    for (const int num : nums) {
-      const string digits =
-          string(maxLen - to_string(num).length(), '0') + to_string(num);
-      for (const int swap : getSwaps(digits))
-        ans += count[swap];
-      ++count[num];
-    }
-
-    return ans;
-  }
-
- private:
-  // Returns all possible numbers after 1 or 2 swaps.
-  unordered_set<int> getSwaps(const string& digits) {
-    const int n = digits.length();
-    unordered_set<int> swaps{{stoi(digits)}};
-
-    // Add all numbers after 1 swap.
-    for (int i = 0; i < n; ++i)
-      for (int j = i + 1; j < n; ++j) {
-        string newDigits = digits;
-        swap(newDigits[i], newDigits[j]);
-        swaps.insert(stoi(newDigits));
-      }
-
-    // Add all numbers after 2 swaps.
-    for (int i1 = 0; i1 < n; ++i1)
-      for (int j1 = i1 + 1; j1 < n; ++j1)
-        for (int i2 = 0; i2 < n; ++i2)
-          for (int j2 = i2 + 1; j2 < n; ++j2) {
-            string newDigits = digits;
-            swap(newDigits[i1], newDigits[j1]);
-            swap(newDigits[i2], newDigits[j2]);
-            swaps.insert(stoi(newDigits));
-          }
-
-    return swaps;
-  }
-};
diff --git a/solutions/3267. Count Almost Equal Pairs II/3267.java b/solutions/3267. Count Almost Equal Pairs II/3267.java
deleted file mode 100644
index 779ac9a8734..00000000000
--- a/solutions/3267. Count Almost Equal Pairs II/3267.java	
+++ /dev/null
@@ -1,50 +0,0 @@
-class Solution {
-  // Similar to 3265. Count Almost Equal Pairs I
-  public int countPairs(int[] nums) {
-    int ans = 0;
-    Map<Integer, Integer> count = new HashMap<>();
-    final int maxLen = String.valueOf(Arrays.stream(nums).max().getAsInt()).length();
-
-    for (final int num : nums) {
-      final String digits = String.format("%0" + maxLen + "d", num);
-      for (final int swap : getSwaps(digits))
-        ans += count.getOrDefault(swap, 0);
-      count.merge(num, 1, Integer::sum);
-    }
-
-    return ans;
-  }
-
-  // Returns all possible numbers after 1 or 2 swaps.
-  private Set<Integer> getSwaps(final String digits) {
-    final int n = digits.length();
-    Set<Integer> swaps = new HashSet<>(Arrays.asList(Integer.parseInt(digits)));
-
-    // Add all numbers after 1 swap.
-    for (int i = 0; i < n; ++i)
-      for (int j = i + 1; j < n; ++j) {
-        char[] newDigits = digits.toCharArray();
-        char temp = newDigits[i];
-        newDigits[i] = newDigits[j];
-        newDigits[j] = temp;
-        swaps.add(Integer.parseInt(new String(newDigits)));
-      }
-
-    // Add all numbers after 2 swaps.
-    for (int i1 = 0; i1 < n; ++i1)
-      for (int j1 = i1 + 1; j1 < n; ++j1)
-        for (int i2 = 0; i2 < n; ++i2)
-          for (int j2 = i2 + 1; j2 < n; ++j2) {
-            char[] newDigits = digits.toCharArray();
-            char temp = newDigits[i1];
-            newDigits[i1] = newDigits[j1];
-            newDigits[j1] = temp;
-            temp = newDigits[i2];
-            newDigits[i2] = newDigits[j2];
-            newDigits[j2] = temp;
-            swaps.add(Integer.parseInt(new String(newDigits)));
-          }
-
-    return swaps;
-  }
-}
diff --git a/solutions/3267. Count Almost Equal Pairs II/3267.py b/solutions/3267. Count Almost Equal Pairs II/3267.py
deleted file mode 100644
index f7c225a487d..00000000000
--- a/solutions/3267. Count Almost Equal Pairs II/3267.py	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution:
-  # Similar to 3265. Count Almost Equal Pairs I
-  def countPairs(self, nums: list[int]) -> int:
-    ans = 0
-    count = collections.Counter()
-    maxLen = len(str(max(nums)))
-
-    for num in nums:
-      digits = list(str(num).zfill(maxLen))
-      for swap in self._getSwaps(digits):
-        ans += count[swap]
-      count[num] += 1
-
-    return ans
-
-  def _getSwaps(self, digits: str) -> set[int]:
-    """Returns all possible numbers after 1 or 2 swaps."""
-    n = len(digits)
-    swaps = set([int(''.join(digits))])
-
-    # Add all numbers after 1 swap.
-    for i, j in itertools.combinations(range(n), 2):
-      newDigits = digits[:]
-      newDigits[i], newDigits[j] = newDigits[j], newDigits[i]
-      swaps.add(int(''.join(newDigits)))
-
-    # Add all numbers after 2 swaps.
-    for (i1, j1), (i2, j2) in itertools.combinations(
-            itertools.combinations(range(n), 2), 2):
-      newDigits = digits[:]
-      newDigits[i1], newDigits[j1] = newDigits[j1], newDigits[i1]
-      newDigits[i2], newDigits[j2] = newDigits[j2], newDigits[i2]
-      swaps.add(int(''.join(newDigits)))
-
-    return swaps
diff --git a/solutions/3268. Find Overlapping Shifts II/3268.sql b/solutions/3268. Find Overlapping Shifts II/3268.sql
deleted file mode 100644
index 7b558b25f4c..00000000000
--- a/solutions/3268. Find Overlapping Shifts II/3268.sql	
+++ /dev/null
@@ -1,40 +0,0 @@
-WITH
-  EmployeeTimes AS (
-    SELECT DISTINCT employee_id, start_time AS `time`
-    FROM EmployeeShifts
-    UNION DISTINCT
-    SELECT DISTINCT employee_id, end_time AS `time`
-    FROM EmployeeShifts
-  ),
-  Segments AS (
-    SELECT
-      employee_id,
-      `time` AS start_time,
-      LEAD(`time`) OVER(PARTITION BY employee_id ORDER BY `time`) AS end_time
-    FROM EmployeeTimes
-  ),
-  SegmentsCount AS (
-    SELECT
-      Segments.*,
-      COUNT(*) AS concurrent_count
-    FROM Segments
-    INNER JOIN EmployeeShifts
-      USING (employee_id)
-    WHERE
-      Segments.start_time >= EmployeeShifts.start_time
-      AND Segments.end_time <= EmployeeShifts.end_time
-    GROUP BY 1, 2, 3
-  )
-SELECT
-  employee_id,
-  MAX(concurrent_count) AS max_overlapping_shifts,
-  SUM(
-    concurrent_count * (concurrent_count - 1) / 2 * TIMESTAMPDIFF(
-      MINUTE,
-      start_time,
-      end_time
-    )
-  ) AS total_overlap_duration -- C(concurrent_count, 2)
-FROM SegmentsCount
-GROUP BY 1
-ORDER BY 1;
diff --git a/solutions/3269. Constructing Two Increasing Arrays/3269.cpp b/solutions/3269. Constructing Two Increasing Arrays/3269.cpp
deleted file mode 100644
index 95ca1959112..00000000000
--- a/solutions/3269. Constructing Two Increasing Arrays/3269.cpp	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
- public:
-  int minLargest(vector<int>& nums1, vector<int>& nums2) {
-    const int m = nums1.size();
-    const int n = nums2.size();
-    // dp[i][j] := the minimum largest number for the first i nums1 and the
-    // first j nums2
-    vector<vector<int>> dp(m + 1, vector<int>(n + 1, INT_MAX));
-    dp[0][0] = 0;
-
-    for (int i = 0; i <= m; ++i)
-      for (int j = 0; j <= n; ++j) {
-        if (i > 0)
-          dp[i][j] = min(dp[i][j], f(dp[i - 1][j], nums1[i - 1]));
-        if (j > 0)
-          dp[i][j] = min(dp[i][j], f(dp[i][j - 1], nums2[j - 1]));
-      }
-
-    return dp[m][n];
-  }
-
- private:
-  // Returns the next number to fill in the array based on the previous number
-  // and the current number.
-  int f(int prev, int num) {
-    return prev + (prev % 2 == num ? 2 : 1);
-  }
-};
diff --git a/solutions/3269. Constructing Two Increasing Arrays/3269.java b/solutions/3269. Constructing Two Increasing Arrays/3269.java
deleted file mode 100644
index 04e1fbea8b0..00000000000
--- a/solutions/3269. Constructing Two Increasing Arrays/3269.java	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
-  public int minLargest(int[] nums1, int[] nums2) {
-    final int m = nums1.length;
-    final int n = nums2.length;
-    // dp[i][j] := the minimum largest number for the first i nums1 and the
-    // first j nums2
-    int[][] dp = new int[m + 1][n + 1];
-
-    Arrays.stream(dp).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE));
-    dp[0][0] = 0;
-
-    for (int i = 0; i <= m; ++i)
-      for (int j = 0; j <= n; ++j) {
-        if (i > 0)
-          dp[i][j] = Math.min(dp[i][j], f(dp[i - 1][j], nums1[i - 1]));
-        if (j > 0)
-          dp[i][j] = Math.min(dp[i][j], f(dp[i][j - 1], nums2[j - 1]));
-      }
-
-    return dp[m][n];
-  }
-
-  // Returns the next number to fill in the array based on the previous number
-  // and the current number.
-  private int f(int prev, int num) {
-    return prev + (prev % 2 == num ? 2 : 1);
-  }
-}
diff --git a/solutions/3269. Constructing Two Increasing Arrays/3269.py b/solutions/3269. Constructing Two Increasing Arrays/3269.py
deleted file mode 100644
index 990e1368805..00000000000
--- a/solutions/3269. Constructing Two Increasing Arrays/3269.py	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution:
-  def minLargest(self, nums1: list[int], nums2: list[int]) -> int:
-    m = len(nums1)
-    n = len(nums2)
-    # dp[i][j] := the minimum largest number for the first i nums1 and the
-    # first j nums2
-    dp = [[math.inf] * (n + 1) for _ in range(m + 1)]
-    dp[0][0] = 0
-
-    def f(prev: int, num: int) -> int:
-      """
-      Returns the next number to fill in the array based on the previous number
-      and the current number.
-      """
-      return prev + (2 if prev % 2 == num else 1)
-
-    for i in range(m + 1):
-      for j in range(n + 1):
-        if i > 0:
-          dp[i][j] = min(dp[i][j], f(dp[i - 1][j], nums1[i - 1]))
-        if j > 0:
-          dp[i][j] = min(dp[i][j], f(dp[i][j - 1], nums2[j - 1]))
-
-    return dp[m][n]
diff --git a/solutions/327. Count of Range Sum/327.py b/solutions/327. Count of Range Sum/327.py
index df6a230176e..af73a0e3d16 100644
--- a/solutions/327. Count of Range Sum/327.py	
+++ b/solutions/327. Count of Range Sum/327.py	
@@ -1,20 +1,13 @@
 class Solution:
-  def countRangeSum(self, nums: list[int], lower: int, upper: int) -> int:
+  def countRangeSum(self, nums: List[int], lower: int, upper: int) -> int:
     n = len(nums)
     self.ans = 0
-    prefix = list(itertools.accumulate(nums, initial=0))
+    prefix = [0] + list(itertools.accumulate(nums))
 
     self._mergeSort(prefix, 0, n, lower, upper)
     return self.ans
 
-  def _mergeSort(
-      self,
-      prefix: list[int],
-      l: int,
-      r: int,
-      lower: int,
-      upper: int,
-  ) -> None:
+  def _mergeSort(self, prefix: List[int], l: int, r: int, lower: int, upper: int) -> None:
     if l >= r:
       return
 
@@ -23,15 +16,7 @@ def _mergeSort(
     self._mergeSort(prefix, m + 1, r, lower, upper)
     self._merge(prefix, l, m, r, lower, upper)
 
-  def _merge(
-      self,
-      prefix: list[int],
-      l: int,
-      m: int,
-      r: int,
-      lower: int,
-      upper: int,
-  ) -> None:
+  def _merge(self, prefix: List[int], l: int, m: int, r: int, lower: int, upper: int) -> None:
     lo = m + 1  # the first index s.t. prefix[lo] - prefix[i] >= lower
     hi = m + 1  # the first index s.t. prefix[hi] - prefix[i] > upper
 
@@ -44,8 +29,8 @@ def _merge(
       self.ans += hi - lo
 
     sorted = [0] * (r - l + 1)
-    k = 0  # sorted's index
-    i = l  # left's index
+    k = 0      # sorted's index
+    i = l      # left's index
     j = m + 1  # right's index
 
     while i <= m and j <= r:
diff --git a/solutions/3270. Find the Key of the Numbers/3270.cpp b/solutions/3270. Find the Key of the Numbers/3270.cpp
deleted file mode 100644
index d24212564b0..00000000000
--- a/solutions/3270. Find the Key of the Numbers/3270.cpp	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
- public:
-  int generateKey(int num1, int num2, int num3) {
-    const string s1 = zfill(num1, 4);
-    const string s2 = zfill(num2, 4);
-    const string s3 = zfill(num3, 4);
-    string ans;
-
-    for (int i = 0; i < 4; ++i)
-      ans += min({s1[i], s2[i], s3[i]});
-
-    return stoi(ans);
-  }
-
- private:
-  string zfill(int num, int width) {
-    ostringstream oss;
-    oss.width(width);
-    oss.fill('0');
-    oss << num;
-    return oss.str();
-  }
-};
diff --git a/solutions/3270. Find the Key of the Numbers/3270.java b/solutions/3270. Find the Key of the Numbers/3270.java
deleted file mode 100644
index 159cb70a67d..00000000000
--- a/solutions/3270. Find the Key of the Numbers/3270.java	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution {
-  public int generateKey(int num1, int num2, int num3) {
-    final String s1 = String.format("%04d", num1);
-    final String s2 = String.format("%04d", num2);
-    final String s3 = String.format("%04d", num3);
-    StringBuilder sb = new StringBuilder();
-
-    for (int i = 0; i < 4; ++i)
-      sb.append((char) Math.min(Math.min(s1.charAt(i), s2.charAt(i)), s3.charAt(i)));
-
-    return Integer.parseInt(sb.toString());
-  }
-}
diff --git a/solutions/3270. Find the Key of the Numbers/3270.py b/solutions/3270. Find the Key of the Numbers/3270.py
deleted file mode 100644
index 86f4efbf6b0..00000000000
--- a/solutions/3270. Find the Key of the Numbers/3270.py	
+++ /dev/null
@@ -1,6 +0,0 @@
-class Solution:
-  def generateKey(self, num1: int, num2: int, num3: int) -> int:
-    return int(''.join(min(a, b, c)
-                       for a, b, c in zip(str(num1).zfill(4),
-                                          str(num2).zfill(4),
-                                          str(num3).zfill(4))))
diff --git a/solutions/3271. Hash Divided String/3271.cpp b/solutions/3271. Hash Divided String/3271.cpp
deleted file mode 100644
index ac595b25e5f..00000000000
--- a/solutions/3271. Hash Divided String/3271.cpp	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution {
- public:
-  string stringHash(string s, int k) {
-    string ans;
-
-    for (int i = 0; i < s.length(); i += k) {
-      int sumHash = 0;
-      for (int j = i; j < i + k; ++j)
-        sumHash += s[j] - 'a';
-      ans += 'a' + sumHash % 26;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3271. Hash Divided String/3271.java b/solutions/3271. Hash Divided String/3271.java
deleted file mode 100644
index 071bf438155..00000000000
--- a/solutions/3271. Hash Divided String/3271.java	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
-  public String stringHash(String s, int k) {
-    StringBuilder sb = new StringBuilder();
-
-    for (int i = 0; i < s.length(); i += k) {
-      int sumHash = 0;
-      for (int j = i; j < i + k; ++j)
-        sumHash += s.charAt(j) - 'a';
-      sb.append((char) ('a' + sumHash % 26));
-    }
-
-    return sb.toString();
-  }
-}
diff --git a/solutions/3271. Hash Divided String/3271.py b/solutions/3271. Hash Divided String/3271.py
deleted file mode 100644
index de6594b31c0..00000000000
--- a/solutions/3271. Hash Divided String/3271.py	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution:
-  def stringHash(self, s: str, k: int) -> str:
-    ans = []
-
-    for i in range(0, len(s), k):
-      sumHash = sum(string.ascii_lowercase.index(s[j])
-                    for j in range(i, i + k))
-      ans.append(string.ascii_lowercase[sumHash % 26])
-
-    return ''.join(ans)
diff --git a/solutions/3272. Find the Count of Good Integers/3272.cpp b/solutions/3272. Find the Count of Good Integers/3272.cpp
deleted file mode 100644
index 52429b74da8..00000000000
--- a/solutions/3272. Find the Count of Good Integers/3272.cpp	
+++ /dev/null
@@ -1,45 +0,0 @@
-class Solution {
- public:
-  long long countGoodIntegers(int n, int k) {
-    const int halfLength = (n + 1) / 2;
-    const int minHalf = pow(10, halfLength - 1);
-    const int maxHalf = pow(10, halfLength);
-    long ans = 0;
-    unordered_set<string> seen;
-
-    for (int num = minHalf; num < maxHalf; ++num) {
-      const string firstHalf = to_string(num);
-      const string secondHalf = {firstHalf.rbegin(), firstHalf.rend()};
-      const string palindrome = firstHalf + secondHalf.substr(n % 2);
-      if (stol(palindrome) % k != 0)
-        continue;
-      string sortedDigits = palindrome;
-      ranges::sort(sortedDigits);
-      if (seen.contains(sortedDigits))
-        continue;
-      seen.insert(sortedDigits);
-      vector<int> digitCount(10);
-      for (const char c : palindrome)
-        ++digitCount[c - '0'];
-      // Leading zeros are not allowed, so the first digit is special.
-      const int firstDigitChoices = n - digitCount[0];
-      long permutations = firstDigitChoices * factorial(n - 1);
-      // For each repeated digit, divide by the factorial of the frequency since
-      // permutations that swap identical digits don't create a new number.
-      for (const int freq : digitCount)
-        if (freq > 1)
-          permutations /= factorial(freq);
-      ans += permutations;
-    }
-
-    return ans;
-  }
-
- private:
-  long factorial(int n) {
-    long res = 1;
-    for (int i = 2; i <= n; ++i)
-      res *= i;
-    return res;
-  }
-};
diff --git a/solutions/3272. Find the Count of Good Integers/3272.java b/solutions/3272. Find the Count of Good Integers/3272.java
deleted file mode 100644
index fcc41e30d88..00000000000
--- a/solutions/3272. Find the Count of Good Integers/3272.java	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution {
-  public long countGoodIntegers(int n, int k) {
-    final int halfLength = (n + 1) / 2;
-    final int minHalf = (int) Math.pow(10, halfLength - 1);
-    final int maxHalf = (int) Math.pow(10, halfLength);
-    long ans = 0;
-    Set<String> seen = new HashSet<>();
-
-    for (int num = minHalf; num < maxHalf; ++num) {
-      final String firstHalf = String.valueOf(num);
-      final String secondHalf = new StringBuilder(firstHalf).reverse().toString();
-      final String palindrome = firstHalf + secondHalf.substring(n % 2);
-      if (Long.parseLong(palindrome) % k != 0)
-        continue;
-      char[] sortedDigits = palindrome.toCharArray();
-      Arrays.sort(sortedDigits);
-      String sortedDigitsStr = new String(sortedDigits);
-      if (seen.contains(sortedDigitsStr))
-        continue;
-      seen.add(sortedDigitsStr);
-      int[] digitCount = new int[10];
-      for (char c : palindrome.toCharArray())
-        ++digitCount[c - '0'];
-      // Leading zeros are not allowed, so the first digit is special.
-      final int firstDigitChoices = n - digitCount[0];
-      long permutations = firstDigitChoices * factorial(n - 1);
-      // For each repeated digit, divide by the factorial of the frequency since
-      // permutations that swap identical digits don't create a new number.
-      for (final int freq : digitCount)
-        if (freq > 1)
-          permutations /= factorial(freq);
-      ans += permutations;
-    }
-
-    return ans;
-  }
-
-  private long factorial(int n) {
-    long res = 1;
-    for (int i = 2; i <= n; ++i)
-      res *= i;
-    return res;
-  }
-}
diff --git a/solutions/3272. Find the Count of Good Integers/3272.py b/solutions/3272. Find the Count of Good Integers/3272.py
deleted file mode 100644
index ee941eb45fa..00000000000
--- a/solutions/3272. Find the Count of Good Integers/3272.py	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution:
-  def countGoodIntegers(self, n: int, k: int) -> int:
-    halfLength = (n + 1) // 2
-    minHalf = 10**(halfLength - 1)
-    maxHalf = 10**halfLength
-    ans = 0
-    seen = set()
-
-    for num in range(minHalf, maxHalf):
-      palindrome = str(num) + str(num)[::-1][n % 2:]
-      sortedDigits = ''.join(sorted(palindrome))
-      if int(palindrome) % k != 0 or sortedDigits in seen:
-        continue
-      seen.add(sortedDigits)
-      digitCount = collections.Counter(palindrome)
-      # Leading zeros are not allowed, so the first digit is special.
-      firstDigitChoices = n - digitCount['0']
-      permutations = firstDigitChoices * math.factorial(n - 1)
-      # For each repeated digit, divide by the factorial of the frequency since
-      # permutations that swap identical digits don't create a new number.
-      for freq in digitCount.values():
-        permutations //= math.factorial(freq)
-      ans += permutations
-
-    return ans
diff --git a/solutions/3273. Minimum Amount of Damage Dealt to Bob/3273.cpp b/solutions/3273. Minimum Amount of Damage Dealt to Bob/3273.cpp
deleted file mode 100644
index ec9672b4007..00000000000
--- a/solutions/3273. Minimum Amount of Damage Dealt to Bob/3273.cpp	
+++ /dev/null
@@ -1,35 +0,0 @@
-struct Enemy {
-  int damage;
-  int timeTakenDown;
-};
-
-class Solution {
- public:
-  long long minDamage(int power, vector<int>& damage, vector<int>& health) {
-    long ans = 0;
-    long sumDamage = accumulate(damage.begin(), damage.end(), 0L);
-    vector<Enemy> enemies;
-
-    for (int i = 0; i < damage.size(); ++i)
-      enemies.emplace_back(damage[i], (health[i] + power - 1) / power);
-
-    // It's better to take down the enemy i first if the damage dealt of taking
-    // down i first is less than the damage dealt of taking down j first. So,
-    //    damage[i] * t[i] + (t[i] + t[j]) * damage[j] <
-    //    damage[j] * t[j] + (t[i] + t[j]) * damage[i]
-    // => damage[i] * t[i] + damage[j] * t[i] + damage[j] * t[j] <
-    //    damage[j] * t[j] + damage[i] * t[j] + damage[i] * t[i]
-    // => damage[j] * t[i] < damage[i] * t[j]
-    // => damage[j] / t[j] < damage[i] / t[i]
-    ranges::sort(enemies, ranges::greater{}, [](const Enemy& e) {
-      return static_cast<double>(e.damage) / e.timeTakenDown;
-    });
-
-    for (const Enemy& enemy : enemies) {
-      ans += sumDamage * enemy.timeTakenDown;
-      sumDamage -= enemy.damage;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3273. Minimum Amount of Damage Dealt to Bob/3273.java b/solutions/3273. Minimum Amount of Damage Dealt to Bob/3273.java
deleted file mode 100644
index 0c6b1e6ca3c..00000000000
--- a/solutions/3273. Minimum Amount of Damage Dealt to Bob/3273.java	
+++ /dev/null
@@ -1,39 +0,0 @@
-class Enemy {
-  public int damage;
-  public int timeTakenDown;
-  public Enemy(int damage, int timeTakenDown) {
-    this.damage = damage;
-    this.timeTakenDown = timeTakenDown;
-  }
-}
-
-class Solution {
-  public long minDamage(int power, int[] damage, int[] health) {
-    long ans = 0;
-    long sumDamage = Arrays.stream(damage).asLongStream().sum();
-    Enemy[] enemies = new Enemy[damage.length];
-
-    for (int i = 0; i < damage.length; ++i)
-      enemies[i] = new Enemy(damage[i], (health[i] + power - 1) / power);
-
-    // It's better to take down the enemy i first if the damage dealt of taking
-    // down i first is less than the damage dealt of taking down j first. So,
-    //    damage[i] * t[i] + (t[i] + t[j]) * damage[j] <
-    //    damage[j] * t[j] + (t[i] + t[j]) * damage[i]
-    // => damage[i] * t[i] + damage[j] * t[i] + damage[j] * t[j] <
-    //    damage[j] * t[j] + damage[i] * t[j] + damage[i] * t[i]
-    // => damage[j] * t[i] < damage[i] * t[j]
-    // => damage[j] / t[j] < damage[i] / t[i]
-    Arrays.sort(enemies,
-                (a, b)
-                    -> Double.compare((double) b.damage / b.timeTakenDown,
-                                      (double) a.damage / a.timeTakenDown));
-
-    for (final Enemy enemy : enemies) {
-      ans += sumDamage * enemy.timeTakenDown;
-      sumDamage -= enemy.damage;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3273. Minimum Amount of Damage Dealt to Bob/3273.py b/solutions/3273. Minimum Amount of Damage Dealt to Bob/3273.py
deleted file mode 100644
index 61b440fbb7d..00000000000
--- a/solutions/3273. Minimum Amount of Damage Dealt to Bob/3273.py	
+++ /dev/null
@@ -1,31 +0,0 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
-class Enemy:
-  damage: int
-  timeTakenDown: int
-
-
-class Solution:
-  def minDamage(self, power: int, damage: list[int], health: list[int]) -> int:
-    ans = 0
-    sumDamage = sum(damage)
-    enemies = [Enemy(d, (h + power - 1) // power)
-               for d, h in zip(damage, health)]
-
-    # It's better to take down the enemy i first if the damage dealt of taking
-    # down i first is less than the damage dealt of taking down j first. So,
-    #    damage[i] * t[i] + (t[i] + t[j]) * damage[j] <
-    #    damage[j] * t[j] + (t[i] + t[j]) * damage[i]
-    # => damage[i] * t[i] + damage[j] * t[i] + damage[j] * t[j] <
-    #    damage[j] * t[j] + damage[i] * t[j] + damage[i] * t[i]
-    # => damage[j] * t[i] < damage[i] * t[j]
-    # => damage[j] / t[j] < damage[i] / t[i]
-    enemies.sort(key=lambda x: -x.damage / x.timeTakenDown)
-
-    for enemy in enemies:
-      ans += sumDamage * enemy.timeTakenDown
-      sumDamage -= enemy.damage
-
-    return ans
diff --git a/solutions/3274. Check if Two Chessboard Squares Have the Same Color/3274.cpp b/solutions/3274. Check if Two Chessboard Squares Have the Same Color/3274.cpp
deleted file mode 100644
index a7f946ce785..00000000000
--- a/solutions/3274. Check if Two Chessboard Squares Have the Same Color/3274.cpp	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
- public:
-  bool checkTwoChessboards(string coordinate1, string coordinate2) {
-    return squareIsWhite(coordinate1) == squareIsWhite(coordinate2);
-  }
-
- private:
-  // Same as 1812. Determine Color of a Chessboard Square
-  bool squareIsWhite(const string& coordinates) {
-    const char letter = coordinates[0];
-    const char digit = coordinates[1];
-    return letter % 2 != digit % 2;
-  }
-};
diff --git a/solutions/3274. Check if Two Chessboard Squares Have the Same Color/3274.java b/solutions/3274. Check if Two Chessboard Squares Have the Same Color/3274.java
deleted file mode 100644
index f207ccf76c5..00000000000
--- a/solutions/3274. Check if Two Chessboard Squares Have the Same Color/3274.java	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution {
-  public boolean checkTwoChessboards(String coordinate1, String coordinate2) {
-    return squareIsWhite(coordinate1) == squareIsWhite(coordinate2);
-  }
-
-  // Same as 1812. Determine Color of a Chessboard Square
-  private boolean squareIsWhite(final String coordinates) {
-    final char letter = coordinates.charAt(0);
-    final char digit = coordinates.charAt(1);
-    return letter % 2 != digit % 2;
-  }
-}
diff --git a/solutions/3274. Check if Two Chessboard Squares Have the Same Color/3274.py b/solutions/3274. Check if Two Chessboard Squares Have the Same Color/3274.py
deleted file mode 100644
index 6ea080758ef..00000000000
--- a/solutions/3274. Check if Two Chessboard Squares Have the Same Color/3274.py	
+++ /dev/null
@@ -1,8 +0,0 @@
-class Solution:
-  def checkTwoChessboards(self, coordinate1: str, coordinate2: str) -> bool:
-    # Same as 1812. Determine Color of a Chessboard Square
-    def squareIsWhite(coordinate: str) -> bool:
-      letter, digit = coordinate
-      return ord(letter) % 2 != int(digit) % 2
-
-    return squareIsWhite(coordinate1) == squareIsWhite(coordinate2)
diff --git a/solutions/3275. K-th Nearest Obstacle Queries/3275.cpp b/solutions/3275. K-th Nearest Obstacle Queries/3275.cpp
deleted file mode 100644
index 6220e56a094..00000000000
--- a/solutions/3275. K-th Nearest Obstacle Queries/3275.cpp	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
- public:
-  vector<int> resultsArray(vector<vector<int>>& queries, int k) {
-    vector<int> ans;
-    priority_queue<int> maxHeap;
-
-    for (const vector<int>& query : queries) {
-      const int x = query[0];
-      const int y = query[1];
-      maxHeap.push(abs(x) + abs(y));
-      if (maxHeap.size() > k)
-        maxHeap.pop();
-      ans.push_back(maxHeap.size() == k ? maxHeap.top() : -1);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3275. K-th Nearest Obstacle Queries/3275.java b/solutions/3275. K-th Nearest Obstacle Queries/3275.java
deleted file mode 100644
index 6bd899b4d10..00000000000
--- a/solutions/3275. K-th Nearest Obstacle Queries/3275.java	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
-  public int[] resultsArray(int[][] queries, int k) {
-    int[] ans = new int[queries.length];
-    Queue<Integer> maxHeap = new PriorityQueue<>(Comparator.reverseOrder());
-
-    for (int i = 0; i < queries.length; ++i) {
-      final int x = queries[i][0];
-      final int y = queries[i][1];
-      maxHeap.offer(Math.abs(x) + Math.abs(y));
-      if (maxHeap.size() > k)
-        maxHeap.poll();
-      ans[i] = maxHeap.size() == k ? maxHeap.peek() : -1;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3275. K-th Nearest Obstacle Queries/3275.py b/solutions/3275. K-th Nearest Obstacle Queries/3275.py
deleted file mode 100644
index 3428c822934..00000000000
--- a/solutions/3275. K-th Nearest Obstacle Queries/3275.py	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution:
-  def resultsArray(self, queries: list[list[int]], k: int) -> list[int]:
-    ans = []
-    maxHeap = []
-
-    for x, y in queries:
-      heapq.heappush(maxHeap, -(abs(x) + abs(y)))
-      if len(maxHeap) > k:
-        heapq.heappop(maxHeap)
-      ans.append(-maxHeap[0] if len(maxHeap) == k else -1)
-
-    return ans
diff --git a/solutions/3276. Select Cells in Grid With Maximum Score/3276.cpp b/solutions/3276. Select Cells in Grid With Maximum Score/3276.cpp
deleted file mode 100644
index ebd6e45cd3a..00000000000
--- a/solutions/3276. Select Cells in Grid With Maximum Score/3276.cpp	
+++ /dev/null
@@ -1,31 +0,0 @@
-class Solution {
- public:
-  int maxScore(vector<vector<int>>& grid) {
-    unordered_map<int, unordered_set<int>> numToIndices;
-    for (int index = 0; index < grid.size(); ++index)
-      for (const int num : grid[index])
-        numToIndices[num].insert(index);
-    vector<vector<int>> mem(numToIndices.size(), vector<int>(1 << grid.size()));
-    return maxScore({numToIndices.begin(), numToIndices.end()}, 0, 0, mem);
-  }
-
- private:
-  // Returns the maximum score by selecting numbers from numToIndices[i..],
-  // where `mask` is the bitmask of the used row indices.
-  int maxScore(const vector<pair<int, unordered_set<int>>>& numToIndices, int i,
-               int mask, vector<vector<int>>& mem) {
-    if (i == numToIndices.size())
-      return 0;
-    if (mem[i][mask] != 0)
-      return mem[i][mask];
-    // Skip numToIndices[i].first.
-    int res = maxScore(numToIndices, i + 1, mask, mem);
-    for (const int index : numToIndices[i].second)
-      if ((mask >> index & 1) == 0)
-        // Take numToIndices[i].first.
-        res =
-            max(res, numToIndices[i].first +
-                         maxScore(numToIndices, i + 1, mask | 1 << index, mem));
-    return mem[i][mask] = res;
-  }
-};
diff --git a/solutions/3276. Select Cells in Grid With Maximum Score/3276.java b/solutions/3276. Select Cells in Grid With Maximum Score/3276.java
deleted file mode 100644
index 98ef88263a4..00000000000
--- a/solutions/3276. Select Cells in Grid With Maximum Score/3276.java	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
-  public int maxScore(List<List<Integer>> grid) {
-    Map<Integer, Set<Integer>> numToIndices = new HashMap<>();
-    for (int index = 0; index < grid.size(); ++index)
-      for (final int num : grid.get(index)) {
-        numToIndices.putIfAbsent(num, new HashSet<>());
-        numToIndices.get(num).add(index);
-      }
-    int[][] mem = new int[numToIndices.size()][1 << grid.size()];
-    return maxScore(new ArrayList<>(numToIndices.entrySet()), 0, 0, mem);
-  }
-
-  // Returns the maximum score by selecting numbers from numToIndices[i..],
-  // where `mask` is the bitmask of the used row indices.
-  private int maxScore(List<Map.Entry<Integer, Set<Integer>>> numToIndices, int i, int mask,
-                       int[][] mem) {
-    if (i == numToIndices.size())
-      return 0;
-    if (mem[i][mask] != 0)
-      return mem[i][mask];
-    // Skip numToIndices[i].getKey().
-    int res = maxScore(numToIndices, i + 1, mask, mem);
-    for (int index : numToIndices.get(i).getValue())
-      if ((mask >> index & 1) == 0)
-        // Take numToIndices[i].getKey().
-        res = Math.max(res, numToIndices.get(i).getKey() +
-                                maxScore(numToIndices, i + 1, mask | (1 << index), mem));
-    return mem[i][mask] = res;
-  }
-}
diff --git a/solutions/3276. Select Cells in Grid With Maximum Score/3276.py b/solutions/3276. Select Cells in Grid With Maximum Score/3276.py
deleted file mode 100644
index 513ff2bbc48..00000000000
--- a/solutions/3276. Select Cells in Grid With Maximum Score/3276.py	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution:
-  def maxScore(self, grid: list[list[int]]) -> int:
-    numToIndices = collections.defaultdict(set)
-    for index, row in enumerate(grid):
-      for num in row:
-        numToIndices[num].add(index)
-    numToIndices = list(numToIndices.items())
-
-    @functools.lru_cache(None)
-    def dp(i: int, mask: int) -> int:
-      """
-      Returns the maximum score by selecting numbers from numToIndices[i..],
-      where `mask` is the bitmask of the used row indices.
-      """
-      if i == len(numToIndices):
-        return 0
-      # Skip numToIndices[i][0].
-      res = dp(i + 1, mask)
-      for index in numToIndices[i][1]:
-        if (mask >> index & 1) == 0:
-          # Take numToIndices[i][0].
-          res = max(res, numToIndices[i][0] + dp(i + 1, mask | 1 << index))
-      return res
-
-    return dp(0, 0)
diff --git a/solutions/3277. Maximum XOR Score Subarray Queries/3277.cpp b/solutions/3277. Maximum XOR Score Subarray Queries/3277.cpp
deleted file mode 100644
index 2e1ed448500..00000000000
--- a/solutions/3277. Maximum XOR Score Subarray Queries/3277.cpp	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution {
- public:
-  vector<int> maximumSubarrayXor(vector<int>& nums,
-                                 vector<vector<int>>& queries) {
-    const int n = nums.size();
-    vector<int> ans;
-    // xors[i][j] := the XOR score of nums[i..j]
-    vector<vector<int>> xors(n, vector<int>(n));
-    // dp[i][j] := the maximum XOR score of nums[i..j]
-    vector<vector<int>> dp(n, vector<int>(n));
-
-    for (int i = 0; i < n; ++i) {
-      xors[i][i] = nums[i];
-      dp[i][i] = nums[i];
-    }
-
-    for (int d = 1; d < n; ++d)
-      for (int i = 0; i + d < n; ++i) {
-        const int j = i + d;
-        xors[i][j] = xors[i][j - 1] ^ xors[i + 1][j];
-        dp[i][j] = max({xors[i][j], dp[i][j - 1], dp[i + 1][j]});
-      }
-
-    for (const vector<int>& query : queries) {
-      const int l = query[0];
-      const int r = query[1];
-      ans.push_back(dp[l][r]);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3277. Maximum XOR Score Subarray Queries/3277.java b/solutions/3277. Maximum XOR Score Subarray Queries/3277.java
deleted file mode 100644
index 8c96e0caa52..00000000000
--- a/solutions/3277. Maximum XOR Score Subarray Queries/3277.java	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
-  public int[] maximumSubarrayXor(int[] nums, int[][] queries) {
-    final int n = nums.length;
-    int[] ans = new int[queries.length];
-    // xors[i][j] := the XOR score of nums[i..j]
-    int[][] xors = new int[n][n];
-    // dp[i][j] := the maximum XOR score of nums[i..j]
-    int[][] dp = new int[n][n];
-
-    for (int i = 0; i < n; ++i) {
-      xors[i][i] = nums[i];
-      dp[i][i] = nums[i];
-    }
-
-    for (int d = 1; d < n; ++d)
-      for (int i = 0; i + d < n; ++i) {
-        final int j = i + d;
-        xors[i][j] = xors[i][j - 1] ^ xors[i + 1][j];
-        dp[i][j] = Math.max(xors[i][j], Math.max(dp[i][j - 1], dp[i + 1][j]));
-      }
-
-    for (int i = 0; i < queries.length; ++i) {
-      final int l = queries[i][0];
-      final int r = queries[i][1];
-      ans[i] = dp[l][r];
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3277. Maximum XOR Score Subarray Queries/3277.py b/solutions/3277. Maximum XOR Score Subarray Queries/3277.py
deleted file mode 100644
index 1742c02f3e0..00000000000
--- a/solutions/3277. Maximum XOR Score Subarray Queries/3277.py	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution:
-  def maximumSubarrayXor(
-      self,
-      nums: list[int],
-      queries: list[list[int]]
-  ) -> list[int]:
-    n = len(nums)
-    # xors[i][j] := the XOR score of nums[i..j]
-    xors = [[0] * n for _ in range(n)]
-    # dp[i][j] := the maximum XOR score of nums[i..j]
-    dp = [[0] * n for _ in range(n)]
-
-    for i, num in enumerate(nums):
-      xors[i][i] = num
-      dp[i][i] = num
-
-    for d in range(1, n):
-      for i in range(n - d):
-        j = i + d
-        xors[i][j] = xors[i][j - 1] ^ xors[i + 1][j]
-        dp[i][j] = max(xors[i][j], dp[i][j - 1], dp[i + 1][j])
-
-    return [dp[l][r] for l, r in queries]
diff --git a/solutions/3278. Find Candidates for Data Scientist Position II/3278.sql b/solutions/3278. Find Candidates for Data Scientist Position II/3278.sql
deleted file mode 100644
index 3d8d2872a0e..00000000000
--- a/solutions/3278. Find Candidates for Data Scientist Position II/3278.sql	
+++ /dev/null
@@ -1,41 +0,0 @@
-WITH
-  ProjectSkills AS (
-    SELECT project_id, COUNT(skill) AS required_skills
-    FROM Projects
-    GROUP BY 1
-  ),
-  CandidateScores AS (
-    SELECT
-      Projects.project_id,
-      Candidates.candidate_id,
-      100 + SUM(
-        CASE
-          WHEN Candidates.proficiency > Projects.importance THEN 10
-          WHEN Candidates.proficiency < Projects.importance THEN -5
-          ELSE 0
-        END
-      ) AS score,
-      COUNT(Projects.skill) AS matched_skills
-    FROM Projects
-    INNER JOIN Candidates
-      USING (skill)
-    GROUP BY 1, 2
-  ),
-  RankedCandidates AS (
-    SELECT
-      CandidateScores.project_id,
-      CandidateScores.candidate_id,
-      CandidateScores.score,
-      RANK() OVER(
-        PARTITION BY CandidateScores.project_id
-        ORDER BY CandidateScores.score DESC, CandidateScores.candidate_id
-      ) AS `rank`
-    FROM CandidateScores
-    INNER JOIN ProjectSkills
-      USING (project_id)
-    WHERE CandidateScores.matched_skills = ProjectSkills.required_skills
-  )
-SELECT project_id, candidate_id, score
-FROM RankedCandidates
-WHERE `rank` = 1
-ORDER BY 1;
diff --git a/solutions/3279. Maximum Total Area Occupied by Pistons/3279.cpp b/solutions/3279. Maximum Total Area Occupied by Pistons/3279.cpp
deleted file mode 100644
index 214e89fad79..00000000000
--- a/solutions/3279. Maximum Total Area Occupied by Pistons/3279.cpp	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
- public:
-  long long maxArea(int height, vector<int>& positions, string directions) {
-    long area = accumulate(positions.begin(), positions.end(), 0L);
-    long ans = area;
-    long diffPerSecond = 0;
-    map<int, vector<int>> timeToIndices;
-
-    for (int i = 0; i < positions.size(); ++i)
-      if (directions[i] == 'U') {
-        timeToIndices[height - positions[i]].push_back(i);
-        timeToIndices[height - positions[i] + height].push_back(i);
-        ++diffPerSecond;
-      } else {
-        timeToIndices[positions[i]].push_back(i);
-        timeToIndices[positions[i] + height].push_back(i);
-        --diffPerSecond;
-      }
-
-    int prevTime = 0;
-
-    for (const auto& [time, indices] : timeToIndices) {
-      area += (time - prevTime) * diffPerSecond;
-      ans = max(ans, area);
-      prevTime = time;
-      for (const int i : indices)
-        if (directions[i] == 'U') {
-          directions[i] = 'D';
-          diffPerSecond -= 2;
-        } else {
-          directions[i] = 'U';
-          diffPerSecond += 2;
-        }
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3279. Maximum Total Area Occupied by Pistons/3279.java b/solutions/3279. Maximum Total Area Occupied by Pistons/3279.java
deleted file mode 100644
index 785463bb446..00000000000
--- a/solutions/3279. Maximum Total Area Occupied by Pistons/3279.java	
+++ /dev/null
@@ -1,42 +0,0 @@
-class Solution {
-  public long maxArea(int height, int[] positions, String directions) {
-    long area = Arrays.stream(positions).asLongStream().sum();
-    long ans = area;
-    long diffPerSecond = 0;
-    TreeMap<Integer, List<Integer>> timeToIndices = new TreeMap<>();
-
-    for (int i = 0; i < positions.length; ++i) {
-      if (directions.charAt(i) == 'U') {
-        timeToIndices.computeIfAbsent(height - positions[i], k -> new ArrayList<>()).add(i);
-        timeToIndices.computeIfAbsent(height - positions[i] + height, k -> new ArrayList<>())
-            .add(i);
-        ++diffPerSecond;
-      } else {
-        timeToIndices.computeIfAbsent(positions[i], k -> new ArrayList<>()).add(i);
-        timeToIndices.computeIfAbsent(positions[i] + height, k -> new ArrayList<>()).add(i);
-        --diffPerSecond;
-      }
-    }
-
-    char[] directionsChars = directions.toCharArray();
-    int prevTime = 0;
-
-    for (Map.Entry<Integer, List<Integer>> entry : timeToIndices.entrySet()) {
-      final int time = entry.getKey();
-      List<Integer> indices = entry.getValue();
-      area += (time - prevTime) * diffPerSecond;
-      ans = Math.max(ans, area);
-      prevTime = time;
-      for (final int i : indices)
-        if (directionsChars[i] == 'U') {
-          directionsChars[i] = 'D';
-          diffPerSecond -= 2;
-        } else {
-          directionsChars[i] = 'U';
-          diffPerSecond += 2;
-        }
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3279. Maximum Total Area Occupied by Pistons/3279.py b/solutions/3279. Maximum Total Area Occupied by Pistons/3279.py
deleted file mode 100644
index ac14601d433..00000000000
--- a/solutions/3279. Maximum Total Area Occupied by Pistons/3279.py	
+++ /dev/null
@@ -1,36 +0,0 @@
-from sortedcontainers import SortedDict
-
-
-class Solution:
-  def maxArea(self, height: int, positions: list[int], directions: str) -> int:
-    area = sum(positions)
-    ans = area
-    diffPerSecond = 0
-    timeToIndices: SortedDict[int, list[int]] = SortedDict()
-
-    for i, (position, direction) in enumerate(zip(positions, directions)):
-      if direction == 'U':
-        timeToIndices.setdefault(height - position, []).append(i)
-        timeToIndices.setdefault(height - position + height, []).append(i)
-        diffPerSecond += 1
-      else:
-        timeToIndices.setdefault(position, []).append(i)
-        timeToIndices.setdefault(position + height, []).append(i)
-        diffPerSecond -= 1
-
-    prevTime = 0
-    directionsList = list(directions)
-
-    for time, indices in timeToIndices.items():
-      area += (time - prevTime) * diffPerSecond
-      ans = max(ans, area)
-      prevTime = time
-      for i in indices:
-        if directionsList[i] == 'U':
-          directionsList[i] = 'D'
-          diffPerSecond -= 2
-        else:
-          directionsList[i] = 'U'
-          diffPerSecond += 2
-
-    return ans
diff --git a/solutions/3280. Convert Date to Binary/3280.cpp b/solutions/3280. Convert Date to Binary/3280.cpp
deleted file mode 100644
index 8b628cdaaf1..00000000000
--- a/solutions/3280. Convert Date to Binary/3280.cpp	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution {
- public:
-  string convertDateToBinary(string date) {
-    const int year = stoi(date.substr(0, 4));
-    const int month = stoi(date.substr(5, 2));
-    const int day = stoi(date.substr(8, 2));
-    return toBinary(year) + '-' + toBinary(month) + '-' + toBinary(day);
-  }
-
- private:
-  // Converts an integer to binary without leading zeros.
-  string toBinary(int value) {
-    const string binary = bitset<16>(value).to_string();
-    return binary.substr(binary.find('1'));  // Remove leading zeros.
-  }
-};
diff --git a/solutions/3280. Convert Date to Binary/3280.java b/solutions/3280. Convert Date to Binary/3280.java
deleted file mode 100644
index 91f9d303b7a..00000000000
--- a/solutions/3280. Convert Date to Binary/3280.java	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
-  public String convertDateToBinary(String date) {
-    final int year = Integer.parseInt(date.substring(0, 4));
-    final int month = Integer.parseInt(date.substring(5, 7));
-    final int day = Integer.parseInt(date.substring(8, 10));
-    StringBuilder sb = new StringBuilder();
-    sb.append(Integer.toBinaryString(year))
-        .append("-")
-        .append(Integer.toBinaryString(month))
-        .append("-")
-        .append(Integer.toBinaryString(day));
-    return sb.toString();
-  }
-}
diff --git a/solutions/3280. Convert Date to Binary/3280.py b/solutions/3280. Convert Date to Binary/3280.py
deleted file mode 100644
index 672dddd7b77..00000000000
--- a/solutions/3280. Convert Date to Binary/3280.py	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution:
-  def convertDateToBinary(self, date: str) -> str:
-    year, month, day = map(int, date.split('-'))
-
-    def toBinary(value: int) -> str:
-      """Converts an integer to binary without leading zeros."""
-      return bin(value)[2:]
-
-    return '-'.join([toBinary(year), toBinary(month), toBinary(day)])
diff --git a/solutions/3281. Maximize Score of Numbers in Ranges/3281.cpp b/solutions/3281. Maximize Score of Numbers in Ranges/3281.cpp
deleted file mode 100644
index c5522587574..00000000000
--- a/solutions/3281. Maximize Score of Numbers in Ranges/3281.cpp	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
- public:
-  int maxPossibleScore(vector<int>& start, int d) {
-    ranges::sort(start);
-
-    long l = 0;
-    long r = (start.back() + d) - start.front() + 1;
-
-    while (l < r) {
-      const long m = (l + r) / 2;
-      if (isPossible(start, d, m))
-        l = m + 1;
-      else
-        r = m;
-    }
-
-    return l - 1;
-  }
-
- private:
-  bool isPossible(const vector<int>& start, int d, long m) {
-    int lastPick = start[0];
-    for (int i = 1; i < start.size(); ++i) {
-      if (lastPick + m > start[i] + d)
-        return false;
-      lastPick = max(lastPick + m, static_cast<long>(start[i]));
-    }
-    return true;
-  }
-};
diff --git a/solutions/3281. Maximize Score of Numbers in Ranges/3281.java b/solutions/3281. Maximize Score of Numbers in Ranges/3281.java
deleted file mode 100644
index 725de696e52..00000000000
--- a/solutions/3281. Maximize Score of Numbers in Ranges/3281.java	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
-  public int maxPossibleScore(int[] start, int d) {
-    Arrays.sort(start);
-
-    long l = 0;
-    long r = (start[start.length - 1] + d) - start[0] + 1;
-
-    while (l < r) {
-      final long m = (l + r) / 2;
-      if (isPossible(start, d, m))
-        l = m + 1;
-      else
-        r = m;
-    }
-
-    return (int) (l - 1);
-  }
-
-  private boolean isPossible(int[] start, int d, long m) {
-    long lastPick = start[0];
-    for (int i = 1; i < start.length; ++i) {
-      if (lastPick + m > start[i] + d)
-        return false;
-      lastPick = Math.max(lastPick + m, (long) start[i]);
-    }
-    return true;
-  }
-}
diff --git a/solutions/3281. Maximize Score of Numbers in Ranges/3281.py b/solutions/3281. Maximize Score of Numbers in Ranges/3281.py
deleted file mode 100644
index b4cfdb856e4..00000000000
--- a/solutions/3281. Maximize Score of Numbers in Ranges/3281.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  def maxPossibleScore(self, start: list[int], d: int) -> int:
-    def isPossible(m: int) -> bool:
-      lastPick = start[0]
-      for i in range(1, len(start)):
-        if lastPick + m > start[i] + d:
-          return False
-        lastPick = max(lastPick + m, start[i])
-      return True
-
-    start.sort()
-
-    maxScore = (start[-1] + d) - start[0] + 1
-    l = bisect.bisect_left(range(maxScore), True,
-                           key=lambda m: not isPossible(m))
-    return l - 1
diff --git a/solutions/3282. Reach End of Array With Max Score/3282.cpp b/solutions/3282. Reach End of Array With Max Score/3282.cpp
deleted file mode 100644
index b05411eda7b..00000000000
--- a/solutions/3282. Reach End of Array With Max Score/3282.cpp	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution {
- public:
-  // Similar to 3205. Maximum Array Hopping Score I
-  long long findMaximumScore(vector<int>& nums) {
-    // The optimal jump is the nearest index j > i s.t. nums[j] > nums[i].
-    long ans = 0;
-    int mx = 0;
-
-    for (const int num : nums) {
-      ans += mx;
-      mx = max(mx, num);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3282. Reach End of Array With Max Score/3282.java b/solutions/3282. Reach End of Array With Max Score/3282.java
deleted file mode 100644
index ac9fcd7f63e..00000000000
--- a/solutions/3282. Reach End of Array With Max Score/3282.java	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution {
-  // Similar to 3205. Maximum Array Hopping Score I
-  public long findMaximumScore(List<Integer> nums) {
-    // The optimal jump is the nearest index j > i s.t. nums[j] > nums[i].
-    long ans = 0;
-    int mx = 0;
-
-    for (final int num : nums) {
-      ans += mx;
-      mx = Math.max(mx, num);
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3282. Reach End of Array With Max Score/3282.py b/solutions/3282. Reach End of Array With Max Score/3282.py
deleted file mode 100644
index 1e53502efe6..00000000000
--- a/solutions/3282. Reach End of Array With Max Score/3282.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  # Similar to 3205. Maximum Array Hopping Score I
-  def findMaximumScore(self, nums: list[int]) -> int:
-    return sum(itertools.accumulate(nums[:-1], max))
diff --git a/solutions/3283. Maximum Number of Moves to Kill All Pawns/3283.cpp b/solutions/3283. Maximum Number of Moves to Kill All Pawns/3283.cpp
deleted file mode 100644
index 52366a20bc0..00000000000
--- a/solutions/3283. Maximum Number of Moves to Kill All Pawns/3283.cpp	
+++ /dev/null
@@ -1,89 +0,0 @@
-class Solution {
- public:
-  int maxMoves(int kx, int ky, vector<vector<int>>& positions) {
-    const int n = positions.size();
-    positions.push_back({kx, ky});
-    unordered_map<int, int> hashedPositionToIndex;
-    // dist[i][j] := the minimum distance from positions[i] to positions[j]
-    vector<vector<int>> dist(n + 1, vector<int>(n + 1));
-
-    for (int i = 0; i < positions.size(); ++i) {
-      const int x = positions[i][0];
-      const int y = positions[i][1];
-      hashedPositionToIndex[hash(x, y)] = i;
-    }
-
-    for (int sourceIndex = 0; sourceIndex < n + 1; ++sourceIndex)
-      bfs(positions, sourceIndex, hashedPositionToIndex, dist);
-
-    const int maxMask = 1 << (n + 1);
-    // dp[i][mask][turn] := the maximum (Alice) or the minimum (Bob) cost to
-    // kill all pawns, where i is the current pawn, mask is the set of pawns
-    // that have been killed, and turn is the current player's turn (0 for Alice
-    // and 1 for Bob)
-    vector<vector<vector<int>>> dp(
-        n + 1, vector<vector<int>>(1 << (n + 1), vector<int>(2)));
-
-    for (int i = 0; i < n + 1; ++i)
-      for (int mask = 0; mask < maxMask - 1; ++mask)
-        dp[i][mask] = {-kMax, kMax};
-
-    for (int mask = maxMask - 2; mask >= 0; --mask)
-      for (int i = 0; i < n + 1; ++i)
-        for (int turn = 0; turn < 2; ++turn)
-          for (int j = 0; j < n; ++j) {
-            if (mask >> j & 1)
-              continue;
-            const int moves = dist[i][j] + dp[j][mask | 1 << j][1 - turn];
-            dp[i][mask][turn] = turn == 0 ? max(dp[i][mask][turn], moves)
-                                          : min(dp[i][mask][turn], moves);
-          }
-
-    // Returns the maximum cost to kill all pawns, i.e., the original positions
-    // array without the knight (kx, ky).
-    return dp[n][1 << n][0];
-  }
-
- private:
-  static constexpr int kSize = 50;
-  static constexpr int kMax = 1'000'000;
-  static constexpr int kDirs[8][2] = {{1, 2},   {2, 1},   {2, -1}, {1, -2},
-                                      {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
-
-  int hash(int x, int y) {
-    return x * kSize + y;
-  }
-
-  // Computes the distance between positions[sourceIndex] and other positions.
-  void bfs(const vector<vector<int>>& positions, int sourceIndex,
-           const unordered_map<int, int>& hashedPositionToIndex,
-           vector<vector<int>>& dist) {
-    const int sx = positions[sourceIndex][0];
-    const int sy = positions[sourceIndex][1];
-    queue<pair<int, int>> q{{{sx, sy}}};
-    vector<vector<bool>> seen(kSize, vector<bool>(kSize));
-    seen[sx][sy] = true;
-    int seenPositions = 0;
-
-    for (int step = 0; !q.empty() && seenPositions < positions.size(); ++step)
-      for (int sz = q.size(); sz > 0; --sz) {
-        const auto [i, j] = q.front();
-        q.pop();
-        if (const auto it = hashedPositionToIndex.find(hash(i, j));
-            it != end(hashedPositionToIndex)) {
-          dist[sourceIndex][it->second] = step;
-          ++seenPositions;
-        }
-        for (const auto& [dx, dy] : kDirs) {
-          const int x = i + dx;
-          const int y = j + dy;
-          if (x < 0 || x >= kSize || y < 0 || y >= kSize)
-            continue;
-          if (seen[x][y])
-            continue;
-          q.emplace(x, y);
-          seen[x][y] = true;
-        }
-      }
-  }
-};
diff --git a/solutions/3283. Maximum Number of Moves to Kill All Pawns/3283.java b/solutions/3283. Maximum Number of Moves to Kill All Pawns/3283.java
deleted file mode 100644
index aefde19177f..00000000000
--- a/solutions/3283. Maximum Number of Moves to Kill All Pawns/3283.java	
+++ /dev/null
@@ -1,86 +0,0 @@
-class Solution {
-  public int maxMoves(int kx, int ky, int[][] positions) {
-    final int n = positions.length;
-    List<int[]> positionsList = new ArrayList<>(List.of(positions));
-    positionsList.add(new int[] {kx, ky});
-    Map<Integer, Integer> hashedPositionToIndex = new HashMap<>();
-    // dist[i][j] := the minimum distance from positions[i] to positions[j]
-    int[][] dist = new int[n + 1][n + 1];
-
-    for (int i = 0; i < positionsList.size(); ++i) {
-      final int x = positionsList.get(i)[0];
-      final int y = positionsList.get(i)[1];
-      hashedPositionToIndex.put(hash(x, y), i);
-    }
-
-    for (int sourceIndex = 0; sourceIndex < n + 1; ++sourceIndex)
-      bfs(positionsList, sourceIndex, hashedPositionToIndex, dist);
-
-    int MAX_MASK = 1 << (n + 1);
-    // dp[i][mask][turn] := the maximum (Alice) or the minimum (Bob) cost to
-    // kill all pawns, where i is the current pawn, mask is the set of pawns
-    // that have been killed, and turn is the current player's turn (0 for Alice
-    // and 1 for Bob)
-    int[][][] dp = new int[n + 1][1 << (n + 1)][2];
-
-    for (int i = 0; i < n + 1; ++i)
-      for (int mask = 0; mask < MAX_MASK - 1; ++mask)
-        dp[i][mask] = new int[] {-MAX, MAX};
-
-    for (int mask = MAX_MASK - 2; mask >= 0; --mask)
-      for (int i = 0; i < n + 1; ++i)
-        for (int turn = 0; turn < 2; ++turn)
-          for (int j = 0; j < n; ++j) {
-            if ((mask >> j & 1) == 1)
-              continue;
-            final int moves = dist[i][j] + dp[j][mask | 1 << j][1 - turn];
-            dp[i][mask][turn] = turn == 0 ? Math.max(dp[i][mask][turn], moves) //
-                                          : Math.min(dp[i][mask][turn], moves);
-          }
-
-    // Returns the maximum cost to kill all pawns, i.e., the original positions
-    // array without the knight (kx, ky).
-    return dp[n][1 << n][0];
-  }
-
-  private static final int SIZE = 50;
-  private static final int MAX = 1_000_000;
-  private static final int[][] DIRS = {{1, 2},   {2, 1},   {2, -1}, {1, -2},
-                                       {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
-
-  private int hash(int x, int y) {
-    return x * SIZE + y;
-  }
-
-  // Computes the distance between positions[sourceIndex] and other positions.
-  private void bfs(List<int[]> positions, int sourceIndex,
-                   Map<Integer, Integer> hashedPositionToIndex, int[][] dist) {
-    final int sx = positions.get(sourceIndex)[0];
-    final int sy = positions.get(sourceIndex)[1];
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(sx, sy)));
-    boolean[][] seen = new boolean[SIZE][SIZE];
-    seen[sx][sy] = true;
-    int seenPositions = 0;
-
-    for (int step = 0; !q.isEmpty() && seenPositions < positions.size(); ++step)
-      for (int sz = q.size(); sz > 0; --sz) {
-        final int i = q.peek().getKey();
-        final int j = q.poll().getValue();
-        final int hashedPosition = hash(i, j);
-        if (hashedPositionToIndex.containsKey(hashedPosition)) {
-          dist[sourceIndex][hashedPositionToIndex.get(hashedPosition)] = step;
-          ++seenPositions;
-        }
-        for (int[] dir : DIRS) {
-          final int x = i + dir[0];
-          final int y = j + dir[1];
-          if (x < 0 || x >= SIZE || y < 0 || y >= SIZE)
-            continue;
-          if (seen[x][y])
-            continue;
-          q.offer(new Pair<>(x, y));
-          seen[x][y] = true;
-        }
-      }
-  }
-}
diff --git a/solutions/3283. Maximum Number of Moves to Kill All Pawns/3283.py b/solutions/3283. Maximum Number of Moves to Kill All Pawns/3283.py
deleted file mode 100644
index 3c049ff0d7c..00000000000
--- a/solutions/3283. Maximum Number of Moves to Kill All Pawns/3283.py	
+++ /dev/null
@@ -1,83 +0,0 @@
-class Solution:
-  def __init__(self):
-    self.SIZE = 50
-    self.MAX = 1_000_000
-    self.DIRS = ((1, 2), (2, 1), (2, -1), (1, -2),
-                 (-1, -2), (-2, -1), (-2, 1), (-1, 2))
-
-  def maxMoves(self, kx: int, ky: int, positions: list[list[int]]) -> int:
-    n = len(positions)
-    positions.append([kx, ky])
-    hashedPositionToIndex = {}
-    # dist[i][j] := the minimum distance from positions[i] to positions[j]
-    dist = [[0] * (n + 1) for _ in range(n + 1)]
-
-    for i, (x, y) in enumerate(positions):
-      hashedPositionToIndex[self._hash(x, y)] = i
-
-    for sourceIndex in range(n + 1):
-      self._bfs(positions, sourceIndex, hashedPositionToIndex, dist)
-
-    MAX_MASK = 1 << (n + 1)
-    # dp[i][mask][turn] := the maximum (Alice) or the minimum (Bob) cost to
-    # kill all pawns, where i is the current pawn, mask is the set of pawns
-    # that have been killed, and turn is the current player's turn (0 for Alice
-    # and 1 for Bob)
-    dp = [[[0, 0]
-          for _ in range(1 << (n + 1))]
-          for _ in range(n + 1)]
-
-    for i in range(n + 1):
-      for mask in range(MAX_MASK - 1):
-        dp[i][mask] = [-self.MAX, self.MAX]
-
-    for mask in range(MAX_MASK - 2, -1, -1):
-      for i in range(n + 1):
-        for turn in range(2):
-          for j in range(n):
-            if mask >> j & 1:
-              continue
-            moves = dist[i][j] + dp[j][mask | 1 << j][1 - turn]
-            dp[i][mask][turn] = (max(dp[i][mask][turn], moves) if turn == 0 else
-                                 min(dp[i][mask][turn], moves))
-
-    # Returns the maximum cost to kill all pawns, i.e., the original positions
-    # array without the knight (kx, ky).
-    return dp[n][1 << n][0]
-
-  def _hash(self, x: int, y: int) -> int:
-    return x * self.SIZE + y
-
-  def _bfs(
-      self,
-      positions: list[list[int]],
-      sourceIndex: int,
-      hashedPositionToIndex: dict[int, int],
-      dist: list[list[int]]
-  ) -> None:
-    """
-    Computes the distance between positions[sourceIndex] and other positions.
-    """
-    sx, sy = positions[sourceIndex]
-    q = collections.deque([(sx, sy)])
-    seen = {(sx, sy)}
-    seenPositions = 0
-
-    step = 0
-    while q and seenPositions < len(positions):
-      for _ in range(len(q)):
-        i, j = q.popleft()
-        hashedPosition = self._hash(i, j)
-        if hashedPosition in hashedPositionToIndex:
-          dist[sourceIndex][hashedPositionToIndex[hashedPosition]] = step
-          seenPositions += 1
-        for dx, dy in self.DIRS:
-          x = i + dx
-          y = j + dy
-          if x < 0 or x >= self.SIZE or y < 0 or y >= self.SIZE:
-            continue
-          if (x, y) in seen:
-            continue
-          q.append((x, y))
-          seen.add((x, y))
-      step += 1
diff --git a/solutions/3284. Sum of Consecutive Subarrays/3284.cpp b/solutions/3284. Sum of Consecutive Subarrays/3284.cpp
deleted file mode 100644
index 505bdf53fe0..00000000000
--- a/solutions/3284. Sum of Consecutive Subarrays/3284.cpp	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution {
- public:
-  int getSum(const std::vector<int>& nums) {
-    const long sum = accumulate(nums.begin(), nums.end(), 0L) % kMod;
-    return (getSum(nums, 1) + getSum(nums, -1) - sum) % kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Returns the sum of all subarrays with a difference of `diff`.
-  long getSum(const vector<int>& nums, int diff) {
-    long res = nums[0];
-    long summ = nums[0];
-    long count = 1;
-    for (int i = 1; i < nums.size(); ++i) {
-      if (nums[i] == nums[i - 1] + diff) {
-        count += 1;
-        summ += count * nums[i];
-      } else {
-        count = 1;
-        summ = nums[i];
-      }
-      res += summ;
-      res %= kMod;
-    }
-    return res;
-  };
-};
diff --git a/solutions/3284. Sum of Consecutive Subarrays/3284.java b/solutions/3284. Sum of Consecutive Subarrays/3284.java
deleted file mode 100644
index ad2edf45ee4..00000000000
--- a/solutions/3284. Sum of Consecutive Subarrays/3284.java	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution {
-  public int getSum(int[] nums) {
-    final long sum = Arrays.stream(nums).asLongStream().sum() % MOD;
-    return (int) ((getSum(nums, 1) + getSum(nums, -1) - sum) % MOD);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  // Returns the sum of all subarrays with a difference of `diff`.
-  private long getSum(int[] nums, int diff) {
-    long res = nums[0];
-    long summ = nums[0];
-    long count = 1;
-    for (int i = 1; i < nums.length; ++i) {
-      if (nums[i] == nums[i - 1] + diff) {
-        count += 1;
-        summ += count * nums[i];
-      } else {
-        count = 1;
-        summ = nums[i];
-      }
-      res += summ;
-      res %= MOD;
-    }
-    return res;
-  }
-}
diff --git a/solutions/3284. Sum of Consecutive Subarrays/3284.py b/solutions/3284. Sum of Consecutive Subarrays/3284.py
deleted file mode 100644
index c93c778b132..00000000000
--- a/solutions/3284. Sum of Consecutive Subarrays/3284.py	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution:
-  def getSum(self, nums: list[int]) -> int:
-    def getSum(diff: int) -> int:
-      """Returns the sum of all subarrays with a difference of `diff`."""
-      res = nums[0]
-      summ = nums[0]
-      count = 1
-      for prev, num in itertools.pairwise(nums):
-        if num == prev + diff:
-          count += 1
-          summ += count * num
-        else:
-          count = 1
-          summ = num
-        res += summ
-      return res
-
-    return (getSum(1) + getSum(-1) - sum(nums)) % 1_000_000_007
diff --git a/solutions/3285. Find Indices of Stable Mountains/3285.cpp b/solutions/3285. Find Indices of Stable Mountains/3285.cpp
deleted file mode 100644
index 25b189a6dc3..00000000000
--- a/solutions/3285. Find Indices of Stable Mountains/3285.cpp	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution {
- public:
-  vector<int> stableMountains(vector<int>& height, int threshold) {
-    vector<int> ans;
-
-    for (int i = 1; i < height.size(); ++i)
-      if (height[i - 1] > threshold)
-        ans.push_back(i);
-
-    return ans;
-  }
-};
diff --git a/solutions/3285. Find Indices of Stable Mountains/3285.java b/solutions/3285. Find Indices of Stable Mountains/3285.java
deleted file mode 100644
index 4b194b243ec..00000000000
--- a/solutions/3285. Find Indices of Stable Mountains/3285.java	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution {
-  public List<Integer> stableMountains(int[] height, int threshold) {
-    List<Integer> ans = new ArrayList<>();
-
-    for (int i = 1; i < height.length; ++i)
-      if (height[i - 1] > threshold)
-        ans.add(i);
-
-    return ans;
-  }
-}
diff --git a/solutions/3285. Find Indices of Stable Mountains/3285.py b/solutions/3285. Find Indices of Stable Mountains/3285.py
deleted file mode 100644
index caa6c342dfe..00000000000
--- a/solutions/3285. Find Indices of Stable Mountains/3285.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def stableMountains(self, height: list[int], threshold: int) -> list[int]:
-    return [i for i in range(1, len(height))
-            if height[i - 1] > threshold]
diff --git a/solutions/3286. Find a Safe Walk Through a Grid/3286.cpp b/solutions/3286. Find a Safe Walk Through a Grid/3286.cpp
deleted file mode 100644
index 28d7c9c9d42..00000000000
--- a/solutions/3286. Find a Safe Walk Through a Grid/3286.cpp	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution {
- public:
-  bool findSafeWalk(vector<vector<int>>& grid, int health) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-    const int m = grid.size();
-    const int n = grid[0].size();
-    const int initialHealth = health - grid[0][0];
-    using T = tuple<int, int, int>;  // (i, j, h)
-    queue<T> q{{{0, 0, initialHealth}}};
-    vector<vector<vector<bool>>> seen(
-        m, vector<vector<bool>>(n, vector<bool>(health + 1)));
-    seen[0][0][initialHealth] = true;
-
-    while (!q.empty())
-      for (int sz = q.size(); sz > 0; --sz) {
-        const auto [i, j, h] = q.front();
-        q.pop();
-        if (i == m - 1 && j == n - 1 && h > 0)
-          return true;
-        for (const auto& [dx, dy] : kDirs) {
-          const int x = i + dx;
-          const int y = j + dy;
-          if (x < 0 || x == m || y < 0 || y == n)
-            continue;
-          const int nextHealth = h - grid[x][y];
-          if (nextHealth <= 0 || seen[x][y][nextHealth])
-            continue;
-          q.emplace(x, y, nextHealth);
-          seen[x][y][nextHealth] = true;
-        }
-      }
-
-    return false;
-  }
-};
diff --git a/solutions/3286. Find a Safe Walk Through a Grid/3286.java b/solutions/3286. Find a Safe Walk Through a Grid/3286.java
deleted file mode 100644
index 893e11421f1..00000000000
--- a/solutions/3286. Find a Safe Walk Through a Grid/3286.java	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution {
-  public boolean findSafeWalk(List<List<Integer>> grid, int health) {
-    record T(int i, int j, int h) {}
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-    final int m = grid.size();
-    final int n = grid.get(0).size();
-    final int initialHealth = health - grid.get(0).get(0);
-    Queue<T> q = new ArrayDeque<>(List.of(new T(0, 0, initialHealth)));
-    boolean[][][] seen = new boolean[m][n][health + 1];
-    seen[0][0][initialHealth] = true;
-
-    while (!q.isEmpty())
-      for (int sz = q.size(); sz > 0; --sz) {
-        final int i = q.peek().i;
-        final int j = q.peek().j;
-        final int h = q.poll().h;
-        if (i == m - 1 && j == n - 1 && h > 0)
-          return true;
-        for (int k = 0; k < 4; ++k) {
-          final int x = i + DIRS[k][0];
-          final int y = j + DIRS[k][1];
-          if (x < 0 || x == m || y < 0 || y == n)
-            continue;
-          final int nextHealth = h - grid.get(x).get(y);
-          if (nextHealth <= 0 || seen[x][y][nextHealth])
-            continue;
-          q.offer(new T(x, y, nextHealth));
-          seen[x][y][nextHealth] = true;
-        }
-      }
-
-    return false;
-  }
-}
diff --git a/solutions/3286. Find a Safe Walk Through a Grid/3286.py b/solutions/3286. Find a Safe Walk Through a Grid/3286.py
deleted file mode 100644
index 533815a0bd6..00000000000
--- a/solutions/3286. Find a Safe Walk Through a Grid/3286.py	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution:
-  def findSafeWalk(self, grid: list[list[int]], health: int) -> bool:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
-    m = len(grid)
-    n = len(grid[0])
-    initialHealth = health - grid[0][0]
-    q = collections.deque([(0, 0, initialHealth)])
-    seen = {(0, 0, initialHealth)}
-
-    while q:
-      for _ in range(len(q)):
-        i, j, h = q.popleft()
-        if i == m - 1 and j == n - 1 and h > 0:
-          return True
-        for dx, dy in DIRS:
-          x = i + dx
-          y = j + dy
-          if x < 0 or x == m or y < 0 or y == n:
-            continue
-          nextHealth = h - grid[x][y]
-          if nextHealth <= 0 or (x, y, nextHealth) in seen:
-            continue
-          q.append((x, y, nextHealth))
-          seen.add((x, y, nextHealth))
-
-    return False
diff --git a/solutions/3287. Find the Maximum Sequence Value of Array/3287.cpp b/solutions/3287. Find the Maximum Sequence Value of Array/3287.cpp
deleted file mode 100644
index c346ae890f8..00000000000
--- a/solutions/3287. Find the Maximum Sequence Value of Array/3287.cpp	
+++ /dev/null
@@ -1,53 +0,0 @@
-class Solution {
- public:
-  int maxValue(vector<int>& nums, int k) {
-    // left[i][j][x] := true if it's possible to get an OR value of x by
-    // selecting j numbers from nums[0..i]
-    const vector<vector<vector<bool>>> left = getPossibleORs(nums, k);
-    // right[i][j][x] := true if it's possible to get an OR value of x by
-    // selecting j numbers from nums[i..n - 1]
-    vector<vector<vector<bool>>> right =
-        getPossibleORs({nums.rbegin(), nums.rend()}, k);
-    ranges::reverse(right);
-
-    int ans = 0;
-
-    for (int i = k - 1; i + k < nums.size(); ++i)
-      for (int a = 0; a <= kMaxXor; ++a)
-        for (int b = 0; b <= kMaxXor; ++b)
-          if (left[i][k][a] && right[i + 1][k][b])
-            ans = max(ans, a ^ b);
-
-    return ans;
-  }
-
- private:
-  static constexpr int kMaxXor = 128;
-
-  // Gets all possible OR values till each index and number of numbers.
-  vector<vector<vector<bool>>> getPossibleORs(const vector<int>& nums, int k) {
-    // dp[i][j][x] := true if it's possible to get an OR value of x by selecting
-    // j numbers from nums[0..i]
-    vector<vector<vector<bool>>> dp(
-        nums.size(), vector<vector<bool>>(k + 1, vector<bool>(kMaxXor + 1)));
-
-    dp[0][1][nums[0]] = true;
-
-    // No number is selected.
-    for (int i = 0; i < nums.size(); ++i)
-      dp[i][0][0] = true;
-
-    for (int i = 1; i < nums.size(); ++i)
-      for (int j = 1; j <= k; ++j)
-        for (int x = 0; x <= kMaxXor; ++x) {
-          // 1. Skip the current number.
-          if (dp[i - 1][j][x])
-            dp[i][j][x] = true;
-          // 2. Pick the current number.
-          if (dp[i - 1][j - 1][x])
-            dp[i][j][nums[i] | x] = true;
-        }
-
-    return dp;
-  }
-};
diff --git a/solutions/3287. Find the Maximum Sequence Value of Array/3287.java b/solutions/3287. Find the Maximum Sequence Value of Array/3287.java
deleted file mode 100644
index 6b07526762e..00000000000
--- a/solutions/3287. Find the Maximum Sequence Value of Array/3287.java	
+++ /dev/null
@@ -1,58 +0,0 @@
-class Solution {
-  public int maxValue(int[] nums, int k) {
-    boolean[][][] left = getPossibleORs(nums, k);
-    int[] reversedNums = reverseArray(nums);
-    boolean[][][] right = getPossibleORs(reversedNums, k);
-    reverseArray(right);
-
-    int ans = 0;
-
-    for (int i = k - 1; i + k < nums.length; ++i)
-      for (int a = 0; a <= MAX_XOR; ++a)
-        for (int b = 0; b <= MAX_XOR; ++b)
-          if (left[i][k][a] && right[i + 1][k][b])
-            ans = Math.max(ans, a ^ b);
-
-    return ans;
-  }
-
-  private static final int MAX_XOR = 128;
-
-  // Gets all possible OR values till each index and number of numbers.
-  private boolean[][][] getPossibleORs(int[] nums, int k) {
-    // dp[i][j][x] := true if it's possible to get an OR value of x by selecting
-    // j numbers from nums[0..i]
-    boolean[][][] dp = new boolean[nums.length][k + 1][MAX_XOR + 1];
-    dp[0][1][nums[0]] = true;
-
-    // No number is selected.
-    for (int i = 0; i < nums.length; ++i)
-      dp[i][0][0] = true;
-
-    for (int i = 1; i < nums.length; ++i)
-      for (int j = 1; j <= k; ++j)
-        for (int x = 0; x <= MAX_XOR; ++x) {
-          if (dp[i - 1][j][x]) // 1. Skip the current number.
-            dp[i][j][x] = true;
-          if (dp[i - 1][j - 1][x]) // 2. Pick the current number.
-            dp[i][j][nums[i] | x] = true;
-        }
-
-    return dp;
-  }
-
-  private int[] reverseArray(int[] arr) {
-    int[] reversed = new int[arr.length];
-    for (int i = 0; i < arr.length; ++i)
-      reversed[i] = arr[arr.length - 1 - i];
-    return reversed;
-  }
-
-  private void reverseArray(boolean[][][] arr) {
-    for (int l = 0, r = arr.length - 1; l < r; ++l, --r) {
-      boolean[][] temp = arr[l];
-      arr[l] = arr[r];
-      arr[r] = temp;
-    }
-  }
-}
diff --git a/solutions/3287. Find the Maximum Sequence Value of Array/3287.py b/solutions/3287. Find the Maximum Sequence Value of Array/3287.py
deleted file mode 100644
index af0ca221a01..00000000000
--- a/solutions/3287. Find the Maximum Sequence Value of Array/3287.py	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution:
-  def maxValue(self, nums: list[int], k: int) -> int:
-    left = self._getPossibleORs(nums, k)
-    right = self._getPossibleORs(nums[::-1], k)[::-1]
-    return max(a ^ b
-               for i in range(k - 1, len(nums) - k)
-               for a in range(128 + 1)
-               for b in range(128 + 1)
-               if left[i][k][a] and right[i + 1][k][b])
-
-  def _getPossibleORs(self, nums: list[int], k: int) -> list[list[list[bool]]]:
-    dp = [[[False] * (128 + 1)
-          for _ in range(k + 1)]
-          for _ in range(len(nums))]
-
-    dp[0][1][nums[0]] = True
-
-    for i in range(len(nums)):
-      dp[i][0][0] = True
-
-    for i in range(1, len(nums)):
-      for j in range(1, k + 1):
-        for x in range(128 + 1):
-          if dp[i - 1][j][x]:
-            dp[i][j][x] = True
-          if dp[i - 1][j - 1][x]:
-            dp[i][j][nums[i] | x] = True
-
-    return dp
diff --git a/solutions/3288. Length of the Longest Increasing Path/3288.cpp b/solutions/3288. Length of the Longest Increasing Path/3288.cpp
deleted file mode 100644
index 48a7034b237..00000000000
--- a/solutions/3288. Length of the Longest Increasing Path/3288.cpp	
+++ /dev/null
@@ -1,43 +0,0 @@
-class Solution {
- public:
-  int maxPathLength(vector<vector<int>>& coordinates, int k) {
-    const int xk = coordinates[k][0];
-    const int yk = coordinates[k][1];
-    vector<pair<int, int>> leftCoordinates;
-    vector<pair<int, int>> rightCoordinates;
-
-    for (const vector<int>& coordinate : coordinates) {
-      const int x = coordinate[0];
-      const int y = coordinate[1];
-      if (x < xk && y < yk)
-        leftCoordinates.emplace_back(x, y);
-      else if (x > xk && y > yk)
-        rightCoordinates.emplace_back(x, y);
-    }
-
-    return 1 + lengthOfLIS(leftCoordinates) + lengthOfLIS(rightCoordinates);
-  }
-
- private:
-  // Similar to 300. Longest Increasing Subsequence
-  int lengthOfLIS(vector<pair<int, int>>& coordinates) {
-    ranges::sort(coordinates, ranges::less{},
-                 [](const pair<int, int>& coordinate) {
-      const auto& [x, y] = coordinate;
-      return pair<int, int>{x, -y};
-    });
-    // tails[i] := the minimum tail of all the increasing subsequences having
-    // length i + 1
-    vector<int> tails;
-    for (const auto& [_, y] : coordinates)
-      if (tails.empty() || y > tails.back())
-        tails.push_back(y);
-      else
-        tails[firstGreaterEqual(tails, y)] = y;
-    return tails.size();
-  }
-
-  int firstGreaterEqual(const vector<int>& arr, int target) {
-    return ranges::lower_bound(arr, target) - arr.begin();
-  }
-};
diff --git a/solutions/3288. Length of the Longest Increasing Path/3288.java b/solutions/3288. Length of the Longest Increasing Path/3288.java
deleted file mode 100644
index f1759561ba2..00000000000
--- a/solutions/3288. Length of the Longest Increasing Path/3288.java	
+++ /dev/null
@@ -1,41 +0,0 @@
-class Solution {
-  public int maxPathLength(int[][] coordinates, int k) {
-    final int xk = coordinates[k][0];
-    final int yk = coordinates[k][1];
-    List<int[]> leftCoordinates = new ArrayList<>();
-    List<int[]> rightCoordinates = new ArrayList<>();
-
-    for (int[] coordinate : coordinates) {
-      final int x = coordinate[0];
-      final int y = coordinate[1];
-      if (x < xk && y < yk)
-        leftCoordinates.add(new int[] {x, y});
-      else if (x > xk && y > yk)
-        rightCoordinates.add(new int[] {x, y});
-    }
-
-    return 1 + lengthOfLIS(leftCoordinates) + lengthOfLIS(rightCoordinates);
-  }
-
-  // Similar to 300. Longest Increasing Subsequence
-  private int lengthOfLIS(List<int[]> coordinates) {
-    coordinates.sort(Comparator.comparingInt((int[] coordinate) -> coordinate[0])
-                         .thenComparingInt((int[] coordinate) -> - coordinate[1]));
-    // tails[i] := the minimum tail of all the increasing subsequences having
-    // length i + 1
-    List<Integer> tails = new ArrayList<>();
-    for (int[] coordinate : coordinates) {
-      final int y = coordinate[1];
-      if (tails.isEmpty() || y > tails.get(tails.size() - 1))
-        tails.add(y);
-      else
-        tails.set(firstGreaterEqual(tails, y), y);
-    }
-    return tails.size();
-  }
-
-  private int firstGreaterEqual(List<Integer> arr, int target) {
-    final int i = Collections.binarySearch(arr, target);
-    return i < 0 ? -i - 1 : i;
-  }
-}
diff --git a/solutions/3288. Length of the Longest Increasing Path/3288.py b/solutions/3288. Length of the Longest Increasing Path/3288.py
deleted file mode 100644
index 56f1ee0f888..00000000000
--- a/solutions/3288. Length of the Longest Increasing Path/3288.py	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution:
-  def maxPathLength(self, coordinates: list[list[int]], k: int) -> int:
-    xk, yk = coordinates[k]
-    leftCoordinates = [(x, y) for x, y in coordinates if x < xk and y < yk]
-    rightCoordinates = [(x, y) for x, y in coordinates if x > xk and y > yk]
-    return (1 +
-            self._lengthOfLIS(leftCoordinates) +
-            self._lengthOfLIS(rightCoordinates))
-
-  # Similar to 300. Longest Increasing Subsequence
-  def _lengthOfLIS(self, coordinates: list[tuple[int, int]]) -> int:
-    coordinates.sort(key=lambda x: (x[0], -x[1]))
-    # tail[i] := the minimum tail of all the increasing subsequences having
-    # length i + 1
-    tail = []
-    for _, y in coordinates:
-      if not tail or y > tail[-1]:
-        tail.append(y)
-      else:
-        tail[bisect.bisect_left(tail, y)] = y
-    return len(tail)
diff --git a/solutions/3289. The Two Sneaky Numbers of Digitville/3289.cpp b/solutions/3289. The Two Sneaky Numbers of Digitville/3289.cpp
deleted file mode 100644
index 6c3acee8691..00000000000
--- a/solutions/3289. The Two Sneaky Numbers of Digitville/3289.cpp	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
- public:
-  vector<int> getSneakyNumbers(const vector<int>& nums) {
-    constexpr int kMax = 100;
-    vector<int> ans;
-    vector<int> count(kMax + 1);
-
-    for (const int num : nums)
-      if (++count[num] == 2)
-        ans.push_back(num);
-
-    return ans;
-  }
-};
diff --git a/solutions/3289. The Two Sneaky Numbers of Digitville/3289.java b/solutions/3289. The Two Sneaky Numbers of Digitville/3289.java
deleted file mode 100644
index d89a3a5a5ca..00000000000
--- a/solutions/3289. The Two Sneaky Numbers of Digitville/3289.java	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
-  public int[] getSneakyNumbers(int[] nums) {
-    final int MAX = 100;
-    int[] ans = new int[2];
-    int[] count = new int[MAX + 1];
-    int ansIndex = 0;
-
-    for (final int num : nums)
-      if (++count[num] == 2)
-        ans[ansIndex++] = num;
-
-    return ans;
-  }
-}
diff --git a/solutions/3289. The Two Sneaky Numbers of Digitville/3289.py b/solutions/3289. The Two Sneaky Numbers of Digitville/3289.py
deleted file mode 100644
index ee04581e946..00000000000
--- a/solutions/3289. The Two Sneaky Numbers of Digitville/3289.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def getSneakyNumbers(self, nums: list[int]) -> list[int]:
-    return [num for num, freq in collections.Counter(nums).items()
-            if freq == 2]
diff --git a/solutions/329. Longest Increasing Path in a Matrix/329.py b/solutions/329. Longest Increasing Path in a Matrix/329.py
index 4709f521286..e0223d5f191 100644
--- a/solutions/329. Longest Increasing Path in a Matrix/329.py	
+++ b/solutions/329. Longest Increasing Path in a Matrix/329.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestIncreasingPath(self, matrix: list[list[int]]) -> int:
+  def longestIncreasingPath(self, matrix: List[List[int]]) -> int:
     m = len(matrix)
     n = len(matrix[0])
 
diff --git a/solutions/3290. Maximum Multiplication Score/3290-2.cpp b/solutions/3290. Maximum Multiplication Score/3290-2.cpp
deleted file mode 100644
index daa93080b4e..00000000000
--- a/solutions/3290. Maximum Multiplication Score/3290-2.cpp	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
- public:
-  long long maxScore(vector<int>& a, vector<int>& b) {
-    // dp[i] := the maximum score of a[0..i]
-    vector<long> dp(4, LONG_MIN / 2);
-
-    for (const long num : b)
-      for (int i = 3; i >= 0; --i)
-        // Skip `num` or pair a[i] with `num`.
-        dp[i] = max(dp[i], (i > 0 ? dp[i - 1] : 0) + a[i] * num);
-
-    return dp[3];
-  }
-};
diff --git a/solutions/3290. Maximum Multiplication Score/3290-2.java b/solutions/3290. Maximum Multiplication Score/3290-2.java
deleted file mode 100644
index f5df9d6e985..00000000000
--- a/solutions/3290. Maximum Multiplication Score/3290-2.java	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
-  public long maxScore(int[] a, int[] b) {
-    // dp[i] := the maximum score of a[0..i]
-    long[] dp = new long[4];
-    Arrays.fill(dp, Long.MIN_VALUE / 2);
-
-    for (final long num : b)
-      for (int i = 3; i >= 0; --i)
-        // Skip `num` or pair a[i] with `num`.
-        dp[i] = Math.max(dp[i], (i > 0 ? dp[i - 1] : 0) + a[i] * num);
-
-    return dp[3];
-  }
-}
diff --git a/solutions/3290. Maximum Multiplication Score/3290-2.py b/solutions/3290. Maximum Multiplication Score/3290-2.py
deleted file mode 100644
index 6fdda6866da..00000000000
--- a/solutions/3290. Maximum Multiplication Score/3290-2.py	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution:
-  def maxScore(self, a: list[int], b: list[int]) -> int:
-    # dp[i] := the maximum score of a[0..i]
-    dp = [-math.inf] * 4
-
-    for num in b:
-      for i in reversed(range(4)):
-        # Skip `num` or pair a[i] with `num`.
-        dp[i] = max(dp[i], (dp[i - 1] if i > 0 else 0) + a[i] * num)
-
-    return dp[3]
diff --git a/solutions/3290. Maximum Multiplication Score/3290.cpp b/solutions/3290. Maximum Multiplication Score/3290.cpp
deleted file mode 100644
index 55c9028ff2b..00000000000
--- a/solutions/3290. Maximum Multiplication Score/3290.cpp	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
- public:
-  long long maxScore(vector<int>& a, vector<int>& b) {
-    const int n = b.size();
-    const long kMin = LONG_MIN / 2;
-    // dp[i][j] := the maximum score by selecting 4 - i numbers from b[j..n - 1]
-    // using the corresponding numbers from a[i..3]
-    vector<vector<long>> dp(5, vector<long>(n + 1));
-
-    // Run out of numbers in b but still need to select numbers from a.
-    for (int i = 0; i < 4; ++i)
-      dp[i][n] = kMin;
-
-    for (int i = 3; i >= 0; --i)
-      for (int j = n - 1; j >= 0; --j)
-        // Skip b[j] or pair a[i] with b[j].
-        dp[i][j] = max(dp[i][j + 1],
-                       a[i] * static_cast<long>(b[j]) + dp[i + 1][j + 1]);
-
-    return dp[0][0] == kMin ? -1 : dp[0][0];
-  }
-};
diff --git a/solutions/3290. Maximum Multiplication Score/3290.java b/solutions/3290. Maximum Multiplication Score/3290.java
deleted file mode 100644
index 0c148416ebe..00000000000
--- a/solutions/3290. Maximum Multiplication Score/3290.java	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
-  public long maxScore(int[] a, int[] b) {
-    final int n = b.length;
-    final long MIN = Long.MIN_VALUE / 2;
-    // dp[i][j] := the maximum score by selecting 4 - i numbers from b[j..n - 1]
-    // using the corresponding numbers from a[i..3]
-    long[][] dp = new long[5][n + 1];
-
-    // Run out of numbers in b but still need to select numbers from a.
-    for (int i = 0; i < 4; ++i)
-      dp[i][n] = MIN;
-
-    for (int i = 3; i >= 0; --i)
-      for (int j = n - 1; j >= 0; --j)
-        // Skip b[j] or pair a[i] with b[j].
-        dp[i][j] = Math.max(dp[i][j + 1], a[i] * (long) b[j] + dp[i + 1][j + 1]);
-
-    return dp[0][0] == MIN ? -1 : dp[0][0];
-  }
-}
diff --git a/solutions/3290. Maximum Multiplication Score/3290.py b/solutions/3290. Maximum Multiplication Score/3290.py
deleted file mode 100644
index 87c3caf5e9f..00000000000
--- a/solutions/3290. Maximum Multiplication Score/3290.py	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution:
-  def maxScore(self, a: list[int], b: list[int]) -> int:
-    n = len(b)
-    # dp[i][j] := the maximum score by selecting 4 - i numbers from b[j..n - 1]
-    # using the corresponding numbers from a[i..3]
-    dp = [[0] * (n + 1) for _ in range(5)]
-
-    # Run out of numbers in b but still need to select numbers from a.
-    for i in range(4):
-      dp[i][n] = -math.inf
-
-    for i in reversed(range(4)):
-      for j in reversed(range(n)):
-        # Skip b[j] or pair a[i] with b[j].
-        dp[i][j] = max(dp[i][j + 1], a[i] * b[j] + dp[i + 1][j + 1])
-
-    return -1 if dp[0][0] == -math.inf else dp[0][0]
diff --git a/solutions/3291. Minimum Number of Valid Strings to Form Target I/3291.cpp b/solutions/3291. Minimum Number of Valid Strings to Form Target I/3291.cpp
deleted file mode 100644
index dceaaa27c8f..00000000000
--- a/solutions/3291. Minimum Number of Valid Strings to Form Target I/3291.cpp	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
- public:
-  int minValidStrings(vector<string>& words, string target) {
-    int ans = 0;
-    int unmatchedPrefix = target.length();
-    vector<vector<int>> lpsList;
-
-    for (const string& word : words)
-      lpsList.push_back(getLPS(word + '#' + target));
-
-    while (unmatchedPrefix > 0) {
-      // Greedily choose the word that has the longest suffix match with the
-      // remaining unmatched prefix.
-      int maxMatchSuffix = 0;
-      for (int i = 0; i < words.size(); ++i)
-        maxMatchSuffix = max(maxMatchSuffix,
-                             lpsList[i][words[i].length() + unmatchedPrefix]);
-      if (maxMatchSuffix == 0)
-        return -1;
-      ++ans;
-      unmatchedPrefix -= maxMatchSuffix;
-    }
-
-    return ans;
-  }
-
- private:
-  // Returns the lps array, where lps[i] is the length of the longest prefix of
-  // pattern[0..i] which is also a suffix of this substring.
-  vector<int> getLPS(const string& pattern) {
-    vector<int> lps(pattern.length());
-    for (int i = 1, j = 0; i < pattern.length(); ++i) {
-      while (j > 0 && pattern[j] != pattern[i])
-        j = lps[j - 1];
-      if (pattern[i] == pattern[j])
-        lps[i] = ++j;
-    }
-    return lps;
-  }
-};
diff --git a/solutions/3291. Minimum Number of Valid Strings to Form Target I/3291.java b/solutions/3291. Minimum Number of Valid Strings to Form Target I/3291.java
deleted file mode 100644
index e01ec740934..00000000000
--- a/solutions/3291. Minimum Number of Valid Strings to Form Target I/3291.java	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution {
-  public int minValidStrings(String[] words, String target) {
-    int ans = 0;
-    int unmatchedPrefix = target.length();
-    int[][] lpsList = new int[words.length][];
-
-    for (int i = 0; i < words.length; ++i)
-      lpsList[i] = getLPS(words[i] + '#' + target);
-
-    while (unmatchedPrefix > 0) {
-      // Greedily choose the word that has the longest suffix match with the
-      // remaining unmatched prefix.
-      int maxMatchSuffix = 0;
-      for (int i = 0; i < words.length; ++i)
-        maxMatchSuffix = Math.max(maxMatchSuffix, lpsList[i][words[i].length() + unmatchedPrefix]);
-      if (maxMatchSuffix == 0)
-        return -1;
-      ++ans;
-      unmatchedPrefix -= maxMatchSuffix;
-    }
-
-    return ans;
-  }
-
-  // Returns the lps array, where lps[i] is the length of the longest prefix of
-  // pattern[0..i] which is also a suffix of this substring.
-  private int[] getLPS(final String pattern) {
-    int[] lps = new int[pattern.length()];
-    for (int i = 1, j = 0; i < pattern.length(); ++i) {
-      while (j > 0 && pattern.charAt(j) != pattern.charAt(i))
-        j = lps[j - 1];
-      if (pattern.charAt(i) == pattern.charAt(j))
-        lps[i] = ++j;
-    }
-    return lps;
-  }
-}
diff --git a/solutions/3291. Minimum Number of Valid Strings to Form Target I/3291.py b/solutions/3291. Minimum Number of Valid Strings to Form Target I/3291.py
deleted file mode 100644
index a6b6093d2c5..00000000000
--- a/solutions/3291. Minimum Number of Valid Strings to Form Target I/3291.py	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution:
-  def minValidStrings(self, words: list[str], target: str) -> int:
-    ans = 0
-    unmatchedPrefix = len(target)
-    lpsList = [self._getLPS(word + '#' + target) for word in words]
-
-    while unmatchedPrefix > 0:
-      # Greedily choose the word that has the longest suffix match with the
-      # remaining unmatched prefix.
-      maxMatchSuffix = 0
-      for lps, word in zip(lpsList, words):
-        maxMatchSuffix = max(maxMatchSuffix, lps[len(word) + unmatchedPrefix])
-      if maxMatchSuffix == 0:
-        return -1
-      ans += 1
-      unmatchedPrefix -= maxMatchSuffix
-
-    return ans
-
-  def _getLPS(self, pattern: str) -> list[int]:
-    """
-    Returns the lps array, where lps[i] is the length of the longest prefix of
-    pattern[0..i] which is also a suffix of this substring.
-    """
-    lps = [0] * len(pattern)
-    j = 0
-    for i in range(1, len(pattern)):
-      while j > 0 and pattern[j] != pattern[i]:
-        j = lps[j - 1]
-      if pattern[i] == pattern[j]:
-        lps[i] = j + 1
-        j += 1
-    return lps
diff --git a/solutions/3292. Minimum Number of Valid Strings to Form Target II/3292.cpp b/solutions/3292. Minimum Number of Valid Strings to Form Target II/3292.cpp
deleted file mode 100644
index cf487d77d57..00000000000
--- a/solutions/3292. Minimum Number of Valid Strings to Form Target II/3292.cpp	
+++ /dev/null
@@ -1,41 +0,0 @@
-class Solution {
- public:
-  // 3291. Minimum Number of Valid Strings to Form Target I
-  int minValidStrings(vector<string>& words, string target) {
-    int ans = 0;
-    int unmatchedPrefix = target.length();
-    vector<vector<int>> lpsList;
-
-    for (const string& word : words)
-      lpsList.push_back(getLPS(word + '#' + target));
-
-    while (unmatchedPrefix > 0) {
-      // Greedily choose the word that has the longest suffix match with the
-      // remaining unmatched prefix.
-      int maxMatchSuffix = 0;
-      for (int i = 0; i < words.size(); ++i)
-        maxMatchSuffix = max(maxMatchSuffix,
-                             lpsList[i][words[i].length() + unmatchedPrefix]);
-      if (maxMatchSuffix == 0)
-        return -1;
-      ++ans;
-      unmatchedPrefix -= maxMatchSuffix;
-    }
-
-    return ans;
-  }
-
- private:
-  // Returns the lps array, where lps[i] is the length of the longest prefix of
-  // pattern[0..i] which is also a suffix of this substring.
-  vector<int> getLPS(const string& pattern) {
-    vector<int> lps(pattern.length());
-    for (int i = 1, j = 0; i < pattern.length(); ++i) {
-      while (j > 0 && pattern[j] != pattern[i])
-        j = lps[j - 1];
-      if (pattern[i] == pattern[j])
-        lps[i] = ++j;
-    }
-    return lps;
-  }
-};
diff --git a/solutions/3292. Minimum Number of Valid Strings to Form Target II/3292.java b/solutions/3292. Minimum Number of Valid Strings to Form Target II/3292.java
deleted file mode 100644
index d166d9414e6..00000000000
--- a/solutions/3292. Minimum Number of Valid Strings to Form Target II/3292.java	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
-  // 3291. Minimum Number of Valid Strings to Form Target I
-  public int minValidStrings(String[] words, String target) {
-    int ans = 0;
-    int unmatchedPrefix = target.length();
-    int[][] lpsList = new int[words.length][];
-
-    for (int i = 0; i < words.length; ++i)
-      lpsList[i] = getLPS(words[i] + '#' + target);
-
-    while (unmatchedPrefix > 0) {
-      // Greedily choose the word that has the longest suffix match with the
-      // remaining unmatched prefix.
-      int maxMatchSuffix = 0;
-      for (int i = 0; i < words.length; ++i)
-        maxMatchSuffix = Math.max(maxMatchSuffix, lpsList[i][words[i].length() + unmatchedPrefix]);
-      if (maxMatchSuffix == 0)
-        return -1;
-      ++ans;
-      unmatchedPrefix -= maxMatchSuffix;
-    }
-
-    return ans;
-  }
-
-  // Returns the lps array, where lps[i] is the length of the longest prefix of
-  // pattern[0..i] which is also a suffix of this substring.
-  private int[] getLPS(final String pattern) {
-    int[] lps = new int[pattern.length()];
-    for (int i = 1, j = 0; i < pattern.length(); ++i) {
-      while (j > 0 && pattern.charAt(j) != pattern.charAt(i))
-        j = lps[j - 1];
-      if (pattern.charAt(i) == pattern.charAt(j))
-        lps[i] = ++j;
-    }
-    return lps;
-  }
-}
diff --git a/solutions/3292. Minimum Number of Valid Strings to Form Target II/3292.py b/solutions/3292. Minimum Number of Valid Strings to Form Target II/3292.py
deleted file mode 100644
index bb3a9b48ae6..00000000000
--- a/solutions/3292. Minimum Number of Valid Strings to Form Target II/3292.py	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution:
-  # 3291. Minimum Number of Valid Strings to Form Target I
-  def minValidStrings(self, words: list[str], target: str) -> int:
-    ans = 0
-    unmatchedPrefix = len(target)
-    lpsList = [self._getLPS(word + '#' + target) for word in words]
-
-    while unmatchedPrefix > 0:
-      # Greedily choose the word that has the longest suffix match with the
-      # remaining unmatched prefix.
-      maxMatchSuffix = 0
-      for lps, word in zip(lpsList, words):
-        maxMatchSuffix = max(maxMatchSuffix, lps[len(word) + unmatchedPrefix])
-      if maxMatchSuffix == 0:
-        return -1
-      ans += 1
-      unmatchedPrefix -= maxMatchSuffix
-
-    return ans
-
-  def _getLPS(self, pattern: str) -> list[int]:
-    """
-    Returns the lps array, where lps[i] is the length of the longest prefix of
-    pattern[0..i] which is also a suffix of this substring.
-    """
-    lps = [0] * len(pattern)
-    j = 0
-    for i in range(1, len(pattern)):
-      while j > 0 and pattern[j] != pattern[i]:
-        j = lps[j - 1]
-      if pattern[i] == pattern[j]:
-        lps[i] = j + 1
-        j += 1
-    return lps
diff --git a/solutions/3293. Calculate Product Final Price/3293.sql b/solutions/3293. Calculate Product Final Price/3293.sql
deleted file mode 100644
index c1f4a06f288..00000000000
--- a/solutions/3293. Calculate Product Final Price/3293.sql	
+++ /dev/null
@@ -1,9 +0,0 @@
-SELECT
-  Products.product_id,
-  Products.price - (
-    Products.price * IFNULL(Discounts.discount, 0) / 100
-  ) AS final_price,
-  Products.category
-FROM Products
-LEFT JOIN Discounts
-  USING (category);
diff --git a/solutions/3294. Convert Doubly Linked List to Array II/3294.cpp b/solutions/3294. Convert Doubly Linked List to Array II/3294.cpp
deleted file mode 100644
index 39ba1a864b8..00000000000
--- a/solutions/3294. Convert Doubly Linked List to Array II/3294.cpp	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
- public:
-  vector<int> toArray(Node* node) {
-    vector<int> ans;
-    Node* curr = node;
-
-    while (curr->prev != nullptr)
-      curr = curr->prev;
-
-    while (curr != nullptr) {
-      ans.push_back(curr->val);
-      curr = curr->next;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3294. Convert Doubly Linked List to Array II/3294.java b/solutions/3294. Convert Doubly Linked List to Array II/3294.java
deleted file mode 100644
index 3d257c700f0..00000000000
--- a/solutions/3294. Convert Doubly Linked List to Array II/3294.java	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution {
-  public int[] toArray(Node node) {
-    List<Integer> ans = new ArrayList<>();
-    Node curr = node;
-
-    while (curr.prev != null)
-      curr = curr.prev;
-
-    while (curr != null) {
-      ans.add(curr.val);
-      curr = curr.next;
-    }
-
-    return ans.stream().mapToInt(Integer::intValue).toArray();
-  }
-}
diff --git a/solutions/3294. Convert Doubly Linked List to Array II/3294.py b/solutions/3294. Convert Doubly Linked List to Array II/3294.py
deleted file mode 100644
index 2ebf2ab7267..00000000000
--- a/solutions/3294. Convert Doubly Linked List to Array II/3294.py	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution:
-  def toArray(self, node: 'Optional[Node]') -> list[int]:
-    ans = []
-    curr = node
-
-    while curr.prev:
-      curr = curr.prev
-
-    while curr:
-      ans.append(curr.val)
-      curr = curr.next
-
-    return ans
diff --git a/solutions/3295. Report Spam Message/3295.cpp b/solutions/3295. Report Spam Message/3295.cpp
deleted file mode 100644
index d4666809626..00000000000
--- a/solutions/3295. Report Spam Message/3295.cpp	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
- public:
-  bool reportSpam(vector<string>& message, vector<string>& bannedWords) {
-    const unordered_set<string> bannedWordsSet{bannedWords.begin(),
-                                               bannedWords.end()};
-    int count = 0;
-
-    for (const string& word : message)
-      if (bannedWordsSet.contains(word) && ++count > 1)
-        return true;
-
-    return false;
-  }
-};
diff --git a/solutions/3295. Report Spam Message/3295.java b/solutions/3295. Report Spam Message/3295.java
deleted file mode 100644
index ec6b3954f5f..00000000000
--- a/solutions/3295. Report Spam Message/3295.java	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution {
-  public boolean reportSpam(String[] message, String[] bannedWords) {
-    Set<String> bannedWordsSet = new HashSet<>(Arrays.asList(bannedWords));
-    int count = 0;
-
-    for (final String word : message)
-      if (bannedWordsSet.contains(word) && ++count > 1)
-        return true;
-
-    return false;
-  }
-}
diff --git a/solutions/3295. Report Spam Message/3295.py b/solutions/3295. Report Spam Message/3295.py
deleted file mode 100644
index d19fa59d616..00000000000
--- a/solutions/3295. Report Spam Message/3295.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def reportSpam(self, message: list[str], bannedWords: list[str]) -> bool:
-    bannedWordsSet = set(bannedWords)
-    return sum(word in bannedWordsSet for word in message) > 1
diff --git a/solutions/3296. Minimum Number of Seconds to Make Mountain Height Zero/3296.cpp b/solutions/3296. Minimum Number of Seconds to Make Mountain Height Zero/3296.cpp
deleted file mode 100644
index f56bf29f9f7..00000000000
--- a/solutions/3296. Minimum Number of Seconds to Make Mountain Height Zero/3296.cpp	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution {
- public:
-  long long minNumberOfSeconds(int mountainHeight, vector<int>& workerTimes) {
-    long l = 1;
-    long r = static_cast<long>(ranges::min(workerTimes)) * mountainHeight *
-             (mountainHeight + 1) / 2;
-
-    while (l < r) {
-      const long m = (l + r) / 2;
-      if (getReducedHeight(workerTimes, m) < mountainHeight)
-        l = m + 1;
-      else
-        r = m;
-    }
-
-    return l;
-  }
-
- private:
-  // Returns the total height reduced by all workers in `m` seconds.
-  int getReducedHeight(const vector<int>& workerTimes, long m) {
-    int reducedHeight = 0;
-    for (const int workerTime : workerTimes)
-      // The height `x` that a worker with working time `w` reduces in `m`
-      // seconds.
-      // w * (1 + 2 + ... + x) <= m
-      //       (1 + x) * x / 2 <= m / w
-      //   x^2 + x - 2 * m / w <= 0
-      //                     x <= (-1 + sqrt(1 + 8 * m / w)) / 2
-      reducedHeight += (-1 + sqrt(1 + 8 * m / workerTime)) / 2;
-    return reducedHeight;
-  }
-};
diff --git a/solutions/3296. Minimum Number of Seconds to Make Mountain Height Zero/3296.java b/solutions/3296. Minimum Number of Seconds to Make Mountain Height Zero/3296.java
deleted file mode 100644
index b9ec5c1ac59..00000000000
--- a/solutions/3296. Minimum Number of Seconds to Make Mountain Height Zero/3296.java	
+++ /dev/null
@@ -1,31 +0,0 @@
-class Solution {
-  public long minNumberOfSeconds(int mountainHeight, int[] workerTimes) {
-    long l = 1;
-    long r = (long) Arrays.stream(workerTimes).min().getAsInt() * mountainHeight *
-             (mountainHeight + 1) / 2;
-
-    while (l < r) {
-      final long m = (l + r) / 2;
-      if (getReducedHeight(workerTimes, m) < mountainHeight)
-        l = m + 1;
-      else
-        r = m;
-    }
-
-    return l;
-  }
-
-  // Returns the total height reduced by all workers in `m` seconds.
-  private int getReducedHeight(int[] workerTimes, long m) {
-    int reducedHeight = 0;
-    for (int workerTime : workerTimes)
-      // The height `x` that a worker with working time `w` reduces in `m`
-      // seconds.
-      // w * (1 + 2 + ... + x) <= m
-      //       (1 + x) * x / 2 <= m / w
-      //   x^2 + x - 2 * m / w <= 0
-      //                     x <= (-1 + sqrt(1 + 8 * m / w)) / 2
-      reducedHeight += (int) ((-1 + Math.sqrt(1 + 8 * m / workerTime)) / 2);
-    return reducedHeight;
-  }
-}
diff --git a/solutions/3296. Minimum Number of Seconds to Make Mountain Height Zero/3296.py b/solutions/3296. Minimum Number of Seconds to Make Mountain Height Zero/3296.py
deleted file mode 100644
index 9c84e1ee453..00000000000
--- a/solutions/3296. Minimum Number of Seconds to Make Mountain Height Zero/3296.py	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution:
-  def minNumberOfSeconds(
-      self,
-      mountainHeight: int,
-      workerTimes: list[int]
-  ) -> int:
-    def getReducedHeight(m: int) -> int:
-      """Returns the total height reduced by all workers in `m` seconds."""
-      # The height `x` that a worker with working time `w` reduces in `m`
-      # seconds.
-      # w * (1 + 2 + ... + x) <= m
-      #       (1 + x) * x / 2 <= m / w
-      #   x^2 + x - 2 * m / w <= 0
-      #                     x <= (-1 + sqrt(1 + 8 * m / w)) / 2
-      return sum((-1 + math.sqrt(1 + 8 * m // workerTime)) // 2
-                 for workerTime in workerTimes)
-
-    l = 1
-    r = min(workerTimes) * mountainHeight * (mountainHeight + 1) // 2
-    return bisect.bisect_left(range(l, r), mountainHeight,
-                              key=getReducedHeight) + l
diff --git a/solutions/3297. Count Substrings That Can Be Rearranged to Contain a String I/3297.cpp b/solutions/3297. Count Substrings That Can Be Rearranged to Contain a String I/3297.cpp
deleted file mode 100644
index 082f9ef3a52..00000000000
--- a/solutions/3297. Count Substrings That Can Be Rearranged to Contain a String I/3297.cpp	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
- public:
-  long long validSubstringCount(string word1, string word2) {
-    long ans = 0;
-    int required = word2.length();
-    vector<int> count(26);
-
-    for (const char c : word2)
-      ++count[c - 'a'];
-
-    for (int l = 0, r = 0; r < word1.length(); ++r) {
-      if (--count[word1[r] - 'a'] >= 0)
-        --required;
-      while (required == 0) {
-        // Add valid substrings containing word1[l..r] to the answer. They are
-        // word1[l..r], word1[l..r + 1], ..., word1[l..n - 1].
-        ans += word1.length() - r;
-        if (++count[word1[l++] - 'a'] > 0)
-          ++required;
-      }
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3297. Count Substrings That Can Be Rearranged to Contain a String I/3297.java b/solutions/3297. Count Substrings That Can Be Rearranged to Contain a String I/3297.java
deleted file mode 100644
index 34be2b1cc99..00000000000
--- a/solutions/3297. Count Substrings That Can Be Rearranged to Contain a String I/3297.java	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
-  public long validSubstringCount(String word1, String word2) {
-    long ans = 0;
-    int required = word2.length();
-    int[] count = new int[26];
-
-    for (final char c : word2.toCharArray())
-      ++count[c - 'a'];
-
-    for (int l = 0, r = 0; r < word1.length(); ++r) {
-      if (--count[word1.charAt(r) - 'a'] >= 0)
-        --required;
-      while (required == 0) {
-        // Add valid substrings containing word1[l..r] to the answer. They are
-        // word1[l..r], word1[l..r + 1], ..., word1[l..n - 1].
-        ans += word1.length() - r;
-        if (++count[word1.charAt(l++) - 'a'] > 0)
-          ++required;
-      }
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3297. Count Substrings That Can Be Rearranged to Contain a String I/3297.py b/solutions/3297. Count Substrings That Can Be Rearranged to Contain a String I/3297.py
deleted file mode 100644
index d9e4e359a99..00000000000
--- a/solutions/3297. Count Substrings That Can Be Rearranged to Contain a String I/3297.py	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution:
-  def validSubstringCount(self, word1: str, word2: str) -> int:
-    ans = 0
-    count = collections.Counter(word2)
-    required = len(word2)
-
-    l = 0
-    for r, c in enumerate(word1):
-      count[c] -= 1
-      if count[c] >= 0:
-        required -= 1
-      while required == 0:
-        # Add valid substrings containing word1[l..r] to the answer. They are
-        # word1[l..r], word1[l..r + 1], ..., word1[l..n - 1].
-        ans += len(word1) - r
-        count[word1[l]] += 1
-        if count[word1[l]] > 0:
-          required += 1
-        l += 1
-
-    return ans
diff --git a/solutions/3298. Count Substrings That Can Be Rearranged to Contain a String II/3298.cpp b/solutions/3298. Count Substrings That Can Be Rearranged to Contain a String II/3298.cpp
deleted file mode 100644
index ccab04d4add..00000000000
--- a/solutions/3298. Count Substrings That Can Be Rearranged to Contain a String II/3298.cpp	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution {
- public:
-  // Same as 3297. Count Substrings That Can Be Rearranged to Contain a String I
-  long long validSubstringCount(string word1, string word2) {
-    long ans = 0;
-    int required = word2.length();
-    vector<int> count(26);
-
-    for (const char c : word2)
-      ++count[c - 'a'];
-
-    for (int l = 0, r = 0; r < word1.length(); ++r) {
-      if (--count[word1[r] - 'a'] >= 0)
-        --required;
-      while (required == 0) {
-        // Add valid substrings containing word1[l..r] to the answer. They are
-        // word1[l..r], word1[l..r + 1], ..., word1[l..n - 1].
-        ans += word1.length() - r;
-        if (++count[word1[l++] - 'a'] > 0)
-          ++required;
-      }
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3298. Count Substrings That Can Be Rearranged to Contain a String II/3298.java b/solutions/3298. Count Substrings That Can Be Rearranged to Contain a String II/3298.java
deleted file mode 100644
index d4f2c9b8e34..00000000000
--- a/solutions/3298. Count Substrings That Can Be Rearranged to Contain a String II/3298.java	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
-  // Same as 3297. Count Substrings That Can Be Rearranged to Contain a String I
-  public long validSubstringCount(String word1, String word2) {
-    long ans = 0;
-    int required = word2.length();
-    int[] count = new int[26];
-
-    for (final char c : word2.toCharArray())
-      ++count[c - 'a'];
-
-    for (int l = 0, r = 0; r < word1.length(); ++r) {
-      if (--count[word1.charAt(r) - 'a'] >= 0)
-        --required;
-      while (required == 0) {
-        // Add valid substrings containing word1[l..r] to the answer. They are
-        // word1[l..r], word1[l..r + 1], ..., word1[l..n - 1].
-        ans += word1.length() - r;
-        if (++count[word1.charAt(l++) - 'a'] > 0)
-          ++required;
-      }
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3298. Count Substrings That Can Be Rearranged to Contain a String II/3298.py b/solutions/3298. Count Substrings That Can Be Rearranged to Contain a String II/3298.py
deleted file mode 100644
index e53644109af..00000000000
--- a/solutions/3298. Count Substrings That Can Be Rearranged to Contain a String II/3298.py	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution:
-  # Same as 3297. Count Substrings That Can Be Rearranged to Contain a String I
-  def validSubstringCount(self, word1: str, word2: str) -> int:
-    ans = 0
-    count = collections.Counter(word2)
-    required = len(word2)
-
-    l = 0
-    for r, c in enumerate(word1):
-      count[c] -= 1
-      if count[c] >= 0:
-        required -= 1
-      while required == 0:
-        # Add valid substrings containing word1[l..r] to the answer. They are
-        # word1[l..r], word1[l..r + 1], ..., word1[l..n - 1].
-        ans += len(word1) - r
-        count[word1[l]] += 1
-        if count[word1[l]] > 0:
-          required += 1
-        l += 1
-
-    return ans
diff --git a/solutions/3299. Sum of Consecutive Subsequences/3299.cpp b/solutions/3299. Sum of Consecutive Subsequences/3299.cpp
deleted file mode 100644
index 9694fa5a24e..00000000000
--- a/solutions/3299. Sum of Consecutive Subsequences/3299.cpp	
+++ /dev/null
@@ -1,63 +0,0 @@
-class Solution {
- public:
-  int getSum(vector<int>& nums) {
-    const int increasingSequenceSum = getSequenceSum(nums, 1);
-    const int decreasingSequenceSum = getSequenceSum(nums, -1);
-    const int arraySum = getArraySum(nums);
-    return (increasingSequenceSum + decreasingSequenceSum -
-            static_cast<long>(arraySum) + kMod) %
-           kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Returns the sum of all sequences in the array that are in consecutive
-  // increasing order if `direction` is 1, or in consecutive decreasing order if
-  // `direction` is -1.
-  int getSequenceSum(const vector<int>& nums, int direction) {
-    const int n = nums.size();
-    long sequenceSum = 0;
-    // {num: the number of subsequences ending in `num` so far}
-    unordered_map<int, int> prefixCount;
-    // {num: the number of subsequences starting from `num` so far}
-    unordered_map<int, int> suffixCount;
-    // prefixSubseqs[i] := the number of subsequences ending in nums[i]
-    vector<int> prefixSubseqs(n);
-    // suffixSubseqs[i] := the number of subsequences starting from nums[i]
-    vector<int> suffixSubseqs(n);
-
-    for (int i = 0; i < n; ++i) {
-      const int prevNum = nums[i] - direction;
-      const int subseqsCount =
-          (prefixCount.contains(prevNum) ? prefixCount[prevNum] : 0) + 1;
-      prefixSubseqs[i] = subseqsCount;
-      prefixCount[nums[i]] += subseqsCount;
-      prefixCount[nums[i]] %= kMod;
-    }
-
-    for (int i = n - 1; i >= 0; --i) {
-      const int nextNum = nums[i] + direction;
-      const int subseqsCount =
-          (suffixCount.contains(nextNum) ? suffixCount[nextNum] : 0) + 1;
-      suffixSubseqs[i] = subseqsCount;
-      suffixCount[nums[i]] += subseqsCount;
-      suffixCount[nums[i]] %= kMod;
-    }
-
-    for (int i = 0; i < n; ++i) {
-      sequenceSum += static_cast<long>(nums[i]) * prefixSubseqs[i] % kMod *
-                     suffixSubseqs[i];
-      sequenceSum %= kMod;
-    }
-
-    return sequenceSum;
-  }
-
-  int getArraySum(const vector<int>& nums) {
-    int arraySum = 0;
-    for (const int num : nums)
-      arraySum = (arraySum + num) % kMod;
-    return arraySum;
-  }
-};
diff --git a/solutions/3299. Sum of Consecutive Subsequences/3299.java b/solutions/3299. Sum of Consecutive Subsequences/3299.java
deleted file mode 100644
index 8fda25e3463..00000000000
--- a/solutions/3299. Sum of Consecutive Subsequences/3299.java	
+++ /dev/null
@@ -1,56 +0,0 @@
-class Solution {
-  public int getSum(int[] nums) {
-    final long increasingSequenceSum = getSequenceSum(nums, 1);
-    final long decreasingSequenceSum = getSequenceSum(nums, -1);
-    final long arraySum = getArraySum(nums);
-    return (int) ((increasingSequenceSum + decreasingSequenceSum - arraySum + MOD) % MOD);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  // Returns the sum of all sequences in the array that are in consecutive
-  // increasing order if `direction` is 1, or in consecutive decreasing order if
-  // `direction` is -1.
-  private long getSequenceSum(int[] nums, int direction) {
-    int n = nums.length;
-    long sequenceSum = 0;
-    // {num: the number of subsequences ending in `num` so far}
-    Map<Integer, Integer> prefixCount = new HashMap<>();
-    // {num: the number of subsequences starting from `num` so far}
-    Map<Integer, Integer> suffixCount = new HashMap<>();
-    // prefixSubseqs[i] := the number of subsequences ending in nums[i]
-    int[] prefixSubseqs = new int[n];
-    // suffixSubseqs[i] := the number of subsequences starting from nums[i]
-    int[] suffixSubseqs = new int[n];
-
-    for (int i = 0; i < n; ++i) {
-      final int prevNum = nums[i] - direction;
-      final int subseqsCount = prefixCount.getOrDefault(prevNum, 0) + 1;
-      prefixSubseqs[i] = subseqsCount;
-      prefixCount.merge(nums[i], subseqsCount, Integer::sum);
-      prefixCount.put(nums[i], prefixCount.get(nums[i]) % MOD);
-    }
-
-    for (int i = n - 1; i >= 0; --i) {
-      int nextNum = nums[i] + direction;
-      int subseqsCount = suffixCount.getOrDefault(nextNum, 0) + 1;
-      suffixSubseqs[i] = subseqsCount;
-      suffixCount.merge(nums[i], subseqsCount, Integer::sum);
-      suffixCount.put(nums[i], suffixCount.get(nums[i]) % MOD);
-    }
-
-    for (int i = 0; i < n; ++i) {
-      sequenceSum += (long) nums[i] * prefixSubseqs[i] % MOD * suffixSubseqs[i];
-      sequenceSum %= MOD;
-    }
-
-    return sequenceSum;
-  }
-
-  private int getArraySum(int[] nums) {
-    int arraySum = 0;
-    for (int num : nums)
-      arraySum = (arraySum + num) % MOD;
-    return arraySum;
-  }
-}
diff --git a/solutions/3299. Sum of Consecutive Subsequences/3299.py b/solutions/3299. Sum of Consecutive Subsequences/3299.py
deleted file mode 100644
index de9c3a83883..00000000000
--- a/solutions/3299. Sum of Consecutive Subsequences/3299.py	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution:
-  def getSum(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-    n = len(nums)
-
-    def getSequenceSum(nums: list[int], direction: int) -> int:
-      """
-      Returns the sum of all sequences in the array that are in consecutive
-      increasing order if `direction` is 1, or in consecutive decreasing order
-      if `direction` is -1."""
-      sequenceSum = 0
-      # {num: the number of subsequences ending in `num` so far}
-      prefixCount = collections.Counter()
-      # {num: the number of subsequences starting from `num` so far}
-      suffixCount = collections.Counter()
-      # prefixSubseqs[i] := the number of subsequences ending in nums[i]
-      prefixSubseqs = [0] * n
-      # suffixSubseqs[i] := the number of subsequences starting from nums[i]
-      suffixSubseqs = [0] * n
-
-      for i, num in enumerate(nums):
-        prevNum = num - direction
-        freq = prefixCount[prevNum] + 1
-        prefixSubseqs[i] = freq
-        prefixCount[num] += freq
-        prefixCount[num] %= MOD
-
-      for i, num in reversed(list(enumerate(nums))):
-        nextNum = num + direction
-        freq = suffixCount[nextNum] + 1
-        suffixSubseqs[i] = freq
-        suffixCount[num] += freq
-        suffixCount[num] %= MOD
-
-      for num, prefixSubseq, suffixSubseq in zip(
-              nums, prefixSubseqs, suffixSubseqs):
-        sequenceSum += num * prefixSubseq * suffixSubseq
-        sequenceSum %= MOD
-
-      return sequenceSum
-
-    increasingSequenceSum = getSequenceSum(nums, 1)
-    decreasingSequenceSum = getSequenceSum(nums, -1)
-    return (increasingSequenceSum + decreasingSequenceSum - sum(nums) + MOD) % MOD
diff --git a/solutions/33. Search in Rotated Sorted Array/33.py b/solutions/33. Search in Rotated Sorted Array/33.py
index 271ab22818e..5e3a82b4e31 100644
--- a/solutions/33. Search in Rotated Sorted Array/33.py	
+++ b/solutions/33. Search in Rotated Sorted Array/33.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def search(self, nums: list[int], target: int) -> int:
+  def search(self, nums: List[int], target: int) -> int:
     l = 0
     r = len(nums) - 1
 
diff --git a/solutions/330. Patching Array/330.py b/solutions/330. Patching Array/330.py
index 2f9bc3b8a57..701dc115878 100644
--- a/solutions/330. Patching Array/330.py	
+++ b/solutions/330. Patching Array/330.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minPatches(self, nums: list[int], n: int) -> int:
+  def minPatches(self, nums: List[int], n: int) -> int:
     ans = 0
     i = 0  # nums' index
     miss = 1  # the minimum sum in [1, n] we might miss
diff --git a/solutions/3300. Minimum Element After Replacement With Digit Sum/3300.cpp b/solutions/3300. Minimum Element After Replacement With Digit Sum/3300.cpp
deleted file mode 100644
index 8da0bcd4009..00000000000
--- a/solutions/3300. Minimum Element After Replacement With Digit Sum/3300.cpp	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
- public:
-  int minElement(vector<int>& nums) {
-    int ans = INT_MAX;
-    for (const int num : nums)
-      ans = min(ans, getDigitSum(num));
-    return ans;
-  }
-
- private:
-  int getDigitSum(int num) {
-    int digitSum = 0;
-    while (num > 0) {
-      digitSum += num % 10;
-      num /= 10;
-    }
-    return digitSum;
-  }
-};
diff --git a/solutions/3300. Minimum Element After Replacement With Digit Sum/3300.java b/solutions/3300. Minimum Element After Replacement With Digit Sum/3300.java
deleted file mode 100644
index d4b31bce7c9..00000000000
--- a/solutions/3300. Minimum Element After Replacement With Digit Sum/3300.java	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
-  public int minElement(int[] nums) {
-    int ans = Integer.MAX_VALUE;
-    for (final int num : nums)
-      ans = Math.min(ans, getDigitSum(num));
-    return ans;
-  }
-
-  private int getDigitSum(int num) {
-    int digitSum = 0;
-    while (num > 0) {
-      digitSum += num % 10;
-      num /= 10;
-    }
-    return digitSum;
-  }
-}
diff --git a/solutions/3300. Minimum Element After Replacement With Digit Sum/3300.py b/solutions/3300. Minimum Element After Replacement With Digit Sum/3300.py
deleted file mode 100644
index 4e8c0dd6242..00000000000
--- a/solutions/3300. Minimum Element After Replacement With Digit Sum/3300.py	
+++ /dev/null
@@ -1,3 +0,0 @@
-class Solution:
-  def minElement(self, nums: list[int]) -> int:
-    return min(sum(map(int, str(num))) for num in nums)
diff --git a/solutions/3301. Maximize the Total Height of Unique Towers/3301.cpp b/solutions/3301. Maximize the Total Height of Unique Towers/3301.cpp
deleted file mode 100644
index 41cb1b876f1..00000000000
--- a/solutions/3301. Maximize the Total Height of Unique Towers/3301.cpp	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
- public:
-  long long maximumTotalSum(vector<int>& maximumHeight) {
-    long ans = 0;
-    int mn = INT_MAX;
-
-    ranges::sort(maximumHeight, greater<>());
-
-    for (const int height : maximumHeight) {
-      const int assigned = min(height, mn - 1);
-      if (assigned == 0)
-        return -1;
-      ans += assigned;
-      mn = assigned;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3301. Maximize the Total Height of Unique Towers/3301.java b/solutions/3301. Maximize the Total Height of Unique Towers/3301.java
deleted file mode 100644
index 70b8d7e778b..00000000000
--- a/solutions/3301. Maximize the Total Height of Unique Towers/3301.java	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
-  public long maximumTotalSum(int[] maximumHeight) {
-    long ans = 0;
-    int mn = Integer.MAX_VALUE;
-
-    Arrays.sort(maximumHeight);
-
-    for (int i = maximumHeight.length - 1; i >= 0; --i) {
-      final int assigned = Math.min(maximumHeight[i], mn - 1);
-      if (assigned == 0)
-        return -1;
-      ans += assigned;
-      mn = assigned;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3301. Maximize the Total Height of Unique Towers/3301.py b/solutions/3301. Maximize the Total Height of Unique Towers/3301.py
deleted file mode 100644
index a92e63d9544..00000000000
--- a/solutions/3301. Maximize the Total Height of Unique Towers/3301.py	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution:
-  def maximumTotalSum(self, maximumHeight: list[int]) -> int:
-    ans = 0
-    mn = math.inf
-
-    for height in sorted(maximumHeight, reverse=True):
-      assigned = min(height, mn - 1)
-      if assigned == 0:
-        return -1
-      ans += assigned
-      mn = assigned
-
-    return ans
diff --git a/solutions/3302. Find the Lexicographically Smallest Valid Sequence/3302.cpp b/solutions/3302. Find the Lexicographically Smallest Valid Sequence/3302.cpp
deleted file mode 100644
index 340a3d4d2a1..00000000000
--- a/solutions/3302. Find the Lexicographically Smallest Valid Sequence/3302.cpp	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution {
- public:
-  vector<int> validSequence(string word1, string word2) {
-    vector<int> ans(word2.length());
-    // last[j] := the index i of the last occurrence in word1, where
-    // word1[i] == word2[j]
-    vector<int> last(word2.length(), -1);
-
-    int i = word1.length() - 1;
-    int j = word2.length() - 1;
-    while (i >= 0 && j >= 0) {
-      if (word1[i] == word2[j])
-        last[j--] = i;
-      --i;
-    }
-
-    bool canSkip = true;
-    j = 0;
-    for (i = 0; i < word1.length(); ++i) {
-      if (j == word2.length())
-        break;
-      if (word1[i] == word2[j]) {
-        ans[j++] = i;
-      } else if (canSkip && (j == word2.length() - 1 || i < last[j + 1])) {
-        canSkip = false;
-        ans[j++] = i;
-      }
-    }
-
-    return j == word2.length() ? ans : vector<int>();
-  }
-};
diff --git a/solutions/3302. Find the Lexicographically Smallest Valid Sequence/3302.java b/solutions/3302. Find the Lexicographically Smallest Valid Sequence/3302.java
deleted file mode 100644
index c890dc427eb..00000000000
--- a/solutions/3302. Find the Lexicographically Smallest Valid Sequence/3302.java	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution {
-  public int[] validSequence(String word1, String word2) {
-    int[] ans = new int[word2.length()];
-    // last[j] := the index i of the last occurrence in word1, where
-    // word1[i] == word2[j]
-    int[] last = new int[word2.length()];
-    Arrays.fill(last, -1);
-
-    int i = word1.length() - 1;
-    int j = word2.length() - 1;
-    while (i >= 0 && j >= 0) {
-      if (word1.charAt(i) == word2.charAt(j))
-        last[j--] = i;
-      --i;
-    }
-
-    boolean canSkip = true;
-    j = 0;
-    for (i = 0; i < word1.length(); ++i) {
-      if (j == word2.length())
-        break;
-      if (word1.charAt(i) == word2.charAt(j)) {
-        ans[j++] = i;
-      } else if (canSkip && (j == word2.length() - 1 || i < last[j + 1])) {
-        canSkip = false;
-        ans[j++] = i;
-      }
-    }
-
-    return j == word2.length() ? ans : new int[0];
-  }
-}
diff --git a/solutions/3302. Find the Lexicographically Smallest Valid Sequence/3302.py b/solutions/3302. Find the Lexicographically Smallest Valid Sequence/3302.py
deleted file mode 100644
index 1ffae28c8a8..00000000000
--- a/solutions/3302. Find the Lexicographically Smallest Valid Sequence/3302.py	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution:
-  def validSequence(self, word1: str, word2: str) -> list[int]:
-    ans = []
-    # last[j] := the index i of the last occurrence in word1, where
-    # word1[i] == word2[j]
-    last = [-1] * len(word2)
-
-    i = len(word1) - 1
-    j = len(word2) - 1
-    while i >= 0 and j >= 0:
-      if word1[i] == word2[j]:
-        last[j] = i
-        j -= 1
-      i -= 1
-
-    canSkip = True
-    j = 0
-    for i, c in enumerate(word1):
-      if j == len(word2):
-        break
-      if c == word2[j]:
-        ans.append(i)
-        j += 1
-      elif canSkip and (j == len(word2) - 1 or i < last[j + 1]):
-        canSkip = False
-        ans.append(i)
-        j += 1
-
-    return ans if j == len(word2) else []
diff --git a/solutions/3303. Find the Occurrence of First Almost Equal Substring/3303.cpp b/solutions/3303. Find the Occurrence of First Almost Equal Substring/3303.cpp
deleted file mode 100644
index 082394b8814..00000000000
--- a/solutions/3303. Find the Occurrence of First Almost Equal Substring/3303.cpp	
+++ /dev/null
@@ -1,42 +0,0 @@
-class Solution {
- public:
-  int minStartingIndex(string s, string pattern) {
-    const vector<int> z1 = zFunction(pattern + s);
-    const vector<int> z2 = zFunction(reversed(pattern) + reversed(s));
-
-    // Match s[i..i + len(pattern) - 1] with `pattern` from both the prefix and
-    // the suffix.
-    for (int i = 0; i <= s.length() - pattern.length(); ++i)
-      if (z1[pattern.length() + i] + z2[s.length() - i] >= pattern.length() - 1)
-        return i;
-
-    return -1;
-  }
-
- private:
-  // Returns the z array, where z[i] is the length of the longest prefix of
-  // s[i..n) which is also a prefix of s.
-  //
-  // https://cp-algorithms.com/string/z-function.html#implementation
-  vector<int> zFunction(const string& s) {
-    const int n = s.length();
-    vector<int> z(n);
-    int l = 0;
-    int r = 0;
-    for (int i = 1; i < n; ++i) {
-      if (i < r)
-        z[i] = min(r - i, z[i - l]);
-      while (i + z[i] < n && s[z[i]] == s[i + z[i]])
-        ++z[i];
-      if (i + z[i] > r) {
-        l = i;
-        r = i + z[i];
-      }
-    }
-    return z;
-  }
-
-  string reversed(const string& s) {
-    return {s.rbegin(), s.rend()};
-  }
-};
diff --git a/solutions/3303. Find the Occurrence of First Almost Equal Substring/3303.java b/solutions/3303. Find the Occurrence of First Almost Equal Substring/3303.java
deleted file mode 100644
index 3d9329435cd..00000000000
--- a/solutions/3303. Find the Occurrence of First Almost Equal Substring/3303.java	
+++ /dev/null
@@ -1,43 +0,0 @@
-class Solution {
-  public int minStartingIndex(String s, String pattern) {
-    int[] z1 = zFunction(new StringBuilder(pattern).append(s).toString());
-    int[] z2 = zFunction(new StringBuilder(pattern)
-                             .reverse() //
-                             .append(new StringBuilder(s).reverse())
-                             .toString());
-
-    // Match s[i..i + len(pattern) - 1] with `pattern` from both the prefix and
-    // the suffix.
-    for (int i = 0; i <= s.length() - pattern.length(); ++i)
-      if (z1[pattern.length() + i] + z2[s.length() - i] >= pattern.length() - 1)
-        return i;
-
-    return -1;
-  }
-
-  // Returns the z array, where z[i] is the length of the longest prefix of
-  // s[i..n) which is also a prefix of s.
-  //
-  // https://cp-algorithms.com/string/z-function.html#implementation
-  private int[] zFunction(final String s) {
-    final int n = s.length();
-    int[] z = new int[n];
-    int l = 0;
-    int r = 0;
-    for (int i = 1; i < n; ++i) {
-      if (i < r)
-        z[i] = Math.min(r - i, z[i - l]);
-      while (i + z[i] < n && s.charAt(z[i]) == s.charAt(i + z[i]))
-        ++z[i];
-      if (i + z[i] > r) {
-        l = i;
-        r = i + z[i];
-      }
-    }
-    return z;
-  }
-
-  private String reversed(final String s) {
-    return new StringBuilder(s).reverse().toString();
-  }
-}
diff --git a/solutions/3303. Find the Occurrence of First Almost Equal Substring/3303.py b/solutions/3303. Find the Occurrence of First Almost Equal Substring/3303.py
deleted file mode 100644
index bec214d86c3..00000000000
--- a/solutions/3303. Find the Occurrence of First Almost Equal Substring/3303.py	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution:
-  def minStartingIndex(self, s: str, pattern: str) -> int:
-    z1 = self._zFunction(pattern + s)
-    z2 = self._zFunction(pattern[::-1] + s[::-1])
-
-    # Match s[i..i + len(pattern) - 1] with `pattern` from both the prefix and
-    # the suffix.
-    for i in range(len(s) - len(pattern) + 1):
-      if z1[len(pattern) + i] + z2[len(s) - i] >= len(pattern) - 1:
-        return i
-
-    return -1
-
-  def _zFunction(self, s: str) -> list[int]:
-    """
-    Returns the z array, where z[i] is the length of the longest prefix of
-    s[i..n) which is also a prefix of s.
-
-    https://cp-algorithms.com/string/z-function.html#implementation
-    """
-    n = len(s)
-    z = [0] * n
-    l = 0
-    r = 0
-    for i in range(1, n):
-      if i < r:
-        z[i] = min(r - i, z[i - l])
-      while i + z[i] < n and s[z[i]] == s[i + z[i]]:
-        z[i] += 1
-      if i + z[i] > r:
-        l = i
-        r = i + z[i]
-    return z
diff --git a/solutions/3304. Find the K-th Character in String Game I/3304.cpp b/solutions/3304. Find the K-th Character in String Game I/3304.cpp
deleted file mode 100644
index c79f018fcdf..00000000000
--- a/solutions/3304. Find the K-th Character in String Game I/3304.cpp	
+++ /dev/null
@@ -1,6 +0,0 @@
-class Solution {
- public:
-  char kthCharacter(unsigned k) {
-    return 'a' + popcount(k - 1);
-  }
-};
diff --git a/solutions/3304. Find the K-th Character in String Game I/3304.java b/solutions/3304. Find the K-th Character in String Game I/3304.java
deleted file mode 100644
index a9d493870dd..00000000000
--- a/solutions/3304. Find the K-th Character in String Game I/3304.java	
+++ /dev/null
@@ -1,5 +0,0 @@
-class Solution {
-  public char kthCharacter(int k) {
-    return (char) ('a' + Integer.bitCount(k - 1));
-  }
-}
diff --git a/solutions/3304. Find the K-th Character in String Game I/3304.py b/solutions/3304. Find the K-th Character in String Game I/3304.py
deleted file mode 100644
index 7f68e21af60..00000000000
--- a/solutions/3304. Find the K-th Character in String Game I/3304.py	
+++ /dev/null
@@ -1,3 +0,0 @@
-class Solution:
-  def kthCharacter(self, k: int) -> str:
-    return string.ascii_lowercase[(k - 1).bit_count()]
diff --git a/solutions/3305. Count of Substrings Containing Every Vowel and K Consonants I/3305.cpp b/solutions/3305. Count of Substrings Containing Every Vowel and K Consonants I/3305.cpp
deleted file mode 100644
index a5828cb3cb1..00000000000
--- a/solutions/3305. Count of Substrings Containing Every Vowel and K Consonants I/3305.cpp	
+++ /dev/null
@@ -1,51 +0,0 @@
-class Solution {
- public:
-  int countOfSubstrings(string word, int k) {
-    return substringsWithAtMost(word, k) - substringsWithAtMost(word, k - 1);
-  }
-
- private:
-  // Return the number of substrings containing every vowel with at most k
-  // consonants.
-  int substringsWithAtMost(const string& word, int k) {
-    if (k == -1)
-      return 0;
-
-    int res = 0;
-    int vowels = 0;
-    int uniqueVowels = 0;
-    unordered_map<char, int> vowelLastSeen;
-
-    for (int l = 0, r = 0; r < word.length(); ++r) {
-      if (isVowel(word[r])) {
-        ++vowels;
-        if (const auto it = vowelLastSeen.find(word[r]);
-            it == vowelLastSeen.end() || it->second < l)
-          ++uniqueVowels;
-        vowelLastSeen[word[r]] = r;
-      }
-      while (r - l + 1 - vowels > k) {
-        if (isVowel(word[l])) {
-          --vowels;
-          if (vowelLastSeen[word[l]] == l)
-            --uniqueVowels;
-        }
-        ++l;
-      }
-      if (uniqueVowels == 5)
-        // Add substrings containing every vowel with at most k consonants to
-        // the answer. They are
-        // word[l..r], word[l + 1..r], ..., word[min(vowelLastSeen[vowel])..r]
-        res += min({vowelLastSeen['a'], vowelLastSeen['e'], vowelLastSeen['i'],
-                    vowelLastSeen['o'], vowelLastSeen['u']}) -
-               l + 1;
-    }
-
-    return res;
-  }
-
-  bool isVowel(char c) {
-    static constexpr string_view kVowels = "aeiou";
-    return kVowels.find(c) != string_view::npos;
-  }
-};
diff --git a/solutions/3305. Count of Substrings Containing Every Vowel and K Consonants I/3305.java b/solutions/3305. Count of Substrings Containing Every Vowel and K Consonants I/3305.java
deleted file mode 100644
index fdc402cbbd3..00000000000
--- a/solutions/3305. Count of Substrings Containing Every Vowel and K Consonants I/3305.java	
+++ /dev/null
@@ -1,51 +0,0 @@
-class Solution {
-  public int countOfSubstrings(String word, int k) {
-    return substringsWithAtMost(word, k) - substringsWithAtMost(word, k - 1);
-  }
-
-  // Return the number of substrings containing every vowel with at most k
-  // consonants.
-  private int substringsWithAtMost(String word, int k) {
-    if (k == -1)
-      return 0;
-
-    int res = 0;
-    int vowels = 0;
-    int uniqueVowels = 0;
-    Map<Character, Integer> vowelLastSeen = new HashMap<>();
-
-    for (int l = 0, r = 0; r < word.length(); ++r) {
-      if (isVowel(word.charAt(r))) {
-        ++vowels;
-        if (!vowelLastSeen.containsKey(word.charAt(r)) || vowelLastSeen.get(word.charAt(r)) < l)
-          ++uniqueVowels;
-        vowelLastSeen.put(word.charAt(r), r);
-      }
-      while (r - l + 1 - vowels > k) {
-        if (isVowel(word.charAt(l))) {
-          --vowels;
-          if (vowelLastSeen.get(word.charAt(l)) == l)
-            --uniqueVowels;
-        }
-        ++l;
-      }
-      if (uniqueVowels == 5) {
-        // Add substrings containing every vowel with at most k consonants to
-        // the answer. They are
-        // word[l..r], word[l + 1..r], ..., word[min(vowelLastSeen[vowel])..r]
-        final int minVowelLastSeen = Arrays.asList('a', 'e', 'i', 'o', 'u')
-                                         .stream()
-                                         .mapToInt(vowel -> vowelLastSeen.get(vowel))
-                                         .min()
-                                         .getAsInt();
-        res += minVowelLastSeen - l + 1;
-      }
-    }
-
-    return res;
-  }
-
-  private boolean isVowel(char c) {
-    return "aeiou".indexOf(c) != -1;
-  }
-}
diff --git a/solutions/3305. Count of Substrings Containing Every Vowel and K Consonants I/3305.py b/solutions/3305. Count of Substrings Containing Every Vowel and K Consonants I/3305.py
deleted file mode 100644
index c9b6e38b815..00000000000
--- a/solutions/3305. Count of Substrings Containing Every Vowel and K Consonants I/3305.py	
+++ /dev/null
@@ -1,39 +0,0 @@
-class Solution:
-  def countOfSubstrings(self, word: str, k: int) -> int:
-    VOWELS = 'aeiou'
-
-    def substringsWithAtMost(k: int) -> int:
-      """
-      Return the number of substrings containing every vowel with at most k
-      consonants.
-      """
-      if k == -1:
-        return 0
-
-      res = 0
-      vowels = 0
-      uniqueVowels = 0
-      vowelLastSeen = {}
-
-      l = 0
-      for r, c in enumerate(word):
-        if c in VOWELS:
-          vowels += 1
-          if c not in vowelLastSeen or vowelLastSeen[c] < l:
-            uniqueVowels += 1
-          vowelLastSeen[c] = r
-        while r - l + 1 - vowels > k:
-          if word[l] in VOWELS:
-            vowels -= 1
-            if vowelLastSeen[word[l]] == l:
-              uniqueVowels -= 1
-          l += 1
-        if uniqueVowels == 5:
-          # Add substrings containing every vowel with at most k consonants to
-          # the answer. They are
-          # word[l..r], word[l + 1..r], ..., word[min(vowelLastSeen[vowel])..r]
-          res += min(vowelLastSeen[vowel] for vowel in VOWELS) - l + 1
-
-      return res
-
-    return substringsWithAtMost(k) - substringsWithAtMost(k - 1)
diff --git a/solutions/3306. Count of Substrings Containing Every Vowel and K Consonants II/3306.cpp b/solutions/3306. Count of Substrings Containing Every Vowel and K Consonants II/3306.cpp
deleted file mode 100644
index c0be629a900..00000000000
--- a/solutions/3306. Count of Substrings Containing Every Vowel and K Consonants II/3306.cpp	
+++ /dev/null
@@ -1,52 +0,0 @@
-class Solution {
- public:
-  // Same as 3305. Count of Substrings Containing Every Vowel and K Consonants I
-  long long countOfSubstrings(string word, int k) {
-    return substringsWithAtMost(word, k) - substringsWithAtMost(word, k - 1);
-  }
-
- private:
-  // Return the number of substrings containing every vowel with at most k
-  // consonants.
-  long substringsWithAtMost(const string& word, int k) {
-    if (k == -1)
-      return 0;
-
-    long res = 0;
-    int vowels = 0;
-    int uniqueVowels = 0;
-    unordered_map<char, int> vowelLastSeen;
-
-    for (int l = 0, r = 0; r < word.length(); ++r) {
-      if (isVowel(word[r])) {
-        ++vowels;
-        if (const auto it = vowelLastSeen.find(word[r]);
-            it == vowelLastSeen.end() || it->second < l)
-          ++uniqueVowels;
-        vowelLastSeen[word[r]] = r;
-      }
-      while (r - l + 1 - vowels > k) {
-        if (isVowel(word[l])) {
-          --vowels;
-          if (vowelLastSeen[word[l]] == l)
-            --uniqueVowels;
-        }
-        ++l;
-      }
-      if (uniqueVowels == 5)
-        // Add substrings containing every vowel with at most k consonants to
-        // the answer. They are
-        // word[l..r], word[l + 1..r], ..., word[min(vowelLastSeen[vowel])..r]
-        res += min({vowelLastSeen['a'], vowelLastSeen['e'], vowelLastSeen['i'],
-                    vowelLastSeen['o'], vowelLastSeen['u']}) -
-               l + 1;
-    }
-
-    return res;
-  }
-
-  bool isVowel(char c) {
-    static constexpr string_view kVowels = "aeiou";
-    return kVowels.find(c) != string_view::npos;
-  }
-};
diff --git a/solutions/3306. Count of Substrings Containing Every Vowel and K Consonants II/3306.java b/solutions/3306. Count of Substrings Containing Every Vowel and K Consonants II/3306.java
deleted file mode 100644
index e6b2dc2b0f2..00000000000
--- a/solutions/3306. Count of Substrings Containing Every Vowel and K Consonants II/3306.java	
+++ /dev/null
@@ -1,52 +0,0 @@
-class Solution {
-  // Same as 3305. Count of Substrings Containing Every Vowel and K Consonants I
-  public long countOfSubstrings(String word, int k) {
-    return substringsWithAtMost(word, k) - substringsWithAtMost(word, k - 1);
-  }
-
-  // Return the number of substrings containing every vowel with at most k
-  // consonants.
-  private long substringsWithAtMost(String word, int k) {
-    if (k == -1)
-      return 0;
-
-    long res = 0;
-    int vowels = 0;
-    int uniqueVowels = 0;
-    Map<Character, Integer> vowelLastSeen = new HashMap<>();
-
-    for (int l = 0, r = 0; r < word.length(); ++r) {
-      if (isVowel(word.charAt(r))) {
-        ++vowels;
-        if (!vowelLastSeen.containsKey(word.charAt(r)) || vowelLastSeen.get(word.charAt(r)) < l)
-          ++uniqueVowels;
-        vowelLastSeen.put(word.charAt(r), r);
-      }
-      while (r - l + 1 - vowels > k) {
-        if (isVowel(word.charAt(l))) {
-          --vowels;
-          if (vowelLastSeen.get(word.charAt(l)) == l)
-            --uniqueVowels;
-        }
-        ++l;
-      }
-      if (uniqueVowels == 5) {
-        // Add substrings containing every vowel with at most k consonants to
-        // the answer. They are
-        // word[l..r], word[l + 1..r], ..., word[min(vowelLastSeen[vowel])..r]
-        final int minVowelLastSeen = Arrays.asList('a', 'e', 'i', 'o', 'u')
-                                         .stream()
-                                         .mapToInt(vowel -> vowelLastSeen.get(vowel))
-                                         .min()
-                                         .getAsInt();
-        res += minVowelLastSeen - l + 1;
-      }
-    }
-
-    return res;
-  }
-
-  private boolean isVowel(char c) {
-    return "aeiou".indexOf(c) != -1;
-  }
-}
diff --git a/solutions/3306. Count of Substrings Containing Every Vowel and K Consonants II/3306.py b/solutions/3306. Count of Substrings Containing Every Vowel and K Consonants II/3306.py
deleted file mode 100644
index fc6347cc4b3..00000000000
--- a/solutions/3306. Count of Substrings Containing Every Vowel and K Consonants II/3306.py	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution:
-  # Same as 3305. Count of Substrings Containing Every Vowel and K Consonants I
-  def countOfSubstrings(self, word: str, k: int) -> int:
-    VOWELS = 'aeiou'
-
-    def substringsWithAtMost(k: int) -> int:
-      """
-      Return the number of substrings containing every vowel with at most k
-      consonants.
-      """
-      if k < 0:
-        return 0
-
-      res = 0
-      vowels = 0
-      uniqueVowels = 0
-      vowelLastSeen = {}
-
-      l = 0
-      for r, c in enumerate(word):
-        if c in VOWELS:
-          vowels += 1
-          if c not in vowelLastSeen or vowelLastSeen[c] < l:
-            uniqueVowels += 1
-          vowelLastSeen[c] = r
-        while r - l + 1 - vowels > k:
-          if word[l] in VOWELS:
-            vowels -= 1
-            if vowelLastSeen[word[l]] == l:
-              uniqueVowels -= 1
-          l += 1
-        if uniqueVowels == 5:
-          # Add substrings containing every vowel with at most k consonants to
-          # the answer. They are
-          # word[l..r], word[l + 1..r], ..., word[min(vowelLastSeen[vowel])..r]
-          res += min(vowelLastSeen[vowel] for vowel in VOWELS) - l + 1
-
-      return res
-
-    return substringsWithAtMost(k) - substringsWithAtMost(k - 1)
diff --git a/solutions/3307. Find the K-th Character in String Game II/3307.cpp b/solutions/3307. Find the K-th Character in String Game II/3307.cpp
deleted file mode 100644
index b345508ce9a..00000000000
--- a/solutions/3307. Find the K-th Character in String Game II/3307.cpp	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
- public:
-  char kthCharacter(long long k, vector<int>& operations) {
-    const int operationsCount = ceil(log2(k));
-    int increases = 0;
-
-    for (int i = operationsCount - 1; i >= 0; --i) {
-      const long halfSize = 1L << i;
-      if (k > halfSize) {
-        k -= halfSize;  // Move k from the right half to the left half.
-        increases += operations[i];
-      }
-    }
-
-    return 'a' + increases % 26;
-  }
-};
diff --git a/solutions/3307. Find the K-th Character in String Game II/3307.java b/solutions/3307. Find the K-th Character in String Game II/3307.java
deleted file mode 100644
index 418f48243e7..00000000000
--- a/solutions/3307. Find the K-th Character in String Game II/3307.java	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution {
-  public char kthCharacter(long k, int[] operations) {
-    final int operationsCount = (int) Math.ceil(Math.log(k) / Math.log(2));
-    int increases = 0;
-
-    for (int i = operationsCount - 1; i >= 0; --i) {
-      final long halfSize = 1L << i;
-      if (k > halfSize) {
-        k -= halfSize; // Move k from the right half to the left half.
-        increases += operations[i];
-      }
-    }
-
-    return (char) ('a' + increases % 26);
-  }
-}
diff --git a/solutions/3307. Find the K-th Character in String Game II/3307.py b/solutions/3307. Find the K-th Character in String Game II/3307.py
deleted file mode 100644
index e06ba31c453..00000000000
--- a/solutions/3307. Find the K-th Character in String Game II/3307.py	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution:
-  def kthCharacter(self, k: int, operations: list[int]) -> str:
-    operationsCount = math.ceil(math.log2(k))
-    increases = 0
-
-    for i in range(operationsCount - 1, -1, -1):
-      halfSize = 2**i
-      if k > halfSize:
-        k -= halfSize  # Move k from the right half to the left half.
-        increases += operations[i]
-
-    return string.ascii_lowercase[increases % 26]
diff --git a/solutions/3308. Find Top Performing Driver/3308.sql b/solutions/3308. Find Top Performing Driver/3308.sql
deleted file mode 100644
index 98202074c8b..00000000000
--- a/solutions/3308. Find Top Performing Driver/3308.sql	
+++ /dev/null
@@ -1,28 +0,0 @@
-WITH
-  DriverPerformance AS (
-    SELECT
-      Vehicles.fuel_type,
-      Vehicles.driver_id,
-      Drivers.accidents,
-      ROUND(AVG(Trips.rating), 2) AS rating,
-      SUM(Trips.distance) AS distance
-    FROM Vehicles
-    INNER JOIN Trips
-      USING (vehicle_id)
-    INNER JOIN Drivers
-      USING (driver_id)
-    GROUP BY 1, 2
-  ),
-  RankedDrivers AS (
-    SELECT
-      *,
-      RANK() OVER(
-        PARTITION BY fuel_type
-        ORDER BY rating DESC, distance DESC, accidents
-      ) AS `rank`
-    FROM DriverPerformance
-  )
-SELECT fuel_type, driver_id, rating, distance
-FROM RankedDrivers
-WHERE `rank` = 1
-ORDER BY 1;
diff --git a/solutions/3309. Maximum Possible Number by Binary Concatenation/3309.cpp b/solutions/3309. Maximum Possible Number by Binary Concatenation/3309.cpp
deleted file mode 100644
index b1920ffe102..00000000000
--- a/solutions/3309. Maximum Possible Number by Binary Concatenation/3309.cpp	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
- public:
-  int maxGoodNumber(vector<int>& nums) {
-    int ans = 0;
-
-    ranges::sort(nums,
-                 [this](int a, int b) { return concat(a, b) > concat(b, a); });
-
-    for (const int num : nums)
-      ans = concat(ans, num);
-
-    return ans;
-  }
-
- private:
-  // Returns the concatenation of the binary representations of a and b.
-  int concat(int a, int b) {
-    return (a << static_cast<int>(log2(b)) + 1) + b;
-  }
-};
diff --git a/solutions/3309. Maximum Possible Number by Binary Concatenation/3309.java b/solutions/3309. Maximum Possible Number by Binary Concatenation/3309.java
deleted file mode 100644
index 923ed14e92e..00000000000
--- a/solutions/3309. Maximum Possible Number by Binary Concatenation/3309.java	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
-  public int maxGoodNumber(int[] nums) {
-    int ans = 0;
-    Integer[] boxedNums = Arrays.stream(nums).boxed().toArray(Integer[] ::new);
-
-    Arrays.sort(boxedNums, (a, b) -> Integer.compare(concat(b, a), concat(a, b)));
-
-    for (final int num : boxedNums)
-      ans = concat(ans, num);
-
-    return ans;
-  }
-
-  // Returns the concatenation of the binary representations of a and b.
-  private int concat(int a, int b) {
-    return a * (Integer.highestOneBit(b) << 1) + b;
-  }
-}
diff --git a/solutions/3309. Maximum Possible Number by Binary Concatenation/3309.py b/solutions/3309. Maximum Possible Number by Binary Concatenation/3309.py
deleted file mode 100644
index 57c97f995e7..00000000000
--- a/solutions/3309. Maximum Possible Number by Binary Concatenation/3309.py	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution:
-  def maxGoodNumber(self, nums: list[int]) -> int:
-    ans = 0
-
-    def concat(a: int, b: int) -> int:
-      """Returns the concatenation of the binary representations of a and b."""
-      return (a << b.bit_length()) + b
-
-    nums.sort(key=functools.cmp_to_key(
-        lambda a, b: concat(b, a) - concat(a, b)))
-
-    for num in nums:
-      ans = concat(ans, num)
-
-    return ans
diff --git a/solutions/3310. Remove Methods From Project/3310.cpp b/solutions/3310. Remove Methods From Project/3310.cpp
deleted file mode 100644
index 3523e008303..00000000000
--- a/solutions/3310. Remove Methods From Project/3310.cpp	
+++ /dev/null
@@ -1,42 +0,0 @@
-class Solution {
- public:
-  vector<int> remainingMethods(int n, int k, vector<vector<int>>& invocations) {
-    vector<int> ans;
-    vector<vector<int>> graph(n);
-
-    for (const vector<int>& invocation : invocations) {
-      const int u = invocation[0];
-      const int v = invocation[1];
-      graph[u].push_back(v);
-    }
-
-    queue<int> q{{k}};
-    vector<bool> seen(n);
-    seen[k] = true;
-
-    while (!q.empty())
-      for (int sz = q.size(); sz > 0; --sz) {
-        const int u = q.front();
-        q.pop();
-        for (const int v : graph[u])
-          if (!seen[v]) {
-            q.push(v);
-            seen[v] = true;
-          }
-      }
-
-    for (int u = 0; u < n; ++u) {
-      if (seen[u])
-        continue;
-      for (const int v : graph[u])
-        if (seen[v]) {
-          ans.resize(n);
-          iota(ans.begin(), ans.end(), 0);
-          return ans;
-        }
-      ans.push_back(u);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3310. Remove Methods From Project/3310.java b/solutions/3310. Remove Methods From Project/3310.java
deleted file mode 100644
index 7c60684437a..00000000000
--- a/solutions/3310. Remove Methods From Project/3310.java	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
-  public List<Integer> remainingMethods(int n, int k, int[][] invocations) {
-    List<Integer> ans = new ArrayList<>();
-    List<Integer>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
-
-    for (int[] invocation : invocations) {
-      final int u = invocation[0];
-      final int v = invocation[1];
-      graph[u].add(v);
-    }
-
-    Queue<Integer> q = new ArrayDeque<>(List.of(k));
-    boolean[] seen = new boolean[n];
-    seen[k] = true;
-
-    while (!q.isEmpty())
-      for (int sz = q.size(); sz > 0; --sz)
-        for (final int v : graph[q.poll()])
-          if (!seen[v]) {
-            q.offer(v);
-            seen[v] = true;
-          }
-
-    for (int u = 0; u < n; ++u) {
-      if (seen[u])
-        continue;
-      for (final int v : graph[u])
-        if (seen[v]) {
-          ans = new ArrayList<>(n);
-          for (int i = 0; i < n; ++i)
-            ans.add(i);
-          return ans;
-        }
-      ans.add(u);
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3310. Remove Methods From Project/3310.py b/solutions/3310. Remove Methods From Project/3310.py
deleted file mode 100644
index dc4e5f39de9..00000000000
--- a/solutions/3310. Remove Methods From Project/3310.py	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution:
-  def remainingMethods(
-      self,
-      n: int,
-      k: int,
-      invocations: list[list[int]]
-  ) -> list[int]:
-    ans = []
-    graph = [[] for _ in range(n)]
-
-    for u, v in invocations:
-      graph[u].append(v)
-
-    q = collections.deque([k])
-    seen = {k}
-
-    while q:
-      for _ in range(len(q)):
-        for v in graph[q.popleft()]:
-          if v not in seen:
-            q.append(v)
-            seen.add(v)
-
-    for u in range(n):
-      if u in seen:
-        continue
-      for v in graph[u]:
-        if v in seen:
-          return list(range(n))
-      ans.append(u)
-
-    return ans
diff --git a/solutions/3311. Construct 2D Grid Matching Graph Layout/3311.cpp b/solutions/3311. Construct 2D Grid Matching Graph Layout/3311.cpp
deleted file mode 100644
index 94f885b1794..00000000000
--- a/solutions/3311. Construct 2D Grid Matching Graph Layout/3311.cpp	
+++ /dev/null
@@ -1,63 +0,0 @@
-class Solution {
- public:
-  vector<vector<int>> constructGridLayout(int n, vector<vector<int>>& edges) {
-    vector<vector<int>> graph(n);
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      graph[u].push_back(v);
-      graph[v].push_back(u);
-    }
-
-    // Randomly choose a node with the minimum degree as the corner.
-    const int corner =
-        ranges::min_element(graph, ranges::less{}, &vector<int>::size) -
-        graph.begin();
-
-    vector<bool> seen(n);
-    seen[corner] = true;
-    const vector<int> firstRow = getFirstRow(graph, corner, seen);
-    const int cols = firstRow.size();
-    const int rows = n / cols;
-
-    vector<vector<int>> ans(rows, vector<int>(cols));
-    ans[0] = firstRow;
-
-    for (int i = 1; i < rows; ++i)
-      for (int j = 0; j < cols; ++j)
-        for (const int v : graph[ans[i - 1][j]])
-          if (!seen[v]) {
-            ans[i][j] = v;
-            seen[v] = true;
-            break;
-          }
-
-    return ans;
-  }
-
- private:
-  vector<int> getFirstRow(vector<vector<int>>& graph, int corner,
-                          vector<bool>& seen) {
-    const int cornerDegree = graph[corner].size();
-    vector<int> row = {corner};
-
-    // Continue appending neighbors until we hit another corner.
-    while (row.size() == 1 || graph[row.back()].size() == cornerDegree + 1) {
-      // Sort neighbors by degree to prioritize smaller ones (shortest row built
-      // first).
-      vector<int>& neighbors = graph[row.back()];
-      ranges::sort(neighbors, ranges::less{},
-                   [&graph](int v) { return graph[v].size(); });
-      for (const int v : neighbors)
-        if (!seen[v] && (graph[v].size() == cornerDegree ||
-                         graph[v].size() == cornerDegree + 1)) {
-          row.push_back(v);
-          seen[v] = true;
-          break;
-        }
-    }
-
-    return row;
-  }
-};
diff --git a/solutions/3311. Construct 2D Grid Matching Graph Layout/3311.java b/solutions/3311. Construct 2D Grid Matching Graph Layout/3311.java
deleted file mode 100644
index bc2e0bc56c9..00000000000
--- a/solutions/3311. Construct 2D Grid Matching Graph Layout/3311.java	
+++ /dev/null
@@ -1,58 +0,0 @@
-class Solution {
-  public int[][] constructGridLayout(int n, int[][] edges) {
-    List<Integer>[] graph = new ArrayList[n];
-
-    for (int i = 0; i < n; i++)
-      graph[i] = new ArrayList<>();
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      graph[u].add(v);
-      graph[v].add(u);
-    }
-
-    // Randomly choose a node with the minimum degree as the corner.
-    int corner = 0;
-    for (int i = 1; i < n; i++)
-      if (graph[i].size() < graph[corner].size())
-        corner = i;
-
-    boolean[] seen = new boolean[n];
-    seen[corner] = true;
-    int[] firstRow = getFirstRow(graph, corner, seen);
-    int cols = firstRow.length;
-    int rows = n / cols;
-
-    int[][] ans = new int[rows][cols];
-    ans[0] = firstRow;
-
-    for (int i = 1; i < rows; ++i)
-      for (int j = 0; j < cols; ++j)
-        for (final int v : graph[ans[i - 1][j]])
-          if (!seen[v]) {
-            ans[i][j] = v;
-            seen[v] = true;
-            break;
-          }
-
-    return ans;
-  }
-
-  private int[] getFirstRow(List<Integer>[] graph, int corner, boolean[] seen) {
-    final int cornerDegree = graph[corner].size();
-    List<Integer> row = new ArrayList<>(List.of(corner));
-    // Continue appending neighbors until we hit another corner.
-    while (row.size() == 1 || graph[row.get(row.size() - 1)].size() == cornerDegree + 1) {
-      List<Integer> neighbors = graph[row.get(row.size() - 1)];
-      Collections.sort(neighbors, (a, b) -> graph[a].size() - graph[b].size());
-      for (final int v : neighbors)
-        if (!seen[v] && (graph[v].size() == cornerDegree || graph[v].size() == cornerDegree + 1)) {
-          row.add(v);
-          seen[v] = true;
-          break;
-        }
-    }
-    return row.stream().mapToInt(Integer::intValue).toArray();
-  }
-}
diff --git a/solutions/3311. Construct 2D Grid Matching Graph Layout/3311.py b/solutions/3311. Construct 2D Grid Matching Graph Layout/3311.py
deleted file mode 100644
index 613af519737..00000000000
--- a/solutions/3311. Construct 2D Grid Matching Graph Layout/3311.py	
+++ /dev/null
@@ -1,47 +0,0 @@
-class Solution:
-  def constructGridLayout(self, n: int, edges: list[list[int]]) -> list[list[int]]:
-    graph = [[] for _ in range(n)]
-
-    for u, v in edges:
-      graph[u].append(v)
-      graph[v].append(u)
-
-    # Randomly choose a node with the minimum degree as the corner.
-    corner = min(range(len(graph)), key=lambda x: len(graph[x]))
-
-    seen = {corner}
-    firstRow = self._getFirstRow(graph, corner, seen)
-    cols = len(firstRow)
-    rows = n // cols
-
-    ans = [[0] * cols for _ in range(rows)]
-    ans[0] = firstRow
-
-    for i in range(1, rows):
-      for j in range(cols):
-        for v in graph[ans[i - 1][j]]:
-          if v not in seen:
-            ans[i][j] = v
-            seen.add(v)
-            break
-
-    return ans
-
-  def _getFirstRow(
-      self,
-      graph: list[list[int]],
-      corner: int,
-      seen: set[int]
-  ) -> list[int]:
-    cornerDegree = len(graph[corner])
-    row = [corner]
-    # Continue appending neighbors until we hit another corner.
-    while len(row) == 1 or len(graph[row[-1]]) == cornerDegree + 1:
-      # Sort neighbors by degree to prioritize smaller ones (shortest row built first).
-      graph[row[-1]].sort(key=lambda x: len(graph[x]))
-      for v in graph[row[-1]]:
-        if v not in seen and len(graph[v]) in (cornerDegree, cornerDegree + 1):
-          row.append(v)
-          seen.add(v)
-          break
-    return row
diff --git a/solutions/3312. Sorted GCD Pair Queries/3312.cpp b/solutions/3312. Sorted GCD Pair Queries/3312.cpp
deleted file mode 100644
index ef345428409..00000000000
--- a/solutions/3312. Sorted GCD Pair Queries/3312.cpp	
+++ /dev/null
@@ -1,56 +0,0 @@
-class Solution {
- public:
-  vector<int> gcdValues(vector<int>& nums, vector<long long>& queries) {
-    const int maxNum = ranges::max(nums);
-    vector<int> ans;
-    // countDivisor[d] := the number of `nums` having `num % d == 0`
-    vector<int> countDivisor(maxNum + 1);
-    // countGcdPair[g] := the number of pairs having gcd == g
-    vector<long> countGcdPair(maxNum + 1);
-    // prefixCountGcdPair[g] := the number of pairs having gcd <= g
-    vector<long> prefixCountGcdPair{0};
-
-    for (const int num : nums)
-      for (int i = 1; i * i <= num; ++i)
-        if (num % i == 0) {
-          ++countDivisor[i];
-          if (i != num / i)
-            ++countDivisor[num / i];
-        }
-
-    for (int gcd = maxNum; gcd >= 1; --gcd) {
-      // There are C(countDivisor[gcd], 2) pairs that have a common divisor
-      // that's a multiple of `gcd` (including the one that equals to `gcd`).
-      // So, substract the multiples of `gcd` to have the number of pairs with a
-      // gcd that's exactly `gcd`.
-      countGcdPair[gcd] =
-          countDivisor[gcd] * static_cast<long>(countDivisor[gcd] - 1) / 2;
-      for (int largerGcd = 2 * gcd; largerGcd <= maxNum; largerGcd += gcd)
-        countGcdPair[gcd] -= countGcdPair[largerGcd];
-    }
-
-    for (int gcd = 1; gcd <= maxNum; ++gcd)
-      prefixCountGcdPair.push_back(prefixCountGcdPair.back() +
-                                   countGcdPair[gcd]);
-
-    for (const long query : queries)
-      ans.push_back(getNthGcdPair(query, prefixCountGcdPair));
-
-    return ans;
-  }
-
- private:
-  // Returns the `query`-th gcd pair.
-  int getNthGcdPair(long query, const vector<long>& prefixCountGcdPair) {
-    int l = 1;
-    int r = prefixCountGcdPair.size() - 1;
-    while (l < r) {
-      const int m = (l + r) / 2;
-      if (prefixCountGcdPair[m] < query + 1)
-        l = m + 1;
-      else
-        r = m;
-    }
-    return l;
-  }
-};
diff --git a/solutions/3312. Sorted GCD Pair Queries/3312.java b/solutions/3312. Sorted GCD Pair Queries/3312.java
deleted file mode 100644
index 90117a13fe2..00000000000
--- a/solutions/3312. Sorted GCD Pair Queries/3312.java	
+++ /dev/null
@@ -1,52 +0,0 @@
-class Solution {
-  public int[] gcdValues(int[] nums, long[] queries) {
-    int maxNum = Arrays.stream(nums).max().getAsInt();
-    int[] ans = new int[queries.length];
-    // countDivisor[d] := the number of `nums` having `num % d == 0`
-    int[] countDivisor = new int[maxNum + 1];
-    // countGcdPair[g] := the number of pairs having gcd == g
-    long[] countGcdPair = new long[maxNum + 1];
-    // prefixCountGcdPair[g] := the number of pairs having gcd <= g
-    long[] prefixCountGcdPair = new long[maxNum + 1];
-
-    for (final int num : nums)
-      for (int i = 1; i * i <= num; ++i)
-        if (num % i == 0) {
-          ++countDivisor[i];
-          if (i != num / i)
-            ++countDivisor[num / i];
-        }
-
-    for (int gcd = maxNum; gcd >= 1; --gcd) {
-      // There are C(countDivisor[gcd], 2) pairs that have a common divisor
-      // that's a multiple of `gcd` (including the one that equals to `gcd`).
-      // So, substract the multiples of `gcd` to have the number of pairs with a
-      // gcd that's exactly `gcd`.
-      countGcdPair[gcd] = (long) countDivisor[gcd] * (countDivisor[gcd] - 1) / 2;
-      for (int largerGcd = 2 * gcd; largerGcd <= maxNum; largerGcd += gcd)
-        countGcdPair[gcd] -= countGcdPair[largerGcd];
-    }
-
-    for (int gcd = 1; gcd <= maxNum; ++gcd)
-      prefixCountGcdPair[gcd] = prefixCountGcdPair[gcd - 1] + countGcdPair[gcd];
-
-    for (int i = 0; i < queries.length; ++i)
-      ans[i] = getNthGcdPair(queries[i], prefixCountGcdPair);
-
-    return ans;
-  }
-
-  // Returns the `query`-th gcd pair.
-  private int getNthGcdPair(long query, long[] prefixCountGcdPair) {
-    int l = 1;
-    int r = prefixCountGcdPair.length - 1;
-    while (l < r) {
-      int m = (l + r) / 2;
-      if (prefixCountGcdPair[m] < query + 1)
-        l = m + 1;
-      else
-        r = m;
-    }
-    return l;
-  }
-}
diff --git a/solutions/3312. Sorted GCD Pair Queries/3312.py b/solutions/3312. Sorted GCD Pair Queries/3312.py
deleted file mode 100644
index 75b5fd1e8ba..00000000000
--- a/solutions/3312. Sorted GCD Pair Queries/3312.py	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution:
-  def gcdValues(self, nums: list[int], queries: list[int]) -> list[int]:
-    maxNum = max(nums)
-    # countDivisor[d] := the number of `nums` having `num % d == 0`
-    countDivisor = [0] * (maxNum + 1)
-    # countGcdPair[g] := the number of pairs having gcd == g
-    countGcdPair = [0] * (maxNum + 1)
-
-    for num in nums:
-      for i in range(1, math.isqrt(num) + 1):
-        if num % i == 0:
-          countDivisor[i] += 1
-          if i != num // i:
-            countDivisor[num // i] += 1
-
-    for gcd in range(maxNum, 0, -1):
-      # There are C(countDivisor[gcd], 2) pairs that have a common divisor
-      # that's a multiple of `gcd` (including the one that equals to `gcd`).
-      # So, substract the multiples of `gcd` to have the number of pairs with a
-      # gcd that's exactly `gcd`.
-      countGcdPair[gcd] = countDivisor[gcd] * (countDivisor[gcd] - 1) // 2
-      for largerGcd in range(2 * gcd, maxNum + 1, gcd):
-        countGcdPair[gcd] -= countGcdPair[largerGcd]
-
-    # prefixCountGcdPair[g] := the number of pairs having gcd <= g
-    prefixCountGcdPair = list(itertools.accumulate(countGcdPair))
-    return [bisect.bisect_left(prefixCountGcdPair, query + 1)
-            for query in queries]
diff --git a/solutions/3313. Find the Last Marked Nodes in Tree/3313.cpp b/solutions/3313. Find the Last Marked Nodes in Tree/3313.cpp
deleted file mode 100644
index ee1c2804a3e..00000000000
--- a/solutions/3313. Find the Last Marked Nodes in Tree/3313.cpp	
+++ /dev/null
@@ -1,81 +0,0 @@
-struct Node {
-  int node = 0;  // the node number
-  int time = 0;  // the time it got marked
-};
-
-struct Last2 {
-  Node last1;  // the last marked node
-  Node last2;  // the second last marked node
-};
-
-class Solution {
- public:
-  // Similar to 3241. Time Taken to Mark All Nodes
-  vector<int> lastMarkedNodes(vector<vector<int>>& edges) {
-    const int n = edges.size() + 1;
-    vector<int> ans(n);
-    vector<vector<int>> tree(n);
-    // dp[i] := the last marked two nodes for subtree rooted at node i, where
-    // each node contains the time it got marked
-    vector<Last2> dp(n);
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      tree[u].push_back(v);
-      tree[v].push_back(u);
-    }
-
-    dfs(tree, 0, /*prev=*/-1, dp);
-    reroot(tree, 0, /*prev=*/-1, /*last=*/Node(), dp, ans);
-    return ans;
-  }
-
- private:
-  // Performs a DFS traversal of the subtree rooted at node `u`, computes the
-  // time taken to mark all nodes in the subtree, records the last two marked
-  // nodes, and returns the last marked node.
-  //
-  // These values are used later in the rerooting process.
-  Node dfs(const vector<vector<int>>& tree, int u, int prev,
-           vector<Last2>& dp) {
-    Node last1(u, 0);
-    Node last2;
-    for (const int v : tree[u]) {
-      if (v == prev)
-        continue;
-      Node child = dfs(tree, v, u, dp);
-      const int time = child.time + 1;
-      if (time > last1.time) {
-        last2 = last1;
-        last1 = Node(child.node, time);
-      } else if (time > last2.time) {
-        last2 = Node(child.node, time);
-      }
-    }
-    dp[u] = {last1, last2};
-    return last1;
-  }
-
-  // Reroots the tree at node `u` and updates the answer array, where `last`
-  // is the last marked node that doesn't go through `u`'s subtree.
-  void reroot(const vector<vector<int>>& tree, int u, int prev,
-              const Node& last, vector<Last2>& dp, vector<int>& ans) {
-    ans[u] = last.time > dp[u].last1.time ? last.node : dp[u].last1.node;
-    for (const int v : tree[u]) {
-      if (v == prev)
-        continue;
-      Node newLast(last.node, last.time + 1);
-      if (dp[u].last1.node == dp[v].last1.node) {
-        const int alternativeTime = 1 + dp[u].last2.time;
-        if (alternativeTime > newLast.time)
-          newLast = Node(dp[u].last2.node, alternativeTime);
-      } else {
-        const int alternativeTime = 1 + dp[u].last1.time;
-        if (alternativeTime > newLast.time)
-          newLast = Node(dp[u].last1.node, alternativeTime);
-      }
-      reroot(tree, v, u, newLast, dp, ans);
-    }
-  }
-};
diff --git a/solutions/3313. Find the Last Marked Nodes in Tree/3313.java b/solutions/3313. Find the Last Marked Nodes in Tree/3313.java
deleted file mode 100644
index c9c53ce535f..00000000000
--- a/solutions/3313. Find the Last Marked Nodes in Tree/3313.java	
+++ /dev/null
@@ -1,84 +0,0 @@
-class Solution {
-  // Similar to 3241. Time Taken to Mark All Nodes
-  public int[] lastMarkedNodes(int[][] edges) {
-    final int n = edges.length + 1;
-    int[] ans = new int[n];
-    List<Integer>[] tree = new List[n];
-    // dp[i] := the last marked two nodes for subtree rooted at node i, where
-    // each node contains the time it got marked
-    Last2[] dp = new Last2[n];
-
-    for (int i = 0; i < n; ++i) {
-      tree[i] = new ArrayList<>();
-      dp[i] = new Last2();
-    }
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      tree[u].add(v);
-      tree[v].add(u);
-    }
-
-    dfs(tree, 0, /*prev=*/-1, dp);
-    reroot(tree, 0, /*prev=*/-1, /*last=*/new Node(), dp, ans);
-    return ans;
-  }
-
-  private record Node(int node, int time) {
-    Node() {
-      this(0, 0);
-    }
-  }
-
-  private record Last2(Node last1, Node last2) {
-    Last2() {
-      this(new Node(), new Node());
-    }
-  }
-
-  // Performs a DFS traversal of the subtree rooted at node `u`, computes the
-  // time taken to mark all nodes in the subtree, records the last two marked
-  // nodes, and returns the last marked node.
-  //
-  // These values are used later in the rerooting process.
-  private Node dfs(List<Integer>[] tree, int u, int prev, Last2[] dp) {
-    Node last1 = new Node(u, 0);
-    Node last2 = new Node();
-    for (final int v : tree[u]) {
-      if (v == prev)
-        continue;
-      Node child = dfs(tree, v, u, dp);
-      final int time = child.time() + 1;
-      if (time > last1.time) {
-        last2 = last1;
-        last1 = new Node(child.node(), time);
-      } else if (time > last2.time) {
-        last2 = new Node(child.node(), time);
-      }
-    }
-    dp[u] = new Last2(last1, last2);
-    return last1;
-  }
-
-  // Reroots the tree at node `u` and updates the answer array, where `last`
-  // is the last marked node that doesn't go through `u`'s subtree.
-  private void reroot(List<Integer>[] tree, int u, int prev, Node last, Last2[] dp, int[] ans) {
-    ans[u] = last.time() > dp[u].last1().time() ? last.node() : dp[u].last1().node();
-    for (final int v : tree[u]) {
-      if (v == prev)
-        continue;
-      Node newLast = new Node(last.node(), last.time() + 1); // 1 := u -> v
-      if (dp[u].last1().node() == dp[v].last1().node()) {
-        final int alternativeTime = 1 + dp[u].last2().time();
-        if (alternativeTime > newLast.time())
-          newLast = new Node(dp[u].last2().node(), alternativeTime);
-      } else {
-        final int alternativeTime = 1 + dp[u].last1().time();
-        if (alternativeTime > newLast.time())
-          newLast = new Node(dp[u].last1().node(), alternativeTime);
-      }
-      reroot(tree, v, u, newLast, dp, ans);
-    }
-  }
-}
diff --git a/solutions/3313. Find the Last Marked Nodes in Tree/3313.py b/solutions/3313. Find the Last Marked Nodes in Tree/3313.py
deleted file mode 100644
index 71c7059e580..00000000000
--- a/solutions/3313. Find the Last Marked Nodes in Tree/3313.py	
+++ /dev/null
@@ -1,89 +0,0 @@
-from dataclasses import dataclass
-
-
-@dataclass
-class Node:
-  node: int = 0  # the node number
-  time: int = 0  # the time it got marked
-
-
-class Last2:
-  def __init__(self, last1: Node = Node(), last2: Node = Node()):
-    self.last1 = last1  # the last marked node
-    self.last2 = last2  # the second last marked node
-
-
-class Solution:
-  # Similar to 3241. Time Taken to Mark All Nodes
-  def lastMarkedNodes(self, edges: list[list[int]]) -> list[int]:
-    n = len(edges) + 1
-    ans = [0] * n
-    tree = [[] for _ in range(n)]
-    # dp[i] := the last marked two nodes for subtree rooted at node i, where
-    # each node contains the time it got marked
-    dp = [Last2()] * n
-
-    for u, v in edges:
-      tree[u].append(v)
-      tree[v].append(u)
-
-    self._dfs(tree, 0, -1, dp)
-    self._reroot(tree, 0, -1, Node(), dp, ans)
-    return ans
-
-  def _dfs(
-      self,
-      tree: list[list[int]],
-      u: int,
-      prev: int,
-      dp: list[Last2]
-  ) -> Node:
-    """
-    Performs a DFS traversal of the subtree rooted at node `u`, computes the
-    time taken to mark all nodes in the subtree, records the last two marked
-    nodes, and returns the last marked node.
-
-    These values are used later in the rerooting process.
-    """
-    last1 = Node(u, 0)
-    last2 = Node()
-    for v in tree[u]:
-      if v == prev:
-        continue
-      child = self._dfs(tree, v, u, dp)
-      time = child.time + 1
-      if time > last1.time:
-        last2 = last1
-        last1 = Node(child.node, time)
-      elif time > last2.time:
-        last2 = Node(child.node, time)
-    dp[u] = Last2(last1, last2)
-    return last1
-
-  def _reroot(
-      self,
-      tree: list[list[int]],
-      u: int,
-      prev: int,
-      last: Node,
-      dp: list[list[int]],
-      ans: list[int]
-  ) -> None:
-    """
-    Reroots the tree at node `u` and updates the answer array, where `last`
-    is the last marked node that doesn't go through `u`'s subtree.
-    """
-    ans[u] = last.node if last.time > dp[u].last1.time else dp[u].last1.node
-    for v in tree[u]:
-      if v == prev:
-        continue
-      newLast = Node(last.node, last.time + 1)
-      if dp[u].last1.node == dp[v].last1.node:
-        alternativeTime = 1 + dp[u].last2.time
-        if alternativeTime > newLast.time:
-          newLast = Node(dp[u].last2.node, alternativeTime)
-      else:
-        alternativeTime = 1 + dp[u].last1.time
-        if alternativeTime > newLast.time:
-          newLast = Node(dp[u].last1.node, alternativeTime)
-      self._reroot(tree, v, u, newLast, dp, ans)
diff --git a/solutions/3314. Construct the Minimum Bitwise Array I/3314.cpp b/solutions/3314. Construct the Minimum Bitwise Array I/3314.cpp
deleted file mode 100644
index 0327d3aa4c3..00000000000
--- a/solutions/3314. Construct the Minimum Bitwise Array I/3314.cpp	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
- public:
-  vector<int> minBitwiseArray(vector<int>& nums) {
-    vector<int> ans;
-
-    for (const int num : nums)
-      ans.push_back(num == 2 ? -1 : num - getLeadingOneOfLastGroupOfOnes(num));
-
-    return ans;
-  }
-
- private:
-  // Returns the leading one of the last group of 1s in the binary
-  // representation of num. For example, if num = 0b10111, the leading one of
-  // the last group of 1s is 0b100.
-  int getLeadingOneOfLastGroupOfOnes(int num) {
-    int leadingOne = 1;
-    while ((num & leadingOne) > 0)
-      leadingOne <<= 1;
-    return leadingOne >> 1;
-  }
-};
diff --git a/solutions/3314. Construct the Minimum Bitwise Array I/3314.java b/solutions/3314. Construct the Minimum Bitwise Array I/3314.java
deleted file mode 100644
index f4cbdadf034..00000000000
--- a/solutions/3314. Construct the Minimum Bitwise Array I/3314.java	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
-  public int[] minBitwiseArray(List<Integer> nums) {
-    int[] ans = new int[nums.size()];
-
-    for (int i = 0; i < nums.size(); ++i)
-      ans[i] = nums.get(i) == 2 ? -1 : nums.get(i) - getLeadingOneOfLastGroupOfOnes(nums.get(i));
-
-    return ans;
-  }
-
-  // Returns the leading one of the last group of 1s in the binary
-  // representation of num. For example, if num = 0b10111, the leading one of
-  // the last group of 1s is 0b100.
-  private int getLeadingOneOfLastGroupOfOnes(int num) {
-    int leadingOne = 1;
-    while ((num & leadingOne) > 0)
-      leadingOne <<= 1;
-    return leadingOne >> 1;
-  }
-}
diff --git a/solutions/3314. Construct the Minimum Bitwise Array I/3314.py b/solutions/3314. Construct the Minimum Bitwise Array I/3314.py
deleted file mode 100644
index 77ef65589fa..00000000000
--- a/solutions/3314. Construct the Minimum Bitwise Array I/3314.py	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution:
-  def minBitwiseArray(self, nums: list[int]) -> list[int]:
-    return [-1 if num == 2 else num - self._getLeadingOneOfLastGroupOfOnes(num)
-            for num in nums]
-
-  def _getLeadingOneOfLastGroupOfOnes(self, num: int) -> int:
-    """
-    Returns the leading one of the last group of 1s in the binary
-    representation of num. For example, if num = 0b10111, the leading one of
-    the last group of 1s is 0b100.
-    """
-    leadingOne = 1
-    while (num & leadingOne) > 0:
-      leadingOne <<= 1
-    return leadingOne >> 1
diff --git a/solutions/3315. Construct the Minimum Bitwise Array II/3315.cpp b/solutions/3315. Construct the Minimum Bitwise Array II/3315.cpp
deleted file mode 100644
index bdd68ff4a8f..00000000000
--- a/solutions/3315. Construct the Minimum Bitwise Array II/3315.cpp	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
- public:
-  // Same as 3314. Construct the Minimum Bitwise Array I
-  vector<int> minBitwiseArray(vector<int>& nums) {
-    vector<int> ans;
-
-    for (const int num : nums)
-      ans.push_back(num == 2 ? -1 : num - getLeadingOneOfLastGroupOfOnes(num));
-
-    return ans;
-  }
-
- private:
-  // Returns the leading one of the last group of 1s in the binary
-  // representation of num. For example, if num = 0b10111, the leading one of
-  // the last group of 1s is 0b100.
-  int getLeadingOneOfLastGroupOfOnes(int num) {
-    int leadingOne = 1;
-    while ((num & leadingOne) > 0)
-      leadingOne <<= 1;
-    return leadingOne >> 1;
-  }
-};
diff --git a/solutions/3315. Construct the Minimum Bitwise Array II/3315.java b/solutions/3315. Construct the Minimum Bitwise Array II/3315.java
deleted file mode 100644
index 600f165b216..00000000000
--- a/solutions/3315. Construct the Minimum Bitwise Array II/3315.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  // Same as 3314. Construct the Minimum Bitwise Array I
-  public int[] minBitwiseArray(List<Integer> nums) {
-    int[] ans = new int[nums.size()];
-
-    for (int i = 0; i < nums.size(); ++i)
-      ans[i] = nums.get(i) == 2 ? -1 : nums.get(i) - getLeadingOneOfLastGroupOfOnes(nums.get(i));
-
-    return ans;
-  }
-
-  // Returns the leading one of the last group of 1s in the binary
-  // representation of num. For example, if num = 0b10111, the leading one of
-  // the last group of 1s is 0b100.
-  private int getLeadingOneOfLastGroupOfOnes(int num) {
-    int leadingOne = 1;
-    while ((num & leadingOne) > 0)
-      leadingOne <<= 1;
-    return leadingOne >> 1;
-  }
-}
diff --git a/solutions/3315. Construct the Minimum Bitwise Array II/3315.py b/solutions/3315. Construct the Minimum Bitwise Array II/3315.py
deleted file mode 100644
index 326799ca558..00000000000
--- a/solutions/3315. Construct the Minimum Bitwise Array II/3315.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  # Same as 3314. Construct the Minimum Bitwise Array I
-  def minBitwiseArray(self, nums: list[int]) -> list[int]:
-    return [-1 if num == 2 else num - self._getLeadingOneOfLastGroupOfOnes(num)
-            for num in nums]
-
-  def _getLeadingOneOfLastGroupOfOnes(self, num: int) -> int:
-    """
-    Returns the leading one of the last group of 1s in the binary
-    representation of num. For example, if num = 0b10111, the leading one of
-    the last group of 1s is 0b100.
-    """
-    leadingOne = 1
-    while (num & leadingOne) > 0:
-      leadingOne <<= 1
-    return leadingOne >> 1
diff --git a/solutions/3316. Find Maximum Removals From Source String/3316-2.cpp b/solutions/3316. Find Maximum Removals From Source String/3316-2.cpp
deleted file mode 100644
index 1c36aacbcc8..00000000000
--- a/solutions/3316. Find Maximum Removals From Source String/3316-2.cpp	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
- public:
-  int maxRemovals(string source, string pattern, vector<int>& targetIndices) {
-    const int m = source.length();
-    const int n = pattern.length();
-    const unordered_set<int> target{targetIndices.begin(), targetIndices.end()};
-    // dp[i][j] := the maximum number of operations that can be performed for
-    // source[i..m) and pattern[j..n)
-    vector<vector<int>> dp(m + 1, vector<int>(n + 1, INT_MIN));
-    dp[m][n] = 0;
-
-    for (int i = m - 1; i >= 0; --i) {
-      dp[i][n] = (target.contains(i) ? 1 : 0) + dp[i + 1][n];
-      for (int j = n - 1; j >= 0; --j) {
-        const int pick = source[i] == pattern[j] ? dp[i + 1][j + 1] : INT_MIN;
-        const int skip = (target.contains(i) ? 1 : 0) + dp[i + 1][j];
-        dp[i][j] = max(pick, skip);
-      }
-    }
-
-    return dp[0][0] == INT_MIN ? 0 : dp[0][0];
-  }
-};
diff --git a/solutions/3316. Find Maximum Removals From Source String/3316-2.java b/solutions/3316. Find Maximum Removals From Source String/3316-2.java
deleted file mode 100644
index 32d4db0c710..00000000000
--- a/solutions/3316. Find Maximum Removals From Source String/3316-2.java	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
-  public int maxRemovals(String source, String pattern, int[] targetIndices) {
-    final int m = source.length();
-    final int n = pattern.length();
-    Set<Integer> target = Arrays.stream(targetIndices).boxed().collect(Collectors.toSet());
-    // dp[i][j] := the maximum number of operations that can be performed for
-    // source[i..m) and pattern[j..n)
-    int[][] dp = new int[m + 1][n + 1];
-    Arrays.stream(dp).forEach(A -> Arrays.fill(A, Integer.MIN_VALUE));
-    dp[m][n] = 0;
-
-    for (int i = m - 1; i >= 0; --i) {
-      dp[i][n] = (target.contains(i) ? 1 : 0) + dp[i + 1][n];
-      for (int j = n - 1; j >= 0; --j) {
-        final int pick =
-            source.charAt(i) == pattern.charAt(j) ? dp[i + 1][j + 1] : Integer.MIN_VALUE;
-        final int skip = (target.contains(i) ? 1 : 0) + dp[i + 1][j];
-        dp[i][j] = Math.max(pick, skip);
-      }
-    }
-
-    return dp[0][0] == Integer.MIN_VALUE ? 0 : dp[0][0];
-  }
-}
diff --git a/solutions/3316. Find Maximum Removals From Source String/3316-2.py b/solutions/3316. Find Maximum Removals From Source String/3316-2.py
deleted file mode 100644
index 6174e951e8f..00000000000
--- a/solutions/3316. Find Maximum Removals From Source String/3316-2.py	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution:
-  def maxRemovals(
-      self,
-      source: str,
-      pattern: str,
-      targetIndices: list[int]
-  ) -> int:
-    m = len(source)
-    n = len(pattern)
-    target = set(targetIndices)
-    # dp[i][j] := the maximum number of operations that can be performed for
-    # source[i..m) and pattern[j..n)
-    dp = [[-math.inf] * (n + 1) for _ in range(m + 1)]
-    dp[m][n] = 0
-
-    for i in reversed(range(m)):
-      dp[i][n] = int(i in target) + dp[i + 1][n]
-      for j in reversed(range(n)):
-        pick = dp[i + 1][j + 1] if source[i] == pattern[j] else -math.inf
-        skip = int(i in target) + dp[i + 1][j]
-        dp[i][j] = max(pick, skip)
-
-    return 0 if dp[0][0] == -math.inf else dp[0][0]
diff --git a/solutions/3316. Find Maximum Removals From Source String/3316-3.cpp b/solutions/3316. Find Maximum Removals From Source String/3316-3.cpp
deleted file mode 100644
index 47af9d147da..00000000000
--- a/solutions/3316. Find Maximum Removals From Source String/3316-3.cpp	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
- public:
-  int maxRemovals(string source, string pattern, vector<int>& targetIndices) {
-    const int m = source.length();
-    const int n = pattern.length();
-    const unordered_set<int> target{targetIndices.begin(), targetIndices.end()};
-    // dp[j] := the maximum number of operations that can be performed for
-    // source so far and pattern[j..n)
-    vector<int> dp(n + 1, INT_MIN);
-    dp[n] = 0;
-
-    for (int i = m - 1; i >= 0; --i) {
-      vector<int> newDp(dp);
-      newDp[n] = (target.contains(i) ? 1 : 0) + dp[n];
-      for (int j = n - 1; j >= 0; --j) {
-        const int pick = source[i] == pattern[j] ? dp[j + 1] : INT_MIN;
-        const int skip = (target.contains(i) ? 1 : 0) + dp[j];
-        newDp[j] = max(pick, skip);
-      }
-      dp = std::move(newDp);
-    }
-
-    return dp[0] == INT_MIN ? 0 : dp[0];
-  }
-};
diff --git a/solutions/3316. Find Maximum Removals From Source String/3316-3.java b/solutions/3316. Find Maximum Removals From Source String/3316-3.java
deleted file mode 100644
index 96beac4d81d..00000000000
--- a/solutions/3316. Find Maximum Removals From Source String/3316-3.java	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
-  public int maxRemovals(String source, String pattern, int[] targetIndices) {
-    final int m = source.length();
-    final int n = pattern.length();
-    Set<Integer> target = Arrays.stream(targetIndices).boxed().collect(Collectors.toSet());
-    // dp[j] := the maximum number of operations that can be performed for
-    // source so far and pattern[j..n)
-    int[] dp = new int[n + 1];
-    Arrays.fill(dp, Integer.MIN_VALUE);
-    dp[n] = 0;
-
-    for (int i = m - 1; i >= 0; --i) {
-      int[] newDp = dp.clone();
-      newDp[n] = (target.contains(i) ? 1 : 0) + dp[n];
-      for (int j = n - 1; j >= 0; --j) {
-        final int pick = source.charAt(i) == pattern.charAt(j) ? dp[j + 1] : Integer.MIN_VALUE;
-        final int skip = (target.contains(i) ? 1 : 0) + dp[j];
-        newDp[j] = Math.max(pick, skip);
-      }
-      dp = newDp;
-    }
-
-    return dp[0] == Integer.MIN_VALUE ? 0 : dp[0];
-  }
-}
diff --git a/solutions/3316. Find Maximum Removals From Source String/3316-3.py b/solutions/3316. Find Maximum Removals From Source String/3316-3.py
deleted file mode 100644
index 7fa7a6eb354..00000000000
--- a/solutions/3316. Find Maximum Removals From Source String/3316-3.py	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution:
-  def maxRemovals(
-      self,
-      source: str,
-      pattern: str,
-      targetIndices: list[int]
-  ) -> int:
-    m = len(source)
-    n = len(pattern)
-    target = set(targetIndices)
-    # dp[j] := the maximum number of operations that can be performed for
-    # source so far and pattern[j..n)
-    dp = [-math.inf] * (n + 1)
-    dp[n] = 0
-
-    for i in reversed(range(m)):
-      newDp = dp[:]
-      newDp[n] = int(i in target) + dp[n]
-      for j in range(n):
-        pick = dp[j + 1] if source[i] == pattern[j] else -math.inf
-        skip = int(i in target) + dp[j]
-        newDp[j] = max(pick, skip)
-      dp = newDp
-
-    return 0 if dp[0] == -math.inf else dp[0]
diff --git a/solutions/3316. Find Maximum Removals From Source String/3316.cpp b/solutions/3316. Find Maximum Removals From Source String/3316.cpp
deleted file mode 100644
index 1e5ed0c354f..00000000000
--- a/solutions/3316. Find Maximum Removals From Source String/3316.cpp	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
- public:
-  int maxRemovals(string source, string pattern, vector<int>& targetIndices) {
-    const unordered_set<int> target{targetIndices.begin(), targetIndices.end()};
-    vector<vector<int>> mem(source.length(), vector<int>(pattern.length(), -1));
-    const int ans = maxRemovals(source, pattern, 0, 0, target, mem);
-    return ans == INT_MIN ? 0 : ans;
-  }
-
- private:
-  // Returns the maximum number of operations that can be performed for
-  // source[i..m) and pattern[j..n).
-  int maxRemovals(const string& source, const string& pattern, int i, int j,
-                  const unordered_set<int>& target, vector<vector<int>>& mem) {
-    if (i == source.length())
-      return j == pattern.length() ? 0 : INT_MIN;
-    if (j == pattern.length())
-      return (target.contains(i) ? 1 : 0) +
-             maxRemovals(source, pattern, i + 1, j, target, mem);
-    if (mem[i][j] != -1)
-      return mem[i][j];
-    const int pick =
-        source[i] == pattern[j]
-            ? maxRemovals(source, pattern, i + 1, j + 1, target, mem)
-            : INT_MIN;
-    const int skip = (target.contains(i) ? 1 : 0) +
-                     maxRemovals(source, pattern, i + 1, j, target, mem);
-    return mem[i][j] = max(pick, skip);
-  };
-};
diff --git a/solutions/3316. Find Maximum Removals From Source String/3316.java b/solutions/3316. Find Maximum Removals From Source String/3316.java
deleted file mode 100644
index e4ecafe7d11..00000000000
--- a/solutions/3316. Find Maximum Removals From Source String/3316.java	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution {
-  public int maxRemovals(String source, String pattern, int[] targetIndices) {
-    Set<Integer> target = Arrays.stream(targetIndices).boxed().collect(Collectors.toSet());
-    Integer[][] mem = new Integer[source.length()][pattern.length()];
-    final int ans = maxRemovals(source, pattern, 0, 0, target, mem);
-    return ans == Integer.MIN_VALUE ? 0 : ans;
-  }
-
-  // Returns the maximum number of operations that can be performed for
-  // source[i..m) and pattern[j..n).
-  private int maxRemovals(String source, String pattern, int i, int j, Set<Integer> target,
-                          Integer[][] mem) {
-    if (i == source.length())
-      return j == pattern.length() ? 0 : Integer.MIN_VALUE;
-    if (j == pattern.length())
-      return (target.contains(i) ? 1 : 0) + maxRemovals(source, pattern, i + 1, j, target, mem);
-    if (mem[i][j] != null)
-      return mem[i][j];
-    final int pick = source.charAt(i) == pattern.charAt(j)
-                         ? maxRemovals(source, pattern, i + 1, j + 1, target, mem)
-                         : Integer.MIN_VALUE;
-    final int skip =
-        (target.contains(i) ? 1 : 0) + maxRemovals(source, pattern, i + 1, j, target, mem);
-    return mem[i][j] = Math.max(pick, skip);
-  }
-}
diff --git a/solutions/3316. Find Maximum Removals From Source String/3316.py b/solutions/3316. Find Maximum Removals From Source String/3316.py
deleted file mode 100644
index 029718b7944..00000000000
--- a/solutions/3316. Find Maximum Removals From Source String/3316.py	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution:
-  def maxRemovals(
-      self,
-      source: str,
-      pattern: str,
-      targetIndices: list[int]
-  ) -> int:
-    m = len(source)
-    n = len(pattern)
-    target = set(targetIndices)
-
-    @functools.lru_cache(None)
-    def dp(i: int, j: int) -> int:
-      """
-      Returns the maximum number of operations that can be performed for
-      source[i..m) and pattern[j..n).
-      """
-      if i == m:
-        return 0 if j == n else -math.inf
-      if j == n:
-        return int(i in target) + dp(i + 1, j)
-      pick = dp(i + 1, j + 1) if source[i] == pattern[j] else -math.inf
-      skip = int(i in target) + dp(i + 1, j)
-      return max(pick, skip)
-
-    ans = dp(0, 0)
-    return 0 if ans == -math.inf else ans
diff --git a/solutions/3317. Find the Number of Possible Ways for an Event/3317.cpp b/solutions/3317. Find the Number of Possible Ways for an Event/3317.cpp
deleted file mode 100644
index 91943756774..00000000000
--- a/solutions/3317. Find the Number of Possible Ways for an Event/3317.cpp	
+++ /dev/null
@@ -1,70 +0,0 @@
-class Solution {
- public:
-  int numberOfWays(int n, int x, int y) {
-    const int maxStages = min(n, x);
-    const auto [fact, invFact] = getFactAndInvFact(max(n, x));
-    const vector<vector<int>> stirling = getStirling(n, maxStages);
-    int ans = 0;
-
-    for (int k = 1; k <= maxStages; ++k) {
-      // 1. Choose `k` stages from `x` stages.
-      long events = nCk(x, k, fact, invFact);
-      // 2. Partition `n` performers into `k` stages.
-      events = events * stirling[n][k] % kMod;
-      // 3. Permute `k` stages.
-      events = events * fact[k] % kMod;
-      // 4. Score `k` stages with score in the range [1, y], so y^k ways.
-      events = events * modPow(y, k) % kMod;
-      ans = (ans + events) % kMod;
-    }
-
-    return ans;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  pair<vector<long>, vector<long>> getFactAndInvFact(int n) {
-    vector<long> fact(n + 1);
-    vector<long> invFact(n + 1);
-    vector<long> inv(n + 1);
-    fact[0] = invFact[0] = 1;
-    inv[0] = inv[1] = 1;
-    for (int i = 1; i <= n; ++i) {
-      if (i >= 2)
-        inv[i] = kMod - kMod / i * inv[kMod % i] % kMod;
-      fact[i] = fact[i - 1] * i % kMod;
-      invFact[i] = invFact[i - 1] * inv[i] % kMod;
-    }
-    return {fact, invFact};
-  }
-
-  int nCk(int n, int k, const vector<long>& fact, const vector<long>& invFact) {
-    return fact[n] * invFact[k] % kMod * invFact[n - k] % kMod;
-  }
-
-  // Returns a 2D array stirling, where stirling[i][j] := the number of ways to
-  // partition a set of i objects into j non-empty subsets.
-  //
-  // https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
-  vector<vector<int>> getStirling(int n, int k) {
-    vector<vector<int>> stirling(n + 1, vector<int>(k + 1));
-    stirling[0][0] = 1;
-    for (int i = 1; i <= n; ++i) {
-      stirling[i][1] = 1;
-      for (int j = 2; j <= min(i, k); ++j)
-        stirling[i][j] = (static_cast<long>(j) * stirling[i - 1][j] +
-                          stirling[i - 1][j - 1]) %
-                         kMod;
-    }
-    return stirling;
-  }
-
-  long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x % kMod, (n - 1)) % kMod;
-    return modPow(x * x % kMod, (n / 2)) % kMod;
-  }
-};
diff --git a/solutions/3317. Find the Number of Possible Ways for an Event/3317.java b/solutions/3317. Find the Number of Possible Ways for an Event/3317.java
deleted file mode 100644
index fc6193321ce..00000000000
--- a/solutions/3317. Find the Number of Possible Ways for an Event/3317.java	
+++ /dev/null
@@ -1,68 +0,0 @@
-class Solution {
-  public int numberOfWays(int n, int x, int y) {
-    final int maxStages = Math.min(n, x);
-    long[][] factAndInvFact = getFactAndInvFact(Math.max(n, x));
-    long[] fact = factAndInvFact[0];
-    long[] invFact = factAndInvFact[1];
-    int[][] stirling = getStirling(n, maxStages);
-    int ans = 0;
-
-    for (int k = 1; k <= maxStages; ++k) {
-      // 1. Choose `k` stages from `x` stages.
-      long events = nCk(x, k, fact, invFact);
-      // 2. Partition `n` performers into `k` stages.
-      events = events * stirling[n][k] % MOD;
-      // 3. Permute `k` stages.
-      events = events * fact[k] % MOD;
-      // 4. Score `k` stages with score in the range [1, y], so y^k ways.
-      events = events * modPow(y, k) % MOD;
-      ans = (int) ((ans + events) % MOD);
-    }
-
-    return ans;
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  private long[][] getFactAndInvFact(int n) {
-    long[] fact = new long[n + 1];
-    long[] invFact = new long[n + 1];
-    long[] inv = new long[n + 1];
-    fact[0] = invFact[0] = 1;
-    inv[0] = inv[1] = 1;
-    for (int i = 1; i <= n; ++i) {
-      if (i >= 2)
-        inv[i] = MOD - MOD / i * inv[MOD % i] % MOD;
-      fact[i] = fact[i - 1] * i % MOD;
-      invFact[i] = invFact[i - 1] * inv[i] % MOD;
-    }
-    return new long[][] {fact, invFact};
-  }
-
-  private int nCk(int n, int k, long[] fact, long[] invFact) {
-    return (int) (fact[n] * invFact[k] % MOD * invFact[n - k] % MOD);
-  }
-
-  // Returns a 2D array stirling, where stirling[i][j] := the number of ways to
-  // partition a set of i objects into j non-empty subsets.
-  //
-  // https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
-  private int[][] getStirling(int n, int k) {
-    int[][] stirling = new int[n + 1][k + 1];
-    stirling[0][0] = 1;
-    for (int i = 1; i <= n; ++i) {
-      stirling[i][1] = 1;
-      for (int j = 2; j <= Math.min(i, k); ++j)
-        stirling[i][j] = (int) (((long) j * stirling[i - 1][j] + stirling[i - 1][j - 1]) % MOD);
-    }
-    return stirling;
-  }
-
-  private long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2);
-  }
-}
diff --git a/solutions/3317. Find the Number of Possible Ways for an Event/3317.py b/solutions/3317. Find the Number of Possible Ways for an Event/3317.py
deleted file mode 100644
index 695172e89b0..00000000000
--- a/solutions/3317. Find the Number of Possible Ways for an Event/3317.py	
+++ /dev/null
@@ -1,36 +0,0 @@
-class Solution:
-  def numberOfWays(self, n: int, x: int, y: int) -> int:
-    MOD = 1_000_000_007
-
-    @functools.lru_cache(None)
-    def fact(i: int) -> int:
-      return 1 if i <= 1 else i * fact(i - 1) % MOD
-
-    @functools.lru_cache(None)
-    def inv(i: int) -> int:
-      return pow(i, MOD - 2, MOD)
-
-    @functools.lru_cache(None)
-    def nCk(n: int, k: int) -> int:
-      return fact(n) * inv(fact(k)) * inv(fact(n - k)) % MOD
-
-    @functools.lru_cache(None)
-    def stirling(n: int, k: int) -> int:
-      """
-      Returns the number of ways to partition a set of n objects into k
-      non-empty subsets.
-
-      https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
-      """
-      if k == 0 or n < k:
-        return 0
-      if k == 1 or n == k:
-        return 1
-      return (k * stirling(n - 1, k) + stirling(n - 1, k - 1)) % MOD
-
-    # 1. Choose `k` stages from `x` stages.
-    # 2. Partition `n` performers into `k` stages.
-    # 3. Permute `k` stages.
-    # 4. Score `k` stages with score in the range [1, y], so y^k ways.
-    return sum(nCk(x, k) * stirling(n, k) * fact(k) * pow(y, k, MOD) % MOD
-               for k in range(1, min(n, x) + 1)) % MOD
diff --git a/solutions/3318. Find X-Sum of All K-Long Subarrays I/3318.cpp b/solutions/3318. Find X-Sum of All K-Long Subarrays I/3318.cpp
deleted file mode 100644
index a55f6ebadce..00000000000
--- a/solutions/3318. Find X-Sum of All K-Long Subarrays I/3318.cpp	
+++ /dev/null
@@ -1,54 +0,0 @@
-class Solution {
- public:
-  vector<int> findXSum(vector<int>& nums, int k, int x) {
-    vector<int> ans;
-    long windowSum = 0;
-    unordered_map<int, int> count;
-    multiset<pair<int, int>> top;  // the top x elements
-    multiset<pair<int, int>> bot;  // the rest of the elements
-
-    // Updates the count of num by freq and the window sum accordingly.
-    auto update = [&count, &top, &bot, &windowSum](int num, int freq) -> void {
-      if (count[num] > 0) {  // Clean up the old count.
-        if (auto it = bot.find({count[num], num}); it != bot.end()) {
-          bot.erase(it);
-        } else {
-          it = top.find({count[num], num});
-          top.erase(it);
-          windowSum -= num * count[num];
-        }
-      }
-      count[num] += freq;
-      if (count[num] > 0)
-        bot.insert({count[num], num});
-    };
-
-    for (int i = 0; i < nums.size(); ++i) {
-      update(nums[i], 1);
-      if (i >= k)
-        update(nums[i - k], -1);
-      // Move the bottom elements to the top if needed.
-      while (!bot.empty() && top.size() < x) {
-        const auto [countB, b] = *bot.rbegin();
-        bot.erase(--bot.end());
-        top.insert({countB, b});
-        windowSum += b * countB;
-      }
-      // Swap the bottom and top elements if needed.
-      while (!bot.empty() && *bot.rbegin() > *top.begin()) {
-        const auto [countB, b] = *bot.rbegin();
-        const auto [countT, t] = *top.begin();
-        bot.erase(--bot.end());
-        top.erase(top.begin());
-        bot.insert({countT, t});
-        top.insert({countB, b});
-        windowSum += b * countB;
-        windowSum -= t * countT;
-      }
-      if (i >= k - 1)
-        ans.push_back(windowSum);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3318. Find X-Sum of All K-Long Subarrays I/3318.java b/solutions/3318. Find X-Sum of All K-Long Subarrays I/3318.java
deleted file mode 100644
index 18d599652ce..00000000000
--- a/solutions/3318. Find X-Sum of All K-Long Subarrays I/3318.java	
+++ /dev/null
@@ -1,57 +0,0 @@
-class Solution {
-  public int[] findXSum(int[] nums, int k, int x) {
-    int[] ans = new int[nums.length - k + 1];
-    Map<Integer, Integer> count = new HashMap<>();
-    TreeSet<Pair<Integer, Integer>> top =
-        new TreeSet<>(Comparator.comparingInt(Pair<Integer, Integer>::getKey)
-                          .thenComparingInt(Pair<Integer, Integer>::getValue));
-    TreeSet<Pair<Integer, Integer>> bot =
-        new TreeSet<>(Comparator.comparingInt(Pair<Integer, Integer>::getKey)
-                          .thenComparingInt(Pair<Integer, Integer>::getValue));
-
-    for (int i = 0; i < nums.length; ++i) {
-      update(nums[i], 1, count, top, bot);
-      if (i >= k)
-        update(nums[i - k], -1, count, top, bot);
-      // Move the bottom elements to the top if needed.
-      while (!bot.isEmpty() && top.size() < x) {
-        Pair<Integer, Integer> pair = bot.pollLast();
-        top.add(pair);
-        windowSum += pair.getValue() * pair.getKey();
-      }
-      // Swap the bottom and top elements if needed.
-      while (!bot.isEmpty() && (bot.last().getKey() > top.first().getKey() ||
-                                bot.last().getKey().equals(top.first().getKey()) &&
-                                    bot.last().getValue() > top.first().getValue())) {
-        Pair<Integer, Integer> pairB = bot.pollLast();
-        Pair<Integer, Integer> pairT = top.pollFirst();
-        top.add(pairB);
-        bot.add(pairT);
-        windowSum += pairB.getValue() * pairB.getKey();
-        windowSum -= pairT.getValue() * pairT.getKey();
-      }
-      if (i >= k - 1)
-        ans[i - k + 1] = windowSum;
-    }
-    return ans;
-  }
-
-  private int windowSum = 0;
-
-  // Updates the count of num by freq and the window sum accordingly.
-  private void update(int num, int freq, Map<Integer, Integer> count,
-                      TreeSet<Pair<Integer, Integer>> top, TreeSet<Pair<Integer, Integer>> bot) {
-    if (count.getOrDefault(num, 0) > 0) { // Clean up the old count.
-      Pair<Integer, Integer> pair = new Pair<>(count.get(num), num);
-      if (bot.remove(pair)) {
-        // Do nothing.
-      } else {
-        top.remove(pair);
-        windowSum -= num * count.get(num);
-      }
-    }
-    count.merge(num, freq, Integer::sum);
-    if (count.get(num) > 0)
-      bot.add(new Pair<>(count.get(num), num));
-  }
-}
diff --git a/solutions/3318. Find X-Sum of All K-Long Subarrays I/3318.py b/solutions/3318. Find X-Sum of All K-Long Subarrays I/3318.py
deleted file mode 100644
index 68baa3296be..00000000000
--- a/solutions/3318. Find X-Sum of All K-Long Subarrays I/3318.py	
+++ /dev/null
@@ -1,45 +0,0 @@
-from sortedcontainers import SortedList
-
-
-class Solution:
-  def findXSum(self, nums: list[int], k: int, x: int) -> list[int]:
-    ans = []
-    windowSum = 0
-    count = collections.Counter()
-    top = SortedList()
-    bot = SortedList()
-
-    def update(num: int, freq: int) -> None:
-      """Updates the count of num by freq and the window sum accordingly."""
-      nonlocal windowSum
-      if count[num] > 0:  # Clean up old values.
-        if [count[num], num] in bot:
-          bot.remove([count[num], num])
-        else:
-          top.remove([count[num], num])
-          windowSum -= num * count[num]
-      count[num] += freq
-      if count[num] > 0:
-        bot.add([count[num], num])
-
-    for i, num in enumerate(nums):
-      update(num, 1)
-      if i >= k:
-        update(nums[i - k], -1)
-      # Move the bottom element to the top if needed.
-      while bot and len(top) < x:
-        countB, b = bot.pop()
-        top.add([countB, b])
-        windowSum += b * countB
-      # Swap the bottom and top elements if needed.
-      while bot and bot[-1] > top[0]:
-        countB, b = bot.pop()
-        countT, t = top.pop(0)
-        bot.add([countT, t])
-        windowSum -= t * countT
-        top.add([countB, b])
-        windowSum += b * countB
-      if i >= k - 1:
-        ans.append(windowSum)
-
-    return ans
diff --git a/solutions/3319. K-th Largest Perfect Subtree Size in Binary Tree/3319.cpp b/solutions/3319. K-th Largest Perfect Subtree Size in Binary Tree/3319.cpp
deleted file mode 100644
index e302a4d7ab0..00000000000
--- a/solutions/3319. K-th Largest Perfect Subtree Size in Binary Tree/3319.cpp	
+++ /dev/null
@@ -1,28 +0,0 @@
-struct T {
-  bool isPerfect;
-  int sz;
-};
-
-class Solution {
- public:
-  int kthLargestPerfectSubtree(TreeNode* root, int k) {
-    vector<int> ans;
-    dfs(root, ans);
-    ranges::sort(ans, greater<>());
-    return ans.size() < k ? -1 : ans[k - 1];
-  }
-
- private:
-  T dfs(TreeNode* root, vector<int>& ans) {
-    if (root == nullptr)
-      return {true, 0};
-    const auto l = dfs(root->left, ans);
-    const auto r = dfs(root->right, ans);
-    if (l.isPerfect && r.isPerfect && l.sz == r.sz) {
-      const int sz = 1 + l.sz + r.sz;
-      ans.push_back(sz);
-      return {true, sz};
-    }
-    return {false, 0};
-  }
-};
diff --git a/solutions/3319. K-th Largest Perfect Subtree Size in Binary Tree/3319.java b/solutions/3319. K-th Largest Perfect Subtree Size in Binary Tree/3319.java
deleted file mode 100644
index 466730f6be3..00000000000
--- a/solutions/3319. K-th Largest Perfect Subtree Size in Binary Tree/3319.java	
+++ /dev/null
@@ -1,23 +0,0 @@
-record T(boolean isPerfect, int sz) {}
-
-class Solution {
-  public int kthLargestPerfectSubtree(TreeNode root, int k) {
-    List<Integer> ans = new ArrayList<>();
-    dfs(root, ans);
-    Collections.sort(ans, Collections.reverseOrder());
-    return ans.size() < k ? -1 : ans.get(k - 1);
-  }
-
-  private T dfs(TreeNode root, List<Integer> ans) {
-    if (root == null)
-      return new T(true, 0);
-    T l = dfs(root.left, ans);
-    T r = dfs(root.right, ans);
-    if (l.isPerfect() && r.isPerfect() && l.sz() == r.sz()) {
-      final int sz = 1 + l.sz() + r.sz();
-      ans.add(sz);
-      return new T(true, sz);
-    }
-    return new T(false, 0);
-  }
-}
diff --git a/solutions/3319. K-th Largest Perfect Subtree Size in Binary Tree/3319.py b/solutions/3319. K-th Largest Perfect Subtree Size in Binary Tree/3319.py
deleted file mode 100644
index c82898b57e3..00000000000
--- a/solutions/3319. K-th Largest Perfect Subtree Size in Binary Tree/3319.py	
+++ /dev/null
@@ -1,27 +0,0 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
-class T:
-  isPerfect: bool
-  sz: int
-
-
-class Solution:
-  def kthLargestPerfectSubtree(self, root: TreeNode | None, k: int) -> int:
-    ans = []
-    self._dfs(root, ans)
-    if len(ans) < k:
-      return -1
-    return sorted(ans, reverse=True)[k - 1]
-
-  def _dfs(self, root: TreeNode, ans: list[int]) -> T:
-    if not root:
-      return T(True, 0)
-    l = self._dfs(root.left, ans)
-    r = self._dfs(root.right, ans)
-    if l.isPerfect and r.isPerfect and l.sz == r.sz:
-      sz = 1 + l.sz + r.sz
-      ans.append(sz)
-      return T(True, sz)
-    return T(False, 0)
diff --git a/solutions/332. Reconstruct Itinerary/332.cpp b/solutions/332. Reconstruct Itinerary/332.cpp
index 9bf4bde454b..6731b099726 100644
--- a/solutions/332. Reconstruct Itinerary/332.cpp	
+++ b/solutions/332. Reconstruct Itinerary/332.cpp	
@@ -8,7 +8,7 @@ class Solution {
       graph[ticket[0]].insert(ticket[1]);
 
     dfs(graph, "JFK", ans);
-    ranges::reverse(ans);
+    reverse(ans.begin(), ans.end());
     return ans;
   }
 
diff --git a/solutions/332. Reconstruct Itinerary/332.py b/solutions/332. Reconstruct Itinerary/332.py
index cbc33a2d43c..df0a55f7d33 100644
--- a/solutions/332. Reconstruct Itinerary/332.py	
+++ b/solutions/332. Reconstruct Itinerary/332.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findItinerary(self, tickets: list[list[str]]) -> list[str]:
+  def findItinerary(self, tickets: List[List[str]]) -> List[str]:
     ans = []
     graph = collections.defaultdict(list)
 
diff --git a/solutions/3320. Count The Number of Winning Sequences/3320.cpp b/solutions/3320. Count The Number of Winning Sequences/3320.cpp
deleted file mode 100644
index 91468ff8a20..00000000000
--- a/solutions/3320. Count The Number of Winning Sequences/3320.cpp	
+++ /dev/null
@@ -1,61 +0,0 @@
-
-class Solution {
- public:
-  int countWinningSequences(string s) {
-    vector<vector<vector<int>>> mem(
-        s.length(), vector<vector<int>>(3, vector<int>(2 * s.length(), -1)));
-    const long ans = count(s, 0, 0, 0, mem) + count(s, 0, 1, 0, mem) +
-                     count(s, 0, 2, 0, mem);
-    return (ans / 2) % kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Returns the number of distinct sequences Bob can use to beat Alice for
-  // s[i..n), where the previous character is `prev` (0: F, 1: W, 2: E) and the
-  // number of points that Bob is having is `bob`.
-  long count(const string& s, int i, int prev, int bob,
-             vector<vector<vector<int>>>& mem) {
-    if (i == s.length())
-      return bob > 0 ? 1 : 0;
-    // Map [-s.length(), s.length() - 1] to [0, 2 * s.length() - 1].
-    int& res = mem[i][prev][bob + s.length()];
-    if (res != -1)
-      return res;
-
-    long f = 0;  // If Bob summons a Fire Dragon at i.
-    long w = 0;  // If Bob summons a Water Serpent at i.
-    long e = 0;  // If Bob summons a Earth Golem at i.
-
-    switch (s[i]) {
-      case 'F':
-        if (prev != 0)
-          f = count(s, i + 1, 0, bob, mem) % kMod;
-        if (prev != 1)
-          w = count(s, i + 1, 1, bob + 1, mem) % kMod;
-        if (prev != 2)
-          e = count(s, i + 1, 2, bob - 1, mem) % kMod;
-        break;
-      case 'W':
-        if (prev != 0)
-          f = count(s, i + 1, 0, bob - 1, mem) % kMod;
-        if (prev != 1)
-          w = count(s, i + 1, 1, bob, mem) % kMod;
-        if (prev != 2)
-          e = count(s, i + 1, 2, bob + 1, mem) % kMod;
-        break;
-      case 'E':
-        if (prev != 0)
-          f = count(s, i + 1, 0, bob + 1, mem) % kMod;
-        if (prev != 1)
-          w = count(s, i + 1, 1, bob - 1, mem) % kMod;
-        if (prev != 2)
-          e = count(s, i + 1, 2, bob, mem) % kMod;
-      default:
-        break;
-    }
-
-    return res = f + w + e;
-  }
-};
diff --git a/solutions/3320. Count The Number of Winning Sequences/3320.java b/solutions/3320. Count The Number of Winning Sequences/3320.java
deleted file mode 100644
index f83eee37ec6..00000000000
--- a/solutions/3320. Count The Number of Winning Sequences/3320.java	
+++ /dev/null
@@ -1,55 +0,0 @@
-class Solution {
-  public int countWinningSequences(String s) {
-    Long[][][] mem = new Long[s.length()][3][2 * s.length()];
-    final long ans = count(s, 0, 0, 0, mem) + count(s, 0, 1, 0, mem) + count(s, 0, 2, 0, mem);
-    return (int) ((ans / 2) % MOD);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  // Returns the number of distinct sequences Bob can use to beat Alice for
-  // s[i..n), where the previous character is `prev` (0: F, 1: W, 2: E) and the
-  // number of points that Bob is having is `bob`.
-  private long count(final String s, int i, int prev, int bob, Long[][][] mem) {
-    if (i == s.length())
-      return bob > 0 ? 1 : 0;
-    final int bobIdx = bob + s.length();
-    if (mem[i][prev][bobIdx] != null)
-      return mem[i][prev][bobIdx];
-
-    long f = 0; // If Bob summons a Fire Dragon at i.
-    long w = 0; // If Bob summons a Water Serpent at i.
-    long e = 0; // If Bob summons a Earth Golem at i.
-
-    switch (s.charAt(i)) {
-      case 'F':
-        if (prev != 0)
-          f = count(s, i + 1, 0, bob, mem) % MOD;
-        if (prev != 1)
-          w = count(s, i + 1, 1, bob + 1, mem) % MOD;
-        if (prev != 2)
-          e = count(s, i + 1, 2, bob - 1, mem) % MOD;
-        break;
-      case 'W':
-        if (prev != 0)
-          f = count(s, i + 1, 0, bob - 1, mem) % MOD;
-        if (prev != 1)
-          w = count(s, i + 1, 1, bob, mem) % MOD;
-        if (prev != 2)
-          e = count(s, i + 1, 2, bob + 1, mem) % MOD;
-        break;
-      case 'E':
-        if (prev != 0)
-          f = count(s, i + 1, 0, bob + 1, mem) % MOD;
-        if (prev != 1)
-          w = count(s, i + 1, 1, bob - 1, mem) % MOD;
-        if (prev != 2)
-          e = count(s, i + 1, 2, bob, mem) % MOD;
-        break;
-      default:
-        break;
-    }
-
-    return mem[i][prev][bobIdx] = f + w + e;
-  }
-}
diff --git a/solutions/3320. Count The Number of Winning Sequences/3320.py b/solutions/3320. Count The Number of Winning Sequences/3320.py
deleted file mode 100644
index 70ecad42c57..00000000000
--- a/solutions/3320. Count The Number of Winning Sequences/3320.py	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution:
-  def countWinningSequences(self, s: str) -> int:
-    MOD = 1_000_000_007
-
-    @functools.lru_cache(None)
-    def dp(i: int, prev: int, bob: int) -> int:
-      """
-      Returns the number of distinct sequences Bob can use to beat Alice for
-      s[i..n), where the previous character is `prev` (0: F, 1: W, 2: E) and the
-      number of points that Bob is having is `bob`.
-      """
-      if i == len(s):
-        return int(bob > 0)
-
-      f = 0  # If Bob summons a Fire Dragon at i.
-      w = 0  # If Bob summons a Water Serpent at i.
-      e = 0  # If Bob summons a Earth Golem at i.
-
-      match s[i]:
-        case 'F':
-          if prev != 0:
-            f = dp(i + 1, 0, bob) % MOD
-          if prev != 1:
-            w = dp(i + 1, 1, bob + 1) % MOD
-          if prev != 2:
-            e = dp(i + 1, 2, bob - 1) % MOD
-        case 'W':
-          if prev != 0:
-            f = dp(i + 1, 0, bob - 1) % MOD
-          if prev != 1:
-            w = dp(i + 1, 1, bob) % MOD
-          if prev != 2:
-            e = dp(i + 1, 2, bob + 1) % MOD
-        case 'E':
-          if prev != 0:
-            f = dp(i + 1, 0, bob + 1) % MOD
-          if prev != 1:
-            w = dp(i + 1, 1, bob - 1) % MOD
-          if prev != 2:
-            e = dp(i + 1, 2, bob) % MOD
-
-      return f + w + e
-
-    return (dp(0, 0, 0) + dp(0, 1, 0) + dp(0, 2, 0)) // 2 % MOD
diff --git a/solutions/3321. Find X-Sum of All K-Long Subarrays II/3321.cpp b/solutions/3321. Find X-Sum of All K-Long Subarrays II/3321.cpp
deleted file mode 100644
index 23311502803..00000000000
--- a/solutions/3321. Find X-Sum of All K-Long Subarrays II/3321.cpp	
+++ /dev/null
@@ -1,55 +0,0 @@
-class Solution {
- public:
-  // Same as 3318. Find X-Sum of All K-Long Subarrays I
-  vector<long long> findXSum(vector<int>& nums, int k, int x) {
-    vector<long long> ans;
-    long windowSum = 0;
-    unordered_map<int, int> count;
-    multiset<pair<int, int>> top;  // the top x elements
-    multiset<pair<int, int>> bot;  // the rest of the elements
-
-    // Updates the count of num by freq and the window sum accordingly.
-    auto update = [&count, &top, &bot, &windowSum](int num, int freq) -> void {
-      if (count[num] > 0) {  // Clean up the old count.
-        if (auto it = bot.find({count[num], num}); it != bot.end()) {
-          bot.erase(it);
-        } else {
-          it = top.find({count[num], num});
-          top.erase(it);
-          windowSum -= static_cast<long>(num) * count[num];
-        }
-      }
-      count[num] += freq;
-      if (count[num] > 0)
-        bot.insert({count[num], num});
-    };
-
-    for (int i = 0; i < nums.size(); ++i) {
-      update(nums[i], 1);
-      if (i >= k)
-        update(nums[i - k], -1);
-      // Move the bottom elements to the top if needed.
-      while (!bot.empty() && top.size() < x) {
-        const auto [countB, b] = *bot.rbegin();
-        bot.erase(--bot.end());
-        top.insert({countB, b});
-        windowSum += static_cast<long>(b) * countB;
-      }
-      // Swap the bottom and top elements if needed.
-      while (!bot.empty() && *bot.rbegin() > *top.begin()) {
-        const auto [countB, b] = *bot.rbegin();
-        const auto [countT, t] = *top.begin();
-        bot.erase(--bot.end());
-        top.erase(top.begin());
-        bot.insert({countT, t});
-        top.insert({countB, b});
-        windowSum += static_cast<long>(b) * countB;
-        windowSum -= static_cast<long>(t) * countT;
-      }
-      if (i >= k - 1)
-        ans.push_back(windowSum);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3321. Find X-Sum of All K-Long Subarrays II/3321.java b/solutions/3321. Find X-Sum of All K-Long Subarrays II/3321.java
deleted file mode 100644
index f32a86d1cec..00000000000
--- a/solutions/3321. Find X-Sum of All K-Long Subarrays II/3321.java	
+++ /dev/null
@@ -1,58 +0,0 @@
-class Solution {
-  // Same as 3318. Find X-Sum of All K-Long Subarrays I
-  public long[] findXSum(int[] nums, int k, int x) {
-    long[] ans = new long[nums.length - k + 1];
-    Map<Integer, Integer> count = new HashMap<>();
-    TreeSet<Pair<Integer, Integer>> top =
-        new TreeSet<>(Comparator.comparingInt(Pair<Integer, Integer>::getKey)
-                          .thenComparingInt(Pair<Integer, Integer>::getValue));
-    TreeSet<Pair<Integer, Integer>> bot =
-        new TreeSet<>(Comparator.comparingInt(Pair<Integer, Integer>::getKey)
-                          .thenComparingInt(Pair<Integer, Integer>::getValue));
-
-    for (int i = 0; i < nums.length; ++i) {
-      update(nums[i], 1, count, top, bot);
-      if (i >= k)
-        update(nums[i - k], -1, count, top, bot);
-      // Move the bottom elements to the top if needed.
-      while (!bot.isEmpty() && top.size() < x) {
-        Pair<Integer, Integer> pair = bot.pollLast();
-        top.add(pair);
-        windowSum += (long) pair.getValue() * pair.getKey();
-      }
-      // Swap the bottom and top elements if needed.
-      while (!bot.isEmpty() && (bot.last().getKey() > top.first().getKey() ||
-                                bot.last().getKey().equals(top.first().getKey()) &&
-                                    bot.last().getValue() > top.first().getValue())) {
-        Pair<Integer, Integer> pairB = bot.pollLast();
-        Pair<Integer, Integer> pairT = top.pollFirst();
-        top.add(pairB);
-        bot.add(pairT);
-        windowSum += (long) pairB.getValue() * pairB.getKey();
-        windowSum -= (long) pairT.getValue() * pairT.getKey();
-      }
-      if (i >= k - 1)
-        ans[i - k + 1] = windowSum;
-    }
-    return ans;
-  }
-
-  private long windowSum = 0;
-
-  // Updates the count of num by freq and the window sum accordingly.
-  private void update(int num, int freq, Map<Integer, Integer> count,
-                      TreeSet<Pair<Integer, Integer>> top, TreeSet<Pair<Integer, Integer>> bot) {
-    if (count.getOrDefault(num, 0) > 0) { // Clean up the old count.
-      Pair<Integer, Integer> pair = new Pair<>(count.get(num), num);
-      if (bot.remove(pair)) {
-        // Do nothing.
-      } else {
-        top.remove(pair);
-        windowSum -= (long) num * count.get(num);
-      }
-    }
-    count.merge(num, freq, Integer::sum);
-    if (count.get(num) > 0)
-      bot.add(new Pair<>(count.get(num), num));
-  }
-}
diff --git a/solutions/3321. Find X-Sum of All K-Long Subarrays II/3321.py b/solutions/3321. Find X-Sum of All K-Long Subarrays II/3321.py
deleted file mode 100644
index 5c1d65b05aa..00000000000
--- a/solutions/3321. Find X-Sum of All K-Long Subarrays II/3321.py	
+++ /dev/null
@@ -1,46 +0,0 @@
-from sortedcontainers import SortedList
-
-
-class Solution:
-  # Same as 3318. Find X-Sum of All K-Long Subarrays I
-  def findXSum(self, nums: list[int], k: int, x: int) -> list[int]:
-    ans = []
-    windowSum = 0
-    count = collections.Counter()
-    top = SortedList()  # the top x elements
-    bot = SortedList()  # the rest of the elements
-
-    def update(num: int, freq: int) -> None:
-      """Updates the count of num by freq and the window sum accordingly."""
-      nonlocal windowSum
-      if count[num] > 0:  # Clean up the old count.
-        if [count[num], num] in bot:
-          bot.remove([count[num], num])
-        else:
-          top.remove([count[num], num])
-          windowSum -= num * count[num]
-      count[num] += freq
-      if count[num] > 0:
-        bot.add([count[num], num])
-
-    for i, num in enumerate(nums):
-      update(num, 1)
-      if i >= k:
-        update(nums[i - k], -1)
-      # Move the bottom elements to the top if needed.
-      while bot and len(top) < x:
-        countB, b = bot.pop()
-        top.add([countB, b])
-        windowSum += b * countB
-      # Swap the bottom and top elements if needed.
-      while bot and bot[-1] > top[0]:
-        countB, b = bot.pop()
-        countT, t = top.pop(0)
-        bot.add([countT, t])
-        top.add([countB, b])
-        windowSum += b * countB
-        windowSum -= t * countT
-      if i >= k - 1:
-        ans.append(windowSum)
-
-    return ans
diff --git a/solutions/3322. Premier League Table Ranking III/3322.sql b/solutions/3322. Premier League Table Ranking III/3322.sql
deleted file mode 100644
index e58c708d173..00000000000
--- a/solutions/3322. Premier League Table Ranking III/3322.sql	
+++ /dev/null
@@ -1,21 +0,0 @@
-WITH
-  TeamPoints AS (
-    SELECT
-      season_id,
-      team_id,
-      team_name,
-      wins * 3 + draws AS points,
-      goals_for - goals_against AS goal_difference
-    FROM SeasonStats
-  ),
-  RankedTeams AS (
-    SELECT
-      *,
-      RANK() OVER(
-        PARTITION BY season_id
-        ORDER BY points DESC, goal_difference DESC, team_name
-      ) AS position
-    FROM TeamPoints
-  )
-SELECT * FROM RankedTeams
-ORDER BY season_id, position, team_name;
diff --git a/solutions/3323. Minimize Connected Groups by Inserting Interval/3323.cpp b/solutions/3323. Minimize Connected Groups by Inserting Interval/3323.cpp
deleted file mode 100644
index 4130380b1a4..00000000000
--- a/solutions/3323. Minimize Connected Groups by Inserting Interval/3323.cpp	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution {
- public:
-  int minConnectedGroups(vector<vector<int>>& intervals, int k) {
-    int mergedIntervals = 0;
-    int maxMergedIntervals = 0;
-
-    intervals = merge(intervals);
-
-    int i = 0;
-    for (const vector<int>& interval : intervals) {
-      const int end = interval[1];
-      while (i < intervals.size() && end + k >= intervals[i][0]) {
-        ++mergedIntervals;
-        ++i;
-      }
-      --mergedIntervals;  // Exclude intervals[i].
-      maxMergedIntervals = max(maxMergedIntervals, mergedIntervals);
-    }
-
-    return intervals.size() - maxMergedIntervals;
-  }
-
- private:
-  // Same as 56. Merge Intervals
-  vector<vector<int>> merge(vector<vector<int>>& intervals) {
-    vector<vector<int>> res;
-    ranges::sort(intervals);
-    for (const vector<int>& interval : intervals)
-      if (res.empty() || res.back()[1] < interval[0])
-        res.push_back(interval);
-      else
-        res.back()[1] = max(res.back()[1], interval[1]);
-    return res;
-  }
-};
diff --git a/solutions/3323. Minimize Connected Groups by Inserting Interval/3323.java b/solutions/3323. Minimize Connected Groups by Inserting Interval/3323.java
deleted file mode 100644
index 231dd974926..00000000000
--- a/solutions/3323. Minimize Connected Groups by Inserting Interval/3323.java	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution {
-  public int minConnectedGroups(int[][] intervals, int k) {
-    int mergedIntervals = 0;
-    int maxMergedIntervals = 0;
-
-    intervals = merge(intervals);
-
-    int i = 0;
-    for (int[] interval : intervals) {
-      final int end = interval[1];
-      while (i < intervals.length && end + k >= intervals[i][0]) {
-        ++mergedIntervals;
-        ++i;
-      }
-      --mergedIntervals; // Exclude intervals[i].
-      maxMergedIntervals = Math.max(maxMergedIntervals, mergedIntervals);
-    }
-
-    return intervals.length - maxMergedIntervals;
-  }
-
-  // Same as 56. Merge Intervals
-  public int[][] merge(int[][] intervals) {
-    List<int[]> res = new ArrayList<>();
-    Arrays.sort(intervals, Comparator.comparingInt((int[] interval) -> interval[0]));
-    for (int[] interval : intervals)
-      if (res.isEmpty() || res.get(res.size() - 1)[1] < interval[0])
-        res.add(interval);
-      else
-        res.get(res.size() - 1)[1] = Math.max(res.get(res.size() - 1)[1], interval[1]);
-    return res.toArray(int[][] ::new);
-  }
-}
diff --git a/solutions/3323. Minimize Connected Groups by Inserting Interval/3323.py b/solutions/3323. Minimize Connected Groups by Inserting Interval/3323.py
deleted file mode 100644
index 64e4880ed7b..00000000000
--- a/solutions/3323. Minimize Connected Groups by Inserting Interval/3323.py	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution:
-  def minConnectedGroups(self, intervals: list[list[int]], k: int) -> int:
-    mergedIntervals = 0
-    maxMergedIntervals = 0
-
-    intervals = self._merge(intervals)
-
-    i = 0
-    for _, end in intervals:
-      while i < len(intervals) and end + k >= intervals[i][0]:
-        mergedIntervals += 1
-        i += 1
-      mergedIntervals -= 1  # Exclude intervals[i].
-      maxMergedIntervals = max(maxMergedIntervals, mergedIntervals)
-
-    return len(intervals) - maxMergedIntervals
-
-  # Same as 56. Merge Intervals
-  def _merge(self, intervals: list[list[int]]) -> list[list[int]]:
-    res = []
-    for interval in sorted(intervals):
-      if not res or res[-1][1] < interval[0]:
-        res.append(interval)
-      else:
-        res[-1][1] = max(res[-1][1], interval[1])
-    return res
diff --git a/solutions/3324. Find the Sequence of Strings Appeared on the Screen/3324.cpp b/solutions/3324. Find the Sequence of Strings Appeared on the Screen/3324.cpp
deleted file mode 100644
index 1f624120c0c..00000000000
--- a/solutions/3324. Find the Sequence of Strings Appeared on the Screen/3324.cpp	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
- public:
-  vector<string> stringSequence(string target) {
-    vector<string> ans;
-    string s;
-
-    for (const char targetChar : target) {
-      s += 'a';
-      ans.push_back(s);
-      for (char c = 'b'; c <= targetChar; c++) {
-        s.back() = c;
-        ans.push_back(s);
-      }
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3324. Find the Sequence of Strings Appeared on the Screen/3324.java b/solutions/3324. Find the Sequence of Strings Appeared on the Screen/3324.java
deleted file mode 100644
index 557b35b2415..00000000000
--- a/solutions/3324. Find the Sequence of Strings Appeared on the Screen/3324.java	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
-  public List<String> stringSequence(String target) {
-    List<String> ans = new ArrayList<>();
-    StringBuilder sb = new StringBuilder();
-
-    for (final char targetChar : target.toCharArray()) {
-      sb.append('a');
-      ans.add(sb.toString());
-      for (char c = 'b'; c < targetChar; ++c) {
-        sb.setCharAt(sb.length() - 1, c);
-        ans.add(sb.toString());
-      }
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3324. Find the Sequence of Strings Appeared on the Screen/3324.py b/solutions/3324. Find the Sequence of Strings Appeared on the Screen/3324.py
deleted file mode 100644
index f09f598263c..00000000000
--- a/solutions/3324. Find the Sequence of Strings Appeared on the Screen/3324.py	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution:
-  def stringSequence(self, target: str) -> list[str]:
-    ans = []
-    s = []
-
-    for targetChar in target:
-      s.append('a')
-      ans.append(''.join(s))
-      for offset in range(ord('b'), ord(targetChar) + 1):
-        s[-1] = chr(offset)
-        ans.append(''.join(s))
-
-    return ans
diff --git a/solutions/3325. Count Substrings With K-Frequency Characters I/3325.cpp b/solutions/3325. Count Substrings With K-Frequency Characters I/3325.cpp
deleted file mode 100644
index 570b1b19dce..00000000000
--- a/solutions/3325. Count Substrings With K-Frequency Characters I/3325.cpp	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
- public:
-  int numberOfSubstrings(string s, int k) {
-    const int n = s.length();
-    int ans = n * (n + 1) / 2;
-    vector<int> count(26);
-
-    for (int l = 0, r = 0; r < n; ++r) {
-      const int c = s[r];
-      ++count[c - 'a'];
-      while (count[c - 'a'] == k)
-        --count[s[l++] - 'a'];
-      ans -= r - l + 1;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3325. Count Substrings With K-Frequency Characters I/3325.java b/solutions/3325. Count Substrings With K-Frequency Characters I/3325.java
deleted file mode 100644
index 3113aebe92c..00000000000
--- a/solutions/3325. Count Substrings With K-Frequency Characters I/3325.java	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
-  public int numberOfSubstrings(String s, int k) {
-    final int n = s.length();
-    int ans = n * (n + 1) / 2;
-    int[] count = new int[26];
-
-    for (int l = 0, r = 0; r < n; ++r) {
-      final int c = s.charAt(r) - 'a';
-      ++count[c];
-      while (count[c] == k)
-        --count[s.charAt(l++) - 'a'];
-      ans -= r - l + 1;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3325. Count Substrings With K-Frequency Characters I/3325.py b/solutions/3325. Count Substrings With K-Frequency Characters I/3325.py
deleted file mode 100644
index 13184d9b953..00000000000
--- a/solutions/3325. Count Substrings With K-Frequency Characters I/3325.py	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution:
-  def numberOfSubstrings(self, s: str, k: int) -> int:
-    n = len(s)
-    ans = n * (n + 1) // 2
-    count = collections.Counter()
-
-    l = 0
-    for r, c in enumerate(s):
-      count[c] += 1
-      while count[c] == k:
-        count[s[l]] -= 1
-        l += 1
-      ans -= r - l + 1
-
-    return ans
diff --git a/solutions/3326. Minimum Division Operations to Make Array Non Decreasing/3326.cpp b/solutions/3326. Minimum Division Operations to Make Array Non Decreasing/3326.cpp
deleted file mode 100644
index 29b6403fd8a..00000000000
--- a/solutions/3326. Minimum Division Operations to Make Array Non Decreasing/3326.cpp	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
- public:
-  int minOperations(vector<int>& nums) {
-    int ans = 0;
-
-    for (int i = nums.size() - 2; i >= 0; --i)
-      if (nums[i] > nums[i + 1]) {
-        const int minDivisor = getMinDivisor(nums[i]);
-        if (minDivisor > nums[i + 1])
-          return -1;
-        nums[i] = minDivisor;
-        ++ans;
-      }
-
-    return ans;
-  }
-
- private:
-  int getMinDivisor(int num) {
-    for (int divisor = 2; divisor <= sqrt(num); ++divisor)
-      if (num % divisor == 0)
-        return divisor;
-    return num;
-  }
-};
diff --git a/solutions/3326. Minimum Division Operations to Make Array Non Decreasing/3326.java b/solutions/3326. Minimum Division Operations to Make Array Non Decreasing/3326.java
deleted file mode 100644
index 43575ec7958..00000000000
--- a/solutions/3326. Minimum Division Operations to Make Array Non Decreasing/3326.java	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
-  public int minOperations(int[] nums) {
-    int ans = 0;
-
-    for (int i = nums.length - 2; i >= 0; --i)
-      if (nums[i] > nums[i + 1]) {
-        final int minDivisor = getMinDivisor(nums[i]);
-        if (minDivisor > nums[i + 1])
-          return -1;
-        nums[i] = minDivisor;
-        ++ans;
-      }
-
-    return ans;
-  }
-
-  private int getMinDivisor(int num) {
-    for (int divisor = 2; divisor <= Math.sqrt(num); ++divisor)
-      if (num % divisor == 0)
-        return divisor;
-    return num;
-  }
-}
diff --git a/solutions/3326. Minimum Division Operations to Make Array Non Decreasing/3326.py b/solutions/3326. Minimum Division Operations to Make Array Non Decreasing/3326.py
deleted file mode 100644
index 996a4a83338..00000000000
--- a/solutions/3326. Minimum Division Operations to Make Array Non Decreasing/3326.py	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution:
-  def minOperations(self, nums: list[int]) -> int:
-    ans = 0
-
-    for i in range(len(nums) - 2, -1, -1):
-      if nums[i] > nums[i + 1]:
-        minDivisor = self._getMinDivisor(nums[i])
-        if minDivisor > nums[i + 1]:
-          return -1
-        nums[i] = minDivisor
-        ans += 1
-
-    return ans
-
-  def _getMinDivisor(self, num: int) -> int:
-    for divisor in range(2, math.isqrt(num) + 1):
-      if num % divisor == 0:
-        return divisor
-    return num
diff --git a/solutions/3327. Check if DFS Strings Are Palindromes/3327.cpp b/solutions/3327. Check if DFS Strings Are Palindromes/3327.cpp
deleted file mode 100644
index 4ed65ca8dcd..00000000000
--- a/solutions/3327. Check if DFS Strings Are Palindromes/3327.cpp	
+++ /dev/null
@@ -1,80 +0,0 @@
-class Solution {
- public:
-  vector<bool> findAnswer(vector<int>& parent, string s) {
-    const int n = parent.size();
-    vector<bool> ans(n);
-    vector<vector<int>> tree(n);
-    vector<int> start(n);  // start[i] := the start index of `dfsStr` of node i
-    vector<int> end(n);    // end[i] := the end index of `dfsStr` of node i
-    string dfsStr;
-
-    for (int i = 1; i < n; ++i)
-      tree[parent[i]].push_back(i);
-
-    dfs(tree, 0, /*index=*/0, s, start, end, dfsStr);
-    const string t = join('@' + dfsStr + '$', /*delimiter=*/'#');
-    const vector<int> p = manacher(t);
-
-    for (int i = 0; i < n; ++i)
-      ans[i] = isPalindrome(start[i], end[i], p);
-
-    return ans;
-  }
-
- private:
-  // Returns the start index of the "DFS string" of u's next node.
-  int dfs(const vector<vector<int>>& tree, int u, int index, const string& s,
-          vector<int>& start, vector<int>& end, string& dfsStr) {
-    start[u] = index;
-    for (const int v : tree[u])
-      index = dfs(tree, v, index, s, start, end, dfsStr);
-    end[u] = index;
-    dfsStr += s[u];
-    return index + 1;
-  }
-
-  // Returns an array `p` s.t. `p[i]` is the length of the longest palindrome
-  // centered at `t[i]`, where `t` is a string with delimiters and sentinels.
-  vector<int> manacher(const string& t) {
-    vector<int> p(t.length());
-    int center = 0;
-    for (int i = 1; i < t.length() - 1; ++i) {
-      const int rightBoundary = center + p[center];
-      const int mirrorIndex = center - (i - center);
-      if (rightBoundary > i)
-        p[i] = min(rightBoundary - i, p[mirrorIndex]);
-      // Try to expand the palindrome centered at i.
-      while (t[i + 1 + p[i]] == t[i - 1 - p[i]])
-        ++p[i];
-      // If a palindrome centered at i expands past `rightBoundary`, adjust
-      // the center based on the expanded palindrome.
-      if (i + p[i] > rightBoundary)
-        center = i;
-    }
-    return p;
-  }
-
-  // Returns true if `dfsStr[s..e]` is a palindrome by using the precomputed
-  // array `p` from the Manacher's algorithm.
-  //
-  // The precomputed array `p` is based on the string `t` with delimiters and
-  // sentinels. Let `t = '#'.join('@' + dfsStr + '$')`. Then, the center of
-  // `dfsStr` maps to `t[s + e + 2]` since `dfsStr[s]` maps to `t[2 * s + 2]`
-  // and `dfsStr[e]` maps to `t[2 * e + 2]`. So, the center of `dfsStr` is
-  // `t[(2 * s + 2 + 2 * e + 2) / 2] = t[s + e + 2]`.
-  bool isPalindrome(int s, int e, const vector<int>& p) {
-    const int length = e - s + 1;
-    const int center = s + e + 2;
-    return p[center] >= length;
-  }
-
-  string join(const string& s, char delimiter) {
-    string joined;
-    for (int i = 0; i < s.length() - 1; ++i) {
-      joined += s[i];
-      joined += delimiter;
-    }
-    joined += s.back();
-    return joined;
-  }
-};
diff --git a/solutions/3327. Check if DFS Strings Are Palindromes/3327.java b/solutions/3327. Check if DFS Strings Are Palindromes/3327.java
deleted file mode 100644
index 3d5ebf56514..00000000000
--- a/solutions/3327. Check if DFS Strings Are Palindromes/3327.java	
+++ /dev/null
@@ -1,86 +0,0 @@
-class Solution {
-  public boolean[] findAnswer(int[] parent, String s) {
-    final int n = parent.length;
-    boolean[] ans = new boolean[n];
-    List<Integer>[] tree = new List[n];
-    // start[i] := the start index of `dfsStr` of node i
-    int[] start = new int[n];
-    // end[i] := the end index of `dfsStr` of node i
-    int[] end = new int[n];
-
-    for (int i = 0; i < n; ++i)
-      tree[i] = new ArrayList<>();
-
-    StringBuilder dfsStr = new StringBuilder();
-
-    for (int i = 1; i < n; ++i)
-      tree[parent[i]].add(i);
-
-    dfs(tree, 0, /*index=*/0, s, start, end, dfsStr);
-    final String t = join('@' + dfsStr.toString() + '$', '#');
-    final int[] p = manacher(t);
-
-    for (int i = 0; i < n; ++i)
-      ans[i] = isPalindrome(start[i], end[i], p);
-
-    return ans;
-  }
-
-  // Returns the start index of the "DFS string" of u's next node.
-  private int dfs(List<Integer>[] tree, int u, int index, final String s, int[] start, int[] end,
-                  StringBuilder dfsStr) {
-    start[u] = index;
-    for (final int v : tree.get(u))
-      index = dfs(tree, v, index, s, start, end, dfsStr);
-    end[u] = index;
-    dfsStr.append(s.charAt(u));
-    return index + 1;
-  }
-
-  // Returns true if `dfsStr[s..e]` is a palindrome by using the precomputed
-  // array `p` from the Manacher's algorithm.
-  //
-  // The precomputed array `p` is based on the string `t` with delimiters and
-  // sentinels. Let `t = '#'.join('@' + dfsStr + '$')`. Then, the center of
-  // `dfsStr` maps to `t[s + e + 2]` since `dfsStr[s]` maps to `t[2 * s + 2]`
-  // and `dfsStr[e]` maps to `t[2 * e + 2]`. So, the center of `dfsStr` is
-  // `t[(2 * s + 2 + 2 * e + 2) / 2] = t[s + e + 2]`.
-  private boolean isPalindrome(int s, int e, int[] p) {
-    final int length = e - s + 1;
-    final int center = s + e + 2;
-    return p[center] >= length;
-  }
-
-  // Returns an array `p` s.t. `p[i]` is the length of the longest palindrome
-  // centered at `t[i]`, where `t` is a string with delimiters and sentinels.
-  private int[] manacher(final String t) {
-    int[] p = new int[t.length()];
-    int center = 0;
-    for (int i = 1; i < t.length() - 1; ++i) {
-      int rightBoundary = center + p[center];
-      int mirrorIndex = center - (i - center);
-      if (rightBoundary > i)
-        p[i] = Math.min(rightBoundary - i, p[mirrorIndex]);
-      // Try to expand the palindrome centered at i.
-      while (i + 1 + p[i] < t.length() && i - 1 - p[i] >= 0 &&
-             t.charAt(i + 1 + p[i]) == t.charAt(i - 1 - p[i]))
-        ++p[i];
-      // If a palindrome centered at i expands past `rightBoundary`, adjust
-      // the center based on the expanded palindrome.
-      if (i + p[i] > rightBoundary) {
-        center = i;
-      }
-    }
-    return p;
-  }
-
-  private String join(final String s, char delimiter) {
-    StringBuilder joined = new StringBuilder();
-    for (int i = 0; i < s.length() - 1; ++i) {
-      joined.append(s.charAt(i));
-      joined.append(delimiter);
-    }
-    joined.append(s.charAt(s.length() - 1));
-    return joined.toString();
-  }
-}
diff --git a/solutions/3327. Check if DFS Strings Are Palindromes/3327.py b/solutions/3327. Check if DFS Strings Are Palindromes/3327.py
deleted file mode 100644
index ede27501b0b..00000000000
--- a/solutions/3327. Check if DFS Strings Are Palindromes/3327.py	
+++ /dev/null
@@ -1,70 +0,0 @@
-class Solution:
-  def findAnswer(self, parent: list[int], s: str) -> list[bool]:
-    n = len(parent)
-    tree = [[] for _ in parent]
-    start = [0] * n  # start[i] := the start index of `dfsStr` of node i
-    end = [0] * n  # end[i] := the end index of `dfsStr` of node i
-    dfsStr = []
-
-    for i in range(1, n):
-      tree[parent[i]].append(i)
-
-    self._dfs(tree, 0, 0, s, start, end, dfsStr)
-    t = '#'.join('@' + ''.join(dfsStr) + '$')
-    p = self._manacher(t)
-    return [self._isPalindrome(s, e, p)
-            for s, e in zip(start, end)]
-
-  def _dfs(
-      self,
-      tree: list[list[int]],
-      u: int,
-      index: int,
-      s: str,
-      start: list[int],
-      end: list[int],
-      dfsStr: list[str]
-  ) -> int:
-    """Returns the start index of the "DFS string" of u's next node."""
-    start[u] = index
-    for v in tree[u]:
-      index = self._dfs(tree, v, index, s, start, end, dfsStr)
-    end[u] = index
-    dfsStr.append(s[u])
-    return index + 1
-
-  def _manacher(self, t: str) -> list[int]:
-    """
-    Returns an array `p` s.t. `p[i]` is the length of the longest palindrome
-    centered at `t[i]`, where `t` is a string with delimiters and sentinels.
-    """
-    p = [0] * len(t)
-    center = 0
-    for i in range(1, len(t) - 1):
-      rightBoundary = center + p[center]
-      mirrorIndex = center - (i - center)
-      if rightBoundary > i:
-        p[i] = min(rightBoundary - i, p[mirrorIndex])
-      # Try to expand the palindrome centered at i.
-      while t[i + 1 + p[i]] == t[i - 1 - p[i]]:
-        p[i] += 1
-      # If a palindrome centered at i expands past `rightBoundary`, adjust
-      # the center based on the expanded palindrome.
-      if i + p[i] > rightBoundary:
-        center = i
-    return p
-
-  def _isPalindrome(self, s: int, e: int, p: list[int]) -> bool:
-    """
-    Returns true if `dfsStr[s..e]` is a palindrome by using the precomputed
-    array `p` from the Manacher's algorithm.
-
-    The precomputed array `p` is based on the string `t` with delimiters and
-    sentinels. Let `t = '#'.join('@' + dfsStr + '$')`. Then, the center of
-    `dfsStr` maps to `t[s + e + 2]` since `dfsStr[s]` maps to `t[2 * s + 2]`
-    and `dfsStr[e]` maps to `t[2 * e + 2]`. So, the center of `dfsStr` is
-    `t[(2 * s + 2 + 2 * e + 2) / 2] = t[s + e + 2]`.
-    """
-    length = e - s + 1
-    center = s + e + 2
-    return p[center] >= length
diff --git a/solutions/3328. Find Cities in Each State II/3328.sql b/solutions/3328. Find Cities in Each State II/3328.sql
deleted file mode 100644
index f94fe04eafc..00000000000
--- a/solutions/3328. Find Cities in Each State II/3328.sql	
+++ /dev/null
@@ -1,8 +0,0 @@
-SELECT
-  state,
-  GROUP_CONCAT(city ORDER BY city SEPARATOR ', ') AS cities,
-  SUM(LEFT(city, 1) = LEFT(state, 1)) AS matching_letter_count
-FROM Cities
-GROUP BY 1
-HAVING COUNT(*) >= 3 AND matching_letter_count > 0
-ORDER BY matching_letter_count DESC, state;
diff --git a/solutions/3329. Count Substrings With K-Frequency Characters II/3329.cpp b/solutions/3329. Count Substrings With K-Frequency Characters II/3329.cpp
deleted file mode 100644
index dc1efddfaa0..00000000000
--- a/solutions/3329. Count Substrings With K-Frequency Characters II/3329.cpp	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
- public:
-  long long numberOfSubstrings(string s, int k) {
-    const int n = s.length();
-    long ans = n * static_cast<long>(n + 1) / 2;
-    vector<int> count(26);
-
-    for (int l = 0, r = 0; r < n; ++r) {
-      const int c = s[r];
-      ++count[c - 'a'];
-      while (count[c - 'a'] == k)
-        --count[s[l++] - 'a'];
-      ans -= r - l + 1;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3329. Count Substrings With K-Frequency Characters II/3329.java b/solutions/3329. Count Substrings With K-Frequency Characters II/3329.java
deleted file mode 100644
index a83eaa8bb7f..00000000000
--- a/solutions/3329. Count Substrings With K-Frequency Characters II/3329.java	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
-  public long numberOfSubstrings(String s, int k) {
-    final int n = s.length();
-    long ans = n * (long) (n + 1) / 2;
-    int[] count = new int[26];
-
-    for (int l = 0, r = 0; r < n; ++r) {
-      final int c = s.charAt(r) - 'a';
-      ++count[c];
-      while (count[c] == k)
-        --count[s.charAt(l++) - 'a'];
-      ans -= r - l + 1;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3329. Count Substrings With K-Frequency Characters II/3329.py b/solutions/3329. Count Substrings With K-Frequency Characters II/3329.py
deleted file mode 100644
index 13184d9b953..00000000000
--- a/solutions/3329. Count Substrings With K-Frequency Characters II/3329.py	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution:
-  def numberOfSubstrings(self, s: str, k: int) -> int:
-    n = len(s)
-    ans = n * (n + 1) // 2
-    count = collections.Counter()
-
-    l = 0
-    for r, c in enumerate(s):
-      count[c] += 1
-      while count[c] == k:
-        count[s[l]] -= 1
-        l += 1
-      ans -= r - l + 1
-
-    return ans
diff --git a/solutions/333. Largest BST Subtree/333.py b/solutions/333. Largest BST Subtree/333.py
index 8f74074377b..083ad8c0eed 100644
--- a/solutions/333. Largest BST Subtree/333.py	
+++ b/solutions/333. Largest BST Subtree/333.py	
@@ -9,8 +9,8 @@ class T:
 
 
 class Solution:
-  def largestBSTSubtree(self, root: TreeNode | None) -> int:
-    def dfs(root: TreeNode | None) -> T:
+  def largestBSTSubtree(self, root: Optional[TreeNode]) -> int:
+    def dfs(root: Optional[TreeNode]) -> T:
       if not root:
         return T(math.inf, -math.inf, 0)
 
diff --git a/solutions/3330. Find the Original Typed String I/3330.cpp b/solutions/3330. Find the Original Typed String I/3330.cpp
deleted file mode 100644
index a41b763dd34..00000000000
--- a/solutions/3330. Find the Original Typed String I/3330.cpp	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution {
- public:
-  int possibleStringCount(string word) {
-    int ans = 1;
-    for (int i = 1; i < word.length(); ++i)
-      if (word[i] == word[i - 1])
-        ++ans;
-    return ans;
-  }
-};
diff --git a/solutions/3330. Find the Original Typed String I/3330.java b/solutions/3330. Find the Original Typed String I/3330.java
deleted file mode 100644
index 88b5602794f..00000000000
--- a/solutions/3330. Find the Original Typed String I/3330.java	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution {
-  public int possibleStringCount(String word) {
-    int ans = 1;
-    for (int i = 1; i < word.length(); ++i)
-      if (word.charAt(i) == word.charAt(i - 1))
-        ++ans;
-    return ans;
-  }
-}
diff --git a/solutions/3330. Find the Original Typed String I/3330.py b/solutions/3330. Find the Original Typed String I/3330.py
deleted file mode 100644
index 67386f6c4b9..00000000000
--- a/solutions/3330. Find the Original Typed String I/3330.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def possibleStringCount(self, word: str) -> int:
-    return 1 + sum(a == b
-                   for a, b in itertools.pairwise(word))
diff --git a/solutions/3331. Find Subtree Sizes After Changes/3331.cpp b/solutions/3331. Find Subtree Sizes After Changes/3331.cpp
deleted file mode 100644
index 22568422f36..00000000000
--- a/solutions/3331. Find Subtree Sizes After Changes/3331.cpp	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution {
- public:
-  vector<int> findSubtreeSizes(vector<int>& parent, string s) {
-    const int n = parent.size();
-    vector<int> ans(n);
-    vector<int> newParent = parent;
-    vector<vector<int>> tree(n);
-
-    for (int i = 1; i < n; ++i) {
-      const int closest = findClosestAncestor(i, parent, s);
-      if (closest != -1)
-        newParent[i] = closest;
-    }
-
-    for (int i = 1; i < n; ++i)
-      tree[newParent[i]].push_back(i);
-
-    dfs(tree, 0, ans);
-    return ans;
-  }
-
- private:
-  // Returns the closest ancestor of node `u` that has the same value as `u`.
-  int findClosestAncestor(int u, const vector<int>& parent, const string& s) {
-    for (int curr = parent[u]; curr != -1; curr = parent[curr])
-      if (s[curr] == s[u])
-        return curr;
-    return -1;
-  }
-
-  int dfs(const vector<vector<int>>& tree, int u, vector<int>& ans) {
-    int sz = 1;
-    for (const int v : tree[u])
-      sz += dfs(tree, v, ans);
-    return ans[u] = sz;
-  }
-};
diff --git a/solutions/3331. Find Subtree Sizes After Changes/3331.java b/solutions/3331. Find Subtree Sizes After Changes/3331.java
deleted file mode 100644
index b900e652cb1..00000000000
--- a/solutions/3331. Find Subtree Sizes After Changes/3331.java	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
-  public int[] findSubtreeSizes(int[] parent, String s) {
-    final int n = parent.length;
-    int[] ans = new int[n];
-    int[] newParent = parent.clone();
-    List<Integer>[] tree = new ArrayList[n];
-
-    for (int i = 0; i < n; ++i)
-      tree[i] = new ArrayList<>();
-
-    for (int i = 1; i < n; ++i) {
-      final int closest = findClosestAncestor(i, parent, s);
-      if (closest != -1)
-        newParent[i] = closest;
-    }
-
-    for (int i = 1; i < n; ++i)
-      tree[newParent[i]].add(i);
-
-    dfs(tree, 0, ans);
-    return ans;
-  }
-
-  // Returns the closest ancestor of node `u` that has the same value as `u`.
-  private int findClosestAncestor(int u, int[] parent, String s) {
-    for (int curr = parent[u]; curr != -1; curr = parent[curr])
-      if (s.charAt(curr) == s.charAt(u))
-        return curr;
-    return -1;
-  }
-
-  private int dfs(List<Integer>[] tree, int u, int[] ans) {
-    int sz = 1;
-    for (final int v : tree[u])
-      sz += dfs(tree, v, ans);
-    return ans[u] = sz;
-  }
-}
diff --git a/solutions/3331. Find Subtree Sizes After Changes/3331.py b/solutions/3331. Find Subtree Sizes After Changes/3331.py
deleted file mode 100644
index 3e3c1512ede..00000000000
--- a/solutions/3331. Find Subtree Sizes After Changes/3331.py	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution:
-  def findSubtreeSizes(self, parent: list[int], s: str) -> list[int]:
-    n = len(parent)
-    ans = [0] * n
-    newParent = parent.copy()
-    tree = [[] for _ in range(n)]
-
-    for i in range(1, n):
-      closest = self._findClosestAncestor(i, parent, s)
-      if closest != -1:
-        newParent[i] = closest
-
-    for i in range(1, n):
-      tree[newParent[i]].append(i)
-
-    self._dfs(tree, 0, ans)
-    return ans
-
-  def _findClosestAncestor(self, u: int, parent: list[int], s: str) -> int:
-    """
-    Returns the closest ancestor of node `u` that has the same value as `u`.
-    """
-    curr = parent[u]
-    while curr != -1:
-      if s[curr] == s[u]:
-        return curr
-      curr = parent[curr]
-    return -1
-
-  def _dfs(self, tree: list[list[int]], u: int, ans: list[int]) -> int:
-    sz = 1
-    for v in tree[u]:
-      sz += self._dfs(tree, v, ans)
-    ans[u] = sz
-    return sz
diff --git a/solutions/3332. Maximum Points Tourist Can Earn/3332-2.cpp b/solutions/3332. Maximum Points Tourist Can Earn/3332-2.cpp
deleted file mode 100644
index 9e8ee6cb5de..00000000000
--- a/solutions/3332. Maximum Points Tourist Can Earn/3332-2.cpp	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
- public:
-  int maxScore(int n, int k, vector<vector<int>>& stayScore,
-               vector<vector<int>>& travelScore) {
-    // dp[j] := the maximum score after days so far being at city j
-    vector<int> dp(n);
-
-    for (int i = 0; i < k; ++i) {
-      vector<int> newDp(n);
-      for (int dest = 0; dest < n; ++dest) {
-        // 1. Stay at the current city.
-        newDp[dest] = dp[dest] + stayScore[i][dest];
-        // 2. Travel from any other city.
-        for (int curr = 0; curr < n; ++curr)
-          if (curr != dest)
-            newDp[dest] = max(newDp[dest], dp[curr] + travelScore[curr][dest]);
-      }
-      dp = std::move(newDp);
-    }
-
-    return ranges::max(dp);
-  }
-};
diff --git a/solutions/3332. Maximum Points Tourist Can Earn/3332-2.java b/solutions/3332. Maximum Points Tourist Can Earn/3332-2.java
deleted file mode 100644
index f45f1f94140..00000000000
--- a/solutions/3332. Maximum Points Tourist Can Earn/3332-2.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public int maxScore(int n, int k, int[][] stayScore, int[][] travelScore) {
-    // dp[j] := the maximum score after days so far being at city j
-    int[] dp = new int[n];
-
-    for (int i = 0; i < k; ++i) {
-      int[] newDp = new int[n];
-      for (int dest = 0; dest < n; ++dest) {
-        // 1. Stay at the current city.
-        newDp[dest] = dp[dest] + stayScore[i][dest];
-        // 2. Travel from any other city.
-        for (int curr = 0; curr < n; ++curr)
-          if (curr != dest)
-            newDp[dest] = Math.max(newDp[dest], dp[curr] + travelScore[curr][dest]);
-      }
-      dp = newDp; // Update dp for the next day
-    }
-
-    return Arrays.stream(dp).max().getAsInt();
-  }
-}
diff --git a/solutions/3332. Maximum Points Tourist Can Earn/3332-2.py b/solutions/3332. Maximum Points Tourist Can Earn/3332-2.py
deleted file mode 100644
index eec2dd9ed96..00000000000
--- a/solutions/3332. Maximum Points Tourist Can Earn/3332-2.py	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution:
-  def maxScore(
-      self,
-      n: int,
-      k: int,
-      stayScore: list[list[int]],
-      travelScore: list[list[int]]
-  ) -> int:
-    # dp[j] := the maximum score after days so far being at city j
-    dp = [0] * n
-
-    for i in range(k):
-      newDp = [0] * n
-      for dest in range(n):
-        # 1. Stay at the current city.
-        newDp[dest] = dp[dest] + stayScore[i][dest]
-        # 2. Travel from any other city.
-        for curr in range(n):
-          if curr != dest:
-            newDp[dest] = max(newDp[dest],
-                              dp[curr] + travelScore[curr][dest])
-      dp = newDp
-
-    return max(dp)
diff --git a/solutions/3332. Maximum Points Tourist Can Earn/3332.cpp b/solutions/3332. Maximum Points Tourist Can Earn/3332.cpp
deleted file mode 100644
index aa9b7d4d803..00000000000
--- a/solutions/3332. Maximum Points Tourist Can Earn/3332.cpp	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
- public:
-  int maxScore(int n, int k, vector<vector<int>>& stayScore,
-               vector<vector<int>>& travelScore) {
-    // dp[i][j] := the maximum score after i days being at city j
-    vector<vector<int>> dp(k + 1, vector<int>(n));
-
-    for (int i = 1; i <= k; ++i)
-      for (int dest = 0; dest < n; ++dest) {
-        // 1. Stay at the current city.
-        dp[i][dest] = dp[i - 1][dest] + stayScore[i - 1][dest];
-        // 2. Travel from any other city.
-        for (int curr = 0; curr < n; ++curr)
-          if (curr != dest)
-            dp[i][dest] =
-                max(dp[i][dest], dp[i - 1][curr] + travelScore[curr][dest]);
-      }
-
-    return ranges::max(dp[k]);
-  }
-};
diff --git a/solutions/3332. Maximum Points Tourist Can Earn/3332.java b/solutions/3332. Maximum Points Tourist Can Earn/3332.java
deleted file mode 100644
index c5a251fa1d4..00000000000
--- a/solutions/3332. Maximum Points Tourist Can Earn/3332.java	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
-  public int maxScore(int n, int k, int[][] stayScore, int[][] travelScore) {
-    // dp[i][j] := the maximum score after i days being at city j
-    int[][] dp = new int[k + 1][n];
-
-    for (int i = 1; i <= k; ++i) {
-      for (int dest = 0; dest < n; ++dest) {
-        // 1. Stay at the current city.
-        dp[i][dest] = dp[i - 1][dest] + stayScore[i - 1][dest];
-        // 2. Travel from any other city.
-        for (int curr = 0; curr < n; ++curr)
-          if (curr != dest)
-            dp[i][dest] = Math.max(dp[i][dest], dp[i - 1][curr] + travelScore[curr][dest]);
-      }
-    }
-
-    return Arrays.stream(dp[k]).max().getAsInt();
-  }
-}
diff --git a/solutions/3332. Maximum Points Tourist Can Earn/3332.py b/solutions/3332. Maximum Points Tourist Can Earn/3332.py
deleted file mode 100644
index 426f4dd5371..00000000000
--- a/solutions/3332. Maximum Points Tourist Can Earn/3332.py	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution:
-  def maxScore(
-      self,
-      n: int,
-      k: int,
-      stayScore: list[list[int]],
-      travelScore: list[list[int]]
-  ) -> int:
-    # dp[i][j] := the maximum score after i days being at city j
-    dp = [[0] * n for _ in range(k + 1)]
-
-    for i in range(1, k + 1):
-      for dest in range(n):
-        # 1. Stay at the current city.
-        dp[i][dest] = dp[i - 1][dest] + stayScore[i - 1][dest]
-        # 2. Travel from any other city.
-        for curr in range(n):
-          if curr != dest:
-            dp[i][dest] = max(dp[i][dest],
-                              dp[i - 1][curr] + travelScore[curr][dest])
-
-    return max(dp[k])
diff --git a/solutions/3333. Find the Original Typed String II/3333.cpp b/solutions/3333. Find the Original Typed String II/3333.cpp
deleted file mode 100644
index 86d55630e76..00000000000
--- a/solutions/3333. Find the Original Typed String II/3333.cpp	
+++ /dev/null
@@ -1,53 +0,0 @@
-class Solution {
- public:
-  int possibleStringCount(string word, int k) {
-    const vector<int> groups = getConsecutiveLetters(word);
-    const int totalCombinations =
-        accumulate(groups.begin(), groups.end(), 1L,
-                   [](long acc, int group) { return acc * group % kMod; });
-    if (k <= groups.size())
-      return totalCombinations;
-
-    // dp[j] := the number of ways to form strings of length j using
-    // groups[0..i]
-    vector<int> dp(k);
-    dp[0] = 1;  // Base case: empty string
-
-    for (int i = 0; i < groups.size(); ++i) {
-      vector<int> newDp(k);
-      int windowSum = 0;
-      int group = groups[i];
-      for (int j = i; j < k; ++j) {
-        newDp[j] = (newDp[j] + windowSum) % kMod;
-        windowSum = (windowSum + dp[j]) % kMod;
-        if (j >= group)
-          windowSum = (windowSum - dp[j - group] + kMod) % kMod;
-      }
-      dp = std::move(newDp);
-    }
-
-    const int invalidCombinations =
-        accumulate(dp.begin(), dp.end(), 0,
-                   [](int acc, int count) { return (acc + count) % kMod; });
-    return (totalCombinations - invalidCombinations + kMod) % kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Returns consecutive identical letters in the input string.
-  // e.g. "aabbbc" -> [2, 3, 1].
-  vector<int> getConsecutiveLetters(const string& word) {
-    vector<int> groups;
-    int group = 1;
-    for (int i = 1; i < word.length(); ++i)
-      if (word[i] == word[i - 1]) {
-        ++group;
-      } else {
-        groups.push_back(group);
-        group = 1;
-      }
-    groups.push_back(group);
-    return groups;
-  }
-};
diff --git a/solutions/3333. Find the Original Typed String II/3333.java b/solutions/3333. Find the Original Typed String II/3333.java
deleted file mode 100644
index 4f3e035b2b4..00000000000
--- a/solutions/3333. Find the Original Typed String II/3333.java	
+++ /dev/null
@@ -1,48 +0,0 @@
-class Solution {
-  public int possibleStringCount(String word, int k) {
-    List<Integer> groups = getConsecutiveLetters(word);
-    final int totalCombinations =
-        (int) groups.stream().mapToLong(Integer::longValue).reduce(1L, (a, b) -> a * b % MOD);
-    if (k <= groups.size())
-      return totalCombinations;
-
-    // dp[j] := the number of ways to form strings of length j using
-    // groups[0..i]
-    int[] dp = new int[k];
-    dp[0] = 1; // Base case: empty string
-
-    for (int i = 0; i < groups.size(); ++i) {
-      int[] newDp = new int[k];
-      int windowSum = 0;
-      int group = groups.get(i);
-      for (int j = i; j < k; ++j) {
-        newDp[j] = (newDp[j] + windowSum) % MOD;
-        windowSum = (windowSum + dp[j]) % MOD;
-        if (j >= group)
-          windowSum = (windowSum - dp[j - group] + MOD) % MOD;
-      }
-      dp = newDp;
-    }
-
-    final int invalidCombinations = Arrays.stream(dp).reduce(0, (a, b) -> (a + b) % MOD);
-    return (totalCombinations - invalidCombinations + MOD) % MOD;
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  // Returns consecutive identical letters in the input string.
-  // e.g. "aabbbc" -> [2, 3, 1].
-  private List<Integer> getConsecutiveLetters(final String word) {
-    List<Integer> groups = new ArrayList<>();
-    int group = 1;
-    for (int i = 1; i < word.length(); ++i)
-      if (word.charAt(i) == word.charAt(i - 1)) {
-        ++group;
-      } else {
-        groups.add(group);
-        group = 1;
-      }
-    groups.add(group);
-    return groups;
-  }
-}
diff --git a/solutions/3333. Find the Original Typed String II/3333.py b/solutions/3333. Find the Original Typed String II/3333.py
deleted file mode 100644
index 8cfb21a9fd8..00000000000
--- a/solutions/3333. Find the Original Typed String II/3333.py	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution:
-  def possibleStringCount(self, word: str, k: int) -> int:
-    MOD = 1_000_000_007
-    groups = self._getConsecutiveLetters(word)
-    totalCombinations = functools.reduce(lambda subtotal, group:
-                                         subtotal * group % MOD, groups)
-    if k <= len(groups):
-      return totalCombinations
-
-    # dp[j] := the number of ways to form strings of length j using groups[0..i]
-    dp = [0] * k
-    dp[0] = 1  # Base case: empty string
-
-    for i, group in enumerate(groups):
-      newDp = [0] * k
-      windowSum = 0
-      for j in range(i, k):
-        newDp[j] = (newDp[j] + windowSum) % MOD
-        windowSum = (windowSum + dp[j]) % MOD
-        if j >= group:
-          windowSum = (windowSum - dp[j - group] + MOD) % MOD
-      dp = newDp
-
-    return (totalCombinations - sum(dp)) % MOD
-
-  def _getConsecutiveLetters(self, word: str) -> list[int]:
-    """
-    Returns consecutive identical letters in the input string.
-    e.g. "aabbbc" -> [2, 3, 1].
-    """
-    groups = []
-    group = 1
-    for i in range(1, len(word)):
-      if word[i] == word[i - 1]:
-        group += 1
-      else:
-        groups.append(group)
-        group = 1
-    groups.append(group)
-    return groups
diff --git a/solutions/3334. Find the Maximum Factor Score of Array/3334.cpp b/solutions/3334. Find the Maximum Factor Score of Array/3334.cpp
deleted file mode 100644
index 1802c119acf..00000000000
--- a/solutions/3334. Find the Maximum Factor Score of Array/3334.cpp	
+++ /dev/null
@@ -1,57 +0,0 @@
-class Solution {
- public:
-  long long maxScore(vector<int>& nums) {
-    const int n = nums.size();
-    // prefixGcd[i] := GCD of nums[0..i]
-    // prefixLcm[i] := LCM of nums[0..i]
-    const auto [prefixGcd, prefixLcm] = getPrefix(nums);
-    // suffixGcd[i] := GCD of nums[i..n - 1]
-    // suffixLcm[i] := LCM of nums[i..n - 1]
-    const auto [suffixGcd, suffixLcm] = getSuffix(nums);
-    long ans = suffixGcd[0] * suffixLcm[0];
-
-    for (int i = 0; i < n; ++i) {
-      const long gcd1 = i > 0 ? prefixGcd[i - 1] : 0;
-      const long gcd2 = i + 1 < n ? suffixGcd[i + 1] : 0;
-      const long lcm1 = i > 0 ? prefixLcm[i - 1] : 1;
-      const long lcm2 = i + 1 < n ? suffixLcm[i + 1] : 1;
-      const long score = gcd(gcd1, gcd2) * lcm(lcm1, lcm2);
-      ans = max(ans, score);
-    }
-
-    return ans;
-  }
-
- private:
-  // Returns the prefix GCD and LCM arrays.
-  pair<vector<long>, vector<long>> getPrefix(const vector<int>& nums) {
-    vector<long> prefixGcd;
-    vector<long> prefixLcm;
-    long currGcd = 0;
-    long currLcm = 1;
-    for (const int num : nums) {
-      currGcd = gcd(currGcd, num);
-      currLcm = lcm(currLcm, num);
-      prefixGcd.push_back(currGcd);
-      prefixLcm.push_back(currLcm);
-    }
-    return {prefixGcd, prefixLcm};
-  }
-
-  // Returns the suffix GCD and LCM arrays.
-  pair<vector<long>, vector<long>> getSuffix(const vector<int>& nums) {
-    vector<long> suffixGcd;
-    vector<long> suffixLcm;
-    long currGcd = 0;
-    long currLcm = 1;
-    for (int i = nums.size() - 1; i >= 0; --i) {
-      currGcd = gcd(currGcd, nums[i]);
-      currLcm = lcm(currLcm, nums[i]);
-      suffixGcd.push_back(currGcd);
-      suffixLcm.push_back(currLcm);
-    }
-    ranges::reverse(suffixGcd);
-    ranges::reverse(suffixLcm);
-    return {suffixGcd, suffixLcm};
-  }
-};
diff --git a/solutions/3334. Find the Maximum Factor Score of Array/3334.java b/solutions/3334. Find the Maximum Factor Score of Array/3334.java
deleted file mode 100644
index f6f4ae4b241..00000000000
--- a/solutions/3334. Find the Maximum Factor Score of Array/3334.java	
+++ /dev/null
@@ -1,65 +0,0 @@
-class Solution {
-  public long maxScore(int[] nums) {
-    final int n = nums.length;
-    // prefixGcd[i] := GCD of nums[0..i]
-    // prefixLcm[i] := LCM of nums[0..i]
-    long[][] prefix = getPrefix(nums);
-    long[] prefixGcd = prefix[0];
-    long[] prefixLcm = prefix[1];
-    // suffixGcd[i] := GCD of nums[i..n - 1]
-    // suffixLcm[i] := LCM of nums[i..n - 1]
-    long[][] suffix = getSuffix(nums);
-    long[] suffixGcd = suffix[0];
-    long[] suffixLcm = suffix[1];
-    long ans = suffixGcd[0] * suffixLcm[0];
-
-    for (int i = 0; i < n; ++i) {
-      final long gcd1 = i > 0 ? prefixGcd[i - 1] : 0;
-      final long gcd2 = i + 1 < n ? suffixGcd[i + 1] : 0;
-      final long lcm1 = i > 0 ? prefixLcm[i - 1] : 1;
-      final long lcm2 = i + 1 < n ? suffixLcm[i + 1] : 1;
-      final long score = gcd(gcd1, gcd2) * lcm(lcm1, lcm2);
-      ans = Math.max(ans, score);
-    }
-
-    return ans;
-  }
-
-  // Returns the prefix GCD and LCM arrays.
-  private long[][] getPrefix(int[] nums) {
-    long[] prefixGcd = new long[nums.length];
-    long[] prefixLcm = new long[nums.length];
-    long currGcd = 0;
-    long currLcm = 1;
-    for (int i = 0; i < nums.length; ++i) {
-      currGcd = gcd(currGcd, nums[i]);
-      currLcm = lcm(currLcm, nums[i]);
-      prefixGcd[i] = currGcd;
-      prefixLcm[i] = currLcm;
-    }
-    return new long[][] {prefixGcd, prefixLcm};
-  }
-
-  // Returns the suffix GCD and LCM arrays.
-  private long[][] getSuffix(int[] nums) {
-    long[] suffixGcd = new long[nums.length];
-    long[] suffixLcm = new long[nums.length];
-    long currGcd = 0;
-    long currLcm = 1;
-    for (int i = nums.length - 1; i >= 0; --i) {
-      currGcd = gcd(currGcd, nums[i]);
-      currLcm = lcm(currLcm, nums[i]);
-      suffixGcd[i] = currGcd;
-      suffixLcm[i] = currLcm;
-    }
-    return new long[][] {suffixGcd, suffixLcm};
-  }
-
-  private long gcd(long a, long b) {
-    return b == 0 ? a : gcd(b, a % b);
-  }
-
-  private long lcm(long a, long b) {
-    return a * (b / gcd(a, b));
-  }
-}
diff --git a/solutions/3334. Find the Maximum Factor Score of Array/3334.py b/solutions/3334. Find the Maximum Factor Score of Array/3334.py
deleted file mode 100644
index f6f8243e69a..00000000000
--- a/solutions/3334. Find the Maximum Factor Score of Array/3334.py	
+++ /dev/null
@@ -1,46 +0,0 @@
-class Solution:
-  def maxScore(self, nums: list[int]) -> int:
-    n = len(nums)
-    # prefixGcd[i] := GCD of nums[0..i]
-    # prefixLcm[i] := LCM of nums[0..i]
-    prefixGcd, prefixLcm = self._getPrefix(nums)
-    # suffixGcd[i] := GCD of nums[i..n - 1]
-    # suffixLcm[i] := LCM of nums[i..n - 1]
-    suffixGcd, suffixLcm = self._getSuffix(nums)
-    ans = suffixGcd[0] * suffixLcm[0]
-
-    for i in range(n):
-      gcd1 = prefixGcd[i - 1] if i > 0 else 0
-      gcd2 = suffixGcd[i + 1] if i + 1 < n else 0
-      lcm1 = prefixLcm[i - 1] if i > 0 else 1
-      lcm2 = suffixLcm[i + 1] if i + 1 < n else 1
-      score = math.gcd(gcd1, gcd2) * math.lcm(lcm1, lcm2)
-      ans = max(ans, score)
-
-    return ans
-
-  def _getPrefix(self, nums: list[int]) -> tuple[list[int], list[int]]:
-    """Returns the prefix GCD and LCM arrays."""
-    prefixGcd = []
-    prefixLcm = []
-    currGcd = 0
-    currLcm = 1
-    for num in nums:
-      currGcd = math.gcd(currGcd, num)
-      currLcm = math.lcm(currLcm, num)
-      prefixGcd.append(currGcd)
-      prefixLcm.append(currLcm)
-    return prefixGcd, prefixLcm
-
-  def _getSuffix(self, nums: list[int]) -> tuple[list[int], list[int]]:
-    """Returns the suffix GCD and LCM arrays."""
-    suffixGcd = []
-    suffixLcm = []
-    currGcd = 0
-    currLcm = 1
-    for num in reversed(nums):
-      currGcd = math.gcd(currGcd, num)
-      currLcm = math.lcm(currLcm, num)
-      suffixGcd.append(currGcd)
-      suffixLcm.append(currLcm)
-    return list(reversed(suffixGcd)), list(reversed(suffixLcm))
diff --git a/solutions/3335. Total Characters in String After Transformations I/3335-2.cpp b/solutions/3335. Total Characters in String After Transformations I/3335-2.cpp
deleted file mode 100644
index 98ca737f308..00000000000
--- a/solutions/3335. Total Characters in String After Transformations I/3335-2.cpp	
+++ /dev/null
@@ -1,64 +0,0 @@
-class Solution {
- public:
-  int lengthAfterTransformations(string s, int t) {
-    // T[i][j] := the number of ways to transform ('a' + i) to ('a' + j)
-    const vector<vector<int>> T = getTransformationMatrix();
-    const vector poweredT = matrixPow(T, t);
-    vector<int> count(26);
-    // lengths[i] := the total length of ('a' + i) after t transformations
-    vector<long> lengths(26);
-
-    for (const char c : s)
-      ++count[c - 'a'];
-
-    for (int i = 0; i < 26; ++i)
-      for (int j = 0; j < 26; ++j) {
-        lengths[j] += static_cast<long>(count[i]) * poweredT[i][j];
-        lengths[j] %= kMod;
-      }
-
-    return accumulate(lengths.begin(), lengths.end(), 0L) % kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  vector<vector<int>> getTransformationMatrix() {
-    vector<vector<int>> T(26, vector<int>(26));
-    // 'z' -> 'ab'
-    T[25][0] = 1;
-    T[25][1] = 1;
-    // 'a' -> 'b', 'b' -> 'c', ..., 'y' -> 'z'
-    for (int i = 0; i < 25; ++i)
-      T[i][i + 1] = 1;
-    return T;
-  }
-
-  vector<vector<int>> getIdentityMatrix(int sz) {
-    vector<vector<int>> I(sz, vector<int>(sz));
-    for (int i = 0; i < sz; ++i)
-      I[i][i] = 1;
-    return I;
-  }
-
-  // Returns A * B.
-  vector<vector<int>> matrixMult(const vector<vector<int>>& A,
-                                 const vector<vector<int>>& B) {
-    const int sz = A.size();
-    vector<vector<int>> C(sz, vector<int>(sz));
-    for (int i = 0; i < sz; ++i)
-      for (int j = 0; j < sz; ++j)
-        for (int k = 0; k < sz; ++k)
-          C[i][j] = (C[i][j] + static_cast<long>(A[i][k]) * B[k][j]) % kMod;
-    return C;
-  }
-
-  // Returns M^n.
-  vector<vector<int>> matrixPow(const vector<vector<int>>& M, int n) {
-    if (n == 0)
-      return getIdentityMatrix(M.size());
-    if (n % 2 == 1)
-      return matrixMult(M, matrixPow(M, n - 1));
-    return matrixPow(matrixMult(M, M), n / 2);
-  }
-};
diff --git a/solutions/3335. Total Characters in String After Transformations I/3335-2.java b/solutions/3335. Total Characters in String After Transformations I/3335-2.java
deleted file mode 100644
index 222d52ac9ce..00000000000
--- a/solutions/3335. Total Characters in String After Transformations I/3335-2.java	
+++ /dev/null
@@ -1,61 +0,0 @@
-class Solution {
-  public int lengthAfterTransformations(String s, int t) {
-    // T[i][j] := the number of ways to transform ('a' + i) to ('a' + j)
-    int[][] T = getTransformationMatrix();
-    int[][] poweredT = matrixPow(T, t);
-    int[] count = new int[26];
-    // lengths[i] := the total length of ('a' + i) after t transformations
-    long[] lengths = new long[26];
-
-    for (final char c : s.toCharArray())
-      ++count[c - 'a'];
-
-    for (int i = 0; i < 26; ++i)
-      for (int j = 0; j < 26; ++j) {
-        lengths[j] += (long) count[i] * poweredT[i][j];
-        lengths[j] %= MOD;
-      }
-
-    return (int) (Arrays.stream(lengths).sum() % MOD);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  private int[][] getTransformationMatrix() {
-    int[][] T = new int[26][26];
-    // 'z' -> 'ab'
-    T[25][0] = 1;
-    T[25][1] = 1;
-    // 'a' -> 'b', 'b' -> 'c', ..., 'y' -> 'z'
-    for (int i = 0; i < 25; ++i)
-      T[i][i + 1] = 1;
-    return T;
-  }
-
-  private int[][] getIdentityMatrix(int sz) {
-    int[][] I = new int[sz][sz];
-    for (int i = 0; i < sz; ++i)
-      I[i][i] = 1;
-    return I;
-  }
-
-  // Returns A * B.
-  private int[][] matrixMult(int[][] A, int[][] B) {
-    final int sz = A.length;
-    int[][] C = new int[sz][sz];
-    for (int i = 0; i < sz; ++i)
-      for (int j = 0; j < sz; ++j)
-        for (int k = 0; k < sz; ++k)
-          C[i][j] = (int) ((C[i][j] + (long) A[i][k] * B[k][j]) % MOD);
-    return C;
-  }
-
-  // Returns M^n.
-  private int[][] matrixPow(int[][] M, int n) {
-    if (n == 0)
-      return getIdentityMatrix(M.length);
-    if (n % 2 == 1)
-      return matrixMult(M, matrixPow(M, n - 1));
-    return matrixPow(matrixMult(M, M), n / 2);
-  }
-}
diff --git a/solutions/3335. Total Characters in String After Transformations I/3335-2.py b/solutions/3335. Total Characters in String After Transformations I/3335-2.py
deleted file mode 100644
index 894c93c6f32..00000000000
--- a/solutions/3335. Total Characters in String After Transformations I/3335-2.py	
+++ /dev/null
@@ -1,50 +0,0 @@
-class Solution:
-  def lengthAfterTransformations(self, s: str, t: int) -> int:
-    MOD = 1_000_000_007
-
-    def matrixMult(A: list[list[int]], B: list[list[int]]) -> list[list[int]]:
-      """Returns A * B."""
-      sz = len(A)
-      C = [[0] * sz for _ in range(sz)]
-      for i in range(sz):
-        for j in range(sz):
-          for k in range(sz):
-            C[i][j] += A[i][k] * B[k][j]
-            C[i][j] %= MOD
-      return C
-
-    def matrixPow(M: list[list[int]], n: int) -> list[list[int]]:
-      """Returns M^n."""
-      if n == 0:
-        return [[1 if i == j else 0  # identity matrix
-                for j in range(len(M))]
-                for i in range(len(M))]
-      if n % 2 == 1:
-        return matrixMult(M, matrixPow(M, n - 1))
-      return matrixPow(matrixMult(M, M), n // 2)
-
-    # T[i][j] := the number of ways to transform ('a' + i) to ('a' + j)
-    T = self._getTransformationMatrix()
-    poweredT = matrixPow(T, t)
-    count = [0] * 26
-    lengths = [0] * 26
-
-    for c in s:
-      count[ord(c) - ord('a')] += 1
-
-    for i in range(26):
-      for j in range(26):
-        lengths[j] += count[i] * poweredT[i][j]
-        lengths[j] %= MOD
-
-    return sum(lengths) % MOD
-
-  def _getTransformationMatrix(self) -> list[list[int]]:
-    T = [[0] * 26 for _ in range(26)]
-    # 'z' -> 'ab'
-    T[25][0] = 1
-    T[25][1] = 1
-    # 'a' -> 'b', 'b' -> 'c', ..., 'y' -> 'z'
-    for i in range(25):
-      T[i][i + 1] = 1
-    return T
diff --git a/solutions/3335. Total Characters in String After Transformations I/3335.cpp b/solutions/3335. Total Characters in String After Transformations I/3335.cpp
deleted file mode 100644
index 6f05fa78278..00000000000
--- a/solutions/3335. Total Characters in String After Transformations I/3335.cpp	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
- public:
-  int lengthAfterTransformations(string s, int t) {
-    constexpr int kMod = 1'000'000'007;
-    vector<int> count(26);
-
-    for (const char c : s)
-      ++count[c - 'a'];
-
-    while (t-- > 0) {
-      vector<int> newCount(26);
-      // 'a' -> 'b', 'b' -> 'c', ..., 'y' -> 'z'
-      for (int i = 0; i < 25; ++i)
-        newCount[i + 1] = count[i];
-      // 'z' -> 'ab'
-      newCount[0] = count[25];
-      newCount[1] = (newCount[1] + count[25]) % kMod;
-      count = std::move(newCount);
-    }
-
-    return accumulate(count.begin(), count.end(), 0L) % kMod;
-  }
-};
diff --git a/solutions/3335. Total Characters in String After Transformations I/3335.java b/solutions/3335. Total Characters in String After Transformations I/3335.java
deleted file mode 100644
index 502973ac644..00000000000
--- a/solutions/3335. Total Characters in String After Transformations I/3335.java	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
-  public int lengthAfterTransformations(String s, int t) {
-    final int MOD = 1_000_000_007;
-    int[] count = new int[26];
-
-    for (final char c : s.toCharArray())
-      ++count[c - 'a'];
-
-    while (t-- > 0) {
-      int[] newCount = new int[26];
-      // 'a' -> 'b', 'b' -> 'c', ..., 'y' -> 'z'
-      for (int i = 0; i < 25; i++)
-        newCount[i + 1] = count[i];
-      // 'z' -> 'ab'
-      newCount[0] = count[25];
-      newCount[1] = (newCount[1] + count[25]) % MOD;
-      count = newCount;
-    }
-
-    return Arrays.stream(count).reduce(0, (a, b) -> (a + b) % MOD);
-  }
-}
diff --git a/solutions/3335. Total Characters in String After Transformations I/3335.py b/solutions/3335. Total Characters in String After Transformations I/3335.py
deleted file mode 100644
index 9181cf5415c..00000000000
--- a/solutions/3335. Total Characters in String After Transformations I/3335.py	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution:
-  def lengthAfterTransformations(self, s: str, t: int) -> int:
-    MOD = 1_000_000_007
-    count = [0] * 26
-
-    for c in s:
-      count[ord(c) - ord('a')] += 1
-
-    for _ in range(t):
-      newCount = [0] * 26
-      # 'a' -> 'b', 'b' -> 'c', ..., 'y' -> 'z'
-      for i in range(25):
-        newCount[i + 1] = count[i]
-      # 'z' -> 'ab'
-      newCount[0] = count[25]
-      newCount[1] = (newCount[1] + count[25]) % MOD
-      count = newCount
-
-    return sum(count) % MOD
diff --git a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-2.cpp b/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-2.cpp
deleted file mode 100644
index 3ae9e94fd0a..00000000000
--- a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-2.cpp	
+++ /dev/null
@@ -1,36 +0,0 @@
-class Solution {
- public:
-  int subsequencePairCount(vector<int>& nums) {
-    constexpr int kMod = 1'000'000'007;
-    const int n = nums.size();
-    const int maxNum = ranges::max(nums);
-    // dp[i][x][y] := the number of disjoint pairs `seq1` and `seq2` of
-    // nums[0..i - 1], where GCD(seq1) == x and GCD(seq2) == y
-    vector<vector<vector<int>>> dp(
-        n + 1, vector<vector<int>>(maxNum + 1, vector<int>(maxNum + 1)));
-    dp[0][0][0] = 1;
-
-    for (int i = 0; i < n; ++i)
-      for (int x = 0; x <= maxNum; ++x)
-        for (int y = 0; y <= maxNum; ++y) {
-          // 1. Skip nums[i].
-          dp[i + 1][x][y] += dp[i][x][y];
-          dp[i + 1][x][y] %= kMod;
-          // 2. Pick nums[i] in the first subsequence.
-          const int newX = gcd(x, nums[i]);
-          dp[i + 1][newX][y] += dp[i][x][y];
-          dp[i + 1][newX][y] %= kMod;
-          // 3. Pick nums[i] in the second subsequence.
-          const int newY = gcd(y, nums[i]);
-          dp[i + 1][x][newY] += dp[i][x][y];
-          dp[i + 1][x][newY] %= kMod;
-        }
-
-    int ans = 0;
-    for (int g = 1; g <= maxNum; ++g) {
-      ans += dp[n][g][g];
-      ans %= kMod;
-    }
-    return ans;
-  }
-};
diff --git a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-2.java b/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-2.java
deleted file mode 100644
index f7b742a8074..00000000000
--- a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-2.java	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
-  public int subsequencePairCount(int[] nums) {
-    final int MOD = 1_000_000_007;
-    final int n = nums.length;
-    final int maxNum = Arrays.stream(nums).max().getAsInt();
-    // dp[i][x][y] := number of disjoint pairs `seq1` and `seq2` of
-    // nums[0..i - 1], where GCD(seq1) == x and GCD(seq2) == y
-    int[][][] dp = new int[n + 1][maxNum + 1][maxNum + 1];
-    dp[0][0][0] = 1;
-
-    for (int i = 0; i < n; ++i)
-      for (int x = 0; x <= maxNum; ++x)
-        for (int y = 0; y <= maxNum; ++y) {
-          // 1. Skip nums[i].
-          dp[i + 1][x][y] += dp[i][x][y];
-          dp[i + 1][x][y] %= MOD;
-          // 2. Pick nums[i] in the first subsequence.
-          final int newX = gcd(x, nums[i]);
-          dp[i + 1][newX][y] += dp[i][x][y];
-          dp[i + 1][newX][y] %= MOD;
-          // 3. Pick nums[i] in the second subsequence.
-          final int newY = gcd(y, nums[i]);
-          dp[i + 1][x][newY] += dp[i][x][y];
-          dp[i + 1][x][newY] %= MOD;
-        }
-
-    int ans = 0;
-    for (int g = 1; g <= maxNum; ++g) {
-      ans += dp[n][g][g];
-      ans %= MOD;
-    }
-    return ans;
-  }
-
-  private int gcd(int a, int b) {
-    return b == 0 ? a : gcd(b, a % b);
-  }
-}
diff --git a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-2.py b/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-2.py
deleted file mode 100644
index 4e3adce3e1b..00000000000
--- a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-2.py	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution:
-  def subsequencePairCount(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-    maxNum = max(nums)
-    # dp[i][x][y] := number of disjoint pairs `seq1` and `seq2` of
-    # nums[0..i - 1], where GCD(seq1) == x and GCD(seq2) == y
-    dp = [[[0] * (maxNum + 1)
-          for _ in range(maxNum + 1)]
-          for _ in range(len(nums) + 1)]
-    dp[0][0][0] = 1
-
-    for i, num in enumerate(nums):
-      for x in range(maxNum + 1):
-        for y in range(maxNum + 1):
-          # 1. Skip nums[i].
-          dp[i + 1][x][y] += dp[i][x][y]
-          dp[i + 1][x][y] %= MOD
-          # 2. Pick nums[i] in the first subsequence.
-          newX = math.gcd(x, num)
-          dp[i + 1][newX][y] += dp[i][x][y]
-          dp[i + 1][newX][y] %= MOD
-          # 3. Pick nums[i] in the second subsequence.
-          newY = math.gcd(y, num)
-          dp[i + 1][x][newY] += dp[i][x][y]
-          dp[i + 1][x][newY] %= MOD
-
-    return sum(dp[-1][g][g]
-               for g in range(1, maxNum + 1)) % MOD
diff --git a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-3.cpp b/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-3.cpp
deleted file mode 100644
index 60723bd73a8..00000000000
--- a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-3.cpp	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
- public:
-  int subsequencePairCount(vector<int>& nums) {
-    constexpr int kMod = 1'000'000'007;
-    const int n = nums.size();
-    const int maxNum = ranges::max(nums);
-    // dp[x][y] := the number of disjoint pairs `seq1` and `seq2` of
-    // nums so far, where GCD(seq1) == x and GCD(seq2) == y
-    vector<vector<int>> dp(maxNum + 1, vector<int>(maxNum + 1));
-    dp[0][0] = 1;
-
-    for (const int num : nums) {
-      vector<vector<int>> newDp(maxNum + 1, vector<int>(maxNum + 1));
-      for (int x = 0; x <= maxNum; ++x)
-        for (int y = 0; y <= maxNum; ++y) {
-          // 1. Skip `num`.
-          newDp[x][y] += dp[x][y];
-          newDp[x][y] %= kMod;
-          // 2. Pick `num` in the first subsequence.
-          const int newX = gcd(x, num);
-          newDp[newX][y] += dp[x][y];
-          newDp[newX][y] %= kMod;
-          // 3. Pick `num` in the second subsequence.
-          const int newY = gcd(y, num);
-          newDp[x][newY] += dp[x][y];
-          newDp[x][newY] %= kMod;
-        }
-      dp = std::move(newDp);
-    }
-
-    int ans = 0;
-    for (int g = 1; g <= maxNum; ++g) {
-      ans += dp[g][g];
-      ans %= kMod;
-    }
-    return ans;
-  }
-};
diff --git a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-3.java b/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-3.java
deleted file mode 100644
index 10968f7ae55..00000000000
--- a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-3.java	
+++ /dev/null
@@ -1,41 +0,0 @@
-class Solution {
-  public int subsequencePairCount(int[] nums) {
-    final int MOD = 1_000_000_007;
-    final int n = nums.length;
-    final int maxNum = Arrays.stream(nums).max().getAsInt();
-    // dp[x][y] := number of disjoint pairs `seq1` and `seq2` of
-    // nums so far, where GCD(seq1) == x and GCD(seq2) == y
-    int[][] dp = new int[maxNum + 1][maxNum + 1];
-    dp[0][0] = 1;
-
-    for (final int num : nums) {
-      int[][] newDp = new int[maxNum + 1][maxNum + 1];
-      for (int x = 0; x <= maxNum; ++x)
-        for (int y = 0; y <= maxNum; ++y) {
-          // 1. Skip `num`.
-          newDp[x][y] += dp[x][y];
-          newDp[x][y] %= MOD;
-          // 2. Pick `num` in the first subsequence.
-          final int newX = gcd(x, num);
-          newDp[newX][y] += dp[x][y];
-          newDp[newX][y] %= MOD;
-          // 3. Pick `num` in the second subsequence.
-          final int newY = gcd(y, num);
-          newDp[x][newY] += dp[x][y];
-          newDp[x][newY] %= MOD;
-        }
-      dp = newDp;
-    }
-
-    int ans = 0;
-    for (int g = 1; g <= maxNum; ++g) {
-      ans += dp[g][g];
-      ans %= MOD;
-    }
-    return ans;
-  }
-
-  private int gcd(int a, int b) {
-    return b == 0 ? a : gcd(b, a % b);
-  }
-}
diff --git a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-3.py b/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-3.py
deleted file mode 100644
index 78c363598a8..00000000000
--- a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336-3.py	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution:
-  def subsequencePairCount(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-    maxNum = max(nums)
-    # dp[x][y] := number of disjoint pairs `seq1` and `seq2` of
-    # nums so far, where GCD(seq1) == x and GCD(seq2) == y
-    dp = [[0] * (maxNum + 1) for _ in range(maxNum + 1)]
-    dp[0][0] = 1
-
-    for num in nums:
-      newDp = [[0] * (maxNum + 1) for _ in range(maxNum + 1)]
-      for x in range(maxNum + 1):
-        for y in range(maxNum + 1):
-          # 1. Skip `num`.
-          newDp[x][y] += dp[x][y]
-          newDp[x][y] %= MOD
-          # 2. Pick `num` in the first subsequence.
-          newX = math.gcd(x, num)
-          newDp[newX][y] += dp[x][y]
-          newDp[newX][y] %= MOD
-          # 3. Pick `num` in the second subsequence.
-          newY = math.gcd(y, num)
-          newDp[x][newY] += dp[x][y]
-          newDp[x][newY] %= MOD
-      dp = newDp
-
-    return sum(dp[g][g]
-               for g in range(1, maxNum + 1)) % MOD
diff --git a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336.cpp b/solutions/3336. Find the Number of Subsequences With Equal GCD/3336.cpp
deleted file mode 100644
index 9a9fe5aa7a8..00000000000
--- a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336.cpp	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution {
- public:
-  int subsequencePairCount(vector<int>& nums) {
-    const int maxNum = ranges::max(nums);
-    vector<vector<vector<int>>> mem(
-        nums.size(),
-        vector<vector<int>>(maxNum + 1, vector<int>(maxNum + 1, -1)));
-    return subsequencePairCount(nums, 0, 0, 0, mem);
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Returns the number of disjoint pairs `seq1` and `seq2` of nums[i..n - 1],
-  // where GCD(seq1) == x and GCD(seq2) == y.
-  int subsequencePairCount(const vector<int>& nums, int i, int x, int y,
-                           vector<vector<vector<int>>>& mem) {
-    if (i == nums.size())
-      return x > 0 && x == y;
-    if (mem[i][x][y] != -1)
-      return mem[i][x][y];
-    // 1. Skip nums[i].
-    const int skip = subsequencePairCount(nums, i + 1, x, y, mem);
-    // 2. Pick nums[i] in the first subsequence.
-    const int take1 =
-        subsequencePairCount(nums, i + 1, gcd(x, nums[i]), y, mem);
-    // 3. Pick nums[i] in the second subsequence.
-    const int take2 =
-        subsequencePairCount(nums, i + 1, x, gcd(y, nums[i]), mem);
-    return mem[i][x][y] = (static_cast<long>(skip) + take1 + take2) % kMod;
-  }
-};
diff --git a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336.java b/solutions/3336. Find the Number of Subsequences With Equal GCD/3336.java
deleted file mode 100644
index 5ccc7c9fc56..00000000000
--- a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336.java	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution {
-  public int subsequencePairCount(int[] nums) {
-    final int maxNum = Arrays.stream(nums).max().getAsInt();
-    Integer[][][] mem = new Integer[nums.length][maxNum + 1][maxNum + 1];
-    return subsequencePairCount(nums, 0, 0, 0, mem);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  private int subsequencePairCount(int[] nums, int i, int x, int y, Integer[][][] mem) {
-    if (i == nums.length)
-      return (x > 0 && x == y) ? 1 : 0;
-    if (mem[i][x][y] != null)
-      return mem[i][x][y];
-    // 1. Skip nums[i]
-    final int skip = subsequencePairCount(nums, i + 1, x, y, mem);
-    // 2. Pick nums[i] in the first subsequence
-    final int take1 = subsequencePairCount(nums, i + 1, gcd(x, nums[i]), y, mem);
-    // 3. Pick nums[i] in the second subsequence
-    final int take2 = subsequencePairCount(nums, i + 1, x, gcd(y, nums[i]), mem);
-    return mem[i][x][y] = (int) (((long) skip + take1 + take2) % MOD);
-  }
-
-  private int gcd(int a, int b) {
-    return b == 0 ? a : gcd(b, a % b);
-  }
-}
diff --git a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336.py b/solutions/3336. Find the Number of Subsequences With Equal GCD/3336.py
deleted file mode 100644
index c3b60550c95..00000000000
--- a/solutions/3336. Find the Number of Subsequences With Equal GCD/3336.py	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution:
-  def subsequencePairCount(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-
-    @functools.lru_cache(None)
-    def dp(i: int, x: int, y: int) -> int:
-      if i == len(nums):
-        return int(x > 0 and x == y)
-      # 1. Skip nums[i]
-      skip = dp(i + 1, x, y)
-      # 2. Pick nums[i] in the first subsequence
-      take1 = dp(i + 1, math.gcd(x, nums[i]), y)
-      # 3. Pick nums[i] in the second subsequence
-      take2 = dp(i + 1, x, math.gcd(y, nums[i]))
-      return (skip + take1 + take2) % MOD
-
-    return dp(0, 0, 0)
diff --git a/solutions/3337. Total Characters in String After Transformations II/3337.cpp b/solutions/3337. Total Characters in String After Transformations II/3337.cpp
deleted file mode 100644
index 78b974c5ebc..00000000000
--- a/solutions/3337. Total Characters in String After Transformations II/3337.cpp	
+++ /dev/null
@@ -1,62 +0,0 @@
-class Solution {
- public:
-  // Similar to 3335. Total Characters in String After Transformations I
-  int lengthAfterTransformations(string s, int t, vector<int>& nums) {
-    // T[i][j] := the number of ways to transform ('a' + i) to ('a' + j)
-    const vector<vector<int>> T = getTransformationMatrix(nums);
-    const vector poweredT = matrixPow(T, t);
-    vector<int> count(26);
-    // lengths[i] := the total length of ('a' + i) after t transformations
-    vector<long> lengths(26);
-
-    for (const char c : s)
-      ++count[c - 'a'];
-
-    for (int i = 0; i < 26; ++i)
-      for (int j = 0; j < 26; ++j) {
-        lengths[j] += static_cast<long>(count[i]) * poweredT[i][j];
-        lengths[j] %= kMod;
-      }
-
-    return accumulate(lengths.begin(), lengths.end(), 0L) % kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  vector<vector<int>> getTransformationMatrix(const vector<int>& nums) {
-    vector<vector<int>> T(26, vector<int>(26));
-    for (int i = 0; i < nums.size(); ++i)
-      for (int step = 1; step <= nums[i]; ++step)
-        ++T[i][(i + step) % 26];
-    return T;
-  }
-
-  vector<vector<int>> getIdentityMatrix(int sz) {
-    vector<vector<int>> I(sz, vector<int>(sz));
-    for (int i = 0; i < sz; ++i)
-      I[i][i] = 1;
-    return I;
-  }
-
-  // Returns A * B.
-  vector<vector<int>> matrixMult(const vector<vector<int>>& A,
-                                 const vector<vector<int>>& B) {
-    const int sz = A.size();
-    vector<vector<int>> C(sz, vector<int>(sz));
-    for (int i = 0; i < sz; ++i)
-      for (int j = 0; j < sz; ++j)
-        for (int k = 0; k < sz; ++k)
-          C[i][j] = (C[i][j] + static_cast<long>(A[i][k]) * B[k][j]) % kMod;
-    return C;
-  }
-
-  // Returns M^n.
-  vector<vector<int>> matrixPow(const vector<vector<int>>& M, int n) {
-    if (n == 0)
-      return getIdentityMatrix(M.size());
-    if (n % 2 == 1)
-      return matrixMult(M, matrixPow(M, n - 1));
-    return matrixPow(matrixMult(M, M), n / 2);
-  }
-};
diff --git a/solutions/3337. Total Characters in String After Transformations II/3337.java b/solutions/3337. Total Characters in String After Transformations II/3337.java
deleted file mode 100644
index 28f18f4d65c..00000000000
--- a/solutions/3337. Total Characters in String After Transformations II/3337.java	
+++ /dev/null
@@ -1,59 +0,0 @@
-class Solution {
-  // Similar to 3335. Total Characters in String After Transformations I
-  public int lengthAfterTransformations(String s, int t, List<Integer> nums) {
-    // T[i][j] := the number of ways to transform ('a' + i) to ('a' + j)
-    int[][] T = getTransformationMatrix(nums);
-    int[][] poweredT = matrixPow(T, t);
-    int[] count = new int[26];
-    // lengths[i] := the total length of ('a' + i) after t transformations
-    long[] lengths = new long[26];
-
-    for (final char c : s.toCharArray())
-      ++count[c - 'a'];
-
-    for (int i = 0; i < 26; ++i)
-      for (int j = 0; j < 26; ++j) {
-        lengths[j] += (long) count[i] * poweredT[i][j];
-        lengths[j] %= MOD;
-      }
-
-    return (int) (Arrays.stream(lengths).sum() % MOD);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  private int[][] getTransformationMatrix(List<Integer> nums) {
-    int[][] T = new int[26][26];
-    for (int i = 0; i < nums.size(); ++i)
-      for (int step = 1; step <= nums.get(i); ++step)
-        ++T[i][(i + step) % 26];
-    return T;
-  }
-
-  private int[][] getIdentityMatrix(int sz) {
-    int[][] I = new int[sz][sz];
-    for (int i = 0; i < sz; ++i)
-      I[i][i] = 1;
-    return I;
-  }
-
-  // Returns A * B.
-  private int[][] matrixMult(int[][] A, int[][] B) {
-    final int sz = A.length;
-    int[][] C = new int[sz][sz];
-    for (int i = 0; i < sz; ++i)
-      for (int j = 0; j < sz; ++j)
-        for (int k = 0; k < sz; ++k)
-          C[i][j] = (int) ((C[i][j] + (long) A[i][k] * B[k][j]) % MOD);
-    return C;
-  }
-
-  // Returns M^n.
-  private int[][] matrixPow(int[][] M, int n) {
-    if (n == 0)
-      return getIdentityMatrix(M.length);
-    if (n % 2 == 1)
-      return matrixMult(M, matrixPow(M, n - 1));
-    return matrixPow(matrixMult(M, M), n / 2);
-  }
-}
diff --git a/solutions/3337. Total Characters in String After Transformations II/3337.py b/solutions/3337. Total Characters in String After Transformations II/3337.py
deleted file mode 100644
index d4ab07ae984..00000000000
--- a/solutions/3337. Total Characters in String After Transformations II/3337.py	
+++ /dev/null
@@ -1,48 +0,0 @@
-class Solution:
-  # Similar to 3335. Total Characters in String After Transformations I
-  def lengthAfterTransformations(self, s: str, t: int, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-
-    def matrixMult(A: list[list[int]], B: list[list[int]]) -> list[list[int]]:
-      """Returns A * B."""
-      sz = len(A)
-      C = [[0] * sz for _ in range(sz)]
-      for i in range(sz):
-        for j in range(sz):
-          for k in range(sz):
-            C[i][j] += A[i][k] * B[k][j]
-            C[i][j] %= MOD
-      return C
-
-    def matrixPow(M: list[list[int]], n: int) -> list[list[int]]:
-      """Returns M^n."""
-      if n == 0:
-        return [[1 if i == j else 0  # identity matrix
-                for j in range(len(M))]
-                for i in range(len(M))]
-      if n % 2 == 1:
-        return matrixMult(M, matrixPow(M, n - 1))
-      return matrixPow(matrixMult(M, M), n // 2)
-
-    # T[i][j] := the number of ways to transform ('a' + i) to ('a' + j)
-    T = self._getTransformationMatrix(nums)
-    poweredT = matrixPow(T, t)
-    count = [0] * 26
-    lengths = [0] * 26
-
-    for c in s:
-      count[ord(c) - ord('a')] += 1
-
-    for i in range(26):
-      for j in range(26):
-        lengths[j] += count[i] * poweredT[i][j]
-        lengths[j] %= MOD
-
-    return sum(lengths) % MOD
-
-  def _getTransformationMatrix(self, nums: list[int]) -> list[list[int]]:
-    T = [[0] * 26 for _ in range(26)]
-    for i, steps in enumerate(nums):
-      for step in range(1, steps + 1):
-        T[i][(i + step) % 26] += 1
-    return T
diff --git a/solutions/3338. Second Highest Salary II/3338.sql b/solutions/3338. Second Highest Salary II/3338.sql
deleted file mode 100644
index 45b82dcc6b9..00000000000
--- a/solutions/3338. Second Highest Salary II/3338.sql	
+++ /dev/null
@@ -1,12 +0,0 @@
-WITH
-  RankedEmployees AS (
-    SELECT *, DENSE_RANK() OVER(
-      PARTITION BY dept
-      ORDER BY salary DESC
-    ) AS `rank`
-    FROM Employees
-  )
-SELECT emp_id, dept
-FROM RankedEmployees
-WHERE `rank` = 2
-ORDER BY 1;
diff --git a/solutions/3339. Find the Number of K-Even Arrays/3339-2.cpp b/solutions/3339. Find the Number of K-Even Arrays/3339-2.cpp
deleted file mode 100644
index c919f7a9923..00000000000
--- a/solutions/3339. Find the Number of K-Even Arrays/3339-2.cpp	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution {
- public:
-  int countOfArrays(int n, int m, int k) {
-    constexpr int kMod = 1'000'000'007;
-    const int even = m / 2;    // the number of even numbers in [1, m]
-    const int odd = m - even;  // the number of odd numbers in [1, m]
-    // dp[j][0/1] := the number of arrays of length so far i with j consecutive
-    // even number pairs ending in an even number (0) or an odd number (1)
-    vector<vector<int>> dp(k + 1, vector<int>(2));
-
-    // Base case: arrays of length 1
-    // For an array of length 1, we can't have any even number pairs yet.
-    dp[0][0] = even;
-    dp[0][1] = odd;
-
-    for (int i = 2; i <= n; ++i) {
-      vector<vector<int>> newDp(k + 1, vector<int>(2));
-      for (int j = 0; j <= k; ++j) {
-        // 1. Appending an even number to an array ending in an even number
-        //    creates a new consecutive even number pair.
-        // 2. Appending an even number to an array ending in an odd number.
-        newDp[j][0] = (static_cast<long>(j > 0 ? dp[j - 1][0] : 0) * even +
-                       static_cast<long>(dp[j][1]) * even) %
-                      kMod;
-        // 3. Appending an odd number to an array.
-        newDp[j][1] = static_cast<long>(dp[j][0] + dp[j][1]) * odd % kMod;
-      }
-      dp = std::move(newDp);
-    }
-
-    return (dp[k][0] + dp[k][1]) % kMod;
-  }
-};
diff --git a/solutions/3339. Find the Number of K-Even Arrays/3339-2.java b/solutions/3339. Find the Number of K-Even Arrays/3339-2.java
deleted file mode 100644
index d4740ee7f45..00000000000
--- a/solutions/3339. Find the Number of K-Even Arrays/3339-2.java	
+++ /dev/null
@@ -1,31 +0,0 @@
-class Solution {
-  public int countOfArrays(int n, int m, int k) {
-    final int MOD = 1_000_000_007;
-    final int even = m / 2;   // the number of even numbers in [1, m]
-    final int odd = m - even; // the number of odd numbers in [1, m]
-    // dp[j][0/1] := the number of arrays of length so far i with j consecutive
-    // even number pairs ending in an even number (0) or an odd number (1)
-    int[][] dp = new int[k + 1][2];
-
-    // Base case: arrays of length 1
-    // For an array of length 1, we can't have any even number pairs yet.
-    dp[0][0] = even;
-    dp[0][1] = odd;
-
-    for (int i = 2; i <= n; ++i) {
-      int[][] newDp = new int[k + 1][2];
-      for (int j = 0; j <= k; ++j) {
-        // 1. Appending an even number to an array ending in an even number
-        //    creates a new consecutive even number pair.
-        // 2. Appending an even number to an array ending in an odd number.
-        newDp[j][0] =
-            (int) (((long) (j > 0 ? dp[j - 1][0] : 0) * even + (long) dp[j][1] * even) % MOD);
-        // 3. Appending an odd number to an array.
-        newDp[j][1] = (int) ((long) (dp[j][0] + dp[j][1]) * odd % MOD);
-      }
-      dp = newDp;
-    }
-
-    return (dp[k][0] + dp[k][1]) % MOD;
-  }
-}
diff --git a/solutions/3339. Find the Number of K-Even Arrays/3339-2.py b/solutions/3339. Find the Number of K-Even Arrays/3339-2.py
deleted file mode 100644
index 8e765b576cc..00000000000
--- a/solutions/3339. Find the Number of K-Even Arrays/3339-2.py	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution:
-  def countOfArrays(self, n: int, m: int, k: int) -> int:
-    MOD = 10**9 + 7
-    even = m // 2  # the number of even numbers in [1, m]
-    odd = m - even  # the number of odd numbers in [1, m]
-    # dp[j][0/1] := the number of arrays of length so far i with j consecutive
-    # even number pairs ending in an even number (0) or an odd number (1)
-    dp = [[0] * 2 for _ in range(k + 1)]
-
-    # Base case: arrays of length 1
-    # For an array of length 1, we can't have any even number pairs yet.
-    dp[0][0] = even
-    dp[0][1] = odd
-
-    for _ in range(2, n + 1):
-      newDp = [[0] * 2 for _ in range(k + 1)]
-      for j in range(k + 1):
-        # 1. Appending an even number to an array ending in an even number
-        #    creates a new consecutive even number pair.
-        # 2. Appending an even number to an array ending in an odd number.
-        newDp[j][0] = ((dp[j - 1][0] if j > 0 else 0) * even +
-                       dp[j][1] * even) % MOD
-        # 3. Appending an odd number to an array.
-        newDp[j][1] = sum(dp[j]) * odd % MOD
-      dp = newDp
-
-    return sum(dp[k]) % MOD
diff --git a/solutions/3339. Find the Number of K-Even Arrays/3339.cpp b/solutions/3339. Find the Number of K-Even Arrays/3339.cpp
deleted file mode 100644
index f4397241272..00000000000
--- a/solutions/3339. Find the Number of K-Even Arrays/3339.cpp	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution {
- public:
-  int countOfArrays(int n, int m, int k) {
-    constexpr int kMod = 1'000'000'007;
-    const int even = m / 2;    // the number of even numbers in [1, m]
-    const int odd = m - even;  // the number of odd numbers in [1, m]
-    // dp[i][j][0/1] := the number of arrays of length i with j consecutive even
-    // number pairs ending in an even number (0) or an odd number (1)
-    vector<vector<vector<int>>> dp(n + 1,
-                                   vector<vector<int>>(k + 1, vector<int>(2)));
-
-    // Base case: arrays of length 1
-    // For an array of length 1, we can't have any even number pairs yet.
-    dp[1][0][0] = even;
-    dp[1][0][1] = odd;
-
-    for (int i = 2; i <= n; ++i)
-      for (int j = 0; j <= k; ++j) {
-        // 1. Appending an even number to an array ending in an even number
-        //    creates a new consecutive even number pair.
-        // 2. Appending an even number to an array ending in an odd number.
-        dp[i][j][0] =
-            (static_cast<long>(j > 0 ? dp[i - 1][j - 1][0] : 0) * even +
-             static_cast<long>(dp[i - 1][j][1]) * even) %
-            kMod;
-        // 3. Appending an odd number to an array.
-        dp[i][j][1] =
-            static_cast<long>(dp[i - 1][j][0] + dp[i - 1][j][1]) * odd % kMod;
-      }
-
-    return (dp[n][k][0] + dp[n][k][1]) % kMod;
-  }
-};
diff --git a/solutions/3339. Find the Number of K-Even Arrays/3339.java b/solutions/3339. Find the Number of K-Even Arrays/3339.java
deleted file mode 100644
index 5325b3cf279..00000000000
--- a/solutions/3339. Find the Number of K-Even Arrays/3339.java	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution {
-  public int countOfArrays(int n, int m, int k) {
-    final int MOD = 1_000_000_007;
-    final int even = m / 2;   // the number of even numbers in [1, m]
-    final int odd = m - even; // the number of odd numbers in [1, m]
-    // dp[i][j][0/1] := the number of arrays of length i with j consecutive even
-    // number pairs ending in an even number (0) or an odd number (1)
-    int[][][] dp = new int[n + 1][k + 1][2];
-
-    // Base case: arrays of length 1
-    // For an array of length 1, we can't have any even number pairs yet.
-    dp[1][0][0] = even;
-    dp[1][0][1] = odd;
-
-    for (int i = 2; i <= n; ++i)
-      for (int j = 0; j <= k; ++j) {
-        // 1. Appending an even number to an array ending in an even number
-        //    creates a new consecutive even number pair.
-        // 2. Appending an even number to an array ending in an odd number.
-        dp[i][j][0] = (int) (((long) (j > 0 ? dp[i - 1][j - 1][0] : 0) * even +
-                              (long) dp[i - 1][j][1] * even) %
-                             MOD);
-        // 3. Appending an odd number to an array.
-        dp[i][j][1] = (int) ((long) (dp[i - 1][j][0] + dp[i - 1][j][1]) * odd % MOD);
-      }
-
-    return (dp[n][k][0] + dp[n][k][1]) % MOD;
-  }
-}
diff --git a/solutions/3339. Find the Number of K-Even Arrays/3339.py b/solutions/3339. Find the Number of K-Even Arrays/3339.py
deleted file mode 100644
index 92b95bc63fe..00000000000
--- a/solutions/3339. Find the Number of K-Even Arrays/3339.py	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution:
-  def countOfArrays(self, n: int, m: int, k: int) -> int:
-    MOD = 10**9 + 7
-    even = m // 2  # the number of even numbers in [1, m]
-    odd = m - even  # the number of odd numbers in [1, m]
-    # dp[i][j][0/1] := the number of arrays of length i with j consecutive even
-    # number pairs ending in an even number (0) or an odd number (1)
-    dp = [[[0] * 2
-          for _ in range(k + 1)]
-          for _ in range(n + 1)]
-
-    # Base case: arrays of length 1
-    # For an array of length 1, we can't have any even number pairs yet.
-    dp[1][0][0] = even
-    dp[1][0][1] = odd
-
-    for i in range(2, n + 1):
-      for j in range(k + 1):
-        # 1. Appending an even number to an array ending in an even number
-        #    creates a new consecutive even number pair.
-        # 2. Appending an even number to an array ending in an odd number.
-        dp[i][j][0] = ((dp[i - 1][j - 1][0] if j > 0 else 0) * even +
-                       dp[i - 1][j][1] * even) % MOD
-        # 3. Appending an odd number to an array.
-        dp[i][j][1] = sum(dp[i - 1][j]) * odd % MOD
-
-    return sum(dp[n][k]) % MOD
diff --git a/solutions/334. Increasing Triplet Subsequence/334.py b/solutions/334. Increasing Triplet Subsequence/334.py
index 994695a3e74..adbc8e80bfe 100644
--- a/solutions/334. Increasing Triplet Subsequence/334.py	
+++ b/solutions/334. Increasing Triplet Subsequence/334.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def increasingTriplet(self, nums: list[int]) -> bool:
+  def increasingTriplet(self, nums: List[int]) -> bool:
     first = math.inf
     second = math.inf
 
diff --git a/solutions/3340. Check Balanced String/3340.cpp b/solutions/3340. Check Balanced String/3340.cpp
deleted file mode 100644
index df684a9abbb..00000000000
--- a/solutions/3340. Check Balanced String/3340.cpp	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
- public:
-  bool isBalanced(string num) {
-    int balance = 0;
-    int sign = 1;
-
-    for (const char c : num) {
-      balance += sign * (c - '0');
-      sign *= -1;
-    }
-
-    return balance == 0;
-  }
-};
diff --git a/solutions/3340. Check Balanced String/3340.java b/solutions/3340. Check Balanced String/3340.java
deleted file mode 100644
index 26e5f3b2b5d..00000000000
--- a/solutions/3340. Check Balanced String/3340.java	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution {
-  public boolean isBalanced(String num) {
-    int balance = 0;
-    int sign = 1;
-
-    for (final char c : num.toCharArray()) {
-      balance += sign * (c - '0');
-      sign *= -1;
-    }
-
-    return balance == 0;
-  }
-}
diff --git a/solutions/3340. Check Balanced String/3340.py b/solutions/3340. Check Balanced String/3340.py
deleted file mode 100644
index 4e90562e63d..00000000000
--- a/solutions/3340. Check Balanced String/3340.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def isBalanced(self, num: str) -> bool:
-    nums = list(map(int, num))
-    return sum(nums[::2]) == sum(nums[1::2])
diff --git a/solutions/3341. Find Minimum Time to Reach Last Room I/3341.cpp b/solutions/3341. Find Minimum Time to Reach Last Room I/3341.cpp
deleted file mode 100644
index 6b3c42d2919..00000000000
--- a/solutions/3341. Find Minimum Time to Reach Last Room I/3341.cpp	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution {
- public:
-  int minTimeToReach(vector<vector<int>>& moveTime) {
-    return dijkstra(moveTime, {0, 0},
-                    {moveTime.size() - 1, moveTime[0].size() - 1});
-  }
-
- private:
-  int dijkstra(const vector<vector<int>>& moveTime, const pair<int, int>& src,
-               const pair<int, int>& dst) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-    const int m = moveTime.size();
-    const int n = moveTime[0].size();
-    vector<vector<int>> dist(m, vector<int>(n, INT_MAX));
-
-    dist[0][0] = 0;
-    using T = pair<int, pair<int, int>>;  // (d, u)
-    priority_queue<T, vector<T>, greater<>> minHeap;
-    minHeap.push({dist[0][0], src});
-
-    while (!minHeap.empty()) {
-      const auto [d, u] = minHeap.top();
-      minHeap.pop();
-      if (u == dst)
-        return d;
-      const auto [i, j] = u;
-      if (d > dist[i][j])
-        continue;
-      for (const auto& [dx, dy] : kDirs) {
-        const int x = i + dx;
-        const int y = j + dy;
-        if (x < 0 || x == m || y < 0 || y == n)
-          continue;
-        const int newDist = max(moveTime[x][y], d) + 1;
-        if (newDist < dist[x][y]) {
-          dist[x][y] = newDist;
-          minHeap.push({newDist, {x, y}});
-        }
-      }
-    }
-
-    return -1;
-  }
-};
diff --git a/solutions/3341. Find Minimum Time to Reach Last Room I/3341.java b/solutions/3341. Find Minimum Time to Reach Last Room I/3341.java
deleted file mode 100644
index 26895be53a9..00000000000
--- a/solutions/3341. Find Minimum Time to Reach Last Room I/3341.java	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution {
-  public int minTimeToReach(int[][] moveTime) {
-    return dijkstra(moveTime, new Pair<>(0, 0),
-                    new Pair<>(moveTime.length - 1, moveTime[0].length - 1));
-  }
-
-  private int dijkstra(int[][] moveTime, Pair<Integer, Integer> src, Pair<Integer, Integer> dst) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-    final int m = moveTime.length;
-    final int n = moveTime[0].length;
-    int[][] dist = new int[m][n];
-    Arrays.stream(dist).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE));
-
-    dist[0][0] = 0;
-    Queue<Pair<Integer, Pair<Integer, Integer>>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey)) {
-          { offer(new Pair<>(dist[0][0], src)); } // (d, u)
-        };
-
-    while (!minHeap.isEmpty()) {
-      final int d = minHeap.peek().getKey();
-      final Pair<Integer, Integer> u = minHeap.poll().getValue();
-      if (u.equals(dst))
-        return d;
-      final int i = u.getKey();
-      final int j = u.getValue();
-      if (d > dist[i][j])
-        continue;
-      for (int[] dir : DIRS) {
-        final int x = i + dir[0];
-        final int y = j + dir[1];
-        if (x < 0 || x == m || y < 0 || y == n)
-          continue;
-        final int newDist = Math.max(moveTime[x][y], d) + 1;
-        if (newDist < dist[x][y]) {
-          dist[x][y] = newDist;
-          minHeap.offer(new Pair<>(newDist, new Pair<>(x, y)));
-        }
-      }
-    }
-
-    return -1;
-  }
-}
diff --git a/solutions/3341. Find Minimum Time to Reach Last Room I/3341.py b/solutions/3341. Find Minimum Time to Reach Last Room I/3341.py
deleted file mode 100644
index eaa93b82252..00000000000
--- a/solutions/3341. Find Minimum Time to Reach Last Room I/3341.py	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution:
-  def minTimeToReach(self, moveTime: list[list[int]]) -> int:
-    return self._dijkstra(moveTime,
-                          (0, 0), (len(moveTime) - 1, len(moveTime[0]) - 1))
-
-  def _dijkstra(
-      self,
-      moveTime: list[list[int]],
-      src: tuple[int, int],
-      dst: tuple[int, int]
-  ) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
-    m = len(moveTime)
-    n = len(moveTime[0])
-    dist = [[math.inf] * n for _ in range(m)]
-
-    dist[0][0] = 0
-    minHeap = [(0, src)]  # (d, u)
-
-    while minHeap:
-      d, u = heapq.heappop(minHeap)
-      if u == dst:
-        return d
-      i, j = u
-      if d > dist[i][j]:
-        continue
-      for dx, dy in DIRS:
-        x = i + dx
-        y = j + dy
-        if x < 0 or x == m or y < 0 or y == n:
-          continue
-        newDist = max(moveTime[x][y], d) + 1
-        if newDist < dist[x][y]:
-          dist[x][y] = newDist
-          heapq.heappush(minHeap, (newDist, (x, y)))
-
-    return -1
diff --git a/solutions/3342. Find Minimum Time to Reach Last Room II/3342.cpp b/solutions/3342. Find Minimum Time to Reach Last Room II/3342.cpp
deleted file mode 100644
index 8540137f81e..00000000000
--- a/solutions/3342. Find Minimum Time to Reach Last Room II/3342.cpp	
+++ /dev/null
@@ -1,45 +0,0 @@
-class Solution {
- public:
-  // Similar to 3341. Find Minimum Time to Reach Last Room I
-  int minTimeToReach(vector<vector<int>>& moveTime) {
-    return dijkstra(moveTime, {0, 0},
-                    {moveTime.size() - 1, moveTime[0].size() - 1});
-  }
-
- private:
-  int dijkstra(const vector<vector<int>>& moveTime, const pair<int, int>& src,
-               const pair<int, int>& dst) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-    const int m = moveTime.size();
-    const int n = moveTime[0].size();
-    vector<vector<int>> dist(m, vector<int>(n, INT_MAX));
-
-    dist[0][0] = 0;
-    using T = pair<int, pair<int, int>>;  // (d, (ux, uy))
-    priority_queue<T, vector<T>, greater<>> minHeap;
-    minHeap.push({dist[0][0], src});
-
-    while (!minHeap.empty()) {
-      const auto [d, u] = minHeap.top();
-      minHeap.pop();
-      if (u == dst)
-        return d;
-      const auto [i, j] = u;
-      if (d > dist[i][j])
-        continue;
-      for (const auto& [dx, dy] : kDirs) {
-        const int x = i + dx;
-        const int y = j + dy;
-        if (x < 0 || x == m || y < 0 || y == n)
-          continue;
-        const int newDist = max(moveTime[x][y], d) + ((i + j) % 2 + 1);
-        if (newDist < dist[x][y]) {
-          dist[x][y] = newDist;
-          minHeap.push({newDist, {x, y}});
-        }
-      }
-    }
-
-    return -1;
-  }
-};
diff --git a/solutions/3342. Find Minimum Time to Reach Last Room II/3342.java b/solutions/3342. Find Minimum Time to Reach Last Room II/3342.java
deleted file mode 100644
index c628164c54f..00000000000
--- a/solutions/3342. Find Minimum Time to Reach Last Room II/3342.java	
+++ /dev/null
@@ -1,45 +0,0 @@
-class Solution {
-  // Similar to 3341. Find Minimum Time to Reach Last Room I
-  public int minTimeToReach(int[][] moveTime) {
-    return dijkstra(moveTime, new Pair<>(0, 0),
-                    new Pair<>(moveTime.length - 1, moveTime[0].length - 1));
-  }
-
-  private int dijkstra(int[][] moveTime, Pair<Integer, Integer> src, Pair<Integer, Integer> dst) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-    final int m = moveTime.length;
-    final int n = moveTime[0].length;
-    int[][] dist = new int[m][n];
-    Arrays.stream(dist).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE));
-
-    dist[0][0] = 0;
-    Queue<Pair<Integer, Pair<Integer, Integer>>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey)) {
-          { offer(new Pair<>(dist[0][0], src)); } // (d, (ux, uy))
-        };
-
-    while (!minHeap.isEmpty()) {
-      final int d = minHeap.peek().getKey();
-      final Pair<Integer, Integer> u = minHeap.poll().getValue();
-      if (u.equals(dst))
-        return d;
-      final int i = u.getKey();
-      final int j = u.getValue();
-      if (d > dist[i][j])
-        continue;
-      for (int[] dir : DIRS) {
-        final int x = i + dir[0];
-        final int y = j + dir[1];
-        if (x < 0 || x == m || y < 0 || y == n)
-          continue;
-        final int newDist = Math.max(moveTime[x][y], d) + ((i + j) % 2 + 1);
-        if (newDist < dist[x][y]) {
-          dist[x][y] = newDist;
-          minHeap.offer(new Pair<>(newDist, new Pair<>(x, y)));
-        }
-      }
-    }
-
-    return -1;
-  }
-}
diff --git a/solutions/3342. Find Minimum Time to Reach Last Room II/3342.py b/solutions/3342. Find Minimum Time to Reach Last Room II/3342.py
deleted file mode 100644
index 5b96e44e525..00000000000
--- a/solutions/3342. Find Minimum Time to Reach Last Room II/3342.py	
+++ /dev/null
@@ -1,39 +0,0 @@
-class Solution:
-  # Similar to 3341. Find Minimum Time to Reach Last Room I
-  def minTimeToReach(self, moveTime: list[list[int]]) -> int:
-    return self._dijkstra(moveTime,
-                          (0, 0),
-                          (len(moveTime) - 1, len(moveTime[0]) - 1))
-
-  def _dijkstra(
-      self,
-      moveTime: list[list[int]],
-      src: tuple[int, int],
-      dst: tuple[int, int]
-  ) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
-    m = len(moveTime)
-    n = len(moveTime[0])
-    dist = [[math.inf] * n for _ in range(m)]
-
-    dist[0][0] = 0
-    minHeap = [(0, src)]  # (d, (ux, uy))
-
-    while minHeap:
-      d, u = heapq.heappop(minHeap)
-      if u == dst:
-        return d
-      i, j = u
-      if d > dist[i][j]:
-        continue
-      for dx, dy in DIRS:
-        x = i + dx
-        y = j + dy
-        if x < 0 or x == m or y < 0 or y == n:
-          continue
-        newDist = max(moveTime[x][y], d) + (i + j) % 2 + 1
-        if newDist < dist[x][y]:
-          dist[x][y] = newDist
-          heapq.heappush(minHeap, (newDist, (x, y)))
-
-    return -1
diff --git a/solutions/3343. Count Number of Balanced Permutations/3343.cpp b/solutions/3343. Count Number of Balanced Permutations/3343.cpp
deleted file mode 100644
index b5ed2970e4c..00000000000
--- a/solutions/3343. Count Number of Balanced Permutations/3343.cpp	
+++ /dev/null
@@ -1,93 +0,0 @@
-class Solution {
- public:
-  int countBalancedPermutations(string num) {
-    vector<int> nums = getNums(num);
-    const int sum = accumulate(nums.begin(), nums.end(), 0);
-    if (sum % 2 == 1)
-      return 0;
-
-    ranges::sort(nums, greater<>());
-
-    const int even = (nums.size() + 1) / 2;
-    const int odd = nums.size() / 2;
-    const int evenBalance = sum / 2;
-    vector<vector<vector<long>>> mem(
-        even + 1,
-        vector<vector<long>>(odd + 1, vector<long>(evenBalance + 1, -1)));
-    const long perm = getPerm(nums);
-    return countBalancedPermutations(nums, even, odd, evenBalance, mem) *
-           modInverse(perm) % kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Returns the number of permutations where there are `even` even indices
-  // left, `odd` odd indices left, and `evenBalance` is the target sum of the
-  // remaining numbers to be placed in even indices.
-  long countBalancedPermutations(const vector<int>& nums, int even, int odd,
-                                 int evenBalance,
-                                 vector<vector<vector<long>>>& mem) {
-    if (evenBalance < 0)
-      return 0;
-    if (even == 0)
-      return evenBalance == 0 ? factorial(odd) : 0;
-    const int index = nums.size() - (even + odd);
-    if (odd == 0) {
-      long remainingSum = 0;
-      for (int i = index; i < nums.size(); ++i)
-        remainingSum += nums[i];
-      return (remainingSum == evenBalance) ? factorial(even) : 0;
-    }
-    if (mem[even][odd][evenBalance] != -1)
-      return mem[even][odd][evenBalance];
-    const long placeEven =
-        countBalancedPermutations(nums, even - 1, odd,
-                                  evenBalance - nums[index], mem) *
-        even % kMod;
-    const long placeOdd =
-        countBalancedPermutations(nums, even, odd - 1, evenBalance, mem) * odd %
-        kMod;
-    return mem[even][odd][evenBalance] = (placeEven + placeOdd) % kMod;
-  }
-
-  vector<int> getNums(const string& num) {
-    vector<int> nums;
-    for (const char c : num)
-      nums.push_back(c - '0');
-    return nums;
-  }
-
-  long getPerm(const vector<int>& nums) {
-    long res = 1;
-    vector<int> count(10);
-    for (const int num : nums)
-      ++count[num];
-    for (const int freq : count)
-      res = res * factorial(freq) % kMod;
-    return res;
-  }
-
-  long factorial(int n) {
-    long res = 1;
-    for (int i = 2; i <= n; ++i)
-      res = res * i % kMod;
-    return res;
-  }
-
-  long modInverse(long a) {
-    long m = kMod;
-    long y = 0;
-    long x = 1;
-    while (a > 1) {
-      const long q = a / m;
-      long t = m;
-      m = a % m;
-      a = t;
-      t = y;
-      y = x - q * y;
-      x = t;
-    }
-    return x < 0 ? x + kMod : x;
-  }
-};
diff --git a/solutions/3343. Count Number of Balanced Permutations/3343.java b/solutions/3343. Count Number of Balanced Permutations/3343.java
deleted file mode 100644
index d15d1e209e5..00000000000
--- a/solutions/3343. Count Number of Balanced Permutations/3343.java	
+++ /dev/null
@@ -1,99 +0,0 @@
-class Solution {
-  public int countBalancedPermutations(String num) {
-    int[] nums = getNums(num);
-    final int sum = Arrays.stream(nums).sum();
-    if (sum % 2 == 1)
-      return 0;
-
-    Arrays.sort(nums);
-    reverse(nums, 0, nums.length - 1);
-
-    final int even = (nums.length + 1) / 2;
-    final int odd = nums.length / 2;
-    final int evenBalance = sum / 2;
-    Long[][][] mem = new Long[even + 1][odd + 1][evenBalance + 1];
-    final long perm = getPerm(nums);
-    return (
-        int) ((countBalancedPermutations(nums, even, odd, evenBalance, mem) * modInverse(perm)) %
-              MOD);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  // Returns the number of permutations where there are `even` even indices
-  // left, `odd` odd indices left, and `evenBalance` is the target sum of the
-  // remaining numbers to be placed in even indices.
-  private long countBalancedPermutations(int[] nums, int even, int odd, int evenBalance,
-                                         Long[][][] mem) {
-    if (evenBalance < 0)
-      return 0;
-    if (even == 0)
-      return evenBalance == 0 ? factorial(odd) : 0;
-    final int index = nums.length - (even + odd);
-    if (odd == 0) {
-      long remainingSum = 0;
-      for (int i = index; i < nums.length; ++i)
-        remainingSum += nums[i];
-      return remainingSum == evenBalance ? factorial(even) : 0;
-    }
-    if (mem[even][odd][evenBalance] != null)
-      return mem[even][odd][evenBalance];
-    final long placeEven =
-        countBalancedPermutations(nums, even - 1, odd, evenBalance - nums[index], mem) * even % MOD;
-    final long placeOdd =
-        countBalancedPermutations(nums, even, odd - 1, evenBalance, mem) * odd % MOD;
-    return mem[even][odd][evenBalance] = (placeEven + placeOdd) % MOD;
-  }
-
-  private int[] getNums(String num) {
-    int[] nums = new int[num.length()];
-    for (int i = 0; i < num.length(); ++i)
-      nums[i] = num.charAt(i) - '0';
-    return nums;
-  }
-
-  private long getPerm(int[] nums) {
-    long res = 1;
-    int[] count = new int[10];
-    for (final int num : nums)
-      ++count[num];
-    for (final int freq : count)
-      res = res * factorial(freq) % MOD;
-    return res;
-  }
-
-  private long factorial(int n) {
-    long res = 1;
-    for (int i = 2; i <= n; ++i)
-      res = res * i % MOD;
-    return res;
-  }
-
-  private long modInverse(long a) {
-    long m = MOD;
-    long y = 0;
-    long x = 1;
-    while (a > 1) {
-      final long q = a / m;
-      long t = m;
-      m = a % m;
-      a = t;
-      t = y;
-      y = x - q * y;
-      x = t;
-    }
-
-    return x < 0 ? x + MOD : x;
-  }
-
-  private void reverse(int[] nums, int l, int r) {
-    while (l < r)
-      swap(nums, l++, r--);
-  }
-
-  private void swap(int[] nums, int i, int j) {
-    final int temp = nums[i];
-    nums[i] = nums[j];
-    nums[j] = temp;
-  }
-}
diff --git a/solutions/3343. Count Number of Balanced Permutations/3343.py b/solutions/3343. Count Number of Balanced Permutations/3343.py
deleted file mode 100644
index 0613a0da99a..00000000000
--- a/solutions/3343. Count Number of Balanced Permutations/3343.py	
+++ /dev/null
@@ -1,31 +0,0 @@
-class Solution:
-  def countBalancedPermutations(self, num: str) -> int:
-    nums = list(map(int, num))
-    summ = sum(nums)
-    if summ % 2 == 1:
-      return 0
-
-    nums.sort(reverse=True)
-
-    @functools.lru_cache(None)
-    def dp(even: int, odd: int, evenBalance: int) -> int:
-      """
-      Returns the number of permutations where there are `even` even indices
-      left, `odd` odd indices left, and `evenBalance` is the target sum of the
-      remaining numbers to be placed in even indices.
-      """
-      if evenBalance < 0:
-        return 0
-      if even == 0:
-        return (evenBalance == 0) * math.factorial(odd)
-      if odd == 0:
-        return (sum(nums[-(even + odd):]) == evenBalance) * math.factorial(even)
-      return (dp(even - 1, odd, evenBalance - nums[-(odd + even)]) * even +
-              dp(even, odd - 1, evenBalance) * odd)
-
-    MOD = 1_000_000_007
-    perm = functools.reduce(lambda x, y: x * math.factorial(y),
-                            collections.Counter(nums).values(), 1)
-    return (dp(even=(len(nums) + 1) // 2,
-               odd=len(nums) // 2,
-               evenBalance=summ // 2) // perm) % MOD
diff --git a/solutions/3344. Maximum Sized Array/3344.cpp b/solutions/3344. Maximum Sized Array/3344.cpp
deleted file mode 100644
index 785ebc7dce8..00000000000
--- a/solutions/3344. Maximum Sized Array/3344.cpp	
+++ /dev/null
@@ -1,56 +0,0 @@
-class Solution {
- public:
-  int maxSizedArray(long long s) {
-    if (s == 0)
-      return 1;
-
-    int l = 0;
-    int r = 1196;  // when s = 10^15, n = 1196
-
-    while (l < r) {
-      const int m = (l + r + 1) / 2;
-      if (getArraySum(m) <= s)
-        l = m;
-      else
-        r = m - 1;
-    }
-
-    return l;
-  }
-
- private:
-  // Returns the number of integers in [0, n - 1] with the i-th bit set.
-  //
-  // For the i-th bit, numbers in the range [0, n - 1] can be divided into
-  // groups of 2^(i + 1) numbers. In each group, exactly half of the numbers
-  // have the i-th bit set.
-  int getNumbersWithBitSet(int n, int i) {
-    const int groupSize = 1 << (i + 1);
-    const int halfGroupSize = 1 << i;
-    const int fullGroups = n / groupSize;
-    const int remaining = max(0, (n % groupSize) - halfGroupSize);
-    return fullGroups * halfGroupSize + remaining;
-  }
-
-  // Returns the sum of all i * (j OR k) values in 3D arrays of size n^3.
-  //
-  //   sum(i * (j OR k)), where 0 <= i, j, k < n
-  // = 0 * (j OR k) + 1 * (j OR k) + ... + (n - 1) * (j OR k)
-  // = (0 + 1 + ... + n - 1) * sum(j OR k)
-  // = (n * (n - 1) / 2) * sum(j OR k)
-  long getArraySum(int n) {
-    const int arithmeticSum = n * (n - 1) / 2;
-    long orSum = 0;
-    for (int i = 0; i < bitLength(n); ++i) {
-      const int numbersWituoutBit = n - getNumbersWithBitSet(n, i);
-      const int pairsWithBit =
-          (n * n) - (numbersWituoutBit * numbersWituoutBit);
-      orSum += pairsWithBit * (1L << i);
-    }
-    return arithmeticSum * orSum;
-  }
-
-  int bitLength(int n) {
-    return 32 - __builtin_clz(n);
-  }
-};
diff --git a/solutions/3344. Maximum Sized Array/3344.java b/solutions/3344. Maximum Sized Array/3344.java
deleted file mode 100644
index c53c08d96d5..00000000000
--- a/solutions/3344. Maximum Sized Array/3344.java	
+++ /dev/null
@@ -1,53 +0,0 @@
-class Solution {
-  public int maxSizedArray(long s) {
-    if (s == 0)
-      return 1;
-
-    int l = 0;
-    int r = 1196; // when s = 10^15, n = 1196
-
-    while (l < r) {
-      final int m = (l + r + 1) / 2;
-      if (getArraySum(m) <= s)
-        l = m;
-      else
-        r = m - 1;
-    }
-
-    return l;
-  }
-
-  // Returns the number of integers in [0, n - 1] with the i-th bit set.
-  //
-  // For the i-th bit, numbers in the range [0, n - 1] can be divided into
-  // groups of 2^(i + 1) numbers. In each group, exactly half of the numbers
-  // have the i-th bit set.
-  private int getNumbersWithBitSet(int n, int i) {
-    final int groupSize = 1 << (i + 1);
-    final int halfGroupSize = 1 << i;
-    final int fullGroups = n / groupSize;
-    final int remaining = Math.max(0, (n % groupSize) - halfGroupSize);
-    return fullGroups * halfGroupSize + remaining;
-  }
-
-  // Returns the sum of all i * (j OR k) values in 3D arrays of size n^3.
-  //
-  //   sum(i * (j OR k)), where 0 <= i, j, k < n
-  // = 0 * (j OR k) + 1 * (j OR k) + ... + (n - 1) * (j OR k)
-  // = (0 + 1 + ... + n - 1) * sum(j OR k)
-  // = (n * (n - 1) / 2) * sum(j OR k)
-  private long getArraySum(int n) {
-    final int arithmeticSum = n * (n - 1) / 2;
-    long orSum = 0;
-    for (int i = 0; i < bitLength(n); i++) {
-      int numbersWithoutBit = n - getNumbersWithBitSet(n, i);
-      long pairsWithBit = (long) n * n - (long) numbersWithoutBit * numbersWithoutBit;
-      orSum += pairsWithBit * (1L << i);
-    }
-    return arithmeticSum * orSum;
-  }
-
-  private int bitLength(int n) {
-    return 32 - Integer.numberOfLeadingZeros(n);
-  }
-}
diff --git a/solutions/3344. Maximum Sized Array/3344.py b/solutions/3344. Maximum Sized Array/3344.py
deleted file mode 100644
index 2fff323667f..00000000000
--- a/solutions/3344. Maximum Sized Array/3344.py	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution:
-  def maxSizedArray(self, s: int) -> int:
-    def getNumbersWithBitSet(n: int, i: int) -> int:
-      """
-      Returns the number of integers in [0, n - 1] with the i-th bit set.
-
-      For the i-th bit, numbers in the range [0, n - 1] can be divided into
-      groups of 2^(i + 1) numbers. In each group, exactly half of the numbers
-      have the i-th bit set.
-      """
-      groupSize = 1 << (i + 1)
-      halfGroupSize = 1 << i
-      fullGroups = n // groupSize
-      remaining = max(0, (n % groupSize) - halfGroupSize)
-      return fullGroups * halfGroupSize + remaining
-
-    def getArraySum(n: int) -> int:
-      """
-      Returns the sum of all i * (j OR k) values in 3D arrays of size n^3.
-
-        sum(i * (j OR k)), where 0 <= i, j, k < n
-      = 0 * (j OR k) + 1 * (j OR k) + ... + (n - 1) * (j OR k)
-      = (0 + 1 + ... + n - 1) * sum(j OR k)
-      = (n * (n - 1) / 2) * sum(j OR k)
-      """
-      arithmeticSum = n * (n - 1) // 2  # 0 + 1 + ... + n - 1
-      orSum = 0  # the sum of (j OR k) values in 2D arrays of size n^2
-      for i in range(n.bit_length()):
-        numbersWithoutBit = n - getNumbersWithBitSet(n, i)
-        pairsWithBit = n**2 - numbersWithoutBit**2
-        orSum += pairsWithBit * (1 << i)  # Add contribution of this bit.
-      return arithmeticSum * orSum
-
-    if s == 0:
-      return 1
-    l = 0
-    r = 1196  # when s = 10^15, n = 1196
-    return bisect.bisect_right(range(l, r + 1), s, key=getArraySum) - 1 + l
diff --git a/solutions/3345. Smallest Divisible Digit Product I/3345.cpp b/solutions/3345. Smallest Divisible Digit Product I/3345.cpp
deleted file mode 100644
index 56272fdf24e..00000000000
--- a/solutions/3345. Smallest Divisible Digit Product I/3345.cpp	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
- public:
-  int smallestNumber(int n, int t) {
-    for (int num = n; num < n + 10; ++num)
-      if (getDigitProd(num) % t == 0)
-        return num;
-    throw;
-  }
-
- private:
-  int getDigitProd(int num) {
-    int digitProd = 1;
-    while (num > 0) {
-      digitProd *= num % 10;
-      num /= 10;
-    }
-    return digitProd;
-  }
-};
diff --git a/solutions/3345. Smallest Divisible Digit Product I/3345.java b/solutions/3345. Smallest Divisible Digit Product I/3345.java
deleted file mode 100644
index 2183c9e3a96..00000000000
--- a/solutions/3345. Smallest Divisible Digit Product I/3345.java	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
-  public int smallestNumber(int n, int t) {
-    for (int num = n; num < n + 10; ++num)
-      if (getDigitProd(num) % t == 0)
-        return num;
-    throw new IllegalArgumentException();
-  }
-
-  private int getDigitProd(int num) {
-    int digitProd = 1;
-    while (num > 0) {
-      digitProd *= num % 10;
-      num /= 10;
-    }
-    return digitProd;
-  }
-}
diff --git a/solutions/3345. Smallest Divisible Digit Product I/3345.py b/solutions/3345. Smallest Divisible Digit Product I/3345.py
deleted file mode 100644
index 9e06be210d6..00000000000
--- a/solutions/3345. Smallest Divisible Digit Product I/3345.py	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution:
-  def smallestNumber(self, n: int, t: int) -> int:
-    return next(num for num in range(n, n + 10)
-                if self._getDigitProd(num) % t == 0)
-
-  def _getDigitProd(self, num: int) -> int:
-    digitProd = 1
-    while num > 0:
-      digitProd *= num % 10
-      num //= 10
-    return digitProd
diff --git a/solutions/3346. Maximum Frequency of an Element After Performing Operations I/3346.cpp b/solutions/3346. Maximum Frequency of an Element After Performing Operations I/3346.cpp
deleted file mode 100644
index 90e5e9bd175..00000000000
--- a/solutions/3346. Maximum Frequency of an Element After Performing Operations I/3346.cpp	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
- public:
-  int maxFrequency(vector<int>& nums, int k, int numOperations) {
-    int ans = 1;
-    int adjustable = 0;
-    unordered_map<int, int> count;
-    map<int, int> line;
-    set<int> candidates;
-
-    for (const int num : nums) {
-      ++count[num];
-      ++line[num - k];
-      --line[num + k + 1];
-      candidates.insert(num);
-      candidates.insert(num - k);
-      candidates.insert(num + k + 1);
-    }
-
-    for (const int num : candidates) {
-      adjustable += line.contains(num) ? line[num] : 0;
-      const int countNum = count.contains(num) ? count[num] : 0;
-      const int adjusted = adjustable - countNum;
-      ans = max(ans, countNum + min(numOperations, adjusted));
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3346. Maximum Frequency of an Element After Performing Operations I/3346.java b/solutions/3346. Maximum Frequency of an Element After Performing Operations I/3346.java
deleted file mode 100644
index bf0fefa15a1..00000000000
--- a/solutions/3346. Maximum Frequency of an Element After Performing Operations I/3346.java	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution {
-  public int maxFrequency(int[] nums, int k, int numOperations) {
-    int ans = 1;
-    int adjustable = 0;
-    Map<Integer, Integer> count = new HashMap<>();
-    TreeMap<Integer, Integer> line = new TreeMap<>();
-    TreeSet<Integer> candidates = new TreeSet<>();
-
-    for (final int num : nums) {
-      count.merge(num, 1, Integer::sum);
-      line.merge(num - k, 1, Integer::sum);
-      line.merge(num + k + 1, -1, Integer::sum);
-      candidates.add(num);
-      candidates.add(num - k);
-      candidates.add(num + k + 1);
-    }
-
-    for (final int num : candidates) {
-      adjustable += line.getOrDefault(num, 0);
-      final int countNum = count.getOrDefault(num, 0);
-      final int adjusted = adjustable - countNum;
-      ans = Math.max(ans, countNum + Math.min(numOperations, adjusted));
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3346. Maximum Frequency of an Element After Performing Operations I/3346.py b/solutions/3346. Maximum Frequency of an Element After Performing Operations I/3346.py
deleted file mode 100644
index 77407c47da7..00000000000
--- a/solutions/3346. Maximum Frequency of an Element After Performing Operations I/3346.py	
+++ /dev/null
@@ -1,24 +0,0 @@
-from sortedcontainers import SortedDict
-
-
-class Solution:
-  def maxFrequency(self, nums: list[int], k: int, numOperations: int) -> int:
-    ans = 1
-    adjustable = 0
-    count = collections.Counter(nums)
-    line = SortedDict()
-    candidates = set()
-
-    for num in nums:
-      line[num - k] = line.get(num - k, 0) + 1
-      line[num + k + 1] = line.get(num + k + 1, 0) - 1
-      candidates.add(num)
-      candidates.add(num - k)
-      candidates.add(num + k + 1)
-
-    for num in sorted(candidates):
-      adjustable += line.get(num, 0)
-      adjusted = adjustable - count[num]
-      ans = max(ans, count[num] + min(numOperations, adjusted))
-
-    return ans
diff --git a/solutions/3347. Maximum Frequency of an Element After Performing Operations II/3347.cpp b/solutions/3347. Maximum Frequency of an Element After Performing Operations II/3347.cpp
deleted file mode 100644
index 8082e05805f..00000000000
--- a/solutions/3347. Maximum Frequency of an Element After Performing Operations II/3347.cpp	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution {
- public:
-  // Same as 3346. Maximum Frequency of an Element After Performing Operations I
-  int maxFrequency(vector<int>& nums, int k, int numOperations) {
-    int ans = 1;
-    int adjustable = 0;
-    unordered_map<int, int> count;
-    map<int, int> line;
-    set<int> candidates;
-
-    for (const int num : nums) {
-      ++count[num];
-      ++line[num - k];
-      --line[num + k + 1];
-      candidates.insert(num);
-      candidates.insert(num - k);
-      candidates.insert(num + k + 1);
-    }
-
-    for (const int num : candidates) {
-      adjustable += line.contains(num) ? line[num] : 0;
-      const int countNum = count.contains(num) ? count[num] : 0;
-      const int adjusted = adjustable - countNum;
-      ans = max(ans, countNum + min(numOperations, adjusted));
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3347. Maximum Frequency of an Element After Performing Operations II/3347.java b/solutions/3347. Maximum Frequency of an Element After Performing Operations II/3347.java
deleted file mode 100644
index 529b8686d13..00000000000
--- a/solutions/3347. Maximum Frequency of an Element After Performing Operations II/3347.java	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
-  // Same as 3346. Maximum Frequency of an Element After Performing Operations I
-  public int maxFrequency(int[] nums, int k, int numOperations) {
-    int ans = 1;
-    int adjustable = 0;
-    Map<Integer, Integer> count = new HashMap<>();
-    TreeMap<Integer, Integer> line = new TreeMap<>();
-    TreeSet<Integer> candidates = new TreeSet<>();
-
-    for (final int num : nums) {
-      count.merge(num, 1, Integer::sum);
-      line.merge(num - k, 1, Integer::sum);
-      line.merge(num + k + 1, -1, Integer::sum);
-      candidates.add(num);
-      candidates.add(num - k);
-      candidates.add(num + k + 1);
-    }
-
-    for (final int num : candidates) {
-      adjustable += line.getOrDefault(num, 0);
-      final int countNum = count.getOrDefault(num, 0);
-      final int adjusted = adjustable - countNum;
-      ans = Math.max(ans, countNum + Math.min(numOperations, adjusted));
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3347. Maximum Frequency of an Element After Performing Operations II/3347.py b/solutions/3347. Maximum Frequency of an Element After Performing Operations II/3347.py
deleted file mode 100644
index 1225d403acf..00000000000
--- a/solutions/3347. Maximum Frequency of an Element After Performing Operations II/3347.py	
+++ /dev/null
@@ -1,25 +0,0 @@
-from sortedcontainers import SortedDict
-
-
-class Solution:
-  # Same as 3346. Maximum Frequency of an Element After Performing Operations I
-  def maxFrequency(self, nums: list[int], k: int, numOperations: int) -> int:
-    ans = 1
-    adjustable = 0
-    count = collections.Counter(nums)
-    line = SortedDict()
-    candidates = set()
-
-    for num in nums:
-      line[num - k] = line.get(num - k, 0) + 1
-      line[num + k + 1] = line.get(num + k + 1, 0) - 1
-      candidates.add(num)
-      candidates.add(num - k)
-      candidates.add(num + k + 1)
-
-    for num in sorted(candidates):
-      adjustable += line.get(num, 0)
-      adjusted = adjustable - count[num]
-      ans = max(ans, count[num] + min(numOperations, adjusted))
-
-    return ans
diff --git a/solutions/3348. Smallest Divisible Digit Product II/3348.cpp b/solutions/3348. Smallest Divisible Digit Product II/3348.cpp
deleted file mode 100644
index 4cf68b0b3f0..00000000000
--- a/solutions/3348. Smallest Divisible Digit Product II/3348.cpp	
+++ /dev/null
@@ -1,140 +0,0 @@
-class Solution {
- public:
-  string smallestNumber(string num, long long t) {
-    const auto [primeCount, isDivisible] = getPrimeCount(t);
-    if (!isDivisible)
-      return "-1";
-
-    const unordered_map<int, int> factorCount = getFactorCount(primeCount);
-    if (sumValues(factorCount) > num.length())
-      return consturct(factorCount);
-
-    unordered_map<int, int> primeCountPrefix = getPrimeCount(num);
-    int firstZeroIndex = num.find('0');
-    if (firstZeroIndex == string::npos) {
-      firstZeroIndex = num.length();
-      if (isSubset(primeCount, primeCountPrefix))
-        return num;
-    }
-
-    for (int i = num.length() - 1; i >= 0; --i) {
-      const int d = num[i] - '0';
-      // Remove the current digit's factors from primeCountPrefix.
-      primeCountPrefix = substract(primeCountPrefix, kFactorCounts.at(d));
-      const int spaceAfterThisDigit = num.length() - 1 - i;
-      if (i > firstZeroIndex)
-        continue;
-      for (int biggerDigit = d + 1; biggerDigit < 10; ++biggerDigit) {
-        // Compute the required factors after replacing with a larger digit.
-        const unordered_map<int, int> factorsAfterReplacement =
-            getFactorCount(substract(substract(primeCount, primeCountPrefix),
-                                     kFactorCounts.at(biggerDigit)));
-        // Check if the replacement is possible within the available space.
-        if (sumValues(factorsAfterReplacement) <= spaceAfterThisDigit) {
-          // Fill extra space with '1', if any, and construct the result.
-          const int fillOnes =
-              spaceAfterThisDigit - sumValues(factorsAfterReplacement);
-          return num.substr(0, i) +        // Keep the prefix unchanged.
-                 to_string(biggerDigit) +  // Replace the current digit.
-                 string(fillOnes, '1') +   // Fill remaining space with '1'.
-                 consturct(factorsAfterReplacement);
-        }
-      }
-    }
-
-    // No solution of the same length exists, so we need to extend the number
-    // by prepending '1's and adding the required factors.
-    const unordered_map<int, int> factorsAfterExtension =
-        getFactorCount(primeCount);
-    return string(num.length() + 1 - sumValues(factorsAfterExtension), '1') +
-           consturct(factorsAfterExtension);
-  }
-
- private:
-  constexpr static unordered_map<int, unordered_map<int, int>> kFactorCounts = {
-      {0, {}},       {1, {}},       {2, {{2, 1}}},         {3, {{3, 1}}},
-      {4, {{2, 2}}}, {5, {{5, 1}}}, {6, {{2, 1}, {3, 1}}}, {7, {{7, 1}}},
-      {8, {{2, 3}}}, {9, {{3, 2}}}};
-
-  // Returns the prime count of t and if t is divisible by 2, 3, 5, 7.
-  pair<unordered_map<int, int>, bool> getPrimeCount(long t) {
-    unordered_map<int, int> count{{2, 0}, {3, 0}, {5, 0}, {7, 0}};
-    for (const int prime : {2, 3, 5, 7}) {
-      while (t % prime == 0) {
-        t /= prime;
-        ++count[prime];
-      }
-    }
-    return {count, t == 1};
-  }
-
-  // Returns the prime count of `num`.
-  unordered_map<int, int> getPrimeCount(const string& num) {
-    unordered_map<int, int> count{{2, 0}, {3, 0}, {5, 0}, {7, 0}};
-    for (const char d : num)
-      for (const auto& [prime, freq] : kFactorCounts.at(d - '0'))
-        count[prime] += freq;
-    return count;
-  }
-
-  unordered_map<int, int> getFactorCount(const unordered_map<int, int>& count) {
-    unordered_map<int, int> res;
-    // 2^3 = 8
-    const int count8 = count.at(2) / 3;
-    const int remaining2 = count.at(2) % 3;
-    // 3^2 = 9
-    const int count9 = count.at(3) / 2;
-    int count3 = count.at(3) % 2;
-    // 2^2 = 4
-    int count4 = remaining2 / 2;
-    int count2 = remaining2 % 2;
-    // Combine 2 and 3 to 6 if both are present.
-    int count6 = 0;
-    if (count2 == 1 && count3 == 1) {
-      count2 = 0;
-      count3 = 0;
-      count6 = 1;
-    }
-    // Combine 3 and 4 to 2 and 6 if both are present.
-    if (count3 == 1 && count4 == 1) {
-      count2 = 1;
-      count6 = 1;
-      count3 = 0;
-      count4 = 0;
-    }
-    return unordered_map<int, int>{
-        {2, count2}, {3, count3},      {4, count4}, {5, count.at(5)},
-        {6, count6}, {7, count.at(7)}, {8, count8}, {9, count9}};
-  }
-
-  string consturct(const unordered_map<int, int>& factors) {
-    string res;
-    for (int digit = 2; digit < 10; ++digit)
-      res += string(factors.at(digit), '0' + digit);
-    return res;
-  }
-
-  // Returns true if a is a subset of b.
-  bool isSubset(const unordered_map<int, int>& a,
-                const unordered_map<int, int>& b) {
-    for (const auto& [key, value] : a)
-      if (b.at(key) < value)
-        return false;
-    return true;
-  }
-
-  // Returns a - b.
-  unordered_map<int, int> substract(unordered_map<int, int> a,
-                                    const unordered_map<int, int>& b) {
-    for (const auto& [key, value] : b)
-      a[key] = max(0, a[key] - value);
-    return a;
-  }
-
-  // Returns the sum of the values in `count`.
-  int sumValues(const unordered_map<int, int>& count) {
-    return accumulate(
-        count.begin(), count.end(), 0,
-        [](int acc, const pair<int, int>& p) { return acc + p.second; });
-  }
-};
diff --git a/solutions/3348. Smallest Divisible Digit Product II/3348.java b/solutions/3348. Smallest Divisible Digit Product II/3348.java
deleted file mode 100644
index 3282159821c..00000000000
--- a/solutions/3348. Smallest Divisible Digit Product II/3348.java	
+++ /dev/null
@@ -1,139 +0,0 @@
-class Solution {
-  public String smallestNumber(String num, long t) {
-    Pair<Map<Integer, Integer>, Boolean> primeCountResult = getPrimeCount(t);
-    Map<Integer, Integer> primeCount = primeCountResult.getKey();
-    boolean isDivisible = primeCountResult.getValue();
-    if (!isDivisible)
-      return "-1";
-
-    Map<Integer, Integer> factorCount = getFactorCount(primeCount);
-    if (sumValues(factorCount) > num.length())
-      return construct(factorCount);
-
-    Map<Integer, Integer> primeCountPrefix = getPrimeCount(num);
-    int firstZeroIndex = num.indexOf('0');
-    if (firstZeroIndex == -1) {
-      firstZeroIndex = num.length();
-      if (isSubset(primeCount, primeCountPrefix))
-        return num;
-    }
-
-    for (int i = num.length() - 1; i >= 0; --i) {
-      final int d = num.charAt(i) - '0';
-      // Remove the current digit's factors from primeCountPrefix.
-      primeCountPrefix = subtract(primeCountPrefix, FACTOR_COUNTS.get(d));
-      final int spaceAfterThisDigit = num.length() - 1 - i;
-      if (i > firstZeroIndex)
-        continue;
-      for (int biggerDigit = d + 1; biggerDigit < 10; ++biggerDigit) {
-        // Compute the required factors after replacing with a larger digit.
-        Map<Integer, Integer> factorsAfterReplacement = getFactorCount(
-            subtract(subtract(primeCount, primeCountPrefix), FACTOR_COUNTS.get(biggerDigit)));
-        // Check if the replacement is possible within the available space.
-        if (sumValues(factorsAfterReplacement) <= spaceAfterThisDigit) {
-          // Fill extra space with '1', if any, and construct the result.
-          final int fillOnes = spaceAfterThisDigit - sumValues(factorsAfterReplacement);
-          return num.substring(0, i) + // Keep the prefix unchanged.
-              biggerDigit +            // Replace the current digit.
-              "1".repeat(fillOnes) + // Fill remaining space with '1'.
-              construct(factorsAfterReplacement);
-        }
-      }
-    }
-
-    // No solution of the same length exists, so we need to extend the number
-    // by prepending '1's and adding the required factors.
-    Map<Integer, Integer> factorsAfterExtension = getFactorCount(primeCount);
-    return "1".repeat(num.length() + 1 - sumValues(factorsAfterExtension)) +
-        construct(factorsAfterExtension);
-  }
-
-  private static final Map<Integer, Map<Integer, Integer>> FACTOR_COUNTS = Map.of(
-      0, Map.of(), 1, Map.of(), 2, Map.of(2, 1), 3, Map.of(3, 1), 4, Map.of(2, 2), 5, Map.of(5, 1),
-      6, Map.of(2, 1, 3, 1), 7, Map.of(7, 1), 8, Map.of(2, 3), 9, Map.of(3, 2));
-
-  // Returns the prime count of t and if t is divisible by 2, 3, 5, 7.
-  private Pair<Map<Integer, Integer>, Boolean> getPrimeCount(long t) {
-    Map<Integer, Integer> count = new HashMap<>(Map.of(2, 0, 3, 0, 5, 0, 7, 0));
-    for (int prime : new int[] {2, 3, 5, 7}) {
-      while (t % prime == 0) {
-        t /= prime;
-        count.put(prime, count.get(prime) + 1);
-      }
-    }
-    return new Pair<>(count, t == 1);
-  }
-
-  // Returns the prime count of `num`.
-  private Map<Integer, Integer> getPrimeCount(String num) {
-    Map<Integer, Integer> count = new HashMap<>(Map.of(2, 0, 3, 0, 5, 0, 7, 0));
-    for (final char c : num.toCharArray()) {
-      Map<Integer, Integer> digitFactors = FACTOR_COUNTS.get(c - '0');
-      for (Map.Entry<Integer, Integer> entry : digitFactors.entrySet()) {
-        final int prime = entry.getKey();
-        final int freq = entry.getValue();
-        count.merge(prime, freq, Integer::sum);
-      }
-    }
-    return count;
-  }
-
-  private Map<Integer, Integer> getFactorCount(Map<Integer, Integer> count) {
-    // 2^3 = 8
-    final int count8 = count.get(2) / 3;
-    final int remaining2 = count.get(2) % 3;
-    // 3^2 = 9
-    final int count9 = count.get(3) / 2;
-    int count3 = count.get(3) % 2;
-    // 2^2 = 4
-    int count4 = remaining2 / 2;
-    int count2 = remaining2 % 2;
-    // Combine 2 and 3 to 6 if both are present
-    int count6 = 0;
-    if (count2 == 1 && count3 == 1) {
-      count2 = 0;
-      count3 = 0;
-      count6 = 1;
-    }
-    // Combine 3 and 4 to 2 and 6 if both are present
-    if (count3 == 1 && count4 == 1) {
-      count2 = 1;
-      count6 = 1;
-      count3 = 0;
-      count4 = 0;
-    }
-    return Map.of(2, count2, 3, count3, 4, count4, 5, count.get(5), 6, count6, 7, count.get(7), 8,
-                  count8, 9, count9);
-  }
-
-  private String construct(Map<Integer, Integer> factors) {
-    StringBuilder sb = new StringBuilder();
-    for (int digit = 2; digit < 10; ++digit)
-      sb.append(String.valueOf(digit).repeat(factors.get(digit)));
-    return sb.toString();
-  }
-
-  // Returns true if a is a subset of b.
-  private boolean isSubset(Map<Integer, Integer> a, Map<Integer, Integer> b) {
-    for (Map.Entry<Integer, Integer> entry : a.entrySet())
-      if (b.get(entry.getKey()) < entry.getValue())
-        return false;
-    return true;
-  }
-
-  // Returns a - b.
-  private Map<Integer, Integer> subtract(Map<Integer, Integer> a, Map<Integer, Integer> b) {
-    Map<Integer, Integer> res = new HashMap<>(a);
-    for (Map.Entry<Integer, Integer> entry : b.entrySet()) {
-      final int key = entry.getKey();
-      final int value = entry.getValue();
-      res.put(key, Math.max(0, res.get(key) - value));
-    }
-    return res;
-  }
-
-  // Returns the sum of the values in `count`.
-  private int sumValues(Map<Integer, Integer> count) {
-    return count.values().stream().mapToInt(Integer::intValue).sum();
-  }
-}
diff --git a/solutions/3348. Smallest Divisible Digit Product II/3348.py b/solutions/3348. Smallest Divisible Digit Product II/3348.py
deleted file mode 100644
index 26926ac5508..00000000000
--- a/solutions/3348. Smallest Divisible Digit Product II/3348.py	
+++ /dev/null
@@ -1,87 +0,0 @@
-FACTOR_COUNTS = {
-    0: collections.Counter(),
-    1: collections.Counter(),
-    2: collections.Counter([2]),
-    3: collections.Counter([3]),
-    4: collections.Counter([2, 2]),
-    5: collections.Counter([5]),
-    6: collections.Counter([2, 3]),
-    7: collections.Counter([7]),
-    8: collections.Counter([2, 2, 2]),
-    9: collections.Counter([3, 3]),
-}
-
-
-class Solution:
-  def smallestNumber(self, num: str, t: int) -> str:
-    primeCount, isDivisible = self._getPrimeCount(t)
-    if not isDivisible:
-      return '-1'
-
-    factorCount = self._getFactorCount(primeCount)
-    if sum(factorCount.values()) > len(num):
-      return ''.join(factor * freq for factor, freq in factorCount.items())
-
-    primeCountPrefix = sum((FACTOR_COUNTS[int(c)]
-                            for c in num), start=collections.Counter())
-    firstZeroIndex = next((i for i, d in enumerate(num) if d == '0'), len(num))
-    if firstZeroIndex == len(num) and primeCount <= primeCountPrefix:
-      return num
-
-    for i, c in reversed(list(enumerate(num))):
-      d = int(c)
-      # Remove the current digit's factors from primeCountPrefix.
-      primeCountPrefix -= FACTOR_COUNTS[d]
-      spaceAfterThisDigit = len(num) - 1 - i
-      if i <= firstZeroIndex:
-        for biggerDigit in range(d + 1, 10):
-          # Compute the required factors after replacing with a larger digit.
-          factorsAfterReplacement = self._getFactorCount(
-              primeCount - primeCountPrefix - FACTOR_COUNTS[biggerDigit]
-          )
-          # Check if the replacement is possible within the available space.
-          if sum(factorsAfterReplacement.values()) <= spaceAfterThisDigit:
-            # Fill extra space with '1', if any, and construct the result.
-            fillOnes = spaceAfterThisDigit - sum(
-                factorsAfterReplacement.values())
-            return (
-                num[:i]  # Keep the prefix unchanged.
-                + str(biggerDigit)  # Replace the current digit.
-                + '1' * fillOnes  # Fill remaining space with '1'.
-                + ''.join(factor * freq for factor,
-                          freq in factorsAfterReplacement.items())
-            )
-
-    # No solution of the same length exists, so we need to extend the number
-    # by prepending '1's and adding the required factors.
-    factorCount = self._getFactorCount(primeCount)
-    return (
-        '1' * (len(num) + 1 - sum(factorCount.values()))
-        + ''.join(factor * freq for factor, freq in factorCount.items())
-    )
-
-  def _getPrimeCount(self, t: int) -> tuple[dict[int, int], bool]:
-    """
-    Returns the count of prime factors of t and if t is divisible by 2, 3, 5, 7.
-    """
-    count = collections.Counter()
-    for prime in [2, 3, 5, 7]:
-      while t % prime == 0:
-        t //= prime
-        count[prime] += 1
-    return count, t == 1
-
-  def _getFactorCount(self, count: dict[int, int]) -> dict[str, int]:
-    """Returns the required factors to form the smallest number."""
-    count8, remaining2 = divmod(count[2], 3)  # 2^3 = 8
-    count9, count3 = divmod(count[3], 2)  # 3^2 = 9
-    count4, count2 = divmod(remaining2, 2)  # 2^2 = 4
-    # Combine 2 and 3 to 6 if both are present.
-    count2, count3, count6 = ((0, 0, 1) if count2 == 1 and count3 == 1
-                              else (count2, count3, 0))
-    # Combine 3 and 4 to 2 and 6 if both are present.
-    count2, count6, count3, count4 = ((1, 1, 0, 0)
-                                      if count3 == 1 and count4 == 1
-                                      else (count2, count6, count3, count4))
-    return {'2': count2, '3': count3, '4': count4, '5': count[5],
-            '6': count6, '7': count[7], '8': count8, '9': count9}
diff --git a/solutions/3349. Adjacent Increasing Subarrays Detection I/3349.cpp b/solutions/3349. Adjacent Increasing Subarrays Detection I/3349.cpp
deleted file mode 100644
index afbf2386467..00000000000
--- a/solutions/3349. Adjacent Increasing Subarrays Detection I/3349.cpp	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
- public:
-  bool hasIncreasingSubarrays(vector<int>& nums, int k) {
-    int increasing = 1;
-    int prevIncreasing = 0;
-
-    for (int i = 1; i < nums.size(); ++i) {
-      if (nums[i] > nums[i - 1]) {
-        ++increasing;
-      } else {
-        prevIncreasing = increasing;
-        increasing = 1;
-      }
-      if (increasing / 2 >= k || min(prevIncreasing, increasing) >= k)
-        return true;
-    }
-
-    return false;
-  }
-};
diff --git a/solutions/3349. Adjacent Increasing Subarrays Detection I/3349.java b/solutions/3349. Adjacent Increasing Subarrays Detection I/3349.java
deleted file mode 100644
index efcabde14aa..00000000000
--- a/solutions/3349. Adjacent Increasing Subarrays Detection I/3349.java	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
-  public boolean hasIncreasingSubarrays(List<Integer> nums, int k) {
-    int increasing = 1;
-    int prevIncreasing = 0;
-
-    for (int i = 1; i < nums.size(); ++i) {
-      if (nums.get(i) > nums.get(i - 1)) {
-        ++increasing;
-      } else {
-        prevIncreasing = increasing;
-        increasing = 1;
-      }
-      if (increasing / 2 >= k || Math.min(prevIncreasing, increasing) >= k)
-        return true;
-    }
-
-    return false;
-  }
-}
diff --git a/solutions/3349. Adjacent Increasing Subarrays Detection I/3349.py b/solutions/3349. Adjacent Increasing Subarrays Detection I/3349.py
deleted file mode 100644
index bd35c7712da..00000000000
--- a/solutions/3349. Adjacent Increasing Subarrays Detection I/3349.py	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution:
-  def hasIncreasingSubarrays(self, nums: list[int], k: int) -> bool:
-    increasing = 1
-    prevIncreasing = 0
-
-    for a, b in itertools.pairwise(nums):
-      if b > a:
-        increasing += 1
-      else:
-        prevIncreasing = increasing
-        increasing = 1
-      if increasing // 2 >= k or min(prevIncreasing, increasing) >= k:
-        return True
-
-    return False
diff --git a/solutions/335. Self Crossing/335.py b/solutions/335. Self Crossing/335.py
index 753009881b6..9a441a8c9ca 100644
--- a/solutions/335. Self Crossing/335.py	
+++ b/solutions/335. Self Crossing/335.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isSelfCrossing(self, x: list[int]) -> bool:
+  def isSelfCrossing(self, x: List[int]) -> bool:
     if len(x) <= 3:
       return False
 
diff --git a/solutions/3350. Adjacent Increasing Subarrays Detection II/3350.cpp b/solutions/3350. Adjacent Increasing Subarrays Detection II/3350.cpp
deleted file mode 100644
index 240e656fd1b..00000000000
--- a/solutions/3350. Adjacent Increasing Subarrays Detection II/3350.cpp	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
- public:
-  // Similar to 3349. Adjacent Increasing Subarrays Detection I
-  int maxIncreasingSubarrays(vector<int>& nums) {
-    int ans = 0;
-    int increasing = 1;
-    int prevIncreasing = 0;
-
-    for (int i = 1; i < nums.size(); ++i) {
-      if (nums[i] > nums[i - 1]) {
-        ++increasing;
-      } else {
-        prevIncreasing = increasing;
-        increasing = 1;
-      }
-      ans = max(ans, increasing / 2);
-      ans = max(ans, min(prevIncreasing, increasing));
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3350. Adjacent Increasing Subarrays Detection II/3350.java b/solutions/3350. Adjacent Increasing Subarrays Detection II/3350.java
deleted file mode 100644
index b954da211ee..00000000000
--- a/solutions/3350. Adjacent Increasing Subarrays Detection II/3350.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  // Similar to 3349. Adjacent Increasing Subarrays Detection I
-  public int maxIncreasingSubarrays(List<Integer> nums) {
-    int ans = 0;
-    int increasing = 1;
-    int prevIncreasing = 0;
-
-    for (int i = 1; i < nums.size(); ++i) {
-      if (nums.get(i) > nums.get(i - 1)) {
-        ++increasing;
-      } else {
-        prevIncreasing = increasing;
-        increasing = 1;
-      }
-      ans = Math.max(ans, increasing / 2);
-      ans = Math.max(ans, Math.min(prevIncreasing, increasing));
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3350. Adjacent Increasing Subarrays Detection II/3350.py b/solutions/3350. Adjacent Increasing Subarrays Detection II/3350.py
deleted file mode 100644
index 7581f155fb3..00000000000
--- a/solutions/3350. Adjacent Increasing Subarrays Detection II/3350.py	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution:
-  # Similar to 3349. Adjacent Increasing Subarrays Detection I
-  def maxIncreasingSubarrays(self, nums: list[int]) -> int:
-    ans = 0
-    increasing = 1
-    prevIncreasing = 0
-
-    for a, b in itertools.pairwise(nums):
-      if b > a:
-        increasing += 1
-      else:
-        prevIncreasing = increasing
-        increasing = 1
-      ans = max(ans, increasing // 2)
-      ans = max(ans, min(prevIncreasing, increasing))
-
-    return ans
diff --git a/solutions/3351. Sum of Good Subsequences/3351.cpp b/solutions/3351. Sum of Good Subsequences/3351.cpp
deleted file mode 100644
index 11e4b734ef2..00000000000
--- a/solutions/3351. Sum of Good Subsequences/3351.cpp	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
- public:
-  int sumOfGoodSubsequences(vector<int>& nums) {
-    constexpr int kMod = 1'000'000'007;
-    const int maxNum = ranges::max(nums);
-    // endsIn[i] := the number of good subsequences ending in i
-    vector<long> endsIn(maxNum + 3);
-    // dp[i] := the sum of good subsequences ending in i
-    vector<long> dp(maxNum + 3);
-
-    for (const int num : nums) {
-      const long seqsToAppend = 1 + endsIn[num] + endsIn[num + 2];
-      dp[num + 1] =
-          (seqsToAppend * num + (dp[num + 1] + dp[num] + dp[num + 2])) % kMod;
-      endsIn[num + 1] = (endsIn[num + 1] + seqsToAppend) % kMod;
-    }
-
-    return accumulate(dp.begin(), dp.end(), 0,
-                      [&](int acc, int d) { return (acc + d) % kMod; });
-  }
-};
diff --git a/solutions/3351. Sum of Good Subsequences/3351.java b/solutions/3351. Sum of Good Subsequences/3351.java
deleted file mode 100644
index 216e81d369b..00000000000
--- a/solutions/3351. Sum of Good Subsequences/3351.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public int sumOfGoodSubsequences(int[] nums) {
-    final int MOD = 1000000007;
-    final int maxNum = Arrays.stream(nums).max().getAsInt();
-    // endsIn[i] := the number of good subsequences ending in i
-    long[] endsIn = new long[maxNum + 3];
-    // dp[i] := the sum of good subsequences ending in i
-    long[] dp = new long[maxNum + 3];
-
-    for (final int num : nums) {
-      final long seqsToAppend = 1 + endsIn[num] + endsIn[num + 2];
-      dp[num + 1] = (seqsToAppend * num + (dp[num + 1] + dp[num] + dp[num + 2])) % MOD;
-      endsIn[num + 1] = (endsIn[num + 1] + seqsToAppend) % MOD;
-    }
-
-    int ans = 0;
-    for (final long d : dp)
-      ans = (int) (ans + d) % MOD;
-    return ans;
-  }
-}
diff --git a/solutions/3351. Sum of Good Subsequences/3351.py b/solutions/3351. Sum of Good Subsequences/3351.py
deleted file mode 100644
index e9d3107c978..00000000000
--- a/solutions/3351. Sum of Good Subsequences/3351.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  def sumOfGoodSubsequences(self, nums: list[int]) -> int:
-    MOD = 10**9 + 7
-    maxNum = max(nums)
-    # endsIn[i] := the number of good subsequences ending in i
-    endsIn = [0] * (maxNum + 2)
-    # dp[i] := the sum of good subsequences ending in i
-    dp = [0] * (maxNum + 2)
-
-    for num in nums:
-      seqsToAppend = 1 + endsIn[num - 1] + endsIn[num + 1]
-      dp[num] = (seqsToAppend * num +
-                 (dp[num] + dp[num - 1] + dp[num + 1])) % MOD
-      endsIn[num] += seqsToAppend % MOD
-
-    return sum(dp) % MOD
diff --git a/solutions/3352. Count K-Reducible Numbers Less Than N/3352.cpp b/solutions/3352. Count K-Reducible Numbers Less Than N/3352.cpp
deleted file mode 100644
index 7a8ebcc5702..00000000000
--- a/solutions/3352. Count K-Reducible Numbers Less Than N/3352.cpp	
+++ /dev/null
@@ -1,42 +0,0 @@
-class Solution {
- public:
-  int countKReducibleNumbers(string s, int k) {
-    vector<vector<vector<int>>> mem(
-        s.length(), vector<vector<int>>(s.length() + 1, vector<int>(2, -1)));
-    return count(s, 0, 0, true, k, getOps(s), mem) - 1;  // - 0
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Returns the number of positive integers less than n that are k-reducible,
-  // considering the i-th digit, where `setBits` is the number of set bits in
-  // the current number, and `tight` indicates if the current digit is
-  // tightly bound.
-  int count(const string& s, int i, int setBits, bool tight, int k,
-            const vector<int>& ops, vector<vector<vector<int>>>& mem) {
-    if (i == s.length())
-      return (ops[setBits] < k && !tight) ? 1 : 0;
-    if (mem[i][setBits][tight] != -1)
-      return mem[i][setBits][tight];
-
-    int res = 0;
-    const int maxDigit = tight ? s[i] - '0' : 1;
-
-    for (int d = 0; d <= maxDigit; ++d) {
-      const bool nextTight = tight && (d == maxDigit);
-      res += count(s, i + 1, setBits + d, nextTight, k, ops, mem);
-      res %= kMod;
-    }
-
-    return mem[i][setBits][tight] = res;
-  };
-
-  // Returns the number of operations to reduce a number to 0.
-  vector<int> getOps(string& s) {
-    vector<int> ops(s.length() + 1);
-    for (int num = 2; num <= s.length(); ++num)
-      ops[num] = 1 + ops[__builtin_popcount(num)];
-    return ops;
-  }
-};
diff --git a/solutions/3352. Count K-Reducible Numbers Less Than N/3352.java b/solutions/3352. Count K-Reducible Numbers Less Than N/3352.java
deleted file mode 100644
index ab310653914..00000000000
--- a/solutions/3352. Count K-Reducible Numbers Less Than N/3352.java	
+++ /dev/null
@@ -1,39 +0,0 @@
-class Solution {
-  public int countKReducibleNumbers(String s, int k) {
-    Integer[][][] mem = new Integer[s.length()][s.length() + 1][2];
-    return count(s, 0, 0, true, k, getOps(s), mem) - 1; // - 0
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  // Returns the number of positive integers less than n that are k-reducible,
-  // considering the i-th digit, where `setBits` is the number of set bits in
-  // the current number, and `tight` indicates if the current digit is
-  // tightly bound.
-  private int count(String s, int i, int setBits, boolean tight, int k, int[] ops,
-                    Integer[][][] mem) {
-    if (i == s.length())
-      return (ops[setBits] < k && !tight) ? 1 : 0;
-    if (mem[i][setBits][tight ? 1 : 0] != null)
-      return mem[i][setBits][tight ? 1 : 0];
-
-    int res = 0;
-    final int maxDigit = tight ? s.charAt(i) - '0' : 1;
-
-    for (int d = 0; d <= maxDigit; ++d) {
-      final boolean nextTight = tight && (d == maxDigit);
-      res += count(s, i + 1, setBits + d, nextTight, k, ops, mem);
-      res %= MOD;
-    }
-
-    return mem[i][setBits][tight ? 1 : 0] = res;
-  }
-
-  // Returns the number of operations to reduce a number to 0.
-  private int[] getOps(String s) {
-    int[] ops = new int[s.length() + 1];
-    for (int num = 2; num <= s.length(); ++num)
-      ops[num] = 1 + ops[Integer.bitCount(num)];
-    return ops;
-  }
-}
diff --git a/solutions/3352. Count K-Reducible Numbers Less Than N/3352.py b/solutions/3352. Count K-Reducible Numbers Less Than N/3352.py
deleted file mode 100644
index 782b2249e9a..00000000000
--- a/solutions/3352. Count K-Reducible Numbers Less Than N/3352.py	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution:
-  def countKReducibleNumbers(self, s: str, k: int) -> int:
-    MOD = 1_000_000_007
-    ops = self._getOps(s)
-
-    @functools.lru_cache(None)
-    def dp(i: int, setBits: int, tight: bool) -> int:
-      """
-      Returns the number of positive integers less than n that are k-reducible,
-      considering the i-th digit, where `setBits` is the number of set bits in
-      the current number, and `tight` indicates if the current digit is
-      tightly bound.
-      """
-      if i == len(s):
-        return int(ops[setBits] < k and not tight)
-
-      res = 0
-      maxDigit = int(s[i]) if tight else 1
-
-      for d in range(maxDigit + 1):
-        nextTight = tight and (d == maxDigit)
-        res += dp(i + 1, setBits + d, nextTight)
-        res %= MOD
-      return res
-
-    return dp(0, 0, True) - 1  # - 0
-
-  def _getOps(self, s: str) -> int:
-    """Returns the number of operations to reduce a number to 0."""
-    ops = [0] * (len(s) + 1)
-    for num in range(2, len(s) + 1):
-      ops[num] = 1 + ops[num.bit_count()]
-    return ops
diff --git a/solutions/3353. Minimum Total Operations/3353.cpp b/solutions/3353. Minimum Total Operations/3353.cpp
deleted file mode 100644
index 8b59fd417e3..00000000000
--- a/solutions/3353. Minimum Total Operations/3353.cpp	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution {
- public:
-  int minOperations(vector<int>& nums) {
-    int ans = 0;
-    for (int i = 1; i < nums.size(); ++i)
-      if (nums[i] != nums[i - 1])
-        ++ans;
-    return ans;
-  }
-};
diff --git a/solutions/3353. Minimum Total Operations/3353.java b/solutions/3353. Minimum Total Operations/3353.java
deleted file mode 100644
index a5d88edf211..00000000000
--- a/solutions/3353. Minimum Total Operations/3353.java	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution {
-  public int minOperations(int[] nums) {
-    int ans = 0;
-    for (int i = 1; i < nums.length; ++i)
-      if (nums[i] != nums[i - 1])
-        ++ans;
-    return ans;
-  }
-}
diff --git a/solutions/3353. Minimum Total Operations/3353.py b/solutions/3353. Minimum Total Operations/3353.py
deleted file mode 100644
index 8ff519930dd..00000000000
--- a/solutions/3353. Minimum Total Operations/3353.py	
+++ /dev/null
@@ -1,3 +0,0 @@
-class Solution:
-  def minOperations(self, nums: list[int]) -> int:
-    return sum(a != b for a, b in itertools.pairwise(nums))
diff --git a/solutions/3354. Make Array Elements Equal to Zero/3354-2.cpp b/solutions/3354. Make Array Elements Equal to Zero/3354-2.cpp
deleted file mode 100644
index 64c852cb610..00000000000
--- a/solutions/3354. Make Array Elements Equal to Zero/3354-2.cpp	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
- public:
-  int countValidSelections(vector<int>& nums) {
-    int ans = 0;
-    int prefix = 0;
-    int suffix = accumulate(nums.begin(), nums.end(), 0);
-
-    for (int i = 0; i < nums.size(); ++i) {
-      suffix -= nums[i];
-      prefix += nums[i];
-      if (nums[i] > 0)
-        continue;
-      if (prefix == suffix)
-        ans += 2;  // Go to either direction.
-      if (abs(prefix - suffix) == 1)
-        ans += 1;  // Go to the direction with the larger sum.
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3354. Make Array Elements Equal to Zero/3354-2.java b/solutions/3354. Make Array Elements Equal to Zero/3354-2.java
deleted file mode 100644
index 687cddc7dca..00000000000
--- a/solutions/3354. Make Array Elements Equal to Zero/3354-2.java	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
-  public int countValidSelections(int[] nums) {
-    int ans = 0;
-    int prefix = 0;
-    int suffix = Arrays.stream(nums).sum();
-
-    for (int i = 0; i < nums.length; ++i) {
-      suffix -= nums[i];
-      prefix += nums[i];
-      if (nums[i] > 0)
-        continue;
-      if (prefix == suffix)
-        ans += 2; // Go to either direction.
-      if (Math.abs(prefix - suffix) == 1)
-        ans += 1; // Go to the direction with the larger sum.
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3354. Make Array Elements Equal to Zero/3354-2.py b/solutions/3354. Make Array Elements Equal to Zero/3354-2.py
deleted file mode 100644
index 2e505240fa2..00000000000
--- a/solutions/3354. Make Array Elements Equal to Zero/3354-2.py	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution:
-  def countValidSelections(self, nums: list[int]) -> int:
-    ans = 0
-    prefix = 0
-    suffix = sum(nums)
-
-    for i, num in enumerate(nums):
-      suffix -= num
-      prefix += num
-      if num > 0:
-        continue
-      if prefix == suffix:
-        ans += 2  # Go to either direction.
-      if abs(prefix - suffix) == 1:
-        ans += 1  # Go to the direction with the larger sum.
-
-    return ans
diff --git a/solutions/3354. Make Array Elements Equal to Zero/3354.cpp b/solutions/3354. Make Array Elements Equal to Zero/3354.cpp
deleted file mode 100644
index 3731e3b9597..00000000000
--- a/solutions/3354. Make Array Elements Equal to Zero/3354.cpp	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution {
- public:
-  int countValidSelections(vector<int>& nums) {
-    const int n = nums.size();
-    int ans = 0;
-    vector<int> prefix(n);  // sum(nums[0..i - 1])
-    vector<int> suffix(n);  // sum(nums[i + 1..n - 1])
-
-    for (int i = 1; i < n; ++i)
-      prefix[i] = prefix[i - 1] + nums[i - 1];
-
-    for (int i = n - 2; i >= 0; --i)
-      suffix[i] = suffix[i + 1] + nums[i + 1];
-
-    for (int i = 0; i < n; ++i) {
-      if (nums[i] > 0)
-        continue;
-      if (prefix[i] == suffix[i])
-        ans += 2;  // Go to either direction.
-      if (abs(prefix[i] - suffix[i]) == 1)
-        ans += 1;  // Go to the direction with the larger sum.
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3354. Make Array Elements Equal to Zero/3354.java b/solutions/3354. Make Array Elements Equal to Zero/3354.java
deleted file mode 100644
index 640ed9e4611..00000000000
--- a/solutions/3354. Make Array Elements Equal to Zero/3354.java	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
-  public int countValidSelections(int[] nums) {
-    final int n = nums.length;
-    int ans = 0;
-    int[] prefix = new int[n]; // sum(nums[0..i - 1])
-    int[] suffix = new int[n]; // sum(nums[i + 1..n - 1])
-
-    for (int i = 1; i < n; ++i)
-      prefix[i] = prefix[i - 1] + nums[i - 1];
-
-    for (int i = n - 2; i >= 0; --i)
-      suffix[i] = suffix[i + 1] + nums[i + 1];
-
-    for (int i = 0; i < n; ++i) {
-      if (nums[i] > 0)
-        continue;
-      if (prefix[i] == suffix[i])
-        ans += 2; // Go to either direction.
-      if (Math.abs(prefix[i] - suffix[i]) == 1)
-        ans += 1; // Go to the direction with the larger sum.
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3354. Make Array Elements Equal to Zero/3354.py b/solutions/3354. Make Array Elements Equal to Zero/3354.py
deleted file mode 100644
index 5d35fb84d8d..00000000000
--- a/solutions/3354. Make Array Elements Equal to Zero/3354.py	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution:
-  def countValidSelections(self, nums: list[int]) -> int:
-    ans = 0
-    prefix = list(itertools.accumulate(nums))
-    suffix = list(itertools.accumulate(nums[::-1]))[::-1]
-
-    for i, num in enumerate(nums):
-      if num > 0:
-        continue
-      if prefix[i] == suffix[i]:
-        ans += 2  # Go to either direction.
-      if abs(prefix[i] - suffix[i]) == 1:
-        ans += 1  # Go to the direction with the larger sum.
-
-    return ans
diff --git a/solutions/3355. Zero Array Transformation I/3355.cpp b/solutions/3355. Zero Array Transformation I/3355.cpp
deleted file mode 100644
index 03f47c2cbf7..00000000000
--- a/solutions/3355. Zero Array Transformation I/3355.cpp	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
- public:
-  bool isZeroArray(vector<int>& nums, vector<vector<int>>& queries) {
-    vector<int> line(nums.size() + 1);
-    int decrement = 0;
-
-    for (const vector<int>& query : queries) {
-      const int l = query[0];
-      const int r = query[1];
-      ++line[l];
-      --line[r + 1];
-    }
-
-    for (int i = 0; i < nums.size(); ++i) {
-      decrement += line[i];
-      if (decrement < nums[i])
-        return false;
-    }
-
-    return true;
-  }
-};
diff --git a/solutions/3355. Zero Array Transformation I/3355.java b/solutions/3355. Zero Array Transformation I/3355.java
deleted file mode 100644
index eff92e87605..00000000000
--- a/solutions/3355. Zero Array Transformation I/3355.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public boolean isZeroArray(int[] nums, int[][] queries) {
-    int[] line = new int[nums.length + 1];
-    int decrement = 0;
-
-    for (int[] query : queries) {
-      final int l = query[0];
-      final int r = query[1];
-      ++line[l];
-      --line[r + 1];
-    }
-
-    for (int i = 0; i < nums.length; ++i) {
-      decrement += line[i];
-      if (decrement < nums[i])
-        return false;
-    }
-
-    return true;
-  }
-}
diff --git a/solutions/3355. Zero Array Transformation I/3355.py b/solutions/3355. Zero Array Transformation I/3355.py
deleted file mode 100644
index 673a22a7782..00000000000
--- a/solutions/3355. Zero Array Transformation I/3355.py	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution:
-  def isZeroArray(self, nums: list[int], queries: list[list[int]]) -> bool:
-    line = [0] * (len(nums) + 1)
-    decrement = 0
-
-    for l, r in queries:
-      line[l] += 1
-      line[r + 1] -= 1
-
-    for i, num in enumerate(nums):
-      decrement += line[i]
-      if decrement < num:
-        return False
-
-    return True
diff --git a/solutions/3356. Zero Array Transformation II/3356.cpp b/solutions/3356. Zero Array Transformation II/3356.cpp
deleted file mode 100644
index 2cc11d626b3..00000000000
--- a/solutions/3356. Zero Array Transformation II/3356.cpp	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution {
- public:
-  int minZeroArray(vector<int>& nums, vector<vector<int>>& queries) {
-    vector<int> line(nums.size() + 1);
-    int decrement = 0;
-    int k = 0;
-
-    for (int i = 0; i < nums.size(); ++i) {
-      while (decrement + line[i] < nums[i]) {
-        if (k == queries.size())
-          return -1;
-        const int l = queries[k][0];
-        const int r = queries[k][1];
-        const int val = queries[k][2];
-        ++k;
-        if (r < i)
-          continue;
-        line[max(l, i)] += val;
-        line[r + 1] -= val;
-      }
-      decrement += line[i];
-    }
-
-    return k;
-  }
-};
diff --git a/solutions/3356. Zero Array Transformation II/3356.java b/solutions/3356. Zero Array Transformation II/3356.java
deleted file mode 100644
index f50d1a691d9..00000000000
--- a/solutions/3356. Zero Array Transformation II/3356.java	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
-  public int minZeroArray(int[] nums, int[][] queries) {
-    int[] line = new int[nums.length + 1];
-    int decrement = 0;
-    int k = 0;
-
-    for (int i = 0; i < nums.length; ++i) {
-      while (decrement + line[i] < nums[i]) {
-        if (k == queries.length)
-          return -1;
-        final int l = queries[k][0];
-        final int r = queries[k][1];
-        final int val = queries[k][2];
-        ++k;
-        if (r < i)
-          continue;
-        line[Math.max(l, i)] += val;
-        line[r + 1] -= val;
-      }
-      decrement += line[i];
-    }
-
-    return k;
-  }
-}
diff --git a/solutions/3356. Zero Array Transformation II/3356.py b/solutions/3356. Zero Array Transformation II/3356.py
deleted file mode 100644
index 148b4261976..00000000000
--- a/solutions/3356. Zero Array Transformation II/3356.py	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution:
-  def minZeroArray(self, nums: list[int], queries: list[list[int]]) -> int:
-    line = [0] * (len(nums) + 1)
-    decrement = 0
-    k = 0
-
-    for i, num in enumerate(nums):
-      while decrement + line[i] < num:
-        if k == len(queries):
-          return -1
-        l, r, val = queries[k]
-        k += 1
-        if r < i:
-          continue
-        line[max(l, i)] += val
-        line[r + 1] -= val
-      decrement += line[i]
-
-    return k
diff --git a/solutions/3357. Minimize the Maximum Adjacent Element Difference/3357.cpp b/solutions/3357. Minimize the Maximum Adjacent Element Difference/3357.cpp
deleted file mode 100644
index 9f583834b4c..00000000000
--- a/solutions/3357. Minimize the Maximum Adjacent Element Difference/3357.cpp	
+++ /dev/null
@@ -1,112 +0,0 @@
-class Solution {
- public:
-  int minDifference(vector<int>& nums) {
-    int maxPositiveGap = 0;
-    int mn = 1'000'000'000;
-    int mx = 0;
-
-    for (int i = 1; i < nums.size(); ++i)
-      if ((nums[i - 1] == -1) != (nums[i] == -1)) {
-        const int positive = max(nums[i - 1], nums[i]);
-        mn = min(mn, positive);
-        mx = max(mx, positive);
-      } else {
-        maxPositiveGap = max(maxPositiveGap, abs(nums[i - 1] - nums[i]));
-      }
-
-    int l = maxPositiveGap;
-    int r = (mx - mn + 1) / 2;
-
-    while (l < r) {
-      const int m = (l + r) / 2;
-      if (check(nums, m, mn + m, mx - m))
-        r = m;
-      else
-        l = m + 1;
-    }
-
-    return l;
-  }
-
- private:
-  // Returns true if it's possible have `m` as maximum absolute difference
-  // between adjacent numbers, where -1s are replaced with `x` or `y`.
-  bool check(const vector<int>& nums, int m, int x, int y) {
-    int gapLength = 0;
-    int prev = 0;
-
-    for (const int num : nums) {
-      if (num == -1) {
-        ++gapLength;
-        continue;
-      }
-      if (prev > 0 && gapLength > 0) {
-        if (gapLength == 1 && !checkSingleGap(prev, num, m, x, y))
-          return false;
-        if (gapLength > 1 && !checkMultipleGaps(prev, num, m, x, y))
-          return false;
-      }
-      prev = num;
-      gapLength = 0;
-    }
-
-    // Check leading gaps.
-    if (nums[0] == -1) {
-      const int num = findFirstNumber(nums, 0, 1);
-      if (num != -1 && !checkBoundaryGaps(num, m, x, y))
-        return false;
-    }
-
-    // Check trailing gaps.
-    if (nums.back() == -1) {
-      const int num = findFirstNumber(nums, nums.size() - 1, -1);
-      if (num != -1 && !checkBoundaryGaps(num, m, x, y))
-        return false;
-    }
-
-    return true;
-  }
-
-  // Returns true if it's possible to have at most `m` as the minimized maximum
-  // difference for a sequence with a single -1 between two numbers.
-  // e.g. [a, -1, b] can be filled with either x or y.
-  bool checkSingleGap(int a, int b, int m, int x, int y) {
-    const int gapWithX = max(abs(a - x), abs(b - x));  // [a, x, b]
-    const int gapWithY = max(abs(a - y), abs(b - y));  // [a, y, b]
-    return min(gapWithX, gapWithY) <= m;
-  }
-
-  // Returns true if it's possible to have at most `m` as the minimized maximum
-  // difference for a sequence with multiple -1s between two numbers.
-  // e.g. [a, -1, -1, ..., -1, b] can be filled with x and y.
-  bool checkMultipleGaps(int a, int b, int m, int x, int y) {
-    const int ax = abs(a - x);
-    const int ay = abs(a - y);
-    const int bx = abs(b - x);
-    const int by = abs(b - y);
-    const int xy = abs(x - y);
-    const int gapAllX = max(ax, bx);        // [a, x, x, ..., x, b]
-    const int gapAllY = max(ay, by);        // [a, y, y, ..., y, b]
-    const int gapXToY = max({ax, xy, by});  // [a, x, ..., y, b]
-    const int gapYToX = max({ay, xy, bx});  // [a, y, ..., x, b]
-    return min({gapAllX, gapAllY, gapXToY, gapYToX}) <= m;
-  }
-
-  // Returns true if it's possible to have at most `m` as the minimized maximum
-  // difference for a boundary sequence starting or ending with -1s.
-  // e.g. [a, -1, -1, ...] or [..., -1, -1, a].
-  bool checkBoundaryGaps(int a, int m, int x, int y) {
-    const int gapAllX = abs(a - x);  // [x, x, ..., x, a]
-    const int gapAllY = abs(a - y);  // [y, y, ..., y, a]
-    return min(gapAllX, gapAllY) <= m;
-  }
-
-  // Returns the first positive number starting from the given index or -1
-  // if not found.
-  int findFirstNumber(const vector<int>& nums, int start, int step) {
-    int i = start;
-    while (i >= 0 && i < nums.size() && nums[i] == -1)
-      i += step;
-    return i >= 0 && i < nums.size() ? nums[i] : -1;
-  }
-};
diff --git a/solutions/3357. Minimize the Maximum Adjacent Element Difference/3357.java b/solutions/3357. Minimize the Maximum Adjacent Element Difference/3357.java
deleted file mode 100644
index b173c9dbf3f..00000000000
--- a/solutions/3357. Minimize the Maximum Adjacent Element Difference/3357.java	
+++ /dev/null
@@ -1,111 +0,0 @@
-class Solution {
-  public int minDifference(int[] nums) {
-    int maxPositiveGap = 0;
-    int mn = 1_000_000_000;
-    int mx = 0;
-
-    for (int i = 1; i < nums.length; ++i) {
-      if ((nums[i - 1] == -1) != (nums[i] == -1)) {
-        final int positive = Math.max(nums[i - 1], nums[i]);
-        mn = Math.min(mn, positive);
-        mx = Math.max(mx, positive);
-      } else {
-        maxPositiveGap = Math.max(maxPositiveGap, Math.abs(nums[i - 1] - nums[i]));
-      }
-    }
-
-    int l = maxPositiveGap;
-    int r = (mx - mn + 1) / 2;
-
-    while (l < r) {
-      final int m = (l + r) / 2;
-      if (check(nums, m, mn + m, mx - m))
-        r = m;
-      else
-        l = m + 1;
-    }
-
-    return l;
-  }
-
-  // Returns true if it's possible have `m` as maximum absolute difference
-  // between adjacent numbers, where -1s are replaced with `x` or `y`.
-  private boolean check(int[] nums, int m, int x, int y) {
-    int gapLength = 0;
-    int prev = 0;
-
-    for (final int num : nums) {
-      if (num == -1) {
-        ++gapLength;
-        continue;
-      }
-      if (prev > 0 && gapLength > 0) {
-        if (gapLength == 1 && !checkSingleGap(prev, num, m, x, y))
-          return false;
-        if (gapLength > 1 && !checkMultipleGaps(prev, num, m, x, y))
-          return false;
-      }
-      prev = num;
-      gapLength = 0;
-    }
-
-    // Check leading gaps
-    if (nums[0] == -1) {
-      final int num = findFirstNumber(nums, 0, 1);
-      if (num != -1 && !checkBoundaryGaps(num, m, x, y))
-        return false;
-    }
-
-    // Check trailing gaps
-    if (nums[nums.length - 1] == -1) {
-      final int num = findFirstNumber(nums, nums.length - 1, -1);
-      if (num != -1 && !checkBoundaryGaps(num, m, x, y))
-        return false;
-    }
-
-    return true;
-  }
-
-  // Returns true if it's possible to have at most `m` as the minimized maximum
-  // difference for a sequence with a single -1 between two numbers.
-  // e.g. [a, -1, b] can be filled with either x or y.
-  private boolean checkSingleGap(int a, int b, int m, int x, int y) {
-    final int gapWithX = Math.max(Math.abs(a - x), Math.abs(b - x)); // [a, x, b]
-    final int gapWithY = Math.max(Math.abs(a - y), Math.abs(b - y)); // [a, y, b]
-    return Math.min(gapWithX, gapWithY) <= m;
-  }
-
-  // Returns true if it's possible to have at most `m` as the minimized maximum
-  // difference for a sequence with multiple -1s between two numbers.
-  // e.g. [a, -1, -1, ..., -1, b] can be filled with x and y.
-  private boolean checkMultipleGaps(int a, int b, int m, int x, int y) {
-    final int ax = Math.abs(a - x);
-    final int ay = Math.abs(a - y);
-    final int bx = Math.abs(b - x);
-    final int by = Math.abs(b - y);
-    final int xy = Math.abs(x - y);
-    final int gapAllX = Math.max(ax, bx);               // [a, x, x, ..., x, b]
-    final int gapAllY = Math.max(ay, by);               // [a, y, y, ..., y, b]
-    final int gapXToY = Math.max(Math.max(ax, xy), by); // [a, x, ..., y, b]
-    final int gapYToX = Math.max(Math.max(ay, xy), bx); // [a, y, ..., x, b]
-    return Math.min(Math.min(gapAllX, gapAllY), Math.min(gapXToY, gapYToX)) <= m;
-  }
-
-  // Returns true if it's possible to have at most `m` as the minimized maximum
-  // difference for a boundary sequence starting or ending with -1s.
-  // e.g. [a, -1, -1, ...] or [..., -1, -1, a].
-  private boolean checkBoundaryGaps(int a, int m, int x, int y) {
-    final int gapAllX = Math.abs(a - x); // [x, x, ..., x, a]
-    final int gapAllY = Math.abs(a - y); // [y, y, ..., y, a]
-    return Math.min(gapAllX, gapAllY) <= m;
-  }
-
-  // Returns the first positive number starting from the given index or -1
-  // if not found.
-  private int findFirstNumber(int[] nums, int start, int step) {
-    int i = start;
-    while (i >= 0 && i < nums.length && nums[i] == -1)
-      i += step;
-    return i >= 0 && i < nums.length ? nums[i] : -1;
-  }
-}
diff --git a/solutions/3357. Minimize the Maximum Adjacent Element Difference/3357.py b/solutions/3357. Minimize the Maximum Adjacent Element Difference/3357.py
deleted file mode 100644
index 7125a212a44..00000000000
--- a/solutions/3357. Minimize the Maximum Adjacent Element Difference/3357.py	
+++ /dev/null
@@ -1,90 +0,0 @@
-class Solution:
-  def minDifference(self, nums: list[int]) -> int:
-    maxPositiveGap = 0
-    mn = 1_000_000_000
-    mx = 0
-
-    for a, b in itertools.pairwise(nums):
-      if (a == -1) != (b == -1):
-        positive = max(a, b)
-        mn = min(mn, positive)
-        mx = max(mx, positive)
-      else:
-        maxPositiveGap = max(maxPositiveGap, abs(a - b))
-
-    l = maxPositiveGap
-    r = (mx - mn + 1) // 2
-    return bisect.bisect_left(
-        range(l, r), True,
-        key=lambda m: self._check(nums, m, mn + m, mx - m)) + l
-
-  def _check(self, nums: list[int], m: int, x: int, y: int) -> bool:
-    """
-    Returns True if it's possible have `m` as maximum absolute difference
-    between adjacent numbers, where -1s are replaced with `x` or `y`.
-    """
-    gapLength = 0
-    prev = 0
-
-    for num in nums:
-      if num == -1:
-        gapLength += 1
-        continue
-      if prev > 0 and gapLength > 0:
-        if gapLength == 1 and not self._checkSingleGap(prev, num, m, x, y):
-          return False
-        if gapLength > 1 and not self._checkMultipleGaps(prev, num, m, x, y):
-          return False
-      prev = num
-      gapLength = 0
-
-    # Check leading gaps
-    if nums[0] == -1:
-      num = next((num for num in nums if num != -1), -1)
-      if num != -1 and not self._checkBoundaryGaps(num, m, x, y):
-        return False
-
-    # Check trailing gaps
-    if nums[-1] == -1:
-      num = next((num for num in reversed(nums) if num != -1), -1)
-      if num != -1 and not self._checkBoundaryGaps(num, m, x, y):
-        return False
-
-    return True
-
-  def _checkSingleGap(self, a: int, b: int, m: int, x: int, y: int) -> bool:
-    """
-    Returns true if it's possible to have at most `m` as the minimized maximum
-    difference for a sequence with a single -1 between two numbers.
-    e.g. [a, -1, b] can be filled with either x or y.
-    """
-    gapWithX = max(abs(a - x), abs(b - x))  # [a, x, b]
-    gapWithY = max(abs(a - y), abs(b - y))  # [a, y, b]
-    return min(gapWithX, gapWithY) <= m
-
-  def _checkMultipleGaps(self, a: int, b: int, m: int, x: int, y: int) -> bool:
-    """
-    Returns true if it's possible to have at most `m` as the minimized maximum
-    difference for a sequence with multiple -1s between two numbers.
-    e.g. [a, -1, -1, ..., -1, b] can be filled with x and y.
-    """
-    ax = abs(a - x)
-    ay = abs(a - y)
-    bx = abs(b - x)
-    by = abs(b - y)
-    xy = abs(x - y)
-    gapAllX = max(ax, bx)  # [a, x, x, ..., x, b]
-    gapAllY = max(ay, by)  # [a, y, y, ..., y, b]
-    gapXToY = max(ax, xy, by)  # [a, x, ..., y, b]
-    gapYToX = max(ay, xy, bx)  # [a, y, ..., x, b]
-    return min(gapAllX, gapAllY, gapXToY, gapYToX) <= m
-
-  def _checkBoundaryGaps(self, a: int, m: int, x: int, y: int) -> bool:
-    """
-    Returns true if it's possible to have at most `m` as the minimized maximum
-    difference for a boundary sequence starting or ending with -1s.
-    e.g. [a, -1, -1, ...] or [..., -1, -1, a].
-    """
-    gapAllX = abs(a - x)  # [x, x, ..., x, a]
-    gapAllY = abs(a - y)  # [y, y, ..., y, a]
-    return min(gapAllX, gapAllY) <= m
diff --git a/solutions/3358. Books with NULL Ratings/3358.sql b/solutions/3358. Books with NULL Ratings/3358.sql
deleted file mode 100644
index 1aa3ad709f7..00000000000
--- a/solutions/3358. Books with NULL Ratings/3358.sql	
+++ /dev/null
@@ -1,4 +0,0 @@
-SELECT book_id, title, author, published_year
-FROM Books
-WHERE rating IS NULL
-ORDER BY 1;
diff --git a/solutions/3359. Find Sorted Submatrices With Maximum Element at Most K/3359.cpp b/solutions/3359. Find Sorted Submatrices With Maximum Element at Most K/3359.cpp
deleted file mode 100644
index 00d6db64dd7..00000000000
--- a/solutions/3359. Find Sorted Submatrices With Maximum Element at Most K/3359.cpp	
+++ /dev/null
@@ -1,50 +0,0 @@
-
-struct T {
-  int subarrayWidth;
-  int rowIndex;
-  int accumulatedSubmatrices;
-};
-
-class Solution {
- public:
-  long long countSubmatrices(vector<vector<int>>& grid, int k) {
-    int m = grid.size();
-    int n = grid[0].size();
-    long ans = 0;
-    // dp[i][j] := the number of valid subarrays ending in grid[i][j]
-    vector<vector<int>> dp(m, vector<int>(n));
-    // stacks[j] := the stack of valid
-    // (subarray width, row index, number of accumulated submatrices) ending in
-    // column j
-    vector<stack<T>> stacks(n);
-
-    for (int j = 0; j < n; ++j)
-      stacks[j].emplace(0, -1, 0);
-
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j)
-        if (grid[i][j] > k) {
-          stacks[j] = stack<T>();
-          stacks[j].emplace(0, i, 0);
-        } else {
-          dp[i][j] = 1;
-          if (j > 0 && grid[i][j - 1] <= k && grid[i][j - 1] >= grid[i][j])
-            // Extend the valid subarrays to the current number.
-            dp[i][j] += dp[i][j - 1];
-          const int width = dp[i][j];
-          stack<T>& stack = stacks[j];
-          // Remove subarray widths greater than the current width since they
-          // will become invalid.
-          while (!stack.empty() && width < stack.top().subarrayWidth)
-            stack.pop();
-          const int height = i - stack.top().rowIndex;
-          const int newSubmatrices = width * height;
-          const int accumulatedSubmatrices =
-              stack.top().accumulatedSubmatrices + newSubmatrices;
-          ans += accumulatedSubmatrices;
-          stack.emplace(width, i, accumulatedSubmatrices);
-        }
-
-    return ans;
-  }
-};
diff --git a/solutions/3359. Find Sorted Submatrices With Maximum Element at Most K/3359.java b/solutions/3359. Find Sorted Submatrices With Maximum Element at Most K/3359.java
deleted file mode 100644
index bfe97a890d8..00000000000
--- a/solutions/3359. Find Sorted Submatrices With Maximum Element at Most K/3359.java	
+++ /dev/null
@@ -1,45 +0,0 @@
-class Solution {
-  public long countSubmatrices(int[][] grid, int k) {
-    record T(int subarrayWidth, int rowIndex, int accumulatedSubmatrices) {}
-    final int m = grid.length;
-    final int n = grid[0].length;
-    long ans = 0;
-    // dp[i][j] := the number of valid subarrays ending in grid[i][j]
-    int[][] dp = new int[m][n];
-    // stacks[j] := the stack of valid
-    // (subarray width, row index, number of accumulated submatrices) ending in
-    // column j
-    List<Deque<T>> stacks = new ArrayList<>(n);
-
-    for (int j = 0; j < n; ++j) {
-      Deque<T> stack = new ArrayDeque<>();
-      stack.push(new T(0, -1, 0));
-      stacks.add(stack);
-    }
-
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j)
-        if (grid[i][j] > k) {
-          stacks.get(j).clear();
-          stacks.get(j).push(new T(0, i, 0));
-        } else {
-          dp[i][j] = 1;
-          if (j > 0 && grid[i][j - 1] <= k && grid[i][j - 1] >= grid[i][j])
-            // Extend the valid subarrays to the current number.
-            dp[i][j] += dp[i][j - 1];
-          final int width = dp[i][j];
-          // Remove subarray widths greater than the current width since they
-          // will become invalid.
-          Deque<T> stack = stacks.get(j);
-          while (!stack.isEmpty() && width < stack.peek().subarrayWidth)
-            stack.pop();
-          final int height = i - stack.peek().rowIndex;
-          final int newSubmatrices = width * height;
-          final int accumulatedSubmatrices = stack.peek().accumulatedSubmatrices + newSubmatrices;
-          ans += accumulatedSubmatrices;
-          stack.push(new T(width, i, accumulatedSubmatrices));
-        }
-
-    return ans;
-  }
-}
diff --git a/solutions/3359. Find Sorted Submatrices With Maximum Element at Most K/3359.py b/solutions/3359. Find Sorted Submatrices With Maximum Element at Most K/3359.py
deleted file mode 100644
index 66c3506d694..00000000000
--- a/solutions/3359. Find Sorted Submatrices With Maximum Element at Most K/3359.py	
+++ /dev/null
@@ -1,44 +0,0 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
-class T:
-  subarrayWidth: int
-  rowIndex: int
-  accumulatedSubmatrices: int
-
-
-class Solution:
-  def countSubmatrices(self, grid: list[list[int]], k: int) -> int:
-    m = len(grid)
-    n = len(grid[0])
-    ans = 0
-    # dp[i][j] := the number of valid subarrays ending in grid[i][j]
-    dp = [[0] * n for _ in range(m)]
-    # stacks[j] := the stack of valid
-    # (subarray width, row index, number of accumulated submatrices) ending in
-    # column j
-    stacks: list[T] = [[T(0, -1, 0)] for _ in range(n)]
-
-    for i, row in enumerate(grid):
-      for j, num in enumerate(row):
-        if num > k:
-          stacks[j] = [T(0, i, 0)]
-        else:
-          dp[i][j] = 1
-          if j > 0 and row[j - 1] <= k and row[j - 1] >= row[j]:
-            # Extend the valid subarrays to the current number.
-            dp[i][j] += dp[i][j - 1]
-          width = dp[i][j]
-          # Remove subarray widths greater than the current count since they
-          # will become invalid.
-          while stacks[j] and width < stacks[j][-1].subarrayWidth:
-            stacks[j].pop()
-          height = i - stacks[j][-1].rowIndex
-          newSubmatrices = width * height
-          accumulatedSubmatrices = (stacks[j][-1].accumulatedSubmatrices +
-                                    newSubmatrices)
-          ans += accumulatedSubmatrices
-          stacks[j].append(T(width, i, accumulatedSubmatrices))
-
-    return ans
diff --git a/solutions/336. Palindrome Pairs/336.cpp b/solutions/336. Palindrome Pairs/336.cpp
index 61941dfbd3a..32e7589c0fa 100644
--- a/solutions/336. Palindrome Pairs/336.cpp	
+++ b/solutions/336. Palindrome Pairs/336.cpp	
@@ -6,7 +6,7 @@ class Solution {
 
     for (int i = 0; i < words.size(); ++i) {
       string word = words[i];
-      ranges::reverse(word);
+      reverse(word.begin(), word.end());
       map[word] = i;
     }
 
diff --git a/solutions/336. Palindrome Pairs/336.py b/solutions/336. Palindrome Pairs/336.py
index daf3372df40..1423983e79d 100644
--- a/solutions/336. Palindrome Pairs/336.py	
+++ b/solutions/336. Palindrome Pairs/336.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def palindromePairs(self, words: list[str]) -> list[list[int]]:
+  def palindromePairs(self, words: List[str]) -> List[List[int]]:
     ans = []
     dict = {word[::-1]: i for i, word in enumerate(words)}
 
diff --git a/solutions/3360. Stone Removal Game/3360.cpp b/solutions/3360. Stone Removal Game/3360.cpp
deleted file mode 100644
index 41dac93dfd6..00000000000
--- a/solutions/3360. Stone Removal Game/3360.cpp	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution {
- public:
-  bool canAliceWin(int n) {
-    for (int stones = 10; stones >= 0; --stones) {
-      if (stones > n)
-        return stones % 2 == 1;
-      n -= stones;
-    }
-    throw;
-  }
-};
diff --git a/solutions/3360. Stone Removal Game/3360.java b/solutions/3360. Stone Removal Game/3360.java
deleted file mode 100644
index 7bd404cdbf5..00000000000
--- a/solutions/3360. Stone Removal Game/3360.java	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution {
-  public boolean canAliceWin(int n) {
-    for (int stones = 10; stones >= 0; --stones) {
-      if (stones > n)
-        return stones % 2 == 1;
-      n -= stones;
-    }
-    throw new IllegalArgumentException();
-  }
-}
diff --git a/solutions/3360. Stone Removal Game/3360.py b/solutions/3360. Stone Removal Game/3360.py
deleted file mode 100644
index 395bec9fd5f..00000000000
--- a/solutions/3360. Stone Removal Game/3360.py	
+++ /dev/null
@@ -1,6 +0,0 @@
-class Solution:
-  def canAliceWin(self, n: int) -> bool:
-    for stones in range(10, -1, -1):
-      if stones > n:
-        return stones % 2 == 1
-      n -= stones
diff --git a/solutions/3361. Shift Distance Between Two Strings/3361.cpp b/solutions/3361. Shift Distance Between Two Strings/3361.cpp
deleted file mode 100644
index 378efe8d974..00000000000
--- a/solutions/3361. Shift Distance Between Two Strings/3361.cpp	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution {
- public:
-  long long shiftDistance(string s, string t, vector<int>& nextCost,
-                          vector<int>& previousCost) {
-    long ans = 0;
-    // prev[i][j] := the prev cost to shift from ('a' + i) to ('a' + j)
-    vector<vector<long>> prev(26, vector<long>(26));
-    // next[i][j] := the next cost to shift from ('a' + i) to ('a' + j)
-    vector<vector<long>> next(26, vector<long>(26));
-
-    for (int i = 0; i < 26; ++i) {
-      long cost = 0;
-      for (int j = 0; j < 26; ++j) {
-        next[i][(i + j) % 26] = cost;
-        cost += nextCost[(i + j) % 26];
-      }
-    }
-
-    for (int i = 0; i < 26; ++i) {
-      long cost = 0;
-      for (int j = 0; j < 26; ++j) {
-        prev[i][(i - j + 26) % 26] = cost;
-        cost += previousCost[(i - j + 26) % 26];
-      }
-    }
-
-    for (int i = 0; i < s.length(); ++i) {
-      const int a = s[i] - 'a';
-      const int b = t[i] - 'a';
-      ans += min(next[a][b], prev[a][b]);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3361. Shift Distance Between Two Strings/3361.java b/solutions/3361. Shift Distance Between Two Strings/3361.java
deleted file mode 100644
index 1e179fc0a28..00000000000
--- a/solutions/3361. Shift Distance Between Two Strings/3361.java	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution {
-  public long shiftDistance(String s, String t, int[] nextCost, int[] previousCost) {
-    long ans = 0;
-    // prev[i][j]: the prev cost to shift from ('a' + i) to ('a' + j)
-    long[][] prev = new long[26][26];
-    // next[i][j]: the next cost to shift from ('a' + i) to ('a' + j)
-    long[][] next = new long[26][26];
-
-    for (int i = 0; i < 26; ++i) {
-      long cost = 0;
-      for (int j = 0; j < 26; ++j) {
-        next[i][(i + j) % 26] = cost;
-        cost += nextCost[(i + j) % 26];
-      }
-    }
-
-    for (int i = 0; i < 26; ++i) {
-      long cost = 0;
-      for (int j = 0; j < 26; ++j) {
-        prev[i][(i - j + 26) % 26] = cost;
-        cost += previousCost[(i - j + 26) % 26];
-      }
-    }
-
-    for (int i = 0; i < s.length(); ++i) {
-      final int a = s.charAt(i) - 'a';
-      final int b = t.charAt(i) - 'a';
-      ans += Math.min(next[a][b], prev[a][b]);
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3361. Shift Distance Between Two Strings/3361.py b/solutions/3361. Shift Distance Between Two Strings/3361.py
deleted file mode 100644
index 943deb35d8f..00000000000
--- a/solutions/3361. Shift Distance Between Two Strings/3361.py	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution:
-  def shiftDistance(
-      self,
-      s: str,
-      t: str,
-      nextCost: list[int],
-      previousCost: list[int]
-  ) -> int:
-    ans = 0
-    # prev[i][j]: the prev cost to shift from ('a' + i) to ('a' + j)
-    prev = [[0] * 26 for _ in range(26)]
-    # next[i][j]: the next cost to shift from ('a' + i) to ('a' + j)
-    next = [[0] * 26 for _ in range(26)]
-
-    for i in range(26):
-      cost = 0
-      for j in range(26):
-        next[i][(i + j) % 26] = cost
-        cost += nextCost[(i + j) % 26]
-
-    for i in range(26):
-      cost = 0
-      for j in range(26):
-        prev[i][(i - j + 26) % 26] = cost
-        cost += previousCost[(i - j + 26) % 26]
-
-    for a, b in zip(s, t):
-      i = ord(a) - ord('a')
-      j = ord(b) - ord('a')
-      ans += min(next[i][j], prev[i][j])
-
-    return ans
diff --git a/solutions/3362. Zero Array Transformation III/3362.cpp b/solutions/3362. Zero Array Transformation III/3362.cpp
deleted file mode 100644
index 11ff7d068d7..00000000000
--- a/solutions/3362. Zero Array Transformation III/3362.cpp	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
- public:
-  int maxRemoval(vector<int>& nums, vector<vector<int>>& queries) {
-    int queryIndex = 0;
-    priority_queue<int> available;                        // available `r`s
-    priority_queue<int, vector<int>, greater<>> running;  // running `r`s
-
-    ranges::sort(queries);
-
-    for (int i = 0; i < nums.size(); ++i) {
-      while (queryIndex < queries.size() && queries[queryIndex][0] <= i)
-        available.push(queries[queryIndex++][1]);
-      while (!running.empty() && running.top() < i)
-        running.pop();
-      while (nums[i] > running.size()) {
-        if (available.empty() || available.top() < i)
-          return -1;
-        running.push(available.top()), available.pop();
-      }
-    }
-
-    return available.size();
-  }
-};
diff --git a/solutions/3362. Zero Array Transformation III/3362.java b/solutions/3362. Zero Array Transformation III/3362.java
deleted file mode 100644
index d7d47e0902e..00000000000
--- a/solutions/3362. Zero Array Transformation III/3362.java	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
-  public int maxRemoval(int[] nums, int[][] queries) {
-    int queryIndex = 0;
-    Queue<Integer> available = new PriorityQueue<>(Collections.reverseOrder()); // available `r`s
-    Queue<Integer> running = new PriorityQueue<>();                             // running `r`s
-
-    Arrays.sort(queries, Comparator.comparingInt((int[] query) -> query[0]));
-
-    for (int i = 0; i < nums.length; ++i) {
-      while (queryIndex < queries.length && queries[queryIndex][0] <= i)
-        available.offer(queries[queryIndex++][1]);
-      while (!running.isEmpty() && running.peek() < i)
-        running.poll();
-      while (nums[i] > running.size()) {
-        if (available.isEmpty() || available.peek() < i)
-          return -1;
-        running.offer(available.poll());
-      }
-    }
-
-    return available.size();
-  }
-}
diff --git a/solutions/3362. Zero Array Transformation III/3362.py b/solutions/3362. Zero Array Transformation III/3362.py
deleted file mode 100644
index 6f3bff44dc8..00000000000
--- a/solutions/3362. Zero Array Transformation III/3362.py	
+++ /dev/null
@@ -1,20 +0,0 @@
-from sortedcontainers import SortedList
-
-
-class Solution:
-  def maxRemoval(self, nums: list[int], queries: list[list[int]]) -> int:
-    q = collections.deque(sorted(queries))
-    available = SortedList()  # available `r`s
-    running = SortedList()  # running `r`s
-
-    for i, num in enumerate(nums):
-      while q and q[0][0] <= i:
-        available.add(q.popleft()[1])
-      while running and running[0] < i:
-        running.pop(0)
-      while num > len(running):
-        if not available or available[-1] < i:
-          return -1
-        running.add(available.pop())
-
-    return len(available)
diff --git a/solutions/3363. Find the Maximum Number of Fruits Collected/3363.cpp b/solutions/3363. Find the Maximum Number of Fruits Collected/3363.cpp
deleted file mode 100644
index 39a3e28a7ef..00000000000
--- a/solutions/3363. Find the Maximum Number of Fruits Collected/3363.cpp	
+++ /dev/null
@@ -1,65 +0,0 @@
-class Solution {
- public:
-  int maxCollectedFruits(vector<vector<int>>& fruits) {
-    return getTopLeft(fruits) + getTopRight(fruits) + getBottomLeft(fruits) -
-           2 * fruits.back().back();
-  }
-
- private:
-  int getTopLeft(const vector<vector<int>>& fruits) {
-    const int n = fruits.size();
-    int res = 0;
-    for (int i = 0; i < n; ++i)
-      res += fruits[i][i];
-    return res;
-  }
-
-  int getTopRight(const vector<vector<int>>& fruits) {
-    const int n = fruits.size();
-    // dp[i][j] := the number of fruits collected from (0, n - 1) to (i, j)
-    vector<vector<int>> dp(n, vector<int>(n));
-    dp[0][n - 1] = fruits[0][n - 1];
-    for (int x = 0; x < n; ++x) {
-      for (int y = 0; y < n; ++y) {
-        if (x >= y && !(x == n - 1 && y == n - 1))
-          continue;
-        for (const auto& [dx, dy] :
-             vector<pair<int, int>>{{1, -1}, {1, 0}, {1, 1}}) {
-          const int i = x - dx;
-          const int j = y - dy;
-          if (i < 0 || i == n || j < 0 || j == n)
-            continue;
-          if (i < j && j < n - 1 - i)
-            continue;
-          dp[x][y] = max(dp[x][y], dp[i][j] + fruits[x][y]);
-        }
-      }
-    }
-
-    return dp[n - 1][n - 1];
-  }
-
-  int getBottomLeft(const vector<vector<int>>& fruits) {
-    const int n = fruits.size();
-    // dp[i][j] := the number of fruits collected from (n - 1, 0) to (i, j)
-    vector<vector<int>> dp(n, vector<int>(n));
-    dp[n - 1][0] = fruits[n - 1][0];
-    for (int y = 0; y < n; ++y) {
-      for (int x = 0; x < n; ++x) {
-        if (x <= y && !(x == n - 1 && y == n - 1))
-          continue;
-        for (const auto& [dx, dy] :
-             vector<pair<int, int>>{{-1, 1}, {0, 1}, {1, 1}}) {
-          const int i = x - dx;
-          const int j = y - dy;
-          if (i < 0 || i == n || j < 0 || j == n)
-            continue;
-          if (j < i && i < n - 1 - j)
-            continue;
-          dp[x][y] = max(dp[x][y], dp[i][j] + fruits[x][y]);
-        }
-      }
-    }
-    return dp[n - 1][n - 1];
-  }
-};
diff --git a/solutions/3363. Find the Maximum Number of Fruits Collected/3363.java b/solutions/3363. Find the Maximum Number of Fruits Collected/3363.java
deleted file mode 100644
index dde1ff275bc..00000000000
--- a/solutions/3363. Find the Maximum Number of Fruits Collected/3363.java	
+++ /dev/null
@@ -1,59 +0,0 @@
-class Solution {
-  public int maxCollectedFruits(int[][] fruits) {
-    final int n = fruits.length;
-    return getTopLeft(fruits) + getTopRight(fruits) + getBottomLeft(fruits) //
-        - 2 * fruits[n - 1][n - 1];
-  }
-
-  private int getTopLeft(int[][] fruits) {
-    final int n = fruits.length;
-    int res = 0;
-    for (int i = 0; i < n; ++i)
-      res += fruits[i][i];
-    return res;
-  }
-
-  private int getTopRight(int[][] fruits) {
-    final int n = fruits.length;
-    // dp[i][j] := the number of fruits collected from (0, n - 1) to (i, j)
-    int[][] dp = new int[n][n];
-    dp[0][n - 1] = fruits[0][n - 1];
-    for (int x = 0; x < n; ++x)
-      for (int y = 0; y < n; ++y) {
-        if (x >= y && !(x == n - 1 && y == n - 1))
-          continue;
-        for (int[] dir : new int[][] {{1, -1}, {1, 0}, {1, 1}}) {
-          final int i = x - dir[0];
-          final int j = y - dir[1];
-          if (i < 0 || i == n || j < 0 || j == n)
-            continue;
-          if (i < j && j < n - 1 - i)
-            continue;
-          dp[x][y] = Math.max(dp[x][y], dp[i][j] + fruits[x][y]);
-        }
-      }
-    return dp[n - 1][n - 1];
-  }
-
-  private int getBottomLeft(int[][] fruits) {
-    final int n = fruits.length;
-    // dp[i][j] := the number of fruits collected from (n - 1, 0) to (i, j)
-    int[][] dp = new int[n][n];
-    dp[n - 1][0] = fruits[n - 1][0];
-    for (int y = 0; y < n; ++y)
-      for (int x = 0; x < n; ++x) {
-        if (x <= y && !(x == n - 1 && y == n - 1))
-          continue;
-        for (int[] dir : new int[][] {{-1, 1}, {0, 1}, {1, 1}}) {
-          final int i = x - dir[0];
-          final int j = y - dir[1];
-          if (i < 0 || i == n || j < 0 || j == n)
-            continue;
-          if (j < i && i < n - 1 - j)
-            continue;
-          dp[x][y] = Math.max(dp[x][y], dp[i][j] + fruits[x][y]);
-        }
-      }
-    return dp[n - 1][n - 1];
-  }
-}
diff --git a/solutions/3363. Find the Maximum Number of Fruits Collected/3363.py b/solutions/3363. Find the Maximum Number of Fruits Collected/3363.py
deleted file mode 100644
index a8f1ffbac65..00000000000
--- a/solutions/3363. Find the Maximum Number of Fruits Collected/3363.py	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution:
-  def maxCollectedFruits(self, fruits: list[list[int]]) -> int:
-    n = len(fruits)
-
-    def getTopLeft() -> int:
-      return sum(fruits[i][i] for i in range(n))
-
-    def getTopRight() -> int:
-      # dp[i][j] := the number of fruits collected from (0, n - 1) to (i, j)
-      dp = [[0] * n for _ in range(n)]
-      dp[0][-1] = fruits[0][-1]
-      for x in range(n):
-        for y in range(n):
-          if x >= y and (x, y) != (n - 1, n - 1):
-            continue
-          for dx, dy in [(1, -1), (1, 0), (1, 1)]:
-            i = x - dx
-            j = y - dy
-            if i < 0 or i == n or j < 0 or j == n:
-              continue
-            if i < j < n - 1 - i:
-              continue
-            dp[x][y] = max(dp[x][y], dp[i][j] + fruits[x][y])
-      return dp[-1][-1]
-
-    def getBottomLeft() -> int:
-      # dp[i][j] := the number of fruits collected from (n - 1, 0) to (i, j)
-      dp = [[0] * n for _ in range(n)]
-      dp[-1][0] = fruits[-1][0]
-      for y in range(n):
-        for x in range(n):
-          if x <= y and (x, y) != (n - 1, n - 1):
-            continue
-          for dx, dy in [(-1, 1), (0, 1), (1, 1)]:
-            i = x - dx
-            j = y - dy
-            if i < 0 or i == n or j < 0 or j == n:
-              continue
-            if j < i < n - 1 - j:
-              continue
-            dp[x][y] = max(dp[x][y], dp[i][j] + fruits[x][y])
-      return dp[-1][-1]
-
-    return getTopLeft() + getTopRight() + getBottomLeft() - 2 * fruits[-1][-1]
diff --git a/solutions/3364. Minimum Positive Sum Subarray/3364.cpp b/solutions/3364. Minimum Positive Sum Subarray/3364.cpp
deleted file mode 100644
index cb7e2fcee55..00000000000
--- a/solutions/3364. Minimum Positive Sum Subarray/3364.cpp	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
- public:
-  int minimumSumSubarray(vector<int>& nums, int l, int r) {
-    int ans = INT_MAX;
-
-    for (int windowSize = l; windowSize <= r; ++windowSize) {
-      int sum = accumulate(nums.begin(), nums.begin() + windowSize, 0);
-      if (sum > 0)
-        ans = min(ans, sum);
-      for (int i = windowSize; i < nums.size(); ++i) {
-        sum -= nums[i - windowSize];
-        sum += nums[i];
-        if (sum > 0)
-          ans = min(ans, sum);
-      }
-    }
-
-    return ans == INT_MAX ? -1 : ans;
-  }
-};
diff --git a/solutions/3364. Minimum Positive Sum Subarray/3364.java b/solutions/3364. Minimum Positive Sum Subarray/3364.java
deleted file mode 100644
index aa136e4c22b..00000000000
--- a/solutions/3364. Minimum Positive Sum Subarray/3364.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public int minimumSumSubarray(List<Integer> nums, int l, int r) {
-    int ans = Integer.MAX_VALUE;
-
-    for (int windowSize = l; windowSize <= r; ++windowSize) {
-      int sum = 0;
-      for (int i = 0; i < windowSize; ++i)
-        sum += nums.get(i);
-      if (sum > 0)
-        ans = Math.min(ans, sum);
-      for (int i = windowSize; i < nums.size(); ++i) {
-        sum -= nums.get(i - windowSize);
-        sum += nums.get(i);
-        if (sum > 0)
-          ans = Math.min(ans, sum);
-      }
-    }
-
-    return ans == Integer.MAX_VALUE ? -1 : ans;
-  }
-}
diff --git a/solutions/3364. Minimum Positive Sum Subarray/3364.py b/solutions/3364. Minimum Positive Sum Subarray/3364.py
deleted file mode 100644
index 6c958bdc5ae..00000000000
--- a/solutions/3364. Minimum Positive Sum Subarray/3364.py	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution:
-  def minimumSumSubarray(self, nums: list[int], l: int, r: int) -> int:
-    ans = math.inf
-
-    for windowSize in range(l, r + 1):
-      windowSum = sum(nums[:windowSize])
-      if windowSum > 0:
-        ans = min(ans, windowSum)
-      for i in range(windowSize, len(nums)):
-        windowSum -= nums[i - windowSize]
-        windowSum += nums[i]
-        if windowSum > 0:
-          ans = min(ans, windowSum)
-
-    return -1 if ans == math.inf else ans
diff --git a/solutions/3365. Rearrange K Substrings to Form Target String/3365.cpp b/solutions/3365. Rearrange K Substrings to Form Target String/3365.cpp
deleted file mode 100644
index 6e790bbbb61..00000000000
--- a/solutions/3365. Rearrange K Substrings to Form Target String/3365.cpp	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution {
- public:
-  bool isPossibleToRearrange(string s, string t, int k) {
-    const int n = s.length();
-    return getCount(s, n / k) == getCount(t, n / k);
-  }
-
- private:
-  unordered_map<string, int> getCount(const string& s, int sz) {
-    unordered_map<string, int> count;
-    for (int i = 0; i < s.length(); i += sz)
-      ++count[s.substr(i, sz)];
-    return count;
-  };
-};
diff --git a/solutions/3365. Rearrange K Substrings to Form Target String/3365.java b/solutions/3365. Rearrange K Substrings to Form Target String/3365.java
deleted file mode 100644
index 408a7cd1222..00000000000
--- a/solutions/3365. Rearrange K Substrings to Form Target String/3365.java	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution {
-  public boolean isPossibleToRearrange(String s, String t, int k) {
-    final int n = s.length();
-    return getCount(s, n / k).equals(getCount(t, n / k));
-  }
-
-  private Map<String, Integer> getCount(final String s, int sz) {
-    Map<String, Integer> count = new HashMap<>();
-    for (int i = 0; i < s.length(); i += sz)
-      count.merge(s.substring(i, i + sz), 1, Integer::sum);
-    return count;
-  }
-}
diff --git a/solutions/3365. Rearrange K Substrings to Form Target String/3365.py b/solutions/3365. Rearrange K Substrings to Form Target String/3365.py
deleted file mode 100644
index 9ab35691b66..00000000000
--- a/solutions/3365. Rearrange K Substrings to Form Target String/3365.py	
+++ /dev/null
@@ -1,5 +0,0 @@
-class Solution:
-  def isPossibleToRearrange(self, s: str, t: str, k: int) -> bool:
-    n = len(s)
-    return (collections.Counter(s[i:i + n // k] for i in range(0, n, n // k)) ==
-            collections.Counter(t[i:i + n // k] for i in range(0, n, n // k)))
diff --git a/solutions/3366. Minimum Array Sum/3366-2.cpp b/solutions/3366. Minimum Array Sum/3366-2.cpp
deleted file mode 100644
index d12614e2714..00000000000
--- a/solutions/3366. Minimum Array Sum/3366-2.cpp	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution {
- public:
-  int minArraySum(vector<int>& nums, int k, int op1, int op2) {
-    const int n = nums.size();
-    // dp[i][j][k] := the minimum sum of nums[i..n - 1] with j operations of op1
-    // and k operations of op2
-    vector<vector<vector<int>>> dp(
-        n + 1, vector<vector<int>>(op1 + 1, vector<int>(op2 + 1, INT_MAX)));
-
-    // Base case: When index reaches the end of the array, the result is 0.
-    for (int i = 0; i <= op1; ++i)
-      for (int j = 0; j <= op2; ++j)
-        dp[n][i][j] = 0;
-
-    for (int i = n - 1; i >= 0; --i)
-      for (int o1 = 0; o1 <= op1; ++o1)
-        for (int o2 = 0; o2 <= op2; ++o2) {
-          int sum = nums[i] + dp[i + 1][o1][o2];
-          if (o1 > 0)
-            sum = min(sum, (nums[i] + 1) / 2 + dp[i + 1][o1 - 1][o2]);
-          if (o2 > 0 && nums[i] >= k)
-            sum = min(sum, nums[i] - k + dp[i + 1][o1][o2 - 1]);
-          if (o1 > 0 && o2 > 0) {
-            if ((nums[i] + 1) / 2 >= k)
-              sum = min(sum, (nums[i] + 1) / 2 - k + dp[i + 1][o1 - 1][o2 - 1]);
-            if (nums[i] >= k)
-              sum = min(sum, (nums[i] - k + 1) / 2 + dp[i + 1][o1 - 1][o2 - 1]);
-          }
-          dp[i][o1][o2] = sum;
-        }
-
-    return dp[0][op1][op2];
-  }
-};
diff --git a/solutions/3366. Minimum Array Sum/3366-2.java b/solutions/3366. Minimum Array Sum/3366-2.java
deleted file mode 100644
index 7e878d768f6..00000000000
--- a/solutions/3366. Minimum Array Sum/3366-2.java	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution {
-  public int minArraySum(int[] nums, int k, int op1, int op2) {
-    final int n = nums.length;
-    // dp[i][j][k] := the minimum sum of nums[i..n - 1] with j operations of op1
-    // and k operations of op2
-    int[][][] dp = new int[n + 1][op1 + 1][op2 + 1];
-
-    Arrays.stream(dp).forEach(
-        A -> Arrays.stream(A).forEach(B -> Arrays.fill(B, Integer.MAX_VALUE)));
-
-    // Base case: When index reaches the end of the array, the result is 0.
-    for (int i = 0; i <= op1; ++i)
-      for (int j = 0; j <= op2; ++j)
-        dp[n][i][j] = 0;
-
-    for (int i = n - 1; i >= 0; --i)
-      for (int o1 = 0; o1 <= op1; ++o1)
-        for (int o2 = 0; o2 <= op2; ++o2) {
-          int sum = nums[i] + dp[i + 1][o1][o2];
-          if (o1 > 0)
-            sum = Math.min(sum, (nums[i] + 1) / 2 + dp[i + 1][o1 - 1][o2]);
-          if (o2 > 0 && nums[i] >= k)
-            sum = Math.min(sum, nums[i] - k + dp[i + 1][o1][o2 - 1]);
-          if (o1 > 0 && o2 > 0) {
-            if ((nums[i] + 1) / 2 >= k)
-              sum = Math.min(sum, (nums[i] + 1) / 2 - k + dp[i + 1][o1 - 1][o2 - 1]);
-            if (nums[i] >= k)
-              sum = Math.min(sum, (nums[i] - k + 1) / 2 + dp[i + 1][o1 - 1][o2 - 1]);
-          }
-          dp[i][o1][o2] = sum;
-        }
-
-    return dp[0][op1][op2];
-  }
-}
diff --git a/solutions/3366. Minimum Array Sum/3366-2.py b/solutions/3366. Minimum Array Sum/3366-2.py
deleted file mode 100644
index 92c5f8798eb..00000000000
--- a/solutions/3366. Minimum Array Sum/3366-2.py	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution:
-  def minArraySum(self, nums: list[int], k: int, op1: int, op2: int) -> int:
-    n = len(nums)
-    # dp[i][j][k] := the minimum sum of nums[i..n - 1] with j operations of op1
-    # and k operations of op2
-    dp = [[[math.inf] * (op2 + 1)
-          for _ in range(op1 + 1)]
-          for _ in range(n + 1)]
-
-    # Base case: When index reaches the end of the array, the result is 0.
-    for i in range(op1 + 1):
-      for j in range(op2 + 1):
-        dp[n][i][j] = 0
-
-    for i in range(n - 1, -1, -1):
-      for o1 in range(op1 + 1):
-        for o2 in range(op2 + 1):
-          summ = nums[i] + dp[i + 1][o1][o2]
-          if o1 > 0:
-            summ = min(summ, (nums[i] + 1) // 2 + dp[i + 1][o1 - 1][o2])
-          if o2 > 0 and nums[i] >= k:
-            summ = min(summ, nums[i] - k + dp[i + 1][o1][o2 - 1])
-          if o1 > 0 and o2 > 0:
-            if (nums[i] + 1) // 2 >= k:
-              summ = min(summ,
-                         (nums[i] + 1) // 2 - k + dp[i + 1][o1 - 1][o2 - 1])
-            if nums[i] >= k:
-              summ = min(summ,
-                         (nums[i] - k + 1) // 2 + dp[i + 1][o1 - 1][o2 - 1])
-          dp[i][o1][o2] = summ
-
-    return dp[0][op1][op2]
diff --git a/solutions/3366. Minimum Array Sum/3366.cpp b/solutions/3366. Minimum Array Sum/3366.cpp
deleted file mode 100644
index ad4e9eec2ee..00000000000
--- a/solutions/3366. Minimum Array Sum/3366.cpp	
+++ /dev/null
@@ -1,36 +0,0 @@
-class Solution {
- public:
-  int minArraySum(vector<int>& nums, int k, int op1, int op2) {
-    vector<vector<vector<int>>> mem(
-        nums.size(),
-        vector<vector<int>>(op1 + 1, vector<int>(op2 + 1, INT_MAX)));
-    return minArraySum(nums, 0, op1, op2, k, mem);
-  }
-
- private:
-  // Returns the minimum sum of nums[i..n - 1] with `op1` operations of op1 and
-  // `op2` operations of op2.
-  int minArraySum(const vector<int>& nums, int i, int op1, int op2, int k,
-                  vector<vector<vector<int>>>& mem) {
-    if (i == nums.size())
-      return 0;
-    if (mem[i][op1][op2] != INT_MAX)
-      return mem[i][op1][op2];
-    int res = nums[i] + minArraySum(nums, i + 1, op1, op2, k, mem);
-    if (op1 > 0)
-      res = min(res, (nums[i] + 1) / 2 +
-                         minArraySum(nums, i + 1, op1 - 1, op2, k, mem));
-    if (op2 > 0 && nums[i] >= k)
-      res = min(res,
-                nums[i] - k + minArraySum(nums, i + 1, op1, op2 - 1, k, mem));
-    if (op1 > 0 && op2 > 0) {
-      if ((nums[i] + 1) / 2 >= k)
-        res = min(res, (nums[i] + 1) / 2 - k +
-                           minArraySum(nums, i + 1, op1 - 1, op2 - 1, k, mem));
-      if (nums[i] >= k)
-        res = min(res, (nums[i] - k + 1) / 2 +
-                           minArraySum(nums, i + 1, op1 - 1, op2 - 1, k, mem));
-    }
-    return mem[i][op1][op2] = res;
-  }
-};
diff --git a/solutions/3366. Minimum Array Sum/3366.java b/solutions/3366. Minimum Array Sum/3366.java
deleted file mode 100644
index 1b9a23c0233..00000000000
--- a/solutions/3366. Minimum Array Sum/3366.java	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution {
-  public int minArraySum(int[] nums, int k, int op1, int op2) {
-    Integer[][][] mem = new Integer[nums.length][op1 + 1][op2 + 1];
-    return minArraySum(nums, 0, op1, op2, k, mem);
-  }
-
-  // Returns the minimum sum of nums[i..n - 1] with `op1` operations of op1 and
-  // `op2` operations of op2.
-  private int minArraySum(int[] nums, int i, int op1, int op2, int k, Integer[][][] mem) {
-    if (i == nums.length)
-      return 0;
-    if (mem[i][op1][op2] != null)
-      return mem[i][op1][op2];
-    int res = nums[i] + minArraySum(nums, i + 1, op1, op2, k, mem);
-    if (op1 > 0)
-      res = Math.min(res, (nums[i] + 1) / 2 + minArraySum(nums, i + 1, op1 - 1, op2, k, mem));
-    if (op2 > 0 && nums[i] >= k)
-      res = Math.min(res, nums[i] - k + minArraySum(nums, i + 1, op1, op2 - 1, k, mem));
-    if (op1 > 0 && op2 > 0) {
-      if ((nums[i] + 1) / 2 >= k)
-        res = Math.min(res,
-                       (nums[i] + 1) / 2 - k + minArraySum(nums, i + 1, op1 - 1, op2 - 1, k, mem));
-      if (nums[i] >= k)
-        res = Math.min(res,
-                       (nums[i] - k + 1) / 2 + minArraySum(nums, i + 1, op1 - 1, op2 - 1, k, mem));
-    }
-    return mem[i][op1][op2] = res;
-  }
-}
diff --git a/solutions/3366. Minimum Array Sum/3366.py b/solutions/3366. Minimum Array Sum/3366.py
deleted file mode 100644
index 6b3a15879fb..00000000000
--- a/solutions/3366. Minimum Array Sum/3366.py	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution:
-  def minArraySum(self, nums: list[int], k: int, op1: int, op2: int) -> int:
-    @functools.lru_cache(None)
-    def dp(i: int, op1: int, op2: int) -> int:
-      """
-      Returns the minimum sum of nums[i..n - 1] with `op1` operations of op1 and
-      `op2` operations of op2.
-      """
-      if i == len(nums):
-        return 0
-      res = nums[i] + dp(i + 1, op1, op2)
-      if op1 > 0:
-        res = min(res, (nums[i] + 1) // 2 + dp(i + 1, op1 - 1, op2))
-      if op2 > 0 and nums[i] >= k:
-        res = min(res, nums[i] - k + dp(i + 1, op1, op2 - 1))
-      if op1 > 0 and op2 > 0:
-        if (nums[i] + 1) // 2 >= k:
-          res = min(res, (nums[i] + 1) // 2 - k + dp(i + 1, op1 - 1, op2 - 1))
-        if nums[i] >= k:
-          res = min(res, (nums[i] - k + 1) // 2 + dp(i + 1, op1 - 1, op2 - 1))
-      return res
-
-    return dp(0, op1, op2)
diff --git a/solutions/3367. Maximize Sum of Weights after Edge Removals/3367.cpp b/solutions/3367. Maximize Sum of Weights after Edge Removals/3367.cpp
deleted file mode 100644
index a340da327e0..00000000000
--- a/solutions/3367. Maximize Sum of Weights after Edge Removals/3367.cpp	
+++ /dev/null
@@ -1,47 +0,0 @@
-class Solution {
- public:
-  long long maximizeSumOfWeights(vector<vector<int>>& edges, int k) {
-    const int n = edges.size() + 1;
-    vector<vector<pair<int, int>>> graph(n);
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      const int w = edge[2];
-      graph[u].emplace_back(v, w);
-      graph[v].emplace_back(u, w);
-    }
-
-    return dfs(graph, 0, -1, k).second;
-  }
-
-  // Returns
-  // (the weight sum of the subtree rooted at u with at most k - 1 children,
-  //  the weight sum of the subtree rooted at u with at most k children).
-  pair<long, long> dfs(const vector<vector<pair<int, int>>>& graph, int u,
-                       int prev, int k) {
-    long weightSum = 0;
-    priority_queue<long> diffs;
-
-    for (const auto& [v, w] : graph[u]) {
-      if (v == prev)
-        continue;
-      const auto [subK1, subK] = dfs(graph, v, u, k);
-      weightSum += subK;
-      // If picking (u, v) makes the sum larger, we should pick it.
-      diffs.push(max(0L, subK1 - subK + w));
-    }
-
-    long topK1 = 0;
-    long topK = 0;
-
-    for (int i = 0; i < k && !diffs.empty(); ++i) {
-      if (i < k - 1)
-        topK1 += diffs.top();
-      topK += diffs.top();
-      diffs.pop();
-    }
-
-    return {weightSum + topK1, weightSum + topK};
-  };
-};
diff --git a/solutions/3367. Maximize Sum of Weights after Edge Removals/3367.java b/solutions/3367. Maximize Sum of Weights after Edge Removals/3367.java
deleted file mode 100644
index d7fde3d6c52..00000000000
--- a/solutions/3367. Maximize Sum of Weights after Edge Removals/3367.java	
+++ /dev/null
@@ -1,49 +0,0 @@
-class Solution {
-  public long maximizeSumOfWeights(int[][] edges, int k) {
-    final int n = edges.length + 1;
-    List<Pair<Integer, Integer>>[] graph = new List[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      final int w = edge[2];
-      graph[u].add(new Pair<>(v, w));
-      graph[v].add(new Pair<>(u, w));
-    }
-
-    return dfs(graph, 0, -1, k).getValue();
-  }
-
-  // Returns
-  // (the weight sum of the subtree rooted at u with at most k - 1 children,
-  //  the weight sum of the subtree rooted at u with at most k children).
-  private Pair<Long, Long> dfs(List<Pair<Integer, Integer>>[] graph, int u, int prev, int k) {
-    long weightSum = 0;
-    Queue<Long> diffs = new PriorityQueue<>(Collections.reverseOrder());
-
-    for (Pair<Integer, Integer> pair : graph[u]) {
-      final int v = pair.getKey();
-      final int w = pair.getValue();
-      if (v == prev)
-        continue;
-      Pair<Long, Long> subResult = dfs(graph, v, u, k);
-      final long subK1 = subResult.getKey();
-      final long subK = subResult.getValue();
-      weightSum += subK;
-      // If picking (u, v) makes the sum larger, we should pick it.
-      diffs.offer(Math.max(0L, subK1 - subK + w));
-    }
-
-    long topK1 = 0;
-    long topK = 0;
-
-    for (int i = 0; i < k && !diffs.isEmpty(); ++i) {
-      if (i < k - 1)
-        topK1 += diffs.peek();
-      topK += diffs.poll();
-    }
-
-    return new Pair<>(weightSum + topK1, weightSum + topK);
-  }
-}
diff --git a/solutions/3367. Maximize Sum of Weights after Edge Removals/3367.py b/solutions/3367. Maximize Sum of Weights after Edge Removals/3367.py
deleted file mode 100644
index 39be20dd2f0..00000000000
--- a/solutions/3367. Maximize Sum of Weights after Edge Removals/3367.py	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution:
-  def maximizeSumOfWeights(self, edges: list[list[int]], k: int) -> int:
-    graph = [[] for _ in range(len(edges) + 1)]
-
-    for u, v, w in edges:
-      graph[u].append((v, w))
-      graph[v].append((u, w))
-
-    def dfs(u: int, prev: int) -> tuple[int, int]:
-      """
-      Returns
-      (the weight sum of the subtree rooted at u with at most k - 1 children,
-       the weight sum of the subtree rooted at u with at most k children).
-      """
-      weightSum = 0
-      diffs = []
-      for v, w in graph[u]:
-        if v == prev:
-          continue
-        subK1, subK = dfs(v, u)
-        weightSum += subK
-        # If picking (u, v) makes the sum larger, we should pick it.
-        diffs.append(max(0, subK1 - subK + w))
-      return (weightSum + sum(heapq.nlargest(k - 1, diffs)),
-              weightSum + sum(heapq.nlargest(k, diffs)))
-
-    return dfs(0, -1)[1]
diff --git a/solutions/3368. First Letter Capitalization/3368.sql b/solutions/3368. First Letter Capitalization/3368.sql
deleted file mode 100644
index 4b5d997e6f2..00000000000
--- a/solutions/3368. First Letter Capitalization/3368.sql	
+++ /dev/null
@@ -1,46 +0,0 @@
-WITH RECURSIVE
-  Words AS (
-    -- Extract the first word and assign a token index.
-    SELECT
-      content_id,
-      SUBSTRING_INDEX(content_text, ' ', 1) AS word,
-      SUBSTRING(
-        content_text,
-        LENGTH(SUBSTRING_INDEX(content_text, ' ', 1)) + 2
-      ) AS remaining_text,
-      1 AS token_index
-    FROM user_content
-    UNION ALL
-    -- Recursively extract the next word and increment the token index.
-    SELECT
-      content_id,
-      SUBSTRING_INDEX(remaining_text, ' ', 1) AS word,
-      SUBSTRING(
-        remaining_text,
-        LENGTH(SUBSTRING_INDEX(remaining_text, ' ', 1)) + 2
-      ) AS remaining_text,
-      token_index + 1 AS token_index
-    FROM Words
-    WHERE remaining_text != ''
-  ),
-  Converted AS (
-    -- Combine the words back in original order with proper capitalization.
-    SELECT
-      content_id,
-      GROUP_CONCAT(
-        CONCAT(
-          UPPER(SUBSTRING(word, 1, 1)),
-          LOWER(SUBSTRING(word, 2))
-        )
-        ORDER BY token_index SEPARATOR ' '
-      ) AS converted_text
-    FROM Words
-    GROUP BY 1
-  )
-SELECT
-  UserContent.content_id,
-  UserContent.content_text AS original_text,
-  Converted.converted_text
-FROM user_content AS UserContent
-INNER JOIN Converted
-  USING (content_id);
diff --git a/solutions/3369. Design an Array Statistics Tracker/3369.cpp b/solutions/3369. Design an Array Statistics Tracker/3369.cpp
deleted file mode 100644
index 807bacdf967..00000000000
--- a/solutions/3369. Design an Array Statistics Tracker/3369.cpp	
+++ /dev/null
@@ -1,50 +0,0 @@
-class StatisticsTracker {
- public:
-  void addNumber(int number) {
-    q.push(number);
-    ++count[number];
-    sortedList.insert(number);
-    modeMaxHeap.emplace(count[number], -number);
-    sum += number;
-  }
-
-  void removeFirstAddedNumber() {
-    const int number = q.front();
-    q.pop();
-    if (--count[number])
-      count.erase(number);
-    sortedList.erase(sortedList.find(number));
-    // Note: No need to update the heap now; we'll clean up stale entries when
-    // getting the mode.
-    sum -= number;
-  }
-
-  int getMean() {
-    return sum / q.size();
-  }
-
-  int getMedian() {
-    auto it = sortedList.begin();
-    advance(it, sortedList.size() / 2);
-    return *it;
-  }
-
-  int getMode() {
-    // Removes stale entries from the top of the heap.
-    while (!modeMaxHeap.empty()) {
-      const int frequency = modeMaxHeap.top().first;
-      const int number = -modeMaxHeap.top().second;
-      if (count.contains(number) && count[number] == frequency)
-        return number;
-      modeMaxHeap.pop();
-    }
-    throw;
-  }
-
- private:
-  queue<int> q;
-  unordered_map<int, int> count;
-  multiset<int> sortedList;
-  priority_queue<pair<int, int>> modeMaxHeap;  // (frequency, number)
-  long sum = 0;
-};
diff --git a/solutions/3369. Design an Array Statistics Tracker/3369.java b/solutions/3369. Design an Array Statistics Tracker/3369.java
deleted file mode 100644
index 81d4ee35d27..00000000000
--- a/solutions/3369. Design an Array Statistics Tracker/3369.java	
+++ /dev/null
@@ -1,57 +0,0 @@
-class StatisticsTracker {
-  public void addNumber(int number) {
-    q.offer(number);
-    count.merge(number, 1, Integer::sum);
-    sortedList.merge(number, 1, Integer::sum);
-    modeMaxHeap.offer(new Pair<>(count.get(number), number));
-    sum += number;
-  }
-
-  public void removeFirstAddedNumber() {
-    final int number = q.poll();
-    count.merge(number, -1, Integer::sum);
-    if (count.get(number) == 0)
-      count.remove(number);
-    sortedList.merge(number, -1, Integer::sum);
-    if (sortedList.get(number) == 0)
-      sortedList.remove(number);
-    sum -= number;
-  }
-
-  public int getMean() {
-    return (int) (sum / q.size());
-  }
-
-  public int getMedian() {
-    final int midIndex = q.size() / 2; // Median depends on the queue size.
-    int count = 0;
-    for (Map.Entry<Integer, Integer> entry : sortedList.entrySet()) {
-      count += entry.getValue();
-      if (count > midIndex)
-        return entry.getKey();
-    }
-    throw new IllegalArgumentException();
-  }
-
-  public int getMode() {
-    // Removes stale entries from the top of the heap.
-    while (!modeMaxHeap.isEmpty()) {
-      final int frequency = modeMaxHeap.peek().getKey();
-      final int number = modeMaxHeap.peek().getValue();
-      if (count.containsKey(number) && count.get(number) == frequency)
-        return number;
-      modeMaxHeap.poll();
-    }
-    throw new IllegalArgumentException();
-  }
-
-  private Queue<Integer> q = new LinkedList<>();
-  private Map<Integer, Integer> count = new HashMap<>();
-  private TreeMap<Integer, Integer> sortedList = new TreeMap<>();
-  // (frequency, number)
-  private PriorityQueue<Pair<Integer, Integer>> modeMaxHeap =
-      new PriorityQueue<>(Comparator.comparingInt(Pair<Integer, Integer>::getKey)
-                              .reversed()
-                              .thenComparingInt(Pair<Integer, Integer>::getValue));
-  private long sum = 0;
-}
diff --git a/solutions/3369. Design an Array Statistics Tracker/3369.py b/solutions/3369. Design an Array Statistics Tracker/3369.py
deleted file mode 100644
index 0bddc0bf4eb..00000000000
--- a/solutions/3369. Design an Array Statistics Tracker/3369.py	
+++ /dev/null
@@ -1,40 +0,0 @@
-from sortedcontainers import SortedList
-
-
-class StatisticsTracker:
-  def __init__(self):
-    self.q = collections.deque()
-    self.count = collections.Counter()
-    self.sortedList = SortedList()
-    self.modeMaxHeap = []  # (frequency, number)
-    self.sum = 0
-
-  def addNumber(self, number: int) -> None:
-    self.q.append(number)
-    self.count[number] += 1
-    self.sortedList.add(number)
-    heapq.heappush(self.modeMaxHeap, (-self.count[number], number))
-    self.sum += number
-
-  def removeFirstAddedNumber(self) -> None:
-    number = self.q.popleft()
-    self.count[number] -= 1
-    self.sortedList.remove(number)
-    # Note: No need to update the heap now; we'll clean up stale entries when
-    # getting the mode.
-    self.sum -= number
-
-  def getMean(self) -> int:
-    return self.sum // len(self.q)
-
-  def getMedian(self) -> int:
-    return self.sortedList[len(self.sortedList) // 2]
-
-  def getMode(self) -> int:
-    # Removes stale heap entries where frequency no longer matches.
-    while self.modeMaxHeap:
-      frequency = -self.modeMaxHeap[0][0]
-      number = self.modeMaxHeap[0][1]
-      if self.count[number] == frequency:
-        return number
-      heapq.heappop(self.modeMaxHeap)
diff --git a/solutions/337. House Robber III/337.py b/solutions/337. House Robber III/337.py
index be34931334c..d0e30a19edf 100644
--- a/solutions/337. House Robber III/337.py	
+++ b/solutions/337. House Robber III/337.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def rob(self, root: TreeNode | None) -> int:
-    def robOrNot(root: TreeNode | None) -> tuple:
+  def rob(self, root: Optional[TreeNode]) -> int:
+    def robOrNot(root: Optional[TreeNode]) -> tuple:
       if not root:
         return (0, 0)
 
diff --git a/solutions/3370. Smallest Number With All Set Bits/3370.cpp b/solutions/3370. Smallest Number With All Set Bits/3370.cpp
deleted file mode 100644
index febd527f69c..00000000000
--- a/solutions/3370. Smallest Number With All Set Bits/3370.cpp	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution {
- public:
-  int smallestNumber(int n) {
-    return (1 << bitLength(n)) - 1;
-  }
-
- private:
-  int bitLength(int n) {
-    return 32 - __builtin_clz(n);
-  }
-};
diff --git a/solutions/3370. Smallest Number With All Set Bits/3370.java b/solutions/3370. Smallest Number With All Set Bits/3370.java
deleted file mode 100644
index a69314756c0..00000000000
--- a/solutions/3370. Smallest Number With All Set Bits/3370.java	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution {
-  public int smallestNumber(int n) {
-    return (1 << bitLength(n)) - 1;
-  }
-
-  private int bitLength(int n) {
-    return Integer.SIZE - Integer.numberOfLeadingZeros(n);
-  }
-}
diff --git a/solutions/3370. Smallest Number With All Set Bits/3370.py b/solutions/3370. Smallest Number With All Set Bits/3370.py
deleted file mode 100644
index d28b3bfe7e6..00000000000
--- a/solutions/3370. Smallest Number With All Set Bits/3370.py	
+++ /dev/null
@@ -1,3 +0,0 @@
-class Solution:
-  def smallestNumber(self, n: int) -> int:
-    return (1 << n.bit_length()) - 1
diff --git a/solutions/3371. Identify the Largest Outlier in an Array/3371.cpp b/solutions/3371. Identify the Largest Outlier in an Array/3371.cpp
deleted file mode 100644
index 938500264f8..00000000000
--- a/solutions/3371. Identify the Largest Outlier in an Array/3371.cpp	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
- public:
-  int getLargestOutlier(vector<int>& nums) {
-    const int sum = accumulate(nums.begin(), nums.end(), 0);
-    int ans = INT_MIN;
-    unordered_map<int, int> count;
-
-    for (const int num : nums)
-      ++count[num];
-
-    for (const int num : nums) {
-      const int withoutNum = sum - num;
-      if (withoutNum % 2 == 0) {
-        const int specialSum = withoutNum / 2;  // the sum of special numbers
-        if (count[specialSum] > (num == specialSum ? 1 : 0))
-          ans = max(ans, num);
-      }
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3371. Identify the Largest Outlier in an Array/3371.java b/solutions/3371. Identify the Largest Outlier in an Array/3371.java
deleted file mode 100644
index 844de27462e..00000000000
--- a/solutions/3371. Identify the Largest Outlier in an Array/3371.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public int getLargestOutlier(int[] nums) {
-    final int sum = Arrays.stream(nums).sum();
-    int ans = Integer.MIN_VALUE;
-    Map<Integer, Integer> count = new HashMap<>();
-
-    for (final int num : nums)
-      count.merge(num, 1, Integer::sum);
-
-    for (final int num : nums) {
-      final int withoutNum = sum - num;
-      if (withoutNum % 2 == 0) {
-        final int specialSum = withoutNum / 2; // the sum of special numbers
-        if (count.getOrDefault(specialSum, 0) > (num == specialSum ? 1 : 0))
-          ans = Math.max(ans, num);
-      }
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3371. Identify the Largest Outlier in an Array/3371.py b/solutions/3371. Identify the Largest Outlier in an Array/3371.py
deleted file mode 100644
index fdeed9112be..00000000000
--- a/solutions/3371. Identify the Largest Outlier in an Array/3371.py	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution:
-  def getLargestOutlier(self, nums: list[int]) -> int:
-    ans = -math.inf
-    summ = sum(nums)
-    count = collections.Counter(nums)
-
-    for num in nums:
-      withoutNum = summ - num
-      if withoutNum % 2 == 0:
-        specialSum = withoutNum // 2  # the sum of special numbers
-        if count[specialSum] > (1 if num == specialSum else 0):
-          ans = max(ans, num)
-
-    return ans
diff --git a/solutions/3372. Maximize the Number of Target Nodes After Connecting Trees I/3372.cpp b/solutions/3372. Maximize the Number of Target Nodes After Connecting Trees I/3372.cpp
deleted file mode 100644
index af5e8d4a7a0..00000000000
--- a/solutions/3372. Maximize the Number of Target Nodes After Connecting Trees I/3372.cpp	
+++ /dev/null
@@ -1,43 +0,0 @@
-class Solution {
- public:
-  vector<int> maxTargetNodes(vector<vector<int>>& edges1,
-                             vector<vector<int>>& edges2, int k) {
-    vector<int> ans;
-    const vector<vector<int>> graph1 = buildGraph(edges1);
-    const vector<vector<int>> graph2 = buildGraph(edges2);
-    int maxReachableInGraph2 = 0;
-
-    if (k > 0)
-      for (int i = 0; i < edges2.size() + 1; ++i)
-        maxReachableInGraph2 =
-            max(maxReachableInGraph2, dfs(graph2, i, -1, k - 1));
-
-    for (int i = 0; i < edges1.size() + 1; ++i)
-      ans.push_back(maxReachableInGraph2 + dfs(graph1, i, -1, k));
-
-    return ans;
-  }
-
- private:
-  // Returns the number of nodes that can be reached from u with k steps.
-  int dfs(const vector<vector<int>>& graph, int u, int prev, int k) {
-    if (k == 0)
-      return 1;
-    int res = 0;
-    for (const int v : graph[u])
-      if (v != prev)
-        res += dfs(graph, v, u, k - 1);
-    return 1 + res;
-  }
-
-  vector<vector<int>> buildGraph(const vector<vector<int>>& edges) {
-    vector<vector<int>> graph(edges.size() + 1);
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      graph[u].push_back(v);
-      graph[v].push_back(u);
-    }
-    return graph;
-  }
-};
diff --git a/solutions/3372. Maximize the Number of Target Nodes After Connecting Trees I/3372.java b/solutions/3372. Maximize the Number of Target Nodes After Connecting Trees I/3372.java
deleted file mode 100644
index c8948f94168..00000000000
--- a/solutions/3372. Maximize the Number of Target Nodes After Connecting Trees I/3372.java	
+++ /dev/null
@@ -1,41 +0,0 @@
-class Solution {
-  public int[] maxTargetNodes(int[][] edges1, int[][] edges2, int k) {
-    int[] ans = new int[edges1.length + 1];
-    List<Integer>[] graph1 = buildGraph(edges1);
-    List<Integer>[] graph2 = buildGraph(edges2);
-    int maxReachableInGraph2 = 0;
-
-    if (k > 0)
-      for (int i = 0; i < edges2.length + 1; ++i)
-        maxReachableInGraph2 = Math.max(maxReachableInGraph2, dfs(graph2, i, -1, k - 1));
-
-    for (int i = 0; i < edges1.length + 1; ++i)
-      ans[i] = maxReachableInGraph2 + dfs(graph1, i, -1, k);
-
-    return ans;
-  }
-
-  // Returns the number of nodes that can be reached from u with k steps.
-  private int dfs(List<Integer>[] graph, int u, int prev, int k) {
-    if (k == 0)
-      return 1;
-    int res = 0;
-    for (final int v : graph[u])
-      if (v != prev)
-        res += dfs(graph, v, u, k - 1);
-    return 1 + res;
-  }
-
-  private List<Integer>[] buildGraph(int[][] edges) {
-    List<Integer>[] graph = new ArrayList[edges.length + 1];
-    for (int i = 0; i < edges.length + 1; ++i)
-      graph[i] = new ArrayList<>();
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      graph[u].add(v);
-      graph[v].add(u);
-    }
-    return graph;
-  }
-}
diff --git a/solutions/3372. Maximize the Number of Target Nodes After Connecting Trees I/3372.py b/solutions/3372. Maximize the Number of Target Nodes After Connecting Trees I/3372.py
deleted file mode 100644
index a3414976443..00000000000
--- a/solutions/3372. Maximize the Number of Target Nodes After Connecting Trees I/3372.py	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution:
-  def maxTargetNodes(
-      self,
-      edges1: list[list[int]],
-      edges2: list[list[int]],
-      k: int
-  ) -> list[int]:
-    graph1 = self._buildGraph(edges1)
-    graph2 = self._buildGraph(edges2)
-    maxReachableInGraph2 = 0
-
-    if k > 0:
-      for i in range(len(edges2) + 1):
-        maxReachableInGraph2 = max(maxReachableInGraph2,
-                                   self._dfs(graph2, i, -1, k - 1))
-
-    return [maxReachableInGraph2 + self._dfs(graph1, i, -1, k)
-            for i in range(len(edges1) + 1)]
-
-  def _dfs(self, graph: list[list[int]], u: int, prev: int, k: int) -> int:
-    """Returns the number of nodes that can be reached from u with k steps."""
-    if k == 0:
-      return 1
-    res = 0
-    for v in graph[u]:
-      if v != prev:
-        res += self._dfs(graph, v, u, k - 1)
-    return 1 + res
-
-  def _buildGraph(self, edges: list[list[int]]) -> list[list[int]]:
-    graph = [[] for _ in range(len(edges) + 1)]
-    for u, v in edges:
-      graph[u].append(v)
-      graph[v].append(u)
-    return graph
diff --git a/solutions/3373. Maximize the Number of Target Nodes After Connecting Trees II/3373.cpp b/solutions/3373. Maximize the Number of Target Nodes After Connecting Trees II/3373.cpp
deleted file mode 100644
index 7be64445be1..00000000000
--- a/solutions/3373. Maximize the Number of Target Nodes After Connecting Trees II/3373.cpp	
+++ /dev/null
@@ -1,50 +0,0 @@
-class Solution {
- public:
-  vector<int> maxTargetNodes(vector<vector<int>>& edges1,
-                             vector<vector<int>>& edges2) {
-    const int n = edges1.size() + 1;
-    const int m = edges2.size() + 1;
-    vector<int> ans;
-    const vector<vector<int>> graph1 = buildGraph(edges1);
-    const vector<vector<int>> graph2 = buildGraph(edges2);
-    vector<bool> parity1(n);
-    vector<bool> parity2(m);  // placeholder (parity2 is not used)
-    const int even1 = dfs(graph1, 0, -1, parity1, /*isEven=*/true);
-    const int even2 = dfs(graph2, 0, -1, parity2, /*isEven=*/true);
-    const int odd1 = n - even1;
-    const int odd2 = m - even2;
-
-    for (int i = 0; i < n; ++i) {
-      const int tree1 = parity1[i] ? even1 : odd1;
-      // Can connect the current node in tree1 to either an even node or an odd
-      // node in tree2.
-      const int tree2 = max(even2, odd2);
-      ans.push_back(tree1 + tree2);
-    }
-
-    return ans;
-  }
-
- private:
-  // Returns the number of nodes that can be reached from u with even steps.
-  int dfs(const vector<vector<int>>& graph, int u, int prev,
-          vector<bool>& parity, bool isEven) {
-    int res = isEven ? 1 : 0;
-    parity[u] = isEven;
-    for (const int v : graph[u])
-      if (v != prev)
-        res += dfs(graph, v, u, parity, !isEven);
-    return res;
-  }
-
-  vector<vector<int>> buildGraph(const vector<vector<int>>& edges) {
-    vector<vector<int>> graph(edges.size() + 1);
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      graph[u].push_back(v);
-      graph[v].push_back(u);
-    }
-    return graph;
-  }
-};
diff --git a/solutions/3373. Maximize the Number of Target Nodes After Connecting Trees II/3373.java b/solutions/3373. Maximize the Number of Target Nodes After Connecting Trees II/3373.java
deleted file mode 100644
index 1ffcb107040..00000000000
--- a/solutions/3373. Maximize the Number of Target Nodes After Connecting Trees II/3373.java	
+++ /dev/null
@@ -1,48 +0,0 @@
-class Solution {
-  public int[] maxTargetNodes(int[][] edges1, int[][] edges2) {
-    final int n = edges1.length + 1;
-    final int m = edges2.length + 1;
-    List<Integer>[] graph1 = buildGraph(edges1, n);
-    List<Integer>[] graph2 = buildGraph(edges2, m);
-    boolean[] parity1 = new boolean[n];
-    boolean[] parity2 = new boolean[m]; // Placeholder (not used)
-    final int even1 = dfs(graph1, 0, -1, parity1, true);
-    final int even2 = dfs(graph2, 0, -1, parity2, true);
-    final int odd1 = n - even1;
-    final int odd2 = m - even2;
-    int[] ans = new int[n];
-
-    for (int i = 0; i < n; i++) {
-      final int tree1 = parity1[i] ? even1 : odd1;
-      // Can connect the current node in tree1 to either an even or an odd node
-      // in tree2.
-      final int tree2 = Math.max(even2, odd2);
-      ans[i] = tree1 + tree2;
-    }
-
-    return ans;
-  }
-
-  // Returns the number of nodes that can be reached from u with even steps.
-  private int dfs(List<Integer>[] graph, int u, int prev, boolean[] parity, boolean isEven) {
-    int res = isEven ? 1 : 0;
-    parity[u] = isEven;
-    for (final int v : graph[u])
-      if (v != prev)
-        res += dfs(graph, v, u, parity, !isEven);
-    return res;
-  }
-
-  private List<Integer>[] buildGraph(int[][] edges, int n) {
-    List<Integer>[] graph = new ArrayList[n];
-    for (int i = 0; i < n; i++)
-      graph[i] = new ArrayList<>();
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      graph[u].add(v);
-      graph[v].add(u);
-    }
-    return graph;
-  }
-}
diff --git a/solutions/3373. Maximize the Number of Target Nodes After Connecting Trees II/3373.py b/solutions/3373. Maximize the Number of Target Nodes After Connecting Trees II/3373.py
deleted file mode 100644
index c30f49943cf..00000000000
--- a/solutions/3373. Maximize the Number of Target Nodes After Connecting Trees II/3373.py	
+++ /dev/null
@@ -1,46 +0,0 @@
-class Solution:
-  def maxTargetNodes(
-      self,
-      edges1: list[list[int]],
-      edges2: list[list[int]]
-  ) -> list[int]:
-    n = len(edges1) + 1
-    m = len(edges2) + 1
-    graph1 = self._buildGraph(edges1)
-    graph2 = self._buildGraph(edges2)
-    parity1 = [False] * n
-    parity2 = [False] * m  # placeholder (parity2 is not used)
-    even1 = self._dfs(graph1, 0, -1, parity1, True)
-    even2 = self._dfs(graph2, 0, -1, parity2, True)
-    odd1 = n - even1
-    odd2 = m - even2
-
-    # Can connect the current node in tree1 to either an even node or an odd
-    # node in tree2.
-    return [(even1 if parity1[i] else odd1) + max(even2, odd2)
-            for i in range(n)]
-
-  def _dfs(
-      self,
-      graph: list[list[int]],
-      u: int,
-      prev: int,
-      parity: list[bool],
-      isEven: bool
-  ) -> int:
-    """
-    Returns the number of nodes that can be reached from u with even steps.
-    """
-    res = 1 if isEven else 0
-    parity[u] = isEven
-    for v in graph[u]:
-      if v != prev:
-        res += self._dfs(graph, v, u, parity, not isEven)
-    return res
-
-  def _buildGraph(self, edges: list[list[int]]) -> list[list[int]]:
-    graph = [[] for _ in range(len(edges) + 1)]
-    for u, v in edges:
-      graph[u].append(v)
-      graph[v].append(u)
-    return graph
diff --git a/solutions/3374. First Letter Capitalization II/3374.sql b/solutions/3374. First Letter Capitalization II/3374.sql
deleted file mode 100644
index 7933ee162e5..00000000000
--- a/solutions/3374. First Letter Capitalization II/3374.sql	
+++ /dev/null
@@ -1,56 +0,0 @@
-WITH RECURSIVE
-  Words AS (
-    -- Extract the first word and assign a token index.
-    SELECT
-      content_id,
-      SUBSTRING_INDEX(content_text, ' ', 1) AS word,
-      SUBSTRING(
-        content_text,
-        LENGTH(SUBSTRING_INDEX(content_text, ' ', 1)) + 2
-      ) AS remaining_text,
-      1 AS token_index
-    FROM user_content
-    UNION ALL
-    -- Recursively extract the next word and increment the token index.
-    SELECT
-      content_id,
-      SUBSTRING_INDEX(remaining_text, ' ', 1) AS word,
-      SUBSTRING(
-        remaining_text,
-        LENGTH(SUBSTRING_INDEX(remaining_text, ' ', 1)) + 2
-      ) AS remaining_text,
-      token_index + 1 AS token_index
-    FROM Words
-    WHERE remaining_text != ''
-  ),
-  Converted AS (
-    -- Combine the words back in original order with proper capitalization.
-    SELECT
-      content_id,
-      GROUP_CONCAT(
-        IF(
-          word LIKE '%-%',
-          CONCAT(
-            UPPER(SUBSTRING(word, 1, 1)),
-            LOWER(SUBSTRING(word, 2, LOCATE('-', word) - 2)),
-            '-',
-            UPPER(SUBSTRING(SUBSTRING_INDEX(word, '-', -1), 1, 1)),
-            LOWER(SUBSTRING(SUBSTRING_INDEX(word, '-', -1), 2))
-          ),
-          CONCAT(
-            UPPER(SUBSTRING(word, 1, 1)),
-            LOWER(SUBSTRING(word, 2))
-          )
-        )
-        ORDER BY token_index SEPARATOR ' '
-      ) AS converted_text
-    FROM Words
-    GROUP BY 1
-  )
-SELECT
-  UserContent.content_id,
-  UserContent.content_text AS original_text,
-  Converted.converted_text
-FROM user_content AS UserContent
-INNER JOIN Converted
-  USING (content_id);
diff --git a/solutions/3375. Minimum Operations to Make Array Values Equal to K/3375.cpp b/solutions/3375. Minimum Operations to Make Array Values Equal to K/3375.cpp
deleted file mode 100644
index de5d8790068..00000000000
--- a/solutions/3375. Minimum Operations to Make Array Values Equal to K/3375.cpp	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution {
- public:
-  int minOperations(vector<int>& nums, int k) {
-    const unordered_set<int> numsSet{nums.begin(), nums.end()};
-    const int mn = ranges::min(nums);
-    if (mn < k)
-      return -1;
-    if (mn > k)
-      return numsSet.size();
-    return numsSet.size() - 1;
-  }
-};
diff --git a/solutions/3375. Minimum Operations to Make Array Values Equal to K/3375.java b/solutions/3375. Minimum Operations to Make Array Values Equal to K/3375.java
deleted file mode 100644
index 781ba01559d..00000000000
--- a/solutions/3375. Minimum Operations to Make Array Values Equal to K/3375.java	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution {
-  public int minOperations(int[] nums, int k) {
-    Set<Integer> numsSet = Arrays.stream(nums).boxed().collect(Collectors.toSet());
-    final int mn = Arrays.stream(nums).min().getAsInt();
-    if (mn < k)
-      return -1;
-    if (mn > k)
-      return numsSet.size();
-    return numsSet.size() - 1;
-  }
-}
diff --git a/solutions/3375. Minimum Operations to Make Array Values Equal to K/3375.py b/solutions/3375. Minimum Operations to Make Array Values Equal to K/3375.py
deleted file mode 100644
index 39e56ff01be..00000000000
--- a/solutions/3375. Minimum Operations to Make Array Values Equal to K/3375.py	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution:
-  def minOperations(self, nums: list[int], k: int) -> int:
-    numsSet = set(nums)
-    mn = min(nums)
-    if mn < k:
-      return -1
-    if mn > k:
-      return len(numsSet)
-    return len(numsSet) - 1
diff --git a/solutions/3376. Minimum Time to Break Locks I/3376.cpp b/solutions/3376. Minimum Time to Break Locks I/3376.cpp
deleted file mode 100644
index 07f0360a96c..00000000000
--- a/solutions/3376. Minimum Time to Break Locks I/3376.cpp	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
- public:
-  int findMinimumTime(vector<int>& strength, int K) {
-    return find(strength, /*x=*/1, 0, K);
-  }
-
- private:
-  int find(const vector<int>& strength, int x, int mask, int k) {
-    if (mask == (1 << strength.size()) - 1)
-      return 0;
-    int res = INT_MAX;
-    for (int i = 0; i < strength.size(); ++i)
-      if ((mask >> i & 1) == 0) {
-        const int time = (strength[i] - 1) / x + 1;  // ceil(strength[i] / x)
-        res = min(res, time + find(strength, x + k, mask | 1 << i, k));
-      }
-    return res;
-  }
-};
diff --git a/solutions/3377. Digit Operations to Make Two Integers Equal/3377.cpp b/solutions/3377. Digit Operations to Make Two Integers Equal/3377.cpp
deleted file mode 100644
index 77f28f5a261..00000000000
--- a/solutions/3377. Digit Operations to Make Two Integers Equal/3377.cpp	
+++ /dev/null
@@ -1,59 +0,0 @@
-class Solution {
- public:
-  int minOperations(int n, int m) {
-    constexpr int kMax = 10000;
-    const vector<bool> isPrime = sieveEratosthenes(kMax);
-    if (isPrime[n] || isPrime[m])
-      return -1;
-    return dijkstra(n, m, isPrime);
-  }
-
- private:
-  int dijkstra(int src, int dst, const vector<bool>& isPrime) {
-    unordered_set<int> seen{src};
-    using P = tuple<int, int>;  // (cost, num)
-    priority_queue<P, vector<P>, greater<>> minHeap;
-    minHeap.emplace(src, src);
-
-    while (!minHeap.empty()) {
-      const auto [cost, curr] = minHeap.top();
-      minHeap.pop();
-      if (curr == dst)
-        return cost;
-      string s = to_string(curr);
-      for (int i = 0; i < s.length(); ++i) {
-        if (s[i] < '9') {
-          ++s[i];
-          const int next = stoi(s);
-          if (!isPrime[next] && !seen.contains(next)) {
-            minHeap.emplace(cost + next, next);
-            seen.insert(next);
-          }
-          --s[i];
-        }
-        if (s[i] > '0' && !(i == 0 && s[i] == '1')) {
-          --s[i];
-          const int next = stoi(s);
-          if (!isPrime[next] && !seen.contains(next)) {
-            minHeap.emplace(cost + next, next);
-            seen.insert(next);
-          }
-          ++s[i];
-        }
-      }
-    }
-
-    return -1;
-  }
-
-  vector<bool> sieveEratosthenes(int n) {
-    vector<bool> isPrime(n, true);
-    isPrime[0] = false;
-    isPrime[1] = false;
-    for (int i = 2; i * i < n; ++i)
-      if (isPrime[i])
-        for (int j = i * i; j < n; j += i)
-          isPrime[j] = false;
-    return isPrime;
-  }
-};
diff --git a/solutions/3377. Digit Operations to Make Two Integers Equal/3377.java b/solutions/3377. Digit Operations to Make Two Integers Equal/3377.java
deleted file mode 100644
index 4e5caee2cf0..00000000000
--- a/solutions/3377. Digit Operations to Make Two Integers Equal/3377.java	
+++ /dev/null
@@ -1,59 +0,0 @@
-class Solution {
-  public int minOperations(int n, int m) {
-    final int MAX = 10000;
-    boolean[] isPrime = sieveEratosthenes(MAX);
-    if (isPrime[n] || isPrime[m])
-      return -1;
-    return dijkstra(n, m, isPrime);
-  }
-
-  private int dijkstra(int src, int dst, boolean[] isPrime) {
-    Set<Integer> seen = new HashSet<>(Arrays.asList(src));
-    // (cost, num)
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey));
-    minHeap.offer(new Pair<>(src, src));
-
-    while (!minHeap.isEmpty()) {
-      final int cost = minHeap.peek().getKey();
-      final int curr = minHeap.poll().getValue();
-      if (curr == dst)
-        return cost;
-      final String s = Integer.toString(curr);
-      for (int i = 0; i < s.length(); ++i) {
-        char[] chars = s.toCharArray();
-        if (chars[i] < '9') {
-          ++chars[i];
-          final int next = Integer.parseInt(new String(chars));
-          if (!isPrime[next] && !seen.contains(next)) {
-            minHeap.offer(new Pair<>(cost + next, next));
-            seen.add(next);
-          }
-          --chars[i];
-        }
-        if (chars[i] > '0' && !(i == 0 && chars[i] == '1')) {
-          --chars[i];
-          final int next = Integer.parseInt(new String(chars));
-          if (!isPrime[next] && !seen.contains(next)) {
-            minHeap.offer(new Pair<>(cost + next, next));
-            seen.add(next);
-          }
-        }
-      }
-    }
-
-    return -1;
-  }
-
-  private boolean[] sieveEratosthenes(int n) {
-    boolean[] isPrime = new boolean[n];
-    Arrays.fill(isPrime, true);
-    isPrime[0] = false;
-    isPrime[1] = false;
-    for (int i = 2; i * i < n; ++i)
-      if (isPrime[i])
-        for (int j = i * i; j < n; j += i)
-          isPrime[j] = false;
-    return isPrime;
-  }
-}
diff --git a/solutions/3377. Digit Operations to Make Two Integers Equal/3377.py b/solutions/3377. Digit Operations to Make Two Integers Equal/3377.py
deleted file mode 100644
index 9b6b6a48766..00000000000
--- a/solutions/3377. Digit Operations to Make Two Integers Equal/3377.py	
+++ /dev/null
@@ -1,43 +0,0 @@
-class Solution:
-  def minOperations(self, n: int, m: int) -> int:
-    isPrime = self._sieveEratosthenes(10000)
-    if isPrime[n] or isPrime[m]:
-      return -1
-    return self._dijkstra(n, m, isPrime)
-
-  def _dijkstra(self, src: int, dst: int, isPrime: list[bool]) -> int:
-    seen = {src}
-    minHeap = [(src, src)]  # (cost, num)
-
-    while minHeap:
-      cost, curr = heapq.heappop(minHeap)
-      if curr == dst:
-        return cost
-      s = list(str(curr))
-      for i, c in enumerate(s):
-        if c < '9':
-          s[i] = str(int(c) + 1)
-          nextNum = int(''.join(s))
-          if not isPrime[nextNum] and nextNum not in seen:
-            heapq.heappush(minHeap, (cost + nextNum, nextNum))
-            seen.add(nextNum)
-          s[i] = c
-        if c > '0' and not (i == 0 and c == '1'):
-          s[i] = str(int(c) - 1)
-          nextNum = int(''.join(s))
-          if not isPrime[nextNum] and nextNum not in seen:
-            heapq.heappush(minHeap, (cost + nextNum, nextNum))
-            seen.add(nextNum)
-          s[i] = c
-
-    return -1
-
-  def _sieveEratosthenes(self, n: int) -> list[bool]:
-    isPrime = [True] * n
-    isPrime[0] = False
-    isPrime[1] = False
-    for i in range(2, int(n**0.5) + 1):
-      if isPrime[i]:
-        for j in range(i * i, n, i):
-          isPrime[j] = False
-    return isPrime
diff --git a/solutions/3378. Count Connected Components in LCM Graph/3378.cpp b/solutions/3378. Count Connected Components in LCM Graph/3378.cpp
deleted file mode 100644
index 369ee738e72..00000000000
--- a/solutions/3378. Count Connected Components in LCM Graph/3378.cpp	
+++ /dev/null
@@ -1,43 +0,0 @@
-class UnionFind {
- public:
-  void unionByRank(int u, int v) {
-    const int i = find(u);
-    const int j = find(v);
-    if (i == j)
-      return;
-    if (rank[i] < rank[j]) {
-      id[i] = j;
-    } else if (rank[i] > rank[j]) {
-      id[j] = i;
-    } else {
-      id[i] = j;
-      ++rank[j];
-    }
-  }
-
-  int find(int u) {
-    if (!id.contains(u))
-      id[u] = u;
-    return id[u] == u ? u : id[u] = find(id[u]);
-  }
-
- private:
-  unordered_map<int, int> id;
-  unordered_map<int, int> rank;
-};
-
-class Solution {
- public:
-  int countComponents(vector<int>& nums, int threshold) {
-    UnionFind uf;
-
-    for (const int num : nums)
-      for (int multiple = 2 * num; multiple <= threshold; multiple += num)
-        uf.unionByRank(num, multiple);
-
-    unordered_set<int> components;
-    for (const int num : nums)
-      components.insert(uf.find(num));
-    return components.size();
-  }
-};
diff --git a/solutions/3378. Count Connected Components in LCM Graph/3378.java b/solutions/3378. Count Connected Components in LCM Graph/3378.java
deleted file mode 100644
index 3aa9c90de87..00000000000
--- a/solutions/3378. Count Connected Components in LCM Graph/3378.java	
+++ /dev/null
@@ -1,41 +0,0 @@
-class UnionFind {
-  public void unionByRank(int u, int v) {
-    final int i = find(u);
-    final int j = find(v);
-    if (i == j)
-      return;
-    if (rank.get(i) < rank.get(j)) {
-      id.put(i, j);
-    } else if (rank.get(i) > rank.get(j)) {
-      id.put(j, i);
-    } else {
-      id.put(i, j);
-      rank.merge(j, 1, Integer::sum);
-    }
-  }
-
-  public int find(int u) {
-    if (!id.containsKey(u)) {
-      id.put(u, u);
-      rank.put(u, 0);
-    }
-    if (id.get(u) != u)
-      id.put(u, find(id.get(u)));
-    return id.get(u);
-  }
-
-  private Map<Integer, Integer> id = new HashMap<>();
-  private Map<Integer, Integer> rank = new HashMap<>();
-}
-
-class Solution {
-  public int countComponents(int[] nums, int threshold) {
-    UnionFind uf = new UnionFind();
-
-    for (final int num : nums)
-      for (int multiple = 2 * num; multiple <= threshold; multiple += num)
-        uf.unionByRank(num, multiple);
-
-    return Arrays.stream(nums).map(uf::find).boxed().collect(Collectors.toSet()).size();
-  }
-}
diff --git a/solutions/3378. Count Connected Components in LCM Graph/3378.py b/solutions/3378. Count Connected Components in LCM Graph/3378.py
deleted file mode 100644
index 3c1e01574b9..00000000000
--- a/solutions/3378. Count Connected Components in LCM Graph/3378.py	
+++ /dev/null
@@ -1,35 +0,0 @@
-class UnionFind:
-  def __init__(self):
-    self.id = {}
-    self.rank = collections.Counter()
-
-  def unionByRank(self, u: int, v: int) -> None:
-    i = self.find(u)
-    j = self.find(v)
-    if i == j:
-      return
-    if self.rank[i] < self.rank[j]:
-      self.id[i] = j
-    elif self.rank[i] > self.rank[j]:
-      self.id[j] = i
-    else:
-      self.id[i] = j
-      self.rank[j] += 1
-
-  def find(self, u: int) -> int:
-    if u not in self.id:
-      self.id[u] = u
-    if self.id[u] != u:
-      self.id[u] = self.find(self.id[u])
-    return self.id[u]
-
-
-class Solution:
-  def countComponents(self, nums: list[int], threshold: int) -> int:
-    uf = UnionFind()
-
-    for num in nums:
-      for multiple in range(2 * num, threshold + 1, num):
-        uf.unionByRank(num, multiple)
-
-    return len(set(uf.find(num) for num in nums))
diff --git a/solutions/3379. Transformed Array/3379.cpp b/solutions/3379. Transformed Array/3379.cpp
deleted file mode 100644
index 2b229e0e4c3..00000000000
--- a/solutions/3379. Transformed Array/3379.cpp	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution {
- public:
-  vector<int> constructTransformedArray(vector<int>& nums) {
-    const int n = nums.size();
-    vector<int> ans;
-
-    for (int i = 0; i < n; ++i)
-      ans.push_back(nums[(i + nums[i] % n + n) % n]);
-
-    return ans;
-  }
-};
diff --git a/solutions/3379. Transformed Array/3379.java b/solutions/3379. Transformed Array/3379.java
deleted file mode 100644
index 2bebd0405d3..00000000000
--- a/solutions/3379. Transformed Array/3379.java	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution {
-  public int[] constructTransformedArray(int[] nums) {
-    final int n = nums.length;
-    int[] ans = new int[n];
-
-    for (int i = 0; i < n; ++i)
-      ans[i] = nums[(i + nums[i] % n + n) % n];
-
-    return ans;
-  }
-}
diff --git a/solutions/3379. Transformed Array/3379.py b/solutions/3379. Transformed Array/3379.py
deleted file mode 100644
index 9d6bbfe5a26..00000000000
--- a/solutions/3379. Transformed Array/3379.py	
+++ /dev/null
@@ -1,5 +0,0 @@
-class Solution:
-  def constructTransformedArray(self, nums: list[int]) -> list[int]:
-    n = len(nums)
-    return [nums[(i + num % n + n) % n]
-            for i, num in enumerate(nums)]
diff --git a/solutions/338. Counting Bits/338.py b/solutions/338. Counting Bits/338.py
index 3fd9453f73a..41124ef24f6 100644
--- a/solutions/338. Counting Bits/338.py	
+++ b/solutions/338. Counting Bits/338.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countBits(self, n: int) -> list[int]:
+  def countBits(self, n: int) -> List[int]:
     # f(i) := i's number of 1s in bitmask
     # f(i) = f(i / 2) + i % 2
     ans = [0] * (n + 1)
diff --git a/solutions/3380. Maximum Area Rectangle With Point Constraints I/3380.cpp b/solutions/3380. Maximum Area Rectangle With Point Constraints I/3380.cpp
deleted file mode 100644
index 038b8441fac..00000000000
--- a/solutions/3380. Maximum Area Rectangle With Point Constraints I/3380.cpp	
+++ /dev/null
@@ -1,91 +0,0 @@
-class SegmentTree {
- public:
-  explicit SegmentTree(int n, int kInf) : kInf(kInf), n(n), tree(4 * n, kInf) {}
-
-  // Updates nums[i] to val.
-  void update(int i, int val) {
-    update(0, 0, n - 1, i, val);
-  }
-
-  // Returns min(nums[i..j]).
-  int query(int i, int j) const {
-    return query(0, 0, n - 1, i, j);
-  }
-
- private:
-  const int kInf;    // the invalid value
-  const int n;       // the size of the input array
-  vector<int> tree;  // the segment tree
-
-  void update(int treeIndex, int lo, int hi, int i, int val) {
-    if (lo == hi) {
-      tree[treeIndex] = val;
-      return;
-    }
-    const int mid = (lo + hi) / 2;
-    if (i <= mid)
-      update(2 * treeIndex + 1, lo, mid, i, val);
-    else
-      update(2 * treeIndex + 2, mid + 1, hi, i, val);
-    tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
-  }
-
-  int query(int treeIndex, int lo, int hi, int i, int j) const {
-    if (i <= lo && hi <= j)  // [lo, hi] lies completely inside [i, j].
-      return tree[treeIndex];
-    if (j < lo || hi < i)  // [lo, hi] lies completely outside [i, j].
-      return kInf;
-    const int mid = (lo + hi) / 2;
-    return merge(query(treeIndex * 2 + 1, lo, mid, i, j),
-                 query(treeIndex * 2 + 2, mid + 1, hi, i, j));
-  }
-
-  int merge(int left, int right) const {
-    return max(left, right);
-  }
-};
-
-class Solution {
- public:
-  int maxRectangleArea(vector<vector<int>>& points) {
-    int ans = -1;
-    ranges::sort(points);
-    const vector<int> ys = getUniqueAndSortedYs(points);
-    SegmentTree tree(ys.size(), /*kInf=*/-1);
-    unordered_map<int, int> yToIndex;
-    unordered_map<int, int> yToX;
-
-    for (int i = 0; i < ys.size(); ++i)
-      yToIndex[ys[i]] = i;
-
-    int prevX = points[0][0];
-    int prevY = points[0][1];
-
-    for (int i = 1; i < points.size(); ++i) {
-      const int x = points[i][0];
-      const int y = points[i][1];
-      if (yToX.contains(prevY) && yToX.contains(y)) {
-        const int xLeft = yToX[y];
-        if (prevX == x && yToX[prevY] == xLeft &&
-            xLeft > tree.query(yToIndex[prevY] + 1, yToIndex[y] - 1))
-          ans = max(ans, (y - prevY) * (x - xLeft));
-      }
-      yToX[prevY] = prevX;
-      tree.update(yToIndex[prevY], prevX);
-      prevX = x;
-      prevY = y;
-    }
-
-    return ans;
-  }
-
- private:
-  vector<int> getUniqueAndSortedYs(const vector<vector<int>>& points) {
-    vector<int> ys;
-    for (const vector<int>& point : points)
-      ys.push_back(point[1]);
-    ranges::sort(ys);
-    ys.erase(unique(ys.begin(), ys.end()), ys.end());
-    return ys;
-  }
-};
diff --git a/solutions/3381. Maximum Subarray Sum With Length Divisible by K/3381.cpp b/solutions/3381. Maximum Subarray Sum With Length Divisible by K/3381.cpp
deleted file mode 100644
index efa8bbbb5cc..00000000000
--- a/solutions/3381. Maximum Subarray Sum With Length Divisible by K/3381.cpp	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
- public:
-  long long maxSubarraySum(std::vector<int>& nums, int k) {
-    long ans = LONG_MIN;
-    long prefix = 0;
-    // minPrefix[i % k] := the minimum prefix sum of the first i numbers
-    vector<long> minPrefix(k, LONG_MAX / 2);
-    minPrefix[k - 1] = 0;
-
-    for (int i = 0; i < nums.size(); ++i) {
-      prefix += nums[i];
-      ans = max(ans, prefix - minPrefix[i % k]);
-      minPrefix[i % k] = min(minPrefix[i % k], prefix);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3381. Maximum Subarray Sum With Length Divisible by K/3381.java b/solutions/3381. Maximum Subarray Sum With Length Divisible by K/3381.java
deleted file mode 100644
index 3d61d9abfc9..00000000000
--- a/solutions/3381. Maximum Subarray Sum With Length Divisible by K/3381.java	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
-  public long maxSubarraySum(int[] nums, int k) {
-    long ans = Long.MIN_VALUE;
-    long prefix = 0;
-    // minPrefix[i % k] := the minimum prefix sum of the first i numbers
-    long[] minPrefix = new long[k];
-    Arrays.fill(minPrefix, Long.MAX_VALUE / 2);
-    minPrefix[k - 1] = 0;
-
-    for (int i = 0; i < nums.length; ++i) {
-      prefix += nums[i];
-      ans = Math.max(ans, prefix - minPrefix[i % k]);
-      minPrefix[i % k] = Math.min(minPrefix[i % k], prefix);
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3381. Maximum Subarray Sum With Length Divisible by K/3381.py b/solutions/3381. Maximum Subarray Sum With Length Divisible by K/3381.py
deleted file mode 100644
index 407fc630b39..00000000000
--- a/solutions/3381. Maximum Subarray Sum With Length Divisible by K/3381.py	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution:
-  def maxSubarraySum(self, nums: list[int], k: int) -> int:
-    ans = -math.inf
-    prefix = 0
-    # minPrefix[i % k] := the minimum prefix sum of the first i numbers
-    minPrefix = [math.inf] * k
-    minPrefix[k - 1] = 0
-
-    for i, num in enumerate(nums):
-      prefix += num
-      ans = max(ans, prefix - minPrefix[i % k])
-      minPrefix[i % k] = min(minPrefix[i % k], prefix)
-
-    return ans
diff --git a/solutions/3382. Maximum Area Rectangle With Point Constraints II/3382.cpp b/solutions/3382. Maximum Area Rectangle With Point Constraints II/3382.cpp
deleted file mode 100644
index f33ca1c654f..00000000000
--- a/solutions/3382. Maximum Area Rectangle With Point Constraints II/3382.cpp	
+++ /dev/null
@@ -1,96 +0,0 @@
-class SegmentTree {
- public:
-  explicit SegmentTree(int n, int kInf) : kInf(kInf), n(n), tree(4 * n, kInf) {}
-
-  // Updates nums[i] to val.
-  void update(int i, int val) {
-    update(0, 0, n - 1, i, val);
-  }
-
-  // Returns min(nums[i..j]).
-  int query(int i, int j) const {
-    return query(0, 0, n - 1, i, j);
-  }
-
- private:
-  const int kInf;    // the invalid value
-  const int n;       // the size of the input array
-  vector<int> tree;  // the segment tree
-
-  void update(int treeIndex, int lo, int hi, int i, int val) {
-    if (lo == hi) {
-      tree[treeIndex] = val;
-      return;
-    }
-    const int mid = (lo + hi) / 2;
-    if (i <= mid)
-      update(2 * treeIndex + 1, lo, mid, i, val);
-    else
-      update(2 * treeIndex + 2, mid + 1, hi, i, val);
-    tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
-  }
-
-  int query(int treeIndex, int lo, int hi, int i, int j) const {
-    if (i <= lo && hi <= j)  // [lo, hi] lies completely inside [i, j].
-      return tree[treeIndex];
-    if (j < lo || hi < i)  // [lo, hi] lies completely outside [i, j].
-      return kInf;
-    const int mid = (lo + hi) / 2;
-    return merge(query(treeIndex * 2 + 1, lo, mid, i, j),
-                 query(treeIndex * 2 + 2, mid + 1, hi, i, j));
-  }
-
-  int merge(int left, int right) const {
-    return max(left, right);
-  }
-};
-
-class Solution {
- public:
-  // Same as 3380. Maximum Area Rectangle With Point Constraints I
-  long long maxRectangleArea(vector<int>& xCoord, vector<int>& yCoord) {
-    long ans = -1;
-    const vector<pair<int, int>> points = getSortedPoints(xCoord, yCoord);
-    const vector<int> ys = getUniqueAndSortedYs(yCoord);
-    SegmentTree tree(ys.size(), /*kInf=*/-1);
-    unordered_map<int, int> yToIndex;
-    unordered_map<int, int> yToX;
-
-    for (int i = 0; i < ys.size(); ++i)
-      yToIndex[ys[i]] = i;
-
-    auto [prevX, prevY] = points[0];
-    for (int i = 1; i < points.size(); ++i) {
-      const auto [x, y] = points[i];
-      if (yToX.contains(prevY) && yToX.contains(y)) {
-        const int xLeft = yToX[y];
-        if (prevX == x && yToX[prevY] == xLeft &&
-            xLeft > tree.query(yToIndex[prevY] + 1, yToIndex[y] - 1))
-          ans = max(ans, static_cast<long>(y - prevY) * (x - xLeft));
-      }
-      yToX[prevY] = prevX;
-      tree.update(yToIndex[prevY], prevX);
-      prevX = x;
-      prevY = y;
-    }
-
-    return ans;
-  }
-
- private:
-  vector<pair<int, int>> getSortedPoints(const vector<int>& xCoord,
-                                         const vector<int>& yCoord) {
-    vector<pair<int, int>> points;
-    for (int i = 0; i < xCoord.size(); ++i)
-      points.emplace_back(xCoord[i], yCoord[i]);
-    ranges::sort(points);
-    return points;
-  }
-
-  vector<int> getUniqueAndSortedYs(const vector<int>& yCoord) {
-    vector<int> ys = yCoord;
-    ranges::sort(ys);
-    ys.erase(unique(ys.begin(), ys.end()), ys.end());
-    return ys;
-  }
-};
diff --git a/solutions/3383. Minimum Runes to Add to Cast Spell/3383.cpp b/solutions/3383. Minimum Runes to Add to Cast Spell/3383.cpp
deleted file mode 100644
index 95437af6e3f..00000000000
--- a/solutions/3383. Minimum Runes to Add to Cast Spell/3383.cpp	
+++ /dev/null
@@ -1,76 +0,0 @@
-class Solution {
- public:
-  int minRunesToAdd(int n, vector<int>& crystals, vector<int>& flowFrom,
-                    vector<int>& flowTo) {
-    vector<vector<int>> graph(n);
-    vector<vector<int>> reversedGraph(n);
-
-    for (int i = 0; i < flowFrom.size(); ++i) {
-      const int u = flowFrom[i];
-      const int v = flowTo[i];
-      graph[u].push_back(v);
-      reversedGraph[v].push_back(u);
-    }
-
-    // Identify Strongly Connected Components (SCC) using Kosaraju's Algorithm
-    vector<bool> seen(n);
-    vector<int> orderStack;
-    vector<int> componentIds(n, -1);
-    int componentCount = 0;
-
-    for (int i = 0; i < n; ++i)
-      if (!seen[i])
-        kosaraju(graph, i, seen, orderStack);
-
-    for (int i = n - 1; i >= 0; --i) {
-      const int u = orderStack[i];
-      if (componentIds[u] == -1)
-        identifySCC(reversedGraph, u, componentIds, componentCount++);
-    }
-
-    // Track crystal-containing components and inter-component edges.
-    vector<bool> hasCrystal(componentCount);
-    vector<bool> hasInterComponentEdge(componentCount);
-
-    for (const int u : crystals)
-      hasCrystal[componentIds[u]] = true;
-
-    for (int i = 0; i < flowFrom.size(); ++i) {
-      const int id1 = componentIds[flowFrom[i]];
-      const int id2 = componentIds[flowTo[i]];
-      if (id1 != id2)  // Edge is inter-component.
-        hasInterComponentEdge[id2] = true;
-    }
-
-    // Count components requiring additional runes.
-    int ans = 0;
-
-    for (int i = 0; i < componentCount; ++i)
-      if (!hasCrystal[i] && !hasInterComponentEdge[i])
-        ++ans;
-
-    return ans;
-  }
-
- private:
-  // Creates a topological order stack using Kosaraju's Algorithm.
-  void kosaraju(const vector<vector<int>>& graph, int u, vector<bool>& seen,
-                vector<int>& orderStack) {
-    seen[u] = true;
-    for (const int v : graph[u])
-      if (!seen[v])
-        kosaraju(graph, v, seen, orderStack);
-    orderStack.push_back(u);
-  }
-
-  // Assigns component IDs during SCC identification in the second DFS.
-  void identifySCC(const vector<vector<int>>& reversedGraph, int u,
-                   vector<int>& componentIds, int componentId) {
-    if (componentIds[u] != -1)
-      return;
-    componentIds[u] = componentId;
-    for (const int v : reversedGraph[u])
-      if (componentIds[v] < 0)
-        identifySCC(reversedGraph, v, componentIds, componentId);
-  }
-};
diff --git a/solutions/3383. Minimum Runes to Add to Cast Spell/3383.java b/solutions/3383. Minimum Runes to Add to Cast Spell/3383.java
deleted file mode 100644
index 7d96d0e3cad..00000000000
--- a/solutions/3383. Minimum Runes to Add to Cast Spell/3383.java	
+++ /dev/null
@@ -1,79 +0,0 @@
-class Solution {
-  public int minRunesToAdd(int n, int[] crystals, int[] flowFrom, int[] flowTo) {
-    List<Integer>[] graph = new ArrayList[n];
-    List<Integer>[] reversedGraph = new ArrayList[n];
-
-    for (int i = 0; i < n; ++i) {
-      graph[i] = new ArrayList<>();
-      reversedGraph[i] = new ArrayList<>();
-    }
-
-    for (int i = 0; i < flowFrom.length; ++i) {
-      final int u = flowFrom[i];
-      final int v = flowTo[i];
-      graph[u].add(v);
-      reversedGraph[v].add(u);
-    }
-
-    // Identify Strongly Connected Components (SCC) using Kosaraju's Algorithm.
-    boolean[] seen = new boolean[n];
-    List<Integer> orderStack = new ArrayList<>();
-    int[] componentIds = new int[n];
-    int componentCount = 0;
-
-    for (int i = 0; i < n; ++i)
-      if (!seen[i])
-        kosaraju(graph, i, seen, orderStack);
-
-    Arrays.fill(componentIds, -1);
-
-    for (int i = orderStack.size() - 1; i >= 0; --i) {
-      final int u = orderStack.get(i);
-      if (componentIds[u] == -1)
-        identifySCC(reversedGraph, u, componentIds, componentCount++);
-    }
-
-    // Track crystal-containing components and inter-component edges.
-    boolean[] hasCrystal = new boolean[componentCount];
-    boolean[] hasInterComponentEdge = new boolean[componentCount];
-
-    for (final int u : crystals)
-      hasCrystal[componentIds[u]] = true;
-
-    for (int i = 0; i < flowFrom.length; ++i) {
-      final int id1 = componentIds[flowFrom[i]];
-      final int id2 = componentIds[flowTo[i]];
-      if (id1 != id2)
-        hasInterComponentEdge[id2] = true;
-    }
-
-    // Count components requiring additional runes
-    int ans = 0;
-
-    for (int i = 0; i < componentCount; ++i)
-      if (!hasCrystal[i] && !hasInterComponentEdge[i])
-        ++ans;
-
-    return ans;
-  }
-
-  // Creates a topological order stack using Kosaraju's Algorithm.
-  private void kosaraju(List<Integer>[] graph, int u, boolean[] seen, List<Integer> orderStack) {
-    seen[u] = true;
-    for (final int v : graph[u])
-      if (!seen[v])
-        kosaraju(graph, v, seen, orderStack);
-    orderStack.add(u);
-  }
-
-  // Assigns component IDs during SCC identification in the second DFS.
-  private void identifySCC(List<Integer>[] reversedGraph, int u, int[] componentIds,
-                           int componentId) {
-    if (componentIds[u] != -1)
-      return;
-    componentIds[u] = componentId;
-    for (final int v : reversedGraph[u])
-      if (componentIds[v] == -1)
-        identifySCC(reversedGraph, v, componentIds, componentId);
-  }
-}
diff --git a/solutions/3383. Minimum Runes to Add to Cast Spell/3383.py b/solutions/3383. Minimum Runes to Add to Cast Spell/3383.py
deleted file mode 100644
index db6707aecd5..00000000000
--- a/solutions/3383. Minimum Runes to Add to Cast Spell/3383.py	
+++ /dev/null
@@ -1,75 +0,0 @@
-class Solution:
-  def minRunesToAdd(
-      self,
-      n: int,
-      crystals: list[int],
-      flowFrom: list[int],
-      flowTo: list[int]
-  ) -> int:
-    graph = [[] for _ in range(n)]
-    reversedGraph = [[] for _ in range(n)]
-
-    for u, v in zip(flowFrom, flowTo):
-      graph[u].append(v)
-      reversedGraph[v].append(u)
-
-    # Identify Strongly Connected Components (SCC) using Kosaraju's Algorithm.
-    seen = set()
-    orderStack = []
-    componentIds = [-1] * n
-    componentCount = 0
-
-    for i in range(n):
-      if i not in seen:
-        self._kosaraju(graph, i, seen, orderStack)
-
-    while orderStack:
-      u = orderStack.pop()
-      if componentIds[u] == -1:
-        self._identifySCC(reversedGraph, u, componentIds, componentCount)
-        componentCount += 1
-
-    # Track crystal-containing components and inter-component edges.
-    hasCrystal = [False] * componentCount
-    hasInterComponentEdge = [False] * componentCount
-
-    for u in crystals:
-      hasCrystal[componentIds[u]] = True
-
-    for u, v in zip(flowFrom, flowTo):
-      id1 = componentIds[u]
-      id2 = componentIds[v]
-      if id1 != id2:  # Edge is inter-component.
-        hasInterComponentEdge[id2] = True
-
-    return sum(not hasCrystal[i] and not hasInterComponentEdge[i]
-               for i in range(componentCount))
-
-  def _kosaraju(
-      self,
-      graph: list[list[int]],
-      u: int,
-      seen: set[int],
-      orderStack: list
-  ) -> None:
-    """Creates a topological order stack using Kosaraju's Algorithm."""
-    seen.add(u)
-    for v in graph[u]:
-      if v not in seen:
-        self._kosaraju(graph, v, seen, orderStack)
-    orderStack.append(u)
-
-  def _identifySCC(
-      self,
-      reversedGraph: list[list[int]],
-      u: int,
-      componentIds: list[int],
-      componentId: int
-  ) -> None:
-    """Assigns component IDs during SCC identification in the second DFS."""
-    if componentIds[u] != -1:
-      return
-    componentIds[u] = componentId
-    for v in reversedGraph[u]:
-      if componentIds[v] == -1:
-        self._identifySCC(reversedGraph, v, componentIds, componentId)
diff --git a/solutions/3384. Team Dominance by Pass Success/3384.sql b/solutions/3384. Team Dominance by Pass Success/3384.sql
deleted file mode 100644
index 6062fb51790..00000000000
--- a/solutions/3384. Team Dominance by Pass Success/3384.sql	
+++ /dev/null
@@ -1,25 +0,0 @@
-WITH
-  PassDetails AS (
-    SELECT
-      Passes.pass_from,
-      Passes.pass_to,
-      Passes.time_stamp,
-      Team1.team_name AS from_team,
-      Team2.team_name AS to_team,
-      CASE
-        WHEN Passes.time_stamp BETWEEN '00:00' AND '45:00' THEN 1
-        WHEN Passes.time_stamp BETWEEN '45:01' AND '90:00' THEN 2
-      END AS half_number
-    FROM Passes
-    INNER JOIN Teams AS Team1
-      ON (Passes.pass_from = Team1.player_id)
-    INNER JOIN Teams AS Team2
-      ON (Passes.pass_to = Team2.player_id)
-  )
-SELECT
-  from_team AS team_name,
-  half_number,
-  SUM(IF(from_team = to_team, 1, -1)) AS dominance
-FROM PassDetails
-GROUP BY 1, 2
-ORDER BY 1, 2;
diff --git a/solutions/3385. Minimum Time to Break Locks II/3385.cpp b/solutions/3385. Minimum Time to Break Locks II/3385.cpp
deleted file mode 100644
index ae6ed637b0d..00000000000
--- a/solutions/3385. Minimum Time to Break Locks II/3385.cpp	
+++ /dev/null
@@ -1,83 +0,0 @@
-class Solution {
- public:
-  int findMinimumTime(vector<int>& strength) {
-    vector<vector<int>> costs;
-
-    for (int turn = 1; turn <= strength.size(); ++turn) {
-      vector<int> cost;
-      for (const int s : strength)
-        cost.push_back((s + turn - 1) / turn);
-      costs.push_back(cost);
-    }
-
-    return hungarian(costs).back();
-  }
-
- private:
-  // Updates the currentMinimum if potentialMinimum is smaller and returns true.
-  bool updateMinimum(int& currentMinimum, const int& potentialMinimum) {
-    if (potentialMinimum < currentMinimum) {
-      currentMinimum = potentialMinimum;
-      return true;
-    }
-    return false;
-  }
-
-  // Returns an array `res` of length n (costs.length), with `res[i]` equaling
-  // the minimum cost to assign the first (i + 1) turns to the first (i + 1)
-  // locks using Hungarian algorithm, where costs[i][j] is the energy required
-  // to break j-th lock in i-th turn.
-  //
-  // https://en.wikipedia.org/wiki/Hungarian_algorithm
-  vector<int> hungarian(const vector<vector<int>>& costs) {
-    const int numLocks = costs.size();
-    vector<int> res;
-    vector<int> lockAssignments(numLocks + 1, -1);
-    vector<int> turnPotentials(numLocks);
-    vector<int> lockPotentials(numLocks + 1);
-
-    for (int currentTurn = 0; currentTurn < numLocks; ++currentTurn) {
-      int currentLock = numLocks;
-      lockAssignments[currentLock] = currentTurn;
-      vector<int> minReducedCosts(numLocks + 1, INT_MAX);
-      vector<int> previousLockAssignments(numLocks + 1, -1);
-      vector<bool> locksInOptimalPath(numLocks + 1);
-
-      while (lockAssignments[currentLock] != -1) {
-        locksInOptimalPath[currentLock] = true;
-        const int assignedTurn = lockAssignments[currentLock];
-        int minCostDelta = INT_MAX;
-        int nextLock;
-
-        for (int lock = 0; lock < numLocks; ++lock)
-          if (!locksInOptimalPath[lock]) {
-            const int reducedCost = costs[assignedTurn][lock] -
-                                    turnPotentials[assignedTurn] -
-                                    lockPotentials[lock];
-            if (updateMinimum(minReducedCosts[lock], reducedCost))
-              previousLockAssignments[lock] = currentLock;
-            if (updateMinimum(minCostDelta, minReducedCosts[lock]))
-              nextLock = lock;
-          }
-
-        for (int lock = 0; lock <= numLocks; ++lock)
-          if (locksInOptimalPath[lock]) {
-            turnPotentials[lockAssignments[lock]] += minCostDelta;
-            lockPotentials[lock] -= minCostDelta;
-          } else {
-            minReducedCosts[lock] -= minCostDelta;
-          }
-
-        currentLock = nextLock;
-      }
-
-      for (int lock; currentLock != numLocks; currentLock = lock)
-        lockAssignments[currentLock] =
-            lockAssignments[lock = previousLockAssignments[currentLock]];
-
-      res.push_back(-lockPotentials[numLocks]);
-    }
-
-    return res;
-  }
-};
diff --git a/solutions/3385. Minimum Time to Break Locks II/3385.java b/solutions/3385. Minimum Time to Break Locks II/3385.java
deleted file mode 100644
index 03da1330975..00000000000
--- a/solutions/3385. Minimum Time to Break Locks II/3385.java	
+++ /dev/null
@@ -1,78 +0,0 @@
-class Solution {
-  public int findMinimumTime(int[] strength) {
-    int[][] costs = new int[strength.length][strength.length];
-    for (int turn = 1; turn <= strength.length; ++turn)
-      for (int j = 0; j < strength.length; j++)
-        costs[turn - 1][j] = (strength[j] + turn - 1) / turn;
-    return hungarian(costs)[costs.length - 1];
-  }
-
-  // Updates the currentMinimum if potentialMinimum is smaller and returns true.
-  private boolean updateMinimum(int[] currentMinimum, int potentialMinimum, int index) {
-    if (potentialMinimum < currentMinimum[index]) {
-      currentMinimum[index] = potentialMinimum;
-      return true;
-    }
-    return false;
-  }
-
-  // Returns an array `res` of length n (costs.length), with `res[i]` equaling
-  // the minimum cost to assign the first (i + 1) turns to the first (i + 1)
-  // locks using the Hungarian algorithm, where costs[i][j] is the energy required
-  // to break j-th lock in i-th turn.
-  //
-  // https://en.wikipedia.org/wiki/Hungarian_algorithm
-  private int[] hungarian(int[][] costs) {
-    final int numLocks = costs.length;
-    int[] res = new int[numLocks];
-    int[] turnPotentials = new int[numLocks];
-    int[] lockPotentials = new int[numLocks + 1];
-    int[] lockAssignments = new int[numLocks + 1];
-    Arrays.fill(lockAssignments, -1);
-
-    for (int currentTurn = 0; currentTurn < numLocks; ++currentTurn) {
-      int currentLock = numLocks;
-      lockAssignments[currentLock] = currentTurn;
-      int[] minReducedCosts = new int[numLocks + 1];
-      Arrays.fill(minReducedCosts, Integer.MAX_VALUE);
-      int[] previousLockAssignments = new int[numLocks + 1];
-      boolean[] locksInOptimalPath = new boolean[numLocks + 1];
-
-      while (lockAssignments[currentLock] != -1) {
-        locksInOptimalPath[currentLock] = true;
-        int assignedTurn = lockAssignments[currentLock];
-        int minCostDelta = Integer.MAX_VALUE;
-        int nextLock = -1;
-
-        for (int lock = 0; lock < numLocks; ++lock)
-          if (!locksInOptimalPath[lock]) {
-            final int reducedCost =
-                costs[assignedTurn][lock] - turnPotentials[assignedTurn] - lockPotentials[lock];
-            if (updateMinimum(minReducedCosts, reducedCost, lock))
-              previousLockAssignments[lock] = currentLock;
-            if (minReducedCosts[lock] < minCostDelta) {
-              minCostDelta = minReducedCosts[lock];
-              nextLock = lock;
-            }
-          }
-
-        for (int lock = 0; lock <= numLocks; ++lock)
-          if (locksInOptimalPath[lock]) {
-            turnPotentials[lockAssignments[lock]] += minCostDelta;
-            lockPotentials[lock] -= minCostDelta;
-          } else {
-            minReducedCosts[lock] -= minCostDelta;
-          }
-
-        currentLock = nextLock;
-      }
-
-      for (int lock; currentLock != numLocks; currentLock = lock)
-        lockAssignments[currentLock] = lockAssignments[lock = previousLockAssignments[currentLock]];
-
-      res[currentTurn] = -lockPotentials[numLocks];
-    }
-
-    return res;
-  }
-}
diff --git a/solutions/3385. Minimum Time to Break Locks II/3385.py b/solutions/3385. Minimum Time to Break Locks II/3385.py
deleted file mode 100644
index d384c827c3e..00000000000
--- a/solutions/3385. Minimum Time to Break Locks II/3385.py	
+++ /dev/null
@@ -1,66 +0,0 @@
-class Solution:
-  def findMinimumTime(self, strength: list[int]) -> int:
-    costs = [[(s + turn - 1) // turn
-             for s in strength]
-             for turn in range(1, len(strength) + 1)]
-    return self._hungarian(costs)[-1]
-
-  def _hungarian(self, costs):
-    """
-    Returns an array `res` of length n (costs.length), with `res[i]` equaling
-    the minimum cost to assign the first (i + 1) turns to the first (i + 1)
-    locks using Hungarian algorithm, where costs[i][j] is the energy required
-    to break j-th lock in i-th turn.
-
-    https://en.wikipedia.org/wiki/Hungarian_algorithm
-    """
-    numLocks = len(costs)
-    turnPotentials = [0] * numLocks
-    lockPotentials = [0] * (numLocks + 1)
-    lockAssignments = [-1] * (numLocks + 1)
-    res = []
-
-    for currentTurn in range(numLocks):
-      currentLock = numLocks
-      lockAssignments[currentLock] = currentTurn
-      minReducedCosts = [math.inf] * (numLocks + 1)
-      previousLockAssignments = [-1] * (numLocks + 1)
-      locksInOptimalPath = [False] * (numLocks + 1)
-
-      while lockAssignments[currentLock] != -1:
-        locksInOptimalPath[currentLock] = True
-        assignedTurn = lockAssignments[currentLock]
-        minCostDelta = math.inf
-        nextLock = None
-
-        for lock in range(numLocks):
-          if not locksInOptimalPath[lock]:
-            reducedCost = (
-                costs[assignedTurn][lock] -
-                turnPotentials[assignedTurn] -
-                lockPotentials[lock]
-            )
-            oldMin = minReducedCosts[lock]
-            minReducedCosts[lock] = min(oldMin, reducedCost)
-            if minReducedCosts[lock] < oldMin:
-              previousLockAssignments[lock] = currentLock
-            if minReducedCosts[lock] < minCostDelta:
-              minCostDelta = minReducedCosts[lock]
-              nextLock = lock
-
-        for lock in range(numLocks + 1):
-          if locksInOptimalPath[lock]:
-            turnPotentials[lockAssignments[lock]] += minCostDelta
-            lockPotentials[lock] -= minCostDelta
-          else:
-            minReducedCosts[lock] -= minCostDelta
-
-        currentLock = nextLock
-
-      while currentLock != numLocks:
-        lockAssignments[currentLock] = lockAssignments[previousLockAssignments[currentLock]]
-        currentLock = previousLockAssignments[currentLock]
-
-      res.append(-lockPotentials[numLocks])
-
-    return res
diff --git a/solutions/3386. Button with Longest Push Time/3386.cpp b/solutions/3386. Button with Longest Push Time/3386.cpp
deleted file mode 100644
index 91e8787be92..00000000000
--- a/solutions/3386. Button with Longest Push Time/3386.cpp	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
- public:
-  int buttonWithLongestTime(vector<vector<int>>& events) {
-    int ans = 0;
-    int maxTimeTaken = 0;
-    int prevTime = 0;
-
-    for (const vector<int>& event : events) {
-      const int index = event[0];
-      const int time = event[1];
-      const int timeTaken = time - prevTime;
-      if (timeTaken > maxTimeTaken ||
-          timeTaken == maxTimeTaken && index < ans) {
-        maxTimeTaken = timeTaken;
-        ans = index;
-      }
-      prevTime = time;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3386. Button with Longest Push Time/3386.java b/solutions/3386. Button with Longest Push Time/3386.java
deleted file mode 100644
index cbc7cdd7971..00000000000
--- a/solutions/3386. Button with Longest Push Time/3386.java	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
-  public int buttonWithLongestTime(int[][] events) {
-    int ans = 0;
-    int maxTimeTaken = 0;
-    int prevTime = 0;
-
-    for (int[] event : events) {
-      final int index = event[0];
-      final int time = event[1];
-      final int timeTaken = time - prevTime;
-      if (timeTaken > maxTimeTaken || timeTaken == maxTimeTaken && index < ans) {
-        maxTimeTaken = timeTaken;
-        ans = index;
-      }
-      prevTime = time;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3386. Button with Longest Push Time/3386.py b/solutions/3386. Button with Longest Push Time/3386.py
deleted file mode 100644
index 8c740deea87..00000000000
--- a/solutions/3386. Button with Longest Push Time/3386.py	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution:
-  def buttonWithLongestTime(self, events: list[list[int]]) -> int:
-    ans = 0
-    maxTimeTaken = 0
-    prevTime = 0
-
-    for index, time in events:
-      timeTaken = time - prevTime
-      if timeTaken > maxTimeTaken or timeTaken == maxTimeTaken and index < ans:
-        maxTimeTaken = timeTaken
-        ans = index
-      prevTime = time
-
-    return ans
diff --git a/solutions/3387. Maximize Amount After Two Days of Conversions/3387.cpp b/solutions/3387. Maximize Amount After Two Days of Conversions/3387.cpp
deleted file mode 100644
index f28e2623994..00000000000
--- a/solutions/3387. Maximize Amount After Two Days of Conversions/3387.cpp	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
- public:
-  double maxAmount(string initialCurrency, vector<vector<string>>& pairs1,
-                   vector<double>& rates1, vector<vector<string>>& pairs2,
-                   vector<double>& rates2) {
-    // dp[currency] := the maximum amount of money to convert to `currency`
-    unordered_map<string, double> dp{{initialCurrency, 1}};
-    bellman(dp, pairs1, rates1);
-    bellman(dp, pairs2, rates2);
-    return dp[initialCurrency];
-  }
-
- private:
-  void bellman(unordered_map<string, double>& dp,
-               const vector<vector<string>>& pairs,
-               const vector<double>& rates) {
-    for (int relax = 0; relax < pairs.size(); ++relax)
-      for (int i = 0; i < pairs.size(); ++i) {
-        const string start = pairs[i][0];
-        const string target = pairs[i][1];
-        dp[target] = max(dp[target], dp[start] * rates[i]);
-        dp[start] = max(dp[start], dp[target] / rates[i]);
-      }
-  }
-};
diff --git a/solutions/3387. Maximize Amount After Two Days of Conversions/3387.java b/solutions/3387. Maximize Amount After Two Days of Conversions/3387.java
deleted file mode 100644
index 1893ee2c458..00000000000
--- a/solutions/3387. Maximize Amount After Two Days of Conversions/3387.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public double maxAmount(String initialCurrency, List<List<String>> pairs1, double[] rates1,
-                          List<List<String>> pairs2, double[] rates2) {
-    // dp[currency] := the maximum amount of money to convert to `currency`
-    Map<String, Double> dp = new HashMap<>();
-    dp.put(initialCurrency, 1.0);
-    bellman(dp, pairs1, rates1);
-    bellman(dp, pairs2, rates2);
-    return dp.get(initialCurrency);
-  }
-
-  private void bellman(Map<String, Double> dp, List<List<String>> pairs, double[] rates) {
-    for (int relax = 0; relax < pairs.size(); ++relax)
-      for (int i = 0; i < pairs.size(); ++i) {
-        final String start = pairs.get(i).get(0);
-        final String target = pairs.get(i).get(1);
-        dp.merge(target, dp.getOrDefault(start, 0.0) * rates[i], Double::max);
-        dp.merge(start, dp.getOrDefault(target, 0.0) / rates[i], Double::max);
-      }
-  }
-}
diff --git a/solutions/3387. Maximize Amount After Two Days of Conversions/3387.py b/solutions/3387. Maximize Amount After Two Days of Conversions/3387.py
deleted file mode 100644
index a098c96970d..00000000000
--- a/solutions/3387. Maximize Amount After Two Days of Conversions/3387.py	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution:
-  def maxAmount(
-      self,
-      initialCurrency: str,
-      pairs1: list[list[str]],
-      rates1: list[float],
-      pairs2: list[list[str]],
-      rates2: list[float]
-  ) -> float:
-    # dp[currency] := the maximum amount of money to convert to `currency`
-    dp: dict[str, float] = collections.defaultdict(float)
-    dp[initialCurrency] = 1.0
-    self._bellman(dp, pairs1, rates1)
-    self._bellman(dp, pairs2, rates2)
-    return dp[initialCurrency]
-
-  def _bellman(
-      self,
-      dp: dict[str, float],
-      pairs: list[list[str]],
-      rates: list[float]
-  ) -> None:
-    for _ in range(len(pairs)):
-      for (start, target), rate in zip(pairs, rates):
-        dp[target] = max(dp[target], dp[start] * rate)
-        dp[start] = max(dp[start], dp[target] / rate)
diff --git a/solutions/3388. Count Beautiful Splits in an Array/3388.cpp b/solutions/3388. Count Beautiful Splits in an Array/3388.cpp
deleted file mode 100644
index 6e007b4763a..00000000000
--- a/solutions/3388. Count Beautiful Splits in an Array/3388.cpp	
+++ /dev/null
@@ -1,43 +0,0 @@
-class Solution {
- public:
-  int beautifulSplits(vector<int>& nums) {
-    const int n = nums.size();
-    int ans = 0;
-    // z[start][i] := the z array of nums[i..n) with respect to nums[start..n)
-    vector<vector<int>> z;
-
-    for (int start = 0; start < n; ++start)
-      z.push_back(zFunction(nums, start));
-
-    // nums1 | nums2 | nums3 = nums[0..i] | nums[i + 1..j] | nums[j + 1..n - 1]
-    for (int i = 0; i < n - 2; ++i)
-      for (int j = i + 1; j < n - 1; ++j)
-        if ((j - i >= i + 1 &&
-             z[0][i + 1] >= i + 1) ||  // nums1 is a prefix of nums2.
-            z[i + 1][j + 1] >= j - i)  // nums2 is a suffix of nums3.
-          ++ans;
-
-    return ans;
-  }
-
- private:
-  // Returns the z array, where z[i] is the length of the longest prefix of
-  // nums[i..n) which is also a prefix of nums[start..n).
-  vector<int> zFunction(const vector<int>& nums, int start) {
-    const int n = nums.size();
-    vector<int> z(n);
-    int l = 0;
-    int r = 0;
-    for (int i = 1 + start; i < n; ++i) {
-      if (i < r)
-        z[i] = min(r - i, z[i - l + start]);
-      while (i + z[i] < n && nums[z[i] + start] == nums[i + z[i]])
-        ++z[i];
-      if (i + z[i] > r) {
-        l = i;
-        r = i + z[i];
-      }
-    }
-    return z;
-  }
-};
diff --git a/solutions/3388. Count Beautiful Splits in an Array/3388.java b/solutions/3388. Count Beautiful Splits in an Array/3388.java
deleted file mode 100644
index b59ac630f6e..00000000000
--- a/solutions/3388. Count Beautiful Splits in an Array/3388.java	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
-  public int beautifulSplits(int[] nums) {
-    final int n = nums.length;
-    int ans = 0;
-    // z[start][i] := the z array of nums[i..n) with respect to nums[start..n)
-    int[][] z = new int[n][];
-
-    for (int start = 0; start < n; ++start)
-      z[start] = zFunction(nums, start);
-
-    // nums1 | nums2 | nums3 = nums[0..i] | nums[i + 1..j] | nums[j + 1..n - 1]
-    for (int i = 0; i < n - 2; ++i)
-      for (int j = i + 1; j < n - 1; ++j)
-        if ((j - i >= i + 1 && z[0][i + 1] >= i + 1) || // nums1 is a prefix of nums2.
-            z[i + 1][j + 1] >= j - i)                   // nums2 is a suffix of nums3.
-          ++ans;
-
-    return ans;
-  }
-
-  // Returns the z array, where z[i] is the length of the longest prefix of
-  // nums[i..n) which is also a prefix of nums[start..n).
-  private int[] zFunction(int[] nums, int start) {
-    final int n = nums.length;
-    int[] z = new int[n];
-    int l = 0;
-    int r = 0;
-    for (int i = 1 + start; i < n; ++i) {
-      if (i < r)
-        z[i] = Math.min(r - i, z[i - l + start]);
-      while (i + z[i] < n && nums[z[i] + start] == nums[i + z[i]])
-        ++z[i];
-      if (i + z[i] > r) {
-        l = i;
-        r = i + z[i];
-      }
-    }
-    return z;
-  }
-}
diff --git a/solutions/3388. Count Beautiful Splits in an Array/3388.py b/solutions/3388. Count Beautiful Splits in an Array/3388.py
deleted file mode 100644
index b4837e6196f..00000000000
--- a/solutions/3388. Count Beautiful Splits in an Array/3388.py	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution:
-  def beautifulSplits(self, nums: list[int]) -> int:
-    n = len(nums)
-    # z[start][i] := the z array of nums[i..n) with respect to nums[start..n)
-    z = [self._zFunction(nums, start)
-         for start in range(n)]
-    # nums1 | nums2 | nums3 = nums[0..i] | nums[i + 1..j] | nums[j + 1..n - 1]
-    return sum((j - i >= i + 1 and z[0][i + 1] >= i + 1)  # nums1 is a prefix of nums2
-               or z[i + 1][j + 1] >= j - i  # nums2 is a suffix of nums3.
-               for i in range(n - 2)
-               for j in range(i + 1, n - 1))
-
-  def _zFunction(self, nums: list[int], start: int) -> list[int]:
-    """
-    Returns the z array, where z[i] is the length of the longest prefix of
-    nums[i..n) which is also a prefix of nums[start..n).
-    """
-    n = len(nums)
-    z = [0] * n
-    l = start
-    r = start
-    for i in range(1 + start, n):
-      if i < r:
-        z[i] = min(r - i, z[i - l + start])
-      while i + z[i] < n and nums[z[i] + start] == nums[i + z[i]]:
-        z[i] += 1
-      if i + z[i] > r:
-        l = i
-        r = i + z[i]
-    return z
diff --git a/solutions/3389. Minimum Operations to Make Character Frequencies Equal/3389.cpp b/solutions/3389. Minimum Operations to Make Character Frequencies Equal/3389.cpp
deleted file mode 100644
index af9466d7f12..00000000000
--- a/solutions/3389. Minimum Operations to Make Character Frequencies Equal/3389.cpp	
+++ /dev/null
@@ -1,48 +0,0 @@
-class Solution {
- public:
-  int makeStringGood(string s) {
-    int ans = s.length();
-    vector<int> count(26);
-
-    for (const char c : s)
-      ++count[c - 'a'];
-
-    const int mx = ranges::max(count);
-    for (int target = 1; target <= mx; ++target)
-      ans = min(ans, getMinOperations(count, target));
-
-    return ans;
-  }
-
- private:
-  int getMinOperations(const vector<int>& count, int target) {
-    // dp[i] := the minimum number of operations to make the frequency of
-    // (i..25)-th (0-indexed) letters equal to `target`.
-    vector<int> dp(27);
-
-    for (int i = 25; i >= 0; --i) {
-      // 1. Delete all the i-th letters.
-      const int deleteAllToZero = count[i];
-      // 2. Insert/delete the i-th letters to have `target` number of letters.
-      const int deleteOrInsertToTarget = abs(target - count[i]);
-      dp[i] = min(deleteAllToZero, deleteOrInsertToTarget) + dp[i + 1];
-      if (i + 1 < 26 && count[i + 1] < target) {
-        const int nextDeficit = target - count[i + 1];
-        // Make the frequency of the i-th letter equal to the `target` or 0.
-        const int needToChange =
-            count[i] > target ? count[i] - target : count[i];
-        const int changeToTarget =
-            nextDeficit > needToChange
-                // 3. Change all the i-th letters to the next letter and then
-                // insert the remaining deficit for the next letter.
-                ? needToChange + (nextDeficit - needToChange)
-                // 4. Change `nextDeficit` i-th letters to the next letter and
-                // then delete the remaining i-th letters.
-                : nextDeficit + (needToChange - nextDeficit);
-        dp[i] = min(dp[i], changeToTarget + dp[i + 2]);
-      }
-    }
-
-    return dp[0];
-  }
-};
diff --git a/solutions/3389. Minimum Operations to Make Character Frequencies Equal/3389.java b/solutions/3389. Minimum Operations to Make Character Frequencies Equal/3389.java
deleted file mode 100644
index 83298a235f4..00000000000
--- a/solutions/3389. Minimum Operations to Make Character Frequencies Equal/3389.java	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution {
-  public int makeStringGood(String s) {
-    int ans = s.length();
-    int[] count = new int[26];
-
-    for (final char c : s.toCharArray())
-      ++count[c - 'a'];
-
-    final int maxCount = Arrays.stream(count).max().getAsInt();
-    for (int target = 1; target <= maxCount; ++target)
-      ans = Math.min(ans, getMinOperations(count, target));
-
-    return ans;
-  }
-
-  private int getMinOperations(int[] count, int target) {
-    // dp[i] represents the minimum number of operations to make the frequency of
-    // (i..25)-th (0-indexed) letters equal to `target`.
-    int[] dp = new int[27];
-
-    for (int i = 25; i >= 0; --i) {
-      // 1. Delete all the i-th letters.
-      int deleteAllToZero = count[i];
-      // 2. Insert/delete the i-th letters to have `target` number of letters.
-      int deleteOrInsertToTarget = Math.abs(target - count[i]);
-      dp[i] = Math.min(deleteAllToZero, deleteOrInsertToTarget) + dp[i + 1];
-      if (i + 1 < 26 && count[i + 1] < target) {
-        final int nextDeficit = target - count[i + 1];
-        // Make the frequency of the i-th letter equal to the `target` or 0.
-        final int needToChange = count[i] <= target ? count[i] : count[i] - target;
-        final int changeToTarget = (nextDeficit > needToChange)
-                                       // 3. Change all the i-th letters to the next letter and then
-                                       // insert the remaining deficit for the next letter.
-                                       ? needToChange + (nextDeficit - needToChange)
-                                       // 4. Change `nextDeficit` i-th letters to the next letter
-                                       // and then delete the remaining i-th letters.
-                                       : nextDeficit + (needToChange - nextDeficit);
-        dp[i] = Math.min(dp[i], changeToTarget + dp[i + 2]);
-      }
-    }
-
-    return dp[0];
-  }
-}
diff --git a/solutions/3389. Minimum Operations to Make Character Frequencies Equal/3389.py b/solutions/3389. Minimum Operations to Make Character Frequencies Equal/3389.py
deleted file mode 100644
index 49fb20de611..00000000000
--- a/solutions/3389. Minimum Operations to Make Character Frequencies Equal/3389.py	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution:
-  def makeStringGood(self, s: str) -> int:
-    count = [0] * 26
-    for c in s:
-      count[ord(c) - ord('a')] += 1
-    return min(self._getMinOperations(count, target)
-               for target in range(1, max(count) + 1))
-
-  def _getMinOperations(self, count: list[int], target: int) -> int:
-    # dp[i] represents the minimum number of operations to make the frequency of
-    # (i..25)-th (0-indexed) letters equal to `target`.
-    dp = [0] * 27
-
-    for i in range(25, -1, -1):
-      # 1. Delete all the i-th letters.
-      deleteAllToZero = count[i]
-      # 2. Insert/delete the i-th letters to have `target` number of letters.
-      deleteOrInsertToTarget = abs(target - count[i])
-      dp[i] = min(deleteAllToZero, deleteOrInsertToTarget) + dp[i + 1]
-      if i + 1 < 26 and count[i + 1] < target:
-        nextDeficit = target - count[i + 1]
-        # Make the frequency of the i-th letter equal to the `target` or 0.
-        needToChange = count[i] if count[i] <= target else count[i] - target
-        changeToTarget = (
-            # 3. Change all the i-th letters to the next letter and then
-            # insert the remaining deficit for the next letter.
-            needToChange + (nextDeficit - needToChange) if nextDeficit > needToChange
-            # 4. Change `nextDeficit` i-th letters to the next letter and
-            # then delete the remaining i-th letters.
-            else nextDeficit + (needToChange - nextDeficit)
-        )
-        dp[i] = min(dp[i], changeToTarget + dp[i + 2])
-
-    return dp[0]
diff --git a/solutions/339. Nested List Weight Sum/339-2.py b/solutions/339. Nested List Weight Sum/339-2.py
index d134beb4cb5..c486f8c106e 100644
--- a/solutions/339. Nested List Weight Sum/339-2.py	
+++ b/solutions/339. Nested List Weight Sum/339-2.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def depthSum(self, nestedList: list[NestedInteger]) -> int:
+  def depthSum(self, nestedList: List[NestedInteger]) -> int:
     ans = 0
 
-    def dfs(nestedList: list[NestedInteger], depth: int) -> None:
+    def dfs(nestedList: List[NestedInteger], depth: int) -> None:
       nonlocal ans
       for ni in nestedList:
         if ni.isInteger():
diff --git a/solutions/339. Nested List Weight Sum/339.py b/solutions/339. Nested List Weight Sum/339.py
index ae4c157bdba..4a598d6654b 100644
--- a/solutions/339. Nested List Weight Sum/339.py	
+++ b/solutions/339. Nested List Weight Sum/339.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def depthSum(self, nestedList: list[NestedInteger]) -> int:
+  def depthSum(self, nestedList: List[NestedInteger]) -> int:
     ans = 0
     depth = 0
     q = collections.deque()
 
-    def addIntegers(nestedList: list[NestedInteger]) -> None:
+    def addIntegers(nestedList: List[NestedInteger]) -> None:
       for ni in nestedList:
         q.append(ni)
 
diff --git a/solutions/3390. Longest Team Pass Streak/3390.sql b/solutions/3390. Longest Team Pass Streak/3390.sql
deleted file mode 100644
index 9ed6dbee313..00000000000
--- a/solutions/3390. Longest Team Pass Streak/3390.sql	
+++ /dev/null
@@ -1,50 +0,0 @@
-WITH RECURSIVE
-  -- Join team names for both passing and receiving players.
-  TeamPasses AS (
-    SELECT
-      Team1.team_name AS team1,
-      Team2.team_name AS team2,
-      Passes.time_stamp
-    FROM Passes
-    INNER JOIN Teams AS Team1
-      ON (Passes.pass_from = Team1.player_id)
-    INNER JOIN Teams AS Team2
-      ON (Passes.pass_to = Team2.player_id)
-  ),
-  -- Rank passes by timestamp within each team.
-  Ranked AS (
-    SELECT
-      team1,
-      team2,
-      RANK() OVER(PARTITION BY team1 ORDER BY time_stamp) AS `rank`
-    FROM TeamPasses
-  ),
-  -- Recursively calculate pass streaks.
-  PassStreaks AS (
-    -- Base case: first pass for each team
-    SELECT
-      team1,
-      team2,
-      `rank`,
-      IF(team1 = team2, 1, 0) AS streak
-    FROM Ranked
-    WHERE `rank` = 1
-    UNION ALL
-    -- Recursive case: subsequent passes
-    SELECT
-      Ranked.team1,
-      Ranked.team2,
-      Ranked.`rank`,
-      IF(Ranked.team1 = Ranked.team2, PassStreaks.streak + 1, 0) AS streak
-    FROM Ranked
-    INNER JOIN PassStreaks
-      ON (
-        Ranked.`rank` = PassStreaks.`rank` + 1
-        AND Ranked.team1 = PassStreaks.team1)
-  )
--- Get the longest streak for each team.
-SELECT team1 AS team_name, MAX(streak) AS longest_streak
-FROM PassStreaks
-GROUP BY 1
-HAVING longest_streak > 0
-ORDER BY 1;
diff --git a/solutions/3391. Design a 3D Binary Matrix with Efficient Layer Tracking/3391.cpp b/solutions/3391. Design a 3D Binary Matrix with Efficient Layer Tracking/3391.cpp
deleted file mode 100644
index 762fb8fdfec..00000000000
--- a/solutions/3391. Design a 3D Binary Matrix with Efficient Layer Tracking/3391.cpp	
+++ /dev/null
@@ -1,42 +0,0 @@
-class Matrix3D {
- public:
-  Matrix3D(int n) {
-    isSet = vector<vector<vector<bool>>>(
-        n, vector<vector<bool>>(n, vector<bool>(n)));
-    count = vector<int>(n);
-    for (int x = 0; x < n; ++x)
-      pairs.insert({0, x});
-  }
-
-  void setCell(int x, int y, int z) {
-    if (isSet[x][y][z])
-      return;
-    isSet[x][y][z] = true;
-    pairs.erase({count[x], x});
-    pairs.insert({++count[x], x});
-  }
-
-  void unsetCell(int x, int y, int z) {
-    if (!isSet[x][y][z])
-      return;
-    isSet[x][y][z] = false;
-    pairs.erase({count[x], x});
-    pairs.insert({--count[x], x});
-  }
-
-  int largestMatrix() {
-    return pairs.rbegin()->second;
-  }
-
- private:
-  vector<vector<vector<bool>>> isSet;
-  vector<int> count;  // count[x] := the number of cells set in the x-th layer
-
-  struct PairCompare {
-    bool operator()(const pair<int, int>& a, const pair<int, int>& b) const {
-      return a.first == b.first ? b.second > a.second : b.first > a.first;
-    }
-  };
-
-  set<pair<int, int>, PairCompare> pairs;  // (count[x], x)
-};
diff --git a/solutions/3391. Design a 3D Binary Matrix with Efficient Layer Tracking/3391.java b/solutions/3391. Design a 3D Binary Matrix with Efficient Layer Tracking/3391.java
deleted file mode 100644
index 1c24a93363d..00000000000
--- a/solutions/3391. Design a 3D Binary Matrix with Efficient Layer Tracking/3391.java	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Matrix3D {
-  public Matrix3D(int n) {
-    isSet = new boolean[n][n][n];
-    count = new int[n];
-    for (int x = 0; x < n; ++x)
-      pairs.add(new Pair<>(0, x));
-  }
-
-  public void setCell(int x, int y, int z) {
-    if (isSet[x][y][z])
-      return;
-    isSet[x][y][z] = true;
-    pairs.remove(new Pair<>(count[x], x));
-    pairs.add(new Pair<>(++count[x], x));
-  }
-
-  public void unsetCell(int x, int y, int z) {
-    if (!isSet[x][y][z])
-      return;
-    isSet[x][y][z] = false;
-    pairs.remove(new Pair<>(count[x], x));
-    pairs.add(new Pair<>(--count[x], x));
-  }
-
-  public int largestMatrix() {
-    return pairs.first().getValue();
-  }
-
-  private boolean[][][] isSet;
-  private int[] count; // count[x] := the number of cells set in the x-th layer
-  private TreeSet<Pair<Integer, Integer>> pairs = new TreeSet<>( // (count[x], x)
-      Comparator.comparing(Pair<Integer, Integer>::getKey, Comparator.reverseOrder())
-          .thenComparing(Pair<Integer, Integer>::getValue, Comparator.reverseOrder()));
-}
diff --git a/solutions/3391. Design a 3D Binary Matrix with Efficient Layer Tracking/3391.py b/solutions/3391. Design a 3D Binary Matrix with Efficient Layer Tracking/3391.py
deleted file mode 100644
index f7a75f2364e..00000000000
--- a/solutions/3391. Design a 3D Binary Matrix with Efficient Layer Tracking/3391.py	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Matrix3D:
-  def __init__(self, n: int):
-    self.isSet = set()
-    # count[x] := the number of set cells in the x-th layer
-    self.count = collections.Counter()
-    # (count[x], x)
-    self.pairs: SortedList = SortedList(key=lambda x: (-x[0], -x[1]))
-    self.pairs.update((0, x) for x in range(n))
-
-  def setCell(self, x: int, y: int, z: int) -> None:
-    if (x, y, z) in self.isSet:
-      return
-    self.isSet.add((x, y, z))
-    self.pairs.remove((self.count[x], x))
-    self.count[x] += 1
-    self.pairs.add((self.count[x], x))
-
-  def unsetCell(self, x: int, y: int, z: int) -> None:
-    if (x, y, z) not in self.isSet:
-      return
-    self.isSet.remove((x, y, z))
-    self.pairs.remove((self.count[x], x))
-    self.count[x] -= 1
-    self.pairs.add((self.count[x], x))
-
-  def largestMatrix(self) -> int:
-    return self.pairs[0][1]
diff --git a/solutions/3392. Count Subarrays of Length Three With a Condition/3392.cpp b/solutions/3392. Count Subarrays of Length Three With a Condition/3392.cpp
deleted file mode 100644
index 4244948f1b6..00000000000
--- a/solutions/3392. Count Subarrays of Length Three With a Condition/3392.cpp	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution {
- public:
-  int countSubarrays(vector<int>& nums) {
-    int ans = 0;
-
-    for (int i = 1; i + 1 < nums.size(); ++i)
-      if (nums[i] == (nums[i - 1] + nums[i + 1]) * 2)
-        ++ans;
-
-    return ans;
-  }
-};
diff --git a/solutions/3392. Count Subarrays of Length Three With a Condition/3392.java b/solutions/3392. Count Subarrays of Length Three With a Condition/3392.java
deleted file mode 100644
index 83131fd9441..00000000000
--- a/solutions/3392. Count Subarrays of Length Three With a Condition/3392.java	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution {
-  public int countSubarrays(int[] nums) {
-    int ans = 0;
-
-    for (int i = 1; i + 1 < nums.length; ++i)
-      if (nums[i] == (nums[i - 1] + nums[i + 1]) * 2)
-        ++ans;
-
-    return ans;
-  }
-}
diff --git a/solutions/3392. Count Subarrays of Length Three With a Condition/3392.py b/solutions/3392. Count Subarrays of Length Three With a Condition/3392.py
deleted file mode 100644
index 9d06b81bddd..00000000000
--- a/solutions/3392. Count Subarrays of Length Three With a Condition/3392.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def countSubarrays(self, nums: list[int]) -> int:
-    return sum(b == (a + c) * 2
-               for a, b, c in zip(nums, nums[1:], nums[2:]))
diff --git a/solutions/3393. Count Paths With the Given XOR Value/3393-2.cpp b/solutions/3393. Count Paths With the Given XOR Value/3393-2.cpp
deleted file mode 100644
index 78c8fdf46d0..00000000000
--- a/solutions/3393. Count Paths With the Given XOR Value/3393-2.cpp	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution {
- public:
-  int countPathsWithXorValue(vector<vector<int>>& grid, int k) {
-    constexpr int kMod = 1'000'000'007;
-    constexpr int kMax = 15;
-    const int m = grid.size();
-    const int n = grid[0].size();
-    // dp[i][j][xors] := the number of paths from (i, j) to (m - 1, n - 1) with
-    // XOR value `xors`
-    vector<vector<vector<int>>> dp(
-        m, vector<vector<int>>(n, vector<int>(kMax + 1)));
-
-    dp[m - 1][n - 1][grid[m - 1][n - 1]] = 1;
-
-    for (int i = m - 1; i >= 0; --i)
-      for (int j = n - 1; j >= 0; --j)
-        for (int xors = 0; xors <= kMax; ++xors) {
-          if (i - 1 >= 0) {
-            const int newXor = xors ^ grid[i - 1][j];
-            dp[i - 1][j][newXor] += dp[i][j][xors];
-            dp[i - 1][j][newXor] %= kMod;
-          }
-          if (j - 1 >= 0) {
-            const int newXor = xors ^ grid[i][j - 1];
-            dp[i][j - 1][newXor] += dp[i][j][xors];
-            dp[i][j - 1][newXor] %= kMod;
-          }
-        }
-
-    return dp[0][0][k];
-  }
-};
diff --git a/solutions/3393. Count Paths With the Given XOR Value/3393-2.java b/solutions/3393. Count Paths With the Given XOR Value/3393-2.java
deleted file mode 100644
index 4ff238e12c6..00000000000
--- a/solutions/3393. Count Paths With the Given XOR Value/3393-2.java	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
-  public int countPathsWithXorValue(int[][] grid, int k) {
-    final int MOD = 1_000_000_007;
-    final int MAX = 15;
-    final int m = grid.length;
-    final int n = grid[0].length;
-    // dp[i][j][xors] := the number of paths from (i, j) to (m - 1, n - 1) with
-    // XOR value `xors`
-    int[][][] dp = new int[m][n][MAX + 1];
-
-    dp[m - 1][n - 1][grid[m - 1][n - 1]] = 1;
-
-    for (int i = m - 1; i >= 0; --i)
-      for (int j = n - 1; j >= 0; --j)
-        for (int xors = 0; xors <= MAX; ++xors) {
-          if (i - 1 >= 0) {
-            final int newXor = xors ^ grid[i - 1][j];
-            dp[i - 1][j][newXor] += dp[i][j][xors];
-            dp[i - 1][j][newXor] %= MOD;
-          }
-          if (j - 1 >= 0) {
-            final int newXor = xors ^ grid[i][j - 1];
-            dp[i][j - 1][newXor] += dp[i][j][xors];
-            dp[i][j - 1][newXor] %= MOD;
-          }
-        }
-
-    return dp[0][0][k];
-  }
-}
diff --git a/solutions/3393. Count Paths With the Given XOR Value/3393-2.py b/solutions/3393. Count Paths With the Given XOR Value/3393-2.py
deleted file mode 100644
index 8a2b5d3261a..00000000000
--- a/solutions/3393. Count Paths With the Given XOR Value/3393-2.py	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution:
-  def countPathsWithXorValue(self, grid, k):
-    MOD = 1_000_000_007
-    MAX = 15
-    m = len(grid)
-    n = len(grid[0])
-    # dp[i][j][xors] := the number of paths from (i, j) to (m - 1, n - 1) with
-    # XOR value `xors`
-    dp = [[[0] * (MAX + 1)
-          for _ in range(n)]
-          for _ in range(m)]
-
-    dp[-1][-1][grid[-1][-1]] = 1
-
-    for i in reversed(range(m)):
-      for j in reversed(range(n)):
-        for xors in range(MAX + 1):
-          if i - 1 >= 0:
-            newXor = xors ^ grid[i - 1][j]
-            dp[i - 1][j][newXor] += dp[i][j][xors]
-            dp[i - 1][j][newXor] %= MOD
-          if j - 1 >= 0:
-            newXor = xors ^ grid[i][j - 1]
-            dp[i][j - 1][newXor] += dp[i][j][xors]
-            dp[i][j - 1][newXor] %= MOD
-
-    return dp[0][0][k]
diff --git a/solutions/3393. Count Paths With the Given XOR Value/3393-3.cpp b/solutions/3393. Count Paths With the Given XOR Value/3393-3.cpp
deleted file mode 100644
index 54dd56db1ed..00000000000
--- a/solutions/3393. Count Paths With the Given XOR Value/3393-3.cpp	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution {
- public:
-  int countPathsWithXorValue(vector<vector<int>>& grid, int k) {
-    constexpr int kMod = 1'000'000'007;
-    constexpr int kMax = 15;
-    const int m = grid.size();
-    const int n = grid[0].size();
-    // dp[i][j][xors] := the number of paths from (0, 0) to (i, j) with XOR
-    // value `xors`
-    vector<vector<vector<int>>> dp(
-        m, vector<vector<int>>(n, vector<int>(kMax + 1)));
-
-    dp[0][0][grid[0][0]] = 1;
-
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j)
-        for (int xors = 0; xors <= kMax; ++xors) {
-          if (i + 1 < m) {
-            const int newXor = xors ^ grid[i + 1][j];
-            dp[i + 1][j][newXor] += dp[i][j][xors];
-            dp[i + 1][j][newXor] %= kMod;
-          }
-          if (j + 1 < n) {
-            const int newXor = xors ^ grid[i][j + 1];
-            dp[i][j + 1][newXor] += dp[i][j][xors];
-            dp[i][j + 1][newXor] %= kMod;
-          }
-        }
-
-    return dp[m - 1][n - 1][k];
-  }
-};
diff --git a/solutions/3393. Count Paths With the Given XOR Value/3393-3.java b/solutions/3393. Count Paths With the Given XOR Value/3393-3.java
deleted file mode 100644
index 60fd8648b42..00000000000
--- a/solutions/3393. Count Paths With the Given XOR Value/3393-3.java	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
-  public int countPathsWithXorValue(int[][] grid, int k) {
-    final int MOD = 1_000_000_007;
-    final int MAX = 15;
-    final int m = grid.length;
-    final int n = grid[0].length;
-    // dp[i][j][xors] := the number of paths from (0, 0) to (i, j) with XOR
-    // value `xors`
-    int[][][] dp = new int[m][n][MAX + 1];
-
-    dp[0][0][grid[0][0]] = 1;
-
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j)
-        for (int xors = 0; xors <= MAX; ++xors) {
-          if (i + 1 < m) {
-            final int newXor = xors ^ grid[i + 1][j];
-            dp[i + 1][j][newXor] += dp[i][j][xors];
-            dp[i + 1][j][newXor] %= MOD;
-          }
-          if (j + 1 < n) {
-            final int newXor = xors ^ grid[i][j + 1];
-            dp[i][j + 1][newXor] += dp[i][j][xors];
-            dp[i][j + 1][newXor] %= MOD;
-          }
-        }
-
-    return dp[m - 1][n - 1][k];
-  }
-}
diff --git a/solutions/3393. Count Paths With the Given XOR Value/3393-3.py b/solutions/3393. Count Paths With the Given XOR Value/3393-3.py
deleted file mode 100644
index f7dc40fcda9..00000000000
--- a/solutions/3393. Count Paths With the Given XOR Value/3393-3.py	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution:
-  def countPathsWithXorValue(self, grid, k):
-    MOD = 1_000_000_007
-    MAX = 15
-    m = len(grid)
-    n = len(grid[0])
-    # dp[i][j][xors] := the number of paths from (0, 0) to (i, j) with XOR
-    # value `xors`
-    dp = [[[0] * (MAX + 1)
-          for _ in range(n)]
-          for _ in range(m)]
-
-    dp[0][0][grid[0][0]] = 1
-
-    for i in range(m):
-      for j in range(n):
-        for xors in range(MAX + 1):
-          if i + 1 < m:
-            newXor = xors ^ grid[i + 1][j]
-            dp[i + 1][j][newXor] += dp[i][j][xors]
-            dp[i + 1][j][newXor] %= MOD
-          if j + 1 < n:
-            newXor = xors ^ grid[i][j + 1]
-            dp[i][j + 1][newXor] += dp[i][j][xors]
-            dp[i][j + 1][newXor] %= MOD
-
-    return dp[-1][-1][k]
diff --git a/solutions/3393. Count Paths With the Given XOR Value/3393.cpp b/solutions/3393. Count Paths With the Given XOR Value/3393.cpp
deleted file mode 100644
index 549be82b0cd..00000000000
--- a/solutions/3393. Count Paths With the Given XOR Value/3393.cpp	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
- public:
-  int countPathsWithXorValue(vector<vector<int>>& grid, int k) {
-    constexpr int kMax = 15;
-    const int m = grid.size();
-    const int n = grid[0].size();
-    vector<vector<vector<int>>> mem(
-        m, vector<vector<int>>(n, vector<int>(kMax + 1, -1)));
-    return count(grid, 0, 0, 0, k, mem);
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Return the number of paths from (i, j) to (m - 1, n - 1) with XOR value
-  // `xors`.
-  int count(const vector<vector<int>>& grid, int i, int j, int xors, int k,
-            vector<vector<vector<int>>>& mem) {
-    if (i == grid.size() || j == grid[0].size())
-      return 0;
-    xors ^= grid[i][j];
-    if (i == grid.size() - 1 && j == grid[0].size() - 1)
-      return xors == k ? 1 : 0;
-    if (mem[i][j][xors] != -1)
-      return mem[i][j][xors];
-    const int right = count(grid, i, j + 1, xors, k, mem) % kMod;
-    const int down = count(grid, i + 1, j, xors, k, mem) % kMod;
-    return mem[i][j][xors] = (right + down) % kMod;
-  }
-};
diff --git a/solutions/3393. Count Paths With the Given XOR Value/3393.java b/solutions/3393. Count Paths With the Given XOR Value/3393.java
deleted file mode 100644
index a181fdd79b0..00000000000
--- a/solutions/3393. Count Paths With the Given XOR Value/3393.java	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution {
-  public int countPathsWithXorValue(int[][] grid, int k) {
-    final int MAX = 15;
-    final int m = grid.length;
-    final int n = grid[0].length;
-    Integer[][][] mem = new Integer[m][n][MAX + 1];
-    return count(grid, 0, 0, 0, k, mem);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  // Return the number of paths from (i, j) to (m - 1, n - 1) with XOR value
-  // `xors`.
-  private int count(int[][] grid, int i, int j, int xors, int k, Integer[][][] mem) {
-    if (i == grid.length || j == grid[0].length)
-      return 0;
-    xors ^= grid[i][j];
-    if (i == grid.length - 1 && j == grid[0].length - 1)
-      return xors == k ? 1 : 0;
-    if (mem[i][j][xors] != null)
-      return mem[i][j][xors];
-    final int right = count(grid, i, j + 1, xors, k, mem) % MOD;
-    final int down = count(grid, i + 1, j, xors, k, mem) % MOD;
-    return mem[i][j][xors] = (right + down) % MOD;
-  }
-}
diff --git a/solutions/3393. Count Paths With the Given XOR Value/3393.py b/solutions/3393. Count Paths With the Given XOR Value/3393.py
deleted file mode 100644
index b36681d98b8..00000000000
--- a/solutions/3393. Count Paths With the Given XOR Value/3393.py	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution:
-  def countPathsWithXorValue(self, grid: list[list[int]], k: int) -> int:
-    MOD = 1_000_000_007
-    m = len(grid)
-    n = len(grid[0])
-
-    @functools.lru_cache(None)
-    def count(i: int, j: int, xors: int) -> int:
-      """
-      Return the number of paths from (i, j) to (m - 1, n - 1) with XOR value
-      `xors`.
-      """
-      if i == m or j == n:
-        return 0
-      xors ^= grid[i][j]
-      if i == m - 1 and j == n - 1:
-        return int(xors == k)
-      right = count(i, j + 1, xors)
-      down = count(i + 1, j, xors)
-      return (right + down) % MOD
-
-    return count(0, 0, 0)
diff --git a/solutions/3394. Check if Grid can be Cut into Sections/3394.cpp b/solutions/3394. Check if Grid can be Cut into Sections/3394.cpp
deleted file mode 100644
index de8c4741fcf..00000000000
--- a/solutions/3394. Check if Grid can be Cut into Sections/3394.cpp	
+++ /dev/null
@@ -1,36 +0,0 @@
-class Solution {
- public:
-  bool checkValidCuts(int n, vector<vector<int>>& rectangles) {
-    vector<pair<int, int>> xs;
-    vector<pair<int, int>> ys;
-
-    for (const vector<int> rectangles : rectangles) {
-      const int startX = rectangles[0];
-      const int startY = rectangles[1];
-      const int endX = rectangles[2];
-      const int endY = rectangles[3];
-      xs.emplace_back(startX, endX);
-      ys.emplace_back(startY, endY);
-    }
-
-    return max(countMerged(xs), countMerged(ys)) >= 3;
-  }
-
- private:
-  int countMerged(vector<pair<int, int>>& intervals) {
-    int count = 0;
-    int prevEnd = 0;
-
-    ranges::sort(intervals);
-
-    for (const auto& [start, eend] : intervals)
-      if (start < prevEnd) {
-        prevEnd = max(prevEnd, eend);
-      } else {
-        prevEnd = eend;
-        ++count;
-      }
-
-    return count;
-  }
-};
diff --git a/solutions/3394. Check if Grid can be Cut into Sections/3394.java b/solutions/3394. Check if Grid can be Cut into Sections/3394.java
deleted file mode 100644
index 3f685435b3c..00000000000
--- a/solutions/3394. Check if Grid can be Cut into Sections/3394.java	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution {
-  public boolean checkValidCuts(int n, int[][] rectangles) {
-    int[][] xs = new int[rectangles.length][2];
-    int[][] ys = new int[rectangles.length][2];
-
-    for (int i = 0; i < rectangles.length; ++i) {
-      xs[i][0] = rectangles[i][0];
-      xs[i][1] = rectangles[i][2];
-      ys[i][0] = rectangles[i][1];
-      ys[i][1] = rectangles[i][3];
-    }
-
-    return Math.max(countMerged(xs), countMerged(ys)) >= 3;
-  }
-
-  private int countMerged(int[][] intervals) {
-    int count = 0;
-    int prevEnd = 0;
-
-    Arrays.sort(intervals, Comparator.comparingInt((int[] interval) -> interval[0]));
-
-    for (int[] interval : intervals) {
-      final int start = interval[0];
-      final int end = interval[1];
-      if (start < prevEnd) {
-        prevEnd = Math.max(prevEnd, end);
-      } else {
-        prevEnd = end;
-        ++count;
-      }
-    }
-
-    return count;
-  }
-}
diff --git a/solutions/3394. Check if Grid can be Cut into Sections/3394.py b/solutions/3394. Check if Grid can be Cut into Sections/3394.py
deleted file mode 100644
index b4d761a2493..00000000000
--- a/solutions/3394. Check if Grid can be Cut into Sections/3394.py	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution:
-  def checkValidCuts(self, n: int, rectangles: list[list[int]]) -> bool:
-    xs = [(startX, endX) for startX, _, endX, _ in rectangles]
-    ys = [(startY, endY) for _, startY, _, endY in rectangles]
-    return max(self._countMerged(xs),
-               self._countMerged(ys)) >= 3
-
-  def _countMerged(self, intervals: list[tuple[int, int]]) -> int:
-    count = 0
-    prevEnd = 0
-    for start, end in sorted(intervals):
-      if start < prevEnd:
-        prevEnd = max(prevEnd, end)
-      else:
-        prevEnd = end
-        count += 1
-    return count
diff --git a/solutions/3395. Subsequences with a Unique Middle Mode I/3395-2.cpp b/solutions/3395. Subsequences with a Unique Middle Mode I/3395-2.cpp
deleted file mode 100644
index 4f4b8846d71..00000000000
--- a/solutions/3395. Subsequences with a Unique Middle Mode I/3395-2.cpp	
+++ /dev/null
@@ -1,75 +0,0 @@
-class Solution {
- public:
-  int subsequencesWithMiddleMode(vector<int>& nums) {
-    int ans = 0;
-    unordered_map<int, int> p;  // prefix counter
-    unordered_map<int, int> s;  // suffix counter
-
-    for (const int num : nums)
-      ++s[num];
-
-    for (int i = 0; i < nums.size(); ++i) {
-      const int a = nums[i];
-      --s[a];
-
-      const int l = i;
-      const int r = nums.size() - i - 1;
-
-      // Start with all possible subsequences with `a` as the middle number.
-      ans = (ans + nC2(l) * nC2(r)) % kMod;
-
-      // Minus cases where frequency of `a` is 1, so it's not a mode.
-      ans = (ans - nC2(l - p[a]) * nC2(r - s[a])) % kMod;
-
-      for (const int b : getUniqueNums(p, s)) {
-        if (b == a)
-          continue;
-
-        // Minus cases where the middle number is not a "unique" mode
-        int subtract = 0;
-
-        // [a b] a [b c]
-        subtract = (subtract + p[a] * p[b] * s[b] * (r - s[a] - s[b])) % kMod;
-
-        // [b c] a [a b]
-        subtract = (subtract + s[a] * s[b] * p[b] * (l - p[a] - p[b])) % kMod;
-
-        // [b b] a [a c]
-        subtract = (subtract + nC2(p[b]) * s[a] * (r - s[a] - s[b])) % kMod;
-
-        // [a c] a [b b]
-        subtract = (subtract + nC2(s[b]) * p[a] * (l - p[a] - p[b])) % kMod;
-
-        // [b b] a [a b]
-        subtract = (subtract + nC2(p[b]) * s[a] * s[b]) % kMod;
-
-        // [a b] a [b b]
-        subtract = (subtract + nC2(s[b]) * p[a] * p[b]) % kMod;
-
-        ans = (ans - subtract + kMod) % kMod;
-      }
-
-      ++p[a];
-    }
-
-    return (ans + kMod) % kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Returns C(n, 2).
-  long nC2(long n) {
-    return n * (n - 1) / 2 % kMod;
-  }
-
-  unordered_set<int> getUniqueNums(const unordered_map<int, int>& p,
-                                   const unordered_map<int, int>& s) {
-    unordered_set<int> uniqueNums;
-    for (const auto& [num, _] : p)
-      uniqueNums.insert(num);
-    for (const auto& [num, _] : s)
-      uniqueNums.insert(num);
-    return uniqueNums;
-  }
-};
diff --git a/solutions/3395. Subsequences with a Unique Middle Mode I/3395-2.java b/solutions/3395. Subsequences with a Unique Middle Mode I/3395-2.java
deleted file mode 100644
index 1b5b483da0b..00000000000
--- a/solutions/3395. Subsequences with a Unique Middle Mode I/3395-2.java	
+++ /dev/null
@@ -1,75 +0,0 @@
-class Solution {
-  public int subsequencesWithMiddleMode(int[] nums) {
-    int ans = 0;
-    Map<Integer, Integer> p = new HashMap<>(); // prefix counter
-    Map<Integer, Integer> s = new HashMap<>(); // suffix counter
-
-    for (final int num : nums)
-      s.merge(num, 1, Integer::sum);
-
-    for (int i = 0; i < nums.length; ++i) {
-      final int a = nums[i];
-      s.merge(a, -1, Integer::sum);
-
-      final int l = i;
-      final int r = nums.length - i - 1;
-
-      final int pa = p.getOrDefault(a, 0);
-      final int sa = s.get(a);
-
-      // Start with all possible subsequences with `a` as the middle number.
-      ans = (int) ((ans + (long) nC2(l) * nC2(r)) % MOD);
-
-      // Minus cases where frequency of 'a' is 1, so it's not a mode.
-      ans = (int) ((ans - (long) nC2(l - pa) * nC2(r - sa)) % MOD);
-
-      for (final int b : getUniqueNums(p, s)) {
-        if (b == a)
-          continue;
-
-        final int pb = p.getOrDefault(b, 0);
-        final int sb = s.get(b);
-
-        // Minus cases where the middle number is not a "unique" mode
-        int subtract = 0;
-
-        // [a b] a [b c]
-        subtract = (int) ((subtract + (long) pa * pb * sb * (r - sa - sb)) % MOD);
-
-        // [b c] a [a b]
-        subtract = (int) ((subtract + (long) sa * sb * pb * (l - pa - pb)) % MOD);
-
-        // [b b] a [a c]
-        subtract = (int) ((subtract + (long) nC2(pb) * sa * (r - sa - sb)) % MOD);
-
-        // [a c] a [b b]
-        subtract = (int) ((subtract + (long) nC2(sb) * pa * (l - pa - pb)) % MOD);
-
-        // [b b] a [a b]
-        subtract = (int) ((subtract + (long) nC2(pb) * sa * sb) % MOD);
-
-        // [a b] a [b b]
-        subtract = (int) ((subtract + (long) nC2(sb) * pa * pb) % MOD);
-
-        ans = (int) ((ans - subtract + MOD) % MOD);
-      }
-
-      p.merge(a, 1, Integer::sum);
-    }
-
-    return (ans + MOD) % MOD;
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  private int nC2(long n) {
-    return (int) (n * (n - 1) / 2 % MOD);
-  }
-
-  private Set<Integer> getUniqueNums(final Map<Integer, Integer> p, final Map<Integer, Integer> s) {
-    final Set<Integer> uniqueNums = new HashSet<>();
-    uniqueNums.addAll(p.keySet());
-    uniqueNums.addAll(s.keySet());
-    return uniqueNums;
-  }
-}
diff --git a/solutions/3395. Subsequences with a Unique Middle Mode I/3395-2.py b/solutions/3395. Subsequences with a Unique Middle Mode I/3395-2.py
deleted file mode 100644
index f7527477d4a..00000000000
--- a/solutions/3395. Subsequences with a Unique Middle Mode I/3395-2.py	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution:
-  def subsequencesWithMiddleMode(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-    ans = 0
-    p = collections.Counter()  # prefix counter
-    s = collections.Counter(nums)  # suffix counter
-
-    def nC2(n: int) -> int:
-      return n * (n - 1) // 2
-
-    for i, a in enumerate(nums):
-      s[a] -= 1
-
-      l = i
-      r = len(nums) - i - 1
-
-      # Start with all possible subsequences with `a` as the middle number.
-      ans += nC2(l) * nC2(r)
-
-      # Minus the cases where the frequency of `a` is 1, so it's not a mode.
-      ans -= nC2(l - p[a]) * nC2(r - s[a])
-
-      for b in p | s:
-        if b == a:
-          continue
-
-        # Minus the cases where the middle number is not a "unique" mode.
-        ans -= p[a] * p[b] * s[b] * (r - s[a] - s[b])  # [a b] a [b c]
-        ans -= s[a] * s[b] * p[b] * (l - p[a] - p[b])  # [b c] a [a b]
-        ans -= nC2(p[b]) * s[a] * (r - s[a] - s[b])  # [b b] a [a c]
-        ans -= nC2(s[b]) * p[a] * (l - p[a] - p[b])  # [a c] a [b b]
-
-        # Minus the cases where the middle number is not a mode.
-        ans -= nC2(p[b]) * s[a] * s[b]  # [b b] a [a b]
-        ans -= nC2(s[b]) * p[a] * p[b]  # [a b] a [b b]
-
-      ans %= MOD
-      p[a] += 1
-
-    return ans
diff --git a/solutions/3395. Subsequences with a Unique Middle Mode I/3395-3.cpp b/solutions/3395. Subsequences with a Unique Middle Mode I/3395-3.cpp
deleted file mode 100644
index 7cd15958685..00000000000
--- a/solutions/3395. Subsequences with a Unique Middle Mode I/3395-3.cpp	
+++ /dev/null
@@ -1,101 +0,0 @@
-// Recall from solution 1 that after counting all the subsequences with `a` as
-// the middle mode number, we need to subtract the cases where `a` is not a
-// unique mode or not a mode.
-//
-// To avoid the need of looping through all numbers that are not `a`, we can
-// maintain the sums that are not related to `a` in the loop.
-//
-// So, during the simplification of the formula, keep the running sums of
-// pss, spp, pp, ss, and ps as the first item.
-// (for cleaner notation, abbreviate p[b] and s[b] to just p and s)
-//
-//   sum(b != a) (p[a] * p * s) * (r - sa - s)
-//             + (sa * s * p) * (l - p[a] - p)
-//             + (p, 2) * sa * (r - sa)
-//             + (s, 2) * p[a] * (l - p[a])
-//
-//   sum(b != a) (p * s) * (p[a] * (r - sa)) + (p * s^2) * (-p[a])
-//             + (s * p) * (sa * (l - p[a])) + (s * p^2) * (-sa)
-//             + (p^2 - p) * (sa * (r - sa) / 2)
-//             + (s^2 - s) * (p[a] * (l - p[a]) / 2)
-
-class Solution {
- public:
-  int subsequencesWithMiddleMode(vector<int>& nums) {
-    int ans = 0;
-    unordered_map<int, int> p;  // prefix counter
-    unordered_map<int, int> s;  // suffix counter
-
-    for (const int num : nums)
-      ++s[num];
-
-    long pss = 0;
-    long spp = 0;
-    long pp = 0;
-    long ss = 0;
-    long ps = 0;
-
-    for (const auto& [_, freq] : s)
-      ss = (ss + static_cast<long>(freq) * freq) % kMod;
-
-    for (int i = 0; i < nums.size(); ++i) {
-      const int a = nums[i];
-      long sa = s[a];
-      const long pa = p[a];
-
-      // Update running sums after decrementing sa.
-      pss = (pss + pa * (-sa * sa + (sa - 1) * (sa - 1))) % kMod;
-      spp = (spp - pa * pa) % kMod;  // (-sa + (sa - 1)) * pa * pa
-      ss = (ss - sa * sa + (sa - 1) * (sa - 1)) % kMod;
-      ps = (ps - pa) % kMod;  // -pa * (-sa + (sa - 1))
-
-      sa = --s[a];
-
-      const int l = i;
-      const int r = nums.size() - i - 1;
-
-      // Start with all possible subsequences with `a` as the middle number.
-      ans = (ans + nC2(l) * nC2(r)) % kMod;
-
-      // Minus cases where frequency of `a` is 1, so it's not a mode.
-      ans = (ans - nC2(l - pa) * nC2(r - sa)) % kMod;
-
-      // Minus the values where `b != a`.
-      const long pss_ = (pss - pa * sa * sa) % kMod;
-      const long spp_ = (spp - sa * pa * pa) % kMod;
-      const long pp_ = (pp - pa * pa) % kMod;
-      const long ss_ = (ss - sa * sa) % kMod;
-      const long ps_ = (ps - pa * sa) % kMod;
-      const long p_ = l - pa;
-      const long s_ = r - sa;
-
-      // Minus cases where `a` is not a "unique" mode or not a mode.
-      long subtract = 0;
-      subtract = (subtract + ps_ * (pa * (r - sa))) % kMod;
-      subtract = (subtract + pss_ * (-pa)) % kMod;
-      subtract = (subtract + ps_ * (sa * (l - pa))) % kMod;
-      subtract = (subtract + spp_ * (-sa)) % kMod;
-      subtract = (subtract + (pp_ - p_) * sa * (r - sa) / 2) % kMod;
-      subtract = (subtract + (ss_ - s_) * pa * (l - pa) / 2) % kMod;
-      ans = (ans - subtract + kMod) % kMod;
-
-      // Update running sums after incrementing p[a].
-      pss = (pss + sa * sa) % kMod;  // (-pa + (pa + 1)) * sa * sa
-      spp = (spp + sa * (-pa * pa + (pa + 1) * (pa + 1))) % kMod;
-      pp = (pp - pa * pa + (pa + 1) * (pa + 1)) % kMod;
-      ps = (ps + sa) % kMod;  // (-pa + (pa + 1)) * sa
-
-      ++p[a];
-    }
-
-    return (ans + kMod) % kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Returns C(n, 2)
-  long nC2(long n) {
-    return n * (n - 1) / 2 % kMod;
-  }
-};
diff --git a/solutions/3395. Subsequences with a Unique Middle Mode I/3395-3.java b/solutions/3395. Subsequences with a Unique Middle Mode I/3395-3.java
deleted file mode 100644
index 23d736b7a31..00000000000
--- a/solutions/3395. Subsequences with a Unique Middle Mode I/3395-3.java	
+++ /dev/null
@@ -1,100 +0,0 @@
-// Recall from solution 1 that after counting all the subsequences with `a` as
-// the middle mode number, we need to subtract the cases where `a` is not a
-// unique mode or not a mode.
-//
-// To avoid the need of looping through all numbers that are not `a`, we can
-// maintain the sums that are not related to `a` in the loop.
-//
-// So, during the simplification of the formula, keep the running sums of
-// pss, spp, pp, ss, and ps as the first item.
-// (for cleaner notation, abbreviate p[b] and s[b] to just p and s)
-//
-//   sum(b != a) (p[a] * p * s) * (r - s[a] - s)
-//             + (s[a] * s * p) * (l - p[a] - p)
-//             + (p, 2) * s[a] * (r - s[a])
-//             + (s, 2) * p[a] * (l - p[a])
-//
-//   sum(b != a) (p * s) * (p[a] * (r - s[a])) + (p * s^2) * (-p[a])
-//             + (s * p) * (s[a] * (l - p[a])) + (s * p^2) * (-s[a])
-//             + (p^2 - p) * (s[a] * (r - s[a]) / 2)
-//             + (s^2 - s) * (p[a] * (l - p[a]) / 2)
-
-class Solution {
-  public int subsequencesWithMiddleMode(int[] nums) {
-    int ans = 0;
-    Map<Integer, Integer> p = new HashMap<>(); // prefix counter
-    Map<Integer, Integer> s = new HashMap<>(); // suffix counter
-
-    for (final int num : nums)
-      s.merge(num, 1, Integer::sum);
-
-    long pss = 0;
-    long spp = 0;
-    long pp = 0;
-    long ss = 0;
-    long ps = 0;
-
-    for (final int freq : s.values())
-      ss = (ss + (long) freq * freq) % MOD;
-
-    for (int i = 0; i < nums.length; ++i) {
-      final int a = nums[i];
-      long sa = s.get(a);
-      final long pa = p.getOrDefault(a, 0);
-
-      // Update running sums after decrementing s[a]
-      pss = (pss + pa * (-sa * sa + (sa - 1) * (sa - 1))) % MOD;
-      spp = (spp - pa * pa) % MOD; // (-sa + (sa - 1)) * pa * pa
-      ss = (ss - sa * sa + (sa - 1) * (sa - 1)) % MOD;
-      ps = (ps - pa) % MOD; // -pa * (-sa + (sa - 1))
-
-      s.merge(a, -1, Integer::sum);
-      sa = s.get(a);
-
-      final int l = i;
-      final int r = nums.length - i - 1;
-
-      // Start with all possible subsequences with `a` as the middle number
-      ans = (int) ((ans + (long) nC2(l) * nC2(r)) % MOD);
-
-      // Minus cases where frequency of `a` is 1, so it's not a mode
-      ans = (int) ((ans - (long) nC2(l - pa) * nC2(r - sa)) % MOD);
-
-      // Minus the values where `b != a`
-      final long pss_ = (pss - pa * sa * sa) % MOD;
-      final long spp_ = (spp - sa * pa * pa) % MOD;
-      final long pp_ = (pp - pa * pa) % MOD;
-      final long ss_ = (ss - sa * sa) % MOD;
-      final long ps_ = (ps - pa * sa) % MOD;
-      final long p_ = l - pa;
-      final long s_ = r - sa;
-
-      // Minus cases where `a` is not a "unique" mode or not a mode
-      long subtract = 0;
-      subtract = (subtract + ps_ * (pa * (r - sa))) % MOD;
-      subtract = (subtract + pss_ * (-pa)) % MOD;
-      subtract = (subtract + ps_ * (sa * (l - pa))) % MOD;
-      subtract = (subtract + spp_ * (-sa)) % MOD;
-      subtract = (subtract + (pp_ - p_) * sa * (r - sa) / 2) % MOD;
-      subtract = (subtract + (ss_ - s_) * pa * (l - pa) / 2) % MOD;
-      ans = (int) ((ans - subtract + MOD) % MOD);
-
-      // Update running sums after incrementing p[a]
-      pss = (pss + sa * sa) % MOD; // (-pa + (pa + 1)) * sa * sa
-      spp = (spp + sa * (-pa * pa + (pa + 1) * (pa + 1))) % MOD;
-      pp = (pp - pa * pa + (pa + 1) * (pa + 1)) % MOD;
-      ps = (ps + sa) % MOD; // (-pa + (pa + 1)) * sa
-
-      p.merge(a, 1, Integer::sum);
-    }
-
-    return (int) ((ans + MOD) % MOD);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  // Returns C(n, 2)
-  private long nC2(long n) {
-    return n * (n - 1) / 2 % MOD;
-  }
-}
diff --git a/solutions/3395. Subsequences with a Unique Middle Mode I/3395-3.py b/solutions/3395. Subsequences with a Unique Middle Mode I/3395-3.py
deleted file mode 100644
index a78670b655a..00000000000
--- a/solutions/3395. Subsequences with a Unique Middle Mode I/3395-3.py	
+++ /dev/null
@@ -1,81 +0,0 @@
-# Recall from solution 1 that after counting all the subsequences with `a` as
-# the middle mode number, we need to subtract the cases where `a` is not a
-# unique mode or not a mode.
-#
-# To avoid the need of looping through all numbers that are not `a`, we can
-# maintain the sums that are not related to `a` in the loop.
-#
-# So, during the simplification of the formula, keep the running sums of
-# pss, spp, pp, ss, and ps as the first item.
-# (for cleaner notation, abbreviate p[b] and s[b] to just p and s)
-#
-#   sum(b != a) (p[a] * p * s) * (r - s[a] - s)
-#             + (s[a] * s * p) * (l - p[a] - p)
-#             + (p, 2) * s[a] * (r - s[a])
-#             + (s, 2) * p[a] * (l - p[a])
-#
-#   sum(b != a) (p * s) * (p[a] * (r - s[a])) + (p * s^2) * (-p[a])
-#             + (s * p) * (s[a] * (l - p[a])) + (s * p^2) * (-s[a])
-#             + (p^2 - p) * (s[a] * (r - s[a]) / 2)
-#             + (s^2 - s) * (p[a] * (l - p[a]) / 2)
-
-
-class Solution:
-  def subsequencesWithMiddleMode(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-    ans = 0
-    p = collections.Counter()  # prefix counter
-    s = collections.Counter(nums)  # suffix counter
-
-    def nC2(n: int) -> int:
-      return n * (n - 1) // 2
-
-    pss = 0
-    spp = 0
-    pp = 0
-    ss = sum(freq**2 for freq in s.values())
-    ps = 0
-
-    for i, a in enumerate(nums):
-      # Update running sums after decrementing s[a].
-      pss += p[a] * (-s[a]**2 + (s[a] - 1)**2)
-      spp += -p[a]**2  # (-s[a] + (s[a] - 1)) * p[a]**2
-      ss += -s[a]**2 + (s[a] - 1)**2
-      ps += -p[a]  # -p[a] * (-s[a] + (s[a] - 1))
-
-      s[a] -= 1
-
-      l = i
-      r = len(nums) - i - 1
-
-      # Start with all possible subsequences with `a` as the middle number.
-      ans += nC2(l) * nC2(r)
-
-      # Minus the cases where the frequency of `a` is 1, so it's not a mode.
-      ans -= nC2(l - p[a]) * nC2(r - s[a])
-
-      # Minus the values where `b != a`.
-      pss_ = pss - p[a] * s[a]**2
-      spp_ = spp - s[a] * p[a]**2
-      pp_ = pp - p[a]**2
-      ss_ = ss - s[a]**2
-      ps_ = ps - p[a] * s[a]
-      p_ = l - p[a]
-      s_ = r - s[a]
-
-      # Minus the cases where the `a` is not a "unique" mode or not a mode.
-      ans -= ps_ * (p[a] * (r - s[a])) + pss_ * (-p[a])
-      ans -= ps_ * (s[a] * (l - p[a])) + spp_ * (-s[a])
-      ans -= (pp_ - p_) * s[a] * (r - s[a]) // 2
-      ans -= (ss_ - s_) * p[a] * (l - p[a]) // 2
-      ans %= MOD
-
-      # Update running sums after incrementing p[a].
-      pss += s[a]**2  # (-p[a] + (p[a] + 1)) * s[a]**2
-      spp += s[a] * (-p[a]**2 + (p[a] + 1)**2)
-      pp += -p[a]**2 + (p[a] + 1)**2
-      ps += s[a]  # (-p[a] + (p[a] + 1)) * s[a]
-
-      p[a] += 1
-
-    return ans
diff --git a/solutions/3395. Subsequences with a Unique Middle Mode I/3395.cpp b/solutions/3395. Subsequences with a Unique Middle Mode I/3395.cpp
deleted file mode 100644
index b3575c7a9e7..00000000000
--- a/solutions/3395. Subsequences with a Unique Middle Mode I/3395.cpp	
+++ /dev/null
@@ -1,100 +0,0 @@
-class Solution {
- public:
-  int subsequencesWithMiddleMode(vector<int>& nums) {
-    const int n = nums.size();
-    long ans = 0;
-    unordered_map<int, int> left;
-    unordered_map<int, int> right;
-
-    for (int i = 0; i < 2; ++i)
-      ++left[nums[i]];
-
-    for (int i = 2; i < n; ++i)
-      ++right[nums[i]];
-
-    for (int i = 2; i < n - 2; ++i) {
-      const int num = nums[i];
-      if (--right[num] == 0)
-        right.erase(num);
-
-      const int leftCount = left[num];
-      const int rightCount = right[num];
-      const int leftOther = i - leftCount;
-      const int rightOther = n - 1 - i - rightCount;
-
-      // count[mode] = 5 -- [a a] a [a a]
-      ans += nC2(leftCount) * nC2(rightCount);
-      ans %= kMod;
-
-      // count[mode] = 4 -- [a a] a [a ?]
-      ans += nC2(leftCount) * rightCount % kMod * rightOther % kMod;
-      ans %= kMod;
-
-      // count[mode] = 4 -- [a ?] a [a a]
-      ans += leftCount * leftOther % kMod * nC2(rightCount) % kMod;
-      ans %= kMod;
-
-      // count[mode] = 3 -- [a a] a [? ?]
-      ans += nC2(leftCount) * nC2(rightOther) % kMod;
-      ans %= kMod;
-
-      // count[mode] = 3 -- [? ?] a [a a]
-      ans += nC2(leftOther) * nC2(rightCount) % kMod;
-      ans %= kMod;
-
-      // count[mode] = 3 -- [a ?] a [a ?]
-      ans +=
-          leftCount * leftOther % kMod * rightCount % kMod * rightOther % kMod;
-      ans %= kMod;
-
-      // count[mode] = 2 -- [a ?] a [? ?]
-      ans += leftCount * calc(num, leftOther, rightOther, left, right) % kMod;
-      ans %= kMod;
-
-      // count[mode] = 2 -- [? ?] a [a ?]
-      ans += rightCount * calc(num, rightOther, leftOther, right, left) % kMod;
-      ans %= kMod;
-
-      ++left[num];
-    }
-
-    return ans % kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Returns C(n, 2).
-  long nC2(long n) {
-    return n * (n - 1) / 2 % kMod;
-  }
-
-  // Returns the count of subsequences that have `a` as the middle number, where
-  // invalid subsequences are excluded.
-  long calc(int a, long other1, long other2,
-            const unordered_map<int, int>& count1,
-            const unordered_map<int, int>& count2) {
-    // [a ?] a [? ?]
-    long res = other1 * nC2(other2) % kMod;
-
-    for (const auto& [b, b1] : count1) {
-      if (b == a)
-        continue;
-      const long b2 = count2.contains(b) ? count2.at(b) : 0;
-      // Exclude triples -- [a b] a [b b].
-      res = (res - b1 * nC2(b2) % kMod + kMod) % kMod;
-      // Exclude doubles -- [a b] a [b ?].
-      res = (res - b1 * b2 % kMod * (other2 - b2) % kMod + kMod) % kMod;
-    }
-
-    for (const auto& [b, b2] : count2) {
-      if (b == a)
-        continue;
-      const long b1 = count1.contains(b) ? count1.at(b) : 0;
-      // Exclude doubles -- [a ?] a [b b].
-      res = (res - (other1 - b1) * nC2(b2) % kMod + kMod) % kMod;
-    }
-
-    return res;
-  }
-};
diff --git a/solutions/3395. Subsequences with a Unique Middle Mode I/3395.java b/solutions/3395. Subsequences with a Unique Middle Mode I/3395.java
deleted file mode 100644
index 0e41adc8fcd..00000000000
--- a/solutions/3395. Subsequences with a Unique Middle Mode I/3395.java	
+++ /dev/null
@@ -1,93 +0,0 @@
-class Solution {
-  public int subsequencesWithMiddleMode(int[] nums) {
-    int n = nums.length;
-    long ans = 0;
-    Map<Integer, Integer> left = new HashMap<>();
-    Map<Integer, Integer> right = new HashMap<>();
-
-    for (int i = 0; i < 2; ++i)
-      left.merge(nums[i], 1, Integer::sum);
-
-    for (int i = 2; i < n; ++i)
-      right.merge(nums[i], 1, Integer::sum);
-
-    for (int i = 2; i < n - 2; ++i) {
-      final int num = nums[i];
-      if (right.merge(num, -1, Integer::sum) == 0)
-        right.remove(num);
-
-      final int leftCount = left.getOrDefault(num, 0);
-      final int rightCount = right.getOrDefault(num, 0);
-      final int leftOther = i - leftCount;
-      final int rightOther = n - 1 - i - rightCount;
-
-      // count[mode] = 5 -- [a a] a [a a]
-      ans = (ans + nC2(leftCount) * nC2(rightCount)) % MOD;
-
-      // count[mode] = 4 -- [a a] a [a ?]
-      ans = (ans + nC2(leftCount) * rightCount % MOD * rightOther % MOD) % MOD;
-
-      // count[mode] = 4 -- [a ?] a [a a]
-      ans = (ans + leftCount * leftOther % MOD * nC2(rightCount) % MOD) % MOD;
-
-      // count[mode] = 3 -- [a a] a [? ?]
-      ans = (ans + nC2(leftCount) * nC2(rightOther) % MOD) % MOD;
-
-      // count[mode] = 3 -- [? ?] a [a a]
-      ans = (ans + nC2(leftOther) * nC2(rightCount) % MOD) % MOD;
-
-      // count[mode] = 3 -- [a ?] a [a ?]
-      ans = (ans + leftCount * leftOther % MOD * rightCount % MOD * rightOther % MOD) % MOD;
-
-      // count[mode] = 2 -- [a ?] a [? ?]
-      ans = (ans + leftCount * calc(num, leftOther, rightOther, left, right) % MOD) % MOD;
-
-      // count[mode] = 2 -- [? ?] a [a ?]
-      ans = (ans + rightCount * calc(num, rightOther, leftOther, right, left) % MOD) % MOD;
-
-      // Update left map
-      left.merge(num, 1, Integer::sum);
-    }
-
-    return (int) (ans % MOD);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  // Returns C(n, 2)
-  private long nC2(long n) {
-    return n * (n - 1) / 2 % MOD;
-  }
-
-  // Returns the count of subsequences that have 'a' as the middle number, where
-  // invalid subsequences are excluded
-  private long calc(int a, long other1, long other2, Map<Integer, Integer> count1,
-                    Map<Integer, Integer> count2) {
-    // [a ?] a [? ?]
-    long res = other1 * nC2(other2) % MOD;
-
-    for (Map.Entry<Integer, Integer> entry : count1.entrySet()) {
-      final int b = entry.getKey();
-      final long b1 = entry.getValue();
-      if (b == a)
-        continue;
-      final long b2 = count2.getOrDefault(b, 0);
-      // Exclude triples -- [a b] a [b b]
-      res = (res - b1 * nC2(b2) % MOD + MOD) % MOD;
-      // Exclude doubles -- [a b] a [b ?]
-      res = (res - b1 * b2 % MOD * (other2 - b2) % MOD + MOD) % MOD;
-    }
-
-    for (Map.Entry<Integer, Integer> entry : count2.entrySet()) {
-      final int b = entry.getKey();
-      final long b2 = entry.getValue();
-      if (b == a)
-        continue;
-      final long b1 = count1.getOrDefault(b, 0);
-      // Exclude doubles -- [a ?] a [b b]
-      res = (res - (other1 - b1) * nC2(b2) % MOD + MOD) % MOD;
-    }
-
-    return res;
-  }
-}
diff --git a/solutions/3395. Subsequences with a Unique Middle Mode I/3395.py b/solutions/3395. Subsequences with a Unique Middle Mode I/3395.py
deleted file mode 100644
index 2d170f0ed05..00000000000
--- a/solutions/3395. Subsequences with a Unique Middle Mode I/3395.py	
+++ /dev/null
@@ -1,88 +0,0 @@
-class Solution:
-  def __init__(self):
-    self.MOD = 1_000_000_007
-
-  def subsequencesWithMiddleMode(self, nums: list[int]) -> int:
-    n = len(nums)
-    ans = 0
-    left = collections.Counter()
-    right = collections.Counter()
-
-    for i in range(2):
-      left[nums[i]] += 1
-
-    for i in range(2, n):
-      right[nums[i]] += 1
-
-    for i in range(2, n - 2):
-      num = nums[i]
-      right[num] -= 1
-      if right[num] == 0:
-        del right[num]
-
-      leftCount = left[num]
-      rightCount = right[num]
-      leftOther = i - leftCount
-      rightOther = n - 1 - i - rightCount
-
-      # count[mode] = 5 -- [a a] a [a a]
-      ans += math.comb(leftCount, 2) * math.comb(rightCount, 2)
-
-      # count[mode] = 4 -- [a a] a [a ?]
-      ans += math.comb(leftCount, 2) * rightCount * rightOther
-
-      # count[mode] = 4 -- [a ?] a [a a]
-      ans += leftCount * leftOther * math.comb(rightCount, 2)
-
-      # count[mode] = 3 -- [a a] a [? ?]
-      ans += math.comb(leftCount, 2) * math.comb(rightOther, 2)
-
-      # count[mode] = 3 -- [? ?] a [a a]
-      ans += math.comb(leftOther, 2) * math.comb(rightCount, 2)
-
-      # count[mode] = 3 -- [a ?] a [a ?]
-      ans += leftCount * leftOther * rightCount * rightOther
-
-      # count[mode] = 2 -- [a ?] a [? ?]
-      ans += leftCount * self._calc(num, leftOther, rightOther, left, right)
-
-      # count[mode] = 2 -- [? ?] a [a ?]
-      ans += rightCount * self._calc(num, rightOther, leftOther, right, left)
-
-      ans %= self.MOD
-      left[num] += 1
-
-    return ans
-
-  def _calc(
-      self,
-      a: int,
-      other1: int,
-      other2: int,
-      count1: dict[int, int],
-      count2: dict[int, int]
-  ) -> int:
-    """
-    Returns the count of subsequences that have `a` as the middle number, where
-    invalid subsequences are excluded.
-    """
-    # [a ?] a [? ?]
-    res = (other1 * math.comb(other2, 2)) % self.MOD
-
-    for b, b1 in count1.items():
-      if b == a:
-        continue
-      b2 = count2[b]
-      # Exclude triples -- [a b] a [b b].
-      res = (res - b1 * math.comb(b2, 2)) % self.MOD
-      # Exclude doubles -- [a b] a [b ?].
-      res = (res - b1 * b2 * (other2 - b2)) % self.MOD
-
-    for b, b2 in count2.items():
-      if b == a:
-        continue
-      b1 = count1[b]
-      # Exclude doubles -- [a ?] a [b b].
-      res = (res - (other1 - b1) * math.comb(b2, 2)) % self.MOD
-
-    return (res + self.MOD) % self.MOD
diff --git a/solutions/3396. Minimum Number of Operations to Make Elements in Array Distinct/3396.cpp b/solutions/3396. Minimum Number of Operations to Make Elements in Array Distinct/3396.cpp
deleted file mode 100644
index d965a49eb7b..00000000000
--- a/solutions/3396. Minimum Number of Operations to Make Elements in Array Distinct/3396.cpp	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution {
- public:
-  int minimumOperations(vector<int>& nums) {
-    unordered_set<int> seen;
-    for (int i = nums.size() - 1; i >= 0; --i)
-      if (!seen.insert(nums[i]).second)
-        return (i + 1 + 2) / 3;  // ceil((i + 1) / 3)
-    return 0;
-  }
-};
diff --git a/solutions/3396. Minimum Number of Operations to Make Elements in Array Distinct/3396.java b/solutions/3396. Minimum Number of Operations to Make Elements in Array Distinct/3396.java
deleted file mode 100644
index d27b1e617e0..00000000000
--- a/solutions/3396. Minimum Number of Operations to Make Elements in Array Distinct/3396.java	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution {
-  public int minimumOperations(int[] nums) {
-    Set<Integer> seen = new HashSet<>();
-    for (int i = nums.length - 1; i >= 0; --i)
-      if (!seen.add(nums[i]))
-        return (i + 1 + 2) / 3; // ceil((i + 1) / 3)
-    return 0;
-  }
-}
diff --git a/solutions/3396. Minimum Number of Operations to Make Elements in Array Distinct/3396.py b/solutions/3396. Minimum Number of Operations to Make Elements in Array Distinct/3396.py
deleted file mode 100644
index 70bd6b3e680..00000000000
--- a/solutions/3396. Minimum Number of Operations to Make Elements in Array Distinct/3396.py	
+++ /dev/null
@@ -1,8 +0,0 @@
-class Solution:
-  def minimumOperations(self, nums: list[int]) -> int:
-    seen = set()
-    for i, num in reversed(list(enumerate(nums))):
-      if num in seen:
-        return (i + 1 + 2) // 3  # ceil((i + 1) / 3)
-      seen.add(num)
-    return 0
diff --git a/solutions/3397. Maximum Number of Distinct Elements After Operations/3397.cpp b/solutions/3397. Maximum Number of Distinct Elements After Operations/3397.cpp
deleted file mode 100644
index 3512674935a..00000000000
--- a/solutions/3397. Maximum Number of Distinct Elements After Operations/3397.cpp	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
- public:
-  int maxDistinctElements(vector<int>& nums, int k) {
-    int ans = 0;
-    int occupied = INT_MIN;
-
-    ranges::sort(nums);
-
-    for (const int num : nums)
-      if (occupied < num + k) {
-        occupied = max(occupied + 1, num - k);
-        ++ans;
-      }
-
-    return ans;
-  }
-};
diff --git a/solutions/3397. Maximum Number of Distinct Elements After Operations/3397.java b/solutions/3397. Maximum Number of Distinct Elements After Operations/3397.java
deleted file mode 100644
index 0b60a9cdc57..00000000000
--- a/solutions/3397. Maximum Number of Distinct Elements After Operations/3397.java	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution {
-  public int maxDistinctElements(int[] nums, int k) {
-    int ans = 0;
-    int occupied = Integer.MIN_VALUE;
-
-    Arrays.sort(nums);
-
-    for (final int num : nums)
-      if (occupied < num + k) {
-        occupied = Math.max(occupied + 1, num - k);
-        ++ans;
-      }
-
-    return ans;
-  }
-}
diff --git a/solutions/3397. Maximum Number of Distinct Elements After Operations/3397.py b/solutions/3397. Maximum Number of Distinct Elements After Operations/3397.py
deleted file mode 100644
index 71d31218627..00000000000
--- a/solutions/3397. Maximum Number of Distinct Elements After Operations/3397.py	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution:
-  def maxDistinctElements(self, nums: list[int], k: int) -> int:
-    ans = 0
-    occupied = -math.inf
-
-    for num in sorted(nums):
-      if occupied < num + k:
-        occupied = max(occupied + 1, num - k)
-        ans += 1
-
-    return ans
diff --git a/solutions/3398. Smallest Substring With Identical Characters I/3398.cpp b/solutions/3398. Smallest Substring With Identical Characters I/3398.cpp
deleted file mode 100644
index d216e78fac1..00000000000
--- a/solutions/3398. Smallest Substring With Identical Characters I/3398.cpp	
+++ /dev/null
@@ -1,43 +0,0 @@
-class Solution {
- public:
-  int minLength(string s, int numOps) {
-    int l = 1;
-    int r = s.length();
-
-    while (l < r) {
-      const int m = (l + r) / 2;
-      if (getMinOps(s, m) <= numOps)
-        r = m;
-      else
-        l = m + 1;
-    }
-
-    return l;
-  }
-
- private:
-  // Returns the minimum number of operations needed to make all groups of
-  // identical characters of length k or less.
-  int getMinOps(const string& s, int k) {
-    if (k == 1) {
-      size_t res = 0;
-      for (int i = 0; i < s.length(); ++i)
-        if (s[i] - '0' == i % 2)
-          ++res;
-      return min(res, s.length() - res);
-    }
-
-    int res = 0;
-    int runningLen = 1;
-
-    for (int i = 1; i < s.length(); ++i)
-      if (s[i] == s[i - 1]) {
-        ++runningLen;
-      } else {
-        res += runningLen / (k + 1);
-        runningLen = 1;
-      }
-
-    return res + runningLen / (k + 1);
-  }
-};
diff --git a/solutions/3398. Smallest Substring With Identical Characters I/3398.java b/solutions/3398. Smallest Substring With Identical Characters I/3398.java
deleted file mode 100644
index d3da6bbeaea..00000000000
--- a/solutions/3398. Smallest Substring With Identical Characters I/3398.java	
+++ /dev/null
@@ -1,41 +0,0 @@
-class Solution {
-  public int minLength(String s, int numOps) {
-    int l = 1;
-    int r = s.length();
-
-    while (l < r) {
-      final int m = (l + r) / 2;
-      if (getMinOps(s, m) <= numOps)
-        r = m;
-      else
-        l = m + 1;
-    }
-
-    return l;
-  }
-
-  // Returns the minimum number of operations needed to make all groups of
-  // identical characters of length k or less.
-  private int getMinOps(final String s, int k) {
-    if (k == 1) {
-      int res = 0;
-      for (int i = 0; i < s.length(); ++i)
-        if (s.charAt(i) - '0' == i % 2)
-          ++res;
-      return Math.min(res, s.length() - res);
-    }
-
-    int res = 0;
-    int runningLen = 1;
-
-    for (int i = 1; i < s.length(); ++i)
-      if (s.charAt(i) == s.charAt(i - 1)) {
-        ++runningLen;
-      } else {
-        res += runningLen / (k + 1);
-        runningLen = 1;
-      }
-
-    return res + runningLen / (k + 1);
-  }
-}
diff --git a/solutions/3398. Smallest Substring With Identical Characters I/3398.py b/solutions/3398. Smallest Substring With Identical Characters I/3398.py
deleted file mode 100644
index 11b94239362..00000000000
--- a/solutions/3398. Smallest Substring With Identical Characters I/3398.py	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution:
-  def minLength(self, s: str, numOps: int) -> int:
-    def getMinOps(k: int) -> int:
-      """
-      Returns the minimum number of operations needed to make all groups of
-      identical characters of length k or less.
-      """
-      if k == 1:
-        res = sum(1 for i, c in enumerate(s) if int(c) == i % 2)
-        return min(res, len(s) - res)
-
-      res = 0
-      runningLen = 1
-
-      for a, b in itertools.pairwise(s):
-        if a == b:
-          runningLen += 1
-        else:
-          res += runningLen // (k + 1)
-          runningLen = 1
-
-      return res + runningLen // (k + 1)
-
-    return bisect_left(range(1, len(s) + 1),
-                       True, key=lambda m: getMinOps(m) <= numOps)
diff --git a/solutions/3399. Smallest Substring With Identical Characters II/3399.cpp b/solutions/3399. Smallest Substring With Identical Characters II/3399.cpp
deleted file mode 100644
index 8d2e0891f10..00000000000
--- a/solutions/3399. Smallest Substring With Identical Characters II/3399.cpp	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution {
- public:
-  // Same as 3398. Smallest Substring With Identical Characters I
-  int minLength(string s, int numOps) {
-    int l = 1;
-    int r = s.length();
-
-    while (l < r) {
-      const int m = (l + r) / 2;
-      if (getMinOps(s, m) <= numOps)
-        r = m;
-      else
-        l = m + 1;
-    }
-
-    return l;
-  }
-
- private:
-  // Returns the minimum number of operations needed to make all groups of
-  // identical characters of length k or less.
-  int getMinOps(const string& s, int k) {
-    if (k == 1) {
-      size_t res = 0;
-      for (int i = 0; i < s.length(); ++i)
-        if (s[i] - '0' == i % 2)
-          ++res;
-      return min(res, s.length() - res);
-    }
-
-    int res = 0;
-    int runningLen = 1;
-
-    for (int i = 1; i < s.length(); ++i)
-      if (s[i] == s[i - 1]) {
-        ++runningLen;
-      } else {
-        res += runningLen / (k + 1);
-        runningLen = 1;
-      }
-
-    return res + runningLen / (k + 1);
-  }
-};
diff --git a/solutions/3399. Smallest Substring With Identical Characters II/3399.java b/solutions/3399. Smallest Substring With Identical Characters II/3399.java
deleted file mode 100644
index e2ee46b4967..00000000000
--- a/solutions/3399. Smallest Substring With Identical Characters II/3399.java	
+++ /dev/null
@@ -1,42 +0,0 @@
-class Solution {
-  // Same as 3398. Smallest Substring With Identical Characters I
-  public int minLength(String s, int numOps) {
-    int l = 1;
-    int r = s.length();
-
-    while (l < r) {
-      final int m = (l + r) / 2;
-      if (getMinOps(s, m) <= numOps)
-        r = m;
-      else
-        l = m + 1;
-    }
-
-    return l;
-  }
-
-  // Returns the minimum number of operations needed to make all groups of
-  // identical characters of length k or less.
-  private int getMinOps(final String s, int k) {
-    if (k == 1) {
-      int res = 0;
-      for (int i = 0; i < s.length(); ++i)
-        if (s.charAt(i) - '0' == i % 2)
-          ++res;
-      return Math.min(res, s.length() - res);
-    }
-
-    int res = 0;
-    int runningLen = 1;
-
-    for (int i = 1; i < s.length(); ++i)
-      if (s.charAt(i) == s.charAt(i - 1)) {
-        ++runningLen;
-      } else {
-        res += runningLen / (k + 1);
-        runningLen = 1;
-      }
-
-    return res + runningLen / (k + 1);
-  }
-}
diff --git a/solutions/3399. Smallest Substring With Identical Characters II/3399.py b/solutions/3399. Smallest Substring With Identical Characters II/3399.py
deleted file mode 100644
index dafeee12386..00000000000
--- a/solutions/3399. Smallest Substring With Identical Characters II/3399.py	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution:
-  # Same as 3398. Smallest Substring With Identical Characters I
-  def minLength(self, s: str, numOps: int) -> int:
-    def getMinOps(k: int) -> int:
-      """
-      Returns the minimum number of operations needed to make all groups of
-      identical characters of length k or less.
-      """
-      if k == 1:
-        res = sum(1 for i, c in enumerate(s) if int(c) == i % 2)
-        return min(res, len(s) - res)
-
-      res = 0
-      runningLen = 1
-
-      for a, b in itertools.pairwise(s):
-        if a == b:
-          runningLen += 1
-        else:
-          res += runningLen // (k + 1)
-          runningLen = 1
-
-      return res + runningLen // (k + 1)
-
-    return bisect_left(range(1, len(s) + 1),
-                       True, key=lambda m: getMinOps(m) <= numOps)
diff --git a/solutions/34. Find First and Last Position of Element in Sorted Array/34.java b/solutions/34. Find First and Last Position of Element in Sorted Array/34.java
index 6784aa7f14b..af811191f70 100644
--- a/solutions/34. Find First and Last Position of Element in Sorted Array/34.java	
+++ b/solutions/34. Find First and Last Position of Element in Sorted Array/34.java	
@@ -7,12 +7,12 @@ public int[] searchRange(int[] nums, int target) {
     return new int[] {l, r};
   }
 
-  private int firstGreaterEqual(int[] arr, int target) {
+  private int firstGreaterEqual(int[] A, int target) {
     int l = 0;
-    int r = arr.length;
+    int r = A.length;
     while (l < r) {
       final int m = (l + r) / 2;
-      if (arr[m] >= target)
+      if (A[m] >= target)
         r = m;
       else
         l = m + 1;
diff --git a/solutions/34. Find First and Last Position of Element in Sorted Array/34.py b/solutions/34. Find First and Last Position of Element in Sorted Array/34.py
index efd067c5c39..6a9fbcde754 100644
--- a/solutions/34. Find First and Last Position of Element in Sorted Array/34.py	
+++ b/solutions/34. Find First and Last Position of Element in Sorted Array/34.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def searchRange(self, nums: list[int], target: int) -> list[int]:
+  def searchRange(self, nums: List[int], target: int) -> List[int]:
     l = bisect_left(nums, target)
     if l == len(nums) or nums[l] != target:
       return -1, -1
diff --git a/solutions/3400. Maximum Number of Matching Indices After Right Shifts/3400.cpp b/solutions/3400. Maximum Number of Matching Indices After Right Shifts/3400.cpp
deleted file mode 100644
index ab111905c47..00000000000
--- a/solutions/3400. Maximum Number of Matching Indices After Right Shifts/3400.cpp	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
- public:
-  int maximumMatchingIndices(vector<int>& nums1, vector<int>& nums2) {
-    const int n = nums1.size();
-    int ans = 0;
-
-    for (int shift = 0; shift < n; ++shift) {
-      int matches = 0;
-      for (int i = 0; i < n; ++i)
-        if (nums1[(i + shift) % n] == nums2[i])
-          ++matches;
-      ans = max(ans, matches);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3400. Maximum Number of Matching Indices After Right Shifts/3400.java b/solutions/3400. Maximum Number of Matching Indices After Right Shifts/3400.java
deleted file mode 100644
index 168a1baeef7..00000000000
--- a/solutions/3400. Maximum Number of Matching Indices After Right Shifts/3400.java	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution {
-  public int maximumMatchingIndices(int[] nums1, int[] nums2) {
-    final int n = nums1.length;
-    int ans = 0;
-
-    for (int shift = 0; shift < n; ++shift) {
-      int matches = 0;
-      for (int i = 0; i < n; ++i)
-        if (nums1[(i + shift) % n] == nums2[i])
-          ++matches;
-      ans = Math.max(ans, matches);
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3400. Maximum Number of Matching Indices After Right Shifts/3400.py b/solutions/3400. Maximum Number of Matching Indices After Right Shifts/3400.py
deleted file mode 100644
index a7c54e7cc58..00000000000
--- a/solutions/3400. Maximum Number of Matching Indices After Right Shifts/3400.py	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution:
-  def maximumMatchingIndices(self, nums1: list[int], nums2: list[int]) -> int:
-    n = len(nums1)
-    ans = 0
-
-    for shift in range(n):
-      matches = 0
-      for i, num2 in enumerate(nums2):
-        if nums1[(i + shift) % n] == num2:
-          matches += 1
-      ans = max(ans, matches)
-
-    return ans
diff --git a/solutions/3401. Find Circular Gift Exchange Chains/3401.sql b/solutions/3401. Find Circular Gift Exchange Chains/3401.sql
deleted file mode 100644
index f050f897026..00000000000
--- a/solutions/3401. Find Circular Gift Exchange Chains/3401.sql	
+++ /dev/null
@@ -1,31 +0,0 @@
-WITH RECURSIVE
-  Chains AS (
-    SELECT *, giver_id AS start_id
-    FROM SecretSanta
-    UNION ALL
-    SELECT SecretSanta.*, Chains.start_id
-    FROM SecretSanta
-    INNER JOIN Chains
-      ON (
-        SecretSanta.giver_id = Chains.receiver_id
-        AND SecretSanta.giver_id != Chains.start_id) -- Avoid cycles.
-  ),
-  ChainSummary AS (
-    SELECT
-      start_id,
-      COUNT(*) AS chain_length,
-      SUM(gift_value) AS total_gift_value
-    FROM Chains
-    GROUP BY 1
-  ),
-  UniqueChains AS (
-    SELECT DISTINCT chain_length, total_gift_value
-    FROM ChainSummary
-  )
-SELECT
-  RANK() OVER(
-    ORDER BY chain_length DESC, total_gift_value DESC
-  ) AS chain_id,
-  chain_length,
-  total_gift_value
-FROM UniqueChains;
diff --git a/solutions/3402. Minimum Operations to Make Columns Strictly Increasing/3402.cpp b/solutions/3402. Minimum Operations to Make Columns Strictly Increasing/3402.cpp
deleted file mode 100644
index 32933905150..00000000000
--- a/solutions/3402. Minimum Operations to Make Columns Strictly Increasing/3402.cpp	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution {
- public:
-  int minimumOperations(vector<vector<int>>& grid) {
-    int ans = 0;
-
-    for (int j = 0; j < grid[0].size(); ++j)
-      for (int i = 1; i < grid.size(); ++i)
-        if (grid[i][j] <= grid[i - 1][j]) {
-          ans += grid[i - 1][j] - grid[i][j] + 1;
-          grid[i][j] = grid[i - 1][j] + 1;
-        }
-
-    return ans;
-  }
-};
diff --git a/solutions/3402. Minimum Operations to Make Columns Strictly Increasing/3402.java b/solutions/3402. Minimum Operations to Make Columns Strictly Increasing/3402.java
deleted file mode 100644
index 40a6bd99c71..00000000000
--- a/solutions/3402. Minimum Operations to Make Columns Strictly Increasing/3402.java	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
-  public int minimumOperations(int[][] grid) {
-    int ans = 0;
-
-    for (int j = 0; j < grid[0].length; ++j)
-      for (int i = 1; i < grid.length; ++i)
-        if (grid[i][j] <= grid[i - 1][j]) {
-          ans += grid[i - 1][j] - grid[i][j] + 1;
-          grid[i][j] = grid[i - 1][j] + 1;
-        }
-
-    return ans;
-  }
-}
diff --git a/solutions/3402. Minimum Operations to Make Columns Strictly Increasing/3402.py b/solutions/3402. Minimum Operations to Make Columns Strictly Increasing/3402.py
deleted file mode 100644
index ba3a6a56bba..00000000000
--- a/solutions/3402. Minimum Operations to Make Columns Strictly Increasing/3402.py	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution:
-  def minimumOperations(self, grid: list[list[int]]) -> int:
-    ans = 0
-
-    for j in range(len(grid[0])):
-      for i in range(1, len(grid)):
-        if grid[i][j] <= grid[i - 1][j]:
-          ans += grid[i - 1][j] - grid[i][j] + 1
-          grid[i][j] = grid[i - 1][j] + 1
-
-    return ans
diff --git a/solutions/3403. Find the Lexicographically Largest String From the Box I/3403.cpp b/solutions/3403. Find the Lexicographically Largest String From the Box I/3403.cpp
deleted file mode 100644
index fadc711710a..00000000000
--- a/solutions/3403. Find the Lexicographically Largest String From the Box I/3403.cpp	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
- public:
-  string answerString(string word, int numFriends) {
-    if (numFriends == 1)
-      return word;
-    const string s = lastSubstring(word);
-    const size_t sz = word.length() - numFriends + 1;
-    return s.substr(0, min(s.length(), sz));
-  }
-
- private:
-  // Same as 1163. Last Substring in Lexicographical Order
-  string lastSubstring(string s) {
-    int i = 0;
-    int j = 1;
-    int k = 0;
-
-    while (j + k < s.length())
-      if (s[i + k] == s[j + k]) {
-        ++k;
-      } else if (s[i + k] > s[j + k]) {
-        // Skip s[j..j + k) and advance to s[j + k + 1] to find a possible
-        // lexicographically larger substring since s[i..i + k) == s[j..j + k)
-        // and s[i + k] > s[j + k).
-        j = j + k + 1;
-        k = 0;
-      } else {
-        // Skip s[i..i + k) and advance to s[i + k + 1] or s[j] to find a
-        // possible lexicographically larger substring since
-        // s[i..i + k) == s[j..j + k) and s[i + k] < s[j + k).
-        // Note that it's unnecessary to explore s[i + k + 1..j) if
-        // i + k + 1 < j since they are already explored by j.
-        i = max(i + k + 1, j);
-        j = i + 1;
-        k = 0;
-      }
-
-    return s.substr(i);
-  }
-};
diff --git a/solutions/3403. Find the Lexicographically Largest String From the Box I/3403.java b/solutions/3403. Find the Lexicographically Largest String From the Box I/3403.java
deleted file mode 100644
index 89d99bdef05..00000000000
--- a/solutions/3403. Find the Lexicographically Largest String From the Box I/3403.java	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
-  public String answerString(String word, int numFriends) {
-    if (numFriends == 1)
-      return word;
-    final String s = lastSubstring(word);
-    final int sz = word.length() - numFriends + 1;
-    return s.substring(0, Math.min(s.length(), sz));
-  }
-
-  // Same as 1163. Last Substring in Lexicographical Order
-  private String lastSubstring(String s) {
-    int i = 0;
-    int j = 1;
-    int k = 0; // the number of the same letters of s[i..n) and s[j..n)
-
-    while (j + k < s.length())
-      if (s.charAt(i + k) == s.charAt(j + k)) {
-        ++k;
-      } else if (s.charAt(i + k) > s.charAt(j + k)) {
-        // Skip s[j..j + k) and advance to s[j + k + 1] to find a possible
-        // lexicographically larger substring since s[i..i + k) == s[j..j + k)
-        // and s[i + k] > s[j + k).
-        j = j + k + 1;
-        k = 0;
-      } else {
-        // Skip s[i..i + k) and advance to s[i + k + 1] or s[j] to find a
-        // possible lexicographically larger substring since
-        // s[i..i + k) == s[j..j + k) and s[i + k] < s[j + k).
-        // Note that it's unnecessary to explore s[i + k + 1..j) if
-        // i + k + 1 < j since they are already explored by j.
-        i = Math.max(i + k + 1, j);
-        j = i + 1;
-        k = 0;
-      }
-
-    return s.substring(i);
-  }
-}
diff --git a/solutions/3403. Find the Lexicographically Largest String From the Box I/3403.py b/solutions/3403. Find the Lexicographically Largest String From the Box I/3403.py
deleted file mode 100644
index 7c8dbf4976c..00000000000
--- a/solutions/3403. Find the Lexicographically Largest String From the Box I/3403.py	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution:
-  def answerString(self, word: str, numFriends: int) -> str:
-    if numFriends == 1:
-      return word
-    s = self._lastSubstring(word)
-    sz = len(word) - numFriends + 1
-    return s[:min(len(s), sz)]
-
-  # Same as 1163. Last Substring in Lexicographical Order
-  def _lastSubstring(self, s: str) -> str:
-    i = 0
-    j = 1
-    k = 0  # the number of the same letters of s[i..n) and s[j..n)
-
-    while j + k < len(s):
-      if s[i + k] == s[j + k]:
-        k += 1
-      elif s[i + k] > s[j + k]:
-        # Skip s[j..j + k) and advance to s[j + k + 1] to find a possible
-        # lexicographically larger substring since s[i..i + k) == s[j..j + k)
-        # and s[i + k] > s[j + k).
-        j = j + k + 1
-        k = 0
-      else:
-        # Skip s[i..i + k) and advance to s[i + k + 1] or s[j] to find a
-        # possible lexicographically larger substring since
-        # s[i..i + k) == s[j..j + k) and s[i + k] < s[j + k).
-        # Note that it's unnecessary to explore s[i + k + 1..j) if
-        # i + k + 1 < j since they are already explored by j.
-        i = max(i + k + 1, j)
-        j = i + 1
-        k = 0
-
-    return s[i:]
diff --git a/solutions/3404. Count Special Subsequences/3404.cpp b/solutions/3404. Count Special Subsequences/3404.cpp
deleted file mode 100644
index d1888e2aebd..00000000000
--- a/solutions/3404. Count Special Subsequences/3404.cpp	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
- public:
-  long long numberOfSubsequences(vector<int>& nums) {
-    const int n = nums.size();
-    const int mx = ranges::max(nums);
-    long ans = 0;
-    vector<vector<int>> count(mx + 1, vector<int>(mx + 1));
-
-    // nums[p] * nums[r] == nums[q] * nums[s]
-    // nums[p] / nums[q] == nums[s] / nums[r]
-    for (int r = 4; r <= n - 1 - 2; ++r) {
-      const int q = r - 2;
-      for (int p = 0; p <= q - 2; ++p) {
-        const int g = gcd(nums[p], nums[q]);
-        ++count[nums[p] / g][nums[q] / g];
-      }
-      for (int s = r + 2; s < n; ++s) {
-        const int g = gcd(nums[s], nums[r]);
-        ans += count[nums[s] / g][nums[r] / g];
-      }
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3404. Count Special Subsequences/3404.java b/solutions/3404. Count Special Subsequences/3404.java
deleted file mode 100644
index d069d16c768..00000000000
--- a/solutions/3404. Count Special Subsequences/3404.java	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
-  public long numberOfSubsequences(int[] nums) {
-    final int n = nums.length;
-    final int mx = Arrays.stream(nums).max().getAsInt();
-    long ans = 0;
-    int[][] count = new int[mx + 1][mx + 1];
-
-    // nums[p] * nums[r] == nums[q] * nums[s]
-    // nums[p] / nums[q] == nums[s] / nums[r]
-    for (int r = 4; r <= n - 1 - 2; ++r) {
-      final int q = r - 2;
-      for (int p = 0; p <= q - 2; ++p) {
-        final int g = gcd(nums[p], nums[q]);
-        ++count[nums[p] / g][nums[q] / g];
-      }
-      for (int s = r + 2; s < n; ++s) {
-        final int g = gcd(nums[s], nums[r]);
-        ans += count[nums[s] / g][nums[r] / g];
-      }
-    }
-
-    return ans;
-  }
-
-  private int gcd(int a, int b) {
-    return b == 0 ? a : gcd(b, a % b);
-  }
-}
diff --git a/solutions/3404. Count Special Subsequences/3404.py b/solutions/3404. Count Special Subsequences/3404.py
deleted file mode 100644
index fd534dcb604..00000000000
--- a/solutions/3404. Count Special Subsequences/3404.py	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution:
-  def numberOfSubsequences(self, nums: list[int]) -> int:
-    n = len(nums)
-    mx = max(nums)
-    ans = 0
-    count = [[0] * (mx + 1) for _ in range(mx + 1)]
-
-    # nums[p] * nums[r] == nums[q] * nums[s]
-    # nums[p] / nums[q] == nums[s] / nums[r]
-    for r in range(4, n - 1 - 2 + 1):
-      q = r - 2
-      for p in range(0, q - 2 + 1):
-        g = math.gcd(nums[p], nums[q])
-        count[nums[p] // g][nums[q] // g] += 1
-      for s in range(r + 2, n):
-        g = math.gcd(nums[s], nums[r])
-        ans += count[nums[s] // g][nums[r] // g]
-
-    return ans
diff --git a/solutions/3405. Count the Number of Arrays with K Matching Adjacent Elements/3405.cpp b/solutions/3405. Count the Number of Arrays with K Matching Adjacent Elements/3405.cpp
deleted file mode 100644
index 8e97c497493..00000000000
--- a/solutions/3405. Count the Number of Arrays with K Matching Adjacent Elements/3405.cpp	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
- public:
-  int countGoodArrays(int n, int m, int k) {
-    const auto [fact, invFact] = getFactAndInvFact(n);
-    return m * modPow(m - 1, n - k - 1) % kMod * nCk(n - 1, k, fact, invFact) %
-           kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x % kMod, (n - 1)) % kMod;
-    return modPow(x * x % kMod, (n / 2)) % kMod;
-  }
-
-  pair<vector<long>, vector<long>> getFactAndInvFact(int n) {
-    vector<long> fact(n + 1);
-    vector<long> invFact(n + 1);
-    vector<long> inv(n + 1);
-    fact[0] = invFact[0] = 1;
-    inv[0] = inv[1] = 1;
-    for (int i = 1; i <= n; ++i) {
-      if (i >= 2)
-        inv[i] = kMod - kMod / i * inv[kMod % i] % kMod;
-      fact[i] = fact[i - 1] * i % kMod;
-      invFact[i] = invFact[i - 1] * inv[i] % kMod;
-    }
-    return {fact, invFact};
-  }
-
-  int nCk(int n, int k, const vector<long>& fact, const vector<long>& invFact) {
-    return fact[n] * invFact[k] % kMod * invFact[n - k] % kMod;
-  }
-};
diff --git a/solutions/3405. Count the Number of Arrays with K Matching Adjacent Elements/3405.java b/solutions/3405. Count the Number of Arrays with K Matching Adjacent Elements/3405.java
deleted file mode 100644
index 933cc1a4886..00000000000
--- a/solutions/3405. Count the Number of Arrays with K Matching Adjacent Elements/3405.java	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution {
-  public int countGoodArrays(int n, int m, int k) {
-    final long[][] factAndInvFact = getFactAndInvFact(n);
-    final long[] fact = factAndInvFact[0];
-    final long[] invFact = factAndInvFact[1];
-    return (int) (m * modPow(m - 1, n - k - 1) % MOD * nCk(n - 1, k, fact, invFact) % MOD);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  private long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2);
-  }
-
-  private long[][] getFactAndInvFact(int n) {
-    long[] fact = new long[n + 1];
-    long[] invFact = new long[n + 1];
-    long[] inv = new long[n + 1];
-    fact[0] = invFact[0] = 1;
-    inv[0] = inv[1] = 1;
-    for (int i = 1; i <= n; ++i) {
-      if (i >= 2)
-        inv[i] = MOD - MOD / i * inv[MOD % i] % MOD;
-      fact[i] = fact[i - 1] * i % MOD;
-      invFact[i] = invFact[i - 1] * inv[i] % MOD;
-    }
-    return new long[][] {fact, invFact};
-  }
-
-  private int nCk(int n, int k, long[] fact, long[] invFact) {
-    return (int) (fact[n] * invFact[k] % MOD * invFact[n - k] % MOD);
-  }
-}
diff --git a/solutions/3405. Count the Number of Arrays with K Matching Adjacent Elements/3405.py b/solutions/3405. Count the Number of Arrays with K Matching Adjacent Elements/3405.py
deleted file mode 100644
index 12cd8246941..00000000000
--- a/solutions/3405. Count the Number of Arrays with K Matching Adjacent Elements/3405.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def countGoodArrays(self, n: int, m: int, k: int) -> int:
-    MOD = 1_000_000_007
-    return m * pow(m - 1, n - k - 1, MOD) * math.comb(n - 1, k) % MOD
diff --git a/solutions/3406. Find the Lexicographically Largest String From the Box II/3406.cpp b/solutions/3406. Find the Lexicographically Largest String From the Box II/3406.cpp
deleted file mode 100644
index fadc711710a..00000000000
--- a/solutions/3406. Find the Lexicographically Largest String From the Box II/3406.cpp	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
- public:
-  string answerString(string word, int numFriends) {
-    if (numFriends == 1)
-      return word;
-    const string s = lastSubstring(word);
-    const size_t sz = word.length() - numFriends + 1;
-    return s.substr(0, min(s.length(), sz));
-  }
-
- private:
-  // Same as 1163. Last Substring in Lexicographical Order
-  string lastSubstring(string s) {
-    int i = 0;
-    int j = 1;
-    int k = 0;
-
-    while (j + k < s.length())
-      if (s[i + k] == s[j + k]) {
-        ++k;
-      } else if (s[i + k] > s[j + k]) {
-        // Skip s[j..j + k) and advance to s[j + k + 1] to find a possible
-        // lexicographically larger substring since s[i..i + k) == s[j..j + k)
-        // and s[i + k] > s[j + k).
-        j = j + k + 1;
-        k = 0;
-      } else {
-        // Skip s[i..i + k) and advance to s[i + k + 1] or s[j] to find a
-        // possible lexicographically larger substring since
-        // s[i..i + k) == s[j..j + k) and s[i + k] < s[j + k).
-        // Note that it's unnecessary to explore s[i + k + 1..j) if
-        // i + k + 1 < j since they are already explored by j.
-        i = max(i + k + 1, j);
-        j = i + 1;
-        k = 0;
-      }
-
-    return s.substr(i);
-  }
-};
diff --git a/solutions/3406. Find the Lexicographically Largest String From the Box II/3406.java b/solutions/3406. Find the Lexicographically Largest String From the Box II/3406.java
deleted file mode 100644
index 89d99bdef05..00000000000
--- a/solutions/3406. Find the Lexicographically Largest String From the Box II/3406.java	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
-  public String answerString(String word, int numFriends) {
-    if (numFriends == 1)
-      return word;
-    final String s = lastSubstring(word);
-    final int sz = word.length() - numFriends + 1;
-    return s.substring(0, Math.min(s.length(), sz));
-  }
-
-  // Same as 1163. Last Substring in Lexicographical Order
-  private String lastSubstring(String s) {
-    int i = 0;
-    int j = 1;
-    int k = 0; // the number of the same letters of s[i..n) and s[j..n)
-
-    while (j + k < s.length())
-      if (s.charAt(i + k) == s.charAt(j + k)) {
-        ++k;
-      } else if (s.charAt(i + k) > s.charAt(j + k)) {
-        // Skip s[j..j + k) and advance to s[j + k + 1] to find a possible
-        // lexicographically larger substring since s[i..i + k) == s[j..j + k)
-        // and s[i + k] > s[j + k).
-        j = j + k + 1;
-        k = 0;
-      } else {
-        // Skip s[i..i + k) and advance to s[i + k + 1] or s[j] to find a
-        // possible lexicographically larger substring since
-        // s[i..i + k) == s[j..j + k) and s[i + k] < s[j + k).
-        // Note that it's unnecessary to explore s[i + k + 1..j) if
-        // i + k + 1 < j since they are already explored by j.
-        i = Math.max(i + k + 1, j);
-        j = i + 1;
-        k = 0;
-      }
-
-    return s.substring(i);
-  }
-}
diff --git a/solutions/3406. Find the Lexicographically Largest String From the Box II/3406.py b/solutions/3406. Find the Lexicographically Largest String From the Box II/3406.py
deleted file mode 100644
index 7c8dbf4976c..00000000000
--- a/solutions/3406. Find the Lexicographically Largest String From the Box II/3406.py	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution:
-  def answerString(self, word: str, numFriends: int) -> str:
-    if numFriends == 1:
-      return word
-    s = self._lastSubstring(word)
-    sz = len(word) - numFriends + 1
-    return s[:min(len(s), sz)]
-
-  # Same as 1163. Last Substring in Lexicographical Order
-  def _lastSubstring(self, s: str) -> str:
-    i = 0
-    j = 1
-    k = 0  # the number of the same letters of s[i..n) and s[j..n)
-
-    while j + k < len(s):
-      if s[i + k] == s[j + k]:
-        k += 1
-      elif s[i + k] > s[j + k]:
-        # Skip s[j..j + k) and advance to s[j + k + 1] to find a possible
-        # lexicographically larger substring since s[i..i + k) == s[j..j + k)
-        # and s[i + k] > s[j + k).
-        j = j + k + 1
-        k = 0
-      else:
-        # Skip s[i..i + k) and advance to s[i + k + 1] or s[j] to find a
-        # possible lexicographically larger substring since
-        # s[i..i + k) == s[j..j + k) and s[i + k] < s[j + k).
-        # Note that it's unnecessary to explore s[i + k + 1..j) if
-        # i + k + 1 < j since they are already explored by j.
-        i = max(i + k + 1, j)
-        j = i + 1
-        k = 0
-
-    return s[i:]
diff --git a/solutions/3407. Substring Matching Pattern/3407.cpp b/solutions/3407. Substring Matching Pattern/3407.cpp
deleted file mode 100644
index 73041dde975..00000000000
--- a/solutions/3407. Substring Matching Pattern/3407.cpp	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution {
- public:
-  bool hasMatch(const string& s, const string& p) {
-    const int starPos = p.find('*');
-    const string prefix = p.substr(0, starPos);
-    const string suffix = p.substr(starPos + 1);
-    const int i = s.find(prefix);
-    return i != string::npos &&
-           s.find(suffix, i + prefix.size()) != string::npos;
-  }
-};
diff --git a/solutions/3407. Substring Matching Pattern/3407.java b/solutions/3407. Substring Matching Pattern/3407.java
deleted file mode 100644
index 4d562b24b37..00000000000
--- a/solutions/3407. Substring Matching Pattern/3407.java	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution {
-  public boolean hasMatch(String s, String p) {
-    final int starPos = p.indexOf('*');
-    final String prefix = p.substring(0, starPos);
-    final String suffix = p.substring(starPos + 1);
-    final int i = s.indexOf(prefix);
-    return i != -1 && s.indexOf(suffix, i + prefix.length()) != -1;
-  }
-}
diff --git a/solutions/3407. Substring Matching Pattern/3407.py b/solutions/3407. Substring Matching Pattern/3407.py
deleted file mode 100644
index 5f2758ac448..00000000000
--- a/solutions/3407. Substring Matching Pattern/3407.py	
+++ /dev/null
@@ -1,5 +0,0 @@
-class Solution:
-  def hasMatch(self, s: str, p: str) -> bool:
-    prefix, suffix = p.split('*')
-    i = s.find(prefix)
-    return i != -1 and s.find(suffix, i + len(prefix)) != -1
diff --git a/solutions/3408. Design Task Manager/3408.cpp b/solutions/3408. Design Task Manager/3408.cpp
deleted file mode 100644
index 2b616122c11..00000000000
--- a/solutions/3408. Design Task Manager/3408.cpp	
+++ /dev/null
@@ -1,53 +0,0 @@
-struct Task {
-  int userId;
-  int taskId;
-  int priority;
-
-  Task() = default;
-  Task(int u, int t, int p) : userId(u), taskId(t), priority(p) {}
-
-  bool operator<(const Task& other) const {
-    return priority == other.priority ? taskId > other.taskId
-                                      : priority > other.priority;
-  }
-};
-
-class TaskManager {
- public:
-  unordered_map<int, Task> taskMap;  // {taskId: Task}
-  set<Task> taskSet;  // Stores tasks sorted by priority and taskId.
-
-  TaskManager(vector<vector<int>>& tasks) {
-    for (const auto& task : tasks)
-      add(task[0], task[1], task[2]);
-  }
-
-  void add(int userId, int taskId, int priority) {
-    const Task task(userId, taskId, priority);
-    taskMap[taskId] = task;
-    taskSet.insert(task);
-  }
-
-  void edit(int taskId, int newPriority) {
-    const Task task = taskMap[taskId];
-    taskSet.erase(task);
-    const Task editedTask = Task(task.userId, task.taskId, newPriority);
-    taskSet.insert(editedTask);
-    taskMap[taskId] = editedTask;
-  }
-
-  void rmv(int taskId) {
-    const Task task = taskMap[taskId];
-    taskSet.erase(task);
-    taskMap.erase(taskId);
-  }
-
-  int execTop() {
-    if (taskSet.empty())
-      return -1;
-    const Task task = *taskSet.begin();
-    taskSet.erase(task);
-    taskMap.erase(task.taskId);
-    return task.userId;
-  }
-};
diff --git a/solutions/3408. Design Task Manager/3408.java b/solutions/3408. Design Task Manager/3408.java
deleted file mode 100644
index e503bfb6a8f..00000000000
--- a/solutions/3408. Design Task Manager/3408.java	
+++ /dev/null
@@ -1,61 +0,0 @@
-class Task implements Comparable<Task> {
-  public int userId;
-  public int taskId;
-  public int priority;
-
-  public Task() {}
-
-  public Task(int userId, int taskId, int priority) {
-    this.userId = userId;
-    this.taskId = taskId;
-    this.priority = priority;
-  }
-
-  @Override
-  public int compareTo(Task other) {
-    return this.priority == other.priority ? Integer.compare(other.taskId, this.taskId)
-                                           : Integer.compare(other.priority, this.priority);
-  }
-}
-
-class TaskManager {
-
-  public TaskManager(List<List<Integer>> tasks) {
-    taskMap = new HashMap<>();
-    taskSet = new TreeSet<>();
-    for (List<Integer> task : tasks)
-      add(task.get(0), task.get(1), task.get(2));
-  }
-
-  public void add(int userId, int taskId, int priority) {
-    Task task = new Task(userId, taskId, priority);
-    taskMap.put(taskId, task);
-    taskSet.add(task);
-  }
-
-  public void edit(int taskId, int newPriority) {
-    Task task = taskMap.get(taskId);
-    taskSet.remove(task);
-    Task editedTask = new Task(task.userId, taskId, newPriority);
-    taskSet.add(editedTask);
-    taskMap.put(taskId, editedTask);
-  }
-
-  public void rmv(int taskId) {
-    Task task = taskMap.get(taskId);
-    taskSet.remove(task);
-    taskMap.remove(taskId);
-  }
-
-  public int execTop() {
-    if (taskSet.isEmpty())
-      return -1;
-    Task task = taskSet.iterator().next();
-    taskSet.remove(task);
-    taskMap.remove(task.taskId);
-    return task.userId;
-  }
-
-  private Map<Integer, Task> taskMap = new HashMap<>(); // {taskId: Task}
-  private Set<Task> taskSet; // Stores tasks sorted by priority and taskId.
-}
diff --git a/solutions/3408. Design Task Manager/3408.py b/solutions/3408. Design Task Manager/3408.py
deleted file mode 100644
index 94ed5b47776..00000000000
--- a/solutions/3408. Design Task Manager/3408.py	
+++ /dev/null
@@ -1,46 +0,0 @@
-from dataclasses import dataclass
-from sortedcontainers import SortedDict, SortedSet
-
-
-@dataclass(frozen=True)
-class Task:
-  userId: int
-  taskId: int
-  priority: int
-
-  def __lt__(self, other):
-    if self.priority == other.priority:
-      return self.taskId > other.taskId
-    return self.priority > other.priority
-
-
-class TaskManager:
-  def __init__(self, tasks: list[list[int]]):
-    self.taskMap = SortedDict()  # {taskId: Task}, keeps tasks sorted by taskId
-    self.taskSet = SortedSet()  # Stores tasks sorted by priority and taskId
-    for task in tasks:
-      self.add(task[0], task[1], task[2])
-
-  def add(self, userId: int, taskId: int, priority: int) -> None:
-    task = Task(userId, taskId, priority)
-    self.taskMap[taskId] = task
-    self.taskSet.add(task)
-
-  def edit(self, taskId: int, newPriority: int) -> None:
-    task = self.taskMap[taskId]
-    self.taskSet.remove(task)
-    editedTask = Task(task.userId, taskId, newPriority)
-    self.taskSet.add(editedTask)
-    self.taskMap[taskId] = editedTask
-
-  def rmv(self, taskId: int) -> None:
-    task = self.taskMap[taskId]
-    self.taskSet.remove(task)
-    del self.taskMap[taskId]
-
-  def execTop(self):
-    if not self.taskSet:
-      return -1
-    task = self.taskSet.pop(0)
-    del self.taskMap[task.taskId]
-    return task.userId
diff --git a/solutions/3409. Longest Subsequence With Decreasing Adjacent Difference/3409.cpp b/solutions/3409. Longest Subsequence With Decreasing Adjacent Difference/3409.cpp
deleted file mode 100644
index 49a04bbd314..00000000000
--- a/solutions/3409. Longest Subsequence With Decreasing Adjacent Difference/3409.cpp	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
- public:
-  int longestSubsequence(vector<int>& nums) {
-    const int mx = ranges::max(nums);
-    // dp[num][diff] := the length of the longest subsequence ending in `num`
-    // s.t. the last absolute difference between consecutive elements is `diff`
-    vector<vector<int>> dp(mx + 1, vector<int>(mx + 1));
-
-    for (const int num : nums) {
-      for (int prev = 1; prev <= mx; ++prev) {
-        const int diff = abs(num - prev);
-        dp[num][diff] = max(dp[num][diff], dp[prev][diff] + 1);
-      }
-      // dp[num][diff] := max(dp[num][j]), where j >= diff
-      for (int j = mx - 1; j >= 0; --j)
-        dp[num][j] = max(dp[num][j], dp[num][j + 1]);
-    }
-
-    return ranges::max_element(dp, ranges::less{}, [](const vector<int>& row) {
-      return row[0];
-    })->at(0);
-  }
-};
diff --git a/solutions/3409. Longest Subsequence With Decreasing Adjacent Difference/3409.java b/solutions/3409. Longest Subsequence With Decreasing Adjacent Difference/3409.java
deleted file mode 100644
index 34568ea1509..00000000000
--- a/solutions/3409. Longest Subsequence With Decreasing Adjacent Difference/3409.java	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
-  public int longestSubsequence(int[] nums) {
-    final int mx = Arrays.stream(nums).max().getAsInt();
-    // dp[num][diff] := the length of the longest subsequence ending in `num`
-    // s.t. the last absolute difference between consecutive elements is `diff`
-    int[][] dp = new int[mx + 1][mx + 1];
-
-    for (final int num : nums) {
-      for (int prev = 1; prev <= mx; ++prev) {
-        final int diff = Math.abs(num - prev);
-        dp[num][diff] = Math.max(dp[num][diff], dp[prev][diff] + 1);
-      }
-      // dp[num][diff] := max(dp[num][j]), where j >= diff
-      for (int j = mx - 1; j >= 0; --j)
-        dp[num][j] = Math.max(dp[num][j], dp[num][j + 1]);
-    }
-
-    return Arrays.stream(dp).mapToInt(row -> row[0]).max().getAsInt();
-  }
-}
diff --git a/solutions/3409. Longest Subsequence With Decreasing Adjacent Difference/3409.py b/solutions/3409. Longest Subsequence With Decreasing Adjacent Difference/3409.py
deleted file mode 100644
index 9bac533934e..00000000000
--- a/solutions/3409. Longest Subsequence With Decreasing Adjacent Difference/3409.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  def longestSubsequence(self, nums: list[int]) -> int:
-    mx = max(nums)
-    # dp[num][diff] := the length of the longest subsequence ending in `num`
-    # s.t. the last absolute difference between consecutive elements is `diff`
-    dp = [[0] * (mx + 1) for _ in range(mx + 1)]
-
-    for num in nums:
-      for prev in range(1, mx + 1):
-        diff = abs(num - prev)
-        dp[num][diff] = max(dp[num][diff], dp[prev][diff] + 1)
-      # dp[num][diff] := max(dp[num][j]) for j >= diff
-      for j in range(mx - 1, -1, -1):
-        dp[num][j] = max(dp[num][j], dp[num][j + 1])
-
-    return max(map(max, dp))
diff --git a/solutions/341. Flatten Nested List Iterator/341-2.py b/solutions/341. Flatten Nested List Iterator/341-2.py
index 0a669f7d5bd..27be91d25f4 100644
--- a/solutions/341. Flatten Nested List Iterator/341-2.py	
+++ b/solutions/341. Flatten Nested List Iterator/341-2.py	
@@ -1,6 +1,6 @@
 class NestedIterator:
-  def __init__(self, nestedList: list[NestedInteger]):
-    self.stack: list[NestedInteger] = []
+  def __init__(self, nestedList: List[NestedInteger]):
+    self.stack: List[NestedInteger] = []
     self.addInteger(nestedList)
 
   def next(self) -> int:
@@ -14,6 +14,6 @@ def hasNext(self) -> bool:
   # addInteger([1, [4, [6]]]) . stack = [[4, [6]], 1]
   # addInteger([4, [6]]) . stack = [[6], 4]
   # addInteger([6]) . stack = [6]
-  def addInteger(self, nestedList: list[NestedInteger]) -> None:
+  def addInteger(self, nestedList: List[NestedInteger]) -> None:
     for n in reversed(nestedList):
       self.stack.append(n)
diff --git a/solutions/341. Flatten Nested List Iterator/341.py b/solutions/341. Flatten Nested List Iterator/341.py
index abaeecc1983..34070b2204c 100644
--- a/solutions/341. Flatten Nested List Iterator/341.py	
+++ b/solutions/341. Flatten Nested List Iterator/341.py	
@@ -1,5 +1,5 @@
 class NestedIterator:
-  def __init__(self, nestedList: list[NestedInteger]):
+  def __init__(self, nestedList: List[NestedInteger]):
     self.q = collections.deque()
     self.addInteger(nestedList)
 
@@ -9,7 +9,7 @@ def next(self) -> int:
   def hasNext(self) -> bool:
     return self.q
 
-  def addInteger(self, nestedList: list[NestedInteger]) -> None:
+  def addInteger(self, nestedList: List[NestedInteger]) -> None:
     for ni in nestedList:
       if ni.isInteger():
         self.q.append(ni.getInteger())
diff --git a/solutions/3410. Maximize Subarray Sum After Removing All Occurrences of One Element/3410-2.cpp b/solutions/3410. Maximize Subarray Sum After Removing All Occurrences of One Element/3410-2.cpp
deleted file mode 100644
index 2a4ec17c50e..00000000000
--- a/solutions/3410. Maximize Subarray Sum After Removing All Occurrences of One Element/3410-2.cpp	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
- public:
-  long long maxSubarraySum(vector<int>& nums) {
-    long ans = ranges::max(nums);
-    long prefix = 0;
-    long minPrefix = 0;
-    // the minimum prefix sum that can have a negative number removed
-    long modifiedMinPrefix = 0;
-    unordered_map<int, int> count;
-    // minPrefixPlusRemoval[num] := the minimum prefix sum plus removed `num`
-    unordered_map<int, long> minPrefixPlusRemoval;
-
-    for (const int num : nums) {
-      prefix += num;
-      ans = max(ans, prefix - modifiedMinPrefix);
-      if (num < 0) {
-        ++count[num];
-        minPrefixPlusRemoval[num] =
-            min(minPrefixPlusRemoval[num], minPrefix) + num;
-        modifiedMinPrefix =
-            min({modifiedMinPrefix, count[num] * static_cast<long>(num),
-                 minPrefixPlusRemoval[num]});
-      }
-      minPrefix = min(minPrefix, prefix);
-      modifiedMinPrefix = min(modifiedMinPrefix, minPrefix);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3410. Maximize Subarray Sum After Removing All Occurrences of One Element/3410-2.java b/solutions/3410. Maximize Subarray Sum After Removing All Occurrences of One Element/3410-2.java
deleted file mode 100644
index 25177d41fb5..00000000000
--- a/solutions/3410. Maximize Subarray Sum After Removing All Occurrences of One Element/3410-2.java	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
-  public long maxSubarraySum(int[] nums) {
-    long ans = Arrays.stream(nums).max().getAsInt();
-    long prefix = 0;
-    long minPrefix = 0;
-    // the minimum prefix sum that can have a negative number removed
-    long modifiedMinPrefix = 0;
-    Map<Integer, Integer> count = new HashMap<>();
-    // minPrefixPlusRemoval[num] := the minimum prefix sum plus removed `num`
-    Map<Integer, Long> minPrefixPlusRemoval = new HashMap<>();
-
-    for (int num : nums) {
-      prefix += num;
-      ans = Math.max(ans, prefix - modifiedMinPrefix);
-      if (num < 0) {
-        count.merge(num, 1, Integer::sum);
-        minPrefixPlusRemoval.put(
-            num, Math.min(minPrefixPlusRemoval.getOrDefault(num, 0L), minPrefix) + num);
-        modifiedMinPrefix = Math.min(modifiedMinPrefix,
-                                     Math.min(count.get(num) * num, minPrefixPlusRemoval.get(num)));
-      }
-      minPrefix = Math.min(minPrefix, prefix);
-      modifiedMinPrefix = Math.min(modifiedMinPrefix, minPrefix);
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3410. Maximize Subarray Sum After Removing All Occurrences of One Element/3410-2.py b/solutions/3410. Maximize Subarray Sum After Removing All Occurrences of One Element/3410-2.py
deleted file mode 100644
index b085201ab3a..00000000000
--- a/solutions/3410. Maximize Subarray Sum After Removing All Occurrences of One Element/3410-2.py	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution:
-  def maxSubarraySum(self, nums: list[int]) -> int:
-    ans = max(nums)
-    prefix = 0
-    minPrefix = 0
-    # the minimum prefix sum that can have a negative number removed
-    modifiedMinPrefix = 0
-    count = collections.Counter()
-    # minPrefixPlusRemoval[num] := the minimum prefix sum plus removed `num`
-    minPrefixPlusRemoval = {}
-
-    for num in nums:
-      prefix += num
-      ans = max(ans, prefix - modifiedMinPrefix)
-      if num < 0:
-        count[num] += 1
-        minPrefixPlusRemoval[num] = (
-            min(minPrefixPlusRemoval.get(num, 0), minPrefix) + num)
-        modifiedMinPrefix = min(modifiedMinPrefix,
-                                count[num] * num,
-                                minPrefixPlusRemoval[num])
-      minPrefix = min(minPrefix, prefix)
-      modifiedMinPrefix = min(modifiedMinPrefix, minPrefix)
-
-    return ans
diff --git a/solutions/3410. Maximize Subarray Sum After Removing All Occurrences of One Element/3410.cpp b/solutions/3410. Maximize Subarray Sum After Removing All Occurrences of One Element/3410.cpp
deleted file mode 100644
index 606a5abb630..00000000000
--- a/solutions/3410. Maximize Subarray Sum After Removing All Occurrences of One Element/3410.cpp	
+++ /dev/null
@@ -1,102 +0,0 @@
-// Same as 53. Maximum Subarray
-struct T {
-  long sum;
-  long maxSubarraySumPrefix;
-  long maxSubarraySumSuffix;
-  long maxSubarraySum;
-  T() = default;
-  T(int num)
-      : sum(num),
-        maxSubarraySumPrefix(num),
-        maxSubarraySumSuffix(num),
-        maxSubarraySum(num) {}
-  T(long sum, long prefix, long suffix, long maxSum)
-      : sum(sum),
-        maxSubarraySumPrefix(prefix),
-        maxSubarraySumSuffix(suffix),
-        maxSubarraySum(maxSum) {}
-};
-
-class SegmentTree {
- public:
-  SegmentTree(const vector<int>& nums) : n(nums.size()), tree(nums.size() * 4) {
-    build(nums, 0, 0, n - 1);
-  }
-
-  // Updates nums[i] to val.
-  void update(int i, int val) {
-    update(0, 0, n - 1, i, val);
-  }
-
-  long getMaxSubarraySum() const {
-    return tree[0].maxSubarraySum;
-  }
-
- private:
-  const int n;     // the size of the input array
-  vector<T> tree;  // the segment tree
-
-  void build(const vector<int>& nums, int treeIndex, int lo, int hi) {
-    if (lo == hi) {
-      tree[treeIndex] = T(nums[lo]);
-      return;
-    }
-    const int mid = (lo + hi) / 2;
-    build(nums, 2 * treeIndex + 1, lo, mid);
-    build(nums, 2 * treeIndex + 2, mid + 1, hi);
-    tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
-  }
-
-  void update(int treeIndex, int lo, int hi, int i, int val) {
-    if (lo == hi) {
-      tree[treeIndex] = T(val);
-      return;
-    }
-    const int mid = (lo + hi) / 2;
-    if (i <= mid)
-      update(2 * treeIndex + 1, lo, mid, i, val);
-    else
-      update(2 * treeIndex + 2, mid + 1, hi, i, val);
-    tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
-  }
-
-  T merge(const T& left, const T& right) const {
-    return T(
-        left.sum + right.sum,
-        max(left.maxSubarraySumPrefix, left.sum + right.maxSubarraySumPrefix),
-        max(right.maxSubarraySumSuffix, right.sum + left.maxSubarraySumSuffix),
-        max({left.maxSubarraySum, right.maxSubarraySum,
-             left.maxSubarraySumSuffix + right.maxSubarraySumPrefix}));
-  }
-};
-
-class Solution {
- public:
-  long long maxSubarraySum(vector<int>& nums) {
-    const bool allPositives =
-        ranges::all_of(nums, [](int num) { return num >= 0; });
-    const long sum = accumulate(nums.begin(), nums.end(), 0L);
-    if (allPositives)
-      return sum;
-    const int maxNum = ranges::max(nums);
-    if (maxNum < 0)
-      return maxNum;
-
-    long ans = LONG_MIN;
-    unordered_map<int, vector<int>> numToIndices;
-    SegmentTree tree(nums);
-
-    for (int i = 0; i < nums.size(); ++i)
-      numToIndices[nums[i]].push_back(i);
-
-    for (const auto& [num, indices] : numToIndices) {
-      for (const int index : indices)
-        tree.update(index, 0);
-      ans = max(ans, tree.getMaxSubarraySum());
-      for (const int index : indices)
-        tree.update(index, num);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3411. Maximum Subarray With Equal Products/3411.cpp b/solutions/3411. Maximum Subarray With Equal Products/3411.cpp
deleted file mode 100644
index 0cc30de6f2c..00000000000
--- a/solutions/3411. Maximum Subarray With Equal Products/3411.cpp	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
- public:
-  int maxLength(const vector<int>& nums) {
-    constexpr int kMaxLcm = 36'288'000;  // 10! x 10
-    const int n = nums.size();
-    int ans = 0;
-
-    for (int i = 0; i < n; ++i) {
-      int prod = 1;
-      int l = 1;
-      int g = 0;
-      for (int j = i; j < n; ++j) {
-        prod *= nums[j];
-        if (prod > kMaxLcm)
-          break;
-        l = lcm(l, nums[j]);
-        g = gcd(g, nums[j]);
-        if (prod == l * g)
-          ans = max(ans, j - i + 1);
-      }
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3411. Maximum Subarray With Equal Products/3411.java b/solutions/3411. Maximum Subarray With Equal Products/3411.java
deleted file mode 100644
index 635430b9e3f..00000000000
--- a/solutions/3411. Maximum Subarray With Equal Products/3411.java	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution {
-  public int maxLength(int[] nums) {
-    final int MAX_LCM = 36_288_000; // 10! x 10
-    final int n = nums.length;
-    int ans = 0;
-
-    for (int i = 0; i < n; ++i) {
-      int prod = 1;
-      int l = 1;
-      int g = 0;
-      for (int j = i; j < n; ++j) {
-        prod *= nums[j];
-        if (prod > MAX_LCM)
-          break;
-        l = lcm(l, nums[j]);
-        g = gcd(g, nums[j]);
-        if (prod == l * g)
-          ans = Math.max(ans, j - i + 1);
-      }
-    }
-
-    return ans;
-  }
-
-  private int gcd(int a, int b) {
-    return b == 0 ? a : gcd(b, a % b);
-  }
-
-  private int lcm(int a, int b) {
-    return a * (b / gcd(a, b));
-  }
-}
diff --git a/solutions/3411. Maximum Subarray With Equal Products/3411.py b/solutions/3411. Maximum Subarray With Equal Products/3411.py
deleted file mode 100644
index 1dd60f0f158..00000000000
--- a/solutions/3411. Maximum Subarray With Equal Products/3411.py	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution:
-  def maxLength(self, nums: list[int]) -> int:
-    n = len(nums)
-    ans = 0
-
-    for i in range(n):
-      prod = 1
-      l = 1
-      g = 0
-      for j in range(i, n):
-        prod *= nums[j]
-        l = math.lcm(l, nums[j])
-        g = math.gcd(g, nums[j])
-        if prod == l * g:
-          ans = max(ans, j - i + 1)
-
-    return ans
diff --git a/solutions/3412. Find Mirror Score of a String/3412.cpp b/solutions/3412. Find Mirror Score of a String/3412.cpp
deleted file mode 100644
index a383926b3d3..00000000000
--- a/solutions/3412. Find Mirror Score of a String/3412.cpp	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
- public:
-  long long calculateScore(string s) {
-    long ans = 0;
-    vector<stack<int>> indices(26);
-
-    for (int i = 0; i < s.length(); ++i) {
-      const int index = s[i] - 'a';
-      const int oppositeIndex = 25 - index;
-      if (!indices[oppositeIndex].empty())
-        ans += i - indices[oppositeIndex].top(), indices[oppositeIndex].pop();
-      else
-        indices[index].push(i);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3412. Find Mirror Score of a String/3412.java b/solutions/3412. Find Mirror Score of a String/3412.java
deleted file mode 100644
index 5ee9abd7fe7..00000000000
--- a/solutions/3412. Find Mirror Score of a String/3412.java	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
-  public long calculateScore(String s) {
-    long ans = 0;
-    Deque<Integer>[] indices = new ArrayDeque[26];
-
-    for (int i = 0; i < 26; ++i)
-      indices[i] = new ArrayDeque<>();
-
-    for (int i = 0; i < s.length(); ++i) {
-      final int index = s.charAt(i) - 'a';
-      final int oppositeIndex = 25 - index;
-      if (!indices[oppositeIndex].isEmpty())
-        ans += i - indices[oppositeIndex].poll();
-      else
-        indices[index].push(i);
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3412. Find Mirror Score of a String/3412.py b/solutions/3412. Find Mirror Score of a String/3412.py
deleted file mode 100644
index 2f40d655ac3..00000000000
--- a/solutions/3412. Find Mirror Score of a String/3412.py	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution:
-  def calculateScore(self, s: str) -> int:
-    ans = 0
-    indices = [[] for _ in range(26)]
-
-    for i, c in enumerate(s):
-      index = ord(c) - ord('a')
-      oppositeIndex = 25 - index
-      if indices[oppositeIndex]:
-        ans += i - indices[oppositeIndex].pop()
-      else:
-        indices[index].append(i)
-
-    return ans
diff --git a/solutions/3413. Maximum Coins From K Consecutive Bags/3413.cpp b/solutions/3413. Maximum Coins From K Consecutive Bags/3413.cpp
deleted file mode 100644
index 29334bde627..00000000000
--- a/solutions/3413. Maximum Coins From K Consecutive Bags/3413.cpp	
+++ /dev/null
@@ -1,57 +0,0 @@
-class Solution {
- public:
-  long long maximumCoins(vector<vector<int>>& coins, int k) {
-    vector<vector<int>> negatedCoins = negateLeftRight(coins);
-    return max(slide(coins, k), slide(negatedCoins, k));
-  }
-
- private:
-  vector<vector<int>> negateLeftRight(const vector<vector<int>> coins) {
-    vector<vector<int>> res;
-    for (const vector<int>& coin : coins) {
-      const int l = coin[0];
-      const int r = coin[1];
-      const int c = coin[2];
-      res.push_back({-r, -l, c});
-    }
-    return res;
-  }
-
-  long slide(vector<vector<int>>& coins, int k) {
-    long res = 0;
-    long windowSum = 0;
-    int j = 0;
-
-    ranges::sort(coins);
-
-    for (const vector<int>& coin : coins) {
-      const int li = coin[0];
-      const int ri = coin[1];
-      const int ci = coin[2];
-      const int rightBoundary = li + k;
-
-      // [lj, rj] is fully in [li..li + k)
-      while (j + 1 < coins.size() && coins[j + 1][0] < rightBoundary) {
-        const int lj = coins[j][0];
-        const int rj = coins[j][1];
-        const int cj = coins[j][2];
-        windowSum += static_cast<long>(rj - lj + 1) * cj;
-        ++j;
-      }
-
-      // [lj, rj] may be partially in [l..l + k)
-      long last = 0;
-      if (j < coins.size() && coins[j][0] < rightBoundary) {
-        const int lj = coins[j][0];
-        const int rj = coins[j][1];
-        const int cj = coins[j][2];
-        last = static_cast<long>(min(rightBoundary - 1, rj) - lj + 1) * cj;
-      }
-
-      res = max(res, windowSum + last);
-      windowSum -= static_cast<long>(ri - li + 1) * ci;
-    }
-
-    return res;
-  }
-};
diff --git a/solutions/3413. Maximum Coins From K Consecutive Bags/3413.java b/solutions/3413. Maximum Coins From K Consecutive Bags/3413.java
deleted file mode 100644
index 3cc0b222cf5..00000000000
--- a/solutions/3413. Maximum Coins From K Consecutive Bags/3413.java	
+++ /dev/null
@@ -1,57 +0,0 @@
-class Solution {
-  public long maximumCoins(int[][] coins, int k) {
-    int[][] negatedCoins = negateLeftRight(coins);
-    return Math.max(slide(coins, k), slide(negatedCoins, k));
-  }
-
-  private int[][] negateLeftRight(int[][] coins) {
-    int[][] res = new int[coins.length][3];
-    for (int i = 0; i < coins.length; ++i) {
-      final int l = coins[i][0];
-      final int r = coins[i][1];
-      final int c = coins[i][2];
-      res[i][0] = -r;
-      res[i][1] = -l;
-      res[i][2] = c;
-    }
-    return res;
-  }
-
-  private long slide(int[][] coins, int k) {
-    long res = 0;
-    long windowSum = 0;
-    int j = 0;
-
-    Arrays.sort(coins, Comparator.comparingInt((int[] coin) -> coin[0]));
-
-    for (int[] coin : coins) {
-      final int li = coin[0];
-      final int ri = coin[1];
-      final int ci = coin[2];
-      final int rightBoundary = li + k;
-
-      // [lj, rj] is fully in [li..li + k).
-      while (j + 1 < coins.length && coins[j + 1][0] < rightBoundary) {
-        final int lj = coins[j][0];
-        final int rj = coins[j][1];
-        final int cj = coins[j][2];
-        windowSum += (long) (rj - lj + 1) * cj;
-        ++j;
-      }
-
-      // [lj, rj] may be partially in [l..l + k).
-      long last = 0;
-      if (j < coins.length && coins[j][0] < rightBoundary) {
-        final int lj = coins[j][0];
-        final int rj = coins[j][1];
-        final int cj = coins[j][2];
-        last = (long) (Math.min(rightBoundary - 1, rj) - lj + 1) * cj;
-      }
-
-      res = Math.max(res, windowSum + last);
-      windowSum -= (long) (ri - li + 1) * ci;
-    }
-
-    return res;
-  }
-}
diff --git a/solutions/3413. Maximum Coins From K Consecutive Bags/3413.py b/solutions/3413. Maximum Coins From K Consecutive Bags/3413.py
deleted file mode 100644
index 2cf492c0a9c..00000000000
--- a/solutions/3413. Maximum Coins From K Consecutive Bags/3413.py	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution:
-  def maximumCoins(self, coins: list[list[int]], k: int) -> int:
-    return max(self._slide(coins, k),
-               self._slide([[-r, -l, c] for l, r, c in coins], k))
-
-  def _slide(self, coins: list[list[int]], k: int) -> int:
-    coins.sort()
-    res = 0
-    windowSum = 0
-    j = 0
-    for li, ri, ci in coins:  # Consider the number line [li..li + k).
-      rightBoundary = li + k
-
-      # [lj, rj] is fully in [li..li + k).
-      while j + 1 < len(coins) and coins[j + 1][0] < rightBoundary:
-        lj, rj, cj = coins[j]
-        windowSum += (rj - lj + 1) * cj
-        j += 1
-
-      # [lj, rj] may be partially in [l..l + k).
-      last = 0
-      if j < len(coins) and coins[j][0] < rightBoundary:
-        lj, rj, cj = coins[j]
-        last = (min(rightBoundary - 1, rj) - lj + 1) * cj
-
-      res = max(res, windowSum + last)
-      windowSum -= (ri - li + 1) * ci
-    return res
diff --git a/solutions/3414. Maximum Score of Non-overlapping Intervals/3414.cpp b/solutions/3414. Maximum Score of Non-overlapping Intervals/3414.cpp
deleted file mode 100644
index f7917e20443..00000000000
--- a/solutions/3414. Maximum Score of Non-overlapping Intervals/3414.cpp	
+++ /dev/null
@@ -1,58 +0,0 @@
-struct T {
-  long weight;
-  vector<int> selected;
-};
-
-class Solution {
- public:
-  vector<int> maximumWeight(vector<vector<int>>& input) {
-    vector<Interval> intervals;
-    for (int i = 0; i < input.size(); ++i)
-      intervals.emplace_back(input[i][0], input[i][1], input[i][2], i);
-    ranges::sort(intervals);
-    vector<vector<T>> memo(intervals.size(), vector<T>(5));
-    return dp(intervals, memo, 0, 4).selected;
-  }
-
- private:
-  using Interval = tuple<int, int, int, int>;
-
-  T dp(const vector<Interval>& intervals, vector<vector<T>>& memo, int i,
-       int quota) {
-    if (i == intervals.size() || quota == 0)
-      return T();
-    if (memo[i][quota].weight > 0)
-      return memo[i][quota];
-
-    T skip = dp(intervals, memo, i + 1, quota);
-
-    auto [_, r, weight, originalIndex] = intervals[i];
-    const int j = findFirstGreater(intervals, i + 1, r);
-    T nextRes = dp(intervals, memo, j, quota - 1);
-
-    vector<int> newSelected = nextRes.selected;
-    newSelected.push_back(originalIndex);
-    ranges::sort(newSelected);
-    T pick(static_cast<long>(weight) + nextRes.weight, newSelected);
-    return memo[i][quota] =
-               (pick.weight > skip.weight ||
-                pick.weight == skip.weight && pick.selected < skip.selected)
-                   ? pick
-                   : skip;
-  }
-
-  // Binary searches the first interval that starts after `rightBoundary`.
-  int findFirstGreater(const vector<Interval>& intervals, int startFrom,
-                       int rightBoundary) {
-    int l = startFrom;
-    int r = intervals.size();
-    while (l < r) {
-      const int m = (l + r) / 2;
-      if (get<0>(intervals[m]) > rightBoundary)
-        r = m;
-      else
-        l = m + 1;
-    }
-    return l;
-  }
-};
diff --git a/solutions/3414. Maximum Score of Non-overlapping Intervals/3414.java b/solutions/3414. Maximum Score of Non-overlapping Intervals/3414.java
deleted file mode 100644
index a063675d500..00000000000
--- a/solutions/3414. Maximum Score of Non-overlapping Intervals/3414.java	
+++ /dev/null
@@ -1,64 +0,0 @@
-class Solution {
-  public int[] maximumWeight(List<List<Integer>> intervals) {
-    // Convert input to Interval objects
-    List<Interval> indexedIntervals = new ArrayList<>();
-    for (int i = 0; i < intervals.size(); ++i) {
-      List<Integer> interval = intervals.get(i);
-      indexedIntervals.add(new Interval(interval.get(0), interval.get(1), interval.get(2), i));
-    }
-    indexedIntervals.sort(Comparator.comparingInt(Interval::left));
-    T[][] memo = new T[indexedIntervals.size()][5];
-    return dp(indexedIntervals, memo, 0, 4).selected.stream().mapToInt(Integer::intValue).toArray();
-  }
-
-  private record T(long weight, List<Integer> selected) {}
-  private record Interval(int left, int right, int weight, int originalIndex) {}
-
-  private T dp(List<Interval> intervals, T[][] memo, int i, int quota) {
-    if (i == intervals.size() || quota == 0)
-      return new T(0, List.of());
-    if (memo[i][quota] != null)
-      return memo[i][quota];
-
-    T skip = dp(intervals, memo, i + 1, quota);
-
-    Interval interval = intervals.get(i);
-    final int j = findFirstGreater(intervals, i + 1, interval.right);
-    T nextRes = dp(intervals, memo, j, quota - 1);
-
-    List<Integer> newSelected = new ArrayList<>(nextRes.selected);
-    newSelected.add(interval.originalIndex);
-    Collections.sort(newSelected);
-    T pick = new T(interval.weight + nextRes.weight, newSelected);
-    return memo[i][quota] =
-               (pick.weight > skip.weight ||
-                (pick.weight == skip.weight && compareLists(pick.selected, skip.selected) < 0))
-                   ? pick
-                   : skip;
-  }
-
-  // Binary searches the first interval that starts after `rightBoundary`.
-  private int findFirstGreater(List<Interval> intervals, int startFrom, int rightBoundary) {
-    int l = startFrom;
-    int r = intervals.size();
-    while (l < r) {
-      final int m = (l + r) / 2;
-      if (intervals.get(m).left > rightBoundary)
-        r = m;
-      else
-        l = m + 1;
-    }
-    return l;
-  }
-
-  // Compares two lists of integers lexicographically.
-  private int compareLists(List<Integer> list1, List<Integer> list2) {
-    final int minSize = Math.min(list1.size(), list2.size());
-    for (int i = 0; i < minSize; ++i) {
-      final int comparison = Integer.compare(list1.get(i), list2.get(i));
-      if (comparison != 0)
-        return comparison;
-    }
-    return Integer.compare(list1.size(), list2.size());
-  }
-}
diff --git a/solutions/3414. Maximum Score of Non-overlapping Intervals/3414.py b/solutions/3414. Maximum Score of Non-overlapping Intervals/3414.py
deleted file mode 100644
index 7983807d3a7..00000000000
--- a/solutions/3414. Maximum Score of Non-overlapping Intervals/3414.py	
+++ /dev/null
@@ -1,38 +0,0 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
-class T:
-  weight: int
-  selected: tuple[int]
-
-  def __iter__(self):
-    yield self.weight
-    yield self.selected
-
-
-class Solution:
-  def maximumWeight(self, intervals: list[list[int]]) -> list[int]:
-    intervals = sorted((*interval, i) for i, interval in enumerate(intervals))
-
-    @functools.lru_cache(None)
-    def dp(i: int, quota: int) -> T:
-      """
-      Returns the maximum weight and the selected intervals for intervals[i..n),
-      where `quota` is the number of intervals that can be selected.
-      """
-      if i == len(intervals) or quota == 0:
-        return T(0, ())
-
-      skip = dp(i + 1, quota)
-
-      _, r, weight, originalIndex = intervals[i]
-      j = bisect.bisect_right(intervals, (r, math.inf))
-      nextRes = dp(j, quota - 1)
-      pick = T(weight + nextRes.weight,
-               sorted((originalIndex, *nextRes.selected)))
-      return (pick if (pick.weight > skip.weight or
-                       pick.weight == skip.weight and pick.selected < skip.selected)
-              else skip)
-
-    return list(dp(0, 4).selected)
diff --git a/solutions/3415. Find Products with Three Consecutive Digits/3415.sql b/solutions/3415. Find Products with Three Consecutive Digits/3415.sql
deleted file mode 100644
index bec84cfcd2c..00000000000
--- a/solutions/3415. Find Products with Three Consecutive Digits/3415.sql	
+++ /dev/null
@@ -1,7 +0,0 @@
-SELECT product_id, name
-FROM Products
-WHERE
-  name REGEXP '[^0-9][0-9]{3}[^0-9]'
-  OR name REGEXP '^[0-9]{3}[^0-9]'
-  OR name REGEXP '[^0-9][0-9]{3}$'
-ORDER BY 1;
diff --git a/solutions/3416. Subsequences with a Unique Middle Mode II/3416.cpp b/solutions/3416. Subsequences with a Unique Middle Mode II/3416.cpp
deleted file mode 100644
index 1e08ec81599..00000000000
--- a/solutions/3416. Subsequences with a Unique Middle Mode II/3416.cpp	
+++ /dev/null
@@ -1,102 +0,0 @@
-// Recall from solution 1 that after counting all the subsequences with `a` as
-// the middle mode number, we need to subtract the cases where `a` is not a
-// unique mode or not a mode.
-//
-// To avoid the need of looping through all numbers that are not `a`, we can
-// maintain the sums that are not related to `a` in the loop.
-//
-// So, during the simplification of the formula, keep the running sums of
-// pss, spp, pp, ss, and ps as the first item.
-// (for cleaner notation, abbreviate p[b] and s[b] to just p and s)
-//
-//   sum(b != a) (p[a] * p * s) * (r - sa - s)
-//             + (sa * s * p) * (l - p[a] - p)
-//             + (p, 2) * sa * (r - sa)
-//             + (s, 2) * p[a] * (l - p[a])
-//
-//   sum(b != a) (p * s) * (p[a] * (r - sa)) + (p * s^2) * (-p[a])
-//             + (s * p) * (sa * (l - p[a])) + (s * p^2) * (-sa)
-//             + (p^2 - p) * (sa * (r - sa) / 2)
-//             + (s^2 - s) * (p[a] * (l - p[a]) / 2)
-
-class Solution {
- public:
-  // Same as 3395. Subsequences with a Unique Middle Mode I
-  int subsequencesWithMiddleMode(vector<int>& nums) {
-    int ans = 0;
-    unordered_map<int, int> p;  // prefix counter
-    unordered_map<int, int> s;  // suffix counter
-
-    for (const int num : nums)
-      ++s[num];
-
-    long pss = 0;
-    long spp = 0;
-    long pp = 0;
-    long ss = 0;
-    long ps = 0;
-
-    for (const auto& [_, freq] : s)
-      ss = (ss + static_cast<long>(freq) * freq) % kMod;
-
-    for (int i = 0; i < nums.size(); ++i) {
-      const int a = nums[i];
-      long sa = s[a];
-      const long pa = p[a];
-
-      // Update running sums after decrementing sa.
-      pss = (pss + pa * (-sa * sa + (sa - 1) * (sa - 1))) % kMod;
-      spp = (spp - pa * pa) % kMod;  // (-sa + (sa - 1)) * pa * pa
-      ss = (ss - sa * sa + (sa - 1) * (sa - 1)) % kMod;
-      ps = (ps - pa) % kMod;  // -pa * (-sa + (sa - 1))
-
-      sa = --s[a];
-
-      const int l = i;
-      const int r = nums.size() - i - 1;
-
-      // Start with all possible subsequences with `a` as the middle number.
-      ans = (ans + nC2(l) * nC2(r)) % kMod;
-
-      // Minus cases where frequency of `a` is 1, so it's not a mode.
-      ans = (ans - nC2(l - pa) * nC2(r - sa)) % kMod;
-
-      // Minus the values where `b != a`.
-      const long pss_ = (pss - pa * sa * sa) % kMod;
-      const long spp_ = (spp - sa * pa * pa) % kMod;
-      const long pp_ = (pp - pa * pa) % kMod;
-      const long ss_ = (ss - sa * sa) % kMod;
-      const long ps_ = (ps - pa * sa) % kMod;
-      const long p_ = l - pa;
-      const long s_ = r - sa;
-
-      // Minus cases where `a` is not a "unique" mode or not a mode.
-      long subtract = 0;
-      subtract = (subtract + ps_ * (pa * (r - sa))) % kMod;
-      subtract = (subtract + pss_ * (-pa)) % kMod;
-      subtract = (subtract + ps_ * (sa * (l - pa))) % kMod;
-      subtract = (subtract + spp_ * (-sa)) % kMod;
-      subtract = (subtract + (pp_ - p_) * sa * (r - sa) / 2) % kMod;
-      subtract = (subtract + (ss_ - s_) * pa * (l - pa) / 2) % kMod;
-      ans = (ans - subtract + kMod) % kMod;
-
-      // Update running sums after incrementing p[a].
-      pss = (pss + sa * sa) % kMod;  // (-pa + (pa + 1)) * sa * sa
-      spp = (spp + sa * (-pa * pa + (pa + 1) * (pa + 1))) % kMod;
-      pp = (pp - pa * pa + (pa + 1) * (pa + 1)) % kMod;
-      ps = (ps + sa) % kMod;  // (-pa + (pa + 1)) * sa
-
-      ++p[a];
-    }
-
-    return (ans + kMod) % kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Returns C(n, 2)
-  long nC2(long n) {
-    return n * (n - 1) / 2 % kMod;
-  }
-};
diff --git a/solutions/3416. Subsequences with a Unique Middle Mode II/3416.java b/solutions/3416. Subsequences with a Unique Middle Mode II/3416.java
deleted file mode 100644
index cea61af14db..00000000000
--- a/solutions/3416. Subsequences with a Unique Middle Mode II/3416.java	
+++ /dev/null
@@ -1,101 +0,0 @@
-// Recall from solution 1 that after counting all the subsequences with `a` as
-// the middle mode number, we need to subtract the cases where `a` is not a
-// unique mode or not a mode.
-//
-// To avoid the need of looping through all numbers that are not `a`, we can
-// maintain the sums that are not related to `a` in the loop.
-//
-// So, during the simplification of the formula, keep the running sums of
-// pss, spp, pp, ss, and ps as the first item.
-// (for cleaner notation, abbreviate p[b] and s[b] to just p and s)
-//
-//   sum(b != a) (p[a] * p * s) * (r - s[a] - s)
-//             + (s[a] * s * p) * (l - p[a] - p)
-//             + (p, 2) * s[a] * (r - s[a])
-//             + (s, 2) * p[a] * (l - p[a])
-//
-//   sum(b != a) (p * s) * (p[a] * (r - s[a])) + (p * s^2) * (-p[a])
-//             + (s * p) * (s[a] * (l - p[a])) + (s * p^2) * (-s[a])
-//             + (p^2 - p) * (s[a] * (r - s[a]) / 2)
-//             + (s^2 - s) * (p[a] * (l - p[a]) / 2)
-
-class Solution {
-  // Same as 3395. Subsequences with a Unique Middle Mode I
-  public int subsequencesWithMiddleMode(int[] nums) {
-    int ans = 0;
-    Map<Integer, Integer> p = new HashMap<>(); // prefix counter
-    Map<Integer, Integer> s = new HashMap<>(); // suffix counter
-
-    for (final int num : nums)
-      s.merge(num, 1, Integer::sum);
-
-    long pss = 0;
-    long spp = 0;
-    long pp = 0;
-    long ss = 0;
-    long ps = 0;
-
-    for (final int freq : s.values())
-      ss = (ss + (long) freq * freq) % MOD;
-
-    for (int i = 0; i < nums.length; ++i) {
-      final int a = nums[i];
-      long sa = s.get(a);
-      final long pa = p.getOrDefault(a, 0);
-
-      // Update running sums after decrementing s[a]
-      pss = (pss + pa * (-sa * sa + (sa - 1) * (sa - 1))) % MOD;
-      spp = (spp - pa * pa) % MOD; // (-sa + (sa - 1)) * pa * pa
-      ss = (ss - sa * sa + (sa - 1) * (sa - 1)) % MOD;
-      ps = (ps - pa) % MOD; // -pa * (-sa + (sa - 1))
-
-      s.merge(a, -1, Integer::sum);
-      sa = s.get(a);
-
-      final int l = i;
-      final int r = nums.length - i - 1;
-
-      // Start with all possible subsequences with `a` as the middle number
-      ans = (int) ((ans + (long) nC2(l) * nC2(r)) % MOD);
-
-      // Minus cases where frequency of `a` is 1, so it's not a mode
-      ans = (int) ((ans - (long) nC2(l - pa) * nC2(r - sa)) % MOD);
-
-      // Minus the values where `b != a`
-      final long pss_ = (pss - pa * sa * sa) % MOD;
-      final long spp_ = (spp - sa * pa * pa) % MOD;
-      final long pp_ = (pp - pa * pa) % MOD;
-      final long ss_ = (ss - sa * sa) % MOD;
-      final long ps_ = (ps - pa * sa) % MOD;
-      final long p_ = l - pa;
-      final long s_ = r - sa;
-
-      // Minus cases where `a` is not a "unique" mode or not a mode
-      long subtract = 0;
-      subtract = (subtract + ps_ * (pa * (r - sa))) % MOD;
-      subtract = (subtract + pss_ * (-pa)) % MOD;
-      subtract = (subtract + ps_ * (sa * (l - pa))) % MOD;
-      subtract = (subtract + spp_ * (-sa)) % MOD;
-      subtract = (subtract + (pp_ - p_) * sa * (r - sa) / 2) % MOD;
-      subtract = (subtract + (ss_ - s_) * pa * (l - pa) / 2) % MOD;
-      ans = (int) ((ans - subtract + MOD) % MOD);
-
-      // Update running sums after incrementing p[a]
-      pss = (pss + sa * sa) % MOD; // (-pa + (pa + 1)) * sa * sa
-      spp = (spp + sa * (-pa * pa + (pa + 1) * (pa + 1))) % MOD;
-      pp = (pp - pa * pa + (pa + 1) * (pa + 1)) % MOD;
-      ps = (ps + sa) % MOD; // (-pa + (pa + 1)) * sa
-
-      p.merge(a, 1, Integer::sum);
-    }
-
-    return (int) ((ans + MOD) % MOD);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  // Returns C(n, 2)
-  private long nC2(long n) {
-    return n * (n - 1) / 2 % MOD;
-  }
-}
diff --git a/solutions/3416. Subsequences with a Unique Middle Mode II/3416.py b/solutions/3416. Subsequences with a Unique Middle Mode II/3416.py
deleted file mode 100644
index a8e5f0fd57e..00000000000
--- a/solutions/3416. Subsequences with a Unique Middle Mode II/3416.py	
+++ /dev/null
@@ -1,82 +0,0 @@
-# Recall from solution 1 that after counting all the subsequences with `a` as
-# the middle mode number, we need to subtract the cases where `a` is not a
-# unique mode or not a mode.
-#
-# To avoid the need of looping through all numbers that are not `a`, we can
-# maintain the sums that are not related to `a` in the loop.
-#
-# So, during the simplification of the formula, keep the running sums of
-# pss, spp, pp, ss, and ps as the first item.
-# (for cleaner notation, abbreviate p[b] and s[b] to just p and s)
-#
-#   sum(b != a) (p[a] * p * s) * (r - s[a] - s)
-#             + (s[a] * s * p) * (l - p[a] - p)
-#             + (p, 2) * s[a] * (r - s[a])
-#             + (s, 2) * p[a] * (l - p[a])
-#
-#   sum(b != a) (p * s) * (p[a] * (r - s[a])) + (p * s^2) * (-p[a])
-#             + (s * p) * (s[a] * (l - p[a])) + (s * p^2) * (-s[a])
-#             + (p^2 - p) * (s[a] * (r - s[a]) / 2)
-#             + (s^2 - s) * (p[a] * (l - p[a]) / 2)
-
-
-class Solution:
-  # Same as 3395. Subsequences with a Unique Middle Mode I
-  def subsequencesWithMiddleMode(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-    ans = 0
-    p = collections.Counter()  # prefix counter
-    s = collections.Counter(nums)  # suffix counter
-
-    def nC2(n: int) -> int:
-      return n * (n - 1) // 2
-
-    pss = 0
-    spp = 0
-    pp = 0
-    ss = sum(freq**2 for freq in s.values())
-    ps = 0
-
-    for i, a in enumerate(nums):
-      # Update running sums after decrementing s[a].
-      pss += p[a] * (-s[a]**2 + (s[a] - 1)**2)
-      spp += -p[a]**2  # (-s[a] + (s[a] - 1)) * p[a]**2
-      ss += -s[a]**2 + (s[a] - 1)**2
-      ps += -p[a]  # -p[a] * (-s[a] + (s[a] - 1))
-
-      s[a] -= 1
-
-      l = i
-      r = len(nums) - i - 1
-
-      # Start with all possible subsequences with `a` as the middle number.
-      ans += nC2(l) * nC2(r)
-
-      # Minus the cases where the frequency of `a` is 1, so it's not a mode.
-      ans -= nC2(l - p[a]) * nC2(r - s[a])
-
-      # Minus the values where `b != a`.
-      pss_ = pss - p[a] * s[a]**2
-      spp_ = spp - s[a] * p[a]**2
-      pp_ = pp - p[a]**2
-      ss_ = ss - s[a]**2
-      ps_ = ps - p[a] * s[a]
-      p_ = l - p[a]
-      s_ = r - s[a]
-
-      # Minus the cases where the `a` is not a "unique" mode or not a mode.
-      ans -= ps_ * (p[a] * (r - s[a])) + pss_ * (-p[a])
-      ans -= ps_ * (s[a] * (l - p[a])) + spp_ * (-s[a])
-      ans -= (pp_ - p_) * s[a] * (r - s[a]) // 2
-      ans -= (ss_ - s_) * p[a] * (l - p[a]) // 2
-      ans %= MOD
-
-      # Update running sums after incrementing p[a].
-      pss += s[a]**2  # (-p[a] + (p[a] + 1)) * s[a]**2
-      spp += s[a] * (-p[a]**2 + (p[a] + 1)**2)
-      pp += -p[a]**2 + (p[a] + 1)**2
-      ps += s[a]  # (-p[a] + (p[a] + 1)) * s[a]
-
-      p[a] += 1
-
-    return ans
diff --git a/solutions/3417. Zigzag Grid Traversal With Skip/3417.cpp b/solutions/3417. Zigzag Grid Traversal With Skip/3417.cpp
deleted file mode 100644
index a8e5791cfd0..00000000000
--- a/solutions/3417. Zigzag Grid Traversal With Skip/3417.cpp	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
- public:
-  vector<int> zigzagTraversal(vector<vector<int>>& grid) {
-    const int m = grid.size();
-    const int n = grid[0].size();
-    vector<int> ans;
-    vector<int> zigzag;
-
-    for (int i = 0; i < m; ++i)
-      if (i % 2 == 0) {
-        for (int j = 0; j < n; ++j)
-          zigzag.push_back(grid[i][j]);
-      } else {
-        for (int j = n - 1; j >= 0; --j)
-          zigzag.push_back(grid[i][j]);
-      }
-
-    for (int i = 0; i < zigzag.size(); i += 2)
-      ans.push_back(zigzag[i]);
-
-    return ans;
-  }
-};
diff --git a/solutions/3417. Zigzag Grid Traversal With Skip/3417.java b/solutions/3417. Zigzag Grid Traversal With Skip/3417.java
deleted file mode 100644
index cbff80d6674..00000000000
--- a/solutions/3417. Zigzag Grid Traversal With Skip/3417.java	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
-  public List<Integer> zigzagTraversal(int[][] grid) {
-    final int m = grid.length;
-    final int n = grid[0].length;
-    List<Integer> ans = new ArrayList<>();
-    List<Integer> zigzag = new ArrayList<>();
-
-    for (int i = 0; i < m; ++i)
-      if (i % 2 == 0) {
-        for (int j = 0; j < n; ++j)
-          zigzag.add(grid[i][j]);
-      } else {
-        for (int j = n - 1; j >= 0; --j)
-          zigzag.add(grid[i][j]);
-      }
-
-    for (int i = 0; i < zigzag.size(); i += 2)
-      ans.add(zigzag.get(i));
-
-    return ans;
-  }
-}
diff --git a/solutions/3417. Zigzag Grid Traversal With Skip/3417.py b/solutions/3417. Zigzag Grid Traversal With Skip/3417.py
deleted file mode 100644
index cabb2a37cd3..00000000000
--- a/solutions/3417. Zigzag Grid Traversal With Skip/3417.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def zigzagTraversal(self, grid: list[list[int]]) -> list[int]:
-    zigzag = [row[::-1] if i % 2 else row for i, row in enumerate(grid)]
-    return [num for row in zigzag for num in row][::2]
diff --git a/solutions/3418. Maximum Amount of Money Robot Can Earn/3418.cpp b/solutions/3418. Maximum Amount of Money Robot Can Earn/3418.cpp
deleted file mode 100644
index e7894198a66..00000000000
--- a/solutions/3418. Maximum Amount of Money Robot Can Earn/3418.cpp	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution {
- public:
-  int maximumAmount(vector<vector<int>>& coins) {
-    const int m = coins.size();
-    const int n = coins[0].size();
-    // dp[i][j][k] := the maximum profit at position (i, j) with k remaining
-    // neutralizations
-    vector<vector<vector<int>>> dp(
-        m, vector<vector<int>>(n, vector<int>(4, -INT_MAX / 2)));
-
-    // Base case: the robot starts at the top-left corner.
-    dp[0][0][2] = coins[0][0];
-    if (coins[0][0] < 0)
-      dp[0][0][1] = 0;  // Neutralize the robber.
-
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j)
-        for (int k = 0; k < 3; ++k) {
-          if (i > 0)
-            dp[i][j][k] = max({dp[i][j][k], dp[i - 1][j][k] + coins[i][j],
-                               dp[i - 1][j][k + 1]});
-          if (j > 0)
-            dp[i][j][k] = max({dp[i][j][k], dp[i][j - 1][k] + coins[i][j],
-                               dp[i][j - 1][k + 1]});
-        }
-
-    return ranges::max(dp[m - 1][n - 1]);
-  }
-};
diff --git a/solutions/3418. Maximum Amount of Money Robot Can Earn/3418.java b/solutions/3418. Maximum Amount of Money Robot Can Earn/3418.java
deleted file mode 100644
index 8e84fe3efaa..00000000000
--- a/solutions/3418. Maximum Amount of Money Robot Can Earn/3418.java	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
-  public int maximumAmount(int[][] coins) {
-    final int m = coins.length;
-    final int n = coins[0].length;
-    // dp[i][j][k] := the maximum profit at position (i, j) with k remaining neutralizations
-    int[][][] dp = new int[m][n][4];
-    Arrays.stream(dp).forEach(
-        A -> Arrays.stream(A).forEach(B -> Arrays.fill(B, Integer.MIN_VALUE / 2)));
-
-    // Base case: the robot starts at the top-left corner.
-    dp[0][0][2] = coins[0][0];
-    if (coins[0][0] < 0)
-      dp[0][0][1] = 0; // Neutralize the robber.
-
-    for (int i = 0; i < m; i++)
-      for (int j = 0; j < n; j++)
-        for (int k = 0; k < 3; k++) {
-          if (i > 0)
-            dp[i][j][k] =
-                Math.max(dp[i][j][k], Math.max(dp[i - 1][j][k] + coins[i][j], dp[i - 1][j][k + 1]));
-          if (j > 0)
-            dp[i][j][k] =
-                Math.max(dp[i][j][k], Math.max(dp[i][j - 1][k] + coins[i][j], dp[i][j - 1][k + 1]));
-        }
-
-    return Arrays.stream(dp[m - 1][n - 1]).max().getAsInt();
-  }
-}
diff --git a/solutions/3418. Maximum Amount of Money Robot Can Earn/3418.py b/solutions/3418. Maximum Amount of Money Robot Can Earn/3418.py
deleted file mode 100644
index 2049b33e2c8..00000000000
--- a/solutions/3418. Maximum Amount of Money Robot Can Earn/3418.py	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution:
-  def maximumAmount(self, coins: list[list[int]]) -> int:
-    m = len(coins)
-    n = len(coins[0])
-    # dp[i][j][k] := the maximum profit at position (i, j) with k remaining
-    # neutralizations
-    dp = [[[-math.inf] * 4 for _ in range(n)] for _ in range(m)]
-
-    # Base case: the robot starts at the top-left corner.
-    dp[0][0][2] = coins[0][0]
-    if coins[0][0] < 0:
-      dp[0][0][1] = 0  # Neutralize the robber.
-
-    for i in range(m):
-      for j in range(n):
-        for k in range(3):  # for each number of remaining neutralizations
-          if i > 0:
-            dp[i][j][k] = max(dp[i][j][k],
-                              dp[i - 1][j][k] + coins[i][j],
-                              dp[i - 1][j][k + 1])
-          if j > 0:
-            dp[i][j][k] = max(dp[i][j][k],
-                              dp[i][j - 1][k] + coins[i][j],
-                              dp[i][j - 1][k + 1])
-
-    return max(dp[-1][-1])
diff --git a/solutions/3419. Minimize the Maximum Edge Weight of Graph/3419.cpp b/solutions/3419. Minimize the Maximum Edge Weight of Graph/3419.cpp
deleted file mode 100644
index 8631a3ac1c5..00000000000
--- a/solutions/3419. Minimize the Maximum Edge Weight of Graph/3419.cpp	
+++ /dev/null
@@ -1,41 +0,0 @@
-class Solution {
- public:
-  int minMaxWeight(int n, vector<vector<int>>& edges, int threshold) {
-    constexpr int kMax = 1'000'000;
-    vector<vector<pair<int, int>>> reversedGraph(n);
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      const int w = edge[2];
-      reversedGraph[v].push_back({u, w});
-    }
-
-    int l = 1;
-    int r = kMax + 1;
-
-    while (l < r) {
-      const int m = (l + r) / 2;
-      if (dfs(reversedGraph, 0, m, vector<bool>(n)) == n)
-        r = m;
-      else
-        l = m + 1;
-    }
-
-    return l == (kMax + 1) ? -1 : l;
-  }
-
- private:
-  // Returns the number of nodes reachable from u with weight <= m.
-  int dfs(const vector<vector<pair<int, int>>>& reversedGraph, int u,
-          int maxWeight, vector<bool>&& seen) {
-    int res = 1;
-    seen[u] = true;
-    for (const auto& [v, w] : reversedGraph[u]) {
-      if (w > maxWeight || seen[v])
-        continue;
-      res += dfs(reversedGraph, v, maxWeight, std::move(seen));
-    }
-    return res;
-  }
-};
diff --git a/solutions/3419. Minimize the Maximum Edge Weight of Graph/3419.java b/solutions/3419. Minimize the Maximum Edge Weight of Graph/3419.java
deleted file mode 100644
index 47f69864df9..00000000000
--- a/solutions/3419. Minimize the Maximum Edge Weight of Graph/3419.java	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution {
-  public int minMaxWeight(int n, int[][] pairs, int threshold) {
-    final int MAX = 1_000_000;
-    List<Pair<Integer, Integer>>[] reversedGraph = new List[n];
-
-    for (int i = 0; i < n; i++)
-      reversedGraph[i] = new ArrayList<>();
-
-    for (int[] pair : pairs) {
-      final int u = pair[0];
-      final int v = pair[1];
-      final int w = pair[2];
-      reversedGraph[v].add(new Pair<>(u, w));
-    }
-
-    int l = 1;
-    int r = MAX + 1;
-
-    while (l < r) {
-      final int m = (l + r) / 2;
-      if (dfs(reversedGraph, 0, m, new boolean[n]) == n)
-        r = m;
-      else
-        l = m + 1;
-    }
-
-    return l == (MAX + 1) ? -1 : l;
-  }
-
-  // Returns the number of nodes reachable from u with weight <= maxWeight.
-  private int dfs(List<Pair<Integer, Integer>>[] reversedGraph, int u, int maxWeight,
-                  boolean[] seen) {
-    int res = 1;
-    seen[u] = true;
-    for (Pair<Integer, Integer> pair : reversedGraph[u]) {
-      final int v = pair.getKey();
-      final int w = pair.getValue();
-      if (w > maxWeight || seen[v])
-        continue;
-      res += dfs(reversedGraph, v, maxWeight, seen);
-    }
-    return res;
-  }
-}
diff --git a/solutions/3419. Minimize the Maximum Edge Weight of Graph/3419.py b/solutions/3419. Minimize the Maximum Edge Weight of Graph/3419.py
deleted file mode 100644
index 5aea45fb01e..00000000000
--- a/solutions/3419. Minimize the Maximum Edge Weight of Graph/3419.py	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution:
-  def minMaxWeight(self, n: int, edges: list[list[int]], threshold: int) -> int:
-    MAX = 1000000
-    reversedGraph = [[] for _ in range(n)]
-
-    for u, v, w in edges:
-      reversedGraph[v].append((u, w))
-
-    l = 1
-    r = MAX + 1
-
-    while l < r:
-      m = (l + r) // 2
-      if self._dfs(reversedGraph, 0, m, set()) == n:
-        r = m
-      else:
-        l = m + 1
-
-    return -1 if l == MAX + 1 else l
-
-  def _dfs(
-      self,
-      reversedGraph: list[list[tuple]],
-      u: int,
-      maxWeight: int,
-      seen: set[int]
-  ) -> int:
-    """Returns the number of nodes reachable from u with weight <= maxWeight."""
-    res = 1
-    seen.add(u)
-    for v, w in reversedGraph[u]:
-      if w > maxWeight or v in seen:
-        continue
-      res += self._dfs(reversedGraph, v, maxWeight, seen)
-    return res
diff --git a/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420-2.cpp b/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420-2.cpp
deleted file mode 100644
index b4c928102c4..00000000000
--- a/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420-2.cpp	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
- public:
-  long long countNonDecreasingSubarrays(vector<int>& nums, int k) {
-    long ans = 0;
-    long cost = 0;
-    // Store indices of `nums` with `nums[i]` in non-increasing order.
-    deque<int> dq;
-
-    for (int i = nums.size() - 1, j = nums.size() - 1; i >= 0; --i) {
-      const int num = nums[i];
-      while (!dq.empty() && nums[dq.back()] < num) {
-        const int l = dq.back();
-        dq.pop_back();
-        const int r = dq.empty() ? j + 1 : dq.back();
-        // Adjust `nums[l]` to `num`.
-        cost += static_cast<long>(r - l) * (num - nums[l]);
-      }
-      dq.push_back(i);
-      while (cost > k) {  // Remove the rightmost number.
-        cost -= nums[dq.front()] - nums[j];
-        if (dq.front() == j)
-          dq.pop_front();
-        --j;
-      }
-      ans += j - i + 1;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420-2.java b/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420-2.java
deleted file mode 100644
index 8fb29f09dca..00000000000
--- a/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420-2.java	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
-  public long countNonDecreasingSubarrays(int[] nums, int k) {
-    long ans = 0;
-    long cost = 0;
-    // Store indices of `nums` with `nums[i]` in non-increasing order.
-    Deque<Integer> dq = new ArrayDeque<>();
-
-    for (int i = nums.length - 1, j = nums.length - 1; i >= 0; --i) {
-      final int num = nums[i];
-      while (!dq.isEmpty() && nums[dq.peekLast()] < num) {
-        final int l = dq.pollLast();
-        final int r = dq.isEmpty() ? j + 1 : dq.peekLast();
-        // Adjust `nums[l]` to `num`.
-        cost += (long) (r - l) * (num - nums[l]);
-      }
-      dq.offerLast(i);
-      while (cost > k) { // Remove the rightmost number.
-        cost -= nums[dq.peekFirst()] - nums[j];
-        if (dq.peekFirst() == j)
-          dq.pollFirst();
-        --j;
-      }
-      ans += j - i + 1;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420-2.py b/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420-2.py
deleted file mode 100644
index b45d7ff38c8..00000000000
--- a/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420-2.py	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution:
-  def countNonDecreasingSubarrays(self, nums: list[int], k: int) -> int:
-    ans = 0
-    cost = 0
-    # Store indices (i) of nums with nums[i] in non-increasing order.
-    dq = collections.deque()
-
-    j = len(nums) - 1
-    for i, num in reversed(list(enumerate(nums))):
-      while dq and nums[dq[-1]] < num:
-        l = dq.pop()
-        r = dq[-1] if dq else j + 1
-        cost += (r - l) * (num - nums[l])  # Adjust `nums[l]` to `num`.
-      dq.append(i)
-      while cost > k:  # Remove the rightmost number.
-        cost -= nums[dq[0]] - nums[j]
-        if dq[0] == j:
-          dq.popleft()
-        j -= 1
-      ans += j - i + 1
-
-    return ans
diff --git a/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420.cpp b/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420.cpp
deleted file mode 100644
index bfd97d10bbf..00000000000
--- a/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420.cpp	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution {
- public:
-  long long countNonDecreasingSubarrays(vector<int>& nums, int k) {
-    long ans = 0;
-    long cost = 0;
-    // Store (number, count) pairs in non-increasing order. The numbers in the
-    // queue represent what nums[i..j] look like after adjustments.
-    deque<pair<int, int>> dq;
-
-    for (int i = nums.size() - 1, j = nums.size() - 1; i >= 0; --i) {
-      const int num = nums[i];
-      int count = 1;
-      while (!dq.empty() && dq.back().first < num) {
-        const auto [nextNum, nextCount] = dq.back();
-        dq.pop_back();
-        count += nextCount;
-        // Adjust `nextNum`s to `num`.
-        cost += static_cast<long>(num - nextNum) * nextCount;
-      }
-      dq.emplace_back(num, count);
-      while (cost > k) {
-        const auto [rightmostNum, rightmostCount] = dq.front();
-        dq.pop_front();
-        cost -= static_cast<long>(rightmostNum - nums[j--]);
-        if (rightmostCount > 1)
-          dq.emplace_front(rightmostNum, rightmostCount - 1);
-      }
-      ans += j - i + 1;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420.java b/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420.java
deleted file mode 100644
index a8aa60c7a79..00000000000
--- a/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420.java	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution {
-  public long countNonDecreasingSubarrays(int[] nums, int k) {
-    long ans = 0;
-    long cost = 0;
-    // Store (number, count) pairs in non-increasing order. The numbers in the
-    // queue represent what nums[i..j] look like after adjustments.
-    Deque<Pair<Integer, Integer>> dq = new ArrayDeque<>();
-
-    for (int i = nums.length - 1, j = nums.length - 1; i >= 0; --i) {
-      final int num = nums[i];
-      int count = 1;
-      while (!dq.isEmpty() && dq.getLast().getKey() < num) {
-        final int nextNum = dq.getLast().getKey();
-        final int nextCount = dq.removeLast().getValue();
-        count += nextCount;
-        // Adjust `nextNum`s to `num`.
-        cost += (long) (num - nextNum) * nextCount;
-      }
-      dq.offerLast(new Pair<>(num, count));
-      while (cost > k) {
-        final int rightmostNum = dq.getFirst().getKey();
-        final int rightmostCount = dq.removeFirst().getValue();
-        cost -= (long) (rightmostNum - nums[j--]);
-        if (rightmostCount > 1)
-          dq.offerFirst(new Pair<>(rightmostNum, rightmostCount - 1));
-      }
-      ans += j - i + 1;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420.py b/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420.py
deleted file mode 100644
index 8da76f3372d..00000000000
--- a/solutions/3420. Count Non-Decreasing Subarrays After K Operations/3420.py	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution:
-  def countNonDecreasingSubarrays(self, nums: list[int], k: int) -> int:
-    ans = 0
-    cost = 0
-    # Store (number, count) pairs in non-increasing order. The numbers in the
-    # queue represent what nums[i..j] look like after adjustments.
-    dq = collections.deque()
-
-    j = len(nums) - 1
-    for i, num in reversed(list(enumerate(nums))):
-      count = 1
-      while dq and dq[-1][0] < num:
-        nextNum, nextCount = dq.pop()
-        count += nextCount
-        cost += (num - nextNum) * nextCount  # Adjust `nextNum`s to `num`.
-      dq.append((num, count))
-      while cost > k:  # Remove the rightmost number.
-        rightmostNum, rightmostCount = dq.popleft()
-        cost -= (rightmostNum - nums[j])
-        j -= 1
-        if rightmostCount > 1:
-          dq.appendleft((rightmostNum, rightmostCount - 1))
-      ans += j - i + 1
-
-    return ans
diff --git a/solutions/3421. Find Students Who Improved/3421.sql b/solutions/3421. Find Students Who Improved/3421.sql
deleted file mode 100644
index 1795182eed9..00000000000
--- a/solutions/3421. Find Students Who Improved/3421.sql	
+++ /dev/null
@@ -1,23 +0,0 @@
-WITH
-  RankedScores AS (
-    SELECT
-      student_id,
-      subject,
-      score,
-      exam_date,
-      RANK() OVER (PARTITION BY student_id, subject ORDER BY exam_date) AS rn_asc,
-      RANK() OVER (PARTITION BY student_id, subject ORDER BY exam_date DESC) AS rn_desc
-    FROM Scores
-  ),
-  FirstLastScores AS (
-    SELECT
-      student_id,
-      subject,
-      MIN(CASE WHEN rn_asc = 1 THEN score END) AS first_score,
-      MAX(CASE WHEN rn_desc = 1 THEN score END) AS latest_score
-    FROM RankedScores GROUP BY 1, 2
-    HAVING COUNT(*) > 1
-  )
-SELECT student_id, subject, first_score, latest_score
-FROM FirstLastScores
-WHERE latest_score > first_score;
diff --git a/solutions/3422. Minimum Operations to Make Subarray Elements Equal/3422.cpp b/solutions/3422. Minimum Operations to Make Subarray Elements Equal/3422.cpp
deleted file mode 100644
index f5bc87b6699..00000000000
--- a/solutions/3422. Minimum Operations to Make Subarray Elements Equal/3422.cpp	
+++ /dev/null
@@ -1,81 +0,0 @@
-struct SumMultiset {
-  multiset<int> nums;
-  long sum = 0;
-
-  void insert(int val) {
-    nums.insert(val);
-    sum += val;
-  }
-
-  void erase(int val) {
-    nums.erase(nums.find(val));
-    sum -= val;
-  }
-};
-
-class MedianTracker {
- public:
-  MedianTracker(int k) : k(k) {}
-
-  void add(int val) {
-    below.insert(val);
-    balance();
-  }
-
-  void remove(int val) {
-    if (const auto it = below.nums.find(val); it != below.nums.cend())
-      below.erase(val);
-    else
-      above.erase(val);
-  }
-
-  long getCost() const {
-    return above.sum - below.sum - (k % 2 == 1 ? *above.nums.begin() : 0);
-  }
-
- private:
-  SumMultiset below;
-  SumMultiset above;
-  const int k;
-
-  void balance() {
-    // Move excessive numbers from `below` to `above`.
-    while (below.nums.size() > k / 2) {
-      const int mx = *prev(below.nums.end());
-      below.erase(mx);
-      above.insert(mx);
-    }
-
-    // Balance `below` and `above`.
-    while (!above.nums.empty()) {
-      const int mx = *prev(below.nums.end());
-      const int mn = *above.nums.begin();
-      if (mx <= mn)
-        break;
-      below.erase(mx);
-      above.erase(mn);
-      below.insert(mn);
-      above.insert(mx);
-    }
-  }
-};
-
-class Solution {
- public:
-  long long minOperations(vector<int>& nums, int k) {
-    MedianTracker tracker(k);
-
-    for (int i = 0; i < k; ++i)
-      tracker.add(nums[i]);
-
-    long ans = tracker.getCost();
-
-    for (int i = k; i < nums.size(); ++i) {
-      tracker.remove(nums[i - k]);
-      tracker.add(nums[i]);
-      ans = min(ans, tracker.getCost());
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3422. Minimum Operations to Make Subarray Elements Equal/3422.java b/solutions/3422. Minimum Operations to Make Subarray Elements Equal/3422.java
deleted file mode 100644
index ca3ea935265..00000000000
--- a/solutions/3422. Minimum Operations to Make Subarray Elements Equal/3422.java	
+++ /dev/null
@@ -1,85 +0,0 @@
-class SumMultiset {
-  public TreeMap<Integer, Integer> nums = new TreeMap<>();
-  public long sum = 0;
-  public int size = 0;
-
-  public void insert(int val) {
-    nums.merge(val, 1, Integer::sum);
-    sum += val;
-    ++size;
-  }
-
-  public void erase(int val) {
-    nums.merge(val, -1, Integer::sum);
-    if (nums.get(val) == 0)
-      nums.remove(val);
-    sum -= val;
-    --size;
-  }
-}
-
-class MedianTracker {
-  public MedianTracker(int k) {
-    this.k = k;
-  }
-
-  public void add(int val) {
-    below.insert(val);
-    balance();
-  }
-
-  public void remove(int val) {
-    if (below.nums.containsKey(val))
-      below.erase(val);
-    else
-      above.erase(val);
-  }
-
-  public long getCost() {
-    return above.sum - below.sum - (k % 2 == 1 ? above.nums.firstKey() : 0L);
-  }
-
-  private SumMultiset below = new SumMultiset();
-  private SumMultiset above = new SumMultiset();
-  private int k;
-
-  private void balance() {
-    // Move excessive numbers from `below` to `above`.
-    while (below.size > k / 2) {
-      final int mx = below.nums.lastKey();
-      below.erase(mx);
-      above.insert(mx);
-    }
-
-    // Balance `below` and `above`.
-    while (!above.nums.isEmpty()) {
-      final int mx = below.nums.lastKey();
-      final int mn = above.nums.firstKey();
-      if (mx <= mn)
-        break;
-      below.erase(mx);
-      above.erase(mn);
-      below.insert(mn);
-      above.insert(mx);
-    }
-  }
-}
-
-class Solution {
-  public long minOperations(int[] nums, int k) {
-    MedianTracker tracker = new MedianTracker(k);
-
-    for (int i = 0; i < k; ++i)
-      tracker.add(nums[i]);
-
-    long ans = tracker.getCost();
-
-    for (int i = k; i < nums.length; ++i) {
-      tracker.remove(nums[i - k]);
-      tracker.add(nums[i]);
-      ans = Math.min(ans, tracker.getCost());
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3422. Minimum Operations to Make Subarray Elements Equal/3422.py b/solutions/3422. Minimum Operations to Make Subarray Elements Equal/3422.py
deleted file mode 100644
index d826678a58f..00000000000
--- a/solutions/3422. Minimum Operations to Make Subarray Elements Equal/3422.py	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution:
-  def minOperations(self, nums: list[int], k: int) -> int:
-    window = SortedList(nums[:k])
-    median = window[(k - 1) // 2]
-    ops = sum(abs(median - nums[j]) for j in range(k))
-    ans = ops
-
-    for i in range(k, len(nums)):
-      window.remove(nums[i - k])
-      window.add(nums[i])
-      ops -= abs(median - nums[i - k])
-      ops += abs(median - nums[i])
-      newMedian = window[(k - 1) // 2]
-      medianMultiplier = (
-          2
-          if k % 2 == 0 and median <= newMedian <= window[k // 2]
-          else k % 2)
-      ops -= abs(newMedian - median) * medianMultiplier
-      median = newMedian
-      ans = min(ans, ops)
-
-    return ans
diff --git a/solutions/3423. Maximum Difference Between Adjacent Elements in a Circular Array/3423.cpp b/solutions/3423. Maximum Difference Between Adjacent Elements in a Circular Array/3423.cpp
deleted file mode 100644
index 66971f3c866..00000000000
--- a/solutions/3423. Maximum Difference Between Adjacent Elements in a Circular Array/3423.cpp	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution {
- public:
-  int maxAdjacentDistance(vector<int>& nums) {
-    int ans = abs(nums.front() - nums.back());
-
-    for (int i = 0; i + 1 < nums.size(); ++i)
-      ans = max(ans, abs(nums[i] - nums[i + 1]));
-
-    return ans;
-  }
-};
diff --git a/solutions/3423. Maximum Difference Between Adjacent Elements in a Circular Array/3423.java b/solutions/3423. Maximum Difference Between Adjacent Elements in a Circular Array/3423.java
deleted file mode 100644
index 7f42c998be2..00000000000
--- a/solutions/3423. Maximum Difference Between Adjacent Elements in a Circular Array/3423.java	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution {
-  public int maxAdjacentDistance(int[] nums) {
-    int ans = Math.abs(nums[0] - nums[nums.length - 1]);
-
-    for (int i = 0; i + 1 < nums.length; ++i)
-      ans = Math.max(ans, Math.abs(nums[i] - nums[i + 1]));
-
-    return ans;
-  }
-}
diff --git a/solutions/3423. Maximum Difference Between Adjacent Elements in a Circular Array/3423.py b/solutions/3423. Maximum Difference Between Adjacent Elements in a Circular Array/3423.py
deleted file mode 100644
index 8edd928a2b1..00000000000
--- a/solutions/3423. Maximum Difference Between Adjacent Elements in a Circular Array/3423.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def maxAdjacentDistance(self, nums: list[int]) -> int:
-    return max(abs(nums[i] - nums[i - 1])
-               for i in range(len(nums)))
diff --git a/solutions/3424. Minimum Cost to Make Arrays Identical/3424.cpp b/solutions/3424. Minimum Cost to Make Arrays Identical/3424.cpp
deleted file mode 100644
index 33401749ed3..00000000000
--- a/solutions/3424. Minimum Cost to Make Arrays Identical/3424.cpp	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
- public:
-  long long minCost(vector<int>& arr, vector<int>& brr, long long k) {
-    return min(noSortCost(arr, brr), sortCost(arr, brr) + k);
-  }
-
- private:
-  long long noSortCost(const vector<int>& arr, const vector<int>& brr) {
-    long res = 0;
-    for (int i = 0; i < arr.size(); ++i)
-      res += abs(arr[i] - brr[i]);
-    return res;
-  }
-
-  long long sortCost(vector<int>& arr, vector<int>& brr) {
-    ranges::sort(arr);
-    ranges::sort(brr);
-    long res = 0;
-    for (int i = 0; i < arr.size(); ++i)
-      res += abs(arr[i] - brr[i]);
-    return res;
-  }
-};
diff --git a/solutions/3424. Minimum Cost to Make Arrays Identical/3424.java b/solutions/3424. Minimum Cost to Make Arrays Identical/3424.java
deleted file mode 100644
index 5f3c8422c4c..00000000000
--- a/solutions/3424. Minimum Cost to Make Arrays Identical/3424.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public long minCost(int[] arr, int[] brr, long k) {
-    return Math.min(noSortCost(arr, brr), sortCost(arr, brr) + k);
-  }
-
-  private long noSortCost(int[] arr, int[] brr) {
-    long res = 0;
-    for (int i = 0; i < arr.length; ++i)
-      res += Math.abs(arr[i] - brr[i]);
-    return res;
-  }
-
-  private long sortCost(int[] arr, int[] brr) {
-    Arrays.sort(arr);
-    Arrays.sort(brr);
-    long res = 0;
-    for (int i = 0; i < arr.length; ++i)
-      res += Math.abs(arr[i] - brr[i]);
-    return res;
-  }
-}
diff --git a/solutions/3424. Minimum Cost to Make Arrays Identical/3424.py b/solutions/3424. Minimum Cost to Make Arrays Identical/3424.py
deleted file mode 100644
index d635aad07cc..00000000000
--- a/solutions/3424. Minimum Cost to Make Arrays Identical/3424.py	
+++ /dev/null
@@ -1,5 +0,0 @@
-class Solution:
-  def minCost(self, arr: list[int], brr: list[int], k: int) -> int:
-    def cost(arr: list[int], brr: list[int]) -> int:
-      return sum(abs(a - b) for a, b in zip(arr, brr))
-    return min(cost(arr, brr), cost(sorted(arr), sorted(brr)) + k)
diff --git a/solutions/3425. Longest Special Path/3425.cpp b/solutions/3425. Longest Special Path/3425.cpp
deleted file mode 100644
index 85a305cd46a..00000000000
--- a/solutions/3425. Longest Special Path/3425.cpp	
+++ /dev/null
@@ -1,49 +0,0 @@
-class Solution {
- public:
-  vector<int> longestSpecialPath(vector<vector<int>>& edges,
-                                 vector<int>& nums) {
-    vector<vector<pair<int, int>>> graph(nums.size());
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      const int w = edge[2];
-      graph[u].emplace_back(v, w);
-      graph[v].emplace_back(u, w);
-    }
-
-    int maxLength = 0;
-    int minNodes = 1;
-    dfs(graph, 0, -1, /*leftBoundary=*/0, /*prefix=*/{0},
-        /*lastSeenDepth=*/{}, nums, maxLength, minNodes);
-    return {maxLength, minNodes};
-  }
-
- private:
-  void dfs(const vector<vector<pair<int, int>>>& graph, int u, int prev,
-           int leftBoundary, vector<int>&& prefix,
-           unordered_map<int, int>&& lastSeenDepth, const vector<int>& nums,
-           int& maxLength, int& minNodes) {
-    const int prevDepth = lastSeenDepth[nums[u]];
-    lastSeenDepth[nums[u]] = prefix.size();
-    leftBoundary = max(leftBoundary, prevDepth);
-
-    const int length = prefix.back() - prefix[leftBoundary];
-    const int nodes = prefix.size() - leftBoundary;
-    if (length > maxLength || (length == maxLength && nodes < minNodes)) {
-      maxLength = length;
-      minNodes = nodes;
-    }
-
-    for (const auto& [v, w] : graph[u]) {
-      if (v == prev)
-        continue;
-      prefix.push_back(prefix.back() + w);
-      dfs(graph, v, u, leftBoundary, std::move(prefix),
-          std::move(lastSeenDepth), nums, maxLength, minNodes);
-      prefix.pop_back();
-    }
-
-    lastSeenDepth[nums[u]] = prevDepth;
-  }
-};
diff --git a/solutions/3425. Longest Special Path/3425.java b/solutions/3425. Longest Special Path/3425.java
deleted file mode 100644
index 8000182dc84..00000000000
--- a/solutions/3425. Longest Special Path/3425.java	
+++ /dev/null
@@ -1,50 +0,0 @@
-class Solution {
-  public int[] longestSpecialPath(int[][] edges, int[] nums) {
-    List<Pair<Integer, Integer>>[] graph = new List[nums.length];
-
-    for (int i = 0; i < nums.length; ++i)
-      graph[i] = new ArrayList<>();
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      final int w = edge[2];
-      graph[u].add(new Pair<>(v, w));
-      graph[v].add(new Pair<>(u, w));
-    }
-
-    int[] ans = new int[2];
-    ans[0] = 0; // maxLength
-    ans[1] = 1; // minNodes
-    dfs(graph, 0, -1, /*leftBoundary=*/0, /*prefix=*/new ArrayList<>(List.of(0)),
-        /*lastSeenDepth=*/new HashMap<>(), nums, ans);
-    return ans;
-  }
-
-  private void dfs(List<Pair<Integer, Integer>>[] graph, int u, int prev, int leftBoundary,
-                   List<Integer> prefix, Map<Integer, Integer> lastSeenDepth, int[] nums,
-                   int[] ans) {
-    final int prevDepth = lastSeenDepth.getOrDefault(nums[u], 0);
-    lastSeenDepth.put(nums[u], prefix.size());
-    leftBoundary = Math.max(leftBoundary, prevDepth);
-
-    final int length = prefix.get(prefix.size() - 1) - prefix.get(leftBoundary);
-    final int nodes = prefix.size() - leftBoundary;
-    if (length > ans[0] || (length == ans[0] && nodes < ans[1])) {
-      ans[0] = length;
-      ans[1] = nodes;
-    }
-
-    for (Pair<Integer, Integer> pair : graph[u]) {
-      final int v = pair.getKey();
-      final int w = pair.getValue();
-      if (v == prev)
-        continue;
-      prefix.add(prefix.get(prefix.size() - 1) + w);
-      dfs(graph, v, u, leftBoundary, prefix, lastSeenDepth, nums, ans);
-      prefix.remove(prefix.size() - 1);
-    }
-
-    lastSeenDepth.put(nums[u], prevDepth);
-  }
-}
diff --git a/solutions/3425. Longest Special Path/3425.py b/solutions/3425. Longest Special Path/3425.py
deleted file mode 100644
index fd574c9c915..00000000000
--- a/solutions/3425. Longest Special Path/3425.py	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution:
-  def longestSpecialPath(
-      self,
-      edges: list[list[int]],
-      nums: list[int]
-  ) -> list[int]:
-    maxLength = 0
-    minNodes = 1
-    graph = [[] for _ in range(len(nums))]
-
-    for u, v, w in edges:
-      graph[u].append((v, w))
-      graph[v].append((u, w))
-
-    prefix = [0]
-    lastSeenDepth = {}
-
-    def dfs(
-        u: int,
-        prev: int,
-        leftBoundary: int,
-    ) -> None:
-      nonlocal maxLength, minNodes
-      prevDepth = lastSeenDepth.get(nums[u], 0)
-      lastSeenDepth[nums[u]] = len(prefix)
-      leftBoundary = max(leftBoundary, prevDepth)
-
-      length = prefix[-1] - prefix[leftBoundary]
-      nodes = len(prefix) - leftBoundary
-      if length > maxLength or (length == maxLength and nodes < minNodes):
-        maxLength = length
-        minNodes = nodes
-
-      for v, w in graph[u]:
-        if v == prev:
-          continue
-        prefix.append(prefix[-1] + w)
-        dfs(v, u, leftBoundary)
-        prefix.pop()
-
-      lastSeenDepth[nums[u]] = prevDepth
-
-    dfs(0, -1, leftBoundary=0)
-    return [maxLength, minNodes]
diff --git a/solutions/3426. Manhattan Distances of All Arrangements of Pieces/3426.cpp b/solutions/3426. Manhattan Distances of All Arrangements of Pieces/3426.cpp
deleted file mode 100644
index e501f210c33..00000000000
--- a/solutions/3426. Manhattan Distances of All Arrangements of Pieces/3426.cpp	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution {
- public:
-  int distanceSum(int m, int n, int k) {
-    // For each distance d, where 1 < d < m, there are `m - d` ways to choose
-    // the two columns that the two pieces are on. For each of the two pieces,
-    // there are `n` ways to choose the row that the piece is on.
-    // Therefore, the contribution of row differences is
-    //   sum(d * (m - d) * n^2), where 1 < d <= m - 1
-    // = n^2 * sum(d * m - d^2)
-    // = n^2 * (d * m * (m - 1) / 2 - m * (m - 1) * (2m - 1) / 6)
-    // = n^2 * (m^3 - m) / 6
-    // Similarly, the contribution of column differences is
-    //   m^2 * (n^3 - n) / 6
-    const int rowContrib = 1L * n * n * (1L * m * m * m - m) / 6 % kMod;
-    const int colContrib = 1L * m * m * (1L * n * n * n - n) / 6 % kMod;
-    return (rowContrib + colContrib) * nCk(m * n - 2, k - 2) % kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  long nCk(int n, int k) {
-    long res = 1;
-    for (int i = 1; i <= k; ++i)
-      // By Fermat's little theorem.
-      res = res * (n - i + 1) % kMod * modPow(i, kMod - 2) % kMod;
-    return res;
-  }
-
-  long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x % kMod, (n - 1)) % kMod;
-    return modPow(x * x % kMod, (n / 2)) % kMod;
-  }
-};
diff --git a/solutions/3426. Manhattan Distances of All Arrangements of Pieces/3426.java b/solutions/3426. Manhattan Distances of All Arrangements of Pieces/3426.java
deleted file mode 100644
index c710636592c..00000000000
--- a/solutions/3426. Manhattan Distances of All Arrangements of Pieces/3426.java	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
-  public int distanceSum(int m, int n, int k) {
-    final long rowContrib = 1L * n * n * (1L * m * m * m - m) / 6 % MOD;
-    final long colContrib = 1L * m * m * (1L * n * n * n - n) / 6 % MOD;
-    return (int) ((rowContrib + colContrib) % MOD * nCk(m * n - 2, k - 2) % MOD);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  private long nCk(int n, int k) {
-    long res = 1;
-    for (int i = 1; i <= k; ++i)
-      // By Fermat's little theorem.
-      res = res * (n - i + 1) % MOD * modPow(i, MOD - 2) % MOD;
-    return res;
-  }
-
-  private long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2);
-  }
-}
diff --git a/solutions/3426. Manhattan Distances of All Arrangements of Pieces/3426.py b/solutions/3426. Manhattan Distances of All Arrangements of Pieces/3426.py
deleted file mode 100644
index 1dd62698676..00000000000
--- a/solutions/3426. Manhattan Distances of All Arrangements of Pieces/3426.py	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution:
-  def distanceSum(self, m: int, n: int, k: int) -> int:
-    # For each distance d, where 1 < d < m, there are `m - d` ways to choose
-    # the two columns that the two pieces are on. For each of the two pieces,
-    # there are `n` ways to choose the row that the piece is on.
-    # Therefore, the contribution of row differences is
-    #   sum(d * (m - d) * n^2), where 1 < d <= m - 1
-    # = n^2 * sum(d * m - d^2)
-    # = n^2 * (d * m * (m - 1) / 2 - m * (m - 1) * (2m - 1) / 6)
-    # = n^2 * (m^3 - m) / 6
-    # Similarly, the contribution of column differences is
-    #   m^2 * (n^3 - n) / 6
-    MOD = 1_000_000_007
-    return (n**2 * (m**3 - m) // 6 +
-            m**2 * (n**3 - n) // 6) * math.comb(m * n - 2, k - 2) % MOD
diff --git a/solutions/3427. Sum of Variable Length Subarrays/3427.cpp b/solutions/3427. Sum of Variable Length Subarrays/3427.cpp
deleted file mode 100644
index 4a7f2441f33..00000000000
--- a/solutions/3427. Sum of Variable Length Subarrays/3427.cpp	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution {
- public:
-  int subarraySum(vector<int>& nums) {
-    const int n = nums.size();
-    int ans = 0;
-    vector<int> prefix(n + 1);
-
-    partial_sum(nums.begin(), nums.end(), prefix.begin() + 1);
-
-    for (int i = 0; i < n; ++i)
-      ans += prefix[i + 1] - prefix[max(0, i - nums[i])];
-
-    return ans;
-  }
-};
diff --git a/solutions/3427. Sum of Variable Length Subarrays/3427.java b/solutions/3427. Sum of Variable Length Subarrays/3427.java
deleted file mode 100644
index db0c4c2f29e..00000000000
--- a/solutions/3427. Sum of Variable Length Subarrays/3427.java	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution {
-  public int subarraySum(int[] nums) {
-    final int n = nums.length;
-    int ans = 0;
-    int[] prefix = new int[n + 1];
-
-    for (int i = 0; i < n; ++i)
-      prefix[i + 1] = prefix[i] + nums[i];
-
-    for (int i = 0; i < n; ++i)
-      ans += prefix[i + 1] - prefix[Math.max(0, i - nums[i])];
-
-    return ans;
-  }
-}
diff --git a/solutions/3427. Sum of Variable Length Subarrays/3427.py b/solutions/3427. Sum of Variable Length Subarrays/3427.py
deleted file mode 100644
index 32b102551fc..00000000000
--- a/solutions/3427. Sum of Variable Length Subarrays/3427.py	
+++ /dev/null
@@ -1,5 +0,0 @@
-class Solution:
-  def subarraySum(self, nums: list[int]) -> int:
-    prefix = list(itertools.accumulate(nums, initial=0))
-    return sum(prefix[i + 1] - prefix[max(0, i - num)]
-               for i, num in enumerate((nums)))
diff --git a/solutions/3428. Maximum and Minimum Sums of at Most Size K Subsequences/3428.cpp b/solutions/3428. Maximum and Minimum Sums of at Most Size K Subsequences/3428.cpp
deleted file mode 100644
index fbbebeedbd9..00000000000
--- a/solutions/3428. Maximum and Minimum Sums of at Most Size K Subsequences/3428.cpp	
+++ /dev/null
@@ -1,48 +0,0 @@
-class Solution {
- public:
-  int minMaxSums(vector<int>& nums, int k) {
-    // In a sorted array, nums[i] will be
-    //   1. The maximum for subsequences formed by nums[0..i].
-    //   2. The minimum for subsequences formed by nums[i..n - 1].
-    //
-    // The number of times nums[i] is the maximum is the same as the number of
-    // times nums[n - 1 - i] is the minimum, due to the symmetry in subsequences
-    // derived from the sorted order.
-    //
-    // To calculate the contribution of nums[i], we need to find the number of
-    // ways to select at most (k - 1) elements from the range of indices where
-    // nums[i] is the smallest or nums[n - 1 - i] is the largest.
-    const int n = nums.size();
-    const vector<vector<int>> comb = getComb(n, k - 1);
-    long ans = 0;
-
-    ranges::sort(nums);
-
-    // i := available numbers from the left of nums[i] or
-    //      available numbers from the right of nums[n - 1 - i]
-    for (int i = 0; i < n; ++i) {
-      int count = 0;
-      for (int j = 0; j <= k - 1; ++j)  // selected numbers
-        count = (count + comb[i][j]) % kMod;
-      ans += static_cast<long>(nums[i]) * count;
-      ans += static_cast<long>(nums[n - 1 - i]) * count;
-      ans %= kMod;
-    }
-
-    return ans;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // C(n, k) = C(n - 1, k) + C(n - 1, k - 1)
-  vector<vector<int>> getComb(int n, int k) {
-    vector<vector<int>> comb(n + 1, vector<int>(k + 1));
-    for (int i = 0; i <= n; ++i)
-      comb[i][0] = 1;
-    for (int i = 1; i <= n; ++i)
-      for (int j = 1; j <= k; ++j)
-        comb[i][j] = (comb[i - 1][j] + comb[i - 1][j - 1]) % kMod;
-    return comb;
-  }
-};
diff --git a/solutions/3428. Maximum and Minimum Sums of at Most Size K Subsequences/3428.java b/solutions/3428. Maximum and Minimum Sums of at Most Size K Subsequences/3428.java
deleted file mode 100644
index 601c99807ba..00000000000
--- a/solutions/3428. Maximum and Minimum Sums of at Most Size K Subsequences/3428.java	
+++ /dev/null
@@ -1,46 +0,0 @@
-class Solution {
-  public int minMaxSums(int[] nums, int k) {
-    // In a sorted array, nums[i] will be
-    //   1. The maximum for subsequences formed by nums[0..i].
-    //   2. The minimum for subsequences formed by nums[i..n - 1].
-    //
-    // The number of times nums[i] is the maximum is the same as the number of
-    // times nums[n - 1 - i] is the minimum, due to the symmetry in subsequences
-    // derived from the sorted order.
-    //
-    // To calculate the contribution of nums[i], we need to find the number of
-    // ways to select at most (k - 1) elements from the range of indices where
-    // nums[i] is the smallest or nums[n - 1 - i] is the largest.
-    final int n = nums.length;
-    final int[][] comb = getComb(n, k - 1);
-    long ans = 0;
-
-    Arrays.sort(nums);
-
-    // i: available numbers from the left of nums[i] or
-    //    available numbers from the right of nums[n - 1 - i]
-    for (int i = 0; i < n; ++i) {
-      int count = 0;
-      for (int j = 0; j <= k - 1; ++j) // selected numbers
-        count = (count + comb[i][j]) % MOD;
-      ans += (long) nums[i] * count;
-      ans += (long) nums[n - 1 - i] * count;
-      ans %= MOD;
-    }
-
-    return (int) ans;
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  // C(n, k) = C(n - 1, k) + C(n - 1, k - 1)
-  private int[][] getComb(int n, int k) {
-    int[][] comb = new int[n + 1][k + 1];
-    for (int i = 0; i <= n; ++i)
-      comb[i][0] = 1;
-    for (int i = 1; i <= n; ++i)
-      for (int j = 1; j <= k; ++j)
-        comb[i][j] = (comb[i - 1][j] + comb[i - 1][j - 1]) % MOD;
-    return comb;
-  }
-}
diff --git a/solutions/3428. Maximum and Minimum Sums of at Most Size K Subsequences/3428.py b/solutions/3428. Maximum and Minimum Sums of at Most Size K Subsequences/3428.py
deleted file mode 100644
index 0d542aff849..00000000000
--- a/solutions/3428. Maximum and Minimum Sums of at Most Size K Subsequences/3428.py	
+++ /dev/null
@@ -1,42 +0,0 @@
-class Solution:
-  def minMaxSums(self, nums: list[int], k: int) -> int:
-    # In a sorted array, nums[i] will be
-    #   1. The maximum for subsequences formed by nums[0..i].
-    #   2. The minimum for subsequences formed by nums[i..n - 1].
-    #
-    # The number of times nums[i] is the maximum is the same as the number of
-    # times nums[n - 1 - i] is the minimum, due to the symmetry in subsequences
-    # derived from the sorted order.
-    #
-    # To calculate the contribution of nums[i], we need to find the number of
-    # ways to select at most (k - 1) elements from the range of indices where
-    # nums[i] is the smallest or nums[n - 1 - i] is the largest.
-    MOD = 1_000_000_007
-    n = len(nums)
-
-    def getComb(n: int, k: int) -> list[list[int]]:
-      """C(n, k) = C(n - 1, k) + C(n - 1, k - 1)"""
-      comb = [[0] * (k + 1) for _ in range(n + 1)]
-      for i in range(n + 1):
-        comb[i][0] = 1
-      for i in range(1, n + 1):
-        for j in range(1, k + 1):
-          comb[i][j] = (comb[i - 1][j] + comb[i - 1][j - 1]) % MOD
-      return comb
-
-    comb = getComb(n, k - 1)
-    ans = 0
-
-    nums.sort()
-
-    # i: available numbers from the left of nums[i] or
-    #    available numbers from the right of nums[-1 - i]
-    for i in range(n):
-      count = 0
-      for j in range(k):  # selected numbers
-        count = (count + comb[i][j]) % MOD
-      ans += nums[i] * count
-      ans += nums[-1 - i] * count
-      ans %= MOD
-
-    return ans
diff --git a/solutions/3429. Paint House IV/3429.cpp b/solutions/3429. Paint House IV/3429.cpp
deleted file mode 100644
index adfafa6b9bb..00000000000
--- a/solutions/3429. Paint House IV/3429.cpp	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
- public:
-  long long minCost(int n, vector<vector<int>>& costs) {
-    constexpr int kInvalidColor = 3;
-    vector<vector<vector<long>>> mem(
-        n / 2, vector<vector<long>>(4, vector<long>(4, -1)));
-    return minCost(costs, 0, kInvalidColor, kInvalidColor, mem);
-  }
-
- private:
-  long minCost(const vector<vector<int>>& costs, int i, int prevLeftColor,
-               int prevRightColor, vector<vector<vector<long>>>& mem) {
-    if (i == costs.size() / 2)
-      return 0;
-    if (mem[i][prevLeftColor][prevRightColor] != -1)
-      return mem[i][prevLeftColor][prevRightColor];
-
-    long res = LONG_MAX;
-
-    for (const int leftColor : getValidColors(prevLeftColor))
-      for (const int rightColor : getValidColors(prevRightColor)) {
-        if (leftColor == rightColor)
-          continue;
-        const long leftCost = costs[i][leftColor];
-        const long rightCost = costs[costs.size() - 1 - i][rightColor];
-        res = min(res, leftCost + rightCost +
-                           minCost(costs, i + 1, leftColor, rightColor, mem));
-      }
-
-    return mem[i][prevLeftColor][prevRightColor] = res;
-  }
-
-  vector<int> getValidColors(int prevColor) {
-    vector<int> validColors;
-    for (int color = 0; color < 3; ++color)
-      if (color != prevColor)
-        validColors.push_back(color);
-    return validColors;
-  }
-};
diff --git a/solutions/3429. Paint House IV/3429.java b/solutions/3429. Paint House IV/3429.java
deleted file mode 100644
index 440e4ca78d9..00000000000
--- a/solutions/3429. Paint House IV/3429.java	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution {
-  public long minCost(int n, int[][] costs) {
-    final int INVALID_COLOR = 3;
-    Long[][][] mem = new Long[n / 2][4][4];
-    return minCost(costs, 0, INVALID_COLOR, INVALID_COLOR, mem);
-  }
-
-  private long minCost(int[][] costs, int i, int prevLeftColor, int prevRightColor,
-                       Long[][][] mem) {
-    if (i == costs.length / 2)
-      return 0;
-    if (mem[i][prevLeftColor][prevRightColor] != null)
-      return mem[i][prevLeftColor][prevRightColor];
-
-    long res = Long.MAX_VALUE;
-
-    for (final int leftColor : getValidColors(prevLeftColor))
-      for (final int rightColor : getValidColors(prevRightColor)) {
-        if (leftColor == rightColor)
-          continue;
-        final long leftCost = costs[i][leftColor];
-        final long rightCost = costs[costs.length - 1 - i][rightColor];
-        res =
-            Math.min(res, leftCost + rightCost + minCost(costs, i + 1, leftColor, rightColor, mem));
-      }
-
-    return mem[i][prevLeftColor][prevRightColor] = res;
-  }
-
-  private List<Integer> getValidColors(int prevColor) {
-    List<Integer> validColors = new ArrayList<>();
-    for (int color = 0; color < 3; ++color)
-      if (color != prevColor)
-        validColors.add(color);
-    return validColors;
-  }
-}
diff --git a/solutions/3429. Paint House IV/3429.py b/solutions/3429. Paint House IV/3429.py
deleted file mode 100644
index 382db170359..00000000000
--- a/solutions/3429. Paint House IV/3429.py	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution:
-  def minCost(self, n: int, costs: list[list[int]]) -> int:
-    INVALID_COLOR = 3
-
-    def getValidColors(prevColor: int) -> list[int]:
-      return [color for color in range(3) if color != prevColor]
-
-    @functools.lru_cache(None)
-    def minCost(i: int, prevLeftColor: int, prevRightColor: int) -> int:
-      if i == len(costs) // 2:
-        return 0
-      res = math.inf
-      for leftColor in getValidColors(prevLeftColor):
-        for rightColor in getValidColors(prevRightColor):
-          if leftColor == rightColor:
-            continue
-          leftCost = costs[i][leftColor]
-          rightCost = costs[-1 - i][rightColor]
-          res = min(res, leftCost + rightCost +
-                    minCost(i + 1, leftColor, rightColor))
-      return res
-
-    return minCost(0, INVALID_COLOR, INVALID_COLOR)
diff --git a/solutions/3430. Maximum and Minimum Sums of at Most Size K Subarrays/3430.cpp b/solutions/3430. Maximum and Minimum Sums of at Most Size K Subarrays/3430.cpp
deleted file mode 100644
index 355ccb0a3da..00000000000
--- a/solutions/3430. Maximum and Minimum Sums of at Most Size K Subarrays/3430.cpp	
+++ /dev/null
@@ -1,47 +0,0 @@
-class Solution {
- public:
-  // Similar to 2104. Sum of Subarray Ranges
-  long long minMaxSubarraySum(const vector<int>& nums, int k) {
-    const auto [prevGt, nextGt] = getPrevNext(nums, less<>());
-    const auto [prevLt, nextLt] = getPrevNext(nums, greater<>());
-    return subarraySum(nums, prevGt, nextGt, k) +
-           subarraySum(nums, prevLt, nextLt, k);
-  }
-
- private:
-  // Returns the sum of all subarrays with a size <= k, The `prev` and `next`
-  // arrays are used to store the indices of the nearest numbers that are
-  // smaller or larger than the current number, respectively.
-  long subarraySum(const vector<int>& nums, const vector<int>& prev,
-                   const vector<int>& next, int k) {
-    long res = 0;
-    for (int i = 0; i < nums.size(); ++i) {
-      const int l = min(i - prev[i], k);
-      const int r = min(next[i] - i, k);
-      const int extra = max(0, l + r - 1 - k);
-      res += nums[i] * static_cast<long>(l * r - extra * (extra + 1) / 2);
-    }
-    return res;
-  }
-
-  // Returns `prev` and `next`, that store the indices of the nearest numbers
-  // that are smaller or larger than the current number depending on `op`.
-  pair<vector<int>, vector<int>> getPrevNext(
-      const vector<int>& nums, const function<bool(int, int)>& op) {
-    const int n = nums.size();
-    vector<int> prev(n, -1);
-    vector<int> next(n, n);
-    stack<int> stack;
-    for (int i = 0; i < n; ++i) {
-      while (!stack.empty() && op(nums[stack.top()], nums[i])) {
-        const int index = stack.top();
-        stack.pop();
-        next[index] = i;
-      }
-      if (!stack.empty())
-        prev[i] = stack.top();
-      stack.push(i);
-    }
-    return {prev, next};
-  }
-};
diff --git a/solutions/3430. Maximum and Minimum Sums of at Most Size K Subarrays/3430.java b/solutions/3430. Maximum and Minimum Sums of at Most Size K Subarrays/3430.java
deleted file mode 100644
index 0ead933aaf9..00000000000
--- a/solutions/3430. Maximum and Minimum Sums of at Most Size K Subarrays/3430.java	
+++ /dev/null
@@ -1,45 +0,0 @@
-class Solution {
-  // Similar to 2104. Sum of Subarray Ranges
-  public long minMaxSubarraySum(int[] nums, int k) {
-    Pair<int[], int[]> gt = getPrevNext(nums, (a, b) -> a < b);
-    Pair<int[], int[]> lt = getPrevNext(nums, (a, b) -> a > b);
-    int[] prevGt = gt.getKey();
-    int[] nextGt = gt.getValue();
-    int[] prevLt = lt.getKey();
-    int[] nextLt = lt.getValue();
-    return subarraySum(nums, k, prevGt, nextGt) + subarraySum(nums, k, prevLt, nextLt);
-  }
-
-  // Returns the sum of all subarrays with a size <= k, The `prev` and `next`
-  // arrays are used to store the indices of the nearest numbers that are
-  // smaller or larger than the current number, respectively.
-  private long subarraySum(int[] nums, int k, int[] prev, int[] next) {
-    long res = 0;
-    for (int i = 0; i < nums.length; ++i) {
-      final int l = Math.min(i - prev[i], k);
-      final int r = Math.min(next[i] - i, k);
-      final int extra = Math.max(0, l + r - 1 - k);
-      res += (long) nums[i] * (l * r - extra * (extra + 1) / 2);
-    }
-    return res;
-  }
-
-  // Returns `prev` and `next`, that store the indices of the nearest numbers
-  // that are smaller or larger than the current number depending on `op`.
-  private Pair<int[], int[]> getPrevNext(int[] nums, BiFunction<Integer, Integer, Boolean> op) {
-    final int n = nums.length;
-    int[] prev = new int[n];
-    int[] next = new int[n];
-    Arrays.fill(prev, -1);
-    Arrays.fill(next, n);
-    Deque<Integer> stack = new ArrayDeque<>();
-    for (int i = 0; i < n; ++i) {
-      while (!stack.isEmpty() && op.apply(nums[stack.peek()], nums[i]))
-        next[stack.pop()] = i;
-      if (!stack.isEmpty())
-        prev[i] = stack.peek();
-      stack.push(i);
-    }
-    return new Pair<>(prev, next);
-  }
-}
diff --git a/solutions/3430. Maximum and Minimum Sums of at Most Size K Subarrays/3430.py b/solutions/3430. Maximum and Minimum Sums of at Most Size K Subarrays/3430.py
deleted file mode 100644
index 04fbdb4e942..00000000000
--- a/solutions/3430. Maximum and Minimum Sums of at Most Size K Subarrays/3430.py	
+++ /dev/null
@@ -1,49 +0,0 @@
-class Solution:
-  # Similar to 2104. Sum of Subarray Ranges
-  def minMaxSubarraySum(self, nums: list[int], k: int) -> int:
-    prevGt, nextGt = self._getPrevNext(nums, operator.lt)
-    prevLt, nextLt = self._getPrevNext(nums, operator.gt)
-    return (self._subarraySum(nums, prevGt, nextGt, k) +
-            self._subarraySum(nums, prevLt, nextLt, k))
-
-  def _subarraySum(
-      self,
-      nums: list[int],
-      prev: list[int],
-      next: list[int],
-      k: int
-  ) -> int:
-    """
-    Returns the sum of all subarrays with a size <= k, The `prev` and `next`
-    arrays are used to store the indices of the nearest numbers that are
-    smaller or larger than the current number, respectively.
-    """
-    res = 0
-    for i, num in enumerate(nums):
-      l = min(i - prev[i], k)
-      r = min(next[i] - i, k)
-      extra = max(0, l + r - 1 - k)
-      res += num * (l * r - extra * (extra + 1) // 2)
-    return res
-
-  def _getPrevNext(
-      self,
-      nums: list[int],
-      op: callable
-  ) -> tuple[list[int], list[int]]:
-    """
-    Returns `prev` and `next`, that store the indices of the nearest numbers
-    that are smaller or larger than the current number depending on `op`.
-    """
-    n = len(nums)
-    prev = [-1] * n
-    next = [n] * n
-    stack = []
-    for i, num in enumerate(nums):
-      while stack and op(nums[stack[-1]], num):
-        index = stack.pop()
-        next[index] = i
-      if stack:
-        prev[i] = stack[-1]
-      stack.append(i)
-    return prev, next
diff --git a/solutions/3431. Minimum Unlocked Indices to Sort Nums/3431.cpp b/solutions/3431. Minimum Unlocked Indices to Sort Nums/3431.cpp
deleted file mode 100644
index 44d247d8420..00000000000
--- a/solutions/3431. Minimum Unlocked Indices to Sort Nums/3431.cpp	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution {
- public:
-  int minUnlockedIndices(vector<int>& nums, vector<int>& locked) {
-    const auto first2It = ranges::find(nums, 2);
-    const auto first3It = ranges::find(nums, 3);
-    const auto last1It = ranges::find_last(nums, 1);
-    const auto last2It = ranges::find_last(nums, 2);
-    const int first2 =
-        first2It == nums.cend() ? -1 : distance(nums.begin(), first2It);
-    const int first3 =
-        first3It == nums.cend() ? -1 : distance(nums.begin(), first3It);
-    const int last1 = last1It.begin() == nums.cend()
-                          ? -1
-                          : distance(nums.begin(), last1It.begin());
-    const int last2 = last2It.begin() == nums.cend()
-                          ? -1
-                          : distance(nums.begin(), last2It.begin());
-    if (first3 != -1 && last1 != -1 && first3 < last1)
-      return -1;
-
-    int ans = 0;
-
-    // Unlocked indices between 2 and 1.
-    if (first2 != -1 && last1 != -1)
-      for (int i = first2; i < last1; ++i)
-        if (locked[i] == 1)
-          ++ans;
-
-    // Unlocked indices between 3 and 2.
-    if (first3 != -1 && last2 != -1)
-      for (int i = first3; i < last2; ++i)
-        if (locked[i] == 1)
-          ++ans;
-
-    return ans;
-  }
-};
diff --git a/solutions/3431. Minimum Unlocked Indices to Sort Nums/3431.java b/solutions/3431. Minimum Unlocked Indices to Sort Nums/3431.java
deleted file mode 100644
index 85a8d0fb017..00000000000
--- a/solutions/3431. Minimum Unlocked Indices to Sort Nums/3431.java	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
-  public int minUnlockedIndices(int[] nums, int[] locked) {
-    final int first2 = findFirstIndex(nums, 2);
-    final int first3 = findFirstIndex(nums, 3);
-    final int last1 = findLastIndex(nums, 1);
-    final int last2 = findLastIndex(nums, 2);
-    if (first3 != -1 && last1 != -1 && first3 < last1)
-      return -1;
-
-    int ans = 0;
-
-    // Unlocked indices between 2 and 1.
-    if (first2 != -1 && last1 != -1)
-      for (int i = first2; i < last1; ++i)
-        if (locked[i] == 1)
-          ++ans;
-
-    // Unlocked indices between 3 and 2.
-    if (first3 != -1 && last2 != -1)
-      for (int i = first3; i < last2; i++)
-        if (locked[i] == 1)
-          ++ans;
-
-    return ans;
-  }
-
-  private int findFirstIndex(int[] nums, int target) {
-    for (int i = 0; i < nums.length; ++i)
-      if (nums[i] == target)
-        return i;
-    return -1;
-  }
-
-  private int findLastIndex(int[] nums, int target) {
-    for (int i = nums.length - 1; i >= 0; i--)
-      if (nums[i] == target)
-        return i;
-    return -1;
-  }
-}
diff --git a/solutions/3431. Minimum Unlocked Indices to Sort Nums/3431.py b/solutions/3431. Minimum Unlocked Indices to Sort Nums/3431.py
deleted file mode 100644
index 3c00ffd7868..00000000000
--- a/solutions/3431. Minimum Unlocked Indices to Sort Nums/3431.py	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution:
-  def minUnlockedIndices(self, nums: list[int], locked: list[int]) -> int:
-    first2 = next((i for i, x in enumerate(nums) if x == 2), -1)
-    first3 = next((i for i, x in enumerate(nums) if x == 3), -1)
-    last1 = next((i for i, x in reversed(list(enumerate(nums))) if x == 1), -1)
-    last2 = next((i for i, x in reversed(list(enumerate(nums))) if x == 2), -1)
-    if first3 != -1 and last1 != -1 and first3 < last1:
-      return -1
-    return (sum(locked[i] == 1 for i in range(first2, last1)
-                if first2 != -1 and last1 != -1) +
-            sum(locked[i] == 1 for i in range(first3, last2)
-                if first3 != -1 and last2 != -1))
diff --git a/solutions/3432. Count Partitions with Even Sum Difference/3432.cpp b/solutions/3432. Count Partitions with Even Sum Difference/3432.cpp
deleted file mode 100644
index 88600242fa7..00000000000
--- a/solutions/3432. Count Partitions with Even Sum Difference/3432.cpp	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution {
- public:
-  int countPartitions(std::vector<int>& nums) {
-    // If we add the same number in the left subarray and remove it from the
-    // right subarray, then the difference remains the same parity. So, just
-    // return the number of ways to partition the array into two subarrays when
-    // the array sum is even.
-    return accumulate(nums.begin(), nums.end(), 0) % 2 == 0 ? nums.size() - 1
-                                                            : 0;
-  }
-};
diff --git a/solutions/3432. Count Partitions with Even Sum Difference/3432.java b/solutions/3432. Count Partitions with Even Sum Difference/3432.java
deleted file mode 100644
index e1c6516f09b..00000000000
--- a/solutions/3432. Count Partitions with Even Sum Difference/3432.java	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution {
-  public int countPartitions(int[] nums) {
-    // If we add the same number in the left subarray and remove it from the
-    // right subarray, then the difference remains the same parity. So, just
-    // return the number of ways to partition the array into two subarrays when
-    // the array sum is even.
-    return Arrays.stream(nums).sum() % 2 == 0 ? nums.length - 1 : 0;
-  }
-}
diff --git a/solutions/3432. Count Partitions with Even Sum Difference/3432.py b/solutions/3432. Count Partitions with Even Sum Difference/3432.py
deleted file mode 100644
index 5d2cce0b194..00000000000
--- a/solutions/3432. Count Partitions with Even Sum Difference/3432.py	
+++ /dev/null
@@ -1,7 +0,0 @@
-class Solution:
-  def countPartitions(self, nums: list[int]) -> int:
-    # If we add the same number in the left subarray and remove it from the
-    # right subarray, then the difference remains the same parity. So, just
-    # return the number of ways to partition the array into two subarrays when
-    # the array sum is even.
-    return len(nums) - 1 if sum(nums) % 2 == 0 else 0
diff --git a/solutions/3433. Count Mentions Per User/3433.cpp b/solutions/3433. Count Mentions Per User/3433.cpp
deleted file mode 100644
index 7839618a702..00000000000
--- a/solutions/3433. Count Mentions Per User/3433.cpp	
+++ /dev/null
@@ -1,65 +0,0 @@
-struct OfflineUser {
-  int returnTimestamp;
-  int userId;
-  bool operator>(const OfflineUser& other) const {
-    return returnTimestamp > other.returnTimestamp;
-  }
-};
-
-class Solution {
- public:
-  vector<int> countMentions(int numberOfUsers, vector<vector<string>>& events) {
-    vector<int> ans(numberOfUsers);
-    vector<int> online(numberOfUsers, true);
-    // min-heap to track users that are offline
-    priority_queue<OfflineUser, vector<OfflineUser>, greater<>> offlineQueue;
-    int allMentionsCount = 0;
-
-    ranges::sort(events, ranges::less{}, [](const vector<string>& event) {
-      const int timestamp = stoi(event[1]);
-      const char eventType = event[0][0];
-      return pair<int, char>{timestamp, -eventType};
-    });
-
-    for (const vector<string>& event : events) {
-      const string eventType = event[0];
-      const int timestamp = stoi(event[1]);
-      // Bring users back online if their offline period has ended.
-      while (!offlineQueue.empty() &&
-             offlineQueue.top().returnTimestamp <= timestamp)
-        online[offlineQueue.top().userId] = true, offlineQueue.pop();
-      if (eventType == "MESSAGE") {
-        const string mentionsString = event[2];
-        if (mentionsString == "ALL") {
-          ++allMentionsCount;
-        } else if (mentionsString == "HERE") {
-          for (int userId = 0; userId < numberOfUsers; ++userId)
-            if (online[userId])
-              ++ans[userId];
-        } else {
-          for (const int userId : getUserIds(mentionsString))
-            ++ans[userId];
-        }
-      } else if (eventType == "OFFLINE") {
-        const int userId = stoi(event[2]);
-        online[userId] = false;
-        // Add to queue to bring back online after 60 units.
-        offlineQueue.emplace(timestamp + 60, userId);
-      }
-    }
-
-    // Add the "ALL" mentions to all users.
-    for (int userId = 0; userId < numberOfUsers; ++userId)
-      ans[userId] += allMentionsCount;
-    return ans;
-  }
-
- private:
-  vector<int> getUserIds(const string& s) {
-    vector<int> integers;
-    istringstream iss(s);
-    for (string id; iss >> id;)
-      integers.push_back(stoi(id.substr(2)));
-    return integers;
-  }
-};
diff --git a/solutions/3433. Count Mentions Per User/3433.java b/solutions/3433. Count Mentions Per User/3433.java
deleted file mode 100644
index 9c4d26d24a3..00000000000
--- a/solutions/3433. Count Mentions Per User/3433.java	
+++ /dev/null
@@ -1,55 +0,0 @@
-class Solution {
-  public int[] countMentions(int numberOfUsers, List<List<String>> events) {
-    record OfflineUser(int returnTimestamp, int userId) {}
-    int[] ans = new int[numberOfUsers];
-    boolean[] online = new boolean[numberOfUsers];
-    Arrays.fill(online, true);
-    // min-heap to track users that are offline
-    Queue<OfflineUser> offlineQueue =
-        new PriorityQueue<>(Comparator.comparingInt(OfflineUser::returnTimestamp));
-    int allMentionsCount = 0;
-
-    events.sort(
-        Comparator.comparingInt((List<String> event) -> Integer.parseInt(event.get(1)))
-            .thenComparing((List<String> event) -> event.get(0), Comparator.reverseOrder()));
-
-    for (List<String> event : events) {
-      final String eventType = event.get(0);
-      final int timestamp = Integer.parseInt(event.get(1));
-      // Bring users back online if their offline period has ended.
-      while (!offlineQueue.isEmpty() && offlineQueue.peek().returnTimestamp <= timestamp)
-        online[offlineQueue.poll().userId] = true;
-      if (eventType.equals("MESSAGE")) {
-        String mentionsString = event.get(2);
-        if (mentionsString.equals("ALL")) {
-          ++allMentionsCount;
-        } else if (mentionsString.equals("HERE")) {
-          for (int userId = 0; userId < numberOfUsers; ++userId)
-            if (online[userId])
-              ++ans[userId];
-        } else {
-          for (final int userId : getUserIds(mentionsString))
-            ++ans[userId];
-        }
-      } else if (eventType.equals("OFFLINE")) {
-        final int userId = Integer.parseInt(event.get(2));
-        online[userId] = false;
-        // Add to queue to bring back online after 60 units
-        offlineQueue.offer(new OfflineUser(timestamp + 60, userId));
-      }
-    }
-
-    // Add the "ALL" mentions to all users.
-    for (int userId = 0; userId < numberOfUsers; ++userId)
-      ans[userId] += allMentionsCount;
-
-    return ans;
-  }
-
-  private List<Integer> getUserIds(final String s) {
-    List<Integer> integers = new ArrayList<>();
-    for (String part : s.split(" "))
-      integers.add(Integer.parseInt(part.substring(2)));
-    return integers;
-  }
-}
diff --git a/solutions/3433. Count Mentions Per User/3433.py b/solutions/3433. Count Mentions Per User/3433.py
deleted file mode 100644
index b96c0b20f68..00000000000
--- a/solutions/3433. Count Mentions Per User/3433.py	
+++ /dev/null
@@ -1,52 +0,0 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
-class OfflineUser:
-  returnTimestamp: int
-  userId: int
-
-  def __lt__(self, other):
-    return self.returnTimestamp < other.returnTimestamp
-
-
-class Solution:
-  def countMentions(
-      self,
-      numberOfUsers: int,
-      events: list[list[str]]
-  ) -> list[int]:
-    ans = [0] * numberOfUsers
-    online = [True] * numberOfUsers
-    offlineQueue = []  # min-heap to track users that are offline
-    allMentionsCount = 0
-
-    events.sort(key=lambda x: (int(x[1]), -ord(x[0][0])))
-
-    for eventType, t, messageContent in events:
-      timestamp = int(t)
-      # Bring users back online if their offline period has ended.
-      while offlineQueue and offlineQueue[0].returnTimestamp <= timestamp:
-        user = heapq.heappop(offlineQueue)
-        online[user.userId] = True
-      if eventType == "MESSAGE":
-        match messageContent:
-          case "ALL":
-            allMentionsCount += 1
-          case "HERE":
-            for userId in range(numberOfUsers):
-              if online[userId]:
-                ans[userId] += 1
-          case _:
-            for userId in [int(part[2:]) for part in messageContent.split()]:
-              ans[userId] += 1
-      elif eventType == "OFFLINE":
-        userId = int(messageContent)
-        online[userId] = False
-        # Add to queue to bring back online after 60 units.
-        heapq.heappush(offlineQueue, OfflineUser(timestamp + 60, userId))
-
-    # Add the "ALL" mentions to all users.
-    for userId in range(numberOfUsers):
-      ans[userId] += allMentionsCount
-    return ans
diff --git a/solutions/3434. Maximum Frequency After Subarray Operation/3434.cpp b/solutions/3434. Maximum Frequency After Subarray Operation/3434.cpp
deleted file mode 100644
index 233fd2b80cc..00000000000
--- a/solutions/3434. Maximum Frequency After Subarray Operation/3434.cpp	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution {
- public:
-  int maxFrequency(vector<int>& nums, int k) {
-    constexpr int kMax = 50;
-    int maxFreq = 0;
-    for (int target = 1; target <= kMax; ++target)
-      if (target != k)
-        maxFreq = max(maxFreq, kadane(nums, target, k));
-    return ranges::count(nums, k) + maxFreq;
-  }
-
- private:
-  // Returns the maximum achievable frequency of `k` by Kakane's algorithm,
-  // where each `target` in subarrays is transformed to `k`.
-  int kadane(const vector<int>& nums, int target, int k) {
-    int maxSum = 0;
-    int sum = 0;
-    for (const int num : nums) {
-      if (num == target)
-        ++sum;
-      else if (num == k)
-        --sum;
-      if (sum < 0)  // Reset if sum becomes negative (Kadane's spirit).
-        sum = 0;
-      maxSum = max(maxSum, sum);
-    }
-    return maxSum;
-  }
-};
diff --git a/solutions/3434. Maximum Frequency After Subarray Operation/3434.java b/solutions/3434. Maximum Frequency After Subarray Operation/3434.java
deleted file mode 100644
index 56c838dfc82..00000000000
--- a/solutions/3434. Maximum Frequency After Subarray Operation/3434.java	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
-  public int maxFrequency(int[] nums, int k) {
-    final int MAX = 50;
-    int maxFreq = 0;
-    for (int target = 1; target <= MAX; ++target)
-      if (target != k)
-        maxFreq = Math.max(maxFreq, kadane(nums, target, k));
-    return (int) Arrays.stream(nums).filter(num -> num == k).count() + maxFreq;
-  }
-
-  // Returns the maximum achievable frequency of `k` using Kakane's algorithm,
-  // where each `target` in subarrays is transformed to `k`.
-  private int kadane(int[] nums, int target, int k) {
-    int maxSum = 0;
-    int sum = 0;
-    for (final int num : nums) {
-      if (num == target)
-        ++sum;
-      else if (num == k)
-        --sum;
-      if (sum < 0) // Reset if sum becomes negative (Kadane's spirit).
-        sum = 0;
-      maxSum = Math.max(maxSum, sum);
-    }
-
-    return maxSum;
-  }
-}
diff --git a/solutions/3434. Maximum Frequency After Subarray Operation/3434.py b/solutions/3434. Maximum Frequency After Subarray Operation/3434.py
deleted file mode 100644
index 720cc2b183d..00000000000
--- a/solutions/3434. Maximum Frequency After Subarray Operation/3434.py	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution:
-  def maxFrequency(self, nums: list[int], k: int) -> int:
-    return nums.count(k) + max(self._kadane(nums, target, k)
-                               for target in range(1, 51)
-                               if target != k)
-
-  def _kadane(self, nums: list[int], target: int, k: int) -> int:
-    """
-    Returns the maximum achievable frequency of `k` by Kakane's algorithm,
-    where each `target` in subarrays is transformed to `k`.
-    """
-    maxSum = 0
-    sum = 0
-    for num in nums:
-      if num == target:
-        sum += 1
-      elif num == k:
-        sum -= 1
-      if sum < 0:  # Reset sum if it becomes negative (Kadane's spirit).
-        sum = 0
-      maxSum = max(maxSum, sum)
-    return maxSum
diff --git a/solutions/3435. Frequencies of Shortest Supersequences/3435.cpp b/solutions/3435. Frequencies of Shortest Supersequences/3435.cpp
deleted file mode 100644
index 53ea06d2c14..00000000000
--- a/solutions/3435. Frequencies of Shortest Supersequences/3435.cpp	
+++ /dev/null
@@ -1,100 +0,0 @@
-enum class State { kInit, kVisiting, kVisited };
-
-class Solution {
- public:
-  vector<vector<int>> supersequences(vector<string>& words) {
-    vector<vector<int>> ans;
-    const vector<pair<int, int>> edges = getEdges(words);
-    const vector<int> nodes = getNodes(edges);
-    const vector<int> letterToIndex = getLetterToIndex(nodes);
-    vector<vector<int>> graph(nodes.size());
-
-    for (const auto& [u, v] : edges)
-      graph[letterToIndex[u]].push_back(letterToIndex[v]);
-
-    for (const auto& doubledSubset : getMinimumSubsets(graph)) {
-      vector<int> freq(26);
-      for (const int letter : nodes)
-        freq[letter] = 1;
-      for (const int index : doubledSubset)
-        freq[nodes[index]] = 2;
-      ans.push_back(freq);
-    }
-
-    return ans;
-  }
-
- private:
-  // Returns a list of the minimum subsets of nodes that do not create a cycle
-  // when skipped.
-  vector<vector<int>> getMinimumSubsets(const vector<vector<int>>& graph) {
-    const int n = graph.size();
-    vector<vector<int>> res;
-    for (int subsetSize = 0; subsetSize <= n; ++subsetSize) {
-      vector<bool> combination(n);
-      fill(combination.end() - subsetSize, combination.end(), true);
-      do {
-        vector<int> doubledSubset;
-        for (int i = 0; i < n; ++i)
-          if (combination[i])
-            doubledSubset.push_back(i);
-        if (!hasCycleSkipping(graph,
-                              {doubledSubset.begin(), doubledSubset.end()}))
-          res.push_back(doubledSubset);
-      } while (next_permutation(combination.begin(), combination.end()));
-      if (!res.empty())
-        return res;
-    }
-    return res;
-  }
-
-  // Returns true if there is a cycle in the `graph` when skipping any edges
-  // whose both endpoints are in `doubledSubset`.
-  bool hasCycleSkipping(const vector<vector<int>>& graph,
-                        const unordered_set<int>& doubledSubset) {
-    vector<State> states(graph.size());
-    for (int i = 0; i < graph.size(); ++i)
-      if (hasCycle(graph, i, states, doubledSubset))
-        return true;
-    return false;
-  }
-
-  bool hasCycle(const vector<vector<int>>& graph, int u, vector<State>& states,
-                const unordered_set<int>& doubledSubset) {
-    if (states[u] == State::kVisiting)
-      return true;
-    if (states[u] == State::kVisited)
-      return false;
-    states[u] = State::kVisiting;
-    if (!doubledSubset.contains(u))
-      for (const int v : graph[u])
-        if (!doubledSubset.contains(v) &&
-            hasCycle(graph, v, states, doubledSubset))
-          return true;
-    states[u] = State::kVisited;
-    return false;
-  }
-
-  vector<pair<int, int>> getEdges(const vector<string>& words) {
-    vector<pair<int, int>> edges;
-    for (const string& word : words)
-      edges.push_back({word[0] - 'a', word[1] - 'a'});
-    return edges;
-  }
-
-  vector<int> getNodes(const vector<pair<int, int>>& edges) {
-    set<int> nodes;
-    for (const auto& [u, v] : edges) {
-      nodes.insert(u);
-      nodes.insert(v);
-    }
-    return {nodes.begin(), nodes.end()};
-  }
-
-  vector<int> getLetterToIndex(const vector<int>& nodes) {
-    vector<int> letterToIndex(26);
-    for (int i = 0; i < nodes.size(); ++i)
-      letterToIndex[nodes[i]] = i;
-    return letterToIndex;
-  }
-};
diff --git a/solutions/3435. Frequencies of Shortest Supersequences/3435.java b/solutions/3435. Frequencies of Shortest Supersequences/3435.java
deleted file mode 100644
index 370668d3c6e..00000000000
--- a/solutions/3435. Frequencies of Shortest Supersequences/3435.java	
+++ /dev/null
@@ -1,140 +0,0 @@
-enum State { INIT, VISITING, VISITED }
-
-class Solution {
-  public List<List<Integer>> supersequences(String[] words) {
-    List<List<Integer>> ans = new ArrayList<>();
-    List<int[]> edges = getEdges(words);
-    List<Integer> nodes = getNodes(edges);
-    int[] letterToIndex = getLetterToIndex(nodes);
-    List<Integer>[] graph = new List[nodes.size()];
-
-    for (int i = 0; i < nodes.size(); i++)
-      graph[i] = new ArrayList<>();
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      graph[letterToIndex[u]].add(letterToIndex[v]);
-    }
-
-    for (List<Integer> doubledSubset : getMinimumSubsets(graph)) {
-      int[] freq = new int[26];
-      for (final int letter : nodes)
-        freq[letter] = 1;
-      for (final int index : doubledSubset)
-        freq[nodes.get(index)] = 2;
-      ans.add(Arrays.stream(freq).boxed().collect(Collectors.toList()));
-    }
-
-    return ans;
-  }
-
-  // Returns a list of the minimum subsets of nodes that do not create a cycle
-  // when skipped.
-  private List<List<Integer>> getMinimumSubsets(List<Integer>[] graph) {
-    final int n = graph.length;
-    List<List<Integer>> res = new ArrayList<>();
-
-    for (int subsetSize = 0; subsetSize <= n; ++subsetSize) {
-      boolean[] combination = new boolean[n];
-      Arrays.fill(combination, n - subsetSize, n, true);
-      do {
-        List<Integer> doubledSubset = new ArrayList<>();
-        for (int i = 0; i < n; i++)
-          if (combination[i])
-            doubledSubset.add(i);
-        if (!hasCycleSkipping(graph, new HashSet<>(doubledSubset)))
-          res.add(doubledSubset);
-      } while (nextPermutation(combination));
-      if (!res.isEmpty())
-        return res;
-    }
-    return res;
-  }
-
-  // Returns true if there is a cycle in the `graph` when skipping any edges
-  // whose both endpoints are in `doubledSubset`.
-  private boolean hasCycleSkipping(List<Integer>[] graph, Set<Integer> doubledSubset) {
-    State[] states = new State[graph.length];
-    for (int i = 0; i < graph.length; ++i)
-      if (hasCycle(graph, i, states, doubledSubset))
-        return true;
-    return false;
-  }
-
-  private boolean hasCycle(List<Integer>[] graph, int u, State[] states,
-                           Set<Integer> doubledSubset) {
-    if (states[u] == State.VISITING)
-      return true;
-    if (states[u] == State.VISITED)
-      return false;
-    states[u] = State.VISITING;
-    if (!doubledSubset.contains(u))
-      for (final int v : graph[u])
-        if (!doubledSubset.contains(v) && hasCycle(graph, v, states, doubledSubset))
-          return true;
-    states[u] = State.VISITED;
-    return false;
-  }
-
-  private List<int[]> getEdges(String[] words) {
-    List<int[]> edges = new ArrayList<>();
-    for (final String word : words)
-      edges.add(new int[] {word.charAt(0) - 'a', word.charAt(1) - 'a'});
-    return edges;
-  }
-
-  private List<Integer> getNodes(List<int[]> edges) {
-    TreeSet<Integer> nodes = new TreeSet<>();
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      nodes.add(u);
-      nodes.add(v);
-    }
-    return new ArrayList<>(nodes);
-  }
-
-  private int[] getLetterToIndex(List<Integer> nodes) {
-    int[] letterToIndex = new int[26];
-    for (int i = 0; i < nodes.size(); ++i)
-      letterToIndex[nodes.get(i)] = i;
-    return letterToIndex;
-  }
-
-  private boolean nextPermutation(boolean[] arr) {
-    final int n = arr.length;
-
-    // From back to front, find the first false followed by true
-    int i;
-    for (i = n - 2; i >= 0; --i)
-      if (!arr[i] && arr[i + 1])
-        break;
-
-    // If no such pair found, we've reached the last permutation
-    if (i < 0)
-      return false;
-
-    // From back to front, find the first true to swap with arr[i].
-    for (int j = n - 1; j > i; --j)
-      if (arr[j] && !arr[i]) {
-        swap(arr, i, j);
-        break;
-      }
-
-    // Reverse arr[i + 1..n - 1].
-    reverse(arr, i + 1, n - 1);
-    return true;
-  }
-
-  private void reverse(boolean[] arr, int l, int r) {
-    while (l < r)
-      swap(arr, l++, r--);
-  }
-
-  private void swap(boolean[] arr, int i, int j) {
-    boolean temp = arr[i];
-    arr[i] = arr[j];
-    arr[j] = temp;
-  }
-}
diff --git a/solutions/3435. Frequencies of Shortest Supersequences/3435.py b/solutions/3435. Frequencies of Shortest Supersequences/3435.py
deleted file mode 100644
index 14625bff66a..00000000000
--- a/solutions/3435. Frequencies of Shortest Supersequences/3435.py	
+++ /dev/null
@@ -1,74 +0,0 @@
-from enum import Enum
-
-
-class State(Enum):
-  INIT = 0
-  VISITING = 1
-  VISITED = 2
-
-
-class Solution:
-  def supersequences(self, words: list[str]) -> list[list[int]]:
-    ans = []
-    edges = [(string.ascii_lowercase.index(words[0]),
-              string.ascii_lowercase.index(words[1]))
-             for words in words]
-    nodes = sorted({u for u, _ in edges} | {v for _, v in edges})
-    letterToIndex = {letter: i for i, letter in enumerate(nodes)}
-    graph = [[] for _ in range(len(nodes))]
-
-    for u, v in edges:
-      graph[letterToIndex[u]].append(letterToIndex[v])
-
-    for doubledSubset in self._getMinimumSubsets(graph):
-      freq = [0] * 26
-      for letter in nodes:
-        freq[letter] = 1
-      for index in doubledSubset:
-        freq[nodes[index]] = 2
-      ans.append(freq)
-
-    return ans
-
-  def _getMinimumSubsets(self, graph: list[list[int]]) -> list[tuple[int]]:
-    """
-    Returns a list of the minimum subsets of nodes that do not create a cycle
-    when skipped.
-    """
-    n = len(graph)
-    for subsetSize in range(n + 1):
-      doubleSubsets = []
-      for doubledSubset in itertools.combinations(range(n), subsetSize):
-        if not self._hasCycleSkipping(graph, set(doubledSubset)):
-          doubleSubsets.append(doubledSubset)
-      if doubleSubsets:
-        return doubleSubsets
-    return []
-
-  def _hasCycleSkipping(
-      self,
-      graph: list[list[int]],
-      doubledSubset: set[int]
-  ) -> bool:
-    """
-    Returns True if there is a cycle in the `graph` when skipping any edges
-    whose both endpoints are in `doubledSubset`.
-    """
-    states = [State.INIT] * len(graph)
-
-    def hasCycle(u: int) -> bool:
-      if states[u] == State.VISITING:
-        return True
-      if states[u] == State.VISITED:
-        return False
-      states[u] = State.VISITING
-      if u not in doubledSubset:
-        for v in graph[u]:
-          if v in doubledSubset:
-            continue
-          if hasCycle(v):
-            return True
-      states[u] = State.VISITED
-      return False
-
-    return any(hasCycle(i) for i in range(len(graph)))
diff --git a/solutions/3436. Find Valid Emails/3436.sql b/solutions/3436. Find Valid Emails/3436.sql
deleted file mode 100644
index 5050f0d885b..00000000000
--- a/solutions/3436. Find Valid Emails/3436.sql	
+++ /dev/null
@@ -1,4 +0,0 @@
-SELECT user_id, email
-FROM Users
-WHERE email REGEXP '^[A-Za-z0-9_]+@[A-Za-z]+\.com$'
-ORDER BY 1;
diff --git a/solutions/3437. Permutations III/3437.cpp b/solutions/3437. Permutations III/3437.cpp
deleted file mode 100644
index 944a75ada9f..00000000000
--- a/solutions/3437. Permutations III/3437.cpp	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
- public:
-  vector<vector<int>> permute(int n) {
-    vector<vector<int>> ans;
-    dfs(n, vector<bool>(n + 1), {}, ans);
-    return ans;
-  }
-
- private:
-  void dfs(int n, vector<bool>&& used, vector<int>&& path,
-           vector<vector<int>>& ans) {
-    if (path.size() == n) {
-      ans.push_back(path);
-      return;
-    }
-    for (int num = 1; num <= n; ++num) {
-      if (used[num])
-        continue;
-      if (!path.empty() && path.back() % 2 == num % 2)
-        continue;
-      used[num] = true;
-      path.push_back(num);
-      dfs(n, std::move(used), std::move(path), ans);
-      path.pop_back();
-      used[num] = false;
-    }
-  }
-};
diff --git a/solutions/3437. Permutations III/3437.java b/solutions/3437. Permutations III/3437.java
deleted file mode 100644
index 5fed5a85caa..00000000000
--- a/solutions/3437. Permutations III/3437.java	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
-  public int[][] permute(int n) {
-    List<List<Integer>> ans = new ArrayList<>();
-    dfs(n, new boolean[n + 1], new ArrayList<>(), ans);
-    return ans.stream()
-        .map(A -> A.stream().mapToInt(Integer::intValue).toArray())
-        .toArray(int[][] ::new);
-  }
-
-  private void dfs(int n, boolean[] used, List<Integer> path, List<List<Integer>> ans) {
-    if (path.size() == n) {
-      ans.add(new ArrayList<>(path));
-      return;
-    }
-
-    for (int num = 1; num <= n; ++num) {
-      if (used[num])
-        continue;
-      if (!path.isEmpty() && path.get(path.size() - 1) % 2 == num % 2)
-        continue;
-      used[num] = true;
-      path.add(num);
-      dfs(n, used, path, ans);
-      path.remove(path.size() - 1);
-      used[num] = false;
-    }
-  }
-}
diff --git a/solutions/3437. Permutations III/3437.py b/solutions/3437. Permutations III/3437.py
deleted file mode 100644
index 6170adeddb0..00000000000
--- a/solutions/3437. Permutations III/3437.py	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution:
-  def permute(self, n: int) -> list[list[int]]:
-    ans = []
-    used = [False] * (n + 1)
-
-    def dfs(path: list[int]) -> None:
-      if len(path) == n:
-        ans.append(path.copy())
-        return
-      for num in range(1, n + 1):
-        if used[num]:
-          continue
-        if path and path[-1] % 2 == num % 2:
-          continue
-        used[num] = True
-        path.append(num)
-        dfs(path)
-        path.pop()
-        used[num] = False
-
-    dfs([])
-    return ans
diff --git a/solutions/3438. Find Valid Pair of Adjacent Digits in String/3438.cpp b/solutions/3438. Find Valid Pair of Adjacent Digits in String/3438.cpp
deleted file mode 100644
index 83846b82b3e..00000000000
--- a/solutions/3438. Find Valid Pair of Adjacent Digits in String/3438.cpp	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
- public:
-  string findValidPair(string s) {
-    vector<int> count(10);
-
-    for (const char c : s)
-      ++count[c - '0'];
-
-    for (int i = 0; i < s.length() - 1; ++i) {
-      const int a = s[i] - '0';
-      const int b = s[i + 1] - '0';
-      if (a != b && count[a] == a && count[b] == b)
-        return s.substr(i, 2);
-    }
-
-    return "";
-  }
-};
diff --git a/solutions/3438. Find Valid Pair of Adjacent Digits in String/3438.java b/solutions/3438. Find Valid Pair of Adjacent Digits in String/3438.java
deleted file mode 100644
index ab3dcb92d19..00000000000
--- a/solutions/3438. Find Valid Pair of Adjacent Digits in String/3438.java	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
-  public String findValidPair(String s) {
-    int[] count = new int[10];
-
-    for (final char c : s.toCharArray())
-      ++count[c - '0'];
-
-    for (int i = 0; i < s.length() - 1; ++i) {
-      final int a = s.charAt(i) - '0';
-      final int b = s.charAt(i + 1) - '0';
-      if (a != b && count[a] == a && count[b] == b)
-        return s.substring(i, i + 2);
-    }
-
-    return "";
-  }
-}
diff --git a/solutions/3438. Find Valid Pair of Adjacent Digits in String/3438.py b/solutions/3438. Find Valid Pair of Adjacent Digits in String/3438.py
deleted file mode 100644
index bc5c7a5cb1e..00000000000
--- a/solutions/3438. Find Valid Pair of Adjacent Digits in String/3438.py	
+++ /dev/null
@@ -1,6 +0,0 @@
-class Solution:
-  def findValidPair(self, s: str) -> str:
-    count = collections.Counter(s)
-    return next((a + b
-                for a, b in itertools.pairwise(s)
-                if a != b and count[a] == int(a) and count[b] == int(b)), '')
diff --git a/solutions/3439. Reschedule Meetings for Maximum Free Time I/3439.cpp b/solutions/3439. Reschedule Meetings for Maximum Free Time I/3439.cpp
deleted file mode 100644
index 615e2ca6a51..00000000000
--- a/solutions/3439. Reschedule Meetings for Maximum Free Time I/3439.cpp	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution {
- public:
-  int maxFreeTime(int eventTime, int k, vector<int>& startTime,
-                  vector<int>& endTime) {
-    const vector<int> gaps = getGaps(eventTime, startTime, endTime);
-    int windowSum = accumulate(gaps.begin(), gaps.begin() + k + 1, 0);
-    int ans = windowSum;
-
-    for (int i = k + 1; i < gaps.size(); ++i) {
-      windowSum += gaps[i] - gaps[i - k - 1];
-      ans = max(ans, windowSum);
-    }
-
-    return ans;
-  }
-
- private:
-  vector<int> getGaps(int eventTime, const vector<int>& startTime,
-                      const vector<int>& endTime) {
-    vector<int> gaps{startTime[0]};
-    for (int i = 1; i < startTime.size(); ++i)
-      gaps.push_back(startTime[i] - endTime[i - 1]);
-    gaps.push_back(eventTime - endTime.back());
-    return gaps;
-  }
-};
diff --git a/solutions/3439. Reschedule Meetings for Maximum Free Time I/3439.java b/solutions/3439. Reschedule Meetings for Maximum Free Time I/3439.java
deleted file mode 100644
index f376dfc2f22..00000000000
--- a/solutions/3439. Reschedule Meetings for Maximum Free Time I/3439.java	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
-  public int maxFreeTime(int eventTime, int k, int[] startTime, int[] endTime) {
-    int[] gaps = getGaps(eventTime, startTime, endTime);
-    int windowSum = Arrays.stream(gaps, 0, k + 1).sum();
-    int ans = windowSum;
-
-    for (int i = k + 1; i < gaps.length; i++) {
-      windowSum += gaps[i] - gaps[i - k - 1];
-      ans = Math.max(ans, windowSum);
-    }
-
-    return ans;
-  }
-
-  private int[] getGaps(int eventTime, int[] startTime, int[] endTime) {
-    int[] gaps = new int[startTime.length + 1];
-    gaps[0] = startTime[0];
-    for (int i = 1; i < startTime.length; ++i)
-      gaps[i] = startTime[i] - endTime[i - 1];
-    gaps[startTime.length] = eventTime - endTime[endTime.length - 1];
-    return gaps;
-  }
-}
diff --git a/solutions/3439. Reschedule Meetings for Maximum Free Time I/3439.py b/solutions/3439. Reschedule Meetings for Maximum Free Time I/3439.py
deleted file mode 100644
index d63cd8e6ddf..00000000000
--- a/solutions/3439. Reschedule Meetings for Maximum Free Time I/3439.py	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution:
-  def maxFreeTime(
-      self,
-      eventTime: int,
-      k: int,
-      startTime: list[int],
-      endTime: list[int]
-  ) -> int:
-    gaps = ([startTime[0]] +
-            [startTime[i] - endTime[i - 1] for i in range(1, len(startTime))] +
-            [eventTime - endTime[-1]])
-    windowSum = sum(gaps[:k + 1])
-    ans = windowSum
-
-    for i in range(k + 1, len(gaps)):
-      windowSum += gaps[i] - gaps[i - k - 1]
-      ans = max(ans, windowSum)
-
-    return ans
diff --git a/solutions/344. Reverse String/344.py b/solutions/344. Reverse String/344.py
index a90e9f5cdf1..11591ed589b 100644
--- a/solutions/344. Reverse String/344.py	
+++ b/solutions/344. Reverse String/344.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def reverseString(self, s: list[str]) -> None:
+  def reverseString(self, s: List[str]) -> None:
     l = 0
     r = len(s) - 1
 
diff --git a/solutions/3440. Reschedule Meetings for Maximum Free Time II/3440.cpp b/solutions/3440. Reschedule Meetings for Maximum Free Time II/3440.cpp
deleted file mode 100644
index e1156077eee..00000000000
--- a/solutions/3440. Reschedule Meetings for Maximum Free Time II/3440.cpp	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
- public:
-  int maxFreeTime(int eventTime, vector<int>& startTime, vector<int>& endTime) {
-    const int n = startTime.size();
-    const vector<int> gaps = getGaps(eventTime, startTime, endTime);
-    int ans = 0;
-    vector<int> maxLeft(n + 1);   // maxLeft[i] := max(gaps[0..i])
-    vector<int> maxRight(n + 1);  // maxRight[i] := max(gaps[i..n])
-
-    maxLeft[0] = gaps[0];
-    maxRight[n] = gaps[n];
-
-    for (int i = 1; i < n + 1; ++i)
-      maxLeft[i] = max(gaps[i], maxLeft[i - 1]);
-
-    for (int i = n - 1; i >= 0; --i)
-      maxRight[i] = max(gaps[i], maxRight[i + 1]);
-
-    for (int i = 0; i < n; ++i) {
-      const int currMeetingTime = endTime[i] - startTime[i];
-      const int adjacentGapsSum = gaps[i] + gaps[i + 1];
-      const bool canMoveMeeting =
-          currMeetingTime <= max(i > 0 ? maxLeft[i - 1] : 0,  //
-                                 i + 2 < n + 1 ? maxRight[i + 2] : 0);
-      ans = max(ans, adjacentGapsSum + (canMoveMeeting ? currMeetingTime : 0));
-    }
-
-    return ans;
-  }
-
- private:
-  vector<int> getGaps(int eventTime, const vector<int>& startTime,
-                      const vector<int>& endTime) {
-    vector<int> gaps{startTime[0]};
-    for (int i = 1; i < startTime.size(); ++i)
-      gaps.push_back(startTime[i] - endTime[i - 1]);
-    gaps.push_back(eventTime - endTime.back());
-    return gaps;
-  }
-};
diff --git a/solutions/3440. Reschedule Meetings for Maximum Free Time II/3440.java b/solutions/3440. Reschedule Meetings for Maximum Free Time II/3440.java
deleted file mode 100644
index 13f1d5a82bc..00000000000
--- a/solutions/3440. Reschedule Meetings for Maximum Free Time II/3440.java	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
-  public int maxFreeTime(int eventTime, int[] startTime, int[] endTime) {
-    final int n = startTime.length;
-    final int[] gaps = getGaps(eventTime, startTime, endTime);
-    int ans = 0;
-    int[] maxLeft = new int[n + 1];  // maxLeft[i] := max(gaps[0..i])
-    int[] maxRight = new int[n + 1]; // maxRight[i] := max(gaps[i..n])
-
-    maxLeft[0] = gaps[0];
-    maxRight[n] = gaps[n];
-
-    for (int i = 1; i < n + 1; ++i)
-      maxLeft[i] = Math.max(gaps[i], maxLeft[i - 1]);
-
-    for (int i = n - 1; i >= 0; --i)
-      maxRight[i] = Math.max(gaps[i], maxRight[i + 1]);
-
-    for (int i = 0; i < n; ++i) {
-      final int currMeetingTime = endTime[i] - startTime[i];
-      final int adjacentGapsSum = gaps[i] + gaps[i + 1];
-      final boolean canMoveMeeting =
-          currMeetingTime <= Math.max(i > 0 ? maxLeft[i - 1] : 0, //
-                                      i + 2 < n + 1 ? maxRight[i + 2] : 0);
-      ans = Math.max(ans, adjacentGapsSum + (canMoveMeeting ? currMeetingTime : 0));
-    }
-
-    return ans;
-  }
-
-  private int[] getGaps(int eventTime, int[] startTime, int[] endTime) {
-    int[] gaps = new int[startTime.length + 1];
-    gaps[0] = startTime[0];
-    for (int i = 1; i < startTime.length; ++i)
-      gaps[i] = startTime[i] - endTime[i - 1];
-    gaps[startTime.length] = eventTime - endTime[endTime.length - 1];
-    return gaps;
-  }
-}
diff --git a/solutions/3440. Reschedule Meetings for Maximum Free Time II/3440.py b/solutions/3440. Reschedule Meetings for Maximum Free Time II/3440.py
deleted file mode 100644
index 1d4270be266..00000000000
--- a/solutions/3440. Reschedule Meetings for Maximum Free Time II/3440.py	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution:
-  def maxFreeTime(
-      self,
-      eventTime: int,
-      startTime: list[int],
-      endTime: list[int]
-  ) -> int:
-    n = len(startTime)
-    gaps = ([startTime[0]] +
-            [startTime[i] - endTime[i - 1] for i in range(1, len(startTime))] +
-            [eventTime - endTime[-1]])
-    ans = 0
-    maxLeft = [gaps[0]] + [0] * n  # maxLeft[i] := max(gaps[0..i])
-    maxRight = [0] * n + [gaps[n]]  # maxRight[i] := max(gaps[i..n])
-
-    for i in range(1, n + 1):
-      maxLeft[i] = max(gaps[i], maxLeft[i - 1])
-
-    for i in range(n - 1, -1, -1):
-      maxRight[i] = max(gaps[i], maxRight[i + 1])
-
-    for i, (start, end) in enumerate(zip(startTime, endTime)):
-      currMeetingTime = end - start
-      adjacentGapsSum = gaps[i] + gaps[i + 1]
-      canMoveMeeting = currMeetingTime <= max(
-          maxLeft[i - 1] if i > 0 else 0,
-          maxRight[i + 2] if i + 2 < n + 1 else 0
-      )
-      ans = max(ans, adjacentGapsSum +
-                (currMeetingTime if canMoveMeeting else 0))
-
-    return ans
diff --git a/solutions/3441. Minimum Cost Good Caption/3441.cpp b/solutions/3441. Minimum Cost Good Caption/3441.cpp
deleted file mode 100644
index 5cbfff27c51..00000000000
--- a/solutions/3441. Minimum Cost Good Caption/3441.cpp	
+++ /dev/null
@@ -1,80 +0,0 @@
-class Solution {
- public:
-  string minCostGoodCaption(string caption) {
-    const int n = caption.length();
-    if (n < 3)
-      return "";
-
-    constexpr int kMaxCost = 1'000'000'000;
-    // dp[i][j][k] := the minimum cost of caption[i..n - 1], where j is the last
-    // letter used, and k is the count of consecutive letters
-    vector<vector<vector<int>>> dp(
-        n, vector<vector<int>>(26, vector<int>(3, kMaxCost)));
-
-    for (char c = 'a'; c <= 'z'; ++c)
-      dp[n - 1][c - 'a'][0] = abs(caption[n - 1] - c);
-
-    int minCost = kMaxCost;
-    for (int i = n - 2; i >= 0; --i) {
-      int newMinCost = kMaxCost;
-      for (char c = 'a'; c <= 'z'; ++c) {
-        const int j = c - 'a';
-        const int changeCost = abs(caption[i] - c);
-        dp[i][j][0] = changeCost + minCost;
-        dp[i][j][1] = changeCost + dp[i + 1][j][0];
-        dp[i][j][2] = changeCost + min(dp[i + 1][j][1], dp[i + 1][j][2]);
-        newMinCost = min(newMinCost, dp[i][j][2]);
-      }
-      minCost = newMinCost;
-    }
-
-    // Reconstruct the string.
-    string ans;
-    int cost = kMaxCost;
-    int letter = -1;
-
-    // Find the initial best letter.
-    for (int c = 25; c >= 0; --c)
-      if (dp[0][c][2] <= cost) {
-        letter = c;
-        cost = dp[0][c][2];
-      }
-
-    // Add the initial triplet.
-    cost -= appendLetter(caption, 0, 'a' + letter, ans);
-    cost -= appendLetter(caption, 1, 'a' + letter, ans);
-    cost -= appendLetter(caption, 2, 'a' + letter, ans);
-
-    // Build the rest of the string.
-    for (int i = 3; i < n;) {
-      // Check if we should switch to a new letter.
-      const int nextLetter = getNextLetter(dp, i, cost);
-      if (nextLetter < letter || ranges::min(dp[i][letter]) > cost) {
-        letter = nextLetter;
-        cost -= appendLetter(caption, i, 'a' + letter, ans);
-        cost -= appendLetter(caption, i + 1, 'a' + letter, ans);
-        cost -= appendLetter(caption, i + 2, 'a' + letter, ans);
-        i += 3;
-      } else {
-        cost -= appendLetter(caption, i, 'a' + letter, ans);
-        i += 1;
-      }
-    }
-
-    return ans;
-  }
-
- private:
-  int getNextLetter(const vector<vector<vector<int>>>& dp, int i, int cost) {
-    int nextLetter = 26;  // invalid letter as the sentinel
-    for (int c = 25; c >= 0; --c)
-      if (cost == dp[i][c][2])
-        nextLetter = c;
-    return nextLetter;
-  }
-
-  int appendLetter(const string& caption, int i, char letter, string& ans) {
-    ans += letter;
-    return abs(caption[i] - letter);
-  }
-};
diff --git a/solutions/3441. Minimum Cost Good Caption/3441.java b/solutions/3441. Minimum Cost Good Caption/3441.java
deleted file mode 100644
index 8c4736ce985..00000000000
--- a/solutions/3441. Minimum Cost Good Caption/3441.java	
+++ /dev/null
@@ -1,77 +0,0 @@
-class Solution {
-  public String minCostGoodCaption(String caption) {
-    final int n = caption.length();
-    if (n < 3)
-      return "";
-
-    final int MAX_COST = 1_000_000_000;
-    int[][][] dp = new int[n][26][3];
-    Arrays.stream(dp).forEach(A -> Arrays.stream(A).forEach(B -> Arrays.fill(B, MAX_COST)));
-    // dp[i][j][k] := the minimum cost of caption[i..n - 1], where j is the last
-    // letter used, and k is the count of consecutive letters
-    for (char c = 'a'; c <= 'z'; ++c)
-      dp[n - 1][c - 'a'][0] = Math.abs(caption.charAt(n - 1) - c);
-
-    int minCost = MAX_COST;
-    for (int i = n - 2; i >= 0; --i) {
-      int newMinCost = MAX_COST;
-      for (char c = 'a'; c <= 'z'; ++c) {
-        final int j = c - 'a';
-        final int changeCost = Math.abs(caption.charAt(i) - c);
-        dp[i][j][0] = changeCost + minCost;
-        dp[i][j][1] = changeCost + dp[i + 1][j][0];
-        dp[i][j][2] = changeCost + Math.min(dp[i + 1][j][1], dp[i + 1][j][2]);
-        newMinCost = Math.min(newMinCost, dp[i][j][2]);
-      }
-      minCost = newMinCost;
-    }
-
-    // Reconstruct the string.
-    StringBuilder sb = new StringBuilder();
-    int cost = MAX_COST;
-    int letter = -1;
-
-    // Find the initial best letter.
-    for (int c = 25; c >= 0; --c)
-      if (dp[0][c][2] <= cost) {
-        letter = c;
-        cost = dp[0][c][2];
-      }
-
-    // Add the initial triplet.
-    cost -= appendLetter(caption, 0, (char) ('a' + letter), sb);
-    cost -= appendLetter(caption, 1, (char) ('a' + letter), sb);
-    cost -= appendLetter(caption, 2, (char) ('a' + letter), sb);
-
-    // Build the rest of the string.
-    for (int i = 3; i < n;) {
-      // Check if we should switch to a new letter.
-      final int nextLetter = getNextLetter(dp, i, cost);
-      if (nextLetter < letter || Arrays.stream(dp[i][letter]).min().getAsInt() > cost) {
-        letter = nextLetter;
-        cost -= appendLetter(caption, i, (char) ('a' + letter), sb);
-        cost -= appendLetter(caption, i + 1, (char) ('a' + letter), sb);
-        cost -= appendLetter(caption, i + 2, (char) ('a' + letter), sb);
-        i += 3;
-      } else {
-        cost -= appendLetter(caption, i, (char) ('a' + letter), sb);
-        i += 1;
-      }
-    }
-
-    return sb.toString();
-  }
-
-  private int getNextLetter(int[][][] dp, int i, int cost) {
-    int nextLetter = 26;
-    for (int c = 25; c >= 0; --c)
-      if (cost == dp[i][c][2])
-        nextLetter = c;
-    return nextLetter;
-  }
-
-  private int appendLetter(String caption, int i, char letter, StringBuilder sb) {
-    sb.append(letter);
-    return Math.abs(caption.charAt(i) - letter);
-  }
-}
diff --git a/solutions/3441. Minimum Cost Good Caption/3441.py b/solutions/3441. Minimum Cost Good Caption/3441.py
deleted file mode 100644
index f716d511c35..00000000000
--- a/solutions/3441. Minimum Cost Good Caption/3441.py	
+++ /dev/null
@@ -1,75 +0,0 @@
-class Solution:
-
-  def minCostGoodCaption(self, caption: str) -> str:
-    n = len(caption)
-    if n < 3:
-      return ''
-
-    MAX_COST = 1_000_000_000
-    # dp[i][j][k] := the minimum cost of caption[i..n - 1], where j is the last
-    # letter used, and k is the count of consecutive letters
-    dp = [[[MAX_COST] * 3 for _ in range(26)] for _ in range(n)]
-
-    for c in range(26):
-      dp[-1][c][0] = abs(string.ascii_lowercase.index(caption[-1]) - c)
-
-    minCost = MAX_COST
-
-    for i in range(n - 2, -1, -1):
-      newMinCost = MAX_COST
-      for c in range(26):
-        changeCost = abs(string.ascii_lowercase.index(caption[i]) - c)
-        dp[i][c][0] = changeCost + minCost
-        dp[i][c][1] = changeCost + dp[i + 1][c][0]
-        dp[i][c][2] = changeCost + min(dp[i + 1][c][1], dp[i + 1][c][2])
-        newMinCost = min(newMinCost, dp[i][c][2])
-      minCost = newMinCost
-
-    # Reconstruct the string.
-    ans = []
-    cost = MAX_COST
-    letter = -1
-
-    # Find the initial best letter.
-    for c in range(25, -1, -1):
-      if dp[0][c][2] <= cost:
-        letter = c
-        cost = dp[0][c][2]
-
-    # Add the initial triplet.
-    cost -= self._appendLetter(caption, 0, chr(ord('a') + letter), ans)
-    cost -= self._appendLetter(caption, 1, chr(ord('a') + letter), ans)
-    cost -= self._appendLetter(caption, 2, chr(ord('a') + letter), ans)
-
-    # Build the rest of the string.
-    i = 3
-    while i < n:
-      nextLetter = self._getNextLetter(dp, i, cost)
-      if nextLetter < letter or min(dp[i][letter]) > cost:
-        letter = nextLetter
-        cost -= self._appendLetter(caption, i, chr(ord('a') + letter), ans)
-        cost -= self._appendLetter(caption, i + 1, chr(ord('a') + letter), ans)
-        cost -= self._appendLetter(caption, i + 2, chr(ord('a') + letter), ans)
-        i += 3
-      else:
-        cost -= self._appendLetter(caption, i, chr(ord('a') + letter), ans)
-        i += 1
-
-    return ''.join(ans)
-
-  def _getNextLetter(self, dp: list[list[list[int]]], i: int, cost: int) -> int:
-    nextLetter = 26
-    for c in range(25, -1, -1):
-      if cost == dp[i][c][2]:
-        nextLetter = c
-    return nextLetter
-
-  def _appendLetter(
-      self,
-      caption: str,
-      i: int,
-      letter: str,
-      ans: list[str]
-  ) -> int:
-    ans.append(letter)
-    return abs(ord(caption[i]) - ord(letter))
diff --git a/solutions/3442. Maximum Difference Between Even and Odd Frequency I/3442.cpp b/solutions/3442. Maximum Difference Between Even and Odd Frequency I/3442.cpp
deleted file mode 100644
index 711672daa03..00000000000
--- a/solutions/3442. Maximum Difference Between Even and Odd Frequency I/3442.cpp	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
- public:
-  int maxDifference(string s) {
-    vector<int> count(26);
-    int maxOdd = 0;
-    int minEven = s.length();
-
-    for (const char c : s)
-      ++count[c - 'a'];
-
-    for (const int freq : count) {
-      if (freq == 0)
-        continue;
-      if (freq % 2 == 0)
-        minEven = min(minEven, freq);
-      else
-        maxOdd = max(maxOdd, freq);
-    }
-
-    return maxOdd - minEven;
-  }
-};
diff --git a/solutions/3442. Maximum Difference Between Even and Odd Frequency I/3442.java b/solutions/3442. Maximum Difference Between Even and Odd Frequency I/3442.java
deleted file mode 100644
index 669706fef14..00000000000
--- a/solutions/3442. Maximum Difference Between Even and Odd Frequency I/3442.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public int maxDifference(String s) {
-    int[] count = new int[26];
-    int maxOdd = 0;
-    int minEven = s.length();
-
-    for (final char c : s.toCharArray())
-      ++count[c - 'a'];
-
-    for (final int freq : count) {
-      if (freq == 0)
-        continue;
-      if (freq % 2 == 0)
-        minEven = Math.min(minEven, freq);
-      else
-        maxOdd = Math.max(maxOdd, freq);
-    }
-
-    return maxOdd - minEven;
-  }
-}
diff --git a/solutions/3442. Maximum Difference Between Even and Odd Frequency I/3442.py b/solutions/3442. Maximum Difference Between Even and Odd Frequency I/3442.py
deleted file mode 100644
index 262d99833c2..00000000000
--- a/solutions/3442. Maximum Difference Between Even and Odd Frequency I/3442.py	
+++ /dev/null
@@ -1,8 +0,0 @@
-class Solution:
-  def maxDifference(self, s: str) -> int:
-    count = collections.Counter(s)
-    maxOdd = max((freq for freq in count.values()
-                  if freq % 2 == 1), default=0)
-    minEven = min((freq for freq in count.values()
-                   if freq % 2 == 0), default=len(s))
-    return maxOdd - minEven
diff --git a/solutions/3443. Maximum Manhattan Distance After K Changes/3443.cpp b/solutions/3443. Maximum Manhattan Distance After K Changes/3443.cpp
deleted file mode 100644
index 9726d9548ef..00000000000
--- a/solutions/3443. Maximum Manhattan Distance After K Changes/3443.cpp	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution {
- public:
-  int maxDistance(string s, int k) {
-    return max({flip(s, k, "NE"), flip(s, k, "NW"),  //
-                flip(s, k, "SE"), flip(s, k, "SW")});
-  }
-
- private:
-  int flip(const string& s, int k, const string& direction) {
-    int res = 0;
-    int pos = 0;
-    int opposite = 0;
-
-    for (const char c : s) {
-      if (direction.find(c) != string::npos) {
-        ++pos;
-      } else {
-        --pos;
-        ++opposite;
-      }
-      res = max(res, pos + 2 * min(k, opposite));
-    }
-
-    return res;
-  }
-};
diff --git a/solutions/3443. Maximum Manhattan Distance After K Changes/3443.java b/solutions/3443. Maximum Manhattan Distance After K Changes/3443.java
deleted file mode 100644
index e801edda6ad..00000000000
--- a/solutions/3443. Maximum Manhattan Distance After K Changes/3443.java	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
-  public int maxDistance(String s, int k) {
-    return Math.max(Math.max(flip(s, k, "NE"), flip(s, k, "NW")),
-                    Math.max(flip(s, k, "SE"), flip(s, k, "SW")));
-  }
-
-  private int flip(String s, int k, String direction) {
-    int res = 0;
-    int pos = 0;
-    int opposite = 0;
-
-    for (final char c : s.toCharArray()) {
-      if (direction.indexOf(c) >= 0) {
-        ++pos;
-      } else {
-        --pos;
-        ++opposite;
-      }
-      res = Math.max(res, pos + 2 * Math.min(k, opposite));
-    }
-
-    return res;
-  }
-}
diff --git a/solutions/3443. Maximum Manhattan Distance After K Changes/3443.py b/solutions/3443. Maximum Manhattan Distance After K Changes/3443.py
deleted file mode 100644
index 0a579496e53..00000000000
--- a/solutions/3443. Maximum Manhattan Distance After K Changes/3443.py	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution:
-  def maxDistance(self, s: str, k: int) -> int:
-    return max(self._flip(s, k, 'NE'), self._flip(s, k, 'NW'),
-               self._flip(s, k, 'SE'), self._flip(s, k, 'SW'))
-
-  def _flip(self, s: str, k: int, direction: str) -> int:
-    res = 0
-    pos = 0
-    opposite = 0
-
-    for c in s:
-      if c in direction:
-        pos += 1
-      else:
-        pos -= 1
-        opposite += 1
-      res = max(res, pos + 2 * min(k, opposite))
-
-    return res
diff --git a/solutions/3444. Minimum Increments for Target Multiples in an Array/3444.cpp b/solutions/3444. Minimum Increments for Target Multiples in an Array/3444.cpp
deleted file mode 100644
index 9da9593ecd3..00000000000
--- a/solutions/3444. Minimum Increments for Target Multiples in an Array/3444.cpp	
+++ /dev/null
@@ -1,58 +0,0 @@
-class Solution {
- public:
-  int minimumIncrements(vector<int>& nums, vector<int>& target) {
-    const int maxMask = 1 << target.size();
-    unordered_map<int, long> maskToLcm;
-
-    for (int mask = 1; mask < maxMask; ++mask) {
-      const vector<int> subset = getSubset(mask, target);
-      maskToLcm[mask] = getLcm(subset);
-    }
-
-    // dp[mask] := the minimum number of increments to make each number in the
-    // subset of target have at least one number that is a multiple in `num`,
-    // where `mask` is the bitmask of the subset of target
-    vector<long> dp(maxMask, LONG_MAX);
-    dp[0] = 0;
-
-    for (const int num : nums) {
-      // maskToCost := (mask, cost), where `mask` is the bitmask of the subset
-      // of target and `cost` is the minimum number of increments to make each
-      // number in the subset of target have at least one number that is a
-      // multiple in `num`
-      vector<pair<int, long>> maskToCost;
-      for (const auto& [mask, lcm] : maskToLcm) {
-        const int remainder = num % lcm;
-        maskToCost.emplace_back(mask, remainder == 0 ? 0 : lcm - remainder);
-      }
-      vector<long> newDp = dp;
-      for (int prevMask = 0; prevMask < maxMask; ++prevMask) {
-        if (dp[prevMask] == LONG_MAX)
-          continue;
-        for (const auto& [mask, cost] : maskToCost) {
-          const int newMask = prevMask | mask;
-          newDp[newMask] = min(newDp[newMask], dp[prevMask] + cost);
-        }
-      }
-      dp = std::move(newDp);
-    }
-
-    return dp.back() == LONG_MAX ? -1 : dp.back();
-  }
-
- private:
-  vector<int> getSubset(int mask, const vector<int>& target) {
-    vector<int> subset;
-    for (int i = 0; i < target.size(); ++i)
-      if (mask >> i & 1)
-        subset.push_back(target[i]);
-    return subset;
-  }
-
-  long getLcm(const vector<int>& nums) {
-    long res = 1;
-    for (const int num : nums)
-      res = lcm(res, num);
-    return res;
-  }
-};
diff --git a/solutions/3444. Minimum Increments for Target Multiples in an Array/3444.java b/solutions/3444. Minimum Increments for Target Multiples in an Array/3444.java
deleted file mode 100644
index 11579ee9e62..00000000000
--- a/solutions/3444. Minimum Increments for Target Multiples in an Array/3444.java	
+++ /dev/null
@@ -1,69 +0,0 @@
-class Solution {
-  public int minimumIncrements(int[] nums, int[] target) {
-    final int maxMask = 1 << target.length;
-    Map<Integer, Long> maskToLcm = new HashMap<>();
-
-    for (int mask = 1; mask < maxMask; ++mask) {
-      List<Integer> subset = getSubset(mask, target);
-      maskToLcm.put(mask, getLcm(subset));
-    }
-
-    // dp[mask] := the minimum number of increments to make each number in the
-    // subset of target have at least one number that is a multiple in `num`,
-    // where `mask` is the bitmask of the subset of target
-    long[] dp = new long[maxMask];
-    Arrays.fill(dp, Long.MAX_VALUE);
-    dp[0] = 0;
-
-    for (final int num : nums) {
-      // maskToCost := (mask, cost), where `mask` is the bitmask of the subset
-      // of target and `cost` is the minimum number of increments to make each
-      // number in the subset of target have at least one number that is a
-      // multiple in `num`
-      List<Pair<Integer, Long>> maskToCost = new ArrayList<>();
-      for (Map.Entry<Integer, Long> entry : maskToLcm.entrySet()) {
-        final int mask = entry.getKey();
-        final long lcm = entry.getValue();
-        final long remainder = num % lcm;
-        maskToCost.add(new Pair<>(mask, remainder == 0 ? 0 : lcm - remainder));
-      }
-      long[] newDp = dp.clone();
-      for (int prevMask = 0; prevMask < maxMask; ++prevMask) {
-        if (dp[prevMask] == Long.MAX_VALUE)
-          continue;
-        for (Pair<Integer, Long> pair : maskToCost) {
-          final int mask = pair.getKey();
-          final long cost = pair.getValue();
-          final int newMask = prevMask | mask;
-          newDp[newMask] = Math.min(newDp[newMask], dp[prevMask] + cost);
-        }
-      }
-      dp = newDp;
-    }
-
-    return dp[maxMask - 1] == Long.MAX_VALUE ? -1 : (int) dp[maxMask - 1];
-  }
-
-  private List<Integer> getSubset(int mask, int[] target) {
-    List<Integer> subset = new ArrayList<>();
-    for (int i = 0; i < target.length; ++i)
-      if ((mask >> i & 1) == 1)
-        subset.add(target[i]);
-    return subset;
-  }
-
-  private long getLcm(List<Integer> nums) {
-    long res = 1;
-    for (final int num : nums)
-      res = lcm(res, num);
-    return res;
-  }
-
-  private long lcm(long a, long b) {
-    return a * b / gcd(a, b);
-  }
-
-  private long gcd(long a, long b) {
-    return b == 0 ? a : gcd(b, a % b);
-  }
-}
diff --git a/solutions/3444. Minimum Increments for Target Multiples in an Array/3444.py b/solutions/3444. Minimum Increments for Target Multiples in an Array/3444.py
deleted file mode 100644
index 17d7e97b9b8..00000000000
--- a/solutions/3444. Minimum Increments for Target Multiples in an Array/3444.py	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution:
-  def minimumIncrements(self, nums: list[int], target: list[int]) -> int:
-    maxMask = 1 << len(target)
-    maskToLcm = {}
-
-    for mask in range(1, maxMask):
-      subset = [num for i, num in enumerate(target) if mask >> i & 1]
-      maskToLcm[mask] = functools.reduce(math.lcm, subset, 1)
-
-    # dp[mask] := the minimum number of increments to make each number in the
-    # subset of target have at least one number that is a multiple in `num`,
-    # where `mask` is the bitmask of the subset of target
-    dp = [math.inf] * maxMask
-    dp[0] = 0
-
-    for num in nums:
-      # maskToCost := (mask, cost), where `mask` is the bitmask of the subset
-      # of target and `cost` is the minimum number of increments to make each
-      # number in the subset of target have at least one number that is a
-      # multiple in `num`
-      maskToCost = [
-          (mask, 0 if (remainder := num % lcm) == 0 else lcm - remainder) for mask,
-          lcm in maskToLcm.items()]
-      newDp = dp[:]
-      for prevMask in range(maxMask):
-        if dp[prevMask] == float('inf'):
-          continue
-        for mask, cost in maskToCost:
-          newMask = prevMask | mask
-          newDp[newMask] = min(newDp[newMask], dp[prevMask] + cost)
-      dp = newDp
-
-    return -1 if dp[-1] == math.inf else dp[-1]
diff --git a/solutions/3445. Maximum Difference Between Even and Odd Frequency II/3445.cpp b/solutions/3445. Maximum Difference Between Even and Odd Frequency II/3445.cpp
deleted file mode 100644
index c8748e50d3c..00000000000
--- a/solutions/3445. Maximum Difference Between Even and Odd Frequency II/3445.cpp	
+++ /dev/null
@@ -1,39 +0,0 @@
-class Solution {
- public:
-  int maxDifference(string s, int k) {
-    int ans = INT_MIN;
-
-    for (const auto& [a, b] : getPermutations()) {
-      // minDiff[parityA][parityB] := min(a - b) of all valid windows with
-      // parityA and parityB
-      vector<vector<int>> minDiff(2, vector<int>(2, INT_MAX / 2));
-      vector<int> prefixA{0};  // prefixA[i] := the number of 'a's in s[0..i)
-      vector<int> prefixB{0};  // prefixB[i] := the number of 'b's in s[0..i)
-      for (int l = 0, r = 0; r < s.length(); ++r) {
-        prefixA.push_back(prefixA.back() + (s[r] == a ? 1 : 0));
-        prefixB.push_back(prefixB.back() + (s[r] == b ? 1 : 0));
-        while (r - l + 1 >= k &&               // the window size >= k
-               prefixA[l] < prefixA.back() &&  // the number of 'a's > 0
-               prefixB[l] < prefixB.back()) {  // the number of 'b's > 0
-          minDiff[prefixA[l] % 2][prefixB[l] % 2] = min(
-              minDiff[prefixA[l] % 2][prefixB[l] % 2], prefixA[l] - prefixB[l]);
-          ++l;
-        }
-        ans = max(ans, (prefixA.back() - prefixB.back()) -
-                           minDiff[1 - prefixA.back() % 2][prefixB.back() % 2]);
-      }
-    }
-
-    return ans;
-  }
-
- private:
-  vector<pair<char, char>> getPermutations() {
-    vector<pair<char, char>> permutations;
-    for (const char a : "01234")
-      for (const char b : "01234")
-        if (a != b)
-          permutations.emplace_back(a, b);
-    return permutations;
-  }
-};
diff --git a/solutions/3445. Maximum Difference Between Even and Odd Frequency II/3445.java b/solutions/3445. Maximum Difference Between Even and Odd Frequency II/3445.java
deleted file mode 100644
index 5f972ae9fb9..00000000000
--- a/solutions/3445. Maximum Difference Between Even and Odd Frequency II/3445.java	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution {
-  public int maxDifference(String s, int k) {
-    int ans = Integer.MIN_VALUE;
-
-    for (Pair<Character, Character> pair : getPermutations()) {
-      final char a = pair.getKey();
-      final char b = pair.getValue();
-
-      // minDiff[parityA][parityB] := min(a - b) of all valid windows with
-      // parityA and parityB
-      int[][] minDiff = new int[2][2];
-      Arrays.stream(minDiff).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE / 2));
-      // prefixA[i] := the number of 'a's in s[0..i)
-      List<Integer> prefixA = new ArrayList<>(List.of(0));
-      // prefixB[i] := the number of 'b's in s[0..i)
-      List<Integer> prefixB = new ArrayList<>(List.of(0));
-      for (int l = 0, r = 0; r < s.length(); ++r) {
-        prefixA.add(prefixA.get(prefixA.size() - 1) + (s.charAt(r) == a ? 1 : 0));
-        prefixB.add(prefixB.get(prefixB.size() - 1) + (s.charAt(r) == b ? 1 : 0));
-        while (r - l + 1 >= k &&                                   // the window size >= k
-               prefixA.get(l) < prefixA.get(prefixA.size() - 1) && // the number of 'a's > 0
-               prefixB.get(l) < prefixB.get(prefixB.size() - 1)) { // the number of 'b's > 0
-          minDiff[prefixA.get(l) % 2][prefixB.get(l) % 2] = Math.min(
-              minDiff[prefixA.get(l) % 2][prefixB.get(l) % 2], prefixA.get(l) - prefixB.get(l));
-          ++l;
-        }
-        ans = Math.max(ans, (prefixA.get(prefixA.size() - 1) - prefixB.get(prefixB.size() - 1)) -
-                                minDiff[1 - prefixA.get(prefixA.size() - 1) % 2]
-                                       [prefixB.get(prefixB.size() - 1) % 2]);
-      }
-    }
-
-    return ans;
-  }
-
-  private List<Pair<Character, Character>> getPermutations() {
-    List<Pair<Character, Character>> permutations = new ArrayList<>();
-    for (final char a : "01234".toCharArray())
-      for (final char b : "01234".toCharArray())
-        if (a != b)
-          permutations.add(new Pair<>(a, b));
-    return permutations;
-  }
-}
diff --git a/solutions/3445. Maximum Difference Between Even and Odd Frequency II/3445.py b/solutions/3445. Maximum Difference Between Even and Odd Frequency II/3445.py
deleted file mode 100644
index 03700c87f3a..00000000000
--- a/solutions/3445. Maximum Difference Between Even and Odd Frequency II/3445.py	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution:
-  def maxDifference(self, s: str, k: int) -> int:
-    ans = -math.inf
-    permutations = [(a, b) for a in '01234' for b in '01234' if a != b]
-
-    for a, b in permutations:
-      # minDiff[(parityA, parityB)] := min(a - b) of all valid windows with
-      # parityA and parityB
-      minDiff = collections.defaultdict(lambda: math.inf)
-      prefixA = [0]  # prefixA[i] := the number of 'a's in s[0..i)
-      prefixB = [0]  # prefixB[i] := the number of 'b's in s[0..i)
-
-      l = 0
-      for r, c in enumerate(s):
-        prefixA.append(prefixA[-1] + int(c == a))
-        prefixB.append(prefixB[-1] + int(c == b))
-        while (r - l + 1 >= k and  # the window size >= k
-               prefixA[l] < prefixA[-1] and  # the number of 'a's > 0
-               prefixB[l] < prefixB[-1]):  # the number of 'b's > 0
-          paritiesKey = (prefixA[l] % 2, prefixB[l] % 2)
-          minDiff[paritiesKey] = min(minDiff[paritiesKey],
-                                     prefixA[l] - prefixB[l])
-          l += 1
-        ans = max(ans, (prefixA[-1] - prefixB[-1]) -
-                  minDiff[(1 - prefixA[-1] % 2, prefixB[-1] % 2)])
-
-    return ans
diff --git a/solutions/3446. Sort Matrix by Diagonals/3446.cpp b/solutions/3446. Sort Matrix by Diagonals/3446.cpp
deleted file mode 100644
index d084b8c5e83..00000000000
--- a/solutions/3446. Sort Matrix by Diagonals/3446.cpp	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
- public:
-  vector<vector<int>> sortMatrix(vector<vector<int>>& grid) {
-    const int n = grid.size();
-    vector<vector<int>> ans(n, vector<int>(n));
-    vector<vector<int>> diag(2 * n + 1);
-
-    for (int i = 0; i < n; ++i)
-      for (int j = 0; j < n; ++j)
-        diag[i - j + n].push_back(grid[i][j]);
-
-    for (int i = 0; i < 2 * n + 1; ++i)
-      if (i < n)
-        ranges::sort(diag[i], greater<int>());
-      else
-        ranges::sort(diag[i]);
-
-    for (int i = 0; i < n; ++i)
-      for (int j = 0; j < n; ++j)
-        ans[i][j] = diag[i - j + n].back(), diag[i - j + n].pop_back();
-
-    return ans;
-  }
-};
diff --git a/solutions/3446. Sort Matrix by Diagonals/3446.java b/solutions/3446. Sort Matrix by Diagonals/3446.java
deleted file mode 100644
index fc0321d51ba..00000000000
--- a/solutions/3446. Sort Matrix by Diagonals/3446.java	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
-  public int[][] sortMatrix(int[][] grid) {
-    final int n = grid.length;
-    int[][] ans = new int[n][n];
-    Map<Integer, List<Integer>> diag = new HashMap<>();
-
-    for (int i = 0; i < n; ++i)
-      for (int j = 0; j < n; ++j) {
-        final int key = i - j;
-        diag.putIfAbsent(key, new ArrayList<>());
-        diag.get(key).add(grid[i][j]);
-      }
-
-    for (Map.Entry<Integer, List<Integer>> entry : diag.entrySet()) {
-      List<Integer> values = entry.getValue();
-      if (entry.getKey() < 0)
-        Collections.sort(values, Collections.reverseOrder());
-      else
-        Collections.sort(values);
-    }
-
-    for (int i = 0; i < n; i++)
-      for (int j = 0; j < n; j++) {
-        final int key = i - j;
-        ans[i][j] = diag.get(key).remove(diag.get(key).size() - 1);
-      }
-
-    return ans;
-  }
-}
diff --git a/solutions/3446. Sort Matrix by Diagonals/3446.py b/solutions/3446. Sort Matrix by Diagonals/3446.py
deleted file mode 100644
index 4ffc4d39416..00000000000
--- a/solutions/3446. Sort Matrix by Diagonals/3446.py	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution:
-  def sortMatrix(self, grid: list[list[int]]) -> list[list[int]]:
-    n = len(grid)
-    ans = [[0] * n for _ in range(n)]
-    diag = collections.defaultdict(list)
-
-    for i, row in enumerate(grid):
-      for j, num in enumerate(row):
-        diag[i - j].append(num)
-
-    for key in diag:
-      diag[key].sort(reverse=key < 0)
-
-    for i in range(n):
-      for j in range(n):
-        ans[i][j] = diag[i - j].pop()
-
-    return ans
diff --git a/solutions/3447. Assign Elements to Groups with Constraints/3447.cpp b/solutions/3447. Assign Elements to Groups with Constraints/3447.cpp
deleted file mode 100644
index cbee96b916d..00000000000
--- a/solutions/3447. Assign Elements to Groups with Constraints/3447.cpp	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
- public:
-  vector<int> assignElements(vector<int>& groups, vector<int>& elements) {
-    vector<int> ans;
-    unordered_map<int, int> elementToMinIndex;
-
-    for (int i = 0; i < elements.size(); ++i)
-      if (!elementToMinIndex.contains(elements[i]))
-        elementToMinIndex[elements[i]] = i;
-
-    for (const int num : groups)
-      ans.push_back(getMinIndex(num, elementToMinIndex));
-
-    return ans;
-  }
-
- private:
-  int getMinIndex(int num, const unordered_map<int, int>& elementToMinIndex) {
-    int res = INT_MAX;
-    for (int i = 1; i * i <= num; ++i) {
-      if (num % i != 0)
-        continue;
-      if (elementToMinIndex.contains(i))
-        res = min(res, elementToMinIndex.at(i));
-      if (num / i != i && elementToMinIndex.contains(num / i))
-        res = min(res, elementToMinIndex.at(num / i));
-    }
-    return res == INT_MAX ? -1 : res;
-  }
-};
diff --git a/solutions/3447. Assign Elements to Groups with Constraints/3447.java b/solutions/3447. Assign Elements to Groups with Constraints/3447.java
deleted file mode 100644
index d41498677cd..00000000000
--- a/solutions/3447. Assign Elements to Groups with Constraints/3447.java	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution {
-  public int[] assignElements(int[] groups, int[] elements) {
-    int[] ans = new int[groups.length];
-    Map<Integer, Integer> elementToMinIndex = new HashMap<>();
-
-    for (int i = 0; i < elements.length; ++i)
-      elementToMinIndex.putIfAbsent(elements[i], i);
-
-    for (int i = 0; i < groups.length; ++i)
-      ans[i] = getMinIndex(groups[i], elementToMinIndex);
-
-    return ans;
-  }
-
-  private int getMinIndex(int num, Map<Integer, Integer> elementToMinIndex) {
-    int res = Integer.MAX_VALUE;
-    for (int i = 1; i * i <= num; ++i) {
-      if (num % i != 0)
-        continue;
-      if (elementToMinIndex.containsKey(i))
-        res = Math.min(res, elementToMinIndex.get(i));
-      if (num / i != i && elementToMinIndex.containsKey(num / i))
-        res = Math.min(res, elementToMinIndex.get(num / i));
-    }
-    return res == Integer.MAX_VALUE ? -1 : res;
-  }
-}
diff --git a/solutions/3447. Assign Elements to Groups with Constraints/3447.py b/solutions/3447. Assign Elements to Groups with Constraints/3447.py
deleted file mode 100644
index a4a967704c0..00000000000
--- a/solutions/3447. Assign Elements to Groups with Constraints/3447.py	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution:
-  def assignElements(self, groups: list[int], elements: list[int]) -> list[int]:
-    ans = []
-    elementToMinIndex = {}
-
-    for i, element in enumerate(elements):
-      if element not in elementToMinIndex:
-        elementToMinIndex[element] = i
-
-    for num in groups:
-      ans.append(self._getMinIndex(num, elementToMinIndex))
-
-    return ans
-
-  def _getMinIndex(self, num: int, elementToMinIndex: dict[int, int]) -> int:
-    res = math.inf
-    i = 1
-    while i * i <= num:
-      if num % i != 0:
-        continue
-      if i in elementToMinIndex:
-        res = min(res, elementToMinIndex[i])
-      if num // i != i and (num // i) in elementToMinIndex:
-        res = min(res, elementToMinIndex[num // i])
-      i += 1
-    return -1 if res == math.inf else res
diff --git a/solutions/3448. Count Substrings Divisible By Last Digit/3448-2.cpp b/solutions/3448. Count Substrings Divisible By Last Digit/3448-2.cpp
deleted file mode 100644
index d60381a5b2f..00000000000
--- a/solutions/3448. Count Substrings Divisible By Last Digit/3448-2.cpp	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
- public:
-  long long countSubstrings(string s) {
-    long ans = 0;
-    // dp[num][rem] := the number of substrings so far that have a remainder of
-    // `rem` when divided by `num`
-    vector<vector<int>> dp(10, vector<int>(10));
-
-    for (const char c : s) {
-      const int digit = c - '0';
-      vector<vector<int>> newDp(10, vector<int>(10));
-      for (int num = 1; num < 10; ++num) {
-        for (int rem = 0; rem < num; ++rem)
-          newDp[num][(rem * 10 + digit) % num] += dp[num][rem];
-        ++newDp[num][digit % num];
-      }
-      dp = std::move(newDp);
-      ans += dp[digit][0];
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3448. Count Substrings Divisible By Last Digit/3448-2.java b/solutions/3448. Count Substrings Divisible By Last Digit/3448-2.java
deleted file mode 100644
index 5cbe75913af..00000000000
--- a/solutions/3448. Count Substrings Divisible By Last Digit/3448-2.java	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
-  public long countSubstrings(String s) {
-    long ans = 0;
-    // dp[num][rem] := the number of substrings so far that have a remainder of
-    // `rem` when divided by `num`
-    int[][] dp = new int[10][10];
-
-    for (final char c : s.toCharArray()) {
-      final int digit = c - '0';
-      int[][] newDp = new int[10][10];
-      for (int num = 1; num < 10; ++num) {
-        for (int rem = 0; rem < num; ++rem)
-          newDp[num][(rem * 10 + digit) % num] += dp[num][rem];
-        ++newDp[num][digit % num];
-      }
-      dp = newDp;
-      ans += dp[digit][0];
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3448. Count Substrings Divisible By Last Digit/3448-2.py b/solutions/3448. Count Substrings Divisible By Last Digit/3448-2.py
deleted file mode 100644
index a3cdfe97f90..00000000000
--- a/solutions/3448. Count Substrings Divisible By Last Digit/3448-2.py	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution:
-  def countSubstrings(self, s: str) -> int:
-    ans = 0
-    # dp[num][rem] := the number of substrings so far that have a remainder of
-    # `rem` when divided by `num`
-    dp = [[0] * 10 for _ in range(10)]
-
-    for c in s:
-      digit = int(c)
-      newDp = [[0] * 10 for _ in range(10)]
-      for num in range(1, 10):
-        for rem in range(num):
-          newDp[num][(rem * 10 + digit) % num] += dp[num][rem]
-        newDp[num][digit % num] += 1
-      dp = newDp
-      ans += dp[digit][0]
-
-    return ans
diff --git a/solutions/3448. Count Substrings Divisible By Last Digit/3448.cpp b/solutions/3448. Count Substrings Divisible By Last Digit/3448.cpp
deleted file mode 100644
index 572e4ea896b..00000000000
--- a/solutions/3448. Count Substrings Divisible By Last Digit/3448.cpp	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
- public:
-  long long countSubstrings(string s) {
-    long ans = 0;
-    // dp[i][num][rem] := the number of first `i` digits of s that have a
-    // remainder of `rem` when divided by `num`
-    vector<vector<vector<int>>> dp(s.length() + 1,
-                                   vector<vector<int>>(10, vector<int>(10)));
-
-    for (int i = 1; i <= s.length(); ++i) {
-      const int digit = s[i - 1] - '0';
-      for (int num = 1; num < 10; ++num) {
-        for (int rem = 0; rem < num; ++rem)
-          dp[i][num][(rem * 10 + digit) % num] += dp[i - 1][num][rem];
-        ++dp[i][num][digit % num];
-      }
-      ans += dp[i][digit][0];
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3448. Count Substrings Divisible By Last Digit/3448.java b/solutions/3448. Count Substrings Divisible By Last Digit/3448.java
deleted file mode 100644
index da4e307a063..00000000000
--- a/solutions/3448. Count Substrings Divisible By Last Digit/3448.java	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
-  public long countSubstrings(String s) {
-    long ans = 0;
-    // dp[i][num][rem] := the number of first `i` digits of s that have a
-    // remainder of `rem` when divided by `num`
-    int[][][] dp = new int[s.length() + 1][10][10];
-
-    for (int i = 1; i <= s.length(); ++i) {
-      final int digit = s.charAt(i - 1) - '0';
-      for (int num = 1; num < 10; ++num) {
-        for (int rem = 0; rem < num; ++rem)
-          dp[i][num][(rem * 10 + digit) % num] += dp[i - 1][num][rem];
-        ++dp[i][num][digit % num];
-      }
-      ans += dp[i][digit][0];
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3448. Count Substrings Divisible By Last Digit/3448.py b/solutions/3448. Count Substrings Divisible By Last Digit/3448.py
deleted file mode 100644
index 0c7e64f9aa9..00000000000
--- a/solutions/3448. Count Substrings Divisible By Last Digit/3448.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  def countSubstrings(self, s: str) -> int:
-    ans = 0
-    # dp[i][num][rem] := the number of first `i` digits of s that have a
-    # remainder of `rem` when divided by `num`
-    dp = [[[0] * 10 for _ in range(10)] for _ in range(len(s) + 1)]
-
-    for i in range(1, len(s) + 1):
-      digit = int(s[i - 1])
-      for num in range(1, 10):
-        for rem in range(num):
-          dp[i][num][(rem * 10 + digit) % num] += dp[i - 1][num][rem]
-        dp[i][num][digit % num] += 1
-      ans += dp[i][digit][0]
-
-    return ans
diff --git a/solutions/3449. Maximize the Minimum Game Score/3449.cpp b/solutions/3449. Maximize the Minimum Game Score/3449.cpp
deleted file mode 100644
index 54a36ef73bf..00000000000
--- a/solutions/3449. Maximize the Minimum Game Score/3449.cpp	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
- public:
-  long long maxScore(vector<int>& points, int m) {
-    long l = 0;
-    long r = (m + 1L) / 2 * points[0] + 1;
-
-    while (l < r) {
-      const long mid = (l + r + 1) / 2;
-      if (isPossible(points, mid, m))
-        l = mid;
-      else
-        r = mid - 1;
-    }
-
-    return l;
-  }
-
- private:
-  // Returns true if it is possible to achieve the maximum minimum value `x`
-  // with `m` number of moves.
-  bool isPossible(const vector<int>& points, long minVal, long m) {
-    long moves = 0;
-    long prevMoves = 0;  // to track remaining moves from the previous point
-    for (int i = 0; i < points.size(); ++i) {
-      // ceil(minVal / point)
-      const long required =
-          max(0L, (minVal + points[i] - 1) / points[i] - prevMoves);
-      if (required > 0) {
-        moves += 2L * required - 1;
-        prevMoves = required - 1;
-      } else if (i + 1 < points.size()) {
-        moves += 1;
-        prevMoves = 0;
-      }
-      if (moves > m)
-        return false;
-    }
-    return true;
-  };
-};
diff --git a/solutions/3449. Maximize the Minimum Game Score/3449.java b/solutions/3449. Maximize the Minimum Game Score/3449.java
deleted file mode 100644
index f9d636b1ef3..00000000000
--- a/solutions/3449. Maximize the Minimum Game Score/3449.java	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution {
-  public long maxScore(int[] points, int m) {
-    long l = 0;
-    long r = ((long) m + 1) / 2 * points[0] + 1;
-
-    while (l < r) {
-      final long mid = (l + r + 1) / 2;
-      if (isPossible(points, mid, m))
-        l = mid;
-      else
-        r = mid - 1;
-    }
-
-    return l;
-  }
-
-  // Returns true if it is possible to achieve the maximum minimum value `x`
-  // with `m` number of moves.
-  private boolean isPossible(int[] points, long minVal, long m) {
-    long moves = 0;
-    long prevMoves = 0; // to track remaining moves from the previous point
-    for (int i = 0; i < points.length; ++i) {
-      // ceil(minVal / point)
-      final long required = Math.max(0, (minVal + points[i] - 1) / points[i] - prevMoves);
-      if (required > 0) {
-        moves += 2L * required - 1;
-        prevMoves = required - 1;
-      } else if (i + 1 < points.length) {
-        moves += 1;
-        prevMoves = 0;
-      }
-      if (moves > m)
-        return false;
-    }
-    return true;
-  }
-}
diff --git a/solutions/3449. Maximize the Minimum Game Score/3449.py b/solutions/3449. Maximize the Minimum Game Score/3449.py
deleted file mode 100644
index e1c0a28e8d6..00000000000
--- a/solutions/3449. Maximize the Minimum Game Score/3449.py	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution:
-  def maxScore(self, points: list[int], m: int) -> int:
-    def isPossible(minVal: int, m: int) -> bool:
-      """
-      Returns True if it is possible to achieve the maximum minimum value `x`
-      with `m` number of moves.
-      """
-      moves = 0
-      prevMoves = 0  # to track remaining moves from the previous point
-      for i, point in enumerate(points):
-        required = (minVal + point - 1) // point  # ceil(minVal / point)
-        required = max(0, required - prevMoves)
-        if required > 0:
-          moves += 2 * required - 1
-          prevMoves = required - 1
-        elif i + 1 < len(points):
-          moves += 1
-          prevMoves = 0
-        if moves > m:
-          return False
-      return True
-
-    l = 0
-    r = (m + 1) // 2 * points[0] + 1
-
-    while l < r:
-      mid = (l + r + 1) // 2
-      if isPossible(mid, m):
-        l = mid
-      else:
-        r = mid - 1
-
-    return l
diff --git a/solutions/345. Reverse Vowels of a String/345.py b/solutions/345. Reverse Vowels of a String/345.py
index e6a05180410..026e2532442 100644
--- a/solutions/345. Reverse Vowels of a String/345.py	
+++ b/solutions/345. Reverse Vowels of a String/345.py	
@@ -1,14 +1,14 @@
 class Solution:
   def reverseVowels(self, s: str) -> str:
     chars = list(s)
-    VOWELS = 'aeiouAEIOU'
+    kVowels = 'aeiouAEIOU'
     l = 0
     r = len(s) - 1
 
     while l < r:
-      while l < r and chars[l] not in VOWELS:
+      while l < r and chars[l] not in kVowels:
         l += 1
-      while l < r and chars[r] not in VOWELS:
+      while l < r and chars[r] not in kVowels:
         r -= 1
       chars[l], chars[r] = chars[r], chars[l]
       l += 1
diff --git a/solutions/3450. Maximum Students on a Single Bench/3450.cpp b/solutions/3450. Maximum Students on a Single Bench/3450.cpp
deleted file mode 100644
index d881f15aebc..00000000000
--- a/solutions/3450. Maximum Students on a Single Bench/3450.cpp	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
- public:
-  int maxStudentsOnBench(vector<vector<int>>& students) {
-    constexpr int kMax = 100;
-    size_t ans = 0;
-    vector<unordered_set<int>> benchToStudents(kMax + 1);
-
-    for (const vector<int>& student : students) {
-      const int studentId = student[0];
-      const int benchId = student[1];
-      benchToStudents[benchId].insert(studentId);
-    }
-
-    for (const unordered_set<int>& students : benchToStudents)
-      ans = max(ans, students.size());
-
-    return ans;
-  }
-};
diff --git a/solutions/3450. Maximum Students on a Single Bench/3450.java b/solutions/3450. Maximum Students on a Single Bench/3450.java
deleted file mode 100644
index 1dd267cd59f..00000000000
--- a/solutions/3450. Maximum Students on a Single Bench/3450.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public int maxStudentsOnBench(int[][] students) {
-    final int MAX = 100;
-    int ans = 0;
-    Set<Integer>[] benchToStudents = new Set[MAX + 1];
-
-    for (int i = 0; i <= MAX; ++i)
-      benchToStudents[i] = new HashSet<>();
-
-    for (int[] student : students) {
-      final int studentId = student[0];
-      final int benchId = student[1];
-      benchToStudents[benchId].add(studentId);
-    }
-
-    for (Set<Integer> studentsOnBench : benchToStudents)
-      ans = Math.max(ans, studentsOnBench.size());
-
-    return ans;
-  }
-}
diff --git a/solutions/3450. Maximum Students on a Single Bench/3450.py b/solutions/3450. Maximum Students on a Single Bench/3450.py
deleted file mode 100644
index 6f2f3ef84cc..00000000000
--- a/solutions/3450. Maximum Students on a Single Bench/3450.py	
+++ /dev/null
@@ -1,6 +0,0 @@
-class Solution:
-  def maxStudentsOnBench(self, students: list[list[int]]) -> int:
-    benchToStudents = collections.defaultdict(set)
-    for studentId, benchId in students:
-      benchToStudents[benchId].add(studentId)
-    return max(map(len, benchToStudents.values()), default=0)
diff --git a/solutions/3451. Find Invalid IP Addresses/3451.sql b/solutions/3451. Find Invalid IP Addresses/3451.sql
deleted file mode 100644
index c4af8469fb2..00000000000
--- a/solutions/3451. Find Invalid IP Addresses/3451.sql	
+++ /dev/null
@@ -1,13 +0,0 @@
-WITH
-  InvalidIPs AS (
-    SELECT ip
-    FROM Logs
-    WHERE
-      LENGTH(ip) - LENGTH(REPLACE(ip, '.', '')) != 3
-      OR ip REGEXP '(^|\\.)0[0-9]'
-      OR ip REGEXP '(^|\\.)([0-9]{4,}|[3-9][0-9]{2}|2[6-9][0-9]|25[6-9])(\\.|$)'
-  )
-SELECT ip, COUNT(*) AS invalid_count
-FROM InvalidIPs
-GROUP BY ip
-ORDER BY invalid_count DESC, ip DESC;
diff --git a/solutions/3452. Sum of Good Numbers/3452.cpp b/solutions/3452. Sum of Good Numbers/3452.cpp
deleted file mode 100644
index f64845daf5a..00000000000
--- a/solutions/3452. Sum of Good Numbers/3452.cpp	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
- public:
-  int sumOfGoodNumbers(vector<int>& nums, int k) {
-    const int n = nums.size();
-    int sum = 0;
-
-    for (int i = 0; i < n; ++i)
-      if ((i - k < 0 || nums[i] > nums[i - k]) &&
-          (i + k >= n || nums[i] > nums[i + k]))
-        sum += nums[i];
-
-    return sum;
-  }
-};
diff --git a/solutions/3452. Sum of Good Numbers/3452.java b/solutions/3452. Sum of Good Numbers/3452.java
deleted file mode 100644
index db905eff242..00000000000
--- a/solutions/3452. Sum of Good Numbers/3452.java	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution {
-  public int sumOfGoodNumbers(int[] nums, int k) {
-    final int n = nums.length;
-    int sum = 0;
-
-    for (int i = 0; i < n; ++i)
-      if ((i - k < 0 || nums[i] > nums[i - k]) && //
-          (i + k >= n || nums[i] > nums[i + k]))
-        sum += nums[i];
-
-    return sum;
-  }
-}
diff --git a/solutions/3452. Sum of Good Numbers/3452.py b/solutions/3452. Sum of Good Numbers/3452.py
deleted file mode 100644
index 193dafc13c0..00000000000
--- a/solutions/3452. Sum of Good Numbers/3452.py	
+++ /dev/null
@@ -1,5 +0,0 @@
-class Solution:
-  def sumOfGoodNumbers(self, nums: list[int], k: int) -> int:
-    return sum(num for i, num in enumerate(nums)
-               if (i - k < 0 or num > nums[i - k])
-               and (i + k >= len(nums) or num > nums[i + k]))
diff --git a/solutions/3453. Separate Squares I/3453.cpp b/solutions/3453. Separate Squares I/3453.cpp
deleted file mode 100644
index 33b20698014..00000000000
--- a/solutions/3453. Separate Squares I/3453.cpp	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution {
- public:
-  double separateSquares(vector<vector<int>>& squares) {
-    const double halfArea = accumulate(squares.begin(), squares.end(), 0.0,
-                                       [](double sum, vector<int>& square) {
-      return sum + static_cast<long>(square[2]) * square[2];
-    }) / 2;
-    vector<tuple<int, bool, int>> events;
-
-    for (const vector<int>& square : squares) {
-      const int y = square[1];
-      const int l = square[2];
-      events.push_back({y, true, l});       // start of square
-      events.push_back({y + l, false, l});  // end of square
-    }
-
-    ranges::sort(events);
-
-    double area = 0;
-    int width = 0;
-    int prevY = 0;
-
-    for (const auto& [y, isStart, l] : events) {
-      double areaGain = width * static_cast<long>(y - prevY);
-      if (area + areaGain >= halfArea)
-        return prevY + (halfArea - area) / width;
-      area += areaGain;
-      width += isStart ? l : -l;
-      prevY = y;
-    }
-
-    throw;
-  }
-};
diff --git a/solutions/3453. Separate Squares I/3453.java b/solutions/3453. Separate Squares I/3453.java
deleted file mode 100644
index 289d741c87f..00000000000
--- a/solutions/3453. Separate Squares I/3453.java	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution {
-  public double separateSquares(int[][] squares) {
-    final double halfArea =
-        Arrays.stream(squares).mapToDouble(square -> Math.pow(square[2], 2)).sum() / 2;
-    List<int[]> events = new ArrayList<>();
-
-    for (int[] square : squares) {
-      final int y = square[1];
-      final int l = square[2];
-      events.add(new int[] {y, 1, l});     // start of square
-      events.add(new int[] {y + l, 0, l}); // end of square
-    }
-
-    events.sort(Comparator.comparingInt(event -> event[0]));
-
-    double area = 0;
-    int width = 0;
-    int prevY = 0;
-
-    for (int[] event : events) {
-      final int y = event[0];
-      final int l = event[2];
-      final double areaGain = width * (long) (y - prevY);
-      if (area + areaGain >= halfArea)
-        return prevY + (halfArea - area) / width;
-      area += areaGain;
-      width += (event[1] == 1) ? l : -l;
-      prevY = y;
-    }
-
-    throw new IllegalArgumentException();
-  }
-}
diff --git a/solutions/3453. Separate Squares I/3453.py b/solutions/3453. Separate Squares I/3453.py
deleted file mode 100644
index 1369d83f6cc..00000000000
--- a/solutions/3453. Separate Squares I/3453.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  def separateSquares(self, squares: list[list[int]]) -> float:
-    halfArea = sum((l**2 for _, _, l in squares)) / 2
-    events = sorted([(y, True, l) for _, y, l in squares] +
-                    [(y + l, False, l) for _, y, l in squares])
-    area = 0
-    width = 0
-    prevY = 0
-
-    for y, isStart, l in events:
-      areaGain = width * (y - prevY)
-      if area + areaGain >= halfArea:
-        return prevY + (halfArea - area) / width
-      area += areaGain
-      width += l if isStart else -l
-      prevY = y
diff --git a/solutions/3454. Separate Squares II/3454.cpp b/solutions/3454. Separate Squares II/3454.cpp
deleted file mode 100644
index 63bf9033aac..00000000000
--- a/solutions/3454. Separate Squares II/3454.cpp	
+++ /dev/null
@@ -1,93 +0,0 @@
-class SegmentTree {
- public:
-  explicit SegmentTree(const vector<int>& xs)
-      : xs(xs), n(xs.size() - 1), coveredCount(4 * n), coveredWidth(4 * n) {}
-
-  // Adds val to the range [i, j].
-  void add(int i, int j, int val) {
-    add(0, 0, n - 1, i, j, val);
-  }
-
-  // Returns the covered width of xs[0..n - 1].
-  int getCoveredWidth() const {
-    return coveredWidth[0];
-  }
-
- private:
-  const int n;  // the number of segments (|xs| - 1)
-  vector<int> xs;
-  vector<int> coveredCount;
-  vector<int> coveredWidth;
-
-  void add(int treeIndex, int lo, int hi, int i, int j, int val) {
-    if (j <= xs[lo] || xs[hi + 1] <= i)
-      return;
-    if (i <= xs[lo] && xs[hi + 1] <= j) {
-      coveredCount[treeIndex] += val;
-    } else {
-      const int mid = (lo + hi) / 2;
-      add(2 * treeIndex + 1, lo, mid, i, j, val);
-      add(2 * treeIndex + 2, mid + 1, hi, i, j, val);
-    }
-    if (coveredCount[treeIndex] > 0) {
-      coveredWidth[treeIndex] = xs[hi + 1] - xs[lo];
-    } else if (lo == hi) {
-      coveredWidth[treeIndex] = 0;
-    } else {
-      coveredWidth[treeIndex] =
-          coveredWidth[2 * treeIndex + 1] + coveredWidth[2 * treeIndex + 2];
-    }
-  }
-};
-
-class Solution {
- public:
-  double separateSquares(vector<vector<int>>& squares) {
-    vector<tuple<int, int, int, int>> events;  // (y, delta, xl, xr)
-    set<int> xs;
-
-    for (const vector<int>& square : squares) {
-      const int x = square[0];
-      const int y = square[1];
-      const int l = square[2];
-      events.emplace_back(y, 1, x, x + l);
-      events.emplace_back(y + l, -1, x, x + l);
-      xs.insert(x);
-      xs.insert(x + l);
-    }
-
-    ranges::sort(events);
-
-    const double halfArea = getArea(events, xs) / 2.0;
-    long area = 0;
-    int prevY = 0;
-    SegmentTree tree({xs.begin(), xs.end()});
-
-    for (const auto& [y, delta, xl, xr] : events) {
-      const int coveredWidth = tree.getCoveredWidth();
-      const long areaGain = coveredWidth * static_cast<long>(y - prevY);
-      if (area + areaGain >= halfArea)
-        return prevY + (halfArea - area) / coveredWidth;
-      area += areaGain;
-      tree.add(xl, xr, delta);
-      prevY = y;
-    }
-
-    throw;
-  }
-
- private:
-  // Returns the total area of the rectangles.
-  long getArea(const vector<tuple<int, int, int, int>>& events,
-               const set<int>& xs) {
-    long totalArea = 0;
-    int prevY = 0;
-    SegmentTree tree({xs.begin(), xs.end()});
-    for (const auto& [y, delta, xl, xr] : events) {
-      totalArea += tree.getCoveredWidth() * static_cast<long>(y - prevY);
-      tree.add(xl, xr, delta);
-      prevY = y;
-    }
-    return totalArea;
-  }
-};
diff --git a/solutions/3455. Shortest Matching Substring/3455.cpp b/solutions/3455. Shortest Matching Substring/3455.cpp
deleted file mode 100644
index 22004196af1..00000000000
--- a/solutions/3455. Shortest Matching Substring/3455.cpp	
+++ /dev/null
@@ -1,48 +0,0 @@
-class Solution {
- public:
-  int shortestMatchingSubstring(string s, string p) {
-    const auto [a, b, c] = split(p);
-    const int ns = s.length();
-    const int na = a.length();
-    const int nb = b.length();
-    const int nc = c.length();
-    const vector<int> lpsA = getLPS(a + '#' + s);
-    const vector<int> lpsB = getLPS(b + '#' + s);
-    const vector<int> lpsC = getLPS(c + '#' + s);
-    int ans = INT_MAX;
-
-    for (int i = 0, j = 0, k = 0; i + nb + nc < ns; ++i) {
-      while (i < ns && lpsA[na + 1 + i] != na)
-        ++i;
-      while (j < ns && (j < i + nb || lpsB[nb + 1 + j] != nb))
-        ++j;
-      while (k < ns && (k < j + nc || lpsC[nc + 1 + k] != nc))
-        ++k;
-      if (k == ns)
-        break;
-      ans = min(ans, k - i + na);
-    }
-
-    return ans == INT_MAX ? -1 : ans;
-  }
-
- private:
-  // Returns the lps array, where lps[i] is the length of the longest prefix of
-  // pattern[0..i] which is also a suffix of this substring.
-  vector<int> getLPS(const string& pattern) {
-    vector<int> lps(pattern.length());
-    for (int i = 1, j = 0; i < pattern.length(); ++i) {
-      while (j > 0 && pattern[j] != pattern[i])
-        j = lps[j - 1];
-      if (pattern[i] == pattern[j])
-        lps[i] = ++j;
-    }
-    return lps;
-  }
-
-  tuple<string, string, string> split(const string& p) {
-    const int i = p.find('*');
-    const int j = p.find('*', i + 1);
-    return {p.substr(0, i), p.substr(i + 1, j - i - 1), p.substr(j + 1)};
-  }
-};
diff --git a/solutions/3455. Shortest Matching Substring/3455.java b/solutions/3455. Shortest Matching Substring/3455.java
deleted file mode 100644
index d3769d03499..00000000000
--- a/solutions/3455. Shortest Matching Substring/3455.java	
+++ /dev/null
@@ -1,49 +0,0 @@
-class Solution {
-  public int shortestMatchingSubstring(String s, String p) {
-    final String[] parts = split(p);
-    final String a = parts[0];
-    final String b = parts[1];
-    final String c = parts[2];
-    final int ns = s.length();
-    final int na = a.length();
-    final int nb = b.length();
-    final int nc = c.length();
-    int[] lpsA = getLPS(a + "#" + s);
-    int[] lpsB = getLPS(b + "#" + s);
-    int[] lpsC = getLPS(c + "#" + s);
-    int ans = Integer.MAX_VALUE;
-
-    for (int i = 0, j = 0, k = 0; i + nb + nc < ns; ++i) {
-      while (i < ns && lpsA[na + 1 + i] != na)
-        ++i;
-      while (j < ns && (j < i + nb || lpsB[nb + 1 + j] != nb))
-        ++j;
-      while (k < ns && (k < j + nc || lpsC[nc + 1 + k] != nc))
-        ++k;
-      if (k == ns)
-        break;
-      ans = Math.min(ans, k - i + na);
-    }
-
-    return ans == Integer.MAX_VALUE ? -1 : ans;
-  }
-
-  // Returns the lps array, where lps[i] is the length of the longest prefix of
-  // pattern[0..i] which is also a suffix of this substring.
-  private int[] getLPS(String pattern) {
-    int[] lps = new int[pattern.length()];
-    for (int i = 1, j = 0; i < pattern.length(); ++i) {
-      while (j > 0 && pattern.charAt(j) != pattern.charAt(i))
-        j = lps[j - 1];
-      if (pattern.charAt(i) == pattern.charAt(j))
-        lps[i] = ++j;
-    }
-    return lps;
-  }
-
-  private String[] split(final String p) {
-    final int i = p.indexOf('*');
-    final int j = p.indexOf('*', i + 1);
-    return new String[] {p.substring(0, i), p.substring(i + 1, j), p.substring(j + 1)};
-  }
-}
diff --git a/solutions/3455. Shortest Matching Substring/3455.py b/solutions/3455. Shortest Matching Substring/3455.py
deleted file mode 100644
index c2d8ae8d777..00000000000
--- a/solutions/3455. Shortest Matching Substring/3455.py	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution:
-  def shortestMatchingSubstring(self, s: str, p: str) -> int:
-    n = len(s)
-    a, b, c = p.split('*')
-    lpsA = self._getLPS(a + '#' + s)[len(a) + 1:]
-    lpsB = self._getLPS(b + '#' + s)[len(b) + 1:]
-    lpsC = self._getLPS(c + '#' + s)[len(c) + 1:]
-    ans = math.inf
-
-    i = 0  # lpsA's index
-    j = 0  # lpsB's index
-    k = 0  # lpsC's index
-    while i + len(b) + len(c) < n:
-      while i < n and lpsA[i] != len(a):
-        i += 1
-      while j < n and (j < i + len(b) or lpsB[j] != len(b)):
-        j += 1
-      while k < n and (k < j + len(c) or lpsC[k] != len(c)):
-        k += 1
-      if k == n:
-        break
-      ans = min(ans, k - i + len(a))
-      i += 1
-
-    return -1 if ans == math.inf else ans
-
-  def _getLPS(self, pattern: str) -> list[int]:
-    """
-    Returns the lps array, where lps[i] is the length of the longest prefix of
-    pattern[0..i] which is also a suffix of this substring.
-    """
-    lps = [0] * len(pattern)
-    j = 0
-    for i in range(1, len(pattern)):
-      while j > 0 and pattern[j] != pattern[i]:
-        j = lps[j - 1]
-      if pattern[i] == pattern[j]:
-        lps[i] = j + 1
-        j += 1
-    return lps
diff --git a/solutions/3456. Find Special Substring of Length K/3456.cpp b/solutions/3456. Find Special Substring of Length K/3456.cpp
deleted file mode 100644
index ebf9d37fca3..00000000000
--- a/solutions/3456. Find Special Substring of Length K/3456.cpp	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
- public:
-  bool hasSpecialSubstring(string s, int k) {
-    int count = 1;
-
-    for (int i = 1; i < s.length(); ++i) {
-      if (s[i] == s[i - 1])
-        ++count;
-      else if (count == k)
-        return true;
-      else
-        count = 1;
-    }
-
-    return count == k;
-  }
-};
diff --git a/solutions/3456. Find Special Substring of Length K/3456.java b/solutions/3456. Find Special Substring of Length K/3456.java
deleted file mode 100644
index f2507547b23..00000000000
--- a/solutions/3456. Find Special Substring of Length K/3456.java	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution {
-  public boolean hasSpecialSubstring(String s, int k) {
-    int count = 1;
-
-    for (int i = 1; i < s.length(); ++i) {
-      if (s.charAt(i) == s.charAt(i - 1))
-        ++count;
-      else if (count == k)
-        return true;
-      else
-        count = 1;
-    }
-
-    return count == k;
-  }
-}
diff --git a/solutions/3456. Find Special Substring of Length K/3456.py b/solutions/3456. Find Special Substring of Length K/3456.py
deleted file mode 100644
index 8beda09e0cd..00000000000
--- a/solutions/3456. Find Special Substring of Length K/3456.py	
+++ /dev/null
@@ -1,3 +0,0 @@
-class Solution:
-  def hasSpecialSubstring(self, s: str, k: int) -> bool:
-    return any(len(list(group)) == k for _, group in groupby(s))
diff --git a/solutions/3457. Eat Pizzas!/3457.cpp b/solutions/3457. Eat Pizzas!/3457.cpp
deleted file mode 100644
index 47160dcde90..00000000000
--- a/solutions/3457. Eat Pizzas!/3457.cpp	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
- public:
-  long long maxWeight(vector<int>& pizzas) {
-    const int eat = pizzas.size() / 4;
-    const int odd = (eat - 1) / 2 + 1;  // ceil(eat / 2)
-    const int even = eat - odd;
-    long ans = 0;
-    int i = 0;  // pizzas' index
-
-    ranges::sort(pizzas, std::greater<>());
-
-    for (int j = 0; j < odd; ++j, i += 1)
-      ans += pizzas[i];
-
-    for (int j = 0; j < even; ++j, i += 2)
-      ans += pizzas[i + 1];
-
-    return ans;
-  }
-};
diff --git a/solutions/3457. Eat Pizzas!/3457.java b/solutions/3457. Eat Pizzas!/3457.java
deleted file mode 100644
index b4378c9bfc4..00000000000
--- a/solutions/3457. Eat Pizzas!/3457.java	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
-  public long maxWeight(int[] pizzas) {
-    final int eat = pizzas.length / 4;
-    final int odd = (eat - 1) / 2 + 1; // ceil(eat / 2)
-    final int even = eat - odd;
-    long ans = 0;
-    int i = pizzas.length - 1; // pizzas' index
-
-    Arrays.sort(pizzas);
-
-    for (int j = 0; j < odd; ++j, i -= 1)
-      ans += pizzas[i];
-
-    for (int j = 0; j < even; ++j, i -= 2)
-      ans += pizzas[i - 1];
-
-    return ans;
-  }
-}
diff --git a/solutions/3457. Eat Pizzas!/3457.py b/solutions/3457. Eat Pizzas!/3457.py
deleted file mode 100644
index c801bbb1e99..00000000000
--- a/solutions/3457. Eat Pizzas!/3457.py	
+++ /dev/null
@@ -1,8 +0,0 @@
-class Solution:
-  def maxWeight(self, pizzas: list[int]) -> int:
-    eat = len(pizzas) // 4
-    odd = math.ceil(eat / 2)
-    even = eat - odd
-    pizzas.sort(reverse=True)
-    return (sum(pizzas[:odd]) +
-            sum(pizzas[odd + 1:odd + 1 + even * 2:2]))
diff --git a/solutions/3458. Select K Disjoint Special Substrings/3458.cpp b/solutions/3458. Select K Disjoint Special Substrings/3458.cpp
deleted file mode 100644
index 4d0cd1e1e3e..00000000000
--- a/solutions/3458. Select K Disjoint Special Substrings/3458.cpp	
+++ /dev/null
@@ -1,41 +0,0 @@
-class Solution {
- public:
-  bool maxSubstringLength(string s, int k) {
-    const int n = s.length();
-    vector<int> first(26, n);
-    vector<int> last(26, -1);
-    vector<char> seenOrder;
-    // dp[i] := the maximum disjoint special substrings for the first i letters
-    vector<int> dp(n + 1);
-
-    for (int i = 0; i < n; ++i) {
-      const char c = s[i];
-      const int a = c - 'a';
-      if (first[a] == n) {
-        first[a] = i;
-        seenOrder.push_back(c);
-      }
-      last[a] = i;
-    }
-
-    for (const char c : seenOrder) {
-      const int a = c - 'a';
-      for (int j = first[a]; j < last[a]; ++j) {
-        const int b = s[j] - 'a';
-        first[a] = min(first[a], first[b]);
-        last[a] = max(last[a], last[b]);
-      }
-    }
-
-    for (int i = 0; i < n; ++i) {
-      const char c = s[i];
-      const int a = c - 'a';
-      if (last[a] != i || (first[a] == 0 && i == n - 1))
-        dp[i + 1] = dp[i];
-      else  // Start a new special substring.
-        dp[i + 1] = max(dp[i], 1 + dp[first[a]]);
-    }
-
-    return dp[n] >= k;
-  }
-};
diff --git a/solutions/3458. Select K Disjoint Special Substrings/3458.java b/solutions/3458. Select K Disjoint Special Substrings/3458.java
deleted file mode 100644
index f989a3bea74..00000000000
--- a/solutions/3458. Select K Disjoint Special Substrings/3458.java	
+++ /dev/null
@@ -1,43 +0,0 @@
-class Solution {
-  public boolean maxSubstringLength(String s, int k) {
-    final int n = s.length();
-    int[] first = new int[26];
-    int[] last = new int[26];
-    // dp[i] := the maximum disjoint special substrings for the first i letters
-    int[] dp = new int[n + 1];
-    List<Character> seenOrder = new ArrayList<>();
-
-    Arrays.fill(first, n);
-    Arrays.fill(last, -1);
-
-    for (int i = 0; i < n; ++i) {
-      final char c = s.charAt(i);
-      final int a = c - 'a';
-      if (first[a] == n) {
-        first[a] = i;
-        seenOrder.add(c);
-      }
-      last[a] = i;
-    }
-
-    for (final char c : seenOrder) {
-      final int a = c - 'a';
-      for (int j = first[a]; j < last[a]; ++j) {
-        final int b = s.charAt(j) - 'a';
-        first[a] = Math.min(first[a], first[b]);
-        last[a] = Math.max(last[a], last[b]);
-      }
-    }
-
-    for (int i = 0; i < n; i++) {
-      final char c = s.charAt(i);
-      final int a = c - 'a';
-      if (last[a] != i || (first[a] == 0 && i == n - 1))
-        dp[i + 1] = dp[i];
-      else // Start a new special substring.
-        dp[i + 1] = Math.max(dp[i], 1 + dp[first[a]]);
-    }
-
-    return dp[n] >= k;
-  }
-}
diff --git a/solutions/3458. Select K Disjoint Special Substrings/3458.py b/solutions/3458. Select K Disjoint Special Substrings/3458.py
deleted file mode 100644
index fc025d94a95..00000000000
--- a/solutions/3458. Select K Disjoint Special Substrings/3458.py	
+++ /dev/null
@@ -1,31 +0,0 @@
-class Solution:
-  def maxSubstringLength(self, s: str, k: int) -> bool:
-    n = len(s)
-    first = [n] * 26
-    last = [-1] * 26
-    # dp[i] := the maximum disjoint special substrings for the first i letters
-    dp = [0] * (n + 1)
-    seenOrder = []
-
-    for i, c in enumerate(s):
-      a = ord(c) - ord('a')
-      if first[a] == n:
-        first[a] = i
-        seenOrder.append(c)
-      last[a] = i
-
-    for c in seenOrder:
-      a = ord(c) - ord('a')
-      for j in range(first[a], last[a]):
-        b = ord(s[j]) - ord('a')
-        first[a] = min(first[a], first[b])
-        last[a] = max(last[a], last[b])
-
-    for i, c in enumerate(s):
-      a = ord(c) - ord('a')
-      if last[a] != i or (first[a] == 0 and i == n - 1):
-        dp[i + 1] = dp[i]
-      else:  # Start a new special substring.
-        dp[i + 1] = max(dp[i], 1 + dp[first[a]])
-
-    return dp[n] >= k
diff --git a/solutions/3459. Length of Longest V-Shaped Diagonal Segment/3459.cpp b/solutions/3459. Length of Longest V-Shaped Diagonal Segment/3459.cpp
deleted file mode 100644
index 3a3e16bf4e0..00000000000
--- a/solutions/3459. Length of Longest V-Shaped Diagonal Segment/3459.cpp	
+++ /dev/null
@@ -1,51 +0,0 @@
-class Solution {
- public:
-  int lenOfVDiagonal(vector<vector<int>>& grid) {
-    const int m = grid.size();
-    const int n = grid[0].size();
-    vector<vector<vector<vector<vector<int>>>>> mem(
-        m, vector<vector<vector<vector<int>>>>(
-               n, vector<vector<vector<int>>>(
-                      2, vector<vector<int>>(2, vector<int>(4, -1)))));
-    int res = 0;
-
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j)
-        if (grid[i][j] == 1)
-          for (int d = 0; d < 4; ++d) {
-            const auto& [dx, dy] = kDirs[d];
-            res = max(res, 1 + dfs(grid, i + dx, j + dy, /*turned=*/false, 2, d,
-                                   mem));
-          }
-
-    return res;
-  }
-
- private:
-  static constexpr int kDirs[4][2] = {{-1, 1}, {1, 1}, {1, -1}, {-1, -1}};
-
-  int dfs(const vector<vector<int>>& grid, int i, int j, bool turned, int num,
-          int dir, vector<vector<vector<vector<vector<int>>>>>& mem) {
-    if (i < 0 || i == grid.size() || j < 0 || j == grid[0].size())
-      return 0;
-    if (grid[i][j] != num)
-      return 0;
-
-    const int hashNum = max(0, num - 1);
-    if (mem[i][j][turned][hashNum][dir] != -1)
-      return mem[i][j][turned][hashNum][dir];
-
-    const int nextNum = num == 2 ? 0 : 2;
-    const auto& [dx, dy] = kDirs[dir];
-    int res = 1 + dfs(grid, i + dx, j + dy, turned, nextNum, dir, mem);
-
-    if (!turned) {
-      const int nextDir = (dir + 1) % 4;
-      const auto& [nextDx, nextDy] = kDirs[nextDir];
-      res = max(res, 1 + dfs(grid, i + nextDx, j + nextDy, /*turned=*/true,
-                             nextNum, nextDir, mem));
-    }
-
-    return mem[i][j][turned][hashNum][dir] = res;
-  }
-};
diff --git a/solutions/3459. Length of Longest V-Shaped Diagonal Segment/3459.java b/solutions/3459. Length of Longest V-Shaped Diagonal Segment/3459.java
deleted file mode 100644
index 738bdc09edf..00000000000
--- a/solutions/3459. Length of Longest V-Shaped Diagonal Segment/3459.java	
+++ /dev/null
@@ -1,47 +0,0 @@
-class Solution {
-  public int lenOfVDiagonal(int[][] grid) {
-    final int m = grid.length;
-    final int n = grid[0].length;
-    Integer[][][][][] mem = new Integer[m][n][2][2][4];
-
-    int ans = 0;
-
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j)
-        if (grid[i][j] == 1)
-          for (int d = 0; d < 4; ++d) {
-            final int dx = DIRS[d][0];
-            final int dy = DIRS[d][1];
-            ans = Math.max(ans, 1 + dfs(grid, i + dx, j + dy, /*turned=*/false, 2, d, mem));
-          }
-
-    return ans;
-  }
-
-  private static final int[][] DIRS = {{-1, 1}, {1, 1}, {1, -1}, {-1, -1}};
-
-  private int dfs(int[][] grid, int i, int j, boolean turned, int num, int dir,
-                  Integer[][][][][] mem) {
-    if (i < 0 || i == grid.length || j < 0 || j == grid[0].length)
-      return 0;
-    if (grid[i][j] != num)
-      return 0;
-
-    final int hashNum = Math.max(0, num - 1);
-    if (mem[i][j][turned ? 1 : 0][hashNum][dir] != null)
-      return mem[i][j][turned ? 1 : 0][hashNum][dir];
-
-    final int nextNum = num == 2 ? 0 : 2;
-    final int dx = DIRS[dir][0], dy = DIRS[dir][1];
-    int res = 1 + dfs(grid, i + dx, j + dy, turned, nextNum, dir, mem);
-
-    if (!turned) {
-      final int nextDir = (dir + 1) % 4;
-      final int nextDx = DIRS[nextDir][0], nextDy = DIRS[nextDir][1];
-      res = Math.max(res,
-                     1 + dfs(grid, i + nextDx, j + nextDy, /*turned=*/true, nextNum, nextDir, mem));
-    }
-
-    return mem[i][j][turned ? 1 : 0][hashNum][dir] = res;
-  }
-}
diff --git a/solutions/3459. Length of Longest V-Shaped Diagonal Segment/3459.py b/solutions/3459. Length of Longest V-Shaped Diagonal Segment/3459.py
deleted file mode 100644
index 39260f257f7..00000000000
--- a/solutions/3459. Length of Longest V-Shaped Diagonal Segment/3459.py	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution:
-  def lenOfVDiagonal(self, grid: list[list[int]]) -> int:
-    DIRS = ((-1, 1), (1, 1), (1, -1), (-1, -1))
-
-    @functools.lru_cache(None)
-    def dfs(i: int, j: int, turned: bool, num: int, dir: int) -> int:
-      if i < 0 or i == len(grid) or j < 0 or j == len(grid[0]):
-        return 0
-      if grid[i][j] != num:
-        return 0
-
-      nextNum = 0 if num == 2 else 2
-      dx, dy = DIRS[dir]
-      res = 1 + dfs(i + dx, j + dy, turned, nextNum, dir)
-
-      if not turned:
-        nextDir = (dir + 1) % 4
-        nextDx, nextDy = DIRS[nextDir]
-        res = max(res, 1 + dfs(i + nextDx, j + nextDy, 1, nextNum, nextDir))
-
-      return res
-
-    return max((1 + dfs(i + dx, j + dy, 0, 2, d)
-                for i, row in enumerate(grid)
-                for j, num in enumerate(row)
-                if num == 1
-                for d, (dx, dy) in enumerate(DIRS)),
-               default=0)
diff --git a/solutions/3460. Longest Common Prefix After at Most One Removal/3460.cpp b/solutions/3460. Longest Common Prefix After at Most One Removal/3460.cpp
deleted file mode 100644
index 35b88f85721..00000000000
--- a/solutions/3460. Longest Common Prefix After at Most One Removal/3460.cpp	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
- public:
-  int longestCommonPrefix(string s, string t) {
-    int i = 0;  // s's index
-    int j = 0;  // t's index
-    bool canSkip = true;
-
-    while (i < s.length() && j < t.length())
-      if (s[i] == t[j]) {
-        ++i;
-        ++j;
-      } else if (canSkip) {
-        ++i;
-        canSkip = false;
-      } else {
-        return j;
-      }
-
-    return j;
-  }
-};
diff --git a/solutions/3460. Longest Common Prefix After at Most One Removal/3460.java b/solutions/3460. Longest Common Prefix After at Most One Removal/3460.java
deleted file mode 100644
index 7452469d544..00000000000
--- a/solutions/3460. Longest Common Prefix After at Most One Removal/3460.java	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
-  public int longestCommonPrefix(String s, String t) {
-    int i = 0; // s's index
-    int j = 0; // t's index
-    boolean canSkip = true;
-
-    while (i < s.length() && j < t.length())
-      if (s.charAt(i) == t.charAt(j)) {
-        ++i;
-        ++j;
-      } else if (canSkip) {
-        ++i;
-        canSkip = false;
-      } else {
-        return j;
-      }
-
-    return j;
-  }
-}
diff --git a/solutions/3460. Longest Common Prefix After at Most One Removal/3460.py b/solutions/3460. Longest Common Prefix After at Most One Removal/3460.py
deleted file mode 100644
index b8938af0a93..00000000000
--- a/solutions/3460. Longest Common Prefix After at Most One Removal/3460.py	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution:
-  def longestCommonPrefix(self, s: str, t: str) -> int:
-    i = 0  # s's index
-    j = 0  # t's index
-    canSkip = True
-
-    while i < len(s) and j < len(t):
-      if s[i] == t[j]:
-        i += 1
-        j += 1
-      elif canSkip:
-        i += 1
-        canSkip = False
-      else:
-        return j
-
-    return j
diff --git a/solutions/3461. Check If Digits Are Equal in String After Operations I/3461.cpp b/solutions/3461. Check If Digits Are Equal in String After Operations I/3461.cpp
deleted file mode 100644
index 5a7e6cf2f1f..00000000000
--- a/solutions/3461. Check If Digits Are Equal in String After Operations I/3461.cpp	
+++ /dev/null
@@ -1,54 +0,0 @@
-class Solution {
- public:
-  bool hasSameDigits(const string& s) {
-    const int n = s.length();
-    int num1 = 0;
-    int num2 = 0;
-
-    for (int i = 0; i + 1 < n; ++i) {
-      const int coefficient = nCkMod10(n - 2, i);
-      num1 += (coefficient * (s[i] - '0')) % 10;
-      num1 %= 10;
-      num2 += (coefficient * (s[i + 1] - '0')) % 10;
-      num2 %= 10;
-    }
-
-    return num1 == num2;
-  }
-
- private:
-  // Returns (n, k) % 10.
-  int nCkMod10(int n, int k) {
-    const int mod2 = lucasTheorem(n, k, 2);
-    const int mod5 = lucasTheorem(n, k, 5);
-    static constexpr int lookup[2][5] = {
-        {0, 6, 2, 8, 4},  // mod2 == 0
-        {5, 1, 7, 3, 9}   // mod2 == 1
-    };
-    return lookup[mod2][mod5];
-  }
-
-  // Returns (n, k) % prime.
-  int lucasTheorem(int n, int k, int prime) {
-    int res = 1;
-    while (n > 0 || k > 0) {
-      const int nMod = n % prime;
-      const int kMod = k % prime;
-      res *= nCk(nMod, kMod);
-      res %= prime;
-      n /= prime;
-      k /= prime;
-    }
-    return res;
-  }
-
-  // Returns (n, k).
-  int nCk(int n, int k) {
-    int res = 1;
-    for (int i = 0; i < k; ++i) {
-      res *= (n - i);
-      res /= (i + 1);
-    }
-    return res;
-  }
-};
diff --git a/solutions/3461. Check If Digits Are Equal in String After Operations I/3461.java b/solutions/3461. Check If Digits Are Equal in String After Operations I/3461.java
deleted file mode 100644
index e8448b7c288..00000000000
--- a/solutions/3461. Check If Digits Are Equal in String After Operations I/3461.java	
+++ /dev/null
@@ -1,52 +0,0 @@
-class Solution {
-  public boolean hasSameDigits(String s) {
-    final int n = s.length();
-    int num1 = 0;
-    int num2 = 0;
-
-    for (int i = 0; i + 1 < n; ++i) {
-      final int coefficient = nCMOD10(n - 2, i);
-      num1 += (coefficient * (s.charAt(i) - '0')) % 10;
-      num1 %= 10;
-      num2 += (coefficient * (s.charAt(i + 1) - '0')) % 10;
-      num2 %= 10;
-    }
-
-    return num1 == num2;
-  }
-
-  // Returns (n, k) % 10.
-  private int nCMOD10(int n, int k) {
-    final int mod2 = lucasTheorem(n, k, 2);
-    final int mod5 = lucasTheorem(n, k, 5);
-    int[][] lookup = {
-        {0, 6, 2, 8, 4}, // mod2 == 0
-        {5, 1, 7, 3, 9}  // mod2 == 1
-    };
-    return lookup[mod2][mod5];
-  }
-
-  // Returns (n, k) % prime.
-  private int lucasTheorem(int n, int k, int prime) {
-    int res = 1;
-    while (n > 0 || k > 0) {
-      final int nMod = n % prime;
-      final int MOD = k % prime;
-      res *= nCk(nMod, MOD);
-      res %= prime;
-      n /= prime;
-      k /= prime;
-    }
-    return res;
-  }
-
-  // Returns (n, k).
-  private int nCk(int n, int k) {
-    int res = 1;
-    for (int i = 0; i < k; ++i) {
-      res *= (n - i);
-      res /= (i + 1);
-    }
-    return res;
-  }
-}
diff --git a/solutions/3461. Check If Digits Are Equal in String After Operations I/3461.py b/solutions/3461. Check If Digits Are Equal in String After Operations I/3461.py
deleted file mode 100644
index 68782a89e1d..00000000000
--- a/solutions/3461. Check If Digits Are Equal in String After Operations I/3461.py	
+++ /dev/null
@@ -1,36 +0,0 @@
-class Solution:
-  def hasSameDigits(self, s: str) -> bool:
-    n = len(s)
-    num1 = 0
-    num2 = 0
-
-    for i in range(n - 1):
-      coefficient = self._nCMOD10(n - 2, i)
-      num1 += (coefficient * (int(s[i]) - 0)) % 10
-      num1 %= 10
-      num2 += (coefficient * (int(s[i + 1]) - 0)) % 10
-      num2 %= 10
-
-    return num1 == num2
-
-  def _nCMOD10(self, n: int, k: int) -> int:
-    """Returns (n, k) % 10."""
-    mod2 = self._lucasTheorem(n, k, 2)
-    mod5 = self._lucasTheorem(n, k, 5)
-    lookup = [
-        [0, 6, 2, 8, 4],  # mod2 == 0
-        [5, 1, 7, 3, 9]   # mod2 == 1
-    ]
-    return lookup[mod2][mod5]
-
-  def _lucasTheorem(self, n: int, k: int, prime: int) -> int:
-    """Returns (n, k) % prime."""
-    res = 1
-    while n > 0 or k > 0:
-      nMod = n % prime
-      MOD = k % prime
-      res *= math.comb(nMod, MOD)
-      res %= prime
-      n //= prime
-      k //= prime
-    return res
diff --git a/solutions/3462. Maximum Sum With at Most K Elements/3462.cpp b/solutions/3462. Maximum Sum With at Most K Elements/3462.cpp
deleted file mode 100644
index d8003e56ec4..00000000000
--- a/solutions/3462. Maximum Sum With at Most K Elements/3462.cpp	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
- public:
-  long long maxSum(vector<vector<int>>& grid, vector<int>& limits, int k) {
-    long ans = 0;
-    priority_queue<int, vector<int>, greater<>> minHeap;
-
-    for (int i = 0; i < grid.size(); ++i) {
-      ranges::sort(grid[i], greater<>());
-      for (int j = 0; j < limits[i]; ++j) {
-        minHeap.push(grid[i][j]);
-        if (minHeap.size() == k + 1)
-          minHeap.pop();
-      }
-    }
-
-    while (!minHeap.empty())
-      ans += minHeap.top(), minHeap.pop();
-
-    return ans;
-  }
-};
diff --git a/solutions/3462. Maximum Sum With at Most K Elements/3462.java b/solutions/3462. Maximum Sum With at Most K Elements/3462.java
deleted file mode 100644
index bb792018c0d..00000000000
--- a/solutions/3462. Maximum Sum With at Most K Elements/3462.java	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
-  public long maxSum(int[][] grid, int[] limits, int k) {
-    long ans = 0;
-    Queue<Integer> minHeap = new PriorityQueue<>();
-
-    for (int i = 0; i < grid.length; ++i) {
-      Arrays.sort(grid[i]);
-      for (int j = grid[i].length - 1; j >= grid[i].length - limits[i]; --j) {
-        minHeap.offer(grid[i][j]);
-        if (minHeap.size() == k + 1)
-          minHeap.poll();
-      }
-    }
-
-    while (!minHeap.isEmpty())
-      ans += minHeap.poll();
-
-    return ans;
-  }
-}
diff --git a/solutions/3462. Maximum Sum With at Most K Elements/3462.py b/solutions/3462. Maximum Sum With at Most K Elements/3462.py
deleted file mode 100644
index 5c9ebb6155d..00000000000
--- a/solutions/3462. Maximum Sum With at Most K Elements/3462.py	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution:
-  def maxSum(self, grid: list[list[int]], limits: list[int], k: int) -> int:
-    minHeap = []
-
-    for row, limit in zip(grid, limits):
-      row.sort(reverse=True)
-      for i in range(limit):
-        heapq.heappush(minHeap, row[i])
-        if len(minHeap) == k + 1:
-          heapq.heappop(minHeap)
-
-    return sum(minHeap)
diff --git a/solutions/3463. Check If Digits Are Equal in String After Operations II/3463.cpp b/solutions/3463. Check If Digits Are Equal in String After Operations II/3463.cpp
deleted file mode 100644
index 6a7c772428e..00000000000
--- a/solutions/3463. Check If Digits Are Equal in String After Operations II/3463.cpp	
+++ /dev/null
@@ -1,55 +0,0 @@
-class Solution {
- public:
-  // Same as 3461. Check If Digits Are Equal in String After Operations I
-  bool hasSameDigits(const string& s) {
-    const int n = s.length();
-    int num1 = 0;
-    int num2 = 0;
-
-    for (int i = 0; i + 1 < n; ++i) {
-      const int coefficient = nCkMod10(n - 2, i);
-      num1 += (coefficient * (s[i] - '0')) % 10;
-      num1 %= 10;
-      num2 += (coefficient * (s[i + 1] - '0')) % 10;
-      num2 %= 10;
-    }
-
-    return num1 == num2;
-  }
-
- private:
-  // Returns (n, k) % 10.
-  int nCkMod10(int n, int k) {
-    const int mod2 = lucasTheorem(n, k, 2);
-    const int mod5 = lucasTheorem(n, k, 5);
-    static constexpr int lookup[2][5] = {
-        {0, 6, 2, 8, 4},  // mod2 == 0
-        {5, 1, 7, 3, 9}   // mod2 == 1
-    };
-    return lookup[mod2][mod5];
-  }
-
-  // Returns (n, k) % prime.
-  int lucasTheorem(int n, int k, int prime) {
-    int res = 1;
-    while (n > 0 || k > 0) {
-      const int nMod = n % prime;
-      const int kMod = k % prime;
-      res *= nCk(nMod, kMod);
-      res %= prime;
-      n /= prime;
-      k /= prime;
-    }
-    return res;
-  }
-
-  // Returns (n, k).
-  int nCk(int n, int k) {
-    int res = 1;
-    for (int i = 0; i < k; ++i) {
-      res *= (n - i);
-      res /= (i + 1);
-    }
-    return res;
-  }
-};
diff --git a/solutions/3463. Check If Digits Are Equal in String After Operations II/3463.java b/solutions/3463. Check If Digits Are Equal in String After Operations II/3463.java
deleted file mode 100644
index 9950a602aab..00000000000
--- a/solutions/3463. Check If Digits Are Equal in String After Operations II/3463.java	
+++ /dev/null
@@ -1,53 +0,0 @@
-class Solution {
-  // Same as 3461. Check If Digits Are Equal in String After Operations I
-  public boolean hasSameDigits(String s) {
-    final int n = s.length();
-    int num1 = 0;
-    int num2 = 0;
-
-    for (int i = 0; i + 1 < n; ++i) {
-      final int coefficient = nCMOD10(n - 2, i);
-      num1 += (coefficient * (s.charAt(i) - '0')) % 10;
-      num1 %= 10;
-      num2 += (coefficient * (s.charAt(i + 1) - '0')) % 10;
-      num2 %= 10;
-    }
-
-    return num1 == num2;
-  }
-
-  // Returns (n, k) % 10.
-  private int nCMOD10(int n, int k) {
-    final int mod2 = lucasTheorem(n, k, 2);
-    final int mod5 = lucasTheorem(n, k, 5);
-    int[][] lookup = {
-        {0, 6, 2, 8, 4}, // mod2 == 0
-        {5, 1, 7, 3, 9}  // mod2 == 1
-    };
-    return lookup[mod2][mod5];
-  }
-
-  // Returns (n, k) % prime.
-  private int lucasTheorem(int n, int k, int prime) {
-    int res = 1;
-    while (n > 0 || k > 0) {
-      final int nMod = n % prime;
-      final int MOD = k % prime;
-      res *= nCk(nMod, MOD);
-      res %= prime;
-      n /= prime;
-      k /= prime;
-    }
-    return res;
-  }
-
-  // Returns (n, k).
-  private int nCk(int n, int k) {
-    int res = 1;
-    for (int i = 0; i < k; ++i) {
-      res *= (n - i);
-      res /= (i + 1);
-    }
-    return res;
-  }
-}
diff --git a/solutions/3463. Check If Digits Are Equal in String After Operations II/3463.py b/solutions/3463. Check If Digits Are Equal in String After Operations II/3463.py
deleted file mode 100644
index afa10f76973..00000000000
--- a/solutions/3463. Check If Digits Are Equal in String After Operations II/3463.py	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution:
-  # Same as 3461. Check If Digits Are Equal in String After Operations I
-  def hasSameDigits(self, s: str) -> bool:
-    n = len(s)
-    num1 = 0
-    num2 = 0
-
-    for i in range(n - 1):
-      coefficient = self._nCMOD10(n - 2, i)
-      num1 += (coefficient * (int(s[i]) - 0)) % 10
-      num1 %= 10
-      num2 += (coefficient * (int(s[i + 1]) - 0)) % 10
-      num2 %= 10
-
-    return num1 == num2
-
-  def _nCMOD10(self, n: int, k: int) -> int:
-    """Returns (n, k) % 10."""
-    mod2 = self._lucasTheorem(n, k, 2)
-    mod5 = self._lucasTheorem(n, k, 5)
-    lookup = [
-        [0, 6, 2, 8, 4],  # mod2 == 0
-        [5, 1, 7, 3, 9]   # mod2 == 1
-    ]
-    return lookup[mod2][mod5]
-
-  def _lucasTheorem(self, n: int, k: int, prime: int) -> int:
-    """Returns (n, k) % prime."""
-    res = 1
-    while n > 0 or k > 0:
-      nMod = n % prime
-      MOD = k % prime
-      res *= math.comb(nMod, MOD)
-      res %= prime
-      n //= prime
-      k //= prime
-    return res
diff --git a/solutions/3464. Maximize the Distance Between Points on a Square/3464.cpp b/solutions/3464. Maximize the Distance Between Points on a Square/3464.cpp
deleted file mode 100644
index 477e685ee9e..00000000000
--- a/solutions/3464. Maximize the Distance Between Points on a Square/3464.cpp	
+++ /dev/null
@@ -1,88 +0,0 @@
-struct Sequence {
-  int startX;
-  int startY;
-  int endX;
-  int endY;
-  int length;
-};
-
-class Solution {
- public:
-  int maxDistance(int side, vector<vector<int>>& points, int k) {
-    const vector<pair<int, int>> ordered = getOrderedPoints(side, points);
-    int l = 0;
-    int r = side;
-
-    while (l < r) {
-      const int m = (l + r + 1) / 2;
-      if (isValidDistance(ordered, k, m))
-        l = m;
-      else
-        r = m - 1;
-    }
-
-    return l;
-  }
-
- private:
-  // Returns true if we can select `k` points such that the minimum Manhattan
-  // distance between any two consecutive chosen points is at least `m`.
-  bool isValidDistance(const vector<pair<int, int>>& ordered, int k, int d) {
-    deque<Sequence> dq{{ordered[0].first, ordered[0].second, ordered[0].first,
-                        ordered[0].second, 1}};
-    int maxLength = 1;
-
-    for (int i = 1; i < ordered.size(); ++i) {
-      const auto& [x, y] = ordered[i];
-      int startX = x;
-      int startY = y;
-      int length = 1;
-      while (!dq.empty() &&
-             (abs(x - dq.front().endX) + abs(y - dq.front().endY) >= d)) {
-        if (abs(x - dq.front().startX) + abs(y - dq.front().startY) >= d &&
-            dq.front().length + 1 >= length) {
-          startX = dq.front().startX;
-          startY = dq.front().startY;
-          length = dq.front().length + 1;
-          maxLength = max(maxLength, length);
-        }
-        dq.pop_front();
-      }
-      dq.emplace_back(startX, startY, x, y, length);
-    }
-
-    return maxLength >= k;
-  }
-
-  // Returns the ordered points on the perimeter of a square of side length
-  // `side`, starting from left, top, right, and bottom boundaries.
-  vector<pair<int, int>> getOrderedPoints(int side,
-                                          vector<vector<int>>& points) {
-    vector<pair<int, int>> left;
-    vector<pair<int, int>> top;
-    vector<pair<int, int>> right;
-    vector<pair<int, int>> bottom;
-
-    for (const vector<int>& point : points) {
-      const int x = point[0];
-      const int y = point[1];
-      if (x == 0 && y > 0)
-        left.emplace_back(x, y);
-      else if (x > 0 && y == side)
-        top.emplace_back(x, y);
-      else if (x == side && y < side)
-        right.emplace_back(x, y);
-      else
-        bottom.emplace_back(x, y);
-    }
-
-    ranges::sort(left);
-    ranges::sort(top);
-    ranges::sort(right, greater<>());
-    ranges::sort(bottom, greater<>());
-    left.insert(left.end(), top.begin(), top.end());
-    left.insert(left.end(), right.begin(), right.end());
-    left.insert(left.end(), bottom.begin(), bottom.end());
-    return left;
-  }
-};
diff --git a/solutions/3464. Maximize the Distance Between Points on a Square/3464.java b/solutions/3464. Maximize the Distance Between Points on a Square/3464.java
deleted file mode 100644
index e3c133b521d..00000000000
--- a/solutions/3464. Maximize the Distance Between Points on a Square/3464.java	
+++ /dev/null
@@ -1,82 +0,0 @@
-class Solution {
-  public int maxDistance(int side, int[][] points, int k) {
-    List<int[]> ordered = getOrderedPoints(side, points);
-    int l = 0;
-    int r = side;
-
-    while (l < r) {
-      final int m = (l + r + 1) / 2;
-      if (isValidDistance(ordered, k, m))
-        l = m;
-      else
-        r = m - 1;
-    }
-
-    return l;
-  }
-
-  private record Sequence(int startX, int startY, int endX, int endY, int length) {}
-
-  // Returns true if we can select `k` points such that the minimum Manhattan
-  // distance between any two consecutive chosen points is at least `m`.
-  private boolean isValidDistance(List<int[]> ordered, int k, int d) {
-    Deque<Sequence> dq = new ArrayDeque<>(List.of(new Sequence(
-        ordered.get(0)[0], ordered.get(0)[1], ordered.get(0)[0], ordered.get(0)[1], 1)));
-    int maxLength = 1;
-
-    for (int i = 1; i < ordered.size(); ++i) {
-      final int x = ordered.get(i)[0];
-      final int y = ordered.get(i)[1];
-      int startX = x;
-      int startY = y;
-      int length = 1;
-      while (!dq.isEmpty() &&
-             (Math.abs(x - dq.peekFirst().endX()) + Math.abs(y - dq.peekFirst().endY()) >= d)) {
-        if (Math.abs(x - dq.peekFirst().startX()) + Math.abs(y - dq.peekFirst().startY()) >= d &&
-            dq.peekFirst().length() + 1 >= length) {
-          startX = dq.peekFirst().startX();
-          startY = dq.peekFirst().startY();
-          length = dq.peekFirst().length() + 1;
-          maxLength = Math.max(maxLength, length);
-        }
-        dq.pollFirst();
-      }
-      dq.addLast(new Sequence(startX, startY, x, y, length));
-    }
-
-    return maxLength >= k;
-  }
-
-  // Returns the ordered points on the perimeter of a square of side length
-  // `side`, starting from left, top, right, and bottom boundaries.
-  private List<int[]> getOrderedPoints(int side, int[][] points) {
-    List<int[]> left = new ArrayList<>();
-    List<int[]> top = new ArrayList<>();
-    List<int[]> right = new ArrayList<>();
-    List<int[]> bottom = new ArrayList<>();
-
-    for (int[] point : points) {
-      final int x = point[0];
-      final int y = point[1];
-      if (x == 0 && y > 0)
-        left.add(point);
-      else if (x > 0 && y == side)
-        top.add(point);
-      else if (x == side && y < side)
-        right.add(point);
-      else
-        bottom.add(point);
-    }
-
-    left.sort(Comparator.comparingInt(a -> a[1]));
-    top.sort(Comparator.comparingInt(a -> a[0]));
-    right.sort(Comparator.comparingInt(a -> - a[1]));
-    bottom.sort(Comparator.comparingInt(a -> - a[0]));
-    List<int[]> ordered = new ArrayList<>();
-    ordered.addAll(left);
-    ordered.addAll(top);
-    ordered.addAll(right);
-    ordered.addAll(bottom);
-    return ordered;
-  }
-}
diff --git a/solutions/3464. Maximize the Distance Between Points on a Square/3464.py b/solutions/3464. Maximize the Distance Between Points on a Square/3464.py
deleted file mode 100644
index f0af116bcdf..00000000000
--- a/solutions/3464. Maximize the Distance Between Points on a Square/3464.py	
+++ /dev/null
@@ -1,70 +0,0 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
-class Sequence:
-  startX: int
-  startY: int
-  endX: int
-  endY: int
-  length: int
-
-  def __iter__(self):
-    yield self.startX
-    yield self.startY
-    yield self.endX
-    yield self.endY
-    yield self.length
-
-
-class Solution:
-  def maxDistance(self, side: int, points: list[list[int]], k: int) -> int:
-    ordered = self._getOrderedPoints(side, points)
-
-    def isValidDistance(m: int) -> bool:
-      """
-      Returns True if we can select `k` points such that the minimum Manhattan
-      distance between any two consecutive chosen points is at least `m`.
-      """
-      dq = collections.deque([Sequence(*ordered[0], *ordered[0], 1)])
-      maxLength = 1
-
-      for i in range(1, len(ordered)):
-        x, y = ordered[i]
-        startX, startY = ordered[i]
-        length = 1
-        while dq and abs(x - dq[0].endX) + abs(y - dq[0].endY) >= m:
-          if (abs(x - dq[0].startX) + abs(y - dq[0].startY) >= m
-                  and dq[0].length + 1 >= length):
-            startX = dq[0].startX
-            startY = dq[0].startY
-            length = dq[0].length + 1
-            maxLength = max(maxLength, length)
-          dq.popleft()
-        dq.append(Sequence(startX, startY, x, y, length))
-
-      return maxLength >= k
-
-    l = 0
-    r = side
-
-    while l < r:
-      m = (l + r + 1) // 2
-      if isValidDistance(m):
-        l = m
-      else:
-        r = m - 1
-
-    return l
-
-  def _getOrderedPoints(self, side: int, points: list[list[int]]) -> list[list[int]]:
-    """
-    Returns the ordered points on the perimeter of a square of side length
-    `side`, starting from left, top, right, and bottom boundaries.
-    """
-    left = sorted([(x, y) for x, y in points if x == 0 and y > 0])
-    top = sorted([(x, y) for x, y in points if x > 0 and y == side])
-    right = sorted([(x, y) for x, y in points if x == side and y < side],
-                   reverse=True)
-    bottom = sorted([(x, y) for x, y in points if y == 0], reverse=True)
-    return left + top + right + bottom
diff --git a/solutions/3465. Find Products with Valid Serial Numbers/3465.sql b/solutions/3465. Find Products with Valid Serial Numbers/3465.sql
deleted file mode 100644
index b2025bc794c..00000000000
--- a/solutions/3465. Find Products with Valid Serial Numbers/3465.sql	
+++ /dev/null
@@ -1,6 +0,0 @@
-SELECT product_id, product_name, description
-FROM Products
-WHERE
-  description REGEXP 'SN[0-9]{4}-[0-9]{4}$'
-  OR description REGEXP 'SN[0-9]{4}-[0-9]{4}[^0-9]+'
-ORDER BY 1;
diff --git a/solutions/3466. Maximum Coin Collection/3466-2.cpp b/solutions/3466. Maximum Coin Collection/3466-2.cpp
deleted file mode 100644
index f606579346e..00000000000
--- a/solutions/3466. Maximum Coin Collection/3466-2.cpp	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
- public:
-  long long maxCoins(vector<int>& lane1, vector<int>& lane2) {
-    // dp[k] := the maximum number of coins at mile so far with k switches
-    vector<long> dp = {lane1[0], lane2[0], LONG_MIN};
-    long ans = ranges::max(dp);
-
-    for (int i = 1; i < lane1.size(); ++i) {
-      dp = {max(0L, dp[0]) + lane1[i],           //
-            max({0L, dp[0], dp[1]}) + lane2[i],  //
-            max(dp[1], dp[2]) + lane1[i]};
-      ans = max(ans, ranges::max(dp));
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3466. Maximum Coin Collection/3466-2.java b/solutions/3466. Maximum Coin Collection/3466-2.java
deleted file mode 100644
index eecdf6880d4..00000000000
--- a/solutions/3466. Maximum Coin Collection/3466-2.java	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution {
-  public long maxCoins(int[] lane1, int[] lane2) {
-    // dp[k] := the maximum number of coins at mile so far with k switches
-    long[] dp = {lane1[0], lane2[0], Long.MIN_VALUE};
-    long ans = Math.max(dp[0], dp[1]);
-
-    for (int i = 1; i < lane1.length; ++i) {
-      dp = new long[] {Math.max(0, dp[0]) + lane1[i],                  //
-                       Math.max(Math.max(0, dp[0]), dp[1]) + lane2[i], //
-                       Math.max(dp[1], dp[2]) + lane1[i]};
-      ans = Math.max(ans, Math.max(Math.max(dp[0], dp[1]), dp[2]));
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3466. Maximum Coin Collection/3466-2.py b/solutions/3466. Maximum Coin Collection/3466-2.py
deleted file mode 100644
index 6f532de579b..00000000000
--- a/solutions/3466. Maximum Coin Collection/3466-2.py	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution:
-  def maxCoins(self, lane1: list[int], lane2: list[int]) -> int:
-    # dp[k] := the maximum number of coins at mile so far with k switches
-    dp = (lane1[0], lane2[0], -math.inf)
-    ans = max(dp)
-
-    for i in range(1, len(lane1)):
-      dp = (max(0, dp[0]) + lane1[i],
-            max(0, dp[0], dp[1]) + lane2[i],
-            max(dp[1], dp[2]) + lane1[i])
-      ans = max(ans, max(dp))
-
-    return ans
diff --git a/solutions/3466. Maximum Coin Collection/3466.cpp b/solutions/3466. Maximum Coin Collection/3466.cpp
deleted file mode 100644
index 30466d908c0..00000000000
--- a/solutions/3466. Maximum Coin Collection/3466.cpp	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
- public:
-  long long maxCoins(vector<int>& lane1, vector<int>& lane2) {
-    const int n = lane1.size();
-    // dp[i][k] := the maximum number of coins at i-th mile with k switches
-    vector<vector<long>> dp(n, vector<long>(3, LONG_MIN));
-    dp[0][0] = lane1[0];
-    dp[0][1] = lane2[0];
-
-    for (int i = 1; i < n; ++i) {
-      dp[i][0] = max(0L, dp[i - 1][0]) + lane1[i];
-      dp[i][1] = max({0L, dp[i - 1][0], dp[i - 1][1]}) + lane2[i];
-      dp[i][2] = max(dp[i - 1][1], dp[i - 1][2]) + lane1[i];
-    }
-
-    return accumulate(dp.begin(), dp.end(), LONG_MIN,
-                      [](long acc, const vector<long>& row) {
-      return max(acc, ranges::max(row));
-    });
-  }
-};
diff --git a/solutions/3466. Maximum Coin Collection/3466.java b/solutions/3466. Maximum Coin Collection/3466.java
deleted file mode 100644
index 23b25a45090..00000000000
--- a/solutions/3466. Maximum Coin Collection/3466.java	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
-  public long maxCoins(int[] lane1, int[] lane2) {
-    final int n = lane1.length;
-    // dp[i][k] := the maximum number of coins at i-th mile with k switches
-    long[][] dp = new long[n][3];
-    Arrays.stream(dp).forEach(A -> Arrays.fill(A, Long.MIN_VALUE));
-    dp[0][0] = lane1[0];
-    dp[0][1] = lane2[0];
-
-    for (int i = 1; i < n; ++i) {
-      dp[i][0] = Math.max(0, dp[i - 1][0]) + lane1[i];
-      dp[i][1] = Math.max(0, Math.max(dp[i - 1][0], dp[i - 1][1])) + lane2[i];
-      dp[i][2] = Math.max(dp[i - 1][1], dp[i - 1][2]) + lane1[i];
-    }
-
-    return Arrays.stream(dp).flatMapToLong(Arrays::stream).max().getAsLong();
-  }
-}
diff --git a/solutions/3466. Maximum Coin Collection/3466.py b/solutions/3466. Maximum Coin Collection/3466.py
deleted file mode 100644
index 88b9d19fd7f..00000000000
--- a/solutions/3466. Maximum Coin Collection/3466.py	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution:
-  def maxCoins(self, lane1: list[int], lane2: list[int]) -> int:
-    n = len(lane1)
-    # dp[i][k] := the maximum number of coins at i-th mile with k switches
-    dp = [[-math.inf] * 3 for _ in range(n)]
-    dp[0][0] = lane1[0]
-    dp[0][1] = lane2[0]
-
-    for i in range(1, n):
-      dp[i][0] = max(0, dp[i - 1][0]) + lane1[i]
-      dp[i][1] = max(0, dp[i - 1][0], dp[i - 1][1]) + lane2[i]
-      dp[i][2] = max(dp[i - 1][1], dp[i - 1][2]) + lane1[i]
-
-    return max(map(max, dp))
diff --git a/solutions/3467. Transform Array by Parity/3467.cpp b/solutions/3467. Transform Array by Parity/3467.cpp
deleted file mode 100644
index 940701cb489..00000000000
--- a/solutions/3467. Transform Array by Parity/3467.cpp	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
- public:
-  vector<int> transformArray(vector<int>& nums) {
-    vector<int> ans;
-    vector<int> count(2);
-
-    for (const int num : nums)
-      ++count[num % 2];
-
-    ans.insert(ans.end(), count[0], 0);
-    ans.insert(ans.end(), count[1], 1);
-    return ans;
-  }
-};
diff --git a/solutions/3467. Transform Array by Parity/3467.java b/solutions/3467. Transform Array by Parity/3467.java
deleted file mode 100644
index 9d0ff1ca5b7..00000000000
--- a/solutions/3467. Transform Array by Parity/3467.java	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
-  public int[] transformArray(int[] nums) {
-    int[] ans = new int[nums.length];
-    int[] count = new int[2];
-
-    for (final int num : nums)
-      ++count[num % 2];
-
-    for (int i = 0; i < count[0]; ++i)
-      ans[i] = 0;
-
-    for (int i = count[0]; i < nums.length; ++i)
-      ans[i] = 1;
-
-    return ans;
-  }
-}
diff --git a/solutions/3467. Transform Array by Parity/3467.py b/solutions/3467. Transform Array by Parity/3467.py
deleted file mode 100644
index bf6cc241398..00000000000
--- a/solutions/3467. Transform Array by Parity/3467.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def transformArray(self, nums: list[int]) -> list[int]:
-    return ([0] * sum(num % 2 == 0 for num in nums) +
-            [1] * sum(num % 2 == 1 for num in nums))
diff --git a/solutions/3468. Find the Number of Copy Arrays/3468.cpp b/solutions/3468. Find the Number of Copy Arrays/3468.cpp
deleted file mode 100644
index 8f7b005ad38..00000000000
--- a/solutions/3468. Find the Number of Copy Arrays/3468.cpp	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution {
- public:
-  int countArrays(vector<int>& original, vector<vector<int>>& bounds) {
-    int mn = bounds[0][0];
-    int mx = bounds[0][1];
-
-    for (int i = 1; i < original.size(); ++i) {
-      const int diff = original[i] - original[i - 1];
-      mn = max(mn + diff, bounds[i][0]);
-      mx = min(mx + diff, bounds[i][1]);
-    }
-
-    return max(0, mx - mn + 1);
-  }
-};
diff --git a/solutions/3468. Find the Number of Copy Arrays/3468.java b/solutions/3468. Find the Number of Copy Arrays/3468.java
deleted file mode 100644
index ac7f9ed1834..00000000000
--- a/solutions/3468. Find the Number of Copy Arrays/3468.java	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
-  public int countArrays(int[] original, int[][] bounds) {
-    int mn = bounds[0][0];
-    int mx = bounds[0][1];
-
-    for (int i = 1; i < original.length; ++i) {
-      final int diff = original[i] - original[i - 1];
-      mn = Math.max(mn + diff, bounds[i][0]);
-      mx = Math.min(mx + diff, bounds[i][1]);
-    }
-
-    return Math.max(0, mx - mn + 1);
-  }
-}
diff --git a/solutions/3468. Find the Number of Copy Arrays/3468.py b/solutions/3468. Find the Number of Copy Arrays/3468.py
deleted file mode 100644
index d079f1082d3..00000000000
--- a/solutions/3468. Find the Number of Copy Arrays/3468.py	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution:
-  def countArrays(self, original: list[int], bounds: list[list[int]]) -> int:
-    mn, mx = bounds[0]
-
-    for i in range(1, len(original)):
-      diff = original[i] - original[i - 1]
-      mn = max(mn + diff, bounds[i][0])
-      mx = min(mx + diff, bounds[i][1])
-
-    return max(0, mx - mn + 1)
diff --git a/solutions/3469. Find Minimum Cost to Remove Array Elements/3469.cpp b/solutions/3469. Find Minimum Cost to Remove Array Elements/3469.cpp
deleted file mode 100644
index 7df55c9ac2c..00000000000
--- a/solutions/3469. Find Minimum Cost to Remove Array Elements/3469.cpp	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
- public:
-  // Main function to start the calculation
-  int minCost(vector<int>& nums) {
-    const int n = nums.size();
-    vector<vector<int>> mem(n + 1, vector<int>(n + 1, -1));
-    return minCost(/*last=*/0, 1, nums, mem);
-  }
-
- private:
-  int minCost(int last, int i, vector<int>& nums, vector<vector<int>>& mem) {
-    const int n = nums.size();
-    if (i == n)  // Single element left.
-      return nums[last];
-    if (i == n - 1)  // Two elements left.
-      return max(nums[last], nums[i]);
-    if (mem[i][last] != -1)
-      return mem[i][last];
-    const int a = max(nums[i], nums[i + 1]) + minCost(last, i + 2, nums, mem);
-    const int b = max(nums[last], nums[i]) + minCost(i + 1, i + 2, nums, mem);
-    const int c = max(nums[last], nums[i + 1]) + minCost(i, i + 2, nums, mem);
-    return mem[i][last] = min({a, b, c});
-  }
-};
diff --git a/solutions/3469. Find Minimum Cost to Remove Array Elements/3469.java b/solutions/3469. Find Minimum Cost to Remove Array Elements/3469.java
deleted file mode 100644
index c5d7f6d1cde..00000000000
--- a/solutions/3469. Find Minimum Cost to Remove Array Elements/3469.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public int minCost(int[] nums) {
-    final int n = nums.length;
-    Integer[][] mem = new Integer[n + 1][n + 1];
-    return minCost(/*last=*/0, 1, nums, mem);
-  }
-
-  private int minCost(int last, int i, int[] nums, Integer[][] mem) {
-    final int n = nums.length;
-    if (i == n) // Single element left.
-      return nums[last];
-    if (i == n - 1) // Two elements left.
-      return Math.max(nums[last], nums[i]);
-    if (mem[i][last] != null)
-      return mem[i][last];
-    final int a = Math.max(nums[i], nums[i + 1]) + minCost(last, i + 2, nums, mem);
-    final int b = Math.max(nums[last], nums[i]) + minCost(i + 1, i + 2, nums, mem);
-    final int c = Math.max(nums[last], nums[i + 1]) + minCost(i, i + 2, nums, mem);
-    return mem[i][last] = Math.min(a, Math.min(b, c));
-  }
-}
diff --git a/solutions/3469. Find Minimum Cost to Remove Array Elements/3469.py b/solutions/3469. Find Minimum Cost to Remove Array Elements/3469.py
deleted file mode 100644
index 6a1f6a69e9f..00000000000
--- a/solutions/3469. Find Minimum Cost to Remove Array Elements/3469.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  def minCost(self, nums: list[int]) -> int:
-    n = len(nums)
-
-    @functools.lru_cache(None)
-    def dp(last: int, i: int) -> int:
-      if i == n:  # Single element left.
-        return nums[last]
-      if i == n - 1:  # Two elements left.
-        return max(nums[last], nums[i])
-      a = max(nums[i], nums[i + 1]) + dp(last, i + 2)
-      b = max(nums[last], nums[i]) + dp(i + 1, i + 2)
-      c = max(nums[last], nums[i + 1]) + dp(i, i + 2)
-      return min(a, b, c)
-
-    return dp(0, 1)
diff --git a/solutions/347. Top K Frequent Elements/347-2.py b/solutions/347. Top K Frequent Elements/347-2.py
index 524b4525574..8f7d86c4ec8 100644
--- a/solutions/347. Top K Frequent Elements/347-2.py	
+++ b/solutions/347. Top K Frequent Elements/347-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def topKFrequent(self, nums: list[int], k: int) -> list[int]:
+  def topKFrequent(self, nums: List[int], k: int) -> List[int]:
     ans = []
     bucket = [[] for _ in range(len(nums) + 1)]
 
diff --git a/solutions/347. Top K Frequent Elements/347.cpp b/solutions/347. Top K Frequent Elements/347.cpp
index 112e067e2a5..8e1200b4a38 100644
--- a/solutions/347. Top K Frequent Elements/347.cpp	
+++ b/solutions/347. Top K Frequent Elements/347.cpp	
@@ -1,6 +1,7 @@
 struct T {
   int num;
   int freq;
+  T(int num, int freq) : num(num), freq(freq) {}
 };
 
 class Solution {
diff --git a/solutions/347. Top K Frequent Elements/347.java b/solutions/347. Top K Frequent Elements/347.java
index 199867ea600..0c21c9832c2 100644
--- a/solutions/347. Top K Frequent Elements/347.java	
+++ b/solutions/347. Top K Frequent Elements/347.java	
@@ -1,10 +1,18 @@
+class T {
+  public int num;
+  public int freq;
+  public T(int num, int freq) {
+    this.num = num;
+    this.freq = freq;
+  }
+}
+
 class Solution {
   public int[] topKFrequent(int[] nums, int k) {
-    record T(int num, int freq) {}
     final int n = nums.length;
     int[] ans = new int[k];
     Map<Integer, Integer> count = new HashMap<>();
-    Queue<T> minHeap = new PriorityQueue<>(Comparator.comparingInt(T::freq));
+    Queue<T> minHeap = new PriorityQueue<>((a, b) -> a.freq - b.freq);
 
     for (final int num : nums)
       count.merge(num, 1, Integer::sum);
diff --git a/solutions/3470. Permutations IV/3470.py b/solutions/3470. Permutations IV/3470.py
deleted file mode 100644
index ee0ba8b4599..00000000000
--- a/solutions/3470. Permutations IV/3470.py	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution:
-  def permute(self, n: int, k: int) -> list[int]:
-    ans = []
-    isLookingForEven = True
-    remainingNumbers = list(range(1, n + 1))
-
-    for turn in range(n):
-      remainingPermutations = (math.factorial((n - 1 - turn) // 2) *
-                               math.factorial((n - turn) // 2))
-      found = False
-      for index, number in enumerate(remainingNumbers):
-        if number % 2 != isLookingForEven and (turn > 0 or n % 2 == 1):
-          continue
-        if k <= remainingPermutations:
-          ans.append(remainingNumbers.pop(index))
-          isLookingForEven = ans[-1] % 2 == 0
-          found = True
-          break
-        k -= remainingPermutations
-      if not found:
-        return []
-
-    return ans
diff --git a/solutions/3471. Find the Largest Almost Missing Integer/3471.cpp b/solutions/3471. Find the Largest Almost Missing Integer/3471.cpp
deleted file mode 100644
index e1af81bcebc..00000000000
--- a/solutions/3471. Find the Largest Almost Missing Integer/3471.cpp	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
- public:
-  int largestInteger(vector<int>& nums, int k) {
-    if (k == nums.size())
-      return ranges::max(nums);
-    const vector<int> count = getCount(nums);
-    if (k == 1)
-      return maxUnique(nums, count);
-    return max(count[nums.front()] == 1 ? nums.front() : -1,
-               count[nums.back()] == 1 ? nums.back() : -1);
-  }
-
- private:
-  // Returns the maximum unique integer in nums if any. Otherwise, returns -1.
-  int maxUnique(const vector<int>& nums, const vector<int>& count) {
-    int maxUnique = -1;
-    for (const int num : nums)
-      if (count[num] == 1)
-        maxUnique = max(maxUnique, num);
-    return maxUnique;
-  }
-
-  vector<int> getCount(const vector<int>& nums) {
-    constexpr int kMax = 50;
-    vector<int> count(kMax + 1);
-    for (const int num : nums)
-      ++count[num];
-    return count;
-  }
-};
diff --git a/solutions/3471. Find the Largest Almost Missing Integer/3471.java b/solutions/3471. Find the Largest Almost Missing Integer/3471.java
deleted file mode 100644
index 0ad87c51db5..00000000000
--- a/solutions/3471. Find the Largest Almost Missing Integer/3471.java	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
-  public int largestInteger(int[] nums, int k) {
-    if (k == nums.length)
-      return Arrays.stream(nums).max().getAsInt();
-    int[] count = getCount(nums);
-    if (k == 1)
-      return maxUnique(nums, count);
-    return Math.max(count[nums[0]] == 1 ? nums[0] : -1,
-                    count[nums[nums.length - 1]] == 1 ? nums[nums.length - 1] : -1);
-  }
-
-  // Returns the maximum unique integer in nums if any. Otherwise, returns -1.
-  private int maxUnique(int[] nums, int[] count) {
-    return Arrays.stream(nums).filter(num -> count[num] == 1).max().orElse(-1);
-  }
-
-  private int[] getCount(int[] nums) {
-    final int MAX = 50;
-    int[] count = new int[MAX + 1];
-    for (final int num : nums)
-      ++count[num];
-    return count;
-  }
-}
diff --git a/solutions/3471. Find the Largest Almost Missing Integer/3471.py b/solutions/3471. Find the Largest Almost Missing Integer/3471.py
deleted file mode 100644
index f62c3be7917..00000000000
--- a/solutions/3471. Find the Largest Almost Missing Integer/3471.py	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution:
-  def largestInteger(self, nums: list[int], k: int) -> int:
-    if k == len(nums):
-      return max(nums)
-    count = collections.Counter(nums)
-    if k == 1:
-      return max([num for num in nums if count[num] == 1], default=-1)
-    return max(
-        nums[0] if count[nums[0]] == 1 else -1,
-        nums[-1] if count[nums[-1]] == 1 else -1
-    )
diff --git a/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472-2.cpp b/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472-2.cpp
deleted file mode 100644
index 0dd0164ad40..00000000000
--- a/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472-2.cpp	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution {
- public:
-  // Similar to 516. Longest Palindromic Subsequence
-  int longestPalindromicSubsequence(string s, int k) {
-    const int n = s.length();
-    // dp[i][j][op] := the length of LPS(s[i..j]) with at most `op` operations
-    vector<vector<vector<int>>> dp(n,
-                                   vector<vector<int>>(n, vector<int>(k + 1)));
-
-    for (int i = 0; i < n; ++i)
-      for (int op = 0; op <= k; ++op)
-        dp[i][i][op] = 1;
-
-    for (int d = 1; d < n; ++d)
-      for (int i = 0; i + d < n; ++i) {
-        const int j = i + d;
-        for (int op = 0; op <= k; ++op) {
-          if (s[i] == s[j]) {
-            dp[i][j][op] = 2 + dp[i + 1][j - 1][op];
-          } else {
-            dp[i][j][op] = max(dp[i + 1][j][op], dp[i][j - 1][op]);
-            const int cost = getCost(s[i], s[j]);
-            if (cost <= op)
-              dp[i][j][op] = max(dp[i][j][op], 2 + dp[i + 1][j - 1][op - cost]);
-          }
-        }
-      }
-
-    return dp[0][n - 1][k];
-  }
-
- private:
-  int getCost(char a, char b) {
-    const int dist = abs(a - b);
-    return min(dist, 26 - dist);
-  }
-};
diff --git a/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472-2.java b/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472-2.java
deleted file mode 100644
index 40d96cf0cc4..00000000000
--- a/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472-2.java	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution {
-  // Similar to 516. Longest Palindromic Subsequence
-  public int longestPalindromicSubsequence(String s, int k) {
-    final int n = s.length();
-    // dp[i][j][op] := the length of LPS(s[i..j]) with at most `op` operations
-    int[][][] dp = new int[n][n][k + 1];
-
-    for (int i = 0; i < n; ++i)
-      for (int op = 0; op <= k; ++op)
-        dp[i][i][op] = 1;
-
-    for (int d = 1; d < n; ++d)
-      for (int i = 0; i + d < n; ++i) {
-        final int j = i + d;
-        for (int op = 0; op <= k; ++op) {
-          if (s.charAt(i) == s.charAt(j)) {
-            dp[i][j][op] = 2 + dp[i + 1][j - 1][op];
-          } else {
-            dp[i][j][op] = Math.max(dp[i + 1][j][op], dp[i][j - 1][op]);
-            final int cost = getCost(s.charAt(i), s.charAt(j));
-            if (cost <= op)
-              dp[i][j][op] = Math.max(dp[i][j][op], 2 + dp[i + 1][j - 1][op - cost]);
-          }
-        }
-      }
-
-    return dp[0][n - 1][k];
-  }
-
-  private int getCost(char a, char b) {
-    final int dist = Math.abs(a - b);
-    return Math.min(dist, 26 - dist);
-  }
-}
diff --git a/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472-2.py b/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472-2.py
deleted file mode 100644
index 54ef27bb7a2..00000000000
--- a/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472-2.py	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution:
-  # Similar to 516. Longest Palindromic Subsequence
-  def longestPalindromicSubsequence(self, s: str, k: int) -> int:
-    n = len(s)
-    # dp[i][j][op] := the length of LPS(s[i..j]) with at most `op` operations
-    dp = [[[0] * (k + 1) for _ in range(n)] for _ in range(n)]
-
-    for i in range(n):
-      for op in range(k + 1):
-        dp[i][i][op] = 1
-
-    for d in range(1, n):
-      for i in range(n - d):
-        j = i + d
-        for op in range(k + 1):
-          if s[i] == s[j]:
-            dp[i][j][op] = 2 + dp[i + 1][j - 1][op]
-          else:
-            dp[i][j][op] = max(dp[i + 1][j][op], dp[i][j - 1][op])
-            cost = self._getCost(s[i], s[j])
-            if cost <= op:
-              dp[i][j][op] = max(dp[i][j][op], 2 + dp[i + 1][j - 1][op - cost])
-
-    return dp[0][n - 1][k]
-
-  def _getCost(self, a: str, b: str) -> int:
-    dist = abs(ord(a) - ord(b))
-    return min(dist, 26 - dist)
diff --git a/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472.cpp b/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472.cpp
deleted file mode 100644
index 3ef026408da..00000000000
--- a/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472.cpp	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution {
- public:
-  // Similar to 516. Longest Palindromic Subsequence
-  int longestPalindromicSubsequence(string s, int k) {
-    const int n = s.length();
-    vector<vector<vector<int>>> mem(
-        n, vector<vector<int>>(n, vector<int>(k + 1, -1)));
-    return lps(s, 0, n - 1, k, mem);
-  }
-
- private:
-  // Returns the length of LPS(s[i..j]) with at most `op` operations.
-  int lps(const string& s, int i, int j, int op,
-          vector<vector<vector<int>>>& mem) {
-    if (i > j)
-      return 0;
-    if (i == j)
-      return 1;
-    if (mem[i][j][op] != -1)
-      return mem[i][j][op];
-    if (s[i] == s[j])
-      return mem[i][j][op] = 2 + lps(s, i + 1, j - 1, op, mem);
-    mem[i][j][op] = max(lps(s, i + 1, j, op, mem), lps(s, i, j - 1, op, mem));
-    const int cost = getCost(s[i], s[j]);
-    if (cost <= op)
-      mem[i][j][op] =
-          max(mem[i][j][op], 2 + lps(s, i + 1, j - 1, op - cost, mem));
-    return mem[i][j][op];
-  }
-
-  int getCost(char a, char b) {
-    const int dist = abs(a - b);
-    return min(dist, 26 - dist);
-  }
-};
diff --git a/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472.java b/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472.java
deleted file mode 100644
index a3947fdaffa..00000000000
--- a/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472.java	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
-  // Similar to 516. Longest Palindromic Subsequence
-  public int longestPalindromicSubsequence(String s, int k) {
-    final int n = s.length();
-    Integer[][][] mem = new Integer[n][n][k + 1];
-    return lps(s, 0, n - 1, k, mem);
-  }
-
-  // Returns the length of LPS(s[i..j]) with at most `op` operations.
-  private int lps(String s, int i, int j, int op, Integer[][][] mem) {
-    if (i > j)
-      return 0;
-    if (i == j)
-      return 1;
-    if (mem[i][j][op] != null)
-      return mem[i][j][op];
-    if (s.charAt(i) == s.charAt(j))
-      return mem[i][j][op] = 2 + lps(s, i + 1, j - 1, op, mem);
-    mem[i][j][op] = Math.max(lps(s, i + 1, j, op, mem), lps(s, i, j - 1, op, mem));
-    final int cost = getCost(s.charAt(i), s.charAt(j));
-    if (cost <= op)
-      mem[i][j][op] = Math.max(mem[i][j][op], 2 + lps(s, i + 1, j - 1, op - cost, mem));
-    return mem[i][j][op];
-  }
-
-  private int getCost(char a, char b) {
-    final int dist = Math.abs(a - b);
-    return Math.min(dist, 26 - dist);
-  }
-}
diff --git a/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472.py b/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472.py
deleted file mode 100644
index b502e6e9b5b..00000000000
--- a/solutions/3472. Longest Palindromic Subsequence After at Most K Operations/3472.py	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution:
-  # Similar to 516. Longest Palindromic Subsequence
-  def longestPalindromicSubsequence(self, s: str, k: int) -> int:
-    @functools.lru_cache(None)
-    def dp(i: int, j: int, op: int) -> int:
-      """Returns the length of LPS(s[i..j]) with at most `op` operations."""
-      if i > j:
-        return 0
-      if i == j:
-        return 1
-      if s[i] == s[j]:
-        return 2 + dp(i + 1, j - 1, op)
-      res = max(dp(i + 1, j, op), dp(i, j - 1, op))
-      cost = self._getCost(s[i], s[j])
-      if cost <= op:
-        res = max(res, 2 + dp(i + 1, j - 1, op - cost))
-      return res
-
-    return dp(0, len(s) - 1, k)
-
-  def _getCost(self, a: str, b: str) -> int:
-    dist = abs(ord(a) - ord(b))
-    return min(dist, 26 - dist)
diff --git a/solutions/3473. Sum of K Subarrays With Length at Least M/3473-2.cpp b/solutions/3473. Sum of K Subarrays With Length at Least M/3473-2.cpp
deleted file mode 100644
index bd90600a47b..00000000000
--- a/solutions/3473. Sum of K Subarrays With Length at Least M/3473-2.cpp	
+++ /dev/null
@@ -1,36 +0,0 @@
-class Solution {
- public:
-  int maxSum(vector<int>& nums, int k, int m) {
-    constexpr int kInf = 20000000;
-    const int n = nums.size();
-    vector<int> prefix(n + 1);
-    // dp[i][ongoing][r] := the maximum sum of nums[i..n - 1], with `ongoing`
-    // indicating if a subarray is currently being extended (1) or not (0), and
-    // `r` segments left to choose
-    vector<vector<vector<int>>> dp(
-        n + 1, vector<vector<int>>(2, vector<int>(k + 1, -kInf)));
-
-    partial_sum(nums.begin(), nums.end(), prefix.begin() + 1);
-
-    // Base case: At the end of the array, if no segments are left, score is 0.
-    dp[n][0][0] = dp[n][1][0] = 0;
-
-    for (int i = n - 1; i >= 0; --i)
-      for (int rem = 0; rem <= k; ++rem) {
-        // When no subarray is ongoing:
-        // 1. Skip nums[i].
-        dp[i][0][rem] = dp[i + 1][0][rem];
-        // 2. Start a new segment of length m (only if rem > 0 and there're
-        // enough elements)
-        if (rem > 0 && i + m <= n)
-          dp[i][0][rem] = max(dp[i][0][rem], dp[i + m][1][rem - 1] +
-                                                 (prefix[i + m] - prefix[i]));
-        // When a subarray is ongoing:
-        // 1. End the current subarray (transition to state 0, same index i)
-        // 2. Extend the current subarray by picking nums[i] and move to i + 1
-        dp[i][1][rem] = max(dp[i][0][rem], dp[i + 1][1][rem] + nums[i]);
-      }
-
-    return dp[0][0][k];
-  }
-};
diff --git a/solutions/3473. Sum of K Subarrays With Length at Least M/3473-2.java b/solutions/3473. Sum of K Subarrays With Length at Least M/3473-2.java
deleted file mode 100644
index 0bc8b916025..00000000000
--- a/solutions/3473. Sum of K Subarrays With Length at Least M/3473-2.java	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution {
-  public int maxSum(int[] nums, int k, int m) {
-    final int INF = 20_000_000;
-    final int n = nums.length;
-    int[] prefix = new int[n + 1];
-    // dp[i][ongoing][r] := the maximum sum of nums[i..n - 1], with `ongoing`
-    // indicating if a subarray is currently being extended (1) or not (0), and
-    // `r` segments left to choose
-    int[][][] dp = new int[n + 1][2][k + 1];
-
-    for (int i = 0; i < n; ++i)
-      prefix[i + 1] = prefix[i] + nums[i];
-
-    Arrays.stream(dp).forEach(row -> Arrays.stream(row).forEach(col -> Arrays.fill(col, -INF)));
-
-    // Base case: At the end of the array, if no segments are left, score is 0.
-    dp[n][0][0] = dp[n][1][0] = 0;
-
-    for (int i = n - 1; i >= 0; --i)
-      for (int rem = 0; rem <= k; ++rem) {
-        // When no subarray is ongoing:
-        // 1. Skip nums[i].
-        dp[i][0][rem] = dp[i + 1][0][rem];
-        // 2. Start a new segment of length m (only if rem > 0 and there're
-        // enough elements)
-        if (rem > 0 && i + m <= n)
-          dp[i][0][rem] =
-              Math.max(dp[i][0][rem], dp[i + m][1][rem - 1] + (prefix[i + m] - prefix[i]));
-        // When a subarray is ongoing:
-        // 1. End the current subarray (transition to state 0, same index i)
-        // 2. Extend the current subarray by picking nums[i] and move to i + 1
-        dp[i][1][rem] = Math.max(dp[i][0][rem], dp[i + 1][1][rem] + nums[i]);
-      }
-
-    return dp[0][0][k];
-  }
-}
diff --git a/solutions/3473. Sum of K Subarrays With Length at Least M/3473-2.py b/solutions/3473. Sum of K Subarrays With Length at Least M/3473-2.py
deleted file mode 100644
index 8178d894737..00000000000
--- a/solutions/3473. Sum of K Subarrays With Length at Least M/3473-2.py	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution:
-  def maxSum(self, nums: list[int], k: int, m: int) -> int:
-    INF = 20_000_000
-    n = len(nums)
-    prefix = list(itertools.accumulate(nums, initial=0))
-
-    # dp[i][ongoing][r] := the maximum sum of nums[i:], with `ongoing`
-    # indicating if a subarray is currently being extended (1) or not (0),
-    # and `r` segments left to choose
-    dp = [[[-INF] * (k + 1) for _ in range(2)] for _ in range(n + 1)]
-
-    # Base case: At the end of the array, if no segments are left, score is 0
-    dp[n][0][0] = dp[n][1][0] = 0
-
-    for i in range(n - 1, -1, -1):
-      for rem in range(k + 1):
-        # When no subarray is ongoing:
-        # 1. Skip nums[i]
-        dp[i][0][rem] = dp[i + 1][0][rem]
-        # 2. Start a new segment of length m (only if rem > 0 and there're enough elements)
-        if rem > 0 and i + m <= n:
-          dp[i][0][rem] = max(
-              dp[i][0][rem],
-              dp[i + m][1][rem - 1] + (prefix[i + m] - prefix[i]))
-        # When a subarray is ongoing:
-        # 1. End the current subarray (transition to state 0, same index i)
-        # 2. Extend the current subarray by picking nums[i] and move to i + 1
-        dp[i][1][rem] = max(dp[i][0][rem], dp[i + 1][1][rem] + nums[i])
-
-    return dp[0][0][k]
diff --git a/solutions/3473. Sum of K Subarrays With Length at Least M/3473.cpp b/solutions/3473. Sum of K Subarrays With Length at Least M/3473.cpp
deleted file mode 100644
index 0c6a451a9c1..00000000000
--- a/solutions/3473. Sum of K Subarrays With Length at Least M/3473.cpp	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
- public:
-  int maxSum(vector<int>& nums, int k, int m) {
-    const int n = nums.size();
-    vector<int> prefix(n + 1);
-    vector<vector<vector<int>>> mem(
-        n, vector<vector<int>>(2, vector<int>(k + 1, -1)));
-    partial_sum(nums.begin(), nums.end(), prefix.begin() + 1);
-    return maxSum(nums, 0, /*ongoing=*/0, k, m, prefix, mem);
-  }
-
- private:
-  static constexpr int kInf = 20'000'000;
-
-  int maxSum(const vector<int>& nums, int i, int ongoing, int k, const int& m,
-             const vector<int>& prefix, vector<vector<vector<int>>>& mem) {
-    if (k < 0)
-      return -kInf;
-    if (i == nums.size())
-      return k == 0 ? 0 : -kInf;
-    if (mem[i][ongoing][k] != -1)
-      return mem[i][ongoing][k];
-    if (ongoing == 1)
-      // 1. End the current subarray (transition to state 0, same index i)
-      // 2. Extend the current subarray by picking nums[i] and move to i + 1.
-      return mem[i][1][k] =
-                 max(maxSum(nums, i, 0, k, m, prefix, mem),
-                     maxSum(nums, i + 1, 1, k, m, prefix, mem) + nums[i]);
-    // ongoing == 0
-    // 1. Skip nums[i].
-    // 2. Pick nums[i..i + m - 1] (only if k > 0 and there're enough elements).
-    int res = maxSum(nums, i + 1, 0, k, m, prefix, mem);
-    if (i + m <= nums.size())  // If we have enough elements for a new segment
-      res = max(res, maxSum(nums, i + m, 1, k - 1, m, prefix, mem) +
-                         (prefix[i + m] - prefix[i]));
-    return mem[i][0][k] = res;
-  }
-};
diff --git a/solutions/3473. Sum of K Subarrays With Length at Least M/3473.java b/solutions/3473. Sum of K Subarrays With Length at Least M/3473.java
deleted file mode 100644
index af8423f18cb..00000000000
--- a/solutions/3473. Sum of K Subarrays With Length at Least M/3473.java	
+++ /dev/null
@@ -1,36 +0,0 @@
-class Solution {
-  public int maxSum(int[] nums, int k, int m) {
-    final int n = nums.length;
-    int[] prefix = new int[n + 1];
-    Integer[][][] mem = new Integer[n][2][k + 1];
-    for (int i = 0; i < n; i++)
-      prefix[i + 1] = prefix[i] + nums[i];
-    return maxSum(nums, 0, 0, k, m, prefix, mem);
-  }
-
-  private static final int INF = 20_000_000;
-
-  private int maxSum(int[] nums, int i, int ongoing, int k, int m, int[] prefix,
-                     Integer[][][] mem) {
-    if (k < 0)
-      return -INF;
-    if (i == nums.length)
-      return k == 0 ? 0 : -INF;
-    if (mem[i][ongoing][k] != null)
-      return mem[i][ongoing][k];
-    if (ongoing == 1)
-      // 1. End the current subarray (transition to state 0, same index i)
-      // 2. Extend the current subarray by picking nums[i] and move to i + 1.
-      return mem[i][1][k] = Math.max(maxSum(nums, i, 0, k, m, prefix, mem),
-                                     maxSum(nums, i + 1, 1, k, m, prefix, mem) + nums[i]);
-    // ongoing == 0
-    // 1. Skip nums[i].
-    // 2. Pick nums[i..i + m - 1] (only if k > 0 and there're enough elements).
-    int res = maxSum(nums, i + 1, 0, k, m, prefix, mem);
-    if (i + m <= nums.length) // If we have enough elements for a new segment
-      res = Math.max(res,
-                     maxSum(nums, i + m, 1, k - 1, m, prefix, mem) + (prefix[i + m] - prefix[i]));
-
-    return mem[i][0][k] = res;
-  }
-}
diff --git a/solutions/3473. Sum of K Subarrays With Length at Least M/3473.py b/solutions/3473. Sum of K Subarrays With Length at Least M/3473.py
deleted file mode 100644
index 832577095cf..00000000000
--- a/solutions/3473. Sum of K Subarrays With Length at Least M/3473.py	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution:
-  def maxSum(self, nums: list[int], k: int, m: int) -> int:
-    INF = 20_000_000
-    n = len(nums)
-    prefix = list(itertools.accumulate(nums, initial=0))
-
-    @functools.lru_cache(None)
-    def dp(i: int, ongoing: int, k: int) -> int:
-      if k < 0:
-        return -INF
-      if i == n:
-        return 0 if k == 0 else -INF
-      if ongoing == 1:
-        # 1. End the current subarray (transition to state 0, same index i)
-        # 2. Extend the current subarray by picking nums[i] and move to i + 1
-        return max(dp(i, 0, k),
-                   dp(i + 1, 1, k) + nums[i])
-      # ongoing == 0
-      # 1. Skip nums[i]
-      # 2. Pick nums[i:i+m] (only if k > 0 and there're enough elements)
-      res = dp(i + 1, 0, k)
-      if i + m <= n:  # If we have enough elements for a new segment
-        res = max(res,
-                  dp(i + m, 1, k - 1) + (prefix[i + m] - prefix[i]))
-      return res
-
-    return dp(0, 0, k)
diff --git a/solutions/3474. Lexicographically Smallest Generated String/3474.cpp b/solutions/3474. Lexicographically Smallest Generated String/3474.cpp
deleted file mode 100644
index 6e0153aaa81..00000000000
--- a/solutions/3474. Lexicographically Smallest Generated String/3474.cpp	
+++ /dev/null
@@ -1,58 +0,0 @@
-class Solution {
- public:
-  string generateString(string str1, string str2) {
-    const int n = str1.length();
-    const int m = str2.length();
-    const int sz = n + m - 1;
-    string ans(sz, '\0');
-    vector<bool> modifiable(sz, true);
-
-    // 1. Handle all 'T' positions first.
-    for (int i = 0; i < n; ++i)
-      if (str1[i] == 'T')
-        for (int j = 0; j < m; ++j) {
-          const int pos = i + j;
-          if (ans[pos] && ans[pos] != str2[j])
-            return "";
-          ans[pos] = str2[j];
-          modifiable[pos] = false;
-        }
-
-    // 2. Fill all remaining positions with 'a'.
-    for (int i = 0; i < sz; ++i)
-      if (ans[i] == '\0')
-        ans[i] = 'a';
-
-    // 3. Handle all 'F' positions.
-    for (int i = 0; i < n; ++i)
-      if (str1[i] == 'F' && match(ans, i, str2)) {
-        const int modifiablePos = lastModifiablePosition(i, m, modifiable);
-        if (modifiablePos == -1)
-          return "";
-        ans[modifiablePos] = 'b';
-        modifiable[modifiablePos] = false;
-      }
-
-    return ans;
-  }
-
- private:
-  // Returns true if the substring of ans starting at `i` matches `s`.
-  bool match(string& ans, int i, string& s) {
-    for (int j = 0; j < s.length(); ++j)
-      if (ans[i + j] != s[j])
-        return false;
-    return true;
-  }
-
-  // Finds the last modifiable position in the substring ans starting at `i`.
-  int lastModifiablePosition(int i, int m, vector<bool>& modifiable) {
-    int modifiablePos = -1;
-    for (int j = 0; j < m; ++j) {
-      const int pos = i + j;
-      if (modifiable[pos])
-        modifiablePos = pos;
-    }
-    return modifiablePos;
-  }
-};
diff --git a/solutions/3474. Lexicographically Smallest Generated String/3474.java b/solutions/3474. Lexicographically Smallest Generated String/3474.java
deleted file mode 100644
index 1e46c66523a..00000000000
--- a/solutions/3474. Lexicographically Smallest Generated String/3474.java	
+++ /dev/null
@@ -1,57 +0,0 @@
-class Solution {
-  public String generateString(String str1, String str2) {
-    final int n = str1.length();
-    final int m = str2.length();
-    final int sz = n + m - 1;
-    char[] ans = new char[sz];
-    boolean[] modifiable = new boolean[sz];
-    Arrays.fill(modifiable, true);
-
-    // 1. Handle all 'T' positions first.
-    for (int i = 0; i < n; ++i)
-      if (str1.charAt(i) == 'T')
-        for (int j = 0; j < m; ++j) {
-          final int pos = i + j;
-          if (ans[pos] != 0 && ans[pos] != str2.charAt(j))
-            return "";
-          ans[pos] = str2.charAt(j);
-          modifiable[pos] = false;
-        }
-
-    // 2. Fill all remaining positions with 'a'.
-    for (int i = 0; i < sz; ++i)
-      if (ans[i] == 0)
-        ans[i] = 'a';
-
-    // 3. Handle all 'F' positions.
-    for (int i = 0; i < n; ++i)
-      if (str1.charAt(i) == 'F' && match(ans, i, str2)) {
-        final int modifiablePos = lastModifiablePosition(i, m, modifiable);
-        if (modifiablePos == -1)
-          return "";
-        ans[modifiablePos] = 'b';
-        modifiable[modifiablePos] = false;
-      }
-
-    return new String(ans);
-  }
-
-  // Returns true if the substring of ans starting at `i` matches `s`.
-  private boolean match(char[] ans, int i, String s) {
-    for (int j = 0; j < s.length(); ++j)
-      if (ans[i + j] != s.charAt(j))
-        return false;
-    return true;
-  }
-
-  // Finds the last modifiable position in the substring ans starting at `i`.
-  private int lastModifiablePosition(int i, int m, boolean[] modifiable) {
-    int modifiablePos = -1;
-    for (int j = 0; j < m; ++j) {
-      final int pos = i + j;
-      if (modifiable[pos])
-        modifiablePos = pos;
-    }
-    return modifiablePos;
-  }
-}
diff --git a/solutions/3474. Lexicographically Smallest Generated String/3474.py b/solutions/3474. Lexicographically Smallest Generated String/3474.py
deleted file mode 100644
index 0015bfd5649..00000000000
--- a/solutions/3474. Lexicographically Smallest Generated String/3474.py	
+++ /dev/null
@@ -1,51 +0,0 @@
-class Solution:
-  def generateString(self, str1: str, str2: str) -> str:
-    n = len(str1)
-    m = len(str2)
-    sz = n + m - 1
-    ans = [None] * sz
-    modifiable = [True] * sz
-
-    # 1. Handle all 'T' positions first.
-    for i, tf in enumerate(str1):
-      if tf == 'T':
-        for j, c in enumerate(str2):
-          pos = i + j
-          if ans[pos] and ans[pos] != c:
-            return ''
-          ans[pos] = c
-          modifiable[pos] = False
-
-    # 2. Fill all remaining positions with 'a'.
-    for i in range(sz):
-      if not ans[i]:
-        ans[i] = 'a'
-
-    # 3. Handle all 'F' positions.
-    for i in range(n):
-      if str1[i] == 'F' and self._match(ans, i, str2):
-        modifiablePos = self._lastModifiablePosition(i, m, modifiable)
-        if modifiablePos == -1:
-          return ''
-        ans[modifiablePos] = 'b'
-        modifiable[modifiablePos] = False
-
-    return ''.join(ans)
-
-  def _match(self, ans: list, i: int, s: str) -> bool:
-    """Returns True if the substring of ans starting at `i` matches `s`."""
-    for j, c in enumerate(s):
-      if ans[i + j] != c:
-        return False
-    return True
-
-  def _lastModifiablePosition(self, i: int, m: int, modifiable: list) -> int:
-    """
-    Finds the last modifiable position in the substring of ans starting at `i`.
-    """
-    modifiablePos = -1
-    for j in range(m):
-      pos = i + j
-      if modifiable[pos]:
-        modifiablePos = pos
-    return modifiablePos
diff --git a/solutions/3475. DNA Pattern Recognition/3475.sql b/solutions/3475. DNA Pattern Recognition/3475.sql
deleted file mode 100644
index fd4cbba6716..00000000000
--- a/solutions/3475. DNA Pattern Recognition/3475.sql	
+++ /dev/null
@@ -1,8 +0,0 @@
-SELECT
-  *,
-  dna_sequence REGEXP '^ATG' AS has_start,
-  dna_sequence REGEXP 'TAA$|TAG$|TGA$' AS has_stop,
-  dna_sequence REGEXP 'ATAT' AS has_atat,
-  dna_sequence REGEXP 'GGG' AS has_ggg
-FROM Samples
-ORDER BY sample_id;
diff --git a/solutions/3476. Maximize Profit from Task Assignment/3476.cpp b/solutions/3476. Maximize Profit from Task Assignment/3476.cpp
deleted file mode 100644
index 5156e79fbb8..00000000000
--- a/solutions/3476. Maximize Profit from Task Assignment/3476.cpp	
+++ /dev/null
@@ -1,31 +0,0 @@
-class Solution {
- public:
-  long long maxProfit(vector<int>& workers, vector<vector<int>>& tasks) {
-    long totalProfit = 0;
-    int maxRemainingProfit = 0;
-    unordered_map<int, vector<int>> skillToProfits;
-
-    for (const vector<int>& task : tasks) {
-      const int skill = task[0];
-      const int profit = task[1];
-      skillToProfits[skill].push_back(profit);
-    }
-
-    for (auto& [_, profits] : skillToProfits)
-      ranges::sort(profits, greater<int>());
-
-    for (const int workerSkill : workers)
-      if (skillToProfits.contains(workerSkill) &&
-          !skillToProfits[workerSkill].empty()) {
-        const int profit = skillToProfits[workerSkill][0];
-        skillToProfits[workerSkill].erase(skillToProfits[workerSkill].begin());
-        totalProfit += profit;
-      }
-
-    for (const auto& [_, profits] : skillToProfits)
-      if (!profits.empty())
-        maxRemainingProfit = max(maxRemainingProfit, profits[0]);
-
-    return totalProfit + maxRemainingProfit;
-  }
-};
diff --git a/solutions/3476. Maximize Profit from Task Assignment/3476.java b/solutions/3476. Maximize Profit from Task Assignment/3476.java
deleted file mode 100644
index a9bf8fcbc36..00000000000
--- a/solutions/3476. Maximize Profit from Task Assignment/3476.java	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution {
-  public long maxProfit(int[] workers, int[][] tasks) {
-    long totalProfit = 0;
-    int maxRemainingProfit = 0;
-    Map<Integer, List<Integer>> skillToProfits = new HashMap<>();
-
-    for (int[] task : tasks) {
-      final int skill = task[0];
-      final int profit = task[1];
-      skillToProfits.computeIfAbsent(skill, k -> new ArrayList<>()).add(profit);
-    }
-
-    for (List<Integer> profits : skillToProfits.values())
-      Collections.sort(profits, Collections.reverseOrder());
-
-    for (final int workerSkill : workers)
-      if (skillToProfits.containsKey(workerSkill) && !skillToProfits.get(workerSkill).isEmpty()) {
-        final int profit = skillToProfits.get(workerSkill).get(0);
-        skillToProfits.get(workerSkill).remove(0);
-        totalProfit += profit;
-      }
-
-    for (List<Integer> profits : skillToProfits.values())
-      if (!profits.isEmpty())
-        maxRemainingProfit = Math.max(maxRemainingProfit, profits.get(0));
-
-    return totalProfit + maxRemainingProfit;
-  }
-}
diff --git a/solutions/3476. Maximize Profit from Task Assignment/3476.py b/solutions/3476. Maximize Profit from Task Assignment/3476.py
deleted file mode 100644
index 962ba80345a..00000000000
--- a/solutions/3476. Maximize Profit from Task Assignment/3476.py	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution:
-  def maxProfit(self, workers: list[int], tasks: list[list[int]]) -> int:
-    totalProfit = 0
-    skillToProfits = collections.defaultdict(list)
-
-    for skill, profit in tasks:
-      skillToProfits[skill].append(profit)
-
-    for skill in skillToProfits:
-      skillToProfits[skill].sort(reverse=True)
-
-    for workerSkill in workers:
-      if workerSkill in skillToProfits and skillToProfits[workerSkill]:
-        profit = skillToProfits[workerSkill][0]
-        skillToProfits[workerSkill].pop(0)
-        totalProfit += profit
-
-    return totalProfit + max(max(profits, default=0)
-                             for profits in skillToProfits.values())
diff --git a/solutions/3477. Fruits Into Baskets II/3477.cpp b/solutions/3477. Fruits Into Baskets II/3477.cpp
deleted file mode 100644
index 4f053a14aa1..00000000000
--- a/solutions/3477. Fruits Into Baskets II/3477.cpp	
+++ /dev/null
@@ -1,77 +0,0 @@
-class SegmentTree {
- public:
-  explicit SegmentTree(const vector<int>& nums) : n(nums.size()), tree(n * 4) {
-    build(nums, 0, 0, n - 1);
-  }
-
-  // Updates nums[i] to val.
-  void update(int i, int val) {
-    update(0, 0, n - 1, i, val);
-  }
-
-  // Returns the first index i where baskets[i] >= target, or -1 if not found.
-  int queryFirst(int target) {
-    return queryFirst(0, 0, n - 1, target);
-  }
-
- private:
-  const int n;       // the size of the input array
-  vector<int> tree;  // the segment tree
-
-  void build(const vector<int>& nums, int treeIndex, int lo, int hi) {
-    if (lo == hi) {
-      tree[treeIndex] = nums[lo];
-      return;
-    }
-    const int mid = (lo + hi) / 2;
-    build(nums, 2 * treeIndex + 1, lo, mid);
-    build(nums, 2 * treeIndex + 2, mid + 1, hi);
-    tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
-  }
-
-  void update(int treeIndex, int lo, int hi, int i, int val) {
-    if (lo == hi) {
-      tree[treeIndex] = val;
-      return;
-    }
-    const int mid = (lo + hi) / 2;
-    if (i <= mid)
-      update(2 * treeIndex + 1, lo, mid, i, val);
-    else
-      update(2 * treeIndex + 2, mid + 1, hi, i, val);
-    tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
-  }
-
-  int queryFirst(int treeIndex, int lo, int hi, int target) {
-    if (tree[treeIndex] < target)
-      return -1;
-    if (lo == hi) {
-      // Found a valid position, mark it as used by setting to -1.
-      update(lo, -1);
-      return lo;
-    }
-    const int mid = (lo + hi) / 2;
-    const int leftChild = tree[2 * treeIndex + 1];
-    return leftChild >= target
-               ? queryFirst(2 * treeIndex + 1, lo, mid, target)
-               : queryFirst(2 * treeIndex + 2, mid + 1, hi, target);
-  }
-
-  int merge(int left, int right) const {
-    return max(left, right);
-  }
-};
-
-class Solution {
- public:
-  int numOfUnplacedFruits(vector<int>& fruits, vector<int>& baskets) {
-    int ans = 0;
-    SegmentTree tree(baskets);
-
-    for (const int fruit : fruits)
-      if (tree.queryFirst(fruit) == -1)
-        ++ans;
-
-    return ans;
-  }
-};
diff --git a/solutions/3478. Choose K Elements With Maximum Sum/3478.cpp b/solutions/3478. Choose K Elements With Maximum Sum/3478.cpp
deleted file mode 100644
index fff5201fa15..00000000000
--- a/solutions/3478. Choose K Elements With Maximum Sum/3478.cpp	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution {
- public:
-  vector<long long> findMaxSum(vector<int>& nums1, vector<int>& nums2, int k) {
-    const int n = nums1.size();
-    vector<long long> ans(n);
-    vector<pair<int, int>> numAndIndexes;
-    priority_queue<long long, vector<long long>, greater<long long>> minHeap;
-
-    for (int i = 0; i < n; i++)
-      numAndIndexes.emplace_back(nums1[i], i);
-
-    ranges::sort(numAndIndexes);
-
-    const int firstIndex = numAndIndexes[0].second;
-    minHeap.push(nums2[firstIndex]);
-    long sum = nums2[firstIndex];
-
-    for (int i = 1; i < n; ++i) {
-      const auto& [currNum, currIndex] = numAndIndexes[i];
-      const auto& [prevNum, prevIndex] = numAndIndexes[i - 1];
-      if (currNum == prevNum)
-        ans[currIndex] = ans[prevIndex];
-      else
-        ans[currIndex] = sum;
-      minHeap.push(nums2[currIndex]);
-      sum += nums2[currIndex];
-      if (minHeap.size() == k + 1)
-        sum -= minHeap.top(), minHeap.pop();
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3478. Choose K Elements With Maximum Sum/3478.java b/solutions/3478. Choose K Elements With Maximum Sum/3478.java
deleted file mode 100644
index a5023cbe0a6..00000000000
--- a/solutions/3478. Choose K Elements With Maximum Sum/3478.java	
+++ /dev/null
@@ -1,35 +0,0 @@
-
-class Solution {
-  public long[] findMaxSum(int[] nums1, int[] nums2, int k) {
-    final int n = nums1.length;
-    long[] ans = new long[n];
-    Pair<Integer, Integer>[] numAndIndexes = new Pair[n];
-    Queue<Long> minHeap = new PriorityQueue<>();
-
-    for (int i = 0; i < n; ++i)
-      numAndIndexes[i] = new Pair<>(nums1[i], i);
-
-    Arrays.sort(numAndIndexes, Comparator.comparingInt(Pair::getKey));
-
-    final int firstIndex = numAndIndexes[0].getValue();
-    minHeap.offer((long) nums2[firstIndex]);
-    long sum = nums2[firstIndex];
-
-    for (int i = 1; i < n; ++i) {
-      final int currNum = numAndIndexes[i].getKey();
-      final int currIndex = numAndIndexes[i].getValue();
-      final int prevNum = numAndIndexes[i - 1].getKey();
-      final int prevIndex = numAndIndexes[i - 1].getValue();
-      if (currNum == prevNum)
-        ans[currIndex] = ans[prevIndex];
-      else
-        ans[currIndex] = sum;
-      minHeap.offer((long) nums2[currIndex]);
-      sum += nums2[currIndex];
-      if (minHeap.size() == k + 1)
-        sum -= minHeap.poll();
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3478. Choose K Elements With Maximum Sum/3478.py b/solutions/3478. Choose K Elements With Maximum Sum/3478.py
deleted file mode 100644
index 2dcbe2aaf0d..00000000000
--- a/solutions/3478. Choose K Elements With Maximum Sum/3478.py	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution:
-  def findMaxSum(self, nums1: list[int], nums2: list[int], k: int) -> list[int]:
-    ans = [0] * len(nums1)
-    numAndIndexes = sorted([(num, i) for i, num in enumerate(nums1)])
-    minHeap = []
-
-    firstIndex = numAndIndexes[0][1]
-    heapq.heappush(minHeap, nums2[firstIndex])
-    summ = nums2[firstIndex]
-
-    for (prevNum, prevIndex), (currNum, currIndex) in itertools.pairwise(numAndIndexes):
-      if currNum == prevNum:
-        ans[currIndex] = ans[prevIndex]
-      else:
-        ans[currIndex] = summ
-      heapq.heappush(minHeap, nums2[currIndex])
-      summ += nums2[currIndex]
-      if len(minHeap) == k + 1:
-        summ -= heapq.heappop(minHeap)
-
-    return ans
diff --git a/solutions/3479. Fruits Into Baskets III/3479.cpp b/solutions/3479. Fruits Into Baskets III/3479.cpp
deleted file mode 100644
index 4b08e94c5ca..00000000000
--- a/solutions/3479. Fruits Into Baskets III/3479.cpp	
+++ /dev/null
@@ -1,78 +0,0 @@
-class SegmentTree {
- public:
-  explicit SegmentTree(const vector<int>& nums) : n(nums.size()), tree(n * 4) {
-    build(nums, 0, 0, n - 1);
-  }
-
-  // Updates nums[i] to val.
-  void update(int i, int val) {
-    update(0, 0, n - 1, i, val);
-  }
-
-  // Returns the first index i where baskets[i] >= target, or -1 if not found.
-  int queryFirst(int target) {
-    return queryFirst(0, 0, n - 1, target);
-  }
-
- private:
-  const int n;       // the size of the input array
-  vector<int> tree;  // the segment tree
-
-  void build(const vector<int>& nums, int treeIndex, int lo, int hi) {
-    if (lo == hi) {
-      tree[treeIndex] = nums[lo];
-      return;
-    }
-    const int mid = (lo + hi) / 2;
-    build(nums, 2 * treeIndex + 1, lo, mid);
-    build(nums, 2 * treeIndex + 2, mid + 1, hi);
-    tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
-  }
-
-  void update(int treeIndex, int lo, int hi, int i, int val) {
-    if (lo == hi) {
-      tree[treeIndex] = val;
-      return;
-    }
-    const int mid = (lo + hi) / 2;
-    if (i <= mid)
-      update(2 * treeIndex + 1, lo, mid, i, val);
-    else
-      update(2 * treeIndex + 2, mid + 1, hi, i, val);
-    tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
-  }
-
-  int queryFirst(int treeIndex, int lo, int hi, int target) {
-    if (tree[treeIndex] < target)
-      return -1;
-    if (lo == hi) {
-      // Found a valid position, mark it as used by setting to -1.
-      update(lo, -1);
-      return lo;
-    }
-    const int mid = (lo + hi) / 2;
-    const int leftChild = tree[2 * treeIndex + 1];
-    return leftChild >= target
-               ? queryFirst(2 * treeIndex + 1, lo, mid, target)
-               : queryFirst(2 * treeIndex + 2, mid + 1, hi, target);
-  }
-
-  int merge(int left, int right) const {
-    return max(left, right);
-  }
-};
-
-class Solution {
- public:
-  // Same as 3477. Fruits Into Baskets II
-  int numOfUnplacedFruits(vector<int>& fruits, vector<int>& baskets) {
-    int ans = 0;
-    SegmentTree tree(baskets);
-
-    for (const int fruit : fruits)
-      if (tree.queryFirst(fruit) == -1)
-        ++ans;
-
-    return ans;
-  }
-};
diff --git a/solutions/348. Design Tic-Tac-Toe/348.cpp b/solutions/348. Design Tic-Tac-Toe/348.cpp
index 6b427f69506..b6b7d546cd8 100644
--- a/solutions/348. Design Tic-Tac-Toe/348.cpp	
+++ b/solutions/348. Design Tic-Tac-Toe/348.cpp	
@@ -13,7 +13,7 @@ class TicTacToe {
    *         1: Player 1 wins.
    *         2: Player 2 wins.
    */
-  int std::move(int row, int col, int player) {
+  int move(int row, int col, int player) {
     const int toAdd = player == 1 ? 1 : -1;
     const int target = player == 1 ? n : -n;
 
diff --git a/solutions/3480. Maximize Subarrays After Removing One Conflicting Pair/3480.cpp b/solutions/3480. Maximize Subarrays After Removing One Conflicting Pair/3480.cpp
deleted file mode 100644
index 76608451539..00000000000
--- a/solutions/3480. Maximize Subarrays After Removing One Conflicting Pair/3480.cpp	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution {
- public:
-  long long maxSubarrays(int n, vector<vector<int>>& conflictingPairs) {
-    long validSubarrays = 0;
-    int maxLeft = 0;
-    int secondMaxLeft = 0;
-    // gains[i] := the number of additional valid subarrays we can gain if the
-    // restriction at index `i` is removed
-    vector<long> gains(n + 1);
-    // conflicts[r] := left endpoints that conflict with subarrays ending in r
-    vector<vector<int>> conflicts(n + 1);
-
-    for (const vector<int>& pair : conflictingPairs) {
-      const int a = pair[0];
-      const int b = pair[1];
-      conflicts[max(a, b)].push_back(min(a, b));
-    }
-
-    for (int right = 1; right <= n; ++right) {
-      for (const int left : conflicts[right]) {
-        if (left > maxLeft) {
-          secondMaxLeft = maxLeft;
-          maxLeft = left;
-        } else if (left > secondMaxLeft) {
-          secondMaxLeft = left;
-        }
-      }
-      // Subarrays [maxLeft + 1..right],
-      //           [maxLeft + 2..right],
-      //           ...
-      //           [right..right] are valid.
-      validSubarrays += right - maxLeft;
-      // If we remove `maxLeft` (the most restrictive conflict), we gain
-      // `maxLeft - secondMaxLeft` new subarrays:
-      // [secondMaxLeft + 1..right],
-      // [secondMaxLeft + 2..right],
-      // ...
-      // [maxLeft..right].
-      gains[maxLeft] += maxLeft - secondMaxLeft;
-    }
-
-    return validSubarrays + ranges::max(gains);
-  }
-};
diff --git a/solutions/3480. Maximize Subarrays After Removing One Conflicting Pair/3480.java b/solutions/3480. Maximize Subarrays After Removing One Conflicting Pair/3480.java
deleted file mode 100644
index f980b0a5ecf..00000000000
--- a/solutions/3480. Maximize Subarrays After Removing One Conflicting Pair/3480.java	
+++ /dev/null
@@ -1,46 +0,0 @@
-class Solution {
-  public long maxSubarrays(int n, int[][] conflictingPairs) {
-    long validSubarrays = 0;
-    int maxLeft = 0;
-    int secondMaxLeft = 0;
-    // gains[i] := the number of additional valid subarrays we can gain if the
-    // restriction at index `i` is removed
-    long[] gains = new long[n + 1];
-    // conflicts[r] := left endpoints that conflict with subarrays ending in r
-    List<Integer>[] conflicts = new List[n + 1];
-
-    for (int i = 0; i <= n; ++i)
-      conflicts[i] = new ArrayList<>();
-
-    for (int[] pair : conflictingPairs) {
-      final int a = pair[0];
-      final int b = pair[1];
-      conflicts[Math.max(a, b)].add(Math.min(a, b));
-    }
-
-    for (int right = 1; right <= n; ++right) {
-      for (int left : conflicts[right]) {
-        if (left > maxLeft) {
-          secondMaxLeft = maxLeft;
-          maxLeft = left;
-        } else if (left > secondMaxLeft) {
-          secondMaxLeft = left;
-        }
-      }
-      // Subarrays [maxLeft + 1..right],
-      //           [maxLeft + 2..right],
-      //           ...
-      //           [right..right] are valid.
-      validSubarrays += right - maxLeft;
-      // If we remove `maxLeft` (the most restrictive conflict), we gain
-      // `maxLeft - secondMaxLeft` new subarrays:
-      // [secondMaxLeft + 1..right],
-      // [secondMaxLeft + 2..right],
-      // ...
-      // [maxLeft..right].
-      gains[maxLeft] += maxLeft - secondMaxLeft;
-    }
-
-    return validSubarrays + Arrays.stream(gains).max().getAsLong();
-  }
-}
diff --git a/solutions/3480. Maximize Subarrays After Removing One Conflicting Pair/3480.py b/solutions/3480. Maximize Subarrays After Removing One Conflicting Pair/3480.py
deleted file mode 100644
index 8acd034abd8..00000000000
--- a/solutions/3480. Maximize Subarrays After Removing One Conflicting Pair/3480.py	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution:
-  def maxSubarrays(self, n: int, conflictingPairs: list[list[int]]) -> int:
-    validSubarrays = 0
-    maxLeft = 0
-    secondMaxLeft = 0
-    # gains[i] := the number of additional valid subarrays we can gain if the
-    # restriction at index `i` is removed
-    gains = [0] * (n + 1)
-    # conflicts[r] := left endpoints that conflict with subarrays ending in r
-    conflicts = [[] for _ in range(n + 1)]
-
-    for a, b in conflictingPairs:
-      conflicts[max(a, b)].append(min(a, b))
-
-    for right in range(1, n + 1):
-      for left in conflicts[right]:
-        if left > maxLeft:
-          secondMaxLeft = maxLeft
-          maxLeft = left
-        elif left > secondMaxLeft:
-          secondMaxLeft = left
-      # Subarrays [maxLeft + 1..right],
-      #           [maxLeft + 2..right],
-      #           ...
-      #           [right..right] are valid.
-      validSubarrays += right - maxLeft
-      # If we remove `maxLeft` (the most restrictive conflict), we gain
-      # `maxLeft - secondMaxLeft` new subarrays:
-      # [secondMaxLeft + 1..right],
-      # [secondMaxLeft + 2..right],
-      # ...
-      # [maxLeft..right].
-      gains[maxLeft] += maxLeft - secondMaxLeft
-
-    return validSubarrays + max(gains)
diff --git a/solutions/3481. Apply Substitutions/3481.cpp b/solutions/3481. Apply Substitutions/3481.cpp
deleted file mode 100644
index 5e2e7581f15..00000000000
--- a/solutions/3481. Apply Substitutions/3481.cpp	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution {
- public:
-  string applySubstitutions(vector<vector<string>>& replacements, string text) {
-    unordered_map<string, string> replaceMap;
-
-    for (const vector<string>& replacement : replacements) {
-      const string& key = replacement[0];
-      const string& value = replacement[1];
-      replaceMap[key] = value;
-    }
-
-    return evaluate(text, replaceMap);
-  }
-
- private:
-  // Evaluates the `text` and replaces the placeholders with the values
-  // from the `replaceMap` recursively.
-  string evaluate(const string& text,
-                  const unordered_map<string, string>& replaceMap) {
-    string res;
-    int i = 0;
-    while (i < text.length())
-      if (text[i] == '%') {
-        const int j = i + 1 + text.substr(i + 1).find('%');
-        const string key = text.substr(i + 1, j - i - 1);
-        const string value = replaceMap.at(key);
-        res += evaluate(value, replaceMap);
-        i = j + 1;
-      } else {
-        res += text[i++];
-      }
-    return res;
-  }
-};
diff --git a/solutions/3481. Apply Substitutions/3481.java b/solutions/3481. Apply Substitutions/3481.java
deleted file mode 100644
index e196536aa3d..00000000000
--- a/solutions/3481. Apply Substitutions/3481.java	
+++ /dev/null
@@ -1,31 +0,0 @@
-class Solution {
-  public String applySubstitutions(List<List<String>> replacements, String text) {
-    Map<String, String> replaceMap = new HashMap<>();
-
-    for (List<String> replacement : replacements) {
-      final String key = replacement.get(0);
-      final String value = replacement.get(1);
-      replaceMap.put(key, value);
-    }
-
-    return evaluate(text, replaceMap);
-  }
-
-  // Evaluates the `text` and replaces the placeholders with the values
-  // from the `replaceMap` recursively.
-  private String evaluate(final String text, Map<String, String> replaceMap) {
-    StringBuilder sb = new StringBuilder();
-    int i = 0;
-    while (i < text.length())
-      if (text.charAt(i) == '%') {
-        final int j = i + 1 + text.substring(i + 1).indexOf('%');
-        final String key = text.substring(i + 1, j);
-        final String value = replaceMap.get(key);
-        sb.append(evaluate(value, replaceMap));
-        i = j + 1;
-      } else {
-        sb.append(text.charAt(i++));
-      }
-    return sb.toString();
-  }
-}
diff --git a/solutions/3481. Apply Substitutions/3481.py b/solutions/3481. Apply Substitutions/3481.py
deleted file mode 100644
index 86e5e4a7096..00000000000
--- a/solutions/3481. Apply Substitutions/3481.py	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution:
-  def applySubstitutions(self, replacements: list[list[str]], text: str) -> str:
-    replaceMap = {key: value for key, value in replacements}
-
-    def evaluate(text: str) -> str:
-      """
-      Evaluates the text and replaces the placeholders with the values
-      from the replace_map recursively.
-      """
-      res = []
-      i = 0
-      while i < len(text):
-        if text[i] == '%':
-          j = i + 1 + text[i + 1:].find('%')
-          key = text[i + 1:j]
-          value = replaceMap[key]
-          res.append(evaluate(value))
-          i = j + 1
-        else:
-          res.append(text[i])
-          i += 1
-      return ''.join(res)
-
-    return evaluate(text)
diff --git a/solutions/3482. Analyze Organization Hierarchy/3482.sql b/solutions/3482. Analyze Organization Hierarchy/3482.sql
deleted file mode 100644
index d3c9ba7316f..00000000000
--- a/solutions/3482. Analyze Organization Hierarchy/3482.sql	
+++ /dev/null
@@ -1,67 +0,0 @@
-WITH RECURSIVE
-  EmployeeHierarchy AS (
-    -- Base case: direct reports to CEO
-    SELECT
-      employee_id,
-      employee_name,
-      manager_id,
-      salary,
-      1 AS level
-    FROM Employees
-    WHERE manager_id IS NULL
-    UNION ALL
-    -- Recursive case: reports of reports
-    SELECT
-      Employees.employee_id,
-      Employees.employee_name,
-      Employees.manager_id,
-      Employees.salary,
-      EmployeeHierarchy.level + 1
-    FROM Employees
-    INNER JOIN EmployeeHierarchy
-      ON (Employees.manager_id = EmployeeHierarchy.employee_id)
-  ),
-  -- Calculate team size and budget for each employee
-  TeamSizeAndBudget AS (
-    WITH RECURSIVE
-      -- Get all subordinates (direct and indirect)
-      Subordinates AS (
-        -- Base case: direct reports
-        SELECT
-          manager_id,
-          employee_id,
-          salary
-        FROM Employees
-        WHERE manager_id IS NOT NULL
-        UNION ALL
-        -- Recursive case: indirect reports
-        SELECT
-          Subordinates.manager_id,
-          Employees.employee_id,
-          Employees.salary
-        FROM Employees
-        INNER JOIN Subordinates
-          ON (Employees.manager_id = Subordinates.employee_id)
-      )
-    SELECT
-      Employees.employee_id,
-      COUNT(DISTINCT Subordinates.employee_id) AS team_size,
-      IFNULL(SUM(Subordinates.salary), 0) + Employees.salary AS total_budget
-    FROM Employees
-    LEFT JOIN Subordinates
-      ON (Employees.employee_id = Subordinates.manager_id)
-    GROUP BY Employees.employee_id, Employees.salary
-  )
-SELECT
-  EmployeeHierarchy.employee_id,
-  EmployeeHierarchy.employee_name,
-  EmployeeHierarchy.level,
-  IFNULL(TeamSizeAndBudget.team_size, 0) AS team_size,
-  IFNULL(TeamSizeAndBudget.total_budget, EmployeeHierarchy.salary) AS budget
-FROM EmployeeHierarchy
-LEFT JOIN TeamSizeAndBudget
-  USING (employee_id)
-ORDER BY
-  EmployeeHierarchy.level,
-  TeamSizeAndBudget.total_budget DESC,
-  EmployeeHierarchy.employee_name;
diff --git a/solutions/3483. Unique 3-Digit Even Numbers/3483.cpp b/solutions/3483. Unique 3-Digit Even Numbers/3483.cpp
deleted file mode 100644
index 904619df3f9..00000000000
--- a/solutions/3483. Unique 3-Digit Even Numbers/3483.cpp	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
- public:
-  int totalNumbers(vector<int>& digits) {
-    unordered_set<int> nums;
-    vector<int> perm = digits;
-
-    ranges::sort(perm);
-
-    do {
-      const int a = perm[0];
-      const int b = perm[1];
-      const int c = perm[2];
-      if (a != 0 && c % 2 == 0)
-        nums.insert(a * 100 + b * 10 + c);
-    } while (next_permutation(perm.begin(), perm.end()));
-
-    return nums.size();
-  }
-};
diff --git a/solutions/3483. Unique 3-Digit Even Numbers/3483.java b/solutions/3483. Unique 3-Digit Even Numbers/3483.java
deleted file mode 100644
index a541e86d4d9..00000000000
--- a/solutions/3483. Unique 3-Digit Even Numbers/3483.java	
+++ /dev/null
@@ -1,55 +0,0 @@
-class Solution {
-  public int totalNumbers(int[] digits) {
-    Set<Integer> nums = new HashSet<>();
-    int[] perm = digits.clone();
-
-    Arrays.sort(perm);
-
-    do {
-      final int a = perm[0];
-      final int b = perm[1];
-      final int c = perm[2];
-      if (a != 0 && c % 2 == 0) {
-        nums.add(a * 100 + b * 10 + c);
-      }
-    } while (nextPermutation(perm));
-
-    return nums.size();
-  }
-
-  private boolean nextPermutation(int[] nums) {
-    final int n = nums.length;
-
-    // From the back to the front, find the first num < nums[i + 1].
-    int i;
-    for (i = n - 2; i >= 0; --i)
-      if (nums[i] < nums[i + 1])
-        break;
-
-    if (i < 0)
-      return false;
-
-    // From the back to the front, find the first num > nums[i] and swap it with
-    // nums[i].
-    for (int j = n - 1; j > i; --j)
-      if (nums[j] > nums[i]) {
-        swap(nums, i, j);
-        break;
-      }
-
-    // Reverse nums[i + 1..n - 1].
-    reverse(nums, i + 1, n - 1);
-    return true;
-  }
-
-  private void reverse(int[] nums, int l, int r) {
-    while (l < r)
-      swap(nums, l++, r--);
-  }
-
-  private void swap(int[] nums, int i, int j) {
-    final int temp = nums[i];
-    nums[i] = nums[j];
-    nums[j] = temp;
-  }
-}
diff --git a/solutions/3483. Unique 3-Digit Even Numbers/3483.py b/solutions/3483. Unique 3-Digit Even Numbers/3483.py
deleted file mode 100644
index f9a5502b586..00000000000
--- a/solutions/3483. Unique 3-Digit Even Numbers/3483.py	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution:
-  def totalNumbers(self, digits: list[int]) -> int:
-    nums = set()
-
-    for a, b, c in itertools.permutations(digits, 3):
-      if a != 0 and c % 2 == 0:
-        nums.add(a * 100 + b * 10 + c)
-
-    return len(nums)
diff --git a/solutions/3484. Design Spreadsheet/3484.cpp b/solutions/3484. Design Spreadsheet/3484.cpp
deleted file mode 100644
index 1e402746489..00000000000
--- a/solutions/3484. Design Spreadsheet/3484.cpp	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Spreadsheet {
- public:
-  Spreadsheet(int rows) {}
-
-  void setCell(string cell, int value) {
-    spreadsheet[cell] = value;
-  }
-
-  void resetCell(string cell) {
-    spreadsheet[cell] = 0;
-  }
-
-  int getValue(string formula) {
-    const int i = formula.find('+');
-    return getToken(formula.substr(1, i - 1)) + getToken(formula.substr(i + 1));
-  }
-
- private:
-  unordered_map<string, int> spreadsheet;
-
-  int getToken(const string& token) {
-    return isdigit(token[0])
-               ? stoi(token)
-               : (spreadsheet.contains(token) ? spreadsheet[token] : 0);
-  }
-};
diff --git a/solutions/3484. Design Spreadsheet/3484.java b/solutions/3484. Design Spreadsheet/3484.java
deleted file mode 100644
index df8bc795269..00000000000
--- a/solutions/3484. Design Spreadsheet/3484.java	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Spreadsheet {
-  public Spreadsheet(int rows) {}
-
-  public void setCell(String cell, int value) {
-    spreadsheet.put(cell, value);
-  }
-
-  public void resetCell(String cell) {
-    spreadsheet.put(cell, 0);
-  }
-
-  public int getValue(String formula) {
-    final int i = formula.indexOf('+');
-    return getToken(formula.substring(1, i)) + getToken(formula.substring(i + 1));
-  }
-
-  private Map<String, Integer> spreadsheet = new HashMap<>();
-
-  private int getToken(final String token) {
-    return Character.isDigit(token.charAt(0)) ? Integer.parseInt(token)
-                                              : spreadsheet.getOrDefault(token, 0);
-  }
-}
diff --git a/solutions/3484. Design Spreadsheet/3484.py b/solutions/3484. Design Spreadsheet/3484.py
deleted file mode 100644
index caaa0305128..00000000000
--- a/solutions/3484. Design Spreadsheet/3484.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Spreadsheet:
-  def __init__(self, rows: int) -> None:
-    self.spreadsheet = {}
-
-  def setCell(self, cell: str, value: int) -> None:
-    self.spreadsheet[cell] = value
-
-  def resetCell(self, cell: str) -> None:
-    self.spreadsheet[cell] = 0
-
-  def getValue(self, formula: str) -> int:
-    i = formula.find('+')
-    return self._getToken(formula[1:i]) + self._getToken(formula[i+1:])
-
-  def _getToken(self, token: str) -> int:
-    return int(token) if token[0].isdigit() else self.spreadsheet.get(token, 0)
diff --git a/solutions/3485. Longest Common Prefix of K Strings After Removal/3485.cpp b/solutions/3485. Longest Common Prefix of K Strings After Removal/3485.cpp
deleted file mode 100644
index 210d1332071..00000000000
--- a/solutions/3485. Longest Common Prefix of K Strings After Removal/3485.cpp	
+++ /dev/null
@@ -1,67 +0,0 @@
-struct TrieNode {
-  vector<shared_ptr<TrieNode>> children;
-  int count = 0;
-  TrieNode() : children(26) {}
-};
-
-class Trie {
- public:
-  Trie(int k) : k(k) {}
-
-  void insert(const string& word) {
-    shared_ptr<TrieNode> node = root;
-    for (int i = 0; i < word.length(); ++i) {
-      const int sz = i + 1;
-      const int index = word[i] - 'a';
-      if (node->children[index] == nullptr)
-        node->children[index] = make_shared<TrieNode>();
-      node = node->children[index];
-      ++node->count;
-      if (node->count >= k && prefixLengthsCount[sz]++ == 0)
-        prefixLengths.insert(sz);
-    }
-  }
-
-  void erase(const string& word) {
-    shared_ptr<TrieNode> node = root;
-    for (int i = 0; i < word.length(); ++i) {
-      const int sz = i + 1;
-      const int index = word[i] - 'a';
-      if (node->children[index] == nullptr)
-        node->children[index] = make_shared<TrieNode>();
-      node = node->children[index];
-      if (node->count == k && prefixLengthsCount[sz]-- == 1)
-        prefixLengths.erase(sz);
-      --node->count;
-    }
-  }
-
-  int getLongestCommonPrefix() const {
-    return prefixLengths.empty() ? 0 : *prefixLengths.begin();
-  }
-
- private:
-  const int k;
-  shared_ptr<TrieNode> root = make_shared<TrieNode>();
-  unordered_map<int, int> prefixLengthsCount;
-  set<int, greater<>> prefixLengths;
-};
-
-class Solution {
- public:
-  vector<int> longestCommonPrefix(vector<string>& words, int k) {
-    vector<int> ans;
-    Trie trie(k);
-
-    for (const string& word : words)
-      trie.insert(word);
-
-    for (const string& word : words) {
-      trie.erase(word);
-      ans.push_back(trie.getLongestCommonPrefix());
-      trie.insert(word);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3485. Longest Common Prefix of K Strings After Removal/3485.java b/solutions/3485. Longest Common Prefix of K Strings After Removal/3485.java
deleted file mode 100644
index 567ca1b1ae8..00000000000
--- a/solutions/3485. Longest Common Prefix of K Strings After Removal/3485.java	
+++ /dev/null
@@ -1,65 +0,0 @@
-class TrieNode {
-  public TrieNode[] children = new TrieNode[26];
-  public int count = 0;
-}
-
-class Trie {
-  public Trie(int k) {
-    this.k = k;
-  }
-
-  public void insert(final String word) {
-    TrieNode node = root;
-    for (int i = 0; i < word.length(); ++i) {
-      final int sz = i + 1;
-      final int index = word.charAt(i) - 'a';
-      if (node.children[index] == null)
-        node.children[index] = new TrieNode();
-      node = node.children[index];
-      ++node.count;
-      if (node.count >= k && prefixLengthsCount.merge(sz, 1, Integer::sum) == 1)
-        prefixLengths.add(sz);
-    }
-  }
-
-  public void erase(final String word) {
-    TrieNode node = root;
-    for (int i = 0; i < word.length(); ++i) {
-      final int sz = i + 1;
-      final int index = word.charAt(i) - 'a';
-      if (node.children[index] == null)
-        node.children[index] = new TrieNode();
-      node = node.children[index];
-      if (node.count == k && prefixLengthsCount.merge(sz, -1, Integer::sum) == 0)
-        prefixLengths.remove(sz);
-      --node.count;
-    }
-  }
-
-  public int getLongestCommonPrefix() {
-    return prefixLengths.isEmpty() ? 0 : prefixLengths.first();
-  }
-
-  private final int k;
-  private TrieNode root = new TrieNode();
-  private Map<Integer, Integer> prefixLengthsCount = new HashMap<>();
-  private TreeSet<Integer> prefixLengths = new TreeSet<>(Collections.reverseOrder());
-}
-
-class Solution {
-  public int[] longestCommonPrefix(String[] words, int k) {
-    final int[] ans = new int[words.length];
-    Trie trie = new Trie(k);
-
-    for (final String word : words)
-      trie.insert(word);
-
-    for (int i = 0; i < words.length; ++i) {
-      trie.erase(words[i]);
-      ans[i] = trie.getLongestCommonPrefix();
-      trie.insert(words[i]);
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3485. Longest Common Prefix of K Strings After Removal/3485.py b/solutions/3485. Longest Common Prefix of K Strings After Removal/3485.py
deleted file mode 100644
index 3f20ff11dd9..00000000000
--- a/solutions/3485. Longest Common Prefix of K Strings After Removal/3485.py	
+++ /dev/null
@@ -1,53 +0,0 @@
-class TrieNode:
-  def __init__(self):
-    self.children: dict[str, TrieNode] = {}
-    self.count = 0
-
-
-class Trie:
-  def __init__(self, k: int):
-    self.k = k
-    self.root = TrieNode()
-    self.prefixLengthsCount = collections.Counter()
-    self.prefixLengths = SortedList()
-
-  def insert(self, word: str) -> None:
-    node = self.root
-    for i, c in enumerate(word):
-      sz = i + 1
-      node = node.children.setdefault(c, TrieNode())
-      node.count += 1
-      if node.count >= self.k:
-        self.prefixLengthsCount[sz] += 1
-        if self.prefixLengthsCount[sz] == 1:
-          self.prefixLengths.add(-sz)
-
-  def erase(self, word: str) -> None:
-    node = self.root
-    for i, c in enumerate(word):
-      sz = i + 1
-      node = node.children[c]
-      if node.count == self.k:
-        self.prefixLengthsCount[sz] -= 1
-        if self.prefixLengthsCount[sz] == 0:
-          self.prefixLengths.remove(-sz)
-      node.count -= 1
-
-  def getLongestCommonPrefix(self) -> int:
-    return 0 if not self.prefixLengths else -self.prefixLengths[0]
-
-
-class Solution:
-  def longestCommonPrefix(self, words: list[str], k: int) -> list[int]:
-    ans = []
-    trie = Trie(k)
-
-    for word in words:
-      trie.insert(word)
-
-    for word in words:
-      trie.erase(word)
-      ans.append(trie.getLongestCommonPrefix())
-      trie.insert(word)
-
-    return ans
diff --git a/solutions/3486. Longest Special Path II/3486.cpp b/solutions/3486. Longest Special Path II/3486.cpp
deleted file mode 100644
index a9180231abc..00000000000
--- a/solutions/3486. Longest Special Path II/3486.cpp	
+++ /dev/null
@@ -1,55 +0,0 @@
-class Solution {
- public:
-  vector<int> longestSpecialPath(vector<vector<int>>& edges,
-                                 vector<int>& nums) {
-    vector<vector<pair<int, int>>> graph(nums.size());
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      const int w = edge[2];
-      graph[u].emplace_back(v, w);
-      graph[v].emplace_back(u, w);
-    }
-
-    int maxLength = 0;
-    int minNodes = 1;
-    dfs(graph, 0, -1, /*leftBoundary=*/{0, 0}, /*prefix=*/{0},
-        /*lastSeenDepth=*/{}, nums, maxLength, minNodes);
-    return {maxLength, minNodes};
-  }
-
- private:
-  void dfs(const vector<vector<pair<int, int>>>& graph, int u, int prev,
-           vector<int> leftBoundary, vector<int>&& prefix,
-           unordered_map<int, int>&& lastSeenDepth, const vector<int>& nums,
-           int& maxLength, int& minNodes) {
-    const int prevDepth = lastSeenDepth[nums[u]];
-    lastSeenDepth[nums[u]] = prefix.size();
-
-    if (prevDepth != 0) {
-      leftBoundary.push_back(prevDepth);
-      ranges::sort(leftBoundary);
-      leftBoundary = {leftBoundary[leftBoundary.size() - 2],
-                      leftBoundary.back()};
-    }
-
-    const int length = prefix.back() - prefix[leftBoundary[0]];
-    const int nodes = prefix.size() - leftBoundary[0];
-    if (length > maxLength || (length == maxLength && nodes < minNodes)) {
-      maxLength = length;
-      minNodes = nodes;
-    }
-
-    for (const auto& [v, w] : graph[u]) {
-      if (v == prev)
-        continue;
-      prefix.push_back(prefix.back() + w);
-      dfs(graph, v, u, leftBoundary, std::move(prefix),
-          std::move(lastSeenDepth), nums, maxLength, minNodes);
-      prefix.pop_back();
-    }
-
-    lastSeenDepth[nums[u]] = prevDepth;
-  }
-};
diff --git a/solutions/3486. Longest Special Path II/3486.java b/solutions/3486. Longest Special Path II/3486.java
deleted file mode 100644
index 72afe408e00..00000000000
--- a/solutions/3486. Longest Special Path II/3486.java	
+++ /dev/null
@@ -1,57 +0,0 @@
-class Solution {
-  public int[] longestSpecialPath(int[][] edges, int[] nums) {
-    List<Pair<Integer, Integer>>[] graph = new List[nums.length];
-
-    for (int i = 0; i < nums.length; ++i)
-      graph[i] = new ArrayList<>();
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      final int w = edge[2];
-      graph[u].add(new Pair<>(v, w));
-      graph[v].add(new Pair<>(u, w));
-    }
-
-    int[] ans = new int[2];
-    ans[0] = 0; // maxLength
-    ans[1] = 1; // minNodes
-    dfs(graph, 0, -1, /*leftBoundary=*/List.of(0, 0),
-        /*prefix=*/new ArrayList<>(List.of(0)),
-        /*lastSeenDepth=*/new HashMap<>(), nums, ans);
-    return ans;
-  }
-
-  private void dfs(List<Pair<Integer, Integer>>[] graph, int u, int prev,
-                   List<Integer> leftBoundary, List<Integer> prefix,
-                   Map<Integer, Integer> lastSeenDepth, int[] nums, int[] ans) {
-    final int prevDepth = lastSeenDepth.getOrDefault(nums[u], 0);
-    lastSeenDepth.put(nums[u], prefix.size());
-
-    if (prevDepth != 0) {
-      leftBoundary.add(prevDepth);
-      Collections.sort(leftBoundary);
-      leftBoundary = List.of(leftBoundary.get(leftBoundary.size() - 2),
-                             leftBoundary.get(leftBoundary.size() - 1));
-    }
-
-    final int length = prefix.get(prefix.size() - 1) - prefix.get(leftBoundary.get(0));
-    final int nodes = prefix.size() - leftBoundary.get(0);
-    if (length > ans[0] || (length == ans[0] && nodes < ans[1])) {
-      ans[0] = length;
-      ans[1] = nodes;
-    }
-
-    for (Pair<Integer, Integer> pair : graph[u]) {
-      final int v = pair.getKey();
-      final int w = pair.getValue();
-      if (v == prev)
-        continue;
-      prefix.add(prefix.get(prefix.size() - 1) + w);
-      dfs(graph, v, u, new ArrayList<>(leftBoundary), prefix, lastSeenDepth, nums, ans);
-      prefix.remove(prefix.size() - 1);
-    }
-
-    lastSeenDepth.put(nums[u], prevDepth);
-  }
-}
diff --git a/solutions/3486. Longest Special Path II/3486.py b/solutions/3486. Longest Special Path II/3486.py
deleted file mode 100644
index f5584caeeb2..00000000000
--- a/solutions/3486. Longest Special Path II/3486.py	
+++ /dev/null
@@ -1,47 +0,0 @@
-class Solution:
-  # Similar to 3425. Longest Special Path
-  def longestSpecialPath(
-      self,
-      edges: list[list[int]],
-      nums: list[int]
-  ) -> list[int]:
-    maxLength = 0
-    minNodes = 1
-    graph = [[] for _ in range(len(nums))]
-
-    for u, v, w in edges:
-      graph[u].append((v, w))
-      graph[v].append((u, w))
-
-    prefix = [0]
-    lastSeenDepth = {}
-
-    def dfs(
-        u: int,
-        prev: int,
-        leftBoundary: list[int],
-    ) -> None:
-      nonlocal maxLength, minNodes
-      prevDepth = lastSeenDepth.get(nums[u], 0)
-      lastSeenDepth[nums[u]] = len(prefix)
-
-      if prevDepth != 0:
-        leftBoundary = sorted(leftBoundary + [prevDepth])[-2:]
-
-      length = prefix[-1] - prefix[leftBoundary[0]]
-      nodes = len(prefix) - leftBoundary[0]
-      if length > maxLength or (length == maxLength and nodes < minNodes):
-        maxLength = length
-        minNodes = nodes
-
-      for v, w in graph[u]:
-        if v == prev:
-          continue
-        prefix.append(prefix[-1] + w)
-        dfs(v, u, leftBoundary)
-        prefix.pop()
-
-      lastSeenDepth[nums[u]] = prevDepth
-
-    dfs(0, -1, leftBoundary=[0, 0])
-    return [maxLength, minNodes]
diff --git a/solutions/3487. Maximum Unique Subarray Sum After Deletion/3487.cpp b/solutions/3487. Maximum Unique Subarray Sum After Deletion/3487.cpp
deleted file mode 100644
index 13c74fc2f64..00000000000
--- a/solutions/3487. Maximum Unique Subarray Sum After Deletion/3487.cpp	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution {
- public:
-  int maxSum(vector<int>& nums) {
-    const int mx = ranges::max(nums);
-    if (mx <= 0)
-      return mx;
-    unordered_set<int> numsSet(nums.begin(), nums.end());
-    return accumulate(numsSet.begin(), numsSet.end(), 0,
-                      [](int acc, int num) { return acc + max(0, num); });
-  }
-};
diff --git a/solutions/3487. Maximum Unique Subarray Sum After Deletion/3487.java b/solutions/3487. Maximum Unique Subarray Sum After Deletion/3487.java
deleted file mode 100644
index 34d9eff559b..00000000000
--- a/solutions/3487. Maximum Unique Subarray Sum After Deletion/3487.java	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
-  public int maxSum(int[] nums) {
-    final int mx = Arrays.stream(nums).max().getAsInt();
-    if (mx <= 0)
-      return mx;
-    return Arrays.stream(nums)
-        .boxed()
-        .collect(Collectors.toSet())
-        .stream()
-        .filter(num -> num > 0)
-        .mapToInt(Integer::intValue)
-        .sum();
-  }
-}
diff --git a/solutions/3487. Maximum Unique Subarray Sum After Deletion/3487.py b/solutions/3487. Maximum Unique Subarray Sum After Deletion/3487.py
deleted file mode 100644
index 5b814ad5ad4..00000000000
--- a/solutions/3487. Maximum Unique Subarray Sum After Deletion/3487.py	
+++ /dev/null
@@ -1,6 +0,0 @@
-class Solution:
-  def maxSum(self, nums: list[int]) -> int:
-    mx = max(nums)
-    if mx <= 0:
-      return mx
-    return sum(max(0, num) for num in set(nums))
diff --git a/solutions/3488. Closest Equal Element Queries/3488.cpp b/solutions/3488. Closest Equal Element Queries/3488.cpp
deleted file mode 100644
index e2d72113ce5..00000000000
--- a/solutions/3488. Closest Equal Element Queries/3488.cpp	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
- public:
-  vector<int> solveQueries(vector<int>& nums, vector<int>& queries) {
-    const int n = nums.size();
-    vector<int> ans;
-    // minDist[i] := the minimum distance between nums[i], and any other index j
-    // in the circular array, where nums[j] == nums[i]
-    vector<int> minDist(n, n);
-    unordered_map<int, int> lastSeen;
-
-    for (int i = 0; i < n * 2; ++i) {
-      const int index = i % n;
-      const int num = nums[index];
-      if (const auto it = lastSeen.find(num); it != lastSeen.cend()) {
-        const int prevIndex = it->second % n;
-        const int d = i - prevIndex;
-        minDist[index] = min(minDist[index], d);
-        minDist[prevIndex] = min(minDist[prevIndex], d);
-      }
-      lastSeen[num] = i;
-    }
-
-    for (const int query : queries)
-      ans.push_back(minDist[query] == n ? -1 : minDist[query]);
-
-    return ans;
-  }
-};
diff --git a/solutions/3488. Closest Equal Element Queries/3488.java b/solutions/3488. Closest Equal Element Queries/3488.java
deleted file mode 100644
index 370d45418d8..00000000000
--- a/solutions/3488. Closest Equal Element Queries/3488.java	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
-  public List<Integer> solveQueries(int[] nums, int[] queries) {
-    final int n = nums.length;
-    List<Integer> ans = new ArrayList<>();
-    // minDist[i] := the minimum distance between nums[i], and any other index j in the circular
-    // array, where nums[j] == nums[i]
-    int[] minDist = new int[n];
-    Arrays.fill(minDist, n);
-    Map<Integer, Integer> lastSeen = new HashMap<>();
-
-    for (int i = 0; i < n * 2; ++i) {
-      final int index = i % n;
-      final int num = nums[index];
-      if (lastSeen.containsKey(num)) {
-        final int prevIndex = lastSeen.get(num) % n;
-        final int d = i - prevIndex;
-        minDist[index] = Math.min(minDist[index], d);
-        minDist[prevIndex] = Math.min(minDist[prevIndex], d);
-      }
-      lastSeen.put(num, i);
-    }
-
-    for (final int query : queries)
-      ans.add(minDist[query] == n ? -1 : minDist[query]);
-
-    return ans;
-  }
-}
diff --git a/solutions/3488. Closest Equal Element Queries/3488.py b/solutions/3488. Closest Equal Element Queries/3488.py
deleted file mode 100644
index c62ba738948..00000000000
--- a/solutions/3488. Closest Equal Element Queries/3488.py	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution:
-  def solveQueries(self, nums: list[int], queries: list[int]) -> list[int]:
-    n = len(nums)
-    # minDist[i] := the minimum distance between nums[i], and any other index j
-    # in the circular array, where nums[j] == nums[i]
-    minDist = [n] * n
-    lastSeen = {}
-
-    for i in range(n * 2):
-      index = i % n
-      num = nums[index]
-      if num in lastSeen:
-        prevIndex = lastSeen[num] % n
-        d = i - prevIndex
-        minDist[index] = min(minDist[index], d)
-        minDist[prevIndex] = min(minDist[prevIndex], d)
-      lastSeen[num] = i
-
-    return [-1 if minDist[query] == n
-            else minDist[query]
-            for query in queries]
diff --git a/solutions/3489. Zero Array Transformation IV/3489.cpp b/solutions/3489. Zero Array Transformation IV/3489.cpp
deleted file mode 100644
index 1036339bb1f..00000000000
--- a/solutions/3489. Zero Array Transformation IV/3489.cpp	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
- public:
-  int minZeroArray(vector<int>& nums, vector<vector<int>>& queries) {
-    if (all_of(nums.begin(), nums.end(), [](int num) { return num == 0; }))
-      return 0;
-
-    const int n = nums.size();
-    vector<unordered_set<int>> subsetSums(n);
-
-    for (int i = 0; i < n; ++i)
-      subsetSums[i].insert(0);
-
-    for (int k = 0; k < queries.size(); ++k) {
-      const int l = queries[k][0];
-      const int r = queries[k][1];
-      const int val = queries[k][2];
-      for (int i = l; i <= r; ++i) {
-        vector<int> sums;
-        for (const int subsetSum : subsetSums[i])
-          sums.push_back(subsetSum + val);
-        for (const int sum : sums)
-          subsetSums[i].insert(sum);
-      }
-      if (canFormAllNumbers(subsetSums, nums))
-        return k + 1;
-    }
-
-    return -1;
-  }
-
-  bool canFormAllNumbers(const vector<unordered_set<int>>& subsetSums,
-                         const vector<int>& nums) {
-    for (int i = 0; i < nums.size(); ++i)
-      if (!subsetSums[i].contains(nums[i]))
-        return false;
-    return true;
-  }
-};
diff --git a/solutions/3489. Zero Array Transformation IV/3489.java b/solutions/3489. Zero Array Transformation IV/3489.java
deleted file mode 100644
index 3f806536d16..00000000000
--- a/solutions/3489. Zero Array Transformation IV/3489.java	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
-  public int minZeroArray(int[] nums, int[][] queries) {
-    if (Arrays.stream(nums).allMatch(num -> num == 0))
-      return 0;
-
-    final int n = nums.length;
-    Set<Integer>[] subsetSums = new Set[n];
-
-    for (int i = 0; i < n; ++i)
-      subsetSums[i] = new HashSet<>(List.of(0));
-
-    for (int k = 0; k < queries.length; ++k) {
-      final int l = queries[k][0];
-      final int r = queries[k][1];
-      final int val = queries[k][2];
-      for (int i = l; i <= r; ++i) {
-        List<Integer> sums = new ArrayList<>();
-        for (final int subsetSum : subsetSums[i])
-          sums.add(subsetSum + val);
-        subsetSums[i].addAll(sums);
-      }
-      if (IntStream.range(0, n).allMatch(i -> subsetSums[i].contains(nums[i])))
-        return k + 1;
-    }
-
-    return -1;
-  }
-}
diff --git a/solutions/3489. Zero Array Transformation IV/3489.py b/solutions/3489. Zero Array Transformation IV/3489.py
deleted file mode 100644
index 4f40170eefd..00000000000
--- a/solutions/3489. Zero Array Transformation IV/3489.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  def minZeroArray(self, nums: list[int], queries: list[list[int]]) -> int:
-    if all(num == 0 for num in nums):
-      return 0
-
-    n = len(nums)
-    subsetSums = [{0} for _ in range(n)]
-
-    for k, (l, r, val) in enumerate(queries):
-      for i in range(l, r + 1):
-        newSums = {subsetSum + val for subsetSum in subsetSums[i]}
-        subsetSums[i].update(newSums)
-      if all(nums[i] in subsetSums[i] for i in range(n)):
-        return k + 1
-
-    return -1
diff --git a/solutions/349. Intersection of Two Arrays/349.py b/solutions/349. Intersection of Two Arrays/349.py
index 37239a1ea73..7d8be9920ec 100644
--- a/solutions/349. Intersection of Two Arrays/349.py	
+++ b/solutions/349. Intersection of Two Arrays/349.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def intersection(self, nums1: list[int], nums2: list[int]) -> list[int]:
+  def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
     ans = []
     nums1 = set(nums1)
 
diff --git a/solutions/3490. Count Beautiful Numbers/3490.cpp b/solutions/3490. Count Beautiful Numbers/3490.cpp
deleted file mode 100644
index 9db379ea04a..00000000000
--- a/solutions/3490. Count Beautiful Numbers/3490.cpp	
+++ /dev/null
@@ -1,45 +0,0 @@
-class Solution {
- public:
-  int beautifulNumbers(int l, int r) {
-    return count(to_string(r), 0, /*tight=*/true, /*isLeadingZero=*/true,
-                 /*hasZero=*/false, /*sum=*/0, /*prod=*/1, {}) -
-           count(to_string(l - 1), 0, /*tight=*/true, /*isLeadingZero=*/true,
-                 /*hasZero=*/false, /*sum=*/0, /*prod=*/1, {});
-  }
-
- private:
-  int count(const string& s, int i, bool tight, bool isLeadingZero,
-            bool hasZero, int sum, int prod, unordered_map<string, int>&& mem) {
-    if (i == s.length()) {
-      if (isLeadingZero)
-        return 0;
-      return (hasZero || prod % sum == 0) ? 1 : 0;
-    }
-    const string key = hash(i, tight, isLeadingZero, hasZero, sum, prod);
-    if (!isLeadingZero && hasZero && !tight)
-      return mem[key] = pow(10, s.length() - i);
-    if (const auto it = mem.find(key); it != mem.end())
-      return it->second;
-
-    int res = 0;
-    const int maxDigit = tight ? s[i] - '0' : 9;
-
-    for (int d = 0; d <= maxDigit; ++d) {
-      const bool nextTight = tight && (d == maxDigit);
-      const bool nextIsLeadingZero = isLeadingZero && d == 0;
-      const bool nextHasZero = !nextIsLeadingZero && d == 0;
-      const int nextProd = nextIsLeadingZero ? 1 : prod * d;
-      res += count(s, i + 1, nextTight, nextIsLeadingZero, nextHasZero, sum + d,
-                   nextProd, std::move(mem));
-    }
-
-    return mem[key] = res;
-  }
-
-  string hash(int i, bool tight, bool isLeadingZero, bool hasZero, int sum,
-              int prod) {
-    return to_string(i) + "_" + (tight ? "1" : "0") + "_" +
-           (isLeadingZero ? "1" : "0") + "_" + (hasZero ? "1" : "0") + "_" +
-           to_string(sum) + "_" + to_string(prod);
-  }
-};
diff --git a/solutions/3490. Count Beautiful Numbers/3490.java b/solutions/3490. Count Beautiful Numbers/3490.java
deleted file mode 100644
index 5b3a5e6d268..00000000000
--- a/solutions/3490. Count Beautiful Numbers/3490.java	
+++ /dev/null
@@ -1,45 +0,0 @@
-class Solution {
-  public int beautifulNumbers(int l, int r) {
-    return count(String.valueOf(r), 0, /*tight=*/true, /*isLeadingZero=*/true,
-                 /*hasZero=*/false, /*sum=*/0, /*prod=*/1, new HashMap<>()) -
-        count(String.valueOf(l - 1), 0, /*tight=*/true, /*isLeadingZero=*/true,
-              /*hasZero=*/false, /*sum=*/0, /*prod=*/1, new HashMap<>());
-  }
-
-  private int count(final String s, int i, boolean tight, boolean isLeadingZero, boolean hasZero,
-                    int sum, int prod, Map<String, Integer> mem) {
-    if (i == s.length()) {
-      if (isLeadingZero)
-        return 0;
-      return (hasZero || prod % sum == 0) ? 1 : 0;
-    }
-    final String key = hash(i, tight, isLeadingZero, hasZero, sum, prod);
-    if (!isLeadingZero && hasZero && !tight) {
-      final int val = (int) Math.pow(10, s.length() - i);
-      mem.put(key, val);
-      return val;
-    }
-    if (mem.containsKey(key))
-      return mem.get(key);
-
-    int res = 0;
-    final int maxDigit = tight ? s.charAt(i) - '0' : 9;
-
-    for (int d = 0; d <= maxDigit; ++d) {
-      final boolean nextTight = tight && (d == maxDigit);
-      final boolean nextIsLeadingZero = isLeadingZero && d == 0;
-      final boolean nextHasZero = !nextIsLeadingZero && d == 0;
-      final int nextProd = nextIsLeadingZero ? 1 : prod * d;
-      res += count(s, i + 1, nextTight, nextIsLeadingZero, nextHasZero, sum + d, nextProd, mem);
-    }
-
-    mem.put(key, res);
-    return res;
-  }
-
-  private String hash(int i, boolean tight, boolean isLeadingZero, boolean hasZero, int sum,
-                      int prod) {
-    return i + "_" + (tight ? "1" : "0") + "_" + (isLeadingZero ? "1" : "0") + "_" +
-        (hasZero ? "1" : "0") + "_" + sum + "_" + prod;
-  }
-}
diff --git a/solutions/3490. Count Beautiful Numbers/3490.py b/solutions/3490. Count Beautiful Numbers/3490.py
deleted file mode 100644
index a678746c41e..00000000000
--- a/solutions/3490. Count Beautiful Numbers/3490.py	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution:
-  def beautifulNumbers(self, l: int, r: int) -> int:
-    @functools.lru_cache(None)
-    def dp(
-        s: str,
-        i: int,
-        tight: bool,
-        isLeadingZero: bool,
-        hasZero: bool,
-        sum: int,
-        prod: int,
-    ) -> int:
-      if i == len(s):
-        if isLeadingZero:
-          return 0
-        return 1 if hasZero or prod % sum == 0 else 0
-      if not isLeadingZero and hasZero and not tight:
-        return 10 ** (len(s) - i)
-
-      res = 0
-      maxDigit = int(s[i]) if tight else 9
-
-      for d in range(maxDigit + 1):
-        nextTight = tight and (d == maxDigit)
-        nextIsLeadingZero = isLeadingZero and d == 0
-        nextHasZero = not nextIsLeadingZero and d == 0
-        nextProd = 1 if nextIsLeadingZero else prod * d
-        res += dp(s, i + 1, nextTight, nextIsLeadingZero,
-                  nextHasZero, sum + d, nextProd)
-
-      return res
-
-    return (dp(str(r), 0, tight=True, isLeadingZero=True, hasZero=False, sum=0, prod=1) -
-            dp(str(l - 1), 0, tight=True, isLeadingZero=True, hasZero=False, sum=0, prod=1))
diff --git a/solutions/3491. Phone Number Prefix/3491-2.cpp b/solutions/3491. Phone Number Prefix/3491-2.cpp
deleted file mode 100644
index 33dff712ab1..00000000000
--- a/solutions/3491. Phone Number Prefix/3491-2.cpp	
+++ /dev/null
@@ -1,52 +0,0 @@
-struct TrieNode {
-  vector<shared_ptr<TrieNode>> children;
-  bool isWord = false;
-  TrieNode() : children(10) {}
-};
-
-class Trie {
- public:
-  void insert(const string& number) {
-    shared_ptr<TrieNode> node = root;
-    for (const char d : number) {
-      const int i = d - '0';
-      if (node->children[i] == nullptr)
-        node->children[i] = make_shared<TrieNode>();
-      node = node->children[i];
-    }
-    node->isWord = true;
-  }
-
-  // Returns true if the number is a prefix of any number in the trie or any
-  // number in the trie is a prefix of the number.
-  bool search(const string& number) {
-    shared_ptr<TrieNode> node = root;
-    for (const char d : number) {
-      const int i = d - '0';
-      if (node->children[i] == nullptr)
-        return false;
-      node = node->children[i];
-      if (node->isWord)
-        return true;
-    }
-    return true;  // The number is a prefix of some number in the trie
-  }
-
- private:
-  shared_ptr<TrieNode> root = make_shared<TrieNode>();
-};
-
-class Solution {
- public:
-  bool phonePrefix(vector<string>& numbers) {
-    Trie trie;
-
-    for (const string& number : numbers) {
-      if (trie.search(number))
-        return false;
-      trie.insert(number);
-    }
-
-    return true;
-  }
-};
diff --git a/solutions/3491. Phone Number Prefix/3491-2.java b/solutions/3491. Phone Number Prefix/3491-2.java
deleted file mode 100644
index 92f8e1e7734..00000000000
--- a/solutions/3491. Phone Number Prefix/3491-2.java	
+++ /dev/null
@@ -1,48 +0,0 @@
-class TrieNode {
-  public TrieNode[] children = new TrieNode[10];
-  public boolean isWord = false;
-}
-
-class Trie {
-  public void insert(String number) {
-    TrieNode node = root;
-    for (final char d : number.toCharArray()) {
-      final int i = d - '0';
-      if (node.children[i] == null)
-        node.children[i] = new TrieNode();
-      node = node.children[i];
-    }
-    node.isWord = true;
-  }
-
-  // Returns true if the number is a prefix of any number in the trie or any
-  // number in the trie is a prefix of the number
-  public boolean search(String number) {
-    TrieNode node = root;
-    for (final char d : number.toCharArray()) {
-      final int i = d - '0';
-      if (node.children[i] == null)
-        return false;
-      node = node.children[i];
-      if (node.isWord)
-        return true;
-    }
-    return true; // The number is a prefix of some number in the trie
-  }
-
-  private TrieNode root = new TrieNode();
-}
-
-class Solution {
-  public boolean phonePrefix(String[] numbers) {
-    Trie trie = new Trie();
-
-    for (final String number : numbers) {
-      if (trie.search(number))
-        return false;
-      trie.insert(number);
-    }
-
-    return true;
-  }
-}
diff --git a/solutions/3491. Phone Number Prefix/3491-2.py b/solutions/3491. Phone Number Prefix/3491-2.py
deleted file mode 100644
index d7bf94701b1..00000000000
--- a/solutions/3491. Phone Number Prefix/3491-2.py	
+++ /dev/null
@@ -1,41 +0,0 @@
-class TrieNode:
-  def __init__(self):
-    self.children: dict[str, TrieNode] = {}
-    self.isWord = False
-
-
-class Trie:
-  def __init__(self):
-    self.root = TrieNode()
-
-  def insert(self, number: str) -> None:
-    node: TrieNode = self.root
-    for d in number:
-      node = node.children.setdefault(d, TrieNode())
-    node.isWord = True
-
-  def search(self, number: str) -> bool:
-    """
-    Returns True if the number is a prefix of any number in the trie or any
-    number in the trie is a prefix of the number.
-    """
-    node: TrieNode = self.root
-    for d in number:
-      if d not in node.children:
-        return False
-      node = node.children[d]
-      if node.isWord:
-        return True
-    return True  # The number is a prefix of some number in the trie.
-
-
-class Solution:
-  def phonePrefix(self, numbers: list[str]) -> bool:
-    trie = Trie()
-
-    for number in numbers:
-      if trie.search(number):
-        return False
-      trie.insert(number)
-
-    return True
diff --git a/solutions/3491. Phone Number Prefix/3491.cpp b/solutions/3491. Phone Number Prefix/3491.cpp
deleted file mode 100644
index f40c88c3795..00000000000
--- a/solutions/3491. Phone Number Prefix/3491.cpp	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution {
- public:
-  bool phonePrefix(vector<string>& numbers) {
-    ranges::sort(numbers);
-    for (int i = 1; i < numbers.size(); ++i)
-      if (numbers[i].starts_with(numbers[i - 1]))
-        return false;
-    return true;
-  }
-};
diff --git a/solutions/3491. Phone Number Prefix/3491.java b/solutions/3491. Phone Number Prefix/3491.java
deleted file mode 100644
index 87f834b2c82..00000000000
--- a/solutions/3491. Phone Number Prefix/3491.java	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution {
-  public boolean phonePrefix(String[] numbers) {
-    Arrays.sort(numbers);
-    for (int i = 1; i < numbers.length; ++i)
-      if (numbers[i].startsWith(numbers[i - 1]))
-        return false;
-    return true;
-  }
-}
diff --git a/solutions/3491. Phone Number Prefix/3491.py b/solutions/3491. Phone Number Prefix/3491.py
deleted file mode 100644
index dabfd44d5f6..00000000000
--- a/solutions/3491. Phone Number Prefix/3491.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def phonePrefix(self, numbers: list[str]) -> bool:
-    return not any(b.startswith(a)
-                   for a, b in itertools.pairwise(sorted(numbers)))
diff --git a/solutions/3492. Maximum Containers on a Ship/3492.cpp b/solutions/3492. Maximum Containers on a Ship/3492.cpp
deleted file mode 100644
index 30f418a23c8..00000000000
--- a/solutions/3492. Maximum Containers on a Ship/3492.cpp	
+++ /dev/null
@@ -1,6 +0,0 @@
-class Solution {
- public:
-  int maxContainers(int n, int w, int maxWeight) {
-    return min(n * n, maxWeight / w);
-  }
-};
diff --git a/solutions/3492. Maximum Containers on a Ship/3492.java b/solutions/3492. Maximum Containers on a Ship/3492.java
deleted file mode 100644
index df11b572b08..00000000000
--- a/solutions/3492. Maximum Containers on a Ship/3492.java	
+++ /dev/null
@@ -1,5 +0,0 @@
-class Solution {
-  public int maxContainers(int n, int w, int maxWeight) {
-    return Math.min(n * n, maxWeight / w);
-  }
-}
diff --git a/solutions/3492. Maximum Containers on a Ship/3492.py b/solutions/3492. Maximum Containers on a Ship/3492.py
deleted file mode 100644
index c59f0429b6b..00000000000
--- a/solutions/3492. Maximum Containers on a Ship/3492.py	
+++ /dev/null
@@ -1,3 +0,0 @@
-class Solution:
-  def maxContainers(self, n: int, w: int, maxWeight: int) -> int:
-    return min(n * n, maxWeight // w)
diff --git a/solutions/3493. Properties Graph/3493.cpp b/solutions/3493. Properties Graph/3493.cpp
deleted file mode 100644
index c20a7989d22..00000000000
--- a/solutions/3493. Properties Graph/3493.cpp	
+++ /dev/null
@@ -1,64 +0,0 @@
-class UnionFind {
- public:
-  UnionFind(int n) : count(n), id(n), rank(n) {
-    iota(id.begin(), id.end(), 0);
-  }
-
-  void unionByRank(int u, int v) {
-    const int i = find(u);
-    const int j = find(v);
-    if (i == j)
-      return;
-    if (rank[i] < rank[j]) {
-      id[i] = j;
-    } else if (rank[i] > rank[j]) {
-      id[j] = i;
-    } else {
-      id[i] = j;
-      ++rank[j];
-    }
-    --count;
-  }
-
-  int getCount() const {
-    return count;
-  }
-
- private:
-  int count;
-  vector<int> id;
-  vector<int> rank;
-
-  int find(int u) {
-    return id[u] == u ? u : id[u] = find(id[u]);
-  }
-};
-
-class Solution {
- public:
-  int numberOfComponents(vector<vector<int>>& properties, int k) {
-    const int n = properties.size();
-    const vector<set<int>> propertySets = getPropertySets(properties);
-    UnionFind uf(n);
-
-    for (int i = 0; i < n; ++i)
-      for (int j = i + 1; j < n; ++j) {
-        vector<int> intersection;
-        std::set_intersection(propertySets[i].begin(), propertySets[i].end(),
-                              propertySets[j].begin(), propertySets[j].end(),
-                              std::back_inserter(intersection));
-        if (intersection.size() >= k)
-          uf.unionByRank(i, j);
-      }
-
-    return uf.getCount();
-  }
-
- private:
-  vector<set<int>> getPropertySets(const vector<vector<int>>& properties) {
-    vector<set<int>> propertySets;
-    for (const vector<int>& property : properties)
-      propertySets.push_back({property.begin(), property.end()});
-    return propertySets;
-  }
-};
diff --git a/solutions/3493. Properties Graph/3493.java b/solutions/3493. Properties Graph/3493.java
deleted file mode 100644
index 5e1f8d0f0b4..00000000000
--- a/solutions/3493. Properties Graph/3493.java	
+++ /dev/null
@@ -1,62 +0,0 @@
-class UnionFind {
-  public UnionFind(int n) {
-    count = n;
-    id = new int[n];
-    rank = new int[n];
-    for (int i = 0; i < n; ++i)
-      id[i] = i;
-  }
-
-  public void unionByRank(int u, int v) {
-    final int i = find(u);
-    final int j = find(v);
-    if (i == j)
-      return;
-    if (rank[i] < rank[j]) {
-      id[i] = j;
-    } else if (rank[i] > rank[j]) {
-      id[j] = i;
-    } else {
-      id[i] = j;
-      ++rank[j];
-    }
-    --count;
-  }
-
-  public int getCount() {
-    return count;
-  }
-
-  private int count;
-  private int[] id;
-  private int[] rank;
-
-  private int find(int u) {
-    return id[u] == u ? u : (id[u] = find(id[u]));
-  }
-}
-
-class Solution {
-  public int numberOfComponents(int[][] properties, int k) {
-    final int n = properties.length;
-    Set<Integer>[] propertySets = getPropertySets(properties);
-    UnionFind uf = new UnionFind(n);
-
-    for (int i = 0; i < n; ++i)
-      for (int j = i + 1; j < n; ++j) {
-        Set<Integer> intersection = new HashSet<>(propertySets[i]);
-        intersection.retainAll(propertySets[j]);
-        if (intersection.size() >= k)
-          uf.unionByRank(i, j);
-      }
-
-    return uf.getCount();
-  }
-
-  private Set<Integer>[] getPropertySets(int[][] properties) {
-    Set<Integer>[] propertySets = new Set[properties.length];
-    for (int i = 0; i < properties.length; ++i)
-      propertySets[i] = Arrays.stream(properties[i]).boxed().collect(Collectors.toSet());
-    return propertySets;
-  }
-}
diff --git a/solutions/3493. Properties Graph/3493.py b/solutions/3493. Properties Graph/3493.py
deleted file mode 100644
index a8a4f64c881..00000000000
--- a/solutions/3493. Properties Graph/3493.py	
+++ /dev/null
@@ -1,40 +0,0 @@
-class UnionFind:
-  def __init__(self, n: int):
-    self.count = n
-    self.id = list(range(n))
-    self.rank = [0] * n
-
-  def unionByRank(self, u: int, v: int) -> None:
-    i = self._find(u)
-    j = self._find(v)
-    if i == j:
-      return
-    if self.rank[i] < self.rank[j]:
-      self.id[i] = j
-    elif self.rank[i] > self.rank[j]:
-      self.id[j] = i
-    else:
-      self.id[i] = j
-      self.rank[j] += 1
-    self.count -= 1
-
-  def getCount(self) -> int:
-    return self.count
-
-  def _find(self, u: int) -> int:
-    if self.id[u] != u:
-      self.id[u] = self._find(self.id[u])
-    return self.id[u]
-
-
-class Solution:
-  def numberOfComponents(self, properties: list[list[int]], k: int) -> int:
-    n = len(properties)
-    uf = UnionFind(n)
-    propertySets = [set(property) for property in properties]
-
-    for i, j in itertools.combinations(range(n), 2):
-      if len(propertySets[i] & propertySets[j]) >= k:
-        uf.unionByRank(i, j)
-
-    return uf.getCount()
diff --git a/solutions/3494. Find the Minimum Amount of Time to Brew Potions/3494.cpp b/solutions/3494. Find the Minimum Amount of Time to Brew Potions/3494.cpp
deleted file mode 100644
index 7b46608556a..00000000000
--- a/solutions/3494. Find the Minimum Amount of Time to Brew Potions/3494.cpp	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
- public:
-  long long minTime(vector<int>& skill, vector<int>& mana) {
-    long sumSkill = accumulate(skill.begin(), skill.end(), 0L);
-    long prevWizardDone = sumSkill * mana[0];
-
-    for (int j = 1; j < mana.size(); ++j) {
-      long prevPotionDone = prevWizardDone;
-      for (int i = skill.size() - 2; i >= 0; --i) {
-        // start time for wizard i brewing potion j
-        // = max(end time for wizard i brewing potion j - 1,
-        //       the earliest start time for wizard i + 1 brewing potion j
-        //       (coming from previous iteration)
-        //       - time for wizard i brewing potion j)
-        prevPotionDone -= static_cast<long>(skill[i + 1]) * mana[j - 1];
-        prevWizardDone =
-            max(prevPotionDone,
-                prevWizardDone - static_cast<long>(skill[i]) * mana[j]);
-      }
-      prevWizardDone += sumSkill * mana[j];
-    }
-
-    return prevWizardDone;
-  }
-};
diff --git a/solutions/3494. Find the Minimum Amount of Time to Brew Potions/3494.java b/solutions/3494. Find the Minimum Amount of Time to Brew Potions/3494.java
deleted file mode 100644
index beb003e9b1b..00000000000
--- a/solutions/3494. Find the Minimum Amount of Time to Brew Potions/3494.java	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
-  public long minTime(int[] skill, int[] mana) {
-    long sumSkill = Arrays.stream(skill).sum();
-    long prevWizardDone = sumSkill * mana[0];
-
-    for (int j = 1; j < mana.length; ++j) {
-      long prevPotionDone = prevWizardDone;
-      for (int i = skill.length - 2; i >= 0; --i) {
-        // start time for wizard i brewing potion j
-        // = max(end time for wizard i brewing potion j - 1,
-        //       the earliest start time for wizard i + 1 brewing potion j
-        //       (coming from previous iteration)
-        //       - time for wizard i brewing potion j)
-        prevPotionDone -= (long) skill[i + 1] * mana[j - 1];
-        prevWizardDone = Math.max(prevPotionDone, prevWizardDone - (long) skill[i] * mana[j]);
-      }
-      prevWizardDone += sumSkill * mana[j];
-    }
-
-    return prevWizardDone;
-  }
-}
diff --git a/solutions/3494. Find the Minimum Amount of Time to Brew Potions/3494.py b/solutions/3494. Find the Minimum Amount of Time to Brew Potions/3494.py
deleted file mode 100644
index 8f7074cbc5a..00000000000
--- a/solutions/3494. Find the Minimum Amount of Time to Brew Potions/3494.py	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution:
-  def minTime(self, skill: list[int], mana: list[int]) -> int:
-    sumSkill = sum(skill)
-    prevWizardDone = sumSkill * mana[0]
-
-    for j in range(1, len(mana)):
-      prevPotionDone = prevWizardDone
-      for i in range(len(skill) - 2, -1, -1):
-        # start time for wizard i brewing potion j
-        # = max(end time for wizard i brewing potion j - 1,
-        #       the earliest start time for wizard i + 1 brewing potion j
-        #       (coming from previous iteration)
-        #       - time for wizard i brewing potion j)
-        prevPotionDone -= skill[i + 1] * mana[j - 1]
-        prevWizardDone = max(prevPotionDone,
-                             prevWizardDone - skill[i] * mana[j])
-      prevWizardDone += sumSkill * mana[j]
-
-    return prevWizardDone
diff --git a/solutions/3495. Minimum Operations to Make Array Elements Zero/3495.cpp b/solutions/3495. Minimum Operations to Make Array Elements Zero/3495.cpp
deleted file mode 100644
index fe25a1dbeff..00000000000
--- a/solutions/3495. Minimum Operations to Make Array Elements Zero/3495.cpp	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
- public:
-  long long minOperations(vector<vector<int>>& queries) {
-    long ans = 0;
-    for (const vector<int>& query : queries) {
-      const int l = query[0];
-      const int r = query[1];
-      ans += (getOperations(r) - getOperations(l - 1) + 1) / 2;
-    }
-    return ans;
-  }
-
- private:
-  // Returns the number of operations required for [1, n].
-  long getOperations(int n) {
-    long res = 0;
-    int ops = 0;
-    for (int powerOfFour = 1; powerOfFour <= n; powerOfFour *= 4) {
-      const int l = powerOfFour;
-      const int r = min(n, powerOfFour * 4 - 1);
-      res += static_cast<long>(r - l + 1) * ++ops;
-    }
-    return res;
-  }
-};
diff --git a/solutions/3495. Minimum Operations to Make Array Elements Zero/3495.java b/solutions/3495. Minimum Operations to Make Array Elements Zero/3495.java
deleted file mode 100644
index f9f2b6d7648..00000000000
--- a/solutions/3495. Minimum Operations to Make Array Elements Zero/3495.java	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
-  public long minOperations(int[][] queries) {
-    long ans = 0;
-    for (int[] query : queries) {
-      final int l = query[0];
-      final int r = query[1];
-      ans += (getOperations(r) - getOperations(l - 1) + 1) / 2;
-    }
-    return ans;
-  }
-
-  // Returns the number of operations required for [1, n].
-  private long getOperations(int n) {
-    long res = 0;
-    int ops = 0;
-    for (int powerOfFour = 1; powerOfFour <= n; powerOfFour *= 4) {
-      final int l = powerOfFour;
-      final int r = Math.min(n, powerOfFour * 4 - 1);
-      res += (long) (r - l + 1) * ++ops;
-    }
-    return res;
-  }
-}
diff --git a/solutions/3495. Minimum Operations to Make Array Elements Zero/3495.py b/solutions/3495. Minimum Operations to Make Array Elements Zero/3495.py
deleted file mode 100644
index d58cd4bba27..00000000000
--- a/solutions/3495. Minimum Operations to Make Array Elements Zero/3495.py	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution:
-  def minOperations(self, queries: list[list[int]]) -> int:
-    return sum((self._getOperations(r) - self._getOperations(l - 1) + 1) // 2
-               for l, r in queries)
-
-  def _getOperations(self, n: int) -> int:
-    """Returns the number of operations required for [1, n]."""
-    res = 0
-    ops = 0
-    powerOfFour = 1
-    while powerOfFour <= n:
-      l = powerOfFour
-      r = min(n, powerOfFour * 4 - 1)
-      ops += 1
-      res += (r - l + 1) * ops
-      powerOfFour *= 4
-    return res
diff --git a/solutions/3496. Maximize Score After Pair Deletions/3496.cpp b/solutions/3496. Maximize Score After Pair Deletions/3496.cpp
deleted file mode 100644
index 182477b3e1b..00000000000
--- a/solutions/3496. Maximize Score After Pair Deletions/3496.cpp	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution {
- public:
-  int maxScore(vector<int>& nums) {
-    const int n = nums.size();
-    const int sum = accumulate(nums.begin(), nums.end(), 0);
-    if (n % 2 == 1)
-      return sum - ranges::min(nums);
-    int minAdjacentSum = INT_MAX;
-    for (int i = 1; i < n; ++i)
-      minAdjacentSum = min(minAdjacentSum, nums[i - 1] + nums[i]);
-    return sum - minAdjacentSum;
-  }
-};
diff --git a/solutions/3496. Maximize Score After Pair Deletions/3496.java b/solutions/3496. Maximize Score After Pair Deletions/3496.java
deleted file mode 100644
index fc5fdae4e44..00000000000
--- a/solutions/3496. Maximize Score After Pair Deletions/3496.java	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution {
-  public int maxScore(int[] nums) {
-    final int n = nums.length;
-    final int sum = Arrays.stream(nums).sum();
-    if (n % 2 == 1)
-      return sum - Arrays.stream(nums).min().getAsInt();
-    int minAdjacentSum = Integer.MAX_VALUE;
-    for (int i = 1; i < n; ++i)
-      minAdjacentSum = Math.min(minAdjacentSum, nums[i - 1] + nums[i]);
-    return sum - minAdjacentSum;
-  }
-}
diff --git a/solutions/3496. Maximize Score After Pair Deletions/3496.py b/solutions/3496. Maximize Score After Pair Deletions/3496.py
deleted file mode 100644
index b07b76d3c03..00000000000
--- a/solutions/3496. Maximize Score After Pair Deletions/3496.py	
+++ /dev/null
@@ -1,6 +0,0 @@
-class Solution:
-  def maxScore(self, nums: list[int]) -> int:
-    summ = sum(nums)
-    if len(nums) % 2 == 1:
-      return summ - min(nums)
-    return summ - min(a + b for a, b in itertools.pairwise(nums))
diff --git a/solutions/3497. Analyze Subscription Conversion /3497.sql b/solutions/3497. Analyze Subscription Conversion /3497.sql
deleted file mode 100644
index d3cbce2b3a5..00000000000
--- a/solutions/3497. Analyze Subscription Conversion /3497.sql	
+++ /dev/null
@@ -1,29 +0,0 @@
-WITH
-  FreeTrial AS (
-    SELECT user_id, AVG(activity_duration) AS avg_free_trial_duration
-    FROM UserActivity
-    WHERE activity_type = 'free_trial'
-    GROUP BY 1
-  ),
-  Paid AS (
-    SELECT user_id, AVG(activity_duration) AS avg_paid_duration
-    FROM UserActivity
-    WHERE activity_type = 'paid'
-    GROUP BY 1
-  ),
-  ConvertedUsers AS (
-    SELECT DISTINCT FreeTrial.user_id
-    FROM FreeTrial
-    INNER JOIN Paid
-      USING (user_id)
-  )
-SELECT
-  ConvertedUsers.user_id,
-  ROUND(FreeTrial.avg_free_trial_duration, 2) AS trial_avg_duration,
-  ROUND(Paid.avg_paid_duration, 2) AS paid_avg_duration
-FROM ConvertedUsers
-INNER JOIN FreeTrial
-  USING (user_id)
-INNER JOIN Paid
-  USING (user_id)
-ORDER BY 1;
diff --git a/solutions/3498. Reverse Degree of a String/3498.cpp b/solutions/3498. Reverse Degree of a String/3498.cpp
deleted file mode 100644
index f788e6708f8..00000000000
--- a/solutions/3498. Reverse Degree of a String/3498.cpp	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution {
- public:
-  int reverseDegree(string s) {
-    int ans = 0;
-    for (int i = 0; i < s.length(); ++i) {
-      const int reversePos = 26 - (s[i] - 'a');
-      ans += reversePos * (i + 1);
-    }
-    return ans;
-  }
-};
diff --git a/solutions/3498. Reverse Degree of a String/3498.java b/solutions/3498. Reverse Degree of a String/3498.java
deleted file mode 100644
index 7f1ca5ddb53..00000000000
--- a/solutions/3498. Reverse Degree of a String/3498.java	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution {
-  public int reverseDegree(String s) {
-    int ans = 0;
-    for (int i = 0; i < s.length(); ++i) {
-      final int reversePos = 26 - (s.charAt(i) - 'a');
-      ans += reversePos * (i + 1);
-    }
-    return ans;
-  }
-}
diff --git a/solutions/3498. Reverse Degree of a String/3498.py b/solutions/3498. Reverse Degree of a String/3498.py
deleted file mode 100644
index 74c56aa54e7..00000000000
--- a/solutions/3498. Reverse Degree of a String/3498.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def reverseDegree(self, s: str) -> int:
-    return sum((26 - (ord(c) - ord('a'))) * (i + 1)
-               for i, c in enumerate(s))
diff --git a/solutions/3499. Maximize Active Section with Trade I/3499.cpp b/solutions/3499. Maximize Active Section with Trade I/3499.cpp
deleted file mode 100644
index 2856469666f..00000000000
--- a/solutions/3499. Maximize Active Section with Trade I/3499.cpp	
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <ranges>
-
-class Solution {
- public:
-  int maxActiveSectionsAfterTrade(string s) {
-    vector<int> zeroGroupLengths;
-    int maxZeroMerge = 0;
-
-    for (int i = 0; i < s.length(); ++i)
-      if (s[i] == '0') {
-        if (i > 0 && s[i - 1] == '0')
-          ++zeroGroupLengths.back();
-        else
-          zeroGroupLengths.push_back(1);
-      }
-
-    for (const auto& [a, b] : zeroGroupLengths | views::pairwise)
-      maxZeroMerge = max(maxZeroMerge, a + b);
-
-    return ranges::count(s, '1') + maxZeroMerge;
-  }
-};
diff --git a/solutions/3499. Maximize Active Section with Trade I/3499.java b/solutions/3499. Maximize Active Section with Trade I/3499.java
deleted file mode 100644
index 64fdde92430..00000000000
--- a/solutions/3499. Maximize Active Section with Trade I/3499.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public int maxActiveSectionsAfterTrade(String s) {
-    List<Integer> zeroGroupLengths = new ArrayList<>();
-    int maxZeroMerge = 0;
-
-    for (int i = 0; i < s.length(); ++i) {
-      if (s.charAt(i) == '0') {
-        if (i > 0 && s.charAt(i - 1) == '0')
-          zeroGroupLengths.set(zeroGroupLengths.size() - 1,
-                               zeroGroupLengths.get(zeroGroupLengths.size() - 1) + 1);
-        else
-          zeroGroupLengths.add(1);
-      }
-    }
-
-    for (int i = 0; i < zeroGroupLengths.size() - 1; ++i)
-      maxZeroMerge = Math.max(maxZeroMerge, zeroGroupLengths.get(i) + zeroGroupLengths.get(i + 1));
-
-    return (int) s.chars().filter(c -> c == '1').count() + maxZeroMerge;
-  }
-}
diff --git a/solutions/3499. Maximize Active Section with Trade I/3499.py b/solutions/3499. Maximize Active Section with Trade I/3499.py
deleted file mode 100644
index 205676dafbd..00000000000
--- a/solutions/3499. Maximize Active Section with Trade I/3499.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def maxActiveSectionsAfterTrade(self, s: str) -> int:
-    zeroGroups = [len(list(g)) for c, g in itertools.groupby(s) if c == '0']
-    return s.count('1') + max(map(sum, pairwise(zeroGroups)), default=0)
diff --git a/solutions/35. Search Insert Position/35.py b/solutions/35. Search Insert Position/35.py
index 5e1c9360087..0eb427aabf8 100644
--- a/solutions/35. Search Insert Position/35.py	
+++ b/solutions/35. Search Insert Position/35.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def searchInsert(self, nums: list[int], target: int) -> int:
+  def searchInsert(self, nums: List[int], target: int) -> int:
     l = 0
     r = len(nums)
 
diff --git a/solutions/350. Intersection of Two Arrays II/350.py b/solutions/350. Intersection of Two Arrays II/350.py
index b339b178f42..389a18c03ed 100644
--- a/solutions/350. Intersection of Two Arrays II/350.py	
+++ b/solutions/350. Intersection of Two Arrays II/350.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def intersect(self, nums1: list[int], nums2: list[int]) -> list[int]:
+  def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:
     if len(nums1) > len(nums2):
       return self.intersect(nums2, nums1)
 
diff --git a/solutions/3500. Minimum Cost to Divide Array Into Subarrays/3500.cpp b/solutions/3500. Minimum Cost to Divide Array Into Subarrays/3500.cpp
deleted file mode 100644
index d2848eae362..00000000000
--- a/solutions/3500. Minimum Cost to Divide Array Into Subarrays/3500.cpp	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
- public:
-  long long minimumCost(vector<int>& nums, vector<int>& cost, int k) {
-    const int n = nums.size();
-    vector<long> prefixNums(n + 1);
-    vector<long> prefixCost(n + 1);
-    // dp[i] := the minimum cost to divide nums[i..n - 1] into subarrays
-    vector<long> dp(n + 1, LONG_MAX);
-
-    partial_sum(nums.begin(), nums.end(), prefixNums.begin() + 1);
-    partial_sum(cost.begin(), cost.end(), prefixCost.begin() + 1);
-    dp[n] = 0;
-
-    for (int i = n - 1; i >= 0; --i)
-      for (int j = i; j < n; ++j)
-        dp[i] =
-            min(dp[i], prefixNums[j + 1] * (prefixCost[j + 1] - prefixCost[i]) +
-                           k * (prefixCost[n] - prefixCost[i]) + dp[j + 1]);
-
-    return dp[0];
-  }
-};
diff --git a/solutions/3500. Minimum Cost to Divide Array Into Subarrays/3500.java b/solutions/3500. Minimum Cost to Divide Array Into Subarrays/3500.java
deleted file mode 100644
index a65c2d50dcb..00000000000
--- a/solutions/3500. Minimum Cost to Divide Array Into Subarrays/3500.java	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
-  public long minimumCost(int[] nums, int[] cost, int k) {
-    final int n = nums.length;
-    long[] prefixNums = new long[n + 1];
-    long[] prefixCost = new long[n + 1];
-    // dp[i] := the minimum cost to divide nums[i..n - 1] into subarrays
-    long[] dp = new long[n + 1];
-
-    for (int i = 0; i < n; ++i) {
-      prefixNums[i + 1] = prefixNums[i] + nums[i];
-      prefixCost[i + 1] = prefixCost[i] + cost[i];
-    }
-
-    Arrays.fill(dp, Long.MAX_VALUE);
-    dp[n] = 0;
-
-    for (int i = n - 1; i >= 0; --i)
-      for (int j = i; j < n; ++j)
-        dp[i] = Math.min(dp[i], prefixNums[j + 1] * (prefixCost[j + 1] - prefixCost[i]) +
-                                    k * (prefixCost[n] - prefixCost[i]) + dp[j + 1]);
-
-    return dp[0];
-  }
-}
diff --git a/solutions/3500. Minimum Cost to Divide Array Into Subarrays/3500.py b/solutions/3500. Minimum Cost to Divide Array Into Subarrays/3500.py
deleted file mode 100644
index 7be6bddb0a4..00000000000
--- a/solutions/3500. Minimum Cost to Divide Array Into Subarrays/3500.py	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution:
-  def minimumCost(self, nums: list[int], cost: list[int], k: int) -> int:
-    n = len(nums)
-    prefixNums = list(itertools.accumulate(nums, initial=0))
-    prefixCost = list(itertools.accumulate(cost, initial=0))
-    # dp[i] := the minimum cost to divide nums[i..n - 1] into subarrays
-    dp = [math.inf] * n + [0]
-
-    for i in range(n - 1, -1, -1):
-      for j in range(i, n):
-        dp[i] = min(dp[i],
-                    prefixNums[j + 1] * (prefixCost[j + 1] - prefixCost[i]) +
-                    k * (prefixCost[n] - prefixCost[i]) + dp[j + 1])
-
-    return dp[0]
diff --git a/solutions/3501. Maximize Active Section with Trade II/3501.cpp b/solutions/3501. Maximize Active Section with Trade II/3501.cpp
deleted file mode 100644
index 375fb1fc5fb..00000000000
--- a/solutions/3501. Maximize Active Section with Trade II/3501.cpp	
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <ranges>
-
-struct Group {
-  int start;
-  int length;
-};
-
-class SparseTable {
- public:
-  SparseTable(const vector<int>& nums)
-      : n(nums.size()), st(std::bit_width(n) + 1, vector<int>(n + 1)) {
-    copy(nums.begin(), nums.end(), st[0].begin());
-    for (int i = 1; i <= bit_width(n); ++i)
-      for (int j = 0; j + (1 << i) <= n; ++j)
-        st[i][j] = max(st[i - 1][j], st[i - 1][j + (1 << (i - 1))]);
-  }
-
-  // Returns max(nums[l..r]).
-  int query(unsigned l, unsigned r) const {
-    const int i = bit_width(r - l + 1) - 1;
-    return max(st[i][l], st[i][r - (1 << i) + 1]);
-  }
-
- private:
-  const unsigned n;
-  vector<vector<int>> st;  // st[i][j] := max(nums[j..j + 2^i - 1])
-};
-
-class Solution {
- public:
-  vector<int> maxActiveSectionsAfterTrade(string s,
-                                          vector<vector<int>>& queries) {
-    const int n = s.length();
-    const int ones = ranges::count(s, '1');
-    const auto [zeroGroups, zeroGroupIndex] = getZeroGroups(s);
-    if (zeroGroups.empty())
-      return vector<int>(queries.size(), ones);
-
-    const SparseTable st(getZeroMergeLengths(zeroGroups));
-    vector<int> ans;
-
-    for (const vector<int>& query : queries) {
-      const int l = query[0];
-      const int r = query[1];
-      const int left = zeroGroupIndex[l] == -1
-                           ? -1
-                           : (zeroGroups[zeroGroupIndex[l]].length -
-                              (l - zeroGroups[zeroGroupIndex[l]].start));
-      const int right = zeroGroupIndex[r] == -1
-                            ? -1
-                            : (r - zeroGroups[zeroGroupIndex[r]].start + 1);
-      const auto [startAdjacentGroupIndex, endAdjacentGroupIndex] =
-          mapToAdjacentGroupIndices(
-              zeroGroupIndex[l] + 1,
-              s[r] == '1' ? zeroGroupIndex[r] : zeroGroupIndex[r] - 1);
-      int activeSections = ones;
-      if (s[l] == '0' && s[r] == '0' &&
-          zeroGroupIndex[l] + 1 == zeroGroupIndex[r])
-        activeSections = max(activeSections, ones + left + right);
-      else if (startAdjacentGroupIndex <= endAdjacentGroupIndex)
-        activeSections = max(
-            activeSections,
-            ones + st.query(startAdjacentGroupIndex, endAdjacentGroupIndex));
-      if (s[l] == '0' &&
-          zeroGroupIndex[l] + 1 <=
-              (s[r] == '1' ? zeroGroupIndex[r] : zeroGroupIndex[r] - 1))
-        activeSections =
-            max(activeSections,
-                ones + left + zeroGroups[zeroGroupIndex[l] + 1].length);
-      if (s[r] == '0' && zeroGroupIndex[l] < zeroGroupIndex[r] - 1)
-        activeSections =
-            max(activeSections,
-                ones + right + zeroGroups[zeroGroupIndex[r] - 1].length);
-      ans.push_back(activeSections);
-    }
-
-    return ans;
-  }
-
- private:
-  // Returns the zero groups and the index of the zero group that contains the
-  // i-th character.
-  pair<vector<Group>, vector<int>> getZeroGroups(const string& s) {
-    vector<Group> zeroGroups;
-    vector<int> zeroGroupIndex;
-    for (int i = 0; i < s.length(); i++) {
-      if (s[i] == '0') {
-        if (i > 0 && s[i - 1] == '0')
-          ++zeroGroups.back().length;
-        else
-          zeroGroups.push_back({i, 1});
-      }
-      zeroGroupIndex.push_back(zeroGroups.size() - 1);
-    }
-    return {zeroGroups, zeroGroupIndex};
-  }
-
-  // Returns the sums of the lengths of the adjacent groups.
-  vector<int> getZeroMergeLengths(const vector<Group>& zeroGroups) {
-    vector<int> zeroMergeLengths;
-    for (const auto& [a, b] : zeroGroups | views::pairwise)
-      zeroMergeLengths.push_back(a.length + b.length);
-    return zeroMergeLengths;
-  }
-
-  // Returns the indices of the adjacent groups that contain l and r completely.
-  //
-  // e.g.    groupIndices = [0, 1, 2, 3]
-  // adjacentGroupIndices = [0 (0, 1), 1 (1, 2), 2 (2, 3)]
-  // map(startGroupIndex = 1, endGroupIndex = 3) -> (1, 2)
-  pair<int, int> mapToAdjacentGroupIndices(int startGroupIndex,
-                                           int endGroupIndex) {
-    return {startGroupIndex, endGroupIndex - 1};
-  }
-};
diff --git a/solutions/3501. Maximize Active Section with Trade II/3501.java b/solutions/3501. Maximize Active Section with Trade II/3501.java
deleted file mode 100644
index a0574016e77..00000000000
--- a/solutions/3501. Maximize Active Section with Trade II/3501.java	
+++ /dev/null
@@ -1,110 +0,0 @@
-class Group {
-  public int start;
-  public int length;
-  public Group(int start, int length) {
-    this.start = start;
-    this.length = length;
-  }
-}
-
-class SparseTable {
-  public SparseTable(int[] nums) {
-    n = nums.length;
-    st = new int[bitLength(n) + 1][n + 1];
-    System.arraycopy(nums, 0, st[0], 0, n);
-    for (int i = 1; i <= st.length; ++i)
-      for (int j = 0; j + (1 << i) <= n; ++j)
-        st[i][j] = Math.max(st[i - 1][j], st[i - 1][j + (1 << (i - 1))]);
-  }
-
-  // Returns max(nums[l..r])
-  public int query(int l, int r) {
-    final int i = bitLength(r - l + 1) - 1;
-    return Math.max(st[i][l], st[i][r - (1 << i) + 1]);
-  }
-
-  private final int n;
-  private final int[][] st; // st[i][j] := max(nums[j..j + 2^i - 1])
-
-  private int bitLength(int n) {
-    return Integer.SIZE - Integer.numberOfLeadingZeros(n);
-  }
-}
-
-class Solution {
-  public List<Integer> maxActiveSectionsAfterTrade(String s, int[][] queries) {
-    final int n = s.length();
-    final int ones = (int) s.chars().filter(c -> c == '1').count();
-    final Pair<List<Group>, int[]> zeroGroupsInfo = getZeroGroups(s);
-    final List<Group> zeroGroups = zeroGroupsInfo.getKey();
-    final int[] zeroGroupIndex = zeroGroupsInfo.getValue();
-
-    if (zeroGroups.isEmpty())
-      return Collections.nCopies(queries.length, ones);
-
-    final SparseTable st = new SparseTable(getZeroMergeLengths(zeroGroups));
-    final List<Integer> ans = new ArrayList<>();
-
-    for (int[] query : queries) {
-      final int l = query[0];
-      final int r = query[1];
-      final int left = zeroGroupIndex[l] == -1 ? -1
-                                               : (zeroGroups.get(zeroGroupIndex[l]).length -
-                                                  (l - zeroGroups.get(zeroGroupIndex[l]).start));
-      final int right =
-          zeroGroupIndex[r] == -1 ? -1 : (r - zeroGroups.get(zeroGroupIndex[r]).start + 1);
-      final Pair<Integer, Integer> adjacentIndices = mapToAdjacentGroupIndices(
-          zeroGroupIndex[l] + 1, s.charAt(r) == '1' ? zeroGroupIndex[r] : zeroGroupIndex[r] - 1);
-      final int startAdjacentGroupIndex = adjacentIndices.getKey();
-      final int endAdjacentGroupIndex = adjacentIndices.getValue();
-
-      int activeSections = ones;
-      if (s.charAt(l) == '0' && s.charAt(r) == '0' && zeroGroupIndex[l] + 1 == zeroGroupIndex[r])
-        activeSections = Math.max(activeSections, ones + left + right);
-      else if (startAdjacentGroupIndex <= endAdjacentGroupIndex)
-        activeSections = Math.max(activeSections,
-                                  ones + st.query(startAdjacentGroupIndex, endAdjacentGroupIndex));
-      if (s.charAt(l) == '0' &&
-          zeroGroupIndex[l] + 1 <= (s.charAt(r) == '1' ? zeroGroupIndex[r] : zeroGroupIndex[r] - 1))
-        activeSections =
-            Math.max(activeSections, ones + left + zeroGroups.get(zeroGroupIndex[l] + 1).length);
-      if (s.charAt(r) == '0' && zeroGroupIndex[l] < zeroGroupIndex[r] - 1)
-        activeSections =
-            Math.max(activeSections, ones + right + zeroGroups.get(zeroGroupIndex[r] - 1).length);
-      ans.add(activeSections);
-    }
-
-    return ans;
-  }
-
-  // Returns the zero groups and the index of the zero group that contains the i-th character
-  private Pair<List<Group>, int[]> getZeroGroups(String s) {
-    final List<Group> zeroGroups = new ArrayList<>();
-    final int[] zeroGroupIndex = new int[s.length()];
-
-    for (int i = 0; i < s.length(); i++) {
-      if (s.charAt(i) == '0') {
-        if (i > 0 && s.charAt(i - 1) == '0')
-          zeroGroups.get(zeroGroups.size() - 1).length++;
-        else
-          zeroGroups.add(new Group(i, 1));
-      }
-      zeroGroupIndex[i] = zeroGroups.size() - 1;
-    }
-
-    return new Pair<>(zeroGroups, zeroGroupIndex);
-  }
-
-  // Returns the sums of the lengths of the adjacent groups
-  private int[] getZeroMergeLengths(List<Group> zeroGroups) {
-    final int[] zeroMergeLengths = new int[zeroGroups.size() - 1];
-    for (int i = 0; i < zeroGroups.size() - 1; ++i)
-      zeroMergeLengths[i] = zeroGroups.get(i).length + zeroGroups.get(i + 1).length;
-    return zeroMergeLengths;
-  }
-
-  // Returns the indices of the adjacent groups that contain l and r completely
-  private Pair<Integer, Integer> mapToAdjacentGroupIndices(int startGroupIndex, int endGroupIndex) {
-    return new Pair<>(startGroupIndex, endGroupIndex - 1);
-  }
-}
diff --git a/solutions/3501. Maximize Active Section with Trade II/3501.py b/solutions/3501. Maximize Active Section with Trade II/3501.py
deleted file mode 100644
index 6962a736e0f..00000000000
--- a/solutions/3501. Maximize Active Section with Trade II/3501.py	
+++ /dev/null
@@ -1,101 +0,0 @@
-from dataclasses import dataclass
-
-
-@dataclass
-class Group:
-  start: int
-  length: int
-
-
-class SparseTable:
-  def __init__(self, nums: list[int]):
-    self.n = len(nums)
-    # st[i][j] := max(nums[j..j + 2^i - 1])
-    self.st = [[0] * (self.n + 1) for _ in range(self.n.bit_length() + 1)]
-    self.st[0] = nums.copy()
-    for i in range(1, self.n.bit_length() + 1):
-      for j in range(self.n - (1 << i) + 1):
-        self.st[i][j] = max(
-            self.st[i - 1][j],
-            self.st[i - 1][j + (1 << (i - 1))])
-
-  def query(self, l: int, r: int) -> int:
-    """Returns max(nums[l..r])."""
-    i = (r - l + 1).bit_length() - 1
-    return max(self.st[i][l], self.st[i][r - (1 << i) + 1])
-
-
-class Solution:
-  def maxActiveSectionsAfterTrade(
-      self,
-      s: str,
-      queries: list[list[int]]
-  ) -> list[int]:
-    ones = s.count('1')
-    zeroGroups, zeroGroupIndex = self._getZeroGroups(s)
-    if not zeroGroups:
-      return [ones] * len(queries)
-
-    st = SparseTable(self._getZeroMergeLengths(zeroGroups))
-
-    def getMaxActiveSections(l: int, r: int) -> int:
-      left = (-1 if zeroGroupIndex[l] == -1
-              else (zeroGroups[zeroGroupIndex[l]].length -
-                    (l - zeroGroups[zeroGroupIndex[l]].start)))
-      right = (-1 if zeroGroupIndex[r] == -1
-               else (r - zeroGroups[zeroGroupIndex[r]].start + 1))
-      startAdjacentGroupIndex, endAdjacentGroupIndex = self._mapToAdjacentGroupIndices(
-          zeroGroupIndex[l] + 1, zeroGroupIndex[r] if s[r] == '1' else zeroGroupIndex[r] - 1)
-      activeSections = ones
-      if (s[l] == '0' and s[r] == '0' and
-              zeroGroupIndex[l] + 1 == zeroGroupIndex[r]):
-        activeSections = max(activeSections, ones + left + right)
-      elif startAdjacentGroupIndex <= endAdjacentGroupIndex:
-        activeSections = max(
-            activeSections,
-            ones + st.query(startAdjacentGroupIndex, endAdjacentGroupIndex))
-      if (s[l] == '0' and
-          zeroGroupIndex[l] + 1 <= (zeroGroupIndex[r]
-                                    if s[r] == '1' else zeroGroupIndex[r] - 1)):
-        activeSections = max(activeSections, ones + left +
-                             zeroGroups[zeroGroupIndex[l] + 1].length)
-      if (s[r] == '0' and zeroGroupIndex[l] < zeroGroupIndex[r] - 1):
-        activeSections = max(activeSections, ones + right +
-                             zeroGroups[zeroGroupIndex[r] - 1].length)
-      return activeSections
-
-    return [getMaxActiveSections(l, r) for l, r in queries]
-
-  def _getZeroGroups(self, s: str) -> tuple[list[Group], list[int]]:
-    """
-    Returns the zero groups and the index of the zero group that contains the
-    i-th character.
-    """
-    zeroGroups = []
-    zeroGroupIndex = []
-    for i in range(len(s)):
-      if s[i] == '0':
-        if i > 0 and s[i - 1] == '0':
-          zeroGroups[-1].length += 1
-        else:
-          zeroGroups.append(Group(i, 1))
-      zeroGroupIndex.append(len(zeroGroups) - 1)
-    return zeroGroups, zeroGroupIndex
-
-  def _getZeroMergeLengths(self, zeroGroups: list[Group]) -> list[int]:
-    """Returns the sums of the lengths of the adjacent groups."""
-    return [a.length + b.length for a, b in itertools.pairwise(zeroGroups)]
-
-  def _mapToAdjacentGroupIndices(
-      self,
-      startGroupIndex: int,
-      endGroupIndex: int
-  ) -> tuple[int, int]:
-    """
-    Returns the indices of the adjacent groups that contain l and r completely.
-
-    e.g.    groupIndices = [0, 1, 2, 3]
-    adjacentGroupIndices = [0 (0, 1), 1 (1, 2), 2 (2, 3)]
-    map(startGroupIndex = 1, endGroupIndex = 3) -> (1, 2)
-    """
-    return startGroupIndex, endGroupIndex - 1
diff --git a/solutions/3502. Minimum Cost to Reach Every Position/3502.cpp b/solutions/3502. Minimum Cost to Reach Every Position/3502.cpp
deleted file mode 100644
index 5f2eecb248d..00000000000
--- a/solutions/3502. Minimum Cost to Reach Every Position/3502.cpp	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution {
- public:
-  vector<int> minCosts(vector<int>& cost) {
-    vector<int> ans;
-    int minCost = INT_MAX;
-    for (const int c : cost) {
-      minCost = min(minCost, c);
-      ans.push_back(minCost);
-    }
-    return ans;
-  }
-};
diff --git a/solutions/3502. Minimum Cost to Reach Every Position/3502.java b/solutions/3502. Minimum Cost to Reach Every Position/3502.java
deleted file mode 100644
index 7ef06811817..00000000000
--- a/solutions/3502. Minimum Cost to Reach Every Position/3502.java	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution {
-  public int[] minCosts(int[] cost) {
-    int[] ans = new int[cost.length];
-    int minCost = Integer.MAX_VALUE;
-    for (int i = 0; i < cost.length; ++i) {
-      minCost = Math.min(minCost, cost[i]);
-      ans[i] = minCost;
-    }
-    return ans;
-  }
-}
diff --git a/solutions/3502. Minimum Cost to Reach Every Position/3502.py b/solutions/3502. Minimum Cost to Reach Every Position/3502.py
deleted file mode 100644
index 4082955d289..00000000000
--- a/solutions/3502. Minimum Cost to Reach Every Position/3502.py	
+++ /dev/null
@@ -1,3 +0,0 @@
-class Solution:
-  def minCosts(self, cost: list[int]) -> list[int]:
-    return list(itertools.accumulate(cost, min))
diff --git a/solutions/3503. Longest Palindrome After Substring Concatenation I/3503.cpp b/solutions/3503. Longest Palindrome After Substring Concatenation I/3503.cpp
deleted file mode 100644
index 75d4f1f73aa..00000000000
--- a/solutions/3503. Longest Palindrome After Substring Concatenation I/3503.cpp	
+++ /dev/null
@@ -1,41 +0,0 @@
-class Solution {
- public:
-  int longestPalindrome(string s, string t) {
-    const int m = s.length();
-    const int n = t.length();
-    vector<int> suffix = getPalindromeLengths(s, true);
-    vector<int> prefix = getPalindromeLengths(t, false);
-    int ans = max(ranges::max(suffix), ranges::max(prefix));
-    // dp[i][j] := the longest length of palindrome starting in s[i] and ending
-    // in t[j]
-    vector<vector<int>> dp(m, vector<int>(n));
-
-    for (int i = 0; i < m; ++i)
-      for (int j = n - 1; j >= 0; --j)
-        if (s[i] == t[j]) {
-          dp[i][j] = 2 + (i > 0 && j < n - 1 ? dp[i - 1][j + 1] : 0);
-          const int extend =
-              max(i + 1 < m ? suffix[i + 1] : 0, j > 0 ? prefix[j - 1] : 0);
-          ans = max(ans, dp[i][j] + extend);
-        }
-
-    return ans;
-  }
-
- private:
-  vector<int> getPalindromeLengths(const string& s, bool isSuffix) {
-    const int n = s.length();
-    // dp[i][j] := True if s[i..j] is a palindrome
-    vector<vector<bool>> dp(n, vector<bool>(n));
-    // lengths[i] := length of longest palindrome in s[i..n - 1]
-    vector<int> lengths(n);
-    for (int i = n - 1; i >= 0; --i)
-      for (int j = i; j < n; ++j)
-        if (s[i] == s[j] && (j - i < 2 || dp[i + 1][j - 1])) {
-          dp[i][j] = true;
-          const int index = isSuffix ? i : j;
-          lengths[index] = max(lengths[index], j - i + 1);
-        }
-    return lengths;
-  }
-};
diff --git a/solutions/3503. Longest Palindrome After Substring Concatenation I/3503.java b/solutions/3503. Longest Palindrome After Substring Concatenation I/3503.java
deleted file mode 100644
index 1c0e6008c8b..00000000000
--- a/solutions/3503. Longest Palindrome After Substring Concatenation I/3503.java	
+++ /dev/null
@@ -1,39 +0,0 @@
-class Solution {
-  public int longestPalindrome(String s, String t) {
-    final int m = s.length();
-    final int n = t.length();
-    int[] suffix = getPalindromeLengths(s, true);
-    int[] prefix = getPalindromeLengths(t, false);
-    int ans = Math.max(Arrays.stream(suffix).max().getAsInt(), //
-                       Arrays.stream(prefix).max().getAsInt());
-    // dp[i][j] := the longest length of palindrome starting in s[i] and ending
-    // in t[j]
-    int[][] dp = new int[m][n];
-
-    for (int i = 0; i < m; ++i)
-      for (int j = n - 1; j >= 0; --j)
-        if (s.charAt(i) == t.charAt(j)) {
-          dp[i][j] = 2 + (i > 0 && j < n - 1 ? dp[i - 1][j + 1] : 0);
-          final int extend = Math.max(i + 1 < m ? suffix[i + 1] : 0, j > 0 ? prefix[j - 1] : 0);
-          ans = Math.max(ans, dp[i][j] + extend);
-        }
-
-    return ans;
-  }
-
-  private int[] getPalindromeLengths(String s, boolean isSuffix) {
-    final int n = s.length();
-    // dp[i][j] := True if s[i..j] is a palindrome
-    boolean[][] dp = new boolean[n][n];
-    // lengths[i] := length of longest palindrome in s[i..n - 1]
-    int[] lengths = new int[n];
-    for (int i = n - 1; i >= 0; --i)
-      for (int j = i; j < n; ++j)
-        if (s.charAt(i) == s.charAt(j) && (j - i < 2 || dp[i + 1][j - 1])) {
-          dp[i][j] = true;
-          final int index = isSuffix ? i : j;
-          lengths[index] = Math.max(lengths[index], j - i + 1);
-        }
-    return lengths;
-  }
-}
diff --git a/solutions/3503. Longest Palindrome After Substring Concatenation I/3503.py b/solutions/3503. Longest Palindrome After Substring Concatenation I/3503.py
deleted file mode 100644
index 6951a127816..00000000000
--- a/solutions/3503. Longest Palindrome After Substring Concatenation I/3503.py	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution:
-  def longestPalindrome(self, s: str, t: str) -> int:
-    m = len(s)
-    n = len(t)
-    suffix = self._getPalindromeLengths(s, True)
-    prefix = self._getPalindromeLengths(t, False)
-    ans = max(max(suffix), max(prefix))
-    # dp[i][j] := the longest length of palindrome starting in s[i] and ending
-    # in t[j]
-    dp = [[0] * n for _ in range(m)]
-
-    for i in range(m):
-      for j in range(n - 1, -1, -1):
-        if s[i] == t[j]:
-          dp[i][j] = 2 + (dp[i - 1][j + 1] if i > 0 and j < n - 1 else 0)
-          extend = max(suffix[i + 1] if i + 1 < m else 0,
-                       prefix[j - 1] if j > 0 else 0)
-          ans = max(ans, dp[i][j] + extend)
-
-    return ans
-
-  def _getPalindromeLengths(self, s: str, isSuffix: bool) -> list[int]:
-    n = len(s)
-    # dp[i][j] := True if s[i..j] is a palindrome
-    dp = [[False] * n for _ in range(n)]
-    # lengths[i] := length of longest palindrome in s[i..n - 1]
-    lengths = [0] * n
-    for i in range(n - 1, -1, -1):
-      for j in range(i, n):
-        if s[i] == s[j] and (j - i < 2 or dp[i + 1][j - 1]):
-          dp[i][j] = True
-          index = i if isSuffix else j
-          lengths[index] = max(lengths[index], j - i + 1)
-    return lengths
diff --git a/solutions/3504. Longest Palindrome After Substring Concatenation II/3504.cpp b/solutions/3504. Longest Palindrome After Substring Concatenation II/3504.cpp
deleted file mode 100644
index bc9d215a732..00000000000
--- a/solutions/3504. Longest Palindrome After Substring Concatenation II/3504.cpp	
+++ /dev/null
@@ -1,42 +0,0 @@
-class Solution {
- public:
-  // 3503. Longest Palindrome After Substring Concatenation I
-  int longestPalindrome(string s, string t) {
-    const int m = s.length();
-    const int n = t.length();
-    vector<int> suffix = getPalindromeLengths(s, true);
-    vector<int> prefix = getPalindromeLengths(t, false);
-    int ans = max(ranges::max(suffix), ranges::max(prefix));
-    // dp[i][j] := the longest length of palindrome starting in s[i] and ending
-    // in t[j]
-    vector<vector<int>> dp(m, vector<int>(n));
-
-    for (int i = 0; i < m; ++i)
-      for (int j = n - 1; j >= 0; --j)
-        if (s[i] == t[j]) {
-          dp[i][j] = 2 + (i > 0 && j < n - 1 ? dp[i - 1][j + 1] : 0);
-          const int extend =
-              max(i + 1 < m ? suffix[i + 1] : 0, j > 0 ? prefix[j - 1] : 0);
-          ans = max(ans, dp[i][j] + extend);
-        }
-
-    return ans;
-  }
-
- private:
-  vector<int> getPalindromeLengths(const string& s, bool isSuffix) {
-    const int n = s.length();
-    // dp[i][j] := True if s[i..j] is a palindrome
-    vector<vector<bool>> dp(n, vector<bool>(n));
-    // lengths[i] := length of longest palindrome in s[i..n - 1]
-    vector<int> lengths(n);
-    for (int i = n - 1; i >= 0; --i)
-      for (int j = i; j < n; ++j)
-        if (s[i] == s[j] && (j - i < 2 || dp[i + 1][j - 1])) {
-          dp[i][j] = true;
-          const int index = isSuffix ? i : j;
-          lengths[index] = max(lengths[index], j - i + 1);
-        }
-    return lengths;
-  }
-};
diff --git a/solutions/3504. Longest Palindrome After Substring Concatenation II/3504.java b/solutions/3504. Longest Palindrome After Substring Concatenation II/3504.java
deleted file mode 100644
index 3bd57d44bba..00000000000
--- a/solutions/3504. Longest Palindrome After Substring Concatenation II/3504.java	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
-  // 3503. Longest Palindrome After Substring Concatenation I
-  public int longestPalindrome(String s, String t) {
-    final int m = s.length();
-    final int n = t.length();
-    int[] suffix = getPalindromeLengths(s, true);
-    int[] prefix = getPalindromeLengths(t, false);
-    int ans = Math.max(Arrays.stream(suffix).max().getAsInt(), //
-                       Arrays.stream(prefix).max().getAsInt());
-    // dp[i][j] := the longest length of palindrome starting in s[i] and ending
-    // in t[j]
-    int[][] dp = new int[m][n];
-
-    for (int i = 0; i < m; ++i)
-      for (int j = n - 1; j >= 0; --j)
-        if (s.charAt(i) == t.charAt(j)) {
-          dp[i][j] = 2 + (i > 0 && j < n - 1 ? dp[i - 1][j + 1] : 0);
-          final int extend = Math.max(i + 1 < m ? suffix[i + 1] : 0, j > 0 ? prefix[j - 1] : 0);
-          ans = Math.max(ans, dp[i][j] + extend);
-        }
-
-    return ans;
-  }
-
-  private int[] getPalindromeLengths(String s, boolean isSuffix) {
-    final int n = s.length();
-    // dp[i][j] := True if s[i..j] is a palindrome
-    boolean[][] dp = new boolean[n][n];
-    // lengths[i] := length of longest palindrome in s[i..n - 1]
-    int[] lengths = new int[n];
-    for (int i = n - 1; i >= 0; --i)
-      for (int j = i; j < n; ++j)
-        if (s.charAt(i) == s.charAt(j) && (j - i < 2 || dp[i + 1][j - 1])) {
-          dp[i][j] = true;
-          final int index = isSuffix ? i : j;
-          lengths[index] = Math.max(lengths[index], j - i + 1);
-        }
-    return lengths;
-  }
-}
diff --git a/solutions/3504. Longest Palindrome After Substring Concatenation II/3504.py b/solutions/3504. Longest Palindrome After Substring Concatenation II/3504.py
deleted file mode 100644
index 8a3ed0f314a..00000000000
--- a/solutions/3504. Longest Palindrome After Substring Concatenation II/3504.py	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution:
-  # 3503. Longest Palindrome After Substring Concatenation I
-  def longestPalindrome(self, s: str, t: str) -> int:
-    m = len(s)
-    n = len(t)
-    suffix = self._getPalindromeLengths(s, True)
-    prefix = self._getPalindromeLengths(t, False)
-    ans = max(max(suffix), max(prefix))
-    # dp[i][j] := the longest length of palindrome starting in s[i] and ending
-    # in t[j]
-    dp = [[0] * n for _ in range(m)]
-
-    for i in range(m):
-      for j in range(n - 1, -1, -1):
-        if s[i] == t[j]:
-          dp[i][j] = 2 + (dp[i - 1][j + 1] if i > 0 and j < n - 1 else 0)
-          extend = max(suffix[i + 1] if i + 1 < m else 0,
-                       prefix[j - 1] if j > 0 else 0)
-          ans = max(ans, dp[i][j] + extend)
-
-    return ans
-
-  def _getPalindromeLengths(self, s: str, isSuffix: bool) -> list[int]:
-    n = len(s)
-    # dp[i][j] := True if s[i..j] is a palindrome
-    dp = [[False] * n for _ in range(n)]
-    # lengths[i] := length of longest palindrome in s[i..n - 1]
-    lengths = [0] * n
-    for i in range(n - 1, -1, -1):
-      for j in range(i, n):
-        if s[i] == s[j] and (j - i < 2 or dp[i + 1][j - 1]):
-          dp[i][j] = True
-          index = i if isSuffix else j
-          lengths[index] = max(lengths[index], j - i + 1)
-    return lengths
diff --git a/solutions/3505. Minimum Operations to Make Elements Within K Subarrays Equal/3505.cpp b/solutions/3505. Minimum Operations to Make Elements Within K Subarrays Equal/3505.cpp
deleted file mode 100644
index c1c00a4fd77..00000000000
--- a/solutions/3505. Minimum Operations to Make Elements Within K Subarrays Equal/3505.cpp	
+++ /dev/null
@@ -1,84 +0,0 @@
-class Solution {
- public:
-  long long minOperations(vector<int>& nums, int x, int k) {
-    // minOps[i] := the minimum number of operations needed to make
-    // nums[i..i + x - 1] equal to the median
-    const vector<long> minOps = getMinOps(nums, x);
-    vector<vector<long>> mem(nums.size() + 1, vector<long>(k + 1, -1));
-    return minOperations(nums, x, 0, k, minOps, mem);
-  }
-
- private:
-  static constexpr long kInf = LONG_MAX / 2;
-
-  // Returns the minimum operations needed to have at least k non-overlapping
-  // subarrays of size x in nums[i..n - 1].
-  long minOperations(const vector<int>& nums, int x, int i, int k,
-                     const vector<long>& minOps, vector<vector<long>>& mem) {
-    if (k == 0)
-      return 0;
-    if (i == nums.size())
-      return kInf;
-    if (mem[i][k] != -1)
-      return mem[i][k];
-    const long skip = minOperations(nums, x, i + 1, k, minOps, mem);
-    const long pick =
-        i + x <= nums.size()
-            ? minOps[i] + minOperations(nums, x, i + x, k - 1, minOps, mem)
-            : kInf;
-    return mem[i][k] = min(skip, pick);
-  }
-
-  // Returns the minimum operations needed to make all elements in the window of
-  // size x equal to the median.
-  vector<long> getMinOps(const vector<int>& nums, int x) {
-    vector<long> minOps;
-    multiset<int> lower;
-    multiset<int> upper;
-    long lowerSum = 0;
-    long upperSum = 0;
-    for (int i = 0; i < nums.size(); ++i) {
-      if (lower.empty() || nums[i] <= *lower.rbegin()) {
-        lower.insert(nums[i]);
-        lowerSum += nums[i];
-      } else {
-        upper.insert(nums[i]);
-        upperSum += nums[i];
-      }
-      if (i >= x) {
-        const int outNum = nums[i - x];
-        if (const auto it = lower.find(outNum); it != lower.cend()) {
-          lower.erase(it);
-          lowerSum -= outNum;
-        } else {
-          upper.erase(upper.find(outNum));
-          upperSum -= outNum;
-        }
-      }
-      // Balance the two multisets s.t.
-      // |lower| >= |upper| and |lower| - |upper| <= 1.
-      if (lower.size() < upper.size()) {
-        const int val = *upper.begin();
-        upper.erase(upper.begin());
-        lower.insert(val);
-        upperSum -= val;
-        lowerSum += val;
-      } else if (lower.size() - upper.size() > 1) {
-        const int val = *lower.rbegin();
-        lower.erase(prev(lower.end()));
-        upper.insert(val);
-        lowerSum -= val;
-        upperSum += val;
-      }
-      // Calculate operations needed to make all elements in the window equal
-      // to the median.
-      if (i >= x - 1) {
-        const int median = *lower.rbegin();
-        const long ops = (median * lower.size() - lowerSum) +
-                         (upperSum - median * upper.size());
-        minOps.push_back(ops);
-      }
-    }
-    return minOps;
-  }
-};
diff --git a/solutions/3505. Minimum Operations to Make Elements Within K Subarrays Equal/3505.java b/solutions/3505. Minimum Operations to Make Elements Within K Subarrays Equal/3505.java
deleted file mode 100644
index 194192c43e0..00000000000
--- a/solutions/3505. Minimum Operations to Make Elements Within K Subarrays Equal/3505.java	
+++ /dev/null
@@ -1,99 +0,0 @@
-class MyMap {
-  public TreeMap<Integer, Integer> map = new TreeMap<>();
-  public int size = 0;
-  public long sum = 0;
-}
-
-class Solution {
-  public long minOperations(int[] nums, int x, int k) {
-    // minOps[i] := the minimum number of operations needed to make
-    // nums[i..i + x - 1] equal to the median
-    List<Long> minOps = getMinOps(nums, x);
-    Long[][] mem = new Long[nums.length + 1][k + 1];
-    return minOperations(nums, x, 0, k, minOps, mem);
-  }
-
-  private static final long INF = Long.MAX_VALUE / 2;
-
-  // Returns the minimum operations needed to have at least k non-overlapping
-  // subarrays of size x in nums[i..n - 1].
-  private long minOperations(int[] nums, int x, int i, int k, List<Long> minOps, Long[][] mem) {
-    if (k == 0)
-      return 0;
-    if (i == nums.length)
-      return INF;
-    if (mem[i][k] != null)
-      return mem[i][k];
-    final long skip = minOperations(nums, x, i + 1, k, minOps, mem);
-    final long pick = i + x <= nums.length
-                          ? minOps.get(i) + minOperations(nums, x, i + x, k - 1, minOps, mem)
-                          : INF;
-    return mem[i][k] = Math.min(skip, pick);
-  }
-
-  // Returns the minimum operations needed to make all elements in the window of
-  // size x equal to the median.
-  private List<Long> getMinOps(int[] nums, int x) {
-    List<Long> minOps = new ArrayList<>();
-    MyMap lower = new MyMap();
-    MyMap upper = new MyMap();
-    for (int i = 0; i < nums.length; ++i) {
-      if (lower.map.isEmpty() || nums[i] <= lower.map.lastKey()) {
-        lower.map.merge(nums[i], 1, Integer::sum);
-        lower.sum += nums[i];
-        ++lower.size;
-      } else {
-        upper.map.merge(nums[i], 1, Integer::sum);
-        upper.sum += nums[i];
-        ++upper.size;
-      }
-      if (i >= x) {
-        final int outNum = nums[i - x];
-        if (lower.map.containsKey(outNum)) {
-          lower.map.merge(outNum, -1, Integer::sum);
-          if (lower.map.get(outNum) == 0)
-            lower.map.remove(outNum);
-          lower.sum -= outNum;
-          --lower.size;
-        } else {
-          upper.map.merge(outNum, -1, Integer::sum);
-          if (upper.map.get(outNum) == 0)
-            upper.map.remove(outNum);
-          upper.sum -= outNum;
-          --upper.size;
-        }
-      }
-      // Balance the two maps s.t.
-      // |lower| >= |upper| and |lower| - |upper| <= 1.
-      if (lower.size < upper.size) {
-        final int val = upper.map.firstKey();
-        upper.map.merge(val, -1, Integer::sum);
-        if (upper.map.get(val) == 0)
-          upper.map.remove(val);
-        lower.map.merge(val, 1, Integer::sum);
-        upper.sum -= val;
-        lower.sum += val;
-        --upper.size;
-        ++lower.size;
-      } else if (lower.size - upper.size > 1) {
-        final int val = lower.map.lastKey();
-        lower.map.merge(val, -1, Integer::sum);
-        if (lower.map.get(val) == 0)
-          lower.map.remove(val);
-        upper.map.merge(val, 1, Integer::sum);
-        lower.sum -= val;
-        upper.sum += val;
-        --lower.size;
-        ++upper.size;
-      }
-      // Calculate operations needed to make all elements in the window equal
-      // to the median.
-      if (i >= x - 1) {
-        final int median = lower.map.lastKey();
-        final long ops = (median * lower.size - lower.sum) + (upper.sum - median * upper.size);
-        minOps.add(ops);
-      }
-    }
-    return minOps;
-  }
-}
diff --git a/solutions/3506. Find Time Required to Eliminate Bacterial Strains/3506.cpp b/solutions/3506. Find Time Required to Eliminate Bacterial Strains/3506.cpp
deleted file mode 100644
index 38fe9fff621..00000000000
--- a/solutions/3506. Find Time Required to Eliminate Bacterial Strains/3506.cpp	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
- public:
-  long long minEliminationTime(vector<int>& timeReq, int splitTime) {
-    priority_queue<long, vector<long>, greater<>> minHeap{timeReq.begin(),
-                                                          timeReq.end()};
-    minHeap.pop();
-
-    while (true) {
-      const long bacterial = splitTime + minHeap.top();
-      minHeap.pop();
-      if (minHeap.empty())
-        return bacterial;
-      if (bacterial > minHeap.top()) {
-        minHeap.pop();
-        minHeap.push(bacterial);
-      }
-    }
-
-    throw;
-  }
-};
diff --git a/solutions/3506. Find Time Required to Eliminate Bacterial Strains/3506.java b/solutions/3506. Find Time Required to Eliminate Bacterial Strains/3506.java
deleted file mode 100644
index b9ece76217d..00000000000
--- a/solutions/3506. Find Time Required to Eliminate Bacterial Strains/3506.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public long minEliminationTime(int[] timeReq, int splitTime) {
-    PriorityQueue<Long> minHeap = new PriorityQueue<>();
-
-    for (final long time : timeReq)
-      minHeap.offer(time);
-
-    minHeap.poll();
-
-    while (true) {
-      final long bacterial = splitTime + minHeap.peek();
-      minHeap.poll();
-      if (minHeap.isEmpty())
-        return bacterial;
-      if (bacterial > minHeap.peek()) {
-        minHeap.poll();
-        minHeap.offer(bacterial);
-      }
-    }
-  }
-}
diff --git a/solutions/3506. Find Time Required to Eliminate Bacterial Strains/3506.py b/solutions/3506. Find Time Required to Eliminate Bacterial Strains/3506.py
deleted file mode 100644
index e30526dc275..00000000000
--- a/solutions/3506. Find Time Required to Eliminate Bacterial Strains/3506.py	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution:
-  def minEliminationTime(self, timeReq: list[int], splitTime: int) -> int:
-    minHeap = timeReq.copy()
-    heapq.heapify(minHeap)
-    heapq.heappop(minHeap)
-
-    while True:
-      bacterial = splitTime + heapq.heappop(minHeap)
-      if not minHeap:
-        return bacterial
-      heapq.heappushpop(minHeap, bacterial)
diff --git a/solutions/3507. Minimum Pair Removal to Sort Array I/3507.cpp b/solutions/3507. Minimum Pair Removal to Sort Array I/3507.cpp
deleted file mode 100644
index 4b1c85148ce..00000000000
--- a/solutions/3507. Minimum Pair Removal to Sort Array I/3507.cpp	
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <ranges>
-
-class Solution {
- public:
-  int minimumPairRemoval(vector<int>& nums) {
-    int ans = 0;
-
-    while (hasInversion(nums)) {
-      vector<int> pairSums;
-      for (const auto& [a, b] : views::pairwise(nums))
-        pairSums.push_back(a + b);
-      const int minPairSum = ranges::min(pairSums);
-      const int minPairIndex =
-          ranges::find(pairSums, minPairSum) - pairSums.begin();
-      nums[minPairIndex] = minPairSum;
-      nums.erase(nums.begin() + minPairIndex + 1);
-      ++ans;
-    }
-
-    return ans;
-  }
-
- private:
-  bool hasInversion(const vector<int>& nums) {
-    for (const auto& [a, b] : views::pairwise(nums))
-      if (a > b)
-        return true;
-    return false;
-  }
-};
diff --git a/solutions/3507. Minimum Pair Removal to Sort Array I/3507.java b/solutions/3507. Minimum Pair Removal to Sort Array I/3507.java
deleted file mode 100644
index e2695cdcb38..00000000000
--- a/solutions/3507. Minimum Pair Removal to Sort Array I/3507.java	
+++ /dev/null
@@ -1,31 +0,0 @@
-class Solution {
-  public int minimumPairRemoval(int[] nums) {
-    int ans = 0;
-    List<Integer> numsList = Arrays.stream(nums).boxed().collect(Collectors.toList());
-
-    while (hasInversion(numsList)) {
-      List<Integer> pairSums = new ArrayList<>();
-      for (int i = 0; i < numsList.size() - 1; ++i)
-        pairSums.add(numsList.get(i) + numsList.get(i + 1));
-      int minPairSum = Integer.MAX_VALUE;
-      int minPairIndex = -1;
-      for (int i = 0; i < pairSums.size(); ++i)
-        if (pairSums.get(i) < minPairSum) {
-          minPairSum = pairSums.get(i);
-          minPairIndex = i;
-        }
-      numsList.set(minPairIndex, minPairSum);
-      numsList.remove(minPairIndex + 1);
-      ++ans;
-    }
-
-    return ans;
-  }
-
-  private boolean hasInversion(List<Integer> nums) {
-    for (int i = 0; i < nums.size() - 1; ++i)
-      if (nums.get(i) > nums.get(i + 1))
-        return true;
-    return false;
-  }
-}
diff --git a/solutions/3507. Minimum Pair Removal to Sort Array I/3507.py b/solutions/3507. Minimum Pair Removal to Sort Array I/3507.py
deleted file mode 100644
index 3d25b21453f..00000000000
--- a/solutions/3507. Minimum Pair Removal to Sort Array I/3507.py	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution:
-  def minimumPairRemoval(self, nums: list[int]) -> int:
-    ans = 0
-
-    while any(x > y for x, y in itertools.pairwise(nums)):
-      pairSums = [x + y for x, y in itertools.pairwise(nums)]
-      minPairSum = min(pairSums)
-      minPairIndex = pairSums.index(minPairSum)
-      nums[minPairIndex] = minPairSum
-      nums.pop(minPairIndex + 1)
-      ans += 1
-
-    return ans
diff --git a/solutions/3508. Implement Router/3508.cpp b/solutions/3508. Implement Router/3508.cpp
deleted file mode 100644
index 1628cc26229..00000000000
--- a/solutions/3508. Implement Router/3508.cpp	
+++ /dev/null
@@ -1,58 +0,0 @@
-struct Packet {
-  int source;
-  int destination;
-  int timestamp;
-
-  bool operator<(const Packet& other) const {
-    return source < other.source ||
-           (source == other.source && destination < other.destination) ||
-           (source == other.source && destination == other.destination &&
-            timestamp < other.timestamp);
-  }
-};
-
-class Router {
- public:
-  Router(int memoryLimit) : memoryLimit(memoryLimit) {}
-
-  bool addPacket(int source, int destination, int timestamp) {
-    const Packet packet{source, destination, timestamp};
-    if (uniquePackets.find(packet) != uniquePackets.end())
-      return false;
-    if (packetQueue.size() == memoryLimit)
-      forwardPacket();
-    packetQueue.push(packet);
-    uniquePackets.insert(packet);
-    destinationTimestamps[destination].push_back(timestamp);
-    return true;
-  }
-
-  vector<int> forwardPacket() {
-    if (packetQueue.empty())
-      return {};
-    const Packet nextPacket = packetQueue.front();
-    packetQueue.pop();
-    uniquePackets.erase(nextPacket);
-    ++processedPacketIndex[nextPacket.destination];
-    return {nextPacket.source, nextPacket.destination, nextPacket.timestamp};
-  }
-
-  int getCount(int destination, int startTime, int endTime) {
-    if (destinationTimestamps.find(destination) == destinationTimestamps.end())
-      return 0;
-    const vector<int>& timestamps = destinationTimestamps[destination];
-    const int startIndex = processedPacketIndex[destination];
-    const auto lowerBound = lower_bound(timestamps.begin() + startIndex,
-                                        timestamps.end(), startTime);
-    const auto upperBound =
-        upper_bound(timestamps.begin() + startIndex, timestamps.end(), endTime);
-    return upperBound - lowerBound;
-  }
-
- private:
-  const int memoryLimit;
-  set<Packet> uniquePackets;
-  queue<Packet> packetQueue;
-  map<int, vector<int>> destinationTimestamps;
-  map<int, int> processedPacketIndex;
-};
diff --git a/solutions/3508. Implement Router/3508.java b/solutions/3508. Implement Router/3508.java
deleted file mode 100644
index 93a9d2ea134..00000000000
--- a/solutions/3508. Implement Router/3508.java	
+++ /dev/null
@@ -1,105 +0,0 @@
-class Packet implements Comparable<Packet> {
-  public int source;
-  public int destination;
-  public int timestamp;
-
-  public Packet(int source, int destination, int timestamp) {
-    this.source = source;
-    this.destination = destination;
-    this.timestamp = timestamp;
-  }
-
-  @Override
-  public int compareTo(Packet other) {
-    if (source != other.source)
-      return Integer.compare(source, other.source);
-    if (destination != other.destination)
-      return Integer.compare(destination, other.destination);
-    return Integer.compare(timestamp, other.timestamp);
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o)
-      return true;
-    if (o == null || getClass() != o.getClass())
-      return false;
-    Packet packet = (Packet) o;
-    return source == packet.source && destination == packet.destination &&
-        timestamp == packet.timestamp;
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash(source, destination, timestamp);
-  }
-}
-
-class Router {
-  public Router(int memoryLimit) {
-    this.memoryLimit = memoryLimit;
-  }
-
-  public boolean addPacket(int source, int destination, int timestamp) {
-    Packet packet = new Packet(source, destination, timestamp);
-    if (uniquePackets.contains(packet))
-      return false;
-    if (packetQueue.size() == memoryLimit)
-      forwardPacket();
-    packetQueue.add(packet);
-    uniquePackets.add(packet);
-    destinationTimestamps.computeIfAbsent(destination, k -> new ArrayList<>()).add(timestamp);
-    return true;
-  }
-
-  public List<Integer> forwardPacket() {
-    if (packetQueue.isEmpty())
-      return Collections.emptyList();
-    Packet nextPacket = packetQueue.poll();
-    uniquePackets.remove(nextPacket);
-    processedPacketIndex.merge(nextPacket.destination, 1, Integer::sum);
-    return Arrays.asList(nextPacket.source, nextPacket.destination, nextPacket.timestamp);
-  }
-
-  public int getCount(int destination, int startTime, int endTime) {
-    if (!destinationTimestamps.containsKey(destination))
-      return 0;
-    List<Integer> timestamps = destinationTimestamps.get(destination);
-    final int startIndex = processedPacketIndex.getOrDefault(destination, 0);
-    final int lowerBoundIndex = firstGreaterEqual(timestamps, startIndex, startTime);
-    final int upperBoundIndex = firstGreater(timestamps, lowerBoundIndex, endTime);
-    return upperBoundIndex - lowerBoundIndex;
-  }
-
-  private final int memoryLimit;
-  private final TreeSet<Packet> uniquePackets = new TreeSet<>();
-  private final Queue<Packet> packetQueue = new LinkedList<>();
-  private final Map<Integer, List<Integer>> destinationTimestamps = new HashMap<>();
-  private final Map<Integer, Integer> processedPacketIndex = new HashMap<>();
-
-  private int firstGreaterEqual(List<Integer> timestamps, int startIndex, int startTime) {
-    int l = startIndex;
-    int r = timestamps.size();
-    while (l < r) {
-      final int m = (l + r) / 2;
-      if (timestamps.get(m) >= startTime)
-        r = m;
-      else
-        l = m + 1;
-    }
-    return l;
-  }
-
-  private int firstGreater(List<Integer> timestamps, int startIndex, int endTime) {
-    int l = startIndex;
-    int r = timestamps.size();
-    while (l < r) {
-      final int m = (l + r) / 2;
-      if (timestamps.get(m) > endTime)
-        r = m;
-      else
-        l = m + 1;
-    }
-    return l;
-  }
-}
diff --git a/solutions/3508. Implement Router/3508.py b/solutions/3508. Implement Router/3508.py
deleted file mode 100644
index f68ecae589d..00000000000
--- a/solutions/3508. Implement Router/3508.py	
+++ /dev/null
@@ -1,47 +0,0 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
-class Packet:
-  source: int
-  destination: int
-  timestamp: int
-
-
-class Router:
-  def __init__(self, memoryLimit: int):
-    self.memoryLimit = memoryLimit
-    self.uniquePackets: set[Packet] = set()
-    self.packetQueue: collections.deque[Packet] = collections.deque()
-    self.destinationTimestamps = collections.defaultdict(list)
-    self.processedPacketIndex = collections.Counter()
-
-  def addPacket(self, source: int, destination: int, timestamp: int) -> bool:
-    packet = Packet(source, destination, timestamp)
-    if packet in self.uniquePackets:
-      return False
-    if len(self.packetQueue) == self.memoryLimit:
-      self.forwardPacket()
-    self.packetQueue.append(packet)
-    self.uniquePackets.add(packet)
-    if destination not in self.destinationTimestamps:
-      self.destinationTimestamps[destination] = []
-    self.destinationTimestamps[destination].append(timestamp)
-    return True
-
-  def forwardPacket(self) -> list[int]:
-    if not self.packetQueue:
-      return []
-    nextPacket = self.packetQueue.popleft()
-    self.uniquePackets.remove(nextPacket)
-    self.processedPacketIndex[nextPacket.destination] += 1
-    return [nextPacket.source, nextPacket.destination, nextPacket.timestamp]
-
-  def getCount(self, destination: int, startTime: int, endTime: int) -> int:
-    if destination not in self.destinationTimestamps:
-      return 0
-    timestamps = self.destinationTimestamps[destination]
-    startIndex = self.processedPacketIndex.get(destination, 0)
-    lowerBound = bisect.bisect_left(timestamps, startTime, startIndex)
-    upperBound = bisect.bisect_right(timestamps, endTime, startIndex)
-    return upperBound - lowerBound
diff --git a/solutions/3509. Maximum Product of Subsequences With an Alternating Sum Equal to K/3509.cpp b/solutions/3509. Maximum Product of Subsequences With an Alternating Sum Equal to K/3509.cpp
deleted file mode 100644
index 374e209c640..00000000000
--- a/solutions/3509. Maximum Product of Subsequences With an Alternating Sum Equal to K/3509.cpp	
+++ /dev/null
@@ -1,42 +0,0 @@
-enum class State {
-  kFirst,     // first element - add to sum and start product
-  kSubtract,  // second element - subtract from sum and multiply product
-  kAdd        // third element - add to sum and multiply product
-};
-
-class Solution {
- public:
-  int maxProduct(vector<int>& nums, int k, int limit) {
-    if (abs(k) > accumulate(nums.begin(), nums.end(), 0))
-      return -1;
-    unordered_map<string, int> mem;
-    const int ans = maxProduct(nums, 0, 1, State::kFirst, k, limit, mem);
-    return ans == kMin ? -1 : ans;
-  }
-
- private:
-  static constexpr int kMin = -5000;
-
-  int maxProduct(const vector<int>& nums, int i, int product, State state,
-                 int k, int limit, unordered_map<string, int>& mem) {
-    if (i == nums.size())
-      return k == 0 && state != State::kFirst && product <= limit ? product
-                                                                  : kMin;
-    const string key = to_string(i) + "," + to_string(k) + "," +
-                       to_string(product) + "," +
-                       to_string(static_cast<int>(state));
-    if (mem.contains(key))
-      return mem[key];
-    int res = maxProduct(nums, i + 1, product, state, k, limit, mem);
-    if (state == State::kFirst)
-      res = max(res, maxProduct(nums, i + 1, nums[i], State::kSubtract,
-                                k - nums[i], limit, mem));
-    if (state == State::kSubtract)
-      res = max(res, maxProduct(nums, i + 1, min(product * nums[i], limit + 1),
-                                State::kAdd, k + nums[i], limit, mem));
-    if (state == State::kAdd)
-      res = max(res, maxProduct(nums, i + 1, min(product * nums[i], limit + 1),
-                                State::kSubtract, k - nums[i], limit, mem));
-    return mem[key] = res;
-  }
-};
diff --git a/solutions/3509. Maximum Product of Subsequences With an Alternating Sum Equal to K/3509.java b/solutions/3509. Maximum Product of Subsequences With an Alternating Sum Equal to K/3509.java
deleted file mode 100644
index 0536c65f7ec..00000000000
--- a/solutions/3509. Maximum Product of Subsequences With an Alternating Sum Equal to K/3509.java	
+++ /dev/null
@@ -1,38 +0,0 @@
-enum State {
-  FIRST,    // first element - add to sum and start product
-  SUBTRACT, // second element - subtract from sum and multiply product
-  ADD       // third element - add to sum and multiply product
-}
-
-class Solution {
-  public int maxProduct(int[] nums, int k, int limit) {
-    if (Math.abs(k) > Arrays.stream(nums).sum())
-      return -1;
-    final Map<String, Integer> mem = new HashMap<>();
-    final int ans = maxProduct(nums, 0, 1, State.FIRST, k, limit, mem);
-    return ans == MIN ? -1 : ans;
-  }
-
-  private static final int MIN = -5000;
-
-  private int maxProduct(int[] nums, int i, int product, State state, int k, int limit,
-                         Map<String, Integer> mem) {
-    if (i == nums.length)
-      return k == 0 && state != State.FIRST && product <= limit ? product : MIN;
-    final String key = i + "," + k + "," + product + "," + state.ordinal();
-    if (mem.containsKey(key))
-      return mem.get(key);
-    int res = maxProduct(nums, i + 1, product, state, k, limit, mem);
-    if (state == State.FIRST)
-      res =
-          Math.max(res, maxProduct(nums, i + 1, nums[i], State.SUBTRACT, k - nums[i], limit, mem));
-    if (state == State.SUBTRACT)
-      res = Math.max(res, maxProduct(nums, i + 1, Math.min(product * nums[i], limit + 1), State.ADD,
-                                     k + nums[i], limit, mem));
-    if (state == State.ADD)
-      res = Math.max(res, maxProduct(nums, i + 1, Math.min(product * nums[i], limit + 1),
-                                     State.SUBTRACT, k - nums[i], limit, mem));
-    mem.put(key, res);
-    return res;
-  }
-}
diff --git a/solutions/3509. Maximum Product of Subsequences With an Alternating Sum Equal to K/3509.py b/solutions/3509. Maximum Product of Subsequences With an Alternating Sum Equal to K/3509.py
deleted file mode 100644
index 043ad6eb2e0..00000000000
--- a/solutions/3509. Maximum Product of Subsequences With an Alternating Sum Equal to K/3509.py	
+++ /dev/null
@@ -1,33 +0,0 @@
-from enum import Enum
-
-
-class State(Enum):
-  FIRST = 0  # first element - add to sum and start product
-  SUBTRACT = 1  # second element - subtract from sum and multiply product
-  ADD = 2  # third element - add to sum and multiply product
-
-
-class Solution:
-  def maxProduct(self, nums: list[int], k: int, limit: int) -> int:
-    MIN = -5000
-    if abs(k) > sum(nums):
-      return -1
-
-    @functools.lru_cache(None)
-    def dp(i: int, product: int, state: State, k: int) -> int:
-      if i == len(nums):
-        return (product if k == 0 and state != State.FIRST and product <= limit
-                else MIN)
-      res = dp(i + 1, product, state, k)
-      if state == State.FIRST:
-        res = max(res, dp(i + 1, nums[i], State.SUBTRACT, k - nums[i]))
-      if state == State.SUBTRACT:
-        res = max(res, dp(i + 1, min(product * nums[i], limit + 1),
-                          State.ADD, k + nums[i]))
-      if state == State.ADD:
-        res = max(res, dp(i + 1, min(product * nums[i], limit + 1),
-                          State.SUBTRACT, k - nums[i]))
-      return res
-
-    ans = dp(0, 1, State.FIRST, k)
-    return -1 if ans == MIN else ans
diff --git a/solutions/3510. Minimum Pair Removal to Sort Array II/3510.cpp b/solutions/3510. Minimum Pair Removal to Sort Array II/3510.cpp
deleted file mode 100644
index 39635080a29..00000000000
--- a/solutions/3510. Minimum Pair Removal to Sort Array II/3510.cpp	
+++ /dev/null
@@ -1,72 +0,0 @@
-class Solution {
- public:
-  int minimumPairRemoval(vector<int>& nums) {
-    const int n = nums.size();
-    int ans = 0;
-    int inversionsCount = 0;
-    vector<int> nextIndices(n);
-    vector<int> prevIndices(n);
-    vector<long> values(nums.begin(), nums.end());
-
-    // Custom comparator for the set
-    auto comp = [](const pair<long, int>& a, const pair<long, int>& b) {
-      return a.first < b.first || (a.first == b.first && a.second < b.second);
-    };
-    set<pair<long, int>, decltype(comp)> pairSums(comp);
-
-    for (int i = 0; i < n; ++i) {
-      nextIndices[i] = i + 1;
-      prevIndices[i] = i - 1;
-    }
-
-    for (int i = 0; i < n - 1; ++i)
-      pairSums.insert({(long)nums[i] + nums[i + 1], i});
-
-    for (int i = 0; i < n - 1; ++i)
-      if (nums[i + 1] < nums[i])
-        ++inversionsCount;
-
-    while (inversionsCount > 0) {
-      ++ans;
-      auto smallestPair = *pairSums.begin();
-      pairSums.erase(pairSums.begin());
-
-      const long pairSum = smallestPair.first;
-      const int currIndex = smallestPair.second;
-      const int nextIndex = nextIndices[currIndex];
-      const int prevIndex = prevIndices[currIndex];
-
-      if (prevIndex >= 0) {
-        const long oldPairSum = values[prevIndex] + values[currIndex];
-        const long newPairSum = values[prevIndex] + pairSum;
-        pairSums.erase({oldPairSum, prevIndex});
-        pairSums.insert({newPairSum, prevIndex});
-        if (values[prevIndex] > values[currIndex])
-          --inversionsCount;
-        if (values[prevIndex] > pairSum)
-          ++inversionsCount;
-      }
-
-      if (values[nextIndex] < values[currIndex])
-        --inversionsCount;
-
-      const int nextNextIndex = (nextIndex < n) ? nextIndices[nextIndex] : n;
-      if (nextNextIndex < n) {
-        const long oldPairSum = values[nextIndex] + values[nextNextIndex];
-        const long newPairSum = pairSum + values[nextNextIndex];
-        pairSums.erase({oldPairSum, nextIndex});
-        pairSums.insert({newPairSum, currIndex});
-        if (values[nextNextIndex] < values[nextIndex])
-          --inversionsCount;
-        if (values[nextNextIndex] < pairSum)
-          ++inversionsCount;
-        prevIndices[nextNextIndex] = currIndex;
-      }
-
-      nextIndices[currIndex] = nextNextIndex;
-      values[currIndex] = pairSum;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3510. Minimum Pair Removal to Sort Array II/3510.java b/solutions/3510. Minimum Pair Removal to Sort Array II/3510.java
deleted file mode 100644
index a995c905486..00000000000
--- a/solutions/3510. Minimum Pair Removal to Sort Array II/3510.java	
+++ /dev/null
@@ -1,65 +0,0 @@
-class Solution {
-  public int minimumPairRemoval(int[] nums) {
-    final int n = nums.length;
-    int ans = 0;
-    int inversionsCount = 0;
-    int[] nextIndices = new int[n];
-    int[] prevIndices = new int[n];
-    long[] values = Arrays.stream(nums).asLongStream().toArray();
-    TreeSet<Pair<Long, Integer>> pairSums =
-        new TreeSet<>(Comparator.comparingLong(Pair<Long, Integer>::getKey)
-                          .thenComparingInt(Pair<Long, Integer>::getValue));
-
-    for (int i = 0; i < n; ++i) {
-      nextIndices[i] = i + 1;
-      prevIndices[i] = i - 1;
-    }
-
-    for (int i = 0; i < n - 1; ++i)
-      pairSums.add(new Pair<>((long) nums[i] + nums[i + 1], i));
-
-    for (int i = 0; i < n - 1; ++i)
-      if (nums[i + 1] < nums[i])
-        ++inversionsCount;
-
-    while (inversionsCount > 0) {
-      ++ans;
-      Pair<Long, Integer> smallestPair = pairSums.pollFirst();
-      final long pairSum = smallestPair.getKey();
-      final int currIndex = smallestPair.getValue();
-      final int nextIndex = nextIndices[currIndex];
-      final int prevIndex = prevIndices[currIndex];
-      if (prevIndex >= 0) {
-        final long oldPairSum = values[prevIndex] + values[currIndex];
-        final long newPairSum = values[prevIndex] + pairSum;
-        pairSums.remove(new Pair<>(oldPairSum, prevIndex));
-        pairSums.add(new Pair<>(newPairSum, prevIndex));
-        if (values[prevIndex] > values[currIndex])
-          --inversionsCount;
-        if (values[prevIndex] > pairSum)
-          ++inversionsCount;
-      }
-
-      if (values[nextIndex] < values[currIndex])
-        --inversionsCount;
-
-      final int nextNextIndex = (nextIndex < n) ? nextIndices[nextIndex] : n;
-      if (nextNextIndex < n) {
-        final long oldPairSum = values[nextIndex] + values[nextNextIndex];
-        final long newPairSum = pairSum + values[nextNextIndex];
-        pairSums.remove(new Pair<>(oldPairSum, nextIndex));
-        pairSums.add(new Pair<>(newPairSum, currIndex));
-        if (values[nextNextIndex] < values[nextIndex])
-          --inversionsCount;
-        if (values[nextNextIndex] < pairSum)
-          ++inversionsCount;
-        prevIndices[nextNextIndex] = currIndex;
-      }
-
-      nextIndices[currIndex] = nextNextIndex;
-      values[currIndex] = pairSum;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3510. Minimum Pair Removal to Sort Array II/3510.py b/solutions/3510. Minimum Pair Removal to Sort Array II/3510.py
deleted file mode 100644
index 6a496ac8a27..00000000000
--- a/solutions/3510. Minimum Pair Removal to Sort Array II/3510.py	
+++ /dev/null
@@ -1,49 +0,0 @@
-from sortedcontainers import SortedList
-
-
-class Solution:
-  def minimumPairRemoval(self, nums: list[int]) -> int:
-    n = len(nums)
-    ans = 0
-    inversionsCount = sum(nums[i + 1] < nums[i] for i in range(n - 1))
-    nextIndices = [i + 1 for i in range(n)]
-    prevIndices = [i - 1 for i in range(n)]
-    pairSums = SortedList((a + b, i)
-                          for i, (a, b) in enumerate(itertools.pairwise(nums)))
-
-    while inversionsCount > 0:
-      ans += 1
-      smallestPair = pairSums.pop(0)
-      pairSum, currIndex = smallestPair
-      nextIndex = nextIndices[currIndex]
-      prevIndex = prevIndices[currIndex]
-
-      if prevIndex >= 0:
-        oldPairSum = nums[prevIndex] + nums[currIndex]
-        newPairSum = nums[prevIndex] + pairSum
-        pairSums.remove((oldPairSum, prevIndex))
-        pairSums.add((newPairSum, prevIndex))
-        if nums[prevIndex] > nums[currIndex]:
-          inversionsCount -= 1
-        if nums[prevIndex] > pairSum:
-          inversionsCount += 1
-
-      if nums[nextIndex] < nums[currIndex]:
-        inversionsCount -= 1
-
-      nextNextIndex = nextIndices[nextIndex] if nextIndex < n else n
-      if nextNextIndex < n:
-        oldPairSum = nums[nextIndex] + nums[nextNextIndex]
-        newPairSum = pairSum + nums[nextNextIndex]
-        pairSums.remove((oldPairSum, nextIndex))
-        pairSums.add((newPairSum, currIndex))
-        if nums[nextNextIndex] < nums[nextIndex]:
-          inversionsCount -= 1
-        if nums[nextNextIndex] < pairSum:
-          inversionsCount += 1
-        prevIndices[nextNextIndex] = currIndex
-
-      nextIndices[currIndex] = nextNextIndex
-      nums[currIndex] = pairSum
-
-    return ans
diff --git a/solutions/3511. Make a Positive Array/3511.cpp b/solutions/3511. Make a Positive Array/3511.cpp
deleted file mode 100644
index 6a0d3e4f9a5..00000000000
--- a/solutions/3511. Make a Positive Array/3511.cpp	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
- public:
-  int makeArrayPositive(vector<int>& nums) {
-    constexpr long kMax = 1'000'000'000'000'000'000;
-    int ans = 0;
-    long minSum = nums[0] + nums[1];
-    vector<long> bigNums{nums.begin(), nums.end()};
-
-    for (int i = 2; i < bigNums.size(); ++i) {
-      const long a = bigNums[i - 2];
-      const long b = bigNums[i - 1];
-      const long c = bigNums[i];
-      minSum = min(minSum + c, a + b + c);
-      if (minSum <= 0) {
-        bigNums[i] = kMax;
-        minSum = kMax;
-        ++ans;
-      }
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3511. Make a Positive Array/3511.java b/solutions/3511. Make a Positive Array/3511.java
deleted file mode 100644
index 35252c1b72f..00000000000
--- a/solutions/3511. Make a Positive Array/3511.java	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
-  public int makeArrayPositive(int[] nums) {
-    final long kMax = 1_000_000_000_000_000_000L;
-    int ans = 0;
-    long minSum = nums[0] + nums[1];
-    long[] bigNums = Arrays.stream(nums).asLongStream().toArray();
-
-    for (int i = 2; i < bigNums.length; ++i) {
-      final long a = bigNums[i - 2];
-      final long b = bigNums[i - 1];
-      final long c = bigNums[i];
-      minSum = Math.min(minSum + c, a + b + c);
-      if (minSum <= 0) {
-        bigNums[i] = kMax;
-        minSum = kMax;
-        ++ans;
-      }
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3511. Make a Positive Array/3511.py b/solutions/3511. Make a Positive Array/3511.py
deleted file mode 100644
index 4b353aae51d..00000000000
--- a/solutions/3511. Make a Positive Array/3511.py	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution:
-  def makeArrayPositive(self, nums: list[int]) -> int:
-    MAX = 10**18
-    ans = 0
-    minSum = nums[0] + nums[1]
-
-    for i in range(2, len(nums)):
-      a, b, c = nums[i - 2], nums[i - 1], nums[i]
-      minSum = min(minSum + c, a + b + c)
-      if minSum <= 0:
-        nums[i] = MAX
-        minSum = MAX
-        ans += 1
-
-    return ans
diff --git a/solutions/3512. Minimum Operations to Make Array Sum Divisible by K/3512.cpp b/solutions/3512. Minimum Operations to Make Array Sum Divisible by K/3512.cpp
deleted file mode 100644
index b0bce84196a..00000000000
--- a/solutions/3512. Minimum Operations to Make Array Sum Divisible by K/3512.cpp	
+++ /dev/null
@@ -1,6 +0,0 @@
-class Solution {
- public:
-  int minOperations(vector<int>& nums, int k) {
-    return accumulate(nums.begin(), nums.end(), 0) % k;
-  }
-};
diff --git a/solutions/3512. Minimum Operations to Make Array Sum Divisible by K/3512.java b/solutions/3512. Minimum Operations to Make Array Sum Divisible by K/3512.java
deleted file mode 100644
index f0ff92e3e24..00000000000
--- a/solutions/3512. Minimum Operations to Make Array Sum Divisible by K/3512.java	
+++ /dev/null
@@ -1,5 +0,0 @@
-class Solution {
-  public int minOperations(int[] nums, int k) {
-    return Arrays.stream(nums).sum() % k;
-  }
-}
diff --git a/solutions/3512. Minimum Operations to Make Array Sum Divisible by K/3512.py b/solutions/3512. Minimum Operations to Make Array Sum Divisible by K/3512.py
deleted file mode 100644
index e9e6eb20585..00000000000
--- a/solutions/3512. Minimum Operations to Make Array Sum Divisible by K/3512.py	
+++ /dev/null
@@ -1,3 +0,0 @@
-class Solution:
-  def minOperations(self, nums: list[int], k: int) -> int:
-    return sum(nums) % k
diff --git a/solutions/3513. Number of Unique XOR Triplets I/3513.cpp b/solutions/3513. Number of Unique XOR Triplets I/3513.cpp
deleted file mode 100644
index e6c32e1f0f7..00000000000
--- a/solutions/3513. Number of Unique XOR Triplets I/3513.cpp	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution {
- public:
-  int uniqueXorTriplets(vector<int>& nums) {
-    const int n = nums.size();
-    if (n < 3)
-      return n;
-    return 1 << (static_cast<int>(log2(n)) + 1);
-  }
-};
diff --git a/solutions/3513. Number of Unique XOR Triplets I/3513.java b/solutions/3513. Number of Unique XOR Triplets I/3513.java
deleted file mode 100644
index 54d74a7edf1..00000000000
--- a/solutions/3513. Number of Unique XOR Triplets I/3513.java	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution {
-  public int uniqueXorTriplets(int[] nums) {
-    final int n = nums.length;
-    if (n < 3)
-      return n;
-    final int x = (int) (Math.log(n) / Math.log(2));
-    return 1 << (x + 1);
-  }
-}
diff --git a/solutions/3513. Number of Unique XOR Triplets I/3513.py b/solutions/3513. Number of Unique XOR Triplets I/3513.py
deleted file mode 100644
index d72edbd25ff..00000000000
--- a/solutions/3513. Number of Unique XOR Triplets I/3513.py	
+++ /dev/null
@@ -1,6 +0,0 @@
-class Solution:
-  def uniqueXorTriplets(self, nums: list[int]) -> int:
-    n = len(nums)
-    if n < 3:
-      return n
-    return 1 << (int(math.log2(n)) + 1)
diff --git a/solutions/3514. Number of Unique XOR Triplets II/3514.java b/solutions/3514. Number of Unique XOR Triplets II/3514.java
deleted file mode 100644
index 73e7b2fe5db..00000000000
--- a/solutions/3514. Number of Unique XOR Triplets II/3514.java	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
-  public int uniqueXorTriplets(int[] nums) {
-    final int n = nums.length;
-    if (n == 1)
-      return 1;
-
-    Set<Integer> pairs = new HashSet<>();
-    BitSet triplets = new BitSet();
-
-    for (int i = 0; i < n; ++i)
-      for (int j = i + 1; j < n; ++j)
-        pairs.add(nums[i] ^ nums[j]);
-
-    for (final int pair : pairs)
-      for (final int num : nums)
-        triplets.set(pair ^ num);
-
-    return triplets.cardinality();
-  }
-}
diff --git a/solutions/3514. Number of Unique XOR Triplets II/3515.cpp b/solutions/3514. Number of Unique XOR Triplets II/3515.cpp
deleted file mode 100644
index ddb1466741d..00000000000
--- a/solutions/3514. Number of Unique XOR Triplets II/3515.cpp	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
- public:
-  int uniqueXorTriplets(vector<int>& nums) {
-    const int n = nums.size();
-    if (n == 1)
-      return 1;
-
-    unordered_set<int> pairs;
-    bitset<2048> triplets;
-
-    for (int i = 0; i < n; ++i)
-      for (int j = i + 1; j < n; ++j)
-        pairs.insert(nums[i] ^ nums[j]);
-
-    for (const int pair : pairs)
-      for (const int num : nums)
-        triplets.set(pair ^ num);
-
-    return triplets.count();
-  }
-};
diff --git a/solutions/3514. Number of Unique XOR Triplets II/3515.py b/solutions/3514. Number of Unique XOR Triplets II/3515.py
deleted file mode 100644
index 216156ddebc..00000000000
--- a/solutions/3514. Number of Unique XOR Triplets II/3515.py	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution:
-  def uniqueXorTriplets(self, nums: list[int]) -> int:
-    n = len(nums)
-    if n == 1:
-      return 1
-    pairs = set(nums[i] ^ nums[j]
-                for i, j in itertools.combinations(range(n), 2))
-    return len(set(pair ^ num
-                   for pair in pairs
-                   for num in nums))
diff --git a/solutions/3515. Shortest Path in a Weighted Tree/3515.cpp b/solutions/3515. Shortest Path in a Weighted Tree/3515.cpp
deleted file mode 100644
index 7584a83a209..00000000000
--- a/solutions/3515. Shortest Path in a Weighted Tree/3515.cpp	
+++ /dev/null
@@ -1,122 +0,0 @@
-class LazySegmentTree {
- public:
-  explicit LazySegmentTree(int n) : n(n), tree(4 * n), lazy(4 * n) {}
-
-  // Updates the range [l, r] by adding val.
-  void addRange(int l, int r, int val) {
-    addRange(0, 0, n - 1, l, r, val);
-  }
-
-  // Returns the value at index i.
-  int query(int i) {
-    return query(0, 0, n - 1, i);
-  }
-
- private:
-  const int n;       // the size of the input array
-  vector<int> tree;  // the segment tree
-  vector<int> lazy;  // the lazy propagation array
-
-  void push(int treeIndex, int lo, int hi) {
-    if (lazy[treeIndex] == 0)
-      return;
-    tree[treeIndex] += lazy[treeIndex];
-    if (lo != hi) {
-      lazy[2 * treeIndex + 1] += lazy[treeIndex];
-      lazy[2 * treeIndex + 2] += lazy[treeIndex];
-    }
-    lazy[treeIndex] = 0;
-  }
-
-  void addRange(int treeIndex, int lo, int hi, int l, int r, int val) {
-    push(treeIndex, lo, hi);
-    if (r < lo || l > hi)  // [lo, hi] lies completely outside [l, r].
-      return;
-    if (l <= lo && hi <= r) {  // [lo, hi] lies completely inside [l, r].
-      lazy[treeIndex] += val;
-      push(treeIndex, lo, hi);
-      return;
-    }
-    const int mid = (lo + hi) / 2;
-    addRange(2 * treeIndex + 1, lo, mid, l, r, val);
-    addRange(2 * treeIndex + 2, mid + 1, hi, l, r, val);
-  }
-
-  int query(int treeIndex, int lo, int hi, int i) {
-    push(treeIndex, lo, hi);
-    if (lo == hi)
-      return tree[treeIndex];
-    const int mid = (lo + hi) / 2;
-    if (i <= mid)
-      return query(2 * treeIndex + 1, lo, mid, i);
-    return query(2 * treeIndex + 2, mid + 1, hi, i);
-  }
-};
-
-class Solution {
- public:
-  vector<int> treeQueries(int n, vector<vector<int>>& edges,
-                          vector<vector<int>>& queries) {
-    LazySegmentTree tree(n);
-    vector<int> ans;
-    vector<vector<pair<int, int>>> graph(n + 1);
-    map<pair<int, int>, int> edgeWeights;
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      const int w = edge[2];
-      graph[u].emplace_back(v, w);
-      graph[v].emplace_back(u, w);
-      edgeWeights[{min(u, v), max(u, v)}] = w;
-    }
-
-    // DFS: Euler tour and parent/distance tracking
-    vector<int> inTime(n + 1);
-    vector<int> outTime(n + 1);
-    vector<int> dist(n + 1);
-    vector<int> parent(n + 1);
-    int time = 0;
-
-    dfs(graph, 1, /*prev=*/-1, time, inTime, outTime, dist, parent);
-
-    for (int i = 1; i <= n; ++i)
-      tree.addRange(inTime[i], inTime[i], dist[i]);
-
-    for (const vector<int>& query : queries) {
-      const int type = query[0];
-      if (type == 1) {
-        const int u = query[1];
-        const int v = query[2];
-        const int newWeight = query[3];
-        const auto key = pair<int, int>{min(u, v), max(u, v)};
-        const int oldWeight = edgeWeights[key];
-        const int delta = newWeight - oldWeight;
-        edgeWeights[key] = newWeight;
-        // Find child node (the one that's not the parent)
-        const int child = (parent[v] == u) ? v : u;
-        tree.addRange(inTime[child], outTime[child], delta);
-      } else {
-        const int x = query[1];
-        ans.push_back(tree.query(inTime[x]));
-      }
-    }
-
-    return ans;
-  }
-
- private:
-  void dfs(const vector<vector<pair<int, int>>>& graph, int u, int prev,
-           int& time, vector<int>& inTime, vector<int>& outTime,
-           vector<int>& dist, vector<int>& parent) {
-    inTime[u] = time++;
-    for (const auto& [v, w] : graph[u]) {
-      if (v == prev)
-        continue;
-      dist[v] = dist[u] + w;
-      parent[v] = u;
-      dfs(graph, v, u, time, inTime, outTime, dist, parent);
-    }
-    outTime[u] = time - 1;
-  }
-};
diff --git a/solutions/3516. Find Closest Person/3516.cpp b/solutions/3516. Find Closest Person/3516.cpp
deleted file mode 100644
index 37a0205c801..00000000000
--- a/solutions/3516. Find Closest Person/3516.cpp	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution {
- public:
-  int findClosest(int x, int y, int z) {
-    const int xz = abs(x - z);
-    const int yz = abs(y - z);
-    if (xz == yz)
-      return 0;
-    return xz < yz ? 1 : 2;
-  }
-};
diff --git a/solutions/3516. Find Closest Person/3516.java b/solutions/3516. Find Closest Person/3516.java
deleted file mode 100644
index 39a8c443bf0..00000000000
--- a/solutions/3516. Find Closest Person/3516.java	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution {
-  public int findClosest(int x, int y, int z) {
-    final int xz = Math.abs(x - z);
-    final int yz = Math.abs(y - z);
-    if (xz == yz)
-      return 0;
-    return xz < yz ? 1 : 2;
-  }
-}
diff --git a/solutions/3516. Find Closest Person/3516.py b/solutions/3516. Find Closest Person/3516.py
deleted file mode 100644
index 4b9e6899e74..00000000000
--- a/solutions/3516. Find Closest Person/3516.py	
+++ /dev/null
@@ -1,7 +0,0 @@
-class Solution:
-  def findClosest(self, x: int, y: int, z: int) -> int:
-    xz = abs(x - z)
-    yz = abs(y - z)
-    if xz == yz:
-      return 0
-    return 1 if xz < yz else 2
diff --git a/solutions/3517. Smallest Palindromic Rearrangement I/3517.cpp b/solutions/3517. Smallest Palindromic Rearrangement I/3517.cpp
deleted file mode 100644
index 989ec443a1a..00000000000
--- a/solutions/3517. Smallest Palindromic Rearrangement I/3517.cpp	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
- public:
-  string smallestPalindrome(string s) {
-    const int n = s.length();
-    const string sortedHalf = getSortedHalf(s);
-    return sortedHalf + (n % 2 ? string(1, s[n / 2]) : "") +
-           reversed(sortedHalf);
-  }
-
- private:
-  string getSortedHalf(const string& s) {
-    string half = s.substr(0, s.length() / 2);
-    ranges::sort(half);
-    return half;
-  }
-
-  string reversed(const string& s) {
-    return {s.rbegin(), s.rend()};
-  }
-};
diff --git a/solutions/3517. Smallest Palindromic Rearrangement I/3517.java b/solutions/3517. Smallest Palindromic Rearrangement I/3517.java
deleted file mode 100644
index c4e88d8c85c..00000000000
--- a/solutions/3517. Smallest Palindromic Rearrangement I/3517.java	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
-  public String smallestPalindrome(String s) {
-    final int n = s.length();
-    final String sortedHalf = getSortedHalf(s);
-    return sortedHalf + (n % 2 == 1 ? String.valueOf(s.charAt(n / 2)) : "") + reversed(sortedHalf);
-  }
-
-  private String getSortedHalf(final String s) {
-    final String half = s.substring(0, s.length() / 2);
-    char[] chars = half.toCharArray();
-    Arrays.sort(chars);
-    return new String(chars);
-  }
-
-  private String reversed(final String s) {
-    return new StringBuilder(s).reverse().toString();
-  }
-}
diff --git a/solutions/3517. Smallest Palindromic Rearrangement I/3517.py b/solutions/3517. Smallest Palindromic Rearrangement I/3517.py
deleted file mode 100644
index 9faeb1fe64b..00000000000
--- a/solutions/3517. Smallest Palindromic Rearrangement I/3517.py	
+++ /dev/null
@@ -1,7 +0,0 @@
-class Solution:
-  def smallestPalindrome(self, s: str) -> str:
-    n = len(s)
-    sortedHalf = sorted(s[:n // 2])
-    return ''.join(sortedHalf +
-                   ([s[n // 2]] if n % 2 else []) +
-                   sortedHalf[::-1])
diff --git a/solutions/3518. Smallest Palindromic Rearrangement II/3518.py b/solutions/3518. Smallest Palindromic Rearrangement II/3518.py
deleted file mode 100644
index 6ca2264f6e9..00000000000
--- a/solutions/3518. Smallest Palindromic Rearrangement II/3518.py	
+++ /dev/null
@@ -1,69 +0,0 @@
-class Solution:
-  def __init__(self):
-    self.MAX = 10**6 + 1
-
-  def smallestPalindrome(self, s: str, k: int) -> str:
-    count = collections.Counter(s)
-    if not self._isPalindromePossible(count):
-      return ''
-
-    halfCount, midLetter = self._getHalfCountAndMidLetter(count)
-    totalPerm = self._calculateTotalPermutations(halfCount)
-    if k > totalPerm:
-      return ''
-    leftHalf = self._generateLeftHalf(halfCount, k)
-    return ''.join(leftHalf) + midLetter + ''.join(reversed(leftHalf))
-
-  def _isPalindromePossible(self, count: collections.Counter) -> bool:
-    oddCount = sum(1 for count in count.values() if count % 2 == 1)
-    return oddCount <= 1
-
-  def _getHalfCountAndMidLetter(self, count: collections.Counter) -> tuple[list[int], str]:
-    halfCount = [0] * 26
-    midLetter = ''
-    for c, freq in count.items():
-      halfCount[ord(c) - ord('a')] = freq // 2
-      if freq % 2 == 1:
-        midLetter = c
-    return halfCount, midLetter
-
-  def _calculateTotalPermutations(self, halfCount: list[int]) -> int:
-    """Calculate the total number of possible permutations."""
-    return self._countArrangements(halfCount)
-
-  def _generateLeftHalf(self, halfCount: list[int], k: int) -> list[str]:
-    """Generate the left half of the palindrome based on k."""
-    halfLen = sum(halfCount)
-    left = []
-    for _ in range(halfLen):
-      for i, freq in enumerate(halfCount):
-        if freq == 0:
-          continue
-        halfCount[i] -= 1
-        arrangements = self._countArrangements(halfCount)
-        if arrangements >= k:
-          left.append(chr(i + ord('a')))
-          break
-        else:
-          k -= arrangements
-          halfCount[i] += 1
-    return left
-
-  def _countArrangements(self, count: list[int]) -> int:
-    """Calculate the number of possible arrangements of characters."""
-    total = sum(count)
-    res = 1
-    for freq in count:
-      res *= self._nCk(total, freq)
-      if res >= self.MAX:
-        return self.MAX
-      total -= freq
-    return res
-
-  def _nCk(self, n: int, k: int) -> int:
-    res = 1
-    for i in range(1, min(k, n - k) + 1):
-      res = res * (n - i + 1) // i
-      if res >= self.MAX:
-        return self.MAX
-    return res
diff --git a/solutions/3519. Count Numbers with Non-Decreasing Digits/3519.cpp b/solutions/3519. Count Numbers with Non-Decreasing Digits/3519.cpp
deleted file mode 100644
index 4572c883db3..00000000000
--- a/solutions/3519. Count Numbers with Non-Decreasing Digits/3519.cpp	
+++ /dev/null
@@ -1,96 +0,0 @@
-class Solution {
- public:
-  int countNumbers(const string& l, const string& r, const int b) {
-    const vector<int> rDigits = convertToBaseB(r, b);
-    vector<int> lDigits = convertToBaseB(l, b);
-    vector<int> lMinus1Digits = convertToBaseB(decrement(l), b);
-    padToSameLength(lDigits, rDigits);
-    padToSameLength(lMinus1Digits, rDigits);
-    return (countWithMem(rDigits, b) - countWithMem(lMinus1Digits, b) + kMod) %
-           kMod;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-  void padToSameLength(vector<int>& a, const vector<int>& b) {
-    a.insert(a.begin(), b.size() - a.size(), 0);
-  }
-
-  int countWithMem(const vector<int>& digits, const int b) {
-    vector<vector<vector<int>>> mem(digits.size(),
-                                    vector<vector<int>>(2, vector<int>(b, -1)));
-    return count(digits, 0, 0, true, b, mem);
-  }
-
-  int count(const vector<int>& num, int pos, int lastDigit, bool tight, int b,
-            vector<vector<vector<int>>>& mem) {
-    if (pos == num.size())
-      return 1;
-
-    if (mem[pos][tight][lastDigit] != -1)
-      return mem[pos][tight][lastDigit];
-
-    int res = 0;
-    const int limit = tight ? num[pos] : b - 1;
-
-    for (int d = lastDigit; d <= limit; d++) {
-      const bool newTight = tight && (d == limit);
-      res = (res + count(num, pos + 1, d, newTight, b, mem)) % kMod;
-    }
-
-    return mem[pos][tight][lastDigit] = res;
-  }
-
-  string decrement(string s) {
-    for (int i = s.length() - 1; i >= 0; --i) {
-      if (s[i] > '0') {
-        --s[i];
-        break;
-      } else {
-        s[i] = '9';
-      }
-    }
-    return s[0] == '0' && s.length() > 1 ? s.substr(1) : s;
-  }
-
-  vector<int> convertToBaseB(const string& numStr, const int b) {
-    vector<int> digits;
-    vector<int> currentNum(1, 0);
-
-    for (const char c : numStr) {
-      const int d = c - '0';
-
-      int carry = 0;
-      for (int i = 0; i < currentNum.size(); ++i) {
-        const long long product = (long long)currentNum[i] * 10 + carry;
-        currentNum[i] = product % b;
-        carry = product / b;
-      }
-
-      while (carry > 0) {
-        currentNum.push_back(carry % b);
-        carry /= b;
-      }
-
-      carry = d;
-      for (int i = 0; i < currentNum.size() && carry; ++i) {
-        const int sum = currentNum[i] + carry;
-        currentNum[i] = sum % b;
-        carry = sum / b;
-      }
-
-      while (carry > 0) {
-        currentNum.push_back(carry % b);
-        carry /= b;
-      }
-    }
-
-    for (int i = currentNum.size() - 1; i >= 0; --i)
-      digits.push_back(currentNum[i]);
-
-    if (digits.empty())
-      digits.push_back(0);
-
-    return digits;
-  }
-};
diff --git a/solutions/352. Data Stream as Disjoint Intervals/352.py b/solutions/352. Data Stream as Disjoint Intervals/352.py
index 2ebbac0d7a9..3b93ee63478 100644
--- a/solutions/352. Data Stream as Disjoint Intervals/352.py	
+++ b/solutions/352. Data Stream as Disjoint Intervals/352.py	
@@ -27,7 +27,7 @@ def addNum(self, val: int) -> None:
     else:
       self.intervals[val] = [val, val]
 
-  def getIntervals(self) -> list[list[int]]:
+  def getIntervals(self) -> List[List[int]]:
     return list(self.intervals.values())
 
   def _lowerKey(self, key: int):
diff --git a/solutions/3520. Minimum Threshold for Inversion Pairs Count/3520.cpp b/solutions/3520. Minimum Threshold for Inversion Pairs Count/3520.cpp
deleted file mode 100644
index b36f0de86d7..00000000000
--- a/solutions/3520. Minimum Threshold for Inversion Pairs Count/3520.cpp	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution {
- public:
-  int minThreshold(vector<int>& nums, int k) {
-    const int mx = ranges::max(nums);
-    int l = 0;
-    int r = mx + 1;
-
-    while (l < r) {
-      const int m = (l + r) / 2;
-      if (countInversionPairs(nums, k, m))
-        r = m;
-      else
-        l = m + 1;
-    }
-
-    return l > mx ? -1 : l;
-  }
-
- private:
-  bool countInversionPairs(const vector<int>& nums, int k, int threshold) {
-    int inversionCount = 0;
-    vector<int> sortedNums;
-
-    for (const int num : nums) {
-      const auto lower = ranges::upper_bound(sortedNums, num);
-      const auto upper = ranges::upper_bound(sortedNums, num + threshold);
-      inversionCount += upper - lower;
-      sortedNums.insert(lower, num);
-    }
-
-    return inversionCount >= k;
-  }
-};
diff --git a/solutions/3520. Minimum Threshold for Inversion Pairs Count/3520.java b/solutions/3520. Minimum Threshold for Inversion Pairs Count/3520.java
deleted file mode 100644
index f9d0af89281..00000000000
--- a/solutions/3520. Minimum Threshold for Inversion Pairs Count/3520.java	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Solution {
-  public int minThreshold(int[] nums, int k) {
-    final int mx = Arrays.stream(nums).max().getAsInt();
-    int l = 0;
-    int r = mx + 1;
-
-    while (l < r) {
-      final int m = (l + r) / 2;
-      if (countInversionPairs(nums, k, m))
-        r = m;
-      else
-        l = m + 1;
-    }
-
-    return l > mx ? -1 : l;
-  }
-
-  private boolean countInversionPairs(final int[] nums, final int k, final int threshold) {
-    int inversionCount = 0;
-    List<Integer> sortedNums = new ArrayList<>();
-
-    for (final int num : nums) {
-      final int lower = firstGreater(sortedNums, num);
-      final int upper = firstGreater(sortedNums, num + threshold);
-      inversionCount += upper - lower;
-      sortedNums.add(lower, num);
-    }
-
-    return inversionCount >= k;
-  }
-
-  private int firstGreater(List<Integer> arr, int target) {
-    int l = 0;
-    int r = arr.size();
-    while (l < r) {
-      final int m = (l + r) / 2;
-      if (arr.get(m) > target)
-        r = m;
-      else
-        l = m + 1;
-    }
-    return l;
-  }
-}
diff --git a/solutions/3521. Find Product Recommendation Pairs/3521.sql b/solutions/3521. Find Product Recommendation Pairs/3521.sql
deleted file mode 100644
index bd1fb61b4f7..00000000000
--- a/solutions/3521. Find Product Recommendation Pairs/3521.sql	
+++ /dev/null
@@ -1,17 +0,0 @@
-SELECT
-  P1.product_id AS product1_id,
-  P2.product_id AS product2_id,
-  PI1.category AS product1_category,
-  PI2.category AS product2_category,
-  COUNT(P1.user_id) AS customer_count
-FROM ProductPurchases AS P1
-INNER JOIN ProductPurchases AS P2
-  USING (user_id)
-LEFT JOIN ProductInfo AS PI1
-  ON (P1.product_id = PI1.product_id)
-LEFT JOIN ProductInfo AS PI2
-  ON (P2.product_id = PI2.product_id)
-WHERE P1.product_id < P2.product_id
-GROUP BY 1, 2, 3, 4
-HAVING COUNT(P1.user_id) >= 3
-ORDER BY customer_count DESC, product1_id, product2_id;
diff --git a/solutions/3522. Calculate Score After Performing Instructions/3522.cpp b/solutions/3522. Calculate Score After Performing Instructions/3522.cpp
deleted file mode 100644
index 2ec4b40a5ad..00000000000
--- a/solutions/3522. Calculate Score After Performing Instructions/3522.cpp	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
- public:
-  long long calculateScore(vector<string>& instructions, vector<int>& values) {
-    const int n = instructions.size();
-    long ans = 0;
-    int i = 0;
-    vector<bool> seen(n);
-
-    while (i >= 0 && i < n && !seen[i]) {
-      seen[i] = true;
-      if (instructions[i] == "add") {
-        ans += values[i];
-        ++i;
-      } else if (instructions[i] == "jump") {
-        i += values[i];
-      }
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3522. Calculate Score After Performing Instructions/3522.java b/solutions/3522. Calculate Score After Performing Instructions/3522.java
deleted file mode 100644
index 04987d674a3..00000000000
--- a/solutions/3522. Calculate Score After Performing Instructions/3522.java	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
-  public long calculateScore(String[] instructions, int[] values) {
-    final int n = instructions.length;
-    long ans = 0;
-    int i = 0;
-    boolean[] seen = new boolean[n];
-
-    while (i >= 0 && i < n && !seen[i]) {
-      seen[i] = true;
-      if (instructions[i].equals("add")) {
-        ans += values[i];
-        ++i;
-      } else if (instructions[i].equals("jump")) {
-        i += values[i];
-      }
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3522. Calculate Score After Performing Instructions/3522.py b/solutions/3522. Calculate Score After Performing Instructions/3522.py
deleted file mode 100644
index 7aeae04c98c..00000000000
--- a/solutions/3522. Calculate Score After Performing Instructions/3522.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  def calculateScore(self, instructions: list[str], values: list[int]) -> int:
-    n = len(instructions)
-    ans = 0
-    i = 0
-    seen = set()
-
-    while 0 <= i < n and i not in seen:
-      seen.add(i)
-      if instructions[i] == 'add':
-        ans += values[i]
-        i += 1
-      elif instructions[i] == 'jump':
-        i += values[i]
-
-    return ans
diff --git a/solutions/3523. Make Array Non-decreasing/3523.cpp b/solutions/3523. Make Array Non-decreasing/3523.cpp
deleted file mode 100644
index de608d08425..00000000000
--- a/solutions/3523. Make Array Non-decreasing/3523.cpp	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution {
- public:
-  int maximumPossibleSize(vector<int>& nums) {
-    int ans = 0;
-    int prev = 0;
-
-    for (const int num : nums)
-      if (num >= prev) {
-        prev = num;
-        ++ans;
-      }
-
-    return ans;
-  }
-};
diff --git a/solutions/3523. Make Array Non-decreasing/3523.java b/solutions/3523. Make Array Non-decreasing/3523.java
deleted file mode 100644
index 4aa4497afaf..00000000000
--- a/solutions/3523. Make Array Non-decreasing/3523.java	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
-  public int maximumPossibleSize(int[] nums) {
-    int ans = 0;
-    int prev = 0;
-
-    for (final int num : nums)
-      if (num >= prev) {
-        prev = num;
-        ++ans;
-      }
-
-    return ans;
-  }
-}
diff --git a/solutions/3523. Make Array Non-decreasing/3523.py b/solutions/3523. Make Array Non-decreasing/3523.py
deleted file mode 100644
index 26dd7e687b1..00000000000
--- a/solutions/3523. Make Array Non-decreasing/3523.py	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution:
-  def maximumPossibleSize(self, nums: list[int]) -> int:
-    ans = 0
-    prev = 0
-
-    for num in nums:
-      if num >= prev:
-        prev = num
-        ans += 1
-
-    return ans
diff --git a/solutions/3524. Find X Value of Array I/3524.cpp b/solutions/3524. Find X Value of Array I/3524.cpp
deleted file mode 100644
index 19e68798e16..00000000000
--- a/solutions/3524. Find X Value of Array I/3524.cpp	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution {
- public:
-  vector<long long> resultArray(vector<int>& nums, int k) {
-    vector<long long> ans(k);
-    // dp[r] := the number of subarrays ending at current position with
-    // product % k == r
-    vector<long long> dp(k);
-
-    for (const int num : nums) {
-      vector<long long> newDp(k);
-      const int numMod = num % k;
-      // Start new subarray with only `num`.
-      newDp[numMod] = 1;
-      // Extend all previous subarrays.
-      for (int i = 0; i < k; ++i) {
-        const int newMod = (static_cast<long>(i) * numMod) % k;
-        newDp[newMod] += dp[i];
-      }
-      // Accumulate counts into ans.
-      for (int i = 0; i < k; ++i)
-        ans[i] += newDp[i];
-      dp = std::move(newDp);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3524. Find X Value of Array I/3524.java b/solutions/3524. Find X Value of Array I/3524.java
deleted file mode 100644
index d6b6cfa0c26..00000000000
--- a/solutions/3524. Find X Value of Array I/3524.java	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution {
-  public long[] resultArray(int[] nums, int k) {
-    long[] ans = new long[k];
-    // dp[r] := the number of subarrays ending at current position with
-    // product % k == r
-    long[] dp = new long[k];
-
-    for (final int num : nums) {
-      long[] newDp = new long[k];
-      final int numMod = num % k;
-      // Start new subarray with only `num`.
-      newDp[numMod] = 1;
-      // Extend all previous subarrays.
-      for (int i = 0; i < k; ++i) {
-        final int newMod = (int) (1L * i * numMod % k);
-        newDp[newMod] += dp[i];
-      }
-      // Accumulate counts into ans.
-      for (int i = 0; i < k; ++i)
-        ans[i] += newDp[i];
-      dp = newDp;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3524. Find X Value of Array I/3524.py b/solutions/3524. Find X Value of Array I/3524.py
deleted file mode 100644
index 6be5a163b41..00000000000
--- a/solutions/3524. Find X Value of Array I/3524.py	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution:
-  def resultArray(self, nums: list[int], k: int) -> list[int]:
-    ans = [0] * k
-    # dp[r] := the number of subarrays ending at current position with
-    # product % k == r
-    dp = [0] * k
-
-    for num in nums:
-      newDp = [0] * k
-      numMod = num % k
-      # Start new subarray with only `num`
-      newDp[numMod] = 1
-      # Extend all previous subarrays
-      for i in range(k):
-        newMod = (i * numMod) % k
-        newDp[newMod] += dp[i]
-      # Accumulate counts into ans
-      for i in range(k):
-        ans[i] += newDp[i]
-      dp = newDp
-
-    return ans
diff --git a/solutions/3525. Find X Value of Array II/3525.cpp b/solutions/3525. Find X Value of Array II/3525.cpp
deleted file mode 100644
index 7f823f8806c..00000000000
--- a/solutions/3525. Find X Value of Array II/3525.cpp	
+++ /dev/null
@@ -1,102 +0,0 @@
-struct Node {
-  int remain[5] = {0};
-  int prod = 1;
-};
-
-class SegmentTree {
- public:
-  explicit SegmentTree(const vector<int>& nums, int k)
-      : n(nums.size()), k(k), tree(4 * n) {
-    build(nums, 0, 0, n - 1);
-  }
-
-  // Updates nums[i] to val.
-  void update(int i, int val) {
-    update(0, 0, n - 1, i, val);
-  }
-
-  // Returns the result of the range query from nums[i..j].
-  Node query(int i, int j) const {
-    return query(0, 0, n - 1, i, j);
-  }
-
- private:
-  const int n;        // the size of the input array
-  const int k;        // the modulo value
-  vector<Node> tree;  // the segment tree
-
-  void build(const vector<int>& nums, int cur, int left, int right) {
-    if (left == right) {
-      tree[cur].remain[nums[left]] = 1;
-      tree[cur].prod = nums[left];
-      return;
-    }
-    const int mid = (left + right) / 2;
-    build(nums, 2 * cur + 1, left, mid);
-    build(nums, 2 * cur + 2, mid + 1, right);
-    tree[cur] = merge(tree[2 * cur + 1], tree[2 * cur + 2]);
-  }
-
-  void update(int treeIndex, int lo, int hi, int i, int val) {
-    if (lo == hi) {
-      for (int j = 0; j < k; ++j)
-        tree[treeIndex].remain[j] = 0;
-      tree[treeIndex].remain[val] = 1;
-      tree[treeIndex].prod = val;
-      return;
-    }
-    const int mid = (lo + hi) / 2;
-    if (i <= mid)
-      update(2 * treeIndex + 1, lo, mid, i, val);
-    else
-      update(2 * treeIndex + 2, mid + 1, hi, i, val);
-    tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
-  }
-
-  Node query(int treeIndex, int lo, int hi, int i, int j) const {
-    if (i <= lo && hi <= j)  // [lo, hi] lies completely inside [i, j].
-      return tree[treeIndex];
-    if (j < lo || hi < i)  // [lo, hi] lies completely outside [i, j].
-      return Node();
-    const int mid = (lo + hi) / 2;
-    return merge(query(2 * treeIndex + 1, lo, mid, i, j),
-                 query(2 * treeIndex + 2, mid + 1, hi, i, j));
-  }
-
-  Node merge(const Node& left, const Node& right) const {
-    Node node;
-    node.prod = (left.prod * right.prod) % k;
-    for (int i = 0; i < k; ++i)
-      node.remain[i] = left.remain[i];
-    for (int i = 0; i < k; ++i)
-      node.remain[(i * left.prod) % k] += right.remain[i];
-    return node;
-  }
-};
-
-class Solution {
- public:
-  vector<int> resultArray(vector<int>& nums, int k,
-                          vector<vector<int>>& queries) {
-    for (int& num : nums)
-      num %= k;
-
-    for (vector<int>& query : queries)
-      query[1] %= k;
-
-    const int n = nums.size();
-    vector<int> ans;
-    SegmentTree tree(nums, k);
-
-    for (const vector<int>& query : queries) {
-      const int index = query[0];
-      const int value = query[1];
-      const int start = query[2];
-      const int x = query[3];
-      tree.update(index, value);
-      ans.push_back(tree.query(start, n - 1).remain[x]);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3526. Range XOR Queries with Subarray Reversals/3526.cpp b/solutions/3526. Range XOR Queries with Subarray Reversals/3526.cpp
deleted file mode 100644
index ec061c58a1e..00000000000
--- a/solutions/3526. Range XOR Queries with Subarray Reversals/3526.cpp	
+++ /dev/null
@@ -1,135 +0,0 @@
-struct Node {
-  Node(int v) : val(v), subXor(v) {}
-  int val;
-  int subXor;
-  int sz = 1;
-  int rev = false;
-  int prior = rand();
-  Node* l = nullptr;
-  Node* r = nullptr;
-};
-
-class AVLTree {
- public:
-  AVLTree(const vector<int>& nums) : root(nullptr) {
-    build(nums);
-  }
-
-  void updateValue(int index, int val) {
-    Node* l = nullptr;
-    Node* r = nullptr;
-    Node* m = nullptr;
-    split(root, index, l, r);
-    split(r, 1, m, r);
-    if (m != nullptr)
-      m->val = val;
-    update(m);
-    root = merge(merge(l, m), r);
-  }
-
-  int rangeXor(int left, int right) {
-    Node* l = nullptr;
-    Node* m = nullptr;
-    Node* r = nullptr;
-    split(root, left, l, r);
-    split(r, right - left + 1, m, r);
-    const int res = getXor(m);
-    root = merge(merge(l, m), r);
-    return res;
-  }
-
-  void reverseRange(int left, int right) {
-    Node* l = nullptr;
-    Node* m = nullptr;
-    Node* r = nullptr;
-    split(root, left, l, r);
-    split(r, right - left + 1, m, r);
-    if (m != nullptr)
-      m->rev = !m->rev;
-    root = merge(merge(l, m), r);
-  }
-
- private:
-  Node* root;
-
-  void build(const vector<int>& nums) {
-    for (const int num : nums)
-      root = merge(root, new Node(num));
-  }
-
-  int getSize(Node* t) {
-    return t ? t->sz : 0;
-  }
-
-  int getXor(Node* t) {
-    return t ? t->subXor : 0;
-  }
-
-  void push(Node* t) {
-    if (t == nullptr || !t->rev)
-      return;
-    swap(t->l, t->r);
-    if (t->l != nullptr)
-      t->l->rev ^= 1;
-    if (t->r != nullptr)
-      t->r->rev ^= 1;
-    t->rev = false;
-  }
-
-  void update(Node* t) {
-    if (t == nullptr)
-      return;
-    t->sz = 1 + getSize(t->l) + getSize(t->r);
-    t->subXor = t->val ^ getXor(t->l) ^ getXor(t->r);
-  }
-
-  void split(Node* t, int k, Node*& l, Node*& r) {
-    if (t == nullptr)
-      return void(l = r = nullptr);
-    push(t);
-    if (getSize(t->l) >= k) {
-      split(t->l, k, l, t->l);
-      r = t;
-    } else {
-      split(t->r, k - getSize(t->l) - 1, t->r, r);
-      l = t;
-    }
-    update(t);
-  }
-
-  Node* merge(Node* l, Node* r) {
-    push(l);
-    push(r);
-    if (l == nullptr || r == nullptr)
-      return l == nullptr ? r : l;
-    if (l->prior > r->prior) {
-      l->r = merge(l->r, r);
-      update(l);
-      return l;
-    } else {
-      r->l = merge(l, r->l);
-      update(r);
-      return r;
-    }
-  }
-};
-
-class Solution {
- public:
-  vector<int> getResults(vector<int>& nums, vector<vector<int>>& queries) {
-    AVLTree tree(nums);
-    vector<int> ans;
-
-    for (const vector<int>& query : queries) {
-      const int type = query[0];
-      if (type == 1)
-        tree.updateValue(/*index=*/query[1], /*val=*/query[2]);
-      else if (type == 2)
-        ans.push_back(tree.rangeXor(/*left=*/query[1], /*right=*/query[2]));
-      else if (type == 3)
-        tree.reverseRange(/*left=*/query[1], /*right=*/query[2]);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3527. Find the Most Common Response/3527.cpp b/solutions/3527. Find the Most Common Response/3527.cpp
deleted file mode 100644
index 6cde991ea01..00000000000
--- a/solutions/3527. Find the Most Common Response/3527.cpp	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
- public:
-  string findCommonResponse(vector<vector<string>>& responses) {
-    string ans;
-    unordered_map<string, int> count;
-    int maxFreq = 0;
-
-    for (const vector<string>& response : responses)
-      for (const string& response :
-           unordered_set<string>{response.begin(), response.end()})
-        ++count[response];
-
-    for (const pair<const string, int>& entry : count)
-      maxFreq = max(maxFreq, entry.second);
-
-    for (const auto& [response, freq] : count)
-      if (freq == maxFreq && (ans.empty() || response < ans))
-        ans = response;
-
-    return ans;
-  }
-};
diff --git a/solutions/3527. Find the Most Common Response/3527.java b/solutions/3527. Find the Most Common Response/3527.java
deleted file mode 100644
index ef311a926f6..00000000000
--- a/solutions/3527. Find the Most Common Response/3527.java	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
-  public String findCommonResponse(List<List<String>> responses) {
-    String ans = "";
-    Map<String, Integer> count = new HashMap<>();
-    int maxFreq = 0;
-
-    for (List<String> response : responses)
-      for (final String r : new HashSet<>(response))
-        count.merge(r, 1, Integer::sum);
-
-    for (final int freq : count.values())
-      maxFreq = Math.max(maxFreq, freq);
-
-    for (Map.Entry<String, Integer> entry : count.entrySet()) {
-      final String response = entry.getKey();
-      final int freq = entry.getValue();
-      if (freq == maxFreq && (ans.isEmpty() || response.compareTo(ans) < 0))
-        ans = response;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3527. Find the Most Common Response/3527.py b/solutions/3527. Find the Most Common Response/3527.py
deleted file mode 100644
index a456cc9c35a..00000000000
--- a/solutions/3527. Find the Most Common Response/3527.py	
+++ /dev/null
@@ -1,12 +0,0 @@
-class Solution:
-  def findCommonResponse(self, responses: list[list[str]]) -> str:
-    count = collections.Counter()
-
-    for response in responses:
-      for response in set(response):
-        count[response] += 1
-
-    maxFreq = max(count.values())
-    return min([response
-                for response, count in count.items()
-                if count == maxFreq])
diff --git a/solutions/3528. Unit Conversion I/3528.cpp b/solutions/3528. Unit Conversion I/3528.cpp
deleted file mode 100644
index d8b93afec9e..00000000000
--- a/solutions/3528. Unit Conversion I/3528.cpp	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution {
- public:
-  vector<int> baseUnitConversions(vector<vector<int>>& conversions) {
-    constexpr int kMod = 1'000'000'007;
-    const int n = conversions.size() + 1;
-    vector<int> ans(n);
-    ans[0] = 1;
-    queue<int> q{{0}};
-    vector<vector<pair<int, int>>> graph(n);
-
-    for (const vector<int>& conversion : conversions) {
-      const int u = conversion[0];
-      const int v = conversion[1];
-      const int factor = conversion[2];
-      graph[u].emplace_back(v, factor);
-    }
-
-    while (!q.empty()) {
-      const int u = q.front();
-      q.pop();
-      for (const auto& [v, factor] : graph[u]) {
-        ans[v] = (static_cast<long>(ans[u]) * factor) % kMod;
-        q.push(v);
-      }
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3528. Unit Conversion I/3528.java b/solutions/3528. Unit Conversion I/3528.java
deleted file mode 100644
index 452c6d70e38..00000000000
--- a/solutions/3528. Unit Conversion I/3528.java	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution {
-  public int[] baseUnitConversions(int[][] conversions) {
-    final int MOD = 1_000_000_007;
-    final int n = conversions.length + 1;
-    int[] ans = new int[n];
-    ans[0] = 1;
-    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(0));
-    List<Pair<Integer, Integer>>[] graph = new List[n];
-
-    for (int i = 0; i < n; i++)
-      graph[i] = new ArrayList<>();
-
-    for (int[] conversion : conversions) {
-      final int u = conversion[0];
-      final int v = conversion[1];
-      final int factor = conversion[2];
-      graph[u].add(new Pair<>(v, factor));
-    }
-
-    while (!q.isEmpty()) {
-      final int u = q.poll();
-      for (Pair<Integer, Integer> pair : graph[u]) {
-        final int v = pair.getKey();
-        final int factor = pair.getValue();
-        ans[v] = (int) ((long) ans[u] * factor % MOD);
-        q.offer(v);
-      }
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3528. Unit Conversion I/3528.py b/solutions/3528. Unit Conversion I/3528.py
deleted file mode 100644
index d77a6762649..00000000000
--- a/solutions/3528. Unit Conversion I/3528.py	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution:
-  def baseUnitConversions(self, conversions: list[list[int]]) -> list[int]:
-    MOD = 1_000_000_007
-    n = len(conversions) + 1
-    ans = [0] * n
-    ans[0] = 1
-    q = collections.deque([0])
-    graph = [[] for _ in range(n)]
-
-    for u, v, factor in conversions:
-      graph[u].append((v, factor))
-
-    while q:
-      u = q.popleft()
-      for v, factor in graph[u]:
-        ans[v] = (ans[u] * factor) % MOD
-        q.append(v)
-
-    return ans
diff --git a/solutions/3529. Count Cells in Overlapping Horizontal and Vertical Substrings/3529.cpp b/solutions/3529. Count Cells in Overlapping Horizontal and Vertical Substrings/3529.cpp
deleted file mode 100644
index 043fdba2d1c..00000000000
--- a/solutions/3529. Count Cells in Overlapping Horizontal and Vertical Substrings/3529.cpp	
+++ /dev/null
@@ -1,81 +0,0 @@
-class Solution {
- public:
-  int countCells(vector<vector<char>>& grid, string pattern) {
-    const int m = grid.size();
-    const int n = grid[0].size();
-    int ans = 0;
-    string flattendGridRow;
-    string flattendGridCol;
-
-    // Flatten the grid for horizontal matching.
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j)
-        flattendGridRow += grid[i][j];
-
-    // Flatten the grid for vertical matching.
-    for (int j = 0; j < n; ++j)
-      for (int i = 0; i < m; ++i)
-        flattendGridCol += grid[i][j];
-
-    // Find matching positions.
-    const vector<vector<bool>> horizontalMatches =
-        markMatchedCells(flattendGridRow, pattern, m, n, true);
-    const vector<vector<bool>> verticalMatches =
-        markMatchedCells(flattendGridCol, pattern, m, n, false);
-
-    // Count overlapping match positions.
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j)
-        if (horizontalMatches[i][j] && verticalMatches[i][j])
-          ++ans;
-
-    return ans;
-  }
-
- private:
-  static constexpr long kBase = 13;
-  static constexpr long kHash = 1'000'000'007;
-
-  vector<vector<bool>> markMatchedCells(const string& flattenedGrid,
-                                        const string& pattern, int m, int n,
-                                        bool isHorizontal) {
-    vector<vector<bool>> matchMatrix(m, vector<bool>(n, false));
-    vector<int> matchPrefix(flattenedGrid.length() + 1);
-    vector<long> pows{1};  // pows[i] := kBase^i % kHash
-    long patternHash = 0;
-    long runningHash = 0;
-
-    for (int i = 1; i < pattern.length(); ++i)
-      pows.push_back((pows.back() * kBase) % kHash);
-
-    for (const char c : pattern)
-      patternHash = (patternHash * kBase + (c - 'a')) % kHash;
-
-    for (int i = 0; i < flattenedGrid.length(); ++i) {
-      runningHash = (runningHash * kBase + (flattenedGrid[i] - 'a')) % kHash;
-      if (i >= pattern.length() - 1) {
-        if (runningHash == patternHash) {  // Match found.
-          ++matchPrefix[i - pattern.length() + 1];
-          --matchPrefix[i + 1];
-        }
-        // Remove the contribution of the oldest letter.
-        const long oldestLetterHash =
-            (pows[pattern.length() - 1] *
-             (flattenedGrid[i - pattern.length() + 1] - 'a')) %
-            kHash;
-        runningHash = (runningHash - oldestLetterHash + kHash) % kHash;
-      }
-    }
-
-    for (int k = 0; k < flattenedGrid.length(); ++k) {
-      matchPrefix[k] += (k > 0) ? matchPrefix[k - 1] : 0;
-      if (matchPrefix[k] > 0) {
-        const int i = isHorizontal ? k / n : k % m;
-        const int j = isHorizontal ? k % n : k / m;
-        matchMatrix[i][j] = true;
-      }
-    }
-
-    return matchMatrix;
-  }
-};
diff --git a/solutions/3529. Count Cells in Overlapping Horizontal and Vertical Substrings/3529.java b/solutions/3529. Count Cells in Overlapping Horizontal and Vertical Substrings/3529.java
deleted file mode 100644
index dafc46fbab8..00000000000
--- a/solutions/3529. Count Cells in Overlapping Horizontal and Vertical Substrings/3529.java	
+++ /dev/null
@@ -1,78 +0,0 @@
-class Solution {
-  public int countCells(char[][] grid, String pattern) {
-    final int m = grid.length;
-    final int n = grid[0].length;
-    int ans = 0;
-    StringBuilder flattenedGridRow = new StringBuilder();
-    StringBuilder flattenedGridCol = new StringBuilder();
-
-    // Flatten the grid for horizontal matching.
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j)
-        flattenedGridRow.append(grid[i][j]);
-
-    // Flatten the grid for vertical matching.
-    for (int j = 0; j < n; ++j)
-      for (int i = 0; i < m; ++i)
-        flattenedGridCol.append(grid[i][j]);
-
-    // Find matching positions.
-    boolean[][] horizontalMatches =
-        markMatchedCells(flattenedGridRow.toString(), pattern, m, n, true);
-    boolean[][] verticalMatches =
-        markMatchedCells(flattenedGridCol.toString(), pattern, m, n, false);
-
-    // Count overlapping match positions.
-    for (int i = 0; i < m; ++i)
-      for (int j = 0; j < n; ++j)
-        if (horizontalMatches[i][j] && verticalMatches[i][j])
-          ++ans;
-
-    return ans;
-  }
-
-  private static final long BASE = 13;
-  private static final long HASH = 1_000_000_007;
-
-  private boolean[][] markMatchedCells(final String flattenedGrid, final String pattern, int m,
-                                       int n, boolean isHorizontal) {
-    boolean[][] matchMatrix = new boolean[m][n];
-    int[] matchPrefix = new int[flattenedGrid.length() + 1];
-    long[] pows = new long[pattern.length()]; // pows[i] := BASE^i % HASH
-    pows[0] = 1;
-    long patternHash = 0;
-    long runningHash = 0;
-
-    for (int i = 1; i < pattern.length(); ++i)
-      pows[i] = (pows[i - 1] * BASE) % HASH;
-
-    for (final char c : pattern.toCharArray())
-      patternHash = (patternHash * BASE + (c - 'a')) % HASH;
-
-    for (int i = 0; i < flattenedGrid.length(); ++i) {
-      runningHash = (runningHash * BASE + (flattenedGrid.charAt(i) - 'a')) % HASH;
-      if (i >= pattern.length() - 1) {
-        if (runningHash == patternHash) { // Match found.
-          ++matchPrefix[i - pattern.length() + 1];
-          --matchPrefix[i + 1];
-        }
-        // Remove the contribution of the oldest letter.
-        final long oldestLetterHash =
-            (pows[pattern.length() - 1] * (flattenedGrid.charAt(i - pattern.length() + 1) - 'a')) %
-            HASH;
-        runningHash = (runningHash - oldestLetterHash + HASH) % HASH;
-      }
-    }
-
-    for (int k = 0; k < flattenedGrid.length(); ++k) {
-      matchPrefix[k] += (k > 0) ? matchPrefix[k - 1] : 0;
-      if (matchPrefix[k] > 0) {
-        final int i = isHorizontal ? k / n : k % m;
-        final int j = isHorizontal ? k % n : k / m;
-        matchMatrix[i][j] = true;
-      }
-    }
-
-    return matchMatrix;
-  }
-}
diff --git a/solutions/3529. Count Cells in Overlapping Horizontal and Vertical Substrings/3529.py b/solutions/3529. Count Cells in Overlapping Horizontal and Vertical Substrings/3529.py
deleted file mode 100644
index ea5ef6e7252..00000000000
--- a/solutions/3529. Count Cells in Overlapping Horizontal and Vertical Substrings/3529.py	
+++ /dev/null
@@ -1,51 +0,0 @@
-class Solution:
-  def countCells(self, grid: list[list[str]], pattern: str) -> int:
-    BASE = 13
-    HASH = 1_000_000_007
-    m = len(grid)
-    n = len(grid[0])
-
-    def markMatchedCells(flattenedGrid: str, isHorizontal: bool) -> list[list[bool]]:
-      matchMatrix = [[False] * n for _ in range(m)]
-      matchPrefix = [0] * (len(flattenedGrid) + 1)
-      pows = [1]  # pows[i] := BASE^i % HASH
-      patternHash = 0
-      runningHash = 0
-
-      for i in range(1, len(pattern)):
-        pows.append((pows[-1] * BASE) % HASH)
-
-      for c in pattern:
-        patternHash = (patternHash * BASE + (ord(c) - ord('a'))) % HASH
-
-      for i in range(len(flattenedGrid)):
-        runningHash = (
-            runningHash * BASE + (ord(flattenedGrid[i]) - ord('a'))) % HASH
-        if i >= len(pattern) - 1:
-          if runningHash == patternHash:  # Match found.
-            matchPrefix[i - len(pattern) + 1] += 1
-            matchPrefix[i + 1] -= 1
-          # Remove the contribution of the oldest letter.
-          oldestLetterHash = (
-              pows[len(pattern) - 1] *
-              (ord(flattenedGrid[i - len(pattern) + 1]) - ord('a'))) % HASH
-          runningHash = (runningHash - oldestLetterHash + HASH) % HASH
-
-      for k in range(len(flattenedGrid)):
-        if k > 0:
-          matchPrefix[k] += matchPrefix[k - 1]
-        if matchPrefix[k] > 0:
-          i = k // n if isHorizontal else k % m
-          j = k % n if isHorizontal else k // m
-          matchMatrix[i][j] = True
-
-      return matchMatrix
-
-    # Find matching positions.
-    flattenedGridRow = ''.join(cell for row in grid for cell in row)
-    flattenedGridCol = ''.join(cell for col in zip(*grid) for cell in col)
-    horizontalMatches = markMatchedCells(flattenedGridRow, True)
-    verticalMatches = markMatchedCells(flattenedGridCol, False)
-    return sum(horizontalMatches[i][j] and verticalMatches[i][j]
-               for i in range(m)
-               for j in range(n))
diff --git a/solutions/353. Design Snake Game/353.cpp b/solutions/353. Design Snake Game/353.cpp
index 977418993ee..bad1dc356fd 100644
--- a/solutions/353. Design Snake Game/353.cpp	
+++ b/solutions/353. Design Snake Game/353.cpp	
@@ -16,7 +16,7 @@ class SnakeGame {
       @param direction - 'U' = Up, 'L' = Left, 'R' = Right, 'D' = Down
       @return The game's score after the move. Return -1 if game over.
       Game over when snake crosses the screen boundary or bites its body. */
-  int std::move(string direction) {
+  int move(string direction) {
     // the old head's position
     int i = body.front() / width;
     int j = body.front() % width;
diff --git a/solutions/353. Design Snake Game/353.py b/solutions/353. Design Snake Game/353.py
index 4d6ea1c298a..a8c448e5f9d 100644
--- a/solutions/353. Design Snake Game/353.py	
+++ b/solutions/353. Design Snake Game/353.py	
@@ -1,5 +1,5 @@
 class SnakeGame:
-  def __init__(self, width: int, height: int, food: list[list[int]]):
+  def __init__(self, width: int, height: int, food: List[List[int]]):
     """
     Initialize your data structure here.
     @param width - screen width
diff --git a/solutions/3530. Maximum Profit from Valid Topological Order in DAG/3530.cpp b/solutions/3530. Maximum Profit from Valid Topological Order in DAG/3530.cpp
deleted file mode 100644
index 342043bde33..00000000000
--- a/solutions/3530. Maximum Profit from Valid Topological Order in DAG/3530.cpp	
+++ /dev/null
@@ -1,39 +0,0 @@
-class Solution {
- public:
-  int maxProfit(int n, vector<vector<int>>& edges, vector<int>& score) {
-    const int maxMask = 1 << n;
-    // need[i] := the bitmask representing all nodes that must be placed before
-    // node i
-    vector<int> need(n);
-    // dp[mask] := the maximum profit achievable by placing the set of nodes
-    // represented by `mask`
-    vector<int> dp(maxMask, -1);
-    dp[0] = 0;
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      need[v] |= 1 << u;
-    }
-
-    // Iterate over all subsets of nodes (represented by bitmask `mask`)
-    for (unsigned mask = 0; mask < maxMask; ++mask) {
-      if (dp[mask] == -1)
-        continue;
-      // Determine the position of the next node to be placed (1-based).
-      const int pos = popcount(mask) + 1;
-      // Try to place each node `i` that hasn't been placed yet.
-      for (int i = 0; i < n; ++i) {
-        if (mask >> i & 1)
-          continue;
-        // Check if all dependencies of node `i` are already placed.
-        if ((mask & need[i]) == need[i]) {
-          const int newMask = mask | 1 << i;  // Mark node `i` as placed.
-          dp[newMask] = max(dp[newMask], dp[mask] + score[i] * pos);
-        }
-      }
-    }
-
-    return dp.back();
-  }
-};
diff --git a/solutions/3530. Maximum Profit from Valid Topological Order in DAG/3530.java b/solutions/3530. Maximum Profit from Valid Topological Order in DAG/3530.java
deleted file mode 100644
index 74e1cf2d294..00000000000
--- a/solutions/3530. Maximum Profit from Valid Topological Order in DAG/3530.java	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution {
-  public int maxProfit(int n, int[][] edges, int[] score) {
-    final int maxMask = 1 << n;
-    // need[i] := the bitmask representing all nodes that must be placed before node i
-    int[] need = new int[n];
-    // dp[mask] := the maximum profit achievable by placing the set of nodes represented by `mask`
-    int[] dp = new int[maxMask];
-    Arrays.fill(dp, -1);
-    dp[0] = 0;
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      need[v] |= 1 << u;
-    }
-
-    // Iterate over all subsets of nodes (represented by bitmask `mask`)
-    for (int mask = 0; mask < maxMask; ++mask) {
-      if (dp[mask] == -1)
-        continue;
-      // Determine the position of the next node to be placed (1-based).
-      int pos = Integer.bitCount(mask) + 1;
-      // Try to place each node `i` that hasn't been placed yet.
-      for (int i = 0; i < n; ++i) {
-        if ((mask >> i & 1) == 1)
-          continue;
-        // Check if all dependencies of node `i` are already placed.
-        if ((mask & need[i]) == need[i]) {
-          final int newMask = mask | 1 << i; // Mark node `i` as placed.
-          dp[newMask] = Math.max(dp[newMask], dp[mask] + score[i] * pos);
-        }
-      }
-    }
-
-    return dp[maxMask - 1];
-  }
-}
diff --git a/solutions/3530. Maximum Profit from Valid Topological Order in DAG/3530.py b/solutions/3530. Maximum Profit from Valid Topological Order in DAG/3530.py
deleted file mode 100644
index d098df6c383..00000000000
--- a/solutions/3530. Maximum Profit from Valid Topological Order in DAG/3530.py	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution:
-  def maxProfit(self, n: int, edges: list[list[int]], score: list[int]) -> int:
-    # need[i] := the bitmask representing all nodes that must be placed before
-    # node i
-    need = [0] * n
-    # dp[mask] := the maximum profit achievable by placing the set of nodes
-    # represented by `mask`
-    dp = [-1] * (1 << n)
-    dp[0] = 0
-
-    for u, v in edges:
-      need[v] |= 1 << u
-
-    # Iterate over all subsets of nodes (represented by bitmask `mask`)
-    for mask in range(1 << n):
-      if dp[mask] == -1:
-        continue
-      # Determine the position of the next node to be placed (1-based).
-      pos = mask.bit_count() + 1
-      # Try to place each node `i` that hasn't been placed yet.
-      for i in range(n):
-        if mask >> i & 1:
-          continue
-        # Check if all dependencies of node `i` are already placed.
-        if (mask & need[i]) == need[i]:
-          newMask = mask | 1 << i  # Mark node `i` as placed.
-          dp[newMask] = max(dp[newMask], dp[mask] + score[i] * pos)
-
-    return dp[-1]
diff --git a/solutions/3531. Count Covered Buildings/3531.cpp b/solutions/3531. Count Covered Buildings/3531.cpp
deleted file mode 100644
index 1b0618e8513..00000000000
--- a/solutions/3531. Count Covered Buildings/3531.cpp	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution {
- public:
-  int countCoveredBuildings(int n, vector<vector<int>>& buildings) {
-    int ans = 0;
-    vector<int> northernmost(n + 1, INT_MAX);
-    vector<int> southernmost(n + 1, 0);
-    vector<int> westernmost(n + 1, INT_MAX);
-    vector<int> easternmost(n + 1, 0);
-
-    for (const vector<int>& building : buildings) {
-      const int x = building[0];
-      const int y = building[1];
-      northernmost[x] = min(northernmost[x], y);
-      southernmost[x] = max(southernmost[x], y);
-      westernmost[y] = min(westernmost[y], x);
-      easternmost[y] = max(easternmost[y], x);
-    }
-
-    for (const vector<int>& building : buildings) {
-      const int x = building[0];
-      const int y = building[1];
-      if (northernmost[x] < y && y < southernmost[x]  //
-          && westernmost[y] < x && x < easternmost[y])
-        ++ans;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3531. Count Covered Buildings/3531.java b/solutions/3531. Count Covered Buildings/3531.java
deleted file mode 100644
index 6e4f0adbff5..00000000000
--- a/solutions/3531. Count Covered Buildings/3531.java	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution {
-  public int countCoveredBuildings(int n, int[][] buildings) {
-    int ans = 0;
-    int[] northernmost = new int[n + 1];
-    int[] southernmost = new int[n + 1];
-    int[] westernmost = new int[n + 1];
-    int[] easternmost = new int[n + 1];
-    Arrays.fill(northernmost, Integer.MAX_VALUE);
-    Arrays.fill(southernmost, 0);
-    Arrays.fill(westernmost, Integer.MAX_VALUE);
-    Arrays.fill(easternmost, 0);
-
-    for (int[] building : buildings) {
-      final int x = building[0];
-      final int y = building[1];
-      northernmost[x] = Math.min(northernmost[x], y);
-      southernmost[x] = Math.max(southernmost[x], y);
-      westernmost[y] = Math.min(westernmost[y], x);
-      easternmost[y] = Math.max(easternmost[y], x);
-    }
-
-    for (int[] building : buildings) {
-      final int x = building[0];
-      final int y = building[1];
-      if (northernmost[x] < y && y < southernmost[x] //
-          && westernmost[y] < x && x < easternmost[y])
-        ++ans;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3531. Count Covered Buildings/3531.py b/solutions/3531. Count Covered Buildings/3531.py
deleted file mode 100644
index cb0f1c3bc5c..00000000000
--- a/solutions/3531. Count Covered Buildings/3531.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  def countCoveredBuildings(self, n: int, buildings: list[list[int]]) -> int:
-    northernmost = [math.inf] * (n + 1)
-    southernmost = [0] * (n + 1)
-    westernmost = [math.inf] * (n + 1)
-    easternmost = [0] * (n + 1)
-
-    for x, y in buildings:
-      northernmost[x] = min(northernmost[x], y)
-      southernmost[x] = max(southernmost[x], y)
-      westernmost[y] = min(westernmost[y], x)
-      easternmost[y] = max(easternmost[y], x)
-
-    return sum(northernmost[x] < y < southernmost[x]
-               and westernmost[y] < x < easternmost[y]
-               for x, y in buildings)
diff --git a/solutions/3532. Path Existence Queries in a Graph I/3532.cpp b/solutions/3532. Path Existence Queries in a Graph I/3532.cpp
deleted file mode 100644
index 6d83865546b..00000000000
--- a/solutions/3532. Path Existence Queries in a Graph I/3532.cpp	
+++ /dev/null
@@ -1,50 +0,0 @@
-class UnionFind {
- public:
-  UnionFind(int n) : id(n), rank(n) {
-    iota(id.begin(), id.end(), 0);
-  }
-
-  void unionByRank(int u, int v) {
-    const int i = find(u);
-    const int j = find(v);
-    if (i == j)
-      return;
-    if (rank[i] < rank[j]) {
-      id[i] = j;
-    } else if (rank[i] > rank[j]) {
-      id[j] = i;
-    } else {
-      id[i] = j;
-      ++rank[j];
-    }
-  }
-
-  int find(int u) {
-    return id[u] == u ? u : id[u] = find(id[u]);
-  }
-
- private:
-  vector<int> id;
-  vector<int> rank;
-};
-
-class Solution {
- public:
-  vector<bool> pathExistenceQueries(int n, vector<int>& nums, int maxDiff,
-                                    vector<vector<int>>& queries) {
-    vector<bool> ans;
-    UnionFind uf(n);
-
-    for (int i = 1; i < n; ++i)
-      if (abs(nums[i] - nums[i - 1]) <= maxDiff)
-        uf.unionByRank(i, i - 1);
-
-    for (const vector<int>& query : queries) {
-      const int u = query[0];
-      const int v = query[1];
-      ans.push_back(uf.find(u) == uf.find(v));
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3532. Path Existence Queries in a Graph I/3532.java b/solutions/3532. Path Existence Queries in a Graph I/3532.java
deleted file mode 100644
index c2d40e471d8..00000000000
--- a/solutions/3532. Path Existence Queries in a Graph I/3532.java	
+++ /dev/null
@@ -1,49 +0,0 @@
-class UnionFind {
-  public UnionFind(int n) {
-    id = new int[n];
-    rank = new int[n];
-    for (int i = 0; i < n; ++i)
-      id[i] = i;
-  }
-
-  public void unionByRank(int u, int v) {
-    final int i = find(u);
-    final int j = find(v);
-    if (i == j)
-      return;
-    if (rank[i] < rank[j]) {
-      id[i] = j;
-    } else if (rank[i] > rank[j]) {
-      id[j] = i;
-    } else {
-      id[i] = j;
-      ++rank[j];
-    }
-  }
-
-  public int find(int u) {
-    return id[u] == u ? u : (id[u] = find(id[u]));
-  }
-
-  private int[] id;
-  private int[] rank;
-}
-
-class Solution {
-  public boolean[] pathExistenceQueries(int n, int[] nums, int maxDiff, int[][] queries) {
-    boolean[] ans = new boolean[queries.length];
-    UnionFind uf = new UnionFind(n);
-
-    for (int i = 1; i < n; ++i)
-      if (Math.abs(nums[i] - nums[i - 1]) <= maxDiff)
-        uf.unionByRank(i, i - 1);
-
-    for (int i = 0; i < queries.length; ++i) {
-      final int u = queries[i][0];
-      final int v = queries[i][1];
-      ans[i] = uf.find(u) == uf.find(v);
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3532. Path Existence Queries in a Graph I/3532.py b/solutions/3532. Path Existence Queries in a Graph I/3532.py
deleted file mode 100644
index c92ccaf9ca6..00000000000
--- a/solutions/3532. Path Existence Queries in a Graph I/3532.py	
+++ /dev/null
@@ -1,40 +0,0 @@
-class UnionFind:
-  def __init__(self, n: int):
-    self.id = list(range(n))
-    self.rank = [0] * n
-
-  def unionByRank(self, u: int, v: int) -> None:
-    i = self.find(u)
-    j = self.find(v)
-    if i == j:
-      return
-    if self.rank[i] < self.rank[j]:
-      self.id[i] = j
-    elif self.rank[i] > self.rank[j]:
-      self.id[j] = i
-    else:
-      self.id[i] = j
-      self.rank[j] += 1
-
-  def find(self, u: int) -> int:
-    if self.id[u] != u:
-      self.id[u] = self.find(self.id[u])
-    return self.id[u]
-
-
-class Solution:
-  def pathExistenceQueries(
-      self,
-      n: int,
-      nums: list[int],
-      maxDiff: int,
-      queries: list[list[int]]
-  ) -> list[bool]:
-    uf = UnionFind(n)
-
-    for i in range(1, n):
-      if abs(nums[i] - nums[i - 1]) <= maxDiff:
-        uf.unionByRank(i, i - 1)
-
-    return [uf.find(u) == uf.find(v)
-            for u, v in queries]
diff --git a/solutions/3533. Concatenated Divisibility/3533.cpp b/solutions/3533. Concatenated Divisibility/3533.cpp
deleted file mode 100644
index 163d422fb24..00000000000
--- a/solutions/3533. Concatenated Divisibility/3533.cpp	
+++ /dev/null
@@ -1,54 +0,0 @@
-class Solution {
- public:
-  vector<int> concatenatedDivisibility(vector<int>& nums, int k) {
-    vector<int> lengths;
-    vector<int> pows;
-
-    ranges::sort(nums);
-
-    for (const int num : nums) {
-      lengths.push_back(to_string(num).length());
-      pows.push_back(static_cast<int>(pow(10, lengths.back())) % k);
-    }
-
-    vector<vector<int>> mem(1 << nums.size(), vector<int>(k, -1));
-    return dp(nums, pows, mem, k, 0, 0) ? reconstruct(nums, pows, mem, k, 0, 0)
-                                        : vector<int>();
-  }
-
- private:
-  // Returns true if there is a way to form a number divisible by `k` using the
-  // numbers in `nums`, where nums[i] is used iff `mask & (1 << i)`.
-  bool dp(const vector<int>& nums, const vector<int>& pows,
-          vector<vector<int>>& mem, int k, int mask, int mod) {
-    if (mem[mask][mod] != -1)
-      return mem[mask][mod] == 1;
-    if (mask == (1 << nums.size()) - 1)
-      return mod == 0;
-    for (int i = 0; i < nums.size(); ++i)
-      if ((mask >> i & 1) == 0) {
-        const int newMod = (mod * pows[i] + nums[i]) % k;
-        if (dp(nums, pows, mem, k, mask | 1 << i, newMod))
-          return mem[mask][mod] = 1;
-      }
-    return mem[mask][mod] = 0;
-  }
-
-  // Reconstructs the numbers that form a number divisible by `k` using the
-  // numbers in `nums`, where nums[i] is used iff `mask & (1 << i)`.
-  vector<int> reconstruct(const vector<int>& nums, const vector<int>& pows,
-                          vector<vector<int>>& mem, int k, int mask, int mod) {
-    for (int i = 0; i < nums.size(); ++i)
-      if ((mask >> i & 1) == 0) {
-        const int newMod = (mod * pows[i] + nums[i]) % k;
-        if (dp(nums, pows, mem, k, mask | 1 << i, newMod)) {
-          vector<int> res{nums[i]};
-          vector<int> rest =
-              reconstruct(nums, pows, mem, k, mask | 1 << i, newMod);
-          ranges::copy(rest, ranges::back_inserter(res));
-          return res;
-        }
-      }
-    return {};
-  }
-};
diff --git a/solutions/3533. Concatenated Divisibility/3533.java b/solutions/3533. Concatenated Divisibility/3533.java
deleted file mode 100644
index 7fbe33b9c9f..00000000000
--- a/solutions/3533. Concatenated Divisibility/3533.java	
+++ /dev/null
@@ -1,51 +0,0 @@
-class Solution {
-  public int[] concatenatedDivisibility(int[] nums, int k) {
-    final int n = nums.length;
-    int[] lengths = new int[n];
-    int[] pows = new int[n];
-
-    Arrays.sort(nums);
-
-    for (int i = 0; i < n; ++i) {
-      lengths[i] = String.valueOf(nums[i]).length();
-      pows[i] = (int) Math.pow(10, lengths[i]) % k;
-    }
-
-    Integer[][] mem = new Integer[1 << n][k];
-    return dp(nums, pows, mem, k, 0, 0) ? reconstruct(nums, pows, mem, k, 0, 0) : new int[0];
-  }
-
-  // Returns true if there is a way to form a number divisible by `k` using the
-  // numbers in `nums`, where nums[i] is used iff `mask & (1 << i)`.
-  private boolean dp(int[] nums, int[] pows, Integer[][] mem, int k, int mask, int mod) {
-    if (mem[mask][mod] != null)
-      return mem[mask][mod] == 1;
-    if (mask == (1 << nums.length) - 1)
-      return (mem[mask][mod] = mod == 0 ? 1 : 0) == 1;
-    for (int i = 0; i < nums.length; ++i)
-      if ((mask >> i & 1) == 0) {
-        final int newMod = (mod * pows[i] + nums[i]) % k;
-        if (dp(nums, pows, mem, k, mask | 1 << i, newMod))
-          return (mem[mask][mod] = 1) == 1;
-      }
-    return (mem[mask][mod] = 0) == 1;
-  }
-
-  // Reconstructs the numbers that form a number divisible by `k` using the
-  // numbers in `nums`, where nums[i] is used iff `mask & (1 << i)`.
-  private int[] reconstruct(int[] nums, int[] pows, Integer[][] mem, int k, int mask, int mod) {
-    for (int i = 0; i < nums.length; ++i)
-      if ((mask >> i & 1) == 0) {
-        final int newMod = (mod * pows[i] + nums[i]) % k;
-        if (dp(nums, pows, mem, k, mask | 1 << i, newMod)) {
-          int[] first = new int[] {nums[i]};
-          int[] rest = reconstruct(nums, pows, mem, k, mask | 1 << i, newMod);
-          int[] res = new int[first.length + rest.length];
-          System.arraycopy(first, 0, res, 0, first.length);
-          System.arraycopy(rest, 0, res, first.length, rest.length);
-          return res;
-        }
-      }
-    return new int[0];
-  }
-}
diff --git a/solutions/3533. Concatenated Divisibility/3533.py b/solutions/3533. Concatenated Divisibility/3533.py
deleted file mode 100644
index cfce30a83f5..00000000000
--- a/solutions/3533. Concatenated Divisibility/3533.py	
+++ /dev/null
@@ -1,35 +0,0 @@
-class Solution:
-  def concatenatedDivisibility(self, nums: list[int], k: int) -> list[int]:
-    n = len(nums)
-    nums.sort()
-    lengths = [len(str(num)) for num in nums]
-    pows = [pow(10, length, k) for length in lengths]
-
-    @functools.lru_cache(None)
-    def dp(mask: int, mod: int) -> bool:
-      """
-      Returns True if there is a way to form a number divisible by `k` using the
-      numbers in `nums`, where nums[i] is used iff `mask & (1 << i)`.
-      """
-      if mask == (1 << n) - 1:
-        return mod == 0
-      for i in range(n):
-        if (mask >> i & 1) == 0:
-          newMod = (mod * pows[i] + nums[i]) % k
-          if dp(mask | 1 << i, newMod):
-            return True
-      return False
-
-    def reconstruct(mask: int, mod: int) -> list[int]:
-      """
-      Reconstructs the numbers that form a number divisible by `k` using the
-      numbers in `nums`, where nums[i] is used iff `mask & (1 << i)`.
-      """
-      for i in range(n):
-        if (mask >> i & 1) == 0:
-          newMod = (mod * pows[i] + nums[i]) % k
-          if dp(mask | 1 << i, newMod):
-            return [nums[i]] + reconstruct(mask | 1 << i, newMod)
-      return []
-
-    return reconstruct(0, 0) if dp(0, 0) else []
diff --git a/solutions/3534. Path Existence Queries in a Graph II/3534.cpp b/solutions/3534. Path Existence Queries in a Graph II/3534.cpp
deleted file mode 100644
index 74f3087bcfe..00000000000
--- a/solutions/3534. Path Existence Queries in a Graph II/3534.cpp	
+++ /dev/null
@@ -1,68 +0,0 @@
-class Solution {
- public:
-  vector<int> pathExistenceQueries(int n, vector<int>& nums, int maxDiff,
-                                   vector<vector<int>>& queries) {
-    vector<int> ans;
-    vector<int> sortedNums;
-    vector<int> indexMap(n);
-    vector<pair<int, int>> sortedNumAndIndexes;
-
-    for (int i = 0; i < n; ++i)
-      sortedNumAndIndexes.emplace_back(nums[i], i);
-
-    ranges::sort(sortedNumAndIndexes);
-
-    for (int i = 0; i < n; ++i) {
-      const auto& [num, sortedIndex] = sortedNumAndIndexes[i];
-      sortedNums.push_back(num);
-      indexMap[sortedIndex] = i;
-    }
-
-    const int maxLevel = std::bit_width(static_cast<unsigned>(n)) + 1;
-    // jump[i][j] := the index of the j-th ancestor of i
-    vector<vector<int>> jump(n, vector<int>(maxLevel));
-
-    int right = 0;
-    for (int i = 0; i < n; ++i) {
-      while (right + 1 < n && sortedNums[right + 1] - sortedNums[i] <= maxDiff)
-        ++right;
-      jump[i][0] = right;
-    }
-
-    for (int level = 1; level < maxLevel; ++level)
-      for (int i = 0; i < n; ++i) {
-        const int prevJump = jump[i][level - 1];
-        jump[i][level] = jump[prevJump][level - 1];
-      }
-
-    for (const vector<int>& query : queries) {
-      const int u = query[0];
-      const int v = query[1];
-      const int uIndex = indexMap[u];
-      const int vIndex = indexMap[v];
-      const int start = min(uIndex, vIndex);
-      const int end = max(uIndex, vIndex);
-      const int res = minJumps(jump, start, end, maxLevel - 1);
-      ans.push_back(res == INT_MAX ? -1 : res);
-    }
-
-    return ans;
-  }
-
- private:
-  // Returns the minimum number of jumps from `start` to `end` using binary
-  // lifting.
-  int minJumps(const vector<vector<int>>& jump, int start, int end, int level) {
-    if (start == end)
-      return 0;
-    if (jump[start][0] >= end)
-      return 1;
-    if (jump[start][level] < end)
-      return INT_MAX;
-    int j = level;
-    for (; j >= 0; --j)
-      if (jump[start][j] < end)
-        break;
-    return (1 << j) + minJumps(jump, jump[start][j], end, j);
-  }
-};
diff --git a/solutions/3534. Path Existence Queries in a Graph II/3534.java b/solutions/3534. Path Existence Queries in a Graph II/3534.java
deleted file mode 100644
index 7a4ba39abd9..00000000000
--- a/solutions/3534. Path Existence Queries in a Graph II/3534.java	
+++ /dev/null
@@ -1,66 +0,0 @@
-class Solution {
-  public int[] pathExistenceQueries(int n, int[] nums, int maxDiff, int[][] queries) {
-    int[] ans = new int[queries.length];
-    int[] indexMap = new int[n];
-    int[] sortedNums = new int[n];
-    Pair<Integer, Integer>[] sortedNumAndIndexes = new Pair[n];
-
-    for (int i = 0; i < n; ++i)
-      sortedNumAndIndexes[i] = new Pair<>(nums[i], i);
-
-    Arrays.sort(sortedNumAndIndexes, Comparator.comparingInt(Pair::getKey));
-
-    for (int i = 0; i < n; ++i) {
-      final int num = sortedNumAndIndexes[i].getKey();
-      final int sortedIndex = sortedNumAndIndexes[i].getValue();
-      sortedNums[i] = num;
-      indexMap[sortedIndex] = i;
-    }
-
-    final int maxLevel = Integer.SIZE - Integer.numberOfLeadingZeros(n) + 1;
-    // jump[i][j] := the index of the j-th ancestor of i
-    int[][] jump = new int[n][maxLevel];
-
-    int right = 0;
-    for (int i = 0; i < n; ++i) {
-      while (right + 1 < n && sortedNums[right + 1] - sortedNums[i] <= maxDiff)
-        ++right;
-      jump[i][0] = right;
-    }
-
-    for (int level = 1; level < maxLevel; ++level)
-      for (int i = 0; i < n; ++i) {
-        final int prevJump = jump[i][level - 1];
-        jump[i][level] = jump[prevJump][level - 1];
-      }
-
-    for (int i = 0; i < queries.length; ++i) {
-      final int u = queries[i][0];
-      final int v = queries[i][1];
-      final int uIndex = indexMap[u];
-      final int vIndex = indexMap[v];
-      final int start = Math.min(uIndex, vIndex);
-      final int end = Math.max(uIndex, vIndex);
-      final int res = minJumps(jump, start, end, maxLevel - 1);
-      ans[i] = res == Integer.MAX_VALUE ? -1 : res;
-    }
-
-    return ans;
-  }
-
-  // Returns the minimum number of jumps from `start` to `end` using binary
-  // lifting.
-  private int minJumps(int[][] jump, int start, int end, int level) {
-    if (start == end)
-      return 0;
-    if (jump[start][0] >= end)
-      return 1;
-    if (jump[start][level] < end)
-      return Integer.MAX_VALUE;
-    int j = level;
-    for (; j >= 0; --j)
-      if (jump[start][j] < end)
-        break;
-    return (1 << j) + minJumps(jump, jump[start][j], end, j);
-  }
-}
diff --git a/solutions/3534. Path Existence Queries in a Graph II/3534.py b/solutions/3534. Path Existence Queries in a Graph II/3534.py
deleted file mode 100644
index 9ae32172b67..00000000000
--- a/solutions/3534. Path Existence Queries in a Graph II/3534.py	
+++ /dev/null
@@ -1,52 +0,0 @@
-class Solution:
-  def pathExistenceQueries(
-      self,
-      n: int,
-      nums: list[int],
-      maxDiff: int,
-      queries: list[list[int]],
-  ) -> list[int]:
-    sortedNumAndIndexes = sorted((num, i) for i, num in enumerate(nums))
-    sortedNums = [num for num, _ in sortedNumAndIndexes]
-    indexMap = {originalIndex: sortedIndex for sortedIndex,
-                (_, originalIndex) in enumerate(sortedNumAndIndexes)}
-    maxLevel = n.bit_length() + 1
-    # jump[i][j] is the index of the j-th ancestor of i
-    jump = [[0] * maxLevel for _ in range(n)]
-
-    right = 0
-    for i in range(n):
-      while right + 1 < n and sortedNums[right + 1] - sortedNums[i] <= maxDiff:
-        right += 1
-      jump[i][0] = right
-
-    for level in range(1, maxLevel):
-      for i in range(n):
-        prevJump = jump[i][level - 1]
-        jump[i][level] = jump[prevJump][level - 1]
-
-    def minJumps(start: int, end: int, level: int) -> int:
-      """
-      Returns the minimum number of jumps from `start` to `end` using binary
-      lifting.
-      """
-      if start == end:
-        return 0
-      if jump[start][0] >= end:
-        return 1
-      if jump[start][level] < end:
-        return math.inf
-      for j in range(level, -1, -1):
-        if jump[start][j] < end:
-          break
-      return (1 << j) + minJumps(jump[start][j], end, j)
-
-    def minDist(u: int, v: int) -> int:
-      uIndex = indexMap[u]
-      vIndex = indexMap[v]
-      start = min(uIndex, vIndex)
-      end = max(uIndex, vIndex)
-      res = minJumps(start, end, maxLevel - 1)
-      return res if res < math.inf else -1
-
-    return [minDist(u, v) for u, v in queries]
diff --git a/solutions/3535. Unit Conversion II/3535.cpp b/solutions/3535. Unit Conversion II/3535.cpp
deleted file mode 100644
index a918e73cb4e..00000000000
--- a/solutions/3535. Unit Conversion II/3535.cpp	
+++ /dev/null
@@ -1,55 +0,0 @@
-class Solution {
- public:
-  vector<int> queryConversions(vector<vector<int>>& conversions,
-                               vector<vector<int>>& queries) {
-    const vector<int> units = baseUnitConversions(conversions);
-    vector<int> ans;
-
-    for (const vector<int>& query : queries) {
-      const int u = query[0];
-      const int v = query[1];
-      // By Fermat's little theorem.
-      ans.push_back(units[v] * modPow(units[u], kMod - 2) % kMod);
-    }
-
-    return ans;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  // Same as 3528. Unit Conversion I
-  vector<int> baseUnitConversions(vector<vector<int>>& conversions) {
-    const int n = conversions.size() + 1;
-    vector<int> res(n);
-    res[0] = 1;
-    queue<int> q{{0}};
-    vector<vector<pair<int, int>>> graph(n);
-
-    for (const vector<int>& conversion : conversions) {
-      const int u = conversion[0];
-      const int v = conversion[1];
-      const int factor = conversion[2];
-      graph[u].emplace_back(v, factor);
-    }
-
-    while (!q.empty()) {
-      const int u = q.front();
-      q.pop();
-      for (const auto& [v, factor] : graph[u]) {
-        res[v] = (static_cast<long>(res[u]) * factor) % kMod;
-        q.push(v);
-      }
-    }
-
-    return res;
-  }
-
-  long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x % kMod, (n - 1)) % kMod;
-    return modPow(x * x % kMod, (n / 2)) % kMod;
-  }
-};
diff --git a/solutions/3535. Unit Conversion II/3535.java b/solutions/3535. Unit Conversion II/3535.java
deleted file mode 100644
index 05bc8d961ed..00000000000
--- a/solutions/3535. Unit Conversion II/3535.java	
+++ /dev/null
@@ -1,55 +0,0 @@
-class Solution {
-  public int[] queryConversions(int[][] conversions, int[][] queries) {
-    int[] units = baseUnitConversions(conversions);
-    int[] ans = new int[queries.length];
-
-    for (int i = 0; i < queries.length; ++i) {
-      final int u = queries[i][0];
-      final int v = queries[i][1];
-      // By Fermat's little theorem.
-      ans[i] = (int) ((long) units[v] * modPow(units[u], MOD - 2) % MOD);
-    }
-
-    return ans;
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  private int[] baseUnitConversions(int[][] conversions) {
-    final int n = conversions.length + 1;
-    int[] ans = new int[n];
-    ans[0] = 1;
-    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(0));
-    List<Pair<Integer, Integer>>[] graph = new List[n];
-
-    for (int i = 0; i < n; i++)
-      graph[i] = new ArrayList<>();
-
-    for (int[] conversion : conversions) {
-      final int u = conversion[0];
-      final int v = conversion[1];
-      final int factor = conversion[2];
-      graph[u].add(new Pair<>(v, factor));
-    }
-
-    while (!q.isEmpty()) {
-      final int u = q.poll();
-      for (Pair<Integer, Integer> pair : graph[u]) {
-        final int v = pair.getKey();
-        final int factor = pair.getValue();
-        ans[v] = (int) ((long) ans[u] * factor % MOD);
-        q.offer(v);
-      }
-    }
-
-    return ans;
-  }
-
-  private int modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return (int) (x * modPow(x % MOD, (n - 1)) % MOD);
-    return modPow(x * x % MOD, (n / 2)) % MOD;
-  }
-}
diff --git a/solutions/3535. Unit Conversion II/3535.py b/solutions/3535. Unit Conversion II/3535.py
deleted file mode 100644
index dbb92714766..00000000000
--- a/solutions/3535. Unit Conversion II/3535.py	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution:
-  def queryConversions(
-      self,
-      conversions: list[list[int]],
-      queries: list[list[int]]
-  ) -> list[int]:
-    self.MOD = 1_000_000_007
-    units = self._baseUnitConversions(conversions)
-    # By Fermat's little theorem.
-    return [units[v] * self._modPow(units[u], self.MOD - 2) % self.MOD
-            for u, v in queries]
-
-  # Same as 3528. Unit Conversion I
-  def _baseUnitConversions(self, conversions: list[list[int]]) -> list[int]:
-    n = len(conversions) + 1
-    res = [0] * n
-    res[0] = 1
-    q = collections.deque([0])
-    graph = [[] for _ in range(n)]
-
-    for u, v, factor in conversions:
-      graph[u].append((v, factor))
-
-    while q:
-      u = q.popleft()
-      for v, factor in graph[u]:
-        res[v] = (res[u] * factor) % self.MOD
-        q.append(v)
-
-    return res
-
-  def _modPow(self, x: int, n: int) -> int:
-    if n == 0:
-      return 1
-    if n % 2 == 1:
-      return x * self._modPow(x, n - 1) % self.MOD
-    return self._modPow(x * x % self.MOD, n // 2)
diff --git a/solutions/3536. Maximum Product of Two Digits/3536.cpp b/solutions/3536. Maximum Product of Two Digits/3536.cpp
deleted file mode 100644
index 9139b185a2d..00000000000
--- a/solutions/3536. Maximum Product of Two Digits/3536.cpp	
+++ /dev/null
@@ -1,9 +0,0 @@
-class Solution {
- public:
-  int maxProduct(int n) {
-    string s = to_string(n);
-    ranges::sort(s);
-    const int sz = s.length();
-    return (s[sz - 1] - '0') * (s[sz - 2] - '0');
-  }
-};
diff --git a/solutions/3536. Maximum Product of Two Digits/3536.java b/solutions/3536. Maximum Product of Two Digits/3536.java
deleted file mode 100644
index bdeadfc2f92..00000000000
--- a/solutions/3536. Maximum Product of Two Digits/3536.java	
+++ /dev/null
@@ -1,8 +0,0 @@
-class Solution {
-  public int maxProduct(int n) {
-    char[] s = String.valueOf(n).toCharArray();
-    Arrays.sort(s);
-    final int sz = s.length;
-    return (s[sz - 1] - '0') * (s[sz - 2] - '0');
-  }
-}
diff --git a/solutions/3536. Maximum Product of Two Digits/3536.py b/solutions/3536. Maximum Product of Two Digits/3536.py
deleted file mode 100644
index b35dec3e10a..00000000000
--- a/solutions/3536. Maximum Product of Two Digits/3536.py	
+++ /dev/null
@@ -1,4 +0,0 @@
-class Solution:
-  def maxProduct(self, n: int) -> int:
-    s = sorted(str(n))
-    return int(s[-1]) * int(s[-2])
diff --git a/solutions/3537. Fill a Special Grid/3537.cpp b/solutions/3537. Fill a Special Grid/3537.cpp
deleted file mode 100644
index 5f29f827b1f..00000000000
--- a/solutions/3537. Fill a Special Grid/3537.cpp	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
- public:
-  vector<vector<int>> specialGrid(int n) {
-    const int sz = 1 << n;
-    int count = 0;
-    vector<vector<int>> grid(sz, vector<int>(sz));
-    fill(grid, 0, sz, 0, sz, count);
-    return grid;
-  }
-
-  void fill(vector<vector<int>>& grid, int x1, int x2, int y1, int y2,
-            int& count) {
-    if (x2 - x1 == 1) {
-      grid[x1][y1] = count++;
-      return;
-    }
-    const int midRow = (x1 + x2) / 2;
-    const int midCol = (y1 + y2) / 2;
-    fill(grid, x1, midRow, midCol, y2, count);
-    fill(grid, midRow, x2, midCol, y2, count);
-    fill(grid, midRow, x2, y1, midCol, count);
-    fill(grid, x1, midRow, y1, midCol, count);
-  }
-};
diff --git a/solutions/3537. Fill a Special Grid/3537.java b/solutions/3537. Fill a Special Grid/3537.java
deleted file mode 100644
index 90667d1196a..00000000000
--- a/solutions/3537. Fill a Special Grid/3537.java	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution {
-  public int[][] specialGrid(int n) {
-    final int sz = 1 << n;
-    int[][] grid = new int[sz][sz];
-    fill(grid, 0, sz, 0, sz);
-    return grid;
-  }
-
-  private int count = 0;
-
-  private void fill(int[][] grid, int x1, int x2, int y1, int y2) {
-    if (x2 - x1 == 1) {
-      grid[x1][y1] = count++;
-      return;
-    }
-    int midRow = (x1 + x2) / 2;
-    int midCol = (y1 + y2) / 2;
-    fill(grid, x1, midRow, midCol, y2);
-    fill(grid, midRow, x2, midCol, y2);
-    fill(grid, midRow, x2, y1, midCol);
-    fill(grid, x1, midRow, y1, midCol);
-  }
-}
diff --git a/solutions/3537. Fill a Special Grid/3537.py b/solutions/3537. Fill a Special Grid/3537.py
deleted file mode 100644
index 65fdbc006e0..00000000000
--- a/solutions/3537. Fill a Special Grid/3537.py	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution:
-  def specialGrid(self, n: int) -> list[list[int]]:
-    sz = 1 << n
-    grid = [[0] * sz for _ in range(sz)]
-    count = 0
-
-    def fill(x1: int, x2: int, y1: int, y2: int) -> None:
-      nonlocal count
-      if x2 - x1 == 1:
-        grid[x1][y1] = count
-        count += 1
-        return
-      midRow = (x1 + x2) // 2
-      midCol = (y1 + y2) // 2
-      fill(x1, midRow, midCol, y2)
-      fill(midRow, x2, midCol, y2)
-      fill(midRow, x2, y1, midCol)
-      fill(x1, midRow, y1, midCol)
-
-    fill(0, sz, 0, sz)
-    return grid
diff --git a/solutions/3538. Merge Operations for Minimum Travel Time/3538.py b/solutions/3538. Merge Operations for Minimum Travel Time/3538.py
deleted file mode 100644
index 912d72e7aca..00000000000
--- a/solutions/3538. Merge Operations for Minimum Travel Time/3538.py	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution:
-  def minTravelTime(
-      self,
-      l: int,
-      n: int,
-      k: int,
-      position: list[int],
-      time: list[int]
-  ) -> int:
-    prefix = list(itertools.accumulate(time))
-
-    @functools.lru_cache(None)
-    def dp(i: int, skips: int, last: int) -> int:
-      """
-      Returns the minimum travel time to reach the last stop from i-th stop,
-      with `skips` skips remaining, and the last stop being `last`.
-      """
-      if i == n - 1:
-        return 0 if skips == 0 else math.inf
-      res = math.inf
-      rate = prefix[i] - (prefix[last - 1] if last > 0 else 0)
-      end = min(n - 1, i + skips + 1)
-      for j in range(i + 1, end + 1):
-        distance = position[j] - position[i]
-        res = min(res, distance * rate + dp(j, skips - (j - i - 1), i + 1))
-      return res
-
-    return dp(0, k, 0)
diff --git a/solutions/3539. Find Sum of Array Product of Magical Sequences/3539.cpp b/solutions/3539. Find Sum of Array Product of Magical Sequences/3539.cpp
deleted file mode 100644
index 88d7e840e9a..00000000000
--- a/solutions/3539. Find Sum of Array Product of Magical Sequences/3539.cpp	
+++ /dev/null
@@ -1,56 +0,0 @@
-class Solution {
- public:
-  int magicalSum(int m, int k, vector<int>& nums) {
-    const vector<vector<int>> comb = getComb(m, m);
-    vector<vector<vector<vector<int>>>> mem(
-        m + 1, vector<vector<vector<int>>>(
-                   k + 1, vector<vector<int>>(nums.size() + 1,
-                                              vector<int>(m + 1, -1))));
-    return dp(m, k, 0, 0, nums, mem, comb);
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  int dp(int m, int k, int i, unsigned carry, const vector<int>& nums,
-         vector<vector<vector<vector<int>>>>& mem,
-         const vector<vector<int>>& comb) {
-    if (m < 0 || k < 0 || (m + popcount(carry) < k))
-      return 0;
-    if (m == 0)
-      return k == popcount(carry) ? 1 : 0;
-    if (i == nums.size())
-      return 0;
-    if (mem[m][k][i][carry] != -1)
-      return mem[m][k][i][carry];
-    int res = 0;
-    for (int count = 0; count <= m; ++count) {
-      const long contribution = comb[m][count] * modPow(nums[i], count) % kMod;
-      const int newCarry = carry + count;
-      res = (res + static_cast<long>(dp(m - count, k - (newCarry % 2), i + 1,
-                                        newCarry / 2, nums, mem, comb)) *
-                       contribution) %
-            kMod;
-    }
-    return mem[m][k][i][carry] = res;
-  }
-
-  // C(n, k) = C(n - 1, k) + C(n - 1, k - 1)
-  vector<vector<int>> getComb(int n, int k) {
-    vector<vector<int>> comb(n + 1, vector<int>(k + 1));
-    for (int i = 0; i <= n; ++i)
-      comb[i][0] = 1;
-    for (int i = 1; i <= n; ++i)
-      for (int j = 1; j <= k; ++j)
-        comb[i][j] = comb[i - 1][j] + comb[i - 1][j - 1];
-    return comb;
-  }
-
-  long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x % kMod, (n - 1)) % kMod;
-    return modPow(x * x % kMod, (n / 2)) % kMod;
-  }
-};
diff --git a/solutions/3539. Find Sum of Array Product of Magical Sequences/3539.java b/solutions/3539. Find Sum of Array Product of Magical Sequences/3539.java
deleted file mode 100644
index 796f9c130e6..00000000000
--- a/solutions/3539. Find Sum of Array Product of Magical Sequences/3539.java	
+++ /dev/null
@@ -1,49 +0,0 @@
-class Solution {
-  public int magicalSum(int m, int k, int[] nums) {
-    int[][] comb = getComb(m, m);
-    Integer[][][][] mem = new Integer[m + 1][k + 1][nums.length + 1][m + 1];
-    return dp(m, k, 0, 0, nums, mem, comb);
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  private int dp(int m, int k, int i, int carry, int[] nums, Integer[][][][] mem, int[][] comb) {
-    if (m < 0 || k < 0 || (m + Integer.bitCount(carry) < k))
-      return 0;
-    if (m == 0)
-      return k == Integer.bitCount(carry) ? 1 : 0;
-    if (i == nums.length)
-      return 0;
-    if (mem[m][k][i][carry] != null)
-      return mem[m][k][i][carry];
-    int res = 0;
-    for (int count = 0; count <= m; count++) {
-      final long contribution = comb[m][count] * modPow(nums[i], count) % MOD;
-      final int newCarry = carry + count;
-      res = (int) ((res +
-                    (long) dp(m - count, k - (newCarry % 2), i + 1, newCarry / 2, nums, mem, comb) *
-                        contribution) %
-                   MOD);
-    }
-    return mem[m][k][i][carry] = res;
-  }
-
-  // C(n, k) = C(n - 1, k) + C(n - 1, k - 1)
-  private int[][] getComb(int n, int k) {
-    int[][] comb = new int[n + 1][k + 1];
-    for (int i = 0; i <= n; i++)
-      comb[i][0] = 1;
-    for (int i = 1; i <= n; i++)
-      for (int j = 1; j <= k; j++)
-        comb[i][j] = (comb[i - 1][j] + comb[i - 1][j - 1]) % MOD;
-    return comb;
-  }
-
-  private long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x % MOD, n - 1) % MOD;
-    return modPow(x * x % MOD, n / 2) % MOD;
-  }
-}
diff --git a/solutions/3539. Find Sum of Array Product of Magical Sequences/3539.py b/solutions/3539. Find Sum of Array Product of Magical Sequences/3539.py
deleted file mode 100644
index f592c7fa791..00000000000
--- a/solutions/3539. Find Sum of Array Product of Magical Sequences/3539.py	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution:
-  def magicalSum(self, m: int, k: int, nums: list[int]) -> int:
-    MOD = 1_000_000_007
-
-    @functools.lru_cache(None)
-    def dp(m: int, k: int, i: int, carry: int) -> int:
-      """
-      Returns the number of magical sequences of length `k` that can be formed
-      from the first `i` numbers in `nums` with at most `m` elements.
-      """
-      if m < 0 or k < 0 or (m + carry.bit_count() < k):
-        return 0
-      if m == 0:
-        return int(k == carry.bit_count())
-      if i == len(nums):
-        return 0
-      res = 0
-      for count in range(m + 1):
-        contribution = math.comb(m, count) * pow(nums[i], count, MOD) % MOD
-        newCarry = carry + count
-        res += dp(m - count, k - (newCarry % 2),
-                  i + 1, newCarry // 2) * contribution
-        res %= MOD
-      return res
-
-    return dp(m, k, 0, 0)
diff --git a/solutions/354. Russian Doll Envelopes/354.cpp b/solutions/354. Russian Doll Envelopes/354.cpp
index 73220b843d1..21755faddbc 100644
--- a/solutions/354. Russian Doll Envelopes/354.cpp	
+++ b/solutions/354. Russian Doll Envelopes/354.cpp	
@@ -1,34 +1,29 @@
 class Solution {
  public:
   int maxEnvelopes(vector<vector<int>>& envelopes) {
-    ranges::sort(envelopes, ranges::less{}, [](const vector<int>& envelope) {
-      const int w = envelope[0];
-      const int h = envelope[1];
-      return pair<int, int>{w, -h};
+    ranges::sort(envelopes, [](const auto& a, const auto& b) {
+      return a[0] == b[0] ? a[1] > b[1] : a[0] < b[0];
     });
-    return lengthOfLIS(envelopes);
-  }
 
- private:
-  // Same to 300. Longest Increasing Subsequence
-  int lengthOfLIS(vector<vector<int>>& envelopes) {
-    // tails[i] := the minimum tail of all the increasing subsequences having
-    // length i + 1
-    vector<int> tails;
+    // Same as 300. Longest Increasing Subsequence
+    int ans = 0;
+    vector<int> dp(envelopes.size());
 
-    for (const vector<int>& envelope : envelopes) {
-      const int h = envelope[1];
-      if (tails.empty() || h > tails.back())
-        tails.push_back(h);
-      else
-        tails[firstGreaterEqual(tails, h)] = h;
+    for (const vector<int>& e : envelopes) {
+      int l = 0;
+      int r = ans;
+      while (l < r) {
+        const int m = (l + r) / 2;
+        if (dp[m] >= e[1])
+          r = m;
+        else
+          l = m + 1;
+      }
+      dp[l] = e[1];
+      if (l == ans)
+        ++ans;
     }
 
-    return tails.size();
-  }
-
- private:
-  int firstGreaterEqual(const vector<int>& arr, int target) {
-    return ranges::lower_bound(arr, target) - arr.begin();
+    return ans;
   }
 };
diff --git a/solutions/354. Russian Doll Envelopes/354.java b/solutions/354. Russian Doll Envelopes/354.java
index af58d7262d8..614afea0e6d 100644
--- a/solutions/354. Russian Doll Envelopes/354.java	
+++ b/solutions/354. Russian Doll Envelopes/354.java	
@@ -1,29 +1,20 @@
 class Solution {
   public int maxEnvelopes(int[][] envelopes) {
-    Arrays.sort(envelopes, Comparator.comparingInt((int[] envelope) -> envelope[0])
-                               .thenComparingInt((int[] envelope) -> - envelope[1]));
-    return lengthOfLIS(envelopes);
-  }
+    Arrays.sort(envelopes, (a, b) -> a[0] == b[0] ? b[1] - a[1] : a[0] - b[0]);
 
-  // Similar to 300. Longest Increasing Subsequence
-  private int lengthOfLIS(int[][] envelopes) {
-    // tails[i] := the minimum tail of all the increasing subsequences having
-    // length i + 1
-    List<Integer> tails = new ArrayList<>();
+    // Same as 300. Longest Increasing Subsequence
+    int ans = 0;
+    int[] dp = new int[envelopes.length];
 
-    for (final int[] envelope : envelopes) {
-      final int h = envelope[1];
-      if (tails.isEmpty() || h > tails.get(tails.size() - 1))
-        tails.add(h);
-      else
-        tails.set(firstGreaterEqual(tails, h), h);
+    for (int[] e : envelopes) {
+      int i = Arrays.binarySearch(dp, 0, ans, e[1]);
+      if (i < 0)
+        i = -(i + 1);
+      dp[i] = e[1];
+      if (i == ans)
+        ++ans;
     }
 
-    return tails.size();
-  }
-
-  private int firstGreaterEqual(List<Integer> arr, int target) {
-    final int i = Collections.binarySearch(arr, target);
-    return i < 0 ? -i - 1 : i;
+    return ans;
   }
 }
diff --git a/solutions/354. Russian Doll Envelopes/354.py b/solutions/354. Russian Doll Envelopes/354.py
index 216f478f3eb..878f69338a7 100644
--- a/solutions/354. Russian Doll Envelopes/354.py	
+++ b/solutions/354. Russian Doll Envelopes/354.py	
@@ -1,17 +1,21 @@
 class Solution:
-  def maxEnvelopes(self, envelopes: list[list[int]]) -> int:
+  def maxEnvelopes(self, envelopes: List[List[int]]) -> int:
     envelopes.sort(key=lambda x: (x[0], -x[1]))
-    return self._lengthOfLIS(envelopes)
-
-  def _lengthOfLIS(self, envelopes: list[list[int]]) -> int:
-    # tails[i] := the minimum tails of all the increasing subsequences having
-    # length i + 1
-    tails = []
+    # Same as 300. Longest Increasing Subsequence
+    ans = 0
+    dp = [0] * len(envelopes)
 
     for _, h in envelopes:
-      if not tails or h > tails[-1]:
-        tails.append(h)
-      else:
-        tails[bisect.bisect_left(tails, h)] = h
+      l = 0
+      r = ans
+      while l < r:
+        m = (l + r) // 2
+        if dp[m] >= h:
+          r = m
+        else:
+          l = m + 1
+      dp[l] = h
+      if l == ans:
+        ans += 1
 
-    return len(tails)
+    return ans
diff --git a/solutions/3540. Minimum Time to Visit All Houses/3540.cpp b/solutions/3540. Minimum Time to Visit All Houses/3540.cpp
deleted file mode 100644
index 9014bdd0574..00000000000
--- a/solutions/3540. Minimum Time to Visit All Houses/3540.cpp	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution {
- public:
-  long long minTotalTime(vector<int>& forward, vector<int>& backward,
-                         vector<int>& queries) {
-    const int n = forward.size();
-    const long sum = accumulate(backward.begin(), backward.end(), 0L);
-    long ans = 0;
-    int pos = 0;
-    vector<long> prefixF(n + 1);
-    vector<long> prefixB(n + 1);
-
-    for (int i = 0; i < n; ++i) {
-      prefixF[i + 1] = prefixF[i] + forward[i];
-      prefixB[i] = (i == 0 ? 0 : prefixB[i - 1]) + backward[i];
-    }
-
-    for (const int q : queries) {
-      const long r = (q < pos ? prefixF[n] : 0) + prefixF[q] - prefixF[pos];
-      const long l = (q > pos ? sum : 0) + prefixB[pos] - prefixB[q];
-      ans += min(l, r);
-      pos = q;
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3540. Minimum Time to Visit All Houses/3540.java b/solutions/3540. Minimum Time to Visit All Houses/3540.java
deleted file mode 100644
index 0449bb905d6..00000000000
--- a/solutions/3540. Minimum Time to Visit All Houses/3540.java	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
-  public long minTotalTime(int[] forward, int[] backward, int[] queries) {
-    final int n = forward.length;
-    final long sum = Arrays.stream(backward).asLongStream().sum();
-    long ans = 0;
-    int pos = 0;
-    long[] prefixF = new long[n + 1];
-    long[] prefixB = new long[n + 1];
-
-    for (int i = 0; i < n; i++) {
-      prefixF[i + 1] = prefixF[i] + forward[i];
-      prefixB[i] = (i == 0 ? 0 : prefixB[i - 1]) + backward[i];
-    }
-
-    for (final int q : queries) {
-      final long r = (q < pos ? prefixF[n] : 0) + prefixF[q] - prefixF[pos];
-      final long l = (q > pos ? sum : 0) + prefixB[pos] - prefixB[q];
-      ans += Math.min(l, r);
-      pos = q;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3540. Minimum Time to Visit All Houses/3540.py b/solutions/3540. Minimum Time to Visit All Houses/3540.py
deleted file mode 100644
index 0a0e6dc2ebb..00000000000
--- a/solutions/3540. Minimum Time to Visit All Houses/3540.py	
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-class Solution:
-  def minTotalTime(
-      self,
-      forward: list[int],
-      backward: list[int],
-      queries: list[int]
-  ) -> int:
-    summ = sum(backward)
-    ans = 0
-    pos = 0
-    prefixF = [0] + list(itertools.accumulate(forward))
-    prefixB = list(itertools.accumulate(backward)) + [0]
-
-    for q in queries:
-      r = int(q < pos) * prefixF[-1] + prefixF[q] - prefixF[pos]
-      l = int(q > pos) * summ + prefixB[pos] - prefixB[q]
-      ans += min(l, r)
-      pos = q
-
-    return ans
diff --git a/solutions/3541. Find Most Frequent Vowel and Consonant/3541.cpp b/solutions/3541. Find Most Frequent Vowel and Consonant/3541.cpp
deleted file mode 100644
index 4d7bc955efb..00000000000
--- a/solutions/3541. Find Most Frequent Vowel and Consonant/3541.cpp	
+++ /dev/null
@@ -1,25 +0,0 @@
-class Solution {
- public:
-  int maxFreqSum(string s) {
-    vector<int> count(26);
-    int maxVowel = 0;
-    int maxConsonant = 0;
-
-    for (const char c : s)
-      ++count[c - 'a'];
-
-    for (const char c : s)
-      if (isVowel(c))
-        maxVowel = max(maxVowel, count[c - 'a']);
-      else
-        maxConsonant = max(maxConsonant, count[c - 'a']);
-
-    return maxVowel + maxConsonant;
-  }
-
- private:
-  bool isVowel(char c) {
-    static constexpr string_view kVowels = "aeiou";
-    return kVowels.find(c) != string_view::npos;
-  }
-};
diff --git a/solutions/3541. Find Most Frequent Vowel and Consonant/3541.java b/solutions/3541. Find Most Frequent Vowel and Consonant/3541.java
deleted file mode 100644
index 10ccc209d2e..00000000000
--- a/solutions/3541. Find Most Frequent Vowel and Consonant/3541.java	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
-  public int maxFreqSum(String s) {
-    int[] count = new int[26];
-    int maxVowel = 0;
-    int maxConsonant = 0;
-
-    for (final char c : s.toCharArray())
-      ++count[c - 'a'];
-
-    for (final char c : s.toCharArray())
-      if (isVowel(c))
-        maxVowel = Math.max(maxVowel, count[c - 'a']);
-      else
-        maxConsonant = Math.max(maxConsonant, count[c - 'a']);
-
-    return maxVowel + maxConsonant;
-  }
-
-  private boolean isVowel(char c) {
-    return "aeiou".indexOf(c) != -1;
-  }
-}
diff --git a/solutions/3541. Find Most Frequent Vowel and Consonant/3541.py b/solutions/3541. Find Most Frequent Vowel and Consonant/3541.py
deleted file mode 100644
index 3ae91797e64..00000000000
--- a/solutions/3541. Find Most Frequent Vowel and Consonant/3541.py	
+++ /dev/null
@@ -1,7 +0,0 @@
-class Solution:
-  def maxFreqSum(self, s: str) -> int:
-    VOWELS = 'aeiou'
-    count = collections.Counter(s)
-    maxVowel = max((count[c] for c in VOWELS if c in count), default=0)
-    maxConsonant = max((count[c] for c in count if c not in VOWELS), default=0)
-    return maxVowel + maxConsonant
diff --git a/solutions/3542. Minimum Operations to Convert All Elements to Zero/3542.cpp b/solutions/3542. Minimum Operations to Convert All Elements to Zero/3542.cpp
deleted file mode 100644
index 169836ef193..00000000000
--- a/solutions/3542. Minimum Operations to Convert All Elements to Zero/3542.cpp	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
- public:
-  int minOperations(vector<int>& nums) {
-    int ans = 0;
-    stack<int> stack;
-    stack.push(0);
-
-    for (const int num : nums) {
-      while (!stack.empty() && stack.top() > num)
-        stack.pop();
-      if (stack.empty() || stack.top() < num) {
-        ++ans;
-        stack.push(num);
-      }
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3542. Minimum Operations to Convert All Elements to Zero/3542.java b/solutions/3542. Minimum Operations to Convert All Elements to Zero/3542.java
deleted file mode 100644
index e453597d7d1..00000000000
--- a/solutions/3542. Minimum Operations to Convert All Elements to Zero/3542.java	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
-  public int minOperations(int[] nums) {
-    int ans = 0;
-    Deque<Integer> stack = new ArrayDeque<>();
-    stack.push(0);
-
-    for (final int num : nums) {
-      while (!stack.isEmpty() && stack.peek() > num)
-        stack.pop();
-      if (stack.isEmpty() || stack.peek() < num) {
-        ++ans;
-        stack.push(num);
-      }
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3542. Minimum Operations to Convert All Elements to Zero/3542.py b/solutions/3542. Minimum Operations to Convert All Elements to Zero/3542.py
deleted file mode 100644
index cf439c242dd..00000000000
--- a/solutions/3542. Minimum Operations to Convert All Elements to Zero/3542.py	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution:
-  def minOperations(self, nums: list[int]) -> int:
-    ans = 0
-    stack = [0]
-
-    for num in nums:
-      while stack and stack[-1] > num:
-        stack.pop()
-      if not stack or stack[-1] < num:
-        ans += 1
-        stack.append(num)
-
-    return ans
diff --git a/solutions/3543. Maximum Weighted K-Edge Path/3543.cpp b/solutions/3543. Maximum Weighted K-Edge Path/3543.cpp
deleted file mode 100644
index d910292cc82..00000000000
--- a/solutions/3543. Maximum Weighted K-Edge Path/3543.cpp	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution {
- public:
-  int maxWeight(int n, vector<vector<int>>& edges, int k, int t) {
-    vector<vector<pair<int, int>>> graph(n);
-    // dp[u][i] := the set of possible path sums ending at node u with i edges
-    vector<unordered_map<int, unordered_set<int>>> dp(n);
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      const int w = edge[2];
-      graph[u].emplace_back(v, w);
-    }
-
-    for (int u = 0; u < n; ++u)
-      dp[u][0].insert(0);  // zero edges = sum 0
-
-    for (int i = 0; i < k; ++i)
-      for (int u = 0; u < n; ++u)
-        if (dp[u].contains(i))
-          for (const int currSum : dp[u][i])
-            for (const auto& [v, w] : graph[u]) {
-              const int newSum = currSum + w;
-              if (newSum < t)
-                dp[v][i + 1].insert(newSum);
-            }
-
-    int ans = -1;
-
-    for (int u = 0; u < n; ++u)
-      if (dp[u].contains(k))
-        for (const int sum : dp[u][k])
-          ans = max(ans, sum);
-
-    return ans;
-  }
-};
diff --git a/solutions/3543. Maximum Weighted K-Edge Path/3543.java b/solutions/3543. Maximum Weighted K-Edge Path/3543.java
deleted file mode 100644
index 9f4edc97136..00000000000
--- a/solutions/3543. Maximum Weighted K-Edge Path/3543.java	
+++ /dev/null
@@ -1,47 +0,0 @@
-class Solution {
-  public int maxWeight(int n, int[][] edges, int k, int t) {
-    List<Pair<Integer, Integer>>[] graph = new List[n];
-    // dp[i][j] := the set of possible path sums ending at node i with j edges
-    Map<Integer, Set<Integer>>[] dp = new Map[n];
-
-    for (int u = 0; u < n; ++u) {
-      graph[u] = new ArrayList<>();
-      dp[u] = new HashMap<>();
-    }
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      final int w = edge[2];
-      graph[u].add(new Pair<>(v, w));
-    }
-
-    for (int u = 0; u < n; ++u) {
-      dp[u].putIfAbsent(0, new HashSet<>());
-      dp[u].get(0).add(0); // zero edges = sum 0
-    }
-
-    for (int i = 0; i < k; ++i)
-      for (int u = 0; u < n; ++u)
-        if (dp[u].containsKey(i))
-          for (final int currSum : dp[u].get(i))
-            for (Pair<Integer, Integer> pair : graph[u]) {
-              final int v = pair.getKey();
-              final int w = pair.getValue();
-              final int newSum = currSum + w;
-              if (newSum < t) {
-                dp[v].putIfAbsent(i + 1, new HashSet<>());
-                dp[v].get(i + 1).add(newSum);
-              }
-            }
-
-    int ans = -1;
-
-    for (int u = 0; u < n; ++u)
-      if (dp[u].containsKey(k))
-        for (final int sum : dp[u].get(k))
-          ans = Math.max(ans, sum);
-
-    return ans;
-  }
-}
diff --git a/solutions/3543. Maximum Weighted K-Edge Path/3543.py b/solutions/3543. Maximum Weighted K-Edge Path/3543.py
deleted file mode 100644
index 8cb88d6ab26..00000000000
--- a/solutions/3543. Maximum Weighted K-Edge Path/3543.py	
+++ /dev/null
@@ -1,27 +0,0 @@
-class Solution:
-  def maxWeight(self, n: int, edges: list[list[int]], k: int, t: int) -> int:
-    graph = [[] for _ in range(n)]
-    # dp[u][i] := the set of possible path sums ending at node u with i edges
-    dp = [defaultdict(set) for _ in range(n)]
-
-    for u, v, w in edges:
-      graph[u].append((v, w))
-
-    for u in range(n):
-      dp[u][0].add(0)  # zero edges = sum 0
-
-    for i in range(k):
-      for u in range(n):
-        for currSum in dp[u][i]:
-          for v, w in graph[u]:
-            newSum = currSum + w
-            if newSum < t:
-              dp[v][i + 1].add(newSum)
-
-    ans = -1
-
-    for u in range(n):
-      if k in dp[u]:
-        ans = max(ans, max(dp[u][k]))
-
-    return ans
diff --git a/solutions/3544. Subtree Inversion Sum/3544.cpp b/solutions/3544. Subtree Inversion Sum/3544.cpp
deleted file mode 100644
index d54e109db82..00000000000
--- a/solutions/3544. Subtree Inversion Sum/3544.cpp	
+++ /dev/null
@@ -1,45 +0,0 @@
-class Solution {
- public:
-  long long subtreeInversionSum(vector<vector<int>>& edges, vector<int>& nums,
-                                int k) {
-    const int n = edges.size() + 1;
-    vector<int> parent(n, -1);
-    vector<vector<int>> graph(n);
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      graph[u].push_back(v);
-      graph[v].push_back(u);
-    }
-
-    vector<vector<vector<long>>> mem(
-        n, vector<vector<long>>(k + 1, vector<long>(2, -1)));
-    return dfs(graph, /*u=*/0, /*stepsSinceInversion=*/k,
-               /*inverted=*/false, nums, k, parent, mem);
-  }
-
- private:
-  // Returns the maximum sum for subtree rooted at u, with `stepsSinceInversion`
-  // steps of inversion and `inverted` is true if the subtree is inverted.
-  long dfs(const vector<vector<int>>& graph, int u, int stepsSinceInversion,
-           bool inverted, const vector<int>& nums, int k, vector<int>& parent,
-           vector<vector<vector<long>>>& mem) {
-    if (mem[u][stepsSinceInversion][inverted] != -1)
-      return mem[u][stepsSinceInversion][inverted];
-    long num = inverted ? -nums[u] : nums[u];
-    long negNum = -num;
-    for (const int v : graph[u]) {
-      if (v == parent[u])
-        continue;
-      parent[v] = u;
-      num += dfs(graph, v, min(k, stepsSinceInversion + 1), inverted, nums, k,
-                 parent, mem);
-      if (stepsSinceInversion == k)
-        negNum += dfs(graph, v, /*stepsSinceInversion=*/1, !inverted, nums, k,
-                      parent, mem);
-    }
-    return mem[u][stepsSinceInversion][inverted] =
-               (stepsSinceInversion == k) ? max(num, negNum) : num;
-  }
-};
diff --git a/solutions/3544. Subtree Inversion Sum/3544.java b/solutions/3544. Subtree Inversion Sum/3544.java
deleted file mode 100644
index 4b4afd86849..00000000000
--- a/solutions/3544. Subtree Inversion Sum/3544.java	
+++ /dev/null
@@ -1,37 +0,0 @@
-class Solution {
-  public long subtreeInversionSum(int[][] edges, int[] nums, int k) {
-    final int n = edges.length + 1;
-    int[] parent = new int[n];
-    List<Integer>[] graph = new List[n];
-    Arrays.fill(parent, -1);
-    Arrays.setAll(graph, i -> new ArrayList<>());
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      graph[u].add(v);
-      graph[v].add(u);
-    }
-
-    return dfs(graph, /*u=*/0, /*stepsSinceInversion=*/k,
-               /*inverted=*/false, nums, k, parent, new Long[n][k + 1][2]);
-  }
-
-  private long dfs(List<Integer>[] graph, int u, int stepsSinceInversion, boolean inverted,
-                   int[] nums, int k, int[] parent, Long[][][] mem) {
-    if (mem[u][stepsSinceInversion][inverted ? 1 : 0] != null)
-      return mem[u][stepsSinceInversion][inverted ? 1 : 0];
-    long num = inverted ? -nums[u] : nums[u];
-    long negNum = -num;
-    for (final int v : graph[u]) {
-      if (v == parent[u])
-        continue;
-      parent[v] = u;
-      num += dfs(graph, v, Math.min(k, stepsSinceInversion + 1), inverted, nums, k, parent, mem);
-      if (stepsSinceInversion == k)
-        negNum += dfs(graph, v, 1, !inverted, nums, k, parent, mem);
-    }
-    return mem[u][stepsSinceInversion][inverted ? 1 : 0] =
-               (stepsSinceInversion == k) ? Math.max(num, negNum) : num;
-  }
-}
diff --git a/solutions/3544. Subtree Inversion Sum/3544.py b/solutions/3544. Subtree Inversion Sum/3544.py
deleted file mode 100644
index eb2a42a55c2..00000000000
--- a/solutions/3544. Subtree Inversion Sum/3544.py	
+++ /dev/null
@@ -1,34 +0,0 @@
-class Solution:
-  def subtreeInversionSum(
-      self,
-      edges: list[list[int]],
-      nums: list[int],
-      k: int
-  ) -> int:
-    n = len(edges) + 1
-    parent = [-1] * n
-    graph = [[] for _ in range(n)]
-
-    for u, v in edges:
-      graph[u].append(v)
-      graph[v].append(u)
-
-    @functools.lru_cache(None)
-    def dp(u: int, stepsSinceInversion: int, inverted: bool) -> int:
-      """
-      Returns the maximum sum for subtree rooted at u, with
-      `stepsSinceInversion` steps of inversion and `inverted` is true if the
-      subtree is inverted.
-      """
-      num = -nums[u] if inverted else nums[u]
-      negNum = -num
-      for v in graph[u]:
-        if v == parent[u]:
-          continue
-        parent[v] = u
-        num += dp(v, min(k, stepsSinceInversion + 1), inverted)
-        if stepsSinceInversion == k:
-          negNum += dp(v, 1, not inverted)
-      return max(num, negNum) if stepsSinceInversion == k else num
-
-    return dp(0, k, False)
diff --git a/solutions/3545. Minimum Deletions for At Most K Distinct Characters/3545.cpp b/solutions/3545. Minimum Deletions for At Most K Distinct Characters/3545.cpp
deleted file mode 100644
index 6021a3a14fb..00000000000
--- a/solutions/3545. Minimum Deletions for At Most K Distinct Characters/3545.cpp	
+++ /dev/null
@@ -1,20 +0,0 @@
-class Solution {
- public:
-  int minDeletion(string s, int k) {
-    unordered_map<char, int> count;
-
-    for (const char c : s)
-      ++count[c];
-
-    if (count.size() <= k)
-      return 0;
-
-    vector<int> freqs;
-
-    for (const auto& [_, freq] : count)
-      freqs.push_back(freq);
-
-    ranges::sort(freqs);
-    return accumulate(freqs.begin(), freqs.begin() + freqs.size() - k, 0);
-  }
-};
diff --git a/solutions/3545. Minimum Deletions for At Most K Distinct Characters/3545.java b/solutions/3545. Minimum Deletions for At Most K Distinct Characters/3545.java
deleted file mode 100644
index d647bdc77b3..00000000000
--- a/solutions/3545. Minimum Deletions for At Most K Distinct Characters/3545.java	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution {
-  public int minDeletion(String s, int k) {
-    Map<Character, Integer> count = new HashMap<>();
-
-    for (final char c : s.toCharArray())
-      count.merge(c, 1, Integer::sum);
-
-    if (count.size() <= k)
-      return 0;
-
-    List<Integer> freqs = new ArrayList<>(count.values());
-    Collections.sort(freqs);
-    return freqs.subList(0, freqs.size() - k).stream().mapToInt(Integer::intValue).sum();
-  }
-}
diff --git a/solutions/3545. Minimum Deletions for At Most K Distinct Characters/3545.py b/solutions/3545. Minimum Deletions for At Most K Distinct Characters/3545.py
deleted file mode 100644
index d39c69bd118..00000000000
--- a/solutions/3545. Minimum Deletions for At Most K Distinct Characters/3545.py	
+++ /dev/null
@@ -1,7 +0,0 @@
-class Solution:
-  def minDeletion(self, s: str, k: int) -> int:
-    count = collections.Counter(s)
-    if len(count) <= k:
-      return 0
-    freqs = sorted(count.values())
-    return sum(freqs[:len(freqs) - k])
diff --git a/solutions/3546. Equal Sum Grid Partition I/3546.cpp b/solutions/3546. Equal Sum Grid Partition I/3546.cpp
deleted file mode 100644
index 58146cce184..00000000000
--- a/solutions/3546. Equal Sum Grid Partition I/3546.cpp	
+++ /dev/null
@@ -1,30 +0,0 @@
-class Solution {
- public:
-  bool canPartitionGrid(vector<vector<int>>& grid) {
-    const long totalSum = accumulate(grid.begin(), grid.end(), 0L,
-                                     [](long acc, const vector<int>& row) {
-      return acc + accumulate(row.begin(), row.end(), 0L);
-    });
-    return canPartition(grid, totalSum) ||
-           canPartition(transposed(grid), totalSum);
-  }
-
- private:
-  bool canPartition(const vector<vector<int>>& lines, long totalSum) {
-    long runningSum = 0;
-    for (const vector<int>& line : lines) {
-      runningSum += accumulate(line.begin(), line.end(), 0L);
-      if (runningSum * 2 == totalSum)
-        return true;
-    }
-    return false;
-  }
-
-  vector<vector<int>> transposed(const vector<vector<int>>& grid) {
-    vector<vector<int>> res(grid[0].size(), vector<int>(grid.size()));
-    for (int i = 0; i < grid.size(); ++i)
-      for (int j = 0; j < grid[0].size(); ++j)
-        res[j][i] = grid[i][j];
-    return res;
-  }
-};
diff --git a/solutions/3546. Equal Sum Grid Partition I/3546.java b/solutions/3546. Equal Sum Grid Partition I/3546.java
deleted file mode 100644
index 7b604101393..00000000000
--- a/solutions/3546. Equal Sum Grid Partition I/3546.java	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution {
-  public boolean canPartitionGrid(int[][] grid) {
-    final long totalSum = Arrays.stream(grid).flatMapToInt(Arrays::stream).asLongStream().sum();
-    return canPartition(grid, totalSum) || canPartition(transposed(grid), totalSum);
-  }
-
-  private boolean canPartition(int[][] lines, long totalSum) {
-    long runningSum = 0;
-    for (int[] line : lines) {
-      runningSum += Arrays.stream(line).asLongStream().sum();
-      if (runningSum * 2 == totalSum)
-        return true;
-    }
-    return false;
-  }
-
-  private int[][] transposed(int[][] grid) {
-    int[][] res = new int[grid[0].length][grid.length];
-    for (int i = 0; i < grid.length; ++i)
-      for (int j = 0; j < grid[0].length; ++j)
-        res[j][i] = grid[i][j];
-    return res;
-  }
-}
diff --git a/solutions/3546. Equal Sum Grid Partition I/3546.py b/solutions/3546. Equal Sum Grid Partition I/3546.py
deleted file mode 100644
index bbc4eb5cba4..00000000000
--- a/solutions/3546. Equal Sum Grid Partition I/3546.py	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution:
-  def canPartitionGrid(self, grid: list[list[int]]) -> bool:
-    totalSum = sum(map(sum, grid))
-
-    def canPartition(grid: list[list[int]]) -> bool:
-      runningSum = 0
-      for row in grid:
-        runningSum += sum(row)
-        if runningSum * 2 == totalSum:
-          return True
-      return False
-
-    return canPartition(grid) or canPartition(zip(*grid))
diff --git a/solutions/3547. Maximum Sum of Edge Values in a Graph/3547.cpp b/solutions/3547. Maximum Sum of Edge Values in a Graph/3547.cpp
deleted file mode 100644
index f3622446ce2..00000000000
--- a/solutions/3547. Maximum Sum of Edge Values in a Graph/3547.cpp	
+++ /dev/null
@@ -1,72 +0,0 @@
-class Solution {
- public:
-  long long maxScore(int n, vector<vector<int>>& edges) {
-    long ans = 0;
-    vector<vector<int>> graph(n);
-    vector<int> cycleSizes;  // components where all nodes have degree 2
-    vector<int> pathSizes;   // components that are not cycleSizes
-    vector<bool> seen(n);
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      graph[u].push_back(v);
-      graph[v].push_back(u);
-    }
-
-    for (int i = 0; i < n; ++i) {
-      if (seen[i])
-        continue;
-      const vector<int> component = getComponent(graph, i, seen);
-      const bool allDegree2 = ranges::all_of(
-          component, [&graph](int u) { return graph[u].size() == 2; });
-      if (allDegree2)
-        cycleSizes.push_back(component.size());
-      else if (component.size() > 1)
-        pathSizes.push_back(component.size());
-    }
-
-    for (const int cycleSize : cycleSizes) {
-      ans += calculateScore(n - cycleSize + 1, n, /*isCycle=*/true);
-      n -= cycleSize;
-    }
-
-    ranges::sort(pathSizes, greater<>());
-
-    for (const int pathSize : pathSizes) {
-      ans += calculateScore(n - pathSize + 1, n, /*isCycle=*/false);
-      n -= pathSize;
-    }
-
-    return ans;
-  }
-
- private:
-  vector<int> getComponent(const vector<vector<int>>& graph, int start,
-                           vector<bool>& seen) {
-    vector<int> component = {start};
-    seen[start] = true;
-    for (int i = 0; i < component.size(); ++i) {
-      const int u = component[i];
-      for (const int v : graph[u]) {
-        if (seen[v])
-          continue;
-        component.push_back(v);
-        seen[v] = true;
-      }
-    }
-    return component;
-  }
-
-  long calculateScore(int left, int right, bool isCycle) {
-    deque<long> window = {right, right};
-    long score = 0;
-    for (int value = right - 1; value >= left; --value) {
-      const long windowValue = window.front();
-      window.pop_front();
-      score += windowValue * value;
-      window.push_back(value);
-    }
-    return score + window[0] * window[1] * isCycle;
-  }
-};
diff --git a/solutions/3547. Maximum Sum of Edge Values in a Graph/3547.java b/solutions/3547. Maximum Sum of Edge Values in a Graph/3547.java
deleted file mode 100644
index d2b47a1e7a7..00000000000
--- a/solutions/3547. Maximum Sum of Edge Values in a Graph/3547.java	
+++ /dev/null
@@ -1,70 +0,0 @@
-class Solution {
-  public long maxScore(int n, int[][] edges) {
-    long ans = 0;
-    List<Integer>[] graph = new List[n];
-    List<Integer> cycleSizes = new ArrayList<>(); // components where all nodes have degree 2
-    List<Integer> pathSizes = new ArrayList<>();  // components that are not cycleSizes
-    boolean[] seen = new boolean[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      graph[u].add(v);
-      graph[v].add(u);
-    }
-
-    for (int i = 0; i < n; ++i) {
-      if (seen[i])
-        continue;
-      List<Integer> component = getComponent(graph, i, seen);
-      final boolean allDegree2 = component.stream().allMatch(u -> graph[u].size() == 2);
-      if (allDegree2)
-        cycleSizes.add(component.size());
-      else if (component.size() > 1)
-        pathSizes.add(component.size());
-    }
-
-    for (final int cycleSize : cycleSizes) {
-      ans += calculateScore(n - cycleSize + 1, n, true);
-      n -= cycleSize;
-    }
-
-    Collections.sort(pathSizes, Collections.reverseOrder());
-
-    for (final int pathSize : pathSizes) {
-      ans += calculateScore(n - pathSize + 1, n, false);
-      n -= pathSize;
-    }
-
-    return ans;
-  }
-
-  private List<Integer> getComponent(List<Integer>[] graph, int start, boolean[] seen) {
-    List<Integer> component = new ArrayList<>(List.of(start));
-    seen[start] = true;
-    for (int i = 0; i < component.size(); ++i) {
-      final int u = component.get(i);
-      for (final int v : graph[u]) {
-        if (seen[v])
-          continue;
-        component.add(v);
-        seen[v] = true;
-      }
-    }
-    return component;
-  }
-
-  private long calculateScore(int left, int right, boolean isCycle) {
-    Deque<Long> window = new ArrayDeque<>();
-    window.offerLast((long) right);
-    window.offerLast((long) right);
-    long score = 0;
-    for (int value = right - 1; value >= left; --value) {
-      final long windowValue = window.pollFirst();
-      score += windowValue * value;
-      window.offerLast((long) value);
-    }
-    return score + window.peekFirst() * window.peekLast() * (isCycle ? 1 : 0);
-  }
-}
diff --git a/solutions/3547. Maximum Sum of Edge Values in a Graph/3547.py b/solutions/3547. Maximum Sum of Edge Values in a Graph/3547.py
deleted file mode 100644
index 51e4d63d495..00000000000
--- a/solutions/3547. Maximum Sum of Edge Values in a Graph/3547.py	
+++ /dev/null
@@ -1,55 +0,0 @@
-class Solution:
-  def maxScore(self, n: int, edges: list[list[int]]) -> int:
-    ans = 0
-    graph = [[] for _ in range(n)]
-    cycleSizes = []  # components where all nodes have degree 2
-    pathSizes = []  # components that are not cycleSizes
-    seen = set()
-
-    for u, v in edges:
-      graph[u].append(v)
-      graph[v].append(u)
-
-    for i in range(n):
-      if i in seen:
-        continue
-      component = self._getComponent(graph, i, seen)
-      if all(len(graph[u]) == 2 for u in component):
-        cycleSizes.append(len(component))
-      elif len(component) > 1:
-        pathSizes.append(len(component))
-
-    for cycleSize in cycleSizes:
-      ans += self._calculateScore(n - cycleSize + 1, n, True)
-      n -= cycleSize
-
-    for pathSize in sorted(pathSizes, reverse=True):
-      ans += self._calculateScore(n - pathSize + 1, n, False)
-      n -= pathSize
-
-    return ans
-
-  def _getComponent(
-      self,
-      graph: list[list[int]],
-      start: int,
-      seen: set[int],
-  ) -> list[int]:
-    component = [start]
-    seen.add(start)
-    for u in component:
-      for v in graph[u]:
-        if v in seen:
-          continue
-        component.append(v)
-        seen.add(v)
-    return component
-
-  def _calculateScore(self, left: int, right: int, isCycle: bool) -> int:
-    window = collections.deque([right, right])
-    score = 0
-    for value in range(right - 1, left - 1, -1):
-      windowValue = window.popleft()
-      score += windowValue * value
-      window.append(value)
-    return score + window[0] * window[1] * isCycle
diff --git a/solutions/3548. Equal Sum Grid Partition II/3548.cpp b/solutions/3548. Equal Sum Grid Partition II/3548.cpp
deleted file mode 100644
index fd7f128f230..00000000000
--- a/solutions/3548. Equal Sum Grid Partition II/3548.cpp	
+++ /dev/null
@@ -1,41 +0,0 @@
-class Solution {
- public:
-  bool canPartitionGrid(vector<vector<int>>& grid) {
-    const long sum = accumulate(grid.begin(), grid.end(), 0L,
-                                [](long acc, const vector<int>& row) {
-      return acc + accumulate(row.begin(), row.end(), 0L);
-    });
-    return canPartition(grid, sum) || canPartition(reversed(grid), sum) ||
-           canPartition(reversed(transposed(grid)), sum) ||
-           canPartition(transposed(grid), sum);
-  }
-
- private:
-  bool canPartition(const vector<vector<int>>& grid, long sum) {
-    long topSum = 0;
-    unordered_set<int> seen;
-    for (int i = 0; i < grid.size(); ++i) {
-      topSum += accumulate(grid[i].begin(), grid[i].end(), 0L);
-      const long botSum = sum - topSum;
-      seen.insert(grid[i].begin(), grid[i].end());
-      if (topSum - botSum == 0 || topSum - botSum == grid[0][0] ||
-          topSum - botSum == grid[0].back() || topSum - botSum == grid[i][0])
-        return true;
-      if (grid[0].size() > 1 && i > 0 && seen.count(topSum - botSum))
-        return true;
-    }
-    return false;
-  }
-
-  vector<vector<int>> transposed(const vector<vector<int>>& grid) {
-    vector<vector<int>> res(grid[0].size(), vector<int>(grid.size()));
-    for (int i = 0; i < grid.size(); ++i)
-      for (int j = 0; j < grid[0].size(); ++j)
-        res[j][i] = grid[i][j];
-    return res;
-  }
-
-  vector<vector<int>> reversed(const vector<vector<int>>& grid) {
-    return {grid.rbegin(), grid.rend()};
-  }
-};
diff --git a/solutions/3548. Equal Sum Grid Partition II/3548.java b/solutions/3548. Equal Sum Grid Partition II/3548.java
deleted file mode 100644
index 6bfe1915c4e..00000000000
--- a/solutions/3548. Equal Sum Grid Partition II/3548.java	
+++ /dev/null
@@ -1,38 +0,0 @@
-class Solution {
-  public boolean canPartitionGrid(int[][] grid) {
-    final long sum = Arrays.stream(grid).flatMapToInt(Arrays::stream).asLongStream().sum();
-    return canPartition(grid, sum) || canPartition(reversed(grid), sum) ||
-        canPartition(reversed(transposed(grid)), sum) || canPartition(transposed(grid), sum);
-  }
-
-  private boolean canPartition(int[][] grid, long sum) {
-    long topSum = 0;
-    Set<Integer> seen = new HashSet<>();
-    for (int i = 0; i < grid.length; ++i) {
-      topSum += Arrays.stream(grid[i]).asLongStream().sum();
-      final long botSum = sum - topSum;
-      Arrays.stream(grid[i]).forEach(seen::add);
-      if (topSum - botSum == 0 || topSum - botSum == grid[0][0] ||
-          topSum - botSum == grid[0][grid[0].length - 1] || topSum - botSum == grid[i][0])
-        return true;
-      if (grid[0].length > 1 && i > 0 && seen.contains((int) (topSum - botSum)))
-        return true;
-    }
-    return false;
-  }
-
-  private int[][] transposed(int[][] grid) {
-    int[][] res = new int[grid[0].length][grid.length];
-    for (int i = 0; i < grid.length; ++i)
-      for (int j = 0; j < grid[0].length; ++j)
-        res[j][i] = grid[i][j];
-    return res;
-  }
-
-  private int[][] reversed(int[][] grid) {
-    return Arrays.stream(grid).collect(Collectors.collectingAndThen(Collectors.toList(), list -> {
-      Collections.reverse(list);
-      return list.toArray(new int[0][]);
-    }));
-  }
-}
diff --git a/solutions/3548. Equal Sum Grid Partition II/3548.py b/solutions/3548. Equal Sum Grid Partition II/3548.py
deleted file mode 100644
index 7b5a290cd86..00000000000
--- a/solutions/3548. Equal Sum Grid Partition II/3548.py	
+++ /dev/null
@@ -1,22 +0,0 @@
-
-class Solution:
-  def canPartitionGrid(self, grid: list[list[int]]) -> bool:
-    summ = sum(map(sum, grid))
-
-    def canPartition(grid: list[list[int]]) -> bool:
-      topSum = 0
-      seen = set()
-      for i, row in enumerate(grid):
-        topSum += sum(row)
-        botSum = summ - topSum
-        seen |= set(row)
-        if topSum - botSum in (0, grid[0][0],  grid[0][-1], row[0]):
-          return True
-        if len(grid[0]) > 1 and i > 0 and topSum - botSum in seen:
-          return True
-      return False
-
-    return (canPartition(grid) or
-            canPartition(grid[::-1]) or
-            canPartition(list(zip(*grid))[::-1]) or
-            canPartition(list(zip(*grid))))
diff --git a/solutions/3549. Multiply Two Polynomials/3549.cpp b/solutions/3549. Multiply Two Polynomials/3549.cpp
deleted file mode 100644
index 4d6fd250d7f..00000000000
--- a/solutions/3549. Multiply Two Polynomials/3549.cpp	
+++ /dev/null
@@ -1,76 +0,0 @@
-class Solution {
- public:
-  vector<long long> multiply(vector<int>& poly1, vector<int>& poly2) {
-    const unsigned n1 = poly1.size();
-    const unsigned n2 = poly2.size();
-    const unsigned n = n1 + n2 - 1;
-    const unsigned sz = 1 << std::bit_width(n - 1);
-
-    // Prepare input arrays for FFT.
-    vector<complex<double>> a(sz);
-    vector<complex<double>> b(sz);
-
-    // Copy polynomial coefficients to complex arrays.
-    for (int i = 0; i < n1; ++i)
-      a[i] = poly1[i];
-
-    for (int i = 0; i < n2; ++i)
-      b[i] = poly2[i];
-
-    // Transform polynomials to frequency domain.
-    fft(a, false);
-    fft(b, false);
-
-    // Multiply in frequency domain.
-    for (int i = 0; i < sz; ++i)
-      a[i] *= b[i];
-
-    // Transform back to coefficient domain.
-    fft(a, true);
-
-    // Extract real parts as polynomial coefficients.
-    vector<long long> ans(n);
-
-    for (int i = 0; i < n; ++i)
-      ans[i] = round(a[i].real());
-
-    return ans;
-  }
-
- private:
-  // Fast Fourier Transform.
-  void fft(vector<complex<double>>& a, bool inverse) {
-    const unsigned n = a.size();
-
-    // Bit-reversal permutation.
-    for (int i = 1, j = 0; i < n; ++i) {
-      int bit = n >> 1;
-      for (; j & bit; bit >>= 1)
-        j ^= bit;
-      j ^= bit;
-      if (i < j)
-        swap(a[i], a[j]);
-    }
-
-    // FFT computation.
-    for (int len = 2; len <= n; len *= 2) {
-      const double angle = 2 * M_PI / len * (inverse ? -1 : 1);
-      const complex<double> w_len(cos(angle), sin(angle));
-      for (int i = 0; i < n; i += len) {
-        complex<double> w(1);
-        for (int j = 0; j < len / 2; ++j) {
-          const complex<double> u = a[i + j];
-          const complex<double> v = a[i + j + len / 2] * w;
-          a[i + j] = u + v;
-          a[i + j + len / 2] = u - v;
-          w *= w_len;
-        }
-      }
-    }
-
-    // Normalize if inverse transform.
-    if (inverse)
-      for (complex<double>& x : a)
-        x /= n;
-  }
-};
diff --git a/solutions/3549. Multiply Two Polynomials/3549.java b/solutions/3549. Multiply Two Polynomials/3549.java
deleted file mode 100644
index d213fb21ef3..00000000000
--- a/solutions/3549. Multiply Two Polynomials/3549.java	
+++ /dev/null
@@ -1,116 +0,0 @@
-class Complex {
-  public double real;
-  public double imag;
-
-  public Complex(double real, double imag) {
-    this.real = real;
-    this.imag = imag;
-  }
-
-  public Complex add(Complex other) {
-    return new Complex(this.real + other.real, this.imag + other.imag);
-  }
-
-  public Complex subtract(Complex other) {
-    return new Complex(this.real - other.real, this.imag - other.imag);
-  }
-
-  public Complex multiply(Complex other) {
-    return new Complex(this.real * other.real - this.imag * other.imag,
-                       this.real * other.imag + this.imag * other.real);
-  }
-
-  public Complex divide(double scalar) {
-    return new Complex(this.real / scalar, this.imag / scalar);
-  }
-}
-
-class Solution {
-  public long[] multiply(int[] poly1, int[] poly2) {
-    final int n1 = poly1.length;
-    final int n2 = poly2.length;
-    final int n = n1 + n2 - 1;
-    final int sz = 1 << bitLength(n - 1);
-
-    // Prepare input arrays for FFT.
-    Complex[] a = new Complex[sz];
-    Complex[] b = new Complex[sz];
-
-    // Initialize arrays with Complex objects
-    for (int i = 0; i < sz; ++i) {
-      a[i] = new Complex(0, 0);
-      b[i] = new Complex(0, 0);
-    }
-
-    // Copy polynomial coefficients to complex arrays.
-    for (int i = 0; i < n1; ++i)
-      a[i] = new Complex(poly1[i], 0);
-
-    for (int i = 0; i < n2; ++i)
-      b[i] = new Complex(poly2[i], 0);
-
-    // Transform polynomials to frequency domain.
-    fft(a, false);
-    fft(b, false);
-
-    // Multiply in frequency domain.
-    for (int i = 0; i < sz; ++i)
-      a[i] = a[i].multiply(b[i]);
-
-    // Transform back to coefficient domain.
-    fft(a, true);
-
-    // Extract real parts as polynomial coefficients.
-    long[] ans = new long[n];
-
-    for (int i = 0; i < n; ++i)
-      ans[i] = Math.round(a[i].real);
-
-    return ans;
-  }
-
-  private void fft(Complex[] a, boolean inverse) {
-    final int n = a.length;
-
-    // Bit-reversal permutation.
-    for (int i = 1, j = 0; i < n; ++i) {
-      int bit = n >> 1;
-      for (; (j & bit) != 0; bit >>= 1)
-        j ^= bit;
-      j ^= bit;
-      if (i < j)
-        swap(a, i, j);
-    }
-
-    // FFT computation.
-    for (int len = 2; len <= n; len *= 2) {
-      final double angle = 2 * Math.PI / len * (inverse ? -1 : 1);
-      final Complex wLen = new Complex(Math.cos(angle), Math.sin(angle));
-      for (int i = 0; i < n; i += len) {
-        Complex w = new Complex(1, 0);
-        for (int j = 0; j < len / 2; ++j) {
-          final Complex u = a[i + j];
-          final Complex v = a[i + j + len / 2].multiply(w);
-          a[i + j] = u.add(v);
-          a[i + j + len / 2] = u.subtract(v);
-          w = w.multiply(wLen);
-        }
-      }
-    }
-
-    // Normalize if inverse transform.
-    if (inverse)
-      for (int i = 0; i < n; ++i)
-        a[i] = a[i].divide(n);
-  }
-
-  private void swap(Complex[] a, int i, int j) {
-    Complex temp = a[i];
-    a[i] = a[j];
-    a[j] = temp;
-  }
-
-  private int bitLength(int n) {
-    return Integer.SIZE - Integer.numberOfLeadingZeros(n);
-  }
-}
diff --git a/solutions/3549. Multiply Two Polynomials/3549.py b/solutions/3549. Multiply Two Polynomials/3549.py
deleted file mode 100644
index ff6c4a89436..00000000000
--- a/solutions/3549. Multiply Two Polynomials/3549.py	
+++ /dev/null
@@ -1,14 +0,0 @@
-from numpy import array, round
-from numpy.fft import fft, ifft
-
-
-class Solution:
-  def multiply(self, poly1: list[int], poly2: list[int]) -> list[int]:
-    n1 = len(poly1)
-    n2 = len(poly2)
-    n = n1 + n2 - 1
-    sz = 1 << (n - 1).bit_length()
-    arr1 = array(poly1 + [0] * (sz - n1))
-    arr2 = array(poly2 + [0] * (sz - n2))
-    ans = ifft(fft(arr1) * fft(arr2))
-    return round(ans).astype(int).tolist()[:n]
diff --git a/solutions/355. Design Twitter/355.cpp b/solutions/355. Design Twitter/355.cpp
index 5a9eca07f05..af25f48fd82 100644
--- a/solutions/355. Design Twitter/355.cpp	
+++ b/solutions/355. Design Twitter/355.cpp	
@@ -2,6 +2,7 @@ struct Tweet {
   int id;
   int time;
   Tweet* next = nullptr;
+  Tweet(int id, int time) : id(id), time(time) {}
 };
 
 struct User {
diff --git a/solutions/355. Design Twitter/355.java b/solutions/355. Design Twitter/355.java
index e11097f520e..a377ae822a8 100644
--- a/solutions/355. Design Twitter/355.java	
+++ b/solutions/355. Design Twitter/355.java	
@@ -50,8 +50,7 @@ public List<Integer> getNewsFeed(int userId) {
       return new ArrayList<>();
 
     List<Integer> newsFeed = new ArrayList<>();
-    Queue<Tweet> maxHeap =
-        new PriorityQueue<>(Comparator.comparingInt((Tweet tweet) -> - tweet.time));
+    Queue<Tweet> maxHeap = new PriorityQueue<>((a, b) -> b.time - a.time);
 
     for (final int followeeId : users.get(userId).followeeIds) {
       Tweet tweetHead = users.get(followeeId).tweetHead;
diff --git a/solutions/355. Design Twitter/355.py b/solutions/355. Design Twitter/355.py
index de810fa6f7b..f16bd08e529 100644
--- a/solutions/355. Design Twitter/355.py	
+++ b/solutions/355. Design Twitter/355.py	
@@ -9,12 +9,9 @@ def postTweet(self, userId: int, tweetId: int) -> None:
     if len(self.tweets[userId]) > 10:
       self.tweets[userId].pop()
 
-  def getNewsFeed(self, userId: int) -> list[int]:
-    tweets = list(
-        heapq.merge(
-            *
-            (self.tweets[followee]
-             for followee in self.followees[userId] | {userId})))
+  def getNewsFeed(self, userId: int) -> List[int]:
+    tweets = list(heapq.merge(
+        *(self.tweets[followee] for followee in self.followees[userId] | {userId})))
     return [tweetId for _, tweetId in tweets[:10]]
 
   def follow(self, followerId: int, followeeId: int) -> None:
diff --git a/solutions/3550. Smallest Index With Digit Sum Equal to Index/3550.cpp b/solutions/3550. Smallest Index With Digit Sum Equal to Index/3550.cpp
deleted file mode 100644
index 779e29f9adc..00000000000
--- a/solutions/3550. Smallest Index With Digit Sum Equal to Index/3550.cpp	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
- public:
-  int smallestIndex(vector<int>& nums) {
-    for (int i = 0; i < nums.size(); ++i)
-      if (getDigitSum(nums[i]) == i)
-        return i;
-    return -1;
-  }
-
- private:
-  int getDigitSum(int num) {
-    int sum = 0;
-    while (num > 0) {
-      sum += num % 10;
-      num /= 10;
-    }
-    return sum;
-  }
-};
diff --git a/solutions/3550. Smallest Index With Digit Sum Equal to Index/3550.java b/solutions/3550. Smallest Index With Digit Sum Equal to Index/3550.java
deleted file mode 100644
index 9d56c32f511..00000000000
--- a/solutions/3550. Smallest Index With Digit Sum Equal to Index/3550.java	
+++ /dev/null
@@ -1,17 +0,0 @@
-class Solution {
-  public int smallestIndex(int[] nums) {
-    for (int i = 0; i < nums.length; ++i)
-      if (getDigitSum(nums[i]) == i)
-        return i;
-    return -1;
-  }
-
-  private int getDigitSum(int num) {
-    int sum = 0;
-    while (num > 0) {
-      sum += num % 10;
-      num /= 10;
-    }
-    return sum;
-  }
-}
diff --git a/solutions/3550. Smallest Index With Digit Sum Equal to Index/3550.py b/solutions/3550. Smallest Index With Digit Sum Equal to Index/3550.py
deleted file mode 100644
index 6c3fbf41b21..00000000000
--- a/solutions/3550. Smallest Index With Digit Sum Equal to Index/3550.py	
+++ /dev/null
@@ -1,8 +0,0 @@
-class Solution:
-  def smallestIndex(self, nums: List[int]) -> int:
-    return next((i
-                 for i, num in enumerate(nums)
-                 if self._getDigitSum(num) == i), -1)
-
-  def _getDigitSum(self, num: int) -> int:
-    return sum(int(digit) for digit in str(num))
diff --git a/solutions/3551. Minimum Swaps to Sort by Digit Sum/3551.cpp b/solutions/3551. Minimum Swaps to Sort by Digit Sum/3551.cpp
deleted file mode 100644
index bbd3a7ed85f..00000000000
--- a/solutions/3551. Minimum Swaps to Sort by Digit Sum/3551.cpp	
+++ /dev/null
@@ -1,40 +0,0 @@
-class Solution {
- public:
-  int minSwaps(vector<int>& nums) {
-    int ans = 0;
-    unordered_set<int> seen;
-    unordered_map<int, int> numToIndex;
-    vector<int> sortedNums = nums;
-
-    ranges::sort(sortedNums, ranges::less{}, [this](int num) {
-      return pair<int, int>{getDigitSum(num), num};
-    });
-
-    for (int i = 0; i < sortedNums.size(); ++i)
-      numToIndex[sortedNums[i]] = i;
-
-    for (int i = 0; i < nums.size(); ++i) {
-      if (seen.contains(i) || numToIndex[nums[i]] == i)
-        continue;
-      int cycleSize = 0;
-      int j = i;
-      while (seen.insert(j).second) {
-        j = numToIndex[nums[j]];
-        ++cycleSize;
-      }
-      ans += max(cycleSize - 1, 0);
-    }
-
-    return ans;
-  }
-
- private:
-  int getDigitSum(int num) {
-    int sum = 0;
-    while (num > 0) {
-      sum += num % 10;
-      num /= 10;
-    }
-    return sum;
-  }
-};
diff --git a/solutions/3551. Minimum Swaps to Sort by Digit Sum/3551.java b/solutions/3551. Minimum Swaps to Sort by Digit Sum/3551.java
deleted file mode 100644
index 88b1670e55f..00000000000
--- a/solutions/3551. Minimum Swaps to Sort by Digit Sum/3551.java	
+++ /dev/null
@@ -1,39 +0,0 @@
-class Solution {
-  public int minSwaps(int[] nums) {
-    int ans = 0;
-    Set<Integer> seen = new HashSet<>();
-    Map<Integer, Integer> numToIndex = new HashMap<>();
-    int[] sortedNums = Arrays.stream(nums)
-                           .boxed()
-                           .sorted(Comparator.comparingInt((Integer num) -> getDigitSum(num))
-                                       .thenComparingInt(num -> num))
-                           .mapToInt(Integer::intValue)
-                           .toArray();
-
-    for (int i = 0; i < sortedNums.length; ++i)
-      numToIndex.put(sortedNums[i], i);
-
-    for (int i = 0; i < nums.length; ++i) {
-      if (seen.contains(i) || numToIndex.get(nums[i]) == i)
-        continue;
-      int cycleSize = 0;
-      int j = i;
-      while (seen.add(j)) {
-        j = numToIndex.get(nums[j]);
-        ++cycleSize;
-      }
-      ans += Math.max(cycleSize - 1, 0);
-    }
-
-    return ans;
-  }
-
-  private int getDigitSum(int num) {
-    int sum = 0;
-    while (num > 0) {
-      sum += num % 10;
-      num /= 10;
-    }
-    return sum;
-  }
-}
diff --git a/solutions/3551. Minimum Swaps to Sort by Digit Sum/3551.py b/solutions/3551. Minimum Swaps to Sort by Digit Sum/3551.py
deleted file mode 100644
index 207ca9299df..00000000000
--- a/solutions/3551. Minimum Swaps to Sort by Digit Sum/3551.py	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution:
-  def minSwaps(self, nums: list[int]) -> int:
-    ans = 0
-    seen = set()
-    sortedNums = sorted(nums, key=lambda x: (self._getDigitSum(x), x))
-    numToIndex = {num: i for i, num in enumerate(sortedNums)}
-
-    for i, num in enumerate(nums):
-      if i in seen or numToIndex[num] == i:
-        continue
-      cycleSize = 0
-      j = i
-      while j not in seen:
-        seen.add(j)
-        j = numToIndex[nums[j]]
-        cycleSize += 1
-      ans += max(cycleSize - 1, 0)
-    return ans
-
-  def _getDigitSum(self, num: int) -> int:
-    return sum(int(digit) for digit in str(num))
diff --git a/solutions/3552. Grid Teleportation Traversal/3552.cpp b/solutions/3552. Grid Teleportation Traversal/3552.cpp
deleted file mode 100644
index ca0da9c513a..00000000000
--- a/solutions/3552. Grid Teleportation Traversal/3552.cpp	
+++ /dev/null
@@ -1,67 +0,0 @@
-class Solution {
- public:
-  // Similar to 3341. Find Minimum Time to Reach Last Room I
-  int minMoves(vector<string>& matrix) {
-    if (matrix.back().back() == '#')
-      return -1;
-
-    vector<vector<pair<int, int>>> teleportPositions(26);
-
-    for (int i = 0; i < matrix.size(); ++i)
-      for (int j = 0; j < matrix[0].size(); ++j)
-        if (matrix[i][j] != '.' && matrix[i][j] != '#')
-          teleportPositions[matrix[i][j] - 'A'].emplace_back(i, j);
-
-    return dijkstra(matrix, teleportPositions, {0, 0},
-                    {matrix.size() - 1, matrix[0].size() - 1});
-  }
-
- private:
-  int dijkstra(const vector<string>& matrix,
-               const vector<vector<pair<int, int>>>& teleportPositions,
-               const pair<int, int>& src, const pair<int, int>& dst) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-    const int m = matrix.size();
-    const int n = matrix[0].size();
-    vector<vector<int>> dist(m, vector<int>(n, INT_MAX));
-    vector<bool> seen(26);
-
-    dist[0][0] = 0;
-    using T = pair<int, pair<int, int>>;  // (d, u)
-    priority_queue<T, vector<T>, greater<>> minHeap;
-    minHeap.push({dist[0][0], src});
-
-    while (!minHeap.empty()) {
-      const auto [d, u] = minHeap.top();
-      minHeap.pop();
-      if (u == dst)
-        return d;
-      const auto [i, j] = u;
-      if (d > dist[i][j])
-        continue;
-      const char c = matrix[i][j];
-      if (isupper(c) && !seen[c - 'A']) {
-        seen[c - 'A'] = true;
-        for (const auto& [x, y] : teleportPositions[c - 'A'])
-          if (d < dist[x][y]) {
-            dist[x][y] = d;
-            minHeap.push({d, {x, y}});
-          }
-      }
-      for (const auto& [dx, dy] : kDirs) {
-        const int x = i + dx;
-        const int y = j + dy;
-        if (x < 0 || x == m || y < 0 || y == n)
-          continue;
-        if (matrix[x][y] == '#')
-          continue;
-        if (d + 1 < dist[x][y]) {
-          dist[x][y] = d + 1;
-          minHeap.push({d + 1, {x, y}});
-        }
-      }
-    }
-
-    return -1;
-  }
-};
diff --git a/solutions/3552. Grid Teleportation Traversal/3552.java b/solutions/3552. Grid Teleportation Traversal/3552.java
deleted file mode 100644
index 638371ed838..00000000000
--- a/solutions/3552. Grid Teleportation Traversal/3552.java	
+++ /dev/null
@@ -1,75 +0,0 @@
-class Solution {
-  // Similar to 3341. Find Minimum Time to Reach Last Room I
-  public int minMoves(String[] matrix) {
-    if (matrix[matrix.length - 1].charAt(matrix[0].length() - 1) == '#')
-      return -1;
-
-    List<Pair<Integer, Integer>>[] teleportPositions = new ArrayList[26];
-
-    for (int i = 0; i < 26; ++i)
-      teleportPositions[i] = new ArrayList<>();
-
-    for (int i = 0; i < matrix.length; ++i)
-      for (int j = 0; j < matrix[0].length(); ++j) {
-        final char c = matrix[i].charAt(j);
-        if (c != '.' && c != '#')
-          teleportPositions[c - 'A'].add(new Pair<>(i, j));
-      }
-
-    return dijkstra(matrix, teleportPositions, new Pair<>(0, 0),
-                    new Pair<>(matrix.length - 1, matrix[0].length() - 1));
-  }
-
-  private int dijkstra(String[] matrix, List<Pair<Integer, Integer>>[] teleportPositions,
-                       Pair<Integer, Integer> src, Pair<Integer, Integer> dst) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-    final int m = matrix.length;
-    final int n = matrix[0].length();
-    int[][] dist = new int[m][n];
-    Arrays.stream(dist).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE));
-    boolean[] seen = new boolean[26];
-
-    dist[0][0] = 0;
-    Queue<Pair<Integer, Pair<Integer, Integer>>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey)) {
-          { offer(new Pair<>(dist[0][0], src)); } // (d, u)
-        };
-
-    while (!minHeap.isEmpty()) {
-      final int d = minHeap.peek().getKey();
-      final Pair<Integer, Integer> u = minHeap.poll().getValue();
-      if (u.equals(dst))
-        return d;
-      final int i = u.getKey();
-      final int j = u.getValue();
-      if (d > dist[i][j])
-        continue;
-      final char c = matrix[i].charAt(j);
-      if (Character.isUpperCase(c) && !seen[c - 'A']) {
-        seen[c - 'A'] = true;
-        for (Pair<Integer, Integer> pos : teleportPositions[c - 'A']) {
-          final int x = pos.getKey();
-          final int y = pos.getValue();
-          if (d < dist[x][y]) {
-            dist[x][y] = d;
-            minHeap.offer(new Pair<>(d, new Pair<>(x, y)));
-          }
-        }
-      }
-      for (int[] dir : DIRS) {
-        final int x = i + dir[0];
-        final int y = j + dir[1];
-        if (x < 0 || x == m || y < 0 || y == n)
-          continue;
-        if (matrix[x].charAt(y) == '#')
-          continue;
-        if (d + 1 < dist[x][y]) {
-          dist[x][y] = d + 1;
-          minHeap.offer(new Pair<>(d + 1, new Pair<>(x, y)));
-        }
-      }
-    }
-
-    return -1;
-  }
-}
diff --git a/solutions/3552. Grid Teleportation Traversal/3552.py b/solutions/3552. Grid Teleportation Traversal/3552.py
deleted file mode 100644
index 6c481836823..00000000000
--- a/solutions/3552. Grid Teleportation Traversal/3552.py	
+++ /dev/null
@@ -1,58 +0,0 @@
-class Solution:
-  # Similar to 3341. Find Minimum Time to Reach Last Room I
-  def minMoves(self, matrix: list[str]) -> int:
-    if matrix[-1][-1] == '#':
-      return -1
-
-    teleportPositions = [[] for _ in range(26)]
-
-    for i, row in enumerate(matrix):
-      for j, c in enumerate(row):
-        if c not in ('.', '#'):
-          teleportPositions[ord(c) - ord('A')].append((i, j))
-
-    return self._dijkstra(matrix, teleportPositions,
-                          (0, 0), (len(matrix) - 1, len(matrix[0]) - 1))
-
-  def _dijkstra(
-      self,
-      matrix: list[str],
-      teleportPositions: list[list[tuple[int, int]]],
-      src: tuple[int, int],
-      dst: tuple[int, int],
-  ) -> int:
-    DIRS = [(0, 1), (1, 0), (0, -1), (-1, 0)]
-    m = len(matrix)
-    n = len(matrix[0])
-    dist = [[math.inf] * n for _ in range(m)]
-    seen = set()
-
-    dist[0][0] = 0
-    minHeap = [(dist[0][0], src)]  # (d, u)
-
-    while minHeap:
-      d, u = heapq.heappop(minHeap)
-      if u == dst:
-        return d
-      i, j = u
-      if d > dist[i][j]:
-        continue
-      c = matrix[i][j]
-      if c.isupper() and c not in seen:
-        seen.add(c)
-        for x, y in teleportPositions[ord(c) - ord('A')]:
-          if d < dist[x][y]:
-            dist[x][y] = d
-            heapq.heappush(minHeap, (d, (x, y)))
-      for dx, dy in DIRS:
-        x = i + dx
-        y = j + dy
-        if x < 0 or x == m or y < 0 or y == n:
-          continue
-        if matrix[x][y] == '#':
-          continue
-        if d + 1 < dist[x][y]:
-          dist[x][y] = d + 1
-          heapq.heappush(minHeap, (d + 1, (x, y)))
-
-    return -1
diff --git a/solutions/3553. Minimum Weighted Subgraph With the Required Paths II/3553.cpp b/solutions/3553. Minimum Weighted Subgraph With the Required Paths II/3553.cpp
deleted file mode 100644
index 71d33bc3ddc..00000000000
--- a/solutions/3553. Minimum Weighted Subgraph With the Required Paths II/3553.cpp	
+++ /dev/null
@@ -1,84 +0,0 @@
-class Solution {
- public:
-  // Similar to 2846. Minimum Edge Weight Equilibrium Queries in a Tree
-  vector<int> minimumWeight(vector<vector<int>>& edges,
-                            vector<vector<int>>& queries) {
-    const int n = edges.size() + 1;
-    const int m = ceil(log2(n));
-    vector<int> ans;
-    vector<vector<pair<int, int>>> graph(n);
-    // jump[i][j] := the 2^j-th ancestor of i
-    vector<vector<int>> jump(n, vector<int>(m));
-    // depth[i] := the depth of i
-    vector<int> depth(n);
-    // dist[i] := the distance from root to i
-    vector<int> dist(n);
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      const int w = edge[2];
-      graph[u].emplace_back(v, w);
-      graph[v].emplace_back(u, w);
-    }
-
-    dfs(graph, 0, /*prev=*/-1, jump, depth, dist);
-
-    for (int j = 1; j < m; ++j)
-      for (int i = 0; i < n; ++i)
-        jump[i][j] = jump[jump[i][j - 1]][j - 1];
-
-    for (const vector<int>& query : queries) {
-      const int src1 = query[0];
-      const int src2 = query[1];
-      const int dest = query[2];
-      ans.push_back((distance(src1, src2, jump, depth, dist) +
-                     distance(src1, dest, jump, depth, dist) +
-                     distance(src2, dest, jump, depth, dist)) /
-                    2);
-    }
-
-    return ans;
-  }
-
- private:
-  void dfs(const vector<vector<pair<int, int>>>& graph, int u, int prev,
-           vector<vector<int>>& jump, vector<int>& depth, vector<int>& dist) {
-    for (const auto& [v, w] : graph[u]) {
-      if (v == prev)
-        continue;
-      jump[v][0] = u;
-      depth[v] = depth[u] + 1;
-      dist[v] = dist[u] + w;
-      dfs(graph, v, u, jump, depth, dist);
-    }
-  }
-
-  // Returns the lca(u, v) by binary jump.
-  int getLCA(int u, int v, const vector<vector<int>>& jump,
-             const vector<int>& depth) {
-    // v is always deeper than u.
-    if (depth[u] > depth[v])
-      return getLCA(v, u, jump, depth);
-    // Jump v to the same height of u.
-    for (int j = 0; j < jump[0].size(); ++j)
-      if (depth[v] - depth[u] >> j & 1)
-        v = jump[v][j];
-    if (u == v)
-      return u;
-    // Jump u and v to the node right below the lca.
-    for (int j = jump[0].size() - 1; j >= 0; --j)
-      if (jump[u][j] != jump[v][j]) {
-        u = jump[u][j];
-        v = jump[v][j];
-      }
-    return jump[u][0];
-  }
-
-  // Returns the distance between u and v.
-  int distance(int u, int v, const vector<vector<int>>& jump,
-               const vector<int>& depth, const vector<int>& dist) {
-    const int lca = getLCA(u, v, jump, depth);
-    return dist[u] + dist[v] - 2 * dist[lca];
-  }
-};
diff --git a/solutions/3553. Minimum Weighted Subgraph With the Required Paths II/3553.java b/solutions/3553. Minimum Weighted Subgraph With the Required Paths II/3553.java
deleted file mode 100644
index 440139d97f2..00000000000
--- a/solutions/3553. Minimum Weighted Subgraph With the Required Paths II/3553.java	
+++ /dev/null
@@ -1,81 +0,0 @@
-class Solution {
-  // Similar to 2846. Minimum Edge Weight Equilibrium Queries in a Tree
-  public int[] minimumWeight(int[][] edges, int[][] queries) {
-    final int n = edges.length + 1;
-    final int m = (int) Math.ceil(Math.log(n) / Math.log(2));
-    int[] ans = new int[queries.length];
-    List<Pair<Integer, Integer>>[] graph = new List[n];
-    // jump[i][j] := the 2^j-th ancestor of i
-    int[][] jump = new int[n][m];
-    // depth[i] := the depth of i
-    int[] depth = new int[n];
-    // dist[i] := the distance from root to i
-    int[] dist = new int[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      final int w = edge[2];
-      graph[u].add(new Pair<>(v, w));
-      graph[v].add(new Pair<>(u, w));
-    }
-
-    dfs(graph, 0, /*prev=*/-1, jump, depth, dist);
-
-    for (int j = 1; j < m; ++j)
-      for (int i = 0; i < n; ++i)
-        jump[i][j] = jump[jump[i][j - 1]][j - 1];
-
-    for (int i = 0; i < queries.length; ++i) {
-      final int src1 = queries[i][0];
-      final int src2 = queries[i][1];
-      final int dest = queries[i][2];
-      ans[i] = (distance(src1, src2, jump, depth, dist) + distance(src1, dest, jump, depth, dist) +
-                distance(src2, dest, jump, depth, dist)) /
-               2;
-    }
-
-    return ans;
-  }
-
-  private void dfs(List<Pair<Integer, Integer>>[] graph, int u, int prev, int[][] jump, int[] depth,
-                   int[] dist) {
-    for (Pair<Integer, Integer> pair : graph[u]) {
-      final int v = pair.getKey();
-      final int w = pair.getValue();
-      if (v == prev)
-        continue;
-      jump[v][0] = u;
-      depth[v] = depth[u] + 1;
-      dist[v] = dist[u] + w;
-      dfs(graph, v, u, jump, depth, dist);
-    }
-  }
-
-  // Returns the lca(u, v) by binary jump.
-  private int getLCA(int u, int v, int[][] jump, int[] depth) {
-    // v is always deeper than u.
-    if (depth[u] > depth[v])
-      return getLCA(v, u, jump, depth);
-    // Jump v to the same height of u.
-    for (int j = 0; j < jump[0].length; ++j)
-      if ((depth[v] - depth[u] >> j & 1) == 1)
-        v = jump[v][j];
-    if (u == v)
-      return u;
-    // Jump u and v to the node right below the lca.
-    for (int j = jump[0].length - 1; j >= 0; --j)
-      if (jump[u][j] != jump[v][j]) {
-        u = jump[u][j];
-        v = jump[v][j];
-      }
-    return jump[u][0];
-  }
-
-  // Returns the distance between u and v.
-  private int distance(int u, int v, int[][] jump, int[] depth, int[] dist) {
-    final int lca = getLCA(u, v, jump, depth);
-    return dist[u] + dist[v] - 2 * dist[lca];
-  }
-}
diff --git a/solutions/3553. Minimum Weighted Subgraph With the Required Paths II/3553.py b/solutions/3553. Minimum Weighted Subgraph With the Required Paths II/3553.py
deleted file mode 100644
index 56a1dae548d..00000000000
--- a/solutions/3553. Minimum Weighted Subgraph With the Required Paths II/3553.py	
+++ /dev/null
@@ -1,81 +0,0 @@
-class Solution:
-  # Similar to 2846. Minimum Edge Weight Equilibrium Queries in a Tree
-  def minimumWeight(
-      self,
-      edges: list[list[int]],
-      queries: list[list[int]]
-  ) -> list[int]:
-    n = len(edges) + 1
-    m = math.ceil(math.log2(n))
-    graph = [[] for _ in range(n)]
-    jump = [[0] * m for _ in range(n)]  # jump[i][j] := the 2^j-th ancestor of i
-    depth = [0] * n  # depth[i] := the depth of i
-    dist = [0] * n  # dist[i] := the distance from root to i
-
-    for u, v, w in edges:
-      graph[u].append((v, w))
-      graph[v].append((u, w))
-
-    self._dfs(graph, 0, -1, jump, depth, dist)
-
-    for j in range(1, m):
-      for i in range(n):
-        jump[i][j] = jump[jump[i][j - 1]][j - 1]
-
-    return [(self._distance(src1, src2, jump, depth, dist) +
-             self._distance(src1, dest, jump, depth, dist) +
-             self._distance(src2, dest, jump, depth, dist)) // 2
-            for src1, src2, dest in queries]
-
-  def _dfs(
-      self,
-      graph: list[list[tuple[int, int]]],
-      u: int,
-      prev: int,
-      jump: list[list[int]],
-      depth: list[int],
-      dist: list[int]
-  ) -> None:
-    for v, w in graph[u]:
-      if v == prev:
-        continue
-      jump[v][0] = u
-      depth[v] = depth[u] + 1
-      dist[v] = dist[u] + w
-      self._dfs(graph, v, u, jump, depth, dist)
-
-  def _getLCA(
-      self,
-      u: int,
-      v: int,
-      jump: list[list[int]],
-      depth: list[int]
-  ) -> int:
-    """Returns the lca(u, v) by binary jump."""
-    # v is always deeper than u.
-    if depth[u] > depth[v]:
-      return self._getLCA(v, u, jump, depth)
-    # Jump v to the same height of u.
-    for j in range(len(jump[0])):
-      if depth[v] - depth[u] >> j & 1:
-        v = jump[v][j]
-    if u == v:
-      return u
-    # Jump u and v to the node right below the lca.
-    for j in range(len(jump[0]) - 1, -1, -1):
-      if jump[u][j] != jump[v][j]:
-        u = jump[u][j]
-        v = jump[v][j]
-    return jump[u][0]
-
-  def _distance(
-      self,
-      u: int,
-      v: int,
-      jump: list[list[int]],
-      depth: list[int],
-      dist: list[int]
-  ) -> int:
-    """Returns the distance between u and v."""
-    lca = self._getLCA(u, v, jump, depth)
-    return dist[u] + dist[v] - 2 * dist[lca]
diff --git a/solutions/3554. Find Category Recommendation Pairs/3554.sql b/solutions/3554. Find Category Recommendation Pairs/3554.sql
deleted file mode 100644
index 041130513a2..00000000000
--- a/solutions/3554. Find Category Recommendation Pairs/3554.sql	
+++ /dev/null
@@ -1,41 +0,0 @@
-WITH
-  UserCategories AS (
-    SELECT DISTINCT
-      ProductPurchases.user_id,
-      ProductInfo.category
-    FROM ProductPurchases
-    INNER JOIN ProductInfo
-      USING (product_id)
-  ),
-  CategoryPairs AS (
-    SELECT
-      UserCategories.user_id,
-      LEAST(
-        UserCategories.category,
-        UserCategories2.category
-      ) AS category1,
-      GREATEST(
-        UserCategories.category,
-        UserCategories2.category
-      ) AS category2
-    FROM UserCategories
-    INNER JOIN UserCategories AS UserCategories2
-      ON (
-        UserCategories.user_id = UserCategories2.user_id
-        AND UserCategories.category < UserCategories2.category)
-  ),
-  PairCustomerCounts AS (
-    SELECT
-      category1,
-      category2,
-      COUNT(DISTINCT user_id) AS customer_count
-    FROM CategoryPairs
-    GROUP BY 1, 2
-  )
-SELECT
-  category1,
-  category2,
-  customer_count
-FROM PairCustomerCounts
-WHERE customer_count >= 3
-ORDER BY customer_count DESC, category1, category2;
diff --git a/solutions/3555. Smallest Subarray to Sort in Every Sliding Window/3555.cpp b/solutions/3555. Smallest Subarray to Sort in Every Sliding Window/3555.cpp
deleted file mode 100644
index 4fcc4ab4184..00000000000
--- a/solutions/3555. Smallest Subarray to Sort in Every Sliding Window/3555.cpp	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution {
- public:
-  vector<int> minSubarraySort(vector<int>& nums, int k) {
-    const int n = nums.size();
-    vector<int> ans;
-
-    for (int i = 0; i <= n - k; ++i) {
-      vector<int> window(nums.begin() + i, nums.begin() + i + k);
-      vector<int> sortedWindow = window;
-      ranges::sort(sortedWindow);
-      int l = 0;
-      int r = k - 1;
-      while (l < k && window[l] == sortedWindow[l])
-        ++l;
-      while (r >= 0 && window[r] == sortedWindow[r])
-        --r;
-      ans.push_back(l > r ? 0 : r - l + 1);
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3555. Smallest Subarray to Sort in Every Sliding Window/3555.java b/solutions/3555. Smallest Subarray to Sort in Every Sliding Window/3555.java
deleted file mode 100644
index 24cbc3c23c3..00000000000
--- a/solutions/3555. Smallest Subarray to Sort in Every Sliding Window/3555.java	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution {
-  public int[] minSubarraySort(int[] nums, int k) {
-    final int n = nums.length;
-    int[] ans = new int[n - k + 1];
-
-    for (int i = 0; i <= n - k; ++i) {
-      int[] window = Arrays.copyOfRange(nums, i, i + k);
-      int[] sortedWindow = window.clone();
-      Arrays.sort(sortedWindow);
-      int l = 0;
-      int r = k - 1;
-      while (l < k && window[l] == sortedWindow[l])
-        ++l;
-      while (r >= 0 && window[r] == sortedWindow[r])
-        --r;
-      ans[i] = l > r ? 0 : r - l + 1;
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3555. Smallest Subarray to Sort in Every Sliding Window/3555.py b/solutions/3555. Smallest Subarray to Sort in Every Sliding Window/3555.py
deleted file mode 100644
index 4749e695af2..00000000000
--- a/solutions/3555. Smallest Subarray to Sort in Every Sliding Window/3555.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  def minSubarraySort(self, nums: list[int], k):
-    ans = []
-
-    for i in range(len(nums) - k + 1):
-      window = nums[i:i+k]
-      sortedWindow = sorted(window)
-      l = 0
-      r = k - 1
-      while l < k and window[l] == sortedWindow[l]:
-        l += 1
-      while r >= 0 and window[r] == sortedWindow[r]:
-        r -= 1
-      ans.append(0 if l > r else r - l + 1)
-
-    return ans
diff --git a/solutions/3556. Sum of Largest Prime Substrings/3556.cpp b/solutions/3556. Sum of Largest Prime Substrings/3556.cpp
deleted file mode 100644
index 209b0bbf5b5..00000000000
--- a/solutions/3556. Sum of Largest Prime Substrings/3556.cpp	
+++ /dev/null
@@ -1,31 +0,0 @@
-class Solution {
- public:
-  long long sumOfLargestPrimes(string s) {
-    const int n = s.length();
-    unordered_set<long> primes;
-
-    for (int i = 0; i < n; ++i)
-      for (int j = i + 1; j <= n; ++j) {
-        const long num = stol(s.substr(i, j - i));
-        if (!primes.contains(num) && isPrime(num))
-          primes.insert(num);
-      }
-
-    vector<long> sortedPrimes{primes.begin(), primes.end()};
-    ranges::sort(sortedPrimes, greater<>());
-    return accumulate(
-        sortedPrimes.begin(),
-        sortedPrimes.begin() + min(3, static_cast<int>(sortedPrimes.size())),
-        0L);
-  }
-
- private:
-  bool isPrime(long num) {
-    if (num <= 1)
-      return false;
-    for (int i = 2; i <= sqrt(num); ++i)
-      if (num % i == 0)
-        return false;
-    return true;
-  }
-};
diff --git a/solutions/3556. Sum of Largest Prime Substrings/3556.java b/solutions/3556. Sum of Largest Prime Substrings/3556.java
deleted file mode 100644
index 4b464f6aa2d..00000000000
--- a/solutions/3556. Sum of Largest Prime Substrings/3556.java	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution {
-  public long sumOfLargestPrimes(String s) {
-    final int n = s.length();
-    Set<Long> primes = new HashSet<>();
-
-    for (int i = 0; i < n; ++i)
-      for (int j = i + 1; j <= n; ++j) {
-        final long num = Long.parseLong(s.substring(i, j));
-        if (!primes.contains(num) && isPrime(num))
-          primes.add(num);
-      }
-
-    List<Long> sortedPrimes = new ArrayList<>(primes);
-    Collections.sort(sortedPrimes, Collections.reverseOrder());
-    return sortedPrimes.stream().limit(3).mapToLong(Long::longValue).sum();
-  }
-
-  private boolean isPrime(long num) {
-    if (num <= 1)
-      return false;
-    for (int i = 2; i <= Math.sqrt(num); i++)
-      if (num % i == 0)
-        return false;
-    return true;
-  }
-}
diff --git a/solutions/3556. Sum of Largest Prime Substrings/3556.py b/solutions/3556. Sum of Largest Prime Substrings/3556.py
deleted file mode 100644
index dfa12758a7e..00000000000
--- a/solutions/3556. Sum of Largest Prime Substrings/3556.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  def sumOfLargestPrimes(self, s: str) -> int:
-    primes = set()
-    n = len(s)
-
-    for i in range(n):
-      for j in range(i + 1, n + 1):
-        num = int(s[i:j])
-        if num not in primes and self._isPrime(num):
-          primes.add(num)
-
-    top3 = sorted(primes, reverse=True)[:3]
-    return sum(top3)
-
-  def _isPrime(self, n: int) -> bool:
-    return n > 1 and all(n % i != 0 for i in range(2, math.isqrt(n) + 1))
diff --git a/solutions/3557. Find Maximum Number of Non Intersecting Substrings/3557.cpp b/solutions/3557. Find Maximum Number of Non Intersecting Substrings/3557.cpp
deleted file mode 100644
index 5655683becb..00000000000
--- a/solutions/3557. Find Maximum Number of Non Intersecting Substrings/3557.cpp	
+++ /dev/null
@@ -1,19 +0,0 @@
-class Solution {
- public:
-  int maxSubstrings(string word) {
-    int ans = 0;
-    unordered_map<char, int> firstSeen;
-
-    for (int i = 0; i < word.length(); ++i) {
-      const char c = word[i];
-      if (!firstSeen.contains(c)) {
-        firstSeen[c] = i;
-      } else if (i - firstSeen[c] + 1 >= 4) {
-        ++ans;
-        firstSeen.clear();
-      }
-    }
-
-    return ans;
-  }
-};
diff --git a/solutions/3557. Find Maximum Number of Non Intersecting Substrings/3557.java b/solutions/3557. Find Maximum Number of Non Intersecting Substrings/3557.java
deleted file mode 100644
index 0b631eb6d7e..00000000000
--- a/solutions/3557. Find Maximum Number of Non Intersecting Substrings/3557.java	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
-  public int maxSubstrings(String word) {
-    int ans = 0;
-    Map<Character, Integer> firstSeen = new HashMap<>();
-
-    for (int i = 0; i < word.length(); ++i) {
-      final char c = word.charAt(i);
-      if (!firstSeen.containsKey(c)) {
-        firstSeen.put(c, i);
-      } else if (i - firstSeen.get(c) + 1 >= 4) {
-        ++ans;
-        firstSeen.clear();
-      }
-    }
-
-    return ans;
-  }
-}
diff --git a/solutions/3557. Find Maximum Number of Non Intersecting Substrings/3557.py b/solutions/3557. Find Maximum Number of Non Intersecting Substrings/3557.py
deleted file mode 100644
index 76c5f54371b..00000000000
--- a/solutions/3557. Find Maximum Number of Non Intersecting Substrings/3557.py	
+++ /dev/null
@@ -1,13 +0,0 @@
-class Solution:
-  def maxSubstrings(self, word: str) -> int:
-    ans = 0
-    firstSeen = {}
-
-    for i, c in enumerate(word):
-      if c not in firstSeen:
-        firstSeen[c] = i
-      elif i - firstSeen[c] + 1 >= 4:
-        ans += 1
-        firstSeen.clear()
-
-    return ans
diff --git a/solutions/3558. Number of Ways to Assign Edge Weights I/3558.cpp b/solutions/3558. Number of Ways to Assign Edge Weights I/3558.cpp
deleted file mode 100644
index bf7ded6430e..00000000000
--- a/solutions/3558. Number of Ways to Assign Edge Weights I/3558.cpp	
+++ /dev/null
@@ -1,43 +0,0 @@
-class Solution {
- public:
-  int assignEdgeWeights(vector<vector<int>>& edges) {
-    const int n = edges.size() + 1;
-    vector<vector<int>> graph(n + 1);
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      graph[u].push_back(v);
-      graph[v].push_back(u);
-    }
-
-    queue<int> q{{1}};
-    vector<bool> seen(n + 1);
-    seen[1] = true;
-    int step = 0;
-
-    for (step = 0; !q.empty(); ++step)
-      for (int sz = q.size(); sz > 0; --sz) {
-        const int u = q.front();
-        q.pop();
-        for (const int v : graph[u])
-          if (!seen[v]) {
-            q.push(v);
-            seen[v] = true;
-          }
-      }
-
-    return step > 0 ? modPow(2, step - 2) : 0;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-
-  long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x % kMod, (n - 1)) % kMod;
-    return modPow(x * x % kMod, (n / 2)) % kMod;
-  }
-};
diff --git a/solutions/3558. Number of Ways to Assign Edge Weights I/3558.java b/solutions/3558. Number of Ways to Assign Edge Weights I/3558.java
deleted file mode 100644
index bbfc6876a73..00000000000
--- a/solutions/3558. Number of Ways to Assign Edge Weights I/3558.java	
+++ /dev/null
@@ -1,41 +0,0 @@
-class Solution {
-  public int assignEdgeWeights(int[][] edges) {
-    final int n = edges.size() + 1;
-    List<Integer>[] graph = new List[n + 1];
-    Arrays.setAll(graph, i -> new ArrayList<>());
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      graph[u].add(v);
-      graph[v].add(u);
-    }
-
-    Queue<Integer> q = new ArrayDeque<>(List.of(1));
-    boolean[] seen = new boolean[n + 1];
-    seen[1] = true;
-
-    int step = 0;
-    for (step = 0; !q.isEmpty(); ++step)
-      for (int sz = q.size(); sz > 0; --sz) {
-        final int u = q.poll();
-        for (final int v : graph[u])
-          if (!seen[v]) {
-            q.offer(v);
-            seen[v] = true;
-          }
-      }
-
-    return step > 0 ? modPow(2, step - 2) : 0;
-  }
-
-  private static final int MOD = 1_000_000_007;
-
-  private int modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return (int) (x * modPow(x % MOD, (n - 1)) % MOD);
-    return modPow(x * x % MOD, (n / 2)) % MOD;
-  }
-}
diff --git a/solutions/3558. Number of Ways to Assign Edge Weights I/3558.py b/solutions/3558. Number of Ways to Assign Edge Weights I/3558.py
deleted file mode 100644
index f0da08a6d72..00000000000
--- a/solutions/3558. Number of Ways to Assign Edge Weights I/3558.py	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution:
-  def assignEdgeWeights(self, edges: list[list[int]]) -> int:
-    MOD = 1_000_000_007
-    n = len(edges) + 1
-    graph = [[] for _ in range(n + 1)]
-
-    for u, v in edges:
-      graph[u].append(v)
-      graph[v].append(u)
-
-    q = collections.deque([1])
-    seen = {1}
-
-    step = 0
-    while q:
-      for _ in range(len(q)):
-        u = q.popleft()
-        for v in graph[u]:
-          if v not in seen:
-            q.append(v)
-            seen.add(v)
-      step += 1
-
-    return pow(2, step - 2, MOD) if step > 0 else 0
diff --git a/solutions/3559. Number of Ways to Assign Edge Weights II/3559.cpp b/solutions/3559. Number of Ways to Assign Edge Weights II/3559.cpp
deleted file mode 100644
index c6d3ff66b99..00000000000
--- a/solutions/3559. Number of Ways to Assign Edge Weights II/3559.cpp	
+++ /dev/null
@@ -1,82 +0,0 @@
-class Solution {
- public:
-  vector<int> assignEdgeWeights(vector<vector<int>>& edges,
-                                vector<vector<int>>& queries) {
-    const int n = edges.size() + 1;
-    vector<int> ans;
-    vector<int> depth(n + 1);
-    vector<vector<int>> graph(n + 1);
-    vector<vector<int>> parent(kLog, vector<int>(n + 1, -1));
-
-    for (const vector<int>& edge : edges) {
-      const int u = edge[0];
-      const int v = edge[1];
-      graph[u].push_back(v);
-      graph[v].push_back(u);
-    }
-
-    dfs(1, -1, graph, parent, depth);
-
-    for (int k = 1; k < kLog; ++k)
-      for (int v = 1; v <= n; ++v)
-        if (parent[k - 1][v] != -1)
-          parent[k][v] = parent[k - 1][parent[k - 1][v]];
-
-    for (const vector<int>& query : queries) {
-      const int u = query[0];
-      const int v = query[1];
-      if (u == v) {
-        ans.push_back(0);
-      } else {
-        const int a = lca(u, v, parent, depth);
-        const int d = depth[u] + depth[v] - 2 * depth[a];
-        ans.push_back(modPow(2, d - 1));
-      }
-    }
-
-    return ans;
-  }
-
- private:
-  static constexpr int kMod = 1'000'000'007;
-  static constexpr int kLog = 17;  // since 2^17 > 1e5
-
-  void dfs(int u, int p, const vector<vector<int>>& graph,
-           vector<vector<int>>& parent, vector<int>& depth) {
-    parent[0][u] = p;
-    for (const int v : graph[u])
-      if (v != p) {
-        depth[v] = depth[u] + 1;
-        dfs(v, u, graph, parent, depth);
-      }
-  }
-
-  int lca(int u, int v, const vector<vector<int>>& parent,
-          const vector<int>& depth) {
-    if (depth[u] < depth[v])
-      swap(u, v);
-
-    for (int k = kLog - 1; k >= 0; --k)
-      if (parent[k][u] != -1 && depth[parent[k][u]] >= depth[v])
-        u = parent[k][u];
-
-    if (u == v)
-      return u;
-
-    for (int k = kLog - 1; k >= 0; --k)
-      if (parent[k][u] != -1 && parent[k][u] != parent[k][v]) {
-        u = parent[k][u];
-        v = parent[k][v];
-      }
-
-    return parent[0][u];
-  }
-
-  long modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return x * modPow(x % kMod, (n - 1)) % kMod;
-    return modPow(x * x % kMod, (n / 2)) % kMod;
-  }
-};
diff --git a/solutions/3559. Number of Ways to Assign Edge Weights II/3559.java b/solutions/3559. Number of Ways to Assign Edge Weights II/3559.java
deleted file mode 100644
index e67d794cea5..00000000000
--- a/solutions/3559. Number of Ways to Assign Edge Weights II/3559.java	
+++ /dev/null
@@ -1,82 +0,0 @@
-class Solution {
-  public int[] assignEdgeWeights(int[][] edges, int[][] queries) {
-    final int n = edges.length + 1;
-    int[] ans = new int[queries.length];
-    final int[] depth = new int[n + 1];
-    final int[][] parent = new int[LOG][n + 1];
-    List<Integer>[] graph = new List[n + 1];
-    Arrays.setAll(graph, i -> new ArrayList<>());
-
-    for (int[] edge : edges) {
-      final int u = edge[0];
-      final int v = edge[1];
-      graph[u].add(v);
-      graph[v].add(u);
-    }
-
-    dfs(1, -1, graph, parent, depth);
-
-    for (int k = 1; k < LOG; ++k)
-      for (int v = 1; v <= n; ++v)
-        if (parent[k - 1][v] != -1)
-          parent[k][v] = parent[k - 1][parent[k - 1][v]];
-
-    for (int i = 0; i < queries.length; ++i) {
-      final int u = queries[i][0];
-      final int v = queries[i][1];
-      if (u == v) {
-        ans[i] = 0;
-      } else {
-        final int a = lca(u, v, parent, depth);
-        final int d = depth[u] + depth[v] - 2 * depth[a];
-        ans[i] = modPow(2, d - 1);
-      }
-    }
-
-    return ans;
-  }
-
-  private static final int MOD = 1_000_000_007;
-  private static final int LOG = 17; // since 2^17 > 1e5
-
-  private void dfs(int u, int p, java.util.List<Integer>[] graph, int[][] parent, int[] depth) {
-    parent[0][u] = p;
-    for (int v : graph[u]) {
-      if (v != p) {
-        depth[v] = depth[u] + 1;
-        dfs(v, u, graph, parent, depth);
-      }
-    }
-  }
-
-  private int lca(int u, int v, int[][] parent, int[] depth) {
-    if (depth[u] < depth[v]) {
-      final int temp = u;
-      u = v;
-      v = temp;
-    }
-
-    for (int k = LOG - 1; k >= 0; --k)
-      if (parent[k][u] != -1 && depth[parent[k][u]] >= depth[v])
-        u = parent[k][u];
-
-    if (u == v)
-      return u;
-
-    for (int k = LOG - 1; k >= 0; --k)
-      if (parent[k][u] != -1 && parent[k][u] != parent[k][v]) {
-        u = parent[k][u];
-        v = parent[k][v];
-      }
-
-    return parent[0][u];
-  }
-
-  private int modPow(long x, long n) {
-    if (n == 0)
-      return 1;
-    if (n % 2 == 1)
-      return (int) (x * modPow(x % MOD, (n - 1)) % MOD);
-    return modPow(x * x % MOD, (n / 2)) % MOD;
-  }
-}
diff --git a/solutions/3559. Number of Ways to Assign Edge Weights II/3559.py b/solutions/3559. Number of Ways to Assign Edge Weights II/3559.py
deleted file mode 100644
index d8d6bb2af15..00000000000
--- a/solutions/3559. Number of Ways to Assign Edge Weights II/3559.py	
+++ /dev/null
@@ -1,59 +0,0 @@
-class Solution:
-  def assignEdgeWeights(
-      self,
-      edges: list[list[int]],
-      queries: list[list[int]]
-  ) -> list[int]:
-    MOD = 1_000_000_007
-    LOG = 17  # since 2^17 > 1e5
-    n = len(edges) + 1
-    ans = []
-    depth = [0] * (n + 1)
-    graph = [[] for _ in range(n + 1)]
-    parent = [[-1] * (n + 1) for _ in range(LOG)]
-
-    for u, v in edges:
-      graph[u].append(v)
-      graph[v].append(u)
-
-    def dfs(u: int, p: int) -> None:
-      parent[0][u] = p
-      for v in graph[u]:
-        if v != p:
-          depth[v] = depth[u] + 1
-          dfs(v, u)
-
-    dfs(1, -1)
-
-    for k in range(1, LOG):
-      for v in range(1, n + 1):
-        if parent[k - 1][v] != -1:
-          parent[k][v] = parent[k - 1][parent[k - 1][v]]
-
-    def lca(u: int, v: int) -> int:
-      if depth[u] < depth[v]:
-        u, v = v, u
-
-      for k in reversed(range(LOG)):
-        if parent[k][u] != -1 and depth[parent[k][u]] >= depth[v]:
-          u = parent[k][u]
-
-      if u == v:
-        return u
-
-      for k in reversed(range(LOG)):
-        if parent[k][u] != -1 and parent[k][u] != parent[k][v]:
-          u = parent[k][u]
-          v = parent[k][v]
-
-      return parent[0][u]
-
-    for u, v in queries:
-      if u == v:
-        ans.append(0)
-      else:
-        a = lca(u, v)
-        d = depth[u] + depth[v] - 2 * depth[a]
-        ans.append(pow(2, d - 1, MOD))
-
-    return ans
diff --git a/solutions/356. Line Reflection/356.py b/solutions/356. Line Reflection/356.py
index 09d71f6c6dc..f09a767d544 100644
--- a/solutions/356. Line Reflection/356.py	
+++ b/solutions/356. Line Reflection/356.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isReflected(self, points: list[list[int]]) -> bool:
+  def isReflected(self, points: List[List[int]]) -> bool:
     minX = math.inf
     maxX = -math.inf
     seen = set()
diff --git a/solutions/3560. Find Minimum Log Transportation Cost/3560.cpp b/solutions/3560. Find Minimum Log Transportation Cost/3560.cpp
deleted file mode 100644
index d9e5e4fa7b3..00000000000
--- a/solutions/3560. Find Minimum Log Transportation Cost/3560.cpp	
+++ /dev/null
@@ -1,6 +0,0 @@
-class Solution {
- public:
-  long long minCuttingCost(long n, long m, int k) {
-    return max(0L, max(n, m) - k) * k;
-  }
-};
diff --git a/solutions/3560. Find Minimum Log Transportation Cost/3560.java b/solutions/3560. Find Minimum Log Transportation Cost/3560.java
deleted file mode 100644
index a8ae6b09416..00000000000
--- a/solutions/3560. Find Minimum Log Transportation Cost/3560.java	
+++ /dev/null
@@ -1,5 +0,0 @@
-class Solution {
-  public long minCuttingCost(long n, long m, int k) {
-    return Math.max(0, Math.max(n, m) - k) * k;
-  }
-}
diff --git a/solutions/3560. Find Minimum Log Transportation Cost/3560.py b/solutions/3560. Find Minimum Log Transportation Cost/3560.py
deleted file mode 100644
index 77b19e87a10..00000000000
--- a/solutions/3560. Find Minimum Log Transportation Cost/3560.py	
+++ /dev/null
@@ -1,3 +0,0 @@
-class Solution:
-  def minCuttingCost(self, n: int, m: int, k: int) -> int:
-    return max(0, max(n, m) - k) * k
diff --git a/solutions/3561. Resulting String After Adjacent Removals/3561.cpp b/solutions/3561. Resulting String After Adjacent Removals/3561.cpp
deleted file mode 100644
index 689bc117d72..00000000000
--- a/solutions/3561. Resulting String After Adjacent Removals/3561.cpp	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution {
- public:
-  string resultingString(string s) {
-    string ans;
-
-    for (const char c : s)
-      if (!ans.empty() &&
-          (abs(ans.back() - c) == 1 || abs(ans.back() - c) == 25))
-        ans.pop_back();
-      else
-        ans += c;
-
-    return ans;
-  }
-};
diff --git a/solutions/3561. Resulting String After Adjacent Removals/3561.java b/solutions/3561. Resulting String After Adjacent Removals/3561.java
deleted file mode 100644
index ecc9ddcf6a7..00000000000
--- a/solutions/3561. Resulting String After Adjacent Removals/3561.java	
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
-  public String resultingString(String s) {
-    StringBuilder sb = new StringBuilder();
-
-    for (final char c : s.toCharArray())
-      if (sb.length() > 0 && (Math.abs(sb.charAt(sb.length() - 1) - c) == 1 ||
-                              Math.abs(sb.charAt(sb.length() - 1) - c) == 25))
-        sb.deleteCharAt(sb.length() - 1);
-      else
-        sb.append(c);
-
-    return sb.toString();
-  }
-}
diff --git a/solutions/3561. Resulting String After Adjacent Removals/3561.py b/solutions/3561. Resulting String After Adjacent Removals/3561.py
deleted file mode 100644
index 884f84c3aef..00000000000
--- a/solutions/3561. Resulting String After Adjacent Removals/3561.py	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution:
-  def resultingString(self, s: str) -> str:
-    stack = []
-
-    for c in s:
-      if stack and abs(ord(stack[-1]) - ord(c)) in (1, 25):
-        stack.pop()
-      else:
-        stack.append(c)
-
-    return ''.join(stack)
diff --git a/solutions/3562. Maximum Profit from Trading Stocks with Discounts/3562.py b/solutions/3562. Maximum Profit from Trading Stocks with Discounts/3562.py
deleted file mode 100644
index 01108185583..00000000000
--- a/solutions/3562. Maximum Profit from Trading Stocks with Discounts/3562.py	
+++ /dev/null
@@ -1,51 +0,0 @@
-class Solution:
-  def maxProfit(
-      self,
-      n: int,
-      present: list[int],
-      future: list[int],
-      hierarchy: list[list[int]],
-      budget: int,
-  ) -> int:
-    tree = [[] for _ in range(n)]
-
-    for u, v in hierarchy:
-      tree[u - 1].append(v - 1)
-
-    @functools.lru_cache(None)
-    def dp(u: int, parent: int) -> tuple[list[int], list[int]]:
-      noDiscount = [0] * (budget + 1)
-      withDiscount = [0] * (budget + 1)
-
-      for v in tree[u]:
-        if v == parent:
-          continue
-        childNoDiscount, childWithDiscount = dp(v, u)
-        noDiscount = self._merge(noDiscount, childNoDiscount)
-        withDiscount = self._merge(withDiscount, childWithDiscount)
-
-      newDp0 = noDiscount[:]
-      newDp1 = noDiscount[:]
-
-      # 1. Buy current node at full cost (no discount)
-      fullCost = present[u]
-      for b in range(fullCost, budget + 1):
-        profit = future[u] - fullCost
-        newDp0[b] = max(newDp0[b], withDiscount[b - fullCost] + profit)
-
-      # 2. Buy current node at half cost (discounted by parent)
-      halfCost = present[u] // 2
-      for b in range(halfCost, budget + 1):
-        profit = future[u] - halfCost
-        newDp1[b] = max(newDp1[b], withDiscount[b - halfCost] + profit)
-
-      return newDp0, newDp1
-
-    return max(dp(0, -1)[0])
-
-  def _merge(self, dpA: list[int], dpB: list[int]) -> list[int]:
-    merged = [-math.inf] * len(dpA)
-    for i, a in enumerate(dpA):
-      for j in range(len(dpA) - i):
-        merged[i + j] = max(merged[i + j], a + dpB[j])
-    return merged
diff --git a/solutions/3563. Lexicographically Smallest String After Adjacent Removals/3563.cpp b/solutions/3563. Lexicographically Smallest String After Adjacent Removals/3563.cpp
deleted file mode 100644
index d5c59273bd3..00000000000
--- a/solutions/3563. Lexicographically Smallest String After Adjacent Removals/3563.cpp	
+++ /dev/null
@@ -1,28 +0,0 @@
-class Solution {
- public:
-  string lexicographicallySmallestString(string s) {
-    const int n = s.size();
-    // dp[i][j] := the lexicographically smallest string by removing adjacent
-    // letters from s[i..j)
-    vector<vector<string>> dp(n + 1, vector<string>(n + 1));
-
-    for (int d = 1; d <= n; ++d)
-      for (int i = 0; i + d <= n; ++i) {
-        const int j = i + d;
-        // 1. Keep s[i].
-        string minString = s[i] + dp[i + 1][j];
-        // 2. Remove s[i] and s[k] if possible.
-        for (int k = i + 1; k < j; ++k)
-          if (isConsecutive(s[i], s[k]) && dp[i + 1][k].empty())
-            minString = min(minString, dp[k + 1][j]);
-        dp[i][j] = minString;
-      }
-
-    return dp[0][n];
-  }
-
- private:
-  bool isConsecutive(char a, char b) {
-    return abs(a - b) == 1 || abs(a - b) == 25;
-  }
-};
diff --git a/solutions/3563. Lexicographically Smallest String After Adjacent Removals/3563.java b/solutions/3563. Lexicographically Smallest String After Adjacent Removals/3563.java
deleted file mode 100644
index dbf8b3b945e..00000000000
--- a/solutions/3563. Lexicographically Smallest String After Adjacent Removals/3563.java	
+++ /dev/null
@@ -1,32 +0,0 @@
-class Solution {
-  public String lexicographicallySmallestString(String s) {
-    final int n = s.length();
-    // dp[i][j]: the lexicographically smallest string by removing adjacent letters from s[i..j)
-    String[][] dp = new String[n + 1][n + 1];
-
-    // Initialize dp[i][i] = "" for all i.
-    for (int i = 0; i <= n; ++i)
-      dp[i][i] = "";
-
-    for (int d = 1; d <= n; ++d)
-      for (int i = 0; i + d <= n; ++i) {
-        final int j = i + d;
-        // 1. Keep s[i].
-        String minString = s.charAt(i) + dp[i + 1][j];
-        // 2. Remove s[i] and s[k] if possible.
-        for (int k = i + 1; k < j; ++k)
-          if (isConsecutive(s.charAt(i), s.charAt(k)) && dp[i + 1][k].isEmpty()) {
-            final String candidate = dp[k + 1][j];
-            if (candidate.compareTo(minString) < 0)
-              minString = candidate;
-          }
-        dp[i][j] = minString;
-      }
-
-    return dp[0][n];
-  }
-
-  private boolean isConsecutive(char a, char b) {
-    return Math.abs(a - b) == 1 || Math.abs(a - b) == 25;
-  }
-}
diff --git a/solutions/3563. Lexicographically Smallest String After Adjacent Removals/3563.py b/solutions/3563. Lexicographically Smallest String After Adjacent Removals/3563.py
deleted file mode 100644
index 7e47fe548c6..00000000000
--- a/solutions/3563. Lexicographically Smallest String After Adjacent Removals/3563.py	
+++ /dev/null
@@ -1,24 +0,0 @@
-class Solution:
-  def lexicographicallySmallestString(self, s: str) -> str:
-    n = len(s)
-    # dp[i][j]: the lexicographically smallest string by removing adjacent
-    # letters from s[i..j)
-    dp = [[''] * (n + 1) for _ in range(n + 1)]
-
-    for d in range(1, n + 1):
-      for i in range(n - d + 1):
-        j = i + d
-        # 1. Keep s[i].
-        minString = s[i] + dp[i + 1][j]
-        # 2. Remove s[i] and s[k] if possible.
-        for k in range(i + 1, j):
-          if self._isConsecutive(s[i], s[k]) and dp[i + 1][k] == '':
-            candidate = dp[k + 1][j]
-            if candidate < minString:
-              minString = candidate
-        dp[i][j] = minString
-
-    return dp[0][n]
-
-  def _isConsecutive(self, a: str, b: str) -> bool:
-    return abs(ord(a) - ord(b)) == 1 or abs(ord(a) - ord(b)) == 25
diff --git a/solutions/358. Rearrange String k Distance Apart/358.py b/solutions/358. Rearrange String k Distance Apart/358.py
index 15d9b8a46c8..4034a1e1477 100644
--- a/solutions/358. Rearrange String k Distance Apart/358.py	
+++ b/solutions/358. Rearrange String k Distance Apart/358.py	
@@ -6,7 +6,7 @@ def rearrangeString(self, s: str, k: int) -> str:
     # valid[i] := the leftmost index i can appear
     valid = collections.Counter()
 
-    def getBestLetter(index: int) -> str:
+    def getBestLetter(index: int) -> chr:
       """Returns the valid letter that has the most count."""
       maxCount = -1
       bestLetter = '*'
diff --git a/solutions/36. Valid Sudoku/36.py b/solutions/36. Valid Sudoku/36.py
index fdabf3dd5ad..e97de64622f 100644
--- a/solutions/36. Valid Sudoku/36.py	
+++ b/solutions/36. Valid Sudoku/36.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isValidSudoku(self, board: list[list[str]]) -> bool:
+  def isValidSudoku(self, board: List[List[str]]) -> bool:
     seen = set()
 
     for i in range(9):
@@ -7,9 +7,9 @@ def isValidSudoku(self, board: list[list[str]]) -> bool:
         c = board[i][j]
         if c == '.':
           continue
-        if (c + '@row ' + str(i) in seen or
-            c + '@col ' + str(j) in seen or
-                c + '@box ' + str(i // 3) + str(j // 3) in seen):
+        if c + '@row ' + str(i) in seen or \
+           c + '@col ' + str(j) in seen or \
+           c + '@box ' + str(i // 3) + str(j // 3) in seen:
           return False
         seen.add(c + '@row ' + str(i))
         seen.add(c + '@col ' + str(j))
diff --git a/solutions/360. Sort Transformed Array/360.py b/solutions/360. Sort Transformed Array/360.py
index dc5e2d2a0e0..ff060246438 100644
--- a/solutions/360. Sort Transformed Array/360.py	
+++ b/solutions/360. Sort Transformed Array/360.py	
@@ -1,11 +1,5 @@
 class Solution:
-  def sortTransformedArray(
-      self,
-      nums: list[int],
-      a: int,
-      b: int,
-      c: int,
-  ) -> list[int]:
+  def sortTransformedArray(self, nums: List[int], a: int, b: int, c: int) -> List[int]:
     n = len(nums)
     upward = a > 0
     ans = [0] * n
diff --git a/solutions/361. Bomb Enemy/361.cpp b/solutions/361. Bomb Enemy/361.cpp
index 2cb2c810f91..5f974971c51 100644
--- a/solutions/361. Bomb Enemy/361.cpp	
+++ b/solutions/361. Bomb Enemy/361.cpp	
@@ -36,8 +36,8 @@ class Solution {
     }
 
     return accumulate(dp.begin(), dp.end(), 0,
-                      [](int acc, const vector<int>& row) {
-      return max(acc, ranges::max(row));
+                      [](int subtotal, const vector<int>& row) {
+      return max(subtotal, ranges::max(row));
     });
   }
 };
diff --git a/solutions/361. Bomb Enemy/361.py b/solutions/361. Bomb Enemy/361.py
index 9659aade03f..2447e45493e 100644
--- a/solutions/361. Bomb Enemy/361.py	
+++ b/solutions/361. Bomb Enemy/361.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxKilledEnemies(self, grid: list[list[str]]) -> int:
+  def maxKilledEnemies(self, grid: List[List[chr]]) -> int:
     m = len(grid)
     n = len(grid[0])
     enemyCount = 0
diff --git a/solutions/362. Design Hit Counter/362.py b/solutions/362. Design Hit Counter/362.py
index b5a40cd92b3..8c9e5ec371c 100644
--- a/solutions/362. Design Hit Counter/362.py	
+++ b/solutions/362. Design Hit Counter/362.py	
@@ -12,5 +12,4 @@ def hit(self, timestamp: int) -> None:
       self.hits[i] = 1  # Reset the hit count to 1.
 
   def getHits(self, timestamp: int) -> int:
-    return sum(h for t, h in zip(self.timestamps, self.hits)
-               if timestamp - t < 300)
+    return sum(h for t, h in zip(self.timestamps, self.hits) if timestamp - t < 300)
diff --git a/solutions/363. Max Sum of Rectangle No Larger Than K/363.py b/solutions/363. Max Sum of Rectangle No Larger Than K/363.py
index 495960665f9..60b4c8a1cd8 100644
--- a/solutions/363. Max Sum of Rectangle No Larger Than K/363.py	
+++ b/solutions/363. Max Sum of Rectangle No Larger Than K/363.py	
@@ -2,7 +2,7 @@
 
 
 class Solution:
-  def maxSumSubmatrix(self, matrix: list[list[int]], k: int) -> int:
+  def maxSumSubmatrix(self, matrix: List[List[int]], k: int) -> int:
     m = len(matrix)
     n = len(matrix[0])
     ans = -math.inf
diff --git a/solutions/364. Nested List Weight Sum II/364.py b/solutions/364. Nested List Weight Sum II/364.py
index c221546b764..40420bc503d 100644
--- a/solutions/364. Nested List Weight Sum II/364.py	
+++ b/solutions/364. Nested List Weight Sum II/364.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def depthSumInverse(self, nestedList: list[NestedInteger]) -> int:
+  def depthSumInverse(self, nestedList: List[NestedInteger]) -> int:
     ans = 0
     prevSum = 0
     q = collections.deque(nestedList)
diff --git a/solutions/365. Water and Jug Problem/365.py b/solutions/365. Water and Jug Problem/365.py
index 6f47afa8a91..def40137cbb 100644
--- a/solutions/365. Water and Jug Problem/365.py	
+++ b/solutions/365. Water and Jug Problem/365.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def canMeasureWater(
-      self,
-      jug1Capacity: int,
-      jug2Capacity: int,
-      targetCapacity: int,
-  ) -> bool:
-    return (targetCapacity == 0 or
-            jug1Capacity + jug2Capacity >= targetCapacity and
-            targetCapacity % gcd(jug1Capacity, jug2Capacity) == 0)
+  def canMeasureWater(self, jug1Capacity: int, jug2Capacity: int, targetCapacity: int) -> bool:
+    return targetCapacity == 0 or \
+        jug1Capacity + jug2Capacity >= targetCapacity and \
+        targetCapacity % gcd(jug1Capacity, jug2Capacity) == 0
diff --git a/solutions/366. Find Leaves of Binary Tree/366.py b/solutions/366. Find Leaves of Binary Tree/366.py
index eb313aa1d86..c43b9abb33c 100644
--- a/solutions/366. Find Leaves of Binary Tree/366.py	
+++ b/solutions/366. Find Leaves of Binary Tree/366.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def findLeaves(self, root: TreeNode | None) -> list[list[int]]:
+  def findLeaves(self, root: Optional[TreeNode]) -> List[List[int]]:
     ans = []
 
-    def depth(root: TreeNode | None) -> int:
+    def depth(root: Optional[TreeNode]) -> int:
       """Returns the depth of the root (0-indexed)."""
       if not root:
         return -1
diff --git a/solutions/367. Valid Perfect Square/367.py b/solutions/367. Valid Perfect Square/367.py
index 2f921e016c5..05ebdf8e9a1 100644
--- a/solutions/367. Valid Perfect Square/367.py	
+++ b/solutions/367. Valid Perfect Square/367.py	
@@ -1,4 +1,5 @@
 class Solution:
   def isPerfectSquare(self, num: int) -> bool:
-    l = bisect.bisect_left(range(num), num, key=lambda m: m * m)
+    l = bisect.bisect_left(range(num), num,
+                           key=lambda m: m * m)
     return l**2 == num
diff --git a/solutions/368. Largest Divisible Subset/368.py b/solutions/368. Largest Divisible Subset/368.py
index 13307f00f4c..a2b2fa00d7d 100644
--- a/solutions/368. Largest Divisible Subset/368.py	
+++ b/solutions/368. Largest Divisible Subset/368.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestDivisibleSubset(self, nums: list[int]) -> list[int]:
+  def largestDivisibleSubset(self, nums: List[int]) -> List[int]:
     n = len(nums)
     ans = []
     count = [1] * n
diff --git a/solutions/369. Plus One Linked List/369-2.cpp b/solutions/369. Plus One Linked List/369-2.cpp
index 8a4e8e2dc8f..ba1c7ab2026 100644
--- a/solutions/369. Plus One Linked List/369-2.cpp	
+++ b/solutions/369. Plus One Linked List/369-2.cpp	
@@ -13,7 +13,7 @@ class Solution {
     // `curr` now points to the rightmost non-9 node.
 
     ++curr->val;
-    while (curr->next != nullptr) {
+    while (curr->next) {
       curr->next->val = 0;
       curr = curr->next;
     }
diff --git a/solutions/37. Sudoku Solver/37.py b/solutions/37. Sudoku Solver/37.py
index 1dbaf79e095..2e0cbab1755 100644
--- a/solutions/37. Sudoku Solver/37.py	
+++ b/solutions/37. Sudoku Solver/37.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def solveSudoku(self, board: list[list[str]]) -> None:
+  def solveSudoku(self, board: List[List[str]]) -> None:
     def isValid(row: int, col: int, c: str) -> bool:
       for i in range(9):
-        if (board[i][col] == c or
-            board[row][i] == c or
-                board[3 * (row // 3) + i // 3][3 * (col // 3) + i % 3] == c):
+        if board[i][col] == c or \
+           board[row][i] == c or \
+           board[3 * (row // 3) + i // 3][3 * (col // 3) + i % 3] == c:
           return False
       return True
 
diff --git a/solutions/370. Range Addition/370.py b/solutions/370. Range Addition/370.py
index 77c83ba9057..aa2a9899e22 100644
--- a/solutions/370. Range Addition/370.py	
+++ b/solutions/370. Range Addition/370.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def getModifiedArray(
-      self,
-      length: int,
-      updates: list[list[int]],
-  ) -> list[int]:
+  def getModifiedArray(self, length: int, updates: list[list[int]]) -> list[int]:
     line = [0] * length
 
     for start, end, inc in updates:
diff --git a/solutions/371. Sum of Two Integers/371.py b/solutions/371. Sum of Two Integers/371.py
index 5f5c2a8b427..3e562154dcc 100644
--- a/solutions/371. Sum of Two Integers/371.py	
+++ b/solutions/371. Sum of Two Integers/371.py	
@@ -1,9 +1,9 @@
 class Solution:
   def getSum(self, a: int, b: int) -> int:
     mask = 0xFFFFFFFF
-    MAX = 2000
+    kMax = 2000
 
     while b != 0:
       a, b = (a ^ b) & mask, ((a & b) << 1) & mask
 
-    return a if a < MAX else ~(a ^ mask)
+    return a if a < kMax else ~(a ^ mask)
diff --git a/solutions/372. Super Pow/372.java b/solutions/372. Super Pow/372.java
index bd88bea90e2..37cce72c62f 100644
--- a/solutions/372. Super Pow/372.java	
+++ b/solutions/372. Super Pow/372.java	
@@ -2,20 +2,20 @@ class Solution {
   public int superPow(int a, int[] b) {
     int ans = 1;
 
-    a %= MOD;
+    a %= kMod;
     for (final int i : b)
-      ans = modPow(ans, 10) * modPow(a, i) % MOD;
+      ans = modPow(ans, 10) * modPow(a, i) % kMod;
 
     return ans;
   }
 
-  private static final int MOD = 1337;
+  private static final int kMod = 1337;
 
   private int modPow(int x, int n) {
     if (n == 0)
       return 1;
     if (n % 2 == 1)
-      return x * modPow(x % MOD, (n - 1)) % MOD;
-    return modPow(x * x % MOD, (n / 2)) % MOD;
+      return x * modPow(x % kMod, (n - 1)) % kMod;
+    return modPow(x * x % kMod, (n / 2)) % kMod;
   }
 }
diff --git a/solutions/372. Super Pow/372.py b/solutions/372. Super Pow/372.py
index 76ed8fa4c52..b9827e66763 100644
--- a/solutions/372. Super Pow/372.py	
+++ b/solutions/372. Super Pow/372.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def superPow(self, a: int, b: list[int]) -> int:
-    MOD = 1337
+  def superPow(self, a: int, b: List[int]) -> int:
+    kMod = 1337
     ans = 1
 
     for i in b:
-      ans = pow(ans, 10, MOD) * pow(a, i, MOD)
+      ans = pow(ans, 10, kMod) * pow(a, i, kMod)
 
-    return ans % MOD
+    return ans % kMod
diff --git a/solutions/373. Find K Pairs with Smallest Sums/373.cpp b/solutions/373. Find K Pairs with Smallest Sums/373.cpp
index be7a96013c1..0ab38d6e83b 100644
--- a/solutions/373. Find K Pairs with Smallest Sums/373.cpp	
+++ b/solutions/373. Find K Pairs with Smallest Sums/373.cpp	
@@ -2,6 +2,7 @@ struct T {
   int i;
   int j;
   int sum;  // nums1[i] + nums2[j]
+  T(int i, int j, int sum) : i(i), j(j), sum(sum) {}
 };
 
 class Solution {
diff --git a/solutions/373. Find K Pairs with Smallest Sums/373.java b/solutions/373. Find K Pairs with Smallest Sums/373.java
index af28a44d21a..82921979ed6 100644
--- a/solutions/373. Find K Pairs with Smallest Sums/373.java	
+++ b/solutions/373. Find K Pairs with Smallest Sums/373.java	
@@ -1,8 +1,18 @@
+class T {
+  public int i;
+  public int j;
+  public int sum; // nums1[i] + nums2[j]
+  public T(int i, int j, int sum) {
+    this.i = i;
+    this.j = j;
+    this.sum = sum;
+  }
+}
+
 class Solution {
   public List<List<Integer>> kSmallestPairs(int[] nums1, int[] nums2, int k) {
-    record T(int i, int j, int sum) {}
     List<List<Integer>> ans = new ArrayList<>();
-    Queue<T> minHeap = new PriorityQueue<>(Comparator.comparingInt(T::sum));
+    Queue<T> minHeap = new PriorityQueue<>((a, b) -> a.sum - b.sum);
 
     for (int i = 0; i < Math.min(k, nums1.length); ++i)
       minHeap.offer(new T(i, 0, nums1[i] + nums2[0]));
diff --git a/solutions/373. Find K Pairs with Smallest Sums/373.py b/solutions/373. Find K Pairs with Smallest Sums/373.py
index 6c40d99c822..9a28487b6d3 100644
--- a/solutions/373. Find K Pairs with Smallest Sums/373.py	
+++ b/solutions/373. Find K Pairs with Smallest Sums/373.py	
@@ -1,7 +1,5 @@
 class Solution:
-  def kSmallestPairs(self, nums1: list[int],
-                     nums2: list[int],
-                     k: int) -> list[list[int]]:
+  def kSmallestPairs(self, nums1: List[int], nums2: List[int], k: int) -> List[List[int]]:
     minHeap = []
 
     for i in range(min(k, len(nums1))):
diff --git a/solutions/376. Wiggle Subsequence/376.py b/solutions/376. Wiggle Subsequence/376.py
index 26e83869917..2e6a489f8cb 100644
--- a/solutions/376. Wiggle Subsequence/376.py	
+++ b/solutions/376. Wiggle Subsequence/376.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def wiggleMaxLength(self, nums: list[int]) -> int:
+  def wiggleMaxLength(self, nums: List[int]) -> int:
     increasing = 1
     decreasing = 1
 
diff --git a/solutions/377. Combination Sum IV/377.py b/solutions/377. Combination Sum IV/377.py
index ca6ad9ab6ee..b7e9b2790a3 100644
--- a/solutions/377. Combination Sum IV/377.py	
+++ b/solutions/377. Combination Sum IV/377.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def combinationSum4(self, nums: list[int], target: int) -> int:
+  def combinationSum4(self, nums: List[int], target: int) -> int:
     dp = [1] + [-1] * target
 
     def dfs(target: int) -> int:
diff --git a/solutions/378. Kth Smallest Element in a Sorted Matrix/378-2.py b/solutions/378. Kth Smallest Element in a Sorted Matrix/378-2.py
index 1c95d693936..72ca426443f 100644
--- a/solutions/378. Kth Smallest Element in a Sorted Matrix/378-2.py	
+++ b/solutions/378. Kth Smallest Element in a Sorted Matrix/378-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def kthSmallest(self, matrix: list[list[int]], k: int) -> int:
+  def kthSmallest(self, matrix: List[List[int]], k: int) -> int:
     def numsNoGreaterThan(m: int) -> int:
       count = 0
       j = len(matrix[0]) - 1
@@ -11,6 +11,5 @@ def numsNoGreaterThan(m: int) -> int:
         count += j + 1
       return count
 
-    l = matrix[0][0]
-    r = matrix[-1][-1]
-    return bisect.bisect_left(range(l, r), k, key=numsNoGreaterThan) + l
+    return bisect.bisect_left(range(matrix[0][0], matrix[-1][-1]), k,
+                              key=lambda m: numsNoGreaterThan(m)) + matrix[0][0]
diff --git a/solutions/378. Kth Smallest Element in a Sorted Matrix/378.cpp b/solutions/378. Kth Smallest Element in a Sorted Matrix/378.cpp
index de9e59bb623..2b7d88a89ad 100644
--- a/solutions/378. Kth Smallest Element in a Sorted Matrix/378.cpp	
+++ b/solutions/378. Kth Smallest Element in a Sorted Matrix/378.cpp	
@@ -2,6 +2,7 @@ struct T {
   int i;
   int j;
   int num;  // matrix[i][j]
+  T(int i, int j, int num) : i(i), j(j), num(num) {}
 };
 
 class Solution {
diff --git a/solutions/378. Kth Smallest Element in a Sorted Matrix/378.java b/solutions/378. Kth Smallest Element in a Sorted Matrix/378.java
index ad8fafdeecb..5ebd6e7208d 100644
--- a/solutions/378. Kth Smallest Element in a Sorted Matrix/378.java	
+++ b/solutions/378. Kth Smallest Element in a Sorted Matrix/378.java	
@@ -1,7 +1,17 @@
+class T {
+  public int i;
+  public int j;
+  public int num; // matrix[i][j]
+  public T(int i, int j, int num) {
+    this.i = i;
+    this.j = j;
+    this.num = num;
+  }
+}
+
 class Solution {
   public int kthSmallest(int[][] matrix, int k) {
-    record T(int i, int j, int num) {}
-    Queue<T> minHeap = new PriorityQueue<>(Comparator.comparingInt(T::num));
+    Queue<T> minHeap = new PriorityQueue<>((a, b) -> a.num - b.num);
 
     for (int i = 0; i < k && i < matrix.length; ++i)
       minHeap.offer(new T(i, 0, matrix[i][0]));
diff --git a/solutions/378. Kth Smallest Element in a Sorted Matrix/378.py b/solutions/378. Kth Smallest Element in a Sorted Matrix/378.py
index a5d36967cdf..32c53835a25 100644
--- a/solutions/378. Kth Smallest Element in a Sorted Matrix/378.py	
+++ b/solutions/378. Kth Smallest Element in a Sorted Matrix/378.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def kthSmallest(self, matrix: list[list[int]], k: int) -> int:
+  def kthSmallest(self, matrix: List[List[int]], k: int) -> int:
     minHeap = []  # (matrix[i][j], i, j)
 
     i = 0
diff --git a/solutions/379. Design Phone Directory/379.java b/solutions/379. Design Phone Directory/379.java
index cdcc6821a5e..a60957cb743 100644
--- a/solutions/379. Design Phone Directory/379.java	
+++ b/solutions/379. Design Phone Directory/379.java	
@@ -12,7 +12,7 @@ public int get() {
     final int availableNum = number;
     number = next[number];
     next[availableNum] = -1; // Mark as used.
-    return availableNum;
+    return ans;
   }
 
   public boolean check(int number) {
diff --git a/solutions/38. Count and Say/38.cpp b/solutions/38. Count and Say/38.cpp
index ebd435705f4..69e158e7bc1 100644
--- a/solutions/38. Count and Say/38.cpp	
+++ b/solutions/38. Count and Say/38.cpp	
@@ -3,7 +3,7 @@ class Solution {
   string countAndSay(int n) {
     string ans = "1";
 
-    while (--n > 0) {
+    while (--n) {
       string next;
       for (int i = 0; i < ans.length(); ++i) {
         int count = 1;
@@ -13,7 +13,7 @@ class Solution {
         }
         next += to_string(count) + ans[i];
       }
-      ans = std::move(next);
+      ans = move(next);
     }
 
     return ans;
diff --git a/solutions/381. Insert Delete GetRandom O(1) - Duplicates allowed/381.cpp b/solutions/381. Insert Delete GetRandom O(1) - Duplicates allowed/381.cpp
index 4352e35b9a4..d224145f7a5 100644
--- a/solutions/381. Insert Delete GetRandom O(1) - Duplicates allowed/381.cpp	
+++ b/solutions/381. Insert Delete GetRandom O(1) - Duplicates allowed/381.cpp	
@@ -1,6 +1,7 @@
 struct Item {
   int val;
   int indexInMap;
+  Item(int val, int indexInMap) : val(val), indexInMap(indexInMap) {}
 };
 
 class RandomizedCollection {
diff --git a/solutions/381. Insert Delete GetRandom O(1) - Duplicates allowed/381.java b/solutions/381. Insert Delete GetRandom O(1) - Duplicates allowed/381.java
index a6bad4bcf0c..6239e5cfbab 100644
--- a/solutions/381. Insert Delete GetRandom O(1) - Duplicates allowed/381.java	
+++ b/solutions/381. Insert Delete GetRandom O(1) - Duplicates allowed/381.java	
@@ -1,3 +1,12 @@
+class Item {
+  public int val;
+  public int indexInMap;
+  public Item(int val, int indexInMap) {
+    this.val = val;
+    this.indexInMap = indexInMap;
+  }
+}
+
 class RandomizedCollection {
   public boolean insert(int val) {
     valToIndices.putIfAbsent(val, new ArrayList<>());
@@ -26,8 +35,6 @@ public int getRandom() {
     return items.get(index).val;
   }
 
-  private record Item(int val, int indexInMap) {}
-
   private Map<Integer, List<Integer>> valToIndices = new HashMap<>();
   private List<Item> items = new ArrayList<>();
   private Random rand = new Random();
diff --git a/solutions/382. Linked List Random Node/382.py b/solutions/382. Linked List Random Node/382.py
index 6623e2c5e26..d842109efe6 100644
--- a/solutions/382. Linked List Random Node/382.py	
+++ b/solutions/382. Linked List Random Node/382.py	
@@ -5,7 +5,7 @@
 #     self.next = next
 
 class Solution:
-  def __init__(self, head: ListNode | None):
+  def __init__(self, head: Optional[ListNode]):
     self.head = head
 
   def getRandom(self) -> int:
diff --git a/solutions/384. Shuffle an Array/384.cpp b/solutions/384. Shuffle an Array/384.cpp
index debe3e3c709..c172d86452f 100644
--- a/solutions/384. Shuffle an Array/384.cpp	
+++ b/solutions/384. Shuffle an Array/384.cpp	
@@ -1,18 +1,20 @@
 class Solution {
  public:
-  Solution(vector<int>& nums) : nums(std::move(nums)) {}
+  Solution(vector<int>& nums) : nums(move(nums)) {}
 
+  /** Resets the array to its original configuration and return it. */
   vector<int> reset() {
     return nums;
   }
 
+  /** Returns a random shuffling of the array. */
   vector<int> shuffle() {
-    vector<int> arr(nums);
-    for (int i = arr.size() - 1; i > 0; --i) {
+    vector<int> A(nums);
+    for (int i = A.size() - 1; i > 0; --i) {
       const int j = rand() % (i + 1);
-      swap(arr[i], arr[j]);
+      swap(A[i], A[j]);
     }
-    return arr;
+    return A;
   }
 
  private:
diff --git a/solutions/384. Shuffle an Array/384.java b/solutions/384. Shuffle an Array/384.java
index 114a28d645a..7c3f7fd7a62 100644
--- a/solutions/384. Shuffle an Array/384.java	
+++ b/solutions/384. Shuffle an Array/384.java	
@@ -3,25 +3,27 @@ public Solution(int[] nums) {
     this.nums = nums;
   }
 
+  /** Resets the array to its original configuration and return it. */
   public int[] reset() {
     return nums;
   }
 
+  /** Returns a random shuffling of the array. */
   public int[] shuffle() {
-    int[] arr = nums.clone();
-    for (int i = arr.length - 1; i > 0; --i) {
+    int[] A = nums.clone();
+    for (int i = A.length - 1; i > 0; --i) {
       final int j = rand.nextInt(i + 1);
-      swap(arr, i, j);
+      swap(A, i, j);
     }
-    return arr;
+    return A;
   }
 
   private int[] nums;
   private Random rand = new Random();
 
-  private void swap(int[] arr, int i, int j) {
-    final int temp = arr[i];
-    arr[i] = arr[j];
-    arr[j] = temp;
+  private void swap(int[] A, int i, int j) {
+    final int temp = A[i];
+    A[i] = A[j];
+    A[j] = temp;
   }
 }
diff --git a/solutions/384. Shuffle an Array/384.py b/solutions/384. Shuffle an Array/384.py
index 8710216b653..2f49b304dab 100644
--- a/solutions/384. Shuffle an Array/384.py	
+++ b/solutions/384. Shuffle an Array/384.py	
@@ -1,13 +1,19 @@
 class Solution:
-  def __init__(self, nums: list[int]):
+  def __init__(self, nums: List[int]):
     self.nums = nums
 
-  def reset(self) -> list[int]:
+  def reset(self) -> List[int]:
+    """
+    Resets the array to its original configuration and return it.
+    """
     return self.nums
 
-  def shuffle(self) -> list[int]:
-    arr = self.nums.copy()
-    for i in range(len(arr) - 1, 0, -1):
+  def shuffle(self) -> List[int]:
+    """
+    Returns a random shuffling of the array.
+    """
+    A = self.nums.copy()
+    for i in range(len(A) - 1, 0, -1):
       j = random.randint(0, i)
-      arr[i], arr[j] = arr[j], arr[i]
-    return arr
+      A[i], A[j] = A[j], A[i]
+    return A
diff --git a/solutions/386. Lexicographical Numbers/386.py b/solutions/386. Lexicographical Numbers/386.py
index 57f55c55011..27b631556cf 100644
--- a/solutions/386. Lexicographical Numbers/386.py	
+++ b/solutions/386. Lexicographical Numbers/386.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def lexicalOrder(self, n: int) -> list[int]:
+  def lexicalOrder(self, n: int) -> List[int]:
     ans = []
     curr = 1
 
diff --git a/solutions/388. Longest Absolute File Path/388.cpp b/solutions/388. Longest Absolute File Path/388.cpp
index 7f235af1731..c8cc9e5d054 100644
--- a/solutions/388. Longest Absolute File Path/388.cpp	
+++ b/solutions/388. Longest Absolute File Path/388.cpp	
@@ -1,6 +1,7 @@
 struct T {
   int depth;
   size_t length;
+  T(int depth, size_t length) : depth(depth), length(length) {}
 };
 
 class Solution {
diff --git a/solutions/39. Combination Sum/39.cpp b/solutions/39. Combination Sum/39.cpp
index 51f811f5304..00322f6a9a3 100644
--- a/solutions/39. Combination Sum/39.cpp	
+++ b/solutions/39. Combination Sum/39.cpp	
@@ -8,7 +8,7 @@ class Solution {
   }
 
  private:
-  void dfs(const vector<int>& candidates, int s, int target, vector<int>&& path,
+  void dfs(const vector<int>& A, int s, int target, vector<int>&& path,
            vector<vector<int>>& ans) {
     if (target < 0)
       return;
@@ -17,9 +17,9 @@ class Solution {
       return;
     }
 
-    for (int i = s; i < candidates.size(); ++i) {
-      path.push_back(candidates[i]);
-      dfs(candidates, i, target - candidates[i], std::move(path), ans);
+    for (int i = s; i < A.size(); ++i) {
+      path.push_back(A[i]);
+      dfs(A, i, target - A[i], move(path), ans);
       path.pop_back();
     }
   }
diff --git a/solutions/39. Combination Sum/39.java b/solutions/39. Combination Sum/39.java
index 2112036fc49..19cd81d5f98 100644
--- a/solutions/39. Combination Sum/39.java	
+++ b/solutions/39. Combination Sum/39.java	
@@ -2,11 +2,11 @@ class Solution {
   public List<List<Integer>> combinationSum(int[] candidates, int target) {
     List<List<Integer>> ans = new ArrayList<>();
     Arrays.sort(candidates);
-    dfs(candidates, 0, target, new ArrayList<>(), ans);
+    dfs(0, candidates, target, new ArrayList<>(), ans);
     return ans;
   }
 
-  private void dfs(int[] candidates, int s, int target, List<Integer> path,
+  private void dfs(int s, int[] candidates, int target, List<Integer> path,
                    List<List<Integer>> ans) {
     if (target < 0)
       return;
@@ -17,7 +17,7 @@ private void dfs(int[] candidates, int s, int target, List<Integer> path,
 
     for (int i = s; i < candidates.length; ++i) {
       path.add(candidates[i]);
-      dfs(candidates, i, target - candidates[i], path, ans);
+      dfs(i, candidates, target - candidates[i], path, ans);
       path.remove(path.size() - 1);
     }
   }
diff --git a/solutions/39. Combination Sum/39.py b/solutions/39. Combination Sum/39.py
index 0ebdd1685d0..87c2f50810a 100644
--- a/solutions/39. Combination Sum/39.py	
+++ b/solutions/39. Combination Sum/39.py	
@@ -1,9 +1,8 @@
 class Solution:
-  def combinationSum(self, candidates: list[int],
-                     target: int) -> list[list[int]]:
+  def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]:
     ans = []
 
-    def dfs(s: int, target: int, path: list[int]) -> None:
+    def dfs(s: int, target: int, path: List[int]) -> None:
       if target < 0:
         return
       if target == 0:
diff --git a/solutions/391. Perfect Rectangle/391.py b/solutions/391. Perfect Rectangle/391.py
index a0b26f9a4ba..42f9304229f 100644
--- a/solutions/391. Perfect Rectangle/391.py	
+++ b/solutions/391. Perfect Rectangle/391.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def isRectangleCover(self, rectangles: list[list[int]]) -> bool:
+  def isRectangleCover(self, rectangles: List[List[int]]) -> bool:
     area = 0
     x1 = math.inf
     y1 = math.inf
     x2 = -math.inf
     y2 = -math.inf
-    corners: set[tuple[int, int]] = set()
+    corners: Set[Tuple[int, int]] = set()
 
     for x, y, a, b in rectangles:
       area += (a - x) * (b - y)
@@ -23,9 +23,9 @@ def isRectangleCover(self, rectangles: list[list[int]]) -> bool:
 
     if len(corners) != 4:
       return False
-    if ((x1, y1) not in corners or
-        (x1, y2) not in corners or
-        (x2, y1) not in corners or
-            (x2, y2) not in corners):
+    if (x1, y1) not in corners or \
+        (x1, y2) not in corners or \
+        (x2, y1) not in corners or \
+            (x2, y2) not in corners:
       return False
     return area == (x2 - x1) * (y2 - y1)
diff --git a/solutions/393. UTF-8 Validation/393.py b/solutions/393. UTF-8 Validation/393.py
index 65d539a7780..0794cb70f9c 100644
--- a/solutions/393. UTF-8 Validation/393.py	
+++ b/solutions/393. UTF-8 Validation/393.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def validUtf8(self, data: list[int]) -> bool:
+  def validUtf8(self, data: List[int]) -> bool:
     followedBytes = 0
 
     for d in data:
diff --git a/solutions/394. Decode String/394.cpp b/solutions/394. Decode String/394.cpp
index 5f5ff3ec218..5a6948392ca 100644
--- a/solutions/394. Decode String/394.cpp	
+++ b/solutions/394. Decode String/394.cpp	
@@ -16,7 +16,7 @@ class Solution {
         } else if (c == ']') {
           const auto [prevStr, n] = stack.top();
           stack.pop();
-          currStr = prevStr + repeat(currStr, n);
+          currStr = prevStr + getRepeatedStr(currStr, n);
         } else {
           currStr += c;
         }
@@ -26,10 +26,11 @@ class Solution {
   }
 
  private:
-  string repeat(const string& s, int n) {
-    string res;
-    for (int i = 0; i < n; ++i)
-      res += s;
-    return res;
+  // Returns s * n.
+  string getRepeatedStr(const string& s, int n) {
+    string repeat;
+    while (n--)
+      repeat += s;
+    return repeat;
   }
 };
diff --git a/solutions/394. Decode String/394.java b/solutions/394. Decode String/394.java
index aac5ee1c5f4..2d7aeef937f 100644
--- a/solutions/394. Decode String/394.java	
+++ b/solutions/394. Decode String/394.java	
@@ -16,7 +16,7 @@ public String decodeString(String s) {
           final Pair<StringBuilder, Integer> pair = stack.pop();
           final StringBuilder prevStr = pair.getKey();
           final int n = pair.getValue();
-          currStr = prevStr.append(currStr.toString().repeat(n));
+          currStr = prevStr.append(getRepeatedStr(currStr, n));
         } else {
           currStr.append(c);
         }
@@ -24,4 +24,12 @@ public String decodeString(String s) {
 
     return currStr.toString();
   }
+
+  // Returns s * n.
+  private StringBuilder getRepeatedStr(StringBuilder s, int n) {
+    StringBuilder sb = new StringBuilder();
+    while (n-- > 0)
+      sb.append(s);
+    return sb;
+  }
 }
diff --git a/solutions/396. Rotate Function/396.py b/solutions/396. Rotate Function/396.py
index 5e8edd8cf3d..a9d1fc92161 100644
--- a/solutions/396. Rotate Function/396.py	
+++ b/solutions/396. Rotate Function/396.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxRotateFunction(self, nums: list[int]) -> int:
+  def maxRotateFunction(self, nums: List[int]) -> int:
     f = sum(i * num for i, num in enumerate(nums))
     ans = f
     summ = sum(nums)
diff --git a/solutions/398. Random Pick Index/398.cpp b/solutions/398. Random Pick Index/398.cpp
index d2a692ba345..88b473d8a64 100644
--- a/solutions/398. Random Pick Index/398.cpp	
+++ b/solutions/398. Random Pick Index/398.cpp	
@@ -1,6 +1,6 @@
 class Solution {
  public:
-  Solution(vector<int>& nums) : nums(std::move(nums)) {}
+  Solution(vector<int>& nums) : nums(move(nums)) {}
 
   int pick(int target) {
     int ans = -1;
diff --git a/solutions/398. Random Pick Index/398.py b/solutions/398. Random Pick Index/398.py
index 46c56fe8058..62a7ec38118 100644
--- a/solutions/398. Random Pick Index/398.py	
+++ b/solutions/398. Random Pick Index/398.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def __init__(self, nums: list[int]):
+  def __init__(self, nums: List[int]):
     self.nums = nums
 
   def pick(self, target: int) -> int:
diff --git a/solutions/399. Evaluate Division/399.cpp b/solutions/399. Evaluate Division/399.cpp
index 1ac4f0f71cb..53d76c8cdb5 100644
--- a/solutions/399. Evaluate Division/399.cpp	
+++ b/solutions/399. Evaluate Division/399.cpp	
@@ -40,8 +40,8 @@ class Solution {
     for (const auto& [B, value] : graph.at(A)) {
       if (seen.contains(B))
         continue;
-      const double res = divide(graph, B, C, std::move(seen));  // B / C
-      if (res > 0)                                              // valid result
+      const double res = divide(graph, B, C, move(seen));  // B / C
+      if (res > 0)                                         // valid result
         return value * res;  // A / C = (A / B) * (B / C)
     }
 
diff --git a/solutions/399. Evaluate Division/399.py b/solutions/399. Evaluate Division/399.py
index d4443507fa1..c1d2440cdc8 100644
--- a/solutions/399. Evaluate Division/399.py	
+++ b/solutions/399. Evaluate Division/399.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def calcEquation(
-      self,
-      equations: list[list[str]],
-      values: list[float],
-      queries: list[list[str]],
-  ) -> list[float]:
+  def calcEquation(self, equations: List[List[str]], values: List[float], queries: List[List[str]]) -> List[float]:
     ans = []
     # graph[A][B] := A / B
     graph = collections.defaultdict(dict)
@@ -13,7 +8,7 @@ def calcEquation(
       graph[A][B] = value
       graph[B][A] = 1 / value
 
-    def devide(A: str, C: str, seen: set[str]) -> float:
+    def devide(A: str, C: str, seen: Set[str]) -> float:
       """Returns A / C."""
       if A == C:
         return 1.0
diff --git a/solutions/4. Median of Two Sorted Arrays/4.py b/solutions/4. Median of Two Sorted Arrays/4.py
index 2007e4ac7f8..9a98833dc74 100644
--- a/solutions/4. Median of Two Sorted Arrays/4.py	
+++ b/solutions/4. Median of Two Sorted Arrays/4.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMedianSortedArrays(self, nums1: list[int], nums2: list[int]) -> float:
+  def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
     n1 = len(nums1)
     n2 = len(nums2)
     if n1 > n2:
diff --git a/solutions/40. Combination Sum II/40.cpp b/solutions/40. Combination Sum II/40.cpp
index d9c765b0526..def2a0d8f6b 100644
--- a/solutions/40. Combination Sum II/40.cpp	
+++ b/solutions/40. Combination Sum II/40.cpp	
@@ -8,7 +8,7 @@ class Solution {
   }
 
  private:
-  void dfs(const vector<int>& candidates, int s, int target, vector<int>&& path,
+  void dfs(const vector<int>& A, int s, int target, vector<int>&& path,
            vector<vector<int>>& ans) {
     if (target < 0)
       return;
@@ -17,11 +17,11 @@ class Solution {
       return;
     }
 
-    for (int i = s; i < candidates.size(); ++i) {
-      if (i > s && candidates[i] == candidates[i - 1])
+    for (int i = s; i < A.size(); ++i) {
+      if (i > s && A[i] == A[i - 1])
         continue;
-      path.push_back(candidates[i]);
-      dfs(candidates, i + 1, target - candidates[i], std::move(path), ans);
+      path.push_back(A[i]);
+      dfs(A, i + 1, target - A[i], move(path), ans);
       path.pop_back();
     }
   }
diff --git a/solutions/40. Combination Sum II/40.java b/solutions/40. Combination Sum II/40.java
index ca64212a71a..ab5f11ec786 100644
--- a/solutions/40. Combination Sum II/40.java	
+++ b/solutions/40. Combination Sum II/40.java	
@@ -2,11 +2,11 @@ class Solution {
   public List<List<Integer>> combinationSum2(int[] candidates, int target) {
     List<List<Integer>> ans = new ArrayList<>();
     Arrays.sort(candidates);
-    dfs(candidates, 0, target, new ArrayList<>(), ans);
+    dfs(0, candidates, target, new ArrayList<>(), ans);
     return ans;
   }
 
-  private void dfs(int[] candidates, int s, int target, List<Integer> path,
+  private void dfs(int s, int[] candidates, int target, List<Integer> path,
                    List<List<Integer>> ans) {
     if (target < 0)
       return;
@@ -19,7 +19,7 @@ private void dfs(int[] candidates, int s, int target, List<Integer> path,
       if (i > s && candidates[i] == candidates[i - 1])
         continue;
       path.add(candidates[i]);
-      dfs(candidates, i + 1, target - candidates[i], path, ans);
+      dfs(i + 1, candidates, target - candidates[i], path, ans);
       path.remove(path.size() - 1);
     }
   }
diff --git a/solutions/40. Combination Sum II/40.py b/solutions/40. Combination Sum II/40.py
index fdd35b24724..0f1cc70a780 100644
--- a/solutions/40. Combination Sum II/40.py	
+++ b/solutions/40. Combination Sum II/40.py	
@@ -1,9 +1,8 @@
 class Solution:
-  def combinationSum2(self, candidates: list[int],
-                      target: int) -> list[list[int]]:
+  def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:
     ans = []
 
-    def dfs(s: int, target: int, path: list[int]) -> None:
+    def dfs(s: int, target: int, path: List[int]) -> None:
       if target < 0:
         return
       if target == 0:
diff --git a/solutions/401. Binary Watch/401-2.py b/solutions/401. Binary Watch/401-2.py
index d0e5d08de86..4098384ec3d 100644
--- a/solutions/401. Binary Watch/401-2.py	
+++ b/solutions/401. Binary Watch/401-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def readBinaryWatch(self, turnedOn: int) -> list[str]:
+  def readBinaryWatch(self, turnedOn: int) -> List[str]:
     ans = []
 
     for h in range(12):
diff --git a/solutions/401. Binary Watch/401.py b/solutions/401. Binary Watch/401.py
index cf46f091ba0..d0d5c4735b0 100644
--- a/solutions/401. Binary Watch/401.py	
+++ b/solutions/401. Binary Watch/401.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def readBinaryWatch(self, turnedOn: int) -> list[str]:
+  def readBinaryWatch(self, turnedOn: int) -> List[str]:
     ans = []
     hours = [1, 2, 4, 8]
     minutes = [1, 2, 4, 8, 16, 32]
diff --git a/solutions/403. Frog Jump/403-2.py b/solutions/403. Frog Jump/403-2.py
index 9ec22c89f89..d20b1df0e0c 100644
--- a/solutions/403. Frog Jump/403-2.py	
+++ b/solutions/403. Frog Jump/403-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canCross(self, stones: list[int]) -> bool:
+  def canCross(self, stones: List[int]) -> bool:
     n = len(stones)
     # dp[i][j] := True if a frog can make a size j jump from stones[i]
     dp = [[False] * (n + 1) for _ in range(n)]
diff --git a/solutions/403. Frog Jump/403.py b/solutions/403. Frog Jump/403.py
index 77c2665f1b6..53a488dbe0f 100644
--- a/solutions/403. Frog Jump/403.py	
+++ b/solutions/403. Frog Jump/403.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canCross(self, stones: list[int]) -> bool:
+  def canCross(self, stones: List[int]) -> bool:
     n = len(stones)
     # dp[i][j] := True if a frog can make a size j jump to stones[i]
     dp = [[False] * (n + 1) for _ in range(n)]
diff --git a/solutions/404. Sum of Left Leaves/404-2.py b/solutions/404. Sum of Left Leaves/404-2.py
index cb72e1e5204..0160600808e 100644
--- a/solutions/404. Sum of Left Leaves/404-2.py	
+++ b/solutions/404. Sum of Left Leaves/404-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sumOfLeftLeaves(self, root: TreeNode | None) -> int:
+  def sumOfLeftLeaves(self, root: Optional[TreeNode]) -> int:
     if not root:
       return 0
 
diff --git a/solutions/404. Sum of Left Leaves/404.py b/solutions/404. Sum of Left Leaves/404.py
index 1180acac17d..160390ed393 100644
--- a/solutions/404. Sum of Left Leaves/404.py	
+++ b/solutions/404. Sum of Left Leaves/404.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sumOfLeftLeaves(self, root: TreeNode | None) -> int:
+  def sumOfLeftLeaves(self, root: Optional[TreeNode]) -> int:
     if not root:
       return 0
 
diff --git a/solutions/405. Convert a Number to Hexadecimal/405.cpp b/solutions/405. Convert a Number to Hexadecimal/405.cpp
index f14a3562b0c..a382f4e3545 100644
--- a/solutions/405. Convert a Number to Hexadecimal/405.cpp	
+++ b/solutions/405. Convert a Number to Hexadecimal/405.cpp	
@@ -13,7 +13,6 @@ class Solution {
       num >>= 4;
     }
 
-    ranges::reverse(ans);
-    return ans;
+    return {ans.rbegin(), ans.rend()};
   }
 };
diff --git a/solutions/406. Queue Reconstruction by Height/406.cpp b/solutions/406. Queue Reconstruction by Height/406.cpp
index 6d30113134b..5bdccff9efd 100644
--- a/solutions/406. Queue Reconstruction by Height/406.cpp	
+++ b/solutions/406. Queue Reconstruction by Height/406.cpp	
@@ -3,14 +3,12 @@ class Solution {
   vector<vector<int>> reconstructQueue(vector<vector<int>>& people) {
     vector<vector<int>> ans;
 
-    ranges::sort(people, ranges::less{}, [](const vector<int>& person) {
-      const int h = person[0];
-      const int k = person[1];
-      return pair<int, int>{-h, k};
+    ranges::sort(people, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] == b[0] ? a[1] < b[1] : a[0] > b[0];
     });
 
-    for (const vector<int>& person : people)
-      ans.insert(ans.begin() + person[1], person);
+    for (const vector<int>& p : people)
+      ans.insert(ans.begin() + p[1], p);
 
     return ans;
   }
diff --git a/solutions/406. Queue Reconstruction by Height/406.java b/solutions/406. Queue Reconstruction by Height/406.java
index f2d0302325d..1ec397c3935 100644
--- a/solutions/406. Queue Reconstruction by Height/406.java	
+++ b/solutions/406. Queue Reconstruction by Height/406.java	
@@ -2,11 +2,10 @@ class Solution {
   public int[][] reconstructQueue(int[][] people) {
     List<int[]> ans = new ArrayList<>();
 
-    Arrays.sort(people, Comparator.comparingInt((int[] person) -> - person[0])
-                            .thenComparingInt((int[] person) -> person[1]));
+    Arrays.sort(people, (a, b) -> a[0] == b[0] ? a[1] - b[1] : b[0] - a[0]);
 
-    for (final int[] person : people)
-      ans.add(person[1], person);
+    for (final int[] p : people)
+      ans.add(p[1], p);
 
     return ans.stream().toArray(int[][] ::new);
   }
diff --git a/solutions/406. Queue Reconstruction by Height/406.py b/solutions/406. Queue Reconstruction by Height/406.py
index 70c999c48cb..b50cb6ff4ed 100644
--- a/solutions/406. Queue Reconstruction by Height/406.py	
+++ b/solutions/406. Queue Reconstruction by Height/406.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def reconstructQueue(self, people: list[list[int]]) -> list[list[int]]:
+  def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
     ans = []
 
     people.sort(key=lambda x: (-x[0], x[1]))
 
-    for person in people:
-      ans.insert(person[1], person)
+    for p in people:
+      ans.insert(p[1], p)
 
     return ans
diff --git a/solutions/407. Trapping Rain Water II/407.cpp b/solutions/407. Trapping Rain Water II/407.cpp
index c0adb2bc00d..02a17df2e8f 100644
--- a/solutions/407. Trapping Rain Water II/407.cpp	
+++ b/solutions/407. Trapping Rain Water II/407.cpp	
@@ -2,12 +2,13 @@ struct T {
   int i;
   int j;
   int h;  // heightMap[i][j] or the height after filling water
+  T(int i, int j, int h) : i(i), j(j), h(h) {}
 };
 
 class Solution {
  public:
   int trapRainWater(vector<vector<int>>& heightMap) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = heightMap.size();
     const int n = heightMap[0].size();
     int ans = 0;
@@ -32,7 +33,7 @@ class Solution {
     while (!minHeap.empty()) {
       const auto [i, j, h] = minHeap.top();
       minHeap.pop();
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/407. Trapping Rain Water II/407.java b/solutions/407. Trapping Rain Water II/407.java
index 8945e42c9bf..505cae4f6f2 100644
--- a/solutions/407. Trapping Rain Water II/407.java	
+++ b/solutions/407. Trapping Rain Water II/407.java	
@@ -1,12 +1,21 @@
+class T {
+  public int i;
+  public int j;
+  public int h; // heightMap[i][j] or the height after filling water
+  public T(int i, int j, int h) {
+    this.i = i;
+    this.j = j;
+    this.h = h;
+  }
+}
+
 class Solution {
   public int trapRainWater(int[][] heightMap) {
-    // h := heightMap[i][j] or the height after filling water
-    record T(int i, int j, int h) {}
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = heightMap.length;
     final int n = heightMap[0].length;
     int ans = 0;
-    Queue<T> minHeap = new PriorityQueue<>(Comparator.comparingInt(T::h));
+    Queue<T> minHeap = new PriorityQueue<>((a, b) -> a.h - b.h);
     boolean[][] seen = new boolean[m][n];
 
     for (int i = 0; i < m; ++i) {
@@ -27,7 +36,7 @@ record T(int i, int j, int h) {}
       final int i = minHeap.peek().i;
       final int j = minHeap.peek().j;
       final int h = minHeap.poll().h;
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/407. Trapping Rain Water II/407.py b/solutions/407. Trapping Rain Water II/407.py
index 271e2c37bac..f3afa5c3f70 100644
--- a/solutions/407. Trapping Rain Water II/407.py	
+++ b/solutions/407. Trapping Rain Water II/407.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def trapRainWater(self, heightMap: list[list[int]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def trapRainWater(self, heightMap: List[List[int]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(heightMap)
     n = len(heightMap[0])
     ans = 0
@@ -21,7 +21,7 @@ def trapRainWater(self, heightMap: list[list[int]]) -> int:
 
     while minHeap:
       h, i, j = heapq.heappop(minHeap)
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/41. First Missing Positive/41.py b/solutions/41. First Missing Positive/41.py
index e893b8e0204..595f6d19a21 100644
--- a/solutions/41. First Missing Positive/41.py	
+++ b/solutions/41. First Missing Positive/41.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def firstMissingPositive(self, nums: list[int]) -> int:
+  def firstMissingPositive(self, nums: List[int]) -> int:
     n = len(nums)
 
     # Correct slot:
diff --git a/solutions/410. Split Array Largest Sum/410-2.py b/solutions/410. Split Array Largest Sum/410-2.py
index 81456424a11..f8fe43896ac 100644
--- a/solutions/410. Split Array Largest Sum/410-2.py	
+++ b/solutions/410. Split Array Largest Sum/410-2.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def splitArray(self, nums: list[int], k: int) -> int:
+  def splitArray(self, nums: List[int], k: int) -> int:
     n = len(nums)
     # dp[i][k] := the minimum of the maximum sum to split the first i numbers
     # into k groups
     dp = [[math.inf] * (k + 1) for _ in range(n + 1)]
-    prefix = list(itertools.accumulate(nums, initial=0))
+    prefix = [0] + list(itertools.accumulate(nums))
 
     for i in range(1, n + 1):
       dp[i][1] = prefix[i]
diff --git a/solutions/410. Split Array Largest Sum/410-3.py b/solutions/410. Split Array Largest Sum/410-3.py
index b14a765f240..c9afccbb1ce 100644
--- a/solutions/410. Split Array Largest Sum/410-3.py	
+++ b/solutions/410. Split Array Largest Sum/410-3.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def splitArray(self, nums: list[int], k: int) -> int:
+  def splitArray(self, nums: List[int], k: int) -> int:
     l = max(nums)
     r = sum(nums) + 1
 
diff --git a/solutions/410. Split Array Largest Sum/410.py b/solutions/410. Split Array Largest Sum/410.py
index acf5b07b5a8..26eb818f466 100644
--- a/solutions/410. Split Array Largest Sum/410.py	
+++ b/solutions/410. Split Array Largest Sum/410.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def splitArray(self, nums: list[int], k: int) -> int:
+  def splitArray(self, nums: List[int], k: int) -> int:
     prefix = list(itertools.accumulate(nums, initial=0))
 
     @functools.lru_cache(None)
diff --git a/solutions/411. Minimum Unique Word Abbreviation/411.py b/solutions/411. Minimum Unique Word Abbreviation/411.py
index 5834262613b..9807ca9b11d 100644
--- a/solutions/411. Minimum Unique Word Abbreviation/411.py	
+++ b/solutions/411. Minimum Unique Word Abbreviation/411.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minAbbreviation(self, target: str, dictionary: list[str]) -> str:
+  def minAbbreviation(self, target: str, dictionary: List[str]) -> str:
     m = len(target)
 
     def getMask(word: str) -> int:
diff --git a/solutions/412. Fizz Buzz/412.py b/solutions/412. Fizz Buzz/412.py
index a69828ff02f..e8d51d0b54b 100644
--- a/solutions/412. Fizz Buzz/412.py	
+++ b/solutions/412. Fizz Buzz/412.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def fizzBuzz(self, n: int) -> list[str]:
+  def fizzBuzz(self, n: int) -> List[str]:
     d = {3: 'Fizz', 5: 'Buzz'}
     return [''.join([d[k] for k in d if i % k == 0]) or str(i) for i in range(1, n + 1)]
diff --git a/solutions/413. Arithmetic Slices/413-2.py b/solutions/413. Arithmetic Slices/413-2.py
index afc099d3fde..1cd6f95f59e 100644
--- a/solutions/413. Arithmetic Slices/413-2.py	
+++ b/solutions/413. Arithmetic Slices/413-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfArithmeticSlices(self, nums: list[int]) -> int:
+  def numberOfArithmeticSlices(self, nums: List[int]) -> int:
     ans = 0
     dp = 0
 
diff --git a/solutions/413. Arithmetic Slices/413.py b/solutions/413. Arithmetic Slices/413.py
index de2b5f74a49..6888c7476b6 100644
--- a/solutions/413. Arithmetic Slices/413.py	
+++ b/solutions/413. Arithmetic Slices/413.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfArithmeticSlices(self, nums: list[int]) -> int:
+  def numberOfArithmeticSlices(self, nums: List[int]) -> int:
     n = len(nums)
     if n < 3:
       return 0
diff --git a/solutions/414. Third Maximum Number/414-2.java b/solutions/414. Third Maximum Number/414-2.java
index f06d4f2f836..8fc68ce3774 100644
--- a/solutions/414. Third Maximum Number/414-2.java	
+++ b/solutions/414. Third Maximum Number/414-2.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public int thirdMax(int[] nums) {
     Queue<Integer> minHeap = new PriorityQueue<>();
     Set<Integer> seen = new HashSet<>();
diff --git a/solutions/414. Third Maximum Number/414-2.py b/solutions/414. Third Maximum Number/414-2.py
index fdd426a5542..45786367bac 100644
--- a/solutions/414. Third Maximum Number/414-2.py	
+++ b/solutions/414. Third Maximum Number/414-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def thirdMax(self, nums: list[int]) -> int:
+  def thirdMax(self, nums: List[int]) -> int:
     minHeap = []
     seen = set()
 
diff --git a/solutions/414. Third Maximum Number/414.java b/solutions/414. Third Maximum Number/414.java
index b8ddef5ff46..4ecb1c31246 100644
--- a/solutions/414. Third Maximum Number/414.java	
+++ b/solutions/414. Third Maximum Number/414.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public int thirdMax(int[] nums) {
     long max1 = Long.MIN_VALUE; // the maximum
     long max2 = Long.MIN_VALUE; // the second maximum
diff --git a/solutions/414. Third Maximum Number/414.py b/solutions/414. Third Maximum Number/414.py
index d4753fc06e0..29b0b49be1e 100644
--- a/solutions/414. Third Maximum Number/414.py	
+++ b/solutions/414. Third Maximum Number/414.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def thirdMax(self, nums: list[int]) -> int:
+  def thirdMax(self, nums: List[int]) -> int:
     max1 = -math.inf  # the maximum
     max2 = -math.inf  # the second maximum
     max3 = -math.inf  # the third maximum
diff --git a/solutions/415. Add Strings/415.cpp b/solutions/415. Add Strings/415.cpp
index b675260897b..fb3f779d8e6 100644
--- a/solutions/415. Add Strings/415.cpp	
+++ b/solutions/415. Add Strings/415.cpp	
@@ -15,7 +15,7 @@ class Solution {
       carry /= 10;
     }
 
-    ranges::reverse(ans);
+    reverse(ans.begin(), ans.end());
     return ans;
   }
 };
diff --git a/solutions/416. Partition Equal Subset Sum/416-2.py b/solutions/416. Partition Equal Subset Sum/416-2.py
index 4c95bf4b33c..6a6a7a1abe0 100644
--- a/solutions/416. Partition Equal Subset Sum/416-2.py	
+++ b/solutions/416. Partition Equal Subset Sum/416-2.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def canPartition(self, nums: list[int]) -> bool:
+  def canPartition(self, nums: List[int]) -> bool:
     summ = sum(nums)
     if summ % 2 == 1:
       return False
     return self.knapsack_(nums, summ // 2)
 
-  def knapsack_(self, nums: list[int], subsetSum: int) -> bool:
+  def knapsack_(self, nums: List[int], subsetSum: int) -> bool:
     # dp[i] := True if i can be formed by nums so far
     dp = [False] * (subsetSum + 1)
     dp[0] = True
diff --git a/solutions/416. Partition Equal Subset Sum/416.py b/solutions/416. Partition Equal Subset Sum/416.py
index fb7f5f64964..d82df332996 100644
--- a/solutions/416. Partition Equal Subset Sum/416.py	
+++ b/solutions/416. Partition Equal Subset Sum/416.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def canPartition(self, nums: list[int]) -> bool:
+  def canPartition(self, nums: List[int]) -> bool:
     summ = sum(nums)
     if summ % 2 == 1:
       return False
     return self.knapsack_(nums, summ // 2)
 
-  def knapsack_(self, nums: list[int], subsetSum: int) -> bool:
+  def knapsack_(self, nums: List[int], subsetSum: int) -> bool:
     n = len(nums)
     # dp[i][j] := True if j can be formed by nums[0..i)
     dp = [[False] * (subsetSum + 1) for _ in range(n + 1)]
diff --git a/solutions/417. Pacific Atlantic Water Flow/417-2.java b/solutions/417. Pacific Atlantic Water Flow/417-2.java
index f5ad03d7bee..fb1b044b43f 100644
--- a/solutions/417. Pacific Atlantic Water Flow/417-2.java	
+++ b/solutions/417. Pacific Atlantic Water Flow/417-2.java	
@@ -19,7 +19,7 @@ public List<List<Integer>> pacificAtlantic(int[][] heights) {
     for (int i = 0; i < m; ++i)
       for (int j = 0; j < n; ++j)
         if (seenP[i][j] && seenA[i][j])
-          ans.add(new ArrayList<>(List.of(i, j)));
+          ans.add(new ArrayList<>(Arrays.asList(i, j)));
 
     return ans;
   }
diff --git a/solutions/417. Pacific Atlantic Water Flow/417-2.py b/solutions/417. Pacific Atlantic Water Flow/417-2.py
index 3c93598ab83..07d75b876ac 100644
--- a/solutions/417. Pacific Atlantic Water Flow/417-2.py	
+++ b/solutions/417. Pacific Atlantic Water Flow/417-2.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def pacificAtlantic(self, heights: list[list[int]]) -> list[list[int]]:
+  def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]:
     m = len(heights)
     n = len(heights[0])
     seenP = [[False] * n for _ in range(m)]
     seenA = [[False] * n for _ in range(m)]
 
-    def dfs(i: int, j: int, h: int, seen: list[list[bool]]) -> None:
+    def dfs(i: int, j: int, h: int, seen: List[List[bool]]) -> None:
       if i < 0 or i == m or j < 0 or j == n:
         return
       if seen[i][j] or heights[i][j] < h:
diff --git a/solutions/417. Pacific Atlantic Water Flow/417.cpp b/solutions/417. Pacific Atlantic Water Flow/417.cpp
index b936cacd5d2..8cc23229b16 100644
--- a/solutions/417. Pacific Atlantic Water Flow/417.cpp	
+++ b/solutions/417. Pacific Atlantic Water Flow/417.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   vector<vector<int>> pacificAtlantic(vector<vector<int>>& heights) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = heights.size();
     const int n = heights[0].size();
     vector<vector<int>> ans;
@@ -15,7 +15,7 @@ class Solution {
         const auto [i, j] = q.front();
         q.pop();
         const int h = heights[i][j];
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/417. Pacific Atlantic Water Flow/417.java b/solutions/417. Pacific Atlantic Water Flow/417.java
index 0f68037b41e..03a1dfe2f29 100644
--- a/solutions/417. Pacific Atlantic Water Flow/417.java	
+++ b/solutions/417. Pacific Atlantic Water Flow/417.java	
@@ -3,21 +3,21 @@ public List<List<Integer>> pacificAtlantic(int[][] heights) {
     final int m = heights.length;
     final int n = heights[0].length;
     List<List<Integer>> ans = new ArrayList<>();
-    Queue<Pair<Integer, Integer>> qP = new ArrayDeque<>();
-    Queue<Pair<Integer, Integer>> qA = new ArrayDeque<>();
+    Queue<int[]> qP = new ArrayDeque<>();
+    Queue<int[]> qA = new ArrayDeque<>();
     boolean[][] seenP = new boolean[m][n];
     boolean[][] seenA = new boolean[m][n];
 
     for (int i = 0; i < m; ++i) {
-      qP.offer(new Pair<>(i, 0));
-      qA.offer(new Pair<>(i, n - 1));
+      qP.offer(new int[] {i, 0});
+      qA.offer(new int[] {i, n - 1});
       seenP[i][0] = true;
       seenA[i][n - 1] = true;
     }
 
     for (int j = 0; j < n; ++j) {
-      qP.offer(new Pair<>(0, j));
-      qA.offer(new Pair<>(m - 1, j));
+      qP.offer(new int[] {0, j});
+      qA.offer(new int[] {m - 1, j});
       seenP[0][j] = true;
       seenA[m - 1][j] = true;
     }
@@ -28,26 +28,26 @@ public List<List<Integer>> pacificAtlantic(int[][] heights) {
     for (int i = 0; i < m; ++i)
       for (int j = 0; j < n; ++j)
         if (seenP[i][j] && seenA[i][j])
-          ans.add(new ArrayList<>(List.of(i, j)));
+          ans.add(new ArrayList<>(Arrays.asList(i, j)));
 
     return ans;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
-  private void bfs(int[][] heights, Queue<Pair<Integer, Integer>> q, boolean[][] seen) {
+  private void bfs(int[][] heights, Queue<int[]> q, boolean[][] seen) {
     while (!q.isEmpty()) {
-      final int i = q.peek().getKey();
-      final int j = q.poll().getValue();
+      final int i = q.peek()[0];
+      final int j = q.poll()[1];
       final int h = heights[i][j];
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == heights.length || y < 0 || y == heights[0].length)
           continue;
         if (seen[x][y] || heights[x][y] < h)
           continue;
-        q.offer(new Pair<>(x, y));
+        q.offer(new int[] {x, y});
         seen[x][y] = true;
       }
     }
diff --git a/solutions/417. Pacific Atlantic Water Flow/417.py b/solutions/417. Pacific Atlantic Water Flow/417.py
index 6820db22d2e..29f2802d1ba 100644
--- a/solutions/417. Pacific Atlantic Water Flow/417.py	
+++ b/solutions/417. Pacific Atlantic Water Flow/417.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def pacificAtlantic(self, heights: list[list[int]]) -> list[list[int]]:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(heights)
     n = len(heights[0])
     qP = collections.deque()
@@ -20,11 +20,11 @@ def pacificAtlantic(self, heights: list[list[int]]) -> list[list[int]]:
       seenP[0][j] = True
       seenA[m - 1][j] = True
 
-    def bfs(q: deque, seen: list[list[bool]]):
+    def bfs(q: deque, seen: List[List[bool]]):
       while q:
         i, j = q.popleft()
         h = heights[i][j]
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           x = i + dx
           y = j + dy
           if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/418. Sentence Screen Fitting/418.cpp b/solutions/418. Sentence Screen Fitting/418.cpp
index 181d4b24b38..acff99c7c4c 100644
--- a/solutions/418. Sentence Screen Fitting/418.cpp	
+++ b/solutions/418. Sentence Screen Fitting/418.cpp	
@@ -5,7 +5,7 @@ class Solution {
     const int n = combined.length();
     int i = 0;  // (i % n) points to the index of combined in each row
 
-    while (rows-- > 0) {
+    while (rows--) {
       i += cols;
       if (combined[i % n] == ' ') {
         ++i;
diff --git a/solutions/418. Sentence Screen Fitting/418.py b/solutions/418. Sentence Screen Fitting/418.py
index c149102a272..b3dfa3db646 100644
--- a/solutions/418. Sentence Screen Fitting/418.py	
+++ b/solutions/418. Sentence Screen Fitting/418.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def wordsTyping(self, sentence: list[str], rows: int, cols: int) -> int:
+  def wordsTyping(self, sentence: List[str], rows: int, cols: int) -> int:
     combined = ' '.join(sentence) + ' '
     n = len(combined)
     i = 0
diff --git a/solutions/419. Battleships in a Board/419.py b/solutions/419. Battleships in a Board/419.py
index e2fe0aaf6c4..0b102cb4647 100644
--- a/solutions/419. Battleships in a Board/419.py	
+++ b/solutions/419. Battleships in a Board/419.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def countBattleships(self, board: list[list[str]]) -> int:
+  def countBattleships(self, board: List[List[str]]) -> int:
     ans = 0
 
     for i, row in enumerate(board):
diff --git a/solutions/42. Trapping Rain Water/42-2.py b/solutions/42. Trapping Rain Water/42-2.py
index 7e1502593c8..0124a4991a6 100644
--- a/solutions/42. Trapping Rain Water/42-2.py	
+++ b/solutions/42. Trapping Rain Water/42-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def trap(self, height: list[int]) -> int:
+  def trap(self, height: List[int]) -> int:
     if not height:
       return 0
 
diff --git a/solutions/42. Trapping Rain Water/42.py b/solutions/42. Trapping Rain Water/42.py
index 850a75fbe48..1a4cd931f33 100644
--- a/solutions/42. Trapping Rain Water/42.py	
+++ b/solutions/42. Trapping Rain Water/42.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def trap(self, height: list[int]) -> int:
+  def trap(self, height: List[int]) -> int:
     n = len(height)
     l = [0] * n  # l[i] := max(height[0..i])
     r = [0] * n  # r[i] := max(height[i..n))
diff --git a/solutions/420. Strong Password Checker/420.py b/solutions/420. Strong Password Checker/420.py
index e598d777290..51955a5b646 100644
--- a/solutions/420. Strong Password Checker/420.py	
+++ b/solutions/420. Strong Password Checker/420.py	
@@ -41,7 +41,7 @@ def strongPasswordChecker(self, password: str) -> int:
     return deletes + max(replaces, missing)
 
   def _getMissing(self, password: str) -> int:
-    return (3
-            - any(c.isupper() for c in password)
-            - any(c.islower() for c in password)
-            - any(c.isdigit() for c in password))
+    return 3 - \
+        any(c.isupper() for c in password) - \
+        any(c.islower() for c in password) - \
+        any(c.isdigit() for c in password)
diff --git a/solutions/421. Maximum XOR of Two Numbers in an Array/421-2.py b/solutions/421. Maximum XOR of Two Numbers in an Array/421-2.py
index 1c7e1960fd8..8b098d5dc64 100644
--- a/solutions/421. Maximum XOR of Two Numbers in an Array/421-2.py	
+++ b/solutions/421. Maximum XOR of Two Numbers in an Array/421-2.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: list[TrieNode | None] = [None] * 2
+    self.children: List[Optional[TrieNode]] = [None] * 2
 
 
 class BitTrie:
@@ -33,7 +33,7 @@ def getMaxXor(self, num: int) -> int:
 
 
 class Solution:
-  def findMaximumXOR(self, nums: list[int]) -> int:
+  def findMaximumXOR(self, nums: List[int]) -> int:
     maxNum = max(nums)
     if maxNum == 0:
       return 0
diff --git a/solutions/421. Maximum XOR of Two Numbers in an Array/421.py b/solutions/421. Maximum XOR of Two Numbers in an Array/421.py
index 4a767b2ecd8..3621c87b760 100644
--- a/solutions/421. Maximum XOR of Two Numbers in an Array/421.py	
+++ b/solutions/421. Maximum XOR of Two Numbers in an Array/421.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaximumXOR(self, nums: list[int]) -> int:
+  def findMaximumXOR(self, nums: List[int]) -> int:
     maxNum = max(nums)
     if maxNum == 0:
       return 0
diff --git a/solutions/422. Valid Word Square/422.py b/solutions/422. Valid Word Square/422.py
index 5f912dd75bf..6074c4231dc 100644
--- a/solutions/422. Valid Word Square/422.py	
+++ b/solutions/422. Valid Word Square/422.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def validWordSquare(self, words: list[str]) -> bool:
+  def validWordSquare(self, words: List[str]) -> bool:
     for i, word in enumerate(words):
       for j, c in enumerate(word):
         if len(words) <= j or len(words[j]) <= i:  # out-of-bounds
diff --git a/solutions/423. Reconstruct Original Digits from English/423.py b/solutions/423. Reconstruct Original Digits from English/423.py
index 3e975014edd..0b48c4fa785 100644
--- a/solutions/423. Reconstruct Original Digits from English/423.py	
+++ b/solutions/423. Reconstruct Original Digits from English/423.py	
@@ -29,5 +29,5 @@ def originalDigits(self, s: str) -> str:
     count[5] -= count[4]
     count[7] -= count[6]
     count[9] -= count[5] + count[6] + count[8]
-    return ''.join(chr(i + ord('0')) for i, c in enumerate(count)
-                   for _ in range(c))
+
+    return ''.join(chr(i + ord('0')) for i, c in enumerate(count) for j in range(c))
diff --git a/solutions/425. Word Squares/425.py b/solutions/425. Word Squares/425.py
index 82685605907..2f7a03573c4 100644
--- a/solutions/425. Word Squares/425.py	
+++ b/solutions/425. Word Squares/425.py	
@@ -1,16 +1,16 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
-    self.startsWith: list[str] = []
+    self.children: Dict[str, TrieNode] = collections.defaultdict(TrieNode)
+    self.startsWith: List[str] = []
 
 
 class Trie:
-  def __init__(self, words: list[str]):
+  def __init__(self, words: List[str]):
     self.root = TrieNode()
     for word in words:
       self._insert(word)
 
-  def findBy(self, prefix: str) -> list[str]:
+  def findBy(self, prefix: str) -> List[str]:
     node = self.root
     for c in prefix:
       if c not in node.children:
@@ -26,7 +26,7 @@ def _insert(self, word: str) -> None:
 
 
 class Solution:
-  def wordSquares(self, words: list[str]) -> list[list[str]]:
+  def wordSquares(self, words: List[str]) -> List[List[str]]:
     if not words:
       return []
 
@@ -42,7 +42,7 @@ def wordSquares(self, words: list[str]) -> list[list[str]]:
 
     return ans
 
-  def _dfs(self, trie: Trie, n: int, path: list[str], ans: list[list[str]]):
+  def _dfs(self, trie: Trie, n: int, path: List[str], ans: List[List[str]]):
     if len(path) == n:
       ans.append(path.copy())
       return
@@ -51,10 +51,10 @@ def _dfs(self, trie: Trie, n: int, path: list[str], ans: list[list[str]]):
 
     for s in trie.findBy(prefix):
       path.append(s)
-      self._dfs(trie, n, path, ans)
+      self.dfs(trie, n, path, ans)
       path.pop()
 
-  def _getPrefix(self, path: list[str]) -> str:
+  def _getPrefix(self, path: List[str]) -> str:
     """
     e.g. path = ["wall",
                  "area"]
diff --git a/solutions/426. Convert Binary Search Tree to Sorted Doubly Linked List/426-2.py b/solutions/426. Convert Binary Search Tree to Sorted Doubly Linked List/426-2.py
index c693aef7b15..c7671af8319 100644
--- a/solutions/426. Convert Binary Search Tree to Sorted Doubly Linked List/426-2.py	
+++ b/solutions/426. Convert Binary Search Tree to Sorted Doubly Linked List/426-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def treeToDoublyList(self, root: 'Node | None') -> 'Node | None':
+  def treeToDoublyList(self, root: 'Optional[Node]') -> 'Optional[Node]':
     if not root:
       return None
 
diff --git a/solutions/426. Convert Binary Search Tree to Sorted Doubly Linked List/426.py b/solutions/426. Convert Binary Search Tree to Sorted Doubly Linked List/426.py
index cf107e7cd75..9d72d428b8b 100644
--- a/solutions/426. Convert Binary Search Tree to Sorted Doubly Linked List/426.py	
+++ b/solutions/426. Convert Binary Search Tree to Sorted Doubly Linked List/426.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def treeToDoublyList(self, root: 'Node | None') -> 'Node | None':
+  def treeToDoublyList(self, root: 'Optional[Node]') -> 'Optional[Node]':
     if not root:
       return None
     leftHead = self.treeToDoublyList(root.left)
@@ -8,7 +8,7 @@ def treeToDoublyList(self, root: 'Node | None') -> 'Node | None':
     root.right = root
     return self._connect(self._connect(leftHead, root), rightHead)
 
-  def _connect(self, node1: 'Node | None', node2: 'Node | None') -> 'Node | None':
+  def _connect(self, node1: 'Optional[Node]', node2: 'Optional[Node]') -> 'Optional[Node]':
     if not node1:
       return node2
     if not node2:
diff --git a/solutions/427. Construct Quad Tree/427.cpp b/solutions/427. Construct Quad Tree/427.cpp
index d6f15f2caee..6652baaefe5 100644
--- a/solutions/427. Construct Quad Tree/427.cpp	
+++ b/solutions/427. Construct Quad Tree/427.cpp	
@@ -7,13 +7,14 @@ class Solution {
  private:
   Node* helper(const vector<vector<int>>& grid, int i, int j, int w) {
     if (allSame(grid, i, j, w))
-      return new Node(grid[i][j] == 1, /*isLeaft=*/true);
-    const int half = w / 2;
-    return new Node(/*val=*/true, /*isLeaf=*/false,
-                    /*topLeft=*/helper(grid, i, j, half),
-                    /*topRight=*/helper(grid, i, j + half, half),
-                    /*bottomLeft=*/helper(grid, i + half, j, half),
-                    /*bottomRight=*/helper(grid, i + half, j + half, half));
+      return new Node(grid[i][j], true);
+
+    Node* node = new Node(true, false);
+    node->topLeft = helper(grid, i, j, w / 2);
+    node->topRight = helper(grid, i, j + w / 2, w / 2);
+    node->bottomLeft = helper(grid, i + w / 2, j, w / 2);
+    node->bottomRight = helper(grid, i + w / 2, j + w / 2, w / 2);
+    return node;
   }
 
   bool allSame(const vector<vector<int>>& grid, int i, int j, int w) {
diff --git a/solutions/427. Construct Quad Tree/427.java b/solutions/427. Construct Quad Tree/427.java
index 50b5bd47de3..c7f4717611a 100644
--- a/solutions/427. Construct Quad Tree/427.java	
+++ b/solutions/427. Construct Quad Tree/427.java	
@@ -5,13 +5,14 @@ public Node construct(int[][] grid) {
 
   private Node helper(int[][] grid, int i, int j, int w) {
     if (allSame(grid, i, j, w))
-      return new Node(grid[i][j] == 1, /*isLeaf=*/true);
-    final int half = w / 2;
-    return new Node(/*val=*/true, /*isLeaf=*/false,
-                    /*topLeft=*/helper(grid, i, j, half),
-                    /*topRight=*/helper(grid, i, j + half, half),
-                    /*bottomLeft=*/helper(grid, i + half, j, half),
-                    /*bottomRight=*/helper(grid, i + half, j + half, half));
+      return new Node(grid[i][j] == 1 ? true : false, true);
+
+    Node node = new Node(true, false);
+    node.topLeft = helper(grid, i, j, w / 2);
+    node.topRight = helper(grid, i, j + w / 2, w / 2);
+    node.bottomLeft = helper(grid, i + w / 2, j, w / 2);
+    node.bottomRight = helper(grid, i + w / 2, j + w / 2, w / 2);
+    return node;
   }
 
   private boolean allSame(int[][] grid, int i, int j, int w) {
diff --git a/solutions/427. Construct Quad Tree/427.py b/solutions/427. Construct Quad Tree/427.py
deleted file mode 100644
index 92cb39a746f..00000000000
--- a/solutions/427. Construct Quad Tree/427.py	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution:
-  def construct(self, grid: list[list[int]]) -> 'Node':
-    return self._helper(grid, 0, 0, len(grid))
-
-  def _helper(self, grid: list[list[int]], i: int, j: int, w: int) -> 'Node':
-    if self._allSame(grid, i, j, w):
-      return Node(grid[i][j] == 1, True)
-    half = w // 2
-    return Node(True, False,
-                self._helper(grid, i, j, half),
-                self._helper(grid, i, j + half, half),
-                self._helper(grid, i + half, j, half),
-                self._helper(grid, i + half, j + half, half))
-
-  def _allSame(self, grid: list[list[int]], i: int, j: int, w: int) -> bool:
-    return all(grid[x][y] == grid[i][j]
-               for x in range(i, i + w)
-               for y in range(j, j + w))
diff --git a/solutions/428. Serialize and Deserialize N-ary Tree/428.cpp b/solutions/428. Serialize and Deserialize N-ary Tree/428.cpp
index afb45f9fa70..e75545e95fe 100644
--- a/solutions/428. Serialize and Deserialize N-ary Tree/428.cpp	
+++ b/solutions/428. Serialize and Deserialize N-ary Tree/428.cpp	
@@ -41,8 +41,9 @@ class Codec {
     while (iss >> word) {
       Node* parent = q.front();
       q.pop();
+      vector<string> kids = getKids(word);
       vector<Node*> children;
-      for (const string& kid : getKids(word)) {
+      for (const string& kid : kids) {
         if (kid == "n")
           continue;
         Node* child = new Node(stoi(kid));
diff --git a/solutions/428. Serialize and Deserialize N-ary Tree/428.java b/solutions/428. Serialize and Deserialize N-ary Tree/428.java
index c35e8b00384..13c141e6023 100644
--- a/solutions/428. Serialize and Deserialize N-ary Tree/428.java	
+++ b/solutions/428. Serialize and Deserialize N-ary Tree/428.java	
@@ -5,7 +5,7 @@ public String serialize(Node root) {
       return "";
 
     StringBuilder sb = new StringBuilder().append(root.val).append(",");
-    Queue<Node> q = new ArrayDeque<>(List.of(root));
+    Queue<Node> q = new ArrayDeque<>(Arrays.asList(root));
 
     while (!q.isEmpty())
       for (int sz = q.size(); sz > 0; --sz) {
@@ -31,12 +31,13 @@ public Node deserialize(String data) {
 
     final String[] vals = data.split(",");
     Node root = new Node(Integer.parseInt(vals[0]));
-    Queue<Node> q = new ArrayDeque<>(List.of(root));
+    Queue<Node> q = new ArrayDeque<>(Arrays.asList(root));
 
     for (int i = 1; i < vals.length; ++i) {
       Node parent = q.poll();
+      final String[] kids = vals[i].split("#");
       List<Node> children = new ArrayList<>();
-      for (final String kid : vals[i].split("#")) {
+      for (final String kid : kids) {
         if (kid.equals("n"))
           continue;
         Node child = new Node(Integer.parseInt(kid));
diff --git a/solutions/428. Serialize and Deserialize N-ary Tree/428.py b/solutions/428. Serialize and Deserialize N-ary Tree/428.py
deleted file mode 100644
index 188f2083e9a..00000000000
--- a/solutions/428. Serialize and Deserialize N-ary Tree/428.py	
+++ /dev/null
@@ -1,44 +0,0 @@
-class Codec:
-  def serialize(self, root: 'Node') -> str:
-    """Encodes a tree to a single string."""
-    if not root:
-      return ''
-
-    s = []
-    q = collections.deque([root])
-    s.append(str(root.val) + ' ')
-
-    while q:
-      for _ in range(len(q)):
-        node = q.popleft()
-        if not node.children:
-          s.append('n')
-        else:
-          for child in node.children:
-            q.append(child)
-            s.append(str(child.val) + '#')
-        s.append(' ')
-
-    return ''.join(s)
-
-  def deserialize(self, data: str) -> 'Node':
-    """Decodes your encoded data to tree."""
-    if not data:
-      return None
-
-    words = data.split()
-    root = Node(int(words[0]))
-    q = collections.deque([root])
-
-    for word in words[1:]:
-      parent = q.popleft()
-      children = []
-      for kid in word.split('#'):
-        if kid in ('', 'n'):
-          continue
-        child = Node(int(kid))
-        children.append(child)
-        q.append(child)
-      parent.children = children
-
-    return root
diff --git a/solutions/429. N-ary Tree Level Order Traversal/429.java b/solutions/429. N-ary Tree Level Order Traversal/429.java
index f4e9738b269..a9e58bed478 100644
--- a/solutions/429. N-ary Tree Level Order Traversal/429.java	
+++ b/solutions/429. N-ary Tree Level Order Traversal/429.java	
@@ -4,7 +4,7 @@ public List<List<Integer>> levelOrder(Node root) {
       return new ArrayList<>();
 
     List<List<Integer>> ans = new ArrayList<>();
-    Queue<Node> q = new ArrayDeque<>(List.of(root));
+    Queue<Node> q = new ArrayDeque<>(Arrays.asList(root));
 
     while (!q.isEmpty()) {
       List<Integer> currLevel = new ArrayList<>();
diff --git a/solutions/429. N-ary Tree Level Order Traversal/429.py b/solutions/429. N-ary Tree Level Order Traversal/429.py
deleted file mode 100644
index 7a06ad582f5..00000000000
--- a/solutions/429. N-ary Tree Level Order Traversal/429.py	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution:
-  def levelOrder(self, root: 'Node') -> list[list[int]]:
-    if not root:
-      return []
-
-    ans = []
-    q = collections.deque([root])
-
-    while q:
-      currLevel = []
-      for _ in range(len(q)):
-        node = q.popleft()
-        currLevel.append(node.val)
-        for child in node.children:
-          q.append(child)
-      ans.append(currLevel)
-
-    return ans
diff --git a/solutions/430. Flatten a Multilevel Doubly Linked List/430-2.cpp b/solutions/430. Flatten a Multilevel Doubly Linked List/430-2.cpp
index 1b67f8a3cea..e270c23aa09 100644
--- a/solutions/430. Flatten a Multilevel Doubly Linked List/430-2.cpp	
+++ b/solutions/430. Flatten a Multilevel Doubly Linked List/430-2.cpp	
@@ -8,7 +8,7 @@ class Solution {
         curr->child->prev = curr;
         curr->child = nullptr;
         Node* tail = curr->next;
-        while (tail->next != nullptr)
+        while (tail->next)
           tail = tail->next;
         tail->next = cachedNext;
         if (cachedNext != nullptr)
diff --git a/solutions/431. Encode N-ary Tree to Binary Tree/431-2.py b/solutions/431. Encode N-ary Tree to Binary Tree/431-2.py
index 8e6eb7cd9bf..3365a8da743 100644
--- a/solutions/431. Encode N-ary Tree to Binary Tree/431-2.py	
+++ b/solutions/431. Encode N-ary Tree to Binary Tree/431-2.py	
@@ -1,6 +1,6 @@
 class Codec:
   # Encodes an n-ary tree to a binary tree.
-  def encode(self, root: 'Node') -> TreeNode | None:
+  def encode(self, root: 'Node') -> Optional[TreeNode]:
     if not root:
       return None
 
@@ -19,7 +19,7 @@ def encode(self, root: 'Node') -> TreeNode | None:
     return rootTreeNode
 
   # Decodes your binary tree to an n-ary tree.
-  def decode(self, root: TreeNode | None) -> 'Node':
+  def decode(self, root: Optional[TreeNode]) -> 'Node':
     if not root:
       return None
 
diff --git a/solutions/431. Encode N-ary Tree to Binary Tree/431.cpp b/solutions/431. Encode N-ary Tree to Binary Tree/431.cpp
index 6af8a94dfb5..de91a898553 100644
--- a/solutions/431. Encode N-ary Tree to Binary Tree/431.cpp	
+++ b/solutions/431. Encode N-ary Tree to Binary Tree/431.cpp	
@@ -40,7 +40,7 @@ class Codec {
       const auto [parentNode, parentTreeNode] = q.front();
       q.pop();
       TreeNode* sibling = parentTreeNode->left;
-      while (sibling != nullptr) {
+      while (sibling) {
         Node* currNode = new Node(sibling->val);
         parentNode->children.push_back(currNode);
         q.emplace(currNode, sibling);
diff --git a/solutions/431. Encode N-ary Tree to Binary Tree/431.java b/solutions/431. Encode N-ary Tree to Binary Tree/431.java
index 4cbefb92de3..ee9dd4e5f71 100644
--- a/solutions/431. Encode N-ary Tree to Binary Tree/431.java	
+++ b/solutions/431. Encode N-ary Tree to Binary Tree/431.java	
@@ -5,7 +5,7 @@ public TreeNode encode(Node root) {
       return null;
 
     TreeNode rootTreeNode = new TreeNode(root.val);
-    Queue<Pair<Node, TreeNode>> q = new ArrayDeque<>(List.of(new Pair<>(root, rootTreeNode)));
+    Queue<Pair<Node, TreeNode>> q = new ArrayDeque<>(Arrays.asList(new Pair<>(root, rootTreeNode)));
 
     while (!q.isEmpty()) {
       Node parentNode = q.peek().getKey();
@@ -33,7 +33,7 @@ public Node decode(TreeNode root) {
       return null;
 
     Node rootNode = new Node(root.val, new ArrayList<>());
-    Queue<Pair<Node, TreeNode>> q = new ArrayDeque<>(List.of(new Pair<>(rootNode, root)));
+    Queue<Pair<Node, TreeNode>> q = new ArrayDeque<>(Arrays.asList(new Pair<>(rootNode, root)));
 
     while (!q.isEmpty()) {
       Node parentNode = q.peek().getKey();
diff --git a/solutions/431. Encode N-ary Tree to Binary Tree/431.py b/solutions/431. Encode N-ary Tree to Binary Tree/431.py
index 972e0333207..38f71eea705 100644
--- a/solutions/431. Encode N-ary Tree to Binary Tree/431.py	
+++ b/solutions/431. Encode N-ary Tree to Binary Tree/431.py	
@@ -1,6 +1,6 @@
 class Codec:
   # Encodes an n-ary tree to a binary tree.
-  def encode(self, root: 'Node') -> TreeNode | None:
+  def encode(self, root: 'Node') -> Optional[TreeNode]:
     if not root:
       return None
 
@@ -24,7 +24,7 @@ def encode(self, root: 'Node') -> TreeNode | None:
     return rootTreeNode
 
   # Decodes your binary tree to an n-ary tree.
-  def decode(self, root: TreeNode | None) -> 'Node':
+  def decode(self, root: Optional[TreeNode]) -> 'Node':
     if not root:
       return None
 
diff --git a/solutions/432. All O`one Data Structure/432.cpp b/solutions/432. All O`one Data Structure/432.cpp
index e1594afc083..0fb2dfd3303 100644
--- a/solutions/432. All O`one Data Structure/432.cpp	
+++ b/solutions/432. All O`one Data Structure/432.cpp	
@@ -1,88 +1,75 @@
-struct Node {
-  int count;
-  unordered_set<string> keys;
-};
-
 class AllOne {
  public:
   void inc(string key) {
-    if (const auto it = keyToIterator.find(key); it == keyToIterator.end())
-      addNewKey(key);
-    else
-      incrementExistingKey(it, key);
-  }
-
-  void dec(string key) {
     const auto it = keyToIterator.find(key);
-    // It is guaranteed that key exists in the data structure before the
-    // decrement.
-    decrementExistingKey(it, key);
-  }
 
-  string getMaxKey() {
-    return nodeList.empty() ? "" : *nodeList.back().keys.begin();
-  }
+    // Doesn't find the key.
+    if (it == keyToIterator.cend()) {
+      if (l.empty() || l.front().value > 1)
+        l.push_front({1, {key}});
+      else
+        l.front().keys.insert(key);
+      keyToIterator[key] = l.begin();
+      return;
+    }
 
-  string getMinKey() {
-    return nodeList.empty() ? "" : *nodeList.front().keys.begin();
-  }
+    const auto lit = it->second;  // list iterator
+    auto nit = next(lit);         // next iterator
 
- private:
-  list<Node> nodeList;  // list of nodes sorted by count
-  unordered_map<string, list<Node>::iterator> keyToIterator;
+    if (nit == l.end() || nit->value > lit->value + 1)
+      nit = l.insert(nit, {lit->value + 1, {key}});
+    else  // nit->value == lit->value + 1
+      nit->keys.insert(key);
+    keyToIterator[key] = nit;  // Reset the mapping.
 
-  // Adds a new node with count 1.
-  void addNewKey(const string& key) {
-    if (nodeList.empty() || nodeList.front().count > 1)
-      nodeList.push_front({1, {key}});
-    else  // nodeList.front().count == 1
-      nodeList.front().keys.insert(key);
-    keyToIterator[key] = nodeList.begin();
+    // Remove the key in the keys set.
+    lit->keys.erase(key);
+    if (lit->keys.empty())
+      l.erase(lit);
   }
 
-  // Increments the count of the key by 1.
-  void incrementExistingKey(
-      unordered_map<string, list<Node>::iterator>::iterator it,
-      const string& key) {
-    const auto listIt = it->second;
+  void dec(string key) {
+    const auto it = keyToIterator.find(key);
 
-    auto nextIt = next(listIt);
-    const int newCount = listIt->count + 1;
-    if (nextIt == nodeList.end() || nextIt->count > newCount)
-      nextIt = nodeList.insert(nextIt, {newCount, {key}});
-    else  // Node with count + 1 exists.
-      nextIt->keys.insert(key);
+    // Doens't find the key.
+    if (it == keyToIterator.cend())
+      return;
 
-    keyToIterator[key] = nextIt;
-    remove(listIt, key);
-  }
+    const auto lit = it->second;  // list iterator
 
-  // Decrements the count of the key by 1.
-  void decrementExistingKey(
-      unordered_map<string, list<Node>::iterator>::iterator it,
-      const string& key) {
-    const auto listIt = it->second;
-    if (listIt->count == 1) {
-      keyToIterator.erase(it);
-      remove(listIt, key);
-      return;
+    if (lit->value == 1) {
+      // no need to find the previous iterator in this case.
+      keyToIterator.erase(key);
+    } else {
+      auto pit = prev(lit);  // the previous iterator
+
+      if (lit == l.begin() || pit->value < lit->value - 1)
+        pit = l.insert(lit, {lit->value - 1, {key}});
+      else  // pit->value == lit-value - 1
+        pit->keys.insert(key);
+      keyToIterator[key] = pit;  // Reset the mapping.
     }
 
-    auto prevIt = prev(listIt);
-    const int newCount = listIt->count - 1;
-    if (listIt == nodeList.begin() || prevIt->count < newCount)
-      prevIt = nodeList.insert(listIt, {newCount, {key}});
-    else  // Node with count - 1 exists.
-      prevIt->keys.insert(key);
+    // Remove the key in the keys set.
+    lit->keys.erase(key);
+    if (lit->keys.empty())
+      l.erase(lit);
+  }
 
-    keyToIterator[key] = prevIt;
-    remove(listIt, key);
+  string getMaxKey() {
+    return l.empty() ? "" : *l.back().keys.cbegin();
   }
 
-  // Removes the key from the node list.
-  void remove(list<Node>::iterator it, const string& key) {
-    it->keys.erase(key);
-    if (it->keys.empty())
-      nodeList.erase(it);
+  string getMinKey() {
+    return l.empty() ? "" : *l.front().keys.cbegin();
   }
+
+ private:
+  struct Node {
+    int value;
+    unordered_set<string> keys;
+  };
+
+  list<Node> l;
+  unordered_map<string, list<Node>::iterator> keyToIterator;
 };
diff --git a/solutions/432. All O`one Data Structure/432.java b/solutions/432. All O`one Data Structure/432.java
deleted file mode 100644
index 161de957133..00000000000
--- a/solutions/432. All O`one Data Structure/432.java	
+++ /dev/null
@@ -1,99 +0,0 @@
-class Node {
-  public int count;
-  public Set<String> keys = new HashSet<>();
-  public Node prev = null;
-  public Node next = null;
-  public Node(int count) {
-    this.count = count;
-  }
-  public Node(int count, String key) {
-    this.count = count;
-    keys.add(key);
-  }
-}
-
-class AllOne {
-  public AllOne() {
-    head.next = tail;
-    tail.prev = head;
-  }
-
-  public void inc(String key) {
-    if (keyToNode.containsKey(key))
-      incrementExistingKey(key);
-    else
-      addNewKey(key);
-  }
-
-  public void dec(String key) {
-    // It is guaranteed that key exists in the data structure before the
-    // decrement.
-    decrementExistingKey(key);
-  }
-
-  public String getMaxKey() {
-    return tail.prev == head ? "" : tail.prev.keys.iterator().next();
-  }
-
-  public String getMinKey() {
-    return head.next == tail ? "" : head.next.keys.iterator().next();
-  }
-
-  private Map<String, Node> keyToNode = new HashMap<>();
-  private Node head = new Node(0);
-  private Node tail = new Node(0);
-
-  // Adds a new node with frequency 1.
-  private void addNewKey(final String key) {
-    if (head.next.count == 1)
-      head.next.keys.add(key);
-    else
-      insertAfter(head, new Node(1, key));
-    keyToNode.put(key, head.next);
-  }
-
-  // Increments the frequency of the key by 1.
-  private void incrementExistingKey(final String key) {
-    Node node = keyToNode.get(key);
-    node.keys.remove(key);
-
-    if (node.next == tail || node.next.count > node.count + 1)
-      insertAfter(node, new Node(node.count + 1));
-
-    node.next.keys.add(key);
-    keyToNode.put(key, node.next);
-
-    if (node.keys.isEmpty())
-      remove(node);
-  }
-
-  // Decrements the count of the key by 1.
-  private void decrementExistingKey(final String key) {
-    Node node = keyToNode.get(key);
-    node.keys.remove(key);
-
-    if (node.count > 1) {
-      if (node.prev == head || node.prev.count != node.count - 1)
-        insertAfter(node.prev, new Node(node.count - 1));
-      node.prev.keys.add(key);
-      keyToNode.put(key, node.prev);
-    } else {
-      keyToNode.remove(key);
-    }
-
-    if (node.keys.isEmpty())
-      remove(node);
-  }
-
-  private void insertAfter(Node node, Node newNode) {
-    newNode.prev = node;
-    newNode.next = node.next;
-    node.next.prev = newNode;
-    node.next = newNode;
-  }
-
-  private void remove(Node node) {
-    node.prev.next = node.next;
-    node.next.prev = node.prev;
-  }
-}
diff --git a/solutions/432. All O`one Data Structure/432.py b/solutions/432. All O`one Data Structure/432.py
deleted file mode 100644
index 4c7188a8898..00000000000
--- a/solutions/432. All O`one Data Structure/432.py	
+++ /dev/null
@@ -1,86 +0,0 @@
-from dataclasses import dataclass
-
-
-@dataclass
-class Node:
-  def __init__(self, count: int, key: str | None = None):
-    self.count = count
-    self.keys: set[str] = {key} if key else set()
-    self.prev: Node | None = None
-    self.next: Node | None = None
-
-  def __eq__(self, other) -> bool:
-    if not isinstance(other, Node):
-      return NotImplemented
-    return self.count == other.count and self.keys == other.keys
-
-
-class AllOne:
-  def __init__(self):
-    self.keyToNode: dict[str, Node] = {}
-    self.head = Node(0)
-    self.tail = Node(0)
-    self.head.next = self.tail
-    self.tail.prev = self.head
-
-  def inc(self, key: str) -> None:
-    if key in self.keyToNode:
-      self._incrementExistingKey(key)
-    else:
-      self._addNewKey(key)
-
-  def dec(self, key: str) -> None:
-    # It is guaranteed that key exists in the data structure before the
-    # decrement.
-    self._decrementExistingKey(key)
-
-  def getMaxKey(self) -> str:
-    return '' if self.tail.prev == self.head \
-        else next(iter(self.tail.prev.keys))
-
-  def getMinKey(self) -> str:
-    return '' if self.head.next == self.tail \
-        else next(iter(self.head.next.keys))
-
-  def _addNewKey(self, key: str) -> None:
-    """Adds a new node with frequency 1."""
-    if self.head.next.count == 1:
-      self.head.next.keys.add(key)
-    else:
-      self._insertAfter(self.head, Node(1, key))
-    self.keyToNode[key] = self.head.next
-
-  def _incrementExistingKey(self, key: str) -> None:
-    """Increments the frequency of the key by 1."""
-    node = self.keyToNode[key]
-    node.keys.remove(key)
-    if node.next == self.tail or node.next.count > node.count + 1:
-      self._insertAfter(node, Node(node.count + 1))
-    node.next.keys.add(key)
-    self.keyToNode[key] = node.next
-    if not node.keys:
-      self._remove(node)
-
-  def _decrementExistingKey(self, key: str) -> None:
-    """Decrements the count of the key by 1."""
-    node = self.keyToNode[key]
-    node.keys.remove(key)
-    if node.count > 1:
-      if node.prev == self.head or node.prev.count != node.count - 1:
-        self._insertAfter(node.prev, Node(node.count - 1))
-      node.prev.keys.add(key)
-      self.keyToNode[key] = node.prev
-    else:
-      del self.keyToNode[key]
-    if not node.keys:
-      self._remove(node)
-
-  def _insertAfter(self, node: Node, newNode: Node) -> None:
-    newNode.prev = node
-    newNode.next = node.next
-    node.next.prev = newNode
-    node.next = newNode
-
-  def _remove(self, node: Node) -> None:
-    node.prev.next = node.next
-    node.next.prev = node.prev
diff --git a/solutions/433. Minimum Genetic Mutation/433.cpp b/solutions/433. Minimum Genetic Mutation/433.cpp
index 06900e06692..077812bcebb 100644
--- a/solutions/433. Minimum Genetic Mutation/433.cpp	
+++ b/solutions/433. Minimum Genetic Mutation/433.cpp	
@@ -1,23 +1,24 @@
 class Solution {
  public:
-  int minMutation(string startGene, string endGene, vector<string>& bank) {
+  int minMutation(string start, string end, vector<string>& bank) {
     unordered_set<string> bankSet{bank.begin(), bank.end()};
-    if (!bankSet.contains(endGene))
+    if (!bankSet.contains(end))
       return -1;
 
-    constexpr char kGenes[] = "ACGT";
-    queue<string> q{{startGene}};
+    int ans = 0;
+    queue<string> q{{start}};
 
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         string word = q.front();
         q.pop();
         for (int j = 0; j < word.length(); ++j) {
           const char cache = word[j];
-          for (const char c : kGenes) {
+          for (const char c : {'A', 'C', 'G', 'T'}) {
             word[j] = c;
-            if (word == endGene)
-              return step;
+            if (word == end)
+              return ans;
             if (bankSet.contains(word)) {
               bankSet.erase(word);
               q.push(word);
@@ -26,6 +27,7 @@ class Solution {
           word[j] = cache;
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/433. Minimum Genetic Mutation/433.java b/solutions/433. Minimum Genetic Mutation/433.java
index 0aedc4f4f63..0ff2ff7e624 100644
--- a/solutions/433. Minimum Genetic Mutation/433.java	
+++ b/solutions/433. Minimum Genetic Mutation/433.java	
@@ -1,22 +1,23 @@
 class Solution {
-  public int minMutation(String startGene, String endGene, String[] bank) {
+  public int minMutation(String start, String end, String[] bank) {
     Set<String> bankSet = new HashSet<>(Arrays.asList(bank));
-    if (!bankSet.contains(endGene))
+    if (!bankSet.contains(end))
       return -1;
 
-    final char[] GENES = new char[] {'A', 'C', 'G', 'T'};
-    Queue<String> q = new ArrayDeque<>(List.of(startGene));
+    int ans = 0;
+    Queue<String> q = new ArrayDeque<>(Arrays.asList(start));
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         StringBuilder sb = new StringBuilder(q.poll());
         for (int j = 0; j < sb.length(); ++j) {
           final char cache = sb.charAt(j);
-          for (final char c : GENES) {
+          for (final char c : new char[] {'A', 'C', 'G', 'T'}) {
             sb.setCharAt(j, c);
             final String word = sb.toString();
-            if (word.equals(endGene))
-              return step;
+            if (word.equals(end))
+              return ans;
             if (bankSet.contains(word)) {
               bankSet.remove(word);
               q.offer(word);
@@ -25,6 +26,7 @@ public int minMutation(String startGene, String endGene, String[] bank) {
           sb.setCharAt(j, cache);
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/433. Minimum Genetic Mutation/433.py b/solutions/433. Minimum Genetic Mutation/433.py
deleted file mode 100644
index 7ff0715cdeb..00000000000
--- a/solutions/433. Minimum Genetic Mutation/433.py	
+++ /dev/null
@@ -1,26 +0,0 @@
-class Solution:
-  def minMutation(self, startGene: str, endGene: str, bank: list[str]) -> int:
-    bankSet = set(bank)
-    if endGene not in bankSet:
-      return -1
-
-    GENES = 'ACGT'
-    q = collections.deque([startGene])
-
-    step = 1
-    while q:
-      for _ in range(len(q)):
-        wordList = list(q.popleft())
-        for j, cache in enumerate(wordList):
-          for c in GENES:
-            wordList[j] = c
-            word = ''.join(wordList)
-            if word == endGene:
-              return step
-            if word in bankSet:
-              bankSet.remove(word)
-              q.append(word)
-          wordList[j] = cache
-      step += 1
-
-    return -1
diff --git a/solutions/435. Non-overlapping Intervals/435.java b/solutions/435. Non-overlapping Intervals/435.java
index 773fab4d926..c6e617ed05b 100644
--- a/solutions/435. Non-overlapping Intervals/435.java	
+++ b/solutions/435. Non-overlapping Intervals/435.java	
@@ -3,7 +3,7 @@ public int eraseOverlapIntervals(int[][] intervals) {
     if (intervals.length == 0)
       return 0;
 
-    Arrays.sort(intervals, Comparator.comparingInt(a -> a[1]));
+    Arrays.sort(intervals, (a, b) -> a[1] - b[1]);
 
     int ans = 0;
     int currentEnd = intervals[0][1];
diff --git a/solutions/435. Non-overlapping Intervals/435.py b/solutions/435. Non-overlapping Intervals/435.py
index 4029681e36d..23cac116f74 100644
--- a/solutions/435. Non-overlapping Intervals/435.py	
+++ b/solutions/435. Non-overlapping Intervals/435.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def eraseOverlapIntervals(self, intervals: list[list[int]]) -> int:
+  def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:
     ans = 0
     currentEnd = -math.inf
 
diff --git a/solutions/436. Find Right Interval/436.cpp b/solutions/436. Find Right Interval/436.cpp
index cd4875cfdb7..31dd3e7fbee 100644
--- a/solutions/436. Find Right Interval/436.cpp	
+++ b/solutions/436. Find Right Interval/436.cpp	
@@ -9,7 +9,10 @@ class Solution {
 
     for (const vector<int>& interval : intervals) {
       const auto it = startToIndex.lower_bound(interval[1]);
-      ans.push_back(it == startToIndex.cend() ? -1 : it->second);
+      if (it == startToIndex.cend())
+        ans.push_back(-1);
+      else
+        ans.push_back(it->second);
     }
 
     return ans;
diff --git a/solutions/436. Find Right Interval/436.java b/solutions/436. Find Right Interval/436.java
index 01d45a724ea..e8d1ddcf77c 100644
--- a/solutions/436. Find Right Interval/436.java	
+++ b/solutions/436. Find Right Interval/436.java	
@@ -3,14 +3,17 @@ public int[] findRightInterval(int[][] intervals) {
     final int n = intervals.length;
 
     int[] ans = new int[n];
-    TreeMap<Integer, Integer> startToIndex = new TreeMap<>();
+    java.util.NavigableMap<Integer, Integer> startToIndex = new TreeMap<>();
 
     for (int i = 0; i < n; ++i)
       startToIndex.put(intervals[i][0], i);
 
     for (int i = 0; i < n; ++i) {
       Map.Entry<Integer, Integer> entry = startToIndex.ceilingEntry(intervals[i][1]);
-      ans[i] = entry == null ? -1 : entry.getValue();
+      if (entry == null)
+        ans[i] = -1;
+      else
+        ans[i] = entry.getValue();
     }
 
     return ans;
diff --git a/solutions/436. Find Right Interval/436.py b/solutions/436. Find Right Interval/436.py
deleted file mode 100644
index 07d86ef0554..00000000000
--- a/solutions/436. Find Right Interval/436.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-from sortedcontainers import SortedDict
-
-
-class Solution:
-  def findRightInterval(self, intervals: list[list[int]]) -> list[int]:
-    ans = []
-    startToIndex = SortedDict()
-
-    for i, (start, end) in enumerate(intervals):
-      startToIndex[start] = i
-
-    for start, end in intervals:
-      i = startToIndex.bisect_left(end)
-      ans.append(-1 if i == len(startToIndex) else startToIndex.peekitem(i)[1])
-
-    return ans
diff --git a/solutions/437. Path Sum III/437.py b/solutions/437. Path Sum III/437.py
index 101cea3bafc..d1af508da55 100644
--- a/solutions/437. Path Sum III/437.py	
+++ b/solutions/437. Path Sum III/437.py	
@@ -1,15 +1,15 @@
 class Solution:
-  def pathSum(self, root: TreeNode | None, summ: int) -> int:
+  def pathSum(self, root: TreeNode, summ: int) -> int:
     if not root:
       return 0
 
     def dfs(root: TreeNode, summ: int) -> int:
       if not root:
         return 0
-      return (int(summ == root.val) +
-              dfs(root.left, summ - root.val) +
-              dfs(root.right, summ - root.val))
+      return (summ == root.val) + \
+          dfs(root.left, summ - root.val) + \
+          dfs(root.right, summ - root.val)
 
-    return (dfs(root, summ) +
-            self.pathSum(root.left, summ) +
-            self.pathSum(root.right, summ))
+    return dfs(root, summ) + \
+        self.pathSum(root.left, summ) + \
+        self.pathSum(root.right, summ)
diff --git a/solutions/438. Find All Anagrams in a String/438.py b/solutions/438. Find All Anagrams in a String/438.py
index d77e95d3454..d95d3f72235 100644
--- a/solutions/438. Find All Anagrams in a String/438.py	
+++ b/solutions/438. Find All Anagrams in a String/438.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findAnagrams(self, s: str, p: str) -> list[int]:
+  def findAnagrams(self, s: str, p: str) -> List[int]:
     ans = []
     count = collections.Counter(p)
     required = len(p)
diff --git a/solutions/440. K-th Smallest in Lexicographical Order/440.cpp b/solutions/440. K-th Smallest in Lexicographical Order/440.cpp
index ecc7dfd2540..f5fb229a19c 100644
--- a/solutions/440. K-th Smallest in Lexicographical Order/440.cpp	
+++ b/solutions/440. K-th Smallest in Lexicographical Order/440.cpp	
@@ -1,30 +1,29 @@
 class Solution {
  public:
-  int findKthNumber(int n, int k) {
-    long ans = 1;
+  int findKthNumber(long n, int k) {
+    auto getGap = [&n](long a, long b) {
+      long gap = 0;
+      while (a <= n) {
+        gap += min(n + 1, b) - a;
+        a *= 10;
+        b *= 10;
+      }
+      return gap;
+    };
+
+    long currNum = 1;
 
     for (int i = 1; i < k;) {
-      const long gap = getGap(ans, ans + 1, n);
+      long gap = getGap(currNum, currNum + 1);
       if (i + gap <= k) {
         i += gap;
-        ++ans;
+        ++currNum;
       } else {
         ++i;
-        ans *= 10;
+        currNum *= 10;
       }
     }
 
-    return ans;
+    return currNum;
   }
-
- private:
-  long getGap(long a, long b, long n) {
-    long gap = 0;
-    while (a <= n) {
-      gap += min(n + 1, b) - a;
-      a *= 10;
-      b *= 10;
-    }
-    return gap;
-  };
 };
diff --git a/solutions/440. K-th Smallest in Lexicographical Order/440.java b/solutions/440. K-th Smallest in Lexicographical Order/440.java
index 538d2940d92..fc07aacec64 100644
--- a/solutions/440. K-th Smallest in Lexicographical Order/440.java	
+++ b/solutions/440. K-th Smallest in Lexicographical Order/440.java	
@@ -1,19 +1,19 @@
 class Solution {
   public int findKthNumber(int n, int k) {
-    long ans = 1;
+    long currNum = 1;
 
     for (int i = 1; i < k;) {
-      final long gap = getGap(ans, ans + 1, n);
+      long gap = getGap(currNum, currNum + 1, n);
       if (i + gap <= k) {
         i += gap;
-        ++ans;
+        ++currNum;
       } else {
         ++i;
-        ans *= 10;
+        currNum *= 10;
       }
     }
 
-    return (int) ans;
+    return (int) currNum;
   }
 
   private long getGap(long a, long b, long n) {
diff --git a/solutions/440. K-th Smallest in Lexicographical Order/440.py b/solutions/440. K-th Smallest in Lexicographical Order/440.py
deleted file mode 100644
index 8a3ca4ea59e..00000000000
--- a/solutions/440. K-th Smallest in Lexicographical Order/440.py	
+++ /dev/null
@@ -1,23 +0,0 @@
-class Solution:
-  def findKthNumber(self, n: int, k: int) -> int:
-    ans = 1
-
-    i = 1
-    while i < k:
-      gap = self._getGap(ans, ans + 1, n)
-      if i + gap <= k:
-        i += gap
-        ans += 1
-      else:
-        i += 1
-        ans *= 10
-
-    return ans
-
-  def _getGap(self, a: int, b: int, n: int) -> int:
-    gap = 0
-    while a <= n:
-      gap += min(n + 1, b) - a
-      a *= 10
-      b *= 10
-    return gap
diff --git a/solutions/442. Find All Duplicates in an Array/442.py b/solutions/442. Find All Duplicates in an Array/442.py
index e5cc0ba7eba..e182a82b309 100644
--- a/solutions/442. Find All Duplicates in an Array/442.py	
+++ b/solutions/442. Find All Duplicates in an Array/442.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findDuplicates(self, nums: list[int]) -> list[int]:
+  def findDuplicates(self, nums: List[int]) -> List[int]:
     ans = []
 
     for num in nums:
diff --git a/solutions/443. String Compression/443.py b/solutions/443. String Compression/443.py
index 5564140e7a4..4b3b8261bc9 100644
--- a/solutions/443. String Compression/443.py	
+++ b/solutions/443. String Compression/443.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def compress(self, chars: list[str]) -> int:
+  def compress(self, chars: List[str]) -> int:
     ans = 0
     i = 0
 
diff --git a/solutions/444. Sequence Reconstruction/444.java b/solutions/444. Sequence Reconstruction/444.java
index dcafa0b3ef3..5886cca8e15 100644
--- a/solutions/444. Sequence Reconstruction/444.java	
+++ b/solutions/444. Sequence Reconstruction/444.java	
@@ -6,7 +6,9 @@ public boolean sequenceReconstruction(int[] org, List<List<Integer>> seqs) {
     final int n = org.length;
     List<Integer>[] graph = new List[n];
     int[] inDegrees = new int[n];
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     // Build the graph.
     for (List<Integer> seq : seqs) {
diff --git a/solutions/444. Sequence Reconstruction/444.py b/solutions/444. Sequence Reconstruction/444.py
index 1462bae5810..6e8659617af 100644
--- a/solutions/444. Sequence Reconstruction/444.py	
+++ b/solutions/444. Sequence Reconstruction/444.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def sequenceReconstruction(
-      self,
-      org: list[int],
-      seqs: list[list[int]],
-  ) -> bool:
+  def sequenceReconstruction(self, org: List[int], seqs: List[List[int]]) -> bool:
     if not seqs:
       return False
 
diff --git a/solutions/446. Arithmetic Slices II - Subsequence/446.py b/solutions/446. Arithmetic Slices II - Subsequence/446.py
deleted file mode 100644
index a735552e606..00000000000
--- a/solutions/446. Arithmetic Slices II - Subsequence/446.py	
+++ /dev/null
@@ -1,21 +0,0 @@
-class Solution:
-  def numberOfArithmeticSlices(self, nums: list[int]) -> int:
-    n = len(nums)
-    ans = 0
-    # dp[i][j] := the number of subsequences end in nums[j] nums[i]
-    dp = [[0] * n for _ in range(n)]
-    numToIndices = collections.defaultdict(list)
-
-    for i, num in enumerate(nums):
-      numToIndices[num].append(i)
-
-    for i in range(n):
-      for j in range(i):
-        target = nums[j] * 2 - nums[i]
-        if target in numToIndices:
-          for k in numToIndices[target]:
-            if k < j:
-              dp[i][j] += dp[j][k] + 1
-        ans += dp[i][j]
-
-    return ans
diff --git a/solutions/447. Number of Boomerangs/447.py b/solutions/447. Number of Boomerangs/447.py
index 119bf19d200..1173478aa84 100644
--- a/solutions/447. Number of Boomerangs/447.py	
+++ b/solutions/447. Number of Boomerangs/447.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfBoomerangs(self, points: list[list[int]]) -> int:
+  def numberOfBoomerangs(self, points: List[List[int]]) -> int:
     ans = 0
 
     for x1, y1 in points:
diff --git a/solutions/448. Find All Numbers Disappeared in an Array/448.py b/solutions/448. Find All Numbers Disappeared in an Array/448.py
index 82f749846f8..355905aa44f 100644
--- a/solutions/448. Find All Numbers Disappeared in an Array/448.py	
+++ b/solutions/448. Find All Numbers Disappeared in an Array/448.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findDisappearedNumbers(self, nums: list[int]) -> list[int]:
+  def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
     for num in nums:
       index = abs(num) - 1
       nums[index] = -abs(nums[index])
diff --git a/solutions/449. Serialize and Deserialize BST/449.cpp b/solutions/449. Serialize and Deserialize BST/449.cpp
index 3246bf3ee7b..ed7bcc6499d 100644
--- a/solutions/449. Serialize and Deserialize BST/449.cpp	
+++ b/solutions/449. Serialize and Deserialize BST/449.cpp	
@@ -1,15 +1,15 @@
 class Codec {
  public:
-  // Encodes a tree to a single string.
   string serialize(TreeNode* root) {
     if (root == nullptr)
       return "";
+
     string s;
+
     serialize(root, s);
     return s;
   }
 
-  // Decodes your encoded data to tree.
   TreeNode* deserialize(string data) {
     if (data.empty())
       return nullptr;
@@ -27,23 +27,24 @@ class Codec {
   void serialize(TreeNode* root, string& s) {
     if (root == nullptr)
       return;
+
     s += to_string(root->val) + " ";
     serialize(root->left, s);
     serialize(root->right, s);
   }
 
-  TreeNode* deserialize(int mn, int mx, queue<int>& q) {
+  TreeNode* deserialize(int min, int max, queue<int>& q) {
     if (q.empty())
       return nullptr;
 
     const int val = q.front();
-    if (val < mn || val > mx)
+    if (val < min || val > max)
       return nullptr;
 
     q.pop();
     TreeNode* root = new TreeNode(val);
-    root->left = deserialize(mn, val, q);
-    root->right = deserialize(val, mx, q);
+    root->left = deserialize(min, val, q);
+    root->right = deserialize(val, max, q);
     return root;
   }
 };
diff --git a/solutions/449. Serialize and Deserialize BST/449.java b/solutions/449. Serialize and Deserialize BST/449.java
index 103ca5af72e..b6c50b580ed 100644
--- a/solutions/449. Serialize and Deserialize BST/449.java	
+++ b/solutions/449. Serialize and Deserialize BST/449.java	
@@ -3,7 +3,9 @@ public class Codec {
   public String serialize(TreeNode root) {
     if (root == null)
       return "";
+
     StringBuilder sb = new StringBuilder();
+
     serialize(root, sb);
     return sb.toString();
   }
@@ -25,6 +27,7 @@ public TreeNode deserialize(String data) {
   private void serialize(TreeNode root, StringBuilder sb) {
     if (root == null)
       return;
+
     sb.append(root.val).append(" ");
     serialize(root.left, sb);
     serialize(root.right, sb);
diff --git a/solutions/449. Serialize and Deserialize BST/449.py b/solutions/449. Serialize and Deserialize BST/449.py
deleted file mode 100644
index 89706c7964e..00000000000
--- a/solutions/449. Serialize and Deserialize BST/449.py	
+++ /dev/null
@@ -1,41 +0,0 @@
-class Codec:
-  def serialize(self, root: TreeNode | None) -> str:
-    """Encodes a tree to a single string."""
-    if not root:
-      return ''
-    chars = []
-    self._serialize(root, chars)
-    return ''.join(chars)
-
-  def deserialize(self, data: str) -> TreeNode | None:
-    """Decodes your encoded data to tree."""
-    if not data:
-      return None
-    q = collections.deque(int(val) for val in data.split())
-    return self._deserialize(-math.inf, math.inf, q)
-
-  def _serialize(self, root: TreeNode | None, chars: list[str]) -> None:
-    if not root:
-      return
-    chars.append(str(root.val))
-    chars.append(' ')
-    self._serialize(root.left, chars)
-    self._serialize(root.right, chars)
-
-  def _deserialize(
-      self,
-      mn: int,
-      mx: int,
-      q: collections.deque[int]
-  ) -> TreeNode | None:
-    if not q:
-      return None
-
-    val = q[0]
-    if val < mn or val > mx:
-      return None
-
-    q.popleft()
-    return TreeNode(val,
-                    self._deserialize(mn, val, q),
-                    self._deserialize(val, mx, q))
diff --git a/solutions/45. Jump Game II/45.py b/solutions/45. Jump Game II/45.py
index 838406cdd58..7f6f68158d6 100644
--- a/solutions/45. Jump Game II/45.py	
+++ b/solutions/45. Jump Game II/45.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def jump(self, nums: list[int]) -> int:
+  def jump(self, nums: List[int]) -> int:
     ans = 0
     end = 0
     farthest = 0
diff --git a/solutions/450. Delete Node in a BST/450.cpp b/solutions/450. Delete Node in a BST/450.cpp
index ec3875eef3e..9c7454767c8 100644
--- a/solutions/450. Delete Node in a BST/450.cpp	
+++ b/solutions/450. Delete Node in a BST/450.cpp	
@@ -23,7 +23,7 @@ class Solution {
 
  private:
   TreeNode* getMin(TreeNode* node) {
-    while (node->left != nullptr)
+    while (node->left)
       node = node->left;
     return node;
   }
diff --git a/solutions/450. Delete Node in a BST/450.py b/solutions/450. Delete Node in a BST/450.py
index f3da2633391..6b5101110a6 100644
--- a/solutions/450. Delete Node in a BST/450.py	
+++ b/solutions/450. Delete Node in a BST/450.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def deleteNode(self, root: TreeNode | None, key: int) -> TreeNode | None:
+  def deleteNode(self, root: Optional[TreeNode], key: int) -> Optional[TreeNode]:
     if not root:
       return None
     if root.val == key:
@@ -18,7 +18,7 @@ def deleteNode(self, root: TreeNode | None, key: int) -> TreeNode | None:
       root.left = self.deleteNode(root.left, key)
     return root
 
-  def _getMin(self, node: TreeNode | None) -> TreeNode | None:
+  def _getMin(self, node: Optional[TreeNode]) -> Optional[TreeNode]:
     while node.left:
       node = node.left
     return node
diff --git a/solutions/452. Minimum Number of Arrows to Burst Balloons/452.java b/solutions/452. Minimum Number of Arrows to Burst Balloons/452.java
index f27ea059330..c99fb7a1d6a 100644
--- a/solutions/452. Minimum Number of Arrows to Burst Balloons/452.java	
+++ b/solutions/452. Minimum Number of Arrows to Burst Balloons/452.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int findMinArrowShots(int[][] points) {
-    Arrays.sort(points, Comparator.comparingInt(a -> a[1]));
+    Arrays.sort(points, (a, b) -> a[1] - b[1]);
 
     int ans = 1;
     int arrowX = points[0][1];
diff --git a/solutions/452. Minimum Number of Arrows to Burst Balloons/452.py b/solutions/452. Minimum Number of Arrows to Burst Balloons/452.py
index 9b2c2c1b319..fc9986c8e18 100644
--- a/solutions/452. Minimum Number of Arrows to Burst Balloons/452.py	
+++ b/solutions/452. Minimum Number of Arrows to Burst Balloons/452.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMinArrowShots(self, points: list[list[int]]) -> int:
+  def findMinArrowShots(self, points: List[List[int]]) -> int:
     ans = 0
     arrowX = -math.inf
 
diff --git a/solutions/453. Minimum Moves to Equal Array Elements/453.cpp b/solutions/453. Minimum Moves to Equal Array Elements/453.cpp
index befdc8cba89..b6e29546404 100644
--- a/solutions/453. Minimum Moves to Equal Array Elements/453.cpp	
+++ b/solutions/453. Minimum Moves to Equal Array Elements/453.cpp	
@@ -2,7 +2,8 @@ class Solution {
  public:
   int minMoves(vector<int>& nums) {
     const int mn = ranges::min(nums);
-    return accumulate(nums.begin(), nums.end(), 0,
-                      [&](int acc, int num) { return acc + (num - mn); });
+    return accumulate(nums.begin(), nums.end(), 0, [&](int subtotal, int num) {
+      return subtotal + (num - mn);
+    });
   }
 };
diff --git a/solutions/453. Minimum Moves to Equal Array Elements/453.py b/solutions/453. Minimum Moves to Equal Array Elements/453.py
index 591bfc113bc..5e0fae69dc7 100644
--- a/solutions/453. Minimum Moves to Equal Array Elements/453.py	
+++ b/solutions/453. Minimum Moves to Equal Array Elements/453.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def minMoves(self, nums: list[int]) -> int:
+  def minMoves(self, nums: List[int]) -> int:
     mn = min(nums)
     return sum(num - mn for num in nums)
diff --git a/solutions/454. 4Sum II/454.py b/solutions/454. 4Sum II/454.py
index f684297a634..63e6c9e2612 100644
--- a/solutions/454. 4Sum II/454.py	
+++ b/solutions/454. 4Sum II/454.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def fourSumCount(self, nums1: list[int], nums2: list[int],
-                   nums3: list[int], nums4: list[int]) -> int:
+  def fourSumCount(self, nums1: List[int], nums2: List[int],
+                   nums3: List[int], nums4: List[int]) -> int:
     count = collections.Counter(a + b for a in nums1 for b in nums2)
     return sum(count[-c - d] for c in nums3 for d in nums4)
diff --git a/solutions/455. Assign Cookies/455.cpp b/solutions/455. Assign Cookies/455.cpp
index 9e24e5df317..0931001edf7 100644
--- a/solutions/455. Assign Cookies/455.cpp	
+++ b/solutions/455. Assign Cookies/455.cpp	
@@ -5,8 +5,8 @@ class Solution {
     ranges::sort(s);
 
     int i = 0;
-    for (const int cookie : s)
-      if (i < g.size() && g[i] <= cookie)
+    for (int j = 0; j < s.size() && i < g.size(); ++j)
+      if (g[i] <= s[j])
         ++i;
 
     return i;
diff --git a/solutions/455. Assign Cookies/455.java b/solutions/455. Assign Cookies/455.java
index 531ed0eab4e..935d520e1f8 100644
--- a/solutions/455. Assign Cookies/455.java	
+++ b/solutions/455. Assign Cookies/455.java	
@@ -4,8 +4,8 @@ public int findContentChildren(int[] g, int[] s) {
     Arrays.sort(s);
 
     int i = 0;
-    for (final int cookie : s)
-      if (i < g.length && g[i] <= cookie)
+    for (int j = 0; i < g.length && j < s.length; ++j)
+      if (g[i] <= s[j])
         ++i;
 
     return i;
diff --git a/solutions/455. Assign Cookies/455.py b/solutions/455. Assign Cookies/455.py
deleted file mode 100644
index fd18491b0d7..00000000000
--- a/solutions/455. Assign Cookies/455.py	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution:
-  def findContentChildren(self, g: list[int], s: list[int]) -> int:
-    g.sort()
-    s.sort()
-
-    i = 0
-    for cookie in s:
-      if i < len(g) and g[i] <= cookie:
-        i += 1
-
-    return i
diff --git a/solutions/456. 132 Pattern/456.cpp b/solutions/456. 132 Pattern/456.cpp
index 00e24ff32fe..d4b62d84123 100644
--- a/solutions/456. 132 Pattern/456.cpp	
+++ b/solutions/456. 132 Pattern/456.cpp	
@@ -2,10 +2,10 @@ class Solution {
  public:
   bool find132pattern(vector<int>& nums) {
     stack<int> stack;  // a decreasing stack
-    int ak = INT_MIN;  // Find a seq, where ai < ak < aj.
+    int ak = INT_MIN;  // We want to find a seq ai < ak < aj.
 
     for (int i = nums.size() - 1; i >= 0; --i) {
-      // If ai < ak, done because ai must < aj.
+      // If ai < ak, we're done because ai must < aj.
       if (nums[i] < ak)
         return true;
       while (!stack.empty() && stack.top() < nums[i])
diff --git a/solutions/456. 132 Pattern/456.java b/solutions/456. 132 Pattern/456.java
index 3d22cb46dfa..d2963924b8e 100644
--- a/solutions/456. 132 Pattern/456.java	
+++ b/solutions/456. 132 Pattern/456.java	
@@ -1,10 +1,10 @@
 class Solution {
   public boolean find132pattern(int[] nums) {
     Deque<Integer> stack = new ArrayDeque<>(); // a decreasing stack
-    int ak = Integer.MIN_VALUE;                // Find a seq, where ai < ak < aj.
+    int ak = Integer.MIN_VALUE;                // We want to find a seq ai < ak < aj.
 
     for (int i = nums.length - 1; i >= 0; --i) {
-      // ai < ak, done because ai must < aj.
+      // ai < ak, we're done because ai must also smaller than aj
       if (nums[i] < ak)
         return true;
       while (!stack.isEmpty() && stack.peek() < nums[i])
diff --git a/solutions/456. 132 Pattern/456.py b/solutions/456. 132 Pattern/456.py
deleted file mode 100644
index 858b240fd0b..00000000000
--- a/solutions/456. 132 Pattern/456.py	
+++ /dev/null
@@ -1,15 +0,0 @@
-class Solution:
-  def find132pattern(self, nums: list[int]) -> bool:
-    stack = []  # a decreasing stack
-    ak = -math.inf  # Find a seq, where ai < ak < aj.
-
-    for num in reversed(nums):
-      # If ai < ak, done because ai must < aj.
-      if num < ak:
-        return True
-      while stack and stack[-1] < num:
-        ak = stack[-1]
-        stack.pop()
-      stack.append(num)  # `nums[i]` is a candidate of aj.
-
-    return False
diff --git a/solutions/457. Circular Array Loop/457.py b/solutions/457. Circular Array Loop/457.py
index f43f93c0d16..7804046d1c2 100644
--- a/solutions/457. Circular Array Loop/457.py	
+++ b/solutions/457. Circular Array Loop/457.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def circularArrayLoop(self, nums: list[int]) -> bool:
+  def circularArrayLoop(self, nums: List[int]) -> bool:
     def advance(i: int) -> int:
       return (i + nums[i]) % len(nums)
 
diff --git a/solutions/46. Permutations/46.cpp b/solutions/46. Permutations/46.cpp
index 4101a8e0732..2abd2c2db24 100644
--- a/solutions/46. Permutations/46.cpp	
+++ b/solutions/46. Permutations/46.cpp	
@@ -2,6 +2,7 @@ class Solution {
  public:
   vector<vector<int>> permute(vector<int>& nums) {
     vector<vector<int>> ans;
+
     dfs(nums, vector<bool>(nums.size()), {}, ans);
     return ans;
   }
@@ -19,7 +20,7 @@ class Solution {
         continue;
       used[i] = true;
       path.push_back(nums[i]);
-      dfs(nums, std::move(used), std::move(path), ans);
+      dfs(nums, move(used), move(path), ans);
       path.pop_back();
       used[i] = false;
     }
diff --git a/solutions/46. Permutations/46.java b/solutions/46. Permutations/46.java
index 4084ef1c58a..bb0995818fc 100644
--- a/solutions/46. Permutations/46.java	
+++ b/solutions/46. Permutations/46.java	
@@ -1,6 +1,7 @@
 class Solution {
   public List<List<Integer>> permute(int[] nums) {
     List<List<Integer>> ans = new ArrayList<>();
+
     dfs(nums, new boolean[nums.length], new ArrayList<>(), ans);
     return ans;
   }
diff --git a/solutions/46. Permutations/46.py b/solutions/46. Permutations/46.py
index b9d50cb8c2c..cd20ef25347 100644
--- a/solutions/46. Permutations/46.py	
+++ b/solutions/46. Permutations/46.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def permute(self, nums: list[int]) -> list[list[int]]:
+  def permute(self, nums: List[int]) -> List[List[int]]:
     ans = []
     used = [False] * len(nums)
 
-    def dfs(path: list[int]) -> None:
+    def dfs(path: List[int]) -> None:
       if len(path) == len(nums):
         ans.append(path.copy())
         return
diff --git a/solutions/460. LFU Cache/460.py b/solutions/460. LFU Cache/460.py
deleted file mode 100644
index 032845654ff..00000000000
--- a/solutions/460. LFU Cache/460.py	
+++ /dev/null
@@ -1,64 +0,0 @@
-class Node:
-  def __init__(self, key: int, value: int, freq: int, it):
-    self.key = key
-    self.value = value
-    self.freq = freq
-    self.it = it
-
-
-class LFUCache:
-  def __init__(self, capacity: int):
-    self.capacity = capacity
-    self.minFreq = 0
-    self.keyToNode = {}
-    self.freqToList = {}
-
-  def get(self, key: int) -> int:
-    if key not in self.keyToNode:
-      return -1
-
-    node = self.keyToNode[key]
-    self._touch(node)
-    return node.value
-
-  def put(self, key: int, value: int) -> None:
-    if self.capacity == 0:
-      return
-
-    if key in self.keyToNode:
-      node = self.keyToNode[key]
-      node.value = value
-      self._touch(node)
-      return
-
-    if len(self.keyToNode) == self.capacity:
-      # Evict an LRU key from `minFreq` list
-      keyToEvict = self.freqToList[self.minFreq][-1]
-      self.freqToList[self.minFreq].pop()
-      del self.keyToNode[keyToEvict]
-
-    self.minFreq = 1
-    if 1 not in self.freqToList:
-      self.freqToList[1] = []
-    self.freqToList[1].insert(0, key)
-    self.keyToNode[key] = Node(key, value, 1, 0)  # Using index 0 as iterator
-
-  def _touch(self, node: Node) -> None:
-    # Update the node's frequency
-    prevFreq = node.freq
-    node.freq += 1
-    newFreq = node.freq
-
-    # Remove the key from `prevFreq`'s list
-    self.freqToList[prevFreq].remove(node.key)
-    if not self.freqToList[prevFreq]:
-      del self.freqToList[prevFreq]
-      # Update `minFreq` if needed
-      if prevFreq == self.minFreq:
-        self.minFreq += 1
-
-    # Insert the key to the front of `newFreq`'s list
-    if newFreq not in self.freqToList:
-      self.freqToList[newFreq] = []
-    self.freqToList[newFreq].insert(0, node.key)
-    node.it = 0  # Using index 0 as iterator
diff --git a/solutions/461. Hamming Distance/461.cpp b/solutions/461. Hamming Distance/461.cpp
index 9e2ac1f56dc..d1e8e495594 100644
--- a/solutions/461. Hamming Distance/461.cpp	
+++ b/solutions/461. Hamming Distance/461.cpp	
@@ -3,7 +3,7 @@ class Solution {
   int hammingDistance(int x, int y) {
     int ans = 0;
 
-    while (x > 0 || y > 0) {
+    while (x || y) {
       ans += (x & 1) ^ (y & 1);
       x >>= 1;
       y >>= 1;
diff --git a/solutions/461. Hamming Distance/461.py b/solutions/461. Hamming Distance/461.py
deleted file mode 100644
index ab08bb05632..00000000000
--- a/solutions/461. Hamming Distance/461.py	
+++ /dev/null
@@ -1,10 +0,0 @@
-class Solution:
-  def hammingDistance(self, x: int, y: int) -> int:
-    ans = 0
-
-    while x > 0 or y > 0:
-      ans += (x & 1) ^ (y & 1)
-      x >>= 1
-      y >>= 1
-
-    return ans
diff --git a/solutions/462. Minimum Moves to Equal Array Elements II/462.cpp b/solutions/462. Minimum Moves to Equal Array Elements II/462.cpp
index 75c9e90f858..53127eed91e 100644
--- a/solutions/462. Minimum Moves to Equal Array Elements II/462.cpp	
+++ b/solutions/462. Minimum Moves to Equal Array Elements II/462.cpp	
@@ -4,8 +4,8 @@ class Solution {
     const int n = nums.size();
     nth_element(nums.begin(), nums.begin() + n / 2, nums.end());
     const int median = nums[n / 2];
-    return accumulate(nums.begin(), nums.end(), 0, [&](int acc, int num) {
-      return acc + abs(num - median);
+    return accumulate(nums.begin(), nums.end(), 0, [&](int subtotal, int num) {
+      return subtotal + abs(num - median);
     });
   }
 };
diff --git a/solutions/462. Minimum Moves to Equal Array Elements II/462.py b/solutions/462. Minimum Moves to Equal Array Elements II/462.py
index 66255985823..1dbff543cfd 100644
--- a/solutions/462. Minimum Moves to Equal Array Elements II/462.py	
+++ b/solutions/462. Minimum Moves to Equal Array Elements II/462.py	
@@ -2,6 +2,6 @@
 
 
 class Solution:
-  def minMoves2(self, nums: list[int]) -> int:
+  def minMoves2(self, nums: List[int]) -> int:
     median = int(statistics.median(nums))
     return sum(abs(num - median) for num in nums)
diff --git a/solutions/463. Island Perimeter/463.py b/solutions/463. Island Perimeter/463.py
index 05e32bdc29c..69b2887e664 100644
--- a/solutions/463. Island Perimeter/463.py	
+++ b/solutions/463. Island Perimeter/463.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def islandPerimeter(self, grid: list[list[int]]) -> int:
+  def islandPerimeter(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
 
diff --git a/solutions/464. Can I Win/464.py b/solutions/464. Can I Win/464.py
deleted file mode 100644
index a8ca6d79900..00000000000
--- a/solutions/464. Can I Win/464.py	
+++ /dev/null
@@ -1,22 +0,0 @@
-class Solution:
-  def canIWin(self, maxChoosableInteger: int, desiredTotal: int) -> bool:
-    if desiredTotal <= 0:
-      return True
-
-    totalSum = maxChoosableInteger * (maxChoosableInteger + 1) // 2
-    if totalSum < desiredTotal:
-      return False
-
-    @functools.lru_cache(None)
-    def dp(total: int, used: int) -> bool:
-      """
-      Returns true if the first player can we, where `used` represents the use
-      numbers.
-      """
-      if total <= 0:
-        return False
-      return any((used >> i & 1) == 0
-                 and not dp(total - i, used | 1 << i)
-                 for i in range(1, maxChoosableInteger + 1))
-
-    return dp(desiredTotal, 0)
diff --git a/solutions/465. Optimal Account Balancing/465.py b/solutions/465. Optimal Account Balancing/465.py
index c26959fdccf..ceab5f723fe 100644
--- a/solutions/465. Optimal Account Balancing/465.py	
+++ b/solutions/465. Optimal Account Balancing/465.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minTransfers(self, transactions: list[list[int]]) -> int:
+  def minTransfers(self, transactions: List[List[int]]) -> int:
     balance = [0] * 21
 
     for u, v, amount in transactions:
diff --git a/solutions/466. Count The Repetitions/466.cpp b/solutions/466. Count The Repetitions/466.cpp
index c12cb83d361..3c738cbf496 100644
--- a/solutions/466. Count The Repetitions/466.cpp	
+++ b/solutions/466. Count The Repetitions/466.cpp	
@@ -1,22 +1,20 @@
 struct Record {
   int count;
   int nextIndex;
+  Record(int count, int nextIndex) : count(count), nextIndex(nextIndex) {}
 };
 
 class Solution {
  public:
   int getMaxRepetitions(string s1, int n1, string s2, int n2) {
-    // records[i].count := the number of times that s2 starting from index i has
-    // been fully matched with s1
-    // records[i].nextIndex := the next index in s2 to be matched after
-    // completing a full match starting from index i
+    // [count(s1 matches s2[i..n)), next index of s2[i..n)]
     vector<Record> records;
 
     for (int i = 0; i < s2.length(); ++i) {
       int count = 0;
       int nextIndex = i;
-      for (const char c : s1)
-        if (s2[nextIndex] == c)
+      for (int j = 0; j < s1.length(); ++j)
+        if (s2[nextIndex] == s1[j])
           if (++nextIndex == s2.length()) {  // There's a match.
             ++count;
             nextIndex = 0;
@@ -24,14 +22,14 @@ class Solution {
       records.emplace_back(count, nextIndex);
     }
 
-    int matches = 0;  // the number of matches between `s1` x n1 and `s2`
-    int i = 0;        // the index in `s2` to start matching
+    int matches = 0;  // `s1` matches `s2`.
+    int index = 0;
 
-    while (n1-- > 0) {
-      matches += records[i].count;
-      i = records[i].nextIndex;
+    while (n1--) {
+      matches += records[index].count;
+      index = records[index].nextIndex;
     }
 
-    return matches / n2;
+    return matches / n2;  // `s1` matches `s2`.
   }
 };
diff --git a/solutions/466. Count The Repetitions/466.java b/solutions/466. Count The Repetitions/466.java
index 76788029657..06d3b08f347 100644
--- a/solutions/466. Count The Repetitions/466.java	
+++ b/solutions/466. Count The Repetitions/466.java	
@@ -1,17 +1,22 @@
+class Record {
+  public int count;
+  public int nextIndex;
+  public Record(int count, int nextIndex) {
+    this.count = count;
+    this.nextIndex = nextIndex;
+  }
+};
+
 class Solution {
   public int getMaxRepetitions(String s1, int n1, String s2, int n2) {
-    record Record(int count, int nextIndex) {}
-    // records[i].count := the number of times that s2 starting from index i has
-    // been fully matched with s1
-    // records[i].nextIndex := the next index in s2 to be matched after
-    // completing a full match starting from index i
+    // [count(s1 matches s2[i..n)), next index of s2[i..n)]
     List<Record> records = new ArrayList<>();
 
     for (int i = 0; i < s2.length(); ++i) {
       int count = 0;
       int nextIndex = i;
-      for (final char c : s1.toCharArray())
-        if (s2.charAt(nextIndex) == c)
+      for (int j = 0; j < s1.length(); ++j)
+        if (s2.charAt(nextIndex) == s1.charAt(j))
           if (++nextIndex == s2.length()) { // There's a match.
             ++count;
             nextIndex = 0;
@@ -19,14 +24,14 @@ record Record(int count, int nextIndex) {}
       records.add(new Record(count, nextIndex));
     }
 
-    int matches = 0; // the number of matches between `s1` x n1 and `s2`
-    int i = 0;       // the index in `s2` to start matching
+    int matches = 0; // `s1` matches `s2`.
+    int index = 0;
 
     while (n1-- > 0) {
-      matches += records.get(i).count;
-      i = records.get(i).nextIndex;
+      matches += records.get(index).count;
+      index = records.get(index).nextIndex;
     }
 
-    return matches / n2;
+    return matches / n2; // `s1` matches `s2`.
   }
 }
diff --git a/solutions/466. Count The Repetitions/466.py b/solutions/466. Count The Repetitions/466.py
deleted file mode 100644
index b092d6864da..00000000000
--- a/solutions/466. Count The Repetitions/466.py	
+++ /dev/null
@@ -1,35 +0,0 @@
-from dataclasses import dataclass
-
-
-@dataclass
-class Record:
-  count: int
-  nextIndex: int
-
-
-class Solution:
-  def getMaxRepetitions(self, s1: str, n1: int, s2: str, n2: int) -> int:
-    # records[i].count := the number of times that s2 starting from index i has
-    # been fully matched with s1
-    # records[i].nextIndex := the next index in s2 to be matched after
-    # completing a full match starting from index i
-    records = []
-
-    for nextIndex in range(len(s2)):
-      count = 0
-      for c in s1:
-        if s2[nextIndex] == c:
-          nextIndex += 1
-          if nextIndex == len(s2):  # There's a match.
-            count += 1
-            nextIndex = 0
-      records.append(Record(count, nextIndex))
-
-    matches = 0  # the number of matches between `s1` x n1 and `s2`
-    i = 0  # the index in `s2` to start matching
-
-    for _ in range(n1):
-      matches += records[i].count
-      i = records[i].nextIndex
-
-    return matches // n2
diff --git a/solutions/467. Unique Substrings in Wraparound String/467.cpp b/solutions/467. Unique Substrings in Wraparound String/467.cpp
index 05ca36eef24..a065c6ba75d 100644
--- a/solutions/467. Unique Substrings in Wraparound String/467.cpp	
+++ b/solutions/467. Unique Substrings in Wraparound String/467.cpp	
@@ -1,16 +1,16 @@
 class Solution {
  public:
-  int findSubstringInWraproundString(string s) {
+  int findSubstringInWraproundString(string p) {
     int maxLength = 1;
     // count[i] := the number of substrings ending in ('a' + i)
     vector<int> count(26);
 
-    for (int i = 0; i < s.length(); ++i) {
-      if (i > 0 && (s[i] - s[i - 1] == 1 || s[i - 1] - s[i] == 25))
+    for (int i = 0; i < p.length(); ++i) {
+      if (i > 0 && (p[i] - p[i - 1] == 1 || p[i - 1] - p[i] == 25))
         ++maxLength;
       else
         maxLength = 1;
-      const int index = s[i] - 'a';
+      const int index = p[i] - 'a';
       count[index] = max(count[index], maxLength);
     }
 
diff --git a/solutions/467. Unique Substrings in Wraparound String/467.java b/solutions/467. Unique Substrings in Wraparound String/467.java
index c8b66225007..563e075f3c7 100644
--- a/solutions/467. Unique Substrings in Wraparound String/467.java	
+++ b/solutions/467. Unique Substrings in Wraparound String/467.java	
@@ -1,15 +1,15 @@
 class Solution {
-  public int findSubstringInWraproundString(String s) {
+  public int findSubstringInWraproundString(String p) {
     int maxLength = 1;
     // count[i] := the number of substrings ending in ('a' + i)
     int[] count = new int[26];
 
-    for (int i = 0; i < s.length(); ++i) {
-      if (i > 0 && (s.charAt(i) - s.charAt(i - 1) == 1 || s.charAt(i - 1) - s.charAt(i) == 25))
+    for (int i = 0; i < p.length(); ++i) {
+      if (i > 0 && (p.charAt(i) - p.charAt(i - 1) == 1 || p.charAt(i - 1) - p.charAt(i) == 25))
         ++maxLength;
       else
         maxLength = 1;
-      final int index = s.charAt(i) - 'a';
+      final int index = p.charAt(i) - 'a';
       count[index] = Math.max(count[index], maxLength);
     }
 
diff --git a/solutions/467. Unique Substrings in Wraparound String/467.py b/solutions/467. Unique Substrings in Wraparound String/467.py
deleted file mode 100644
index fea69244953..00000000000
--- a/solutions/467. Unique Substrings in Wraparound String/467.py	
+++ /dev/null
@@ -1,16 +0,0 @@
-class Solution:
-  def findSubstringInWraproundString(self, s: str) -> int:
-    maxLength = 1
-    # count[i] := the number of substrings ending in ('a' + i)
-    count = [0] * 26
-
-    for i in range(len(s)):
-      if i > 0 and (ord(s[i]) - ord(s[i - 1]) == 1
-                    or ord(s[i - 1]) - ord(s[i]) == 25):
-        maxLength += 1
-      else:
-        maxLength = 1
-      index = ord(s[i]) - ord('a')
-      count[index] = max(count[index], maxLength)
-
-    return sum(count)
diff --git a/solutions/468. Validate IP Address/468.cpp b/solutions/468. Validate IP Address/468.cpp
index 6ea492cedf4..79184872041 100644
--- a/solutions/468. Validate IP Address/468.cpp	
+++ b/solutions/468. Validate IP Address/468.cpp	
@@ -1,17 +1,17 @@
 class Solution {
  public:
-  string validIPAddress(string queryIP) {
+  string validIPAddress(string IP) {
     string digit;
-    istringstream iss(queryIP);
+    istringstream iss(IP);
 
-    if (ranges::count(queryIP, '.') == 3) {
+    if (ranges::count(IP, '.') == 3) {
       for (int i = 0; i < 4; ++i)  // Make sure that we have four parts.
         if (!getline(iss, digit, '.') || !isIPv4(digit))
           return "Neither";
       return "IPv4";
     }
 
-    if (ranges::count(queryIP, ':') == 7) {
+    if (ranges::count(IP, ':') == 7) {
       for (int i = 0; i < 8; ++i)  // Make sure that we have eight parts.
         if (!getline(iss, digit, ':') || !isIPv6(digit))
           return "Neither";
diff --git a/solutions/468. Validate IP Address/468.java b/solutions/468. Validate IP Address/468.java
index c6279e02e65..e5063a1132a 100644
--- a/solutions/468. Validate IP Address/468.java	
+++ b/solutions/468. Validate IP Address/468.java	
@@ -1,14 +1,14 @@
 class Solution {
-  public String validIPAddress(String queryIP) {
-    if (queryIP.chars().filter(c -> c == '.').count() == 3) {
-      for (final String digit : queryIP.split("\\.", -1))
+  public String validIPAddress(String IP) {
+    if (IP.chars().filter(c -> c == '.').count() == 3) {
+      for (final String digit : IP.split("\\.", -1))
         if (!isIPv4(digit))
           return "Neither";
       return "IPv4";
     }
 
-    if (queryIP.chars().filter(c -> c == ':').count() == 7) {
-      for (final String digit : queryIP.split("\\:", -1))
+    if (IP.chars().filter(c -> c == ':').count() == 7) {
+      for (final String digit : IP.split("\\:", -1))
         if (!isIPv6(digit))
           return "Neither";
       return "IPv6";
diff --git a/solutions/468. Validate IP Address/468.py b/solutions/468. Validate IP Address/468.py
deleted file mode 100644
index deb533d6500..00000000000
--- a/solutions/468. Validate IP Address/468.py	
+++ /dev/null
@@ -1,29 +0,0 @@
-class Solution:
-  def validIPAddress(self, queryIP: str) -> str:
-    if queryIP.count('.') == 3:
-      parts = queryIP.split('.')
-      if len(parts) == 4 and all(self._isIPv4(part) for part in parts):
-        return 'IPv4'
-
-    if queryIP.count(':') == 7:
-      parts = queryIP.split(':')
-      if len(parts) == 8 and all(self._isIPv6(part) for part in parts):
-        return 'IPv6'
-
-    return 'Neither'
-
-  def _isIPv4(self, digit: str) -> bool:
-    if not digit or len(digit) > 3:
-      return False
-    if len(digit) > 1 and digit[0] == '0':
-      return False
-    if not all(c.isdigit() for c in digit):
-      return False
-    num = int(digit)
-    return 0 <= num <= 255
-
-  def _isIPv6(self, digit: str) -> bool:
-    if not digit or len(digit) > 4:
-      return False
-    validChars = set('0123456789abcdefABCDEF')
-    return all(c in validChars for c in digit)
diff --git a/solutions/469. Convex Polygon/469.cpp b/solutions/469. Convex Polygon/469.cpp
index 33bf1a398ad..b6e474239c6 100644
--- a/solutions/469. Convex Polygon/469.cpp	
+++ b/solutions/469. Convex Polygon/469.cpp	
@@ -1,6 +1,11 @@
 class Solution {
  public:
   bool isConvex(vector<vector<int>>& points) {
+    auto getCross = [](const vector<int>& p, const vector<int>& q,
+                       const vector<int>& r) -> int {
+      return (q[0] - p[0]) * (r[1] - p[1]) - (q[1] - p[1]) * (r[0] - p[0]);
+    };
+
     const int n = points.size();
     long sign = 0;
 
@@ -17,11 +22,4 @@ class Solution {
 
     return true;
   }
-
- private:
-  // Returns pq x qr.
-  int getCross(const vector<int>& p, const vector<int>& q,
-               const vector<int>& r) {
-    return (q[0] - p[0]) * (r[1] - p[1]) - (q[1] - p[1]) * (r[0] - p[0]);
-  }
 };
diff --git a/solutions/469. Convex Polygon/469.java b/solutions/469. Convex Polygon/469.java
index b44ab3450e5..a7daf283137 100644
--- a/solutions/469. Convex Polygon/469.java	
+++ b/solutions/469. Convex Polygon/469.java	
@@ -16,7 +16,6 @@ else if (cross * sign < 0)
     return true;
   }
 
-  // Returns pq x qr.
   private int getCross(List<Integer> p, List<Integer> q, List<Integer> r) {
     return (q.get(0) - p.get(0)) * (r.get(1) - p.get(1)) -
         (q.get(1) - p.get(1)) * (r.get(0) - p.get(0));
diff --git a/solutions/469. Convex Polygon/469.py b/solutions/469. Convex Polygon/469.py
index c9dfc56dd24..39e75502564 100644
--- a/solutions/469. Convex Polygon/469.py	
+++ b/solutions/469. Convex Polygon/469.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def isConvex(self, points: list[list[int]]) -> bool:
-    def getCross(p: list[int], q: list[int], r: list[int]):
-      """Returns pq x qr."""
+  def isConvex(self, points: List[List[int]]) -> bool:
+    # Pq x qr
+    def getCross(p: List[int], q: List[int], r: List[int]):
       return (q[0] - p[0]) * (r[1] - p[1]) - (q[1] - p[1]) * (r[0] - p[0])
 
     sign = 0
diff --git a/solutions/47. Permutations II/47.cpp b/solutions/47. Permutations II/47.cpp
index eea4ee0fdc8..ac2cc3c4088 100644
--- a/solutions/47. Permutations II/47.cpp	
+++ b/solutions/47. Permutations II/47.cpp	
@@ -22,7 +22,7 @@ class Solution {
         continue;
       used[i] = true;
       path.push_back(nums[i]);
-      dfs(nums, std::move(used), std::move(path), ans);
+      dfs(nums, move(used), move(path), ans);
       path.pop_back();
       used[i] = false;
     }
diff --git a/solutions/47. Permutations II/47.py b/solutions/47. Permutations II/47.py
index 0c71fd4b0b0..7c7691da4b6 100644
--- a/solutions/47. Permutations II/47.py	
+++ b/solutions/47. Permutations II/47.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def permuteUnique(self, nums: list[int]) -> list[list[int]]:
+  def permuteUnique(self, nums: List[int]) -> List[List[int]]:
     ans = []
     used = [False] * len(nums)
 
-    def dfs(path: list[int]) -> None:
+    def dfs(path: List[int]) -> None:
       if len(path) == len(nums):
         ans.append(path.copy())
         return
diff --git a/solutions/470. Implement Rand10() Using Rand7()/470.cpp b/solutions/470. Implement Rand10() Using Rand7()/470.cpp
index 15355d24c28..c0979468c30 100644
--- a/solutions/470. Implement Rand10() Using Rand7()/470.cpp	
+++ b/solutions/470. Implement Rand10() Using Rand7()/470.cpp	
@@ -6,8 +6,10 @@ class Solution {
  public:
   int rand10() {
     int num = 40;
+
     while (num >= 40)
       num = (rand7() - 1) * 7 + rand7() - 1;
+
     return num % 10 + 1;
   }
 };
diff --git a/solutions/470. Implement Rand10() Using Rand7()/470.java b/solutions/470. Implement Rand10() Using Rand7()/470.java
index 8593cf41a3a..80a2fcba83d 100644
--- a/solutions/470. Implement Rand10() Using Rand7()/470.java	
+++ b/solutions/470. Implement Rand10() Using Rand7()/470.java	
@@ -7,8 +7,10 @@
 class Solution extends SolBase {
   public int rand10() {
     int num = 40;
+
     while (num >= 40)
       num = (rand7() - 1) * 7 + rand7() - 1;
+
     return num % 10 + 1;
   }
 }
diff --git a/solutions/470. Implement Rand10() Using Rand7()/470.py b/solutions/470. Implement Rand10() Using Rand7()/470.py
deleted file mode 100644
index eb768f08667..00000000000
--- a/solutions/470. Implement Rand10() Using Rand7()/470.py	
+++ /dev/null
@@ -1,10 +0,0 @@
-# The rand7() API is already defined for you.
-# def rand7():
-# @return a random integer in the range 1 to 7
-
-class Solution:
-  def rand10(self) -> int:
-    num = 40
-    while num >= 40:
-      num = (rand7() - 1) * 7 + (rand7() - 1)
-    return num % 10 + 1
diff --git a/solutions/471. Encode String with Shortest Length/471-2.cpp b/solutions/471. Encode String with Shortest Length/471-2.cpp
index 44d0d531da2..1c4c8ec82dd 100644
--- a/solutions/471. Encode String with Shortest Length/471-2.cpp	
+++ b/solutions/471. Encode String with Shortest Length/471-2.cpp	
@@ -21,11 +21,11 @@ class Solution {
 
         // Try to compress the string.
         // e.g. s = aabaabaab -> 3[aab]
-        for (int k = i; k < j; ++k) {
+        for (int k = i; k <= j; ++k) {
           const string& pattern = s.substr(i, k - i + 1);
           if (curr.length() % pattern.length() == 0 &&
               regex_replace(curr, regex(pattern), "").empty()) {
-            const string candidate =
+            const string& candidate =
                 to_string(curr.length() / pattern.length()) + '[' + dp[i][k] +
                 ']';
             if (candidate.length() < dp[i][j].length())
diff --git a/solutions/471. Encode String with Shortest Length/471-2.java b/solutions/471. Encode String with Shortest Length/471-2.java
index 052c85671dd..a15449906b6 100644
--- a/solutions/471. Encode String with Shortest Length/471-2.java	
+++ b/solutions/471. Encode String with Shortest Length/471-2.java	
@@ -20,7 +20,7 @@ public String encode(String s) {
 
         // Try to compress the string.
         // e.g. s = aabaabaab -> 3[aab]
-        for (int k = i; k < j; ++k) {
+        for (int k = i; k <= j; ++k) {
           final String pattern = s.substring(i, k + 1);
           if (curr.length() % pattern.length() == 0 && curr.replaceAll(pattern, "").isEmpty()) {
             final String candidate =
diff --git a/solutions/471. Encode String with Shortest Length/471-2.py b/solutions/471. Encode String with Shortest Length/471-2.py
deleted file mode 100644
index a9ac553f982..00000000000
--- a/solutions/471. Encode String with Shortest Length/471-2.py	
+++ /dev/null
@@ -1,31 +0,0 @@
-class Solution:
-  def encode(self, s: str) -> str:
-    n = len(s)
-    # dp[i][j] := the shortest encoded string of s[i..j]
-    dp = [[''] * n for _ in range(n)]
-
-    for d in range(n):
-      for i in range(n - d):
-        j = i + d
-        curr = s[i:j + 1]
-        dp[i][j] = curr
-
-        if len(dp[i][j]) < 5:
-          continue
-
-        # Try all the possible partitions.
-        for k in range(i, j):
-          if len(dp[i][k]) + len(dp[k + 1][j]) < len(dp[i][j]):
-            dp[i][j] = dp[i][k] + dp[k + 1][j]
-
-        # Try to compress the string.
-        # e.g. s = aabaabaab -> 3[aab]
-        for k in range(i, j):
-          pattern = s[i:k + 1]
-          if len(curr) % len(pattern) == 0 and pattern * (len(curr) //
-                                                          len(pattern)) == curr:
-            candidate = f"{len(curr) // len(pattern)}[{dp[i][k]}]"
-            if len(candidate) < len(dp[i][j]):
-              dp[i][j] = candidate
-
-    return dp[0][n - 1]
diff --git a/solutions/471. Encode String with Shortest Length/471.cpp b/solutions/471. Encode String with Shortest Length/471.cpp
index f77d36a2637..45997dff592 100644
--- a/solutions/471. Encode String with Shortest Length/471.cpp	
+++ b/solutions/471. Encode String with Shortest Length/471.cpp	
@@ -3,7 +3,7 @@ class Solution {
   string encode(string s) {
     const int n = s.length();
     vector<vector<string>> mem(n, vector<string>(n));
-    return encode(s, 0, n - 1, mem);
+    return encode(s, 0, n - 1);
   }
 
  private:
@@ -12,7 +12,7 @@ class Solution {
     if (!mem[i][j].empty())
       return mem[i][j];
 
-    const string curr = s.substr(i, j - i + 1);
+    const string& curr = s.substr(i, j - i + 1);
     mem[i][j] = curr;
 
     if (mem[i][j].length() < 5)
@@ -20,20 +20,20 @@ class Solution {
 
     // Try all the possible partitions.
     for (int k = i; k < j; ++k) {
-      const string l = encode(s, i, k, mem);
-      const string r = encode(s, k + 1, j, mem);
+      const string& l = encode(s, i, k, mem);
+      const string& r = encode(s, k + 1, j, mem);
       if (l.length() + r.length() < mem[i][j].length())
         mem[i][j] = l + r;
     }
 
     // Try to compress the string.
     // e.g. s = aabaabaab -> 3[aab]
-    for (int k = i; k < j; ++k) {
-      const string pattern = s.substr(i, k - i + 1);
+    for (int k = i; k <= j; ++k) {
+      const string& pattern = s.substr(i, k - i + 1);
       if (curr.length() % pattern.length() == 0 &&
           regex_replace(curr, regex(pattern), "").empty()) {
-        const string candidate = to_string(curr.length() / pattern.length()) +
-                                 '[' + encode(s, i, k, mem) + ']';
+        const string& candidate = to_string(curr.length() / pattern.length()) +
+                                  '[' + encode(s, i, k, mem) + ']';
         if (candidate.length() < mem[i][j].length())
           mem[i][j] = candidate;
       }
diff --git a/solutions/471. Encode String with Shortest Length/471.java b/solutions/471. Encode String with Shortest Length/471.java
index 3a93c92889c..1ad0bbc7a06 100644
--- a/solutions/471. Encode String with Shortest Length/471.java	
+++ b/solutions/471. Encode String with Shortest Length/471.java	
@@ -26,7 +26,7 @@ private String encode(final String s, int i, int j, String[][] mem) {
 
     // Try to compress the string.
     // e.g. s = aabaabaab -> 3[aab]
-    for (int k = i; k < j; ++k) {
+    for (int k = i; k <= j; ++k) {
       final String pattern = s.substring(i, k + 1);
       if (curr.length() % pattern.length() == 0 && curr.replaceAll(pattern, "").isEmpty()) {
         final String candidate =
diff --git a/solutions/471. Encode String with Shortest Length/471.py b/solutions/471. Encode String with Shortest Length/471.py
deleted file mode 100644
index 2ef096cd85c..00000000000
--- a/solutions/471. Encode String with Shortest Length/471.py	
+++ /dev/null
@@ -1,33 +0,0 @@
-class Solution:
-  def encode(self, s: str) -> str:
-    n = len(s)
-
-    @functools.lru_cache(None)
-    def dp(i: int, j: int) -> str:
-      """Returns the shortest encoded string of s[i..j]."""
-      curr = s[i:j + 1]
-      res = curr
-
-      if len(res) < 5:
-        return res
-
-      # Try all possible partitions.
-      for k in range(i, j):
-        l = dp(i, k)
-        r = dp(k + 1, j)
-        if len(l) + len(r) < len(res):
-          res = l + r
-
-      # Try to compress the string.
-      # e.g. s = aabaabaab -> 3[aab]
-      for k in range(i, j):
-        pattern = s[i:k + 1]
-        if len(curr) % len(pattern) == 0 and pattern * (len(curr) //
-                                                        len(pattern)) == curr:
-          candidate = f"{len(curr) // len(pattern)}[{dp(i, k)}]"
-          if len(candidate) < len(res):
-            res = candidate
-
-      return res
-
-    return dp(0, n - 1)
diff --git a/solutions/472. Concatenated Words/472.py b/solutions/472. Concatenated Words/472.py
index b13453ef2f2..53b1e5de278 100644
--- a/solutions/472. Concatenated Words/472.py	
+++ b/solutions/472. Concatenated Words/472.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findAllConcatenatedWordsInADict(self, words: list[str]) -> list[str]:
+  def findAllConcatenatedWordsInADict(self, words: List[str]) -> List[str]:
     wordSet = set(words)
 
     @functools.lru_cache(None)
diff --git a/solutions/473. Matchsticks to Square/473.cpp b/solutions/473. Matchsticks to Square/473.cpp
index ac1460af59e..497e173fb11 100644
--- a/solutions/473. Matchsticks to Square/473.cpp	
+++ b/solutions/473. Matchsticks to Square/473.cpp	
@@ -8,7 +8,7 @@ class Solution {
     if (perimeter % 4 != 0)
       return false;
 
-    ranges::sort(matchsticks, greater<>());
+    ranges::sort(matchsticks, greater<int>());
     return dfs(matchsticks, 0, vector<int>(4, perimeter / 4));
   }
 
@@ -21,7 +21,7 @@ class Solution {
       if (matchsticks[selected] > edges[i])
         continue;
       edges[i] -= matchsticks[selected];
-      if (dfs(matchsticks, selected + 1, std::move(edges)))
+      if (dfs(matchsticks, selected + 1, move(edges)))
         return true;
       edges[i] += matchsticks[selected];
     }
diff --git a/solutions/473. Matchsticks to Square/473.java b/solutions/473. Matchsticks to Square/473.java
index 3df04c3cd55..dfe23d71438 100644
--- a/solutions/473. Matchsticks to Square/473.java	
+++ b/solutions/473. Matchsticks to Square/473.java	
@@ -9,7 +9,7 @@ public boolean makesquare(int[] matchsticks) {
 
     int[] edges = new int[4];
     Arrays.fill(edges, perimeter / 4);
-    Arrays.sort(edges);
+    Arrays.sort(edges); // can't do "Arrays.sort(edges, (a, b) -> b - a);" in Java
     return dfs(matchsticks, matchsticks.length - 1, edges);
   }
 
diff --git a/solutions/473. Matchsticks to Square/473.py b/solutions/473. Matchsticks to Square/473.py
index 62e11a70bf6..e6fe3b2b608 100644
--- a/solutions/473. Matchsticks to Square/473.py	
+++ b/solutions/473. Matchsticks to Square/473.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def makesquare(self, matchsticks: list[int]) -> bool:
+  def makesquare(self, matchsticks: List[int]) -> bool:
     if len(matchsticks) < 4:
       return False
 
@@ -9,7 +9,7 @@ def makesquare(self, matchsticks: list[int]) -> bool:
 
     A = sorted(matchsticks)[::-1]
 
-    def dfs(selected: int, edges: list[int]) -> bool:
+    def dfs(selected: int, edges: List[int]) -> bool:
       if selected == len(A):
         return all(edge == edges[0] for edge in edges)
 
diff --git a/solutions/474. Ones and Zeroes/474.cpp b/solutions/474. Ones and Zeroes/474.cpp
index dd844030f49..b9e599c2727 100644
--- a/solutions/474. Ones and Zeroes/474.cpp	
+++ b/solutions/474. Ones and Zeroes/474.cpp	
@@ -6,11 +6,11 @@ class Solution {
     vector<vector<int>> dp(m + 1, vector<int>(n + 1));
 
     for (const string& s : strs) {
-      const int zeros = ranges::count(s, '0');
-      const int ones = s.length() - zeros;
-      for (int i = m; i >= zeros; --i)
-        for (int j = n; j >= ones; --j)
-          dp[i][j] = max(dp[i][j], dp[i - zeros][j - ones] + 1);
+      const int count0 = ranges::count(s, '0');
+      const int count1 = s.length() - count0;
+      for (int i = m; i >= count0; --i)
+        for (int j = n; j >= count1; --j)
+          dp[i][j] = max(dp[i][j], dp[i - count0][j - count1] + 1);
     }
 
     return dp[m][n];
diff --git a/solutions/474. Ones and Zeroes/474.java b/solutions/474. Ones and Zeroes/474.java
index 177c3f45c80..c539eee0104 100644
--- a/solutions/474. Ones and Zeroes/474.java	
+++ b/solutions/474. Ones and Zeroes/474.java	
@@ -5,11 +5,11 @@ public int findMaxForm(String[] strs, int m, int n) {
     int[][] dp = new int[m + 1][n + 1];
 
     for (final String s : strs) {
-      final int zeros = (int) s.chars().filter(c -> c == '0').count();
-      final int ones = (int) s.length() - zeros;
-      for (int i = m; i >= zeros; --i)
-        for (int j = n; j >= ones; --j)
-          dp[i][j] = Math.max(dp[i][j], dp[i - zeros][j - ones] + 1);
+      final int count0 = (int) s.chars().filter(c -> c == '0').count();
+      final int count1 = (int) s.length() - count0;
+      for (int i = m; i >= count0; --i)
+        for (int j = n; j >= count1; --j)
+          dp[i][j] = Math.max(dp[i][j], dp[i - count0][j - count1] + 1);
     }
 
     return dp[m][n];
diff --git a/solutions/474. Ones and Zeroes/474.py b/solutions/474. Ones and Zeroes/474.py
index 7c86a89d6f6..6fd0cfaf14c 100644
--- a/solutions/474. Ones and Zeroes/474.py	
+++ b/solutions/474. Ones and Zeroes/474.py	
@@ -1,14 +1,14 @@
 class Solution:
-  def findMaxForm(self, strs: list[str], m: int, n: int) -> int:
+  def findMaxForm(self, strs: List[str], m: int, n: int) -> int:
     # dp[i][j] := the maximum size of the subset given i 0s and j 1s are
     # available
     dp = [[0] * (n + 1) for _ in range(m + 1)]
 
     for s in strs:
-      zeros = s.count('0')
-      ones = len(s) - zeros
-      for i in range(m, zeros - 1, -1):
-        for j in range(n, ones - 1, -1):
-          dp[i][j] = max(dp[i][j], dp[i - zeros][j - ones] + 1)
+      count0 = s.count('0')
+      count1 = len(s) - count0
+      for i in range(m, count0 - 1, -1):
+        for j in range(n, count1 - 1, -1):
+          dp[i][j] = max(dp[i][j], dp[i - count0][j - count1] + 1)
 
     return dp[m][n]
diff --git a/solutions/477. Total Hamming Distance/477.cpp b/solutions/477. Total Hamming Distance/477.cpp
index 3680c6f0d76..df5674f202d 100644
--- a/solutions/477. Total Hamming Distance/477.cpp	
+++ b/solutions/477. Total Hamming Distance/477.cpp	
@@ -1,10 +1,10 @@
 class Solution {
  public:
   int totalHammingDistance(vector<int>& nums) {
-    constexpr int maxMask = 1 << 30;
+    constexpr int kMaxMask = 1 << 30;
     int ans = 0;
 
-    for (int mask = 1; mask < maxMask; mask <<= 1) {
+    for (int mask = 1; mask < kMaxMask; mask <<= 1) {
       const int ones =
           ranges::count_if(nums, [mask](int num) { return num & mask; });
       const int zeros = nums.size() - ones;
diff --git a/solutions/477. Total Hamming Distance/477.java b/solutions/477. Total Hamming Distance/477.java
index e01713c609b..7f695823bdf 100644
--- a/solutions/477. Total Hamming Distance/477.java	
+++ b/solutions/477. Total Hamming Distance/477.java	
@@ -1,9 +1,9 @@
 class Solution {
   public int totalHammingDistance(int[] nums) {
-    final int MAX_BIT = 30;
+    final int kMaxBit = 30;
     int ans = 0;
 
-    for (int i = 0; i < MAX_BIT; ++i) {
+    for (int i = 0; i < kMaxBit; ++i) {
       final int mask = 1 << i;
       final int ones = (int) Arrays.stream(nums).filter(num -> (num & mask) > 0).count();
       final int zeros = nums.length - ones;
diff --git a/solutions/477. Total Hamming Distance/477.py b/solutions/477. Total Hamming Distance/477.py
index 2db30fb0fb5..c259d09f03e 100644
--- a/solutions/477. Total Hamming Distance/477.py	
+++ b/solutions/477. Total Hamming Distance/477.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def totalHammingDistance(self, nums: list[int]) -> int:
-    MAX_BIT = 30
+  def totalHammingDistance(self, nums: List[int]) -> int:
+    kMaxBit = 30
     ans = 0
 
-    for i in range(MAX_BIT):
+    for i in range(kMaxBit):
       ones = sum(num & (1 << i) > 0 for num in nums)
       zeros = len(nums) - ones
       ans += ones * zeros
diff --git a/solutions/478. Generate Random Point in a Circle/478.py b/solutions/478. Generate Random Point in a Circle/478.py
index ee6dd08acd0..a439a9e21f0 100644
--- a/solutions/478. Generate Random Point in a Circle/478.py	
+++ b/solutions/478. Generate Random Point in a Circle/478.py	
@@ -4,7 +4,7 @@ def __init__(self, radius: float, x_center: float, y_center: float):
     self.x_center = x_center
     self.y_center = y_center
 
-  def randPoint(self) -> list[float]:
+  def randPoint(self) -> List[float]:
     length = math.sqrt(random.uniform(0, 1)) * self.radius
     degree = random.uniform(0, 1) * 2 * math.pi
     x = self.x_center + length * math.cos(degree)
diff --git a/solutions/479. Largest Palindrome Product/479.cpp b/solutions/479. Largest Palindrome Product/479.cpp
index c951f0edc59..ebed9e2749c 100644
--- a/solutions/479. Largest Palindrome Product/479.cpp	
+++ b/solutions/479. Largest Palindrome Product/479.cpp	
@@ -21,7 +21,7 @@ class Solution {
  private:
   long getPalindromeCandidate(int i) {
     string reversed = to_string(i);
-    ranges::reverse(reversed);
+    reverse(reversed.begin(), reversed.end());
     return stol(to_string(i) + reversed);
   }
 };
diff --git a/solutions/479. Largest Palindrome Product/479.java b/solutions/479. Largest Palindrome Product/479.java
index 9c0e6156f9b..c9992264a4e 100644
--- a/solutions/479. Largest Palindrome Product/479.java	
+++ b/solutions/479. Largest Palindrome Product/479.java	
@@ -3,7 +3,7 @@ public int largestPalindrome(int n) {
     if (n == 1)
       return 9;
 
-    final int MOD = 1337;
+    final int kMod = 1337;
     final int upper = (int) Math.pow(10, n) - 1;
     final int lower = (int) Math.pow(10, n - 1) - 1;
 
@@ -11,7 +11,7 @@ public int largestPalindrome(int n) {
       final long cand = getPalindromeCandidate(i);
       for (long j = upper; j * j >= cand; --j)
         if (cand % j == 0)
-          return (int) (cand % MOD);
+          return (int) (cand % kMod);
     }
 
     throw new IllegalArgumentException();
diff --git a/solutions/479. Largest Palindrome Product/479.py b/solutions/479. Largest Palindrome Product/479.py
index 5deb11c8dd1..03b439a4015 100644
--- a/solutions/479. Largest Palindrome Product/479.py	
+++ b/solutions/479. Largest Palindrome Product/479.py	
@@ -3,7 +3,7 @@ def largestPalindrome(self, n: int) -> int:
     if n == 1:
       return 9
 
-    MOD = 1337
+    kMod = 1337
     upper = pow(10, n) - 1
     lower = pow(10, n - 1) - 1
 
@@ -12,5 +12,5 @@ def largestPalindrome(self, n: int) -> int:
       j = upper
       while j * j >= cand:
         if cand % j == 0:
-          return cand % MOD
+          return cand % kMod
         j -= 1
diff --git a/solutions/48. Rotate Image/48-2.py b/solutions/48. Rotate Image/48-2.py
index f44a2d57724..60b309d2f81 100644
--- a/solutions/48. Rotate Image/48-2.py	
+++ b/solutions/48. Rotate Image/48-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def rotate(self, matrix: list[list[int]]) -> None:
+  def rotate(self, matrix: List[List[int]]) -> None:
     for mn in range(len(matrix) // 2):
       mx = len(matrix) - mn - 1
       for i in range(mn, mx):
diff --git a/solutions/48. Rotate Image/48.cpp b/solutions/48. Rotate Image/48.cpp
index dd8b15fd980..e6a9f63395b 100644
--- a/solutions/48. Rotate Image/48.cpp	
+++ b/solutions/48. Rotate Image/48.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   void rotate(vector<vector<int>>& matrix) {
-    ranges::reverse(matrix);
+    reverse(matrix.begin(), matrix.end());
     for (int i = 0; i < matrix.size(); ++i)
       for (int j = i + 1; j < matrix.size(); ++j)
         swap(matrix[i][j], matrix[j][i]);
diff --git a/solutions/48. Rotate Image/48.py b/solutions/48. Rotate Image/48.py
index 272d73eb585..74ecc343305 100644
--- a/solutions/48. Rotate Image/48.py	
+++ b/solutions/48. Rotate Image/48.py	
@@ -1,5 +1,7 @@
 class Solution:
-  def rotate(self, matrix: list[list[int]]) -> None:
+  def rotate(self, matrix: List[List[int]]) -> None:
     matrix.reverse()
-    for i, j in itertools.combinations(range(len(matrix)), 2):
-      matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]
+
+    for i in range(len(matrix)):
+      for j in range(i + 1, len(matrix)):
+        matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]
diff --git a/solutions/481. Magical String/481.java b/solutions/481. Magical String/481.java
deleted file mode 100644
index 12099498a85..00000000000
--- a/solutions/481. Magical String/481.java	
+++ /dev/null
@@ -1,18 +0,0 @@
-class Solution {
-  public int magicalString(int n) {
-    StringBuilder sb = new StringBuilder(" 122");
-    int ans = 0;
-
-    for (int i = 3; i <= n; ++i)
-      if (i % 2 == 1)
-        sb.append(String.valueOf('1').repeat(sb.charAt(i) - '0'));
-      else
-        sb.append(String.valueOf('2').repeat(sb.charAt(i) - '0'));
-
-    for (int i = 0; i <= n; ++i)
-      if (sb.charAt(i) == '1')
-        ++ans;
-
-    return ans;
-  }
-}
diff --git a/solutions/481. Magical String/481.py b/solutions/481. Magical String/481.py
deleted file mode 100644
index 0b5a19ce084..00000000000
--- a/solutions/481. Magical String/481.py	
+++ /dev/null
@@ -1,11 +0,0 @@
-class Solution:
-  def magicalString(self, n: int) -> int:
-    s = [' ', '1', '2', '2']
-
-    for i in range(3, n + 1):
-      if i % 2 == 1:
-        s.extend(['1'] * (int(s[i])))
-      else:
-        s.extend(['2'] * (int(s[i])))
-
-    return sum(1 for c in s[:n + 1] if c == '1')
diff --git a/solutions/482. License Key Formatting/482.cpp b/solutions/482. License Key Formatting/482.cpp
index ed9865ef4bd..3303097b1c8 100644
--- a/solutions/482. License Key Formatting/482.cpp	
+++ b/solutions/482. License Key Formatting/482.cpp	
@@ -13,7 +13,6 @@ class Solution {
       ++length;
     }
 
-    ranges::reverse(ans);
-    return ans;
+    return {ans.rbegin(), ans.rend()};
   }
 };
diff --git a/solutions/484. Find Permutation/484-2.java b/solutions/484. Find Permutation/484-2.java
index 97d33431e7f..e818db22d7f 100644
--- a/solutions/484. Find Permutation/484-2.java	
+++ b/solutions/484. Find Permutation/484-2.java	
@@ -27,14 +27,14 @@ private int getNextIndex(final String s, char c, int start) {
     return s.length();
   }
 
-  private void reverse(int[] arr, int l, int r) {
+  private void reverse(int[] A, int l, int r) {
     while (l < r)
-      swap(arr, l++, r--);
+      swap(A, l++, r--);
   }
 
-  private void swap(int[] arr, int i, int j) {
-    final int temp = arr[i];
-    arr[i] = arr[j];
-    arr[j] = temp;
+  private void swap(int[] A, int i, int j) {
+    final int temp = A[i];
+    A[i] = A[j];
+    A[j] = temp;
   }
 }
diff --git a/solutions/484. Find Permutation/484-2.py b/solutions/484. Find Permutation/484-2.py
index f1487005f2d..2a29a7023a3 100644
--- a/solutions/484. Find Permutation/484-2.py	
+++ b/solutions/484. Find Permutation/484-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findPermutation(self, s: str) -> list[int]:
+  def findPermutation(self, s: str) -> List[int]:
     ans = [i for i in range(1, len(s) + 2)]
 
     # For each D* group (s[i..j]), reverse ans[i..j + 1].
diff --git a/solutions/484. Find Permutation/484.py b/solutions/484. Find Permutation/484.py
index 0dc4f4f5e65..acbbe6a7cb5 100644
--- a/solutions/484. Find Permutation/484.py	
+++ b/solutions/484. Find Permutation/484.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findPermutation(self, s: str) -> list[int]:
+  def findPermutation(self, s: str) -> List[int]:
     ans = []
     stack = []
 
diff --git a/solutions/485. Max Consecutive Ones/485.py b/solutions/485. Max Consecutive Ones/485.py
index 2916f3b5135..f9b4afde744 100644
--- a/solutions/485. Max Consecutive Ones/485.py	
+++ b/solutions/485. Max Consecutive Ones/485.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaxConsecutiveOnes(self, nums: list[int]) -> int:
+  def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
     ans = 0
     summ = 0
 
diff --git a/solutions/487. Max Consecutive Ones II/487-2.py b/solutions/487. Max Consecutive Ones II/487-2.py
index 78dd6c6399a..451b7d18b4f 100644
--- a/solutions/487. Max Consecutive Ones II/487-2.py	
+++ b/solutions/487. Max Consecutive Ones II/487-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaxConsecutiveOnes(self, nums: list[int]) -> int:
+  def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
     maxZeros = 1
     ans = 0
     q = collections.deque()  # Store indices of zero.
diff --git a/solutions/487. Max Consecutive Ones II/487-3.py b/solutions/487. Max Consecutive Ones II/487-3.py
index 4c5df2307b6..d6601ba405e 100644
--- a/solutions/487. Max Consecutive Ones II/487-3.py	
+++ b/solutions/487. Max Consecutive Ones II/487-3.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaxConsecutiveOnes(self, nums: list[int]) -> int:
+  def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
     ans = 0
     lastZeroIndex = -1
 
diff --git a/solutions/487. Max Consecutive Ones II/487.py b/solutions/487. Max Consecutive Ones II/487.py
index 57f077965c5..2f259374e31 100644
--- a/solutions/487. Max Consecutive Ones II/487.py	
+++ b/solutions/487. Max Consecutive Ones II/487.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaxConsecutiveOnes(self, nums: list[int]) -> int:
+  def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
     ans = 0
     zeros = 0
 
diff --git a/solutions/488. Zuma Game/488.cpp b/solutions/488. Zuma Game/488.cpp
index d88a98083cd..6f16bc59a5a 100644
--- a/solutions/488. Zuma Game/488.cpp	
+++ b/solutions/488. Zuma Game/488.cpp	
@@ -31,7 +31,7 @@ class Solution {
         // Place hs[j] in board[i].
         const string& newHand = hs.substr(0, j) + hs.substr(j + 1);
         string newBoard = board.substr(0, i) + hs[j] + board.substr(i);
-        const int res = dfs(std::move(newBoard), newHand, std::move(mem));
+        const int res = dfs(move(newBoard), newHand, move(mem));
         if (res < INT_MAX)
           ans = min(ans, 1 + res);
       }
diff --git a/solutions/489. Robot Room Cleaner/489.cpp b/solutions/489. Robot Room Cleaner/489.cpp
index 1cd0213dac7..7588ebc3254 100644
--- a/solutions/489. Robot Room Cleaner/489.cpp	
+++ b/solutions/489. Robot Room Cleaner/489.cpp	
@@ -5,7 +5,7 @@
  *  public:
  *   // Returns true if the cell in front is open and robot moves into the cell.
  *   // Returns false if the cell in front is blocked and robot stays in the
- *   // Current cell. bool std::move();
+ *   // Current cell. bool move();
  *
  *   // Robot will stay in the same cell after calling turnLeft/turnRight.
  *   // Each turn will be 90 degrees.
@@ -24,7 +24,7 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   struct PairHash {
     size_t operator()(const pair<int, int>& p) const {
@@ -41,10 +41,10 @@ class Solution {
     // The order is important since the idea is always turning right.
     for (int k = 0; k < 4; ++k) {
       const int newD = (d + k) % 4;
-      const int x = i + kDirs[newD][0];
-      const int y = j + kDirs[newD][1];
+      const int x = i + dirs[newD][0];
+      const int y = j + dirs[newD][1];
       if (!seen.contains({x, y}) && robot.move()) {
-        dfs(robot, x, y, newD, std::move(seen));
+        dfs(robot, x, y, newD, move(seen));
         // Go back to the previous cell.
         robot.turnRight();
         robot.turnRight();
diff --git a/solutions/489. Robot Room Cleaner/489.java b/solutions/489. Robot Room Cleaner/489.java
index a52fef8fe1a..0037fe01347 100644
--- a/solutions/489. Robot Room Cleaner/489.java	
+++ b/solutions/489. Robot Room Cleaner/489.java	
@@ -21,7 +21,7 @@ public void cleanRoom(Robot robot) {
     dfs(robot, 0, 0, 0, new HashSet<>());
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private void dfs(Robot robot, int d, int i, int j, Set<Pair<Integer, Integer>> seen) {
     seen.add(new Pair<>(i, j));
@@ -31,8 +31,8 @@ private void dfs(Robot robot, int d, int i, int j, Set<Pair<Integer, Integer>> s
     // The order is important since the idea is always turning right.
     for (int k = 0; k < 4; ++k) {
       final int newD = (d + k) % 4;
-      final int x = i + DIRS[newD][0];
-      final int y = j + DIRS[newD][1];
+      final int x = i + dirs[newD][0];
+      final int y = j + dirs[newD][1];
       if (!seen.contains(new Pair<>(x, y)) && robot.move()) {
         dfs(robot, newD, x, y, seen);
         // Go back to the previous cell.
diff --git a/solutions/49. Group Anagrams/49.py b/solutions/49. Group Anagrams/49.py
index a1b747284df..731f367da9b 100644
--- a/solutions/49. Group Anagrams/49.py	
+++ b/solutions/49. Group Anagrams/49.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def groupAnagrams(self, strs: list[str]) -> list[list[str]]:
+  def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
     dict = collections.defaultdict(list)
 
     for str in strs:
diff --git a/solutions/490. The Maze/490-2.cpp b/solutions/490. The Maze/490-2.cpp
index 6347b703b5e..38b4f788efc 100644
--- a/solutions/490. The Maze/490-2.cpp	
+++ b/solutions/490. The Maze/490-2.cpp	
@@ -8,7 +8,7 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   bool dfs(vector<vector<int>>& maze, vector<vector<bool>>&& seen, int i, int j,
            const vector<int>& destination) {
@@ -19,14 +19,14 @@ class Solution {
 
     seen[i][j] = true;
 
-    for (const auto& [dx, dy] : kDirs) {
+    for (const auto& [dx, dy] : dirs) {
       int x = i;
       int y = j;
       while (isValid(maze, x + dx, y + dy)) {
         x += dx;
         y += dy;
       }
-      if (dfs(maze, std::move(seen), x, y, destination))
+      if (dfs(maze, move(seen), x, y, destination))
         return true;
     }
 
diff --git a/solutions/490. The Maze/490-2.java b/solutions/490. The Maze/490-2.java
index 22a797ef641..96cb2df5c7a 100644
--- a/solutions/490. The Maze/490-2.java	
+++ b/solutions/490. The Maze/490-2.java	
@@ -4,7 +4,7 @@ public boolean hasPath(int[][] maze, int[] start, int[] destination) {
     return dfs(maze, seen, start[0], start[1], destination);
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private boolean dfs(int[][] maze, boolean[][] seen, int i, int j, int[] destination) {
     if (i == destination[0] && j == destination[1])
@@ -14,7 +14,7 @@ private boolean dfs(int[][] maze, boolean[][] seen, int i, int j, int[] destinat
 
     seen[i][j] = true;
 
-    for (int[] dir : DIRS) {
+    for (int[] dir : dirs) {
       int x = i;
       int y = j;
       while (isValid(maze, x + dir[0], y + dir[1])) {
diff --git a/solutions/490. The Maze/490-2.py b/solutions/490. The Maze/490-2.py
index de913e935df..0c0ac1a5470 100644
--- a/solutions/490. The Maze/490-2.py	
+++ b/solutions/490. The Maze/490-2.py	
@@ -1,11 +1,6 @@
 class Solution:
-  def hasPath(
-      self,
-      maze: list[list[int]],
-      start: list[int],
-      destination: list[int],
-  ) -> bool:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def hasPath(self, maze: List[List[int]], start: List[int], destination: List[int]) -> bool:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(maze)
     n = len(maze[0])
 
@@ -22,7 +17,7 @@ def dfs(i: int, j: int) -> bool:
 
       seen.add((i, j))
 
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i
         y = j
         while isValid(x + dx, y + dy):
diff --git a/solutions/490. The Maze/490.cpp b/solutions/490. The Maze/490.cpp
index ff40f1c292c..12dc7c16fa9 100644
--- a/solutions/490. The Maze/490.cpp	
+++ b/solutions/490. The Maze/490.cpp	
@@ -2,7 +2,7 @@ class Solution {
  public:
   bool hasPath(vector<vector<int>>& maze, vector<int>& start,
                vector<int>& destination) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = maze.size();
     const int n = maze[0].size();
     queue<pair<int, int>> q{{{start[0], start[1]}}};
@@ -12,7 +12,7 @@ class Solution {
     while (!q.empty()) {
       const auto [i, j] = q.front();
       q.pop();
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         int x = i;
         int y = j;
         while (isValid(maze, x + dx, y + dy)) {
diff --git a/solutions/490. The Maze/490.java b/solutions/490. The Maze/490.java
index 1999ddcdeb2..6cb65cca8e4 100644
--- a/solutions/490. The Maze/490.java	
+++ b/solutions/490. The Maze/490.java	
@@ -1,16 +1,16 @@
 class Solution {
   public boolean hasPath(int[][] maze, int[] start, int[] destination) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = maze.length;
     final int n = maze[0].length;
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(start[0], start[1])));
+    Queue<int[]> q = new ArrayDeque<>(Arrays.asList(new int[] {start[0], start[1]}));
     boolean[][] seen = new boolean[m][n];
     seen[start[0]][start[1]] = true;
 
     while (!q.isEmpty()) {
-      final int i = q.peek().getKey();
-      final int j = q.poll().getValue();
-      for (int[] dir : DIRS) {
+      final int i = q.peek()[0];
+      final int j = q.poll()[1];
+      for (int[] dir : dirs) {
         int x = i;
         int y = j;
         while (isValid(maze, x + dir[0], y + dir[1])) {
@@ -21,7 +21,7 @@ public boolean hasPath(int[][] maze, int[] start, int[] destination) {
           return true;
         if (seen[x][y])
           continue;
-        q.offer(new Pair<>(x, y));
+        q.offer(new int[] {x, y});
         seen[x][y] = true;
       }
     }
diff --git a/solutions/490. The Maze/490.py b/solutions/490. The Maze/490.py
index 6b1be356bcc..0a81f5b9473 100644
--- a/solutions/490. The Maze/490.py	
+++ b/solutions/490. The Maze/490.py	
@@ -1,11 +1,6 @@
 class Solution:
-  def hasPath(
-      self,
-      maze: list[list[int]],
-      start: list[int],
-      destination: list[int],
-  ) -> bool:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def hasPath(self, maze: List[List[int]], start: List[int], destination: List[int]) -> bool:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(maze)
     n = len(maze[0])
     q = collections.deque([(start[0], start[1])])
@@ -16,7 +11,7 @@ def isValid(x: int, y: int) -> bool:
 
     while q:
       i, j = q.popleft()
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i
         y = j
         while isValid(x + dx, y + dy):
diff --git a/solutions/491. Increasing Subsequences/491.cpp b/solutions/491. Increasing Subsequences/491.cpp
index 5dcc3a48296..2815b3dc84c 100644
--- a/solutions/491. Increasing Subsequences/491.cpp	
+++ b/solutions/491. Increasing Subsequences/491.cpp	
@@ -20,7 +20,7 @@ class Solution {
       if (path.empty() || nums[i] >= path.back()) {
         used.insert(nums[i]);
         path.push_back(nums[i]);
-        dfs(nums, i + 1, std::move(path), ans);
+        dfs(nums, i + 1, move(path), ans);
         path.pop_back();
       }
     }
diff --git a/solutions/491. Increasing Subsequences/491.py b/solutions/491. Increasing Subsequences/491.py
index 066daf1dc0f..255a1627ef7 100644
--- a/solutions/491. Increasing Subsequences/491.py	
+++ b/solutions/491. Increasing Subsequences/491.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def findSubsequences(self, nums: list[int]) -> list[list[int]]:
+  def findSubsequences(self, nums: List[int]) -> List[List[int]]:
     ans = []
 
-    def dfs(s: int, path: list[int]) -> None:
+    def dfs(s: int, path: List[int]) -> None:
       if len(path) > 1:
         ans.append(path)
 
diff --git a/solutions/493. Reverse Pairs/493-2.cpp b/solutions/493. Reverse Pairs/493-2.cpp
index b91fc41874c..c397c0a2e13 100644
--- a/solutions/493. Reverse Pairs/493-2.cpp	
+++ b/solutions/493. Reverse Pairs/493-2.cpp	
@@ -10,7 +10,7 @@ class SegmentTree {
   }
 
   // Returns sum(nums[i..j]).
-  int query(int i, int j) const {
+  int query(int i, int j) {
     return query(0, 0, n - 1, i, j);
   }
 
@@ -42,7 +42,7 @@ class SegmentTree {
     tree[treeIndex] = merge(tree[2 * treeIndex + 1], tree[2 * treeIndex + 2]);
   }
 
-  int query(int treeIndex, int lo, int hi, int i, int j) const {
+  int query(int treeIndex, int lo, int hi, int i, int j) {
     if (i <= lo && hi <= j)  // [lo, hi] lies completely inside [i, j].
       return tree[treeIndex];
     if (j < lo || hi < i)  // [lo, hi] lies completely outside [i, j].
@@ -52,8 +52,9 @@ class SegmentTree {
                  query(treeIndex * 2 + 2, mid + 1, hi, i, j));
   }
 
-  int merge(int left, int right) const {
-    return left + right;
+  // Merges the result of the left node and the right node.
+  int merge(int a, int b) const {
+    return a + b;
   }
 };
 
diff --git a/solutions/493. Reverse Pairs/493-3.cpp b/solutions/493. Reverse Pairs/493-3.cpp
index 96a8c5ced5d..3e8ecfa3c43 100644
--- a/solutions/493. Reverse Pairs/493-3.cpp	
+++ b/solutions/493. Reverse Pairs/493-3.cpp	
@@ -61,11 +61,7 @@ class SegmentTree {
       return query(root->left, i, j);
     if (i > mid)
       return query(root->right, i, j);
-    return merge(query(root->left, i, mid), query(root->right, mid + 1, j));
-  }
-
-  int merge(int left, int right) const {
-    return left + right;
+    return query(root->left, i, mid) + query(root->right, mid + 1, j);
   }
 };
 
diff --git a/solutions/494. Target Sum/494-2.py b/solutions/494. Target Sum/494-2.py
index 33e2b76210e..13f91352c21 100644
--- a/solutions/494. Target Sum/494-2.py	
+++ b/solutions/494. Target Sum/494-2.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def findTargetSumWays(self, nums: list[int], target: int) -> int:
+  def findTargetSumWays(self, nums: List[int], target: int) -> int:
     summ = sum(nums)
     if summ < abs(target) or (summ + target) % 2 == 1:
       return 0
 
-    def knapsack(nums: list[int], target: int) -> int:
+    def knapsack(nums: List[int], target: int) -> int:
       # dp[i] := the number of ways to sum to i by nums so far
       dp = [0] * (target + 1)
       dp[0] = 1
diff --git a/solutions/494. Target Sum/494.py b/solutions/494. Target Sum/494.py
index e765c880d81..a8805c52344 100644
--- a/solutions/494. Target Sum/494.py	
+++ b/solutions/494. Target Sum/494.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findTargetSumWays(self, nums: list[int], target: int) -> int:
+  def findTargetSumWays(self, nums: List[int], target: int) -> int:
     summ = sum(nums)
     if summ < abs(target) or (summ + target) % 2 == 1:
       return 0
diff --git a/solutions/495. Teemo Attacking/495.py b/solutions/495. Teemo Attacking/495.py
index baa71899d74..ff74cf836e3 100644
--- a/solutions/495. Teemo Attacking/495.py	
+++ b/solutions/495. Teemo Attacking/495.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findPoisonedDuration(self, timeSeries: list[int], duration: int) -> int:
+  def findPoisonedDuration(self, timeSeries: List[int], duration: int) -> int:
     if duration == 0:
       return 0
 
diff --git a/solutions/496. Next Greater Element I/496.py b/solutions/496. Next Greater Element I/496.py
index 21ad1999013..19fcbd7efc9 100644
--- a/solutions/496. Next Greater Element I/496.py	
+++ b/solutions/496. Next Greater Element I/496.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def nextGreaterElement(self, nums1: list[int], nums2: list[int]) -> list[int]:
+  def nextGreaterElement(self, nums1: List[int], nums2: List[int]) -> List[int]:
     numToNextGreater = {}
     stack = []  # a decreasing stack
 
diff --git a/solutions/497. Random Point in Non-overlapping Rectangles/497.cpp b/solutions/497. Random Point in Non-overlapping Rectangles/497.cpp
index a2425d62020..8c76789e04b 100644
--- a/solutions/497. Random Point in Non-overlapping Rectangles/497.cpp	
+++ b/solutions/497. Random Point in Non-overlapping Rectangles/497.cpp	
@@ -1,6 +1,6 @@
 class Solution {
  public:
-  Solution(vector<vector<int>>& rects) : rects(std::move(rects)) {
+  Solution(vector<vector<int>>& rects) : rects(move(rects)) {
     for (const vector<int>& r : this->rects)
       areas.push_back(getArea(r));
     partial_sum(areas.begin(), areas.end(), areas.begin());
diff --git a/solutions/497. Random Point in Non-overlapping Rectangles/497.java b/solutions/497. Random Point in Non-overlapping Rectangles/497.java
index ef8f3ade9aa..dd6647c22ed 100644
--- a/solutions/497. Random Point in Non-overlapping Rectangles/497.java	
+++ b/solutions/497. Random Point in Non-overlapping Rectangles/497.java	
@@ -24,8 +24,8 @@ private int getArea(int[] r) {
     return (r[2] - r[0] + 1) * (r[3] - r[1] + 1);
   }
 
-  private int firstGreater(int[] arr, int target) {
-    final int i = Arrays.binarySearch(arr, target + 1);
+  private int firstGreater(int[] A, int target) {
+    final int i = Arrays.binarySearch(A, target + 1);
     return i < 0 ? -i - 1 : i;
   }
 }
diff --git a/solutions/497. Random Point in Non-overlapping Rectangles/497.py b/solutions/497. Random Point in Non-overlapping Rectangles/497.py
index 04098b5be05..b6f927dc564 100644
--- a/solutions/497. Random Point in Non-overlapping Rectangles/497.py	
+++ b/solutions/497. Random Point in Non-overlapping Rectangles/497.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def __init__(self, rects: list[list[int]]):
+  def __init__(self, rects: List[List[int]]):
     self.rects = rects
     self.areas = list(itertools.accumulate(
         [(x2 - x1 + 1) * (y2 - y1 + 1) for x1, y1, x2, y2 in rects]))
 
-  def pick(self) -> list[int]:
+  def pick(self) -> List[int]:
     index = bisect_right(self.areas, random.randint(0, self.areas[-1] - 1))
     x1, y1, x2, y2 = self.rects[index]
     return [random.randint(x1, x2), random.randint(y1, y2)]
diff --git a/solutions/499. The Maze III/499.cpp b/solutions/499. The Maze III/499.cpp
index 66f39901a36..f693fc9f5b7 100644
--- a/solutions/499. The Maze III/499.cpp	
+++ b/solutions/499. The Maze III/499.cpp	
@@ -30,17 +30,13 @@ class Solution {
     if (maze[i][j] == 0 || steps + 2 < maze[i][j]) {
       maze[i][j] = steps + 2;  // +2 because maze[i][j] == 0 || 1.
       if (dx == 0)
-        dfs(maze, i, j, hole, 1, 0, steps, std::move(minSteps), path + "d",
-            ans);
+        dfs(maze, i, j, hole, 1, 0, steps, move(minSteps), path + "d", ans);
       if (dy == 0)
-        dfs(maze, i, j, hole, 0, -1, steps, std::move(minSteps), path + "l",
-            ans);
+        dfs(maze, i, j, hole, 0, -1, steps, move(minSteps), path + "l", ans);
       if (dy == 0)
-        dfs(maze, i, j, hole, 0, 1, steps, std::move(minSteps), path + "r",
-            ans);
+        dfs(maze, i, j, hole, 0, 1, steps, move(minSteps), path + "r", ans);
       if (dx == 0)
-        dfs(maze, i, j, hole, -1, 0, steps, std::move(minSteps), path + "u",
-            ans);
+        dfs(maze, i, j, hole, -1, 0, steps, move(minSteps), path + "u", ans);
     }
   }
 };
diff --git a/solutions/499. The Maze III/499.py b/solutions/499. The Maze III/499.py
index c0dfa9be8c8..40a2949110a 100644
--- a/solutions/499. The Maze III/499.py	
+++ b/solutions/499. The Maze III/499.py	
@@ -1,11 +1,6 @@
 class Solution:
-  def findShortestWay(
-      self,
-      maze: list[list[int]],
-      ball: list[int],
-      hole: list[int],
-  ) -> str:
-    ans = 'impossible'
+  def findShortestWay(self, maze: List[List[int]], ball: List[int], hole: List[int]) -> str:
+    ans = "impossible"
     minSteps = math.inf
 
     def dfs(i: int, j: int, dx: int, dy: int, steps: int, path: str):
@@ -15,8 +10,8 @@ def dfs(i: int, j: int, dx: int, dy: int, steps: int, path: str):
         return
 
       if dx != 0 or dy != 0:  # Both are zeros for the initial ball position.
-        while (0 <= i + dx < len(maze) and 0 <= j + dy < len(maze[0]) and
-               maze[i + dx][j + dy] != 1):
+        while 0 <= i + dx < len(maze) and 0 <= j + dy < len(maze[0]) \
+                and maze[i + dx][j + dy] != 1:
           i += dx
           j += dy
           steps += 1
diff --git a/solutions/5. Longest Palindromic Substring/5-2.cpp b/solutions/5. Longest Palindromic Substring/5-2.cpp
index cc5e57b112c..c67814f8e53 100644
--- a/solutions/5. Longest Palindromic Substring/5-2.cpp	
+++ b/solutions/5. Longest Palindromic Substring/5-2.cpp	
@@ -1,51 +1,54 @@
 class Solution {
  public:
   string longestPalindrome(string s) {
-    const string t = join('@' + s + '$', /*delimiter=*/'#');
-    const vector<int> p = manacher(t);
-    int maxPalindromeLength = 0;
+    // '@' and '$' signs serve as sentinels appended to each end to avoid bounds
+    // checking.
+    const string& t = join('@' + s + '$', '#');
+    const int n = t.length();
+    // t[i - maxExtends[i]..i) ==
+    // t[i + 1..i + maxExtends[i]]
+    vector<int> maxExtends(n);
+    int center = 0;
+
+    for (int i = 1; i < n - 1; ++i) {
+      const int rightBoundary = center + maxExtends[center];
+      const int mirrorIndex = center - (i - center);
+      maxExtends[i] =
+          rightBoundary > i && min(rightBoundary - i, maxExtends[mirrorIndex]);
+
+      // Attempt to expand the palindrome centered at i.
+      while (t[i + 1 + maxExtends[i]] == t[i - 1 - maxExtends[i]])
+        ++maxExtends[i];
+
+      // If a palindrome centered at i expand past `rightBoundary`, adjust
+      // center based on expanded palindrome.
+      if (i + maxExtends[i] > rightBoundary)
+        center = i;
+    }
+
+    // Find `maxExtend` and `bestCenter`.
+    int maxExtend = 0;
     int bestCenter = -1;
 
-    for (int i = 0; i < p.size(); ++i)
-      if (p[i] > maxPalindromeLength) {
-        maxPalindromeLength = p[i];
+    for (int i = 0; i < n; ++i)
+      if (maxExtends[i] > maxExtend) {
+        maxExtend = maxExtends[i];
         bestCenter = i;
       }
 
-    const int l = (bestCenter - maxPalindromeLength) / 2;
-    const int r = (bestCenter + maxPalindromeLength) / 2;
+    const int l = (bestCenter - maxExtend) / 2;
+    const int r = (bestCenter + maxExtend) / 2;
     return s.substr(l, r - l);
   }
 
  private:
-  // Returns an array `p` s.t. `p[i]` is the length of the longest palindrome
-  // centered at `t[i]`, where `t` is a string with delimiters and sentinels.
-  vector<int> manacher(const string& t) {
-    vector<int> p(t.length());
-    int center = 0;
-    for (int i = 1; i < t.length() - 1; ++i) {
-      const int rightBoundary = center + p[center];
-      const int mirrorIndex = center - (i - center);
-      if (rightBoundary > i)
-        p[i] = min(rightBoundary - i, p[mirrorIndex]);
-      // Try to expand the palindrome centered at i.
-      while (t[i + 1 + p[i]] == t[i - 1 - p[i]])
-        ++p[i];
-      // If a palindrome centered at i expands past `rightBoundary`, adjust
-      // the center based on the expanded palindrome.
-      if (i + p[i] > rightBoundary)
-        center = i;
-    }
-    return p;
-  }
-
-  string join(const string& s, char delimiter) {
+  string join(const string& s, char c) {
     string joined;
-    for (int i = 0; i < s.length() - 1; ++i) {
+    for (int i = 0; i < s.length(); ++i) {
       joined += s[i];
-      joined += delimiter;
+      if (i != s.length() - 1)
+        joined += c;
     }
-    joined += s.back();
     return joined;
   }
 };
diff --git a/solutions/5. Longest Palindromic Substring/5-2.java b/solutions/5. Longest Palindromic Substring/5-2.java
index 0b7b53adee5..909c3e97526 100644
--- a/solutions/5. Longest Palindromic Substring/5-2.java	
+++ b/solutions/5. Longest Palindromic Substring/5-2.java	
@@ -1,51 +1,50 @@
 class Solution {
   public String longestPalindrome(String s) {
-    final String t = join('@' + s + '$', /*delimiter=*/'#');
-    final int[] p = manacher(t);
-    int maxPalindromeLength = 0;
-    int bestCenter = -1;
+    // '@' and '$' signs serve as sentinels appended to each end to avoid bounds
+    // checking.
+    final String t = join('@' + s + '$', '#');
+    final int n = t.length();
+    // t[i - maxExtends[i]..i) ==
+    // t[i + 1..i + maxExtends[i]]
+    int[] maxExtends = new int[n];
+    int center = 0;
 
-    for (int i = 0; i < p.length; ++i)
-      if (p[i] > maxPalindromeLength) {
-        maxPalindromeLength = p[i];
-        bestCenter = i;
-      }
+    for (int i = 1; i < n - 1; ++i) {
+      final int rightBoundary = center + maxExtends[center];
+      final int mirrorIndex = center - (i - center);
+      maxExtends[i] =
+          rightBoundary > i && Math.min(rightBoundary - i, maxExtends[mirrorIndex]) > 0 ? 1 : 0;
 
-    final int l = (bestCenter - maxPalindromeLength) / 2;
-    final int r = (bestCenter + maxPalindromeLength) / 2;
-    return s.substring(l, r);
-  }
+      // Attempt to expand the palindrome centered at i.
+      while (t.charAt(i + 1 + maxExtends[i]) == t.charAt(i - 1 - maxExtends[i]))
+        ++maxExtends[i];
 
-  // Returns an array `p` s.t. `p[i]` is the length of the longest palindrome
-  // centered at `t[i]`, where `t` is a string with delimiters and sentinels.
-  private int[] manacher(final String t) {
-    int[] p = new int[t.length()];
-    int center = 0;
-    for (int i = 1; i < t.length() - 1; ++i) {
-      int rightBoundary = center + p[center];
-      int mirrorIndex = center - (i - center);
-      if (rightBoundary > i)
-        p[i] = Math.min(rightBoundary - i, p[mirrorIndex]);
-      // Try to expand the palindrome centered at i.
-      while (i + 1 + p[i] < t.length() && i - 1 - p[i] >= 0 &&
-             t.charAt(i + 1 + p[i]) == t.charAt(i - 1 - p[i]))
-        ++p[i];
-      // If a palindrome centered at i expands past `rightBoundary`, adjust
-      // the center based on the expanded palindrome.
-      if (i + p[i] > rightBoundary) {
+      // If a palindrome centered at i expand past `rightBoundary`, adjust
+      // center based on expanded palindrome.
+      if (i + maxExtends[i] > rightBoundary)
         center = i;
-      }
     }
-    return p;
+
+    // Find `maxExtend` and `bestCenter`.
+    int maxExtend = 0;
+    int bestCenter = -1;
+
+    for (int i = 0; i < n; ++i)
+      if (maxExtends[i] > maxExtend) {
+        maxExtend = maxExtends[i];
+        bestCenter = i;
+      }
+
+    return s.substring((bestCenter - maxExtend) / 2, (bestCenter + maxExtend) / 2);
   }
 
-  private String join(final String s, char delimiter) {
-    StringBuilder joined = new StringBuilder();
-    for (int i = 0; i < s.length() - 1; ++i) {
-      joined.append(s.charAt(i));
-      joined.append(delimiter);
+  private String join(final String s, char c) {
+    StringBuilder sb = new StringBuilder();
+    for (int i = 0; i < s.length(); ++i) {
+      sb.append(s.charAt(i));
+      if (i != s.length() - 1)
+        sb.append(c);
     }
-    joined.append(s.charAt(s.length() - 1));
-    return joined.toString();
+    return sb.toString();
   }
 }
diff --git a/solutions/5. Longest Palindromic Substring/5-2.py b/solutions/5. Longest Palindromic Substring/5-2.py
index 6a8400616ea..d43f8e2c55a 100644
--- a/solutions/5. Longest Palindromic Substring/5-2.py	
+++ b/solutions/5. Longest Palindromic Substring/5-2.py	
@@ -1,30 +1,30 @@
 class Solution:
   def longestPalindrome(self, s: str) -> str:
+    # '@' and '$' signs serve as sentinels appended to each end to avoid bounds
+    # checking.
     t = '#'.join('@' + s + '$')
-    p = self._manacher(t)
-    maxPalindromeLength, bestCenter = max((extend, i)
-                                          for i, extend in enumerate(p))
-    l = (bestCenter - maxPalindromeLength) // 2
-    r = (bestCenter + maxPalindromeLength) // 2
-    return s[l:r]
-
-  def _manacher(self, t: str) -> list[int]:
-    """
-    Returns an array `p` s.t. `p[i]` is the length of the longest palindrome
-    centered at `t[i]`, where `t` is a string with delimiters and sentinels.
-    """
-    p = [0] * len(t)
+    n = len(t)
+    # t[i - maxExtends[i]..i) ==
+    # t[i + 1..i + maxExtends[i]]
+    maxExtends = [0] * n
     center = 0
-    for i in range(1, len(t) - 1):
-      rightBoundary = center + p[center]
+
+    for i in range(1, n - 1):
+      rightBoundary = center + maxExtends[center]
       mirrorIndex = center - (i - center)
-      if rightBoundary > i:
-        p[i] = min(rightBoundary - i, p[mirrorIndex])
-      # Try to expand the palindrome centered at i.
-      while t[i + 1 + p[i]] == t[i - 1 - p[i]]:
-        p[i] += 1
-      # If a palindrome centered at i expands past `rightBoundary`, adjust
-      # the center based on the expanded palindrome.
-      if i + p[i] > rightBoundary:
+      maxExtends[i] = rightBoundary > i and \
+          min(rightBoundary - i, maxExtends[mirrorIndex])
+
+      # Attempt to expand the palindrome centered at i.
+      while t[i + 1 + maxExtends[i]] == t[i - 1 - maxExtends[i]]:
+        maxExtends[i] += 1
+
+      # If a palindrome centered at i expand past `rightBoundary`, adjust
+      # center based on expanded palindrome.
+      if i + maxExtends[i] > rightBoundary:
         center = i
-    return p
+
+    # Find `maxExtend` and `bestCenter`.
+    maxExtend, bestCenter = max((extend, i)
+                                for i, extend in enumerate(maxExtends))
+    return s[(bestCenter - maxExtend) // 2:(bestCenter + maxExtend) // 2]
diff --git a/solutions/5. Longest Palindromic Substring/5.py b/solutions/5. Longest Palindromic Substring/5.py
index 320e8a2da5a..da0fc0cee00 100644
--- a/solutions/5. Longest Palindromic Substring/5.py	
+++ b/solutions/5. Longest Palindromic Substring/5.py	
@@ -6,7 +6,7 @@ def longestPalindrome(self, s: str) -> str:
     # (start, end) indices of the longest palindrome in s
     indices = [0, 0]
 
-    def extend(s: str, i: int, j: int) -> tuple[int, int]:
+    def extend(s: str, i: int, j: int) -> Tuple[int, int]:
       """
       Returns the (start, end) indices of the longest palindrome extended from
       the substring s[i..j].
diff --git a/solutions/500. Keyboard Row/500.py b/solutions/500. Keyboard Row/500.py
index 1b19b5c1e05..1309cce959b 100644
--- a/solutions/500. Keyboard Row/500.py	
+++ b/solutions/500. Keyboard Row/500.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findWords(self, words: list[str]) -> list[str]:
+  def findWords(self, words: List[str]) -> List[str]:
     ans = []
     rows = [set('qwertyuiop'), set('asdfghjkl'), set('zxcvbnm')]
 
diff --git a/solutions/501. Find Mode in Binary Search Tree/501.py b/solutions/501. Find Mode in Binary Search Tree/501.py
index 8752948091f..870dff774f5 100644
--- a/solutions/501. Find Mode in Binary Search Tree/501.py	
+++ b/solutions/501. Find Mode in Binary Search Tree/501.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def findMode(self, root: TreeNode | None) -> list[int]:
+  def findMode(self, root: Optional[TreeNode]) -> List[int]:
     self.ans = []
     self.pred = None
     self.count = 0
     self.maxCount = 0
 
-    def updateCount(root: TreeNode | None) -> None:
+    def updateCount(root: Optional[TreeNode]) -> None:
       if self.pred and self.pred.val == root.val:
         self.count += 1
       else:
@@ -19,7 +19,7 @@ def updateCount(root: TreeNode | None) -> None:
 
       self.pred = root
 
-    def inorder(root: TreeNode | None) -> None:
+    def inorder(root: Optional[TreeNode]) -> None:
       if not root:
         return
 
diff --git a/solutions/502. IPO/502.cpp b/solutions/502. IPO/502.cpp
index 31893907e07..f6029f78a94 100644
--- a/solutions/502. IPO/502.cpp	
+++ b/solutions/502. IPO/502.cpp	
@@ -1,28 +1,29 @@
 struct T {
   int pro;
   int cap;
+  T(int pro, int cap) : pro(pro), cap(cap) {}
 };
 
 class Solution {
  public:
-  int findMaximizedCapital(int k, int w, vector<int>& profits,
-                           vector<int>& capital) {
+  int findMaximizedCapital(int k, int W, vector<int>& Profits,
+                           vector<int>& Capital) {
     auto compareC = [](const T& a, const T& b) { return a.cap > b.cap; };
     auto compareP = [](const T& a, const T& b) { return a.pro < b.pro; };
     priority_queue<T, vector<T>, decltype(compareC)> minHeap(compareC);
     priority_queue<T, vector<T>, decltype(compareP)> maxHeap(compareP);
 
-    for (int i = 0; i < capital.size(); ++i)
-      minHeap.emplace(profits[i], capital[i]);
+    for (int i = 0; i < Capital.size(); ++i)
+      minHeap.emplace(Profits[i], Capital[i]);
 
-    while (k-- > 0) {
-      while (!minHeap.empty() && minHeap.top().cap <= w)
+    while (k--) {
+      while (!minHeap.empty() && minHeap.top().cap <= W)
         maxHeap.push(minHeap.top()), minHeap.pop();
       if (maxHeap.empty())
         break;
-      w += maxHeap.top().pro, maxHeap.pop();
+      W += maxHeap.top().pro, maxHeap.pop();
     }
 
-    return w;
+    return W;
   }
 };
diff --git a/solutions/502. IPO/502.java b/solutions/502. IPO/502.java
index 72f9e890b45..9daacecf8bb 100644
--- a/solutions/502. IPO/502.java	
+++ b/solutions/502. IPO/502.java	
@@ -1,20 +1,28 @@
+class T {
+  public int pro;
+  public int cap;
+  public T(int pro, int cap) {
+    this.pro = pro;
+    this.cap = cap;
+  }
+}
+
 class Solution {
-  public int findMaximizedCapital(int k, int w, int[] profits, int[] capital) {
-    record T(int pro, int cap) {}
-    Queue<T> minHeap = new PriorityQueue<>(Comparator.comparing(T::cap));
-    Queue<T> maxHeap = new PriorityQueue<>(Comparator.comparing(T::pro, Comparator.reverseOrder()));
+  public int findMaximizedCapital(int k, int W, int[] Profits, int[] Capital) {
+    Queue<T> minHeap = new PriorityQueue<>((a, b) -> a.cap - b.cap);
+    Queue<T> maxHeap = new PriorityQueue<>((a, b) -> b.pro - a.pro);
 
-    for (int i = 0; i < capital.length; ++i)
-      minHeap.offer(new T(profits[i], capital[i]));
+    for (int i = 0; i < Capital.length; ++i)
+      minHeap.offer(new T(Profits[i], Capital[i]));
 
     while (k-- > 0) {
-      while (!minHeap.isEmpty() && minHeap.peek().cap <= w)
+      while (!minHeap.isEmpty() && minHeap.peek().cap <= W)
         maxHeap.offer(minHeap.poll());
       if (maxHeap.isEmpty())
         break;
-      w += maxHeap.poll().pro;
+      W += maxHeap.poll().pro;
     }
 
-    return w;
+    return W;
   }
 }
diff --git a/solutions/503. Next Greater Element II/503.py b/solutions/503. Next Greater Element II/503.py
index 3dd38fe4f1e..2eab9282eda 100644
--- a/solutions/503. Next Greater Element II/503.py	
+++ b/solutions/503. Next Greater Element II/503.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def nextGreaterElements(self, nums: list[int]) -> list[int]:
+  def nextGreaterElements(self, nums: List[int]) -> List[int]:
     n = len(nums)
     ans = [-1] * n
     stack = []  # a decreasing stack storing indices
diff --git a/solutions/505. The Maze II/505-2.cpp b/solutions/505. The Maze II/505-2.cpp
index 397e758ebe1..c0a346be3d2 100644
--- a/solutions/505. The Maze II/505-2.cpp	
+++ b/solutions/505. The Maze II/505-2.cpp	
@@ -13,24 +13,24 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   void dfs(vector<vector<int>>& maze, vector<vector<int>>& dist, int i, int j,
            const vector<int>& destination) {
     if (i == destination[0] && j == destination[1])
       return;
 
-    for (const auto& [dx, dy] : kDirs) {
+    for (const auto& [dx, dy] : dirs) {
       int x = i;
       int y = j;
-      int step = dist[i][j];
+      int steps = dist[i][j];
       while (isValid(maze, x + dx, y + dy)) {
         x += dx;
         y += dy;
-        ++step;
+        ++steps;
       }
-      if (step < dist[x][y]) {
-        dist[x][y] = step;
+      if (steps < dist[x][y]) {
+        dist[x][y] = steps;
         dfs(maze, dist, x, y, destination);
       }
     }
diff --git a/solutions/505. The Maze II/505-2.java b/solutions/505. The Maze II/505-2.java
index e72448176bb..1abc6ce2934 100644
--- a/solutions/505. The Maze II/505-2.java	
+++ b/solutions/505. The Maze II/505-2.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int shortestDistance(int[][] maze, int[] start, int[] destination) {
     int[][] dist = new int[maze.length][maze[0].length];
-    Arrays.stream(dist).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE));
+    Arrays.stream(dist).forEach(row -> Arrays.fill(row, Integer.MAX_VALUE));
     dist[start[0]][start[1]] = 0;
 
     dfs(maze, dist, start[0], start[1], destination);
@@ -11,23 +11,23 @@ public int shortestDistance(int[][] maze, int[] start, int[] destination) {
         : dist[destination[0]][destination[1]];
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private void dfs(int[][] maze, int[][] dist, int i, int j, int[] destination) {
     if (i == destination[0] && j == destination[1])
       return;
 
-    for (int[] dir : DIRS) {
+    for (int[] dir : dirs) {
       int x = i;
       int y = j;
-      int step = dist[i][j];
+      int steps = dist[i][j];
       while (isValid(maze, x + dir[0], y + dir[1])) {
         x += dir[0];
         y += dir[1];
-        ++step;
+        ++steps;
       }
-      if (step < dist[x][y]) {
-        dist[x][y] = step;
+      if (steps < dist[x][y]) {
+        dist[x][y] = steps;
         dfs(maze, dist, x, y, destination);
       }
     }
diff --git a/solutions/505. The Maze II/505.cpp b/solutions/505. The Maze II/505.cpp
index 505133b7a08..b11bf2f4613 100644
--- a/solutions/505. The Maze II/505.cpp	
+++ b/solutions/505. The Maze II/505.cpp	
@@ -2,7 +2,7 @@ class Solution {
  public:
   int shortestDistance(vector<vector<int>>& maze, vector<int>& start,
                        vector<int>& destination) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = maze.size();
     const int n = maze[0].size();
     queue<pair<int, int>> q{{{start[0], start[1]}}};
@@ -12,17 +12,17 @@ class Solution {
     while (!q.empty()) {
       const auto [i, j] = q.front();
       q.pop();
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         int x = i;
         int y = j;
-        int step = dist[i][j];
+        int steps = dist[i][j];
         while (isValid(maze, x + dx, y + dy)) {
           x += dx;
           y += dy;
-          ++step;
+          ++steps;
         }
-        if (step < dist[x][y]) {
-          dist[x][y] = step;
+        if (steps < dist[x][y]) {
+          dist[x][y] = steps;
           if (x == destination[0] && y == destination[1])
             continue;
           q.emplace(x, y);
diff --git a/solutions/505. The Maze II/505.java b/solutions/505. The Maze II/505.java
index 744c550dcf7..3de78d33285 100644
--- a/solutions/505. The Maze II/505.java	
+++ b/solutions/505. The Maze II/505.java	
@@ -1,28 +1,28 @@
 class Solution {
   public int shortestDistance(int[][] maze, int[] start, int[] destination) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = maze.length;
     final int n = maze[0].length;
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(start[0], start[1])));
+    Queue<int[]> q = new ArrayDeque<>(Arrays.asList(new int[] {start[0], start[1]}));
     int[][] dist = new int[maze.length][maze[0].length];
-    Arrays.stream(dist).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE));
+    Arrays.stream(dist).forEach(row -> Arrays.fill(row, Integer.MAX_VALUE));
     dist[start[0]][start[1]] = 0;
 
     while (!q.isEmpty()) {
-      final int i = q.peek().getKey();
-      final int j = q.poll().getValue();
-      for (int[] dir : DIRS) {
+      final int i = q.peek()[0];
+      final int j = q.poll()[1];
+      for (int[] dir : dirs) {
         int x = i;
         int y = j;
-        int step = dist[i][j];
+        int steps = dist[i][j];
         while (isValid(maze, x + dir[0], y + dir[1])) {
           x += dir[0];
           y += dir[1];
-          ++step;
+          ++steps;
         }
-        if (step < dist[x][y]) {
-          dist[x][y] = step;
-          q.offer(new Pair<>(x, y));
+        if (steps < dist[x][y]) {
+          dist[x][y] = steps;
+          q.offer(new int[] {x, y});
         }
       }
     }
diff --git a/solutions/506. Relative Ranks/506.java b/solutions/506. Relative Ranks/506.java
index 477c8fb901e..10eaddb5ab4 100644
--- a/solutions/506. Relative Ranks/506.java	
+++ b/solutions/506. Relative Ranks/506.java	
@@ -7,7 +7,7 @@ public String[] findRelativeRanks(int[] nums) {
     for (int i = 0; i < n; ++i)
       indices.add(i);
 
-    Collections.sort(indices, Comparator.comparingInt(a -> - nums[a]));
+    Collections.sort(indices, (a, b) -> nums[b] - nums[a]);
 
     for (int i = 0; i < n; ++i)
       if (i == 0)
diff --git a/solutions/508. Most Frequent Subtree Sum/508.py b/solutions/508. Most Frequent Subtree Sum/508.py
index 0d9b3dcead9..779dd983ad0 100644
--- a/solutions/508. Most Frequent Subtree Sum/508.py	
+++ b/solutions/508. Most Frequent Subtree Sum/508.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def findFrequentTreeSum(self, root: TreeNode | None) -> list[int]:
+  def findFrequentTreeSum(self, root: Optional[TreeNode]) -> List[int]:
     if not root:
       return []
 
     count = collections.Counter()
 
-    def dfs(root: TreeNode | None) -> int:
+    def dfs(root: Optional[TreeNode]) -> int:
       if not root:
         return 0
 
diff --git a/solutions/51. N-Queens/51.cpp b/solutions/51. N-Queens/51.cpp
index c3bfff16966..3ebf3860559 100644
--- a/solutions/51. N-Queens/51.cpp	
+++ b/solutions/51. N-Queens/51.cpp	
@@ -21,8 +21,7 @@ class Solution {
         continue;
       board[i][j] = 'Q';
       cols[j] = diag1[i + j] = diag2[j - i + n - 1] = true;
-      dfs(n, i + 1, std::move(cols), std::move(diag1), std::move(diag2),
-          std::move(board), ans);
+      dfs(n, i + 1, move(cols), move(diag1), move(diag2), move(board), ans);
       cols[j] = diag1[i + j] = diag2[j - i + n - 1] = false;
       board[i][j] = '.';
     }
diff --git a/solutions/51. N-Queens/51.py b/solutions/51. N-Queens/51.py
index 3cd34db487d..c9dc9e610aa 100644
--- a/solutions/51. N-Queens/51.py	
+++ b/solutions/51. N-Queens/51.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def solveNQueens(self, n: int) -> list[list[str]]:
+  def solveNQueens(self, n: int) -> List[List[str]]:
     ans = []
     cols = [False] * n
     diag1 = [False] * (2 * n - 1)
     diag2 = [False] * (2 * n - 1)
 
-    def dfs(i: int, board: list[int]) -> None:
+    def dfs(i: int, board: List[int]) -> None:
       if i == n:
         ans.append(board)
         return
diff --git a/solutions/510. Inorder Successor in BST II/510.cpp b/solutions/510. Inorder Successor in BST II/510.cpp
index a59ebcce247..1d4bd574305 100644
--- a/solutions/510. Inorder Successor in BST II/510.cpp	
+++ b/solutions/510. Inorder Successor in BST II/510.cpp	
@@ -2,9 +2,9 @@ class Solution {
  public:
   Node* inorderSuccessor(Node* node) {
     // The successor is somewhere lower in the right subtree.
-    if (node->right != nullptr) {
+    if (node->right) {
       node = node->right;
-      while (node->left != nullptr)
+      while (node->left)
         node = node->left;
       return node;
     }
diff --git a/solutions/513. Find Bottom Left Tree Value/513-2.cpp b/solutions/513. Find Bottom Left Tree Value/513-2.cpp
index 376f3d70392..b6be28cf8a0 100644
--- a/solutions/513. Find Bottom Left Tree Value/513-2.cpp	
+++ b/solutions/513. Find Bottom Left Tree Value/513-2.cpp	
@@ -15,7 +15,7 @@ class Solution {
       ans = root->val;
     }
 
-    dfs(root->left, depth + 1, std::move(maxDepth), ans);
-    dfs(root->right, depth + 1, std::move(maxDepth), ans);
+    dfs(root->left, depth + 1, move(maxDepth), ans);
+    dfs(root->right, depth + 1, move(maxDepth), ans);
   }
 };
diff --git a/solutions/513. Find Bottom Left Tree Value/513-2.py b/solutions/513. Find Bottom Left Tree Value/513-2.py
index ed9c923465a..46a836a07f7 100644
--- a/solutions/513. Find Bottom Left Tree Value/513-2.py	
+++ b/solutions/513. Find Bottom Left Tree Value/513-2.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def findBottomLeftValue(self, root: TreeNode | None) -> int:
+  def findBottomLeftValue(self, root: Optional[TreeNode]) -> int:
     ans = 0
     maxDepth = 0
 
-    def dfs(root: TreeNode | None, depth: int) -> None:
+    def dfs(root: Optional[TreeNode], depth: int) -> None:
       nonlocal ans
       nonlocal maxDepth
       if not root:
diff --git a/solutions/513. Find Bottom Left Tree Value/513.java b/solutions/513. Find Bottom Left Tree Value/513.java
index fceca4a21dd..b8133d6d34f 100644
--- a/solutions/513. Find Bottom Left Tree Value/513.java	
+++ b/solutions/513. Find Bottom Left Tree Value/513.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int findBottomLeftValue(TreeNode root) {
-    Queue<TreeNode> q = new ArrayDeque<>(List.of(root));
+    Queue<TreeNode> q = new ArrayDeque<>(Arrays.asList(root));
     TreeNode node = null;
 
     while (!q.isEmpty()) {
diff --git a/solutions/513. Find Bottom Left Tree Value/513.py b/solutions/513. Find Bottom Left Tree Value/513.py
index 7ea33127607..5fe9bcc7490 100644
--- a/solutions/513. Find Bottom Left Tree Value/513.py	
+++ b/solutions/513. Find Bottom Left Tree Value/513.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findBottomLeftValue(self, root: TreeNode | None) -> int:
+  def findBottomLeftValue(self, root: Optional[TreeNode]) -> int:
     q = collections.deque([root])
 
     while q:
diff --git a/solutions/514. Freedom Trail/514.cpp b/solutions/514. Freedom Trail/514.cpp
index ea1f1746c4d..abd6d7cdbfa 100644
--- a/solutions/514. Freedom Trail/514.cpp	
+++ b/solutions/514. Freedom Trail/514.cpp	
@@ -24,8 +24,7 @@ class Solution {
       if (ring[i] == key[index]) {
         const int minRotates = min(i, ring.length() - i);
         const string& newRing = ring.substr(i) + ring.substr(0, i);
-        const int remainingRotates =
-            dfs(newRing, key, index + 1, std::move(mem));
+        const int remainingRotates = dfs(newRing, key, index + 1, move(mem));
         ans = min(ans, minRotates + remainingRotates);
       }
 
diff --git a/solutions/515. Find Largest Value in Each Tree Row/515-2.py b/solutions/515. Find Largest Value in Each Tree Row/515-2.py
index fd168279960..fb3d1bca4ef 100644
--- a/solutions/515. Find Largest Value in Each Tree Row/515-2.py	
+++ b/solutions/515. Find Largest Value in Each Tree Row/515-2.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def largestValues(self, root: TreeNode | None) -> list[int]:
+  def largestValues(self, root: Optional[TreeNode]) -> List[int]:
     ans = []
 
-    def dfs(root: TreeNode | None, depth: int) -> None:
+    def dfs(root: Optional[TreeNode], depth: int) -> None:
       if not root:
         return
       if depth + 1 > len(ans):
diff --git a/solutions/515. Find Largest Value in Each Tree Row/515.java b/solutions/515. Find Largest Value in Each Tree Row/515.java
index 5166149f43a..a09012c984a 100644
--- a/solutions/515. Find Largest Value in Each Tree Row/515.java	
+++ b/solutions/515. Find Largest Value in Each Tree Row/515.java	
@@ -4,7 +4,7 @@ public List<Integer> largestValues(TreeNode root) {
       return new ArrayList<>();
 
     List<Integer> ans = new ArrayList<>();
-    Queue<TreeNode> q = new ArrayDeque<>(List.of(root));
+    Queue<TreeNode> q = new ArrayDeque<>(Arrays.asList(root));
 
     while (!q.isEmpty()) {
       int mx = Integer.MIN_VALUE;
diff --git a/solutions/515. Find Largest Value in Each Tree Row/515.py b/solutions/515. Find Largest Value in Each Tree Row/515.py
index f34a8bd346c..7b6e2a7252e 100644
--- a/solutions/515. Find Largest Value in Each Tree Row/515.py	
+++ b/solutions/515. Find Largest Value in Each Tree Row/515.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestValues(self, root: TreeNode | None) -> list[int]:
+  def largestValues(self, root: Optional[TreeNode]) -> List[int]:
     if not root:
       return []
 
diff --git a/solutions/517. Super Washing Machines/517.py b/solutions/517. Super Washing Machines/517.py
index f4f858b5651..f154905513d 100644
--- a/solutions/517. Super Washing Machines/517.py	
+++ b/solutions/517. Super Washing Machines/517.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMinMoves(self, machines: list[int]) -> int:
+  def findMinMoves(self, machines: List[int]) -> int:
     dresses = sum(machines)
 
     if dresses % len(machines) != 0:
diff --git a/solutions/518. Coin Change 2/518.py b/solutions/518. Coin Change 2/518.py
index 8d7505d46e6..1b2b6c9260b 100644
--- a/solutions/518. Coin Change 2/518.py	
+++ b/solutions/518. Coin Change 2/518.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def change(self, amount: int, coins: list[int]) -> int:
+  def change(self, amount: int, coins: List[int]) -> int:
     dp = [1] + [0] * amount
 
     for coin in coins:
diff --git a/solutions/52. N-Queens II/52.cpp b/solutions/52. N-Queens II/52.cpp
index 198852bd948..58a170f4656 100644
--- a/solutions/52. N-Queens II/52.cpp	
+++ b/solutions/52. N-Queens II/52.cpp	
@@ -19,7 +19,7 @@ class Solution {
       if (cols[j] || diag1[i + j] || diag2[j - i + n - 1])
         continue;
       cols[j] = diag1[i + j] = diag2[j - i + n - 1] = true;
-      dfs(n, i + 1, std::move(cols), std::move(diag1), std::move(diag2), ans);
+      dfs(n, i + 1, move(cols), move(diag1), move(diag2), ans);
       cols[j] = diag1[i + j] = diag2[j - i + n - 1] = false;
     }
   }
diff --git a/solutions/522. Longest Uncommon Subsequence II/522.cpp b/solutions/522. Longest Uncommon Subsequence II/522.cpp
index 035c21803f3..947312105d3 100644
--- a/solutions/522. Longest Uncommon Subsequence II/522.cpp	
+++ b/solutions/522. Longest Uncommon Subsequence II/522.cpp	
@@ -10,8 +10,9 @@ class Solution {
       else
         seen.insert(str);
 
-    ranges::sort(strs, ranges::greater{},
-                 [](const string& s) { return s.length(); });
+    ranges::sort(strs, [](const string& a, const string& b) {
+      return a.length() > b.length();
+    });
 
     for (int i = 0; i < strs.size(); ++i) {
       if (duplicates.contains(strs[i]))
diff --git a/solutions/522. Longest Uncommon Subsequence II/522.py b/solutions/522. Longest Uncommon Subsequence II/522.py
index 435395aafb1..9a8b373714b 100644
--- a/solutions/522. Longest Uncommon Subsequence II/522.py	
+++ b/solutions/522. Longest Uncommon Subsequence II/522.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLUSlength(self, strs: list[str]) -> int:
+  def findLUSlength(self, strs: List[str]) -> int:
     def isSubsequence(a: str, b: str) -> bool:
       i = 0
       j = 0
@@ -19,7 +19,7 @@ def isSubsequence(a: str, b: str) -> bool:
         duplicates.add(s)
       seen.add(s)
 
-    strs.sort(key=lambda x: -len(x))
+    strs.sort(key=lambda s: -len(s))
 
     for i in range(len(strs)):
       if strs[i] in duplicates:
diff --git a/solutions/523. Continuous Subarray Sum/523.py b/solutions/523. Continuous Subarray Sum/523.py
index c51016f6868..d517d5719ac 100644
--- a/solutions/523. Continuous Subarray Sum/523.py	
+++ b/solutions/523. Continuous Subarray Sum/523.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def checkSubarraySum(self, nums: list[int], k: int) -> bool:
+  def checkSubarraySum(self, nums: List[int], k: int) -> bool:
     prefix = 0
     prefixToIndex = {0: -1}
 
diff --git a/solutions/524. Longest Word in Dictionary through Deleting/524.py b/solutions/524. Longest Word in Dictionary through Deleting/524.py
index 5c37836199d..0e7bb5b8208 100644
--- a/solutions/524. Longest Word in Dictionary through Deleting/524.py	
+++ b/solutions/524. Longest Word in Dictionary through Deleting/524.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLongestWord(self, s: str, d: list[str]) -> str:
+  def findLongestWord(self, s: str, d: List[str]) -> str:
     ans = ''
 
     for word in d:
diff --git a/solutions/525. Contiguous Array/525.py b/solutions/525. Contiguous Array/525.py
index 045d91b2a24..0c8208a606f 100644
--- a/solutions/525. Contiguous Array/525.py	
+++ b/solutions/525. Contiguous Array/525.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaxLength(self, nums: list[int]) -> int:
+  def findMaxLength(self, nums: List[int]) -> int:
     ans = 0
     prefix = 0
     prefixToIndex = {0: -1}
diff --git a/solutions/526. Beautiful Arrangement/526.cpp b/solutions/526. Beautiful Arrangement/526.cpp
index 1091db55206..d1c9a0e88d0 100644
--- a/solutions/526. Beautiful Arrangement/526.cpp	
+++ b/solutions/526. Beautiful Arrangement/526.cpp	
@@ -16,7 +16,7 @@ class Solution {
     for (int i = 1; i <= n; ++i)
       if (filled[i] == 'x' && (num % i == 0 || i % num == 0)) {
         filled[i] = 'o';
-        count += dfs(n, num + 1, std::move(filled), std::move(mem));
+        count += dfs(n, num + 1, move(filled), move(mem));
         filled[i] = 'x';
       }
 
diff --git a/solutions/527. Word Abbreviation/527-2.cpp b/solutions/527. Word Abbreviation/527-2.cpp
index ddc63dd3114..b6090fbe5fd 100644
--- a/solutions/527. Word Abbreviation/527-2.cpp	
+++ b/solutions/527. Word Abbreviation/527-2.cpp	
@@ -1,6 +1,7 @@
 struct IndexedWord {
   string word;
   int index;
+  IndexedWord(const string& word, int index) : word(word), index(index) {}
 };
 
 class Solution {
@@ -16,8 +17,9 @@ class Solution {
     }
 
     for (auto& [_, indexedWords] : abbrevToIndexedWords) {
-      ranges::sort(indexedWords, ranges::less{},
-                   [](const IndexedWord& iw) { return iw.word; });
+      ranges::sort(indexedWords, [](const auto& a, const auto& b) {
+        return a.word < b.word;
+      });
       vector<int> lcp(indexedWords.size());
       for (int i = 1; i < indexedWords.size(); ++i) {
         const int k =
diff --git a/solutions/527. Word Abbreviation/527-2.java b/solutions/527. Word Abbreviation/527-2.java
index 9921acb7fb4..601d19c1c0a 100644
--- a/solutions/527. Word Abbreviation/527-2.java	
+++ b/solutions/527. Word Abbreviation/527-2.java	
@@ -1,6 +1,14 @@
+class IndexedWord {
+  public String word;
+  public int index;
+  public IndexedWord(final String word, int index) {
+    this.word = word;
+    this.index = index;
+  }
+}
+
 class Solution {
   public List<String> wordsAbbreviation(List<String> words) {
-    record IndexedWord(String word, int index) {}
     String[] ans = new String[words.size()];
     Map<String, List<IndexedWord>> abbrevToIndexedWords = new HashMap<>();
 
diff --git a/solutions/527. Word Abbreviation/527-2.py b/solutions/527. Word Abbreviation/527-2.py
index d8823ae8e04..369c7d4c3ce 100644
--- a/solutions/527. Word Abbreviation/527-2.py	
+++ b/solutions/527. Word Abbreviation/527-2.py	
@@ -1,14 +1,11 @@
-from dataclasses import dataclass
-
-
-@dataclass
 class IndexedWord:
-  word: str
-  index: int
+  def __init__(self, word: str, index: int):
+    self.word = word
+    self.index = index
 
 
 class Solution:
-  def wordsAbbreviation(self, words: list[str]) -> list[str]:
+  def wordsAbbreviation(self, words: List[str]) -> List[str]:
     n = len(words)
     ans = [''] * n
 
diff --git a/solutions/527. Word Abbreviation/527-3.cpp b/solutions/527. Word Abbreviation/527-3.cpp
index 6d531ca9a22..cba00f04d33 100644
--- a/solutions/527. Word Abbreviation/527-3.cpp	
+++ b/solutions/527. Word Abbreviation/527-3.cpp	
@@ -1,6 +1,7 @@
 struct IndexedWord {
   string word;
   int index;
+  IndexedWord(const string& word, int index) : word(word), index(index) {}
 };
 
 struct TrieNode {
diff --git a/solutions/527. Word Abbreviation/527-3.java b/solutions/527. Word Abbreviation/527-3.java
index d7dafe57d4a..5c0c6fb1eee 100644
--- a/solutions/527. Word Abbreviation/527-3.java	
+++ b/solutions/527. Word Abbreviation/527-3.java	
@@ -1,3 +1,12 @@
+class IndexedWord {
+  public String word;
+  public int index;
+  public IndexedWord(final String word, int index) {
+    this.word = word;
+    this.index = index;
+  }
+}
+
 class TrieNode {
   public TrieNode[] children = new TrieNode[26];
   public int count = 0;
@@ -5,7 +14,6 @@ class TrieNode {
 
 class Solution {
   public List<String> wordsAbbreviation(List<String> words) {
-    record IndexedWord(String word, int index) {}
     String[] ans = new String[words.size()];
     Map<String, List<IndexedWord>> abbrevToIndexedWords = new HashMap<>();
 
diff --git a/solutions/527. Word Abbreviation/527-3.py b/solutions/527. Word Abbreviation/527-3.py
index e09de1876d6..ff014fbcfdc 100644
--- a/solutions/527. Word Abbreviation/527-3.py	
+++ b/solutions/527. Word Abbreviation/527-3.py	
@@ -1,20 +1,17 @@
-from dataclasses import dataclass
-
-
-@dataclass
 class IndexedWord:
-  word: str
-  index: int
+  def __init__(self, word: str, index: int):
+    self.word = word
+    self.index = index
 
 
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = collections.defaultdict(TrieNode)
     self.count = 0
 
 
 class Solution:
-  def wordsAbbreviation(self, words: list[str]) -> list[str]:
+  def wordsAbbreviation(self, words: List[str]) -> List[str]:
     n = len(words)
     ans = [''] * n
 
@@ -33,13 +30,13 @@ def getAbbrev(s: str, prefixIndex: int) -> str:
       abbrev = getAbbrev(word, 0)
       abbrevToIndexedWords[abbrev].append(IndexedWord(word, i))
 
-    def insertWord(root: TrieNode | None, word: str) -> None:
+    def insertWord(root: Optional[TrieNode], word: str) -> None:
       node = root
       for c in word:
         node = node.children.setdefault(c, TrieNode())
         node.count += 1
 
-    def firstUniqueIndex(root: TrieNode | None, word: str) -> None:
+    def firstUniqueIndex(root: Optional[TrieNode], word: str) -> None:
       node = root
       for i, c in enumerate(word):
         node = node.children[c]
diff --git a/solutions/527. Word Abbreviation/527.py b/solutions/527. Word Abbreviation/527.py
index 68d18d9996f..167897eddcc 100644
--- a/solutions/527. Word Abbreviation/527.py	
+++ b/solutions/527. Word Abbreviation/527.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def wordsAbbreviation(self, words: list[str]) -> list[str]:
+  def wordsAbbreviation(self, words: List[str]) -> List[str]:
     n = len(words)
 
     def getAbbrev(s: str, prefixIndex: int) -> str:
diff --git a/solutions/528. Random Pick with Weight/528-2.py b/solutions/528. Random Pick with Weight/528-2.py
index 9116d2dd4d8..325216f4c74 100644
--- a/solutions/528. Random Pick with Weight/528-2.py	
+++ b/solutions/528. Random Pick with Weight/528-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def __init__(self, w: list[int]):
+  def __init__(self, w: List[int]):
     self.prefix = list(itertools.accumulate(w))
 
   def pickIndex(self) -> int:
diff --git a/solutions/528. Random Pick with Weight/528.py b/solutions/528. Random Pick with Weight/528.py
index 075ee7042ed..6a2e2408a44 100644
--- a/solutions/528. Random Pick with Weight/528.py	
+++ b/solutions/528. Random Pick with Weight/528.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def __init__(self, w: list[int]):
+  def __init__(self, w: List[int]):
     self.prefix = list(itertools.accumulate(w))
 
   def pickIndex(self) -> int:
diff --git a/solutions/529. Minesweeper/529.cpp b/solutions/529. Minesweeper/529.cpp
index e9d6084eb1e..3df821c7540 100644
--- a/solutions/529. Minesweeper/529.cpp	
+++ b/solutions/529. Minesweeper/529.cpp	
@@ -14,8 +14,8 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[8][2] = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1},
-                                      {0, 1},   {1, -1}, {1, 0},  {1, 1}};
+  static constexpr int dirs[8][2] = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1},
+                                     {0, 1},   {1, -1}, {1, 0},  {1, 1}};
 
   void dfs(vector<vector<char>>& board, int i, int j) {
     if (i < 0 || i == board.size() || j < 0 || j == board[0].size())
@@ -27,13 +27,13 @@ class Solution {
     board[i][j] = minesCount == 0 ? 'B' : '0' + minesCount;
 
     if (minesCount == 0)
-      for (const auto& [dx, dy] : kDirs)
+      for (const auto& [dx, dy] : dirs)
         dfs(board, i + dx, j + dy);
   }
 
   int getMinesCount(const vector<vector<char>>& board, int i, int j) {
     int minesCount = 0;
-    for (const auto& [dx, dy] : kDirs) {
+    for (const auto& [dx, dy] : dirs) {
       const int x = i + dx;
       const int y = j + dy;
       if (x < 0 || x == board.size() || y < 0 || y == board[0].size())
diff --git a/solutions/529. Minesweeper/529.java b/solutions/529. Minesweeper/529.java
index 023634ef83e..575cb3f92dd 100644
--- a/solutions/529. Minesweeper/529.java	
+++ b/solutions/529. Minesweeper/529.java	
@@ -11,7 +11,7 @@ public char[][] updateBoard(char[][] board, int[] click) {
     return board;
   }
 
-  private static final int[][] DIRS = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1},
+  private static final int[][] dirs = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1},
                                        {0, 1},   {1, -1}, {1, 0},  {1, 1}};
 
   private void dfs(char[][] board, int i, int j) {
@@ -24,13 +24,13 @@ private void dfs(char[][] board, int i, int j) {
     board[i][j] = minesCount == 0 ? 'B' : (char) ('0' + minesCount);
 
     if (minesCount == 0)
-      for (int[] dir : DIRS)
+      for (int[] dir : dirs)
         dfs(board, i + dir[0], j + dir[1]);
   }
 
   private int getMinesCount(char[][] board, int i, int j) {
     int minesCount = 0;
-    for (final int[] dir : DIRS) {
+    for (final int[] dir : dirs) {
       final int x = i + dir[0];
       final int y = j + dir[1];
       if (x < 0 || x == board.length || y < 0 || y == board[0].length)
diff --git a/solutions/529. Minesweeper/529.py b/solutions/529. Minesweeper/529.py
index d0537591ce2..393cd71b83c 100644
--- a/solutions/529. Minesweeper/529.py	
+++ b/solutions/529. Minesweeper/529.py	
@@ -1,17 +1,16 @@
 class Solution:
-  def updateBoard(self, board: list[list[str]],
-                  click: list[int]) -> list[list[str]]:
+  def updateBoard(self, board: List[List[str]], click: List[int]) -> List[List[str]]:
     i, j = click
     if board[i][j] == 'M':
       board[i][j] = 'X'
       return board
 
-    DIRS = ((-1, -1), (-1, 0), (-1, 1), (0, -1),
+    dirs = ((-1, -1), (-1, 0), (-1, 1), (0, -1),
             (0, 1), (1, -1), (1, 0), (1, 1))
 
     def getMinesCount(i: int, j: int) -> int:
       minesCount = 0
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == len(board) or y < 0 or y == len(board[0]):
@@ -30,7 +29,7 @@ def dfs(i: int, j: int) -> None:
       board[i][j] = 'B' if minesCount == 0 else str(minesCount)
 
       if minesCount == 0:
-        for dx, dy in DIRS:
+        for dx, dy in dirs:
           dfs(i + dx, j + dy)
 
     dfs(i, j)
diff --git a/solutions/53. Maximum Subarray/53-2.py b/solutions/53. Maximum Subarray/53-2.py
index 60027ee4a7a..d5347cfdb0f 100644
--- a/solutions/53. Maximum Subarray/53-2.py	
+++ b/solutions/53. Maximum Subarray/53-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSubArray(self, nums: list[int]) -> int:
+  def maxSubArray(self, nums: List[int]) -> int:
     ans = -math.inf
     summ = 0
 
diff --git a/solutions/53. Maximum Subarray/53-3.cpp b/solutions/53. Maximum Subarray/53-3.cpp
index ddaf3fd7da0..3a981d779a3 100644
--- a/solutions/53. Maximum Subarray/53-3.cpp	
+++ b/solutions/53. Maximum Subarray/53-3.cpp	
@@ -1,10 +1,10 @@
 struct T {
-  int sum;
   // the sum of the subarray starting from the first number
-  int maxSubarraySumPrefix;
+  int maxSubarraySumLeft;
   // the sum of the subarray ending in the last number
-  int maxSubarraySumSuffix;
+  int maxSubarraySumRight;
   int maxSubarraySum;
+  int sum;
 };
 
 class Solution {
@@ -17,18 +17,19 @@ class Solution {
   T divideAndConquer(const vector<int>& nums, int l, int r) {
     if (l == r)
       return {nums[l], nums[l], nums[l], nums[l]};
+
     const int m = (l + r) / 2;
-    const T left = divideAndConquer(nums, l, m);
-    const T right = divideAndConquer(nums, m + 1, r);
-    return T{
-        .sum = left.sum + right.sum,
-        .maxSubarraySumPrefix = max(left.maxSubarraySumPrefix,
-                                    left.sum + right.maxSubarraySumPrefix),
-        .maxSubarraySumSuffix = max(right.maxSubarraySumSuffix,
-                                    right.sum + left.maxSubarraySumSuffix),
-        .maxSubarraySum =
-            max({left.maxSubarraySum, right.maxSubarraySum,
-                 left.maxSubarraySumSuffix + right.maxSubarraySumPrefix}),
-    };
+    const T t1 = divideAndConquer(nums, l, m);
+    const T t2 = divideAndConquer(nums, m + 1, r);
+
+    const int maxSubarraySumLeft =
+        max(t1.maxSubarraySumLeft, t1.sum + t2.maxSubarraySumLeft);
+    const int maxSubarraySumRight =
+        max(t1.maxSubarraySumRight + t2.sum, t2.maxSubarraySumRight);
+    const int maxSubarraySum =
+        max({t1.maxSubarraySumRight + t2.maxSubarraySumLeft, t1.maxSubarraySum,
+             t2.maxSubarraySum});
+    const int sum = t1.sum + t2.sum;
+    return {maxSubarraySumLeft, maxSubarraySumRight, maxSubarraySum, sum};
   }
 };
diff --git a/solutions/53. Maximum Subarray/53-3.java b/solutions/53. Maximum Subarray/53-3.java
index 81bef31159f..a18a9f1ed90 100644
--- a/solutions/53. Maximum Subarray/53-3.java	
+++ b/solutions/53. Maximum Subarray/53-3.java	
@@ -6,23 +6,24 @@ public int maxSubArray(int[] nums) {
   private T divideAndConquer(int[] nums, int l, int r) {
     if (l == r)
       return new T(nums[l], nums[l], nums[l], nums[l]);
+
     final int m = (l + r) / 2;
-    final T left = divideAndConquer(nums, l, m);
-    final T right = divideAndConquer(nums, m + 1, r);
-    final int maxSubarraySumPrefix =
-        Math.max(left.maxSubarraySumPrefix, left.sum + right.maxSubarraySumPrefix);
-    final int maxSubarraySumSuffix =
-        Math.max(left.maxSubarraySumSuffix + right.sum, right.maxSubarraySumSuffix);
-    final int maxSubarraySum = Math.max(left.maxSubarraySumSuffix + right.maxSubarraySumPrefix,
-                                        Math.max(left.maxSubarraySum, right.maxSubarraySum));
-    final int sum = left.sum + right.sum;
-    return new T(sum, maxSubarraySumPrefix, maxSubarraySumSuffix, maxSubarraySum);
+    final T t1 = divideAndConquer(nums, l, m);
+    final T t2 = divideAndConquer(nums, m + 1, r);
+
+    final int maxSubarraySumLeft = Math.max(t1.maxSubarraySumLeft, t1.sum + t2.maxSubarraySumLeft);
+    final int maxSubarraySumRight =
+        Math.max(t1.maxSubarraySumRight + t2.sum, t2.maxSubarraySumRight);
+    final int maxSubarraySum = Math.max(t1.maxSubarraySumRight + t2.maxSubarraySumLeft,
+                                        Math.max(t1.maxSubarraySum, t2.maxSubarraySum));
+    final int sum = t1.sum + t2.sum;
+    return new T(maxSubarraySumLeft, maxSubarraySumRight, maxSubarraySum, sum);
   }
 
-  private record T(int sum,
-                   // the sum of the subarray starting from the first number
-                   int maxSubarraySumPrefix,
-                   // the sum of the subarray ending in the last number
-                   int maxSubarraySumSuffix, //
-                   int maxSubarraySum) {}
+  private record T(
+      // the sum of the subarray starting from the first number
+      int maxSubarraySumLeft,
+      // the sum of the subarray ending in the last number
+      int maxSubarraySumRight, //
+      int maxSubarraySum, int sum) {}
 }
diff --git a/solutions/53. Maximum Subarray/53-3.py b/solutions/53. Maximum Subarray/53-3.py
index 8cc9f67fcf5..5cf5a4a5f7f 100644
--- a/solutions/53. Maximum Subarray/53-3.py	
+++ b/solutions/53. Maximum Subarray/53-3.py	
@@ -3,29 +3,31 @@
 
 @dataclass(frozen=True)
 class T:
-  summ: int
   # the sum of the subarray starting from the first number
   maxSubarraySumLeft: int
   # the sum of the subarray ending in the last number
   maxSubarraySumRight: int
   maxSubarraySum: int
+  summ: int
 
 
 class Solution:
-  def maxSubArray(self, nums: list[int]) -> int:
+  def maxSubArray(self, nums: List[int]) -> int:
     def divideAndConquer(l: int, r: int) -> T:
       if l == r:
         return T(nums[l], nums[l], nums[l], nums[l])
+
       m = (l + r) // 2
-      left = divideAndConquer(l, m)
-      right = divideAndConquer(m + 1, r)
-      maxSubarraySumLeft = max(left.maxSubarraySumLeft,
-                               left.summ + right.maxSubarraySumLeft)
+      t1 = divideAndConquer(l, m)
+      t2 = divideAndConquer(m + 1, r)
+
+      maxSubarraySumLeft = max(t1.maxSubarraySumLeft,
+                               t1.summ + t2.maxSubarraySumLeft)
       maxSubarraySumRight = max(
-          left.maxSubarraySumRight + right.summ, right.maxSubarraySumRight)
-      maxSubarraySum = max(left.maxSubarraySumRight + right.maxSubarraySumLeft,
-                           left.maxSubarraySum, right.maxSubarraySum)
-      summ = left.summ + right.summ
-      return T(summ, maxSubarraySumLeft, maxSubarraySumRight, maxSubarraySum)
+          t1.maxSubarraySumRight + t2.summ, t2.maxSubarraySumRight)
+      maxSubarraySum = max(t1.maxSubarraySumRight +
+                           t2.maxSubarraySumLeft, t1.maxSubarraySum, t2.maxSubarraySum)
+      summ = t1.summ + t2.summ
+      return T(maxSubarraySumLeft, maxSubarraySumRight, maxSubarraySum, summ)
 
     return divideAndConquer(0, len(nums) - 1).maxSubarraySum
diff --git a/solutions/53. Maximum Subarray/53.py b/solutions/53. Maximum Subarray/53.py
index 98703659042..e1016da1e3c 100644
--- a/solutions/53. Maximum Subarray/53.py	
+++ b/solutions/53. Maximum Subarray/53.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSubArray(self, nums: list[int]) -> int:
+  def maxSubArray(self, nums: List[int]) -> int:
     # dp[i] := the maximum sum subarray ending in i
     dp = [0] * len(nums)
 
diff --git a/solutions/530. Minimum Absolute Difference in BST/530.cpp b/solutions/530. Minimum Absolute Difference in BST/530.cpp
index c5d79f4dfa9..be67a741fc6 100644
--- a/solutions/530. Minimum Absolute Difference in BST/530.cpp	
+++ b/solutions/530. Minimum Absolute Difference in BST/530.cpp	
@@ -6,8 +6,8 @@ class Solution {
     int prev = -1;
     stack<TreeNode*> stack;
 
-    while (root != nullptr || !stack.empty()) {
-      while (root != nullptr) {
+    while (root || !stack.empty()) {
+      while (root) {
         stack.push(root);
         root = root->left;
       }
diff --git a/solutions/531. Lonely Pixel I/531.py b/solutions/531. Lonely Pixel I/531.py
index f3c2d02005e..1ff7fb8d197 100644
--- a/solutions/531. Lonely Pixel I/531.py	
+++ b/solutions/531. Lonely Pixel I/531.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLonelyPixel(self, picture: list[list[str]]) -> int:
+  def findLonelyPixel(self, picture: List[List[str]]) -> int:
     m = len(picture)
     n = len(picture[0])
     ans = 0
diff --git a/solutions/532. K-diff Pairs in an Array/532.py b/solutions/532. K-diff Pairs in an Array/532.py
index 4d89633a354..0c3aa1a3519 100644
--- a/solutions/532. K-diff Pairs in an Array/532.py	
+++ b/solutions/532. K-diff Pairs in an Array/532.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findPairs(self, nums: list[int], k: int) -> int:
+  def findPairs(self, nums: List[int], k: int) -> int:
     ans = 0
     numToIndex = {num: i for i, num in enumerate(nums)}
 
diff --git a/solutions/533. Lonely Pixel II/533.py b/solutions/533. Lonely Pixel II/533.py
index 19db5e6b803..cb19080c008 100644
--- a/solutions/533. Lonely Pixel II/533.py	
+++ b/solutions/533. Lonely Pixel II/533.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findBlackPixel(self, picture: list[list[str]], target: int) -> int:
+  def findBlackPixel(self, picture: List[List[str]], target: int) -> int:
     m = len(picture)
     n = len(picture[0])
     ans = 0
diff --git a/solutions/537. Complex Number Multiplication/537.cpp b/solutions/537. Complex Number Multiplication/537.cpp
index b9de29e33fb..3efc743ec80 100644
--- a/solutions/537. Complex Number Multiplication/537.cpp	
+++ b/solutions/537. Complex Number Multiplication/537.cpp	
@@ -1,14 +1,13 @@
 class Solution {
  public:
-  string complexNumberMultiply(string num1, string num2) {
-    const auto& [a0, a1] = getReala0ndImag(num1);
-    const auto& [b0, b1] = getReala0ndImag(num2);
-    return to_string(a0 * b0 - a1 * b1) + "+" + to_string(a0 * b1 + a1 * b0) +
-           "i";
+  string complexNumberMultiply(string a, string b) {
+    const auto& [A, B] = getRealAndImag(a);
+    const auto& [C, D] = getRealAndImag(b);
+    return to_string(A * C - B * D) + "+" + to_string(A * D + B * C) + "i";
   }
 
  private:
-  pair<int, int> getReala0ndImag(const string& s) {
+  pair<int, int> getRealAndImag(const string& s) {
     const string& real = s.substr(0, s.find_first_of('+'));
     const string& imag = s.substr(s.find_first_of('+') + 1);
     return {stoi(real), stoi(imag)};
diff --git a/solutions/537. Complex Number Multiplication/537.java b/solutions/537. Complex Number Multiplication/537.java
index 0c24c41a03c..f945c4eb24f 100644
--- a/solutions/537. Complex Number Multiplication/537.java	
+++ b/solutions/537. Complex Number Multiplication/537.java	
@@ -1,9 +1,9 @@
 class Solution {
-  public String complexNumberMultiply(String num1, String num2) {
-    int[] a = getRealAndImag(num1);
-    int[] b = getRealAndImag(num2);
-    return String.valueOf(a[0] * b[0] - a[1] * b[1]) + "+" +
-        String.valueOf(a[0] * b[1] + a[1] * b[0]) + "i";
+  public String complexNumberMultiply(String a, String b) {
+    int[] A = getRealAndImag(a);
+    int[] B = getRealAndImag(b);
+    return String.valueOf(A[0] * B[0] - A[1] * B[1]) + "+" +
+        String.valueOf(A[0] * B[1] + A[1] * B[0]) + "i";
   }
 
   private int[] getRealAndImag(final String s) {
diff --git a/solutions/537. Complex Number Multiplication/537.py b/solutions/537. Complex Number Multiplication/537.py
index 85714db1e91..889511ae228 100644
--- a/solutions/537. Complex Number Multiplication/537.py	
+++ b/solutions/537. Complex Number Multiplication/537.py	
@@ -1,8 +1,9 @@
 class Solution:
-  def complexNumberMultiply(self, num1: str, num2: str) -> str:
-    a0, a1 = self._getReala0ndImag(num1)
-    b0, b1 = self._getReala0ndImag(num2)
-    return str(a0 * b0 - a1 * b1) + '+' + str(a0 * b1 + a1 * b0) + 'i'
+  def complexNumberMultiply(self, a: str, b: str) -> str:
+    def getRealAndImag(s: str) -> tuple:
+      return int(s[:s.index('+')]), int(s[s.index('+') + 1:-1])
 
-  def _getReala0ndImag(self, s: str) -> tuple:
-    return int(s[:s.index('+')]), int(s[s.index('+') + 1:-1])
+    A, B = getRealAndImag(a)
+    C, D = getRealAndImag(b)
+
+    return str(A * C - B * D) + '+' + str(A * D + B * C) + 'i'
diff --git a/solutions/538. Convert BST to Greater Tree/538.py b/solutions/538. Convert BST to Greater Tree/538.py
index dcb94ccef80..4d605c68957 100644
--- a/solutions/538. Convert BST to Greater Tree/538.py	
+++ b/solutions/538. Convert BST to Greater Tree/538.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def convertBST(self, root: TreeNode | None) -> TreeNode | None:
+  def convertBST(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
     prefix = 0
 
-    def reversedInorder(root: TreeNode | None) -> None:
+    def reversedInorder(root: Optional[TreeNode]) -> None:
       nonlocal prefix
       if not root:
         return
diff --git a/solutions/539. Minimum Time Difference/539.py b/solutions/539. Minimum Time Difference/539.py
index 50c8c4e37e0..374f44d7504 100644
--- a/solutions/539. Minimum Time Difference/539.py	
+++ b/solutions/539. Minimum Time Difference/539.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMinDifference(self, timePoints: list[str]) -> int:
+  def findMinDifference(self, timePoints: List[str]) -> int:
     ans = 24 * 60
     nums = sorted([int(timePoint[:2]) * 60 + int(timePoint[3:])
                    for timePoint in timePoints])
diff --git a/solutions/54. Spiral Matrix/54.py b/solutions/54. Spiral Matrix/54.py
index 5ee798e45e7..48a42407a16 100644
--- a/solutions/54. Spiral Matrix/54.py	
+++ b/solutions/54. Spiral Matrix/54.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def spiralOrder(self, matrix: list[list[int]]) -> list[int]:
+  def spiralOrder(self, matrix: List[List[int]]) -> List[int]:
     if not matrix:
       return []
 
diff --git a/solutions/540. Single Element in a Sorted Array/540.py b/solutions/540. Single Element in a Sorted Array/540.py
index d3bdb208612..30dadd06ce2 100644
--- a/solutions/540. Single Element in a Sorted Array/540.py	
+++ b/solutions/540. Single Element in a Sorted Array/540.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def singleNonDuplicate(self, nums: list[int]) -> int:
+  def singleNonDuplicate(self, nums: List[int]) -> int:
     l = 0
     r = len(nums) - 1
 
diff --git a/solutions/542. 01 Matrix/542-2.cpp b/solutions/542. 01 Matrix/542-2.cpp
index 2bdbd27b674..6ac7e62a117 100644
--- a/solutions/542. 01 Matrix/542-2.cpp	
+++ b/solutions/542. 01 Matrix/542-2.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   vector<vector<int>> updateMatrix(vector<vector<int>>& mat) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = mat.size();
     const int n = mat[0].size();
     queue<pair<int, int>> q;
@@ -16,7 +16,7 @@ class Solution {
     while (!q.empty()) {
       const auto [i, j] = q.front();
       q.pop();
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/542. 01 Matrix/542-2.java b/solutions/542. 01 Matrix/542-2.java
index 661c664454a..9613248e7e8 100644
--- a/solutions/542. 01 Matrix/542-2.java	
+++ b/solutions/542. 01 Matrix/542-2.java	
@@ -1,28 +1,28 @@
 class Solution {
   public int[][] updateMatrix(int[][] mat) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = mat.length;
     final int n = mat[0].length;
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>();
+    Queue<int[]> q = new ArrayDeque<>();
 
     for (int i = 0; i < m; ++i)
       for (int j = 0; j < n; ++j)
         if (mat[i][j] == 0)
-          q.offer(new Pair<>(i, j));
+          q.offer(new int[] {i, j});
         else
           mat[i][j] = Integer.MAX_VALUE;
 
     while (!q.isEmpty()) {
-      final int i = q.peek().getKey();
-      final int j = q.poll().getValue();
-      for (int[] dir : DIRS) {
+      final int i = q.peek()[0];
+      final int j = q.poll()[1];
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == m || y < 0 || y == n)
           continue;
         if (mat[x][y] <= mat[i][j] + 1)
           continue;
-        q.offer(new Pair<>(x, y));
+        q.offer(new int[] {x, y});
         mat[x][y] = mat[i][j] + 1;
       }
     }
diff --git a/solutions/542. 01 Matrix/542-2.py b/solutions/542. 01 Matrix/542-2.py
index 72e2e8e0ba2..ed358e46ddc 100644
--- a/solutions/542. 01 Matrix/542-2.py	
+++ b/solutions/542. 01 Matrix/542-2.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def updateMatrix(self, mat: list[list[int]]) -> list[list[int]]:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def updateMatrix(self, mat: List[List[int]]) -> List[List[int]]:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(mat)
     n = len(mat[0])
     q = collections.deque()
@@ -14,7 +14,7 @@ def updateMatrix(self, mat: list[list[int]]) -> list[list[int]]:
 
     while q:
       i, j = q.popleft()
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/542. 01 Matrix/542.cpp b/solutions/542. 01 Matrix/542.cpp
index e2dc1eb5c9d..9513c8fdeac 100644
--- a/solutions/542. 01 Matrix/542.cpp	
+++ b/solutions/542. 01 Matrix/542.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   vector<vector<int>> updateMatrix(vector<vector<int>>& mat) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = mat.size();
     const int n = mat[0].size();
     queue<pair<int, int>> q;
@@ -17,7 +17,7 @@ class Solution {
     while (!q.empty()) {
       const auto [i, j] = q.front();
       q.pop();
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/542. 01 Matrix/542.java b/solutions/542. 01 Matrix/542.java
index 2c10939649f..cd6b4270bbf 100644
--- a/solutions/542. 01 Matrix/542.java	
+++ b/solutions/542. 01 Matrix/542.java	
@@ -1,22 +1,22 @@
 class Solution {
   public int[][] updateMatrix(int[][] mat) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[] dirs = new int[] {0, 1, 0, -1, 0};
     final int m = mat.length;
     final int n = mat[0].length;
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>();
+    Queue<int[]> q = new ArrayDeque<>();
     boolean[][] seen = new boolean[m][n];
 
     for (int i = 0; i < m; ++i)
       for (int j = 0; j < n; ++j)
         if (mat[i][j] == 0) {
-          q.offer(new Pair<>(i, j));
+          q.offer(new int[] {i, j});
           seen[i][j] = true;
         }
 
     while (!q.isEmpty()) {
-      final int i = q.peek().getKey();
-      final int j = q.poll().getValue();
-      for (int[] dir : DIRS) {
+      final int i = q.peek()[0];
+      final int j = q.poll()[1];
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == m || y < 0 || y == n)
@@ -24,7 +24,7 @@ public int[][] updateMatrix(int[][] mat) {
         if (seen[x][y])
           continue;
         mat[x][y] = mat[i][j] + 1;
-        q.offer(new Pair<>(x, y));
+        q.offer(new int[] {x, y});
         seen[x][y] = true;
       }
     }
diff --git a/solutions/542. 01 Matrix/542.py b/solutions/542. 01 Matrix/542.py
index 277c9f2ee6c..0d0f84ec491 100644
--- a/solutions/542. 01 Matrix/542.py	
+++ b/solutions/542. 01 Matrix/542.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def updateMatrix(self, mat: list[list[int]]) -> list[list[int]]:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def updateMatrix(self, mat: List[List[int]]) -> List[List[int]]:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     m = len(mat)
     n = len(mat[0])
     q = collections.deque()
@@ -14,7 +14,7 @@ def updateMatrix(self, mat: list[list[int]]) -> list[list[int]]:
 
     while q:
       i, j = q.popleft()
-      for dx, dy in DIRS:
+      for dx, dy in dirs:
         x = i + dx
         y = j + dy
         if x < 0 or x == m or y < 0 or y == n:
diff --git a/solutions/543. Diameter of Binary Tree/543.py b/solutions/543. Diameter of Binary Tree/543.py
index 4fb1607a492..bb80329b2e2 100644
--- a/solutions/543. Diameter of Binary Tree/543.py	
+++ b/solutions/543. Diameter of Binary Tree/543.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def diameterOfBinaryTree(self, root: TreeNode | None) -> int:
+  def diameterOfBinaryTree(self, root: Optional[TreeNode]) -> int:
     ans = 0
 
-    def maxDepth(root: TreeNode | None) -> int:
+    def maxDepth(root: Optional[TreeNode]) -> int:
       nonlocal ans
       if not root:
         return 0
diff --git a/solutions/544. Output Contest Matches/544.py b/solutions/544. Output Contest Matches/544.py
index 6eb0847274b..3e5bf443438 100644
--- a/solutions/544. Output Contest Matches/544.py	
+++ b/solutions/544. Output Contest Matches/544.py	
@@ -1,6 +1,6 @@
 class Solution:
   def findContestMatch(self, n: int) -> str:
-    def generateMatches(matches: list[str]) -> str:
+    def generateMatches(matches: List[str]) -> str:
       if len(matches) == 1:
         return matches[0]
 
diff --git a/solutions/545. Boundary of Binary Tree/545.java b/solutions/545. Boundary of Binary Tree/545.java
index 43e285a5ce1..e2da0c161a7 100644
--- a/solutions/545. Boundary of Binary Tree/545.java	
+++ b/solutions/545. Boundary of Binary Tree/545.java	
@@ -2,7 +2,7 @@ class Solution {
   public List<Integer> boundaryOfBinaryTree(TreeNode root) {
     if (root == null)
       return new ArrayList<>();
-    List<Integer> ans = new ArrayList<>(List.of(root.val));
+    List<Integer> ans = new ArrayList<>(Arrays.asList(root.val));
     dfs(root.left, true, false, ans);
     dfs(root.right, false, true, ans);
     return ans;
diff --git a/solutions/545. Boundary of Binary Tree/545.py b/solutions/545. Boundary of Binary Tree/545.py
index 5f11e7b088d..4be656563d4 100644
--- a/solutions/545. Boundary of Binary Tree/545.py	
+++ b/solutions/545. Boundary of Binary Tree/545.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def boundaryOfBinaryTree(self, root: TreeNode | None) -> list[int]:
+  def boundaryOfBinaryTree(self, root: Optional[TreeNode]) -> List[int]:
     if not root:
       return []
 
     ans = [root.val]
 
-    def dfs(root: TreeNode | None, lb: bool, rb: bool):
+    def dfs(root: Optional[TreeNode], lb: bool, rb: bool):
       """
       1. root.left is left boundary if root is left boundary.
          root.right if left boundary if root.left is None.
diff --git a/solutions/546. Remove Boxes/546.py b/solutions/546. Remove Boxes/546.py
index 97718251060..ff9a16940c6 100644
--- a/solutions/546. Remove Boxes/546.py	
+++ b/solutions/546. Remove Boxes/546.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def removeBoxes(self, boxes: list[int]) -> int:
+  def removeBoxes(self, boxes: List[int]) -> int:
     @functools.lru_cache(None)
     def dp(i: int, j: int, k: int) -> int:
       """
diff --git a/solutions/547. Friend Circles/547.py b/solutions/547. Friend Circles/547.py
index 29e319290d3..39e0e11d1b3 100644
--- a/solutions/547. Friend Circles/547.py	
+++ b/solutions/547. Friend Circles/547.py	
@@ -25,7 +25,7 @@ def _find(self, u: int) -> int:
 
 
 class Solution:
-  def findCircleNum(self, isConnected: list[list[int]]) -> int:
+  def findCircleNum(self, isConnected: List[List[int]]) -> int:
     n = len(isConnected)
     uf = UnionFind(n)
 
diff --git a/solutions/55. Jump Game/55.py b/solutions/55. Jump Game/55.py
index 037d2ee9b49..dda6ee130c9 100644
--- a/solutions/55. Jump Game/55.py	
+++ b/solutions/55. Jump Game/55.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canJump(self, nums: list[int]) -> bool:
+  def canJump(self, nums: List[int]) -> bool:
     i = 0
     reach = 0
 
diff --git a/solutions/552. Student Attendance Record II/552.cpp b/solutions/552. Student Attendance Record II/552.cpp
index be5f828054b..6735caa8903 100644
--- a/solutions/552. Student Attendance Record II/552.cpp	
+++ b/solutions/552. Student Attendance Record II/552.cpp	
@@ -6,7 +6,7 @@ class Solution {
     vector<vector<long>> dp(2, vector<long>(3));
     dp[0][0] = 1;
 
-    while (n-- > 0) {
+    while (n--) {
       const auto prev(dp);
 
       // Append a P.
@@ -30,8 +30,9 @@ class Solution {
       dp[1][2] = prev[1][1];
     }
 
-    return accumulate(dp.begin(), dp.end(), 0, [](int acc, vector<long>& row) {
-      return (acc + accumulate(row.begin(), row.end(), 0L)) % kMod;
+    return accumulate(dp.begin(), dp.end(), 0,
+                      [](int subtotal, vector<long>& row) {
+      return (subtotal + accumulate(row.begin(), row.end(), 0L)) % kMod;
     });
   }
 };
diff --git a/solutions/552. Student Attendance Record II/552.java b/solutions/552. Student Attendance Record II/552.java
index c11bdad7316..a31542c9271 100644
--- a/solutions/552. Student Attendance Record II/552.java	
+++ b/solutions/552. Student Attendance Record II/552.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int checkRecord(int n) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i][j] := the length so far with i A's and the last letters are j L's
     long[][] dp = new long[2][3];
     dp[0][0] = 1;
@@ -11,7 +11,7 @@ public int checkRecord(int n) {
                           .toArray((int length) -> new long[length][]);
 
       // Append a P.
-      dp[0][0] = (prev[0][0] + prev[0][1] + prev[0][2]) % MOD;
+      dp[0][0] = (prev[0][0] + prev[0][1] + prev[0][2]) % kMod;
 
       // Append an L.
       dp[0][1] = prev[0][0];
@@ -21,7 +21,7 @@ public int checkRecord(int n) {
 
       // Append an A or append a P.
       dp[1][0] =
-          (prev[0][0] + prev[0][1] + prev[0][2] + prev[1][0] + prev[1][1] + prev[1][2]) % MOD;
+          (prev[0][0] + prev[0][1] + prev[0][2] + prev[1][0] + prev[1][1] + prev[1][2]) % kMod;
 
       // Append an L.
       dp[1][1] = prev[1][0];
@@ -30,6 +30,6 @@ public int checkRecord(int n) {
       dp[1][2] = prev[1][1];
     }
 
-    return (int) ((dp[0][0] + dp[0][1] + dp[0][2] + dp[1][0] + dp[1][1] + dp[1][2]) % MOD);
+    return (int) ((dp[0][0] + dp[0][1] + dp[0][2] + dp[1][0] + dp[1][1] + dp[1][2]) % kMod);
   }
 }
diff --git a/solutions/552. Student Attendance Record II/552.py b/solutions/552. Student Attendance Record II/552.py
index 5725df7a1c2..e5780c8d435 100644
--- a/solutions/552. Student Attendance Record II/552.py	
+++ b/solutions/552. Student Attendance Record II/552.py	
@@ -1,6 +1,6 @@
 class Solution:
   def checkRecord(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # dp[i][j] := the length so far with i A's and the last letters are j L's
     dp = [[0] * 3 for _ in range(2)]
     dp[0][0] = 1
@@ -9,7 +9,7 @@ def checkRecord(self, n: int) -> int:
       prev = [A[:] for A in dp]
 
       # Append a P.
-      dp[0][0] = (prev[0][0] + prev[0][1] + prev[0][2]) % MOD
+      dp[0][0] = (prev[0][0] + prev[0][1] + prev[0][2]) % kMod
 
       # Append an L.
       dp[0][1] = prev[0][0]
@@ -19,7 +19,7 @@ def checkRecord(self, n: int) -> int:
 
       # Append an A or append a P.
       dp[1][0] = (prev[0][0] + prev[0][1] + prev[0][2] +
-                  prev[1][0] + prev[1][1] + prev[1][2]) % MOD
+                  prev[1][0] + prev[1][1] + prev[1][2]) % kMod
 
       # Append an L.
       dp[1][1] = prev[1][0]
@@ -27,4 +27,4 @@ def checkRecord(self, n: int) -> int:
       # Append an L.
       dp[1][2] = prev[1][1]
 
-    return (sum(dp[0]) + sum(dp[1])) % MOD
+    return (sum(dp[0]) + sum(dp[1])) % kMod
diff --git a/solutions/553. Optimal Division/553.py b/solutions/553. Optimal Division/553.py
index 0dbeddcb735..ba75ab4ce05 100644
--- a/solutions/553. Optimal Division/553.py	
+++ b/solutions/553. Optimal Division/553.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def optimalDivision(self, nums: list[int]) -> str:
+  def optimalDivision(self, nums: List[int]) -> str:
     ans = str(nums[0])
 
     if len(nums) == 1:
diff --git a/solutions/554. Brick Wall/554.py b/solutions/554. Brick Wall/554.py
index 51ee6ed36bc..b48c1196b54 100644
--- a/solutions/554. Brick Wall/554.py	
+++ b/solutions/554. Brick Wall/554.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def leastBricks(self, wall: list[list[int]]) -> int:
+  def leastBricks(self, wall: List[List[int]]) -> int:
     maxFreq = 0
     count = collections.defaultdict(int)
 
diff --git a/solutions/555. Split Concatenated Strings/555.cpp b/solutions/555. Split Concatenated Strings/555.cpp
index 0a09f7f7a4f..61cb25be593 100644
--- a/solutions/555. Split Concatenated Strings/555.cpp	
+++ b/solutions/555. Split Concatenated Strings/555.cpp	
@@ -18,7 +18,9 @@ class Solution {
 
  private:
   string reversed(const string& s) {
-    return {s.rbegin(), s.rend()};
+    string r = s;
+    reverse(r.begin(), r.end());
+    return r;
   }
 
   string join(const vector<string>& sortedStrs, int i) {
diff --git a/solutions/555. Split Concatenated Strings/555.py b/solutions/555. Split Concatenated Strings/555.py
index fcd4c208933..df0a7de35d3 100644
--- a/solutions/555. Split Concatenated Strings/555.py	
+++ b/solutions/555. Split Concatenated Strings/555.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def splitLoopedString(self, strs: list[str]) -> str:
+  def splitLoopedString(self, strs: List[str]) -> str:
     ans = ''
     sortedStrs = [max(s, s[::-1]) for s in strs]
 
diff --git a/solutions/556. Next Greater Element III/556.cpp b/solutions/556. Next Greater Element III/556.cpp
index cabeb6fdd6b..252fb599dfd 100644
--- a/solutions/556. Next Greater Element III/556.cpp	
+++ b/solutions/556. Next Greater Element III/556.cpp	
@@ -1,9 +1,35 @@
 class Solution {
  public:
   int nextGreaterElement(int n) {
-    string s = to_string(n);
-    ranges::next_permutation(s);
+    const string& s = nextPermutation(to_string(n));
     const long ans = stol(s);
     return ans > INT_MAX || ans <= n ? -1 : ans;
   }
+
+ private:
+  // Similar to 31. Next Permutation
+  string nextPermutation(string s) {
+    const int n = s.length();
+
+    int i;
+    for (i = n - 2; i >= 0; --i)
+      if (s[i] < s[i + 1])
+        break;
+
+    if (i >= 0) {
+      for (int j = n - 1; j > i; --j)
+        if (s[j] > s[i]) {
+          swap(s[i], s[j]);
+          break;
+        }
+    }
+
+    reverse(s, i + 1, n - 1);
+    return s;
+  }
+
+  void reverse(string& s, int l, int r) {
+    while (l < r)
+      swap(s[l++], s[r--]);
+  }
 };
diff --git a/solutions/556. Next Greater Element III/556.py b/solutions/556. Next Greater Element III/556.py
index c031c663b36..40136749f42 100644
--- a/solutions/556. Next Greater Element III/556.py	
+++ b/solutions/556. Next Greater Element III/556.py	
@@ -1,6 +1,6 @@
 class Solution:
   def nextGreaterElement(self, n: int) -> int:
-    def nextPermutation(s: list[str]) -> str:
+    def nextPermutation(s: List[chr]) -> str:
       i = len(s) - 2
       while i >= 0:
         if s[i] < s[i + 1]:
@@ -16,7 +16,7 @@ def nextPermutation(s: list[str]) -> str:
       reverse(s, i + 1, len(s) - 1)
       return ''.join(s)
 
-    def reverse(s: list[str], l: int, r: int):
+    def reverse(s: List[chr], l: int, r: int):
       while l < r:
         s[l], s[r] = s[r], s[l]
         l += 1
diff --git a/solutions/56. Merge Intervals/56.java b/solutions/56. Merge Intervals/56.java
index 5cc5a01a4c9..1f7dce94919 100644
--- a/solutions/56. Merge Intervals/56.java	
+++ b/solutions/56. Merge Intervals/56.java	
@@ -2,7 +2,7 @@ class Solution {
   public int[][] merge(int[][] intervals) {
     List<int[]> ans = new ArrayList<>();
 
-    Arrays.sort(intervals, Comparator.comparingInt(interval -> interval[0]));
+    Arrays.sort(intervals, (a, b) -> (a[0] - b[0]));
 
     for (int[] interval : intervals)
       if (ans.isEmpty() || ans.get(ans.size() - 1)[1] < interval[0])
diff --git a/solutions/56. Merge Intervals/56.py b/solutions/56. Merge Intervals/56.py
index b88a454ce6c..a72f1b825cf 100644
--- a/solutions/56. Merge Intervals/56.py	
+++ b/solutions/56. Merge Intervals/56.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def merge(self, intervals: list[list[int]]) -> list[list[int]]:
+  def merge(self, intervals: List[List[int]]) -> List[List[int]]:
     ans = []
 
     for interval in sorted(intervals):
diff --git a/solutions/560. Subarray Sum Equals K/560.py b/solutions/560. Subarray Sum Equals K/560.py
index 89bd7b1e159..c9622b56546 100644
--- a/solutions/560. Subarray Sum Equals K/560.py	
+++ b/solutions/560. Subarray Sum Equals K/560.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def subarraySum(self, nums: list[int], k: int) -> int:
+  def subarraySum(self, nums: List[int], k: int) -> int:
     ans = 0
     prefix = 0
     count = collections.Counter({0: 1})
diff --git a/solutions/561. Array Partition I/561.py b/solutions/561. Array Partition I/561.py
index f61d5ab8d3b..1736c689515 100644
--- a/solutions/561. Array Partition I/561.py	
+++ b/solutions/561. Array Partition I/561.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def arrayPairSum(self, nums: list[int]) -> int:
+  def arrayPairSum(self, nums: List[int]) -> int:
     return sum(sorted(nums)[::2])
diff --git a/solutions/562. Longest Line of Consecutive One in Matrix/562.py b/solutions/562. Longest Line of Consecutive One in Matrix/562.py
index ef8be174c51..9de606a1fe0 100644
--- a/solutions/562. Longest Line of Consecutive One in Matrix/562.py	
+++ b/solutions/562. Longest Line of Consecutive One in Matrix/562.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestLine(self, mat: list[list[int]]) -> int:
+  def longestLine(self, mat: List[List[int]]) -> int:
     m = len(mat)
     n = len(mat[0])
     ans = 0
diff --git a/solutions/563. Binary Tree Tilt/563.py b/solutions/563. Binary Tree Tilt/563.py
index f584a181b96..28598699d09 100644
--- a/solutions/563. Binary Tree Tilt/563.py	
+++ b/solutions/563. Binary Tree Tilt/563.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def findTilt(self, root: TreeNode | None) -> int:
+  def findTilt(self, root: Optional[TreeNode]) -> int:
     ans = 0
 
-    def summ(root: TreeNode | None) -> None:
+    def summ(root: Optional[TreeNode]) -> None:
       nonlocal ans
       if not root:
         return 0
diff --git a/solutions/564. Find the Closest Palindrome/564.cpp b/solutions/564. Find the Closest Palindrome/564.cpp
index 5b540bd8a1a..88a0ad73218 100644
--- a/solutions/564. Find the Closest Palindrome/564.cpp	
+++ b/solutions/564. Find the Closest Palindrome/564.cpp	
@@ -8,23 +8,22 @@ class Solution {
   }
 
  private:
-  // Returns the two closest palindromes to the given number.
   pair<long, long> getPalindromes(const string& s) {
     const long num = stol(s);
     const int n = s.length();
     pair<long, long> palindromes;
-    const string half = s.substr(0, (n + 1) / 2);
-    const string reversedHalf = reversed(half.substr(0, n / 2));
+    const string& half = s.substr(0, (n + 1) / 2);
+    const string& reversedHalf = reversed(half.substr(0, n / 2));
     const long candidate = stol(half + reversedHalf);
 
     if (candidate < num)
       palindromes.first = candidate;
     else {
-      const string prevHalf = to_string(stol(half) - 1);
-      const string reversedPrevHalf = reversed(prevHalf.substr(0, n / 2));
+      const string& prevHalf = to_string(stol(half) - 1);
+      const string& reversedPrevHalf = reversed(prevHalf.substr(0, n / 2));
       if (n % 2 == 0 && stol(prevHalf) == 0)
         palindromes.first = 9;
-      else if (n % 2 == 0 && prevHalf == "9")
+      else if (n % 2 == 0 && (stol(prevHalf) + 1) % 10 == 0)
         palindromes.first = stol(prevHalf + '9' + reversedPrevHalf);
       else
         palindromes.first = stol(prevHalf + reversedPrevHalf);
diff --git a/solutions/564. Find the Closest Palindrome/564.java b/solutions/564. Find the Closest Palindrome/564.java
index 3b8eafc5ba1..b41e2cd3d5f 100644
--- a/solutions/564. Find the Closest Palindrome/564.java	
+++ b/solutions/564. Find the Closest Palindrome/564.java	
@@ -7,7 +7,6 @@ public String nearestPalindromic(String n) {
         : String.valueOf(palindromes[1]);
   }
 
-  // Returns the two closest palindromes to the given number.
   private long[] getPalindromes(final String s) {
     final long num = Long.parseLong(s);
     final int n = s.length();
@@ -26,7 +25,7 @@ private long[] getPalindromes(final String s) {
               .toString();
       if (n % 2 == 0 && Long.parseLong(prevHalf) == 0)
         palindromes[0] = 9;
-      else if (n % 2 == 0 && prevHalf.equals("9"))
+      else if (n % 2 == 0 && (Long.parseLong(prevHalf) + 1) % 10 == 0)
         palindromes[0] = Long.parseLong(prevHalf + '9' + reversedPrevHalf);
       else
         palindromes[0] = Long.parseLong(prevHalf + reversedPrevHalf);
diff --git a/solutions/564. Find the Closest Palindrome/564.py b/solutions/564. Find the Closest Palindrome/564.py
index ee62ab0b7e3..8ab916c0023 100644
--- a/solutions/564. Find the Closest Palindrome/564.py	
+++ b/solutions/564. Find the Closest Palindrome/564.py	
@@ -1,36 +1,33 @@
 class Solution:
   def nearestPalindromic(self, n: str) -> str:
-    prevPalindrome, nextPalindrome = self._getPalindromes(n)
-    return (str(prevPalindrome)
-            if abs(prevPalindrome - int(n)) <= abs(nextPalindrome - int(n))
-            else str(nextPalindrome))
+    def getPalindromes(s: str) -> tuple:
+      num = int(s)
+      k = len(s)
+      palindromes = []
+      half = s[0:(k + 1) // 2]
+      reversedHalf = half[:k // 2][::-1]
+      candidate = int(half + reversedHalf)
 
-  def _getPalindromes(self, s: str) -> tuple[str, str]:
-    """Returns the two closest palindromes to the given number."""
-    num = int(s)
-    sz = len(s)
-    palindromes = []
-    half = s[0:(sz + 1) // 2]
-    reversedHalf = half[:sz // 2][::-1]
-    candidate = int(half + reversedHalf)
+      if candidate < num:
+        palindromes.append(candidate)
+      else:
+        prevHalf = str(int(half) - 1)
+        reversedPrevHalf = prevHalf[:k // 2][::-1]
+        if k % 2 == 0 and int(prevHalf) == 0:
+          palindromes.append(9)
+        elif k % 2 == 0 and (int(prevHalf) + 1) % 10 == 0:
+          palindromes.append(int(prevHalf + '9' + reversedPrevHalf))
+        else:
+          palindromes.append(int(prevHalf + reversedPrevHalf))
 
-    if candidate < num:
-      palindromes.append(candidate)
-    else:
-      prevHalf = str(int(half) - 1)
-      reversedPrevHalf = prevHalf[:sz // 2][::-1]
-      if sz % 2 == 0 and int(prevHalf) == 0:
-        palindromes.append(9)
-      elif sz % 2 == 0 and prevHalf == '9':
-        palindromes.append(int(prevHalf + '9' + reversedPrevHalf))
+      if candidate > num:
+        palindromes.append(candidate)
       else:
-        palindromes.append(int(prevHalf + reversedPrevHalf))
+        nextHalf = str(int(half) + 1)
+        reversedNextHalf = nextHalf[:k // 2][::-1]
+        palindromes.append(int(nextHalf + reversedNextHalf))
 
-    if candidate > num:
-      palindromes.append(candidate)
-    else:
-      nextHalf = str(int(half) + 1)
-      reversedNextHalf = nextHalf[:sz // 2][::-1]
-      palindromes.append(int(nextHalf + reversedNextHalf))
+      return palindromes
 
-    return palindromes
+    prevPalindrome, nextPalindrome = getPalindromes(n)
+    return str(prevPalindrome) if abs(prevPalindrome - int(n)) <= abs(nextPalindrome - int(n)) else str(nextPalindrome)
diff --git a/solutions/565. Array Nesting/565.py b/solutions/565. Array Nesting/565.py
index 07dfa1b04c8..195e852dd2c 100644
--- a/solutions/565. Array Nesting/565.py	
+++ b/solutions/565. Array Nesting/565.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def arrayNesting(self, nums: list[int]) -> int:
+  def arrayNesting(self, nums: List[int]) -> int:
     ans = 0
 
     for num in nums:
diff --git a/solutions/566. Reshape the Matrix/566.py b/solutions/566. Reshape the Matrix/566.py
index 6f30df67e06..7e5ddfc1b46 100644
--- a/solutions/566. Reshape the Matrix/566.py	
+++ b/solutions/566. Reshape the Matrix/566.py	
@@ -1,6 +1,5 @@
 class Solution:
-  def matrixReshape(self, nums: list[list[int]],
-                    r: int, c: int) -> list[list[int]]:
+  def matrixReshape(self, nums: List[List[int]], r: int, c: int) -> List[List[int]]:
     if nums == [] or r * c != len(nums) * len(nums[0]):
       return nums
 
diff --git a/solutions/568. Maximum Vacation Days/568-3.cpp b/solutions/568. Maximum Vacation Days/568-3.cpp
index 4604aff7ccb..612d9434abf 100644
--- a/solutions/568. Maximum Vacation Days/568-3.cpp	
+++ b/solutions/568. Maximum Vacation Days/568-3.cpp	
@@ -14,7 +14,7 @@ class Solution {
           if (flights[i][j] == 1)
             newDp[i] = max(newDp[i], days[j][k] + dp[j]);
       }
-      dp = std::move(newDp);
+      dp = move(newDp);
     }
 
     return dp[0];
diff --git a/solutions/57. Insert Interval/57.py b/solutions/57. Insert Interval/57.py
index ab5794f6b68..d8c09c47a5a 100644
--- a/solutions/57. Insert Interval/57.py	
+++ b/solutions/57. Insert Interval/57.py	
@@ -1,6 +1,5 @@
 class Solution:
-  def insert(self, intervals: list[list[int]],
-             newInterval: list[int]) -> list[list[int]]:
+  def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]:
     n = len(intervals)
     ans = []
     i = 0
diff --git a/solutions/573. Squirrel Simulation/573.py b/solutions/573. Squirrel Simulation/573.py
index 5868f30456a..7a812eb2569 100644
--- a/solutions/573. Squirrel Simulation/573.py	
+++ b/solutions/573. Squirrel Simulation/573.py	
@@ -1,13 +1,6 @@
 class Solution:
-  def minDistance(
-      self,
-      height: int,
-      width: int,
-      tree: list[int],
-      squirrel: list[int],
-      nuts: list[list[int]],
-  ) -> int:
-    def dist(a: list[int], b: list[int]) -> int:
+  def minDistance(self, height: int, width: int, tree: List[int], squirrel: List[int], nuts: List[List[int]]) -> int:
+    def dist(a: List[int], b: List[int]) -> int:
       return abs(a[0] - b[0]) + abs(a[1] - b[1])
 
     totDist = sum(dist(nut, tree) for nut in nuts) * 2
diff --git a/solutions/575. Distribute Candies/575.py b/solutions/575. Distribute Candies/575.py
index b2e5e8128fb..2e3a80a31ba 100644
--- a/solutions/575. Distribute Candies/575.py	
+++ b/solutions/575. Distribute Candies/575.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def distributeCandies(self, candies: list[int]) -> int:
+  def distributeCandies(self, candies: List[int]) -> int:
     return min(len(candies) // 2, len(set(candies)))
diff --git a/solutions/576. Out of Boundary Paths/576-2.cpp b/solutions/576. Out of Boundary Paths/576-2.cpp
index 49727ea815a..7404e66edf6 100644
--- a/solutions/576. Out of Boundary Paths/576-2.cpp	
+++ b/solutions/576. Out of Boundary Paths/576-2.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int findPaths(int m, int n, int maxMove, int startRow, int startColumn) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     constexpr int kMod = 1'000'000'007;
     int ans = 0;
     // dp[i][j] := the number of paths to move the ball (i, j) out-of-bounds
@@ -13,7 +13,7 @@ class Solution {
       for (int i = 0; i < m; ++i)
         for (int j = 0; j < n; ++j)
           if (dp[i][j] > 0)
-            for (const auto& [dx, dy] : kDirs) {
+            for (const auto& [dx, dy] : dirs) {
               const int x = i + dx;
               const int y = j + dy;
               if (x < 0 || x == m || y < 0 || y == n)
@@ -21,7 +21,7 @@ class Solution {
               else
                 newDp[x][y] = (newDp[x][y] + dp[i][j]) % kMod;
             }
-      dp = std::move(newDp);
+      dp = move(newDp);
     }
 
     return ans;
diff --git a/solutions/576. Out of Boundary Paths/576-2.java b/solutions/576. Out of Boundary Paths/576-2.java
index 2622979f701..fda0059f8f1 100644
--- a/solutions/576. Out of Boundary Paths/576-2.java	
+++ b/solutions/576. Out of Boundary Paths/576-2.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int findPaths(int m, int n, int maxMove, int startRow, int startColumn) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
-    final int MOD = 1_000_000_007;
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int kMod = 1_000_000_007;
     int ans = 0;
     // dp[i][j] := the number of paths to move the ball (i, j) out-of-bounds
     int[][] dp = new int[m][n];
@@ -12,13 +12,13 @@ public int findPaths(int m, int n, int maxMove, int startRow, int startColumn) {
       for (int i = 0; i < m; ++i)
         for (int j = 0; j < n; ++j)
           if (dp[i][j] > 0)
-            for (int[] dir : DIRS) {
+            for (int[] dir : dirs) {
               final int x = i + dir[0];
               final int y = j + dir[1];
               if (x < 0 || x == m || y < 0 || y == n)
-                ans = (ans + dp[i][j]) % MOD;
+                ans = (ans + dp[i][j]) % kMod;
               else
-                newDp[x][y] = (newDp[x][y] + dp[i][j]) % MOD;
+                newDp[x][y] = (newDp[x][y] + dp[i][j]) % kMod;
             }
       dp = newDp;
     }
diff --git a/solutions/576. Out of Boundary Paths/576-2.py b/solutions/576. Out of Boundary Paths/576-2.py
index f1aba33e90b..9af8d617b89 100644
--- a/solutions/576. Out of Boundary Paths/576-2.py	
+++ b/solutions/576. Out of Boundary Paths/576-2.py	
@@ -1,14 +1,7 @@
 class Solution:
-  def findPaths(
-      self,
-      m: int,
-      n: int,
-      maxMove: int,
-      startRow: int,
-      startColumn: int,
-  ) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
-    MOD = 1_000_000_007
+  def findPaths(self, m: int, n: int, maxMove: int, startRow: int, startColumn: int) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
+    kMod = 1_000_000_007
     ans = 0
     # dp[i][j] := the number of paths to move the ball (i, j) out-of-bounds
     dp = [[0] * n for _ in range(m)]
@@ -19,13 +12,13 @@ def findPaths(
       for i in range(m):
         for j in range(n):
           if dp[i][j] > 0:
-            for dx, dy in DIRS:
+            for dx, dy in dirs:
               x = i + dx
               y = j + dy
               if x < 0 or x == m or y < 0 or y == n:
-                ans = (ans + dp[i][j]) % MOD
+                ans = (ans + dp[i][j]) % kMod
               else:
-                newDp[x][y] = (newDp[x][y] + dp[i][j]) % MOD
+                newDp[x][y] = (newDp[x][y] + dp[i][j]) % kMod
       dp = newDp
 
     return ans
diff --git a/solutions/576. Out of Boundary Paths/576.java b/solutions/576. Out of Boundary Paths/576.java
index 48b8bfcd13f..115106a314a 100644
--- a/solutions/576. Out of Boundary Paths/576.java	
+++ b/solutions/576. Out of Boundary Paths/576.java	
@@ -4,7 +4,7 @@ public int findPaths(int m, int n, int maxMove, int startRow, int startColumn) {
     return findPaths(m, n, maxMove, startRow, startColumn, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of paths to move the ball at (i, j) out-of-bounds with k
   // moves.
@@ -19,6 +19,6 @@ private int findPaths(int m, int n, int k, int i, int j, Integer[][][] mem) {
                                   findPaths(m, n, k - 1, i - 1, j, mem) +
                                   findPaths(m, n, k - 1, i, j + 1, mem) +
                                   findPaths(m, n, k - 1, i, j - 1, mem)) %
-                                 MOD);
+                                 kMod);
   }
 }
diff --git a/solutions/576. Out of Boundary Paths/576.py b/solutions/576. Out of Boundary Paths/576.py
index 3edba844968..eae924daf2a 100644
--- a/solutions/576. Out of Boundary Paths/576.py	
+++ b/solutions/576. Out of Boundary Paths/576.py	
@@ -1,6 +1,6 @@
 class Solution:
   def findPaths(self, m, n, maxMove, startRow, startColumn):
-    MOD = 1000000007
+    kMod = 1000000007
 
     @functools.lru_cache(None)
     def dp(k: int, i: int, j: int) -> int:
@@ -13,6 +13,6 @@ def dp(k: int, i: int, j: int) -> int:
       if k == 0:
         return 0
       return (dp(k - 1, i + 1, j) + dp(k - 1, i - 1, j) +
-              dp(k - 1, i, j + 1) + dp(k - 1, i, j - 1)) % MOD
+              dp(k - 1, i, j + 1) + dp(k - 1, i, j - 1)) % kMod
 
     return dp(maxMove, startRow, startColumn)
diff --git a/solutions/581. Shortest Unsorted Continuous Subarray/581.py b/solutions/581. Shortest Unsorted Continuous Subarray/581.py
index a3d1857981d..74833549940 100644
--- a/solutions/581. Shortest Unsorted Continuous Subarray/581.py	
+++ b/solutions/581. Shortest Unsorted Continuous Subarray/581.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findUnsortedSubarray(self, nums: list[int]) -> int:
+  def findUnsortedSubarray(self, nums: List[int]) -> int:
     mn = math.inf
     mx = -math.inf
     flag = False
diff --git a/solutions/582. Kill Process/582.py b/solutions/582. Kill Process/582.py
index 5c3da75eac2..17cfaf64f99 100644
--- a/solutions/582. Kill Process/582.py	
+++ b/solutions/582. Kill Process/582.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def killProcess(
-      self,
-      pid: list[int],
-      ppid: list[int],
-      kill: int,
-  ) -> list[int]:
+  def killProcess(self, pid: List[int], ppid: List[int], kill: int) -> List[int]:
     ans = []
     tree = collections.defaultdict(list)
 
diff --git a/solutions/587. Erect the Fence/587.cpp b/solutions/587. Erect the Fence/587.cpp
index 4a845a0e50d..af3d451f51d 100644
--- a/solutions/587. Erect the Fence/587.cpp	
+++ b/solutions/587. Erect the Fence/587.cpp	
@@ -4,10 +4,8 @@ class Solution {
   vector<vector<int>> outerTrees(vector<vector<int>>& trees) {
     vector<vector<int>> hull;
 
-    ranges::sort(trees, ranges::less{}, [](const vector<int>& tree) {
-      const int x = tree[0];
-      const int y = tree[1];
-      return pair<int, int>{x, y};
+    ranges::sort(trees, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] == b[0] ? a[1] < b[1] : a[0] < b[0];
     });
 
     // Build the lower hull: left-to-right scan.
@@ -28,10 +26,8 @@ class Solution {
     }
 
     // Remove the redundant elements from the stack.
-    ranges::sort(hull, ranges::less{}, [](const vector<int>& tree) {
-      const int x = tree[0];
-      const int y = tree[1];
-      return pair<int, int>{y, x};
+    ranges::sort(hull, [](const vector<int>& a, const vector<int>& b) {
+      return a[0] == b[0] ? a[1] < b[1] : a[0] < b[0];
     });
     hull.erase(unique(hull.begin(), hull.end(),
                       [](const vector<int>& a, const vector<int>& b) {
diff --git a/solutions/587. Erect the Fence/587.java b/solutions/587. Erect the Fence/587.java
index e594bed63c5..d3dd51d4c8c 100644
--- a/solutions/587. Erect the Fence/587.java	
+++ b/solutions/587. Erect the Fence/587.java	
@@ -3,9 +3,7 @@ class Solution {
   public int[][] outerTrees(int[][] trees) {
     Stack<int[]> hull = new Stack<>();
 
-    Arrays.sort(
-        trees,
-        Comparator.comparingInt((int[] tree) -> tree[0]).thenComparingInt((int[] tree) -> tree[1]));
+    Arrays.sort(trees, (a, b) -> a[0] == b[0] ? a[1] - b[1] : a[0] - b[0]);
 
     // Build the lower hull: left-to-right scan.
     for (int[] tree : trees) {
diff --git a/solutions/587. Erect the Fence/587.py b/solutions/587. Erect the Fence/587.py
index eaeae39a418..b9fe6483cdf 100644
--- a/solutions/587. Erect the Fence/587.py	
+++ b/solutions/587. Erect the Fence/587.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def outerTrees(self, trees: list[list[int]]) -> list[list[int]]:
+  def outerTrees(self, trees: List[List[int]]) -> List[List[int]]:
     hull = []
 
     trees.sort(key=lambda x: (x[0], x[1]))
 
-    def cross(p: list[int], q: list[int], r: list[int]) -> int:
+    def cross(p: List[int], q: List[int], r: List[int]) -> int:
       return (q[1] - p[1]) * (r[0] - q[0]) - (q[0] - p[0]) * (r[1] - q[1])
 
     # Build the lower hull: left-to-right scan.
diff --git a/solutions/59. Spiral Matrix II/59.py b/solutions/59. Spiral Matrix II/59.py
index 5caf399cb70..f65f8d993dc 100644
--- a/solutions/59. Spiral Matrix II/59.py	
+++ b/solutions/59. Spiral Matrix II/59.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def generateMatrix(self, n: int) -> list[list[int]]:
+  def generateMatrix(self, n: int) -> List[List[int]]:
     ans = [[0] * n for _ in range(n)]
     count = 1
 
diff --git a/solutions/590. N-ary Tree Postorder Traversal/590.cpp b/solutions/590. N-ary Tree Postorder Traversal/590.cpp
index af776bcc61b..17a952cbd77 100644
--- a/solutions/590. N-ary Tree Postorder Traversal/590.cpp	
+++ b/solutions/590. N-ary Tree Postorder Traversal/590.cpp	
@@ -14,7 +14,7 @@ class Solution {
         stack.push(child);
     }
 
-    ranges::reverse(ans);
+    reverse(ans.begin(), ans.end());
     return ans;
   }
 };
diff --git a/solutions/591. Tag Validator/591.py b/solutions/591. Tag Validator/591.py
index fbfdf70dea3..ba239751b62 100644
--- a/solutions/591. Tag Validator/591.py	
+++ b/solutions/591. Tag Validator/591.py	
@@ -35,15 +35,11 @@ def isValidTagName(tagName: str, isEndTag: bool) -> bool:
             return False
         elif code[i + 1] == '/':  # the end tag
           closeIndex = code.find('>', i + 2)
-          if closeIndex == -1 or not isValidTagName(
-                  code[i + 2: closeIndex],
-                  True):
+          if closeIndex == -1 or not isValidTagName(code[i + 2:closeIndex], True):
             return False
         else:  # the start tag
           closeIndex = code.find('>', i + 1)
-          if closeIndex == -1 or not isValidTagName(
-                  code[i + 1: closeIndex],
-                  False):
+          if closeIndex == -1 or not isValidTagName(code[i + 1:closeIndex], False):
             return False
         i = closeIndex
       i += 1
diff --git a/solutions/593. Valid Square/593.py b/solutions/593. Valid Square/593.py
index 34a3733290d..4a3f07c7315 100644
--- a/solutions/593. Valid Square/593.py	
+++ b/solutions/593. Valid Square/593.py	
@@ -1,15 +1,9 @@
 class Solution:
-  def validSquare(
-      self,
-      p1: list[int],
-      p2: list[int],
-      p3: list[int],
-      p4: list[int],
-  ) -> bool:
-    def dist(p1: list[int], p2: list[int]) -> int:
+  def validSquare(self, p1: List[int], p2: List[int], p3: List[int], p4: List[int]) -> bool:
+    def dist(p1: List[int], p2: List[int]) -> int:
       return (p1[0] - p2[0])**2 + (p1[1] - p2[1])**2
 
     distSet = set([dist(*pair)
-                   for pair in list(
-                       itertools.combinations([p1, p2, p3, p4], 2))])
+                   for pair in list(itertools.combinations([p1, p2, p3, p4], 2))])
+
     return 0 not in distSet and len(distSet) == 2
diff --git a/solutions/594. Longest Harmonious Subsequence/594.py b/solutions/594. Longest Harmonious Subsequence/594.py
index 180c3fd2539..f81a608e6a6 100644
--- a/solutions/594. Longest Harmonious Subsequence/594.py	
+++ b/solutions/594. Longest Harmonious Subsequence/594.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLHS(self, nums: list[int]) -> int:
+  def findLHS(self, nums: List[int]) -> int:
     ans = 0
     count = collections.Counter(nums)
 
diff --git a/solutions/598. Range Addition II/598.py b/solutions/598. Range Addition II/598.py
index 034c4422453..01d257d55bd 100644
--- a/solutions/598. Range Addition II/598.py	
+++ b/solutions/598. Range Addition II/598.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxCount(self, m: int, n: int, ops: list[list[int]]) -> int:
+  def maxCount(self, m: int, n: int, ops: List[List[int]]) -> int:
     minY = m
     minX = n
 
diff --git a/solutions/599. Minimum Index Sum of Two Lists/599.py b/solutions/599. Minimum Index Sum of Two Lists/599.py
index 68a83540e84..d2758dcc870 100644
--- a/solutions/599. Minimum Index Sum of Two Lists/599.py	
+++ b/solutions/599. Minimum Index Sum of Two Lists/599.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findRestaurant(self, list1: list[str], list2: list[str]) -> list[str]:
+  def findRestaurant(self, list1: List[str], list2: List[str]) -> List[str]:
     ans = []
     restaurantToIndex = {restaurant: i for i,
                          restaurant in enumerate(list1)}
diff --git a/solutions/604. Design Compressed String Iterator/604-2.cpp b/solutions/604. Design Compressed String Iterator/604-2.cpp
index 49916c008c0..1f9083628b0 100644
--- a/solutions/604. Design Compressed String Iterator/604-2.cpp	
+++ b/solutions/604. Design Compressed String Iterator/604-2.cpp	
@@ -14,6 +14,7 @@ class StringIterator {
   char next() {
     if (!hasNext())
       return ' ';
+
     const char c = q.front().first;
     if (--q.front().second == 0)
       q.pop();
diff --git a/solutions/604. Design Compressed String Iterator/604-2.java b/solutions/604. Design Compressed String Iterator/604-2.java
index ef04d40d73e..884d465bd08 100644
--- a/solutions/604. Design Compressed String Iterator/604-2.java	
+++ b/solutions/604. Design Compressed String Iterator/604-2.java	
@@ -13,6 +13,7 @@ public StringIterator(String compressedString) {
   public char next() {
     if (!hasNext())
       return ' ';
+
     final char c = q.peek().getKey();
     final int num = q.poll().getValue();
     if (num > 1)
diff --git a/solutions/604. Design Compressed String Iterator/604-2.py b/solutions/604. Design Compressed String Iterator/604-2.py
index 23d1b3354c1..39e3a35fd1c 100644
--- a/solutions/604. Design Compressed String Iterator/604-2.py	
+++ b/solutions/604. Design Compressed String Iterator/604-2.py	
@@ -8,13 +8,14 @@ def __init__(self, compressedString: str):
       i += 1
       num = 0
       while i < len(compressedString) and compressedString[i].isdigit():
-        num = num * 10 + int(compressedString[i])
+        num = num * 10 + (ord(compressedString[i]) - ord('0'))
         i += 1
       self.q.append((c, num))
 
   def next(self) -> str:
     if not self.hasNext():
       return ' '
+
     c, num = self.q.popleft()
     if num > 1:
       self.q.appendleft((c, num - 1))
diff --git a/solutions/604. Design Compressed String Iterator/604.py b/solutions/604. Design Compressed String Iterator/604.py
index 1f0b08f9b63..340eb44aee5 100644
--- a/solutions/604. Design Compressed String Iterator/604.py	
+++ b/solutions/604. Design Compressed String Iterator/604.py	
@@ -13,7 +13,7 @@ def next(self) -> str:
       self.currentChar = self.s[self.i]
       self.i += 1
       while self.i < len(self.s) and self.s[self.i].isdigit():
-        self.num = self.num * 10 + int(self.s[self.i])
+        self.num = self.num * 10 + (ord(self.s[self.i]) - ord('0'))
         self.i += 1
 
     self.num -= 1
diff --git a/solutions/605. Can Place Flowers/605.py b/solutions/605. Can Place Flowers/605.py
index 83b3eb703c9..23c2f3b1375 100644
--- a/solutions/605. Can Place Flowers/605.py	
+++ b/solutions/605. Can Place Flowers/605.py	
@@ -1,9 +1,7 @@
 class Solution:
-  def canPlaceFlowers(self, flowerbed: list[int], n: int) -> bool:
+  def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool:
     for i, flower in enumerate(flowerbed):
-      if flower == 0 and (
-              i == 0 or flowerbed[i - 1] == 0) and (
-              i == len(flowerbed) - 1 or flowerbed[i + 1] == 0):
+      if flower == 0 and (i == 0 or flowerbed[i - 1] == 0) and (i == len(flowerbed) - 1 or flowerbed[i + 1] == 0):
         flowerbed[i] = 1
         n -= 1
       if n <= 0:
diff --git a/solutions/606. Construct String from Binary Tree/606.py b/solutions/606. Construct String from Binary Tree/606.py
index 3edca465a21..ee9b0401003 100644
--- a/solutions/606. Construct String from Binary Tree/606.py	
+++ b/solutions/606. Construct String from Binary Tree/606.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def tree2str(self, t: TreeNode | None) -> str:
-    def dfs(root: TreeNode | None) -> str:
+  def tree2str(self, t: Optional[TreeNode]) -> str:
+    def dfs(root: Optional[TreeNode]) -> str:
       if not root:
         return ''
       if root.right:
diff --git a/solutions/609. Find Duplicate File in System/609.py b/solutions/609. Find Duplicate File in System/609.py
index c3aaccb002d..d55cae01c05 100644
--- a/solutions/609. Find Duplicate File in System/609.py	
+++ b/solutions/609. Find Duplicate File in System/609.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findDuplicate(self, paths: list[str]) -> list[list[str]]:
+  def findDuplicate(self, paths: List[str]) -> List[List[str]]:
     contentToPathFiles = collections.defaultdict(list)
 
     for path in paths:
diff --git a/solutions/611. Valid Triangle Number/611.py b/solutions/611. Valid Triangle Number/611.py
index ac8b63df9a1..6ee4f8bdde0 100644
--- a/solutions/611. Valid Triangle Number/611.py	
+++ b/solutions/611. Valid Triangle Number/611.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def triangleNumber(self, nums: list[int]) -> int:
+  def triangleNumber(self, nums: List[int]) -> int:
     ans = 0
 
     nums.sort()
diff --git a/solutions/616. Add Bold Tag in String/616-2.py b/solutions/616. Add Bold Tag in String/616-2.py
index ca7dff7df76..0e011f98476 100644
--- a/solutions/616. Add Bold Tag in String/616-2.py	
+++ b/solutions/616. Add Bold Tag in String/616-2.py	
@@ -1,11 +1,11 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
     self.isWord = False
 
 
 class Solution:
-  def addBoldTag(self, s: str, words: list[str]) -> str:
+  def addBoldTag(self, s: str, words: List[str]) -> str:
     n = len(s)
     ans = []
     # bold[i] := True if s[i] should be bolded
diff --git a/solutions/616. Add Bold Tag in String/616.py b/solutions/616. Add Bold Tag in String/616.py
index 9ceb4500bab..1dd6baa2bfe 100644
--- a/solutions/616. Add Bold Tag in String/616.py	
+++ b/solutions/616. Add Bold Tag in String/616.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def addBoldTag(self, s: str, words: list[str]) -> str:
+  def addBoldTag(self, s: str, words: List[str]) -> str:
     n = len(s)
     ans = []
     # bold[i] := True if s[i] should be bolded
diff --git a/solutions/617. Merge Two Binary Trees/617.py b/solutions/617. Merge Two Binary Trees/617.py
index fcfa073aa66..998c208a4d1 100644
--- a/solutions/617. Merge Two Binary Trees/617.py	
+++ b/solutions/617. Merge Two Binary Trees/617.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def mergeTrees(
-      self,
-      root1: TreeNode | None,
-      root2: TreeNode | None,
-  ) -> TreeNode | None:
+  def mergeTrees(self, root1: Optional[TreeNode], root2: Optional[TreeNode]) -> Optional[TreeNode]:
     if not root1 and not root2:
       return None
     val = (root1.val if root1 else 0) + (root2.val if root2 else 0)
diff --git a/solutions/621. Task Scheduler/621.py b/solutions/621. Task Scheduler/621.py
index 5b615919c81..5eeb5476279 100644
--- a/solutions/621. Task Scheduler/621.py	
+++ b/solutions/621. Task Scheduler/621.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def leastInterval(self, tasks: list[str], n: int) -> int:
+  def leastInterval(self, tasks: List[str], n: int) -> int:
     count = collections.Counter(tasks)
     maxFreq = max(count.values())
     # Put the most frequent task in the slot first.
diff --git a/solutions/623. Add One Row to Tree/623.java b/solutions/623. Add One Row to Tree/623.java
index 30b5bec6694..900c276adc3 100644
--- a/solutions/623. Add One Row to Tree/623.java	
+++ b/solutions/623. Add One Row to Tree/623.java	
@@ -7,7 +7,7 @@ public TreeNode addOneRow(TreeNode root, int v, int d) {
     }
 
     int depth = 0;
-    Queue<TreeNode> q = new ArrayDeque<>(List.of(root));
+    Queue<TreeNode> q = new ArrayDeque<>(Arrays.asList(root));
 
     while (!q.isEmpty()) {
       ++depth;
diff --git a/solutions/624. Maximum Distance in Arrays/624-2.py b/solutions/624. Maximum Distance in Arrays/624-2.py
index 870f215f4b5..1d4eece5f42 100644
--- a/solutions/624. Maximum Distance in Arrays/624-2.py	
+++ b/solutions/624. Maximum Distance in Arrays/624-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxDistance(self, arrays: list[list[int]]) -> int:
+  def maxDistance(self, arrays: List[List[int]]) -> int:
     min1, index_min1 = min((A[0], i) for i, A in enumerate(arrays))
     max1, index_max1 = max((A[-1], i) for i, A in enumerate(arrays))
     if index_min1 != index_max1:
diff --git a/solutions/624. Maximum Distance in Arrays/624.py b/solutions/624. Maximum Distance in Arrays/624.py
index 6bbd6570c59..edefe74554c 100644
--- a/solutions/624. Maximum Distance in Arrays/624.py	
+++ b/solutions/624. Maximum Distance in Arrays/624.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxDistance(self, arrays: list[list[int]]) -> int:
+  def maxDistance(self, arrays: List[List[int]]) -> int:
     ans = 0
     mn = 10000
     mx = -10000
diff --git a/solutions/628. Maximum Product of Three Numbers/628-2.py b/solutions/628. Maximum Product of Three Numbers/628-2.py
index 7fc1620e949..fac6a711772 100644
--- a/solutions/628. Maximum Product of Three Numbers/628-2.py	
+++ b/solutions/628. Maximum Product of Three Numbers/628-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumProduct(self, nums: list[int]) -> int:
+  def maximumProduct(self, nums: List[int]) -> int:
     min1 = inf   # the minimum
     min2 = inf   # the second minimum
     max1 = -inf  # the maximum
diff --git a/solutions/628. Maximum Product of Three Numbers/628.py b/solutions/628. Maximum Product of Three Numbers/628.py
index 41b8f1cbb77..8cce9d8fa48 100644
--- a/solutions/628. Maximum Product of Three Numbers/628.py	
+++ b/solutions/628. Maximum Product of Three Numbers/628.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maximumProduct(self, nums: list[int]) -> int:
+  def maximumProduct(self, nums: List[int]) -> int:
     nums.sort()
     return max(nums[-1] * nums[0] * nums[1],
                nums[-1] * nums[-2] * nums[-3])
diff --git a/solutions/629. K Inverse Pairs Array/629.java b/solutions/629. K Inverse Pairs Array/629.java
index 7f82ec44bfa..f0e6fafd6f6 100644
--- a/solutions/629. K Inverse Pairs Array/629.java	
+++ b/solutions/629. K Inverse Pairs Array/629.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int kInversePairs(int n, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i][j] := the number of permutations of numbers 1..i with j inverse pairs
     int[][] dp = new int[n + 1][k + 1];
 
@@ -10,9 +10,9 @@ public int kInversePairs(int n, int k) {
 
     for (int i = 1; i <= n; ++i)
       for (int j = 1; j <= k; ++j) {
-        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % MOD;
+        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % kMod;
         if (j - i >= 0)
-          dp[i][j] = (dp[i][j] - dp[i - 1][j - i] + MOD) % MOD;
+          dp[i][j] = (dp[i][j] - dp[i - 1][j - i] + kMod) % kMod;
       }
 
     return dp[n][k];
diff --git a/solutions/629. K Inverse Pairs Array/629.py b/solutions/629. K Inverse Pairs Array/629.py
index d24a8edc36c..a7bd7ba5017 100644
--- a/solutions/629. K Inverse Pairs Array/629.py	
+++ b/solutions/629. K Inverse Pairs Array/629.py	
@@ -1,6 +1,6 @@
 class Solution:
   def kInversePairs(self, n: int, k: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # dp[i][j] := the number of permutations of numbers 1..i with j inverse pairs
     dp = [[0] * (k + 1) for _ in range(n + 1)]
 
@@ -10,8 +10,8 @@ def kInversePairs(self, n: int, k: int) -> int:
 
     for i in range(1, n + 1):
       for j in range(1, k + 1):
-        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % MOD
+        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % kMod
         if j - i >= 0:
-          dp[i][j] = (dp[i][j] - dp[i - 1][j - i] + MOD) % MOD
+          dp[i][j] = (dp[i][j] - dp[i - 1][j - i] + kMod) % kMod
 
     return dp[n][k]
diff --git a/solutions/63. Unique Paths II/63-2.py b/solutions/63. Unique Paths II/63-2.py
index bf6e986b1e8..7ad58c5023d 100644
--- a/solutions/63. Unique Paths II/63-2.py	
+++ b/solutions/63. Unique Paths II/63-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def uniquePathsWithObstacles(self, obstacleGrid: list[list[int]]) -> int:
+  def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:
     m = len(obstacleGrid)
     n = len(obstacleGrid[0])
     dp = [0] * n
diff --git a/solutions/63. Unique Paths II/63.py b/solutions/63. Unique Paths II/63.py
index 573915070ba..ee4d310623f 100644
--- a/solutions/63. Unique Paths II/63.py	
+++ b/solutions/63. Unique Paths II/63.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def uniquePathsWithObstacles(self, obstacleGrid: list[list[int]]) -> int:
+  def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:
     m = len(obstacleGrid)
     n = len(obstacleGrid[0])
     # dp[i][j] := the number of unique paths from (0, 0) to (i, j)
diff --git a/solutions/630. Course Schedule III/630.cpp b/solutions/630. Course Schedule III/630.cpp
index 7bfd5c00da7..815065b0342 100644
--- a/solutions/630. Course Schedule III/630.cpp	
+++ b/solutions/630. Course Schedule III/630.cpp	
@@ -4,8 +4,8 @@ class Solution {
     int time = 0;
     priority_queue<int> maxHeap;
 
-    ranges::sort(courses, ranges::less{},
-                 [](const vector<int>& course) { return course[1]; });
+    ranges::sort(courses,
+                 [](const auto& a, const auto& b) { return a[1] < b[1]; });
 
     for (const vector<int>& course : courses) {
       const int duration = course[0];
diff --git a/solutions/630. Course Schedule III/630.java b/solutions/630. Course Schedule III/630.java
index f5c6cfe1c20..a1106b43c21 100644
--- a/solutions/630. Course Schedule III/630.java	
+++ b/solutions/630. Course Schedule III/630.java	
@@ -3,7 +3,7 @@ public int scheduleCourse(int[][] courses) {
     int time = 0;
     Queue<Integer> maxHeap = new PriorityQueue<>(Collections.reverseOrder());
 
-    Arrays.sort(courses, Comparator.comparingInt(course -> course[1]));
+    Arrays.sort(courses, (a, b) -> (a[1] - b[1]));
 
     for (int[] course : courses) {
       final int duration = course[0];
diff --git a/solutions/630. Course Schedule III/630.py b/solutions/630. Course Schedule III/630.py
index 4508534e6c9..0cedd413cc4 100644
--- a/solutions/630. Course Schedule III/630.py	
+++ b/solutions/630. Course Schedule III/630.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def scheduleCourse(self, courses: list[list[int]]) -> int:
+  def scheduleCourse(self, courses: List[List[int]]) -> int:
     time = 0
     maxHeap = []
 
diff --git a/solutions/631. Design Excel Sum Formula/631.py b/solutions/631. Design Excel Sum Formula/631.py
index 6d3d98d3686..73f701ef413 100644
--- a/solutions/631. Design Excel Sum Formula/631.py	
+++ b/solutions/631. Design Excel Sum Formula/631.py	
@@ -1,50 +1,32 @@
-from dataclasses import dataclass
-
-
-@dataclass
 class Cell:
-  val: int = 0
-  posCount: dict[tuple[int, int], int] | None = None
+  def __init__(self, val: int, posCount: Optional[Dict[Tuple[int, int], int]]):
+    self.val = val
+    self.posCount = posCount  # {pos, count}
 
 
 class Excel:
   def __init__(self, height: int, width: str):
-    self.width = ord(width) - ord('A') + 1
-    self.sheet = [[Cell() for _ in range(self.width)] for _ in range(height)]
+    self.sheet = [[Cell(0, None) for i in range(height)]
+                  for _ in range(ord(width) - ord('A') + 1)]
 
   def set(self, row: int, column: str, val: int) -> None:
-    self._getCell(row, column).val = val
-    self._getCell(row, column).posCount = {}
+    self.sheet[row - 1][ord(column) - ord('A')] = Cell(val, None)
 
   def get(self, row: int, column: str) -> int:
-    cell = self._getCell(row, column)
-    if not cell.posCount:
-      return cell.val
-    val = 0
-    for pos, count in cell.posCount.items():
-      val += self.get(pos // self.width + 1, chr(pos %
-                      self.width + ord('A'))) * count
-    return val
+    cell = self.sheet[row - 1][ord(column) - ord('A')]
+    if cell.posCount:
+      return sum(self.get(*pos) * freq for pos, freq in cell.posCount.items())
+    return cell.val
 
-  def sum(self, row: int, column: str, numbers: list[str]) -> int:
-    self._getCell(row, column).posCount = self._parse(numbers)
+  def sum(self, row: int, column: str, numbers: List[str]) -> int:
+    self.sheet[row - 1][ord(column) - ord('A')].posCount = self._parse(numbers)
     return self.get(row, column)
 
-  def _getCell(self, row: int, column: str) -> Cell:
-    return self.sheet[row - 1][ord(column) - ord('A')]
-
-  def _parse(self, numbers: list[str]) -> dict[int, int]:
-    count: dict[int, int] = {}
-    for s in numbers:
-      startRow, startCol, endRow, endCol = self._parseRange(s)
-      for i in range(startRow - 1, endRow):
-        for j in range(ord(startCol) - ord('A'), ord(endCol) - ord('A') + 1):
-          pos = i * self.width + j
-          count[pos] = count.get(pos, 0) + 1
+  def _parse(self, numbers: List[str]):
+    count = collections.Counter()
+    for n in numbers:
+      s, e = n.split(':')[0], n.split(':')[1] if ':' in n else n
+      for i in range(int(s[1:]), int(e[1:]) + 1):
+        for j in range(ord(s[0]) - ord('A'), ord(e[0]) - ord('A') + 1):
+          count[(i, chr(j + ord('A')))] += 1
     return count
-
-  def _parseRange(self, s: str) -> tuple[int, str, int, str]:
-    if ':' not in s:
-      return int(s[1:]), s[0], int(s[1:]), s[0]
-    l, r = s.split(':')
-    return int(l[1:]), l[0], int(r[1:]), r[0]
diff --git a/solutions/632. Smallest Range Covering Elements from K Lists/632.cpp b/solutions/632. Smallest Range Covering Elements from K Lists/632.cpp
index 306cf5ab678..6b86f66fd14 100644
--- a/solutions/632. Smallest Range Covering Elements from K Lists/632.cpp	
+++ b/solutions/632. Smallest Range Covering Elements from K Lists/632.cpp	
@@ -2,6 +2,7 @@ struct T {
   int i;
   int j;
   int num;  // nums[i][j]
+  T(int i, int j, int num) : i(i), j(j), num(num) {}
 };
 
 class Solution {
diff --git a/solutions/632. Smallest Range Covering Elements from K Lists/632.java b/solutions/632. Smallest Range Covering Elements from K Lists/632.java
index 8c2f5dd56b8..d6204ca3c36 100644
--- a/solutions/632. Smallest Range Covering Elements from K Lists/632.java	
+++ b/solutions/632. Smallest Range Covering Elements from K Lists/632.java	
@@ -1,7 +1,17 @@
+class T {
+  public int i;
+  public int j;
+  public int num; // nums[i][j]
+  public T(int i, int j, int num) {
+    this.i = i;
+    this.j = j;
+    this.num = num;
+  }
+}
+
 class Solution {
   public int[] smallestRange(List<List<Integer>> nums) {
-    record T(int i, int j, int num) {} // num := nums[i][j]
-    Queue<T> minHeap = new PriorityQueue<>(Comparator.comparingInt(T::num));
+    Queue<T> minHeap = new PriorityQueue<>((a, b) -> a.num - b.num);
     int mn = Integer.MAX_VALUE;
     int mx = Integer.MIN_VALUE;
 
diff --git a/solutions/632. Smallest Range Covering Elements from K Lists/632.py b/solutions/632. Smallest Range Covering Elements from K Lists/632.py
index 3465b2533a8..21b59cf1f9b 100644
--- a/solutions/632. Smallest Range Covering Elements from K Lists/632.py	
+++ b/solutions/632. Smallest Range Covering Elements from K Lists/632.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def smallestRange(self, nums: list[list[int]]) -> list[int]:
+  def smallestRange(self, nums: List[List[int]]) -> List[int]:
     minHeap = [(row[0], i, 0) for i, row in enumerate(nums)]
     heapq.heapify(minHeap)
 
diff --git a/solutions/634. Find the Derangement of An Array/634-2.java b/solutions/634. Find the Derangement of An Array/634-2.java
index b19a5fec558..d0786627c77 100644
--- a/solutions/634. Find the Derangement of An Array/634-2.java	
+++ b/solutions/634. Find the Derangement of An Array/634-2.java	
@@ -1,12 +1,12 @@
 class Solution {
   public int findDerangement(int n) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int[] dp = new int[n + 1];
 
     dp[0] = 1;
 
     for (int i = 2; i <= n; ++i)
-      dp[i] = (int) ((i - 1L) * (dp[i - 1] + dp[i - 2]) % MOD);
+      dp[i] = (int) ((i - 1L) * (dp[i - 1] + dp[i - 2]) % kMod);
 
     return dp[n];
   }
diff --git a/solutions/634. Find the Derangement of An Array/634-2.py b/solutions/634. Find the Derangement of An Array/634-2.py
index c8d1dcda366..1321c09e2d5 100644
--- a/solutions/634. Find the Derangement of An Array/634-2.py	
+++ b/solutions/634. Find the Derangement of An Array/634-2.py	
@@ -1,9 +1,9 @@
 class Solution:
   def findDerangement(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     dp = [1] + [0] * n
 
     for i in range(2, n + 1):
-      dp[i] = (i - 1) * (dp[i - 1] + dp[i - 2]) % MOD
+      dp[i] = (i - 1) * (dp[i - 1] + dp[i - 2]) % kMod
 
     return dp[n]
diff --git a/solutions/634. Find the Derangement of An Array/634.java b/solutions/634. Find the Derangement of An Array/634.java
index a00ebfa4a1a..a532ca6f93b 100644
--- a/solutions/634. Find the Derangement of An Array/634.java	
+++ b/solutions/634. Find the Derangement of An Array/634.java	
@@ -4,7 +4,7 @@ public int findDerangement(int n) {
     return findDerangement(n, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   private int findDerangement(int i, int[] mem) {
     if (i == 0)
@@ -16,6 +16,6 @@ private int findDerangement(int i, int[] mem) {
     return mem[i] = (int) ((i - 1L) *
                            (findDerangement(i - 1, mem) + //
                             findDerangement(i - 2, mem)) %
-                           MOD);
+                           kMod);
   }
 }
diff --git a/solutions/634. Find the Derangement of An Array/634.py b/solutions/634. Find the Derangement of An Array/634.py
index 5bf75fcae84..74bba485527 100644
--- a/solutions/634. Find the Derangement of An Array/634.py	
+++ b/solutions/634. Find the Derangement of An Array/634.py	
@@ -1,6 +1,6 @@
 class Solution:
   def findDerangement(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
 
     @functools.lru_cache(None)
     def dp(i: int) -> int:
@@ -8,6 +8,6 @@ def dp(i: int) -> int:
         return 1
       if i == 1:
         return 0
-      return (i - 1) * (dp(i - 1) + dp(i - 2)) % MOD
+      return (i - 1) * (dp(i - 1) + dp(i - 2)) % kMod
 
     return dp(n)
diff --git a/solutions/635. Design Log Storage System/635.py b/solutions/635. Design Log Storage System/635.py
index d954bd0f642..fe218daeb4b 100644
--- a/solutions/635. Design Log Storage System/635.py	
+++ b/solutions/635. Design Log Storage System/635.py	
@@ -7,7 +7,7 @@ def __init__(self):
   def put(self, id: int, timestamp: str) -> None:
     self.idAndTimestamps.append((id, timestamp))
 
-  def retrieve(self, start: str, end: str, granularity: str) -> list[int]:
+  def retrieve(self, start: str, end: str, granularity: str) -> List[int]:
     index = self.granularityToIndices[granularity]
     s = start[:index]
     e = end[:index]
diff --git a/solutions/637. Average of Levels in Binary Tree/637.java b/solutions/637. Average of Levels in Binary Tree/637.java
index 6574754e7ed..f7b0a265f5d 100644
--- a/solutions/637. Average of Levels in Binary Tree/637.java	
+++ b/solutions/637. Average of Levels in Binary Tree/637.java	
@@ -1,7 +1,7 @@
 class Solution {
   public List<Double> averageOfLevels(TreeNode root) {
     List<Double> ans = new ArrayList<>();
-    Queue<TreeNode> q = new ArrayDeque<>(List.of(root));
+    Queue<TreeNode> q = new ArrayDeque<>(Arrays.asList(root));
 
     while (!q.isEmpty()) {
       long sum = 0;
diff --git a/solutions/638. Shopping Offers/638.py b/solutions/638. Shopping Offers/638.py
index 570036fc8b0..ef1b56ba414 100644
--- a/solutions/638. Shopping Offers/638.py	
+++ b/solutions/638. Shopping Offers/638.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def shoppingOffers(
-      self,
-      price: list[int],
-      special: list[list[int]],
-      needs: list[int]
-  ) -> int:
+  def shoppingOffers(self, price: List[int], special: List[List[int]], needs: List[int]) -> int:
     def dfs(s: int) -> int:
       ans = 0
       for i, need in enumerate(needs):
diff --git a/solutions/639. Decode Ways II/639-2.java b/solutions/639. Decode Ways II/639-2.java
index 1e1b0122ad5..32f2f5b19f0 100644
--- a/solutions/639. Decode Ways II/639-2.java	
+++ b/solutions/639. Decode Ways II/639-2.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int numDecodings(String s) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = s.length();
     long prev2 = 1;
     long prev1 = count(s.charAt(n - 1));
 
     for (int i = n - 2; i >= 0; --i) {
       long dp = count(s.charAt(i), s.charAt(i + 1)) * prev2 + count(s.charAt(i)) * prev1;
-      dp %= MOD;
+      dp %= kMod;
       prev2 = prev1;
       prev1 = dp;
     }
diff --git a/solutions/639. Decode Ways II/639.java b/solutions/639. Decode Ways II/639.java
index 8a1ede5c9de..2f226082261 100644
--- a/solutions/639. Decode Ways II/639.java	
+++ b/solutions/639. Decode Ways II/639.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numDecodings(String s) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = s.length();
     // dp[i] := the number of ways to decode s[i..n - 1]
     long[] dp = new long[n + 1];
@@ -10,7 +10,7 @@ public int numDecodings(String s) {
     for (int i = n - 2; i >= 0; --i) {
       dp[i] += count(s.charAt(i), s.charAt(i + 1)) * dp[i + 2];
       dp[i] += count(s.charAt(i)) * dp[i + 1];
-      dp[i] %= MOD;
+      dp[i] %= kMod;
     }
 
     return (int) dp[0];
diff --git a/solutions/64. Minimum Path Sum/64.py b/solutions/64. Minimum Path Sum/64.py
index c5a3db36606..ad9e5119167 100644
--- a/solutions/64. Minimum Path Sum/64.py	
+++ b/solutions/64. Minimum Path Sum/64.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minPathSum(self, grid: list[list[int]]) -> int:
+  def minPathSum(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
 
diff --git a/solutions/640. Solve the Equation/640.py b/solutions/640. Solve the Equation/640.py
index 9a25a961caa..72b59d4264e 100644
--- a/solutions/640. Solve the Equation/640.py	
+++ b/solutions/640. Solve the Equation/640.py	
@@ -8,7 +8,7 @@ def calculate(s: str) -> tuple:
 
       for i, c in enumerate(s):
         if c.isdigit():
-          num = num * 10 + int(c)
+          num = num * 10 + ord(c) - ord('0')
         elif c in '+-':
           constant += sign * num
           sign = 1 if c == '+' else -1
diff --git a/solutions/642. Design Search Autocomplete System/642.py b/solutions/642. Design Search Autocomplete System/642.py
index a10a9f581a1..ccf4819f698 100644
--- a/solutions/642. Design Search Autocomplete System/642.py	
+++ b/solutions/642. Design Search Autocomplete System/642.py	
@@ -1,9 +1,9 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
-    self.s: str | None = None
+    self.children: Dict[str, TrieNode] = {}
+    self.s: Optional[str] = None
     self.time = 0
-    self.top3: list[TrieNode] = []
+    self.top3: List[TrieNode] = []
 
   def __lt__(self, other):
     if self.time == other.time:
@@ -19,15 +19,15 @@ def update(self, node) -> None:
 
 
 class AutocompleteSystem:
-  def __init__(self, sentences: list[str], times: list[int]):
+  def __init__(self, sentences: List[str], times: List[int]):
     self.root = TrieNode()
     self.curr = self.root
-    self.s: list[str] = []
+    self.s: List[chr] = []
 
     for sentence, time in zip(sentences, times):
       self._insert(sentence, time)
 
-  def input(self, c: str) -> list[str]:
+  def input(self, c: str) -> List[str]:
     if c == '#':
       self._insert(''.join(self.s), 1)
       self.curr = self.root
diff --git a/solutions/643. Maximum Average Subarray I/643.py b/solutions/643. Maximum Average Subarray I/643.py
index c70ffe158e3..c4887be900d 100644
--- a/solutions/643. Maximum Average Subarray I/643.py	
+++ b/solutions/643. Maximum Average Subarray I/643.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findMaxAverage(self, nums: list[int], k: int) -> float:
+  def findMaxAverage(self, nums: List[int], k: int) -> float:
     summ = sum(nums[:k])
     ans = summ
 
diff --git a/solutions/644. Maximum Average Subarray II/644.java b/solutions/644. Maximum Average Subarray II/644.java
index de08f26f947..d2e0129928e 100644
--- a/solutions/644. Maximum Average Subarray II/644.java	
+++ b/solutions/644. Maximum Average Subarray II/644.java	
@@ -1,10 +1,10 @@
 class Solution {
   public double findMaxAverage(int[] nums, int k) {
-    final double ERR = 1e-5;
+    final double kErr = 1e-5;
     double l = (double) Arrays.stream(nums).min().getAsInt();
     double r = (double) Arrays.stream(nums).max().getAsInt();
 
-    while (r - l > ERR) {
+    while (r - l > kErr) {
       final double m = (l + r) / 2;
       if (check(nums, k, m))
         l = m;
diff --git a/solutions/644. Maximum Average Subarray II/644.py b/solutions/644. Maximum Average Subarray II/644.py
index b737b1262d9..78f9ebdcfce 100644
--- a/solutions/644. Maximum Average Subarray II/644.py	
+++ b/solutions/644. Maximum Average Subarray II/644.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def findMaxAverage(self, nums: list[int], k: int) -> float:
-    ERR = 1e-5
+  def findMaxAverage(self, nums: List[int], k: int) -> float:
+    kErr = 1e-5
     l = min(nums)
     r = max(nums)
 
@@ -25,7 +25,7 @@ def check(m: float) -> bool:
 
       return False
 
-    while r - l > ERR:
+    while r - l > kErr:
       m = (l + r) / 2
       if check(m):
         l = m
diff --git a/solutions/645. Set Mismatch/645.py b/solutions/645. Set Mismatch/645.py
index b4cbcb9daeb..a0fcb52c35a 100644
--- a/solutions/645. Set Mismatch/645.py	
+++ b/solutions/645. Set Mismatch/645.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findErrorNums(self, nums: list[int]) -> list[int]:
+  def findErrorNums(self, nums: List[int]) -> List[int]:
     for num in nums:
       if nums[abs(num) - 1] < 0:
         duplicate = abs(num)
diff --git a/solutions/646. Maximum Length of Pair Chain/646.java b/solutions/646. Maximum Length of Pair Chain/646.java
index 01cc7fe8572..672d4af8583 100644
--- a/solutions/646. Maximum Length of Pair Chain/646.java	
+++ b/solutions/646. Maximum Length of Pair Chain/646.java	
@@ -5,7 +5,7 @@ public int findLongestChain(int[][] pairs) {
     int ans = 0;
     int prevEnd = Integer.MIN_VALUE;
 
-    Arrays.sort(pairs, Comparator.comparingInt(pair -> pair[1]));
+    Arrays.sort(pairs, (a, b) -> a[1] - b[1]);
 
     for (int[] pair : pairs)
       if (pair[0] > prevEnd) {
diff --git a/solutions/646. Maximum Length of Pair Chain/646.py b/solutions/646. Maximum Length of Pair Chain/646.py
index db6e695f3b5..f23eba8de29 100644
--- a/solutions/646. Maximum Length of Pair Chain/646.py	
+++ b/solutions/646. Maximum Length of Pair Chain/646.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLongestChain(self, pairs: list[list[int]]) -> int:
+  def findLongestChain(self, pairs: List[List[int]]) -> int:
     ans = 0
     prevEnd = -math.inf
 
diff --git a/solutions/648. Replace Words/648.py b/solutions/648. Replace Words/648.py
index 690377b7f9a..c361a2fe4dd 100644
--- a/solutions/648. Replace Words/648.py	
+++ b/solutions/648. Replace Words/648.py	
@@ -20,7 +20,7 @@ def search(self, word: str) -> str:
       node = node[c]
     return word
 
-  def replaceWords(self, dictionary: list[str], sentence: str) -> str:
+  def replaceWords(self, dictionary: List[str], sentence: str) -> str:
     for word in dictionary:
       self.insert(word)
 
diff --git a/solutions/652. Find Duplicate Subtrees/652.py b/solutions/652. Find Duplicate Subtrees/652.py
index 98277764e2c..e727e15e5fa 100644
--- a/solutions/652. Find Duplicate Subtrees/652.py	
+++ b/solutions/652. Find Duplicate Subtrees/652.py	
@@ -1,15 +1,15 @@
 class Solution:
-  def findDuplicateSubtrees(self, root: TreeNode | None) -> list[TreeNode | None]:
+  def findDuplicateSubtrees(self, root: Optional[TreeNode]) -> List[Optional[TreeNode]]:
     ans = []
     count = collections.Counter()
 
-    def encode(root: TreeNode | None) -> str:
+    def encode(root: Optional[TreeNode]) -> str:
       if not root:
         return ''
 
-      encoded = (str(root.val) + '#' +
-                 encode(root.left) + '#' +
-                 encode(root.right))
+      encoded = str(root.val) + '#' + \
+          encode(root.left) + '#' + \
+          encode(root.right)
       count[encoded] += 1
       if count[encoded] == 2:
         ans.append(root)
diff --git a/solutions/653. Two Sum IV - Input is a BST/653.py b/solutions/653. Two Sum IV - Input is a BST/653.py
index da2a62e69c8..bb18e2ec0ab 100644
--- a/solutions/653. Two Sum IV - Input is a BST/653.py	
+++ b/solutions/653. Two Sum IV - Input is a BST/653.py	
@@ -1,5 +1,5 @@
 class BSTIterator:
-  def __init__(self, root: TreeNode | None, leftToRight: bool):
+  def __init__(self, root: Optional[TreeNode], leftToRight: bool):
     self.stack = []
     self.leftToRight = leftToRight
     self._pushUntilNone(root)
@@ -12,14 +12,14 @@ def next(self) -> int:
       self._pushUntilNone(node.left)
     return node.val
 
-  def _pushUntilNone(self, root: TreeNode | None):
+  def _pushUntilNone(self, root: Optional[TreeNode]):
     while root:
       self.stack.append(root)
       root = root.left if self.leftToRight else root.right
 
 
 class Solution:
-  def findTarget(self, root: TreeNode | None, k: int) -> bool:
+  def findTarget(self, root: Optional[TreeNode], k: int) -> bool:
     if not root:
       return False
 
diff --git a/solutions/654. Maximum Binary Tree/654.py b/solutions/654. Maximum Binary Tree/654.py
index 29bd88aa8eb..4d1666d9b37 100644
--- a/solutions/654. Maximum Binary Tree/654.py	
+++ b/solutions/654. Maximum Binary Tree/654.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def constructMaximumBinaryTree(self, nums: list[int]) -> TreeNode | None:
-    def build(i: int, j: int) -> TreeNode | None:
+  def constructMaximumBinaryTree(self, nums: List[int]) -> Optional[TreeNode]:
+    def build(i: int, j: int) -> Optional[TreeNode]:
       if i > j:
         return None
 
diff --git a/solutions/655. Print Binary Tree/655.py b/solutions/655. Print Binary Tree/655.py
index b25511f3288..af80fbf2cf0 100644
--- a/solutions/655. Print Binary Tree/655.py	
+++ b/solutions/655. Print Binary Tree/655.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def printTree(self, root: TreeNode | None) -> list[list[str]]:
-    def maxHeight(root: TreeNode | None) -> int:
+  def printTree(self, root: Optional[TreeNode]) -> List[List[str]]:
+    def maxHeight(root: Optional[TreeNode]) -> int:
       if not root:
         return 0
       return 1 + max(maxHeight(root.left), maxHeight(root.right))
 
-    def dfs(root: TreeNode | None, row: int, left: int, right: int) -> None:
+    def dfs(root: Optional[TreeNode], row: int, left: int, right: int) -> None:
       if not root:
         return
 
diff --git a/solutions/656. Coin Path/656-2.py b/solutions/656. Coin Path/656-2.py
index bbf60c8d3dc..3114628e219 100644
--- a/solutions/656. Coin Path/656-2.py	
+++ b/solutions/656. Coin Path/656-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def cheapestJump(self, coins: list[int], maxJump: int) -> list[int]:
+  def cheapestJump(self, coins: List[int], maxJump: int) -> List[int]:
     if coins[-1] == -1:
       return []
 
@@ -25,7 +25,7 @@ def cheapestJump(self, coins: list[int], maxJump: int) -> list[int]:
       return []
     return self._constructPath(next, 0)
 
-  def _constructPath(self, next: list[int], i: int) -> list[int]:
+  def _constructPath(self, next: List[int], i: int) -> List[int]:
     ans = []
     while i != -1:
       ans.append(i + 1)  # 1-indexed
diff --git a/solutions/656. Coin Path/656.py b/solutions/656. Coin Path/656.py
index 5ea1489254c..fefafdb8cd5 100644
--- a/solutions/656. Coin Path/656.py	
+++ b/solutions/656. Coin Path/656.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def cheapestJump(self, coins: list[int], maxJump: int) -> list[int]:
+  def cheapestJump(self, coins: List[int], maxJump: int) -> List[int]:
     if coins[-1] == -1:
       return []
 
@@ -33,7 +33,7 @@ def cheapestJump(i: int) -> int:
       return []
     return self._constructPath(next, 0)
 
-  def _constructPath(self, next: list[int], i: int) -> list[int]:
+  def _constructPath(self, next: List[int], i: int) -> List[int]:
     ans = []
     while i != -1:
       ans.append(i + 1)  # 1-indexed
diff --git a/solutions/658. Find K Closest Elements/658.py b/solutions/658. Find K Closest Elements/658.py
index 6ce85044285..ac598942dd2 100644
--- a/solutions/658. Find K Closest Elements/658.py	
+++ b/solutions/658. Find K Closest Elements/658.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findClosestElements(self, arr: list[int], k: int, x: int) -> list[int]:
+  def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]:
     l = 0
     r = len(arr) - k
 
diff --git a/solutions/66. Plus One/66.py b/solutions/66. Plus One/66.py
index 091176a671f..f04703ba937 100644
--- a/solutions/66. Plus One/66.py	
+++ b/solutions/66. Plus One/66.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def plusOne(self, digits: list[int]) -> list[int]:
+  def plusOne(self, digits: List[int]) -> List[int]:
     for i, d in reversed(list(enumerate(digits))):
       if d < 9:
         digits[i] += 1
diff --git a/solutions/660. Remove 9/660.cpp b/solutions/660. Remove 9/660.cpp
index 8dc15222691..77388a8b010 100644
--- a/solutions/660. Remove 9/660.cpp	
+++ b/solutions/660. Remove 9/660.cpp	
@@ -2,7 +2,7 @@ class Solution {
  public:
   int newInteger(int n) {
     string ans;
-    while (n > 0) {
+    while (n) {
       ans = to_string(n % 9) + ans;
       n /= 9;
     }
diff --git a/solutions/661. Image Smoother/661.py b/solutions/661. Image Smoother/661.py
index 866cd31f8a5..d3853201c68 100644
--- a/solutions/661. Image Smoother/661.py	
+++ b/solutions/661. Image Smoother/661.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def imageSmoother(self, M: list[list[int]]) -> list[list[int]]:
+  def imageSmoother(self, M: List[List[int]]) -> List[List[int]]:
     m = len(M)
     n = len(M[0])
     ans = [[0 for j in range(n)] for i in range(m)]
diff --git a/solutions/662. Maximum Width of Binary Tree/662-2.cpp b/solutions/662. Maximum Width of Binary Tree/662-2.cpp
index 50d4725cd3a..ba696cc9fe8 100644
--- a/solutions/662. Maximum Width of Binary Tree/662-2.cpp	
+++ b/solutions/662. Maximum Width of Binary Tree/662-2.cpp	
@@ -18,7 +18,7 @@ class Solution {
       startOfLevel.push_back(index);
 
     ans = max(ans, index - startOfLevel[level] + 1);
-    dfs(root->left, level + 1, index * 2, std::move(startOfLevel), ans);
-    dfs(root->right, level + 1, index * 2 + 1, std::move(startOfLevel), ans);
+    dfs(root->left, level + 1, index * 2, move(startOfLevel), ans);
+    dfs(root->right, level + 1, index * 2 + 1, move(startOfLevel), ans);
   }
 };
diff --git a/solutions/662. Maximum Width of Binary Tree/662.java b/solutions/662. Maximum Width of Binary Tree/662.java
index 4af6a86bdfa..6c9c3dda3f8 100644
--- a/solutions/662. Maximum Width of Binary Tree/662.java	
+++ b/solutions/662. Maximum Width of Binary Tree/662.java	
@@ -4,8 +4,8 @@ public int widthOfBinaryTree(TreeNode root) {
       return 0;
 
     int ans = 0;
-    // {node, index}
-    Deque<Pair<TreeNode, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(root, 1)));
+    Deque<Pair<TreeNode, Integer>> q = new ArrayDeque<>(); // {node, index}
+    q.offer(new Pair<>(root, 1));
 
     while (!q.isEmpty()) {
       final int offset = q.peekFirst().getValue() * 2;
diff --git a/solutions/663. Equal Tree Partition/663.py b/solutions/663. Equal Tree Partition/663.py
index dac4fb41d27..409ae7107c0 100644
--- a/solutions/663. Equal Tree Partition/663.py	
+++ b/solutions/663. Equal Tree Partition/663.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def checkEqualTree(self, root: TreeNode | None) -> bool:
+  def checkEqualTree(self, root: Optional[TreeNode]) -> bool:
     if not root:
       return False
 
     seen = set()
 
-    def dfs(root: TreeNode | None) -> int:
+    def dfs(root: Optional[TreeNode]) -> int:
       if not root:
         return 0
 
diff --git a/solutions/665. Non-decreasing Array/665.py b/solutions/665. Non-decreasing Array/665.py
index f9ef0a36dba..915b0fddc73 100644
--- a/solutions/665. Non-decreasing Array/665.py	
+++ b/solutions/665. Non-decreasing Array/665.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def checkPossibility(self, nums: list[int]) -> bool:
+  def checkPossibility(self, nums: List[int]) -> bool:
     j = None
 
     for i in range(len(nums) - 1):
@@ -8,5 +8,5 @@ def checkPossibility(self, nums: list[int]) -> bool:
           return False
         j = i
 
-    return (j is None or j == 0 or j == len(nums) - 2 or
-            nums[j - 1] <= nums[j + 1] or nums[j] <= nums[j + 2])
+    return j is None or j == 0 or j == len(nums) - 2 or \
+        nums[j - 1] <= nums[j + 1] or nums[j] <= nums[j + 2]
diff --git a/solutions/666. Path Sum IV/666.py b/solutions/666. Path Sum IV/666.py
index 14bfff120d0..c4a8c226de6 100644
--- a/solutions/666. Path Sum IV/666.py	
+++ b/solutions/666. Path Sum IV/666.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def pathSum(self, nums: list[int]) -> int:
+  def pathSum(self, nums: List[int]) -> int:
     ans = 0
     tree = [[-1] * 8 for _ in range(4)]
 
diff --git a/solutions/667. Beautiful Arrangement II/667.py b/solutions/667. Beautiful Arrangement II/667.py
index 20e281f3a77..342c224f96e 100644
--- a/solutions/667. Beautiful Arrangement II/667.py	
+++ b/solutions/667. Beautiful Arrangement II/667.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def constructArray(self, n: int, k: int) -> list[int]:
+  def constructArray(self, n: int, k: int) -> List[int]:
     ans = list(range(1, n - k + 1))
 
     for i in range(k):
diff --git a/solutions/67. Add Binary/67.cpp b/solutions/67. Add Binary/67.cpp
index e38bbb7ace5..2257613a0af 100644
--- a/solutions/67. Add Binary/67.cpp	
+++ b/solutions/67. Add Binary/67.cpp	
@@ -15,7 +15,7 @@ class Solution {
       carry /= 2;
     }
 
-    ranges::reverse(ans);
+    reverse(ans.begin(), ans.end());
     return ans;
   }
 };
diff --git a/solutions/673. Number of Longest Increasing Subsequence/673.py b/solutions/673. Number of Longest Increasing Subsequence/673.py
index f8a2758d55e..26953aa454d 100644
--- a/solutions/673. Number of Longest Increasing Subsequence/673.py	
+++ b/solutions/673. Number of Longest Increasing Subsequence/673.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findNumberOfLIS(self, nums: list[int]) -> int:
+  def findNumberOfLIS(self, nums: List[int]) -> int:
     ans = 0
     maxLength = 0
     # length[i] := the length of the LIS ending in nums[i]
diff --git a/solutions/674. Longest Continuous Increasing Subsequence/674.py b/solutions/674. Longest Continuous Increasing Subsequence/674.py
index e8bd61a4319..3676c214ed3 100644
--- a/solutions/674. Longest Continuous Increasing Subsequence/674.py	
+++ b/solutions/674. Longest Continuous Increasing Subsequence/674.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLengthOfLCIS(self, nums: list[int]) -> int:
+  def findLengthOfLCIS(self, nums: List[int]) -> int:
     ans = 0
     j = 0
 
diff --git a/solutions/675. Cut Off Trees for Golf Event/675.cpp b/solutions/675. Cut Off Trees for Golf Event/675.cpp
index 731e9f3bd45..0fd8121ec8a 100644
--- a/solutions/675. Cut Off Trees for Golf Event/675.cpp	
+++ b/solutions/675. Cut Off Trees for Golf Event/675.cpp	
@@ -2,6 +2,7 @@ struct T {
   int i;
   int j;
   int height;
+  T(int i, int j, int height) : i(i), j(j), height(height) {}
 };
 
 class Solution {
@@ -23,10 +24,10 @@ class Solution {
       const auto [i, j, _] = minHeap.top();
       minHeap.pop();
       // Walk from (x, y) to (i, j).
-      const int step = bfs(forest, x, y, i, j);
-      if (step < 0)
+      const int steps = bfs(forest, x, y, i, j);
+      if (steps < 0)
         return -1;
-      ans += step;
+      ans += steps;
       x = i;
       y = j;
     }
@@ -35,22 +36,23 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   int bfs(const vector<vector<int>>& forest, int si, int sj, int ei, int ej) {
     const int m = forest.size();
     const int n = forest[0].size();
+    int steps = 0;
     queue<pair<int, int>> q{{{si, sj}}};
     vector<vector<bool>> seen(m, vector<bool>(n));
     seen[si][sj] = true;
 
-    for (int step = 0; !q.empty(); ++step)
-      for (int sz = q.size(); sz > 0; --sz) {
+    while (!q.empty()) {
+      for (int s = q.size(); s > 0; --s) {
         const auto [i, j] = q.front();
         q.pop();
         if (i == ei && j == ej)
-          return step;
-        for (const auto& [dx, dy] : kDirs) {
+          return steps;
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
@@ -61,6 +63,8 @@ class Solution {
           seen[x][y] = true;
         }
       }
+      ++steps;
+    }
 
     return -1;
   };
diff --git a/solutions/675. Cut Off Trees for Golf Event/675.java b/solutions/675. Cut Off Trees for Golf Event/675.java
index 269735fce6e..0bcc892bffa 100644
--- a/solutions/675. Cut Off Trees for Golf Event/675.java	
+++ b/solutions/675. Cut Off Trees for Golf Event/675.java	
@@ -1,7 +1,17 @@
+class T {
+  public int i;
+  public int j;
+  public int height;
+  public T(int i, int j, int height) {
+    this.i = i;
+    this.j = j;
+    this.height = height;
+  }
+}
+
 class Solution {
   public int cutOffTree(List<List<Integer>> forest) {
-    record T(int i, int j, int height) {}
-    Queue<T> minHeap = new PriorityQueue<>(Comparator.comparingInt(T::height));
+    Queue<T> minHeap = new PriorityQueue<>((a, b) -> a.height - b.height);
 
     for (int i = 0; i < forest.size(); ++i)
       for (int j = 0; j < forest.get(0).size(); ++j)
@@ -16,10 +26,10 @@ record T(int i, int j, int height) {}
       final int i = minHeap.peek().i;
       final int j = minHeap.poll().j;
       // Walk from (x, y) to (i, j).
-      final int step = bfs(forest, x, y, i, j);
-      if (step < 0)
+      final int steps = bfs(forest, x, y, i, j);
+      if (steps < 0)
         return -1;
-      ans += step;
+      ans += steps;
       x = i;
       y = j;
     }
@@ -27,32 +37,35 @@ record T(int i, int j, int height) {}
     return ans;
   }
 
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private int bfs(List<List<Integer>> forest, int si, int sj, int ei, int ej) {
     final int m = forest.size();
     final int n = forest.get(0).size();
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(List.of(new Pair<>(si, sj)));
+    int steps = 0;
+    Queue<int[]> q = new ArrayDeque<>(Arrays.asList(new int[] {si, sj}));
     boolean[][] seen = new boolean[m][n];
     seen[si][sj] = true;
 
-    for (int step = 0; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
       for (int sz = q.size(); sz > 0; --sz) {
-        final int i = q.peek().getKey();
-        final int j = q.poll().getValue();
+        final int i = q.peek()[0];
+        final int j = q.poll()[1];
         if (i == ei && j == ej)
-          return step;
-        for (int[] dir : DIRS) {
+          return steps;
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == m || y < 0 || y == n)
             continue;
           if (seen[x][y] || forest.get(x).get(y) == 0)
             continue;
-          q.offer(new Pair<>(x, y));
+          q.offer(new int[] {x, y});
           seen[x][y] = true;
         }
       }
+      ++steps;
+    }
 
     return -1;
   };
diff --git a/solutions/676. Implement Magic Dictionary/676-2.java b/solutions/676. Implement Magic Dictionary/676-2.java
index f423cfecb8c..8ad4f6a3e36 100644
--- a/solutions/676. Implement Magic Dictionary/676-2.java	
+++ b/solutions/676. Implement Magic Dictionary/676-2.java	
@@ -9,7 +9,7 @@ public void buildDict(String[] dictionary) {
       insert(word);
   }
 
-  public boolean search(final String searchWord) {
+  public boolean search(String searchWord) {
     TrieNode node = root;
     for (int i = 0; i < searchWord.length(); ++i) {
       final int index = searchWord.charAt(i) - 'a';
diff --git a/solutions/676. Implement Magic Dictionary/676-2.py b/solutions/676. Implement Magic Dictionary/676-2.py
index 9f4b901aa48..a849038bbac 100644
--- a/solutions/676. Implement Magic Dictionary/676-2.py	
+++ b/solutions/676. Implement Magic Dictionary/676-2.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = collections.defaultdict(TrieNode)
     self.isWord = False
 
 
@@ -8,7 +8,7 @@ class MagicDictionary:
   def __init__(self):
     self.root = TrieNode()
 
-  def buildDict(self, dictionary: list[str]) -> None:
+  def buildDict(self, dictionary: List[str]) -> None:
     for word in dictionary:
       self._insert(word)
 
@@ -18,14 +18,14 @@ def search(self, searchWord: str) -> bool:
       for letter in string.ascii_lowercase:
         if letter == c:
           continue
-        if letter not in node.children:
-          continue
         child = node.children[letter]
+        if not child:
+          continue
         # Replace the searchWord[i] with `letter`, then check if
         # searchWord[i + 1..n) matches `child`.
         if self._find(child, searchWord, i + 1):
           return True
-      if c not in node.children:
+      if not node.children[c]:
         return False
       node = node.children[c]
     return False
diff --git a/solutions/676. Implement Magic Dictionary/676.java b/solutions/676. Implement Magic Dictionary/676.java
index 516337921d7..f6e919ec9f4 100644
--- a/solutions/676. Implement Magic Dictionary/676.java	
+++ b/solutions/676. Implement Magic Dictionary/676.java	
@@ -7,7 +7,7 @@ public void buildDict(String[] dictionary) {
       }
   }
 
-  public boolean search(final String searchWord) {
+  public boolean search(String searchWord) {
     for (int i = 0; i < searchWord.length(); ++i) {
       final String replaced = getReplaced(searchWord, i);
       if (dict.getOrDefault(replaced, searchWord.charAt(i)) != searchWord.charAt(i))
diff --git a/solutions/676. Implement Magic Dictionary/676.py b/solutions/676. Implement Magic Dictionary/676.py
index ec0f8f561c9..36a83c3b80e 100644
--- a/solutions/676. Implement Magic Dictionary/676.py	
+++ b/solutions/676. Implement Magic Dictionary/676.py	
@@ -2,7 +2,7 @@ class MagicDictionary:
   def __init__(self):
     self.dict = {}
 
-  def buildDict(self, dictionary: list[str]) -> None:
+  def buildDict(self, dictionary: List[str]) -> None:
     for word in dictionary:
       for i, c in enumerate(word):
         replaced = self._getReplaced(word, i)
diff --git a/solutions/677. Map Sum Pairs/677.java b/solutions/677. Map Sum Pairs/677.java
index f38ad22ae60..008b59cbee3 100644
--- a/solutions/677. Map Sum Pairs/677.java	
+++ b/solutions/677. Map Sum Pairs/677.java	
@@ -4,7 +4,7 @@ class TrieNode {
 }
 
 class MapSum {
-  public void insert(final String key, int val) {
+  public void insert(String key, int val) {
     final int diff = val - keyToVal.getOrDefault(key, 0);
     TrieNode node = root;
     for (final char c : key.toCharArray()) {
diff --git a/solutions/677. Map Sum Pairs/677.py b/solutions/677. Map Sum Pairs/677.py
index 8fb5e703e39..5da51ce6e2f 100644
--- a/solutions/677. Map Sum Pairs/677.py	
+++ b/solutions/677. Map Sum Pairs/677.py	
@@ -1,6 +1,6 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
     self.sum = 0
 
 
diff --git a/solutions/679. 24 Game/679.java b/solutions/679. 24 Game/679.java
index 7fe69557998..26a00923ef7 100644
--- a/solutions/679. 24 Game/679.java	
+++ b/solutions/679. 24 Game/679.java	
@@ -15,7 +15,7 @@ private boolean dfs(List<Double> nums) {
     for (int i = 0; i < nums.size(); ++i)
       for (int j = i + 1; j < nums.size(); ++j)
         for (final double num : generate(nums.get(i), nums.get(j))) {
-          List<Double> nextRound = new ArrayList<>(List.of(num));
+          List<Double> nextRound = new ArrayList<>(Arrays.asList(num));
           for (int k = 0; k < nums.size(); ++k) {
             if (k == i || k == j) // It is used in `generate()`.
               continue;
diff --git a/solutions/679. 24 Game/679.py b/solutions/679. 24 Game/679.py
index 166b110247d..abdec026c0f 100644
--- a/solutions/679. 24 Game/679.py	
+++ b/solutions/679. 24 Game/679.py	
@@ -1,24 +1,25 @@
 class Solution:
-  def judgePoint24(self, nums: list[int]) -> bool:
-    def generate(a: float, b: float) -> list[float]:
+  def judgePoint24(self, nums: List[int]) -> bool:
+    def generate(a: float, b: float) -> List[float]:
       return [a * b,
               math.inf if b == 0 else a / b,
               math.inf if a == 0 else b / a,
               a + b, a - b, b - a]
 
-    def dfs(nums: list[float]) -> bool:
+    def dfs(nums: List[float]) -> bool:
       if len(nums) == 1:
         return abs(nums[0] - 24.0) < 0.001
 
-      for i, j in itertools.combinations(range(len(nums)), 2):
-        for num in generate(nums[i], nums[j]):
-          nextRound = [num]
-          for k in range(len(nums)):
-            if k == i or k == j:
-              continue
-            nextRound.append(nums[k])
-          if dfs(nextRound):
-            return True
+      for i in range(len(nums)):
+        for j in range(i + 1, len(nums)):
+          for num in generate(nums[i], nums[j]):
+            nextRound = [num]
+            for k in range(len(nums)):
+              if k == i or k == j:
+                continue
+              nextRound.append(nums[k])
+            if dfs(nextRound):
+              return True
 
       return False
 
diff --git a/solutions/68. Text Justification/68.py b/solutions/68. Text Justification/68.py
index 55be2d5908e..8b4de0ba29a 100644
--- a/solutions/68. Text Justification/68.py	
+++ b/solutions/68. Text Justification/68.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def fullJustify(self, words: list[str], maxWidth: int) -> list[str]:
+  def fullJustify(self, words: List[str], maxWidth: int) -> List[str]:
     ans = []
     row = []
     rowLetters = 0
diff --git a/solutions/681. Next Closest Time/681.py b/solutions/681. Next Closest Time/681.py
index d3dc4b542cf..1edc5cb60a8 100644
--- a/solutions/681. Next Closest Time/681.py	
+++ b/solutions/681. Next Closest Time/681.py	
@@ -3,7 +3,7 @@ def nextClosestTime(self, time: str) -> str:
     ans = list(time)
     digits = sorted(ans)
 
-    def nextClosest(digit: str, limit: str) -> str:
+    def nextClosest(digit: str, limit: str) -> chr:
       next = bisect_right(digits, digit)
       return digits[0] if next == 4 or digits[next] > limit else digits[next]
 
diff --git a/solutions/682. Baseball Game/682.py b/solutions/682. Baseball Game/682.py
index 9fce1c36e10..ffa62861451 100644
--- a/solutions/682. Baseball Game/682.py	
+++ b/solutions/682. Baseball Game/682.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def calPoints(self, operations: list[str]) -> int:
+  def calPoints(self, operations: List[str]) -> int:
     scores = []
 
     for operation in operations:
diff --git a/solutions/683. K Empty Slots/683.py b/solutions/683. K Empty Slots/683.py
index 7c923d39902..37a40baa076 100644
--- a/solutions/683. K Empty Slots/683.py	
+++ b/solutions/683. K Empty Slots/683.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def kEmptySlots(self, bulbs: list[int], k: int) -> int:
+  def kEmptySlots(self, bulbs: List[int], k: int) -> int:
     n = len(bulbs)
     ans = math.inf
     # day[i] := the day when bulbs[i] is turned on
diff --git a/solutions/684. Redundant Connection/684.py b/solutions/684. Redundant Connection/684.py
index 078f6b06555..f2bc22f871f 100644
--- a/solutions/684. Redundant Connection/684.py	
+++ b/solutions/684. Redundant Connection/684.py	
@@ -24,7 +24,7 @@ def _find(self, u: int) -> int:
 
 
 class Solution:
-  def findRedundantConnection(self, edges: list[list[int]]) -> list[int]:
+  def findRedundantConnection(self, edges: List[List[int]]) -> List[int]:
     uf = UnionFind(len(edges) + 1)
 
     for edge in edges:
diff --git a/solutions/685. Redundant Connection II/685.py b/solutions/685. Redundant Connection II/685.py
index 57f81d8df75..7e8fcb7cf8a 100644
--- a/solutions/685. Redundant Connection II/685.py	
+++ b/solutions/685. Redundant Connection II/685.py	
@@ -24,9 +24,7 @@ def _find(self, u: int) -> int:
 
 
 class Solution:
-  def findRedundantDirectedConnection(
-      self, edges: list[list[int]],
-  ) -> list[int]:
+  def findRedundantDirectedConnection(self, edges: List[List[int]]) -> List[int]:
     ids = [0] * (len(edges) + 1)
     nodeWithTwoParents = 0
 
@@ -35,7 +33,7 @@ def findRedundantDirectedConnection(
       if ids[v] == 2:
         nodeWithTwoParents = v
 
-    def findRedundantDirectedConnection(skippedEdgeIndex: int) -> list[int]:
+    def findRedundantDirectedConnection(skippedEdgeIndex: int) -> List[int]:
       uf = UnionFind(len(edges) + 1)
 
       for i, edge in enumerate(edges):
diff --git a/solutions/687. Longest Univalue Path/687.py b/solutions/687. Longest Univalue Path/687.py
index 713259cdfc9..7b07e38251b 100644
--- a/solutions/687. Longest Univalue Path/687.py	
+++ b/solutions/687. Longest Univalue Path/687.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def longestUnivaluePath(self, root: TreeNode | None) -> int:
+  def longestUnivaluePath(self, root: Optional[TreeNode]) -> int:
     ans = 0
 
-    def longestUnivaluePathDownFrom(root: TreeNode | None) -> int:
+    def longestUnivaluePathDownFrom(root: Optional[TreeNode]) -> int:
       nonlocal ans
       if not root:
         return 0
diff --git a/solutions/688. Knight Probability in Chessboard/688.cpp b/solutions/688. Knight Probability in Chessboard/688.cpp
index 78edcb4f133..8cf92a6e5a8 100644
--- a/solutions/688. Knight Probability in Chessboard/688.cpp	
+++ b/solutions/688. Knight Probability in Chessboard/688.cpp	
@@ -1,8 +1,8 @@
 class Solution {
  public:
   double knightProbability(int n, int k, int row, int column) {
-    constexpr int kDirs[8][2] = {{1, 2},   {2, 1},   {2, -1}, {1, -2},
-                                 {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
+    constexpr int dirs[8][2] = {{1, 2},   {2, 1},   {2, -1}, {1, -2},
+                                {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
     constexpr double kProb = 0.125;
     // dp[i][j] := the probability to stand on (i, j)
     vector<vector<double>> dp(n, vector<double>(n));
@@ -13,7 +13,7 @@ class Solution {
       for (int i = 0; i < n; ++i)
         for (int j = 0; j < n; ++j)
           if (dp[i][j] > 0.0) {
-            for (const auto& [dx, dy] : kDirs) {
+            for (const auto& [dx, dy] : dirs) {
               const int x = i + dx;
               const int y = j + dy;
               if (x < 0 || x >= n || y < 0 || y >= n)
@@ -25,8 +25,8 @@ class Solution {
     }
 
     return accumulate(dp.begin(), dp.end(), 0.0,
-                      [](double acc, const vector<double>& row) {
-      return acc + accumulate(row.begin(), row.end(), 0.0);
+                      [](double subtotal, const vector<double>& row) {
+      return subtotal + accumulate(row.begin(), row.end(), 0.0);
     });
   }
 };
diff --git a/solutions/688. Knight Probability in Chessboard/688.java b/solutions/688. Knight Probability in Chessboard/688.java
index fe46a4fba4a..661b51f8b3f 100644
--- a/solutions/688. Knight Probability in Chessboard/688.java	
+++ b/solutions/688. Knight Probability in Chessboard/688.java	
@@ -1,7 +1,7 @@
 class Solution {
   public double knightProbability(int n, int k, int row, int column) {
-    final int[][] DIRS = {{1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
-    final double PROB = 0.125;
+    final int[][] dirs = {{1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
+    final double kProb = 0.125;
     // dp[i][j] := the probability to stand on (i, j)
     double[][] dp = new double[n][n];
     dp[row][column] = 1.0;
@@ -11,12 +11,12 @@ public double knightProbability(int n, int k, int row, int column) {
       for (int i = 0; i < n; ++i)
         for (int j = 0; j < n; ++j)
           if (dp[i][j] > 0.0) {
-            for (int[] dir : DIRS) {
+            for (int[] dir : dirs) {
               final int x = i + dir[0];
               final int y = j + dir[1];
               if (x < 0 || x >= n || y < 0 || y >= n)
                 continue;
-              newDp[x][y] += dp[i][j] * PROB;
+              newDp[x][y] += dp[i][j] * kProb;
             }
           }
       dp = newDp;
diff --git a/solutions/688. Knight Probability in Chessboard/688.py b/solutions/688. Knight Probability in Chessboard/688.py
index b9a8def6f30..245f8b9f305 100644
--- a/solutions/688. Knight Probability in Chessboard/688.py	
+++ b/solutions/688. Knight Probability in Chessboard/688.py	
@@ -1,6 +1,6 @@
 class Solution:
   def knightProbability(self, n: int, k: int, row: int, column: int) -> float:
-    DIRS = ((1, 2), (2, 1), (2, -1), (1, -2),
+    dirs = ((1, 2), (2, 1), (2, -1), (1, -2),
             (-1, -2), (-2, -1), (-2, 1), (-1, 2))
     # dp[i][j] := the probability to stand on (i, j)
     dp = [[0] * n for _ in range(n)]
@@ -10,7 +10,7 @@ def knightProbability(self, n: int, k: int, row: int, column: int) -> float:
       newDp = [[0] * n for _ in range(n)]
       for i in range(n):
         for j in range(n):
-          for dx, dy in DIRS:
+          for dx, dy in dirs:
             x = i + dx
             y = j + dy
             if 0 <= x < n and 0 <= y < n:
diff --git a/solutions/689. Maximum Sum of 3 Non-Overlapping Subarrays/689.py b/solutions/689. Maximum Sum of 3 Non-Overlapping Subarrays/689.py
index 7a545d34822..3bd8daaee19 100644
--- a/solutions/689. Maximum Sum of 3 Non-Overlapping Subarrays/689.py	
+++ b/solutions/689. Maximum Sum of 3 Non-Overlapping Subarrays/689.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSumOfThreeSubarrays(self, nums: list[int], k: int) -> list[int]:
+  def maxSumOfThreeSubarrays(self, nums: List[int], k: int) -> List[int]:
     n = len(nums) - k + 1
     # sums[i] := sum(nums[i..i + k))
     sums = [0] * n
@@ -31,9 +31,8 @@ def maxSumOfThreeSubarrays(self, nums: list[int], k: int) -> list[int]:
     ans = [-1, -1, -1]
 
     for i in range(k, n - k):
-      if (ans[0] == -1 or
-          sums[ans[0]] + sums[ans[1]] + sums[ans[2]] <
-              sums[l[i - k]] + sums[i] + sums[r[i + k]]):
+      if ans[0] == -1 or sums[ans[0]] + sums[ans[1]] + sums[ans[2]] <\
+              sums[l[i - k]] + sums[i] + sums[r[i + k]]:
         ans[0] = l[i - k]
         ans[1] = i
         ans[2] = r[i + k]
diff --git a/solutions/690. Employee Importance/690.py b/solutions/690. Employee Importance/690.py
index b0b443fb4b9..d77c4761855 100644
--- a/solutions/690. Employee Importance/690.py	
+++ b/solutions/690. Employee Importance/690.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def getImportance(self, employees: list['Employee'], id: int) -> int:
+  def getImportance(self, employees: List['Employee'], id: int) -> int:
     idToEmployee = {employee.id: employee for employee in employees}
 
     def dfs(id: int) -> int:
diff --git a/solutions/691. Stickers to Spell Word/691.py b/solutions/691. Stickers to Spell Word/691.py
index 12afc0d46ca..17abe1fd934 100644
--- a/solutions/691. Stickers to Spell Word/691.py	
+++ b/solutions/691. Stickers to Spell Word/691.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minStickers(self, stickers: list[str], target: str) -> int:
+  def minStickers(self, stickers: List[str], target: str) -> int:
     maxMask = 1 << len(target)
     # dp[i] := the minimum number of stickers to spell out i, where i is the
     # bit mask of target
diff --git a/solutions/692. Top K Frequent Words/692-2.cpp b/solutions/692. Top K Frequent Words/692-2.cpp
index 458f870bc1f..76f7eb62b6e 100644
--- a/solutions/692. Top K Frequent Words/692-2.cpp	
+++ b/solutions/692. Top K Frequent Words/692-2.cpp	
@@ -1,6 +1,7 @@
 struct T {
   string word;
   int freq;
+  T(string word, int freq) : word(word), freq(freq) {}
 };
 
 class Solution {
@@ -28,7 +29,7 @@ class Solution {
     while (!heap.empty())
       ans.push_back(heap.top().word), heap.pop();
 
-    ranges::reverse(ans);
+    reverse(ans.begin(), ans.end());
     return ans;
   }
 };
diff --git a/solutions/692. Top K Frequent Words/692-2.java b/solutions/692. Top K Frequent Words/692-2.java
index b09b6b461a1..c7bd7872178 100644
--- a/solutions/692. Top K Frequent Words/692-2.java	
+++ b/solutions/692. Top K Frequent Words/692-2.java	
@@ -1,13 +1,21 @@
+class T {
+  public String word;
+  public int freq;
+  public T(String word, int freq) {
+    this.word = word;
+    this.freq = freq;
+  }
+};
+
 class Solution {
   public List<String> topKFrequent(String[] words, int k) {
-    record T(String word, int freq) {}
     List<String> ans = new ArrayList<>();
     Map<String, Integer> count = new HashMap<>();
     // Words with higher frequency and lower alphabetical order are in the
     // bottom of the heap because we'll pop words with lower frequency and
     // higher alphabetical order if the heap's size > k.
     Queue<T> heap = new PriorityQueue<>(
-        Comparator.comparingInt(T::freq).thenComparing(T::word, Comparator.reverseOrder()));
+        (a, b) -> a.freq == b.freq ? b.word.compareTo(a.word) : a.freq - b.freq);
 
     for (final String word : words)
       count.merge(word, 1, Integer::sum);
diff --git a/solutions/692. Top K Frequent Words/692-2.py b/solutions/692. Top K Frequent Words/692-2.py
index b731f113a38..2631c6bd00b 100644
--- a/solutions/692. Top K Frequent Words/692-2.py	
+++ b/solutions/692. Top K Frequent Words/692-2.py	
@@ -1,19 +1,19 @@
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
 class T:
-  word: str
-  freq: int
+  def __init__(self, word: str, freq: int):
+    self.word = word
+    self.freq = freq
 
   def __lt__(self, other):
     if self.freq == other.freq:
+      # Words with higher frequency and lower alphabetical order are in the
+      # bottom of the heap because we'll pop words with lower frequency and
+      # higher alphabetical order if the heap's size > k.
       return self.word > other.word
     return self.freq < other.freq
 
 
 class Solution:
-  def topKFrequent(self, words: list[str], k: int) -> list[str]:
+  def topKFrequent(self, words: List[str], k: int) -> List[str]:
     ans = []
     heap = []
 
diff --git a/solutions/692. Top K Frequent Words/692.py b/solutions/692. Top K Frequent Words/692.py
index 534816034f8..64378a2d232 100644
--- a/solutions/692. Top K Frequent Words/692.py	
+++ b/solutions/692. Top K Frequent Words/692.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def topKFrequent(self, words: list[str], k: int) -> list[str]:
+  def topKFrequent(self, words: List[str], k: int) -> List[str]:
     ans = []
     bucket = [[] for _ in range(len(words) + 1)]
 
diff --git a/solutions/694. Number of Distinct Islands/694.py b/solutions/694. Number of Distinct Islands/694.py
index 9c598c895b1..e5c32604779 100644
--- a/solutions/694. Number of Distinct Islands/694.py	
+++ b/solutions/694. Number of Distinct Islands/694.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numDistinctIslands(self, grid: list[list[int]]) -> int:
+  def numDistinctIslands(self, grid: List[List[int]]) -> int:
     seen = set()
 
     def dfs(i: int, j: int, i0: int, j0: int):
diff --git a/solutions/695. Max Area of Island/695.py b/solutions/695. Max Area of Island/695.py
index 044ff0d9210..e775c00bd3a 100644
--- a/solutions/695. Max Area of Island/695.py	
+++ b/solutions/695. Max Area of Island/695.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxAreaOfIsland(self, grid: list[list[int]]) -> int:
+  def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
     def dfs(i: int, j: int) -> int:
       if i < 0 or i == len(grid) or j < 0 or j == len(grid[0]):
         return 0
diff --git a/solutions/697. Degree of an Array/697.py b/solutions/697. Degree of an Array/697.py
index 193605c7a0b..09055298c53 100644
--- a/solutions/697. Degree of an Array/697.py	
+++ b/solutions/697. Degree of an Array/697.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findShortestSubArray(self, nums: list[int]) -> int:
+  def findShortestSubArray(self, nums: List[int]) -> int:
     ans = 0
     degree = 0
     debut = {}
diff --git a/solutions/698. Partition to K Equal Sum Subsets/698.py b/solutions/698. Partition to K Equal Sum Subsets/698.py
index 6444dc86a69..96c6aa86de3 100644
--- a/solutions/698. Partition to K Equal Sum Subsets/698.py	
+++ b/solutions/698. Partition to K Equal Sum Subsets/698.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canPartitionKSubsets(self, nums: list[int], k: int) -> bool:
+  def canPartitionKSubsets(self, nums: List[int], k: int) -> bool:
     summ = sum(nums)
     if summ % k != 0:
       return False
diff --git a/solutions/700. Search in a Binary Search Tree/700.java b/solutions/700. Search in a Binary Search Tree/700.java
index 2aa1e84f3b0..f613eec4511 100644
--- a/solutions/700. Search in a Binary Search Tree/700.java	
+++ b/solutions/700. Search in a Binary Search Tree/700.java	
@@ -1,4 +1,4 @@
-class Solution {
+public class Solution {
   public TreeNode searchBST(TreeNode root, int val) {
     if (root == null)
       return null;
diff --git a/solutions/700. Search in a Binary Search Tree/700.py b/solutions/700. Search in a Binary Search Tree/700.py
index 66535ada544..f51a15dae56 100644
--- a/solutions/700. Search in a Binary Search Tree/700.py	
+++ b/solutions/700. Search in a Binary Search Tree/700.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def searchBST(self, root: TreeNode | None, val: int) -> TreeNode | None:
+  def searchBST(self, root: Optional[TreeNode], val: int) -> Optional[TreeNode]:
     if not root:
       return None
     if root.val == val:
diff --git a/solutions/701. Insert into a Binary Search Tree/701.py b/solutions/701. Insert into a Binary Search Tree/701.py
index 1826b79d1af..475aff6b332 100644
--- a/solutions/701. Insert into a Binary Search Tree/701.py	
+++ b/solutions/701. Insert into a Binary Search Tree/701.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def insertIntoBST(self, root: TreeNode | None, val: int) -> TreeNode | None:
+  def insertIntoBST(self, root: Optional[TreeNode], val: int) -> Optional[TreeNode]:
     if not root:
       return TreeNode(val)
     if root.val > val:
diff --git a/solutions/704. Binary Search/704.py b/solutions/704. Binary Search/704.py
index 7b6bded92e0..e751ae50e4c 100644
--- a/solutions/704. Binary Search/704.py	
+++ b/solutions/704. Binary Search/704.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def search(self, nums: list[int], target: int) -> int:
+  def search(self, nums: List[int], target: int) -> int:
     i = bisect.bisect_left(nums, target)
     return -1 if i == len(nums) or nums[i] != target else i
diff --git a/solutions/706. Design HashMap/706.java b/solutions/706. Design HashMap/706.java
index 787f79d585b..d01da368447 100644
--- a/solutions/706. Design HashMap/706.java	
+++ b/solutions/706. Design HashMap/706.java	
@@ -1,34 +1,34 @@
 class MyHashMap {
   public MyHashMap() {
-    lists = new List[SIZE];
-    for (int i = 0; i < SIZE; ++i)
+    lists = new List[kSize];
+    for (int i = 0; i < kSize; ++i)
       lists[i] = new ArrayList<>();
   }
 
   public void put(int key, int value) {
-    for (int[] pair : lists[key % SIZE])
+    for (int[] pair : lists[key % kSize])
       if (pair[0] == key) {
         pair[1] = value;
         return;
       }
-    lists[key % SIZE].add(new int[] {key, value});
+    lists[key % kSize].add(new int[] {key, value});
   }
 
   public int get(int key) {
-    for (int[] pair : lists[key % SIZE])
+    for (int[] pair : lists[key % kSize])
       if (pair[0] == key)
         return pair[1];
     return -1;
   }
 
   public void remove(int key) {
-    for (int i = 0; i < lists[key % SIZE].size(); ++i)
-      if (lists[key % SIZE].get(i)[0] == key) {
-        lists[key % SIZE].remove(i);
+    for (int i = 0; i < lists[key % kSize].size(); ++i)
+      if (lists[key % kSize].get(i)[0] == key) {
+        lists[key % kSize].remove(i);
         return;
       }
   }
 
-  private static final int SIZE = 10000;
+  private static final int kSize = 10000;
   List<int[]>[] lists; // Each slot stores the (key, value) list.
 }
diff --git a/solutions/707. Design Linked List/707.cpp b/solutions/707. Design Linked List/707.cpp
index ff9b6b84fc8..5bbc4d58f9f 100644
--- a/solutions/707. Design Linked List/707.cpp	
+++ b/solutions/707. Design Linked List/707.cpp	
@@ -25,7 +25,7 @@ class MyLinkedList {
 
   void addAtTail(int val) {
     ListNode* curr = &dummy;
-    while (curr->next != nullptr)
+    while (curr->next)
       curr = curr->next;
     curr->next = new ListNode(val);
     ++length;
diff --git a/solutions/707. Design Linked List/707.py b/solutions/707. Design Linked List/707.py
index 98d9ac89254..88de9b77025 100644
--- a/solutions/707. Design Linked List/707.py	
+++ b/solutions/707. Design Linked List/707.py	
@@ -1,10 +1,7 @@
-from dataclasses import dataclass
-
-
-@dataclass
 class ListNode:
-  val: int
-  next: ListNode | None = None
+  def __init__(self, x):
+    self.val = x
+    self.next = None
 
 
 class MyLinkedList:
diff --git a/solutions/71. Simplify Path/71.java b/solutions/71. Simplify Path/71.java
index 3dca2dd6eef..a18a08c5e53 100644
--- a/solutions/71. Simplify Path/71.java	
+++ b/solutions/71. Simplify Path/71.java	
@@ -1,9 +1,9 @@
 class Solution {
   public String simplifyPath(String path) {
-    final String[] DIRS = path.split("/");
+    final String[] dirs = path.split("/");
     Stack<String> stack = new Stack<>();
 
-    for (final String dir : DIRS) {
+    for (final String dir : dirs) {
       if (dir.isEmpty() || dir.equals("."))
         continue;
       if (dir.equals("..")) {
diff --git a/solutions/710. Random Pick with Blacklist/710.py b/solutions/710. Random Pick with Blacklist/710.py
index 563323cbacb..bff87089d4a 100644
--- a/solutions/710. Random Pick with Blacklist/710.py	
+++ b/solutions/710. Random Pick with Blacklist/710.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def __init__(self, n: int, blacklist: list[int]):
+  def __init__(self, n: int, blacklist: List[int]):
     self.validRange = n - len(blacklist)
     self.dict = {}
 
diff --git a/solutions/711. Number of Distinct Islands II/711.java b/solutions/711. Number of Distinct Islands II/711.java
index ea7ee58e90f..a388b44e0cf 100644
--- a/solutions/711. Number of Distinct Islands II/711.java	
+++ b/solutions/711. Number of Distinct Islands II/711.java	
@@ -50,9 +50,11 @@ private List<Pair<Integer, Integer>> normalize(List<Pair<Integer, Integer>> isla
       points[7][k] = new Pair<>(-j, -i);
     }
 
-    for (Pair<Integer, Integer>[] point : points)
-      Arrays.sort(point, Comparator.comparingInt(Pair<Integer, Integer>::getKey)
-                             .thenComparingInt(Pair<Integer, Integer>::getValue));
+    for (Pair<Integer, Integer>[] p : points)
+      Arrays.sort(p,
+                  (a, b)
+                      -> a.getKey().equals(b.getKey()) ? a.getValue() - b.getValue()
+                                                       : a.getKey() - b.getKey());
 
     // Normalize each p by substracting p[1..7] with p[0].
     for (Pair<Integer, Integer>[] p : points) {
diff --git a/solutions/711. Number of Distinct Islands II/711.py b/solutions/711. Number of Distinct Islands II/711.py
index 3239d39d0d8..92a7d3aee5a 100644
--- a/solutions/711. Number of Distinct Islands II/711.py	
+++ b/solutions/711. Number of Distinct Islands II/711.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numDistinctIslands2(self, grid: list[list[int]]) -> int:
+  def numDistinctIslands2(self, grid: List[List[int]]) -> int:
     seen = set()
 
     def dfs(i: int, j: int):
@@ -15,7 +15,7 @@ def dfs(i: int, j: int):
       dfs(i, j + 1)
       dfs(i, j - 1)
 
-    def normalize(island: list[tuple]) -> list[tuple]:
+    def normalize(island: List[tuple]) -> List[tuple]:
       # points[i] := 8 different rotations/reflections of an island
       points = [[] for _ in range(8)]
 
diff --git a/solutions/713. Subarray Product Less Than K/713.py b/solutions/713. Subarray Product Less Than K/713.py
index 13ebaa04f37..845a911380b 100644
--- a/solutions/713. Subarray Product Less Than K/713.py	
+++ b/solutions/713. Subarray Product Less Than K/713.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numSubarrayProductLessThanK(self, nums: list[int], k: int) -> int:
+  def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int:
     if k <= 1:
       return 0
 
diff --git a/solutions/714. Best Time to Buy and Sell Stock with Transaction Fee/714.py b/solutions/714. Best Time to Buy and Sell Stock with Transaction Fee/714.py
index e2e64319b58..c31099720cd 100644
--- a/solutions/714. Best Time to Buy and Sell Stock with Transaction Fee/714.py	
+++ b/solutions/714. Best Time to Buy and Sell Stock with Transaction Fee/714.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxProfit(self, prices: list[int], fee: int) -> int:
+  def maxProfit(self, prices: List[int], fee: int) -> int:
     sell = 0
     hold = -math.inf
 
diff --git a/solutions/715. Range Module/715.cpp b/solutions/715. Range Module/715.cpp
index d48127ee8dc..69dd9947006 100644
--- a/solutions/715. Range Module/715.cpp	
+++ b/solutions/715. Range Module/715.cpp	
@@ -2,16 +2,17 @@ struct SegmentTreeNode {
   int lo;
   int hi;
   bool tracked = false;
-  std::unique_ptr<SegmentTreeNode> left;
-  std::unique_ptr<SegmentTreeNode> right;
-  SegmentTreeNode(int lo, int hi, bool tracked,
-                  std::unique_ptr<SegmentTreeNode> left = nullptr,
-                  std::unique_ptr<SegmentTreeNode> right = nullptr)
-      : lo(lo),
-        hi(hi),
-        tracked(tracked),
-        left(std::move(left)),
-        right(std::move(right)) {}
+  SegmentTreeNode* left;
+  SegmentTreeNode* right;
+  SegmentTreeNode(int lo, int hi, bool tracked, SegmentTreeNode* left = nullptr,
+                  SegmentTreeNode* right = nullptr)
+      : lo(lo), hi(hi), tracked(tracked), left(left), right(right) {}
+  ~SegmentTreeNode() {
+    delete left;
+    delete right;
+    left = nullptr;
+    right = nullptr;
+  }
 };
 
 class SegmentTree {
@@ -19,22 +20,21 @@ class SegmentTree {
   explicit SegmentTree() : root(make_unique<SegmentTreeNode>(0, 1e9, false)) {}
 
   void addRange(int i, int j) {
-    update(root, i, j, true);
+    update(root.get(), i, j, true);
   }
 
   bool queryRange(int i, int j) {
-    return query(root, i, j);
+    return query(root.get(), i, j);
   }
 
   void removeRange(int i, int j) {
-    update(root, i, j, false);
+    update(root.get(), i, j, false);
   }
 
  private:
   std::unique_ptr<SegmentTreeNode> root;
 
-  void update(std::unique_ptr<SegmentTreeNode>& root, int i, int j,
-              bool tracked) {
+  void update(SegmentTreeNode* root, int i, int j, bool tracked) {
     if (root->lo == i && root->hi == j) {
       root->tracked = tracked;
       root->left = nullptr;
@@ -43,9 +43,8 @@ class SegmentTree {
     }
     const int mid = root->lo + (root->hi - root->lo) / 2;
     if (root->left == nullptr) {
-      root->left = make_unique<SegmentTreeNode>(root->lo, mid, root->tracked);
-      root->right =
-          make_unique<SegmentTreeNode>(mid + 1, root->hi, root->tracked);
+      root->left = new SegmentTreeNode(root->lo, mid, root->tracked);
+      root->right = new SegmentTreeNode(mid + 1, root->hi, root->tracked);
     }
     if (j <= mid)
       update(root->left, i, j, tracked);
@@ -55,10 +54,10 @@ class SegmentTree {
       update(root->left, i, mid, tracked);
       update(root->right, mid + 1, j, tracked);
     }
-    root->tracked = merge(root->left->tracked, root->right->tracked);
+    root->tracked = root->left->tracked && root->right->tracked;
   }
 
-  bool query(std::unique_ptr<SegmentTreeNode>& root, int i, int j) const {
+  bool query(SegmentTreeNode* root, int i, int j) {
     if (root->left == nullptr)
       return root->tracked;
     if (root->lo == i && root->hi == j)
@@ -68,11 +67,7 @@ class SegmentTree {
       return query(root->left, i, j);
     if (i > mid)
       return query(root->right, i, j);
-    return merge(query(root->left, i, mid), query(root->right, mid + 1, j));
-  }
-
-  bool merge(bool left, bool right) const {
-    return left && right;
+    return query(root->left, i, mid) && query(root->right, mid + 1, j);
   }
 };
 
diff --git a/solutions/717. 1-bit and 2-bit Characters/717.py b/solutions/717. 1-bit and 2-bit Characters/717.py
index ff26f19effd..4f0caa7a9bf 100644
--- a/solutions/717. 1-bit and 2-bit Characters/717.py	
+++ b/solutions/717. 1-bit and 2-bit Characters/717.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isOneBitCharacter(self, bits: list[int]) -> bool:
+  def isOneBitCharacter(self, bits: List[int]) -> bool:
     i = 0
     while i < len(bits) - 1:
       i += bits[i] + 1
diff --git a/solutions/718. Maximum Length of Repeated Subarray/718-2.py b/solutions/718. Maximum Length of Repeated Subarray/718-2.py
index 940fcee6ff7..10abc213bde 100644
--- a/solutions/718. Maximum Length of Repeated Subarray/718-2.py	
+++ b/solutions/718. Maximum Length of Repeated Subarray/718-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLength(self, nums1: list[int], nums2: list[int]) -> int:
+  def findLength(self, nums1: List[int], nums2: List[int]) -> int:
     ans = 0
     dp = [0] * (len(nums2) + 1)
 
diff --git a/solutions/718. Maximum Length of Repeated Subarray/718.py b/solutions/718. Maximum Length of Repeated Subarray/718.py
index 0853f288909..5bf7d06d1f9 100644
--- a/solutions/718. Maximum Length of Repeated Subarray/718.py	
+++ b/solutions/718. Maximum Length of Repeated Subarray/718.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findLength(self, nums1: list[int], nums2: list[int]) -> int:
+  def findLength(self, nums1: List[int], nums2: List[int]) -> int:
     m = len(nums1)
     n = len(nums2)
     ans = 0
diff --git a/solutions/719. Find K-th Smallest Pair Distance/719.py b/solutions/719. Find K-th Smallest Pair Distance/719.py
index d7b0ec13325..e9b20e50547 100644
--- a/solutions/719. Find K-th Smallest Pair Distance/719.py	
+++ b/solutions/719. Find K-th Smallest Pair Distance/719.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def smallestDistancePair(self, nums: list[int], k: int) -> int:
+  def smallestDistancePair(self, nums: List[int], k: int) -> int:
     nums.sort()
 
     def numPairDistancesNoGreaterThan(m: int) -> int:
@@ -13,5 +13,6 @@ def numPairDistancesNoGreaterThan(m: int) -> int:
         count += j - i - 1
       return count
 
-    return bisect.bisect_left(range(nums[-1] - nums[0]), k,
-                              key=numPairDistancesNoGreaterThan)
+    return bisect.bisect_left(
+        range(0, nums[-1] - nums[0]), k,
+        key=lambda m: numPairDistancesNoGreaterThan(m))
diff --git a/solutions/720. Longest Word in Dictionary/720.py b/solutions/720. Longest Word in Dictionary/720.py
index d959c81793a..aa4c2ea792a 100644
--- a/solutions/720. Longest Word in Dictionary/720.py	
+++ b/solutions/720. Longest Word in Dictionary/720.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestWord(self, words: list[str]) -> str:
+  def longestWord(self, words: List[str]) -> str:
     root = {}
 
     for word in words:
@@ -16,8 +16,7 @@ def dfs(node: dict) -> str:
       for child in node:
         if 'word' in node[child] and len(node[child]['word']) > 0:
           childWord = dfs(node[child])
-          if len(childWord) > len(ans) or (
-                  len(childWord) == len(ans) and childWord < ans):
+          if len(childWord) > len(ans) or (len(childWord) == len(ans) and childWord < ans):
             ans = childWord
 
       return ans
diff --git a/solutions/722. Remove Comments/722.py b/solutions/722. Remove Comments/722.py
index 4048cd36572..a6882da9e2a 100644
--- a/solutions/722. Remove Comments/722.py	
+++ b/solutions/722. Remove Comments/722.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def removeComments(self, source: list[str]) -> list[str]:
+  def removeComments(self, source: List[str]) -> List[str]:
     ans = []
     commenting = False
     modified = ''
diff --git a/solutions/724. Find Pivot Index/724.py b/solutions/724. Find Pivot Index/724.py
index 0f5c8b2e96f..b2eb4187001 100644
--- a/solutions/724. Find Pivot Index/724.py	
+++ b/solutions/724. Find Pivot Index/724.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def pivotIndex(self, nums: list[int]) -> int:
+  def pivotIndex(self, nums: List[int]) -> int:
     summ = sum(nums)
     prefix = 0
 
diff --git a/solutions/725. Split Linked List in Parts/725.py b/solutions/725. Split Linked List in Parts/725.py
index ee22d5c4ebf..a48ac852163 100644
--- a/solutions/725. Split Linked List in Parts/725.py	
+++ b/solutions/725. Split Linked List in Parts/725.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def splitListToParts(self, root: ListNode, k: int) -> list[ListNode]:
+  def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]:
     ans = [[] for _ in range(k)]
     length = 0
     curr = root
diff --git a/solutions/728. Self Dividing Numbers/728.py b/solutions/728. Self Dividing Numbers/728.py
index 36e57cf489c..897d3814875 100644
--- a/solutions/728. Self Dividing Numbers/728.py	
+++ b/solutions/728. Self Dividing Numbers/728.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def selfDividingNumbers(self, left: int, right: int) -> list[int]:
+  def selfDividingNumbers(self, left: int, right: int) -> List[int]:
     return [num for num in range(left, right + 1) if all(n != 0 and num % n == 0 for n in map(int, str(num)))]
diff --git a/solutions/729. My Calendar I/729-2.cpp b/solutions/729. My Calendar I/729-2.cpp
index 126e3ba9735..5b59c046499 100644
--- a/solutions/729. My Calendar I/729-2.cpp	
+++ b/solutions/729. My Calendar I/729-2.cpp	
@@ -1,10 +1,10 @@
 class MyCalendar {
  public:
   bool book(int start, int end) {
-    auto lo = line.lower_bound(end);
+    auto lo = timeline.lower_bound(end);
 
-    if (lo == line.begin() || (--lo)->second <= start) {
-      line[start] = end;
+    if (lo == timeline.begin() || (--lo)->second <= start) {
+      timeline[start] = end;
       return true;
     }
 
@@ -12,5 +12,5 @@ class MyCalendar {
   }
 
  private:
-  map<int, int> line;
+  map<int, int> timeline;
 };
diff --git a/solutions/729. My Calendar I/729-2.java b/solutions/729. My Calendar I/729-2.java
index 9a3f4278cde..d56a419fad2 100644
--- a/solutions/729. My Calendar I/729-2.java	
+++ b/solutions/729. My Calendar I/729-2.java	
@@ -1,14 +1,14 @@
 class MyCalendar {
   public boolean book(int start, int end) {
-    Integer low = line.lowerKey(end);
+    Integer low = timeline.lowerKey(end);
 
-    if (low == null || line.get(low) <= start) {
-      line.put(start, end);
+    if (low == null || timeline.get(low) <= start) {
+      timeline.put(start, end);
       return true;
     }
 
     return false;
   }
 
-  private TreeMap<Integer, Integer> line = new TreeMap<>();
+  private TreeMap<Integer, Integer> timeline = new TreeMap<>();
 }
diff --git a/solutions/729. My Calendar I/729-3.py b/solutions/729. My Calendar I/729-3.py
index a3cf444e7d6..ca92c8d1715 100644
--- a/solutions/729. My Calendar I/729-3.py	
+++ b/solutions/729. My Calendar I/729-3.py	
@@ -1,12 +1,9 @@
-from dataclasses import dataclass
-
-
-@dataclass
 class Node:
-  start: int
-  end: int
-  left = None
-  right = None
+  def __init__(self, start: int, end: int):
+    self.start = start
+    self.end = end
+    self.left = None
+    self.right = None
 
 
 class Tree:
diff --git a/solutions/729. My Calendar I/729.cpp b/solutions/729. My Calendar I/729.cpp
index 1b50cb0f9ee..38096b7bcb9 100644
--- a/solutions/729. My Calendar I/729.cpp	
+++ b/solutions/729. My Calendar I/729.cpp	
@@ -1,13 +1,13 @@
 class MyCalendar {
  public:
-  bool book(int startTime, int endTime) {
-    for (const auto& [s, e] : line)
-      if (max(startTime, s) < min(endTime, e))
+  bool book(int start, int end) {
+    for (const auto& [s, e] : timeline)
+      if (max(start, s) < min(end, e))
         return false;
-    line.emplace_back(startTime, endTime);
+    timeline.emplace_back(start, end);
     return true;
   }
 
  private:
-  vector<pair<int, int>> line;
+  vector<pair<int, int>> timeline;
 };
diff --git a/solutions/729. My Calendar I/729.java b/solutions/729. My Calendar I/729.java
index b759ff6a81e..c27c88da53a 100644
--- a/solutions/729. My Calendar I/729.java	
+++ b/solutions/729. My Calendar I/729.java	
@@ -1,11 +1,11 @@
 class MyCalendar {
-  public boolean book(int startTime, int endTime) {
-    for (int[] t : line)
-      if (Math.max(t[0], startTime) < Math.min(t[1], endTime))
+  public boolean book(int start, int end) {
+    for (int[] t : timeline)
+      if (Math.max(t[0], start) < Math.min(t[1], end))
         return false;
-    line.add(new int[] {start, end});
+    timeline.add(new int[] {start, end});
     return true;
   }
 
-  private List<int[]> line = new ArrayList<>();
+  private List<int[]> timeline = new ArrayList<>();
 }
diff --git a/solutions/729. My Calendar I/729.py b/solutions/729. My Calendar I/729.py
index b19ae1860d0..323e79c2ced 100644
--- a/solutions/729. My Calendar I/729.py	
+++ b/solutions/729. My Calendar I/729.py	
@@ -1,10 +1,10 @@
 class MyCalendar:
   def __init__(self):
-    self.line = []
+    self.timeline = []
 
-  def book(self, startTime: int, endTime: int) -> bool:
-    for s, e in self.line:
-      if max(startTime, s) < min(endTime, e):
+  def book(self, start: int, end: int) -> bool:
+    for s, e in self.timeline:
+      if max(start, s) < min(end, e):
         return False
-    self.line.append((startTime, endTime))
+    self.timeline.append((start, end))
     return True
diff --git a/solutions/73. Set Matrix Zeroes/73.py b/solutions/73. Set Matrix Zeroes/73.py
index ec4d214cfc2..1bee92672fe 100644
--- a/solutions/73. Set Matrix Zeroes/73.py	
+++ b/solutions/73. Set Matrix Zeroes/73.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def setZeroes(self, matrix: list[list[int]]) -> None:
+  def setZeroes(self, matrix: List[List[int]]) -> None:
     m = len(matrix)
     n = len(matrix[0])
     shouldFillFirstRow = 0 in matrix[0]
diff --git a/solutions/730. Count Different Palindromic Subsequences/730.java b/solutions/730. Count Different Palindromic Subsequences/730.java
index 79966ac3716..286d25beb90 100644
--- a/solutions/730. Count Different Palindromic Subsequences/730.java	
+++ b/solutions/730. Count Different Palindromic Subsequences/730.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int countPalindromicSubsequences(String s) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = s.length();
     // dp[i][j] := the number of different non-empty palindromic subsequences in
     // s[i..j]
@@ -28,7 +28,7 @@ else if (lo == hi)
         } else {
           dp[i][j] = dp[i][j - 1] + dp[i + 1][j] - dp[i + 1][j - 1];
         }
-        dp[i][j] = (int) ((dp[i][j] + MOD) % MOD);
+        dp[i][j] = (int) ((dp[i][j] + kMod) % kMod);
       }
 
     return dp[0][n - 1];
diff --git a/solutions/730. Count Different Palindromic Subsequences/730.py b/solutions/730. Count Different Palindromic Subsequences/730.py
index 39648bf65bc..d8bfcabe9b1 100644
--- a/solutions/730. Count Different Palindromic Subsequences/730.py	
+++ b/solutions/730. Count Different Palindromic Subsequences/730.py	
@@ -1,6 +1,6 @@
 class Solution:
   def countPalindromicSubsequences(self, s: str) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     n = len(s)
     # dp[i][j] := the number of different non-empty palindromic subsequences in
     # s[i..j]
@@ -27,6 +27,6 @@ def countPalindromicSubsequences(self, s: str) -> int:
             dp[i][j] = dp[i + 1][j - 1] * 2 - dp[lo + 1][hi - 1]
         else:
           dp[i][j] = dp[i][j - 1] + dp[i + 1][j] - dp[i + 1][j - 1]
-        dp[i][j] = (dp[i][j] + MOD) % MOD
+        dp[i][j] = (dp[i][j] + kMod) % kMod
 
     return dp[0][n - 1]
diff --git a/solutions/731. My Calendar II/731-2.cpp b/solutions/731. My Calendar II/731-2.cpp
index 78499ed5e30..5fa58e9fe12 100644
--- a/solutions/731. My Calendar II/731-2.cpp	
+++ b/solutions/731. My Calendar II/731-2.cpp	
@@ -1,18 +1,18 @@
 class MyCalendarTwo {
  public:
   bool book(int start, int end) {
-    ++line[start];
-    --line[end];
+    ++timeline[start];
+    --timeline[end];
 
     int activeEvents = 0;
 
-    for (const auto& [_, count] : line) {
+    for (const auto& [_, count] : timeline) {
       activeEvents += count;
       if (activeEvents > 2) {
-        if (--line[start] == 0)
-          line.erase(start);
-        if (++line[end] == 0)
-          line.erase(end);
+        if (--timeline[start] == 0)
+          timeline.erase(start);
+        if (++timeline[end] == 0)
+          timeline.erase(end);
         return false;
       }
     }
@@ -21,5 +21,5 @@ class MyCalendarTwo {
   }
 
  private:
-  map<int, int> line;
+  map<int, int> timeline;
 };
diff --git a/solutions/731. My Calendar II/731-2.java b/solutions/731. My Calendar II/731-2.java
index dab4c9589fa..607b47334d3 100644
--- a/solutions/731. My Calendar II/731-2.java	
+++ b/solutions/731. My Calendar II/731-2.java	
@@ -1,17 +1,17 @@
 class MyCalendarTwo {
   public boolean book(int start, int end) {
-    line.merge(start, 1, Integer::sum);
-    line.merge(end, -1, Integer::sum);
+    timeline.merge(start, 1, Integer::sum);
+    timeline.merge(end, -1, Integer::sum);
 
     int activeEvents = 0;
 
-    for (final int count : line.values()) {
+    for (final int count : timeline.values()) {
       activeEvents += count;
       if (activeEvents > 2) {
-        if (line.merge(start, -1, Integer::sum) == 0)
-          line.remove(start);
-        if (line.merge(end, 1, Integer::sum) == 0)
-          line.remove(end);
+        if (timeline.merge(start, -1, Integer::sum) == 0)
+          timeline.remove(start);
+        if (timeline.merge(end, 1, Integer::sum) == 0)
+          timeline.remove(end);
         return false;
       }
     }
@@ -19,5 +19,5 @@ public boolean book(int start, int end) {
     return true;
   }
 
-  private Map<Integer, Integer> line = new TreeMap<>();
+  private Map<Integer, Integer> timeline = new TreeMap<>();
 }
diff --git a/solutions/732. My Calendar III/732.cpp b/solutions/732. My Calendar III/732.cpp
index c5fdd41340a..dc5947c9f05 100644
--- a/solutions/732. My Calendar III/732.cpp	
+++ b/solutions/732. My Calendar III/732.cpp	
@@ -1,13 +1,13 @@
 class MyCalendarThree {
  public:
   int book(int start, int end) {
-    ++line[start];
-    --line[end];
+    ++timeline[start];
+    --timeline[end];
 
     int ans = 0;
     int activeEvents = 0;
 
-    for (const auto& [_, count] : line) {
+    for (const auto& [_, count] : timeline) {
       activeEvents += count;
       ans = max(ans, activeEvents);
     }
@@ -16,5 +16,5 @@ class MyCalendarThree {
   }
 
  private:
-  map<int, int> line;
+  map<int, int> timeline;
 };
diff --git a/solutions/732. My Calendar III/732.java b/solutions/732. My Calendar III/732.java
index 6a624c01882..8f6e1f791f5 100644
--- a/solutions/732. My Calendar III/732.java	
+++ b/solutions/732. My Calendar III/732.java	
@@ -1,12 +1,12 @@
 class MyCalendarThree {
   public int book(int start, int end) {
-    line.merge(start, 1, Integer::sum);
-    line.merge(end, -1, Integer::sum);
+    timeline.merge(start, 1, Integer::sum);
+    timeline.merge(end, -1, Integer::sum);
 
     int ans = 0;
     int activeEvents = 0;
 
-    for (final int count : line.values()) {
+    for (final int count : timeline.values()) {
       activeEvents += count;
       ans = Math.max(ans, activeEvents);
     }
@@ -14,5 +14,5 @@ public int book(int start, int end) {
     return ans;
   }
 
-  private Map<Integer, Integer> line = new TreeMap<>();
+  private Map<Integer, Integer> timeline = new TreeMap<>();
 }
diff --git a/solutions/732. My Calendar III/732.py b/solutions/732. My Calendar III/732.py
index 5636de88bda..a8abf17a10b 100644
--- a/solutions/732. My Calendar III/732.py	
+++ b/solutions/732. My Calendar III/732.py	
@@ -3,16 +3,16 @@
 
 class MyCalendarThree:
   def __init__(self):
-    self.line = SortedDict()
+    self.timeline = SortedDict()
 
   def book(self, start: int, end: int) -> int:
-    self.line[start] = self.line.get(start, 0) + 1
-    self.line[end] = self.line.get(end, 0) - 1
+    self.timeline[start] = self.timeline.get(start, 0) + 1
+    self.timeline[end] = self.timeline.get(end, 0) - 1
 
     ans = 0
     activeEvents = 0
 
-    for count in self.line.values():
+    for count in self.timeline.values():
       activeEvents += count
       ans = max(ans, activeEvents)
 
diff --git a/solutions/733. Flood Fill/733.cpp b/solutions/733. Flood Fill/733.cpp
index 25c462a840f..cacc17d7e09 100644
--- a/solutions/733. Flood Fill/733.cpp	
+++ b/solutions/733. Flood Fill/733.cpp	
@@ -19,9 +19,9 @@ class Solution {
     image[i][j] = newColor;
     seen[i][j] = true;
 
-    dfs(image, i + 1, j, std::move(seen), startColor, newColor);
-    dfs(image, i - 1, j, std::move(seen), startColor, newColor);
-    dfs(image, i, j + 1, std::move(seen), startColor, newColor);
-    dfs(image, i, j - 1, std::move(seen), startColor, newColor);
+    dfs(image, i + 1, j, move(seen), startColor, newColor);
+    dfs(image, i - 1, j, move(seen), startColor, newColor);
+    dfs(image, i, j + 1, move(seen), startColor, newColor);
+    dfs(image, i, j - 1, move(seen), startColor, newColor);
   }
 };
diff --git a/solutions/733. Flood Fill/733.py b/solutions/733. Flood Fill/733.py
index 65c3f9997a0..2b4d7b4f9d6 100644
--- a/solutions/733. Flood Fill/733.py	
+++ b/solutions/733. Flood Fill/733.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def floodFill(self, image: list[list[int]],
-                sr: int, sc: int, newColor: int) -> list[list[int]]:
+  def floodFill(self, image: List[List[int]],
+                sr: int, sc: int, newColor: int) -> List[List[int]]:
     startColor = image[sr][sc]
     seen = set()
 
diff --git a/solutions/734. Sentence Similarity/734.py b/solutions/734. Sentence Similarity/734.py
index 27a62cc6d77..8750e5473a6 100644
--- a/solutions/734. Sentence Similarity/734.py	
+++ b/solutions/734. Sentence Similarity/734.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def areSentencesSimilar(
-      self,
-      sentence1: list[str],
-      sentence2: list[str],
-      similarPairs: list[list[str]],
-  ) -> bool:
+  def areSentencesSimilar(self, sentence1: List[str], sentence2: List[str], similarPairs: List[List[str]]) -> bool:
     if len(sentence1) != len(sentence2):
       return False
 
diff --git a/solutions/735. Asteroid Collision/735.py b/solutions/735. Asteroid Collision/735.py
index e21a285a1c1..f56e17837f1 100644
--- a/solutions/735. Asteroid Collision/735.py	
+++ b/solutions/735. Asteroid Collision/735.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def asteroidCollision(self, asteroids: list[int]) -> list[int]:
+  def asteroidCollision(self, asteroids: List[int]) -> List[int]:
     stack = []
 
     for a in asteroids:
diff --git a/solutions/737. Sentence Similarity II/737.cpp b/solutions/737. Sentence Similarity II/737.cpp
index ff7f803e37a..8eb20d0fd1a 100644
--- a/solutions/737. Sentence Similarity II/737.cpp	
+++ b/solutions/737. Sentence Similarity II/737.cpp	
@@ -37,7 +37,7 @@ class Solution {
     for (const string& child : graph.at(source)) {
       if (seen.contains(child))
         continue;
-      if (dfs(graph, child, target, std::move(seen)))
+      if (dfs(graph, child, target, move(seen)))
         return true;
     }
 
diff --git a/solutions/737. Sentence Similarity II/737.py b/solutions/737. Sentence Similarity II/737.py
index 7b93223fead..25d20214f5a 100644
--- a/solutions/737. Sentence Similarity II/737.py	
+++ b/solutions/737. Sentence Similarity II/737.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def areSentencesSimilarTwo(
-      self,
-      words1: list[str],
-      words2: list[str],
-      pairs: list[list[str]],
-  ) -> bool:
+  def areSentencesSimilarTwo(self, words1: List[str], words2: List[str], pairs: List[List[str]]) -> bool:
     if len(words1) != len(words2):
       return False
 
diff --git a/solutions/739. Daily Temperatures/739.py b/solutions/739. Daily Temperatures/739.py
index b6d7b9792bc..dfda41c622f 100644
--- a/solutions/739. Daily Temperatures/739.py	
+++ b/solutions/739. Daily Temperatures/739.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def dailyTemperatures(self, temperatures: list[int]) -> list[int]:
+  def dailyTemperatures(self, temperatures: List[int]) -> List[int]:
     ans = [0] * len(temperatures)
     stack = []  # a decreasing stack
 
diff --git a/solutions/74. Search a 2D Matrix/74.py b/solutions/74. Search a 2D Matrix/74.py
index 2e02bc279a1..80a6fabcd1e 100644
--- a/solutions/74. Search a 2D Matrix/74.py	
+++ b/solutions/74. Search a 2D Matrix/74.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def searchMatrix(self, matrix: list[list[int]], target: int) -> bool:
+  def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
     if not matrix:
       return False
 
diff --git a/solutions/741. Cherry Pickup/741-2.java b/solutions/741. Cherry Pickup/741-2.java
index 17565498898..33b955477e7 100644
--- a/solutions/741. Cherry Pickup/741-2.java	
+++ b/solutions/741. Cherry Pickup/741-2.java	
@@ -1,11 +1,13 @@
 class Solution {
   public int cherryPickup(int[][] grid) {
     final int n = grid.length;
+
     // dp[x1][y1][x2] := the maximum cherries we could pick from
     // g[0][0] -> g[x1 - 1][y1 - 1] + g[0][0] -> g[x2 - 1][y2 - 1],
     // where y2 = x1 + y1 - x2 (reducing states from 4 to 3)
     int[][][] dp = new int[n + 1][n + 1][n + 1];
-    Arrays.stream(dp).forEach(A -> Arrays.stream(A).forEach(B -> Arrays.fill(B, -1)));
+    for (int[][] A : dp)
+      Arrays.stream(A).forEach(a -> Arrays.fill(a, -1));
     dp[1][1][1] = grid[0][0];
 
     for (int x1 = 1; x1 <= n; ++x1)
diff --git a/solutions/743. Network Delay Time/743.cpp b/solutions/743. Network Delay Time/743.cpp
index 3d4c14cdb0c..bfde2e4bb3d 100644
--- a/solutions/743. Network Delay Time/743.cpp	
+++ b/solutions/743. Network Delay Time/743.cpp	
@@ -16,10 +16,10 @@ class Solution {
  private:
   int dijkstra(const vector<vector<pair<int, int>>>& graph, int src) {
     vector<int> dist(graph.size(), INT_MAX);
-
-    dist[src] = 0;
     using P = pair<int, int>;  // (d, u)
     priority_queue<P, vector<P>, greater<>> minHeap;
+
+    dist[src] = 0;
     minHeap.emplace(dist[src], src);
 
     while (!minHeap.empty()) {
diff --git a/solutions/743. Network Delay Time/743.java b/solutions/743. Network Delay Time/743.java
index e4b4dadaa60..6818756a1f7 100644
--- a/solutions/743. Network Delay Time/743.java	
+++ b/solutions/743. Network Delay Time/743.java	
@@ -18,12 +18,11 @@ public int networkDelayTime(int[][] times, int n, int k) {
   private int dijkstra(List<Pair<Integer, Integer>>[] graph, int src) {
     int[] dist = new int[graph.length];
     Arrays.fill(dist, Integer.MAX_VALUE);
+    // (d, u)
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
 
     dist[src] = 0;
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey)) {
-          { offer(new Pair<>(dist[src], src)); } // (d, u)
-        };
+    minHeap.offer(new Pair<>(dist[src], src));
 
     while (!minHeap.isEmpty()) {
       final int d = minHeap.peek().getKey();
diff --git a/solutions/743. Network Delay Time/743.py b/solutions/743. Network Delay Time/743.py
index deb0a8966fa..f21b26aa479 100644
--- a/solutions/743. Network Delay Time/743.py	
+++ b/solutions/743. Network Delay Time/743.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def networkDelayTime(self, times: list[list[int]], n: int, k: int) -> int:
+  def networkDelayTime(self, times: List[List[int]], n: int, k: int) -> int:
     graph = [[] for _ in range(n)]
 
     for u, v, w in times:
@@ -7,7 +7,7 @@ def networkDelayTime(self, times: list[list[int]], n: int, k: int) -> int:
 
     return self._dijkstra(graph, k - 1)
 
-  def _dijkstra(self, graph: list[list[tuple[int, int]]], src: int) -> int:
+  def _dijkstra(self, graph: List[List[Tuple[int, int]]], src: int) -> int:
     dist = [math.inf] * len(graph)
 
     dist[src] = 0
diff --git a/solutions/744. Find Smallest Letter Greater Than Target/744.py b/solutions/744. Find Smallest Letter Greater Than Target/744.py
index 48faae712e6..06fb1e94a56 100644
--- a/solutions/744. Find Smallest Letter Greater Than Target/744.py	
+++ b/solutions/744. Find Smallest Letter Greater Than Target/744.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def nextGreatestLetter(self, letters: list[str], target: str) -> str:
+  def nextGreatestLetter(self, letters: List[str], target: str) -> str:
     l = bisect.bisect_right(range(len(letters)), target,
                             key=lambda m: letters[m])
     return letters[l % len(letters)]
diff --git a/solutions/746. Min Cost Climbing Stairs/746.py b/solutions/746. Min Cost Climbing Stairs/746.py
index a5efee81f39..8ca6afd34b5 100644
--- a/solutions/746. Min Cost Climbing Stairs/746.py	
+++ b/solutions/746. Min Cost Climbing Stairs/746.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minCostClimbingStairs(self, cost: list[int]) -> int:
+  def minCostClimbingStairs(self, cost: List[int]) -> int:
     cost.append(0)
 
     for i in range(2, len(cost)):
diff --git a/solutions/747. Largest Number At Least Twice of Others/747.py b/solutions/747. Largest Number At Least Twice of Others/747.py
index e992a5c6c80..a2d1de9bbd2 100644
--- a/solutions/747. Largest Number At Least Twice of Others/747.py	
+++ b/solutions/747. Largest Number At Least Twice of Others/747.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def dominantIndex(self, nums: list[int]) -> int:
+  def dominantIndex(self, nums: List[int]) -> int:
     mx = 0
     secondMax = 0
 
diff --git a/solutions/748. Shortest Completing Word/748.py b/solutions/748. Shortest Completing Word/748.py
index 5b7ffdb4a3e..5e563450f45 100644
--- a/solutions/748. Shortest Completing Word/748.py	
+++ b/solutions/748. Shortest Completing Word/748.py	
@@ -1,9 +1,8 @@
 class Solution:
-  def shortestCompletingWord(self, licensePlate: str, words: list[str]) -> str:
+  def shortestCompletingWord(self, licensePlate: str, words: List[str]) -> str:
     def isMatch(word: str) -> bool:
       wordCount = collections.Counter(word)
-      return False if any(
-          wordCount[i] < count[i] for i in string.ascii_letters) else True
+      return False if any(wordCount[i] < count[i] for i in string.ascii_letters) else True
 
     ans = '*' * 16
     count = collections.defaultdict(int)
diff --git a/solutions/749. Contain Virus/749.cpp b/solutions/749. Contain Virus/749.cpp
index 295dfea7737..51bf063c9a1 100644
--- a/solutions/749. Contain Virus/749.cpp	
+++ b/solutions/749. Contain Virus/749.cpp	
@@ -32,8 +32,8 @@ class Solution {
 
       // Regions that infect the most neighbors will be sorted to the back of
       // the array.
-      ranges::sort(regions, ranges::less{}, [](const Region& region) {
-        return region.noninfected.size();
+      ranges::sort(regions, [](const Region& a, const Region& b) {
+        return a.noninfected.size() < b.noninfected.size();
       });
 
       // Build walls around the region that infects the most neighbors.
diff --git a/solutions/749. Contain Virus/749.java b/solutions/749. Contain Virus/749.java
index 5b870197545..c7e49d9225e 100644
--- a/solutions/749. Contain Virus/749.java	
+++ b/solutions/749. Contain Virus/749.java	
@@ -4,7 +4,7 @@ class Region {
   public Set<Integer> infected = new HashSet<>();
   public Set<Integer> noninfected = new HashSet<>();
   public int wallsRequired = 0;
-}
+};
 
 class Solution {
   public int containVirus(int[][] isInfected) {
diff --git a/solutions/75. Sort Colors/75-2.py b/solutions/75. Sort Colors/75-2.py
index 9b14fdd7885..2606e35d2aa 100644
--- a/solutions/75. Sort Colors/75-2.py	
+++ b/solutions/75. Sort Colors/75-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sortColors(self, nums: list[int]) -> None:
+  def sortColors(self, nums: List[int]) -> None:
     l = 0  # The next 0 should be placed in l.
     r = len(nums) - 1  # THe next 2 should be placed in r.
 
diff --git a/solutions/75. Sort Colors/75.py b/solutions/75. Sort Colors/75.py
index b0d2df8c717..ba1d7ea58af 100644
--- a/solutions/75. Sort Colors/75.py	
+++ b/solutions/75. Sort Colors/75.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sortColors(self, nums: list[int]) -> None:
+  def sortColors(self, nums: List[int]) -> None:
     zero = -1
     one = -1
     two = -1
diff --git a/solutions/751. IP to CIDR/751.py b/solutions/751. IP to CIDR/751.py
index 2ccfddf3c93..7e64434d197 100644
--- a/solutions/751. IP to CIDR/751.py	
+++ b/solutions/751. IP to CIDR/751.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def ipToCIDR(self, ip: str, n: int) -> list[str]:
+  def ipToCIDR(self, ip: str, n: int) -> List[str]:
     ans = []
     num = self._getNum(ip.split('.'))
 
@@ -12,13 +12,13 @@ def ipToCIDR(self, ip: str, n: int) -> list[str]:
 
     return ans
 
-  def _getNum(self, x: list[str]) -> int:
+  def _getNum(self, x: List[str]) -> int:
     num = 0
     for i in range(4):
       num = num * 256 + int(x[i])
     return num
 
-  def _maxLow(self, n: int) -> int | None:
+  def _maxLow(self, n: int) -> Optional[int]:
     """Returns the maximum i s.t. 2^i < n."""
     for i in range(32):
       if 1 << i + 1 > n:
@@ -39,7 +39,7 @@ def _getCIDR(self, num: int, prefix: int) -> str:
     a = num & 255
     return '.'.join([str(s) for s in [a, b, c, d]]) + '/' + str(prefix)
 
-  def _getPrefix(self, count: int) -> int | None:
+  def _getPrefix(self, count: int) -> Optional[int]:
     """
     e.g. count = 8 = 2^3 . prefix = 32 - 3 = 29
          count = 1 = 2^0 . prefix = 32 - 0 = 32
diff --git a/solutions/752. Open the Lock/752.cpp b/solutions/752. Open the Lock/752.cpp
index ec855abf8d0..78f5676be2f 100644
--- a/solutions/752. Open the Lock/752.cpp	
+++ b/solutions/752. Open the Lock/752.cpp	
@@ -7,9 +7,11 @@ class Solution {
     if (target == "0000")
       return 0;
 
+    int ans = 0;
     queue<string> q{{"0000"}};
 
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         string word = q.front();
         q.pop();
@@ -18,7 +20,7 @@ class Solution {
           // Increase the i-th digit by 1.
           word[i] = word[i] == '9' ? '0' : word[i] + 1;
           if (word == target)
-            return step;
+            return ans;
           if (!seen.contains(word)) {
             q.push(word);
             seen.insert(word);
@@ -27,7 +29,7 @@ class Solution {
           // Decrease the i-th digit by 1.
           word[i] = word[i] == '0' ? '9' : word[i] - 1;
           if (word == target)
-            return step;
+            return ans;
           if (!seen.contains(word)) {
             q.push(word);
             seen.insert(word);
@@ -35,6 +37,7 @@ class Solution {
           word[i] = cache;
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/752. Open the Lock/752.java b/solutions/752. Open the Lock/752.java
index 6f60b6aa41f..36de801e1e3 100644
--- a/solutions/752. Open the Lock/752.java	
+++ b/solutions/752. Open the Lock/752.java	
@@ -6,9 +6,11 @@ public int openLock(String[] deadends, String target) {
     if (target.equals("0000"))
       return 0;
 
-    Queue<String> q = new ArrayDeque<>(List.of("0000"));
+    int ans = 0;
+    Queue<String> q = new ArrayDeque<>(Arrays.asList("0000"));
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         StringBuilder sb = new StringBuilder(q.poll());
         for (int i = 0; i < 4; ++i) {
@@ -17,7 +19,7 @@ public int openLock(String[] deadends, String target) {
           sb.setCharAt(i, sb.charAt(i) == '9' ? '0' : (char) (sb.charAt(i) + 1));
           String word = sb.toString();
           if (word.equals(target))
-            return step;
+            return ans;
           if (!seen.contains(word)) {
             q.offer(word);
             seen.add(word);
@@ -27,7 +29,7 @@ public int openLock(String[] deadends, String target) {
           sb.setCharAt(i, sb.charAt(i) == '0' ? '9' : (char) (sb.charAt(i) - 1));
           word = sb.toString();
           if (word.equals(target))
-            return step;
+            return ans;
           if (!seen.contains(word)) {
             q.offer(word);
             seen.add(word);
@@ -35,6 +37,7 @@ public int openLock(String[] deadends, String target) {
           sb.setCharAt(i, cache);
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/753. Cracking the Safe/753.cpp b/solutions/753. Cracking the Safe/753.cpp
index 6a3829644d6..ebd62f99505 100644
--- a/solutions/753. Cracking the Safe/753.cpp	
+++ b/solutions/753. Cracking the Safe/753.cpp	
@@ -19,7 +19,7 @@ class Solution {
       if (!seen.contains(prefix)) {
         seen.insert(prefix);
         path.push_back(c);
-        if (dfs(passwordSize, n, k, std::move(seen), path))
+        if (dfs(passwordSize, n, k, move(seen), path))
           return true;
         path.pop_back();
         seen.erase(prefix);
diff --git a/solutions/755. Pour Water/755.py b/solutions/755. Pour Water/755.py
index afc384460ab..ded1e66ef7d 100644
--- a/solutions/755. Pour Water/755.py	
+++ b/solutions/755. Pour Water/755.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def pourWater(self, heights: list[int], volume: int, k: int) -> list[int]:
+  def pourWater(self, heights: List[int], volume: int, k: int) -> List[int]:
     i = k
 
     while volume > 0:
diff --git a/solutions/756. Pyramid Transition Matrix/756.py b/solutions/756. Pyramid Transition Matrix/756.py
index a657b27b939..4389bc4668b 100644
--- a/solutions/756. Pyramid Transition Matrix/756.py	
+++ b/solutions/756. Pyramid Transition Matrix/756.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def pyramidTransition(self, bottom: str, allowed: list[str]) -> bool:
+  def pyramidTransition(self, bottom: str, allowed: List[str]) -> bool:
     prefixToBlocks = collections.defaultdict(list)
 
     for a in allowed:
diff --git a/solutions/757. Set Intersection Size At Least Two/757.cpp b/solutions/757. Set Intersection Size At Least Two/757.cpp
index e284c4ab869..208bb0327c9 100644
--- a/solutions/757. Set Intersection Size At Least Two/757.cpp	
+++ b/solutions/757. Set Intersection Size At Least Two/757.cpp	
@@ -5,27 +5,23 @@ class Solution {
     int mx = -1;
     int secondMax = -1;
 
-    ranges::sort(intervals, ranges::less{}, [](const vector<int>& interval) {
-      const int start = interval[0];
-      const int end = interval[1];
-      return pair<int, int>{end, -start};
+    ranges::sort(intervals, [](const vector<int>& a, const vector<int>& b) {
+      return a[1] == b[1] ? a[0] > b[0] : a[1] < b[1];
     });
 
     for (const vector<int>& interval : intervals) {
-      const int start = interval[0];
-      const int end = interval[1];
+      const int a = interval[0];
+      const int b = interval[1];
       // The maximum and the second maximum still satisfy.
-      if (mx >= start && secondMax >= start)
+      if (mx >= a && secondMax >= a)
         continue;
-      if (mx >= start) {
-        // The maximum still satisfy.
+      if (mx >= a) {  // The maximum still satisfy.
         secondMax = mx;
-        mx = end;  // Add `end` to the set.
+        mx = b;  // Add b to the set S.
         ans += 1;
-      } else {
-        // The maximum and the second maximum can't satisfy.
-        mx = end;             // Add `end` to the set.
-        secondMax = end - 1;  // Add `end - 1` to the set.
+      } else {              // The maximum and the second maximum can't satisfy.
+        mx = b;             // Add b to the set S.
+        secondMax = b - 1;  // Add b - 1 to the set S.
         ans += 2;
       }
     }
diff --git a/solutions/757. Set Intersection Size At Least Two/757.java b/solutions/757. Set Intersection Size At Least Two/757.java
index 0d0b7bfdb92..cffb459668d 100644
--- a/solutions/757. Set Intersection Size At Least Two/757.java	
+++ b/solutions/757. Set Intersection Size At Least Two/757.java	
@@ -4,24 +4,21 @@ public int intersectionSizeTwo(int[][] intervals) {
     int mx = -1;
     int secondMax = -1;
 
-    Arrays.sort(intervals, Comparator.comparingInt((int[] interval) -> interval[1])
-                               .thenComparingInt((int[] interval) -> - interval[0]));
+    Arrays.sort(intervals, (a, b) -> a[1] == b[1] ? b[0] - a[0] : a[1] - b[1]);
 
     for (int[] interval : intervals) {
-      final int start = interval[0];
-      final int end = interval[1];
+      final int a = interval[0];
+      final int b = interval[1];
       // The maximum and the second maximum still satisfy.
-      if (mx >= start && secondMax >= start)
+      if (mx >= a && secondMax >= a)
         continue;
-      if (mx >= start) {
-        // The maximum still satisfy.
+      if (mx >= a) { // The maximum still satisfy.
         secondMax = mx;
-        mx = end; // Add `end` to the set.
+        mx = b; // Add b to the set S.
         ans += 1;
-      } else {
-        // The maximum and the second maximum can't satisfy.
-        mx = end;            // Add `end` to the set.
-        secondMax = end - 1; // Add `end - 1` to the set.
+      } else {             // The maximum and the second maximum can't satisfy.
+        mx = b;            // Add b to the set S.
+        secondMax = b - 1; // Add b - 1 to the set S.
         ans += 2;
       }
     }
diff --git a/solutions/758. Bold Words in String/758-2.py b/solutions/758. Bold Words in String/758-2.py
index 83e42057e5f..d062221b5fc 100644
--- a/solutions/758. Bold Words in String/758-2.py	
+++ b/solutions/758. Bold Words in String/758-2.py	
@@ -1,11 +1,11 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
     self.isWord = False
 
 
 class Solution:
-  def boldWords(self, words: list[str], s: str) -> str:
+  def boldWords(self, words: List[str], s: str) -> str:
     n = len(s)
     ans = []
     # bold[i] := True if s[i] should be bolded
diff --git a/solutions/758. Bold Words in String/758.py b/solutions/758. Bold Words in String/758.py
index 5dc4b838b9f..ac88413cd98 100644
--- a/solutions/758. Bold Words in String/758.py	
+++ b/solutions/758. Bold Words in String/758.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def boldWords(self, words: list[str], s: str) -> str:
+  def boldWords(self, words: List[str], s: str) -> str:
     n = len(s)
     ans = []
     # bold[i] := True if s[i] should be bolded
diff --git a/solutions/759. Employee Free Time/759.cpp b/solutions/759. Employee Free Time/759.cpp
index b7a96cc9db2..e190b1cfd6d 100644
--- a/solutions/759. Employee Free Time/759.cpp	
+++ b/solutions/759. Employee Free Time/759.cpp	
@@ -7,8 +7,9 @@ class Solution {
     for (const vector<Interval>& s : schedule)
       intervals.insert(intervals.end(), s.begin(), s.end());
 
-    ranges::sort(intervals, ranges::less{},
-                 [](const Interval& interval) { return interval.start; });
+    ranges::sort(intervals, [](const auto& a, const auto& b) {
+      return a.start < b.start;
+    });
 
     int prevEnd = intervals[0].end;
 
diff --git a/solutions/759. Employee Free Time/759.java b/solutions/759. Employee Free Time/759.java
index 1d1ed413d63..fca4f0ae5eb 100644
--- a/solutions/759. Employee Free Time/759.java	
+++ b/solutions/759. Employee Free Time/759.java	
@@ -4,7 +4,7 @@ public List<Interval> employeeFreeTime(List<List<Interval>> schedule) {
     List<Interval> intervals = new ArrayList<>();
 
     schedule.forEach(s -> intervals.addAll(s));
-    Collections.sort(intervals, Comparator.comparingInt(interval -> interval.start));
+    Collections.sort(intervals, (a, b) -> a.start - b.start);
 
     int prevEnd = intervals.get(0).end;
 
diff --git a/solutions/760. Find Anagram Mappings/760.py b/solutions/760. Find Anagram Mappings/760.py
index 73dab2d0828..f43f9d3a613 100644
--- a/solutions/760. Find Anagram Mappings/760.py	
+++ b/solutions/760. Find Anagram Mappings/760.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def anagramMappings(self, nums1: list[int], nums2: list[int]) -> list[int]:
+  def anagramMappings(self, nums1: List[int], nums2: List[int]) -> List[int]:
     numToIndices = collections.defaultdict(list)
 
     for i, num in enumerate(nums2):
diff --git a/solutions/763. Partition Labels/763.py b/solutions/763. Partition Labels/763.py
index 116ad9e85a4..48f1a27ce6d 100644
--- a/solutions/763. Partition Labels/763.py	
+++ b/solutions/763. Partition Labels/763.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def partitionLabels(self, s: str) -> list[int]:
+  def partitionLabels(self, s: str) -> List[int]:
     ans = []
     letterToRightmostIndex = {c: i for i, c in enumerate(s)}
 
diff --git a/solutions/764. Largest Plus Sign/764.java b/solutions/764. Largest Plus Sign/764.java
index b532a2ce597..28a54e00960 100644
--- a/solutions/764. Largest Plus Sign/764.java	
+++ b/solutions/764. Largest Plus Sign/764.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int orderOfLargestPlusSign(int n, int[][] mines) {
     int[][] grid = new int[n][n];
-    Arrays.stream(grid).forEach(A -> Arrays.fill(A, n));
+    Arrays.stream(grid).forEach(row -> Arrays.fill(row, n));
 
     for (int[] mine : mines)
       grid[mine[0]][mine[1]] = 0;
diff --git a/solutions/766. Toeplitz Matrix/766.py b/solutions/766. Toeplitz Matrix/766.py
index a06fa9cb1fa..6ab07441513 100644
--- a/solutions/766. Toeplitz Matrix/766.py	
+++ b/solutions/766. Toeplitz Matrix/766.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isToeplitzMatrix(self, matrix: list[list[int]]) -> bool:
+  def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool:
     for i in range(len(matrix) - 1):
       for j in range(len(matrix[0]) - 1):
         if matrix[i][j] != matrix[i + 1][j + 1]:
diff --git a/solutions/767. Reorganize String/767.java b/solutions/767. Reorganize String/767.java
index 7f0cd0db48b..a9c39355f1d 100644
--- a/solutions/767. Reorganize String/767.java	
+++ b/solutions/767. Reorganize String/767.java	
@@ -12,7 +12,7 @@ public String reorganizeString(String s) {
     StringBuilder sb = new StringBuilder();
     // (freq, c)
     Queue<Pair<Integer, Character>> maxHeap =
-        new PriorityQueue<>(Comparator.comparing(Pair::getKey, Comparator.reverseOrder()));
+        new PriorityQueue<>((a, b) -> b.getKey() - a.getKey());
     int prevFreq = 0;
     char prevChar = '@';
 
diff --git a/solutions/768. Max Chunks To Make Sorted II/768.py b/solutions/768. Max Chunks To Make Sorted II/768.py
index e786788003c..56b52c6efeb 100644
--- a/solutions/768. Max Chunks To Make Sorted II/768.py	
+++ b/solutions/768. Max Chunks To Make Sorted II/768.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxChunksToSorted(self, arr: list[int]) -> int:
+  def maxChunksToSorted(self, arr: List[int]) -> int:
     n = len(arr)
     ans = 0
     mx = -math.inf
diff --git a/solutions/769. Max Chunks To Make Sorted/769.py b/solutions/769. Max Chunks To Make Sorted/769.py
index 14062c09a19..dff2a620540 100644
--- a/solutions/769. Max Chunks To Make Sorted/769.py	
+++ b/solutions/769. Max Chunks To Make Sorted/769.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxChunksToSorted(self, arr: list[int]) -> int:
+  def maxChunksToSorted(self, arr: List[int]) -> int:
     ans = 0
     mx = -math.inf
 
diff --git a/solutions/77. Combinations/77.cpp b/solutions/77. Combinations/77.cpp
index a1ca980282f..fc90f5ece3e 100644
--- a/solutions/77. Combinations/77.cpp	
+++ b/solutions/77. Combinations/77.cpp	
@@ -15,7 +15,7 @@ class Solution {
 
     for (int i = s; i <= n; ++i) {
       path.push_back(i);
-      dfs(n, k, i + 1, std::move(path), ans);
+      dfs(n, k, i + 1, move(path), ans);
       path.pop_back();
     }
   }
diff --git a/solutions/77. Combinations/77.py b/solutions/77. Combinations/77.py
index cc823f0dbdf..3c182388f9f 100644
--- a/solutions/77. Combinations/77.py	
+++ b/solutions/77. Combinations/77.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def combine(self, n: int, k: int) -> list[list[int]]:
+  def combine(self, n: int, k: int) -> List[List[int]]:
     ans = []
 
-    def dfs(s: int, path: list[int]) -> None:
+    def dfs(s: int, path: List[int]) -> None:
       if len(path) == k:
         ans.append(path.copy())
         return
diff --git a/solutions/770. Basic Calculator IV/770.py b/solutions/770. Basic Calculator IV/770.py
index 5e000096e37..fec4fb5eeec 100644
--- a/solutions/770. Basic Calculator IV/770.py	
+++ b/solutions/770. Basic Calculator IV/770.py	
@@ -28,7 +28,7 @@ def __mul__(self, other):
   #     res.append(term + ': ' + str(coef))
   #   return '{' + ', '.join(res) + '}'
 
-  def toList(self) -> list[str]:
+  def toList(self) -> List[str]:
     for term in list(self.terms.keys()):
       if not self.terms[term]:
         del self.terms[term]
@@ -72,12 +72,7 @@ def _merge(self, a: str, b: str) -> str:
 
 
 class Solution:
-  def basicCalculatorIV(
-      self,
-      expression: str,
-      evalvars: list[str],
-      evalints: list[int],
-  ) -> list[str]:
+  def basicCalculatorIV(self, expression: str, evalvars: List[str], evalints: List[int]) -> List[str]:
     tokens = list(self._getTokens(expression))
     evalMap = {a: b for a, b in zip(evalvars, evalints)}
 
@@ -103,7 +98,7 @@ def _getTokens(self, s: str) -> Iterator[str]:
     if i < len(s):
       yield s[i:]
 
-  def _infixToPostfix(self, tokens: list[str]) -> list[str]:
+  def _infixToPostfix(self, tokens: List[str]) -> List[str]:
     postfix = []
     ops = []
 
@@ -127,8 +122,8 @@ def precedes(prevOp: str, currOp: str) -> bool:
         postfix.append(token)
     return postfix + ops[::-1]
 
-  def _evaluate(self, postfix: list[str]) -> Poly:
-    polys: list[Poly] = []
+  def _evaluate(self, postfix: List[str]) -> Poly:
+    polys: List[Poly] = []
     for token in postfix:
       if token in '+-*':
         b = polys.pop()
diff --git a/solutions/772. Basic Calculator III/772.py b/solutions/772. Basic Calculator III/772.py
index b6ec370c426..82012c2b414 100644
--- a/solutions/772. Basic Calculator III/772.py	
+++ b/solutions/772. Basic Calculator III/772.py	
@@ -31,9 +31,9 @@ def precedes(prev: str, curr: str) -> bool:
     while i < len(s):
       c = s[i]
       if c.isdigit():
-        num = int(c)
+        num = ord(c) - ord('0')
         while i + 1 < len(s) and s[i + 1].isdigit():
-          num = num * 10 + int(s[i + 1])
+          num = num * 10 + (ord(s[i + 1]) - ord('0'))
           i += 1
         nums.append(num)
         hasPrevNum = True
diff --git a/solutions/773. Sliding Puzzle/773.cpp b/solutions/773. Sliding Puzzle/773.cpp
index ad225397d41..79a19d97e4f 100644
--- a/solutions/773. Sliding Puzzle/773.cpp	
+++ b/solutions/773. Sliding Puzzle/773.cpp	
@@ -1,10 +1,11 @@
 class Solution {
  public:
   int slidingPuzzle(vector<vector<int>>& board) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     constexpr int m = 2;
     constexpr int n = 3;
-    constexpr char goal[] = "123450";
+    const string goal = "123450";
+    int steps = 0;
     string start;
 
     // Hash the 2D vector into a string.
@@ -18,14 +19,15 @@ class Solution {
     queue<string> q{{start}};
     unordered_set<string> seen{start};
 
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++steps;
       for (int sz = q.size(); sz > 0; --sz) {
         string s = q.front();
         q.pop();
         const int zeroIndex = s.find('0');
         const int i = zeroIndex / n;
         const int j = zeroIndex % n;
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
@@ -33,7 +35,7 @@ class Solution {
           const int swappedIndex = x * n + y;
           swap(s[zeroIndex], s[swappedIndex]);
           if (s == goal)
-            return step;
+            return steps;
           if (!seen.contains(s)) {
             q.push(s);
             seen.insert(s);
@@ -41,6 +43,7 @@ class Solution {
           swap(s[zeroIndex], s[swappedIndex]);
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/773. Sliding Puzzle/773.java b/solutions/773. Sliding Puzzle/773.java
index 35375968bac..81013a8acd7 100644
--- a/solutions/773. Sliding Puzzle/773.java	
+++ b/solutions/773. Sliding Puzzle/773.java	
@@ -1,9 +1,10 @@
 class Solution {
   public int slidingPuzzle(int[][] board) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = 2;
     final int n = 3;
     final String goal = "123450";
+    int steps = 0;
     StringBuilder startSb = new StringBuilder();
 
     for (int i = 0; i < m; ++i)
@@ -11,19 +12,21 @@ public int slidingPuzzle(int[][] board) {
         startSb.append((char) ('0' + board[i][j]));
 
     final String start = startSb.toString();
+
     if (start.equals(goal))
       return 0;
 
-    Queue<String> q = new ArrayDeque<>(List.of(start));
+    Queue<String> q = new ArrayDeque<>(Arrays.asList(start));
     Set<String> seen = new HashSet<>(Arrays.asList(start));
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++steps;
       for (int sz = q.size(); sz > 0; --sz) {
         final String s = q.poll();
         final int zeroIndex = s.indexOf("0");
         final int i = zeroIndex / n;
         final int j = zeroIndex % n;
-        for (int[] dir : DIRS) {
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == m || y < 0 || y == n)
@@ -34,13 +37,14 @@ public int slidingPuzzle(int[][] board) {
           sb.setCharAt(swappedIndex, s.charAt(zeroIndex));
           final String t = sb.toString();
           if (t.equals(goal))
-            return step;
+            return steps;
           if (!seen.contains(t)) {
             q.offer(t);
             seen.add(t);
           }
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/774. Minimize Max Distance to Gas Station/774.java b/solutions/774. Minimize Max Distance to Gas Station/774.java
index 2aba02cb3b2..cc57f3a6588 100644
--- a/solutions/774. Minimize Max Distance to Gas Station/774.java	
+++ b/solutions/774. Minimize Max Distance to Gas Station/774.java	
@@ -1,10 +1,10 @@
 class Solution {
   public double minmaxGasDist(int[] stations, int k) {
-    final double ERR = 1e-6;
+    final double kErr = 1e-6;
     double l = 0;
     double r = stations[stations.length - 1] - stations[0];
 
-    while (r - l > ERR) {
+    while (r - l > kErr) {
       final double m = (l + r) / 2;
       if (check(stations, k, m))
         r = m;
diff --git a/solutions/774. Minimize Max Distance to Gas Station/774.py b/solutions/774. Minimize Max Distance to Gas Station/774.py
index a2a8ddba57c..0e430c6e128 100644
--- a/solutions/774. Minimize Max Distance to Gas Station/774.py	
+++ b/solutions/774. Minimize Max Distance to Gas Station/774.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def minmaxGasDist(self, stations: list[int], k: int) -> float:
-    ERR = 1e-6
+  def minmaxGasDist(self, stations: List[int], k: int) -> float:
+    kErr = 1e-6
     l = 0
     r = stations[-1] - stations[0]
 
@@ -17,7 +17,7 @@ def possible(k: int, m: float) -> bool:
             return False
       return True
 
-    while r - l > ERR:
+    while r - l > kErr:
       m = (l + r) / 2
       if possible(k, m):
         r = m
diff --git a/solutions/775. Global and Local Inversions/775-2.py b/solutions/775. Global and Local Inversions/775-2.py
index 8e2e1c4c6af..938118d8f36 100644
--- a/solutions/775. Global and Local Inversions/775-2.py	
+++ b/solutions/775. Global and Local Inversions/775-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isIdealPermutation(self, nums: list[int]) -> bool:
+  def isIdealPermutation(self, nums: List[int]) -> bool:
     for i, num in enumerate(nums):
       if abs(num - i) > 1:
         return False
diff --git a/solutions/775. Global and Local Inversions/775.py b/solutions/775. Global and Local Inversions/775.py
index 5cdb9ff1401..6655fc1340f 100644
--- a/solutions/775. Global and Local Inversions/775.py	
+++ b/solutions/775. Global and Local Inversions/775.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isIdealPermutation(self, nums: list[int]) -> bool:
+  def isIdealPermutation(self, nums: List[int]) -> bool:
     mx = -1  # the number that is most likely > nums[i + 2]
 
     for i in range(len(nums) - 2):
diff --git a/solutions/776. Split BST/776.py b/solutions/776. Split BST/776.py
index 10a9c2a63c9..e7579cac886 100644
--- a/solutions/776. Split BST/776.py	
+++ b/solutions/776. Split BST/776.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def splitBST(self, root: TreeNode | None, target: int) -> list[TreeNode | None]:
+  def splitBST(self, root: Optional[TreeNode], target: int) -> List[Optional[TreeNode]]:
     if not root:
       return None, None
     if root.val > target:
diff --git a/solutions/778. Swim in Rising Water/778.cpp b/solutions/778. Swim in Rising Water/778.cpp
index cfe60aae0a2..6e3ac2a9c48 100644
--- a/solutions/778. Swim in Rising Water/778.cpp	
+++ b/solutions/778. Swim in Rising Water/778.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int swimInWater(vector<vector<int>>& grid) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int n = grid.size();
     int ans = grid[0][0];
     using T = tuple<int, int, int>;  // (grid[i][j], i, j)
@@ -17,7 +17,7 @@ class Solution {
       ans = max(ans, height);
       if (i == n - 1 && j == n - 1)
         break;
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int x = i + dx;
         const int y = j + dy;
         if (x < 0 || x == n || y < 0 || y == n)
diff --git a/solutions/778. Swim in Rising Water/778.java b/solutions/778. Swim in Rising Water/778.java
index 26132341f78..4b26ce9f40d 100644
--- a/solutions/778. Swim in Rising Water/778.java	
+++ b/solutions/778. Swim in Rising Water/778.java	
@@ -1,12 +1,13 @@
 class Solution {
   public int swimInWater(int[][] grid) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int n = grid.length;
     int ans = grid[0][0];
-    Queue<int[]> minHeap = new PriorityQueue<>(Comparator.comparingInt(a -> a[0])) {
-      { offer(new int[] {grid[0][0], 0, 0}); } // (grid[i][j], i, j)
-    };
+    // (grid[i][j], i, j)
+    Queue<int[]> minHeap = new PriorityQueue<>((a, b) -> a[0] - b[0]);
     boolean[][] seen = new boolean[n][n];
+
+    minHeap.offer(new int[] {grid[0][0], 0, 0});
     seen[0][0] = true;
 
     while (!minHeap.isEmpty()) {
@@ -16,7 +17,7 @@ public int swimInWater(int[][] grid) {
       ans = Math.max(ans, height);
       if (i == n - 1 && j == n - 1)
         break;
-      for (int[] dir : DIRS) {
+      for (int[] dir : dirs) {
         final int x = i + dir[0];
         final int y = j + dir[1];
         if (x < 0 || x == n || y < 0 || y == n)
diff --git a/solutions/78. Subsets/78.cpp b/solutions/78. Subsets/78.cpp
index 5652e43cd26..a23759c0ef5 100644
--- a/solutions/78. Subsets/78.cpp	
+++ b/solutions/78. Subsets/78.cpp	
@@ -13,7 +13,7 @@ class Solution {
 
     for (int i = s; i < nums.size(); ++i) {
       path.push_back(nums[i]);
-      dfs(nums, i + 1, std::move(path), ans);
+      dfs(nums, i + 1, move(path), ans);
       path.pop_back();
     }
   }
diff --git a/solutions/78. Subsets/78.py b/solutions/78. Subsets/78.py
index 85653a3e7c3..fc1cd0da6bd 100644
--- a/solutions/78. Subsets/78.py	
+++ b/solutions/78. Subsets/78.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def subsets(self, nums: list[int]) -> list[list[int]]:
+  def subsets(self, nums: List[int]) -> List[List[int]]:
     ans = []
 
-    def dfs(s: int, path: list[int]) -> None:
+    def dfs(s: int, path: List[int]) -> None:
       ans.append(path)
 
       for i in range(s, len(nums)):
diff --git a/solutions/780. Reaching Points/780.py b/solutions/780. Reaching Points/780.py
index a02728e4cea..131b6302acc 100644
--- a/solutions/780. Reaching Points/780.py	
+++ b/solutions/780. Reaching Points/780.py	
@@ -3,5 +3,5 @@ def reachingPoints(self, sx: int, sy: int, tx: int, ty: int) -> bool:
     while sx < tx and sy < ty:
       tx, ty = tx % ty, ty % tx
 
-    return (sx == tx and sy <= ty and (ty - sy) % tx == 0 or
-            sy == ty and sx <= tx and (tx - sx) % ty == 0)
+    return sx == tx and sy <= ty and (ty - sy) % tx == 0 or \
+        sy == ty and sx <= tx and (tx - sx) % ty == 0
diff --git a/solutions/781. Rabbits in Forest/781.py b/solutions/781. Rabbits in Forest/781.py
index 2a013995a7f..5e6d92d8c25 100644
--- a/solutions/781. Rabbits in Forest/781.py	
+++ b/solutions/781. Rabbits in Forest/781.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numRabbits(self, answers: list[int]) -> int:
+  def numRabbits(self, answers: List[int]) -> int:
     ans = 0
     count = collections.Counter()
 
diff --git a/solutions/782. Transform to Chessboard/782.py b/solutions/782. Transform to Chessboard/782.py
index c530d2aaaef..90552c4ece2 100644
--- a/solutions/782. Transform to Chessboard/782.py	
+++ b/solutions/782. Transform to Chessboard/782.py	
@@ -1,9 +1,8 @@
 class Solution:
-  def movesToChessboard(self, board: list[list[int]]) -> int:
+  def movesToChessboard(self, board: List[List[int]]) -> int:
     n = len(board)
 
-    if any(board[0][0] ^ board[i][0] ^ board[0][j] ^ board[i][j]
-           for i in range(n) for j in range(n)):
+    if any(board[0][0] ^ board[i][0] ^ board[0][j] ^ board[i][j] for i in range(n) for j in range(n)):
       return -1
 
     rowSum = sum(board[0])
diff --git a/solutions/785. Is Graph Bipartite?/785-2.java b/solutions/785. Is Graph Bipartite?/785-2.java
index 5bc5c9d1544..5f42648ca1f 100644
--- a/solutions/785. Is Graph Bipartite?/785-2.java	
+++ b/solutions/785. Is Graph Bipartite?/785-2.java	
@@ -1,12 +1,12 @@
-enum Color { WHITE, RED, GREEN }
+enum Color { kWhite, kRed, kGreen }
 
 class Solution {
   public boolean isBipartite(int[][] graph) {
     Color[] colors = new Color[graph.length];
-    Arrays.fill(colors, Color.WHITE);
+    Arrays.fill(colors, Color.kWhite);
 
     for (int i = 0; i < graph.length; ++i)
-      if (colors[i] == Color.WHITE && !isValidColor(graph, i, colors, Color.RED))
+      if (colors[i] == Color.kWhite && !isValidColor(graph, i, colors, Color.kRed))
         return false;
 
     return true;
@@ -14,14 +14,14 @@ public boolean isBipartite(int[][] graph) {
 
   private boolean isValidColor(int[][] graph, int u, Color[] colors, Color color) {
     // The painted color should be same as `color`.
-    if (colors[u] != Color.WHITE)
+    if (colors[u] != Color.kWhite)
       return colors[u] == color;
 
     colors[u] = color;
 
     // All the children should have valid colors.
     for (final int v : graph[u])
-      if (!isValidColor(graph, v, colors, color == Color.RED ? Color.GREEN : Color.RED))
+      if (!isValidColor(graph, v, colors, color == Color.kRed ? Color.kGreen : Color.kRed))
         return false;
 
     return true;
diff --git a/solutions/785. Is Graph Bipartite?/785-2.py b/solutions/785. Is Graph Bipartite?/785-2.py
index 6ada51abcc3..88572786802 100644
--- a/solutions/785. Is Graph Bipartite?/785-2.py	
+++ b/solutions/785. Is Graph Bipartite?/785-2.py	
@@ -2,25 +2,25 @@
 
 
 class Color(Enum):
-  WHITE = 0
-  RED = 1
-  GREEN = 2
+  kWhite = 0
+  kRed = 1
+  kGreen = 2
 
 
 class Solution:
-  def isBipartite(self, graph: list[list[int]]) -> bool:
-    colors = [Color.WHITE] * len(graph)
+  def isBipartite(self, graph: List[List[int]]) -> bool:
+    colors = [Color.kWhite] * len(graph)
 
     def isValidColor(u: int, color: Color) -> bool:
       # The painted color should be same as `color`.
-      if colors[u] != Color.WHITE:
+      if colors[u] != Color.kWhite:
         return colors[u] == color
 
       colors[u] = color
 
       # All the children should have valid colors.
-      childrenColor = Color.RED if colors[u] == Color.GREEN else Color.GREEN
+      childrenColor = Color.kRed if colors[u] == Color.kGreen else Color.kGreen
       return all(isValidColor(v, childrenColor) for v in graph[u])
 
-    return all(colors[i] != Color.WHITE or isValidColor(i, Color.RED)
+    return all(colors[i] != Color.kWhite or isValidColor(i, Color.kRed)
                for i in range(len(graph)))
diff --git a/solutions/785. Is Graph Bipartite?/785.cpp b/solutions/785. Is Graph Bipartite?/785.cpp
index 03590891af3..3659695b937 100644
--- a/solutions/785. Is Graph Bipartite?/785.cpp	
+++ b/solutions/785. Is Graph Bipartite?/785.cpp	
@@ -13,20 +13,18 @@ class Solution {
       colors[i] = Color::kRed;
       // BFS.
       queue<int> q{{i}};
-      while (!q.empty())
-        for (int sz = q.size(); sz > 0; --sz) {
-          const int u = q.front();
-          q.pop();
-          for (const int v : graph[u]) {
-            if (colors[v] == colors[u])
-              return false;
-            if (colors[v] == Color::kWhite) {
-              colors[v] =
-                  colors[u] == Color::kRed ? Color::kGreen : Color::kRed;
-              q.push(v);
-            }
+      while (!q.empty()) {
+        const int u = q.front();
+        q.pop();
+        for (const int v : graph[u]) {
+          if (colors[v] == colors[u])
+            return false;
+          if (colors[v] == Color::kWhite) {
+            colors[v] = colors[u] == Color::kRed ? Color::kGreen : Color::kRed;
+            q.push(v);
           }
         }
+      }
     }
 
     return true;
diff --git a/solutions/785. Is Graph Bipartite?/785.java b/solutions/785. Is Graph Bipartite?/785.java
index 1533ed97e7c..32d639f94ba 100644
--- a/solutions/785. Is Graph Bipartite?/785.java	
+++ b/solutions/785. Is Graph Bipartite?/785.java	
@@ -1,30 +1,31 @@
-enum Color { WHITE, RED, GREEN }
+enum Color { kWhite, kRed, kGreen }
 
 class Solution {
   public boolean isBipartite(int[][] graph) {
     Color[] colors = new Color[graph.length];
-    Arrays.fill(colors, Color.WHITE);
+    Arrays.fill(colors, Color.kWhite);
 
     for (int i = 0; i < graph.length; ++i) {
       // This node has been colored, so do nothing.
-      if (colors[i] != Color.WHITE)
+      if (colors[i] != Color.kWhite)
         continue;
       // Always paint red for a white node.
-      colors[i] = Color.RED;
+      colors[i] = Color.kRed;
       // BFS.
-      Queue<Integer> q = new ArrayDeque<>(List.of(i));
-      while (!q.isEmpty())
+      Queue<Integer> q = new ArrayDeque<>(Arrays.asList(i));
+      while (!q.isEmpty()) {
         for (int sz = q.size(); sz > 0; --sz) {
           final int u = q.poll();
           for (final int v : graph[u]) {
             if (colors[v] == colors[u])
               return false;
-            if (colors[v] == Color.WHITE) {
-              colors[v] = colors[u] == Color.RED ? Color.GREEN : Color.RED;
+            if (colors[v] == Color.kWhite) {
+              colors[v] = colors[u] == Color.kRed ? Color.kGreen : Color.kRed;
               q.offer(v);
             }
           }
         }
+      }
     }
 
     return true;
diff --git a/solutions/785. Is Graph Bipartite?/785.py b/solutions/785. Is Graph Bipartite?/785.py
index 4d6ff0d5e10..84e311347bd 100644
--- a/solutions/785. Is Graph Bipartite?/785.py	
+++ b/solutions/785. Is Graph Bipartite?/785.py	
@@ -2,31 +2,30 @@
 
 
 class Color(Enum):
-  WHITE = 0
-  RED = 1
-  GREEN = 2
+  kWhite = 0
+  kRed = 1
+  kGreen = 2
 
 
 class Solution:
-  def isBipartite(self, graph: list[list[int]]) -> bool:
-    colors = [Color.WHITE] * len(graph)
+  def isBipartite(self, graph: List[List[int]]) -> bool:
+    colors = [Color.kWhite] * len(graph)
 
     for i in range(len(graph)):
       # This node has been colored, so do nothing.
-      if colors[i] != Color.WHITE:
+      if colors[i] != Color.kWhite:
         continue
       # Always paint red for a white node.
-      colors[i] = Color.RED
+      colors[i] = Color.kRed
       # BFS.
       q = collections.deque([i])
       while q:
-        for _ in range(len(q)):
-          u = q.popleft()
-          for v in graph[u]:
-            if colors[v] == colors[u]:
-              return False
-            if colors[v] == Color.WHITE:
-              colors[v] = Color.RED if colors[u] == Color.GREEN else Color.GREEN
-              q.append(v)
+        u = q.popleft()
+        for v in graph[u]:
+          if colors[v] == colors[u]:
+            return False
+          if colors[v] == Color.kWhite:
+            colors[v] = Color.kRed if colors[u] == Color.kGreen else Color.kGreen
+            q.append(v)
 
     return True
diff --git a/solutions/786. K-th Smallest Prime Fraction/786.py b/solutions/786. K-th Smallest Prime Fraction/786.py
index 8fb1ccc6c00..fc857284622 100644
--- a/solutions/786. K-th Smallest Prime Fraction/786.py	
+++ b/solutions/786. K-th Smallest Prime Fraction/786.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def kthSmallestPrimeFraction(self, arr: list[int], k: int) -> list[int]:
+  def kthSmallestPrimeFraction(self, arr: List[int], k: int) -> List[int]:
     n = len(arr)
     ans = [0, 1]
     l = 0
diff --git a/solutions/787. Cheapest Flights Within K Stops/787.cpp b/solutions/787. Cheapest Flights Within K Stops/787.cpp
index 14f6c0cbea5..4f5a94238eb 100644
--- a/solutions/787. Cheapest Flights Within K Stops/787.cpp	
+++ b/solutions/787. Cheapest Flights Within K Stops/787.cpp	
@@ -18,10 +18,10 @@ class Solution {
   int dijkstra(const vector<vector<pair<int, int>>>& graph, int src, int dst,
                int k) {
     vector<vector<int>> dist(graph.size(), vector<int>(k + 2, INT_MAX));
-
-    dist[src][k + 1] = 0;
     using T = tuple<int, int, int>;  // (d, u, stops)
     priority_queue<T, vector<T>, greater<>> minHeap;
+
+    dist[src][k + 1] = 0;
     minHeap.emplace(dist[src][k + 1], src, k + 1);
 
     while (!minHeap.empty()) {
diff --git a/solutions/787. Cheapest Flights Within K Stops/787.java b/solutions/787. Cheapest Flights Within K Stops/787.java
index add21f731f3..f56ece42757 100644
--- a/solutions/787. Cheapest Flights Within K Stops/787.java	
+++ b/solutions/787. Cheapest Flights Within K Stops/787.java	
@@ -18,11 +18,11 @@ public int findCheapestPrice(int n, int[][] flights, int src, int dst, int k) {
   private int dijkstra(List<Pair<Integer, Integer>>[] graph, int src, int dst, int k) {
     int[][] dist = new int[graph.length][k + 2];
     Arrays.stream(dist).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE));
+    // (d, u, stops)
+    Queue<int[]> minHeap = new PriorityQueue<>((a, b) -> a[0] - b[0]);
 
     dist[src][k + 1] = 0;
-    Queue<int[]> minHeap = new PriorityQueue<>(Comparator.comparingInt(a -> a[0])) {
-      { offer(new int[] {dist[src][k + 1], src, k + 1}); } // (d, u, stops)
-    };
+    minHeap.offer(new int[] {dist[src][k + 1], src, k + 1});
 
     while (!minHeap.isEmpty()) {
       final int d = minHeap.peek()[0];
diff --git a/solutions/787. Cheapest Flights Within K Stops/787.py b/solutions/787. Cheapest Flights Within K Stops/787.py
index 8565cf69406..cee4b5e7224 100644
--- a/solutions/787. Cheapest Flights Within K Stops/787.py	
+++ b/solutions/787. Cheapest Flights Within K Stops/787.py	
@@ -1,12 +1,5 @@
 class Solution:
-  def findCheapestPrice(
-      self,
-      n: int,
-      flights: list[list[int]],
-      src: int,
-      dst: int,
-      k: int,
-  ) -> int:
+  def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, k: int) -> int:
     graph = [[] for _ in range(n)]
 
     for u, v, w in flights:
@@ -14,14 +7,8 @@ def findCheapestPrice(
 
     return self._dijkstra(graph, src, dst, k)
 
-  def _dijkstra(
-      self,
-      graph: list[list[tuple[int, int]]],
-      src: int,
-      dst: int,
-      k: int,
-  ) -> int:
-    dist = [[math.inf] * (k + 2) for _ in range(len(graph))]
+  def _dijkstra(self, graph: List[List[Tuple[int, int]]], src: int, dst: int, k: int) -> int:
+    dist = [[math.inf for _ in range(k + 2)] for _ in range(len(graph))]
 
     dist[src][k + 1] = 0
     minHeap = [(dist[src][k + 1], src, k + 1)]  # (d, u, stops)
diff --git a/solutions/789. Escape The Ghosts/789.py b/solutions/789. Escape The Ghosts/789.py
index c177bab119f..96519f02616 100644
--- a/solutions/789. Escape The Ghosts/789.py	
+++ b/solutions/789. Escape The Ghosts/789.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def escapeGhosts(self, ghosts: list[list[int]], target: list[int]) -> bool:
+  def escapeGhosts(self, ghosts: List[List[int]], target: List[int]) -> bool:
     ghostSteps = min(abs(x - target[0]) +
                      abs(y - target[1]) for x, y in ghosts)
 
diff --git a/solutions/79. Word Search/79.py b/solutions/79. Word Search/79.py
index ddb6a301128..c577941d6d7 100644
--- a/solutions/79. Word Search/79.py	
+++ b/solutions/79. Word Search/79.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def exist(self, board: list[list[str]], word: str) -> bool:
+  def exist(self, board: List[List[str]], word: str) -> bool:
     m = len(board)
     n = len(board[0])
 
@@ -13,14 +13,13 @@ def dfs(i: int, j: int, s: int) -> bool:
 
       cache = board[i][j]
       board[i][j] = '*'
-      isExist = (dfs(i + 1, j, s + 1) or
-                 dfs(i - 1, j, s + 1) or
-                 dfs(i, j + 1, s + 1) or
-                 dfs(i, j - 1, s + 1))
+      isExist = \
+          dfs(i + 1, j, s + 1) or \
+          dfs(i - 1, j, s + 1) or \
+          dfs(i, j + 1, s + 1) or \
+          dfs(i, j - 1, s + 1)
       board[i][j] = cache
 
       return isExist
 
-    return any(dfs(i, j, 0)
-               for i in range(m)
-               for j in range(n))
+    return any(dfs(i, j, 0) for i in range(m) for j in range(n))
diff --git a/solutions/790. Domino and Tromino Tiling/790.java b/solutions/790. Domino and Tromino Tiling/790.java
index e43ef74e447..277344cfea2 100644
--- a/solutions/790. Domino and Tromino Tiling/790.java	
+++ b/solutions/790. Domino and Tromino Tiling/790.java	
@@ -1,13 +1,13 @@
 class Solution {
   public int numTilings(int n) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     long[] dp = new long[1001];
     dp[1] = 1;
     dp[2] = 2;
     dp[3] = 5;
 
     for (int i = 4; i <= n; ++i)
-      dp[i] = (2 * dp[i - 1] + dp[i - 3]) % MOD;
+      dp[i] = (2 * dp[i - 1] + dp[i - 3]) % kMod;
 
     return (int) dp[n];
   }
diff --git a/solutions/790. Domino and Tromino Tiling/790.py b/solutions/790. Domino and Tromino Tiling/790.py
index 5ef12c6825b..00b49690749 100644
--- a/solutions/790. Domino and Tromino Tiling/790.py	
+++ b/solutions/790. Domino and Tromino Tiling/790.py	
@@ -1,9 +1,9 @@
 class Solution:
   def numTilings(self, n: int) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     dp = [0, 1, 2, 5] + [0] * 997
 
     for i in range(4, n + 1):
       dp[i] = 2 * dp[i - 1] + dp[i - 3]
 
-    return dp[n] % MOD
+    return dp[n] % kMod
diff --git a/solutions/792. Number of Matching Subsequences/792-2.py b/solutions/792. Number of Matching Subsequences/792-2.py
index 7f72c09441c..cb96e689fe1 100644
--- a/solutions/792. Number of Matching Subsequences/792-2.py	
+++ b/solutions/792. Number of Matching Subsequences/792-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numMatchingSubseq(self, s: str, words: list[str]) -> int:
+  def numMatchingSubseq(self, s: str, words: List[str]) -> int:
     ans = 0
     # [(i, j)] := words[i] and the letter words[i][j] is waiting for
     bucket = [[] for _ in range(26)]
diff --git a/solutions/792. Number of Matching Subsequences/792.py b/solutions/792. Number of Matching Subsequences/792.py
index 6cc550694f0..32e7e18199a 100644
--- a/solutions/792. Number of Matching Subsequences/792.py	
+++ b/solutions/792. Number of Matching Subsequences/792.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numMatchingSubseq(self, s: str, words: list[str]) -> int:
+  def numMatchingSubseq(self, s: str, words: List[str]) -> int:
     root = {}
 
     def insert(word: str) -> None:
diff --git a/solutions/794. Valid Tic-Tac-Toe State/794.py b/solutions/794. Valid Tic-Tac-Toe State/794.py
index 3936086b5e8..332d3597d4b 100644
--- a/solutions/794. Valid Tic-Tac-Toe State/794.py	
+++ b/solutions/794. Valid Tic-Tac-Toe State/794.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def validTicTacToe(self, board: list[str]) -> bool:
+  def validTicTacToe(self, board: List[str]) -> bool:
     def isWin(c: str) -> bool:
-      return (any(row.count(c) == 3 for row in board) or
-              any(row.count(c) == 3 for row in list(zip(*board))) or
-              all(board[i][i] == c for i in range(3)) or
-              all(board[i][2 - i] == c for i in range(3)))
+      return any(row.count(c) == 3 for row in board) or \
+          any(row.count(c) == 3 for row in list(zip(*board))) or \
+          all(board[i][i] == c for i in range(3)) or \
+          all(board[i][2 - i] == c for i in range(3))
 
     countX = sum(row.count('X') for row in board)
     countO = sum(row.count('O') for row in board)
diff --git a/solutions/795. Number of Subarrays with Bounded Maximum/795.py b/solutions/795. Number of Subarrays with Bounded Maximum/795.py
index 20dfd5cbb91..169bde7406a 100644
--- a/solutions/795. Number of Subarrays with Bounded Maximum/795.py	
+++ b/solutions/795. Number of Subarrays with Bounded Maximum/795.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def numSubarrayBoundedMax(
-      self,
-      nums: list[int],
-      left: int,
-      right: int,
-  ) -> int:
+  def numSubarrayBoundedMax(self, nums: List[int], left: int, right: int) -> int:
     ans = 0
     l = -1
     r = -1
diff --git a/solutions/797. All Paths From Source to Target/797.cpp b/solutions/797. All Paths From Source to Target/797.cpp
index cbe9c63d7cb..323c1e958b7 100644
--- a/solutions/797. All Paths From Source to Target/797.cpp	
+++ b/solutions/797. All Paths From Source to Target/797.cpp	
@@ -16,7 +16,7 @@ class Solution {
 
     for (const int v : graph[u]) {
       path.push_back(v);
-      dfs(graph, v, std::move(path), ans);
+      dfs(graph, v, move(path), ans);
       path.pop_back();
     }
   }
diff --git a/solutions/797. All Paths From Source to Target/797.java b/solutions/797. All Paths From Source to Target/797.java
index baa27ae7a5c..a9e3fbea893 100644
--- a/solutions/797. All Paths From Source to Target/797.java	
+++ b/solutions/797. All Paths From Source to Target/797.java	
@@ -1,7 +1,7 @@
 class Solution {
   public List<List<Integer>> allPathsSourceTarget(int[][] graph) {
     List<List<Integer>> ans = new ArrayList<>();
-    dfs(graph, 0, new ArrayList<>(List.of(0)), ans);
+    dfs(graph, 0, new ArrayList<>(Arrays.asList(0)), ans);
     return ans;
   }
 
diff --git a/solutions/797. All Paths From Source to Target/797.py b/solutions/797. All Paths From Source to Target/797.py
index 28c3c83b563..ee36509afd0 100644
--- a/solutions/797. All Paths From Source to Target/797.py	
+++ b/solutions/797. All Paths From Source to Target/797.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def allPathsSourceTarget(self, graph: list[list[int]]) -> list[list[int]]:
+  def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]:
     ans = []
 
-    def dfs(u: int, path: list[int]) -> None:
+    def dfs(u: int, path: List[int]) -> None:
       if u == len(graph) - 1:
         ans.append(path)
         return
diff --git a/solutions/799. Champagne Tower/799-2.cpp b/solutions/799. Champagne Tower/799-2.cpp
index 9cc6d242e2d..51f0b78d73f 100644
--- a/solutions/799. Champagne Tower/799-2.cpp	
+++ b/solutions/799. Champagne Tower/799-2.cpp	
@@ -11,7 +11,7 @@ class Solution {
           newDp[j] += (dp[j] - 1) / 2.0;
           newDp[j + 1] += (dp[j] - 1) / 2.0;
         }
-      dp = std::move(newDp);
+      dp = move(newDp);
     }
 
     return min(1.0, dp[query_glass]);
diff --git a/solutions/8. String to Integer (atoi)/8.py b/solutions/8. String to Integer (atoi)/8.py
index 1da31751455..7f79c33f428 100644
--- a/solutions/8. String to Integer (atoi)/8.py	
+++ b/solutions/8. String to Integer (atoi)/8.py	
@@ -13,7 +13,7 @@ def myAtoi(self, s: str) -> int:
     for c in s:
       if not c.isdigit():
         break
-      num = num * 10 + int(c)
+      num = num * 10 + ord(c) - ord('0')
       if sign * num <= -2**31:
         return -2**31
       if sign * num >= 2**31 - 1:
diff --git a/solutions/80. Remove Duplicates from Sorted Array II/80.py b/solutions/80. Remove Duplicates from Sorted Array II/80.py
index e8e169d092c..a3fb1a56032 100644
--- a/solutions/80. Remove Duplicates from Sorted Array II/80.py	
+++ b/solutions/80. Remove Duplicates from Sorted Array II/80.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def removeDuplicates(self, nums: list[int]) -> int:
+  def removeDuplicates(self, nums: List[int]) -> int:
     i = 0
 
     for num in nums:
diff --git a/solutions/800. Similar RGB Color/800.java b/solutions/800. Similar RGB Color/800.java
index a624f540491..3da715d6b6f 100644
--- a/solutions/800. Similar RGB Color/800.java	
+++ b/solutions/800. Similar RGB Color/800.java	
@@ -1,12 +1,12 @@
 class Solution {
   public String similarRGB(String color) {
-    String[] SHORTHANDS = {"00", "11", "22", "33", "44", "55", "66", "77",
-                           "88", "99", "aa", "bb", "cc", "dd", "ee", "ff"};
+    String[] kShorthands = {"00", "11", "22", "33", "44", "55", "66", "77",
+                            "88", "99", "aa", "bb", "cc", "dd", "ee", "ff"};
     StringBuilder ans = new StringBuilder("#");
 
     for (int i = 1; i < color.length(); i += 2) {
       final int currValue = Integer.parseInt(color.substring(i, i + 2), 16);
-      String closestShorthand = findClosestShorthand(currValue, SHORTHANDS);
+      String closestShorthand = findClosestShorthand(currValue, kShorthands);
       ans.append(closestShorthand);
     }
 
diff --git a/solutions/800. Similar RGB Color/800.py b/solutions/800. Similar RGB Color/800.py
index 4654024e9f1..7322874bdf7 100644
--- a/solutions/800. Similar RGB Color/800.py	
+++ b/solutions/800. Similar RGB Color/800.py	
@@ -1,13 +1,13 @@
 class Solution:
   def similarRGB(self, color: str) -> str:
-    SHORTHANDS = ['00', '11', '22', '33', '44', '55', '66', '77', '88', '99',
-                  'aa', 'bb', 'cc', 'dd', 'ee', 'ff']
+    kShorthands = ['00', '11', '22', '33', '44', '55', '66', '77', '88', '99',
+                   'aa', 'bb', 'cc', 'dd', 'ee', 'ff']
     ans = ['#']
 
     for i in range(1, len(color), 2):
       currValue = int(color[i:i + 2], 16)
-      closestShorthand = min(SHORTHANDS,
-                             key=lambda x: (currValue - int(x, 16))**2)
+      closestShorthand = min(kShorthands,
+                             key=lambda shorthand: (currValue - int(shorthand, 16))**2)
       ans.append(closestShorthand)
 
     return ''.join(ans)
diff --git a/solutions/801. Minimum Swaps To Make Sequences Increasing/801.py b/solutions/801. Minimum Swaps To Make Sequences Increasing/801.py
index faa49087b10..8fbf5180a67 100644
--- a/solutions/801. Minimum Swaps To Make Sequences Increasing/801.py	
+++ b/solutions/801. Minimum Swaps To Make Sequences Increasing/801.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minSwap(self, nums1: list[int], nums2: list[int]) -> int:
+  def minSwap(self, nums1: List[int], nums2: List[int]) -> int:
     keepAt = [math.inf] * len(nums1)
     swapAt = [math.inf] * len(nums1)
     keepAt[0] = 0
diff --git a/solutions/802. Find Eventual Safe States/802.cpp b/solutions/802. Find Eventual Safe States/802.cpp
index 16a0ecd111f..6d5912e2992 100644
--- a/solutions/802. Find Eventual Safe States/802.cpp	
+++ b/solutions/802. Find Eventual Safe States/802.cpp	
@@ -20,11 +20,13 @@ class Solution {
       return true;
     if (states[u] == State::kVisited)
       return false;
+
     states[u] = State::kVisiting;
     for (const int v : graph[u])
       if (hasCycle(graph, v, states))
         return true;
     states[u] = State::kVisited;
+
     return false;
   }
 };
diff --git a/solutions/802. Find Eventual Safe States/802.java b/solutions/802. Find Eventual Safe States/802.java
index be904bf7c4a..49a58277817 100644
--- a/solutions/802. Find Eventual Safe States/802.java	
+++ b/solutions/802. Find Eventual Safe States/802.java	
@@ -1,4 +1,4 @@
-enum State { INIT, VISITING, VISITED }
+enum State { kInit, kVisiting, kVisited }
 
 class Solution {
   public List<Integer> eventualSafeNodes(int[][] graph) {
@@ -13,15 +13,17 @@ public List<Integer> eventualSafeNodes(int[][] graph) {
   }
 
   private boolean hasCycle(int[][] graph, int u, State[] states) {
-    if (states[u] == State.VISITING)
+    if (states[u] == State.kVisiting)
       return true;
-    if (states[u] == State.VISITED)
+    if (states[u] == State.kVisited)
       return false;
-    states[u] = State.VISITING;
+
+    states[u] = State.kVisiting;
     for (final int v : graph[u])
       if (hasCycle(graph, v, states))
         return true;
-    states[u] = State.VISITED;
+    states[u] = State.kVisited;
+
     return false;
   }
 }
diff --git a/solutions/802. Find Eventual Safe States/802.py b/solutions/802. Find Eventual Safe States/802.py
index c6b49828e77..2c2c1fe33a3 100644
--- a/solutions/802. Find Eventual Safe States/802.py	
+++ b/solutions/802. Find Eventual Safe States/802.py	
@@ -2,24 +2,24 @@
 
 
 class State(Enum):
-  INIT = 0
-  VISITING = 1
-  VISITED = 2
+  kInit = 0
+  kVisiting = 1
+  kVisited = 2
 
 
 class Solution:
-  def eventualSafeNodes(self, graph: list[list[int]]) -> list[int]:
-    states = [State.INIT] * len(graph)
+  def eventualSafeNodes(self, graph: List[List[int]]) -> List[int]:
+    states = [State.kInit] * len(graph)
 
     def hasCycle(u: int) -> bool:
-      if states[u] == State.VISITING:
+      if states[u] == State.kVisiting:
         return True
-      if states[u] == State.VISITED:
+      if states[u] == State.kVisited:
         return False
-      states[u] = State.VISITING
+
+      states[u] = State.kVisiting
       if any(hasCycle(v) for v in graph[u]):
         return True
-      states[u] = State.VISITED
-      return False
+      states[u] = State.kVisited
 
     return [i for i in range(len(graph)) if not hasCycle(i)]
diff --git a/solutions/803. Bricks Falling When Hit/803.cpp b/solutions/803. Bricks Falling When Hit/803.cpp
index 6382ac03752..e85e8cc55b7 100644
--- a/solutions/803. Bricks Falling When Hit/803.cpp	
+++ b/solutions/803. Bricks Falling When Hit/803.cpp	
@@ -74,7 +74,7 @@ class Solution {
   }
 
  private:
-  static constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  static constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
   int m;
   int n;
 
@@ -82,7 +82,7 @@ class Solution {
                       int j) {
     const int hash = getHash(i, j);
 
-    for (const auto& [dx, dy] : kDirs) {
+    for (const auto& [dx, dy] : dirs) {
       const int x = i + dx;
       const int y = j + dy;
       if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/803. Bricks Falling When Hit/803.java b/solutions/803. Bricks Falling When Hit/803.java
index e13435b3ed1..86c392bff30 100644
--- a/solutions/803. Bricks Falling When Hit/803.java	
+++ b/solutions/803. Bricks Falling When Hit/803.java	
@@ -75,12 +75,12 @@ public int[] hitBricks(int[][] grid, int[][] hits) {
 
   private int m;
   private int n;
-  private static final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+  private static final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
 
   private void unionNeighbors(int[][] grid, UnionFind uf, int i, int j) {
     final int hash = getHash(i, j);
 
-    for (int[] dir : DIRS) {
+    for (int[] dir : dirs) {
       final int x = i + dir[0];
       final int y = j + dir[1];
       if (x < 0 || x == m || y < 0 || y == n)
diff --git a/solutions/804. Unique Morse Code Words/804.py b/solutions/804. Unique Morse Code Words/804.py
index 56d79f8ffc9..c00bb5889f7 100644
--- a/solutions/804. Unique Morse Code Words/804.py	
+++ b/solutions/804. Unique Morse Code Words/804.py	
@@ -1,13 +1,11 @@
 class Solution:
-  def uniqueMorseRepresentations(self, words: list[str]) -> int:
-    morse = [".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..",
-             ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.",
-             "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."]
+  def uniqueMorseRepresentations(self, words: List[str]) -> int:
+    morse = [".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--",
+             "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."]
     transformations = set()
 
     for word in words:
-      transformation = ''.join(
-          morse[ord(c) - ord('a')] for c in word)
+      transformation = ''.join(morse[ord(c) - ord('a')] for c in word)
       transformations.add(transformation)
 
     return len(transformations)
diff --git a/solutions/805. Split Array With Same Average/805.py b/solutions/805. Split Array With Same Average/805.py
index 49483bc4b1f..1be1f3d3186 100644
--- a/solutions/805. Split Array With Same Average/805.py	
+++ b/solutions/805. Split Array With Same Average/805.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def splitArraySameAverage(self, nums: list[int]) -> bool:
+  def splitArraySameAverage(self, nums: List[int]) -> bool:
     n = len(nums)
     summ = sum(nums)
     if not any(i * summ % n == 0 for i in range(1, n // 2 + 1)):
diff --git a/solutions/806. Number of Lines To Write String/806.py b/solutions/806. Number of Lines To Write String/806.py
index 7a346d79a3e..c8fddb7423a 100644
--- a/solutions/806. Number of Lines To Write String/806.py	
+++ b/solutions/806. Number of Lines To Write String/806.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numberOfLines(self, widths: list[int], s: str) -> list[int]:
+  def numberOfLines(self, widths: List[int], s: str) -> List[int]:
     numLines = 1
     runningWidth = 0
 
diff --git a/solutions/807. Max Increase to Keep City Skyline/807.py b/solutions/807. Max Increase to Keep City Skyline/807.py
index f5bfaa6e109..902dfa4cd5b 100644
--- a/solutions/807. Max Increase to Keep City Skyline/807.py	
+++ b/solutions/807. Max Increase to Keep City Skyline/807.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxIncreaseKeepingSkyline(self, grid: list[list[int]]) -> int:
+  def maxIncreaseKeepingSkyline(self, grid: List[List[int]]) -> int:
     rowMax = list(map(max, grid))
     colMax = list(map(max, zip(*grid)))
     return sum(min(i, j) for i in rowMax for j in colMax) - sum(map(sum, grid))
diff --git a/solutions/809. Expressive Words/809.py b/solutions/809. Expressive Words/809.py
index c4c280575e4..b77f82ca879 100644
--- a/solutions/809. Expressive Words/809.py	
+++ b/solutions/809. Expressive Words/809.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def expressiveWords(self, s: str, words: list[str]) -> int:
+  def expressiveWords(self, s: str, words: List[str]) -> int:
     def isStretchy(word: str) -> bool:
       n = len(s)
       m = len(word)
diff --git a/solutions/81. Search in Rotated Sorted Array II/81.py b/solutions/81. Search in Rotated Sorted Array II/81.py
index 75913e1d3bc..94eb27c7ec7 100644
--- a/solutions/81. Search in Rotated Sorted Array II/81.py	
+++ b/solutions/81. Search in Rotated Sorted Array II/81.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def search(self, nums: list[int], target: int) -> bool:
+  def search(self, nums: List[int], target: int) -> bool:
     l = 0
     r = len(nums) - 1
 
diff --git a/solutions/810. Chalkboard XOR Game/810.py b/solutions/810. Chalkboard XOR Game/810.py
index 804f8a03a03..efa98b8cdd2 100644
--- a/solutions/810. Chalkboard XOR Game/810.py	
+++ b/solutions/810. Chalkboard XOR Game/810.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def xorGame(self, nums: list[int]) -> bool:
+  def xorGame(self, nums: List[int]) -> bool:
     return functools.reduce(operator.xor, nums) == 0 or len(nums) % 2 == 0
diff --git a/solutions/811. Subdomain Visit Count/811.py b/solutions/811. Subdomain Visit Count/811.py
index e4be953949e..de0ab858fde 100644
--- a/solutions/811. Subdomain Visit Count/811.py	
+++ b/solutions/811. Subdomain Visit Count/811.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def subdomainVisits(self, cpdomains: list[str]) -> list[str]:
+  def subdomainVisits(self, cpdomains: List[str]) -> List[str]:
     ans = []
     count = collections.Counter()
 
diff --git a/solutions/812. Largest Triangle Area/812.py b/solutions/812. Largest Triangle Area/812.py
index 5008f408d16..59fc1b9cc2b 100644
--- a/solutions/812. Largest Triangle Area/812.py	
+++ b/solutions/812. Largest Triangle Area/812.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestTriangleArea(self, points: list[list[int]]) -> float:
+  def largestTriangleArea(self, points: List[List[int]]) -> float:
     ans = 0
 
     for Ax, Ay in points:
diff --git a/solutions/814. Binary Tree Pruning/814.py b/solutions/814. Binary Tree Pruning/814.py
index 1703c1d928b..bb6bf6dee9a 100644
--- a/solutions/814. Binary Tree Pruning/814.py	
+++ b/solutions/814. Binary Tree Pruning/814.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def pruneTree(self, root: TreeNode | None) -> TreeNode | None:
+  def pruneTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
     if not root:
       return None
     root.left = self.pruneTree(root.left)
diff --git a/solutions/815. Bus Routes/815.cpp b/solutions/815. Bus Routes/815.cpp
index 5dd88c0255c..380f4719eac 100644
--- a/solutions/815. Bus Routes/815.cpp	
+++ b/solutions/815. Bus Routes/815.cpp	
@@ -12,9 +12,11 @@ class Solution {
       for (const int route : routes[i])
         graph[route].push_back(i);
 
+    int ans = 0;
     queue<int> q{{source}};
 
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         const int route = q.front();
         q.pop();
@@ -22,10 +24,11 @@ class Solution {
           if (usedBuses.insert(bus).second)
             for (const int nextRoute : routes[bus]) {
               if (nextRoute == target)
-                return step;
+                return ans;
               q.push(nextRoute);
             }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/815. Bus Routes/815.java b/solutions/815. Bus Routes/815.java
index d731b86c216..787769e016a 100644
--- a/solutions/815. Bus Routes/815.java	
+++ b/solutions/815. Bus Routes/815.java	
@@ -12,18 +12,21 @@ public int numBusesToDestination(int[][] routes, int source, int target) {
         graph.get(route).add(i);
       }
 
-    Queue<Integer> q = new ArrayDeque<>(List.of(source));
+    int ans = 0;
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(source));
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
-        for (final int bus : graph.getOrDefault(q.poll(), new ArrayList<>()))
+        for (final int bus : graph.get(q.poll()))
           if (usedBuses.add(bus))
             for (final int nextRoute : routes[bus]) {
               if (nextRoute == target)
-                return step;
+                return ans;
               q.offer(nextRoute);
             }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/815. Bus Routes/815.py b/solutions/815. Bus Routes/815.py
index 7f980ef89dc..69f032bbb57 100644
--- a/solutions/815. Bus Routes/815.py	
+++ b/solutions/815. Bus Routes/815.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def numBusesToDestination(
-      self,
-      routes: list[list[int]],
-      source: int,
-      target: int,
-  ) -> int:
+  def numBusesToDestination(self, routes: List[List[int]], source: int, target: int) -> int:
     if source == target:
       return 0
 
@@ -15,10 +10,11 @@ def numBusesToDestination(
       for route in routes[i]:
         graph[route].append(i)
 
+    ans = 0
     q = collections.deque([source])
 
-    step = 1
     while q:
+      ans += 1
       for _ in range(len(q)):
         for bus in graph[q.popleft()]:
           if bus in usedBuses:
@@ -26,8 +22,7 @@ def numBusesToDestination(
           usedBuses.add(bus)
           for nextRoute in routes[bus]:
             if nextRoute == target:
-              return step
+              return ans
             q.append(nextRoute)
-      step += 1
 
     return -1
diff --git a/solutions/816. Ambiguous Coordinates/816.java b/solutions/816. Ambiguous Coordinates/816.java
index 377bf09d742..65e02afd9db 100644
--- a/solutions/816. Ambiguous Coordinates/816.java	
+++ b/solutions/816. Ambiguous Coordinates/816.java	
@@ -15,11 +15,11 @@ private List<String> splits(final String s) {
     if (s.isEmpty() || s.length() > 1 && s.charAt(0) == '0' && s.charAt(s.length() - 1) == '0')
       return new ArrayList<>();
     if (s.charAt(s.length() - 1) == '0')
-      return List.of(s);
+      return new ArrayList<>(Arrays.asList(s));
     if (s.charAt(0) == '0')
-      return List.of("0." + s.substring(1));
+      return new ArrayList<>(Arrays.asList("0." + s.substring(1)));
 
-    List<String> res = new ArrayList<>(List.of(s));
+    List<String> res = new ArrayList<>(Arrays.asList(s));
     for (int i = 1; i < s.length(); ++i)
       res.add(s.substring(0, i) + "." + s.substring(i));
     return res;
diff --git a/solutions/816. Ambiguous Coordinates/816.py b/solutions/816. Ambiguous Coordinates/816.py
index 34c39179603..809e7a6e2e9 100644
--- a/solutions/816. Ambiguous Coordinates/816.py	
+++ b/solutions/816. Ambiguous Coordinates/816.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def ambiguousCoordinates(self, s: str) -> list[str]:
-    def splits(s: str) -> list[str]:
+  def ambiguousCoordinates(self, s: str) -> List[str]:
+    def splits(s: str) -> List[str]:
       if not s or len(s) > 1 and s[0] == s[-1] == '0':
         return []
       if s[-1] == '0':
diff --git a/solutions/817. Linked List Components/817.py b/solutions/817. Linked List Components/817.py
index 10c2a115b66..7eb242b0e72 100644
--- a/solutions/817. Linked List Components/817.py	
+++ b/solutions/817. Linked List Components/817.py	
@@ -1,11 +1,10 @@
 class Solution:
-  def numComponents(self, head: ListNode | None, nums: list[int]) -> int:
+  def numComponents(self, head: Optional[ListNode], nums: List[int]) -> int:
     ans = 0
     numsSet = set(nums)
 
     while head:
-      if head.val in numsSet and (
-              head.next == None or head.next.val not in numsSet):
+      if head.val in numsSet and (head.next == None or head.next.val not in numsSet):
         ans += 1
       head = head.next
 
diff --git a/solutions/819. Most Common Word/819.py b/solutions/819. Most Common Word/819.py
index bb248dc5918..8de0bc08701 100644
--- a/solutions/819. Most Common Word/819.py	
+++ b/solutions/819. Most Common Word/819.py	
@@ -1,6 +1,5 @@
 class Solution:
-  def mostCommonWord(self, paragraph: str, banned: list[str]) -> str:
+  def mostCommonWord(self, paragraph: str, banned: List[str]) -> str:
     banned = set(banned)
     words = re.findall(r'\w+', paragraph.lower())
-    return collections.Counter(
-        word for word in words if word not in banned).most_common(1)[0][0]
+    return collections.Counter(word for word in words if word not in banned).most_common(1)[0][0]
diff --git a/solutions/82. Remove Duplicates from Sorted List II/82.cpp b/solutions/82. Remove Duplicates from Sorted List II/82.cpp
index 52f2a2e0c51..8144bab376d 100644
--- a/solutions/82. Remove Duplicates from Sorted List II/82.cpp	
+++ b/solutions/82. Remove Duplicates from Sorted List II/82.cpp	
@@ -4,7 +4,7 @@ class Solution {
     ListNode dummy(0, head);
     ListNode* prev = &dummy;
 
-    while (head != nullptr) {
+    while (head) {
       while (head->next && head->val == head->next->val)
         head = head->next;
       if (prev->next == head)
diff --git a/solutions/820. Short Encoding of Words/820-2.cpp b/solutions/820. Short Encoding of Words/820-2.cpp
index 7fed6179c4b..9acc83a99b7 100644
--- a/solutions/820. Short Encoding of Words/820-2.cpp	
+++ b/solutions/820. Short Encoding of Words/820-2.cpp	
@@ -9,8 +9,9 @@ class Solution {
         wordsSet.erase(sv.substr(i));
     }
 
-    return accumulate(
-        wordsSet.begin(), wordsSet.end(), 0,
-        [](int acc, const auto& sv) { return acc + sv.length() + 1; });
+    return accumulate(wordsSet.begin(), wordsSet.end(), 0,
+                      [](int subtotal, const auto& sv) {
+      return subtotal + sv.length() + 1;
+    });
   }
 };
diff --git a/solutions/820. Short Encoding of Words/820.cpp b/solutions/820. Short Encoding of Words/820.cpp
index a31d46f6f7a..4e837b76ba6 100644
--- a/solutions/820. Short Encoding of Words/820.cpp	
+++ b/solutions/820. Short Encoding of Words/820.cpp	
@@ -25,7 +25,7 @@ class Solution {
  private:
   shared_ptr<TrieNode> insert(shared_ptr<TrieNode> root, const string& word) {
     shared_ptr<TrieNode> node = root;
-    for (const char c : string{word.rbegin(), word.rend()}) {
+    for (const char c : string(word.rbegin(), word.rend())) {
       const int i = c - 'a';
       if (node->children[i] == nullptr)
         node->children[i] = make_shared<TrieNode>();
diff --git a/solutions/820. Short Encoding of Words/820.py b/solutions/820. Short Encoding of Words/820.py
index 4152224d199..9f266157873 100644
--- a/solutions/820. Short Encoding of Words/820.py	
+++ b/solutions/820. Short Encoding of Words/820.py	
@@ -1,11 +1,11 @@
 class TrieNode:
   def __init__(self):
-    self.children: dict[str, TrieNode] = {}
+    self.children: Dict[str, TrieNode] = {}
     self.depth = 0
 
 
 class Solution:
-  def minimumLengthEncoding(self, words: list[str]) -> int:
+  def minimumLengthEncoding(self, words: List[str]) -> int:
     root = TrieNode()
     leaves = []
 
diff --git a/solutions/821. Shortest Distance to a Character/821.py b/solutions/821. Shortest Distance to a Character/821.py
index 582fc27e14f..39f121a930f 100644
--- a/solutions/821. Shortest Distance to a Character/821.py	
+++ b/solutions/821. Shortest Distance to a Character/821.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def shortestToChar(self, s: str, c: str) -> list[int]:
+  def shortestToChar(self, s: str, c: str) -> List[int]:
     n = len(s)
     ans = [0] * n
     prev = -n
diff --git a/solutions/822. Card Flipping Game/822.java b/solutions/822. Card Flipping Game/822.java
index 4806ecbc2d7..de4771055eb 100644
--- a/solutions/822. Card Flipping Game/822.java	
+++ b/solutions/822. Card Flipping Game/822.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int flipgame(int[] fronts, int[] backs) {
-    final int MAX = 2001;
-    int ans = MAX;
+    final int kMax = 2001;
+    int ans = kMax;
     Set<Integer> same = new HashSet<>();
 
     for (int i = 0; i < fronts.length; ++i)
@@ -16,6 +16,6 @@ public int flipgame(int[] fronts, int[] backs) {
       if (!same.contains(back))
         ans = Math.min(ans, back);
 
-    return ans == MAX ? 0 : ans;
+    return ans == kMax ? 0 : ans;
   }
 }
diff --git a/solutions/822. Card Flipping Game/822.py b/solutions/822. Card Flipping Game/822.py
index 961b5327e92..4f861e0666a 100644
--- a/solutions/822. Card Flipping Game/822.py	
+++ b/solutions/822. Card Flipping Game/822.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def flipgame(self, fronts: list[int], backs: list[int]) -> int:
+  def flipgame(self, fronts: List[int], backs: List[int]) -> int:
     same = {front
             for front, back in zip(fronts, backs)
             if front == back}
diff --git a/solutions/823. Binary Trees With Factors/823.java b/solutions/823. Binary Trees With Factors/823.java
index e317bfa0031..7df139424ee 100644
--- a/solutions/823. Binary Trees With Factors/823.java	
+++ b/solutions/823. Binary Trees With Factors/823.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numFactoredBinaryTrees(int[] arr) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = arr.length;
     // dp[i] := the number of binary trees with arr[i] as the root
     long[] dp = new long[n];
@@ -18,10 +18,10 @@ public int numFactoredBinaryTrees(int[] arr) {
           final int right = arr[i] / arr[j];
           if (numToIndex.containsKey(right)) {
             dp[i] += dp[j] * dp[numToIndex.get(right)];
-            dp[i] %= MOD;
+            dp[i] %= kMod;
           }
         }
 
-    return (int) (Arrays.stream(dp).sum() % MOD);
+    return (int) (Arrays.stream(dp).sum() % kMod);
   }
 }
diff --git a/solutions/823. Binary Trees With Factors/823.py b/solutions/823. Binary Trees With Factors/823.py
index e3d96103fc5..4c2b48d9f43 100644
--- a/solutions/823. Binary Trees With Factors/823.py	
+++ b/solutions/823. Binary Trees With Factors/823.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def numFactoredBinaryTrees(self, arr: list[int]) -> int:
-    MOD = 1_000_000_007
+  def numFactoredBinaryTrees(self, arr: List[int]) -> int:
+    kMod = 1_000_000_007
     n = len(arr)
     # dp[i] := the number of binary trees with arr[i] as the root
     dp = [1] * n
@@ -13,6 +13,6 @@ def numFactoredBinaryTrees(self, arr: list[int]) -> int:
           right = root // arr[j]
           if right in numToIndex:
             dp[i] += dp[j] * dp[numToIndex[right]]
-            dp[i] %= MOD
+            dp[i] %= kMod
 
-    return sum(dp) % MOD
+    return sum(dp) % kMod
diff --git a/solutions/824. Goat Latin/824.py b/solutions/824. Goat Latin/824.py
index 9bdddac7ae8..267a09e18ad 100644
--- a/solutions/824. Goat Latin/824.py	
+++ b/solutions/824. Goat Latin/824.py	
@@ -1,13 +1,13 @@
 class Solution:
   def toGoatLatin(self, sentence: str) -> str:
     ans = []
-    VOWELS = 'aeiouAEIOU'
+    kVowels = 'aeiouAEIOU'
 
     i = 1
     for word in sentence.split():
       if i > 1:
         ans.append(' ')
-      if word[0] in VOWELS:
+      if word[0] in kVowels:
         ans.append(word)
       else:
         ans.append(word[1:] + word[0])
diff --git a/solutions/825. Friends Of Appropriate Ages/825.py b/solutions/825. Friends Of Appropriate Ages/825.py
index 8bd181c9a05..bf0b302ec21 100644
--- a/solutions/825. Friends Of Appropriate Ages/825.py	
+++ b/solutions/825. Friends Of Appropriate Ages/825.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numFriendRequests(self, ages: list[int]) -> int:
+  def numFriendRequests(self, ages: List[int]) -> int:
     ans = 0
     count = [0] * 121
 
diff --git a/solutions/826. Most Profit Assigning Work/826.java b/solutions/826. Most Profit Assigning Work/826.java
index 1b1a635bde6..9d4f105f153 100644
--- a/solutions/826. Most Profit Assigning Work/826.java	
+++ b/solutions/826. Most Profit Assigning Work/826.java	
@@ -6,7 +6,7 @@ public int maxProfitAssignment(int[] difficulty, int[] profit, int[] worker) {
     for (int i = 0; i < difficulty.length; ++i)
       jobs.add(new Pair<>(difficulty[i], profit[i]));
 
-    Collections.sort(jobs, Comparator.comparingInt(Pair::getKey));
+    Collections.sort(jobs, Comparator.comparing(Pair::getKey));
     Arrays.sort(worker);
 
     int i = 0;
diff --git a/solutions/826. Most Profit Assigning Work/826.py b/solutions/826. Most Profit Assigning Work/826.py
index a634cc4e0f3..ee55a3bd75d 100644
--- a/solutions/826. Most Profit Assigning Work/826.py	
+++ b/solutions/826. Most Profit Assigning Work/826.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def maxProfitAssignment(
-      self,
-      difficulty: list[int],
-      profit: list[int],
-      worker: list[int],
-  ) -> int:
+  def maxProfitAssignment(self, difficulty: List[int], profit: List[int], worker: List[int]) -> int:
     ans = 0
     jobs = sorted(zip(difficulty, profit))
     worker.sort(reverse=1)
diff --git a/solutions/827. Making A Large Island/827.java b/solutions/827. Making A Large Island/827.java
index 9f61ff00230..fe14f2584da 100644
--- a/solutions/827. Making A Large Island/827.java	
+++ b/solutions/827. Making A Large Island/827.java	
@@ -4,7 +4,7 @@ public int largestIsland(int[][] grid) {
     final int n = grid[0].length;
     int maxSize = 0;
     // sizes[i] := the size of the i-th connected component (starting from 2)
-    List<Integer> sizes = new ArrayList<>(List.of(0, 0));
+    List<Integer> sizes = new ArrayList<>(Arrays.asList(0, 0));
 
     // For each 1 in the grid, paint all the connected 1s with the next
     // available color (2, 3, and so on). Also, remember the size of the island
diff --git a/solutions/83. Remove Duplicates from Sorted List/83.cpp b/solutions/83. Remove Duplicates from Sorted List/83.cpp
index 4ebf7be0189..926de8c046e 100644
--- a/solutions/83. Remove Duplicates from Sorted List/83.cpp	
+++ b/solutions/83. Remove Duplicates from Sorted List/83.cpp	
@@ -3,7 +3,7 @@ class Solution {
   ListNode* deleteDuplicates(ListNode* head) {
     ListNode* curr = head;
 
-    while (curr != nullptr) {
+    while (curr) {
       while (curr->next && curr->val == curr->next->val)
         curr->next = curr->next->next;
       curr = curr->next;
diff --git a/solutions/830. Positions of Large Groups/830.py b/solutions/830. Positions of Large Groups/830.py
index ec3d7a1ca7e..572ce49dee7 100644
--- a/solutions/830. Positions of Large Groups/830.py	
+++ b/solutions/830. Positions of Large Groups/830.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largeGroupPositions(self, s: str) -> list[list[int]]:
+  def largeGroupPositions(self, s: str) -> List[List[int]]:
     n = len(s)
     ans = []
     i = 0
diff --git a/solutions/832. Flipping an Image/832.py b/solutions/832. Flipping an Image/832.py
index aa04b8785cb..b7a2362eada 100644
--- a/solutions/832. Flipping an Image/832.py	
+++ b/solutions/832. Flipping an Image/832.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def flipAndInvertImage(self, A: list[list[int]]) -> list[list[int]]:
+  def flipAndInvertImage(self, A: List[List[int]]) -> List[List[int]]:
     n = len(A)
 
     for i in range(n):
diff --git a/solutions/833. Find And Replace in String/833.cpp b/solutions/833. Find And Replace in String/833.cpp
index 66aae98bd4c..31b7ff0b691 100644
--- a/solutions/833. Find And Replace in String/833.cpp	
+++ b/solutions/833. Find And Replace in String/833.cpp	
@@ -2,16 +2,19 @@ class Solution {
  public:
   string findReplaceString(string s, vector<int>& indices,
                            vector<string>& sources, vector<string>& targets) {
-    vector<tuple<int, string, string>> operations;
+    vector<pair<int, int>> sortedIndices;
 
     for (int i = 0; i < indices.size(); ++i)
-      operations.emplace_back(indices[i], sources[i], targets[i]);
+      sortedIndices.emplace_back(indices[i], i);
 
-    ranges::sort(operations, greater<>());
+    ranges::sort(sortedIndices, greater<>());
 
-    for (const auto& [index, source, target] : operations)
-      if (string_view(s.data() + index, source.length()) == source)
+    for (const auto& [index, i] : sortedIndices) {
+      const string& source = sources[i];
+      const string& target = targets[i];
+      if (s.substr(index, source.length()) == source)
         s = s.substr(0, index) + target + s.substr(index + source.length());
+    }
 
     return s;
   }
diff --git a/solutions/833. Find And Replace in String/833.java b/solutions/833. Find And Replace in String/833.java
index 88ce1ca117c..ede379eab2f 100644
--- a/solutions/833. Find And Replace in String/833.java	
+++ b/solutions/833. Find And Replace in String/833.java	
@@ -1,19 +1,20 @@
 class Solution {
   public String findReplaceString(String s, int[] indices, String[] sources, String[] targets) {
-    record Operation(int index, String source, String target) {}
-    Operation[] operations = new Operation[indices.length];
+    List<Pair<Integer, Integer>> sortedIndices = new ArrayList<>();
 
     for (int i = 0; i < indices.length; ++i)
-      operations[i] = new Operation(indices[i], sources[i], targets[i]);
+      sortedIndices.add(new Pair<>(indices[i], i));
 
-    Arrays.sort(operations, Comparator.comparing(Operation::index, Comparator.reverseOrder())
-                                .thenComparing(Operation::source, Comparator.reverseOrder())
-                                .thenComparing(Operation::target, Comparator.reverseOrder()));
+    Collections.sort(sortedIndices, (a, b) -> b.getKey() - a.getKey());
 
-    for (Operation op : operations)
-      if (s.substring(op.index, Math.min(op.index + op.source.length(), s.length()))
-              .equals(op.source))
-        s = s.substring(0, op.index) + op.target + s.substring(op.index + op.source.length());
+    for (Pair<Integer, Integer> sortedIndex : sortedIndices) {
+      final int index = sortedIndex.getKey();
+      final int i = sortedIndex.getValue();
+      final String source = sources[i];
+      final String target = targets[i];
+      if (s.substring(index, index + source.length()).equals(source))
+        s = s.substring(0, index) + target + s.substring(index + source.length());
+    }
 
     return s;
   }
diff --git a/solutions/833. Find And Replace in String/833.py b/solutions/833. Find And Replace in String/833.py
index c261d691600..84e0d1ecb14 100644
--- a/solutions/833. Find And Replace in String/833.py	
+++ b/solutions/833. Find And Replace in String/833.py	
@@ -1,13 +1,7 @@
 class Solution:
-  def findReplaceString(
-      self,
-      s: str,
-      indices: list[int],
-      sources: list[str],
-      targets: list[str]
-  ) -> str:
-    for index, source, target in sorted(zip(indices, sources, targets),
-                                        reverse=True):
+  def findReplaceString(self, s: str, indexes: List[int],
+                        sources: List[str], targets: List[str]) -> str:
+    for index, source, target in sorted(zip(indexes, sources, targets), reverse=True):
       if s[index:index + len(source)] == source:
         s = s[:index] + target + s[index + len(source):]
     return s
diff --git a/solutions/834. Sum of Distances in Tree/834.cpp b/solutions/834. Sum of Distances in Tree/834.cpp
index 0513bd410f2..b3fdc582069 100644
--- a/solutions/834. Sum of Distances in Tree/834.cpp	
+++ b/solutions/834. Sum of Distances in Tree/834.cpp	
@@ -12,32 +12,32 @@ class Solution {
       tree[v].insert(u);
     }
 
-    postorder(tree, 0, /*prev=*/-1, count, ans);
-    preorder(tree, 0, /*prev=*/-1, count, ans);
+    postorder(tree, 0, -1, count, ans);
+    preorder(tree, 0, -1, count, ans);
     return ans;
   }
 
  private:
-  void postorder(const vector<unordered_set<int>>& tree, int u, int prev,
+  void postorder(const vector<unordered_set<int>>& tree, int node, int parent,
                  vector<int>& count, vector<int>& ans) {
-    for (const int v : tree[u]) {
-      if (v == prev)
+    for (const int child : tree[node]) {
+      if (child == parent)
         continue;
-      postorder(tree, v, u, count, ans);
-      count[u] += count[v];
-      ans[u] += ans[v] + count[v];
+      postorder(tree, child, node, count, ans);
+      count[node] += count[child];
+      ans[node] += ans[child] + count[child];
     }
   }
 
-  void preorder(const vector<unordered_set<int>>& tree, int u, int prev,
+  void preorder(const vector<unordered_set<int>>& tree, int node, int parent,
                 vector<int>& count, vector<int>& ans) {
-    for (const int v : tree[u]) {
-      if (v == prev)
+    for (const int child : tree[node]) {
+      if (child == parent)
         continue;
-      // count[v] us are 1 step closer from v than prev.
-      // (n - count[v]) us are 1 step farther from v than prev.
-      ans[v] = ans[u] - count[v] + (tree.size() - count[v]);
-      preorder(tree, v, u, count, ans);
+      // count[child] nodes are 1 step closer from child than parent.
+      // (n - count[child]) nodes are 1 step farther from child than parent.
+      ans[child] = ans[node] - count[child] + (tree.size() - count[child]);
+      preorder(tree, child, node, count, ans);
     }
   }
 };
diff --git a/solutions/834. Sum of Distances in Tree/834.java b/solutions/834. Sum of Distances in Tree/834.java
index 1a83eafcf57..546175984f3 100644
--- a/solutions/834. Sum of Distances in Tree/834.java	
+++ b/solutions/834. Sum of Distances in Tree/834.java	
@@ -21,24 +21,24 @@ public int[] sumOfDistancesInTree(int n, int[][] edges) {
     return ans;
   }
 
-  private void postorder(Set<Integer>[] tree, int u, int prev, int[] count, int[] ans) {
-    for (final int v : tree[u]) {
-      if (v == prev)
+  private void postorder(Set<Integer>[] tree, int node, int parent, int[] count, int[] ans) {
+    for (final int child : tree[node]) {
+      if (child == parent)
         continue;
-      postorder(tree, v, u, count, ans);
-      count[u] += count[v];
-      ans[u] += ans[v] + count[v];
+      postorder(tree, child, node, count, ans);
+      count[node] += count[child];
+      ans[node] += ans[child] + count[child];
     }
   }
 
-  private void preorder(Set<Integer>[] tree, int u, int prev, int[] count, int[] ans) {
-    for (final int v : tree[u]) {
-      if (v == prev)
+  private void preorder(Set<Integer>[] tree, int node, int parent, int[] count, int[] ans) {
+    for (final int child : tree[node]) {
+      if (child == parent)
         continue;
-      // count[v] us are 1 step closer from v than prev.
-      // (n - count[v]) us are 1 step farther from v than prev.
-      ans[v] = ans[u] - count[v] + (tree.length - count[v]);
-      preorder(tree, v, u, count, ans);
+      // count[child] nodes are 1 step closer from child than parent.
+      // (n - count[child]) nodes are 1 step farther from child than parent.
+      ans[child] = ans[node] - count[child] + (tree.length - count[child]);
+      preorder(tree, child, node, count, ans);
     }
   }
 }
diff --git a/solutions/834. Sum of Distances in Tree/834.py b/solutions/834. Sum of Distances in Tree/834.py
index a8120ea715c..d44f7a78db7 100644
--- a/solutions/834. Sum of Distances in Tree/834.py	
+++ b/solutions/834. Sum of Distances in Tree/834.py	
@@ -1,30 +1,30 @@
 class Solution:
-  def sumOfDistancesInTree(self, n: int, edges: list[list[int]]) -> list[int]:
+  def sumOfDistancesInTree(self, n: int, edges: List[List[int]]) -> List[int]:
     ans = [0] * n
     count = [1] * n
-    tree = [set() for _ in range(n)]
+    tree = collections.defaultdict(set)
 
     for u, v in edges:
       tree[u].add(v)
       tree[v].add(u)
 
-    def postorder(u: int, prev: int) -> None:
-      for v in tree[u]:
-        if v == prev:
+    def postorder(node, parent=None):
+      for child in tree[node]:
+        if child == parent:
           continue
-        postorder(v, u)
-        count[u] += count[v]
-        ans[u] += ans[v] + count[v]
+        postorder(child, node)
+        count[node] += count[child]
+        ans[node] += ans[child] + count[child]
 
-    def preorder(u: int, prev: int) -> None:
-      for v in tree[u]:
-        if v == prev:
+    def preorder(node, parent=None):
+      for child in tree[node]:
+        if child == parent:
           continue
-        # count[v] us are 1 step closer from v than prev.
-        # (n - count[v]) us are 1 step farther from v than prev.
-        ans[v] = ans[u] - count[v] + (n - count[v])
-        preorder(v, u)
+        # count[child] nodes are 1 step closer from child than parent.
+        # (n - count[child]) nodes are 1 step farther from child than parent.
+        ans[child] = ans[node] - count[child] + (n - count[child])
+        preorder(child, node)
 
-    postorder(0, -1)
-    preorder(0, -1)
+    postorder(0)
+    preorder(0)
     return ans
diff --git a/solutions/835. Image Overlap/835.java b/solutions/835. Image Overlap/835.java
index 16514e3cc22..f8724d69e4f 100644
--- a/solutions/835. Image Overlap/835.java	
+++ b/solutions/835. Image Overlap/835.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int largestOverlap(int[][] img1, int[][] img2) {
-    final int MAGIC = 100;
+    final int kMagic = 100;
     final int n = img1.length;
     int ans = 0;
     List<int[]> ones1 = new ArrayList<>();
@@ -17,7 +17,7 @@ public int largestOverlap(int[][] img1, int[][] img2) {
 
     for (int[] a : ones1)
       for (int[] b : ones2) {
-        final int key = (a[0] - b[0]) * MAGIC + a[1] - b[1];
+        final int key = (a[0] - b[0]) * kMagic + a[1] - b[1];
         offsetCount.merge(key, 1, Integer::sum);
       }
 
diff --git a/solutions/835. Image Overlap/835.py b/solutions/835. Image Overlap/835.py
index 25b3b6f276a..446be67185f 100644
--- a/solutions/835. Image Overlap/835.py	
+++ b/solutions/835. Image Overlap/835.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def largestOverlap(self, img1: list[list[int]], img2: list[list[int]]) -> int:
-    MAGIC = 100
+  def largestOverlap(self, img1: List[List[int]], img2: List[List[int]]) -> int:
+    kMagic = 100
     ones1 = [(i, j)
              for i, row in enumerate(img1)
              for j, num in enumerate(row)
@@ -13,6 +13,6 @@ def largestOverlap(self, img1: list[list[int]], img2: list[list[int]]) -> int:
 
     for ax, ay in ones1:
       for bx, by in ones2:
-        offsetCount[(ax - bx) * MAGIC + (ay - by)] += 1
+        offsetCount[(ax - bx) * kMagic + (ay - by)] += 1
 
     return max(offsetCount.values()) if offsetCount else 0
diff --git a/solutions/836. Rectangle Overlap/836.py b/solutions/836. Rectangle Overlap/836.py
index 09f46433c3a..cefb2aee1ee 100644
--- a/solutions/836. Rectangle Overlap/836.py	
+++ b/solutions/836. Rectangle Overlap/836.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def isRectangleOverlap(self, rec1: list[int], rec2: list[int]) -> bool:
+  def isRectangleOverlap(self, rec1: List[int], rec2: List[int]) -> bool:
     return rec1[0] < rec2[2] and rec2[0] < rec1[2] and rec1[1] < rec2[3] and rec2[1] < rec1[3]
diff --git a/solutions/84. Largest Rectangle in Histogram/84.py b/solutions/84. Largest Rectangle in Histogram/84.py
index 34c39d2a212..e5a41391dfe 100644
--- a/solutions/84. Largest Rectangle in Histogram/84.py	
+++ b/solutions/84. Largest Rectangle in Histogram/84.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestRectangleArea(self, heights: list[int]) -> int:
+  def largestRectangleArea(self, heights: List[int]) -> int:
     ans = 0
     stack = []
 
diff --git a/solutions/840. Magic Squares In Grid/840.py b/solutions/840. Magic Squares In Grid/840.py
index bb5e59a9f57..9039f06809f 100644
--- a/solutions/840. Magic Squares In Grid/840.py	
+++ b/solutions/840. Magic Squares In Grid/840.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numMagicSquaresInside(self, grid: list[list[int]]) -> int:
+  def numMagicSquaresInside(self, grid: List[List[int]]) -> int:
     def isMagic(i: int, j: int) -> int:
       s = "".join(str(grid[i + num // 3][j + num % 3])
                   for num in [0, 1, 2, 5, 8, 7, 6, 3])
diff --git a/solutions/841. Keys and Rooms/841.py b/solutions/841. Keys and Rooms/841.py
index 957e86d62cb..8c5346ba57f 100644
--- a/solutions/841. Keys and Rooms/841.py	
+++ b/solutions/841. Keys and Rooms/841.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canVisitAllRooms(self, rooms: list[list[int]]) -> bool:
+  def canVisitAllRooms(self, rooms: List[List[int]]) -> bool:
     seen = [False] * len(rooms)
 
     def dfs(node: int) -> None:
diff --git a/solutions/843. Guess the Word/843.cpp b/solutions/843. Guess the Word/843.cpp
index 1b068a3334e..aa4d1f0a307 100644
--- a/solutions/843. Guess the Word/843.cpp	
+++ b/solutions/843. Guess the Word/843.cpp	
@@ -8,19 +8,19 @@
  */
 class Solution {
  public:
-  void findSecretWord(vector<string>& words, Master& master) {
+  void findSecretWord(vector<string>& wordlist, Master& master) {
     srand(time(nullptr));
 
     for (int i = 0; i < 10; ++i) {
-      const string& guessedWord = words[rand() % words.size()];
+      const string& guessedWord = wordlist[rand() % wordlist.size()];
       const int matches = master.guess(guessedWord);
       if (matches == 6)
         break;
       vector<string> updated;
-      for (const string& word : words)
+      for (const string& word : wordlist)
         if (getMatches(guessedWord, word) == matches)
           updated.push_back(word);
-      words = std::move(updated);
+      wordlist = move(updated);
     }
   }
 
diff --git a/solutions/843. Guess the Word/843.java b/solutions/843. Guess the Word/843.java
index 8d69eb28333..83401545505 100644
--- a/solutions/843. Guess the Word/843.java	
+++ b/solutions/843. Guess the Word/843.java	
@@ -6,19 +6,19 @@
  * }
  */
 class Solution {
-  public void findSecretWord(String[] words, Master master) {
+  public void findSecretWord(String[] wordlist, Master master) {
     Random rand = new Random();
 
     for (int i = 0; i < 10; ++i) {
-      final String guessedWord = words[rand.nextInt(words.length)];
+      final String guessedWord = wordlist[rand.nextInt(wordlist.length)];
       final int matches = master.guess(guessedWord);
       if (matches == 6)
         break;
       List<String> updated = new ArrayList<>();
-      for (final String word : words)
+      for (final String word : wordlist)
         if (getMatches(guessedWord, word) == matches)
           updated.add(word);
-      words = updated.toArray(new String[0]);
+      wordlist = updated.toArray(new String[0]);
     }
   }
 
diff --git a/solutions/843. Guess the Word/843.py b/solutions/843. Guess the Word/843.py
index 7170485a7f5..996132a56d3 100644
--- a/solutions/843. Guess the Word/843.py	
+++ b/solutions/843. Guess the Word/843.py	
@@ -6,12 +6,19 @@
 #   def guess(self, word: str) -> int:
 
 class Solution:
-  def findSecretWord(self, words: list[str], master: 'Master') -> None:
+  def findSecretWord(self, wordlist: List[str], master: 'Master') -> None:
+    def getMatches(s1: str, s2: str) -> int:
+      matches = 0
+      for c1, c2 in zip(s1, s2):
+        if c1 == c2:
+          matches += 1
+      return matches
+
     for _ in range(10):
-      guessedWord = words[random.randint(0, len(words) - 1)]
+      guessedWord = wordlist[random.randint(0, len(wordlist) - 1)]
       matches = master.guess(guessedWord)
       if matches == 6:
         break
-      words = [
-          word for word in words
-          if sum(c1 == c2 for c1, c2 in zip(guessedWord, word)) == matches]
+      wordlist = [
+          word for word in wordlist
+          if getMatches(guessedWord, word) == matches]
diff --git a/solutions/845. Longest Mountain in Array/845.py b/solutions/845. Longest Mountain in Array/845.py
index 7b55bc0a248..7c0eedac4fa 100644
--- a/solutions/845. Longest Mountain in Array/845.py	
+++ b/solutions/845. Longest Mountain in Array/845.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def longestMountain(self, arr: list[int]) -> int:
+  def longestMountain(self, arr: List[int]) -> int:
     ans = 0
     i = 0
 
diff --git a/solutions/846. Hand of Straights/846.py b/solutions/846. Hand of Straights/846.py
index 4f9a24ec7de..18bc63aab16 100644
--- a/solutions/846. Hand of Straights/846.py	
+++ b/solutions/846. Hand of Straights/846.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isNStraightHand(self, hand: list[int], groupSize: int) -> bool:
+  def isNStraightHand(self, hand: List[int], groupSize: int) -> bool:
     count = collections.Counter(hand)
 
     for start in sorted(count):
diff --git a/solutions/847. Shortest Path Visiting All Nodes/847.cpp b/solutions/847. Shortest Path Visiting All Nodes/847.cpp
index cab7d5969e5..a9466185ed4 100644
--- a/solutions/847. Shortest Path Visiting All Nodes/847.cpp	
+++ b/solutions/847. Shortest Path Visiting All Nodes/847.cpp	
@@ -3,24 +3,28 @@ class Solution {
   int shortestPathLength(vector<vector<int>>& graph) {
     const int n = graph.size();
     const int goal = (1 << n) - 1;
+
+    int ans = 0;
     queue<pair<int, int>> q;  // (u, state)
     vector<vector<bool>> seen(n, vector<bool>(1 << n));
 
     for (int i = 0; i < n; ++i)
       q.emplace(i, 1 << i);
 
-    for (int step = 0; !q.empty(); ++step)
+    while (!q.empty()) {
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [u, state] = q.front();
         q.pop();
         if (state == goal)
-          return step;
+          return ans;
         if (seen[u][state])
           continue;
         seen[u][state] = true;
         for (const int v : graph[u])
-          q.emplace(v, state | 1 << v);
+          q.emplace(v, state | (1 << v));
       }
+      ++ans;
+    }
 
     return -1;
   }
diff --git a/solutions/847. Shortest Path Visiting All Nodes/847.java b/solutions/847. Shortest Path Visiting All Nodes/847.java
index 4ab94ea6aa9..b09201dcd09 100644
--- a/solutions/847. Shortest Path Visiting All Nodes/847.java	
+++ b/solutions/847. Shortest Path Visiting All Nodes/847.java	
@@ -2,24 +2,28 @@ class Solution {
   public int shortestPathLength(int[][] graph) {
     final int n = graph.length;
     final int goal = (1 << n) - 1;
+
+    int ans = 0;
     Queue<Pair<Integer, Integer>> q = new ArrayDeque<>(); // (u, state)
     boolean[][] seen = new boolean[n][1 << n];
 
     for (int i = 0; i < n; ++i)
       q.offer(new Pair<>(i, 1 << i));
 
-    for (int step = 0; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
       for (int sz = q.size(); sz > 0; --sz) {
         final int u = q.peek().getKey();
         final int state = q.poll().getValue();
         if (state == goal)
-          return step;
+          return ans;
         if (seen[u][state])
           continue;
         seen[u][state] = true;
         for (final int v : graph[u])
-          q.offer(new Pair<>(v, state | 1 << v));
+          q.offer(new Pair<>(v, state | (1 << v)));
       }
+      ++ans;
+    }
 
     return -1;
   }
diff --git a/solutions/847. Shortest Path Visiting All Nodes/847.py b/solutions/847. Shortest Path Visiting All Nodes/847.py
index 05ec067a618..9e58092dad6 100644
--- a/solutions/847. Shortest Path Visiting All Nodes/847.py	
+++ b/solutions/847. Shortest Path Visiting All Nodes/847.py	
@@ -1,24 +1,25 @@
 class Solution:
-  def shortestPathLength(self, graph: list[list[int]]) -> int:
+  def shortestPathLength(self, graph: List[List[int]]) -> int:
     n = len(graph)
     goal = (1 << n) - 1
+
+    ans = 0
     q = collections.deque()  # (u, state)
     seen = set()
 
     for i in range(n):
       q.append((i, 1 << i))
 
-    step = 0
     while q:
       for _ in range(len(q)):
         u, state = q.popleft()
         if state == goal:
-          return step
+          return ans
         if (u, state) in seen:
           continue
         seen.add((u, state))
         for v in graph[u]:
-          q.append((v, state | 1 << v))
-      step += 1
+          q.append((v, state | (1 << v)))
+      ans += 1
 
     return -1
diff --git a/solutions/848. Shifting Letters/848.py b/solutions/848. Shifting Letters/848.py
index 8ff10fa6b89..26867037c09 100644
--- a/solutions/848. Shifting Letters/848.py	
+++ b/solutions/848. Shifting Letters/848.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def shiftingLetters(self, s: str, shifts: list[int]) -> str:
+  def shiftingLetters(self, s: str, shifts: List[int]) -> str:
     ans = []
 
     for i in reversed(range(len(shifts) - 1)):
diff --git a/solutions/849. Maximize Distance to Closest Person/849.py b/solutions/849. Maximize Distance to Closest Person/849.py
index 967c7748934..3268b42c753 100644
--- a/solutions/849. Maximize Distance to Closest Person/849.py	
+++ b/solutions/849. Maximize Distance to Closest Person/849.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxDistToClosest(self, seats: list[int]) -> int:
+  def maxDistToClosest(self, seats: List[int]) -> int:
     n = len(seats)
     ans = 0
     j = -1
diff --git a/solutions/85. Maximal Rectangle/85.py b/solutions/85. Maximal Rectangle/85.py
index 3ea64731787..5a1b4331cb2 100644
--- a/solutions/85. Maximal Rectangle/85.py	
+++ b/solutions/85. Maximal Rectangle/85.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def maximalRectangle(self, matrix: list[list[str]]) -> int:
+  def maximalRectangle(self, matrix: List[List[str]]) -> int:
     if not matrix:
       return 0
 
     ans = 0
     hist = [0] * len(matrix[0])
 
-    def largestRectangleArea(heights: list[int]) -> int:
+    def largestRectangleArea(heights: List[int]) -> int:
       ans = 0
       stack = []
 
diff --git a/solutions/850. Rectangle Area II/850.cpp b/solutions/850. Rectangle Area II/850.cpp
index 88999002c80..16929713258 100644
--- a/solutions/850. Rectangle Area II/850.cpp	
+++ b/solutions/850. Rectangle Area II/850.cpp	
@@ -3,12 +3,14 @@ struct Event {
   int y1;
   int y2;
   char type;
+  Event(int x, int y1, int y2, char type) : x(x), y1(y1), y2(y2), type(type) {}
 };
 
 class Solution {
  public:
   int rectangleArea(vector<vector<int>>& rectangles) {
     constexpr int kMod = 1'000'000'007;
+
     vector<Event> events;
 
     for (const vector<int>& r : rectangles) {
@@ -16,8 +18,8 @@ class Solution {
       events.emplace_back(r[2], r[1], r[3], 'e');
     }
 
-    ranges::sort(events, ranges::less{},
-                 [](const Event& event) { return event.x; });
+    ranges::sort(events,
+                 [](const auto& a, const auto& b) { return a.x < b.x; });
 
     long ans = 0;
     int prevX = 0;
diff --git a/solutions/850. Rectangle Area II/850.java b/solutions/850. Rectangle Area II/850.java
index 32e5fe30fe6..76a2707bb56 100644
--- a/solutions/850. Rectangle Area II/850.java	
+++ b/solutions/850. Rectangle Area II/850.java	
@@ -1,7 +1,19 @@
+class Event {
+  public int x;
+  public int y1;
+  public int y2;
+  public char type;
+  public Event(int x, int y1, int y2, char type) {
+    this.x = x;
+    this.y1 = y1;
+    this.y2 = y2;
+    this.type = type;
+  }
+}
+
 class Solution {
   public int rectangleArea(int[][] rectangles) {
-    record Event(int x, int y1, int y2, char type) {}
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     List<Event> events = new ArrayList<>();
 
     for (int[] r : rectangles) {
@@ -9,7 +21,7 @@ record Event(int x, int y1, int y2, char type) {}
       events.add(new Event(r[2], r[1], r[3], 'e'));
     }
 
-    Collections.sort(events, Comparator.comparingInt(Event::x));
+    Collections.sort(events, (a, b) -> a.x - b.x);
 
     long ans = 0;
     int prevX = 0;
@@ -18,18 +30,18 @@ record Event(int x, int y1, int y2, char type) {}
     for (Event e : events) {
       if (e.x > prevX) {
         final int width = e.x - prevX;
-        ans = (ans + width * getHeight(yPairs)) % MOD;
+        ans = (ans + width * getHeight(yPairs)) % kMod;
         prevX = e.x;
       }
       if (e.type == 's') {
         yPairs.add(new Pair<>(e.y1, e.y2));
-        Collections.sort(yPairs, Comparator.comparingInt(Pair::getKey));
+        Collections.sort(yPairs, Comparator.comparing(Pair::getKey));
       } else { // type == 'e'
         yPairs.remove(new Pair<>(e.y1, e.y2));
       }
     }
 
-    return (int) (ans % MOD);
+    return (int) (ans % kMod);
   }
 
   private long getHeight(List<Pair<Integer, Integer>> yPairs) {
diff --git a/solutions/850. Rectangle Area II/850.py b/solutions/850. Rectangle Area II/850.py
index 1a334a71dbe..b1d1d96f9e1 100644
--- a/solutions/850. Rectangle Area II/850.py	
+++ b/solutions/850. Rectangle Area II/850.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def rectangleArea(self, rectangles: list[list[int]]) -> int:
+  def rectangleArea(self, rectangles: List[List[int]]) -> int:
     events = []
 
     for x1, y1, x2, y2 in rectangles:
@@ -12,7 +12,7 @@ def rectangleArea(self, rectangles: list[list[int]]) -> int:
     prevX = 0
     yPairs = []
 
-    def getHeight(yPairs: list[tuple[int, int]]) -> int:
+    def getHeight(yPairs: List[Tuple[int, int]]) -> int:
       height = 0
       prevY = 0
 
diff --git a/solutions/851. Loud and Rich/851.java b/solutions/851. Loud and Rich/851.java
index dd7a679f196..95d5bac4474 100644
--- a/solutions/851. Loud and Rich/851.java	
+++ b/solutions/851. Loud and Rich/851.java	
@@ -5,7 +5,9 @@ public int[] loudAndRich(int[][] richer, int[] quiet) {
     List<Integer>[] graph = new List[n];
 
     Arrays.fill(ans, -1);
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] r : richer) {
       final int u = r[1];
diff --git a/solutions/851. Loud and Rich/851.py b/solutions/851. Loud and Rich/851.py
index d906adaa16e..33eb1e23d2d 100644
--- a/solutions/851. Loud and Rich/851.py	
+++ b/solutions/851. Loud and Rich/851.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def loudAndRich(self, richer: list[list[int]], quiet: list[int]) -> list[int]:
+  def loudAndRich(self, richer: List[List[int]], quiet: List[int]) -> List[int]:
     graph = [[] for _ in range(len(quiet))]
 
     for v, u in richer:
diff --git a/solutions/852. Peak Index in a Mountain Array/852.py b/solutions/852. Peak Index in a Mountain Array/852.py
index 2b74ea08b51..0d41e02e869 100644
--- a/solutions/852. Peak Index in a Mountain Array/852.py	
+++ b/solutions/852. Peak Index in a Mountain Array/852.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def peakIndexInMountainArray(self, arr: list[int]) -> int:
+  def peakIndexInMountainArray(self, arr: List[int]) -> int:
     l = 0
     r = len(arr) - 1
 
diff --git a/solutions/853. Car Fleet/853.cpp b/solutions/853. Car Fleet/853.cpp
index 86be61664b2..bdc0e3c71f2 100644
--- a/solutions/853. Car Fleet/853.cpp	
+++ b/solutions/853. Car Fleet/853.cpp	
@@ -12,8 +12,8 @@ class Solution {
     for (int i = 0; i < position.size(); ++i)
       cars[i] = {position[i], (double)(target - position[i]) / speed[i]};
 
-    ranges::sort(cars, ranges::greater{},
-                 [](const Car& car) { return car.pos; });
+    ranges::sort(cars,
+                 [](const auto& a, const auto& b) { return a.pos > b.pos; });
 
     double maxTime = 0;  // the time of the slowest car to reach the target
 
diff --git a/solutions/853. Car Fleet/853.java b/solutions/853. Car Fleet/853.java
index b1269475a8d..a9b1745a796 100644
--- a/solutions/853. Car Fleet/853.java	
+++ b/solutions/853. Car Fleet/853.java	
@@ -1,13 +1,22 @@
+class Car {
+  public int pos;
+  public double time;
+
+  public Car(int pos, double time) {
+    this.pos = pos;
+    this.time = time;
+  }
+}
+
 class Solution {
   public int carFleet(int target, int[] position, int[] speed) {
-    record Car(int pos, double time) {}
     int ans = 0;
     Car[] cars = new Car[position.length];
 
     for (int i = 0; i < position.length; ++i)
       cars[i] = new Car(position[i], (double) (target - position[i]) / speed[i]);
 
-    Arrays.sort(cars, Comparator.comparingInt(Car::pos).reversed());
+    Arrays.sort(cars, (a, b) -> b.pos - a.pos);
 
     double maxTime = 0; // the time of the slowest car to reach the target
 
diff --git a/solutions/853. Car Fleet/853.py b/solutions/853. Car Fleet/853.py
index d73a8a4653f..e65cdd3642d 100644
--- a/solutions/853. Car Fleet/853.py	
+++ b/solutions/853. Car Fleet/853.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def carFleet(self, target: int, position: list[int], speed: list[int]) -> int:
+  def carFleet(self, target: int, position: List[int], speed: List[int]) -> int:
     ans = 0
     times = [
         float(target - p) / s for p, s in sorted(zip(position, speed),
diff --git a/solutions/854. K-Similar Strings/854.cpp b/solutions/854. K-Similar Strings/854.cpp
index 1e0657f7f28..9a7e3ba763e 100644
--- a/solutions/854. K-Similar Strings/854.cpp	
+++ b/solutions/854. K-Similar Strings/854.cpp	
@@ -1,15 +1,16 @@
 class Solution {
  public:
   int kSimilarity(string s1, string s2) {
+    int ans = 0;
     queue<string> q{{s1}};
     unordered_set<string> seen{{s1}};
 
-    for (int step = 0; !q.empty(); ++step)
+    while (!q.empty()) {
       for (int sz = q.size(); sz > 0; --sz) {
         string curr = q.front();
         q.pop();
         if (curr == s2)
-          return step;
+          return ans;
         for (const string& child : getChildren(curr, s2)) {
           if (seen.contains(child))
             continue;
@@ -17,6 +18,8 @@ class Solution {
           seen.insert(child);
         }
       }
+      ++ans;
+    }
 
     return -1;
   }
diff --git a/solutions/854. K-Similar Strings/854.java b/solutions/854. K-Similar Strings/854.java
index 8fdca30cb07..03dae4449b5 100644
--- a/solutions/854. K-Similar Strings/854.java	
+++ b/solutions/854. K-Similar Strings/854.java	
@@ -1,13 +1,14 @@
 class Solution {
   public int kSimilarity(String s1, String s2) {
-    Queue<String> q = new ArrayDeque<>(List.of(s1));
+    int ans = 0;
+    Queue<String> q = new ArrayDeque<>(Arrays.asList(s1));
     Set<String> seen = new HashSet<>(Arrays.asList(s1));
 
-    for (int step = 0; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
       for (int sz = q.size(); sz > 0; --sz) {
         final String curr = q.poll();
         if (curr.equals(s2))
-          return step;
+          return ans;
         for (final String child : getChildren(curr, s2)) {
           if (seen.contains(child))
             continue;
@@ -15,6 +16,8 @@ public int kSimilarity(String s1, String s2) {
           seen.add(child);
         }
       }
+      ++ans;
+    }
 
     return -1;
   }
diff --git a/solutions/854. K-Similar Strings/854.py b/solutions/854. K-Similar Strings/854.py
index dcb194a0f96..554315399b0 100644
--- a/solutions/854. K-Similar Strings/854.py	
+++ b/solutions/854. K-Similar Strings/854.py	
@@ -1,24 +1,24 @@
 class Solution:
   def kSimilarity(self, s1: str, s2: str) -> int:
+    ans = 0
     q = collections.deque([s1])
     seen = {s1}
 
-    step = 0
     while q:
       for _ in range(len(q)):
         curr = q.popleft()
         if curr == s2:
-          return step
+          return ans
         for child in self._getChildren(curr, s2):
           if child in seen:
             continue
           q.append(child)
           seen.add(child)
-      step += 1
+      ans += 1
 
     return -1
 
-  def _getChildren(self, curr: str, target: str) -> list[str]:
+  def _getChildren(self, curr: str, target: str) -> List[str]:
     children = []
     s = list(curr)
     i = 0  # the first index s.t. curr[i] != target[i]
diff --git a/solutions/857. Minimum Cost to Hire K Workers/857.java b/solutions/857. Minimum Cost to Hire K Workers/857.java
index b15ca78be5b..4cd10c233fa 100644
--- a/solutions/857. Minimum Cost to Hire K Workers/857.java	
+++ b/solutions/857. Minimum Cost to Hire K Workers/857.java	
@@ -9,7 +9,7 @@ public double mincostToHireWorkers(int[] quality, int[] wage, int k) {
     for (int i = 0; i < quality.length; ++i)
       workers[i] = new Pair<>((double) wage[i] / quality[i], quality[i]);
 
-    Arrays.sort(workers, Comparator.comparingDouble(Pair::getKey));
+    Arrays.sort(workers, (a, b) -> Double.compare(a.getKey(), b.getKey()));
 
     for (Pair<Double, Integer> worker : workers) {
       final double wagePerQuality = worker.getKey();
diff --git a/solutions/857. Minimum Cost to Hire K Workers/857.py b/solutions/857. Minimum Cost to Hire K Workers/857.py
index cfdfd7847c1..c19006e0f2e 100644
--- a/solutions/857. Minimum Cost to Hire K Workers/857.py	
+++ b/solutions/857. Minimum Cost to Hire K Workers/857.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def mincostToHireWorkers(
-      self,
-      quality: list[int],
-      wage: list[int],
-      k: int,
-  ) -> float:
+  def mincostToHireWorkers(self, quality: List[int], wage: List[int], k: int) -> float:
     ans = math.inf
     qualitySum = 0
     # (wagePerQuality, quality) sorted by wagePerQuality
diff --git a/solutions/859. Buddy Strings/859.py b/solutions/859. Buddy Strings/859.py
index 21155aa03cc..39bf9ad4012 100644
--- a/solutions/859. Buddy Strings/859.py	
+++ b/solutions/859. Buddy Strings/859.py	
@@ -6,6 +6,6 @@ def buddyStrings(self, s: str, goal: str) -> bool:
       return True
     diffIndices = [i for i, (a, b) in enumerate(zip(s, goal))
                    if a != b]
-    return (len(diffIndices) == 2 and
-            s[diffIndices[0]] == goal[diffIndices[1]] and
-            s[diffIndices[1]] == goal[diffIndices[0]])
+    return len(diffIndices) == 2 and \
+        s[diffIndices[0]] == goal[diffIndices[1]] and \
+        s[diffIndices[1]] == goal[diffIndices[0]]
diff --git a/solutions/860. Lemonade Change/860.cpp b/solutions/860. Lemonade Change/860.cpp
index 28ce5507953..7d22a172c75 100644
--- a/solutions/860. Lemonade Change/860.cpp	
+++ b/solutions/860. Lemonade Change/860.cpp	
@@ -1,24 +1,24 @@
 class Solution {
  public:
   bool lemonadeChange(vector<int>& bills) {
-    int fives = 0;
-    int tens = 0;
+    int count5 = 0;
+    int count10 = 0;
 
     for (const int bill : bills) {
       if (bill == 5) {
-        ++fives;
+        ++count5;
       } else if (bill == 10) {
-        --fives;
-        ++tens;
+        --count5;
+        ++count10;
       } else {  // bill == 20
-        if (tens > 0) {
-          --tens;
-          --fives;
+        if (count10 > 0) {
+          --count10;
+          --count5;
         } else {
-          fives -= 3;
+          count5 -= 3;
         }
       }
-      if (fives < 0)
+      if (count5 < 0)
         return false;
     }
 
diff --git a/solutions/860. Lemonade Change/860.java b/solutions/860. Lemonade Change/860.java
index 3fbb62e5fea..aad979ea831 100644
--- a/solutions/860. Lemonade Change/860.java	
+++ b/solutions/860. Lemonade Change/860.java	
@@ -1,23 +1,23 @@
 class Solution {
   public boolean lemonadeChange(int[] bills) {
-    int fives = 0;
-    int tens = 0;
+    int count5 = 0;
+    int count10 = 0;
 
     for (final int bill : bills) {
       if (bill == 5) {
-        ++fives;
+        ++count5;
       } else if (bill == 10) {
-        --fives;
-        ++tens;
+        --count5;
+        ++count10;
       } else { // bill == 20
-        if (tens > 0) {
-          --tens;
-          --fives;
+        if (count10 > 0) {
+          --count10;
+          --count5;
         } else {
-          fives -= 3;
+          count5 -= 3;
         }
       }
-      if (fives < 0)
+      if (count5 < 0)
         return false;
     }
 
diff --git a/solutions/860. Lemonade Change/860.py b/solutions/860. Lemonade Change/860.py
index 5e5e7e7ee73..83700fb3ae9 100644
--- a/solutions/860. Lemonade Change/860.py	
+++ b/solutions/860. Lemonade Change/860.py	
@@ -1,21 +1,21 @@
 class Solution:
-  def lemonadeChange(self, bills: list[int]) -> bool:
-    fives = 0
-    tens = 0
+  def lemonadeChange(self, bills: List[int]) -> bool:
+    count5 = 0
+    count10 = 0
 
     for bill in bills:
       if bill == 5:
-        fives += 1
+        count5 += 1
       elif bill == 10:
-        fives -= 1
-        tens += 1
+        count5 -= 1
+        count10 += 1
       else:  # bill == 20
-        if tens > 0:
-          tens -= 1
-          fives -= 1
+        if count10 > 0:
+          count10 -= 1
+          count5 -= 1
         else:
-          fives -= 3
-      if fives < 0:
+          count5 -= 3
+      if count5 < 0:
         return False
 
     return True
diff --git a/solutions/861. Score After Flipping Matrix/861-2.py b/solutions/861. Score After Flipping Matrix/861-2.py
index da5ffbe5711..6b2cb8a81fd 100644
--- a/solutions/861. Score After Flipping Matrix/861-2.py	
+++ b/solutions/861. Score After Flipping Matrix/861-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def matrixScore(self, grid: list[list[int]]) -> int:
+  def matrixScore(self, grid: List[List[int]]) -> int:
     m = len(grid)
     n = len(grid[0])
     ans = m  # All the cells in the first column are 1.
diff --git a/solutions/861. Score After Flipping Matrix/861.py b/solutions/861. Score After Flipping Matrix/861.py
index 1247880d16c..56794df17ba 100644
--- a/solutions/861. Score After Flipping Matrix/861.py	
+++ b/solutions/861. Score After Flipping Matrix/861.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def matrixScore(self, grid: list[list[int]]) -> int:
+  def matrixScore(self, grid: List[List[int]]) -> int:
     # Flip the rows with a leading 0.
     for row in grid:
       if row[0] == 0:
@@ -13,15 +13,15 @@ def matrixScore(self, grid: list[list[int]]) -> int:
     # Add a binary number for each row.
     return sum(self._binary(row) for row in grid)
 
-  def _flip(self, row: list[int]) -> None:
+  def _flip(self, row: List[int]) -> None:
     for i in range(len(row)):
       row[i] ^= 1
 
-  def _flipCol(self, grid: list[list[int]], j: int) -> None:
+  def _flipCol(self, grid: List[List[int]], j: int) -> None:
     for i in range(len(grid)):
       grid[i][j] ^= 1
 
-  def _binary(self, row: list[int]) -> int:
+  def _binary(self, row: List[int]) -> int:
     res = row[0]
     for j in range(1, len(row)):
       res = res * 2 + row[j]
diff --git a/solutions/862. Shortest Subarray with Sum at Least K/862.java b/solutions/862. Shortest Subarray with Sum at Least K/862.java
index b345a18c243..dd3803f333b 100644
--- a/solutions/862. Shortest Subarray with Sum at Least K/862.java	
+++ b/solutions/862. Shortest Subarray with Sum at Least K/862.java	
@@ -13,7 +13,7 @@ public int shortestSubarray(int[] nums, int k) {
         ans = Math.min(ans, i - dq.pollFirst());
       while (!dq.isEmpty() && prefix[i] <= prefix[dq.getLast()])
         dq.pollLast();
-      dq.offerLast(i);
+      dq.addLast(i);
     }
 
     return ans <= n ? ans : -1;
diff --git a/solutions/862. Shortest Subarray with Sum at Least K/862.py b/solutions/862. Shortest Subarray with Sum at Least K/862.py
index 3dc64d6802d..aa1e9aa70e2 100644
--- a/solutions/862. Shortest Subarray with Sum at Least K/862.py	
+++ b/solutions/862. Shortest Subarray with Sum at Least K/862.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def shortestSubarray(self, nums: list[int], k: int) -> int:
+  def shortestSubarray(self, nums: List[int], k: int) -> int:
     n = len(nums)
     ans = n + 1
     dq = collections.deque()
-    prefix = list(itertools.accumulate(nums, initial=0))
+    prefix = [0] + list(itertools.accumulate(nums))
 
     for i in range(n + 1):
       while dq and prefix[i] - prefix[dq[0]] >= k:
diff --git a/solutions/864. Shortest Path to Get All Keys/864.cpp b/solutions/864. Shortest Path to Get All Keys/864.cpp
index ac21bb2d865..f6e473398e2 100644
--- a/solutions/864. Shortest Path to Get All Keys/864.cpp	
+++ b/solutions/864. Shortest Path to Get All Keys/864.cpp	
@@ -2,27 +2,30 @@ struct T {
   int i;
   int j;
   int keys;  // the keys in the bitmask
+  T(int i, int j, int keys) : i(i), j(j), keys(keys) {}
 };
 
 class Solution {
  public:
   int shortestPathAllKeys(vector<string>& grid) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = grid.size();
     const int n = grid[0].length();
     const int keysCount = getKeysCount(grid);
     const int kKeys = (1 << keysCount) - 1;
     const vector<int> start = getStart(grid);
+    int ans = 0;
     queue<T> q{{{start[0], start[1], 0}}};
     vector<vector<vector<bool>>> seen(
         m, vector<vector<bool>>(n, vector<bool>(kKeys)));
     seen[start[0]][start[1]][0] = true;
 
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j, keys] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
@@ -32,7 +35,7 @@ class Solution {
             continue;
           const int newKeys = 'a' <= c && c <= 'f' ? keys | 1 << c - 'a' : keys;
           if (newKeys == kKeys)
-            return step;
+            return ans;
           if (seen[x][y][newKeys])
             continue;
           if ('A' <= c && c <= 'F' && (newKeys >> c - 'A' & 1) == 0)
@@ -41,6 +44,7 @@ class Solution {
           seen[x][y][newKeys] = true;
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/864. Shortest Path to Get All Keys/864.java b/solutions/864. Shortest Path to Get All Keys/864.java
index 0455be66ee4..3cbc2156100 100644
--- a/solutions/864. Shortest Path to Get All Keys/864.java	
+++ b/solutions/864. Shortest Path to Get All Keys/864.java	
@@ -11,22 +11,24 @@ public T(int i, int j, int keys) {
 
 class Solution {
   public int shortestPathAllKeys(String[] grid) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int m = grid.length;
     final int n = grid[0].length();
     final int keysCount = getKeysCount(grid);
-    final int KEYS = (1 << keysCount) - 1;
+    final int kKeys = (1 << keysCount) - 1;
     final int[] start = getStart(grid);
-    Queue<T> q = new ArrayDeque<>(List.of(new T(start[0], start[1], 0)));
-    boolean[][][] seen = new boolean[m][n][KEYS];
+    int ans = 0;
+    Queue<T> q = new ArrayDeque<>(Arrays.asList(new T(start[0], start[1], 0)));
+    boolean[][][] seen = new boolean[m][n][kKeys];
     seen[start[0]][start[1]][0] = true;
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         final int i = q.peek().i;
         final int j = q.peek().j;
         final int keys = q.poll().keys;
-        for (int[] dir : DIRS) {
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == m || y < 0 || y == n)
@@ -35,8 +37,8 @@ public int shortestPathAllKeys(String[] grid) {
           if (c == '#')
             continue;
           final int newKeys = 'a' <= c && c <= 'f' ? keys | 1 << c - 'a' : keys;
-          if (newKeys == KEYS)
-            return step;
+          if (newKeys == kKeys)
+            return ans;
           if (seen[x][y][newKeys])
             continue;
           if ('A' <= c && c <= 'F' && (newKeys >> c - 'A' & 1) == 0)
@@ -45,6 +47,7 @@ public int shortestPathAllKeys(String[] grid) {
           seen[x][y][newKeys] = true;
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/865. Smallest Subtree with all the Deepest Nodes/865.java b/solutions/865. Smallest Subtree with all the Deepest Nodes/865.java
index 825104c7eaa..e25d2f38e04 100644
--- a/solutions/865. Smallest Subtree with all the Deepest Nodes/865.java	
+++ b/solutions/865. Smallest Subtree with all the Deepest Nodes/865.java	
@@ -1,16 +1,24 @@
+class T {
+  public TreeNode lca;
+  public int depth;
+
+  public T(TreeNode lca, int depth) {
+    this.lca = lca;
+    this.depth = depth;
+  }
+};
+
 class Solution {
   public TreeNode subtreeWithAllDeepest(TreeNode root) {
     return dfs(root).lca;
   }
 
-  private record T(TreeNode lca, int depth) {}
-
   private T dfs(TreeNode root) {
     if (root == null)
       return new T(null, 0);
 
-    T left = dfs(root.left);
-    T right = dfs(root.right);
+    T l = dfs(root.left);
+    T r = dfs(root.right);
     if (left.depth > right.depth)
       return new T(left.lca, left.depth + 1);
     if (left.depth < right.depth)
diff --git a/solutions/866. Prime Palindrome/866.cpp b/solutions/866. Prime Palindrome/866.cpp
index 5d4125f7c4d..18c2f60f6c7 100644
--- a/solutions/866. Prime Palindrome/866.cpp	
+++ b/solutions/866. Prime Palindrome/866.cpp	
@@ -32,7 +32,7 @@ class Solution {
     for (int i = pow(10, length - 1); i < pow(10, length); ++i) {
       const string s = to_string(i);
       string reversedS = s;
-      ranges::reverse(reversedS);
+      reverse(reversedS.begin(), reversedS.end());
       for (int j = 0; j < 10; ++j)
         palindromes.push_back(stoi(s + to_string(j) + reversedS));
     }
diff --git a/solutions/867. Transpose Matrix/867.py b/solutions/867. Transpose Matrix/867.py
index b60ec1be2d2..c80ee4aa112 100644
--- a/solutions/867. Transpose Matrix/867.py	
+++ b/solutions/867. Transpose Matrix/867.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def transpose(self, A: list[list[int]]) -> list[list[int]]:
+  def transpose(self, A: List[List[int]]) -> List[List[int]]:
     ans = [[0] * len(A) for _ in range(len(A[0]))]
 
     for i in range(len(A)):
diff --git a/solutions/87. Scramble String/87.py b/solutions/87. Scramble String/87.py
index 99a91c128f5..776fba83aff 100644
--- a/solutions/87. Scramble String/87.py	
+++ b/solutions/87. Scramble String/87.py	
@@ -9,8 +9,7 @@ def isScramble(self, s1: str, s2: str) -> bool:
     for i in range(1, len(s1)):
       if self.isScramble(s1[:i], s2[:i]) and self.isScramble(s1[i:], s2[i:]):
         return True
-      if (self.isScramble(s1[:i], s2[len(s2) - i:]) and
-              self.isScramble(s1[i:], s2[: len(s2) - i])):
+      if self.isScramble(s1[:i], s2[len(s2) - i:]) and self.isScramble(s1[i:], s2[:len(s2) - i]):
         return True
 
     return False
diff --git a/solutions/870. Advantage Shuffle/870.py b/solutions/870. Advantage Shuffle/870.py
index 6aa8beb944b..73e05e8bef3 100644
--- a/solutions/870. Advantage Shuffle/870.py	
+++ b/solutions/870. Advantage Shuffle/870.py	
@@ -2,7 +2,7 @@
 
 
 class Solution:
-  def advantageCount(self, nums1: list[int], nums2: list[int]) -> list[int]:
+  def advantageCount(self, nums1: List[int], nums2: List[int]) -> List[int]:
     sl = SortedList(nums1)
 
     for i, num in enumerate(nums2):
diff --git a/solutions/871. Minimum Number of Refueling Stops/871-2.py b/solutions/871. Minimum Number of Refueling Stops/871-2.py
index fcd38c7634c..539d033c571 100644
--- a/solutions/871. Minimum Number of Refueling Stops/871-2.py	
+++ b/solutions/871. Minimum Number of Refueling Stops/871-2.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minRefuelStops(
-      self,
-      target: int,
-      startFuel: int,
-      stations: list[list[int]],
-  ) -> int:
+  def minRefuelStops(self, target: int, startFuel: int, stations: List[List[int]]) -> int:
     ans = 0
     i = 0  # station's index
     curr = startFuel
diff --git a/solutions/871. Minimum Number of Refueling Stops/871.py b/solutions/871. Minimum Number of Refueling Stops/871.py
index d57ad978f99..62242fcf3db 100644
--- a/solutions/871. Minimum Number of Refueling Stops/871.py	
+++ b/solutions/871. Minimum Number of Refueling Stops/871.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def minRefuelStops(
-      self,
-      target: int,
-      startFuel: int,
-      stations: list[list[int]],
-  ) -> int:
+  def minRefuelStops(self, target: int, startFuel: int, stations: List[List[int]]) -> int:
     # dp[i] := the farthest position we can reach w / i refuels
     dp = [startFuel] + [0] * len(stations)
 
diff --git a/solutions/872. Leaf-Similar Trees/872.py b/solutions/872. Leaf-Similar Trees/872.py
index 5708f7ba76b..8cffc418a72 100644
--- a/solutions/872. Leaf-Similar Trees/872.py	
+++ b/solutions/872. Leaf-Similar Trees/872.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def leafSimilar(self, root1: TreeNode | None, root2: TreeNode | None) -> bool:
-    def dfs(root: TreeNode | None) -> None:
+  def leafSimilar(self, root1: Optional[TreeNode], root2: Optional[TreeNode]) -> bool:
+    def dfs(root: Optional[TreeNode]) -> None:
       if not root:
         return
       if not root.left and not root.right:
diff --git a/solutions/873. Length of Longest Fibonacci Subsequence/873.py b/solutions/873. Length of Longest Fibonacci Subsequence/873.py
index 88f67279fd5..b76e440151b 100644
--- a/solutions/873. Length of Longest Fibonacci Subsequence/873.py	
+++ b/solutions/873. Length of Longest Fibonacci Subsequence/873.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def lenLongestFibSubseq(self, arr: list[int]) -> int:
+  def lenLongestFibSubseq(self, arr: List[int]) -> int:
     n = len(arr)
     ans = 0
     numToIndex = {a: i for i, a in enumerate(arr)}
diff --git a/solutions/874. Walking Robot Simulation/874.cpp b/solutions/874. Walking Robot Simulation/874.cpp
index 1b29a50acc5..012805939eb 100644
--- a/solutions/874. Walking Robot Simulation/874.cpp	
+++ b/solutions/874. Walking Robot Simulation/874.cpp	
@@ -1,30 +1,27 @@
 class Solution {
  public:
   int robotSim(vector<int>& commands, vector<vector<int>>& obstacles) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     int ans = 0;
     int d = 0;  // 0 := north, 1 := east, 2 := south, 3 := west
     int x = 0;  // the start x
     int y = 0;  // the start y
     unordered_set<pair<int, int>, PairHash> obstaclesSet;
 
-    for (const vector<int>& obstacle : obstacles) {
-      const int x = obstacle[0];
-      const int y = obstacle[1];
-      obstaclesSet.insert({x, y});
-    }
+    for (const vector<int>& o : obstacles)
+      obstaclesSet.insert({o[0], o[1]});
 
-    for (const int command : commands) {
-      if (command == -1) {
+    for (const int c : commands) {
+      if (c == -1) {
         d = (d + 1) % 4;
-      } else if (command == -2) {
+      } else if (c == -2) {
         d = (d + 3) % 4;
       } else {
-        for (int step = 0; step < command; ++step) {
-          if (obstaclesSet.contains({x + kDirs[d][0], y + kDirs[d][1]}))
+        for (int step = 0; step < c; ++step) {
+          if (obstaclesSet.contains({x + dirs[d], y + dirs[d + 1]}))
             break;
-          x += kDirs[d][0];
-          y += kDirs[d][1];
+          x += dirs[d];
+          y += dirs[d + 1];
         }
       }
       ans = max(ans, x * x + y * y);
diff --git a/solutions/874. Walking Robot Simulation/874.java b/solutions/874. Walking Robot Simulation/874.java
index 463455ff2fb..b78e0ea1af0 100644
--- a/solutions/874. Walking Robot Simulation/874.java	
+++ b/solutions/874. Walking Robot Simulation/874.java	
@@ -1,29 +1,26 @@
 class Solution {
   public int robotSim(int[] commands, int[][] obstacles) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     int ans = 0;
     int d = 0; // 0 := north, 1 := east, 2 := south, 3 := west
     int x = 0; // the start x
     int y = 0; // the start y
     Set<Pair<Integer, Integer>> obstaclesSet = new HashSet<>();
 
-    for (int[] obstacle : obstacles) {
-      final int x_ = obstacle[0];
-      final int y_ = obstacle[1];
-      obstaclesSet.add(new Pair<>(x_, y_));
-    }
+    for (int[] o : obstacles)
+      obstaclesSet.add(new Pair<>(o[0], o[1]));
 
-    for (final int command : commands) {
-      if (command == -1) {
+    for (final int c : commands) {
+      if (c == -1) {
         d = (d + 1) % 4;
-      } else if (command == -2) {
+      } else if (c == -2) {
         d = (d + 3) % 4;
       } else {
-        for (int step = 0; step < command; ++step) {
-          if (obstaclesSet.contains(new Pair<>(x + DIRS[d][0], y + DIRS[d][1])))
+        for (int step = 0; step < c; ++step) {
+          if (obstaclesSet.contains(new Pair<>(x + dirs[d], y + dirs[d + 1])))
             break;
-          x += DIRS[d][0];
-          y += DIRS[d][1];
+          x += dirs[d];
+          y += dirs[d + 1];
         }
       }
       ans = Math.max(ans, x * x + y * y);
diff --git a/solutions/874. Walking Robot Simulation/874.py b/solutions/874. Walking Robot Simulation/874.py
index bfa1100927c..18954abd129 100644
--- a/solutions/874. Walking Robot Simulation/874.py	
+++ b/solutions/874. Walking Robot Simulation/874.py	
@@ -1,23 +1,24 @@
 class Solution:
-  def robotSim(self, commands: list[int], obstacles: list[list[int]]) -> int:
-    DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0))
+  def robotSim(self, commands: List[int], obstacles: List[List[int]]) -> int:
+    dirs = ((0, 1), (1, 0), (0, -1), (-1, 0))
     ans = 0
     d = 0  # 0 := north, 1 := east, 2 := south, 3 := west
     x = 0  # the start x
     y = 0  # the start y
     obstaclesSet = {(x, y) for x, y in obstacles}
 
-    for command in commands:
-      if command == -1:
+    for c in commands:
+      if c == -1:
         d = (d + 1) % 4
-      elif command == -2:
+      elif c == -2:
         d = (d + 3) % 4
       else:
-        for _ in range(command):
-          if (x + DIRS[d][0], y + DIRS[d][1]) in obstaclesSet:
+        for _ in range(c):
+          if (x + dirs[d], y + dirs[d + 1]) in obstaclesSet:
             break
-          x += DIRS[d][0]
-          y += DIRS[d][1]
+          x += dirs[d]
+          y += dirs[d + 1]
+
       ans = max(ans, x * x + y * y)
 
     return ans
diff --git a/solutions/875. Koko Eating Bananas/875.cpp b/solutions/875. Koko Eating Bananas/875.cpp
index 36710b4cc7d..eee01c00b5e 100644
--- a/solutions/875. Koko Eating Bananas/875.cpp	
+++ b/solutions/875. Koko Eating Bananas/875.cpp	
@@ -18,8 +18,9 @@ class Solution {
  private:
   // Returns the hours to eat all the piles with speed m.
   int eatHours(const vector<int>& piles, int m) {
-    return accumulate(piles.begin(), piles.end(), 0, [&](int acc, int pile) {
-      return acc + (pile - 1) / m + 1;  // ceil(pile / m)
+    return accumulate(piles.begin(), piles.end(), 0,
+                      [&](int subtotal, int pile) {
+      return subtotal + (pile - 1) / m + 1;  // ceil(pile / m)
     });
   }
 };
diff --git a/solutions/875. Koko Eating Bananas/875.py b/solutions/875. Koko Eating Bananas/875.py
index 30896191ec8..bc7519b7ec8 100644
--- a/solutions/875. Koko Eating Bananas/875.py	
+++ b/solutions/875. Koko Eating Bananas/875.py	
@@ -1,9 +1,7 @@
 class Solution:
-  def minEatingSpeed(self, piles: list[int], h: int) -> int:
+  def minEatingSpeed(self, piles: List[int], h: int) -> int:
     def eatHours(m: int) -> bool:
-      """Returns the hours to eat all the piles with speed m."""
-      return sum((pile - 1) // m + 1 for pile in piles)
-    l = 1
-    r = max(piles)
-    return bisect.bisect_left(range(l, r), True,
-                              key=lambda m: eatHours(m) <= h) + l
+      """Returns True if Koko can eat all piles with speed m."""
+      return sum((pile - 1) // m + 1 for pile in piles) <= h
+    return bisect.bisect_left(range(1, max(piles)), True,
+                              key=lambda m: eatHours(m)) + 1
diff --git a/solutions/877. Stone Game/877-2.py b/solutions/877. Stone Game/877-2.py
index 85863a0dadd..a0a925a228a 100644
--- a/solutions/877. Stone Game/877-2.py	
+++ b/solutions/877. Stone Game/877-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def stoneGame(self, piles: list[int]) -> bool:
+  def stoneGame(self, piles: List[int]) -> bool:
     n = len(piles)
     dp = piles.copy()
 
diff --git a/solutions/877. Stone Game/877.py b/solutions/877. Stone Game/877.py
index 5af49d06f10..6cd9c1c5691 100644
--- a/solutions/877. Stone Game/877.py	
+++ b/solutions/877. Stone Game/877.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def stoneGame(self, piles: list[int]) -> bool:
+  def stoneGame(self, piles: List[int]) -> bool:
     n = len(piles)
     # dp[i][j] := the maximum stones you can get more than your opponent in piles[i..j]
     dp = [[0] * n for _ in range(n)]
diff --git a/solutions/878. Nth Magical Number/878.java b/solutions/878. Nth Magical Number/878.java
index 81b7b7efb3f..7e682f3bcbf 100644
--- a/solutions/878. Nth Magical Number/878.java	
+++ b/solutions/878. Nth Magical Number/878.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int nthMagicalNumber(long n, long a, long b) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final long lcm = a * b / gcd(a, b);
     long l = Math.min(a, b);
     long r = Math.min(a, b) * n;
@@ -13,7 +13,7 @@ public int nthMagicalNumber(long n, long a, long b) {
         l = m + 1;
     }
 
-    return (int) (l % MOD);
+    return (int) (l % kMod);
   }
 
   private long gcd(long a, long b) {
diff --git a/solutions/878. Nth Magical Number/878.py b/solutions/878. Nth Magical Number/878.py
index 03c4aec1574..b1c0b7c0188 100644
--- a/solutions/878. Nth Magical Number/878.py	
+++ b/solutions/878. Nth Magical Number/878.py	
@@ -1,8 +1,6 @@
 class Solution:
   def nthMagicalNumber(self, n: int, a: int, b: int) -> int:
     lcm = a * b // math.gcd(a, b)
-    l = min(a, b)
-    r = min(a, b) * n
-    ans = bisect.bisect_left(range(l, r), n,
-                             key=lambda m: m // a + m // b - m // lcm) + l
-    return ans % (10**9 + 7)
+    l = bisect.bisect_left(range(min(a, b), min(a, b) * n), n,
+                           key=lambda m: m // a + m // b - m // lcm) + min(a, b)
+    return l % (10**9 + 7)
diff --git a/solutions/879. Profitable Schemes/879-2.java b/solutions/879. Profitable Schemes/879-2.java
index 7e86f260aac..e9e64a90a96 100644
--- a/solutions/879. Profitable Schemes/879-2.java	
+++ b/solutions/879. Profitable Schemes/879-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int profitableSchemes(int n, int minProfit, int[] group, int[] profit) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i][j] := the number of schemes, where <= i members, generating
     // >= j profits
     int[][] dp = new int[n + 1][minProfit + 1];
@@ -14,7 +14,7 @@ public int profitableSchemes(int n, int minProfit, int[] group, int[] profit) {
       for (int i = n; i >= g; --i)
         for (int j = minProfit; j >= 0; --j) {
           dp[i][j] += dp[i - g][Math.max(0, j - p)];
-          dp[i][j] %= MOD;
+          dp[i][j] %= kMod;
         }
     }
 
diff --git a/solutions/879. Profitable Schemes/879.java b/solutions/879. Profitable Schemes/879.java
index 76cd314b33b..d5a4b1f3338 100644
--- a/solutions/879. Profitable Schemes/879.java	
+++ b/solutions/879. Profitable Schemes/879.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int profitableSchemes(int n, int minProfit, int[] group, int[] profit) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[k][i][j] := the number of schemes, where the first k crimes are
     // committed by <= i members, generating >= j profits
     int[][][] dp = new int[group.length + 1][n + 1][minProfit + 1];
@@ -18,7 +18,7 @@ public int profitableSchemes(int n, int minProfit, int[] group, int[] profit) {
             dp[k][i][j] = dp[k - 1][i][j];
           } else {
             dp[k][i][j] = dp[k - 1][i][j] + dp[k - 1][i - g][Math.max(0, j - p)];
-            dp[k][i][j] %= MOD;
+            dp[k][i][j] %= kMod;
           }
     }
 
diff --git a/solutions/88. Merge Sorted Array/88.py b/solutions/88. Merge Sorted Array/88.py
index 5f134df75f5..84b5e9d2e08 100644
--- a/solutions/88. Merge Sorted Array/88.py	
+++ b/solutions/88. Merge Sorted Array/88.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def merge(self, nums1: list[int], m: int, nums2: list[int], n: int) -> None:
+  def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
     i = m - 1  # nums1's index (the actual nums)
     j = n - 1  # nums2's index
     k = m + n - 1  # nums1's index (the next filled position)
diff --git a/solutions/881. Boats to Save People/881.py b/solutions/881. Boats to Save People/881.py
index c4e27b30a0d..6b11be4e964 100644
--- a/solutions/881. Boats to Save People/881.py	
+++ b/solutions/881. Boats to Save People/881.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numRescueBoats(self, people: list[int], limit: int) -> int:
+  def numRescueBoats(self, people: List[int], limit: int) -> int:
     ans = 0
     i = 0
     j = len(people) - 1
diff --git a/solutions/882. Reachable Nodes In Subdivided Graph/882.cpp b/solutions/882. Reachable Nodes In Subdivided Graph/882.cpp
index 6dbcfe8798f..c49b389aab2 100644
--- a/solutions/882. Reachable Nodes In Subdivided Graph/882.cpp	
+++ b/solutions/882. Reachable Nodes In Subdivided Graph/882.cpp	
@@ -32,9 +32,10 @@ class Solution {
  private:
   int dijkstra(const vector<vector<pair<int, int>>>& graph, int src,
                int maxMoves, vector<int>& dist) {
-    dist[src] = 0;
     using P = pair<int, int>;  // (d, u)
     priority_queue<P, vector<P>, greater<>> minHeap;
+
+    dist[src] = 0;
     minHeap.emplace(dist[src], src);
 
     while (!minHeap.empty()) {
diff --git a/solutions/882. Reachable Nodes In Subdivided Graph/882.java b/solutions/882. Reachable Nodes In Subdivided Graph/882.java
index 16921dc5990..09a3479a309 100644
--- a/solutions/882. Reachable Nodes In Subdivided Graph/882.java	
+++ b/solutions/882. Reachable Nodes In Subdivided Graph/882.java	
@@ -1,9 +1,12 @@
 class Solution {
   public int reachableNodes(int[][] edges, int maxMoves, int n) {
     List<Pair<Integer, Integer>>[] graph = new List[n];
+    Queue<int[]> minHeap = new PriorityQueue<>((a, b) -> a[0] - b[0]); // (d, u)
     int[] dist = new int[n];
     Arrays.fill(dist, maxMoves + 1);
-    Arrays.setAll(graph, i -> new ArrayList<>());
+
+    for (int i = 0; i < n; ++i)
+      graph[i] = new ArrayList<>();
 
     for (int[] edge : edges) {
       final int u = edge[0];
@@ -31,11 +34,11 @@ public int reachableNodes(int[][] edges, int maxMoves, int n) {
   }
 
   private int dijkstra(List<Pair<Integer, Integer>>[] graph, int src, int maxMoves, int[] dist) {
+    // (d, u)
+    Queue<Pair<Integer, Integer>> minHeap = new PriorityQueue<>(Comparator.comparing(Pair::getKey));
+
     dist[src] = 0;
-    Queue<Pair<Integer, Integer>> minHeap =
-        new PriorityQueue<>(Comparator.comparingInt(Pair::getKey)) {
-          { offer(new Pair<>(dist[src], src)); } // (d, u)
-        };
+    minHeap.offer(new Pair<>(dist[src], src));
 
     while (!minHeap.isEmpty()) {
       final int d = minHeap.peek().getKey();
diff --git a/solutions/882. Reachable Nodes In Subdivided Graph/882.py b/solutions/882. Reachable Nodes In Subdivided Graph/882.py
index 9927651067c..9cff1f49a4d 100644
--- a/solutions/882. Reachable Nodes In Subdivided Graph/882.py	
+++ b/solutions/882. Reachable Nodes In Subdivided Graph/882.py	
@@ -1,10 +1,5 @@
 class Solution:
-  def reachableNodes(
-      self,
-      edges: list[list[int]],
-      maxMoves: int,
-      n: int,
-  ) -> int:
+  def reachableNodes(self, edges: List[List[int]], maxMoves: int, n: int) -> int:
     graph = [[] for _ in range(n)]
     dist = [maxMoves + 1] * n
 
@@ -24,13 +19,7 @@ def reachableNodes(
 
     return reachableNodes + reachableSubnodes
 
-  def _dijkstra(
-      self,
-      graph: list[list[tuple[int, int]]],
-      src: int,
-      maxMoves: int,
-      dist: list[int],
-  ) -> int:
+  def _dijkstra(self, graph: List[List[Tuple[int, int]]], src: int, maxMoves: int, dist: List[int]) -> int:
     dist[src] = 0
     minHeap = [(dist[src], src)]  # (d, u)
 
diff --git a/solutions/883. Projection Area of 3D Shapes/883.py b/solutions/883. Projection Area of 3D Shapes/883.py
index b49a785360d..8a0b8422cc5 100644
--- a/solutions/883. Projection Area of 3D Shapes/883.py	
+++ b/solutions/883. Projection Area of 3D Shapes/883.py	
@@ -1,6 +1,3 @@
 class Solution:
-  def projectionArea(self, grid: list[list[int]]) -> int:
-    return sum(
-        a > 0 for row in grid for a in row) + sum(
-        max(row) for row in grid) + sum(
-        max(col) for col in zip(*grid))
+  def projectionArea(self, grid: List[List[int]]) -> int:
+    return sum(a > 0 for row in grid for a in row) + sum(max(row) for row in grid) + sum(max(col) for col in zip(*grid))
diff --git a/solutions/884. Uncommon Words from Two Sentences/884.py b/solutions/884. Uncommon Words from Two Sentences/884.py
index bbd055ead76..25d8ee68b01 100644
--- a/solutions/884. Uncommon Words from Two Sentences/884.py	
+++ b/solutions/884. Uncommon Words from Two Sentences/884.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def uncommonFromSentences(self, A: str, B: str) -> list[str]:
+  def uncommonFromSentences(self, A: str, B: str) -> List[str]:
     count = collections.Counter((A + ' ' + B).split())
     return [word for word, freq in count.items() if freq == 1]
diff --git a/solutions/885. Spiral Matrix III/885.java b/solutions/885. Spiral Matrix III/885.java
index 0149b16c9e8..26bb22dd390 100644
--- a/solutions/885. Spiral Matrix III/885.java	
+++ b/solutions/885. Spiral Matrix III/885.java	
@@ -2,7 +2,7 @@ class Solution {
   public int[][] spiralMatrixIII(int rows, int cols, int rStart, int cStart) {
     final int[] dx = {1, 0, -1, 0};
     final int[] dy = {0, 1, 0, -1};
-    List<int[]> ans = new ArrayList<>(List.of(new int[] {rStart, cStart}));
+    List<int[]> ans = new ArrayList<>(Arrays.asList(new int[] {rStart, cStart}));
 
     for (int i = 0; ans.size() < rows * cols; ++i)
       for (int step = 0; step < i / 2 + 1; ++step) {
diff --git a/solutions/885. Spiral Matrix III/885.py b/solutions/885. Spiral Matrix III/885.py
index d22eceb64b7..8abbbb6a27d 100644
--- a/solutions/885. Spiral Matrix III/885.py	
+++ b/solutions/885. Spiral Matrix III/885.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def spiralMatrixIII(self, rows: int, cols: int, rStart: int, cStart: int) -> list[list[int]]:
+  def spiralMatrixIII(self, rows: int, cols: int, rStart: int, cStart: int) -> List[List[int]]:
     dx = [1, 0, -1, 0]
     dy = [0, 1, 0, -1]
     ans = [[rStart, cStart]]
diff --git a/solutions/886. Possible Bipartition/886.java b/solutions/886. Possible Bipartition/886.java
index 1e42333e8fa..a58545eb159 100644
--- a/solutions/886. Possible Bipartition/886.java	
+++ b/solutions/886. Possible Bipartition/886.java	
@@ -1,10 +1,10 @@
-enum Color { WHITE, RED, GREEN }
+enum Color { kWhite, kRed, kGreen }
 
 class Solution {
   public boolean possibleBipartition(int n, int[][] dislikes) {
     List<Integer>[] graph = new List[n + 1];
     Color[] colors = new Color[n + 1];
-    Arrays.fill(colors, Color.WHITE);
+    Arrays.fill(colors, Color.kWhite);
 
     for (int i = 1; i <= n; ++i)
       graph[i] = new ArrayList<>();
@@ -18,7 +18,7 @@ public boolean possibleBipartition(int n, int[][] dislikes) {
 
     // Reduce to 785. Is Graph Bipartite?
     for (int i = 1; i <= n; ++i)
-      if (colors[i] == Color.WHITE && !isValidColor(graph, i, colors, Color.RED))
+      if (colors[i] == Color.kWhite && !isValidColor(graph, i, colors, Color.kRed))
         return false;
 
     return true;
@@ -26,14 +26,14 @@ public boolean possibleBipartition(int n, int[][] dislikes) {
 
   private boolean isValidColor(List<Integer>[] graph, int u, Color[] colors, Color color) {
     // Always paint red for a white node.
-    if (colors[u] != Color.WHITE)
+    if (colors[u] != Color.kWhite)
       return colors[u] == color;
 
     colors[u] = color; // Always paint the node with `color`.
 
     // All the children should have valid colors.
     for (final int v : graph[u])
-      if (!isValidColor(graph, v, colors, color == Color.RED ? Color.GREEN : Color.RED))
+      if (!isValidColor(graph, v, colors, color == Color.kRed ? Color.kGreen : Color.kRed))
         return false;
 
     return true;
diff --git a/solutions/886. Possible Bipartition/886.py b/solutions/886. Possible Bipartition/886.py
index 81698338c2e..761c666eddc 100644
--- a/solutions/886. Possible Bipartition/886.py	
+++ b/solutions/886. Possible Bipartition/886.py	
@@ -2,15 +2,15 @@
 
 
 class Color(Enum):
-  WHITE = 0
-  RED = 1
-  GREEN = 2
+  kWhite = 0
+  kRed = 1
+  kGreen = 2
 
 
 class Solution:
-  def possibleBipartition(self, n: int, dislikes: list[list[int]]) -> bool:
+  def possibleBipartition(self, n: int, dislikes: List[List[int]]) -> bool:
     graph = [[] for _ in range(n + 1)]
-    colors = [Color.WHITE] * (n + 1)
+    colors = [Color.kWhite] * (n + 1)
 
     for u, v in dislikes:
       graph[u].append(v)
@@ -19,14 +19,14 @@ def possibleBipartition(self, n: int, dislikes: list[list[int]]) -> bool:
     # Reduce to 785. Is Graph Bipartite?
     def isValidColor(u: int, color: Color) -> bool:
       # Always paint red for a white node.
-      if colors[u] != Color.WHITE:
+      if colors[u] != Color.kWhite:
         return colors[u] == color
 
       colors[u] = color  # Always paint the node with `color`.
 
       # All the children should have valid colors.
-      childrenColor = Color.RED if colors[u] == Color.GREEN else Color.GREEN
+      childrenColor = Color.kRed if colors[u] == Color.kGreen else Color.kGreen
       return all(isValidColor(v, childrenColor) for v in graph[u])
 
-    return all(colors[i] != Color.WHITE or isValidColor(i, Color.RED)
+    return all(colors[i] != Color.kWhite or isValidColor(i, Color.kRed)
                for i in range(1, n + 1))
diff --git a/solutions/887. Super Egg Drop/887-3.py b/solutions/887. Super Egg Drop/887-3.py
index b8eb752a27b..16acdff4dee 100644
--- a/solutions/887. Super Egg Drop/887-3.py	
+++ b/solutions/887. Super Egg Drop/887-3.py	
@@ -6,7 +6,7 @@ def superEggDrop(self, k: int, n: int) -> int:
     while dp[moves][k] < n:
       moves += 1
       for eggs in range(1, k + 1):
-        dp[moves][eggs] = (dp[moves - 1][eggs - 1] +
-                           dp[moves - 1][eggs] + 1)
+        dp[moves][eggs] = dp[moves - 1][eggs - 1] + \
+            dp[moves - 1][eggs] + 1
 
     return moves
diff --git a/solutions/888. Fair Candy Swap/888.py b/solutions/888. Fair Candy Swap/888.py
index f3b3f47d6c8..2829f1a0d8e 100644
--- a/solutions/888. Fair Candy Swap/888.py	
+++ b/solutions/888. Fair Candy Swap/888.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def fairCandySwap(
-      self,
-      aliceSizes: list[int],
-      bobSizes: list[int],
-  ) -> list[int]:
+  def fairCandySwap(self, aliceSizes: List[int], bobSizes: List[int]) -> List[int]:
     diff = (sum(aliceSizes) - sum(bobSizes)) // 2
     bobSizesSet = set(bobSizes)
 
diff --git a/solutions/889. Construct Binary Tree from Preorder and Postorder Traversal/889.py b/solutions/889. Construct Binary Tree from Preorder and Postorder Traversal/889.py
index d7e58a9ab99..338483ef3e2 100644
--- a/solutions/889. Construct Binary Tree from Preorder and Postorder Traversal/889.py	
+++ b/solutions/889. Construct Binary Tree from Preorder and Postorder Traversal/889.py	
@@ -1,12 +1,8 @@
 class Solution:
-  def constructFromPrePost(
-      self,
-      pre: list[int],
-      post: list[int],
-  ) -> TreeNode | None:
+  def constructFromPrePost(self, pre: List[int], post: List[int]) -> Optional[TreeNode]:
     postToIndex = {num: i for i, num in enumerate(post)}
 
-    def build(preStart: int, preEnd: int, postStart: int, postEnd: int) -> TreeNode | None:
+    def build(preStart: int, preEnd: int, postStart: int, postEnd: int) -> Optional[TreeNode]:
       if preStart > preEnd:
         return None
       if preStart == preEnd:
diff --git a/solutions/89. Gray Code/89.py b/solutions/89. Gray Code/89.py
index 3b5e733292f..6b388efa1f7 100644
--- a/solutions/89. Gray Code/89.py	
+++ b/solutions/89. Gray Code/89.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def grayCode(self, n: int) -> list[int]:
+  def grayCode(self, n: int) -> List[int]:
     ans = [0]
 
     for i in range(n):
diff --git a/solutions/890. Find and Replace Pattern/890.py b/solutions/890. Find and Replace Pattern/890.py
index b55b991f968..fce9f4e9ccf 100644
--- a/solutions/890. Find and Replace Pattern/890.py	
+++ b/solutions/890. Find and Replace Pattern/890.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findAndReplacePattern(self, words: list[str], pattern: str) -> list[str]:
+  def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]:
     def isIsomorphic(w: str, p: str) -> bool:
       return [*map(w.index, w)] == [*map(p.index, p)]
     return [word for word in words if isIsomorphic(word, pattern)]
diff --git a/solutions/891. Sum of Subsequence Widths/891.java b/solutions/891. Sum of Subsequence Widths/891.java
index d2a7d637a9d..3bea6b73947 100644
--- a/solutions/891. Sum of Subsequence Widths/891.java	
+++ b/solutions/891. Sum of Subsequence Widths/891.java	
@@ -1,15 +1,15 @@
 class Solution {
   public int sumSubseqWidths(int[] nums) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = nums.length;
     long ans = 0;
     long exp = 1;
 
     Arrays.sort(nums);
 
-    for (int i = 0; i < n; ++i, exp = exp * 2 % MOD) {
+    for (int i = 0; i < n; ++i, exp = exp * 2 % kMod) {
       ans += (nums[i] - nums[n - 1 - i]) * exp;
-      ans %= MOD;
+      ans %= kMod;
     }
 
     return (int) ans;
diff --git a/solutions/891. Sum of Subsequence Widths/891.py b/solutions/891. Sum of Subsequence Widths/891.py
index 10243700fa7..114fc07f90e 100644
--- a/solutions/891. Sum of Subsequence Widths/891.py	
+++ b/solutions/891. Sum of Subsequence Widths/891.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def sumSubseqWidths(self, nums: list[int]) -> int:
-    MOD = 1_000_000_007
+  def sumSubseqWidths(self, nums: List[int]) -> int:
+    kMod = 1_000_000_007
     n = len(nums)
     ans = 0
     exp = 1
@@ -9,7 +9,7 @@ def sumSubseqWidths(self, nums: list[int]) -> int:
 
     for i in range(n):
       ans += (nums[i] - nums[n - 1 - i]) * exp
-      ans %= MOD
-      exp = exp * 2 % MOD
+      ans %= kMod
+      exp = exp * 2 % kMod
 
     return ans
diff --git a/solutions/892. Surface Area of 3D Shapes/892.py b/solutions/892. Surface Area of 3D Shapes/892.py
index f88532da7f3..4a8f59aa811 100644
--- a/solutions/892. Surface Area of 3D Shapes/892.py	
+++ b/solutions/892. Surface Area of 3D Shapes/892.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def surfaceArea(self, grid: list[list[int]]) -> int:
+  def surfaceArea(self, grid: List[List[int]]) -> int:
     ans = 0
 
     for i in range(len(grid)):
diff --git a/solutions/893. Groups of Special-Equivalent Strings/893.py b/solutions/893. Groups of Special-Equivalent Strings/893.py
index d9e7e859b63..71a4d7f819d 100644
--- a/solutions/893. Groups of Special-Equivalent Strings/893.py	
+++ b/solutions/893. Groups of Special-Equivalent Strings/893.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def numSpecialEquivGroups(self, words: list[str]) -> int:
+  def numSpecialEquivGroups(self, words: List[str]) -> int:
     return len({''.join(sorted(word[::2])) + ''.join(sorted(word[1::2]))
                 for word in words})
diff --git a/solutions/894. All Possible Full Binary Trees/894.py b/solutions/894. All Possible Full Binary Trees/894.py
index 14a76a595a3..d3053ca742a 100644
--- a/solutions/894. All Possible Full Binary Trees/894.py	
+++ b/solutions/894. All Possible Full Binary Trees/894.py	
@@ -1,6 +1,6 @@
 class Solution:
   @functools.lru_cache(None)
-  def allPossibleFBT(self, n: int) -> list[TreeNode | None]:
+  def allPossibleFBT(self, n: int) -> List[Optional[TreeNode]]:
     if n % 2 == 0:
       return []
     if n == 1:
diff --git a/solutions/896. Monotonic Array/896.py b/solutions/896. Monotonic Array/896.py
index 0ac375a1238..c56fb70c5c0 100644
--- a/solutions/896. Monotonic Array/896.py	
+++ b/solutions/896. Monotonic Array/896.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isMonotonic(self, nums: list[int]) -> bool:
+  def isMonotonic(self, nums: List[int]) -> bool:
     increasing = True
     decreasing = True
 
diff --git a/solutions/899. Orderly Queue/899.py b/solutions/899. Orderly Queue/899.py
index e1ab12c9b59..48e877f24ee 100644
--- a/solutions/899. Orderly Queue/899.py	
+++ b/solutions/899. Orderly Queue/899.py	
@@ -1,4 +1,4 @@
 class Solution:
   def orderlyQueue(self, s: str, k: int) -> str:
-    return (''.join(sorted(s)) if k > 1
-            else min(s[i:] + s[:i] for i in range(len(s))))
+    return ''.join(sorted(s)) if k > 1 \
+        else min(s[i:] + s[:i] for i in range(len(s)))
diff --git a/solutions/90. Subsets II/90.cpp b/solutions/90. Subsets II/90.cpp
index 978dffc5fbf..912d7c40be8 100644
--- a/solutions/90. Subsets II/90.cpp	
+++ b/solutions/90. Subsets II/90.cpp	
@@ -16,7 +16,7 @@ class Solution {
       if (i > s && nums[i] == nums[i - 1])
         continue;
       path.push_back(nums[i]);
-      dfs(nums, i + 1, std::move(path), ans);
+      dfs(nums, i + 1, move(path), ans);
       path.pop_back();
     }
   }
diff --git a/solutions/90. Subsets II/90.py b/solutions/90. Subsets II/90.py
index 0eb1d2f803d..0c86e6757a2 100644
--- a/solutions/90. Subsets II/90.py	
+++ b/solutions/90. Subsets II/90.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def subsetsWithDup(self, nums: list[int]) -> list[list[int]]:
+  def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
     ans = []
 
-    def dfs(s: int, path: list[int]) -> None:
+    def dfs(s: int, path: List[int]) -> None:
       ans.append(path)
       if s == len(nums):
         return
diff --git a/solutions/900. RLE Iterator/900.py b/solutions/900. RLE Iterator/900.py
index 65ceb89a7f8..d82dde2e323 100644
--- a/solutions/900. RLE Iterator/900.py	
+++ b/solutions/900. RLE Iterator/900.py	
@@ -1,5 +1,5 @@
 class RLEIterator:
-  def __init__(self, encoding: list[int]):
+  def __init__(self, encoding: List[int]):
     self.encoding = encoding
     self.index = 0
 
diff --git a/solutions/902. Numbers At Most N Given Digit Set/902.py b/solutions/902. Numbers At Most N Given Digit Set/902.py
index 0105049ac7f..780fcd85541 100644
--- a/solutions/902. Numbers At Most N Given Digit Set/902.py	
+++ b/solutions/902. Numbers At Most N Given Digit Set/902.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def atMostNGivenDigitSet(self, digits: list[str], n: int) -> int:
+  def atMostNGivenDigitSet(self, digits: List[str], n: int) -> int:
     ans = 0
     num = str(n)
 
diff --git a/solutions/903. Valid Permutations for DI Sequence/903-2.cpp b/solutions/903. Valid Permutations for DI Sequence/903-2.cpp
index c598b839615..0d1dca02bc3 100644
--- a/solutions/903. Valid Permutations for DI Sequence/903-2.cpp	
+++ b/solutions/903. Valid Permutations for DI Sequence/903-2.cpp	
@@ -26,7 +26,7 @@ class Solution {
           newDp[j] = prefix;
         }
       }
-      dp = std::move(newDp);
+      dp = move(newDp);
     }
 
     return dp[0];
diff --git a/solutions/903. Valid Permutations for DI Sequence/903-2.java b/solutions/903. Valid Permutations for DI Sequence/903-2.java
index 132cea9a034..45b47e04a95 100644
--- a/solutions/903. Valid Permutations for DI Sequence/903-2.java	
+++ b/solutions/903. Valid Permutations for DI Sequence/903-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numPermsDISequence(String s) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = s.length();
     int[] dp = new int[n + 1];
 
@@ -14,14 +14,14 @@ public int numPermsDISequence(String s) {
         // Calculate the postfix sum to prevent duplicate calculation.
         int postfixsum = 0;
         for (int j = n - i; j >= 0; --j) {
-          postfixsum = (postfixsum + dp[j + 1]) % MOD;
+          postfixsum = (postfixsum + dp[j + 1]) % kMod;
           newDp[j] = postfixsum;
         }
       } else { // s[i - 1] == 'D'
         // Calculate the prefix sum to prevent duplicate calculation.
         int prefix = 0;
         for (int j = 0; j <= n - i; ++j) {
-          prefix = (prefix + dp[j]) % MOD;
+          prefix = (prefix + dp[j]) % kMod;
           newDp[j] = prefix;
         }
       }
diff --git a/solutions/903. Valid Permutations for DI Sequence/903.java b/solutions/903. Valid Permutations for DI Sequence/903.java
index 0855b4207ba..67a25a28f01 100644
--- a/solutions/903. Valid Permutations for DI Sequence/903.java	
+++ b/solutions/903. Valid Permutations for DI Sequence/903.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numPermsDISequence(String s) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = s.length();
     // dp[i][j] := the number of valid permutations with i + 1 digits, where s[i] is j-th
     // Digit of remaining digits
@@ -15,14 +15,14 @@ public int numPermsDISequence(String s) {
         // Calculate the postfix sum to prevent duplicate calculation.
         int postfixsum = 0;
         for (int j = n - i; j >= 0; --j) {
-          postfixsum = (postfixsum + dp[i - 1][j + 1]) % MOD;
+          postfixsum = (postfixsum + dp[i - 1][j + 1]) % kMod;
           dp[i][j] = postfixsum;
         }
       } else { // s[i - 1] == 'D'
         // Calculate the prefix sum to prevent duplicate calculation.
         int prefix = 0;
         for (int j = 0; j <= n - i; ++j) {
-          prefix = (prefix + dp[i - 1][j]) % MOD;
+          prefix = (prefix + dp[i - 1][j]) % kMod;
           dp[i][j] = prefix;
         }
       }
diff --git a/solutions/904. Fruit Into Baskets/904.py b/solutions/904. Fruit Into Baskets/904.py
index b5fb152bd77..58827459080 100644
--- a/solutions/904. Fruit Into Baskets/904.py	
+++ b/solutions/904. Fruit Into Baskets/904.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def totalFruit(self, fruits: list[int]) -> int:
+  def totalFruit(self, fruits: List[int]) -> int:
     ans = 0
     count = collections.defaultdict(int)
 
diff --git a/solutions/905. Sort Array By Parity/905.py b/solutions/905. Sort Array By Parity/905.py
index 5dab36807ca..ad2dcb9b2c1 100644
--- a/solutions/905. Sort Array By Parity/905.py	
+++ b/solutions/905. Sort Array By Parity/905.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sortArrayByParity(self, nums: list[int]) -> list[int]:
+  def sortArrayByParity(self, nums: List[int]) -> List[int]:
     l = 0
     r = len(nums) - 1
 
diff --git a/solutions/907. Sum of Subarray Minimums/907.java b/solutions/907. Sum of Subarray Minimums/907.java
index 03354d62ac4..13c1d8c98b5 100644
--- a/solutions/907. Sum of Subarray Minimums/907.java	
+++ b/solutions/907. Sum of Subarray Minimums/907.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int sumSubarrayMins(int[] arr) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     final int n = arr.length;
     long ans = 0;
     // prevMin[i] := index k s.t. arr[k] is the previous minimum in arr[:i]
@@ -24,7 +24,7 @@ public int sumSubarrayMins(int[] arr) {
 
     for (int i = 0; i < arr.length; ++i) {
       ans += (long) arr[i] * (i - prevMin[i]) * (nextMin[i] - i);
-      ans %= MOD;
+      ans %= kMod;
     }
 
     return (int) ans;
diff --git a/solutions/907. Sum of Subarray Minimums/907.py b/solutions/907. Sum of Subarray Minimums/907.py
index 714bf46638e..f3aad7e06f7 100644
--- a/solutions/907. Sum of Subarray Minimums/907.py	
+++ b/solutions/907. Sum of Subarray Minimums/907.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def sumSubarrayMins(self, arr: list[int]) -> int:
-    MOD = 1_000_000_007
+  def sumSubarrayMins(self, arr: List[int]) -> int:
+    kMod = 1_000_000_007
     n = len(arr)
     ans = 0
     # prevMin[i] := index k s.t. arr[k] is the previous minimum in arr[:i]
@@ -19,6 +19,6 @@ def sumSubarrayMins(self, arr: list[int]) -> int:
 
     for i, a in enumerate(arr):
       ans += a * (i - prevMin[i]) * (nextMin[i] - i)
-      ans %= MOD
+      ans %= kMod
 
     return ans
diff --git a/solutions/908. Smallest Range I/908.py b/solutions/908. Smallest Range I/908.py
index b5e34418341..ec0e34a63ab 100644
--- a/solutions/908. Smallest Range I/908.py	
+++ b/solutions/908. Smallest Range I/908.py	
@@ -1,3 +1,3 @@
 class Solution:
-  def smallestRangeI(self, nums: list[int], k: int) -> int:
+  def smallestRangeI(self, nums: List[int], k: int) -> int:
     return max(0, max(nums) - min(nums) - 2 * k)
diff --git a/solutions/909. Snakes and Ladders/909.cpp b/solutions/909. Snakes and Ladders/909.cpp
index 936b137abe4..a1d7e6bd99d 100644
--- a/solutions/909. Snakes and Ladders/909.cpp	
+++ b/solutions/909. Snakes and Ladders/909.cpp	
@@ -2,28 +2,31 @@ class Solution {
  public:
   int snakesAndLadders(vector<vector<int>>& board) {
     const int n = board.size();
+    int ans = 0;
     queue<int> q{{1}};
     vector<bool> seen(1 + n * n);
-    vector<int> arr(1 + n * n);  // 2D -> 1D
+    vector<int> A(1 + n * n);  // 2D -> 1D
 
     for (int i = 0; i < n; ++i)
       for (int j = 0; j < n; ++j)
-        arr[(n - 1 - i) * n + ((n - i) % 2 == 0 ? n - j : j + 1)] = board[i][j];
+        A[(n - 1 - i) * n + ((n - i) % 2 == 0 ? n - j : j + 1)] = board[i][j];
 
-    for (int step = 1; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         const int curr = q.front();
         q.pop();
         for (int next = curr + 1; next <= min(curr + 6, n * n); ++next) {
-          const int dest = arr[next] > 0 ? arr[next] : next;
+          const int dest = A[next] > 0 ? A[next] : next;
           if (dest == n * n)
-            return step;
+            return ans;
           if (seen[dest])
             continue;
           q.push(dest);
           seen[dest] = true;
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/909. Snakes and Ladders/909.java b/solutions/909. Snakes and Ladders/909.java
index 540a9fe2e04..3a76f537b4e 100644
--- a/solutions/909. Snakes and Ladders/909.java	
+++ b/solutions/909. Snakes and Ladders/909.java	
@@ -1,27 +1,30 @@
 class Solution {
   public int snakesAndLadders(int[][] board) {
     final int n = board.length;
-    Queue<Integer> q = new ArrayDeque<>(List.of(1));
+    int ans = 0;
+    Queue<Integer> q = new ArrayDeque<>(Arrays.asList(1));
     boolean[] seen = new boolean[1 + n * n];
-    int[] arr = new int[1 + n * n]; // 2D -> 1D
+    int[] A = new int[1 + n * n]; // 2D -> 1D
 
     for (int i = 0; i < n; ++i)
       for (int j = 0; j < n; ++j)
-        arr[(n - 1 - i) * n + ((n - i) % 2 == 0 ? n - j : j + 1)] = board[i][j];
+        A[(n - 1 - i) * n + ((n - i) % 2 == 0 ? n - j : j + 1)] = board[i][j];
 
-    for (int step = 1; !q.isEmpty(); ++step)
+    while (!q.isEmpty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         final int curr = q.poll();
         for (int next = curr + 1; next <= Math.min(curr + 6, n * n); ++next) {
-          final int dest = arr[next] > 0 ? arr[next] : next;
+          final int dest = A[next] > 0 ? A[next] : next;
           if (dest == n * n)
-            return step;
+            return ans;
           if (seen[dest])
             continue;
           q.offer(dest);
           seen[dest] = true;
         }
       }
+    }
 
     return -1;
   }
diff --git a/solutions/909. Snakes and Ladders/909.py b/solutions/909. Snakes and Ladders/909.py
index ba16bd929f8..bc76febf00c 100644
--- a/solutions/909. Snakes and Ladders/909.py	
+++ b/solutions/909. Snakes and Ladders/909.py	
@@ -1,26 +1,26 @@
 class Solution:
-  def snakesAndLadders(self, board: list[list[int]]) -> int:
+  def snakesAndLadders(self, board: List[List[int]]) -> int:
     n = len(board)
+    ans = 0
     q = collections.deque([1])
     seen = set()
-    arr = [0] * (1 + n * n)  # 2D -> 1D
+    A = [0] * (1 + n * n)  # 2D -> 1D
 
     for i in range(n):
       for j in range(n):
-        arr[(n - 1 - i) * n + (n - j if (n - i) % 2 == 0 else j + 1)] = board[i][j]
+        A[(n - 1 - i) * n + (n - j if (n - i) % 2 == 0 else j + 1)] = board[i][j]
 
-    step = 1
     while q:
+      ans += 1
       for _ in range(len(q)):
         curr = q.popleft()
         for next in range(curr + 1, min(curr + 6, n * n) + 1):
-          dest = arr[next] if arr[next] > 0 else next
+          dest = A[next] if A[next] > 0 else next
           if dest == n * n:
-            return step
+            return ans
           if dest in seen:
             continue
           q.append(dest)
           seen.add(dest)
-      step += 1
 
     return -1
diff --git a/solutions/910. Smallest Range II/910.py b/solutions/910. Smallest Range II/910.py
index 015ebd66e79..12b6437fe7c 100644
--- a/solutions/910. Smallest Range II/910.py	
+++ b/solutions/910. Smallest Range II/910.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def smallestRangeII(self, nums: list[int], k: int) -> int:
+  def smallestRangeII(self, nums: List[int], k: int) -> int:
     nums.sort()
 
     ans = nums[-1] - nums[0]
diff --git a/solutions/911. Online Election/911.py b/solutions/911. Online Election/911.py
index 26d961c6dfe..11c6ee728f7 100644
--- a/solutions/911. Online Election/911.py	
+++ b/solutions/911. Online Election/911.py	
@@ -1,5 +1,5 @@
 class TopVotedCandidate:
-  def __init__(self, persons: list[int], times: list[int]):
+  def __init__(self, persons: List[int], times: List[int]):
     self.times = times
     self.timeToLead = {}
     count = collections.Counter()  # {person: voted}
diff --git a/solutions/912. Sort an Array/912-2.cpp b/solutions/912. Sort an Array/912-2.cpp
index 8854e4fcb96..d1e38550e5b 100644
--- a/solutions/912. Sort an Array/912-2.cpp	
+++ b/solutions/912. Sort an Array/912-2.cpp	
@@ -6,32 +6,32 @@ class Solution {
   }
 
  private:
-  void heapSort(vector<int>& nums) {
-    buildMaxHeap(nums);
-    int heapSize = nums.size();
-    for (int i = nums.size() - 1; i > 0; --i) {
-      swap(nums[i], nums[0]);
+  void heapSort(vector<int>& A) {
+    buildMaxHeap(A);
+    int heapSize = A.size();
+    for (int i = A.size() - 1; i > 0; --i) {
+      swap(A[i], A[0]);
       --heapSize;
-      maxHeapify(nums, 0, heapSize);
+      maxHeapify(A, 0, heapSize);
     }
   }
 
-  void buildMaxHeap(vector<int>& nums) {
-    for (int i = nums.size() / 2; i >= 0; --i)
-      maxHeapify(nums, i, nums.size());
+  void buildMaxHeap(vector<int>& A) {
+    for (int i = A.size() / 2; i >= 0; --i)
+      maxHeapify(A, i, A.size());
   }
 
-  void maxHeapify(vector<int>& nums, int i, int heapSize) {
+  void maxHeapify(vector<int>& A, int i, int heapSize) {
     const int l = 2 * i + 1;
     const int r = 2 * i + 2;
     int largest = i;
-    if (l < heapSize && nums[largest] < nums[l])
+    if (l < heapSize && A[largest] < A[l])
       largest = l;
-    if (r < heapSize && nums[largest] < nums[r])
+    if (r < heapSize && A[largest] < A[r])
       largest = r;
     if (largest != i) {
-      swap(nums[largest], nums[i]);
-      maxHeapify(nums, largest, heapSize);
+      swap(A[largest], A[i]);
+      maxHeapify(A, largest, heapSize);
     }
   }
 };
diff --git a/solutions/912. Sort an Array/912-2.java b/solutions/912. Sort an Array/912-2.java
index eff7576631a..1bc9a5a1a02 100644
--- a/solutions/912. Sort an Array/912-2.java	
+++ b/solutions/912. Sort an Array/912-2.java	
@@ -4,38 +4,38 @@ public int[] sortArray(int[] nums) {
     return nums;
   }
 
-  private void heapSort(int[] nums) {
-    buildMaxHeap(nums);
-    int heapSize = nums.length;
-    for (int i = nums.length - 1; i > 0; --i) {
-      swap(nums, i, 0);
+  private void heapSort(int[] A) {
+    buildMaxHeap(A);
+    int heapSize = A.length;
+    for (int i = A.length - 1; i > 0; --i) {
+      swap(A, i, 0);
       --heapSize;
-      maxHeapify(nums, 0, heapSize);
+      maxHeapify(A, 0, heapSize);
     }
   }
 
-  private void buildMaxHeap(int[] nums) {
-    for (int i = nums.length / 2; i >= 0; --i)
-      maxHeapify(nums, i, nums.length);
+  private void buildMaxHeap(int[] A) {
+    for (int i = A.length / 2; i >= 0; --i)
+      maxHeapify(A, i, A.length);
   }
 
-  private void maxHeapify(int[] nums, int i, int heapSize) {
+  private void maxHeapify(int[] A, int i, int heapSize) {
     final int l = 2 * i + 1;
     final int r = 2 * i + 2;
     int largest = i;
-    if (l < heapSize && nums[largest] < nums[l])
+    if (l < heapSize && A[largest] < A[l])
       largest = l;
-    if (r < heapSize && nums[largest] < nums[r])
+    if (r < heapSize && A[largest] < A[r])
       largest = r;
     if (largest != i) {
-      swap(nums, largest, i);
-      maxHeapify(nums, largest, heapSize);
+      swap(A, largest, i);
+      maxHeapify(A, largest, heapSize);
     }
   }
 
-  private void swap(int[] nums, int i, int j) {
-    final int temp = nums[i];
-    nums[i] = nums[j];
-    nums[j] = temp;
+  private void swap(int[] A, int i, int j) {
+    final int temp = A[i];
+    A[i] = A[j];
+    A[j] = temp;
   }
 }
diff --git a/solutions/912. Sort an Array/912-2.py b/solutions/912. Sort an Array/912-2.py
index bae01758080..93561e8e5b1 100644
--- a/solutions/912. Sort an Array/912-2.py	
+++ b/solutions/912. Sort an Array/912-2.py	
@@ -1,28 +1,28 @@
 class Solution:
-  def sortArray(self, nums: list[int]) -> list[int]:
-    self._heapSort(nums)
-    return nums
+  def sortArray(self, nums: List[int]) -> List[int]:
+    def heapSort(A: List[int]) -> None:
+      def maxHeapify(A: List[int], i: int, heapSize: int) -> None:
+        l = 2 * i + 1
+        r = 2 * i + 2
+        largest = i
+        if l < heapSize and A[largest] < A[l]:
+          largest = l
+        if r < heapSize and A[largest] < A[r]:
+          largest = r
+        if largest != i:
+          A[largest], A[i] = A[i], A[largest]
+          maxHeapify(A, largest, heapSize)
 
-  def _heapSort(self, nums: list[int]) -> None:
-    def maxHeapify(nums: list[int], i: int, heapSize: int) -> None:
-      l = 2 * i + 1
-      r = 2 * i + 2
-      largest = i
-      if l < heapSize and nums[largest] < nums[l]:
-        largest = l
-      if r < heapSize and nums[largest] < nums[r]:
-        largest = r
-      if largest != i:
-        nums[largest], nums[i] = nums[i], nums[largest]
-        maxHeapify(nums, largest, heapSize)
+      def buildMaxHeap(A: List[int]) -> None:
+        for i in range(len(A) // 2, -1, -1):
+          maxHeapify(A, i, len(A))
 
-    def buildMaxHeap(nums: list[int]) -> None:
-      for i in range(len(nums) // 2, -1, -1):
-        maxHeapify(nums, i, len(nums))
+      buildMaxHeap(A)
+      heapSize = len(A)
+      for i in reversed(range(1, len(A))):
+        A[i], A[0] = A[0], A[i]
+        heapSize -= 1
+        maxHeapify(A, 0, heapSize)
 
-    buildMaxHeap(nums)
-    heapSize = len(nums)
-    for i in reversed(range(1, len(nums))):
-      nums[i], nums[0] = nums[0], nums[i]
-      heapSize -= 1
-      maxHeapify(nums, 0, heapSize)
+    heapSort(nums)
+    return nums
diff --git a/solutions/912. Sort an Array/912-3.cpp b/solutions/912. Sort an Array/912-3.cpp
index 1ad3c91d123..5eef624b9c9 100644
--- a/solutions/912. Sort an Array/912-3.cpp	
+++ b/solutions/912. Sort an Array/912-3.cpp	
@@ -6,24 +6,24 @@ class Solution {
   }
 
  private:
-  void quickSort(vector<int>& nums, int l, int r) {
+  void quickSort(vector<int>& A, int l, int r) {
     if (l >= r)
       return;
 
-    const int m = partition(nums, l, r);
-    quickSort(nums, l, m - 1);
-    quickSort(nums, m + 1, r);
+    const int m = partition(A, l, r);
+    quickSort(A, l, m - 1);
+    quickSort(A, m + 1, r);
   }
 
-  int partition(vector<int>& nums, int l, int r) {
+  int partition(vector<int>& A, int l, int r) {
     const int randIndex = rand() % (r - l + 1) + l;
-    swap(nums[randIndex], nums[r]);
-    const int pivot = nums[r];
+    swap(A[randIndex], A[r]);
+    const int pivot = A[r];
     int nextSwapped = l;
     for (int i = l; i < r; ++i)
-      if (nums[i] <= pivot)
-        swap(nums[nextSwapped++], nums[i]);
-    swap(nums[nextSwapped], nums[r]);
+      if (A[i] <= pivot)
+        swap(A[nextSwapped++], A[i]);
+    swap(A[nextSwapped], A[r]);
     return nextSwapped;
   }
 };
diff --git a/solutions/912. Sort an Array/912-3.java b/solutions/912. Sort an Array/912-3.java
index 59cc4642a1b..25aa88d4aa6 100644
--- a/solutions/912. Sort an Array/912-3.java	
+++ b/solutions/912. Sort an Array/912-3.java	
@@ -4,30 +4,30 @@ public int[] sortArray(int[] nums) {
     return nums;
   }
 
-  private void quickSort(int[] nums, int l, int r) {
+  private void quickSort(int[] A, int l, int r) {
     if (l >= r)
       return;
 
-    final int m = partition(nums, l, r);
-    quickSort(nums, l, m - 1);
-    quickSort(nums, m + 1, r);
+    final int m = partition(A, l, r);
+    quickSort(A, l, m - 1);
+    quickSort(A, m + 1, r);
   }
 
-  private int partition(int[] nums, int l, int r) {
+  private int partition(int[] A, int l, int r) {
     final int randIndex = new Random().nextInt(r - l + 1) + l;
-    swap(nums, randIndex, r);
-    final int pivot = nums[r];
+    swap(A, randIndex, r);
+    final int pivot = A[r];
     int nextSwapped = l;
     for (int i = l; i < r; ++i)
-      if (nums[i] <= pivot)
-        swap(nums, nextSwapped++, i);
-    swap(nums, nextSwapped, r);
+      if (A[i] <= pivot)
+        swap(A, nextSwapped++, i);
+    swap(A, nextSwapped, r);
     return nextSwapped;
   }
 
-  private void swap(int[] nums, int i, int j) {
-    final int temp = nums[i];
-    nums[i] = nums[j];
-    nums[j] = temp;
+  private void swap(int[] A, int i, int j) {
+    final int temp = A[i];
+    A[i] = A[j];
+    A[j] = temp;
   }
 }
diff --git a/solutions/912. Sort an Array/912-3.py b/solutions/912. Sort an Array/912-3.py
index 7d30eacc9c2..3ddd16992cc 100644
--- a/solutions/912. Sort an Array/912-3.py	
+++ b/solutions/912. Sort an Array/912-3.py	
@@ -1,24 +1,24 @@
 class Solution:
-  def sortArray(self, nums: list[int]) -> list[int]:
-    self._quickSort(nums, 0, len(nums) - 1)
-    return nums
+  def sortArray(self, nums: List[int]) -> List[int]:
+    def quickSort(A: List[int], l: int, r: int) -> None:
+      if l >= r:
+        return
 
-  def _quickSort(self, nums: list[int], l: int, r: int) -> None:
-    if l >= r:
-      return
+      def partition(A: List[int], l: int, r: int) -> int:
+        randIndex = random.randint(0, r - l) + l
+        A[randIndex], A[r] = A[r], A[randIndex]
+        pivot = A[r]
+        nextSwapped = l
+        for i in range(l, r):
+          if A[i] <= pivot:
+            A[nextSwapped], A[i] = A[i], A[nextSwapped]
+            nextSwapped += 1
+        A[nextSwapped], A[r] = A[r], A[nextSwapped]
+        return nextSwapped
 
-    def partition(nums: list[int], l: int, r: int) -> int:
-      randIndex = random.randint(0, r - l) + l
-      nums[randIndex], nums[r] = nums[r], nums[randIndex]
-      pivot = nums[r]
-      nextSwapped = l
-      for i in range(l, r):
-        if nums[i] <= pivot:
-          nums[nextSwapped], nums[i] = nums[i], nums[nextSwapped]
-          nextSwapped += 1
-      nums[nextSwapped], nums[r] = nums[r], nums[nextSwapped]
-      return nextSwapped
+      m = partition(A, l, r)
+      quickSort(A, l, m - 1)
+      quickSort(A, m + 1, r)
 
-    m = partition(nums, l, r)
-    self._quickSort(nums, l, m - 1)
-    self._quickSort(nums, m + 1, r)
+    quickSort(nums, 0, len(nums) - 1)
+    return nums
diff --git a/solutions/912. Sort an Array/912.cpp b/solutions/912. Sort an Array/912.cpp
index cab2eb24e75..842364a3125 100644
--- a/solutions/912. Sort an Array/912.cpp	
+++ b/solutions/912. Sort an Array/912.cpp	
@@ -6,35 +6,36 @@ class Solution {
   }
 
  private:
-  void mergeSort(vector<int>& nums, int l, int r) {
+  void mergeSort(vector<int>& A, int l, int r) {
     if (l >= r)
       return;
+
     const int m = (l + r) / 2;
-    mergeSort(nums, l, m);
-    mergeSort(nums, m + 1, r);
-    merge(nums, l, m, r);
+    mergeSort(A, l, m);
+    mergeSort(A, m + 1, r);
+    merge(A, l, m, r);
   }
 
-  void merge(vector<int>& nums, int l, int m, int r) {
+  void merge(vector<int>& A, int l, int m, int r) {
     vector<int> sorted(r - l + 1);
     int k = 0;      // sorted's index
     int i = l;      // left's index
     int j = m + 1;  // right's index
 
     while (i <= m && j <= r)
-      if (nums[i] < nums[j])
-        sorted[k++] = nums[i++];
+      if (A[i] < A[j])
+        sorted[k++] = A[i++];
       else
-        sorted[k++] = nums[j++];
+        sorted[k++] = A[j++];
 
     // Put the possible remaining left part into the sorted array.
     while (i <= m)
-      sorted[k++] = nums[i++];
+      sorted[k++] = A[i++];
 
     // Put the possible remaining right part into the sorted array.
     while (j <= r)
-      sorted[k++] = nums[j++];
+      sorted[k++] = A[j++];
 
-    copy(sorted.begin(), sorted.end(), nums.begin() + l);
+    copy(sorted.begin(), sorted.end(), A.begin() + l);
   }
 };
diff --git a/solutions/912. Sort an Array/912.java b/solutions/912. Sort an Array/912.java
index 755cfe7b296..cbe7a12b1b4 100644
--- a/solutions/912. Sort an Array/912.java	
+++ b/solutions/912. Sort an Array/912.java	
@@ -4,35 +4,36 @@ public int[] sortArray(int[] nums) {
     return nums;
   }
 
-  private void mergeSort(int[] nums, int l, int r) {
+  private void mergeSort(int[] A, int l, int r) {
     if (l >= r)
       return;
+
     final int m = (l + r) / 2;
-    mergeSort(nums, l, m);
-    mergeSort(nums, m + 1, r);
-    merge(nums, l, m, r);
+    mergeSort(A, l, m);
+    mergeSort(A, m + 1, r);
+    merge(A, l, m, r);
   }
 
-  private void merge(int[] nums, int l, int m, int r) {
+  private void merge(int[] A, int l, int m, int r) {
     int[] sorted = new int[r - l + 1];
     int k = 0;     // sorted's index
     int i = l;     // left's index
     int j = m + 1; // right's index
 
     while (i <= m && j <= r)
-      if (nums[i] < nums[j])
-        sorted[k++] = nums[i++];
+      if (A[i] < A[j])
+        sorted[k++] = A[i++];
       else
-        sorted[k++] = nums[j++];
+        sorted[k++] = A[j++];
 
     // Put the possible remaining left part into the sorted array.
     while (i <= m)
-      sorted[k++] = nums[i++];
+      sorted[k++] = A[i++];
 
     // Put the possible remaining right part into the sorted array.
     while (j <= r)
-      sorted[k++] = nums[j++];
+      sorted[k++] = A[j++];
 
-    System.arraycopy(sorted, 0, nums, l, sorted.length);
+    System.arraycopy(sorted, 0, A, l, sorted.length);
   }
 }
diff --git a/solutions/912. Sort an Array/912.py b/solutions/912. Sort an Array/912.py
index 3ca39bfc0ed..b52b60f450d 100644
--- a/solutions/912. Sort an Array/912.py	
+++ b/solutions/912. Sort an Array/912.py	
@@ -1,43 +1,43 @@
 class Solution:
-  def sortArray(self, nums: list[int]) -> list[int]:
-    self._mergeSort(nums, 0, len(nums) - 1)
-    return nums
+  def sortArray(self, nums: List[int]) -> List[int]:
+    def mergeSort(A: List[int], l: int, r: int) -> None:
+      if l >= r:
+        return
 
-  def _mergeSort(self, nums: list[int], l: int, r: int) -> None:
-    if l >= r:
-      return
+      def merge(A: List[int], l: int, m: int, r: int) -> None:
+        sorted = [0] * (r - l + 1)
+        k = 0  # sorted's index
+        i = l  # left's index
+        j = m + 1  # right's index
 
-    def merge(nums: list[int], l: int, m: int, r: int) -> None:
-      sorted = [0] * (r - l + 1)
-      k = 0  # sorted's index
-      i = l  # left's index
-      j = m + 1  # right's index
+        while i <= m and j <= r:
+          if A[i] < A[j]:
+            sorted[k] = A[i]
+            k += 1
+            i += 1
+          else:
+            sorted[k] = A[j]
+            k += 1
+            j += 1
 
-      while i <= m and j <= r:
-        if nums[i] < nums[j]:
-          sorted[k] = nums[i]
+        # Put the possible remaining left part into the sorted array.
+        while i <= m:
+          sorted[k] = A[i]
           k += 1
           i += 1
-        else:
-          sorted[k] = nums[j]
+
+        # Put the possible remaining right part into the sorted array.
+        while j <= r:
+          sorted[k] = A[j]
           k += 1
           j += 1
 
-      # Put the possible remaining left part into the sorted array.
-      while i <= m:
-        sorted[k] = nums[i]
-        k += 1
-        i += 1
+        A[l:l + len(sorted)] = sorted
 
-      # Put the possible remaining right part into the sorted array.
-      while j <= r:
-        sorted[k] = nums[j]
-        k += 1
-        j += 1
+      m = (l + r) // 2
+      mergeSort(A, l, m)
+      mergeSort(A, m + 1, r)
+      merge(A, l, m, r)
 
-      nums[l:l + len(sorted)] = sorted
-
-    m = (l + r) // 2
-    self._mergeSort(nums, l, m)
-    self._mergeSort(nums, m + 1, r)
-    merge(nums, l, m, r)
+    mergeSort(nums, 0, len(nums) - 1)
+    return nums
diff --git a/solutions/913. Cat and Mouse/913.java b/solutions/913. Cat and Mouse/913.java
index ffe9b5446c1..48b75a73911 100644
--- a/solutions/913. Cat and Mouse/913.java	
+++ b/solutions/913. Cat and Mouse/913.java	
@@ -1,4 +1,4 @@
-enum State { DRAW, MOUSE_WIN, CAT_WIN }
+enum State { kDraw, kMouseWin, kCatWin }
 
 class Solution {
   public int catMouseGame(int[][] graph) {
@@ -20,11 +20,11 @@ public int catMouseGame(int[][] graph) {
     for (int cat = 1; cat < n; ++cat)
       for (int move = 0; move < 2; ++move) {
         // Mouse is in the hole.
-        states[cat][0][move] = State.MOUSE_WIN.ordinal();
-        q.offer(new int[] {cat, 0, move, State.MOUSE_WIN.ordinal()});
+        states[cat][0][move] = State.kMouseWin.ordinal();
+        q.offer(new int[] {cat, 0, move, State.kMouseWin.ordinal()});
         // Cat catches mouse.
-        states[cat][cat][move] = State.CAT_WIN.ordinal();
-        q.offer(new int[] {cat, cat, move, State.CAT_WIN.ordinal()});
+        states[cat][cat][move] = State.kCatWin.ordinal();
+        q.offer(new int[] {cat, cat, move, State.kCatWin.ordinal()});
       }
 
     while (!q.isEmpty()) {
@@ -43,8 +43,8 @@ public int catMouseGame(int[][] graph) {
         // The state has been determined.
         if (states[prevCat][prevMouse][prevMove] > 0)
           continue;
-        if (prevMove == 0 && state == State.MOUSE_WIN.ordinal() ||
-            prevMove == 1 && state == State.CAT_WIN.ordinal() ||
+        if (prevMove == 0 && state == State.kMouseWin.ordinal() ||
+            prevMove == 1 && state == State.kCatWin.ordinal() ||
             --outDegree[prevCat][prevMouse][prevMove] == 0) {
           states[prevCat][prevMouse][prevMove] = state;
           q.offer(new int[] {prevCat, prevMouse, prevMove, state});
diff --git a/solutions/913. Cat and Mouse/913.py b/solutions/913. Cat and Mouse/913.py
index 4da9027e138..c799d93b533 100644
--- a/solutions/913. Cat and Mouse/913.py	
+++ b/solutions/913. Cat and Mouse/913.py	
@@ -2,18 +2,18 @@
 
 
 class State(IntEnum):
-  DRAW = 0
-  MOUSE_WIN = 1
-  CAT_WIN = 2
+  kDraw = 0
+  kMouseWin = 1
+  kCatWin = 2
 
 
 class Solution:
-  def catMouseGame(self, graph: list[list[int]]) -> int:
+  def catMouseGame(self, graph: List[List[int]]) -> int:
     n = len(graph)
     # result of (cat, mouse, move)
     # move := 0 (mouse) // 1 (cat)
-    states = [[[0] * 2 for _ in range(n)] for _ in range(n)]
-    outDegree = [[[0] * 2 for _ in range(n)] for _ in range(n)]
+    states = [[[0] * 2 for i in range(n)] for j in range(n)]
+    outDegree = [[[0] * 2 for i in range(n)] for j in range(n)]
     q = collections.deque()  # (cat, mouse, move, state)
 
     for cat in range(n):
@@ -25,11 +25,11 @@ def catMouseGame(self, graph: list[list[int]]) -> int:
     for cat in range(1, n):
       for move in range(2):
         # Mouse is in the hole.
-        states[cat][0][move] = int(State.MOUSE_WIN)
-        q.append((cat, 0, move, int(State.MOUSE_WIN)))
+        states[cat][0][move] = int(State.kMouseWin)
+        q.append((cat, 0, move, int(State.kMouseWin)))
         # Cat catches mouse.
-        states[cat][cat][move] = int(State.CAT_WIN)
-        q.append((cat, cat, move, int(State.CAT_WIN)))
+        states[cat][cat][move] = int(State.kCatWin)
+        q.append((cat, cat, move, int(State.kCatWin)))
 
     while q:
       cat, mouse, move, state = q.popleft()
@@ -44,8 +44,8 @@ def catMouseGame(self, graph: list[list[int]]) -> int:
         # The state has been determined.
         if states[prevCat][prevMouse][prevMove]:
           continue
-        if (prevMove == 0 and state == int(State.MOUSE_WIN) or
-                prevMove == 1 and state == int(State.CAT_WIN)):
+        if prevMove == 0 and state == int(State.kMouseWin) or \
+                prevMove == 1 and state == int(State.kCatWin):
           states[prevCat][prevMouse][prevMove] = state
           q.append((prevCat, prevMouse, prevMove, state))
         else:
diff --git a/solutions/914. X of a Kind in a Deck of Cards/914.py b/solutions/914. X of a Kind in a Deck of Cards/914.py
index 76fba57295b..2477ebfe817 100644
--- a/solutions/914. X of a Kind in a Deck of Cards/914.py	
+++ b/solutions/914. X of a Kind in a Deck of Cards/914.py	
@@ -1,4 +1,4 @@
 class Solution:
-  def hasGroupsSizeX(self, deck: list[int]) -> bool:
+  def hasGroupsSizeX(self, deck: List[int]) -> bool:
     count = collections.Counter(deck)
     return functools.reduce(math.gcd, count.values()) >= 2
diff --git a/solutions/915. Partition Array into Disjoint Intervals/915.py b/solutions/915. Partition Array into Disjoint Intervals/915.py
index f1f3da2d184..8b1b05b2d85 100644
--- a/solutions/915. Partition Array into Disjoint Intervals/915.py	
+++ b/solutions/915. Partition Array into Disjoint Intervals/915.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def partitionDisjoint(self, nums: list[int]) -> int:
+  def partitionDisjoint(self, nums: List[int]) -> int:
     n = len(nums)
     mn = [0] * (n - 1) + [nums[-1]]
     mx = -math.inf
diff --git a/solutions/916. Word Subsets/916.py b/solutions/916. Word Subsets/916.py
index 09bd343840b..b13ccecd812 100644
--- a/solutions/916. Word Subsets/916.py	
+++ b/solutions/916. Word Subsets/916.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def wordSubsets(self, A: list[str], B: list[str]) -> list[str]:
+  def wordSubsets(self, A: List[str], B: List[str]) -> List[str]:
     count = collections.Counter()
 
     for b in B:
diff --git a/solutions/918. Maximum Sum Circular Subarray/918.py b/solutions/918. Maximum Sum Circular Subarray/918.py
index 21ae88b9c71..ea8a5d7f786 100644
--- a/solutions/918. Maximum Sum Circular Subarray/918.py	
+++ b/solutions/918. Maximum Sum Circular Subarray/918.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxSubarraySumCircular(self, nums: list[int]) -> int:
+  def maxSubarraySumCircular(self, nums: List[int]) -> int:
     totalSum = 0
     currMaxSum = 0
     currMinSum = 0
diff --git a/solutions/919. Complete Binary Tree Inserter/919.py b/solutions/919. Complete Binary Tree Inserter/919.py
index b22fdf04c73..4f00c2c0986 100644
--- a/solutions/919. Complete Binary Tree Inserter/919.py	
+++ b/solutions/919. Complete Binary Tree Inserter/919.py	
@@ -1,5 +1,5 @@
 class CBTInserter:
-  def __init__(self, root: TreeNode | None):
+  def __init__(self, root: Optional[TreeNode]):
     self.tree = [root]
     for node in self.tree:
       if node.left:
@@ -17,5 +17,5 @@ def insert(self, v: int) -> int:
       parent.right = self.tree[-1]
     return parent.val
 
-  def get_root(self) -> TreeNode | None:
+  def get_root(self) -> Optional[TreeNode]:
     return self.tree[0]
diff --git a/solutions/92. Reverse Linked List II/92.py b/solutions/92. Reverse Linked List II/92.py
index 61267185599..bd463733906 100644
--- a/solutions/92. Reverse Linked List II/92.py	
+++ b/solutions/92. Reverse Linked List II/92.py	
@@ -1,17 +1,12 @@
 class Solution:
-  def reverseBetween(
-      self,
-      head: ListNode | None,
-      left: int,
-      right: int,
-  ) -> ListNode | None:
+  def reverseBetween(self, head: Optional[ListNode], left: int, right: int) -> Optional[ListNode]:
     if left == 1:
       return self.reverseN(head, right)
 
     head.next = self.reverseBetween(head.next, left - 1, right - 1)
     return head
 
-  def reverseN(self, head: ListNode | None, n: int) -> ListNode | None:
+  def reverseN(self, head: Optional[ListNode], n: int) -> Optional[ListNode]:
     if n == 1:
       return head
 
diff --git a/solutions/920. Number of Music Playlists/920-2.java b/solutions/920. Number of Music Playlists/920-2.java
index 3e778ad75df..5f47b2b9c0d 100644
--- a/solutions/920. Number of Music Playlists/920-2.java	
+++ b/solutions/920. Number of Music Playlists/920-2.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int numMusicPlaylists(int n, int goal, int k) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // dp[i][j] := the number of playlists with i songs and j different songs
     long[][] dp = new long[goal + 1][n + 1];
     dp[0][0] = 1;
@@ -9,7 +9,7 @@ public int numMusicPlaylists(int n, int goal, int k) {
       for (int j = 1; j <= n; ++j) {
         dp[i][j] += dp[i - 1][j - 1] * (n - (j - 1));  // The last song is new.
         dp[i][j] += dp[i - 1][j] * Math.max(0, j - k); // The last song is old.
-        dp[i][j] %= MOD;
+        dp[i][j] %= kMod;
       }
 
     return (int) dp[goal][n];
diff --git a/solutions/920. Number of Music Playlists/920.java b/solutions/920. Number of Music Playlists/920.java
index 6a952ff8bbd..757e32e6dae 100644
--- a/solutions/920. Number of Music Playlists/920.java	
+++ b/solutions/920. Number of Music Playlists/920.java	
@@ -5,7 +5,7 @@ public int numMusicPlaylists(int n, int goal, int k) {
     return (int) numMusicPlaylists(n, k, goal, n, mem);
   }
 
-  private static final int MOD = 1_000_000_007;
+  private static final int kMod = 1_000_000_007;
 
   // Returns the number of playlists with i songs and j different songs.
   private long numMusicPlaylists(int n, int k, int i, int j, long[][] mem) {
@@ -20,6 +20,6 @@ private long numMusicPlaylists(int n, int k, int i, int j, long[][] mem) {
     mem[i][j] = numMusicPlaylists(n, k, i - 1, j - 1, mem) * (n - (j - 1));
     // The last song is old.
     mem[i][j] += numMusicPlaylists(n, k, i - 1, j, mem) * Math.max(0, j - k);
-    return mem[i][j] %= MOD;
+    return mem[i][j] %= kMod;
   }
 }
diff --git a/solutions/922. Sort Array By Parity II/922.py b/solutions/922. Sort Array By Parity II/922.py
index 9b3ed0f37c1..60d1f6c10b2 100644
--- a/solutions/922. Sort Array By Parity II/922.py	
+++ b/solutions/922. Sort Array By Parity II/922.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sortArrayByParityII(self, nums: list[int]) -> list[int]:
+  def sortArrayByParityII(self, nums: List[int]) -> List[int]:
     n = len(nums)
 
     i = 0
diff --git a/solutions/923. 3Sum With Multiplicity/923.java b/solutions/923. 3Sum With Multiplicity/923.java
index 9896ecd397f..8e13b68960b 100644
--- a/solutions/923. 3Sum With Multiplicity/923.java	
+++ b/solutions/923. 3Sum With Multiplicity/923.java	
@@ -1,6 +1,6 @@
 class Solution {
   public int threeSumMulti(int[] arr, int target) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     int ans = 0;
     Map<Integer, Integer> count = new HashMap<>();
 
@@ -17,11 +17,11 @@ public int threeSumMulti(int[] arr, int target) {
         if (!count.containsKey(k))
           continue;
         if (i == j && j == k)
-          ans = (int) ((ans + (long) x * (x - 1) * (x - 2) / 6) % MOD);
+          ans = (int) ((ans + (long) x * (x - 1) * (x - 2) / 6) % kMod);
         else if (i == j && j != k)
-          ans = (int) ((ans + (long) x * (x - 1) / 2 * count.get(k)) % MOD);
+          ans = (int) ((ans + (long) x * (x - 1) / 2 * count.get(k)) % kMod);
         else if (i < j && j < k)
-          ans = (int) ((ans + (long) x * y * count.get(k)) % MOD);
+          ans = (int) ((ans + (long) x * y * count.get(k)) % kMod);
       }
     }
 
diff --git a/solutions/923. 3Sum With Multiplicity/923.py b/solutions/923. 3Sum With Multiplicity/923.py
index e58970c273f..9e473fc72b6 100644
--- a/solutions/923. 3Sum With Multiplicity/923.py	
+++ b/solutions/923. 3Sum With Multiplicity/923.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def threeSumMulti(self, arr: list[int], target: int) -> int:
-    MOD = 1_000_000_007
+  def threeSumMulti(self, arr: List[int], target: int) -> int:
+    kMod = 1_000_000_007
     ans = 0
     count = collections.Counter(arr)
 
@@ -10,10 +10,10 @@ def threeSumMulti(self, arr: list[int], target: int) -> int:
         if k not in count:
           continue
         if i == j and j == k:
-          ans = (ans + x * (x - 1) * (x - 2) // 6) % MOD
+          ans = (ans + x * (x - 1) * (x - 2) // 6) % kMod
         elif i == j and j != k:
-          ans = (ans + x * (x - 1) // 2 * count[k]) % MOD
+          ans = (ans + x * (x - 1) // 2 * count[k]) % kMod
         elif i < j and j < k:
-          ans = (ans + x * y * count[k]) % MOD
+          ans = (ans + x * y * count[k]) % kMod
 
-    return ans % MOD
+    return ans % kMod
diff --git a/solutions/927. Three Equal Parts/927.py b/solutions/927. Three Equal Parts/927.py
index a4a82fd87f2..55dd1aac672 100644
--- a/solutions/927. Three Equal Parts/927.py	
+++ b/solutions/927. Three Equal Parts/927.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def threeEqualParts(self, arr: list[int]) -> list[int]:
+  def threeEqualParts(self, arr: List[int]) -> List[int]:
     ones = sum(a == 1 for a in arr)
 
     if ones == 0:
diff --git a/solutions/929. Unique Email Addresses/929.py b/solutions/929. Unique Email Addresses/929.py
index a563d046da4..2c10dfd4463 100644
--- a/solutions/929. Unique Email Addresses/929.py	
+++ b/solutions/929. Unique Email Addresses/929.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numUniqueEmails(self, emails: list[str]) -> int:
+  def numUniqueEmails(self, emails: List[str]) -> int:
     seen = set()
 
     for email in emails:
diff --git a/solutions/93. Restore IP Addresses/93.cpp b/solutions/93. Restore IP Addresses/93.cpp
index 1175bc53bb3..264efb55c57 100644
--- a/solutions/93. Restore IP Addresses/93.cpp	
+++ b/solutions/93. Restore IP Addresses/93.cpp	
@@ -25,7 +25,7 @@ class Solution {
       if (stoi(num) > 255)
         return;
       path.push_back(num);
-      dfs(s, start + length, std::move(path), ans);
+      dfs(s, start + length, move(path), ans);
       path.pop_back();
     }
   }
diff --git a/solutions/93. Restore IP Addresses/93.py b/solutions/93. Restore IP Addresses/93.py
index d708b7549da..7ee9ae04b4b 100644
--- a/solutions/93. Restore IP Addresses/93.py	
+++ b/solutions/93. Restore IP Addresses/93.py	
@@ -1,8 +1,8 @@
 class Solution:
-  def restoreIpAddresses(self, s: str) -> list[str]:
+  def restoreIpAddresses(self, s: str) -> List[str]:
     ans = []
 
-    def dfs(start: int, path: list[int]) -> None:
+    def dfs(start: int, path: List[int]) -> None:
       if len(path) == 4 and start == len(s):
         ans.append(path[0] + '.' + path[1] + '.' + path[2] + '.' + path[3])
         return
diff --git a/solutions/930. Binary Subarrays With Sum/930-2.py b/solutions/930. Binary Subarrays With Sum/930-2.py
index 7c1505a58a8..c8924bd1a7c 100644
--- a/solutions/930. Binary Subarrays With Sum/930-2.py	
+++ b/solutions/930. Binary Subarrays With Sum/930-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numSubarraysWithSum(self, nums: list[int], goal: int) -> int:
+  def numSubarraysWithSum(self, nums: List[int], goal: int) -> int:
     def numSubarraysWithSumAtMost(goal: int) -> int:
       res = 0
       count = 0
diff --git a/solutions/930. Binary Subarrays With Sum/930.py b/solutions/930. Binary Subarrays With Sum/930.py
index fc5f34c4cac..54d21ed23b7 100644
--- a/solutions/930. Binary Subarrays With Sum/930.py	
+++ b/solutions/930. Binary Subarrays With Sum/930.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numSubarraysWithSum(self, nums: list[int], goal: int) -> int:
+  def numSubarraysWithSum(self, nums: List[int], goal: int) -> int:
     ans = 0
     prefix = 0
     # {prefix: number of occurrence}
diff --git a/solutions/931. Minimum Falling Path Sum/931.py b/solutions/931. Minimum Falling Path Sum/931.py
index 3c3e78c7b8a..23adbdc2794 100644
--- a/solutions/931. Minimum Falling Path Sum/931.py	
+++ b/solutions/931. Minimum Falling Path Sum/931.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minFallingPathSum(self, A: list[list[int]]) -> int:
+  def minFallingPathSum(self, A: List[List[int]]) -> int:
     n = len(A)
 
     for i in range(1, n):
diff --git a/solutions/932. Beautiful Array/932.cpp b/solutions/932. Beautiful Array/932.cpp
index 85da3e24959..b26c04964b0 100644
--- a/solutions/932. Beautiful Array/932.cpp	
+++ b/solutions/932. Beautiful Array/932.cpp	
@@ -1,26 +1,26 @@
 class Solution {
  public:
   vector<int> beautifulArray(int n) {
-    vector<int> arr(n);
-    iota(arr.begin(), arr.end(), 1);
-    divide(arr, 0, n - 1, 1);
-    return arr;
+    vector<int> A(n);
+    iota(A.begin(), A.end(), 1);
+    divide(A, 0, n - 1, 1);
+    return A;
   }
 
  private:
-  void divide(vector<int>& arr, int l, int r, int mask) {
+  void divide(vector<int>& A, int l, int r, int mask) {
     if (l >= r)
       return;
-    const int m = partition(arr, l, r, mask);
-    divide(arr, l, m, mask << 1);
-    divide(arr, m + 1, r, mask << 1);
+    const int m = partition(A, l, r, mask);
+    divide(A, l, m, mask << 1);
+    divide(A, m + 1, r, mask << 1);
   }
 
-  int partition(vector<int>& arr, int l, int r, int mask) {
+  int partition(vector<int>& A, int l, int r, int mask) {
     int nextSwapped = l;
     for (int i = l; i <= r; ++i)
-      if (arr[i] & mask)
-        swap(arr[i], arr[nextSwapped++]);
+      if (A[i] & mask)
+        swap(A[i], A[nextSwapped++]);
     return nextSwapped - 1;
   }
 };
diff --git a/solutions/932. Beautiful Array/932.java b/solutions/932. Beautiful Array/932.java
index f199dc3082c..0d33997a2b0 100644
--- a/solutions/932. Beautiful Array/932.java	
+++ b/solutions/932. Beautiful Array/932.java	
@@ -1,31 +1,31 @@
 class Solution {
   public int[] beautifulArray(int n) {
-    int[] arr = new int[n];
+    int[] A = new int[n];
     for (int i = 0; i < n; ++i)
-      arr[i] = i + 1;
-    divide(arr, 0, n - 1, 1);
-    return arr;
+      A[i] = i + 1;
+    divide(A, 0, n - 1, 1);
+    return A;
   }
 
-  private void divide(int[] arr, int l, int r, int mask) {
+  private void divide(int[] A, int l, int r, int mask) {
     if (l >= r)
       return;
-    final int m = partition(arr, l, r, mask);
-    divide(arr, l, m, mask << 1);
-    divide(arr, m + 1, r, mask << 1);
+    final int m = partition(A, l, r, mask);
+    divide(A, l, m, mask << 1);
+    divide(A, m + 1, r, mask << 1);
   }
 
-  private int partition(int[] arr, int l, int r, int mask) {
+  private int partition(int[] A, int l, int r, int mask) {
     int nextSwapped = l;
     for (int i = l; i <= r; ++i)
-      if ((arr[i] & mask) > 0)
-        swap(arr, i, nextSwapped++);
+      if ((A[i] & mask) > 0)
+        swap(A, i, nextSwapped++);
     return nextSwapped - 1;
   }
 
-  private void swap(int[] arr, int i, int j) {
-    final int temp = arr[i];
-    arr[i] = arr[j];
-    arr[j] = temp;
+  private void swap(int[] A, int i, int j) {
+    final int temp = A[i];
+    A[i] = A[j];
+    A[j] = temp;
   }
 }
diff --git a/solutions/932. Beautiful Array/932.py b/solutions/932. Beautiful Array/932.py
index 5de6fac65fd..0c2c20e5244 100644
--- a/solutions/932. Beautiful Array/932.py	
+++ b/solutions/932. Beautiful Array/932.py	
@@ -1,12 +1,12 @@
 class Solution:
-  def beautifulArray(self, n: int) -> list[int]:
-    arr = [i for i in range(1, n + 1)]
+  def beautifulArray(self, n: int) -> List[int]:
+    A = [i for i in range(1, n + 1)]
 
     def partition(l: int, r: int, mask: int) -> int:
       nextSwapped = l
       for i in range(l, r + 1):
-        if arr[i] & mask:
-          arr[i], arr[nextSwapped] = arr[nextSwapped], arr[i]
+        if A[i] & mask:
+          A[i], A[nextSwapped] = A[nextSwapped], A[i]
           nextSwapped += 1
       return nextSwapped - 1
 
@@ -18,4 +18,4 @@ def divide(l: int, r: int, mask: int) -> None:
       divide(m + 1, r, mask << 1)
 
     divide(0, n - 1, 1)
-    return arr
+    return A
diff --git a/solutions/934. Shortest Bridge/934-2.cpp b/solutions/934. Shortest Bridge/934-2.cpp
index 90f483fc473..6143dc5d8ca 100644
--- a/solutions/934. Shortest Bridge/934-2.cpp	
+++ b/solutions/934. Shortest Bridge/934-2.cpp	
@@ -1,7 +1,7 @@
 class Solution {
  public:
   int shortestBridge(vector<vector<int>>& grid) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int n = grid.size();
     queue<pair<int, int>> q;
 
@@ -11,7 +11,7 @@ class Solution {
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == n || y < 0 || y == n)
diff --git a/solutions/934. Shortest Bridge/934-2.java b/solutions/934. Shortest Bridge/934-2.java
index 92f29ed83b0..86b2d3cf904 100644
--- a/solutions/934. Shortest Bridge/934-2.java	
+++ b/solutions/934. Shortest Bridge/934-2.java	
@@ -1,16 +1,16 @@
 class Solution {
   public int shortestBridge(int[][] grid) {
-    final int[][] DIRS = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    final int[][] dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     final int n = grid.length;
-    Queue<Pair<Integer, Integer>> q = new ArrayDeque<>();
+    Queue<int[]> q = new ArrayDeque<>();
 
     markGridTwo(grid, q);
 
     for (int ans = 0; !q.isEmpty(); ++ans)
       for (int sz = q.size(); sz > 0; --sz) {
-        final int i = q.peek().getKey();
-        final int j = q.poll().getValue();
-        for (int[] dir : DIRS) {
+        final int i = q.peek()[0];
+        final int j = q.poll()[1];
+        for (int[] dir : dirs) {
           final int x = i + dir[0];
           final int y = j + dir[1];
           if (x < 0 || x == n || y < 0 || y == n)
@@ -20,7 +20,7 @@ public int shortestBridge(int[][] grid) {
           if (grid[x][y] == 1)
             return ans;
           grid[x][y] = 2;
-          q.offer(new Pair<>(x, y));
+          q.offer(new int[] {x, y});
         }
       }
 
@@ -28,7 +28,7 @@ public int shortestBridge(int[][] grid) {
   }
 
   // Marks one group to 2s by DFS.
-  private void markGridTwo(int[][] grid, Queue<Pair<Integer, Integer>> q) {
+  private void markGridTwo(int[][] grid, Queue<int[]> q) {
     for (int i = 0; i < grid.length; ++i)
       for (int j = 0; j < grid[0].length; ++j)
         if (grid[i][j] == 1) {
@@ -38,13 +38,13 @@ private void markGridTwo(int[][] grid, Queue<Pair<Integer, Integer>> q) {
   }
 
   // Marks one group to 2s by DFS and pushes them to the queue.
-  private void markGridTwo(int[][] grid, int i, int j, Queue<Pair<Integer, Integer>> q) {
+  private void markGridTwo(int[][] grid, int i, int j, Queue<int[]> q) {
     if (i < 0 || i == grid.length || j < 0 || j == grid[0].length)
       return;
     if (grid[i][j] != 1)
       return;
     grid[i][j] = 2;
-    q.offer(new Pair<>(i, j));
+    q.offer(new int[] {i, j});
     markGridTwo(grid, i + 1, j, q);
     markGridTwo(grid, i - 1, j, q);
     markGridTwo(grid, i, j + 1, q);
diff --git a/solutions/935. Knight Dialer/935.cpp b/solutions/935. Knight Dialer/935.cpp
index c6a8ef8943d..0a69fd5504d 100644
--- a/solutions/935. Knight Dialer/935.cpp	
+++ b/solutions/935. Knight Dialer/935.cpp	
@@ -1,8 +1,8 @@
 class Solution {
  public:
   int knightDialer(int n) {
-    constexpr int kDirs[8][2] = {{1, 2},   {2, 1},   {2, -1}, {1, -2},
-                                 {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
+    constexpr int dirs[8][2] = {{1, 2},   {2, 1},   {2, -1}, {1, -2},
+                                {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
     constexpr int kMod = 1'000'000'007;
 
     // dp[i][j] := the number of ways to stand on (i, j)
@@ -15,7 +15,7 @@ class Solution {
         for (int j = 0; j < 3; ++j) {
           if (isNotNumericCell(i, j))
             continue;
-          for (const auto& [dx, dy] : kDirs) {
+          for (const auto& [dx, dy] : dirs) {
             const int x = i + dx;
             const int y = j + dy;
             if (x < 0 || x >= 4 || y < 0 || y >= 3)
@@ -25,7 +25,7 @@ class Solution {
             newDp[i][j] = (newDp[i][j] + dp[x][y]) % kMod;
           }
         }
-      dp = std::move(newDp);
+      dp = move(newDp);
     }
 
     int ans = 0;
diff --git a/solutions/935. Knight Dialer/935.java b/solutions/935. Knight Dialer/935.java
index d54f6aad4b2..4b0bff0c1e7 100644
--- a/solutions/935. Knight Dialer/935.java	
+++ b/solutions/935. Knight Dialer/935.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int knightDialer(int n) {
-    final int[][] DIRS = {{1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
-    final int MOD = 1_000_000_007;
+    final int[][] dirs = {{1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}};
+    final int kMod = 1_000_000_007;
     // dp[i][j] := the number of ways to stand on (i, j)
     int[][] dp = new int[4][3];
     Arrays.stream(dp).forEach(A -> Arrays.fill(A, 1));
@@ -13,14 +13,14 @@ public int knightDialer(int n) {
         for (int j = 0; j < 3; ++j) {
           if (isNotNumericCell(i, j))
             continue;
-          for (int[] dir : DIRS) {
+          for (int[] dir : dirs) {
             final int x = i + dir[0];
             final int y = j + dir[1];
             if (x < 0 || x >= 4 || y < 0 || y >= 3)
               continue;
             if (isNotNumericCell(x, y))
               continue;
-            newDp[i][j] = (newDp[i][j] + dp[x][y]) % MOD;
+            newDp[i][j] = (newDp[i][j] + dp[x][y]) % kMod;
           }
         }
       dp = newDp;
@@ -30,7 +30,7 @@ public int knightDialer(int n) {
 
     for (int[] row : dp)
       for (final int a : row)
-        ans = (ans + a) % MOD;
+        ans = (ans + a) % kMod;
 
     return ans;
   }
diff --git a/solutions/935. Knight Dialer/935.py b/solutions/935. Knight Dialer/935.py
index 0b64885a1d9..92ed72f56ed 100644
--- a/solutions/935. Knight Dialer/935.py	
+++ b/solutions/935. Knight Dialer/935.py	
@@ -1,8 +1,8 @@
 class Solution:
   def knightDialer(self, n: int) -> int:
-    DIRS = ((1, 2), (2, 1), (2, -1), (1, -2),
+    dirs = ((1, 2), (2, 1), (2, -1), (1, -2),
             (-1, -2), (-2, -1), (-2, 1), (-1, 2))
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
 
     # dp[i][j] := the number of ways stand on (i, j)
     dp = [[1] * 3 for _ in range(4)]
@@ -14,14 +14,14 @@ def knightDialer(self, n: int) -> int:
         for j in range(3):
           if (i, j) in ((3, 0), (3, 2)):
             continue
-          for dx, dy in DIRS:
+          for dx, dy in dirs:
             x = i + dx
             y = j + dy
             if x < 0 or x >= 4 or y < 0 or y >= 3:
               continue
             if (x, y) in ((3, 0), (3, 2)):
               continue
-            newDp[x][y] = (newDp[x][y] + dp[i][j]) % MOD
+            newDp[x][y] = (newDp[x][y] + dp[i][j]) % kMod
       dp = newDp
 
-    return sum(map(sum, dp)) % MOD
+    return sum(map(sum, dp)) % kMod
diff --git a/solutions/936. Stamping The Sequence/936.cpp b/solutions/936. Stamping The Sequence/936.cpp
index d5e6d33737d..3c5e1fb06d0 100644
--- a/solutions/936. Stamping The Sequence/936.cpp	
+++ b/solutions/936. Stamping The Sequence/936.cpp	
@@ -25,7 +25,7 @@ class Solution {
         return {};
     }
 
-    ranges::reverse(ans);
+    reverse(ans.begin(), ans.end());
     return ans;
   }
 
diff --git a/solutions/936. Stamping The Sequence/936.py b/solutions/936. Stamping The Sequence/936.py
index 48cd7b30e9f..58b7f417d4e 100644
--- a/solutions/936. Stamping The Sequence/936.py	
+++ b/solutions/936. Stamping The Sequence/936.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def movesToStamp(self, stamp: str, target: str) -> list[int]:
+  def movesToStamp(self, stamp: str, target: str) -> List[int]:
     def stampify(s: int) -> int:
       """
       Stamps target[i..i + |stamp|) and returns the number of newly stamped
diff --git a/solutions/937. Reorder Data in Log Files/937.cpp b/solutions/937. Reorder Data in Log Files/937.cpp
index d8058627178..2367e5b747b 100644
--- a/solutions/937. Reorder Data in Log Files/937.cpp	
+++ b/solutions/937. Reorder Data in Log Files/937.cpp	
@@ -13,10 +13,9 @@ class Solution {
         letterLogs.emplace_back(log.substr(0, i), log.substr(i + 1));
     }
 
-    ranges::sort(letterLogs, ranges::less{},
-                 [](const pair<string, string>& letterLog) {
-      const auto& [identifier, letters] = letterLog;
-      return pair<string, string>{letters, identifier};
+    ranges::sort(letterLogs, [](const pair<string, string>& a,
+                                const pair<string, string>& b) {
+      return a.second == b.second ? a.first < b.first : a.second < b.second;
     });
 
     for (const auto& [identifier, letters] : letterLogs)
diff --git a/solutions/937. Reorder Data in Log Files/937.java b/solutions/937. Reorder Data in Log Files/937.java
index bd283950808..6ffe07a6e57 100644
--- a/solutions/937. Reorder Data in Log Files/937.java	
+++ b/solutions/937. Reorder Data in Log Files/937.java	
@@ -12,8 +12,12 @@ public String[] reorderLogFiles(String[] logs) {
         letterLogs.add(new String[] {log.substring(0, i), log.substring(i + 1)});
     }
 
-    Collections.sort(letterLogs, Comparator.comparing((String[] letterLog) -> letterLog[1])
-                                     .thenComparing((String[] letterLog) -> letterLog[0]));
+    Collections.sort(letterLogs, new Comparator<String[]>() {
+      @Override
+      public int compare(String[] l1, String[] l2) {
+        return l1[1].compareTo(l2[1]) == 0 ? l1[0].compareTo(l2[0]) : l1[1].compareTo(l2[1]);
+      }
+    });
 
     for (String[] letterLog : letterLogs)
       ans.add(letterLog[0] + " " + letterLog[1]);
diff --git a/solutions/937. Reorder Data in Log Files/937.py b/solutions/937. Reorder Data in Log Files/937.py
index 2ed3b9207b2..f860fcbbd46 100644
--- a/solutions/937. Reorder Data in Log Files/937.py	
+++ b/solutions/937. Reorder Data in Log Files/937.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def reorderLogFiles(self, logs: list[str]) -> list[str]:
+  def reorderLogFiles(self, logs: List[str]) -> List[str]:
     digitLogs = []
     letterLogs = []
 
@@ -10,5 +10,6 @@ def reorderLogFiles(self, logs: list[str]) -> list[str]:
       else:
         letterLogs.append((log[:i], log[i + 1:]))
 
-    letterLogs.sort(key=lambda x: (x[1], x[0]))
+    letterLogs.sort(key=lambda l: (l[1], l[0]))
+
     return [identifier + ' ' + letters for identifier, letters in letterLogs] + digitLogs
diff --git a/solutions/939. Minimum Area Rectangle/939.py b/solutions/939. Minimum Area Rectangle/939.py
index 307465563b9..a861d9d19c5 100644
--- a/solutions/939. Minimum Area Rectangle/939.py	
+++ b/solutions/939. Minimum Area Rectangle/939.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minAreaRect(self, points: list[list[int]]) -> int:
+  def minAreaRect(self, points: List[List[int]]) -> int:
     ans = math.inf
     xToYs = collections.defaultdict(set)
 
diff --git a/solutions/94. Binary Tree Inorder Traversal/94.cpp b/solutions/94. Binary Tree Inorder Traversal/94.cpp
index 2f1ca90bc6d..529c9adc3ed 100644
--- a/solutions/94. Binary Tree Inorder Traversal/94.cpp	
+++ b/solutions/94. Binary Tree Inorder Traversal/94.cpp	
@@ -4,8 +4,8 @@ class Solution {
     vector<int> ans;
     stack<TreeNode*> stack;
 
-    while (root != nullptr || !stack.empty()) {
-      while (root != nullptr) {
+    while (root || !stack.empty()) {
+      while (root) {
         stack.push(root);
         root = root->left;
       }
diff --git a/solutions/94. Binary Tree Inorder Traversal/94.py b/solutions/94. Binary Tree Inorder Traversal/94.py
index 019077d4a68..9f7bf245cd5 100644
--- a/solutions/94. Binary Tree Inorder Traversal/94.py	
+++ b/solutions/94. Binary Tree Inorder Traversal/94.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def inorderTraversal(self, root: TreeNode | None) -> list[int]:
+  def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
     ans = []
     stack = []
 
diff --git a/solutions/940. Distinct Subsequences II/940.java b/solutions/940. Distinct Subsequences II/940.java
index 53909344923..69eb8c69e9f 100644
--- a/solutions/940. Distinct Subsequences II/940.java	
+++ b/solutions/940. Distinct Subsequences II/940.java	
@@ -1,12 +1,12 @@
 class Solution {
   public int distinctSubseqII(String s) {
-    final int MOD = 1_000_000_007;
+    final int kMod = 1_000_000_007;
     // endsIn[i] := the number of subsequence that end in ('a' + i)
     long[] endsIn = new long[26];
 
     for (final char c : s.toCharArray())
-      endsIn[c - 'a'] = (Arrays.stream(endsIn).sum() + 1) % MOD;
+      endsIn[c - 'a'] = (Arrays.stream(endsIn).sum() + 1) % kMod;
 
-    return (int) (Arrays.stream(endsIn).sum() % MOD);
+    return (int) (Arrays.stream(endsIn).sum() % kMod);
   }
 }
diff --git a/solutions/940. Distinct Subsequences II/940.py b/solutions/940. Distinct Subsequences II/940.py
index b346ec2d568..5a9d226c4e5 100644
--- a/solutions/940. Distinct Subsequences II/940.py	
+++ b/solutions/940. Distinct Subsequences II/940.py	
@@ -1,10 +1,10 @@
 class Solution:
   def distinctSubseqII(self, s: str) -> int:
-    MOD = 1_000_000_007
+    kMod = 1_000_000_007
     # endsIn[i] := the number of subsequence that end in ('a' + i)
     endsIn = [0] * 26
 
     for c in s:
-      endsIn[ord(c) - ord('a')] = (sum(endsIn) + 1) % MOD
+      endsIn[ord(c) - ord('a')] = (sum(endsIn) + 1) % kMod
 
-    return sum(endsIn) % MOD
+    return sum(endsIn) % kMod
diff --git a/solutions/941. Valid Mountain Array/941.py b/solutions/941. Valid Mountain Array/941.py
index e898cae6f03..f98db13302e 100644
--- a/solutions/941. Valid Mountain Array/941.py	
+++ b/solutions/941. Valid Mountain Array/941.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def validMountainArray(self, arr: list[int]) -> bool:
+  def validMountainArray(self, arr: List[int]) -> bool:
     if len(arr) < 3:
       return False
 
diff --git a/solutions/942. DI String Match/942.py b/solutions/942. DI String Match/942.py
index fae76d229ed..5070fb6befa 100644
--- a/solutions/942. DI String Match/942.py	
+++ b/solutions/942. DI String Match/942.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def diStringMatch(self, s: str) -> list[int]:
+  def diStringMatch(self, s: str) -> List[int]:
     ans = []
     mn = 0
     mx = len(s)
diff --git a/solutions/943. Find the Shortest Superstring/943-2.cpp b/solutions/943. Find the Shortest Superstring/943-2.cpp
index 39099b4218d..50a3a7000d4 100644
--- a/solutions/943. Find the Shortest Superstring/943-2.cpp	
+++ b/solutions/943. Find the Shortest Superstring/943-2.cpp	
@@ -1,8 +1,8 @@
 class Solution {
  public:
-  string shortestSuperstring(vector<string>& words) {
-    const int n = words.size();
-    // cost[i][j] := the cost to append words[j] after words[i]
+  string shortestSuperstring(vector<string>& A) {
+    const int n = A.size();
+    // cost[i][j] := the cost to append A[j] after A[i]
     vector<vector<int>> cost(n, vector<int>(n));
     // dp[s][j] := the minimum cost to visit nodes of s ending in j, s is a
     // binary Value, e.g. dp[6][2] means the minimum cost to visit {1, 2} ending
@@ -24,12 +24,12 @@ class Solution {
     // Pre-calculate the `cost` array to save time.
     for (int i = 0; i < n; ++i)
       for (int j = i + 1; j < n; ++j) {
-        cost[i][j] = getCost(words[i], words[j]);
-        cost[j][i] = getCost(words[j], words[i]);
+        cost[i][j] = getCost(A[i], A[j]);
+        cost[j][i] = getCost(A[j], A[i]);
       }
 
     for (int i = 0; i < n; ++i)
-      dp[1 << i][i] = words[i].length();
+      dp[1 << i][i] = A[i].length();
 
     // Enumerate all the states ending in different nodes.
     for (int s = 1; s < (1 << n); ++s)
@@ -52,9 +52,9 @@ class Solution {
     while (s > 0) {
       const int i = parent[s][j];
       if (i == -1)
-        ans = words[j] + ans;
+        ans = A[j] + ans;
       else
-        ans = words[j].substr(words[j].length() - cost[i][j]) + ans;
+        ans = A[j].substr(A[j].length() - cost[i][j]) + ans;
       s -= 1 << j;
       j = i;
     }
diff --git a/solutions/943. Find the Shortest Superstring/943-2.java b/solutions/943. Find the Shortest Superstring/943-2.java
index 4d1c5dc8839..cba388c9321 100644
--- a/solutions/943. Find the Shortest Superstring/943-2.java	
+++ b/solutions/943. Find the Shortest Superstring/943-2.java	
@@ -1,13 +1,13 @@
 class Solution {
-  public String shortestSuperstring(String[] words) {
-    final int n = words.length;
-    // cost[i][j] := the cost to append words[j] after words[i]
+  public String shortestSuperstring(String[] A) {
+    final int n = A.length;
+    // cost[i][j] := the cost to append A[j] after A[i]
     int[][] cost = new int[n][n];
     // Pre-calculate the `cost` array to save time.
     for (int i = 0; i < n; ++i)
       for (int j = i + 1; j < n; ++j) {
-        cost[i][j] = getCost(words[i], words[j]);
-        cost[j][i] = getCost(words[j], words[i]);
+        cost[i][j] = getCost(A[i], A[j]);
+        cost[j][i] = getCost(A[j], A[i]);
       }
     // dp[s][j] := the minimum cost to visit nodes of s ending in j, s is a
     // binary Value, e.g. dp[6][2] means the minimum cost to visit {1, 2} ending
@@ -16,10 +16,10 @@ public String shortestSuperstring(String[] words) {
     Arrays.stream(dp).forEach(A -> Arrays.fill(A, Integer.MAX_VALUE / 2));
     // parent[s][j] := the parent of "nodes of s ending in j"
     int[][] parent = new int[1 << n][n];
-    Arrays.stream(parent).forEach(A -> Arrays.fill(A, -1));
+    Arrays.stream(parent).forEach(row -> Arrays.fill(row, -1));
 
     for (int i = 0; i < n; ++i)
-      dp[1 << i][i] = words[i].length();
+      dp[1 << i][i] = A[i].length();
 
     // Enumerate all the states ending in different nodes.
     for (int s = 1; s < (1 << n); ++s)
@@ -41,9 +41,9 @@ public String shortestSuperstring(String[] words) {
     while (s > 0) {
       final int i = parent[s][j];
       if (i == -1)
-        ans = words[j] + ans;
+        ans = A[j] + ans;
       else
-        ans = words[j].substring(words[j].length() - cost[i][j]) + ans;
+        ans = A[j].substring(A[j].length() - cost[i][j]) + ans;
       s -= 1 << j;
       j = i;
     }
diff --git a/solutions/943. Find the Shortest Superstring/943.cpp b/solutions/943. Find the Shortest Superstring/943.cpp
index 81bf57ab6d0..2a93fab5194 100644
--- a/solutions/943. Find the Shortest Superstring/943.cpp	
+++ b/solutions/943. Find the Shortest Superstring/943.cpp	
@@ -1,8 +1,8 @@
 class Solution {
  public:
-  string shortestSuperstring(vector<string>& words) {
-    const int n = words.size();
-    // cost[i][j] := the cost to append words[j] after words[i]
+  string shortestSuperstring(vector<string>& A) {
+    const int n = A.size();
+    // cost[i][j] := the cost to append A[j] after A[i]
     vector<vector<int>> cost(n, vector<int>(n));
 
     // Returns the cost to append b after a.
@@ -18,47 +18,47 @@ class Solution {
     // Pre-calculate cost array to save time.
     for (int i = 0; i < n; ++i)
       for (int j = i + 1; j < n; ++j) {
-        cost[i][j] = getCost(words[i], words[j]);
-        cost[j][i] = getCost(words[j], words[i]);
+        cost[i][j] = getCost(A[i], A[j]);
+        cost[j][i] = getCost(A[j], A[i]);
       }
 
     vector<int> bestPath;
     int minLength = n * 20;  // given by problem
 
-    dfs(words, cost, {}, bestPath, 0, 0, 0, minLength);
+    dfs(A, cost, {}, bestPath, 0, 0, 0, minLength);
 
-    string ans = words[bestPath[0]];
+    string ans = A[bestPath[0]];
 
     for (int k = 1; k < n; ++k) {
       const int i = bestPath[k - 1];
       const int j = bestPath[k];
-      ans += words[j].substr(words[j].length() - cost[i][j]);
+      ans += A[j].substr(A[j].length() - cost[i][j]);
     }
 
     return ans;
   }
 
  private:
-  // used: i-th bit means words[i] is used or not
-  void dfs(const vector<string>& words, const vector<vector<int>>& cost,
+  // used: i-th bit means A[i] is used or not
+  void dfs(const vector<string>& A, const vector<vector<int>>& cost,
            vector<int>&& path, vector<int>& bestPath, int used, int depth,
            int currLength, int& minLength) {
     if (currLength >= minLength)
       return;
-    if (depth == words.size()) {
+    if (depth == A.size()) {
       minLength = currLength;
       bestPath = path;
       return;
     }
 
-    for (int i = 0; i < words.size(); ++i) {
-      if (used >> i & 1)
+    for (int i = 0; i < A.size(); ++i) {
+      if (1 << i & used)
         continue;
       path.push_back(i);
-      const int newLength = depth == 0 ? words[i].length()
-                                       : currLength + cost[path[depth - 1]][i];
-      dfs(words, cost, std::move(path), bestPath, used | 1 << i, depth + 1,
-          newLength, minLength);
+      const int newLength =
+          depth == 0 ? A[i].length() : currLength + cost[path[depth - 1]][i];
+      dfs(A, cost, move(path), bestPath, used | 1 << i, depth + 1, newLength,
+          minLength);
       path.pop_back();
     }
   }
diff --git a/solutions/943. Find the Shortest Superstring/943.java b/solutions/943. Find the Shortest Superstring/943.java
index 932c9e4ab02..a619ebbf9cd 100644
--- a/solutions/943. Find the Shortest Superstring/943.java	
+++ b/solutions/943. Find the Shortest Superstring/943.java	
@@ -1,14 +1,14 @@
 class Solution {
-  public String shortestSuperstring(String[] words) {
-    final int n = words.length;
-    // cost[i][j] := the cost to append words[j] after words[i]
+  public String shortestSuperstring(String[] A) {
+    final int n = A.length;
+    // cost[i][j] := the cost to append A[j] after A[i]
     int[][] cost = new int[n][n];
 
     // Pre-calculate cost array to save time.
     for (int i = 0; i < n; ++i)
       for (int j = i + 1; j < n; ++j) {
-        cost[i][j] = getCost(words[i], words[j]);
-        cost[j][i] = getCost(words[j], words[i]);
+        cost[i][j] = getCost(A[i], A[j]);
+        cost[j][i] = getCost(A[j], A[i]);
       }
 
     List<Integer> path = new ArrayList<>();
@@ -16,14 +16,14 @@ public String shortestSuperstring(String[] words) {
 
     minLength = n * 20; // given by problem
 
-    dfs(words, cost, path, bestPath, 0, 0, 0);
+    dfs(A, cost, path, bestPath, 0, 0, 0);
 
-    StringBuilder sb = new StringBuilder(words[bestPath.get(0)]);
+    StringBuilder sb = new StringBuilder(A[bestPath.get(0)]);
 
     for (int k = 1; k < n; ++k) {
       final int i = bestPath.get(k - 1);
       final int j = bestPath.get(k);
-      sb.append(words[j].substring(words[j].length() - cost[i][j]));
+      sb.append(A[j].substring(A[j].length() - cost[i][j]));
     }
 
     return sb.toString();
@@ -41,12 +41,12 @@ private int getCost(final String a, final String b) {
     return cost;
   }
 
-  // used: i-th bit means words[i] is used or not
-  private void dfs(String[] words, int[][] cost, List<Integer> path, List<Integer> bestPath,
-                   int used, int depth, int currLength) {
+  // used: i-th bit means A[i] is used or not
+  private void dfs(String[] A, int[][] cost, List<Integer> path, List<Integer> bestPath, int used,
+                   int depth, int currLength) {
     if (currLength >= minLength)
       return;
-    if (depth == words.length) {
+    if (depth == A.length) {
       minLength = currLength;
       bestPath.clear();
       for (final int node : path) {
@@ -55,13 +55,12 @@ private void dfs(String[] words, int[][] cost, List<Integer> path, List<Integer>
       return;
     }
 
-    for (int i = 0; i < words.length; ++i) {
-      if ((used >> i & 1) == 1)
+    for (int i = 0; i < A.length; ++i) {
+      if ((1 << i & used) > 0)
         continue;
       path.add(i);
-      final int newLength =
-          depth == 0 ? words[i].length() : currLength + cost[path.get(depth - 1)][i];
-      dfs(words, cost, path, bestPath, used | 1 << i, depth + 1, newLength);
+      final int newLength = depth == 0 ? A[i].length() : currLength + cost[path.get(depth - 1)][i];
+      dfs(A, cost, path, bestPath, used | 1 << i, depth + 1, newLength);
       path.remove(path.size() - 1);
     }
   }
diff --git a/solutions/944. Delete Columns to Make Sorted/944.py b/solutions/944. Delete Columns to Make Sorted/944.py
index 56c2d0c5eff..a48a23e2ef0 100644
--- a/solutions/944. Delete Columns to Make Sorted/944.py	
+++ b/solutions/944. Delete Columns to Make Sorted/944.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minDeletionSize(self, strs: list[str]) -> int:
+  def minDeletionSize(self, strs: List[str]) -> int:
     ans = 0
 
     for j in range(len(strs[0])):
diff --git a/solutions/945. Minimum Increment to Make Array Unique/945.py b/solutions/945. Minimum Increment to Make Array Unique/945.py
index d83b0d6f896..cd3ce617679 100644
--- a/solutions/945. Minimum Increment to Make Array Unique/945.py	
+++ b/solutions/945. Minimum Increment to Make Array Unique/945.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minIncrementForUnique(self, nums: list[int]) -> int:
+  def minIncrementForUnique(self, nums: List[int]) -> int:
     ans = 0
     minAvailable = 0
 
diff --git a/solutions/946. Validate Stack Sequences/946.py b/solutions/946. Validate Stack Sequences/946.py
index 4cd3441f011..14961db313f 100644
--- a/solutions/946. Validate Stack Sequences/946.py	
+++ b/solutions/946. Validate Stack Sequences/946.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def validateStackSequences(
-      self,
-      pushed: list[int],
-      popped: list[int],
-  ) -> bool:
+  def validateStackSequences(self, pushed: List[int], popped: List[int]) -> bool:
     stack = []
     i = 0  # popped's index
 
diff --git a/solutions/948. Bag of Tokens/948.py b/solutions/948. Bag of Tokens/948.py
index 29f64fc1ba0..76ebfe7a72c 100644
--- a/solutions/948. Bag of Tokens/948.py	
+++ b/solutions/948. Bag of Tokens/948.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def bagOfTokensScore(self, tokens: list[int], power: int) -> int:
+  def bagOfTokensScore(self, tokens: List[int], power: int) -> int:
     ans = 0
     score = 0
     q = collections.deque(sorted(tokens))
diff --git a/solutions/949. Largest Time for Given Digits/949.py b/solutions/949. Largest Time for Given Digits/949.py
index e7639687043..f2ab7d94359 100644
--- a/solutions/949. Largest Time for Given Digits/949.py	
+++ b/solutions/949. Largest Time for Given Digits/949.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestTimeFromDigits(self, arr: list[int]) -> str:
+  def largestTimeFromDigits(self, arr: List[int]) -> str:
     for time in itertools.permutations(sorted(arr, reverse=True)):
       if time[:2] < (2, 4) and time[2] < 6:
         return '%d%d:%d%d' % time
diff --git a/solutions/95. Unique Binary Search Trees II/95.py b/solutions/95. Unique Binary Search Trees II/95.py
index 8eeb85f9af0..a74a46d8004 100644
--- a/solutions/95. Unique Binary Search Trees II/95.py	
+++ b/solutions/95. Unique Binary Search Trees II/95.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def generateTrees(self, n: int) -> list[TreeNode]:
+  def generateTrees(self, n: int) -> List[TreeNode]:
     if n == 0:
       return []
 
-    def generateTrees(mn: int, mx: int) -> list[int | None]:
+    def generateTrees(mn: int, mx: int) -> List[Optional[int]]:
       if mn > mx:
         return [None]
 
diff --git a/solutions/950. Reveal Cards In Increasing Order/950.java b/solutions/950. Reveal Cards In Increasing Order/950.java
index b56f436514c..b98bcda27a6 100644
--- a/solutions/950. Reveal Cards In Increasing Order/950.java	
+++ b/solutions/950. Reveal Cards In Increasing Order/950.java	
@@ -5,12 +5,12 @@ public int[] deckRevealedIncreasing(int[] deck) {
     Arrays.sort(deck);
 
     Deque<Integer> dq = new ArrayDeque<>();
-    dq.offerFirst(deck[n - 1]);
+    dq.addFirst(deck[n - 1]);
 
     for (int i = n - 2; i >= 0; --i) {
-      dq.offerFirst(dq.getLast());
+      dq.addFirst(dq.getLast());
       dq.pollLast();
-      dq.offerFirst(deck[i]);
+      dq.addFirst(deck[i]);
     }
 
     for (int i = 0; i < n; ++i)
diff --git a/solutions/950. Reveal Cards In Increasing Order/950.py b/solutions/950. Reveal Cards In Increasing Order/950.py
index 8e94eec697e..dca8a54c5b2 100644
--- a/solutions/950. Reveal Cards In Increasing Order/950.py	
+++ b/solutions/950. Reveal Cards In Increasing Order/950.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def deckRevealedIncreasing(self, deck: list[int]) -> list[int]:
+  def deckRevealedIncreasing(self, deck: List[int]) -> List[int]:
     dq = collections.deque()
 
     for card in reversed(sorted(deck)):
diff --git a/solutions/951. Flip Equivalent Binary Trees/951.py b/solutions/951. Flip Equivalent Binary Trees/951.py
index dabe437a189..97b9c5bbcbd 100644
--- a/solutions/951. Flip Equivalent Binary Trees/951.py	
+++ b/solutions/951. Flip Equivalent Binary Trees/951.py	
@@ -1,12 +1,11 @@
 class Solution:
-  def flipEquiv(self, root1: TreeNode | None, root2: TreeNode | None) -> bool:
+  def flipEquiv(self, root1: Optional[TreeNode], root2: Optional[TreeNode]) -> bool:
     if not root1:
       return not root2
     if not root2:
       return not root1
     if root1.val != root2.val:
       return False
-    return (self.flipEquiv(root1.left, root2.left) and
-            self.flipEquiv(root1.right, root2.right) or
-            self.flipEquiv(root1.left, root2.right) and
-            self.flipEquiv(root1.right, root2.left))
+    return self.flipEquiv(root1.left, root2.left) and self.flipEquiv(root1.right, root2.right) or \
+        self.flipEquiv(root1.left, root2.right) and self.flipEquiv(
+        root1.right, root2.left)
diff --git a/solutions/952. Largest Component Size by Common Factor/952.py b/solutions/952. Largest Component Size by Common Factor/952.py
index 3d2bf119514..b3c8eee4b26 100644
--- a/solutions/952. Largest Component Size by Common Factor/952.py	
+++ b/solutions/952. Largest Component Size by Common Factor/952.py	
@@ -23,7 +23,7 @@ def find(self, u: int) -> int:
 
 
 class Solution:
-  def largestComponentSize(self, nums: list[int]) -> int:
+  def largestComponentSize(self, nums: List[int]) -> int:
     ans = 0
     uf = UnionFind(max(nums) + 1)
     count = collections.Counter()
diff --git a/solutions/953. Verifying an Alien Dictionary/953.py b/solutions/953. Verifying an Alien Dictionary/953.py
index 5d17d872911..f0c09f96ec5 100644
--- a/solutions/953. Verifying an Alien Dictionary/953.py	
+++ b/solutions/953. Verifying an Alien Dictionary/953.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isAlienSorted(self, words: list[str], order: str) -> bool:
+  def isAlienSorted(self, words: List[str], order: str) -> bool:
     dict = {c: i for i, c in enumerate(order)}
     words = [[dict[c] for c in word] for word in words]
     return all(w1 <= w2 for w1, w2 in zip(words, words[1:]))
diff --git a/solutions/954. Array of Doubled Pairs/954.cpp b/solutions/954. Array of Doubled Pairs/954.cpp
index 43b5638128a..ca54e8a9b48 100644
--- a/solutions/954. Array of Doubled Pairs/954.cpp	
+++ b/solutions/954. Array of Doubled Pairs/954.cpp	
@@ -6,7 +6,7 @@ class Solution {
     for (const int a : arr)
       ++count[a];
 
-    ranges::sort(arr, ranges::less{}, [](const int a) { return abs(a); });
+    ranges::sort(arr, [](const int a, const int b) { return abs(a) < abs(b); });
 
     for (const int a : arr) {
       if (count[a] == 0)
diff --git a/solutions/954. Array of Doubled Pairs/954.java b/solutions/954. Array of Doubled Pairs/954.java
index 2139bb62e2e..85aa40e151f 100644
--- a/solutions/954. Array of Doubled Pairs/954.java	
+++ b/solutions/954. Array of Doubled Pairs/954.java	
@@ -7,8 +7,8 @@ public boolean canReorderDoubled(int[] arr) {
 
     arr = Arrays.stream(arr)
               .boxed()
-              .sorted(Comparator.comparingInt(Math::abs))
-              .mapToInt(Integer::intValue)
+              .sorted((a, b) -> Math.abs(a) - Math.abs(b))
+              .mapToInt(i -> i)
               .toArray();
 
     for (final int a : arr) {
diff --git a/solutions/954. Array of Doubled Pairs/954.py b/solutions/954. Array of Doubled Pairs/954.py
index cb319565c81..157116e5dc5 100644
--- a/solutions/954. Array of Doubled Pairs/954.py	
+++ b/solutions/954. Array of Doubled Pairs/954.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def canReorderDoubled(self, arr: list[int]) -> bool:
+  def canReorderDoubled(self, arr: List[int]) -> bool:
     count = collections.Counter(arr)
 
     for key in sorted(count, key=abs):
diff --git a/solutions/957. Prison Cells After N Days/957.py b/solutions/957. Prison Cells After N Days/957.py
index 1e08f7e3ba8..214a613c20e 100644
--- a/solutions/957. Prison Cells After N Days/957.py	
+++ b/solutions/957. Prison Cells After N Days/957.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def prisonAfterNDays(self, cells: list[int], n: int) -> list[int]:
+  def prisonAfterNDays(self, cells: List[int], n: int) -> List[int]:
     nextDayCells = [0] * len(cells)
     day = 0
 
diff --git a/solutions/961. N-Repeated Element in Size 2N Array/961.py b/solutions/961. N-Repeated Element in Size 2N Array/961.py
index 8b8da88f47e..fe39f817855 100644
--- a/solutions/961. N-Repeated Element in Size 2N Array/961.py	
+++ b/solutions/961. N-Repeated Element in Size 2N Array/961.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def repeatedNTimes(self, nums: list[int]) -> int:
+  def repeatedNTimes(self, nums: List[int]) -> int:
     for i in range(len(nums) - 2):
       if nums[i] == nums[i + 1] or nums[i] == nums[i + 2]:
         return nums[i]
diff --git a/solutions/962. Maximum Width Ramp/962.py b/solutions/962. Maximum Width Ramp/962.py
index 32ce3e74c9e..80e74a6fd26 100644
--- a/solutions/962. Maximum Width Ramp/962.py	
+++ b/solutions/962. Maximum Width Ramp/962.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxWidthRamp(self, nums: list[int]) -> int:
+  def maxWidthRamp(self, nums: List[int]) -> int:
     ans = 0
     stack = []
 
diff --git a/solutions/963. Minimum Area Rectangle II/963.java b/solutions/963. Minimum Area Rectangle II/963.java
index 4399e34c17f..3f877c0630c 100644
--- a/solutions/963. Minimum Area Rectangle II/963.java	
+++ b/solutions/963. Minimum Area Rectangle II/963.java	
@@ -1,6 +1,6 @@
 class Solution {
   public double minAreaFreeRect(int[][] points) {
-    long ans = Long.MAX_VALUE;
+    Long ans = Long.MAX_VALUE;
     // For each A, B pair points, {hash(A, B): (ax, ay, bx, by)}.
     Map<Integer, List<int[]>> centerToPoints = new HashMap<>();
 
@@ -22,7 +22,7 @@ public double minAreaFreeRect(int[][] points) {
           // AC is perpendicular to AD.
           // AC dot AD = (cx - ax, cy - ay) dot (dx - ax, dy - ay) == 0.
           if ((cx - ax) * (dx - ax) + (cy - ay) * (dy - ay) == 0) {
-            final long squaredArea = dist(ax, ay, cx, cy) * dist(ax, ay, dx, dy);
+            Long squaredArea = dist(ax, ay, cx, cy) * dist(ax, ay, dx, dy);
             if (squaredArea > 0)
               ans = Math.min(ans, squaredArea);
           }
@@ -35,7 +35,7 @@ private int hash(int[] p, int[] q) {
     return ((p[0] + q[0]) << 16) + (p[1] + q[1]);
   }
 
-  private long dist(long px, long py, long qx, long qy) {
+  private Long dist(long px, long py, long qx, long qy) {
     return (px - qx) * (px - qx) + (py - qy) * (py - qy);
   }
 }
diff --git a/solutions/963. Minimum Area Rectangle II/963.py b/solutions/963. Minimum Area Rectangle II/963.py
index 37951a73e52..147918ceca2 100644
--- a/solutions/963. Minimum Area Rectangle II/963.py	
+++ b/solutions/963. Minimum Area Rectangle II/963.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minAreaFreeRect(self, points: list[list[int]]) -> float:
+  def minAreaFreeRect(self, points: List[List[int]]) -> float:
     ans = math.inf
     # For each A, B pair points, {hash(A, B): (ax, ay, bx, by)}.
     centerToPoints = collections.defaultdict(list)
diff --git a/solutions/964. Least Operators to Express Number/964.cpp b/solutions/964. Least Operators to Express Number/964.cpp
index 98f9adc6815..eef1c2221dc 100644
--- a/solutions/964. Least Operators to Express Number/964.cpp	
+++ b/solutions/964. Least Operators to Express Number/964.cpp	
@@ -22,9 +22,9 @@ class Solution {
     if (prod == target)
       return mem[target] = n;
 
-    int ans = dfs(x, target - prod / x, std::move(mem)) + n;
+    int ans = dfs(x, target - prod / x, move(mem)) + n;
     if (prod < 2 * target)
-      ans = min(ans, dfs(x, prod - target, std::move(mem)) + n + 1);
+      ans = min(ans, dfs(x, prod - target, move(mem)) + n + 1);
     return mem[target] = ans;
   }
 };
diff --git a/solutions/964. Least Operators to Express Number/964.java b/solutions/964. Least Operators to Express Number/964.java
index c864b1ca213..f83eb9770b9 100644
--- a/solutions/964. Least Operators to Express Number/964.java	
+++ b/solutions/964. Least Operators to Express Number/964.java	
@@ -24,9 +24,9 @@ private int dfs(int x, int target) {
       return mem.get(target);
     }
 
-    int ans = dfs(x, target - (int) (prod / x)) + n;
+    int ans = dfs(x, target - (int) (prod / (long) x)) + n;
     if (prod < 2 * target)
-      ans = Math.min(ans, dfs(x, (int) (prod - target)) + n + 1);
+      ans = Math.min(ans, dfs(x, (int) (prod - (long) target)) + n + 1);
     mem.put(target, ans);
     return ans;
   }
diff --git a/solutions/965. Univalued Binary Tree/965.py b/solutions/965. Univalued Binary Tree/965.py
index 78cafad2e66..f44dcf2908a 100644
--- a/solutions/965. Univalued Binary Tree/965.py	
+++ b/solutions/965. Univalued Binary Tree/965.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isUnivalTree(self, root: TreeNode | None) -> bool:
+  def isUnivalTree(self, root: Optional[TreeNode]) -> bool:
     if not root:
       return True
     if root.left and root.left.val != root.val:
diff --git a/solutions/966. Vowel Spellchecker/966.py b/solutions/966. Vowel Spellchecker/966.py
index 0ccc72127b0..979ad5ee76a 100644
--- a/solutions/966. Vowel Spellchecker/966.py	
+++ b/solutions/966. Vowel Spellchecker/966.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def spellchecker(self, wordlist: list[str], queries: list[str]) -> list[str]:
+  def spellchecker(self, wordlist: List[str], queries: List[str]) -> List[str]:
     def lowerKey(word: str) -> str:
       return '$' + ''.join([c.lower() for c in word])
 
diff --git a/solutions/969. Pancake Sorting/969.py b/solutions/969. Pancake Sorting/969.py
index 5bf5e134d03..f7d7ae0ae99 100644
--- a/solutions/969. Pancake Sorting/969.py	
+++ b/solutions/969. Pancake Sorting/969.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def pancakeSort(self, arr: list[int]) -> list[int]:
+  def pancakeSort(self, arr: List[int]) -> List[int]:
     ans = []
 
     for target in range(len(arr), 0, -1):
diff --git a/solutions/97. Interleaving String/97-2.py b/solutions/97. Interleaving String/97-2.py
index 356d603621b..3c8fd5be851 100644
--- a/solutions/97. Interleaving String/97-2.py	
+++ b/solutions/97. Interleaving String/97-2.py	
@@ -16,7 +16,7 @@ def isInterleave(self, s1: str, s2: str, s3: str) -> bool:
         elif j == 0:
           dp[j] = dp[j] and s1[i - 1] == s3[i - 1]
         else:
-          dp[j] = (dp[j] and s1[i - 1] == s3[i + j - 1] or
-                   dp[j - 1] and s2[j - 1] == s3[i + j - 1])
+          dp[j] = (dp[j] and s1[i - 1] == s3[i + j - 1]) or \
+              (dp[j - 1] and s2[j - 1] == s3[i + j - 1])
 
     return dp[n]
diff --git a/solutions/97. Interleaving String/97.py b/solutions/97. Interleaving String/97.py
index 11acefa3964..136abf355b8 100644
--- a/solutions/97. Interleaving String/97.py	
+++ b/solutions/97. Interleaving String/97.py	
@@ -18,7 +18,7 @@ def isInterleave(self, s1: str, s2: str, s3: str) -> bool:
 
     for i in range(1, m + 1):
       for j in range(1, n + 1):
-        dp[i][j] = (dp[i - 1][j] and s1[i - 1] == s3[i + j - 1] or
-                    dp[i][j - 1] and s2[j - 1] == s3[i + j - 1])
+        dp[i][j] = (dp[i - 1][j] and s1[i - 1] == s3[i + j - 1]) or \
+            (dp[i][j - 1] and s2[j - 1] == s3[i + j - 1])
 
     return dp[m][n]
diff --git a/solutions/970. Powerful Integers/970.py b/solutions/970. Powerful Integers/970.py
index 52e8469bb0d..f898fc8c971 100644
--- a/solutions/970. Powerful Integers/970.py	
+++ b/solutions/970. Powerful Integers/970.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def powerfulIntegers(self, x: int, y: int, bound: int) -> list[int]:
+  def powerfulIntegers(self, x: int, y: int, bound: int) -> List[int]:
     xs = {x**i for i in range(20) if x**i < bound}
     ys = {y**i for i in range(20) if y**i < bound}
     return list({i + j for i in xs for j in ys if i + j <= bound})
diff --git a/solutions/971. Flip Binary Tree To Match Preorder Traversal/971.cpp b/solutions/971. Flip Binary Tree To Match Preorder Traversal/971.cpp
index 186cac6a5e6..4277ddbaf82 100644
--- a/solutions/971. Flip Binary Tree To Match Preorder Traversal/971.cpp	
+++ b/solutions/971. Flip Binary Tree To Match Preorder Traversal/971.cpp	
@@ -20,11 +20,11 @@ class Solution {
     if (i < voyage.size() && root->left && root->left->val != voyage[i]) {
       // Flip the root.
       ans.push_back(root->val);
-      dfs(root->right, std::move(i), voyage, ans);
-      dfs(root->left, std::move(i), voyage, ans);
+      dfs(root->right, move(i), voyage, ans);
+      dfs(root->left, move(i), voyage, ans);
     } else {
-      dfs(root->left, std::move(i), voyage, ans);
-      dfs(root->right, std::move(i), voyage, ans);
+      dfs(root->left, move(i), voyage, ans);
+      dfs(root->right, move(i), voyage, ans);
     }
   }
 };
diff --git a/solutions/973. K Closest Points to Origin/973-2.py b/solutions/973. K Closest Points to Origin/973-2.py
index 362c51eb2ac..2e1b13e09f6 100644
--- a/solutions/973. K Closest Points to Origin/973-2.py	
+++ b/solutions/973. K Closest Points to Origin/973-2.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def kClosest(self, points: list[list[int]], k: int) -> list[list[int]]:
-    def squareDist(p: list[int]) -> int:
+  def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]:
+    def squareDist(p: List[int]) -> int:
       return p[0] * p[0] + p[1] * p[1]
 
     def quickSelect(l: int, r: int, k: int) -> None:
diff --git a/solutions/973. K Closest Points to Origin/973-3.py b/solutions/973. K Closest Points to Origin/973-3.py
index 603742a5d8a..13fa647a5b3 100644
--- a/solutions/973. K Closest Points to Origin/973-3.py	
+++ b/solutions/973. K Closest Points to Origin/973-3.py	
@@ -1,6 +1,6 @@
 class Solution:
-  def kClosest(self, points: list[list[int]], k: int) -> list[list[int]]:
-    def squareDist(p: list[int]) -> int:
+  def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]:
+    def squareDist(p: List[int]) -> int:
       return p[0] * p[0] + p[1] * p[1]
 
     def quickSelect(l: int, r: int, k: int) -> None:
@@ -28,8 +28,8 @@ def quickSelect(l: int, r: int, k: int) -> None:
 
 
 class Solution:
-  def kClosest(self, points: list[list[int]], k: int) -> list[list[int]]:
-    def squareDist(p: list[int]) -> int:
+  def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]:
+    def squareDist(p: List[int]) -> int:
       return p[0] * p[0] + p[1] * p[1]
 
     def quickSelect(l: int, r: int, k: int) -> None:
diff --git a/solutions/973. K Closest Points to Origin/973.java b/solutions/973. K Closest Points to Origin/973.java
index 8bd0641fab5..15502e1b20c 100644
--- a/solutions/973. K Closest Points to Origin/973.java	
+++ b/solutions/973. K Closest Points to Origin/973.java	
@@ -1,7 +1,7 @@
 class Solution {
   public int[][] kClosest(int[][] points, int k) {
     int[][] ans = new int[k][2];
-    Queue<int[]> maxHeap = new PriorityQueue<>(Comparator.comparingInt(a -> - squareDist(a)));
+    PriorityQueue<int[]> maxHeap = new PriorityQueue<>((a, b) -> squareDist(b) - squareDist(a));
 
     for (int[] point : points) {
       maxHeap.offer(point);
diff --git a/solutions/973. K Closest Points to Origin/973.py b/solutions/973. K Closest Points to Origin/973.py
index 9b2b137e716..8128de9e311 100644
--- a/solutions/973. K Closest Points to Origin/973.py	
+++ b/solutions/973. K Closest Points to Origin/973.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def kClosest(self, points: list[list[int]], k: int) -> list[list[int]]:
+  def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]:
     maxHeap = []
 
     for x, y in points:
diff --git a/solutions/974. Subarray Sums Divisible by K/974.py b/solutions/974. Subarray Sums Divisible by K/974.py
index aa03fd9f99b..6016efe9ea5 100644
--- a/solutions/974. Subarray Sums Divisible by K/974.py	
+++ b/solutions/974. Subarray Sums Divisible by K/974.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def subarraysDivByK(self, nums: list[int], k: int) -> int:
+  def subarraysDivByK(self, nums: List[int], k: int) -> int:
     ans = 0
     prefix = 0
     count = [0] * k
diff --git a/solutions/976. Largest Perimeter Triangle/976.py b/solutions/976. Largest Perimeter Triangle/976.py
index 5ece5b1b22b..0c7a6b3eed8 100644
--- a/solutions/976. Largest Perimeter Triangle/976.py	
+++ b/solutions/976. Largest Perimeter Triangle/976.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def largestPerimeter(self, nums: list[int]) -> int:
+  def largestPerimeter(self, nums: List[int]) -> int:
     nums = sorted(nums)
 
     for i in range(len(nums) - 1, 1, -1):
diff --git a/solutions/977. Squares of a Sorted Array/977.py b/solutions/977. Squares of a Sorted Array/977.py
index 1b3025903b7..6a8e089556d 100644
--- a/solutions/977. Squares of a Sorted Array/977.py	
+++ b/solutions/977. Squares of a Sorted Array/977.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def sortedSquares(self, nums: list[int]) -> list[int]:
+  def sortedSquares(self, nums: List[int]) -> List[int]:
     n = len(nums)
     l = 0
     r = n - 1
diff --git a/solutions/978. Longest Turbulent Subarray/978.py b/solutions/978. Longest Turbulent Subarray/978.py
index b4623ca6cbe..dc3b3f5ae6c 100644
--- a/solutions/978. Longest Turbulent Subarray/978.py	
+++ b/solutions/978. Longest Turbulent Subarray/978.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def maxTurbulenceSize(self, arr: list[int]) -> int:
+  def maxTurbulenceSize(self, arr: List[int]) -> int:
     ans = 1
     increasing = 1
     decreasing = 1
diff --git a/solutions/98. Validate Binary Search Tree/98-2.cpp b/solutions/98. Validate Binary Search Tree/98-2.cpp
index 5324cbbf309..ab2aeeefe7d 100644
--- a/solutions/98. Validate Binary Search Tree/98-2.cpp	
+++ b/solutions/98. Validate Binary Search Tree/98-2.cpp	
@@ -4,8 +4,8 @@ class Solution {
     stack<TreeNode*> stack;
     TreeNode* pred = nullptr;
 
-    while (root != nullptr || !stack.empty()) {
-      while (root != nullptr) {
+    while (root || !stack.empty()) {
+      while (root) {
         stack.push(root);
         root = root->left;
       }
diff --git a/solutions/98. Validate Binary Search Tree/98-2.py b/solutions/98. Validate Binary Search Tree/98-2.py
index 53d0ce204ea..b7ed9107f4b 100644
--- a/solutions/98. Validate Binary Search Tree/98-2.py	
+++ b/solutions/98. Validate Binary Search Tree/98-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def isValidBST(self, root: TreeNode | None) -> bool:
+  def isValidBST(self, root: Optional[TreeNode]) -> bool:
     stack = []
     pred = None
 
diff --git a/solutions/98. Validate Binary Search Tree/98.py b/solutions/98. Validate Binary Search Tree/98.py
index 4462555feb9..53ea628707c 100644
--- a/solutions/98. Validate Binary Search Tree/98.py	
+++ b/solutions/98. Validate Binary Search Tree/98.py	
@@ -1,7 +1,7 @@
 class Solution:
-  def isValidBST(self, root: TreeNode | None) -> bool:
-    def isValidBST(root: TreeNode | None,
-                   minNode: TreeNode | None, maxNode: TreeNode | None) -> bool:
+  def isValidBST(self, root: Optional[TreeNode]) -> bool:
+    def isValidBST(root: Optional[TreeNode],
+                   minNode: Optional[TreeNode], maxNode: Optional[TreeNode]) -> bool:
       if not root:
         return True
       if minNode and root.val <= minNode.val:
@@ -9,7 +9,7 @@ def isValidBST(root: TreeNode | None,
       if maxNode and root.val >= maxNode.val:
         return False
 
-      return (isValidBST(root.left, minNode, root) and
-              isValidBST(root.right, root, maxNode))
+      return isValidBST(root.left, minNode, root) and \
+          isValidBST(root.right, root, maxNode)
 
     return isValidBST(root, None, None)
diff --git a/solutions/981. Time Based Key-Value Store/981.cpp b/solutions/981. Time Based Key-Value Store/981.cpp
index e3944a50987..6df98c2bfd5 100644
--- a/solutions/981. Time Based Key-Value Store/981.cpp	
+++ b/solutions/981. Time Based Key-Value Store/981.cpp	
@@ -1,6 +1,7 @@
 struct T {
   string value;
   int timestamp;
+  T(string value, int timestamp) : value(value), timestamp(timestamp) {}
 };
 
 class TimeMap {
diff --git a/solutions/982. Triples with Bitwise AND Equal To Zero/982.java b/solutions/982. Triples with Bitwise AND Equal To Zero/982.java
index cb46aa704d1..d1772a58a5c 100644
--- a/solutions/982. Triples with Bitwise AND Equal To Zero/982.java	
+++ b/solutions/982. Triples with Bitwise AND Equal To Zero/982.java	
@@ -1,15 +1,15 @@
 class Solution {
   public int countTriplets(int[] nums) {
-    final int MAX = 1 << 16;
+    final int kMax = 1 << 16;
     int ans = 0;
-    int[] count = new int[MAX]; // {nums[i] & nums[j]: times}
+    int[] count = new int[kMax]; // {nums[i] & nums[j]: times}
 
     for (final int a : nums)
       for (final int b : nums)
         ++count[a & b];
 
     for (final int num : nums)
-      for (int i = 0; i < MAX; ++i)
+      for (int i = 0; i < kMax; ++i)
         if ((num & i) == 0)
           ans += count[i];
 
diff --git a/solutions/982. Triples with Bitwise AND Equal To Zero/982.py b/solutions/982. Triples with Bitwise AND Equal To Zero/982.py
index 80bcf7fefb4..4407c8e25e7 100644
--- a/solutions/982. Triples with Bitwise AND Equal To Zero/982.py	
+++ b/solutions/982. Triples with Bitwise AND Equal To Zero/982.py	
@@ -1,15 +1,15 @@
 class Solution:
-  def countTriplets(self, nums: list[int]) -> int:
-    MAX = 1 << 16
+  def countTriplets(self, nums: List[int]) -> int:
+    kMax = 1 << 16
     ans = 0
-    count = [0] * MAX  # {nums[i] & nums[j]: times}
+    count = [0] * kMax  # {nums[i] & nums[j]: times}
 
     for a in nums:
       for b in nums:
         count[a & b] += 1
 
     for num in nums:
-      for i in range(MAX):
+      for i in range(kMax):
         if (num & i) == 0:
           ans += count[i]
 
diff --git a/solutions/983. Minimum Cost For Tickets/983.cpp b/solutions/983. Minimum Cost For Tickets/983.cpp
index df19df7d134..664be96ef4d 100644
--- a/solutions/983. Minimum Cost For Tickets/983.cpp	
+++ b/solutions/983. Minimum Cost For Tickets/983.cpp	
@@ -5,7 +5,7 @@ class Solution {
     queue<pair<int, int>> last7;
     queue<pair<int, int>> last30;
 
-    for (const int day : days) {
+    for (int day : days) {
       while (!last7.empty() && last7.front().first + 7 <= day)
         last7.pop();
       while (!last30.empty() && last30.front().first + 30 <= day)
diff --git a/solutions/983. Minimum Cost For Tickets/983.java b/solutions/983. Minimum Cost For Tickets/983.java
index 854e2bfb6f8..9db38c4db1e 100644
--- a/solutions/983. Minimum Cost For Tickets/983.java	
+++ b/solutions/983. Minimum Cost For Tickets/983.java	
@@ -1,17 +1,17 @@
 class Solution {
   public int mincostTickets(int[] days, int[] costs) {
     int ans = 0;
-    Queue<Pair<Integer, Integer>> last7 = new ArrayDeque<>(); // [day, cost]
-    Queue<Pair<Integer, Integer>> last30 = new ArrayDeque<>();
+    Queue<int[]> last7 = new ArrayDeque<>(); // [day, cost]
+    Queue<int[]> last30 = new ArrayDeque<>();
 
-    for (final int day : days) {
-      while (!last7.isEmpty() && last7.peek().getKey() + 7 <= day)
+    for (int day : days) {
+      while (!last7.isEmpty() && last7.peek()[0] + 7 <= day)
         last7.poll();
-      while (!last30.isEmpty() && last30.peek().getKey() + 30 <= day)
+      while (!last30.isEmpty() && last30.peek()[0] + 30 <= day)
         last30.poll();
-      last7.offer(new Pair<>(day, ans + costs[1]));
-      last30.offer(new Pair<>(day, ans + costs[2]));
-      ans = Math.min(ans + costs[0], Math.min(last7.peek().getValue(), last30.peek().getValue()));
+      last7.offer(new int[] {day, ans + costs[1]});
+      last30.offer(new int[] {day, ans + costs[2]});
+      ans = Math.min(ans + costs[0], Math.min(last7.peek()[1], last30.peek()[1]));
     }
 
     return ans;
diff --git a/solutions/983. Minimum Cost For Tickets/983.py b/solutions/983. Minimum Cost For Tickets/983.py
index 309d427c0dc..4224fe3a4ae 100644
--- a/solutions/983. Minimum Cost For Tickets/983.py	
+++ b/solutions/983. Minimum Cost For Tickets/983.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def mincostTickets(self, days: list[int], costs: list[int]) -> int:
+  def mincostTickets(self, days: List[int], costs: List[int]) -> int:
     ans = 0
     last7 = collections.deque()
     last30 = collections.deque()
diff --git a/solutions/985. Sum of Even Numbers After Queries/985.cpp b/solutions/985. Sum of Even Numbers After Queries/985.cpp
index a6a8fa34560..abd6f53a2f7 100644
--- a/solutions/985. Sum of Even Numbers After Queries/985.cpp	
+++ b/solutions/985. Sum of Even Numbers After Queries/985.cpp	
@@ -3,8 +3,9 @@ class Solution {
   vector<int> sumEvenAfterQueries(vector<int>& nums,
                                   vector<vector<int>>& queries) {
     vector<int> ans;
-    int sum = accumulate(nums.begin(), nums.end(), 0, [](int acc, int num) {
-      return acc + (num % 2 == 0 ? num : 0);
+    int sum =
+        accumulate(nums.begin(), nums.end(), 0, [](int subtotal, int num) {
+      return subtotal + (num % 2 == 0 ? num : 0);
     });
 
     for (const vector<int>& query : queries) {
diff --git a/solutions/985. Sum of Even Numbers After Queries/985.py b/solutions/985. Sum of Even Numbers After Queries/985.py
index a607d914190..cedf3b306db 100644
--- a/solutions/985. Sum of Even Numbers After Queries/985.py	
+++ b/solutions/985. Sum of Even Numbers After Queries/985.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def sumEvenAfterQueries(
-      self,
-      nums: list[int],
-      queries: list[list[int]],
-  ) -> list[int]:
+  def sumEvenAfterQueries(self, nums: List[int], queries: List[List[int]]) -> List[int]:
     ans = []
     summ = sum(a for a in nums if a % 2 == 0)
 
diff --git a/solutions/986. Interval List Intersections/986.py b/solutions/986. Interval List Intersections/986.py
index da908c00278..568d864322b 100644
--- a/solutions/986. Interval List Intersections/986.py	
+++ b/solutions/986. Interval List Intersections/986.py	
@@ -1,6 +1,5 @@
 class Solution:
-  def intervalIntersection(self, firstList: list[list[int]],
-                           secondList: list[list[int]]) -> list[list[int]]:
+  def intervalIntersection(self, firstList: List[List[int]], secondList: List[List[int]]) -> List[List[int]]:
     ans = []
     i = 0
     j = 0
@@ -8,11 +7,11 @@ def intervalIntersection(self, firstList: list[list[int]],
     while i < len(firstList) and j < len(secondList):
       # lo := the start of the intersection
       # hi := the end of the intersection
-      lo = max(firstlist[i][0], secondlist[j][0])
-      hi = min(firstlist[i][1], secondlist[j][1])
+      lo = max(firstList[i][0], secondList[j][0])
+      hi = min(firstList[i][1], secondList[j][1])
       if lo <= hi:
         ans.append([lo, hi])
-      if firstlist[i][1] < secondlist[j][1]:
+      if firstList[i][1] < secondList[j][1]:
         i += 1
       else:
         j += 1
diff --git a/solutions/987. Vertical Order Traversal of a Binary Tree/987.java b/solutions/987. Vertical Order Traversal of a Binary Tree/987.java
index fe5e75eea47..e3dc7529fb0 100644
--- a/solutions/987. Vertical Order Traversal of a Binary Tree/987.java	
+++ b/solutions/987. Vertical Order Traversal of a Binary Tree/987.java	
@@ -6,8 +6,7 @@ public List<List<Integer>> verticalTraversal(TreeNode root) {
     dfs(root, 0, 0, xToSortedPairs);
 
     for (List<int[]> pairs : xToSortedPairs.values()) {
-      Collections.sort(pairs, Comparator.comparingInt((int[] pair) -> pair[0])
-                                  .thenComparingInt((int[] pair) -> pair[1]));
+      Collections.sort(pairs, (a, b) -> a[0] == b[0] ? a[1] - b[1] : a[0] - b[0]);
       List<Integer> vals = new ArrayList<>();
       for (int[] pair : pairs)
         vals.add(pair[1]);
diff --git a/solutions/987. Vertical Order Traversal of a Binary Tree/987.py b/solutions/987. Vertical Order Traversal of a Binary Tree/987.py
index e162dfd1993..7814085595a 100644
--- a/solutions/987. Vertical Order Traversal of a Binary Tree/987.py	
+++ b/solutions/987. Vertical Order Traversal of a Binary Tree/987.py	
@@ -1,9 +1,9 @@
 class Solution:
-  def verticalTraversal(self, root: TreeNode | None) -> list[list[int]]:
+  def verticalTraversal(self, root: Optional[TreeNode]) -> List[List[int]]:
     ans = []
     xToNodes = collections.defaultdict(list)
 
-    def dfs(node: TreeNode | None, x: int, y: int) -> None:
+    def dfs(node: Optional[TreeNode], x: int, y: int) -> None:
       if not node:
         return
       xToNodes[x].append((-y, node.val))
@@ -12,7 +12,7 @@ def dfs(node: TreeNode | None, x: int, y: int) -> None:
 
     dfs(root, 0, 0)
 
-    for _, nodes in sorted(xToNodes.items(), key=lambda x: x[0]):
+    for _, nodes in sorted(xToNodes.items(), key=lambda item: item[0]):
       ans.append([val for _, val in sorted(nodes)])
 
     return ans
diff --git a/solutions/988. Smallest String Starting From Leaf/988.cpp b/solutions/988. Smallest String Starting From Leaf/988.cpp
index 349ccc1e6ea..d2399397e72 100644
--- a/solutions/988. Smallest String Starting From Leaf/988.cpp	
+++ b/solutions/988. Smallest String Starting From Leaf/988.cpp	
@@ -14,14 +14,14 @@ class Solution {
     path.push_back(root->val + 'a');
 
     if (root->left == nullptr && root->right == nullptr) {
-      ranges::reverse(path);
+      reverse(path.begin(), path.end());
       if (ans == "" || ans > path)
         ans = path;
-      ranges::reverse(path);  // Roll back.
+      reverse(path.begin(), path.end());  // Roll back.
     }
 
-    dfs(root->left, std::move(path), ans);
-    dfs(root->right, std::move(path), ans);
+    dfs(root->left, move(path), ans);
+    dfs(root->right, move(path), ans);
     path.pop_back();
   }
 };
diff --git a/solutions/989. Add to Array-Form of Integer/989.py b/solutions/989. Add to Array-Form of Integer/989.py
index 0934fa56887..a30ad1a4442 100644
--- a/solutions/989. Add to Array-Form of Integer/989.py	
+++ b/solutions/989. Add to Array-Form of Integer/989.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def addToArrayForm(self, num: list[int], k: int) -> list[int]:
+  def addToArrayForm(self, num: List[int], k: int) -> List[int]:
     for i in reversed(range(len(num))):
       k, num[i] = divmod(num[i] + k, 10)
 
diff --git a/solutions/99. Recover Binary Search Tree/99-2.py b/solutions/99. Recover Binary Search Tree/99-2.py
index 68fc1458b78..338befd4904 100644
--- a/solutions/99. Recover Binary Search Tree/99-2.py	
+++ b/solutions/99. Recover Binary Search Tree/99-2.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def recoverTree(self, root: TreeNode | None) -> None:
+  def recoverTree(self, root: Optional[TreeNode]) -> None:
     pred = None
     x = None  # the first wrong node
     y = None  # the second wrong node
@@ -17,7 +17,7 @@ def recoverTree(self, root: TreeNode | None) -> None:
       pred = root
       root = root.right
 
-    def swap(x: TreeNode | None, y: TreeNode | None) -> None:
+    def swap(x: Optional[TreeNode], y: Optional[TreeNode]) -> None:
       temp = x.val
       x.val = y.val
       y.val = temp
diff --git a/solutions/99. Recover Binary Search Tree/99-3.py b/solutions/99. Recover Binary Search Tree/99-3.py
index 2504640bf52..6cc9d5d7f28 100644
--- a/solutions/99. Recover Binary Search Tree/99-3.py	
+++ b/solutions/99. Recover Binary Search Tree/99-3.py	
@@ -1,10 +1,10 @@
 class Solution:
-  def recoverTree(self, root: TreeNode | None) -> None:
+  def recoverTree(self, root: Optional[TreeNode]) -> None:
     pred = None
     x = None  # the first wrong node
     y = None  # the second wrong node
 
-    def findPredecessor(root: TreeNode | None) -> TreeNode | None:
+    def findPredecessor(root: Optional[TreeNode]) -> Optional[TreeNode]:
       pred = root.left
       while pred.right and pred.right != root:
         pred = pred.right
@@ -37,7 +37,7 @@ def findPredecessor(root: TreeNode | None) -> TreeNode | None:
         # End of the main logic.
         root = root.right
 
-    def swap(x: TreeNode | None, y: TreeNode | None) -> None:
+    def swap(x: Optional[TreeNode], y: Optional[TreeNode]) -> None:
       temp = x.val
       x.val = y.val
       y.val = temp
diff --git a/solutions/99. Recover Binary Search Tree/99.py b/solutions/99. Recover Binary Search Tree/99.py
index 5fc8fcd7ceb..a4698e0ce95 100644
--- a/solutions/99. Recover Binary Search Tree/99.py	
+++ b/solutions/99. Recover Binary Search Tree/99.py	
@@ -1,11 +1,11 @@
 class Solution:
-  def recoverTree(self, root: TreeNode | None) -> None:
-    def swap(x: TreeNode | None, y: TreeNode | None) -> None:
+  def recoverTree(self, root: Optional[TreeNode]) -> None:
+    def swap(x: Optional[TreeNode], y: Optional[TreeNode]) -> None:
       temp = x.val
       x.val = y.val
       y.val = temp
 
-    def inorder(root: TreeNode | None) -> None:
+    def inorder(root: Optional[TreeNode]) -> None:
       if not root:
         return
 
diff --git a/solutions/990. Satisfiability of Equality Equations/990.py b/solutions/990. Satisfiability of Equality Equations/990.py
index b32965fb709..1a625f18713 100644
--- a/solutions/990. Satisfiability of Equality Equations/990.py	
+++ b/solutions/990. Satisfiability of Equality Equations/990.py	
@@ -12,16 +12,13 @@ def find(self, u: int) -> int:
 
 
 class Solution:
-  def equationsPossible(self, equations: list[str]) -> bool:
+  def equationsPossible(self, equations: List[str]) -> bool:
     uf = UnionFind(26)
 
     for x, op, _, y in equations:
       if op == '=':
-        uf.union(ord(x) - ord('a'),
-                 ord(y) - ord('a'))
+        uf.union(ord(x) - ord('a'), ord(y) - ord('a'))
 
-    return all(
-        uf.find(ord(x) - ord('a')) !=
-        uf.find(ord(y) - ord('a'))
-        for x, op, _, y in equations
-        if op == '!')
+    return all(uf.find(ord(x) - ord('a')) != uf.find(ord(y) - ord('a'))
+               for x, op, _, y in equations
+               if op == '!')
diff --git a/solutions/992. Subarrays with K Different Integers/992.cpp b/solutions/992. Subarrays with K Different Integers/992.cpp
index 94417ef1241..d15c5c38614 100644
--- a/solutions/992. Subarrays with K Different Integers/992.cpp	
+++ b/solutions/992. Subarrays with K Different Integers/992.cpp	
@@ -1,12 +1,12 @@
 class Solution {
  public:
   int subarraysWithKDistinct(vector<int>& nums, int k) {
-    return subarraysWithAtMostKDistinct(nums, k) -
-           subarraysWithAtMostKDistinct(nums, k - 1);
+    return subarrayWithAtMostKDistinct(nums, k) -
+           subarrayWithAtMostKDistinct(nums, k - 1);
   }
 
  private:
-  int subarraysWithAtMostKDistinct(const vector<int>& nums, int k) {
+  int subarrayWithAtMostKDistinct(const vector<int>& nums, int k) {
     int res = 0;
     vector<int> count(nums.size() + 1);
 
diff --git a/solutions/992. Subarrays with K Different Integers/992.py b/solutions/992. Subarrays with K Different Integers/992.py
index a28e89790a1..c7eea10c0ae 100644
--- a/solutions/992. Subarrays with K Different Integers/992.py	
+++ b/solutions/992. Subarrays with K Different Integers/992.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def subarraysWithKDistinct(self, nums: list[int], k: int) -> int:
+  def subarraysWithKDistinct(self, nums: List[int], k: int) -> int:
     def subarraysWithAtMostKDistinct(k: int) -> int:
       res = 0
       count = collections.Counter()
diff --git a/solutions/994. Rotting Oranges/994-2.cpp b/solutions/994. Rotting Oranges/994-2.cpp
index 646a5cdcddd..8f74fd71015 100644
--- a/solutions/994. Rotting Oranges/994-2.cpp	
+++ b/solutions/994. Rotting Oranges/994-2.cpp	
@@ -1,9 +1,10 @@
 class Solution {
  public:
   int orangesRotting(vector<vector<int>>& grid) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = grid.size();
     const int n = grid[0].size();
+    int ans = 0;
     int countFresh = 0;
     queue<pair<int, int>> q;
 
@@ -17,12 +18,12 @@ class Solution {
     if (countFresh == 0)
       return 0;
 
-    int step = 0;
-    for (; !q.empty(); ++step)
+    while (!q.empty()) {
+      ++ans;
       for (int sz = q.size(); sz > 0; --sz) {
         const auto [i, j] = q.front();
         q.pop();
-        for (const auto& [dx, dy] : kDirs) {
+        for (const auto& [dx, dy] : dirs) {
           const int x = i + dx;
           const int y = j + dy;
           if (x < 0 || x == m || y < 0 || y == n)
@@ -34,7 +35,8 @@ class Solution {
           --countFresh;     // Decrease the count of fresh oranges by 1.
         }
       }
+    }
 
-    return countFresh == 0 ? step - 1 : -1;
+    return countFresh == 0 ? ans - 1 : -1;
   }
 };
diff --git a/solutions/994. Rotting Oranges/994.cpp b/solutions/994. Rotting Oranges/994.cpp
index b25701de08d..b8c448da249 100644
--- a/solutions/994. Rotting Oranges/994.cpp	
+++ b/solutions/994. Rotting Oranges/994.cpp	
@@ -1,12 +1,12 @@
 class Solution {
  public:
   int orangesRotting(vector<vector<int>>& grid) {
-    constexpr int kDirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
+    constexpr int dirs[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
     const int m = grid.size();
     const int n = grid[0].size();
 
     auto isNeighborRotten = [&](int i, int j, const vector<vector<int>>& grid) {
-      for (const auto& [dx, dy] : kDirs) {
+      for (const auto& [dx, dy] : dirs) {
         const int r = i + dx;
         const int c = j + dy;
         if (r < 0 || r == m || c < 0 || c == n)
diff --git a/solutions/995. Minimum Number of K Consecutive Bit Flips/995.py b/solutions/995. Minimum Number of K Consecutive Bit Flips/995.py
index 2560e773dc5..7962c0d8127 100644
--- a/solutions/995. Minimum Number of K Consecutive Bit Flips/995.py	
+++ b/solutions/995. Minimum Number of K Consecutive Bit Flips/995.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def minKBitFlips(self, nums: list[int], k: int) -> int:
+  def minKBitFlips(self, nums: List[int], k: int) -> int:
     ans = 0
     flippedTime = 0
 
diff --git a/solutions/996. Number of Squareful Arrays/996.cpp b/solutions/996. Number of Squareful Arrays/996.cpp
index 79d05317427..55afe2264a7 100644
--- a/solutions/996. Number of Squareful Arrays/996.cpp	
+++ b/solutions/996. Number of Squareful Arrays/996.cpp	
@@ -24,7 +24,7 @@ class Solution {
         continue;
       used[i] = true;
       path.push_back(nums[i]);
-      dfs(nums, std::move(used), std::move(path), ans);
+      dfs(nums, move(used), move(path), ans);
       path.pop_back();
       used[i] = false;
     }
diff --git a/solutions/996. Number of Squareful Arrays/996.py b/solutions/996. Number of Squareful Arrays/996.py
index 143fa0f21b7..8dff9db61ad 100644
--- a/solutions/996. Number of Squareful Arrays/996.py	
+++ b/solutions/996. Number of Squareful Arrays/996.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numSquarefulPerms(self, nums: list[int]) -> int:
+  def numSquarefulPerms(self, nums: List[int]) -> int:
     ans = 0
     used = [False] * len(nums)
 
@@ -7,7 +7,7 @@ def isSquare(num: int) -> bool:
       root = math.isqrt(num)
       return root * root == num
 
-    def dfs(path: list[int]) -> None:
+    def dfs(path: List[int]) -> None:
       nonlocal ans
       if len(path) > 1 and not isSquare(path[-1] + path[-2]):
         return
diff --git a/solutions/997. Find the Town Judge/997.py b/solutions/997. Find the Town Judge/997.py
index b19d374edd0..62ca1116abd 100644
--- a/solutions/997. Find the Town Judge/997.py	
+++ b/solutions/997. Find the Town Judge/997.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def findJudge(self, n: int, trust: list[list[int]]) -> int:
+  def findJudge(self, n: int, trust: List[List[int]]) -> int:
     count = [0] * (n + 1)
 
     for a, b in trust:
diff --git a/solutions/998. Maximum Binary Tree II/998-2.py b/solutions/998. Maximum Binary Tree II/998-2.py
index bb32d147bae..e0a631a5f3a 100644
--- a/solutions/998. Maximum Binary Tree II/998-2.py	
+++ b/solutions/998. Maximum Binary Tree II/998-2.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def insertIntoMaxTree(
-      self,
-      root: TreeNode | None,
-      val: int,
-  ) -> TreeNode | None:
+  def insertIntoMaxTree(self, root: Optional[TreeNode], val: int) -> Optional[TreeNode]:
     if root.val < val:
       return TreeNode(val, root, None)
     curr = root
diff --git a/solutions/998. Maximum Binary Tree II/998.py b/solutions/998. Maximum Binary Tree II/998.py
index 3f3e6645fac..d4c46091fab 100644
--- a/solutions/998. Maximum Binary Tree II/998.py	
+++ b/solutions/998. Maximum Binary Tree II/998.py	
@@ -1,9 +1,5 @@
 class Solution:
-  def insertIntoMaxTree(
-      self,
-      root: TreeNode | None,
-      val: int,
-  ) -> TreeNode | None:
+  def insertIntoMaxTree(self, root: Optional[TreeNode], val: int) -> Optional[TreeNode]:
     if not root:
       return TreeNode(val)
     if root.val < val:
diff --git a/solutions/999. Available Captures for Rook/999.py b/solutions/999. Available Captures for Rook/999.py
index 491ab11d4ea..bcf0a4405fd 100644
--- a/solutions/999. Available Captures for Rook/999.py	
+++ b/solutions/999. Available Captures for Rook/999.py	
@@ -1,5 +1,5 @@
 class Solution:
-  def numRookCaptures(self, board: list[list[str]]) -> int:
+  def numRookCaptures(self, board: List[List[str]]) -> int:
     ans = 0
 
     for i in range(8):
