


def       UpperCamelCase__     (  SCREAMING_SNAKE_CASE__			,       SCREAMING_SNAKE_CASE__						):
 __lowerCamelCase		:							int							=						sorted(SCREAMING_SNAKE_CASE__			,       key=lambda SCREAMING_SNAKE_CASE__						: value[2]			,       reverse=SCREAMING_SNAKE_CASE__						)

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

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


if __name__ == "__main__":
       import doctest

       doctest.testmod()





from __future__ import annotations
def       UpperCamelCase__     (  SCREAMING_SNAKE_CASE__			,       SCREAMING_SNAKE_CASE__			,       SCREAMING_SNAKE_CASE__			,       SCREAMING_SNAKE_CASE__						):
 __lowerCamelCase					,     __lowerCamelCase		:							str							=						m - 1, 0
 while i >= 0 and j < n:
  if key == mat[i][j]:
   print(f'Key {key} found at row- {i + 1} column- {j + 1}'						)
   return
  if key < mat[i][j]:
   i -= 1
  else:
   j += 1
 print(f'Key {key} not found'						)
def       UpperCamelCase__     (  ):
 __lowerCamelCase		:							List[Any]							=						[[2, 5, 7], [4, 8, 13], [9, 11, 15], [12, 17, 20]]
 __lowerCamelCase		:							int							=						int(input('Enter the element to be searched:'						)						)
 print(SCREAMING_SNAKE_CASE__						)
 search_in_a_sorted_matrix(SCREAMING_SNAKE_CASE__			,       len(SCREAMING_SNAKE_CASE__						)			,       len(mat[0]						)			,       SCREAMING_SNAKE_CASE__						)


if __name__ == "__main__":
       import doctest

       doctest.testmod()
       main()

