fun main() {

    data class Common(val input: List<String>) {

        lateinit var moves: List<String>
        lateinit var stacks: List<ArrayDeque<Char>>

        init {
            parse()
        }

        fun parse() {
            val map = input.groupBy {
                when {
                    it.contains("move") -> "moves"
                    it.contains("[") -> "crates"
                    else -> "garbage"
                }
            }

            val maxStringLength = map["crates"]!!.maxOf { it.length }
            val crates = map["crates"]!!
                .map {
                    it.padEnd(maxStringLength)
                        .toList()
                        .chunked(4)
                        .map { list -> list[1] }
                }

            val rowLength = crates.first().size
            stacks = List(rowLength) { ArrayDeque() }

            crates.forEach {
                it.forEachIndexed {
                    i, c -> stacks[i].addLast(c)
                }
            }

            moves = map["moves"]!!.map {
                it.replace("move", "")
                  .replace("from", "")
                  .replace("to", "")
                  .trim()
            }
        }
    }

    fun part1(input: List<String>): String {
        val common = Common(input)

        common.moves.forEach {
            val (count, from, to) = it.split(" ").filterNot { s -> s.isBlank() }.map { n -> n.toInt() }
            repeat (count) {
                var element: Char
                do {
                    element = common.stacks[from - 1].removeFirst()
                } while(element == ' ')

                common.stacks[to-1].addFirst(element)
            }
        }

        return List(common.stacks.size) { i ->
            common.stacks[i].removeFirst()
        }.joinToString(separator = "")
    }

    fun part2(input: List<String>): String {
        val main = Common(input)

        main.moves.forEach {
            val (count, from, to) = it.split(" ").filterNot { s -> s.isBlank() }.map { n -> n.toInt() }
            val cratesToMove = mutableListOf<Char>()

            repeat (count) {
                if (main.stacks[from -1].isNotEmpty()) {
                    var element: Char
                    do {
                        element = main.stacks[from - 1].removeFirst()
                        if (element != ' ') {
                            cratesToMove.add(element)
                        }
                    } while (element == ' ')
                }
            }

            cratesToMove.reversed().forEach { c ->
                main.stacks[to - 1].addFirst(c)
            }
        }

        return List(main.stacks.size) { i ->
            main.stacks[i].removeFirst()
        }.joinToString(separator = "")
    }

    val input = readInput("inputs/Day05")
    println(part1(input))
    println(part2(input))
}

