"""simple docstring"""


class  a__     :






   class  a__     :
      snake_case_				=   "_prev", "_data", "_next"


      def __init__(  self,					_UpperCAmelCase,					_UpperCAmelCase,					_UpperCAmelCase	):
           '''simple docstring'''



           lowercase__								=				link_p
           lowercase__								=				element
           lowercase__								=				link_n


      def 						snake_case__						(  self	):
           '''simple docstring'''



           return (
               F''' Prev -> {self._prev is not None}, Next -> {self._next is not None}'''
           )



   def __init__(  self	):
        '''simple docstring'''



        lowercase__								=				self._Node(_UpperCAmelCase,					_UpperCAmelCase,					_UpperCAmelCase	)
        lowercase__								=				self._Node(_UpperCAmelCase,					_UpperCAmelCase,					_UpperCAmelCase	)
        lowercase__								=				self._trailer
        lowercase__								=				self._header
        lowercase__								=				0


   def __len__(  self	):
        '''simple docstring'''



        return self._size


   def 						snake_case__						(  self	):
        '''simple docstring'''



        return self.__len__() == 0


   def 						snake_case__						(  self,					_UpperCAmelCase,					_UpperCAmelCase,					_UpperCAmelCase	):
        '''simple docstring'''



        lowercase__								=				self._Node(_UpperCAmelCase,					_UpperCAmelCase,					_UpperCAmelCase	)
        lowercase__								=				new_node
        lowercase__								=				new_node
        self._size += 1
        return self


   def 						snake_case__						(  self,					_UpperCAmelCase	):
        '''simple docstring'''



        lowercase__								=				node._prev
        lowercase__								=				node._next

        lowercase__								=				successor
        lowercase__								=				predecessor
        self._size -= 1
        lowercase__								=				node._data
        lowercase__								=				lowercase__								=				lowercase__								=				None
        del node
        return temp






class  a__     ( _DoublyLinkedBase						):


   def 						snake_case__						(  self	):
        '''simple docstring'''



        if self.is_empty():
             raise Exception("List is empty"	)
        return self._header._next._data


   def 						snake_case__						(  self	):
        '''simple docstring'''



        if self.is_empty():
             raise Exception("List is empty"	)
        return self._trailer._prev._data


   def 						snake_case__						(  self,					_UpperCAmelCase	):
        '''simple docstring'''



        return self._insert(self._header,					_UpperCAmelCase,					self._header._next	)


   def 						snake_case__						(  self,					_UpperCAmelCase	):
        '''simple docstring'''



        return self._insert(self._trailer._prev,					_UpperCAmelCase,					self._trailer	)


   def 						snake_case__						(  self	):
        '''simple docstring'''



        if self.is_empty():
             raise IndexError("remove_first from empty list"	)
        return self._delete(self._header._next	)


   def 						snake_case__						(  self	):
        '''simple docstring'''



        if self.is_empty():
             raise IndexError("remove_first from empty list"	)
        return self._delete(self._trailer._prev	)





"""simple docstring"""


def        __a (		A     ,					A   ):






     '''simple docstring'''



     lowercase__								=				sorted(A     ,					key=lambda A   : value[2]     ,					reverse=A   )

     # Create a list of size equal to the maximum deadline
     # and initialize it with -1
     lowercase__								=				max(A     ,					key=lambda A   : value[1]   )[1]
     lowercase__								=				[-1] * max_deadline

     # Finding the maximum profit and the count of jobs
     lowercase__								=				0
     lowercase__								=				0
     for job in jobs:
          # Find a free time slot for this job
          # (Note that we start from the last possible slot)
          for i in range(job[1] - 1     ,					-1     ,					-1   ):
               if time_slots[i] == -1:
                    lowercase__								=				job[0]
                    count += 1
                    max_profit += job[2]
                    break
     return [count, max_profit]


if __name__ == "__main__":
 import doctest

 doctest.testmod()




