Check if current shop can be assigned to a person who 's  already visiting any other shop
flag = False NEW_LINE if ( len ( st ) == 0 ) : NEW_LINE INDENT ar = list ( st . keys ( ) ) NEW_LINE it = bisect_left ( ar , a [ i ] [ 0 ] ) NEW_LINE if ( it != 0 ) : NEW_LINE INDENT it -= 1 NEW_LINE DEDENT DEDENT