/**
 * Given two nested tuples representing ranges, return the intersection range.
 *
 * @param range1 A tuple representing the first range, with the format (start, stop).
 * @param range2 A tuple representing the second range, with the format (start, stop).
 * @return A tuple representing the intersection range, with the format (start, stop).
 */
fun intersectionOfRanges(range1: Pair<Int, Int>, range2: Pair<Int, Int>): Pair<Int, Int> {

    val start = maxOf(range1.first, range2.first)
    val stop = minOf(range1.second, range2.second)
    return Pair(start, stop)
}
/**
 * Given two nested tuples representing ranges, return the intersection range.
 *
 * @param range1 A tuple representing the first range, with the format (start, stop).
 * @param range2 A tuple representing the second range, with the format (start, stop).
 * @return A tuple representing the intersection range, with the format (start, stop).
 */
fun intersectionOfRanges(range1: Pair<Int, Int>, range2: Pair<Int, Int>): Pair<Int, Int> {
/**
 * Given two nested tuples representing ranges, return the intersection range.
 *
 * @param range1 A tuple representing the first range, with the format (start, stop).
 * @param range2 A tuple representing the second range, with the format (start, stop).
 * @return A tuple representing the intersection range, with the format (start, stop).
 */
fun intersectionOfRanges(range1: Pair<Int, Int>, range2: Pair<Int, Int>): Pair<Int, Int> {

    val start = maxOf(range1.first, range2.first)
    val stop = minOf(range1.second, range2.second)
    return Pair(start, stop)
}