package day14

import java.io.File

fun parseInput(lines: List<String>): Pair<String, Map<String, Char>> {
  val initial = lines.first()
  val insertions =
    lines.drop(2).associate {
      val (pattern, addition) = it.split(" -> ")
      pattern to addition.first()
    }
  return initial to insertions
}

private fun combineAllMaps(vararg maps: Map<Char, Long>): Map<Char, Long> =
  maps.flatMap { it.toList() }
    .groupBy { it.first }
    .mapValues { (_, v) -> v.fold(0L) { acc, (_, v) -> acc + v } }

private fun combine2(map1: Map<Char, Long>, map2: Map<Char, Long>): Map<Char, Long> =
  combineAllMaps(map1, map2)

val memoizeCountDescendantChars = { insertions: Map<String, Char> ->
  // intermediate steps will be stored here
  val cache = mutableMapOf<Pair<String, Int>, Map<Char, Long>>()

  // Recursively build the count, storing all intermediate steps
  // in 'cache' so that they can be reused later on
  fun getAdditionCount(pair: String, steps: Int): Map<Char, Long> =
    when {
      steps == 0 -> emptyMap()
      cache.containsKey(pair to steps) -> cache[pair to steps]!!
      insertions.containsKey(pair) -> {
        val c = insertions[pair]!!
        val result = combineAllMaps(
          mapOf(c to 1L),
          getAdditionCount("${pair[0]}$c", steps - 1),
          getAdditionCount("$c${pair[1]}", steps - 1)
        )
        cache[pair to steps] = result
        result
      }
      else -> emptyMap()
    }

  ::getAdditionCount
}

fun solve(polymer: String, insertions: Map<String, Char>, steps: Int): Long {
  val memoizedGetDescendants = memoizeCountDescendantChars(insertions)

  val finalCount = sequence {
    // Count initial chars
    val initialCharCount = polymer
      .groupingBy { it }.eachCount()
      .mapValues { (_, v) -> v.toLong() }
      .toMutableMap()

    yield(initialCharCount)

    // Count descendant chars generated by each pair or chars ('abc' -> 'ab','bc')
    for (i in 0..(polymer.length - 2)) {
      val pair = polymer.substring(i, i + 2)
      yield(memoizedGetDescendants(pair, steps))
    }
  }.reduce(::combine2)

  val max = finalCount.maxOf { it.value }
  val min = finalCount.minOf { it.value }
  return max - min
}

fun main() {
  File("./input/day14.txt").useLines { lines ->
    val (initialPolymer, insertions) = parseInput(lines.toList())
    println(solve(initialPolymer, insertions, 10))
    println(solve(initialPolymer, insertions, 40))
  }
}

Compiled from "Day14.kt"
public final class day14.Day14Kt {
  private static final kotlin.jvm.functions.Function1<java.util.Map<java.lang.String, java.lang.Character>, kotlin.reflect.KFunction<java.util.Map<java.lang.Character, java.lang.Long>>> memoizeCountDescendantChars;

