C++ simple solution!!
Code


# Code
```cpp []
class Solution {
public:
    vector<int> countMentions(int num, vector<vector<string>>& e) {
        int n = e.size();
        vector<int> m(num, 0);
        vector<vector<int>> offline(num, vector<int>(1, -61)); 

        
        for (int i = 0; i < n; i++) {
            string curr = e[i][0];
            int time = stoi(e[i][1]);
            string type = e[i][2];

            if (curr == "OFFLINE") {
                int user = stoi(type);
                offline[user].push_back(time);
            }
        }

        
        for (int i = 0; i < n; i++) {
            string curr = e[i][0];
            int time = stoi(e[i][1]);
            string type = e[i][2];

            if (curr == "MESSAGE") {
                if (type == "ALL") {
                   
                    for (int j = 0; j < num; j++) {
                        m[j]++;
                    }
                } else if (type == "HERE") {
                   
                    for (int j = 0; j < num; j++) {
                        bool isOnline = true;
                        for (int k = 0; k < offline[j].size(); k++) {
                            if (offline[j][k] <= time && (offline[j][k] + 59) >= time) {
                                isOnline = false;
                                break; 
                            }
                        }
                        if (isOnline) {
                            m[j]++;
                        }
                    }
                } else {
                   
                    int number = 0;
                    bool inNumber = false;

                    for (char c : type) {
                        if (isdigit(c)) {
                            inNumber = true;
                            number = number * 10 + (c - '0');
                        } else {
                            if (inNumber) {
                                if (number >= 0 && number < num) {
                                    m[number]++;
                                }
                                number = 0;
                                inNumber = false;
                            }
                        }
                    }

                   
                    if (inNumber && number >= 0 && number < num) {
                        m[number]++;
                    }
                }
            }
        }

        return m;
    }
};

```
['C++']