Compiled from "Day05.kt"
public final class Day05Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String inputs/Day05
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)Ljava/lang/String;
      10: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      13: swap
      14: invokevirtual #30                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      17: aload_0
      18: invokestatic  #33                 // Method main$part2:(Ljava/util/List;)Ljava/lang/String;
      21: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      24: swap
      25: invokevirtual #30                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      28: return

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

  private static final java.lang.String main$part1(java.util.List<java.lang.String>);
    Code:
       0: new           #43                 // class Day05Kt$main$Common
       3: dup
       4: aload_0
       5: invokespecial #47                 // Method Day05Kt$main$Common."<init>":(Ljava/util/List;)V
       8: astore_1
       9: aload_1
      10: invokevirtual #51                 // Method Day05Kt$main$Common.getMoves:()Ljava/util/List;
      13: checkcast     #53                 // class java/lang/Iterable
      16: astore_2
      17: iconst_0
      18: istore_3
      19: aload_2
      20: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      25: astore        4
      27: aload         4
      29: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      34: ifeq          422
      37: aload         4
      39: invokeinterface #67,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      44: astore        5
      46: aload         5
      48: checkcast     #69                 // class java/lang/String
      51: astore        6
      53: iconst_0
      54: istore        7
      56: aload         6
      58: checkcast     #71                 // class java/lang/CharSequence
      61: iconst_1
      62: anewarray     #69                 // class java/lang/String
      65: astore        8
      67: aload         8
      69: iconst_0
      70: ldc           #73                 // String
      72: aastore
      73: aload         8
      75: iconst_0
      76: iconst_0
      77: bipush        6
      79: aconst_null
      80: invokestatic  #79                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      83: checkcast     #53                 // class java/lang/Iterable
      86: astore        8
      88: iconst_0
      89: istore        9
      91: aload         8
      93: astore        10
      95: new           #81                 // class java/util/ArrayList
      98: dup
      99: invokespecial #83                 // Method java/util/ArrayList."<init>":()V
     102: checkcast     #85                 // class java/util/Collection
     105: astore        11
     107: iconst_0
     108: istore        12
     110: aload         10
     112: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     117: astore        13
     119: aload         13
     121: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     126: ifeq          172
     129: aload         13
     131: invokeinterface #67,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     136: astore        14
     138: aload         14
     140: checkcast     #69                 // class java/lang/String
     143: astore        15
     145: iconst_0
     146: istore        16
     148: aload         15
     150: checkcast     #71                 // class java/lang/CharSequence
     153: invokestatic  #89                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     156: ifne          119
     159: aload         11
     161: aload         14
     163: invokeinterface #93,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     168: pop
     169: goto          119
     172: aload         11
     174: checkcast     #95                 // class java/util/List
     177: nop
     178: checkcast     #53                 // class java/lang/Iterable
     181: astore        8
     183: nop
     184: iconst_0
     185: istore        9
     187: aload         8
     189: astore        10
     191: new           #81                 // class java/util/ArrayList
     194: dup
     195: aload         8
     197: bipush        10
     199: invokestatic  #101                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     202: invokespecial #104                // Method java/util/ArrayList."<init>":(I)V
     205: checkcast     #85                 // class java/util/Collection
     208: astore        11
     210: iconst_0
     211: istore        12
     213: aload         10
     215: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     220: astore        13
     222: aload         13
     224: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     229: ifeq          276
     232: aload         13
     234: invokeinterface #67,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     239: astore        14
     241: aload         11
     243: aload         14
     245: checkcast     #69                 // class java/lang/String
     248: astore        15
     250: astore        17
     252: iconst_0
     253: istore        16
     255: aload         15
     257: invokestatic  #110                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     260: nop
     261: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     264: aload         17
     266: swap
     267: invokeinterface #93,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     272: pop
     273: goto          222
     276: aload         11
     278: checkcast     #95                 // class java/util/List
     281: nop
     282: astore        18
     284: aload         18
     286: iconst_0
     287: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     292: checkcast     #120                // class java/lang/Number
     295: invokevirtual #124                // Method java/lang/Number.intValue:()I
     298: istore        8
     300: aload         18
     302: iconst_1
     303: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     308: checkcast     #120                // class java/lang/Number
     311: invokevirtual #124                // Method java/lang/Number.intValue:()I
     314: istore        9
     316: aload         18
     318: iconst_2
     319: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     324: checkcast     #120                // class java/lang/Number
     327: invokevirtual #124                // Method java/lang/Number.intValue:()I
     330: istore        10
     332: iconst_0
     333: istore        11
     335: iload         11
     337: iload         8
     339: if_icmpge     417
     342: iload         11
     344: istore        12
     346: iconst_0
     347: istore        13
     349: iconst_0
     350: istore        14
     352: aload_1
     353: invokevirtual #127                // Method Day05Kt$main$Common.getStacks:()Ljava/util/List;
     356: iload         9
     358: iconst_1
     359: isub
     360: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     365: checkcast     #129                // class kotlin/collections/ArrayDeque
     368: invokevirtual #132                // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;
     371: checkcast     #134                // class java/lang/Character
     374: invokevirtual #138                // Method java/lang/Character.charValue:()C
     377: istore        14
     379: iload         14
     381: bipush        32
     383: if_icmpeq     352
     386: aload_1
     387: invokevirtual #127                // Method Day05Kt$main$Common.getStacks:()Ljava/util/List;
     390: iload         10
     392: iconst_1
     393: isub
     394: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     399: checkcast     #129                // class kotlin/collections/ArrayDeque
     402: iload         14
     404: invokestatic  #141                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     407: invokevirtual #144                // Method kotlin/collections/ArrayDeque.addFirst:(Ljava/lang/Object;)V
     410: nop
     411: iinc          11, 1
     414: goto          335
     417: nop
     418: nop
     419: goto          27
     422: nop
     423: aload_1
     424: invokevirtual #127                // Method Day05Kt$main$Common.getStacks:()Ljava/util/List;
     427: invokeinterface #147,  1          // InterfaceMethod java/util/List.size:()I
     432: istore_2
     433: new           #81                 // class java/util/ArrayList
     436: dup
     437: iload_2
     438: invokespecial #104                // Method java/util/ArrayList."<init>":(I)V
     441: astore_3
     442: iconst_0
     443: istore        4
     445: iload         4
     447: iload_2
     448: if_icmpge     504
     451: iload         4
     453: istore        5
     455: aload_3
     456: iload         5
     458: istore        6
     460: astore        19
     462: iconst_0
     463: istore        7
     465: aload_1
     466: invokevirtual #127                // Method Day05Kt$main$Common.getStacks:()Ljava/util/List;
     469: iload         6
     471: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     476: checkcast     #129                // class kotlin/collections/ArrayDeque
     479: invokevirtual #132                // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;
     482: checkcast     #134                // class java/lang/Character
     485: invokevirtual #138                // Method java/lang/Character.charValue:()C
     488: invokestatic  #141                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     491: aload         19
     493: swap
     494: invokevirtual #148                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     497: pop
     498: iinc          4, 1
     501: goto          445
     504: aload_3
     505: checkcast     #95                 // class java/util/List
     508: checkcast     #53                 // class java/lang/Iterable
     511: ldc           #150                // String
     513: checkcast     #71                 // class java/lang/CharSequence
     516: aconst_null
     517: aconst_null
     518: iconst_0
     519: aconst_null
     520: aconst_null
     521: bipush        62
     523: aconst_null
     524: invokestatic  #154                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     527: areturn

  private static final java.lang.String main$part2(java.util.List<java.lang.String>);
    Code:
       0: new           #43                 // class Day05Kt$main$Common
       3: dup
       4: aload_0
       5: invokespecial #47                 // Method Day05Kt$main$Common."<init>":(Ljava/util/List;)V
       8: astore_1
       9: aload_1
      10: invokevirtual #51                 // Method Day05Kt$main$Common.getMoves:()Ljava/util/List;
      13: checkcast     #53                 // class java/lang/Iterable
      16: astore_2
      17: iconst_0
      18: istore_3
      19: aload_2
      20: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      25: astore        4
      27: aload         4
      29: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      34: ifeq          549
      37: aload         4
      39: invokeinterface #67,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      44: astore        5
      46: aload         5
      48: checkcast     #69                 // class java/lang/String
      51: astore        6
      53: iconst_0
      54: istore        7
      56: aload         6
      58: checkcast     #71                 // class java/lang/CharSequence
      61: iconst_1
      62: anewarray     #69                 // class java/lang/String
      65: astore        8
      67: aload         8
      69: iconst_0
      70: ldc           #73                 // String
      72: aastore
      73: aload         8
      75: iconst_0
      76: iconst_0
      77: bipush        6
      79: aconst_null
      80: invokestatic  #79                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      83: checkcast     #53                 // class java/lang/Iterable
      86: astore        8
      88: iconst_0
      89: istore        9
      91: aload         8
      93: astore        10
      95: new           #81                 // class java/util/ArrayList
      98: dup
      99: invokespecial #83                 // Method java/util/ArrayList."<init>":()V
     102: checkcast     #85                 // class java/util/Collection
     105: astore        11
     107: iconst_0
     108: istore        12
     110: aload         10
     112: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     117: astore        13
     119: aload         13
     121: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     126: ifeq          172
     129: aload         13
     131: invokeinterface #67,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     136: astore        14
     138: aload         14
     140: checkcast     #69                 // class java/lang/String
     143: astore        15
     145: iconst_0
     146: istore        16
     148: aload         15
     150: checkcast     #71                 // class java/lang/CharSequence
     153: invokestatic  #89                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     156: ifne          119
     159: aload         11
     161: aload         14
     163: invokeinterface #93,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     168: pop
     169: goto          119
     172: aload         11
     174: checkcast     #95                 // class java/util/List
     177: nop
     178: checkcast     #53                 // class java/lang/Iterable
     181: astore        8
     183: nop
     184: iconst_0
     185: istore        9
     187: aload         8
     189: astore        10
     191: new           #81                 // class java/util/ArrayList
     194: dup
     195: aload         8
     197: bipush        10
     199: invokestatic  #101                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     202: invokespecial #104                // Method java/util/ArrayList."<init>":(I)V
     205: checkcast     #85                 // class java/util/Collection
     208: astore        11
     210: iconst_0
     211: istore        12
     213: aload         10
     215: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     220: astore        13
     222: aload         13
     224: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     229: ifeq          276
     232: aload         13
     234: invokeinterface #67,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     239: astore        14
     241: aload         11
     243: aload         14
     245: checkcast     #69                 // class java/lang/String
     248: astore        15
     250: astore        17
     252: iconst_0
     253: istore        16
     255: aload         15
     257: invokestatic  #110                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     260: nop
     261: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     264: aload         17
     266: swap
     267: invokeinterface #93,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     272: pop
     273: goto          222
     276: aload         11
     278: checkcast     #95                 // class java/util/List
     281: nop
     282: astore        18
     284: aload         18
     286: iconst_0
     287: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     292: checkcast     #120                // class java/lang/Number
     295: invokevirtual #124                // Method java/lang/Number.intValue:()I
     298: istore        8
     300: aload         18
     302: iconst_1
     303: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     308: checkcast     #120                // class java/lang/Number
     311: invokevirtual #124                // Method java/lang/Number.intValue:()I
     314: istore        9
     316: aload         18
     318: iconst_2
     319: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     324: checkcast     #120                // class java/lang/Number
     327: invokevirtual #124                // Method java/lang/Number.intValue:()I
     330: istore        10
     332: new           #81                 // class java/util/ArrayList
     335: dup
     336: invokespecial #83                 // Method java/util/ArrayList."<init>":()V
     339: checkcast     #95                 // class java/util/List
     342: astore        11
     344: iconst_0
     345: istore        12
     347: iload         12
     349: iload         8
     351: if_icmpge     457
     354: iload         12
     356: istore        13
     358: iconst_0
     359: istore        14
     361: aload_1
     362: invokevirtual #127                // Method Day05Kt$main$Common.getStacks:()Ljava/util/List;
     365: iload         9
     367: iconst_1
     368: isub
     369: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     374: checkcast     #85                 // class java/util/Collection
     377: invokeinterface #192,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     382: ifne          389
     385: iconst_1
     386: goto          390
     389: iconst_0
     390: ifeq          450
     393: iconst_0
     394: istore        15
     396: aload_1
     397: invokevirtual #127                // Method Day05Kt$main$Common.getStacks:()Ljava/util/List;
     400: iload         9
     402: iconst_1
     403: isub
     404: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     409: checkcast     #129                // class kotlin/collections/ArrayDeque
     412: invokevirtual #132                // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;
     415: checkcast     #134                // class java/lang/Character
     418: invokevirtual #138                // Method java/lang/Character.charValue:()C
     421: istore        15
     423: iload         15
     425: bipush        32
     427: if_icmpeq     443
     430: aload         11
     432: iload         15
     434: invokestatic  #141                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     437: invokeinterface #193,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     442: pop
     443: iload         15
     445: bipush        32
     447: if_icmpeq     396
     450: nop
     451: iinc          12, 1
     454: goto          347
     457: aload         11
     459: checkcast     #53                 // class java/lang/Iterable
     462: invokestatic  #197                // Method kotlin/collections/CollectionsKt.reversed:(Ljava/lang/Iterable;)Ljava/util/List;
     465: checkcast     #53                 // class java/lang/Iterable
     468: astore        12
     470: iconst_0
     471: istore        13
     473: aload         12
     475: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     480: astore        14
     482: aload         14
     484: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     489: ifeq          543
     492: aload         14
     494: invokeinterface #67,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     499: astore        15
     501: aload         15
     503: checkcast     #134                // class java/lang/Character
     506: invokevirtual #138                // Method java/lang/Character.charValue:()C
     509: istore        16
     511: iconst_0
     512: istore        19
     514: aload_1
     515: invokevirtual #127                // Method Day05Kt$main$Common.getStacks:()Ljava/util/List;
     518: iload         10
     520: iconst_1
     521: isub
     522: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     527: checkcast     #129                // class kotlin/collections/ArrayDeque
     530: iload         16
     532: invokestatic  #141                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     535: invokevirtual #144                // Method kotlin/collections/ArrayDeque.addFirst:(Ljava/lang/Object;)V
     538: nop
     539: nop
     540: goto          482
     543: nop
     544: nop
     545: nop
     546: goto          27
     549: nop
     550: aload_1
     551: invokevirtual #127                // Method Day05Kt$main$Common.getStacks:()Ljava/util/List;
     554: invokeinterface #147,  1          // InterfaceMethod java/util/List.size:()I
     559: istore_2
     560: new           #81                 // class java/util/ArrayList
     563: dup
     564: iload_2
     565: invokespecial #104                // Method java/util/ArrayList."<init>":(I)V
     568: astore_3
     569: iconst_0
     570: istore        4
     572: iload         4
     574: iload_2
     575: if_icmpge     631
     578: iload         4
     580: istore        5
     582: aload_3
     583: iload         5
     585: istore        6
     587: astore        20
     589: iconst_0
     590: istore        7
     592: aload_1
     593: invokevirtual #127                // Method Day05Kt$main$Common.getStacks:()Ljava/util/List;
     596: iload         6
     598: invokeinterface #118,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     603: checkcast     #129                // class kotlin/collections/ArrayDeque
     606: invokevirtual #132                // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;
     609: checkcast     #134                // class java/lang/Character
     612: invokevirtual #138                // Method java/lang/Character.charValue:()C
     615: invokestatic  #141                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     618: aload         20
     620: swap
     621: invokevirtual #148                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     624: pop
     625: iinc          4, 1
     628: goto          572
     631: aload_3
     632: checkcast     #95                 // class java/util/List
     635: checkcast     #53                 // class java/lang/Iterable
     638: ldc           #150                // String
     640: checkcast     #71                 // class java/lang/CharSequence
     643: aconst_null
     644: aconst_null
     645: iconst_0
     646: aconst_null
     647: aconst_null
     648: bipush        62
     650: aconst_null
     651: invokestatic  #154                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     654: areturn
}