  public static final kotlin.Pair<java.lang.String, java.util.Map<java.lang.String, java.lang.Character>> parseInput(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #10                 // String lines
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokestatic  #22                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      10: checkcast     #24                 // class java/lang/String
      13: astore_1
      14: aload_0
      15: checkcast     #26                 // class java/lang/Iterable
      18: iconst_2
      19: invokestatic  #30                 // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
      22: checkcast     #26                 // class java/lang/Iterable
      25: astore_3
      26: iconst_0
      27: istore        4
      29: aload_3
      30: bipush        10
      32: invokestatic  #34                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      35: invokestatic  #40                 // Method kotlin/collections/MapsKt.mapCapacity:(I)I
      38: bipush        16
      40: invokestatic  #46                 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
      43: istore        5
      45: aload_3
      46: astore        6
      48: new           #48                 // class java/util/LinkedHashMap
      51: dup
      52: iload         5
      54: invokespecial #52                 // Method java/util/LinkedHashMap."<init>":(I)V
      57: checkcast     #54                 // class java/util/Map
      60: astore        7
      62: iconst_0
      63: istore        8
      65: aload         6
      67: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      72: astore        9
      74: aload         9
      76: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      81: ifeq          201
      84: aload         9
      86: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      91: astore        10
      93: aload         7
      95: astore        11
      97: aload         10
      99: checkcast     #24                 // class java/lang/String
     102: astore        12
     104: iconst_0
     105: istore        13
     107: aload         12
     109: checkcast     #70                 // class java/lang/CharSequence
     112: iconst_1
     113: anewarray     #24                 // class java/lang/String
     116: astore        14
     118: aload         14
     120: iconst_0
     121: ldc           #72                 // String  ->
     123: aastore
     124: aload         14
     126: iconst_0
     127: iconst_0
     128: bipush        6
     130: aconst_null
     131: invokestatic  #78                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     134: astore        15
     136: aload         15
     138: iconst_0
     139: invokeinterface #84,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     144: checkcast     #24                 // class java/lang/String
     147: astore        14
     149: aload         15
     151: iconst_1
     152: invokeinterface #84,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     157: checkcast     #24                 // class java/lang/String
     160: astore        16
     162: aload         14
     164: aload         16
     166: checkcast     #70                 // class java/lang/CharSequence
     169: invokestatic  #87                 // Method kotlin/text/StringsKt.first:(Ljava/lang/CharSequence;)C
     172: invokestatic  #93                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     175: invokestatic  #99                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     178: astore        12
     180: aload         11
     182: aload         12
     184: invokevirtual #104                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     187: aload         12
     189: invokevirtual #107                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     192: invokeinterface #111,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     197: pop
     198: goto          74
     201: aload         7
     203: nop
     204: astore_2
     205: aload_1
     206: aload_2
     207: invokestatic  #99                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     210: areturn

  private static final java.util.Map<java.lang.Character, java.lang.Long> combineAllMaps(java.util.Map<java.lang.Character, java.lang.Long>...);
    Code:
       0: aload_0
       1: astore_1
       2: iconst_0
       3: istore_2
       4: aload_1
       5: astore_3
       6: new           #135                // class java/util/ArrayList
       9: dup
      10: invokespecial #138                // Method java/util/ArrayList."<init>":()V
      13: checkcast     #140                // class java/util/Collection
      16: astore        4
      18: iconst_0
      19: istore        5
      21: iconst_0
      22: istore        6
      24: aload_3
      25: arraylength
      26: istore        7
      28: iload         6
      30: iload         7
      32: if_icmpge     72
      35: aload_3
      36: iload         6
      38: aaload
      39: astore        8
      41: aload         8
      43: astore        9
      45: iconst_0
      46: istore        10
      48: aload         9
      50: invokestatic  #144                // Method kotlin/collections/MapsKt.toList:(Ljava/util/Map;)Ljava/util/List;
      53: checkcast     #26                 // class java/lang/Iterable
      56: astore        9
      58: aload         4
      60: aload         9
      62: invokestatic  #148                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
      65: pop
      66: iinc          6, 1
      69: goto          28
      72: aload         4
      74: checkcast     #80                 // class java/util/List
      77: nop
      78: checkcast     #26                 // class java/lang/Iterable
      81: astore_1
      82: nop
      83: iconst_0
      84: istore_2
      85: aload_1
      86: astore_3
      87: new           #48                 // class java/util/LinkedHashMap
      90: dup
      91: invokespecial #149                // Method java/util/LinkedHashMap."<init>":()V
      94: checkcast     #54                 // class java/util/Map
      97: astore        4
      99: iconst_0
     100: istore        5
     102: aload_3
     103: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     108: astore        6
     110: aload         6
     112: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     117: ifeq          231
     120: aload         6
     122: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     127: astore        7
     129: aload         7
     131: checkcast     #101                // class kotlin/Pair
     134: astore        8
     136: iconst_0
     137: istore        9
     139: aload         8
     141: invokevirtual #104                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     144: checkcast     #89                 // class java/lang/Character
     147: invokevirtual #153                // Method java/lang/Character.charValue:()C
     150: invokestatic  #93                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     153: astore        10
     155: aload         4
     157: astore        11
     159: iconst_0
     160: istore        12
     162: aload         11
     164: aload         10
     166: invokeinterface #156,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     171: astore        13
     173: aload         13
     175: ifnonnull     210
     178: iconst_0
     179: istore        14
     181: new           #135                // class java/util/ArrayList
     184: dup
     185: invokespecial #138                // Method java/util/ArrayList."<init>":()V
     188: checkcast     #80                 // class java/util/List
     191: astore        14
     193: aload         11
     195: aload         10
     197: aload         14
     199: invokeinterface #111,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     204: pop
     205: aload         14
     207: goto          212
     210: aload         13
     212: nop
     213: checkcast     #80                 // class java/util/List
     216: astore        8
     218: aload         8
     220: aload         7
     222: invokeinterface #160,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     227: pop
     228: goto          110
     231: aload         4
     233: nop
     234: astore_1
     235: nop
     236: iconst_0
     237: istore_2
     238: aload_1
     239: astore_3
     240: new           #48                 // class java/util/LinkedHashMap
     243: dup
     244: aload_1
     245: invokeinterface #164,  1          // InterfaceMethod java/util/Map.size:()I
     250: invokestatic  #40                 // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     253: invokespecial #52                 // Method java/util/LinkedHashMap."<init>":(I)V
     256: checkcast     #54                 // class java/util/Map
     259: astore        4
     261: iconst_0
     262: istore        5
     264: aload_3
     265: invokeinterface #168,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     270: checkcast     #26                 // class java/lang/Iterable
     273: astore        6
     275: iconst_0
     276: istore        7
     278: aload         6
     280: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     285: astore        8
     287: aload         8
     289: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     294: ifeq          461
     297: aload         8
     299: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     304: astore        9
     306: aload         4
     308: aload         9
     310: checkcast     #170                // class java/util/Map$Entry
     313: astore        10
     315: astore        11
     317: iconst_0
     318: istore        12
     320: aload         10
     322: invokeinterface #173,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     327: aload         11
     329: swap
     330: aload         9
     332: checkcast     #170                // class java/util/Map$Entry
     335: astore        13
     337: astore        31
     339: astore        30
     341: iconst_0
     342: istore        14
     344: aload         13
     346: invokeinterface #176,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     351: checkcast     #80                 // class java/util/List
     354: astore        15
     356: aload         15
     358: checkcast     #26                 // class java/lang/Iterable
     361: astore        16
     363: lconst_0
     364: lstore        17
     366: iconst_0
     367: istore        19
     369: lload         17
     371: lstore        20
     373: aload         16
     375: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     380: astore        22
     382: aload         22
     384: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     389: ifeq          438
     392: aload         22
     394: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     399: astore        23
     401: lload         20
     403: aload         23
     405: checkcast     #101                // class kotlin/Pair
     408: astore        24
     410: lstore        25
     412: iconst_0
     413: istore        27
     415: aload         24
     417: invokevirtual #179                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     420: checkcast     #181                // class java/lang/Number
     423: invokevirtual #185                // Method java/lang/Number.longValue:()J
     426: lstore        28
     428: lload         25
     430: lload         28
     432: ladd
     433: lstore        20
     435: goto          382
     438: lload         20
     440: nop
     441: invokestatic  #190                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     444: astore        32
     446: aload         30
     448: aload         31
     450: aload         32
     452: invokeinterface #111,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     457: pop
     458: goto          287
     461: aload         4
     463: nop
     464: nop
     465: areturn

  private static final java.util.Map<java.lang.Character, java.lang.Long> combine2(java.util.Map<java.lang.Character, java.lang.Long>, java.util.Map<java.lang.Character, java.lang.Long>);
    Code:
       0: iconst_2
       1: anewarray     #54                 // class java/util/Map
       4: astore_2
       5: aload_2
       6: iconst_0
       7: aload_0
       8: aastore
       9: aload_2
      10: iconst_1
      11: aload_1
      12: aastore
      13: aload_2
      14: invokestatic  #238                // Method combineAllMaps:([Ljava/util/Map;)Ljava/util/Map;
      17: areturn

  public static final kotlin.jvm.functions.Function1<java.util.Map<java.lang.String, java.lang.Character>, kotlin.reflect.KFunction<java.util.Map<java.lang.Character, java.lang.Long>>> getMemoizeCountDescendantChars();
    Code:
       0: getstatic     #247                // Field memoizeCountDescendantChars:Lkotlin/jvm/functions/Function1;
       3: areturn

  public static final long solve(java.lang.String, java.util.Map<java.lang.String, java.lang.Character>, int);
    Code:
       0: aload_0
       1: ldc           #252                // String polymer
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #253                // String insertions
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: getstatic     #247                // Field memoizeCountDescendantChars:Lkotlin/jvm/functions/Function1;
      15: aload_1
      16: invokeinterface #258,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
      21: checkcast     #260                // class kotlin/reflect/KFunction
      24: astore_3
      25: new           #262                // class day14/Day14Kt$solve$finalCount$1
      28: dup
      29: aload_0
      30: aload_3
      31: iload_2
      32: aconst_null
      33: invokespecial #265                // Method day14/Day14Kt$solve$finalCount$1."<init>":(Ljava/lang/String;Lkotlin/reflect/KFunction;ILkotlin/coroutines/Continuation;)V
      36: checkcast     #267                // class kotlin/jvm/functions/Function2
      39: invokestatic  #273                // Method kotlin/sequences/SequencesKt.sequence:(Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;
      42: astore        5
      44: nop
      45: iconst_0
      46: istore        6
      48: aload         5
      50: invokeinterface #276,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      55: astore        7
      57: aload         7
      59: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      64: ifne          78
      67: new           #278                // class java/lang/UnsupportedOperationException
      70: dup
      71: ldc_w         #280                // String Empty sequence can\'t be reduced.
      74: invokespecial #283                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
      77: athrow
      78: aload         7
      80: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      85: astore        8
      87: aload         7
      89: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      94: ifeq          131
      97: aload         8
      99: aload         7
     101: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     106: checkcast     #54                 // class java/util/Map
     109: astore        9
     111: checkcast     #54                 // class java/util/Map
     114: astore        11
     116: iconst_0
     117: istore        13
     119: aload         11
     121: aload         9
     123: invokestatic  #285                // Method combine2:(Ljava/util/Map;Ljava/util/Map;)Ljava/util/Map;
     126: astore        8
     128: goto          87
     131: aload         8
     133: checkcast     #54                 // class java/util/Map
     136: astore        4
     138: aload         4
     140: invokeinterface #168,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     145: checkcast     #26                 // class java/lang/Iterable
     148: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     153: astore        8
     155: aload         8
     157: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     162: ifne          173
     165: new           #287                // class java/util/NoSuchElementException
     168: dup
     169: invokespecial #288                // Method java/util/NoSuchElementException."<init>":()V
     172: athrow
     173: aload         8
     175: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     180: checkcast     #170                // class java/util/Map$Entry
     183: astore        9
     185: iconst_0
     186: istore        11
     188: aload         9
     190: invokeinterface #176,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     195: checkcast     #181                // class java/lang/Number
     198: invokevirtual #185                // Method java/lang/Number.longValue:()J
     201: lstore        9
     203: aload         8
     205: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     210: ifeq          258
     213: aload         8
     215: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     220: checkcast     #170                // class java/util/Map$Entry
     223: astore        11
     225: iconst_0
     226: istore        13
     228: aload         11
     230: invokeinterface #176,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     235: checkcast     #181                // class java/lang/Number
     238: invokevirtual #185                // Method java/lang/Number.longValue:()J
     241: lstore        11
     243: lload         9
     245: lload         11
     247: lcmp
     248: ifge          203
     251: lload         11
     253: lstore        9
     255: goto          203
     258: lload         9
     260: lstore        5
     262: aload         4
     264: invokeinterface #168,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     269: checkcast     #26                 // class java/lang/Iterable
     272: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     277: astore        11
     279: aload         11
     281: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     286: ifne          297
     289: new           #287                // class java/util/NoSuchElementException
     292: dup
     293: invokespecial #288                // Method java/util/NoSuchElementException."<init>":()V
     296: athrow
     297: aload         11
     299: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     304: checkcast     #170                // class java/util/Map$Entry
     307: astore        13
     309: iconst_0
     310: istore        15
     312: aload         13
     314: invokeinterface #176,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     319: checkcast     #181                // class java/lang/Number
     322: invokevirtual #185                // Method java/lang/Number.longValue:()J
     325: lstore        13
     327: aload         11
     329: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     334: ifeq          382
     337: aload         11
     339: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     344: checkcast     #170                // class java/util/Map$Entry
     347: astore        15
     349: iconst_0
     350: istore        17
     352: aload         15
     354: invokeinterface #176,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     359: checkcast     #181                // class java/lang/Number
     362: invokevirtual #185                // Method java/lang/Number.longValue:()J
     365: lstore        15
     367: lload         13
     369: lload         15
     371: lcmp
     372: ifle          327
     375: lload         15
     377: lstore        13
     379: goto          327
     382: lload         13
     384: lstore        7
     386: lload         5
     388: lload         7
     390: lsub
     391: lreturn

  public static final void main();
    Code:
       0: new           #309                // class java/io/File
       3: dup
       4: ldc_w         #311                // String ./input/day14.txt
       7: invokespecial #312                // Method java/io/File."<init>":(Ljava/lang/String;)V
      10: astore_0
      11: getstatic     #318                // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;
      14: astore_1
      15: iconst_0
      16: istore_2
      17: aload_0
      18: astore_3
      19: sipush        8192
      22: istore        4
      24: aload_3
      25: astore        5
      27: new           #320                // class java/io/InputStreamReader
      30: dup
      31: new           #322                // class java/io/FileInputStream
      34: dup
      35: aload         5
      37: invokespecial #325                // Method java/io/FileInputStream."<init>":(Ljava/io/File;)V
      40: checkcast     #327                // class java/io/InputStream
      43: aload_1
      44: invokespecial #330                // Method java/io/InputStreamReader."<init>":(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V
      47: checkcast     #332                // class java/io/Reader
      50: astore        5
      52: aload         5
      54: instanceof    #334                // class java/io/BufferedReader
      57: ifeq          68
      60: aload         5
      62: checkcast     #334                // class java/io/BufferedReader
      65: goto          79
      68: new           #334                // class java/io/BufferedReader
      71: dup
      72: aload         5
      74: iload         4
      76: invokespecial #337                // Method java/io/BufferedReader."<init>":(Ljava/io/Reader;I)V
      79: checkcast     #339                // class java/io/Closeable
      82: astore_3
      83: aconst_null
      84: astore        4
      86: nop
      87: aload_3
      88: checkcast     #334                // class java/io/BufferedReader
      91: astore        5
      93: iconst_0
      94: istore        6
      96: aload         5
      98: invokestatic  #345                // Method kotlin/io/TextStreamsKt.lineSequence:(Ljava/io/BufferedReader;)Lkotlin/sequences/Sequence;
     101: astore        7
     103: iconst_0
     104: istore        8
     106: aload         7
     108: invokestatic  #348                // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
     111: invokestatic  #350                // Method parseInput:(Ljava/util/List;)Lkotlin/Pair;
     114: astore        9
     116: aload         9
     118: invokevirtual #353                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     121: checkcast     #24                 // class java/lang/String
     124: astore        10
     126: aload         9
     128: invokevirtual #179                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     131: checkcast     #54                 // class java/util/Map
     134: astore        11
     136: aload         10
     138: aload         11
     140: bipush        10
     142: invokestatic  #355                // Method solve:(Ljava/lang/String;Ljava/util/Map;I)J
     145: lstore        12
     147: getstatic     #361                // Field java/lang/System.out:Ljava/io/PrintStream;
     150: lload         12
     152: invokevirtual #367                // Method java/io/PrintStream.println:(J)V
     155: aload         10
     157: aload         11
     159: bipush        40
     161: invokestatic  #355                // Method solve:(Ljava/lang/String;Ljava/util/Map;I)J
     164: lstore        12
     166: getstatic     #361                // Field java/lang/System.out:Ljava/io/PrintStream;
     169: lload         12
     171: invokevirtual #367                // Method java/io/PrintStream.println:(J)V
     174: nop
     175: getstatic     #373                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     178: astore        5
     180: aload_3
     181: aload         4
     183: invokestatic  #379                // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V
     186: goto          209
     189: astore        6
     191: aload         6
     193: astore        4
     195: aload         6
     197: athrow
     198: astore        6
     200: aload_3
     201: aload         4
     203: invokestatic  #379                // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V
     206: aload         6
     208: athrow
     209: nop
     210: return
    Exception table:
       from    to  target type
          86   180   189   Class java/lang/Throwable
          86   180   198   any
         189   198   198   any
         198   200   198   any

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #393                // Method main:()V
       3: return

  private static final java.util.Map<java.lang.Character, java.lang.Long> memoizeCountDescendantChars$lambda$5$getAdditionCount(java.util.Map<kotlin.Pair<java.lang.String, java.lang.Integer>, java.util.Map<java.lang.Character, java.lang.Long>>, java.util.Map<java.lang.String, java.lang.Character>, java.lang.String, int);
    Code:
       0: nop
       1: iload_3
       2: ifne          11
       5: invokestatic  #402                // Method kotlin/collections/MapsKt.emptyMap:()Ljava/util/Map;
       8: goto          208
      11: aload_0
      12: aload_2
      13: iload_3
      14: invokestatic  #407                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      17: invokestatic  #99                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      20: invokeinterface #410,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
      25: ifeq          52
      28: aload_0
      29: aload_2
      30: iload_3
      31: invokestatic  #407                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      34: invokestatic  #99                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      37: invokeinterface #156,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      42: dup
      43: invokestatic  #414                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      46: checkcast     #54                 // class java/util/Map
      49: goto          208
      52: aload_1
      53: aload_2
      54: invokeinterface #410,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
      59: ifeq          205
      62: aload_1
      63: aload_2
      64: invokeinterface #156,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      69: dup
      70: invokestatic  #414                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      73: checkcast     #89                 // class java/lang/Character
      76: invokevirtual #153                // Method java/lang/Character.charValue:()C
      79: istore        4
      81: iconst_3
      82: anewarray     #54                 // class java/util/Map
      85: astore        6
      87: aload         6
      89: iconst_0
      90: iload         4
      92: invokestatic  #93                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      95: lconst_1
      96: invokestatic  #190                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      99: invokestatic  #99                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     102: invokestatic  #418                // Method kotlin/collections/MapsKt.mapOf:(Lkotlin/Pair;)Ljava/util/Map;
     105: aastore
     106: aload         6
     108: iconst_1
     109: aload_0
     110: aload_1
     111: new           #420                // class java/lang/StringBuilder
     114: dup
     115: invokespecial #421                // Method java/lang/StringBuilder."<init>":()V
     118: aload_2
     119: iconst_0
     120: invokevirtual #425                // Method java/lang/String.charAt:(I)C
     123: invokevirtual #429                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     126: iload         4
     128: invokevirtual #429                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     131: invokevirtual #433                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     134: iload_3
     135: iconst_1
     136: isub
     137: invokestatic  #435                // Method memoizeCountDescendantChars$lambda$5$getAdditionCount:(Ljava/util/Map;Ljava/util/Map;Ljava/lang/String;I)Ljava/util/Map;
     140: aastore
     141: aload         6
     143: iconst_2
     144: aload_0
     145: aload_1
     146: new           #420                // class java/lang/StringBuilder
     149: dup
     150: invokespecial #421                // Method java/lang/StringBuilder."<init>":()V
     153: iload         4
     155: invokevirtual #429                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     158: aload_2
     159: iconst_1
     160: invokevirtual #425                // Method java/lang/String.charAt:(I)C
     163: invokevirtual #429                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     166: invokevirtual #433                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     169: iload_3
     170: iconst_1
     171: isub
     172: invokestatic  #435                // Method memoizeCountDescendantChars$lambda$5$getAdditionCount:(Ljava/util/Map;Ljava/util/Map;Ljava/lang/String;I)Ljava/util/Map;
     175: aastore
     176: aload         6
     178: invokestatic  #238                // Method combineAllMaps:([Ljava/util/Map;)Ljava/util/Map;
     181: astore        5
     183: aload_0
     184: aload_2
     185: iload_3
     186: invokestatic  #407                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     189: invokestatic  #99                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     192: aload         5
     194: invokeinterface #111,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     199: pop
     200: aload         5
     202: goto          208
     205: invokestatic  #402                // Method kotlin/collections/MapsKt.emptyMap:()Ljava/util/Map;
     208: areturn

  private static final kotlin.reflect.KFunction memoizeCountDescendantChars$lambda$5(java.util.Map);
    Code:
       0: aload_0
       1: ldc           #253                // String insertions
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #48                 // class java/util/LinkedHashMap
       9: dup
      10: invokespecial #149                // Method java/util/LinkedHashMap."<init>":()V
      13: checkcast     #54                 // class java/util/Map
      16: astore_1
      17: new           #445                // class day14/Day14Kt$memoizeCountDescendantChars$1$1
      20: dup
      21: aload_1
      22: aload_0
      23: invokespecial #448                // Method day14/Day14Kt$memoizeCountDescendantChars$1$1."<init>":(Ljava/util/Map;Ljava/util/Map;)V
      26: checkcast     #260                // class kotlin/reflect/KFunction
      29: areturn

  public static final java.util.Map access$memoizeCountDescendantChars$lambda$5$getAdditionCount(java.util.Map, java.util.Map, java.lang.String, int);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: iload_3
       4: invokestatic  #435                // Method memoizeCountDescendantChars$lambda$5$getAdditionCount:(Ljava/util/Map;Ljava/util/Map;Ljava/lang/String;I)Ljava/util/Map;
       7: areturn

  static {};
    Code:
       0: invokedynamic #464,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
       5: putstatic     #247                // Field memoizeCountDescendantChars:Lkotlin/jvm/functions/Function1;
       8: return
}

Compiled from "Day14.kt"
final class day14.Day14Kt$solve$finalCount$1 extends kotlin.coroutines.jvm.internal.RestrictedSuspendLambda implements kotlin.jvm.functions.Function2<kotlin.sequences.SequenceScope<? super java.util.Map<java.lang.Character, ? extends java.lang.Long>>, kotlin.coroutines.Continuation<? super kotlin.Unit>, java.lang.Object> {
  int I$0;

