Python || Heaps || Simple Solution
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

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


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

# Code
```python3 []
class TaskManager:

    def __init__(self, tasks: List[List[int]]):
        self.task = {}
        self.h = []
        self.user = {}
        for i in tasks:
            [u, t, p] = i
            self.task[t] = p
            self.user[t] = u
            self.h.append((-p, -t, u))
        heapify(self.h)
        

    def add(self, userId: int, taskId: int, priority: int) -> None:
        heappush(self.h, (-priority, -taskId, userId))
        self.user[taskId] = userId
        self.task[taskId] = priority
        

    def edit(self, taskId: int, newPriority: int) -> None:
        if self.task[taskId] != newPriority:
            heappush(self.h, (-newPriority, -taskId, self.user[taskId]))
        self.task[taskId] = newPriority
        

    def rmv(self, taskId: int) -> None:
        del self.task[taskId]
        del self.user[taskId]
        

    def execTop(self) -> int:
        while self.h and (-self.h[0][1] not in self.task or self.task[-self.h[0][1]] != -self.h[0][0]):
            heappop(self.h)
        if not self.h:
            return -1
        (p, t, u) = heappop(self.h)
        del self.task[-t]
        del self.user[-t]
        return u
        
        


# Your TaskManager object will be instantiated and called as such:
# obj = TaskManager(tasks)
# obj.add(userId,taskId,priority)
# obj.edit(taskId,newPriority)
# obj.rmv(taskId)
# param_4 = obj.execTop()
```
['Hash Table', 'Design', 'Heap (Priority Queue)', 'Python3']