/**
 * Merge two dictionaries by adding the values of common keys.
 *
 * @param dict1 The first dictionary.
 * @param dict2 The second dictionary.
 * @return A new dictionary with the merged values.
 */
fun mergeDictionaries(dict1: Map<String, Any>, dict2: Map<String, Any>): Map<String, Any> {

    val result = mutableMapOf<String, Any>()
    for (key in dict1.keys.intersect(dict2.keys)) {
        if (dict1[key] is Map<*, *> && dict2[key] is Map<*, *>) {
            result[key] = mergeDictionaries(dict1[key] as Map<String, Any>, dict2[key] as Map<String, Any>)
        } else {
            result[key] = (dict1[key] as Int) + (dict2[key] as Int)
        }
    }
    return result
}
/**
 * Merge two dictionaries by adding the values of common keys.
 *
 * @param dict1 The first dictionary.
 * @param dict2 The second dictionary.
 * @return A new dictionary with the merged values.
 */
fun mergeDictionaries(dict1: Map<String, Any>, dict2: Map<String, Any>): Map<String, Any> {
/**
 * Merge two dictionaries by adding the values of common keys.
 *
 * @param dict1 The first dictionary.
 * @param dict2 The second dictionary.
 * @return A new dictionary with the merged values.
 */
fun mergeDictionaries(dict1: Map<String, Any>, dict2: Map<String, Any>): Map<String, Any> {

    val result = mutableMapOf<String, Any>()
    for (key in dict1.keys.intersect(dict2.keys)) {
        if (dict1[key] is Map<*, *> && dict2[key] is Map<*, *>) {
            result[key] = mergeDictionaries(dict1[key] as Map<String, Any>, dict2[key] as Map<String, Any>)
        } else {
            result[key] = (dict1[key] as Int) + (dict2[key] as Int)
        }
    }
    return result
}