Lazy Delete Method, Very Easy using PQ & Map
Explanation:
Data Structures:

map: A HashMap that stores task information where the key is taskId and the value is an array containing userId and priority.
pq:
# Explanation:
1. Data Structures:

- map: A HashMap that stores task information where the key is taskId and the value is an array containing userId and priority.
- pq: A PriorityQueue that manages tasks based on their priority and taskId. It sorts tasks by priority (higher priority first). If priorities are equal, it sorts by taskId (higher taskId first).

2. Constructor (TaskManager):

- Initializes the map and pq.
- Takes a list of tasks and adds each one to the task manager using the add method.

3. add Method:

- Adds a task to the map and pq.
- Parameters: userId, taskId, and priority.

4. edit Method:

- Edits the priority of an existing task.
- Retrieves the task from the map, removes it, and re-adds it with the new priority.

5. rmv Method:

- Removes a task from the map.

`Note: The task remains in the pq, but it will be ignored during execution.`


6. execTop Method:

- Executes the task with the highest priority.
- Continuously polls the pq to get the task with the highest priority.
- Skips tasks that no longer exist in the map or have outdated priorities.
- Returns the userId of the executed task or -1 if no tasks are available.

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
```
O(nlogn)
```

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
```
O(n)
```

# Code
```java []
import java.util.*;

class TaskManager {

    // A map to store task information. Key is taskId, value is an array containing userId and priority.
    Map<Integer, int[]> map; // taskId => [userId, priority]

    // A priority queue to manage tasks based on priority and taskId.
    PriorityQueue<int[]> pq; // [userId, taskId, priority]

    // Constructor to initialize the task manager with a list of tasks.
    public TaskManager(List<List<Integer>> tasks) {
        map = new HashMap<>();
        pq = new PriorityQueue<>((a, b) -> {
            // Custom comparator to sort tasks by priority (higher priority first).
            // If priorities are equal, sort by taskId (higher taskId first).
            if (a[2] == b[2]) return Integer.compare(b[1], a[1]);
            else return Integer.compare(b[2], a[2]);
        });

        // Add each task from the input list to the task manager.
        for (List<Integer> list : tasks) {
            add(list.get(0), list.get(1), list.get(2));
        }
    }

    // Method to add a new task.
    public void add(int userId, int taskId, int priority) {
        // Store task information in the map.
        map.put(taskId, new int[]{userId, priority});
        // Add task to the priority queue.
        pq.add(new int[]{userId, taskId, priority});
    }

    // Method to edit the priority of an existing task.
    public void edit(int taskId, int newPriority) {
        // Get the current task information from the map.
        int[] task = map.get(taskId);
        // Remove the task from the map (it will be re-added with the new priority).
        rmv(taskId);
        // Add the task with the new priority.
        add(task[0], taskId, newPriority);
    }

    // Method to remove a task.
    public void rmv(int taskId) {
        // Remove the task from the map.
        map.remove(taskId);
        // Note: The task remains in the priority queue, but it will be ignored during execution.
    }

    // Method to execute the task with the highest priority.
    public int execTop() {
        // If there are no tasks, return -1.
        if (map.isEmpty()) return -1;

        // Process tasks in the priority queue.
        while (!pq.isEmpty()) {
            // Get the task with the highest priority.
            int[] task = pq.poll();
            // If the task no longer exists in the map, skip it.
            if (!map.containsKey(task[1])) continue;
            // Get the current task information from the map.
            int[] currentTask = map.get(task[1]);
            // If the priority in the map does not match the priority in the queue, skip it.
            if (task[2] != currentTask[1]) continue;
            // Remove the task from the map and return the userId.
            map.remove(task[1]);
            return currentTask[0];
        }

        // If no tasks were executed, return -1.
        return -1;
    }
}

/**
 * Your TaskManager object will be instantiated and called as such:
 * TaskManager obj = new TaskManager(tasks);
 * obj.add(userId,taskId,priority);
 * obj.edit(taskId,newPriority);
 * obj.rmv(taskId);
 * int param_4 = obj.execTop();
 */
```
['Ordered Map', 'Heap (Priority Queue)', 'Java']