/**
 * This function takes a list of images and finds the common colors in all of them.
 *
 * @param images a list of image files
 * @return commonColors a list of colors common to all images
 */
fun findCommonColors(images: List<List<IntArray>>): List<IntArray> {

    // Initialize an empty list to store common colors
    val commonColors = mutableListOf<IntArray>()

    // Iterate through each pixel of the first image
    for (pixel1 in images[0]) {
        // Iterate through each pixel of the remaining images
        for (image in images.subList(1, images.size)) {
            for (pixel2 in image) {
                // Check if the RGB values of the pixels are the same
                if (pixel1[0] == pixel2[0] && pixel1[1] == pixel2[1] && pixel1[2] == pixel2[2]) {
                    // Add the common color to the list
                    commonColors.add(pixel1)
                    // Continue to the next pixel in the first image
                    continue
                } else {
                    // If the colors are not the same, break out of the loop
                    break
                }
            }
        }
    }

    // Return the list of common colors
    return commonColors
}
/**
 * This function takes a list of images and finds the common colors in all of them.
 *
 * @param images a list of image files
 * @return commonColors a list of colors common to all images
 */
fun findCommonColors(images: List<List<IntArray>>): List<IntArray> {
/**
 * This function takes a list of images and finds the common colors in all of them.
 *
 * @param images a list of image files
 * @return commonColors a list of colors common to all images
 */
fun findCommonColors(images: List<List<IntArray>>): List<IntArray> {

    // Initialize an empty list to store common colors
    val commonColors = mutableListOf<IntArray>()

    // Iterate through each pixel of the first image
    for (pixel1 in images[0]) {
        // Iterate through each pixel of the remaining images
        for (image in images.subList(1, images.size)) {
            for (pixel2 in image) {
                // Check if the RGB values of the pixels are the same
                if (pixel1[0] == pixel2[0] && pixel1[1] == pixel2[1] && pixel1[2] == pixel2[2]) {
                    // Add the common color to the list
                    commonColors.add(pixel1)
                    // Continue to the next pixel in the first image
                    continue
                } else {
                    // If the colors are not the same, break out of the loop
                    break
                }
            }
        }
    }

    // Return the list of common colors
    return commonColors
}