/**
 * Calculates the intersection of the loads on a structural member.
 *
 * @param n Number of loads on the first member
 * @param m Number of loads on the second member
 * @param loads List of loads on the structural members
 * @return List of loads that intersect on both members
 */
fun intersectedLoads(n: Int, m: Int, loads: List<Int>): List<Int> {

    val intersected = mutableListOf<Int>()

    for (i in 0 until n) {
        val loadI = loads[i]
        for (j in 0 until m) {
            val loadJ = loads[j]

            if (!(loadI > loadJ || loadJ > loadI)) {
                intersected.add(loadI)
            }
        }
    }

    return intersected
}
/**
 * Calculates the intersection of the loads on a structural member.
 *
 * @param n Number of loads on the first member
 * @param m Number of loads on the second member
 * @param loads List of loads on the structural members
 * @return List of loads that intersect on both members
 */
fun intersectedLoads(n: Int, m: Int, loads: List<Int>): List<Int> {
/**
 * Calculates the intersection of the loads on a structural member.
 *
 * @param n Number of loads on the first member
 * @param m Number of loads on the second member
 * @param loads List of loads on the structural members
 * @return List of loads that intersect on both members
 */
fun intersectedLoads(n: Int, m: Int, loads: List<Int>): List<Int> {

    val intersected = mutableListOf<Int>()

    for (i in 0 until n) {
        val loadI = loads[i]
        for (j in 0 until m) {
            val loadJ = loads[j]

            if (!(loadI > loadJ || loadJ > loadI)) {
                intersected.add(loadI)
            }
        }
    }

    return intersected
}