def add(self, val):
        """Add the element *val* to the list."""
        _maxes, _lists = self._maxes, self._lists

        if _maxes:
            pos = bisect_right(_maxes, val)

            if pos == len(_maxes):
                pos -= 1
                _maxes[pos] = val
                _lists[pos].append(val)
            else:
                insort(_lists[pos], val)

            self._expand(pos)
        else:
            _maxes.append(val)
            _lists.append([val])

        self._len += 1
def add ( self , val ) : _maxes , _lists = self . _maxes , self . _lists if _maxes : pos = bisect_right ( _maxes , val ) if pos == len ( _maxes ) : pos -= 1 _maxes [ pos ] = val _lists [ pos ] . append ( val ) else : insort ( _lists [ pos ] , val ) self . _expand ( pos ) else : _maxes . append ( val ) _lists . append ( [ val ] ) self . _len += 1
Add the element *val* to the list.