function for calculating the required sum between two indexes
def summ ( x ) : NEW_LINE INDENT global BIT NEW_LINE s = 0 NEW_LINE while x > 0 : NEW_LINE INDENT s += BIT [ x ] NEW_LINE x -= x & - x NEW_LINE DEDENT return s NEW_LINE DEDENT