Easy | C++| Map 
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
```cpp []
class TaskManager {
public:
    map<int,map<int,int>>store;
    unordered_map<int,int>mapping;
    TaskManager(vector<vector<int>>& tasks) {
        mapping.clear();
        store.clear();
        for(int i=0;i<tasks.size();i++){
            store[tasks[i][2]][tasks[i][1]] = tasks[i][0];
            mapping[tasks[i][1]] = tasks[i][2];
        }
    }
    
    void add(int userId, int taskId, int priority) {
        store[priority][taskId]=userId;
        mapping[taskId] = priority;
    }
    
    void edit(int taskId, int newPriority) {
        int currPriority = mapping[taskId];
        int userId = store[currPriority][taskId];
        store[currPriority].erase(taskId);
        if(store[currPriority].size()==0){
            store.erase(currPriority);
        }
        store[newPriority][taskId]=userId;
        mapping[taskId] = newPriority;
    }
    
    void rmv(int taskId) {
        int currPriority = mapping[taskId];
        store[currPriority].erase(taskId);
         if(store[currPriority].size()==0){
            store.erase(currPriority);
        }
        mapping.erase(taskId);
    }
    
    int execTop() {
        if(store.size()==0)
            return -1;
        
        int taskId = store.rbegin()->second.rbegin()->first;
        int userId = store.rbegin()->second.rbegin()->second;
        rmv(taskId);
        return userId;
    }
};

/**
 * 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();
 */
```
['C++']