  int I$1;

  int label;

  private java.lang.Object L$0;

  final java.lang.String $polymer;

  final kotlin.reflect.KFunction<java.util.Map<java.lang.Character, java.lang.Long>> $memoizedGetDescendants;

  final int $steps;

  day14.Day14Kt$solve$finalCount$1(java.lang.String, kotlin.reflect.KFunction<? extends java.util.Map<java.lang.Character, java.lang.Long>>, int, kotlin.coroutines.Continuation<? super day14.Day14Kt$solve$finalCount$1>);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #14                 // Field $polymer:Ljava/lang/String;
       5: aload_0
       6: aload_2
       7: putfield      #18                 // Field $memoizedGetDescendants:Lkotlin/reflect/KFunction;
      10: aload_0
      11: iload_3
      12: putfield      #22                 // Field $steps:I
      15: aload_0
      16: iconst_2
      17: aload         4
      19: invokespecial #25                 // Method kotlin/coroutines/jvm/internal/RestrictedSuspendLambda."<init>":(ILkotlin/coroutines/Continuation;)V
      22: return

  public final java.lang.Object invokeSuspend(java.lang.Object);
    Code:
       0: invokestatic  #55                 // Method kotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINE_SUSPENDED:()Ljava/lang/Object;
       3: astore        22
       5: aload_0
       6: getfield      #58                 // Field label:I
       9: tableswitch   { // 0 to 2
                     0: 36
                     1: 264
                     2: 380
               default: 423
          }
      36: aload_1
      37: invokestatic  #64                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
      40: aload_0
      41: getfield      #67                 // Field L$0:Ljava/lang/Object;
      44: checkcast     #69                 // class kotlin/sequences/SequenceScope
      47: astore_2
      48: aload_0
      49: getfield      #14                 // Field $polymer:Ljava/lang/String;
      52: checkcast     #71                 // class java/lang/CharSequence
      55: astore        4
      57: iconst_0
      58: istore        5
      60: new           #73                 // class day14/Day14Kt$solve$finalCount$1$invokeSuspend$$inlined$groupingBy$1
      63: dup
      64: aload         4
      66: invokespecial #76                 // Method day14/Day14Kt$solve$finalCount$1$invokeSuspend$$inlined$groupingBy$1."<init>":(Ljava/lang/CharSequence;)V
      69: checkcast     #78                 // class kotlin/collections/Grouping
      72: invokestatic  #84                 // Method kotlin/collections/GroupingKt.eachCount:(Lkotlin/collections/Grouping;)Ljava/util/Map;
      75: astore        4
      77: iconst_0
      78: istore        5
      80: aload         4
      82: astore        6
      84: new           #86                 // class java/util/LinkedHashMap
      87: dup
      88: aload         4
      90: invokeinterface #92,  1           // InterfaceMethod java/util/Map.size:()I
      95: invokestatic  #98                 // Method kotlin/collections/MapsKt.mapCapacity:(I)I
      98: invokespecial #101                // Method java/util/LinkedHashMap."<init>":(I)V
     101: checkcast     #88                 // class java/util/Map
     104: astore        7
     106: iconst_0
     107: istore        8
     109: aload         6
     111: invokeinterface #105,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     116: checkcast     #107                // class java/lang/Iterable
     119: astore        9
     121: iconst_0
     122: istore        10
     124: aload         9
     126: invokeinterface #111,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     131: astore        11
     133: aload         11
     135: invokeinterface #117,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     140: ifeq          228
     143: aload         11
     145: invokeinterface #120,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     150: astore        12
     152: aload         7
     154: aload         12
     156: checkcast     #122                // class java/util/Map$Entry
     159: astore        13
     161: astore        14
     163: iconst_0
     164: istore        15
     166: aload         13
     168: invokeinterface #125,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     173: aload         14
     175: swap
     176: aload         12
     178: checkcast     #122                // class java/util/Map$Entry
     181: astore        16
     183: astore        20
     185: astore        19
     187: iconst_0
     188: istore        17
     190: aload         16
     192: invokeinterface #128,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     197: checkcast     #130                // class java/lang/Number
     200: invokevirtual #133                // Method java/lang/Number.intValue:()I
     203: istore        18
     205: iload         18
     207: i2l
     208: invokestatic  #139                // Method kotlin/coroutines/jvm/internal/Boxing.boxLong:(J)Ljava/lang/Long;
     211: astore        21
     213: aload         19
     215: aload         20
     217: aload         21
     219: invokeinterface #143,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     224: pop
     225: goto          133
     228: aload         7
     230: nop
     231: nop
     232: invokestatic  #147                // Method kotlin/collections/MapsKt.toMutableMap:(Ljava/util/Map;)Ljava/util/Map;
     235: astore_3
     236: aload_2
     237: aload_3
     238: aload_0
     239: checkcast     #149                // class kotlin/coroutines/Continuation
     242: aload_0
     243: aload_2
     244: putfield      #67                 // Field L$0:Ljava/lang/Object;
     247: aload_0
     248: iconst_1
     249: putfield      #58                 // Field label:I
     252: invokevirtual #153                // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
     255: dup
     256: aload         22
     258: if_acmpne     277
     261: aload         22
     263: areturn
     264: aload_0
     265: getfield      #67                 // Field L$0:Ljava/lang/Object;
     268: checkcast     #69                 // class kotlin/sequences/SequenceScope
     271: astore_2
     272: aload_1
     273: invokestatic  #64                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
     276: aload_1
     277: pop
     278: iconst_0
     279: istore        4
     281: aload_0
     282: getfield      #14                 // Field $polymer:Ljava/lang/String;
     285: invokevirtual #158                // Method java/lang/String.length:()I
     288: iconst_2
     289: isub
     290: istore        5
     292: iload         4
     294: iload         5
     296: if_icmpgt     419
     299: aload_0
     300: getfield      #14                 // Field $polymer:Ljava/lang/String;
     303: iload         4
     305: iload         4
     307: iconst_2
     308: iadd
     309: invokevirtual #162                // Method java/lang/String.substring:(II)Ljava/lang/String;
     312: dup
     313: ldc           #164                // String substring(...)
     315: invokestatic  #170                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     318: astore        6
     320: aload_2
     321: aload_0
     322: getfield      #18                 // Field $memoizedGetDescendants:Lkotlin/reflect/KFunction;
     325: checkcast     #7                  // class kotlin/jvm/functions/Function2
     328: aload         6
     330: aload_0
     331: getfield      #22                 // Field $steps:I
     334: invokestatic  #174                // Method kotlin/coroutines/jvm/internal/Boxing.boxInt:(I)Ljava/lang/Integer;
     337: invokeinterface #177,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     342: aload_0
     343: checkcast     #149                // class kotlin/coroutines/Continuation
     346: aload_0
     347: aload_2
     348: putfield      #67                 // Field L$0:Ljava/lang/Object;
     351: aload_0
     352: iload         4
     354: putfield      #179                // Field I$0:I
     357: aload_0
     358: iload         5
     360: putfield      #181                // Field I$1:I
     363: aload_0
     364: iconst_2
     365: putfield      #58                 // Field label:I
     368: invokevirtual #153                // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
     371: dup
     372: aload         22
     374: if_acmpne     405
     377: aload         22
     379: areturn
     380: aload_0
     381: getfield      #181                // Field I$1:I
     384: istore        5
     386: aload_0
     387: getfield      #179                // Field I$0:I
     390: istore        4
     392: aload_0
     393: getfield      #67                 // Field L$0:Ljava/lang/Object;
     396: checkcast     #69                 // class kotlin/sequences/SequenceScope
     399: astore_2
     400: aload_1
     401: invokestatic  #64                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
     404: aload_1
     405: pop
     406: iload         4
     408: iload         5
     410: if_icmpeq     419
     413: iinc          4, 1
     416: goto          299
     419: getstatic     #187                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     422: areturn
     423: new           #189                // class java/lang/IllegalStateException
     426: dup
     427: ldc           #191                // String call to \'resume\' before \'invoke\' with coroutine
     429: invokespecial #194                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     432: athrow

