Replace the bits of the value at arr [ queries [ p ] [ 0 ] ] with the bits of queries [ p ] [ 1 ]
for i in range ( 0 , 32 ) : NEW_LINE INDENT if ( ( 1 << i ) & arr [ queries [ p ] [ 0 ] ] ) : NEW_LINE INDENT bits [ i ] -= 1 NEW_LINE DEDENT if ( queries [ p ] [ 1 ] & ( 1 << i ) ) : NEW_LINE INDENT bits [ i ] += 1 NEW_LINE DEDENT DEDENT