Python solution, beats 99% custom sort, heap
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
```python3 []
class Solution:
    def countMentions(self, numberOfUsers: int, events: List[List[str]]) -> List[int]:
        mentions_map = defaultdict(int)
        all_mentions_cnt = 0
        here_mentions_cnt = 0
        offline_cnt = defaultdict(int)
        offline_heap = []
        
        sorted_events = sorted(events, key=lambda x: (int(x[1]), x[0] != "OFFLINE"))
        
        for m, t, s in sorted_events:
            if m == 'MESSAGE':
                if s == 'HERE':
                    here_mentions_cnt += 1
                    while offline_heap and int(t) - 60 >= offline_heap[0][0]:
                        heapq.heappop(offline_heap)
                    for t, u in offline_heap:
                        offline_cnt[u] += 1 
                    
                elif s == 'ALL':
                    all_mentions_cnt += 1
                else:
                    for u_id in s.split(" "):
                        mentions_map[u_id[2:]] += 1
            elif m == 'OFFLINE':
                heapq.heappush(offline_heap, (int(t), s))
                
        result = [0] * numberOfUsers
        
        for i in range(len(result)):
            result[i] += (mentions_map[str(i)] + all_mentions_cnt + here_mentions_cnt - offline_cnt[str(i)])
        
        return result
                
                
        
```
['Heap (Priority Queue)', 'Python3']