Leetcode: 2102. Sequentially Ordinal Rank Tracker

Problem Statement

from sortedcontainers import SortedList


class SORTracker:
    def __init__(self):
        self.loc = SortedList()
        self.q = 0

    def add(self, name: str, score: int) -> None:
        self.loc.add((-score, name))

    def get(self) -> str:
        ans = self.loc[self.q][1]
        self.q += 1
        return ans


# Your SORTracker object will be instantiated and called as such:
# obj = SORTracker()
# obj.add(name,score)
# param_2 = obj.get()