Detailed Java Solution using PriorityQueue and TreeSet
IntuitionIf we store all the busy servers in a priorityQueue with the comparator which specifies that the server whose finish time is lowest must be at the top,
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
If we store all the busy servers in a priorityQueue with the comparator which specifies that the server whose finish time is lowest must be at the top, and if the lowest time of 2 servers are same, we take the server with smallest index first.
This way, when a request comes, with an arrival time x, we will fetch all the servers from the queue, whose finish time is <= x. And will add all the servers in a set, and for finding the correct server from these servers, we will find the ceiling value of (i%k) in the set. After this again add this server in the busy server queue. Meanwhile, also increase this server's request processed by 1.
At last, we will find all those servers, who have the max request processed.

# Approach
<!-- Describe your approach to solving the problem. -->
Implement a PriorityQueue, with this comparator :
```
// item inside the queue -> (index, nextFreeTime)
PriorityQueue <int[]> busyServers = new PriorityQueue <>((a, b) -> {
    if (a[1] != b[1]) {
        return a[1] - b[1];
    }
    return a[0] - b[0];
});
```
Implement a TreeSet for keeping the available servers.

Initialize the busy servers queue with the first k requests.
Then for each next request, fetch all the servers from queue, whose nextFreeTime <= current request's arrival time, now add all these server's index into the set. Now, fetch the correct server from the set, by finding the ceil value of (i%k) and now add this server into the queue again.
Also, increase this server's request processed by 1.
At last find all the servers whose total request processed is max


# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
O(NlogK)

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
O(K)

# Code
```java []

class Solution {
    public List<Integer> busiestServers(int k, int[] arrival, int[] load) {
        // (index, nextFreeTime)
        PriorityQueue <int[]> busyServers = new PriorityQueue <>((a, b) -> {
            if (a[1] != b[1]) {
                return a[1] - b[1];
            }
            return a[0] - b[0];
        });
        int max = 1;
        int requestProcessed[] = new int[k];
        for (int i = 0; i < Math.min(k, arrival.length); i++) {
            requestProcessed[i] = 1;
            busyServers.add(new int[]{i, arrival[i] + load[i]});
        }
        TreeSet <Integer> available = new TreeSet <>();
        for (int i = k; i < arrival.length; i++) {
            int arrivalTime = arrival[i];
            while (!busyServers.isEmpty() && busyServers.peek()[1] <= arrivalTime) {
                available.add(busyServers.poll()[0]);
            }
            int serverRequired = i % k;
            if (available.size() == 0) {
                continue;
            }
            int serverGot;
            if (available.ceiling(serverRequired) != null) {
                serverGot = available.ceiling(serverRequired);
            } else {
                serverGot = available.pollFirst();
            }
            available.remove(serverGot);
            requestProcessed[serverGot] ++;
            max = Math.max(max, requestProcessed[serverGot]);
            busyServers.add(new int[]{serverGot, arrivalTime + load[i]});
        }
        List <Integer> res = new LinkedList<>();
        for (int i = 0; i < k; i++) {
            if (requestProcessed[i] == max) {
                res.add(i);
            }
        }
        return res;
    }
}
```
['Java']