Compiled from "Day05.kt"
public final class Day05Kt$main$Common {
  private final java.util.List<java.lang.String> input;

  public java.util.List<java.lang.String> moves;

  public java.util.List<kotlin.collections.ArrayDeque<java.lang.Character>> stacks;

  public Day05Kt$main$Common(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #9                  // String input
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #18                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #21                 // Field input:Ljava/util/List;
      15: nop
      16: aload_0
      17: invokevirtual #24                 // Method parse:()V
      20: nop
      21: return

  public final java.util.List<java.lang.String> getInput();
    Code:
       0: aload_0
       1: getfield      #21                 // Field input:Ljava/util/List;
       4: areturn

  public final java.util.List<java.lang.String> getMoves();
    Code:
       0: aload_0
       1: getfield      #33                 // Field moves:Ljava/util/List;
       4: dup
       5: ifnull        9
       8: areturn
       9: pop
      10: ldc           #34                 // String moves
      12: invokestatic  #38                 // Method kotlin/jvm/internal/Intrinsics.throwUninitializedPropertyAccessException:(Ljava/lang/String;)V
      15: aconst_null
      16: areturn

  public final void setMoves(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #43                 // String <set-?>
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: putfield      #33                 // Field moves:Ljava/util/List;
      11: return

  public final java.util.List<kotlin.collections.ArrayDeque<java.lang.Character>> getStacks();
    Code:
       0: aload_0
       1: getfield      #48                 // Field stacks:Ljava/util/List;
       4: dup
       5: ifnull        9
       8: areturn
       9: pop
      10: ldc           #49                 // String stacks
      12: invokestatic  #38                 // Method kotlin/jvm/internal/Intrinsics.throwUninitializedPropertyAccessException:(Ljava/lang/String;)V
      15: aconst_null
      16: areturn

  public final void setStacks(java.util.List<kotlin.collections.ArrayDeque<java.lang.Character>>);
    Code:
       0: aload_1
       1: ldc           #43                 // String <set-?>
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: putfield      #48                 // Field stacks:Ljava/util/List;
      11: return

  public final void parse();
    Code:
       0: aload_0
       1: getfield      #21                 // Field input:Ljava/util/List;
       4: checkcast     #53                 // class java/lang/Iterable
       7: astore_2
       8: iconst_0
       9: istore_3
      10: aload_2
      11: astore        4
      13: new           #55                 // class java/util/LinkedHashMap
      16: dup
      17: invokespecial #56                 // Method java/util/LinkedHashMap."<init>":()V
      20: checkcast     #58                 // class java/util/Map
      23: astore        5
      25: iconst_0
      26: istore        6
      28: aload         4
      30: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      35: astore        7
      37: aload         7
      39: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      44: ifeq          196
      47: aload         7
      49: invokeinterface #72,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      54: astore        8
      56: aload         8
      58: checkcast     #74                 // class java/lang/String
      61: astore        9
      63: iconst_0
      64: istore        10
      66: nop
      67: aload         9
      69: checkcast     #76                 // class java/lang/CharSequence
      72: ldc           #78                 // String move
      74: checkcast     #76                 // class java/lang/CharSequence
      77: iconst_0
      78: iconst_2
      79: aconst_null
      80: invokestatic  #84                 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z
      83: ifeq          91
      86: ldc           #34                 // String moves
      88: goto          117
      91: aload         9
      93: checkcast     #76                 // class java/lang/CharSequence
      96: ldc           #86                 // String [
      98: checkcast     #76                 // class java/lang/CharSequence
     101: iconst_0
     102: iconst_2
     103: aconst_null
     104: invokestatic  #84                 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z
     107: ifeq          115
     110: ldc           #88                 // String crates
     112: goto          117
     115: ldc           #90                 // String garbage
     117: nop
     118: astore        11
     120: aload         5
     122: astore        12
     124: iconst_0
     125: istore        13
     127: aload         12
     129: aload         11
     131: invokeinterface #94,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     136: astore        14
     138: aload         14
     140: ifnonnull     175
     143: iconst_0
     144: istore        15
     146: new           #96                 // class java/util/ArrayList
     149: dup
     150: invokespecial #97                 // Method java/util/ArrayList."<init>":()V
     153: checkcast     #40                 // class java/util/List
     156: astore        15
     158: aload         12
     160: aload         11
     162: aload         15
     164: invokeinterface #101,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     169: pop
     170: aload         15
     172: goto          177
     175: aload         14
     177: nop
     178: checkcast     #40                 // class java/util/List
     181: astore        9
     183: aload         9
     185: aload         8
     187: invokeinterface #105,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     192: pop
     193: goto          37
     196: aload         5
     198: nop
     199: astore_1
     200: aload_1
     201: ldc           #88                 // String crates
     203: invokeinterface #94,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     208: dup
     209: invokestatic  #109                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     212: checkcast     #53                 // class java/lang/Iterable
     215: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     220: astore        4
     222: aload         4
     224: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     229: ifne          240
     232: new           #111                // class java/util/NoSuchElementException
     235: dup
     236: invokespecial #112                // Method java/util/NoSuchElementException."<init>":()V
     239: athrow
     240: aload         4
     242: invokeinterface #72,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     247: checkcast     #74                 // class java/lang/String
     250: astore        5
     252: iconst_0
     253: istore        6
     255: aload         5
     257: invokevirtual #116                // Method java/lang/String.length:()I
     260: istore        5
     262: aload         4
     264: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     269: ifeq          308
     272: aload         4
     274: invokeinterface #72,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     279: checkcast     #74                 // class java/lang/String
     282: astore        6
     284: iconst_0
     285: istore        7
     287: aload         6
     289: invokevirtual #116                // Method java/lang/String.length:()I
     292: istore        6
     294: iload         5
     296: iload         6
     298: if_icmpge     262
     301: iload         6
     303: istore        5
     305: goto          262
     308: iload         5
     310: istore_2
     311: aload_1
     312: ldc           #88                 // String crates
     314: invokeinterface #94,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     319: dup
     320: invokestatic  #109                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     323: checkcast     #53                 // class java/lang/Iterable
     326: astore        4
     328: nop
     329: iconst_0
     330: istore        5
     332: aload         4
     334: astore        6
     336: new           #96                 // class java/util/ArrayList
     339: dup
     340: aload         4
     342: bipush        10
     344: invokestatic  #122                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     347: invokespecial #125                // Method java/util/ArrayList."<init>":(I)V
     350: checkcast     #127                // class java/util/Collection
     353: astore        7
     355: iconst_0
     356: istore        8
     358: aload         6
     360: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     365: astore        9
     367: aload         9
     369: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     374: ifeq          547
     377: aload         9
     379: invokeinterface #72,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     384: astore        10
     386: aload         7
     388: aload         10
     390: checkcast     #74                 // class java/lang/String
     393: astore        11
     395: astore        23
     397: iconst_0
     398: istore        12
     400: aload         11
     402: iload_2
     403: iconst_0
     404: iconst_2
     405: aconst_null
     406: invokestatic  #131                // Method kotlin/text/StringsKt.padEnd$default:(Ljava/lang/String;ICILjava/lang/Object;)Ljava/lang/String;
     409: checkcast     #76                 // class java/lang/CharSequence
     412: invokestatic  #135                // Method kotlin/text/StringsKt.toList:(Ljava/lang/CharSequence;)Ljava/util/List;
     415: checkcast     #53                 // class java/lang/Iterable
     418: iconst_4
     419: invokestatic  #139                // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;I)Ljava/util/List;
     422: checkcast     #53                 // class java/lang/Iterable
     425: astore        13
     427: nop
     428: iconst_0
     429: istore        14
     431: aload         13
     433: astore        15
     435: new           #96                 // class java/util/ArrayList
     438: dup
     439: aload         13
     441: bipush        10
     443: invokestatic  #122                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     446: invokespecial #125                // Method java/util/ArrayList."<init>":(I)V
     449: checkcast     #127                // class java/util/Collection
     452: astore        16
     454: iconst_0
     455: istore        17
     457: aload         15
     459: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     464: astore        18
     466: aload         18
     468: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     473: ifeq          528
     476: aload         18
     478: invokeinterface #72,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     483: astore        19
     485: aload         16
     487: aload         19
     489: checkcast     #40                 // class java/util/List
     492: astore        20
     494: astore        21
     496: iconst_0
     497: istore        22
     499: aload         20
     501: iconst_1
     502: invokeinterface #142,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     507: checkcast     #144                // class java/lang/Character
     510: invokevirtual #148                // Method java/lang/Character.charValue:()C
     513: invokestatic  #152                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     516: aload         21
     518: swap
     519: invokeinterface #153,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     524: pop
     525: goto          466
     528: aload         16
     530: checkcast     #40                 // class java/util/List
     533: nop
     534: nop
     535: aload         23
     537: swap
     538: invokeinterface #153,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     543: pop
     544: goto          367
     547: aload         7
     549: checkcast     #40                 // class java/util/List
     552: nop
     553: astore_3
     554: aload_3
     555: invokestatic  #157                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     558: checkcast     #40                 // class java/util/List
     561: invokeinterface #160,  1          // InterfaceMethod java/util/List.size:()I
     566: istore        4
     568: aload_0
     569: astore        23
     571: new           #96                 // class java/util/ArrayList
     574: dup
     575: iload         4
     577: invokespecial #125                // Method java/util/ArrayList."<init>":(I)V
     580: astore        5
     582: iconst_0
     583: istore        6
     585: iload         6
     587: iload         4
     589: if_icmpge     627
     592: iload         6
     594: istore        7
     596: aload         5
     598: iload         7
     600: istore        8
     602: astore        24
     604: iconst_0
     605: istore        9
     607: new           #162                // class kotlin/collections/ArrayDeque
     610: dup
     611: invokespecial #163                // Method kotlin/collections/ArrayDeque."<init>":()V
     614: aload         24
     616: swap
     617: invokevirtual #164                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     620: pop
     621: iinc          6, 1
     624: goto          585
     627: aload         5
     629: checkcast     #40                 // class java/util/List
     632: aload         23
     634: swap
     635: invokevirtual #166                // Method setStacks:(Ljava/util/List;)V
     638: aload_3
     639: checkcast     #53                 // class java/lang/Iterable
     642: astore        5
     644: iconst_0
     645: istore        6
     647: aload         5
     649: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     654: astore        7
     656: aload         7
     658: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     663: ifeq          791
     666: aload         7
     668: invokeinterface #72,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     673: astore        8
     675: aload         8
     677: checkcast     #40                 // class java/util/List
     680: astore        9
     682: iconst_0
     683: istore        10
     685: aload         9
     687: checkcast     #53                 // class java/lang/Iterable
     690: astore        11
     692: iconst_0
     693: istore        12
     695: iconst_0
     696: istore        13
     698: aload         11
     700: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     705: astore        14
     707: aload         14
     709: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     714: ifeq          785
     717: aload         14
     719: invokeinterface #72,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     724: astore        15
     726: iload         13
     728: iinc          13, 1
     731: istore        16
     733: iload         16
     735: ifge          741
     738: invokestatic  #169                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     741: iload         16
     743: aload         15
     745: checkcast     #144                // class java/lang/Character
     748: invokevirtual #148                // Method java/lang/Character.charValue:()C
     751: istore        17
     753: istore        18
     755: iconst_0
     756: istore        19
     758: aload_0
     759: invokevirtual #171                // Method getStacks:()Ljava/util/List;
     762: iload         18
     764: invokeinterface #142,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     769: checkcast     #162                // class kotlin/collections/ArrayDeque
     772: iload         17
     774: invokestatic  #152                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     777: invokevirtual #174                // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     780: nop
     781: nop
     782: goto          707
     785: nop
     786: nop
     787: nop
     788: goto          656
     791: nop
     792: aload_0
     793: aload_1
     794: ldc           #34                 // String moves
     796: invokeinterface #94,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     801: dup
     802: invokestatic  #109                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     805: checkcast     #53                 // class java/lang/Iterable
     808: astore        5
     810: astore        23
     812: iconst_0
     813: istore        6
     815: aload         5
     817: astore        7
     819: new           #96                 // class java/util/ArrayList
     822: dup
     823: aload         5
     825: bipush        10
     827: invokestatic  #122                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     830: invokespecial #125                // Method java/util/ArrayList."<init>":(I)V
     833: checkcast     #127                // class java/util/Collection
     836: astore        8
     838: iconst_0
     839: istore        9
     841: aload         7
     843: invokeinterface #62,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     848: astore        10
     850: aload         10
     852: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     857: ifeq          938
     860: aload         10
     862: invokeinterface #72,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     867: astore        11
     869: aload         8
     871: aload         11
     873: checkcast     #74                 // class java/lang/String
     876: astore        12
     878: astore        24
     880: iconst_0
     881: istore        13
     883: nop
     884: aload         12
     886: ldc           #78                 // String move
     888: ldc           #176                // String
     890: iconst_0
     891: iconst_4
     892: aconst_null
     893: invokestatic  #180                // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
     896: ldc           #182                // String from
     898: ldc           #176                // String
     900: iconst_0
     901: iconst_4
     902: aconst_null
     903: invokestatic  #180                // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
     906: ldc           #184                // String to
     908: ldc           #176                // String
     910: iconst_0
     911: iconst_4
     912: aconst_null
     913: invokestatic  #180                // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
     916: checkcast     #76                 // class java/lang/CharSequence
     919: invokestatic  #188                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     922: invokevirtual #192                // Method java/lang/Object.toString:()Ljava/lang/String;
     925: nop
     926: aload         24
     928: swap
     929: invokeinterface #153,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     934: pop
     935: goto          850
     938: aload         8
     940: checkcast     #40                 // class java/util/List
     943: nop
     944: aload         23
     946: swap
     947: invokevirtual #194                // Method setMoves:(Ljava/util/List;)V
     950: return

  public final java.util.List<java.lang.String> component1();
    Code:
       0: aload_0
       1: getfield      #21                 // Field input:Ljava/util/List;
       4: areturn

  public final Day05Kt$main$Common copy(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #9                  // String input
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class Day05Kt$main$Common
       9: dup
      10: aload_1
      11: invokespecial #247                // Method "<init>":(Ljava/util/List;)V
      14: areturn

  public static Day05Kt$main$Common copy$default(Day05Kt$main$Common, java.util.List, int, java.lang.Object);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #21                 // Field input:Ljava/util/List;
      10: astore_1
      11: aload_0
      12: aload_1
      13: invokevirtual #251                // Method copy:(Ljava/util/List;)LDay05Kt$main$Common;
      16: areturn

  public java.lang.String toString();
    Code:
       0: new           #253                // class java/lang/StringBuilder
       3: dup
       4: invokespecial #254                // Method java/lang/StringBuilder."<init>":()V
       7: ldc_w         #256                // String Common(input=
      10: invokevirtual #260                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      13: aload_0
      14: getfield      #21                 // Field input:Ljava/util/List;
      17: invokevirtual #263                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      20: bipush        41
      22: invokevirtual #266                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      25: invokevirtual #267                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      28: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #21                 // Field input:Ljava/util/List;
       4: invokevirtual #270                // Method java/lang/Object.hashCode:()I
       7: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class Day05Kt$main$Common
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day05Kt$main$Common
      20: astore_2
      21: aload_0
      22: getfield      #21                 // Field input:Ljava/util/List;
      25: aload_2
      26: getfield      #21                 // Field input:Ljava/util/List;
      29: invokestatic  #275                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: iconst_1
      38: ireturn
}


fun main() {

    data class Monkey(val name: String, val expr: String)
    fun Monkey.evaluateExpr(map: MutableMap<String, Long>): Long? {
        val parts = this.expr.split(" ")
        if (parts.size == 1) {
            return parts[0].toLong()
        }

        val name1 = parts.first()
        val name2 = parts.last()
        val operator = parts[1]

        if (operator == "=") {
            if (name1 in map) {
                map[name2] = map[name1]!!
            } else if (name2 in map) {
                map[name1] = map[name2]!!
            }
        } else {
            if (name1 in map && name2 in map) {
                val value1 = map[name1]!!
                val value2 = map[name2]!!
                return when (operator) {
                    "+" -> value1 + value2
                    "-" -> value1 - value2
                    "*" -> value1 * value2
                    "/" -> value1 / value2
                    else -> null
                }
            }
        }

        return null
    }
    fun Monkey.variants(): List<Monkey> {
        val parts = this.expr.split(" ")
        if (parts.size == 1) {
            return listOf(this)
        }

        val name1 = parts.first()
        val name2 = parts.last()
        val operator = parts[1]

        return when (operator) {
            "+" -> listOf(this, Monkey(name1, "$name - $name2"), Monkey(name2, "$name - $name1"))
            "-" -> listOf(this, Monkey(name1, "$name + $name2"), Monkey(name2, "$name1 - $name"))
            "*" -> listOf(this, Monkey(name1, "$name / $name2"), Monkey(name2, "$name / $name1"))
            "/" -> listOf(this, Monkey(name1, "$name * $name2"), Monkey(name2, "$name1 / $name"))
            else -> listOf(this)
        }
    }

    fun List<Monkey>.calc(need: String): Long {
        val map = mutableMapOf<String, Long>()

        while (need !in map) {
            forEach {
                if (map[it.name] == null) {
                    it.evaluateExpr(map)?.let { result ->
                        map[it.name] = result
                    }
                }
            }
        }

        return map[need]!!
    }

    fun part1(input: List<String>) =
        input.map {
                val (name, expr) = it.split(": ")
                Monkey(name, expr)
            }
            .calc("root")

    fun part2(input: List<String>) =
        input.flatMap {
                val (name, expr) = it.split(": ")
                when (name) {
                    "root" -> Monkey(name, expr.replace("+", "=")).variants()
                    else -> Monkey(name, expr).variants()
                }
            }
            .filterNot { it.name == "humn" && it.expr.split(" ").size == 1 }
            .calc("humn")

    val input = readInput("inputs/Day21")
    println(part1(input))
    println(part2(input))
}

Compiled from "Day21.kt"
public final class Day21Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String inputs/Day21
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)J
      10: lstore_1
      11: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      14: lload_1
      15: invokevirtual #30                 // Method java/io/PrintStream.println:(J)V
      18: aload_0
      19: invokestatic  #33                 // Method main$part2:(Ljava/util/List;)J
      22: lstore_1
      23: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      26: lload_1
      27: invokevirtual #30                 // Method java/io/PrintStream.println:(J)V
      30: return

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

  private static final java.lang.Long main$evaluateExpr(Day21Kt$main$Monkey, java.util.Map<java.lang.String, java.lang.Long>);
    Code:
       0: aload_0
       1: invokevirtual #49                 // Method Day21Kt$main$Monkey.getExpr:()Ljava/lang/String;
       4: checkcast     #51                 // class java/lang/CharSequence
       7: iconst_1
       8: anewarray     #53                 // class java/lang/String
      11: astore_3
      12: aload_3
      13: iconst_0
      14: ldc           #55                 // String
      16: aastore
      17: aload_3
      18: iconst_0
      19: iconst_0
      20: bipush        6
      22: aconst_null
      23: invokestatic  #61                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      26: astore_2
      27: aload_2
      28: invokeinterface #67,  1           // InterfaceMethod java/util/List.size:()I
      33: iconst_1
      34: if_icmpne     54
      37: aload_2
      38: iconst_0
      39: invokeinterface #71,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      44: checkcast     #53                 // class java/lang/String
      47: invokestatic  #77                 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
      50: invokestatic  #81                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      53: areturn
      54: aload_2
      55: invokestatic  #87                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      58: checkcast     #53                 // class java/lang/String
      61: astore_3
      62: aload_2
      63: invokestatic  #90                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      66: checkcast     #53                 // class java/lang/String
      69: astore        4
      71: aload_2
      72: iconst_1
      73: invokeinterface #71,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      78: checkcast     #53                 // class java/lang/String
      81: astore        5
      83: aload         5
      85: ldc           #92                 // String =
      87: invokestatic  #98                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      90: ifeq          160
      93: aload_1
      94: aload_3
      95: invokeinterface #104,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
     100: ifeq          126
     103: aload_1
     104: aload         4
     106: aload_1
     107: aload_3
     108: invokeinterface #107,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     113: dup
     114: invokestatic  #111                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     117: invokeinterface #115,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     122: pop
     123: goto          366
     126: aload_1
     127: aload         4
     129: invokeinterface #104,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
     134: ifeq          366
     137: aload_1
     138: aload_3
     139: aload_1
     140: aload         4
     142: invokeinterface #107,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     147: dup
     148: invokestatic  #111                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     151: invokeinterface #115,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     156: pop
     157: goto          366
     160: aload_1
     161: aload_3
     162: invokeinterface #104,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
     167: ifeq          366
     170: aload_1
     171: aload         4
     173: invokeinterface #104,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
     178: ifeq          366
     181: aload_1
     182: aload_3
     183: invokeinterface #107,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     188: dup
     189: invokestatic  #111                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     192: checkcast     #117                // class java/lang/Number
     195: invokevirtual #121                // Method java/lang/Number.longValue:()J
     198: lstore        6
     200: aload_1
     201: aload         4
     203: invokeinterface #107,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     208: dup
     209: invokestatic  #111                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     212: checkcast     #117                // class java/lang/Number
     215: invokevirtual #121                // Method java/lang/Number.longValue:()J
     218: lstore        8
     220: aload         5
     222: astore        10
     224: aload         10
     226: invokevirtual #124                // Method java/lang/String.hashCode:()I
     229: tableswitch   { // 42 to 47
                    42: 268
                    43: 281
                    44: 364
                    45: 294
                    46: 364
                    47: 307
               default: 364
          }
     268: aload         10
     270: ldc           #126                // String *
     272: invokevirtual #129                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     275: ifne          342
     278: goto          364
     281: aload         10
     283: ldc           #131                // String +
     285: invokevirtual #129                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     288: ifne          320
     291: goto          364
     294: aload         10
     296: ldc           #133                // String -
     298: invokevirtual #129                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     301: ifne          331
     304: goto          364
     307: aload         10
     309: ldc           #135                // String /
     311: invokevirtual #129                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     314: ifne          353
     317: goto          364
     320: lload         6
     322: lload         8
     324: ladd
     325: invokestatic  #81                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     328: goto          365
     331: lload         6
     333: lload         8
     335: lsub
     336: invokestatic  #81                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     339: goto          365
     342: lload         6
     344: lload         8
     346: lmul
     347: invokestatic  #81                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     350: goto          365
     353: lload         6
     355: lload         8
     357: ldiv
     358: invokestatic  #81                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     361: goto          365
     364: aconst_null
     365: areturn
     366: aconst_null
     367: areturn

  private static final java.util.List<Day21Kt$main$Monkey> main$variants(Day21Kt$main$Monkey);
    Code:
       0: aload_0
       1: invokevirtual #49                 // Method Day21Kt$main$Monkey.getExpr:()Ljava/lang/String;
       4: checkcast     #51                 // class java/lang/CharSequence
       7: iconst_1
       8: anewarray     #53                 // class java/lang/String
      11: astore_2
      12: aload_2
      13: iconst_0
      14: ldc           #55                 // String
      16: aastore
      17: aload_2
      18: iconst_0
      19: iconst_0
      20: bipush        6
      22: aconst_null
      23: invokestatic  #61                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      26: astore_1
      27: aload_1
      28: invokeinterface #67,  1           // InterfaceMethod java/util/List.size:()I
      33: iconst_1
      34: if_icmpne     42
      37: aload_0
      38: invokestatic  #155                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      41: areturn
      42: aload_1
      43: invokestatic  #87                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      46: checkcast     #53                 // class java/lang/String
      49: astore_2
      50: aload_1
      51: invokestatic  #90                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      54: checkcast     #53                 // class java/lang/String
      57: astore_3
      58: aload_1
      59: iconst_1
      60: invokeinterface #71,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      65: checkcast     #53                 // class java/lang/String
      68: astore        4
      70: aload         4
      72: astore        5
      74: aload         5
      76: invokevirtual #124                // Method java/lang/String.hashCode:()I
      79: tableswitch   { // 42 to 47
                    42: 116
                    43: 129
                    44: 548
                    45: 142
                    46: 548
                    47: 155
               default: 548
          }
     116: aload         5
     118: ldc           #126                // String *
     120: invokevirtual #129                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     123: ifne          358
     126: goto          548
     129: aload         5
     131: ldc           #131                // String +
     133: invokevirtual #129                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     136: ifne          168
     139: goto          548
     142: aload         5
     144: ldc           #133                // String -
     146: invokevirtual #129                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     149: ifne          263
     152: goto          548
     155: aload         5
     157: ldc           #135                // String /
     159: invokevirtual #129                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     162: ifne          453
     165: goto          548
     168: iconst_3
     169: anewarray     #45                 // class Day21Kt$main$Monkey
     172: astore        6
     174: aload         6
     176: iconst_0
     177: aload_0
     178: aastore
     179: aload         6
     181: iconst_1
     182: new           #45                 // class Day21Kt$main$Monkey
     185: dup
     186: aload_2
     187: new           #157                // class java/lang/StringBuilder
     190: dup
     191: invokespecial #160                // Method java/lang/StringBuilder."<init>":()V
     194: aload_0
     195: invokevirtual #163                // Method Day21Kt$main$Monkey.getName:()Ljava/lang/String;
     198: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     201: ldc           #169                // String  -
     203: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     206: aload_3
     207: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     210: invokevirtual #172                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     213: invokespecial #175                // Method Day21Kt$main$Monkey."<init>":(Ljava/lang/String;Ljava/lang/String;)V
     216: aastore
     217: aload         6
     219: iconst_2
     220: new           #45                 // class Day21Kt$main$Monkey
     223: dup
     224: aload_3
     225: new           #157                // class java/lang/StringBuilder
     228: dup
     229: invokespecial #160                // Method java/lang/StringBuilder."<init>":()V
     232: aload_0
     233: invokevirtual #163                // Method Day21Kt$main$Monkey.getName:()Ljava/lang/String;
     236: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     239: ldc           #169                // String  -
     241: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     244: aload_2
     245: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     248: invokevirtual #172                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     251: invokespecial #175                // Method Day21Kt$main$Monkey."<init>":(Ljava/lang/String;Ljava/lang/String;)V
     254: aastore
     255: aload         6
     257: invokestatic  #178                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     260: goto          552
     263: iconst_3
     264: anewarray     #45                 // class Day21Kt$main$Monkey
     267: astore        6
     269: aload         6
     271: iconst_0
     272: aload_0
     273: aastore
     274: aload         6
     276: iconst_1
     277: new           #45                 // class Day21Kt$main$Monkey
     280: dup
     281: aload_2
     282: new           #157                // class java/lang/StringBuilder
     285: dup
     286: invokespecial #160                // Method java/lang/StringBuilder."<init>":()V
     289: aload_0
     290: invokevirtual #163                // Method Day21Kt$main$Monkey.getName:()Ljava/lang/String;
     293: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     296: ldc           #180                // String  +
     298: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     301: aload_3
     302: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     305: invokevirtual #172                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     308: invokespecial #175                // Method Day21Kt$main$Monkey."<init>":(Ljava/lang/String;Ljava/lang/String;)V
     311: aastore
     312: aload         6
     314: iconst_2
     315: new           #45                 // class Day21Kt$main$Monkey
     318: dup
     319: aload_3
     320: new           #157                // class java/lang/StringBuilder
     323: dup
     324: invokespecial #160                // Method java/lang/StringBuilder."<init>":()V
     327: aload_2
     328: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     331: ldc           #169                // String  -
     333: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     336: aload_0
     337: invokevirtual #163                // Method Day21Kt$main$Monkey.getName:()Ljava/lang/String;
     340: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     343: invokevirtual #172                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     346: invokespecial #175                // Method Day21Kt$main$Monkey."<init>":(Ljava/lang/String;Ljava/lang/String;)V
     349: aastore
     350: aload         6
     352: invokestatic  #178                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     355: goto          552
     358: iconst_3
     359: anewarray     #45                 // class Day21Kt$main$Monkey
     362: astore        6
     364: aload         6
     366: iconst_0
     367: aload_0
     368: aastore
     369: aload         6
     371: iconst_1
     372: new           #45                 // class Day21Kt$main$Monkey
     375: dup
     376: aload_2
     377: new           #157                // class java/lang/StringBuilder
     380: dup
     381: invokespecial #160                // Method java/lang/StringBuilder."<init>":()V
     384: aload_0
     385: invokevirtual #163                // Method Day21Kt$main$Monkey.getName:()Ljava/lang/String;
     388: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     391: ldc           #182                // String  /
     393: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     396: aload_3
     397: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     400: invokevirtual #172                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     403: invokespecial #175                // Method Day21Kt$main$Monkey."<init>":(Ljava/lang/String;Ljava/lang/String;)V
     406: aastore
     407: aload         6
     409: iconst_2
     410: new           #45                 // class Day21Kt$main$Monkey
     413: dup
     414: aload_3
     415: new           #157                // class java/lang/StringBuilder
     418: dup
     419: invokespecial #160                // Method java/lang/StringBuilder."<init>":()V
     422: aload_0
     423: invokevirtual #163                // Method Day21Kt$main$Monkey.getName:()Ljava/lang/String;
     426: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     429: ldc           #182                // String  /
     431: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     434: aload_2
     435: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     438: invokevirtual #172                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     441: invokespecial #175                // Method Day21Kt$main$Monkey."<init>":(Ljava/lang/String;Ljava/lang/String;)V
     444: aastore
     445: aload         6
     447: invokestatic  #178                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     450: goto          552
     453: iconst_3
     454: anewarray     #45                 // class Day21Kt$main$Monkey
     457: astore        6
     459: aload         6
     461: iconst_0
     462: aload_0
     463: aastore
     464: aload         6
     466: iconst_1
     467: new           #45                 // class Day21Kt$main$Monkey
     470: dup
     471: aload_2
     472: new           #157                // class java/lang/StringBuilder
     475: dup
     476: invokespecial #160                // Method java/lang/StringBuilder."<init>":()V
     479: aload_0
     480: invokevirtual #163                // Method Day21Kt$main$Monkey.getName:()Ljava/lang/String;
     483: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     486: ldc           #184                // String  *
     488: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     491: aload_3
     492: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     495: invokevirtual #172                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     498: invokespecial #175                // Method Day21Kt$main$Monkey."<init>":(Ljava/lang/String;Ljava/lang/String;)V
     501: aastore
     502: aload         6
     504: iconst_2
     505: new           #45                 // class Day21Kt$main$Monkey
     508: dup
     509: aload_3
     510: new           #157                // class java/lang/StringBuilder
     513: dup
     514: invokespecial #160                // Method java/lang/StringBuilder."<init>":()V
     517: aload_2
     518: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     521: ldc           #182                // String  /
     523: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     526: aload_0
     527: invokevirtual #163                // Method Day21Kt$main$Monkey.getName:()Ljava/lang/String;
     530: invokevirtual #167                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     533: invokevirtual #172                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     536: invokespecial #175                // Method Day21Kt$main$Monkey."<init>":(Ljava/lang/String;Ljava/lang/String;)V
     539: aastore
     540: aload         6
     542: invokestatic  #178                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     545: goto          552
     548: aload_0
     549: invokestatic  #155                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     552: areturn

  private static final long main$calc(java.util.List<Day21Kt$main$Monkey>, java.lang.String);
    Code:
       0: new           #190                // class java/util/LinkedHashMap
       3: dup
       4: invokespecial #191                // Method java/util/LinkedHashMap."<init>":()V
       7: checkcast     #100                // class java/util/Map
      10: astore_2
      11: aload_2
      12: aload_1
      13: invokeinterface #104,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
      18: ifne          137
      21: aload_0
      22: checkcast     #193                // class java/lang/Iterable
      25: astore_3
      26: iconst_0
      27: istore        4
      29: aload_3
      30: invokeinterface #197,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      35: astore        5
      37: aload         5
      39: invokeinterface #203,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      44: ifeq          133
      47: aload         5
      49: invokeinterface #207,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      54: astore        6
      56: aload         6
      58: checkcast     #45                 // class Day21Kt$main$Monkey
      61: astore        7
      63: iconst_0
      64: istore        8
      66: aload_2
      67: aload         7
      69: invokevirtual #163                // Method Day21Kt$main$Monkey.getName:()Ljava/lang/String;
      72: invokeinterface #107,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      77: ifnonnull     128
      80: aload         7
      82: aload_2
      83: invokestatic  #209                // Method main$evaluateExpr:(LDay21Kt$main$Monkey;Ljava/util/Map;)Ljava/lang/Long;
      86: dup
      87: ifnull        126
      90: checkcast     #117                // class java/lang/Number
      93: invokevirtual #121                // Method java/lang/Number.longValue:()J
      96: lstore        9
      98: iconst_0
      99: istore        11
     101: lload         9
     103: invokestatic  #81                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     106: astore        12
     108: aload_2
     109: aload         7
     111: invokevirtual #163                // Method Day21Kt$main$Monkey.getName:()Ljava/lang/String;
     114: aload         12
     116: invokeinterface #115,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     121: pop
     122: nop
     123: goto          128
     126: pop
     127: nop
     128: nop
     129: nop
     130: goto          37
     133: nop
     134: goto          11
     137: aload_2
     138: aload_1
     139: invokeinterface #107,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     144: dup
     145: invokestatic  #111                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     148: checkcast     #117                // class java/lang/Number
     151: invokevirtual #121                // Method java/lang/Number.longValue:()J
     154: lreturn

  private static final long main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #193                // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #224                // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #228                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #231                // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #233                // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #197,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #203,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          149
      48: aload         6
      50: invokeinterface #207,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #53                 // class java/lang/String
      64: astore        8
      66: astore        13
      68: iconst_0
      69: istore        9
      71: aload         8
      73: checkcast     #51                 // class java/lang/CharSequence
      76: iconst_1
      77: anewarray     #53                 // class java/lang/String
      80: astore        10
      82: aload         10
      84: iconst_0
      85: ldc           #235                // String :
      87: aastore
      88: aload         10
      90: iconst_0
      91: iconst_0
      92: bipush        6
      94: aconst_null
      95: invokestatic  #61                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      98: astore        11
     100: aload         11
     102: iconst_0
     103: invokeinterface #71,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     108: checkcast     #53                 // class java/lang/String
     111: astore        10
     113: aload         11
     115: iconst_1
     116: invokeinterface #71,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     121: checkcast     #53                 // class java/lang/String
     124: astore        12
     126: new           #45                 // class Day21Kt$main$Monkey
     129: dup
     130: aload         10
     132: aload         12
     134: invokespecial #175                // Method Day21Kt$main$Monkey."<init>":(Ljava/lang/String;Ljava/lang/String;)V
     137: aload         13
     139: swap
     140: invokeinterface #238,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     145: pop
     146: goto          38
     149: aload         4
     151: checkcast     #63                 // class java/util/List
     154: nop
     155: ldc           #240                // String root
     157: invokestatic  #242                // Method main$calc:(Ljava/util/List;Ljava/lang/String;)J
     160: lreturn

  private static final long main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #193                // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #224                // class java/util/ArrayList
      12: dup
      13: invokespecial #253                // Method java/util/ArrayList."<init>":()V
      16: checkcast     #233                // class java/util/Collection
      19: astore        4
      21: iconst_0
      22: istore        5
      24: aload_3
      25: invokeinterface #197,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      30: astore        6
      32: aload         6
      34: invokeinterface #203,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      39: ifeq          184
      42: aload         6
      44: invokeinterface #207,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      49: astore        7
      51: aload         7
      53: checkcast     #53                 // class java/lang/String
      56: astore        8
      58: iconst_0
      59: istore        9
      61: aload         8
      63: checkcast     #51                 // class java/lang/CharSequence
      66: iconst_1
      67: anewarray     #53                 // class java/lang/String
      70: astore        10
      72: aload         10
      74: iconst_0
      75: ldc           #235                // String :
      77: aastore
      78: aload         10
      80: iconst_0
      81: iconst_0
      82: bipush        6
      84: aconst_null
      85: invokestatic  #61                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      88: astore        11
      90: aload         11
      92: iconst_0
      93: invokeinterface #71,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      98: checkcast     #53                 // class java/lang/String
     101: astore        10
     103: aload         11
     105: iconst_1
     106: invokeinterface #71,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     111: checkcast     #53                 // class java/lang/String
     114: astore        12
     116: aload         10
     118: ldc           #240                // String root
     120: invokestatic  #98                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     123: ifeq          153
     126: new           #45                 // class Day21Kt$main$Monkey
     129: dup
     130: aload         10
     132: aload         12
     134: ldc           #131                // String +
     136: ldc           #92                 // String =
     138: iconst_0
     139: iconst_4
     140: aconst_null
     141: invokestatic  #257                // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
     144: invokespecial #175                // Method Day21Kt$main$Monkey."<init>":(Ljava/lang/String;Ljava/lang/String;)V
     147: invokestatic  #259                // Method main$variants:(LDay21Kt$main$Monkey;)Ljava/util/List;
     150: goto          167
     153: new           #45                 // class Day21Kt$main$Monkey
     156: dup
     157: aload         10
     159: aload         12
     161: invokespecial #175                // Method Day21Kt$main$Monkey."<init>":(Ljava/lang/String;Ljava/lang/String;)V
     164: invokestatic  #259                // Method main$variants:(LDay21Kt$main$Monkey;)Ljava/util/List;
     167: checkcast     #193                // class java/lang/Iterable
     170: nop
     171: astore        8
     173: aload         4
     175: aload         8
     177: invokestatic  #263                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     180: pop
     181: goto          32
     184: aload         4
     186: checkcast     #63                 // class java/util/List
     189: nop
     190: checkcast     #193                // class java/lang/Iterable
     193: astore_1
     194: nop
     195: iconst_0
     196: istore_2
     197: aload_1
     198: astore_3
     199: new           #224                // class java/util/ArrayList
     202: dup
     203: invokespecial #253                // Method java/util/ArrayList."<init>":()V
     206: checkcast     #233                // class java/util/Collection
     209: astore        4
     211: iconst_0
     212: istore        5
     214: aload_3
     215: invokeinterface #197,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     220: astore        6
     222: aload         6
     224: invokeinterface #203,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     229: ifeq          325
     232: aload         6
     234: invokeinterface #207,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     239: astore        7
     241: aload         7
     243: checkcast     #45                 // class Day21Kt$main$Monkey
     246: astore        8
     248: iconst_0
     249: istore        9
     251: aload         8
     253: invokevirtual #163                // Method Day21Kt$main$Monkey.getName:()Ljava/lang/String;
     256: ldc_w         #265                // String humn
     259: invokestatic  #98                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     262: ifeq          308
     265: aload         8
     267: invokevirtual #49                 // Method Day21Kt$main$Monkey.getExpr:()Ljava/lang/String;
     270: checkcast     #51                 // class java/lang/CharSequence
     273: iconst_1
     274: anewarray     #53                 // class java/lang/String
     277: astore        10
     279: aload         10
     281: iconst_0
     282: ldc           #55                 // String
     284: aastore
     285: aload         10
     287: iconst_0
     288: iconst_0
     289: bipush        6
     291: aconst_null
     292: invokestatic  #61                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     295: invokeinterface #67,  1           // InterfaceMethod java/util/List.size:()I
     300: iconst_1
     301: if_icmpne     308
     304: iconst_1
     305: goto          309
     308: iconst_0
     309: ifne          222
     312: aload         4
     314: aload         7
     316: invokeinterface #238,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     321: pop
     322: goto          222
     325: aload         4
     327: checkcast     #63                 // class java/util/List
     330: nop
     331: ldc_w         #265                // String humn
     334: invokestatic  #242                // Method main$calc:(Ljava/util/List;Ljava/lang/String;)J
     337: lreturn
}

Compiled from "Day21.kt"
public final class Day21Kt$main$Monkey {
  private final java.lang.String name;

