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 ; } for ( Map . Entry < Integer , Integer > i : y_axis . entrySet ( ) ) { int c = i . getValue ( ) ;