  public final kotlin.coroutines.Continuation<kotlin.Unit> create(java.lang.Object, kotlin.coroutines.Continuation<?>);
    Code:
       0: new           #2                  // class day14/Day14Kt$solve$finalCount$1
       3: dup
       4: aload_0
       5: getfield      #14                 // Field $polymer:Ljava/lang/String;
       8: aload_0
       9: getfield      #18                 // Field $memoizedGetDescendants:Lkotlin/reflect/KFunction;
      12: aload_0
      13: getfield      #22                 // Field $steps:I
      16: aload_2
      17: invokespecial #223                // Method "<init>":(Ljava/lang/String;Lkotlin/reflect/KFunction;ILkotlin/coroutines/Continuation;)V
      20: astore_3
      21: aload_3
      22: aload_1
      23: putfield      #67                 // Field L$0:Ljava/lang/Object;
      26: aload_3
      27: checkcast     #149                // class kotlin/coroutines/Continuation
      30: areturn

  public final java.lang.Object invoke(kotlin.sequences.SequenceScope<? super java.util.Map<java.lang.Character, java.lang.Long>>, kotlin.coroutines.Continuation<? super kotlin.Unit>);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokevirtual #228                // Method create:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;
       6: checkcast     #2                  // class day14/Day14Kt$solve$finalCount$1
       9: getstatic     #187                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      12: invokevirtual #230                // Method invokeSuspend:(Ljava/lang/Object;)Ljava/lang/Object;
      15: areturn

