def countSmaller(self, nums):
        # preprocess the array to make it discrete in [0, 1, ..., n-1]
        h = {}
        for i, v in enumerate(sorted(nums)):
            h[v] = i  # override duplicates

        A = [h[v] for v in nums]
        n = len(A)
        st = SegmentTree(n)
        ret = []
        for i in xrange(n-1, -1, -1):
            ret.append(st.query_less(st.root, A[i]))
            st.inc(A[i], 1)

        return ret[::-1]
Returns a string with a formatted representation that might
dataset/ETHPy150Open algorhythms/LeetCode/315 Count of Smaller Numbers After Self.py/Solution.countSmaller--crossover with--dataset/ETHPy150Open javgh/greenaddress-pos-tools/nfc/ndef/handover.py/HandoverRequestMessage.pretty