Given n points in a 2d plane I.E $ (x_1,y_1),(x_2,y_2)\dots (x_n,y_n) $.
Create a data structure that holds the points and a method closer$(a,b)$ that returns all the points in the data structure that are closer to $(0,0) $ than to $(a,b) $.
The preprocessing and creation of the data structure have no complexity limit but the closer$(a,b)$ has a time complexity of $\mathcal{O}(\log(n)+k)$ where n is the number of points and k is the amount of points closer to $(0,0)$ .
I'm quite certain it involves self balancing binary search trees, but not sure how to implement it. If $(a,b)$ is given during preprocessing then we can just make an array and sort it with $$d=(x_i-0)^2+(y_i-0)^2-((x_i-a)^2+(y_i-b)^2)$$. That would give us a search in $\log(n)$ on the first element in the array that is bigger than $ 0 $ and then we can just run a for loop j times.
If (a,b) is not given during preprocessing then I don't know how to approach this, I tried switching to polar coordinates or trying to find the mathematical Locus but It didn't seem to get me anywhere.