/**
 * Given two lists of lists, returns a list of common elements between the lists using list comprehension and 'in' statement.
 *
 * @param a The first list.
 * @param b The second list.
 * @return A list of common elements between the lists.
 *
 * Example:
 * - get_common_elements(listOf(listOf(1, 2, 3), listOf(4, 5, 6), listOf(7, 8, 9)), listOf(listOf(1, 2, 4), listOf(4, 6, 8), listOf(7, 9, 10)))
 * - Output: [1, 4, 7, 8, 9]
 */
fun getCommonElements(a: List<List<Int>>, b: List<List<Int>>): List<Int> {

    // Write your code here to solve the exercise
    val commonElements = mutableListOf<Int>()
    
    // Iterate over the first list, iterating over each sub-list, and for each element check if it exists in the second list using list comprehension
    for (sublist in a) {
        for (element in sublist) {
            if (element in b.flatten()) {
                commonElements.add(element)
            }
        }
    }
    
    return commonElements
}
/**
 * Given two lists of lists, returns a list of common elements between the lists using list comprehension and 'in' statement.
 *
 * @param a The first list.
 * @param b The second list.
 * @return A list of common elements between the lists.
 *
 * Example:
 * - get_common_elements(listOf(listOf(1, 2, 3), listOf(4, 5, 6), listOf(7, 8, 9)), listOf(listOf(1, 2, 4), listOf(4, 6, 8), listOf(7, 9, 10)))
 * - Output: [1, 4, 7, 8, 9]
 */
fun getCommonElements(a: List<List<Int>>, b: List<List<Int>>): List<Int> {
/**
 * Given two lists of lists, returns a list of common elements between the lists using list comprehension and 'in' statement.
 *
 * @param a The first list.
 * @param b The second list.
 * @return A list of common elements between the lists.
 *
 * Example:
 * - get_common_elements(listOf(listOf(1, 2, 3), listOf(4, 5, 6), listOf(7, 8, 9)), listOf(listOf(1, 2, 4), listOf(4, 6, 8), listOf(7, 9, 10)))
 * - Output: [1, 4, 7, 8, 9]
 */
fun getCommonElements(a: List<List<Int>>, b: List<List<Int>>): List<Int> {

    // Write your code here to solve the exercise
    val commonElements = mutableListOf<Int>()
    
    // Iterate over the first list, iterating over each sub-list, and for each element check if it exists in the second list using list comprehension
    for (sublist in a) {
        for (element in sublist) {
            if (element in b.flatten()) {
                commonElements.add(element)
            }
        }
    }
    
    return commonElements
}