Function calculates distance between two points
static long dist ( Tuple < int , int > p1 , Tuple < int , int > p2 ) { long x0 = p1 . Item1 - p2 . Item1 ; long y0 = p1 . Item2 - p2 . Item2 ; return x0 * x0 + y0 * y0 ; }