Simple C++ using Priority Queue and Unordered Map
tu maps task and user and tp maps task and priorityCode
tu maps task and user and tp maps task and priority
# Code
```cpp []
class TaskManager {
public:
    unordered_map<int, int> tp, tu;
    priority_queue<pair<int, int>> pq;

    TaskManager(vector<vector<int>>& tasks) {
        for (auto &t : tasks) {
            pq.push({t[2], t[1]});
            tp[t[1]] = t[2];
            tu[t[1]] = t[0];
        }
    }
   
    void add(int u, int t, int p) {
        tu[t] = u;
        tp[t] = p;
        pq.push({p, t});
    }
    
    void edit(int t, int p) {
        tp[t] = p;
        pq.push({p, t});        
    }
    
    void rmv(int t) {
        tu.erase(t);
        tp.erase(t);
    }
    
    int execTop() {
        while (!pq.empty()) { 
            int t = pq.top().second;
            int p = pq.top().first;
            pq.pop();
            if (tp.find(t) == tp.end() || tp[t] != p) 
                continue;
            tp.erase(t);
            int ans = tu[t];
            tu.erase(t);
            return ans;
        }
        return -1;
    }
};

```
['C++']