


def       a__						(		snake_case__				:       int	,      snake_case__				:       list    ):
  _UpperCAmelCase		:       List[str]       =    sorted(snake_case__	,      key=lambda snake_case__    : value[2]	,      reverse=snake_case__    )

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

  # Finding the maximum profit and the count of jobs
  _UpperCAmelCase		:       Optional[int]       =    0
  _UpperCAmelCase		:       Any       =    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:
        _UpperCAmelCase		:       Dict       =    job[0]
        count += 1
        max_profit += job[2]
        break
  return [count, max_profit]


if __name__ == "__main__":
 import doctest

 doctest.testmod()









from typing import Any


class 		_SCREAMING_SNAKE_CASE    :


     def __init__(     self						):
       _UpperCAmelCase		:       Union[str, Any]       =    []
       _UpperCAmelCase		:       Dict       =    0


     def __str__(     self						):
       _UpperCAmelCase		:       Union[str, Any]       =    """<""" + str(self.stack						)[1:-1] + """>"""
       return printed


     def 					__snake_case(     self       ,				A_						):
       self.stack.append(A_						)
       _UpperCAmelCase		:       Optional[Any]       =    self.length + 1


     def 					__snake_case(     self						):
       self.rotate(1						)
       _UpperCAmelCase		:       List[Any]       =    self.stack[self.length - 1]
       _UpperCAmelCase		:       Optional[Any]       =    self.stack[:-1]
       self.rotate(self.length - 1						)
       _UpperCAmelCase		:       Union[str, Any]       =    self.length - 1
       return dequeued


     def 					__snake_case(     self       ,				A_						):
       for _ in range(A_						):
         _UpperCAmelCase		:       Dict       =    self.stack[0]
         _UpperCAmelCase		:       List[Any]       =    self.stack[1:]
         self.put(A_						)
         _UpperCAmelCase		:       Dict       =    self.length - 1


     def 					__snake_case(     self						):
       _UpperCAmelCase		:       Tuple       =    self.get()
       self.put(A_						)
       self.rotate(self.length - 1						)
       return front


     def 					__snake_case(     self						):
       return self.length





