/**
 * Find the intersection of two sets and perform addition operation on the common elements.
 *
 * @param set1 First set of elements
 * @param set2 Second set of elements
 * @return Set containing the common elements with addition performed
 * @throws IllegalArgumentException If either set1 or set2 is not a set
 */
fun intersectionAddition(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    // Check if set1 and set2 are indeed sets
    if (set1 !is Set<Int> || set2 !is Set<Int>) {
        throw IllegalArgumentException("Both set1 and set2 must be sets")
    }

    // Initialize an empty set to store the common elements after addition
    val resultSet = mutableSetOf<Int>()

    // Iterate over the elements in set1 and set2
    for (element in set1) {
        // Check if the element is present in set2
        if (element in set2) {
            // Perform addition operation on the common element
            val newElement = element + element
            resultSet.add(newElement)
        }
    }

    return resultSet
}
/**
 * Find the intersection of two sets and perform addition operation on the common elements.
 *
 * @param set1 First set of elements
 * @param set2 Second set of elements
 * @return Set containing the common elements with addition performed
 * @throws IllegalArgumentException If either set1 or set2 is not a set
 */
fun intersectionAddition(set1: Set<Int>, set2: Set<Int>): Set<Int> {
/**
 * Find the intersection of two sets and perform addition operation on the common elements.
 *
 * @param set1 First set of elements
 * @param set2 Second set of elements
 * @return Set containing the common elements with addition performed
 * @throws IllegalArgumentException If either set1 or set2 is not a set
 */
fun intersectionAddition(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    // Check if set1 and set2 are indeed sets
    if (set1 !is Set<Int> || set2 !is Set<Int>) {
        throw IllegalArgumentException("Both set1 and set2 must be sets")
    }

    // Initialize an empty set to store the common elements after addition
    val resultSet = mutableSetOf<Int>()

    // Iterate over the elements in set1 and set2
    for (element in set1) {
        // Check if the element is present in set2
        if (element in set2) {
            // Perform addition operation on the common element
            val newElement = element + element
            resultSet.add(newElement)
        }
    }

    return resultSet
}