  private final java.lang.String expr;

  public Day21Kt$main$Monkey(java.lang.String, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #8                  // String name
       3: invokestatic  #14                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #16                 // String expr
       9: invokestatic  #14                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokespecial #19                 // Method java/lang/Object."<init>":()V
      16: aload_0
      17: aload_1
      18: putfield      #22                 // Field name:Ljava/lang/String;
      21: aload_0
      22: aload_2
      23: putfield      #24                 // Field expr:Ljava/lang/String;
      26: return

  public final java.lang.String getName();
    Code:
       0: aload_0
       1: getfield      #22                 // Field name:Ljava/lang/String;
       4: areturn

  public final java.lang.String getExpr();
    Code:
       0: aload_0
       1: getfield      #24                 // Field expr:Ljava/lang/String;
       4: areturn

  public final java.lang.String component1();
    Code:
       0: aload_0
       1: getfield      #22                 // Field name:Ljava/lang/String;
       4: areturn

  public final java.lang.String component2();
    Code:
       0: aload_0
       1: getfield      #24                 // Field expr:Ljava/lang/String;
       4: areturn

  public final Day21Kt$main$Monkey copy(java.lang.String, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #8                  // String name
       3: invokestatic  #14                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #16                 // String expr
       9: invokestatic  #14                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #2                  // class Day21Kt$main$Monkey
      15: dup
      16: aload_1
      17: aload_2
      18: invokespecial #35                 // Method "<init>":(Ljava/lang/String;Ljava/lang/String;)V
      21: areturn

  public static Day21Kt$main$Monkey copy$default(Day21Kt$main$Monkey, java.lang.String, java.lang.String, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #22                 // Field name:Ljava/lang/String;
      10: astore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #24                 // Field expr:Ljava/lang/String;
      21: astore_2
      22: aload_0
      23: aload_1
      24: aload_2
      25: invokevirtual #39                 // Method copy:(Ljava/lang/String;Ljava/lang/String;)LDay21Kt$main$Monkey;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #42                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #43                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #45                 // String Monkey(name=
       9: invokevirtual #49                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #22                 // Field name:Ljava/lang/String;
      16: invokevirtual #49                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: ldc           #51                 // String , expr=
      21: invokevirtual #49                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #24                 // Field expr:Ljava/lang/String;
      28: invokevirtual #49                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #54                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #56                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #22                 // Field name:Ljava/lang/String;
       4: invokevirtual #62                 // Method java/lang/String.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #24                 // Field expr:Ljava/lang/String;
      16: invokevirtual #62                 // Method java/lang/String.hashCode:()I
      19: iadd
      20: istore_1
      21: iload_1
      22: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class Day21Kt$main$Monkey
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day21Kt$main$Monkey
      20: astore_2
      21: aload_0
      22: getfield      #22                 // Field name:Ljava/lang/String;
      25: aload_2
      26: getfield      #22                 // Field name:Ljava/lang/String;
      29: invokestatic  #70                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #24                 // Field expr:Ljava/lang/String;
      41: aload_2
      42: getfield      #24                 // Field expr:Ljava/lang/String;
      45: invokestatic  #70                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifne          53
      51: iconst_0
      52: ireturn
      53: iconst_1
      54: ireturn
}