Given an array of spatial coordinates, write an efficient algorithm to find the nearest points to a specific origin.
Return exactly k points, ordered by increasing squared Euclidean distance from the origin. Break equal-distance ties by original input order. Implement nearest_points(points, origin, k), where points and origin contain integer 2D coordinates and the result contains coordinate pairs from points.
def nearest_points(points, origin, k):