Function which builds the segment tree
def build ( arr , node , start , end ) : NEW_LINE INDENT if ( start == end ) : NEW_LINE INDENT tree [ node ] = arr [ start ] ; NEW_LINE return ; NEW_LINE DEDENT mid = ( start + end ) >> 1 ; NEW_LINE build ( arr , 2 * node , start , mid ) ; NEW_LINE build ( arr , 2 * node + 1 , mid + 1 , end ) ; NEW_LINE tree [ node ] = tree [ 2 * node ] | tree [ 2 * node + 1 ] ; NEW_LINE DEDENT