python3 sortedlist + line sweep + hashtable
Code\n\nfrom sortedcontainers import SortedList\nclass Solution:\n    def busiestServers(self, k: int, arrival: List[int], load: List[int]) -> List[int]:\n     
# Code\n```\nfrom sortedcontainers import SortedList\nclass Solution:\n    def busiestServers(self, k: int, arrival: List[int], load: List[int]) -> List[int]:\n        handles = {i:0 for i in range(k)}\n        sweeps = []\n        for i,(a,l) in enumerate(zip(arrival,load)):\n            sweeps.append((a,1,i))\n            sweeps.append((a+l,-1,i)) # mark the starts and ends of tasks with an event in the sweeping list, where -1 denotes ends and 1 denotes start, so that ends comes before starts at the same timestamp to allow for new incomers to fill the gap just vacuated\n\n        sweeps.sort()\n        dropped = set([])\n        availible = SortedList([i for i in range(k)])\n        distributed = {}\n        for time,event,index in sweeps: # sweep the line\n            if event == 1 and len(availible)==0: # this is the case where there is no availible server\n                dropped.add(index)\n            if index in dropped: # when a task that did not even come into processing comes to its end, we ignore\n                continue\n            if event == -1: # when a task finishes we release the server\n                availible.add(distributed[index])\n            else: # find the availible server when there is one\n                ideal = index % k\n                actual = availible.bisect_right(ideal)\n                if (actual == 0 and availible[0] == ideal):\n                    actual = 0 # corner cases, when the desired server is 0 and avalible\n                if (actual > 0 and availible[actual-1] == ideal):\n                    actual -= 1 # when a desired server other than 0 is availible \n                if actual == len(availible):\n                    actual = 0 # when there is no server availible after the desired one, we go to the start of the list\n \n                handles[availible[actual]] += 1\n                distributed[index] = availible[actual]\n                availible.remove(availible[actual]) # remove the server selected from availible list\n        res = []\n        maxhandled = max(handles.values())\n        return [i for i in range(k) if handles[i] == maxhandled]\n\n\n\n\n        \n```
['Hash Table', 'Line Sweep', 'Ordered Set', 'Python3']