Short Interview friendly solution - Accepted
Intuition
Use SortedList to keep track of sorted elements in window whenever a new element is added.
Calculate the average in current window and return answer.
# Intuition
1. Use SortedList to keep track of sorted elements in window whenever a new element is added.
2. Calculate the average in current window and return answer.

# Complexity
- Time complexity: O(log m)

- Space complexity: O(m)

# Code
```python3 []
class MKAverage:

    def __init__(self, m: int, k: int):
        self.m = m
        self.k = k
        self.window = deque()
        self.sorted_list = SortedList()

    def addElement(self, num: int) -> None:
        self.window.append(num)
        self.sorted_list.add(num)

        if len(self.window) > self.m:
            old = self.window.popleft()
            self.sorted_list.remove(old)

    def calculateMKAverage(self) -> int:
        n = len(self.window)
        if n < self.m:
            return -1

        # remove k smallest and k largest
        arr = self.sorted_list[self.k : -self.k]

        return sum(arr) // len(arr)
        


# Your MKAverage object will be instantiated and called as such:
# obj = MKAverage(m, k)
# obj.addElement(num)
# param_2 = obj.calculateMKAverage()
```
['Python3']