/**
 * Given two positive integers n and m,
 * create a tuple that contains all possible combinations of the numbers
 * from 0 up to n-1 with the numbers from 0 up to m-1.
 *
 * @param n A positive integer representing the range of the first set of numbers.
 * @param m A positive integer representing the range of the second set of numbers.
 * @return A tuple containing the Cartesian product of the two sets.
 *
 * Example:
 * intersectionTuples(2, 3) -> listOf(Pair(0, 0), Pair(0, 1), Pair(0, 2), Pair(1, 0), Pair(1, 1), Pair(1, 2))
 * intersectionTuples(3, 2) -> listOf(Pair(0, 0), Pair(0, 1), Pair(1, 0), Pair(1, 1), Pair(2, 0), Pair(2, 1))
 */
fun intersectionTuples(n: Int, m: Int): List<Pair<Int, Int>> {

    val result = mutableListOf<Pair<Int, Int>>()
    for (i in 0 until n) {
        for (j in 0 until m) {
            result.add(Pair(i, j))
        }
    }
    return result
}
/**
 * Given two positive integers n and m,
 * create a tuple that contains all possible combinations of the numbers
 * from 0 up to n-1 with the numbers from 0 up to m-1.
 *
 * @param n A positive integer representing the range of the first set of numbers.
 * @param m A positive integer representing the range of the second set of numbers.
 * @return A tuple containing the Cartesian product of the two sets.
 *
 * Example:
 * intersectionTuples(2, 3) -> listOf(Pair(0, 0), Pair(0, 1), Pair(0, 2), Pair(1, 0), Pair(1, 1), Pair(1, 2))
 * intersectionTuples(3, 2) -> listOf(Pair(0, 0), Pair(0, 1), Pair(1, 0), Pair(1, 1), Pair(2, 0), Pair(2, 1))
 */
fun intersectionTuples(n: Int, m: Int): List<Pair<Int, Int>> {
/**
 * Given two positive integers n and m,
 * create a tuple that contains all possible combinations of the numbers
 * from 0 up to n-1 with the numbers from 0 up to m-1.
 *
 * @param n A positive integer representing the range of the first set of numbers.
 * @param m A positive integer representing the range of the second set of numbers.
 * @return A tuple containing the Cartesian product of the two sets.
 *
 * Example:
 * intersectionTuples(2, 3) -> listOf(Pair(0, 0), Pair(0, 1), Pair(0, 2), Pair(1, 0), Pair(1, 1), Pair(1, 2))
 * intersectionTuples(3, 2) -> listOf(Pair(0, 0), Pair(0, 1), Pair(1, 0), Pair(1, 1), Pair(2, 0), Pair(2, 1))
 */
fun intersectionTuples(n: Int, m: Int): List<Pair<Int, Int>> {

    val result = mutableListOf<Pair<Int, Int>>()
    for (i in 0 until n) {
        for (j in 0 until m) {
            result.add(Pair(i, j))
        }
    }
    return result
}