using priority queue and tree set
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
```scala []
import scala.collection.mutable
object Solution {
    def busiestServers(k: Int, arrival: Array[Int], load: Array[Int]): List[Int] = {
        val servers=Array.fill(k)(0)
        val available=mutable.TreeSet[Int]()
        (0 until k).foreach(available.addOne)
        val occupied=new mutable.PriorityQueue[(Int,Int)]()(Ordering.by[(Int,Int),Int](-_._1).orElseBy(-_._2))
        arrival.indices.foreach{i=>
        val startTime=arrival(i)
        while(occupied.nonEmpty && occupied.head._1<=startTime){
            available.addOne(occupied.dequeue._2)
        }

        if(available.nonEmpty){
            val endTime=startTime+load(i)
            val idxToInsert=if(available.contains(i%k)) i%k 
            else if(available.minAfter(i%k).isDefined) available.minAfter(i%k).get
            else available.head
            occupied.addOne((endTime,idxToInsert))
            available.remove(idxToInsert)
            servers(idxToInsert) += 1
        } 
        }
        
        val max=servers.max
        println(s"Servers ${servers.mkString(",")}")
        servers.indices.filter(idx=> servers(idx)==max).toList
    }
}
```
['Scala']