bit update function which updates values from index " idx " to last by value " val "
def update ( idx , val ) : NEW_LINE INDENT global bit NEW_LINE if idx == 0 : NEW_LINE INDENT return NEW_LINE DEDENT while idx <= n : NEW_LINE INDENT bit [ idx ] += val NEW_LINE idx += ( idx & - idx ) NEW_LINE DEDENT DEDENT