Set || Priority Queue || Greedy || C++
\n# Code\n\nclass Solution {\npublic:\n    vector<int> busiestServers(int k, vector<int>& arrival, vector<int>& load) {\n        priority_queue<pair<int,int>,ve
\n# Code\n```\nclass Solution {\npublic:\n    vector<int> busiestServers(int k, vector<int>& arrival, vector<int>& load) {\n        priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>q;\n        set<int>s;\n        vector<int>server(k,0);\n        for(int i=0;i<k;i++) s.insert(i);\n        for(int i=0;i<arrival.size();i++){\n            while(!q.empty() and q.top().first<=arrival[i]){\n                s.insert(q.top().second);\n                q.pop();\n            }\n            int x=i%k;\n            if(s.size()==0) continue;\n            auto y=s.lower_bound(x);\n            if(y==s.end()) y=s.lower_bound(0);\n            q.push({arrival[i]+load[i],*y});\n            server[*y]++;\n            s.erase(y);\n        }\n        int maxi=*max_element(server.begin(),server.end());\n        vector<int>res;\n        for(int i=0;i<k;i++){\n            if(server[i]==maxi) res.push_back(i);\n        }\n        return res;\n    }\n};\n```
['Greedy', 'Heap (Priority Queue)', 'Ordered Set', 'C++']