short python with bisect
```\nclass Solution:\n    def fallingSquares(self, positions):\n        g ,MAX, ans= [(0,0),(1e9,0)], 0, []\n        for i,side in positions:\n            l = b
```\nclass Solution:\n    def fallingSquares(self, positions):\n        g ,MAX, ans= [(0,0),(1e9,0)], 0, []\n        for i,side in positions:\n            l = bisect.bisect(g,(i,0)) \n            r = bisect.bisect_left(g,(i+side,0)) \n            curr = max(g[k][1] for k in range(l-1,r))+side\n            MAX = max(MAX,curr) \n            ans += MAX, \n            g[l:r] = [(i,curr),(i+side,g[r-1][1])] \n        return ans\n
[]