Computing the x ^ 2 + y ^ 2 for each given points and sorting them .
public static void preprocess ( int [ ] p , int [ ] x , int [ ] y , int n ) { for ( int i = 0 ; i < n ; i ++ ) p [ i ] = x [ i ] * x [ i ] + y [ i ] * y [ i ] ; Array . Sort ( p ) ; }