Step ( 3 ) - Loop for i = K to N - 1 and do accordingly
for i in range ( K , N ) : NEW_LINE INDENT if pq [ 0 ] < vec [ i ] [ 0 ] : NEW_LINE INDENT total_points = ( total_points - pq [ 0 ] + vec [ i ] [ 0 ] ) NEW_LINE max_rating = max ( max_rating , total_points * vec [ i ] [ 1 ] ) NEW_LINE heapq . heappop ( pq ) NEW_LINE heapq . heappush ( pq , vec [ i ] [ 0 ] ) NEW_LINE DEDENT DEDENT return max_rating NEW_LINE