def k_closest(points, k, origin=(<NUM_LIT:0>, <NUM_LIT:0>)):<EOL>
heap = [(-distance(p, origin), p) for p in points[:k]]<EOL>heapify(heap)<EOL>"""<STR_LIT>"""<EOL>for p in points[k:]:<EOL><INDENT>d = distance(p, origin)<EOL>heappushpop(heap, (-d, p))  <EOL>"""<STR_LIT>"""<EOL><DEDENT>return [p for nd, p in heap]<EOL>
Initialize max heap with first k points.
    Python does not support a max heap; thus we can use the default min heap where the keys (distance) are negated.