  public java.lang.Object invoke(java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #69                 // class kotlin/sequences/SequenceScope
       5: aload_2
       6: checkcast     #149                // class kotlin/coroutines/Continuation
       9: invokevirtual #234                // Method invoke:(Lkotlin/sequences/SequenceScope;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
      12: areturn
}

Compiled from "Day14.kt"
final class day14.Day14Kt$memoizeCountDescendantChars$1$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function2<java.lang.String, java.lang.Integer, java.util.Map<java.lang.Character, ? extends java.lang.Long>> {
  final java.util.Map<kotlin.Pair<java.lang.String, java.lang.Integer>, java.util.Map<java.lang.Character, java.lang.Long>> $cache;

  final java.util.Map<java.lang.String, java.lang.Character> $insertions;

  day14.Day14Kt$memoizeCountDescendantChars$1$1(java.util.Map<kotlin.Pair<java.lang.String, java.lang.Integer>, java.util.Map<java.lang.Character, java.lang.Long>>, java.util.Map<java.lang.String, java.lang.Character>);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #14                 // Field $cache:Ljava/util/Map;
       5: aload_0
       6: aload_2
       7: putfield      #17                 // Field $insertions:Ljava/util/Map;
      10: aload_0
      11: iconst_2
      12: ldc           #19                 // class kotlin/jvm/internal/Intrinsics$Kotlin
      14: ldc           #21                 // String getAdditionCount
      16: ldc           #23                 // String memoizeCountDescendantChars$lambda$5$getAdditionCount(Ljava/util/Map;Ljava/util/Map;Ljava/lang/String;I)Ljava/util/Map;
      18: iconst_0
      19: invokespecial #26                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      22: return

