Python easy to read and understand | merge-intervals
```\nclass CountIntervals:\n\n    def init(self):\n        self.intervals = []\n\n    def add(self, left: int, right: int) -> None:\n        self.intervals.appe
```\nclass CountIntervals:\n\n    def __init__(self):\n        self.intervals = []\n\n    def add(self, left: int, right: int) -> None:\n        self.intervals.append([left, right])\n        self.intervals.sort(key = lambda x:x[0])\n        res = [self.intervals[0]]\n        for u, v in self.intervals[1:]:\n            if u <= res[-1][1]:\n                res[-1][1] = max(res[-1][1], v)\n            else:\n                res.append([u, v])\n        self.intervals = res.copy()\n\n    def count(self) -> int:\n        res = 0\n        for u, v in self.intervals:\n            res += (v-u+1)\n        return res\n\n\n# Your CountIntervals object will be instantiated and called as such:\n# obj = CountIntervals()\n# obj.add(left,right)\n# param_2 = obj.count()
['Python', 'Python3']