Function to calculate Euclidean distance
double find ( double x , double y , vector < vector < int > > & p ) { double mind = 0 ; for ( int i = 0 ; i < p . size ( ) ; i ++ ) { double a = p [ i ] [ 0 ] , b = p [ i ] [ 1 ] ; mind += sqrt ( ( x - a ) * ( x - a ) + ( y - b ) * ( y - b ) ) ; } return mind ; }