Function that returns bitwise OR of segment [ L . . R ]
def query ( node , start , end , l , r ) : NEW_LINE INDENT if ( start > end or start > r or end < l ) : NEW_LINE INDENT return 0 ; NEW_LINE DEDENT if ( start >= l and end <= r ) : NEW_LINE INDENT return tree [ node ] ; NEW_LINE DEDENT mid = ( start + end ) >> 1 ; NEW_LINE q1 = query ( 2 * node , start , mid , l , r ) ; NEW_LINE q2 = query ( 2 * node + 1 , mid + 1 , end , l , r ) ; NEW_LINE return q1 | q2 ; NEW_LINE DEDENT