[Python]The most standard template for Binary Search
\nclass Solution:\n    def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int:\n        \n\t\t# 3 types to write out standard binary search, that is, 
```\nclass Solution:\n    def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int:\n        \n\t\t# 3 types to write out standard binary search, that is, bisect_left, bisect, and (value + 1) - 1 (take the behind index) \n\t\t# All can be written out in details\n\t\t# This is for bisect_left\n        def binary_search(target):\n       \n            left = 0\n            right = m - 1\n\n            while left + 1 < right:\n\n                mid = left + (right - left) // 2\n\t\t\t\t\n\t\t\t\t# difference will happen here if it is bisect, not bisect_left\n                if S[mid] < target:\n                    left = mid + 1\n                else:\n                    right = mid\n\t\t\t\t\t\n\t\t\t# difference will happen here if it is bisect, not bisect_left\n            if target <= S[left]:\n                return left            \n            elif S[left] < target <= S[right]:\n                return right            \n            else:\n                return right + 1\n        \n        rides = sorted(rides)\n        \n        # S = [1, 3, 10, 11, 12, 13]\n        S = [i[0] for i in rides]\n        \n        # m = 6\n        m = len(rides)\n        \n        # dp = [0, 0, 0, 0, 0, 0, 0]\n        dp = [0] * (m + 1)\n        \n        for k in range(m-1, -1, -1):\n            \n            idx = binary_search(rides[k][1])\n            \n            dp[k] = max(dp[k+1], rides[k][1] - rides[k][0] + rides[k][2] + dp[idx])\n        \n\t\t# dp = [20, 20, 11, 9, 6, 6, 0]\n        return dp[0]\n```
['Binary Tree', 'Python']