
    d?                     l    d Z d	dddZd	dddZd	dddZd	dddZ	 ddlT n# e$ r Y nw xY weZeZdS )
zBisection algorithms.    Nkeyc                    |t          | |||          }nt          |  ||          |||          }|                     ||           dS )zInsert item x in list a, and keep it sorted assuming a is sorted.

    If x is already in a, insert it to the right of the rightmost x.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    Nr   )bisect_rightinsertaxlohir   s          /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.11/bisect.pyinsort_rightr      sS     {!QB''!SSVVR555HHROOOOO    c                
   |dk     rt          d          |t          |           }|)||k     r"||z   dz  }|| |         k     r|}n|dz   }||k     "n1||k     r+||z   dz  }| || |                   k     r|}n|dz   }||k     +|S )a  Return the index where to insert item x in list a, assuming a is sorted.

    The return value i is such that all e in a[:i] have e <= x, and all e in
    a[i:] have e > x.  So if x already appears in the list, a.insert(i, x) will
    insert just after the rightmost x already there.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    r   lo must be non-negativeN      
ValueErrorlenr	   r
   r   r   r   mids         r   r   r      s     
Avv2333	zVV {2gg7q.C1S6zz1W 2gg 2gg7q.C33qv;;1W 2gg Ir   c                    |t          | |||          }nt          |  ||          |||          }|                     ||           dS )zInsert item x in list a, and keep it sorted assuming a is sorted.

    If x is already in a, insert it to the left of the leftmost x.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    Nr   )bisect_leftr   r   s        r   insort_leftr   5   sS     {Ar2&&CCFFB444HHROOOOOr   c                
   |dk     rt          d          |t          |           }|)||k     r"||z   dz  }| |         |k     r|dz   }n|}||k     "n1||k     r+||z   dz  } || |                   |k     r|dz   }n|}||k     +|S )a  Return the index where to insert item x in list a, assuming a is sorted.

    The return value i is such that all e in a[:i] have e < x, and all e in
    a[i:] have e >= x.  So if x already appears in the list, a.insert(i, x) will
    insert just before the leftmost x already there.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    r   r   Nr   r   r   r   s         r   r   r   D   s     
Avv2333	zVV {2gg7q.Cvzz1W 2gg 2gg7q.Cs1S6{{Q1W 2gg Ir   )*)r   N)	__doc__r   r   r   r   _bisectImportErrorbisectinsort r   r   <module>r$      s     T     T     DD     D     F	 	 	 	D	 
	s   % --