Priority Queue || Hashing || Super Simple || C++
Code
# Code
```cpp []
class TaskManager 
{
public:
    priority_queue<vector<int>> ptu;
    set<int> tasks;
    map<int,int> taskPriority, taskUser;
    TaskManager(vector<vector<int>>& t) 
    {
        for(auto task: t)
        {
            ptu.push({task[2],task[1],task[0]});
            tasks.insert(task[1]);
            taskPriority[task[1]]=task[2];
            taskUser[task[1]]=task[0];
        }
    }
    
    void add(int userId, int taskId, int priority) 
    {
        ptu.push({priority,taskId,userId});
        tasks.insert(taskId);
        taskPriority[taskId]=priority;
        taskUser[taskId]=userId;
    }
    
    void edit(int taskId, int newPriority) 
    {
        int userId=taskUser[taskId];
        taskPriority[taskId]=newPriority;
        ptu.push({newPriority,taskId,userId});
    }
    
    void rmv(int taskId) 
    {
        tasks.erase(taskId);
        taskPriority.erase(taskId);
        taskUser.erase(taskId);
    }
    
    int execTop() 
    {
        while(!ptu.empty())
        {
            auto v=ptu.top();
            int priority=v[0];
            int taskId=v[1];
            int userId=v[2];
            ptu.pop();
            if(tasks.find(taskId)!=tasks.end() && taskPriority[taskId]==priority)
            {
                rmv(taskId);
                return userId;
            }
        }
        return -1;
    }
};
```
['Hash Table', 'Heap (Priority Queue)', 'C++']