sortedcontainers: The Balanced Tree Python Was Missing
A sorted list, a sorted set, and a sorted dict - with O(log n) insert, delete, k-th element, and count queries. Python’s standard library gives you a hash map (dict), a hash set (set), a binary heap