Priority_queue + Set | C++ | Beats 99%
Intuition\nWe need to track the servers that handle the most number of requests, given the arrival times and load times for each request. The core challenge is 
# Intuition\nWe need to track the servers that handle the most number of requests, given the arrival times and load times for each request. The core challenge is to manage server availability and efficiently assign requests to servers.\n\n# Approach\n1. **Initialization**:\n   - Use a priority queue to keep track of busy servers with their respective end times.\n   - Use a set to track free servers.\n\n2. **Processing Requests**:\n   - For each request, free up servers that have completed their tasks before the current request arrives.\n   - Assign the request to the most suitable free server. Use modular arithmetic to find the next available server.\n   - Update the server\'s end time and keep track of how many requests each server has processed.\n\n3. **Finding the Busiest Servers**:\n   - After processing all requests, find the servers with the maximum load and return their indices.\n\n# Complexity\n- **Time Complexity**: $$O(n \\log k)$$ due to priority queue operations and set manipulations.\n- **Space Complexity**: $$O(k + n)$$ to store server loads, busy servers, and free servers.\n\n# Code \n```cpp \n\nint init = [](){\n    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);\n    return -1;\n}();\n\nclass Solution {\npublic:\n    vector<int> busiestServers(int k, vector<int>& arrival, vector<int>& load) {\n        int n = arrival.size();\n        vector<int> serverLoad(k, 0), ans;\n        priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> busyServers; // min-heap for busy servers\n        set<int> freeServers;\n\n        // Initialize all servers as free\n        for (int i = 0; i < k; ++i) freeServers.insert(i);\n\n        // Process each request\n        for (int i = 0; i < n; ++i) {\n            int currentTime = arrival[i];\n\n            // Free up servers that have completed their tasks by current time\n            while (!busyServers.empty() && busyServers.top().first <= currentTime) {\n                freeServers.insert(busyServers.top().second);\n                busyServers.pop();\n            }\n\n            if (freeServers.empty()) continue; // No servers available\n\n            // Find the server to handle the current request\n            auto it = freeServers.lower_bound(i % k);\n            if (it == freeServers.end()) it = freeServers.begin();\n            int serverIndex = *it;\n\n            // Update server status\n            freeServers.erase(it);\n            serverLoad[serverIndex]++;\n            busyServers.emplace(currentTime + load[i], serverIndex);\n        }\n\n        // Find the maximum load and the corresponding servers\n        int maxLoad = *max_element(serverLoad.begin(), serverLoad.end());\n        for (int i = 0; i < k; ++i) if (serverLoad[i] == maxLoad) ans.push_back(i);\n\n        return ans;\n    }\n};\n```
['Array', 'Greedy', 'Heap (Priority Queue)', 'Ordered Set', 'C++']