This a problem from UAP NCPC 2016. link: problem uva-13084
In short the description is:
A point in a n*n grid (n is maximum 5000) is considered troublesome if there exist another point in the grid which creates angle less than atan(1/k) where n^2<=k<=2n^2 with respect to the upper two corners. In the above picture C is a troublesome point. There are at most 10 test cases. No idea How to solve this problem. Any help?