We can not choose pairs from these as they have same x coordinatethus they will result line segment parallel to y axis
total -= ( c * ( c - 1 ) ) / 2 ; } foreach ( KeyValuePair < int , int > i in y_axis ) { int c = i . Value ;