



'''simple docstring'''






def 					snake_case_      (  lowerCAmelCase_ ,     lowerCAmelCase_	)->	list:





       '''simple docstring'''


       _UpperCAmelCase						:		Optional[Any]      =				sorted(lowerCAmelCase_ ,     key=lambda lowerCAmelCase_	: value[2] ,     reverse=lowerCAmelCase_	)

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

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


if __name__ == "__main__":
   import doctest

   doctest.testmod()








'''simple docstring'''






def 					snake_case_      (  lowerCAmelCase_	)->	tuple[int, int]:





       '''simple docstring'''


       if len(lowerCAmelCase_	) == 1:
              return a[0], a[0]
       else:
              # split A into half.
              _UpperCAmelCase						:		Union[str, Any]      =				a[: len(lowerCAmelCase_	) // 2]
              _UpperCAmelCase						:		str      =				a[len(lowerCAmelCase_	) // 2 :]

              # 2 sub problems, 1/2 of original size.
              _UpperCAmelCase  ,_UpperCAmelCase						:		str      =				max_difference(lowerCAmelCase_	)
              _UpperCAmelCase  ,_UpperCAmelCase						:		List[str]      =				max_difference(lowerCAmelCase_	)

              # get min of first and max of second
              # linear time
              _UpperCAmelCase						:		Dict      =				min(lowerCAmelCase_	)
              _UpperCAmelCase						:		List[Any]      =				max(lowerCAmelCase_	)

              # 3 cases, either (small1, big1),
              # (min_first, max_second), (small2, big2)
              # constant comparisons
              if biga - smalla > max_second - min_first and biga - smalla > biga - smalla:
                     return smalla, biga
              elif biga - smalla > max_second - min_first:
                     return smalla, biga
              else:
                     return min_first, max_second


if __name__ == "__main__":
   import doctest

   doctest.testmod()



