[Python3] SortedList
Please pull this commit for solutions of weekly 293. \n\n\nfrom sortedcontainers import SortedList\n\nclass CountIntervals:\n\n    def __init__(self):\n        
Please pull this [commit](https://github.com/gaosanyong/leetcode/commit/5edf72d3865cd9791f0a89b968c0c1aeeaa381c3) for solutions of weekly 293. \n\n```\nfrom sortedcontainers import SortedList\n\nclass CountIntervals:\n\n    def __init__(self):\n        self.cnt = 0 \n        self.intervals = SortedList()\n\n    def add(self, left: int, right: int) -> None:\n        k = self.intervals.bisect_left((left, right))\n        while k < len(self.intervals) and self.intervals[k][0] <= right: \n            l, r = self.intervals.pop(k)\n            self.cnt -= r - l + 1\n            right = max(right, r)\n        if k and left <= self.intervals[k-1][1]: \n            l, r = self.intervals.pop(k-1)\n            self.cnt -= r - l + 1\n            left = l\n            right = max(right, r)\n        self.cnt += right - left + 1\n        self.intervals.add((left, right))\n\n    def count(self) -> int:\n        return self.cnt\n```
['Python3']