Simple Unordered Map C++
Code

# Code
```cpp []
class Solution {
public:
    vector<int> getIDs(string s){ // string id
        vector<int> res;
        int i=0;
        int n = s.length();
        string tmp;
        while(i < n){
            if(s[i] == ' ') {
            
                res.push_back(stoi(tmp));
               
                tmp = "";
                i++;
                continue;
            }
            if(s[i] == 'i' || s[i] == 'd' ){
                i++;
                continue;
            }
            
            tmp += s[i];
            i++;
        }
        if(tmp != ""){
            res.push_back(stoi(tmp));
        }

        return res;


    }
    void here(vector<string> &event, unordered_map<int,pair<bool,pair<int, int>>> &mp){
        
        int timestamp = stoi(event[1]);
        for(auto &user : mp){
            // here we should check 60s condition
            if(user.second.first){
                user.second.second.first = timestamp;
                user.second.second.second++; // incr count
            }else if(timestamp - user.second.second.first >= 60){ 
                user.second.first = true;
                user.second.second.first = timestamp;
                user.second.second.second++; // incr count
            }

        }
    }
    void all(vector<string> &event, unordered_map<int,pair<bool,pair<int, int>>> &mp){
              
        int timestamp = stoi(event[1]);

        for(auto &user : mp){
            user.second.second.second++; // incr count
        }
    }
    void mention(vector<string> &event, unordered_map<int,pair<bool,pair<int, int>>> &mp){
        auto ans = getIDs(event[2]);
      
        for(auto userID : ans){
            mp[userID].second.second++;
        }
    }
    void offline(vector<string> &event, unordered_map<int,pair<bool,pair<int, int>>>&mp){
      
        int id = stoi(event[2]);
        int timestamp = stoi(event[1]);
        mp[id].first = false;
        mp[id].second.first = timestamp;
    }
    
    vector<int> countMentions(int numberOfUsers, vector<vector<string>>& events) {



        sort(events.begin(), events.end(), [](vector<string> &a, vector<string> &b) {
            int aa = stoi(a[1]);
            int bb = stoi(b[1]);
            if(aa == bb){
                if(a[0] == "OFFLINE"){
                    return true;
                }else{
                    return false;
                }
            }
            return aa < bb;
        });        

        unordered_map<int,pair<bool,pair<int, int>>> mp; // userID => {bool, [time, count]}
        vector<int> res(numberOfUsers);

        for(int i=0; i < numberOfUsers; i++){
            mp[i] = {true, {0,0}};
        }

        for(auto event : events){
            string etype = event[0];
            if(etype == "OFFLINE"){
                offline(event, mp);
            }else if(etype == "MESSAGE"){
                if(event[2] == "ALL"){
                    all(event, mp);
                }else if(event[2] == "HERE"){
                    here(event, mp);
                }else{
                    mention(event, mp);
          
                }
            }
        }

      
        for(int i=0; i < numberOfUsers; i++){
            res[i] = mp[i].second.second;
          
        }

        return res;
    }
};
```
['C++']