/**
 * This function takes a set of points as input and returns the count of intersections between all lines formed by
 * connecting the points.
 *
 * @param points A set of points represented as tuples (x, y).
 * @return The count of intersections between the lines formed by the points.
 */
fun countNumberOfIntersections(points: Set<Pair<Int, Int>>): Int {

    var count = 0

    for (i in points.indices) {
        for (j in i + 1 until points.size) {
            val (x1, y1) = points.elementAt(i)
            val (x2, y2) = points.elementAt(j)

            val slope1 = (y2 - y1).toDouble() / (x2 - x1)

            for (k in j + 1 until points.size) {
                val (x3, y3) = points.elementAt(k)

                val slope2 = (y3 - y1).toDouble() / (x3 - x1)

                if (slope1 == slope2) {
                    count++
                }
            }
        }
    }

    return count
}
/**
 * This function takes a set of points as input and returns the count of intersections between all lines formed by
 * connecting the points.
 *
 * @param points A set of points represented as tuples (x, y).
 * @return The count of intersections between the lines formed by the points.
 */
fun countNumberOfIntersections(points: Set<Pair<Int, Int>>): Int {
/**
 * This function takes a set of points as input and returns the count of intersections between all lines formed by
 * connecting the points.
 *
 * @param points A set of points represented as tuples (x, y).
 * @return The count of intersections between the lines formed by the points.
 */
fun countNumberOfIntersections(points: Set<Pair<Int, Int>>): Int {

    var count = 0

    for (i in points.indices) {
        for (j in i + 1 until points.size) {
            val (x1, y1) = points.elementAt(i)
            val (x2, y2) = points.elementAt(j)

            val slope1 = (y2 - y1).toDouble() / (x2 - x1)

            for (k in j + 1 until points.size) {
                val (x3, y3) = points.elementAt(k)

                val slope2 = (y3 - y1).toDouble() / (x3 - x1)

                if (slope1 == slope2) {
                    count++
                }
            }
        }
    }

    return count
}