<gouthampradhan>greedy_CourseScheduleIII_1.java
public int scheduleCourse(int[][] courses) {
    Arrays.sort(courses, (a, b) -> a[1] - b[1]);
    Queue<Integer> pq = new PriorityQueue<>((a, b) -> b - a);
    int time = 0;
    for (int[] course : courses) {
      time += course[0];
      pq.add(course[0]);
      if (time > course[1]) time -= pq.poll();
    }
    return pq.size();
  }
public int sample_funcname ( int [ ] [ ] var_0 ) {
  Arrays . sort ( var_0 , ( var_3 , var_4 ) -> var_3 [ 1 ] - var_4 [ 1 ] ) ;
  Queue < Integer > var_9 = new PriorityQueue < > ( ( var_3 , var_4 ) -> var_4 - var_3 ) ;
  int var_11 = 0 ;
  for ( int [ ] var_12 : var_0 ) {
    var_11 += var_12 [ 0 ] ;
    var_9 . add ( var_12 [ 0 ] ) ;
    if ( var_11 > var_12 [ 1 ] ) var_11 -= var_9 . poll ( ) ;
  }
  return var_9 . size ( ) ;
}