  public final java.util.Map<java.lang.Character, java.lang.Long> invoke(java.lang.String, int);
    Code:
       0: aload_1
       1: ldc           #33                 // String p0
       3: invokestatic  #39                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #14                 // Field $cache:Ljava/util/Map;
      10: aload_0
      11: getfield      #17                 // Field $insertions:Ljava/util/Map;
      14: aload_1
      15: iload_2
      16: invokestatic  #45                 // Method day14/Day14Kt.access$memoizeCountDescendantChars$lambda$5$getAdditionCount:(Ljava/util/Map;Ljava/util/Map;Ljava/lang/String;I)Ljava/util/Map;
      19: areturn

  public java.lang.Object invoke(java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #51                 // class java/lang/String
       5: aload_2
       6: checkcast     #53                 // class java/lang/Number
       9: invokevirtual #57                 // Method java/lang/Number.intValue:()I
      12: invokevirtual #59                 // Method invoke:(Ljava/lang/String;I)Ljava/util/Map;
      15: areturn
}

Compiled from "_Strings.kt"
public final class day14.Day14Kt$solve$finalCount$1$invokeSuspend$$inlined$groupingBy$1 implements kotlin.collections.Grouping<java.lang.Character, java.lang.Character> {
  final java.lang.CharSequence $this_groupingBy;

  public day14.Day14Kt$solve$finalCount$1$invokeSuspend$$inlined$groupingBy$1(java.lang.CharSequence);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #18                 // Field $this_groupingBy:Ljava/lang/CharSequence;
       5: aload_0
       6: invokespecial #21                 // Method java/lang/Object."<init>":()V
       9: return

  public java.util.Iterator<java.lang.Character> sourceIterator();
    Code:
       0: aload_0
       1: getfield      #18                 // Field $this_groupingBy:Ljava/lang/CharSequence;
       4: invokestatic  #33                 // Method kotlin/text/StringsKt.iterator:(Ljava/lang/CharSequence;)Lkotlin/collections/CharIterator;
       7: checkcast     #35                 // class java/util/Iterator
      10: areturn

  public java.lang.Character keyOf(char);
    Code:
       0: iload_1
       1: istore_2
       2: iconst_0
       3: istore_3
       4: iload_2
       5: invokestatic  #43                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
       8: areturn

  public java.lang.Object keyOf(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #40                 // class java/lang/Character
       5: invokevirtual #53                 // Method java/lang/Character.charValue:()C
       8: invokevirtual #55                 // Method keyOf:(C)Ljava/lang/Object;
      11: areturn
}