fun main() = Calculator.solve()

private object Calculator {
    fun solve() {
        val expressions = readInput()
        println("Part 1: root value ${calcValue(expressions, "root")}")
        println("Part 2, humn requires value ${matchValuesAt(expressions, "root")}")
    }

    private fun readInput(): Map<String, Expr> = buildMap {
        generateSequence(::readLine).forEach { line ->
            val parts = line.split(":")
            val label = parts.get(0).trim()
            val expr = parts.get(1).trim()
            when {
                expr.contains(" ") -> {
                    val parts = expr.split(" ")
                    val op = when (parts.get(1)) {
                        "+" -> Op.Plus
                        "-" -> Op.Minus
                        "*" -> Op.Mul
                        "/" -> Op.Div
                        else -> throw Error("Unexpected operation: ${parts.get(1)}")
                    }
                    put(label, Calc(parts[0], parts[2], op))

                }

                else -> {
                    put(label, Just(expr.toLong(10)))
                }
            }
        }
    }

    private fun calcValue(expressions: Map<String, Expr>, label: String): Long {
        val values = mutableMapOf<String, Long>()

        fun getValue(label: String): Long {
            var value = values[label]
            if (value == null) {
                val expr = expressions.getValue(label)
                value = when (expr) {
                    is Just ->
                        expr.value

                    is Calc -> {
                        val a = getValue(expr.a)
                        val b = getValue(expr.b)
                        expr.operation.calc(a, b)
                    }
                }
                values[label] = value
            }
            return value
        }

        return getValue(label)
    }

    private fun matchValuesAt(expressions: Map<String, Expr>, rootLabel: String): Long {
        val root = expressions.getValue(rootLabel) as Calc

        fun findDeps(start: String, needle: String): List<String> {
            val stack = mutableListOf(listOf(start))
            while (stack.isNotEmpty()) {
                val item = stack.removeFirst()
                if (item.first() == needle) {
                    return item
                }
                val expr = expressions.getValue(item.first())
                if (expr is Just) {
                    continue
                }
                if (expr is Calc) {
                    stack.add(listOf(expr.a).plus(item))
                    stack.add(listOf(expr.b).plus(item))
                }
            }
            return listOf()
        }

        val aDeps = findDeps(root.a, "humn")
        val bDeps = findDeps(root.b, "humn")
        if (aDeps.isNotEmpty() && bDeps.isNotEmpty()) {
            TODO("Dont know how to solve this yet")
        } else if (aDeps.isEmpty() && bDeps.isEmpty()) {
            throw Error("Failed to find dep list to humn")
        }
        val (targetValue, deps) = if (aDeps.isNotEmpty()) {
            println("A: ${root.a}")
            Pair(calcValue(expressions, root.b), aDeps)
        } else {
            println("B: ${root.b}")
            Pair(calcValue(expressions, root.a), bDeps)
        }
        println("$root, targetValue: $targetValue, deps: $deps")
        val targetValues = mutableMapOf(Pair(deps.last(), targetValue))
        println("$targetValues")
        for (pair in deps.reversed().windowed(2, 1)) {
            val calc = expressions.getValue(pair.first()) as Calc
            val next = pair.last()
            val other = if (next == calc.a) calc.b else calc.a
            val otherValue = calcValue(expressions, other)
            val target = targetValues.getValue(pair.first())
            val nextTarget = when (calc.operation) {
                Op.Plus -> target - otherValue
                Op.Mul -> target / otherValue
                Op.Minus -> if (next == calc.a) target + otherValue else otherValue - target
                Op.Div -> if (next == calc.a) target * otherValue else otherValue / target
            }
            targetValues[next] = nextTarget
        }
        return 0
    }

    sealed interface Expr

    data class Just(val value: Long) : Expr
    data class Calc(val a: String, val b: String, val operation: Op) : Expr

    enum class Op {
        Plus {
            override fun calc(a: Long, b: Long): Long = a + b
        },
        Minus {
            override fun calc(a: Long, b: Long): Long = a - b
        },
        Mul {
            override fun calc(a: Long, b: Long): Long = a * b
        },
        Div {
            override fun calc(a: Long, b: Long): Long = a / b
        };

        abstract fun calc(a: Long, b: Long): Long

    }
}

Compiled from "Calculator.kt"
final class Calculator {
  public static final Calculator INSTANCE;

  private Calculator();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final void solve();
    Code:
       0: aload_0
       1: invokespecial #15                 // Method readInput:()Ljava/util/Map;
       4: astore_1
       5: new           #17                 // class java/lang/StringBuilder
       8: dup
       9: invokespecial #18                 // Method java/lang/StringBuilder."<init>":()V
      12: ldc           #20                 // String Part 1: root value
      14: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      17: aload_0
      18: aload_1
      19: ldc           #26                 // String root
      21: invokespecial #30                 // Method calcValue:(Ljava/util/Map;Ljava/lang/String;)J
      24: invokevirtual #33                 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
      27: invokevirtual #37                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      30: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
      33: swap
      34: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      37: new           #17                 // class java/lang/StringBuilder
      40: dup
      41: invokespecial #18                 // Method java/lang/StringBuilder."<init>":()V
      44: ldc           #51                 // String Part 2, humn requires value
      46: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      49: aload_0
      50: aload_1
      51: ldc           #26                 // String root
      53: invokespecial #54                 // Method matchValuesAt:(Ljava/util/Map;Ljava/lang/String;)J
      56: invokevirtual #33                 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
      59: invokevirtual #37                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      62: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
      65: swap
      66: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      69: return

  private final java.util.Map<java.lang.String, Calculator$Expr> readInput();
    Code:
       0: invokestatic  #62                 // Method kotlin/collections/MapsKt.createMapBuilder:()Ljava/util/Map;
       3: astore_1
       4: aload_1
       5: astore_2
       6: iconst_0
       7: istore_3
       8: getstatic     #68                 // Field Calculator$readInput$1$1.INSTANCE:LCalculator$readInput$1$1;
      11: checkcast     #70                 // class kotlin/jvm/functions/Function0
      14: invokestatic  #76                 // Method kotlin/sequences/SequencesKt.generateSequence:(Lkotlin/jvm/functions/Function0;)Lkotlin/sequences/Sequence;
      17: astore        4
      19: iconst_0
      20: istore        5
      22: aload         4
      24: invokeinterface #82,  1           // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      29: astore        6
      31: aload         6
      33: invokeinterface #88,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      38: ifeq          434
      41: aload         6
      43: invokeinterface #92,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      48: astore        7
      50: aload         7
      52: checkcast     #94                 // class java/lang/String
      55: astore        8
      57: iconst_0
      58: istore        9
      60: aload         8
      62: checkcast     #96                 // class java/lang/CharSequence
      65: iconst_1
      66: anewarray     #94                 // class java/lang/String
      69: astore        10
      71: aload         10
      73: iconst_0
      74: ldc           #98                 // String :
      76: aastore
      77: aload         10
      79: iconst_0
      80: iconst_0
      81: bipush        6
      83: aconst_null
      84: invokestatic  #104                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      87: astore        11
      89: aload         11
      91: iconst_0
      92: invokeinterface #110,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      97: checkcast     #94                 // class java/lang/String
     100: checkcast     #96                 // class java/lang/CharSequence
     103: invokestatic  #114                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     106: invokevirtual #115                // Method java/lang/Object.toString:()Ljava/lang/String;
     109: astore        10
     111: aload         11
     113: iconst_1
     114: invokeinterface #110,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     119: checkcast     #94                 // class java/lang/String
     122: checkcast     #96                 // class java/lang/CharSequence
     125: invokestatic  #114                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     128: invokevirtual #115                // Method java/lang/Object.toString:()Ljava/lang/String;
     131: astore        12
     133: nop
     134: aload         12
     136: checkcast     #96                 // class java/lang/CharSequence
     139: ldc           #117                // String
     141: checkcast     #96                 // class java/lang/CharSequence
     144: iconst_0
     145: iconst_2
     146: aconst_null
     147: invokestatic  #121                // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z
     150: ifeq          400
     153: aload         12
     155: checkcast     #96                 // class java/lang/CharSequence
     158: iconst_1
     159: anewarray     #94                 // class java/lang/String
     162: astore        13
     164: aload         13
     166: iconst_0
     167: ldc           #117                // String
     169: aastore
     170: aload         13
     172: iconst_0
     173: iconst_0
     174: bipush        6
     176: aconst_null
     177: invokestatic  #104                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     180: astore        14
     182: aload         14
     184: iconst_1
     185: invokeinterface #110,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     190: checkcast     #94                 // class java/lang/String
     193: astore        15
     195: aload         15
     197: invokevirtual #125                // Method java/lang/String.hashCode:()I
     200: tableswitch   { // 42 to 47
                    42: 240
                    43: 253
                    44: 316
                    45: 266
                    46: 316
                    47: 279
               default: 316
          }
     240: aload         15
     242: ldc           #127                // String *
     244: invokevirtual #131                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     247: ifne          304
     250: goto          316
     253: aload         15
     255: ldc           #133                // String +
     257: invokevirtual #131                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     260: ifne          292
     263: goto          316
     266: aload         15
     268: ldc           #135                // String -
     270: invokevirtual #131                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     273: ifne          298
     276: goto          316
     279: aload         15
     281: ldc           #137                // String /
     283: invokevirtual #131                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     286: ifne          310
     289: goto          316
     292: getstatic     #143                // Field Calculator$Op.Plus:LCalculator$Op;
     295: goto          353
     298: getstatic     #146                // Field Calculator$Op.Minus:LCalculator$Op;
     301: goto          353
     304: getstatic     #149                // Field Calculator$Op.Mul:LCalculator$Op;
     307: goto          353
     310: getstatic     #152                // Field Calculator$Op.Div:LCalculator$Op;
     313: goto          353
     316: new           #154                // class java/lang/Error
     319: dup
     320: new           #17                 // class java/lang/StringBuilder
     323: dup
     324: invokespecial #18                 // Method java/lang/StringBuilder."<init>":()V
     327: ldc           #156                // String Unexpected operation:
     329: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     332: aload         14
     334: iconst_1
     335: invokeinterface #110,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     340: checkcast     #94                 // class java/lang/String
     343: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     346: invokevirtual #37                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     349: invokespecial #159                // Method java/lang/Error."<init>":(Ljava/lang/String;)V
     352: athrow
     353: astore        13
     355: aload_2
     356: aload         10
     358: new           #161                // class Calculator$Calc
     361: dup
     362: aload         14
     364: iconst_0
     365: invokeinterface #110,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     370: checkcast     #94                 // class java/lang/String
     373: aload         14
     375: iconst_2
     376: invokeinterface #110,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     381: checkcast     #94                 // class java/lang/String
     384: aload         13
     386: invokespecial #164                // Method Calculator$Calc."<init>":(Ljava/lang/String;Ljava/lang/String;LCalculator$Op;)V
     389: invokeinterface #170,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     394: checkcast     #172                // class Calculator$Expr
     397: goto          428
     400: aload_2
     401: aload         10
     403: new           #174                // class Calculator$Just
     406: dup
     407: aload         12
     409: bipush        10
     411: invokestatic  #180                // Method kotlin/text/CharsKt.checkRadix:(I)I
     414: invokestatic  #186                // Method java/lang/Long.parseLong:(Ljava/lang/String;I)J
     417: invokespecial #189                // Method Calculator$Just."<init>":(J)V
     420: invokeinterface #170,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     425: checkcast     #172                // class Calculator$Expr
     428: pop
     429: nop
     430: nop
     431: goto          31
     434: nop
     435: nop
     436: aload_1
     437: invokestatic  #193                // Method kotlin/collections/MapsKt.build:(Ljava/util/Map;)Ljava/util/Map;
     440: areturn

  private final long calcValue(java.util.Map<java.lang.String, ? extends Calculator$Expr>, java.lang.String);
    Code:
       0: new           #214                // class java/util/LinkedHashMap
       3: dup
       4: invokespecial #215                // Method java/util/LinkedHashMap."<init>":()V
       7: checkcast     #166                // class java/util/Map
      10: astore_3
      11: aload_3
      12: aload_1
      13: aload_2
      14: invokestatic  #219                // Method calcValue$getValue:(Ljava/util/Map;Ljava/util/Map;Ljava/lang/String;)J
      17: lreturn

  private final long matchValuesAt(java.util.Map<java.lang.String, ? extends Calculator$Expr>, java.lang.String);
    Code:
       0: aload_1
       1: aload_2
       2: invokestatic  #224                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
       5: dup
       6: ldc           #226                // String null cannot be cast to non-null type <root>.Calculator.Calc
       8: invokestatic  #232                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;Ljava/lang/String;)V
      11: checkcast     #161                // class Calculator$Calc
      14: astore_3
      15: aload_1
      16: aload_3
      17: invokevirtual #235                // Method Calculator$Calc.getA:()Ljava/lang/String;
      20: ldc           #237                // String humn
      22: invokestatic  #241                // Method matchValuesAt$findDeps:(Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;)Ljava/util/List;
      25: astore        4
      27: aload_1
      28: aload_3
      29: invokevirtual #244                // Method Calculator$Calc.getB:()Ljava/lang/String;
      32: ldc           #237                // String humn
      34: invokestatic  #241                // Method matchValuesAt$findDeps:(Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;)Ljava/util/List;
      37: astore        5
      39: aload         4
      41: checkcast     #246                // class java/util/Collection
      44: invokeinterface #249,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      49: ifne          56
      52: iconst_1
      53: goto          57
      56: iconst_0
      57: ifeq          113
      60: aload         5
      62: checkcast     #246                // class java/util/Collection
      65: invokeinterface #249,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      70: ifne          77
      73: iconst_1
      74: goto          78
      77: iconst_0
      78: ifeq          113
      81: ldc           #251                // String Dont know how to solve this yet
      83: astore        6
      85: new           #253                // class kotlin/NotImplementedError
      88: dup
      89: new           #17                 // class java/lang/StringBuilder
      92: dup
      93: invokespecial #18                 // Method java/lang/StringBuilder."<init>":()V
      96: ldc           #255                // String An operation is not implemented:
      98: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     101: aload         6
     103: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     106: invokevirtual #37                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     109: invokespecial #256                // Method kotlin/NotImplementedError."<init>":(Ljava/lang/String;)V
     112: athrow
     113: aload         4
     115: invokeinterface #257,  1          // InterfaceMethod java/util/List.isEmpty:()Z
     120: ifeq          144
     123: aload         5
     125: invokeinterface #257,  1          // InterfaceMethod java/util/List.isEmpty:()Z
     130: ifeq          144
     133: new           #154                // class java/lang/Error
     136: dup
     137: ldc_w         #259                // String Failed to find dep list to humn
     140: invokespecial #159                // Method java/lang/Error."<init>":(Ljava/lang/String;)V
     143: athrow
     144: aload         4
     146: checkcast     #246                // class java/util/Collection
     149: invokeinterface #249,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     154: ifne          161
     157: iconst_1
     158: goto          162
     161: iconst_0
     162: ifeq          219
     165: new           #17                 // class java/lang/StringBuilder
     168: dup
     169: invokespecial #18                 // Method java/lang/StringBuilder."<init>":()V
     172: ldc_w         #261                // String A:
     175: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     178: aload_3
     179: invokevirtual #235                // Method Calculator$Calc.getA:()Ljava/lang/String;
     182: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     185: invokevirtual #37                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     188: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
     191: swap
     192: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     195: new           #263                // class kotlin/Pair
     198: dup
     199: aload_0
     200: aload_1
     201: aload_3
     202: invokevirtual #244                // Method Calculator$Calc.getB:()Ljava/lang/String;
     205: invokespecial #30                 // Method calcValue:(Ljava/util/Map;Ljava/lang/String;)J
     208: invokestatic  #267                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     211: aload         4
     213: invokespecial #270                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     216: goto          270
     219: new           #17                 // class java/lang/StringBuilder
     222: dup
     223: invokespecial #18                 // Method java/lang/StringBuilder."<init>":()V
     226: ldc_w         #272                // String B:
     229: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     232: aload_3
     233: invokevirtual #244                // Method Calculator$Calc.getB:()Ljava/lang/String;
     236: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     239: invokevirtual #37                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     242: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
     245: swap
     246: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     249: new           #263                // class kotlin/Pair
     252: dup
     253: aload_0
     254: aload_1
     255: aload_3
     256: invokevirtual #235                // Method Calculator$Calc.getA:()Ljava/lang/String;
     259: invokespecial #30                 // Method calcValue:(Ljava/util/Map;Ljava/lang/String;)J
     262: invokestatic  #267                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     265: aload         5
     267: invokespecial #270                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     270: astore        6
     272: aload         6
     274: invokevirtual #275                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     277: checkcast     #277                // class java/lang/Number
     280: invokevirtual #281                // Method java/lang/Number.longValue:()J
     283: lstore        7
     285: aload         6
     287: invokevirtual #284                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     290: checkcast     #106                // class java/util/List
     293: astore        9
     295: new           #17                 // class java/lang/StringBuilder
     298: dup
     299: invokespecial #18                 // Method java/lang/StringBuilder."<init>":()V
     302: aload_3
     303: invokevirtual #287                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     306: ldc_w         #289                // String , targetValue:
     309: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     312: lload         7
     314: invokevirtual #33                 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
     317: ldc_w         #291                // String , deps:
     320: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     323: aload         9
     325: invokevirtual #287                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     328: invokevirtual #37                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     331: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
     334: swap
     335: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     338: iconst_1
     339: anewarray     #263                // class kotlin/Pair
     342: astore        11
     344: aload         11
     346: iconst_0
     347: new           #263                // class kotlin/Pair
     350: dup
     351: aload         9
     353: invokestatic  #297                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     356: lload         7
     358: invokestatic  #267                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     361: invokespecial #270                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     364: aastore
     365: aload         11
     367: invokestatic  #301                // Method kotlin/collections/MapsKt.mutableMapOf:([Lkotlin/Pair;)Ljava/util/Map;
     370: astore        10
     372: aload         10
     374: invokestatic  #304                // Method java/lang/String.valueOf:(Ljava/lang/Object;)Ljava/lang/String;
     377: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
     380: swap
     381: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     384: aload         9
     386: checkcast     #306                // class java/lang/Iterable
     389: invokestatic  #310                // Method kotlin/collections/CollectionsKt.reversed:(Ljava/lang/Iterable;)Ljava/util/List;
     392: checkcast     #306                // class java/lang/Iterable
     395: iconst_2
     396: iconst_1
     397: iconst_0
     398: iconst_4
     399: aconst_null
     400: invokestatic  #314                // Method kotlin/collections/CollectionsKt.windowed$default:(Ljava/lang/Iterable;IIZILjava/lang/Object;)Ljava/util/List;
     403: invokeinterface #315,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     408: astore        11
     410: aload         11
     412: invokeinterface #88,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     417: ifeq          666
     420: aload         11
     422: invokeinterface #92,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     427: checkcast     #106                // class java/util/List
     430: astore        12
     432: aload_1
     433: aload         12
     435: invokestatic  #318                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     438: invokestatic  #224                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
     441: dup
     442: ldc           #226                // String null cannot be cast to non-null type <root>.Calculator.Calc
     444: invokestatic  #232                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;Ljava/lang/String;)V
     447: checkcast     #161                // class Calculator$Calc
     450: astore        13
     452: aload         12
     454: invokestatic  #297                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     457: checkcast     #94                 // class java/lang/String
     460: astore        14
     462: aload         14
     464: aload         13
     466: invokevirtual #235                // Method Calculator$Calc.getA:()Ljava/lang/String;
     469: invokestatic  #322                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     472: ifeq          483
     475: aload         13
     477: invokevirtual #244                // Method Calculator$Calc.getB:()Ljava/lang/String;
     480: goto          488
     483: aload         13
     485: invokevirtual #235                // Method Calculator$Calc.getA:()Ljava/lang/String;
     488: astore        15
     490: aload_0
     491: aload_1
     492: aload         15
     494: invokespecial #30                 // Method calcValue:(Ljava/util/Map;Ljava/lang/String;)J
     497: lstore        16
     499: aload         10
     501: aload         12
     503: invokestatic  #318                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     506: invokestatic  #224                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
     509: checkcast     #277                // class java/lang/Number
     512: invokevirtual #281                // Method java/lang/Number.longValue:()J
     515: lstore        18
     517: aload         13
     519: invokevirtual #326                // Method Calculator$Calc.getOperation:()LCalculator$Op;
     522: getstatic     #332                // Field Calculator$WhenMappings.$EnumSwitchMapping$0:[I
     525: swap
     526: invokevirtual #335                // Method Calculator$Op.ordinal:()I
     529: iaload
     530: tableswitch   { // 1 to 4
                     1: 560
                     2: 568
                     3: 576
                     4: 605
               default: 634
          }
     560: lload         18
     562: lload         16
     564: lsub
     565: goto          642
     568: lload         18
     570: lload         16
     572: ldiv
     573: goto          642
     576: aload         14
     578: aload         13
     580: invokevirtual #235                // Method Calculator$Calc.getA:()Ljava/lang/String;
     583: invokestatic  #322                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     586: ifeq          597
     589: lload         18
     591: lload         16
     593: ladd
     594: goto          642
     597: lload         16
     599: lload         18
     601: lsub
     602: goto          642
     605: aload         14
     607: aload         13
     609: invokevirtual #235                // Method Calculator$Calc.getA:()Ljava/lang/String;
     612: invokestatic  #322                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     615: ifeq          626
     618: lload         18
     620: lload         16
     622: lmul
     623: goto          642
     626: lload         16
     628: lload         18
     630: ldiv
     631: goto          642
     634: new           #337                // class kotlin/NoWhenBranchMatchedException
     637: dup
     638: invokespecial #338                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     641: athrow
     642: lstore        20
     644: lload         20
     646: invokestatic  #267                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     649: astore        22
     651: aload         10
     653: aload         14
     655: aload         22
     657: invokeinterface #170,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     662: pop
     663: goto          410
     666: lconst_0
     667: lreturn

  private static final long calcValue$getValue(java.util.Map<java.lang.String, java.lang.Long>, java.util.Map<java.lang.String, ? extends Calculator$Expr>, java.lang.String);
    Code:
       0: aload_0
       1: aload_2
       2: invokeinterface #356,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #182                // class java/lang/Long
      10: astore_3
      11: aload_3
      12: ifnonnull     125
      15: aload_1
      16: aload_2
      17: invokestatic  #224                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
      20: checkcast     #172                // class Calculator$Expr
      23: astore        4
      25: aload         4
      27: astore        5
      29: aload         5
      31: instanceof    #174                // class Calculator$Just
      34: ifeq          48
      37: aload         4
      39: checkcast     #174                // class Calculator$Just
      42: invokevirtual #358                // Method Calculator$Just.getValue:()J
      45: goto          112
      48: aload         5
      50: instanceof    #161                // class Calculator$Calc
      53: ifeq          104
      56: aload_0
      57: aload_1
      58: aload         4
      60: checkcast     #161                // class Calculator$Calc
      63: invokevirtual #235                // Method Calculator$Calc.getA:()Ljava/lang/String;
      66: invokestatic  #219                // Method calcValue$getValue:(Ljava/util/Map;Ljava/util/Map;Ljava/lang/String;)J
      69: lstore        6
      71: aload_0
      72: aload_1
      73: aload         4
      75: checkcast     #161                // class Calculator$Calc
      78: invokevirtual #244                // Method Calculator$Calc.getB:()Ljava/lang/String;
      81: invokestatic  #219                // Method calcValue$getValue:(Ljava/util/Map;Ljava/util/Map;Ljava/lang/String;)J
      84: lstore        8
      86: aload         4
      88: checkcast     #161                // class Calculator$Calc
      91: invokevirtual #326                // Method Calculator$Calc.getOperation:()LCalculator$Op;
      94: lload         6
      96: lload         8
      98: invokevirtual #361                // Method Calculator$Op.calc:(JJ)J
     101: goto          112
     104: new           #337                // class kotlin/NoWhenBranchMatchedException
     107: dup
     108: invokespecial #338                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     111: athrow
     112: invokestatic  #267                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     115: astore_3
     116: aload_0
     117: aload_2
     118: aload_3
     119: invokeinterface #170,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     124: pop
     125: aload_3
     126: invokevirtual #362                // Method java/lang/Long.longValue:()J
     129: lreturn

  private static final java.util.List<java.lang.String> matchValuesAt$findDeps(java.util.Map<java.lang.String, ? extends Calculator$Expr>, java.lang.String, java.lang.String);
    Code:
       0: iconst_1
       1: anewarray     #106                // class java/util/List
       4: astore        4
       6: aload         4
       8: iconst_0
       9: aload_1
      10: invokestatic  #373                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      13: aastore
      14: aload         4
      16: invokestatic  #377                // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;
      19: astore_3
      20: aload_3
      21: checkcast     #246                // class java/util/Collection
      24: invokeinterface #249,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      29: ifne          36
      32: iconst_1
      33: goto          37
      36: iconst_0
      37: ifeq          167
      40: aload_3
      41: invokeinterface #380,  1          // InterfaceMethod java/util/List.removeFirst:()Ljava/lang/Object;
      46: dup
      47: ldc_w         #382                // String removeFirst(...)
      50: invokestatic  #385                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      53: checkcast     #106                // class java/util/List
      56: astore        4
      58: aload         4
      60: invokestatic  #318                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      63: aload_2
      64: invokestatic  #322                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      67: ifeq          73
      70: aload         4
      72: areturn
      73: aload_0
      74: aload         4
      76: invokestatic  #318                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      79: invokestatic  #224                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
      82: checkcast     #172                // class Calculator$Expr
      85: astore        5
      87: aload         5
      89: instanceof    #174                // class Calculator$Just
      92: ifeq          98
      95: goto          20
      98: aload         5
     100: instanceof    #161                // class Calculator$Calc
     103: ifeq          20
     106: aload_3
     107: aload         5
     109: checkcast     #161                // class Calculator$Calc
     112: invokevirtual #235                // Method Calculator$Calc.getA:()Ljava/lang/String;
     115: invokestatic  #373                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     118: checkcast     #246                // class java/util/Collection
     121: aload         4
     123: checkcast     #306                // class java/lang/Iterable
     126: invokestatic  #389                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Iterable;)Ljava/util/List;
     129: invokeinterface #392,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     134: pop
     135: aload_3
     136: aload         5
     138: checkcast     #161                // class Calculator$Calc
     141: invokevirtual #244                // Method Calculator$Calc.getB:()Ljava/lang/String;
     144: invokestatic  #373                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     147: checkcast     #246                // class java/util/Collection
     150: aload         4
     152: checkcast     #306                // class java/lang/Iterable
     155: invokestatic  #389                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Iterable;)Ljava/util/List;
     158: invokeinterface #392,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     163: pop
     164: goto          20
     167: invokestatic  #396                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
     170: areturn

  static {};
    Code:
       0: new           #2                  // class Calculator
       3: dup
       4: invokespecial #402                // Method "<init>":()V
       7: putstatic     #404                // Field INSTANCE:LCalculator;
      10: return
}

Compiled from "Calculator.kt"
public final class Calculator$WhenMappings {
  public static final int[] $EnumSwitchMapping$0;

  static {};
    Code:
       0: invokestatic  #14                 // Method Calculator$Op.values:()[LCalculator$Op;
       3: arraylength
       4: newarray       int
       6: astore_0
       7: nop
       8: aload_0
       9: getstatic     #18                 // Field Calculator$Op.Plus:LCalculator$Op;
      12: invokevirtual #22                 // Method Calculator$Op.ordinal:()I
      15: iconst_1
      16: iastore
      17: goto          21
      20: astore_1
      21: nop
      22: aload_0
      23: getstatic     #25                 // Field Calculator$Op.Mul:LCalculator$Op;
      26: invokevirtual #22                 // Method Calculator$Op.ordinal:()I
      29: iconst_2
      30: iastore
      31: goto          35
      34: astore_1
      35: nop
      36: aload_0
      37: getstatic     #28                 // Field Calculator$Op.Minus:LCalculator$Op;
      40: invokevirtual #22                 // Method Calculator$Op.ordinal:()I
      43: iconst_3
      44: iastore
      45: goto          49
      48: astore_1
      49: nop
      50: aload_0
      51: getstatic     #31                 // Field Calculator$Op.Div:LCalculator$Op;
      54: invokevirtual #22                 // Method Calculator$Op.ordinal:()I
      57: iconst_4
      58: iastore
      59: goto          63
      62: astore_1
      63: aload_0
      64: putstatic     #35                 // Field $EnumSwitchMapping$0:[I
      67: return
    Exception table:
       from    to  target type
           7    17    20   Class java/lang/NoSuchFieldError
          21    31    34   Class java/lang/NoSuchFieldError
          35    45    48   Class java/lang/NoSuchFieldError
          49    59    62   Class java/lang/NoSuchFieldError
}

Compiled from "Calculator.kt"
public interface Calculator$Expr {
}

Compiled from "Calculator.kt"
final class Calculator$Op$Mul extends Calculator$Op {
  Calculator$Op$Mul();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method Calculator$Op."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public long calc(long, long);
    Code:
       0: lload_1
       1: lload_3
       2: lmul
       3: lreturn
}

Compiled from "Calculator.kt"
public final class Calculator$Calc implements Calculator$Expr {
  private final java.lang.String a;

  private final java.lang.String b;

  private final Calculator$Op operation;

  public Calculator$Calc(java.lang.String, java.lang.String, Calculator$Op);
    Code:
       0: aload_1
       1: ldc           #11                 // String a
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #19                 // String b
       9: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #21                 // String operation
      15: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_0
      19: invokespecial #24                 // Method java/lang/Object."<init>":()V
      22: aload_0
      23: aload_1
      24: putfield      #27                 // Field a:Ljava/lang/String;
      27: aload_0
      28: aload_2
      29: putfield      #29                 // Field b:Ljava/lang/String;
      32: aload_0
      33: aload_3
      34: putfield      #32                 // Field operation:LCalculator$Op;
      37: return

  public final java.lang.String getA();
    Code:
       0: aload_0
       1: getfield      #27                 // Field a:Ljava/lang/String;
       4: areturn

  public final java.lang.String getB();
    Code:
       0: aload_0
       1: getfield      #29                 // Field b:Ljava/lang/String;
       4: areturn

  public final Calculator$Op getOperation();
    Code:
       0: aload_0
       1: getfield      #32                 // Field operation:LCalculator$Op;
       4: areturn

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

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

  public final Calculator$Op component3();
    Code:
       0: aload_0
       1: getfield      #32                 // Field operation:LCalculator$Op;
       4: areturn

  public final Calculator$Calc copy(java.lang.String, java.lang.String, Calculator$Op);
    Code:
       0: aload_1
       1: ldc           #11                 // String a
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #19                 // String b
       9: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #21                 // String operation
      15: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: new           #2                  // class Calculator$Calc
      21: dup
      22: aload_1
      23: aload_2
      24: aload_3
      25: invokespecial #46                 // Method "<init>":(Ljava/lang/String;Ljava/lang/String;LCalculator$Op;)V
      28: areturn

  public static Calculator$Calc copy$default(Calculator$Calc, java.lang.String, java.lang.String, Calculator$Op, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #27                 // Field a:Ljava/lang/String;
      11: astore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #29                 // Field b:Ljava/lang/String;
      23: astore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #32                 // Field operation:LCalculator$Op;
      35: astore_3
      36: aload_0
      37: aload_1
      38: aload_2
      39: aload_3
      40: invokevirtual #50                 // Method copy:(Ljava/lang/String;Ljava/lang/String;LCalculator$Op;)LCalculator$Calc;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #53                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #54                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #56                 // String Calc(a=
       9: invokevirtual #60                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #27                 // Field a:Ljava/lang/String;
      16: invokevirtual #60                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: ldc           #62                 // String , b=
      21: invokevirtual #60                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #29                 // Field b:Ljava/lang/String;
      28: invokevirtual #60                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      31: ldc           #64                 // String , operation=
      33: invokevirtual #60                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #32                 // Field operation:LCalculator$Op;
      40: invokevirtual #67                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #70                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #72                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #27                 // Field a:Ljava/lang/String;
       4: invokevirtual #78                 // Method java/lang/String.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #29                 // Field b:Ljava/lang/String;
      16: invokevirtual #78                 // Method java/lang/String.hashCode:()I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #32                 // Field operation:LCalculator$Op;
      29: invokevirtual #81                 // Method Calculator$Op.hashCode:()I
      32: iadd
      33: istore_1
      34: iload_1
      35: 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 Calculator$Calc
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Calculator$Calc
      20: astore_2
      21: aload_0
      22: getfield      #27                 // Field a:Ljava/lang/String;
      25: aload_2
      26: getfield      #27                 // Field a:Ljava/lang/String;
      29: invokestatic  #90                 // 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      #29                 // Field b:Ljava/lang/String;
      41: aload_2
      42: getfield      #29                 // Field b:Ljava/lang/String;
      45: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifne          53
      51: iconst_0
      52: ireturn
      53: aload_0
      54: getfield      #32                 // Field operation:LCalculator$Op;
      57: aload_2
      58: getfield      #32                 // Field operation:LCalculator$Op;
      61: if_acmpeq     66
      64: iconst_0
      65: ireturn
      66: iconst_1
      67: ireturn
}

Compiled from "Calculator.kt"
final class Calculator$Op$Plus extends Calculator$Op {
  Calculator$Op$Plus();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method Calculator$Op."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public long calc(long, long);
    Code:
       0: lload_1
       1: lload_3
       2: ladd
       3: lreturn
}

Compiled from "Calculator.kt"
final class Calculator$Op$Div extends Calculator$Op {
  Calculator$Op$Div();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method Calculator$Op."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public long calc(long, long);
    Code:
       0: lload_1
       1: lload_3
       2: ldiv
       3: lreturn
}

Compiled from "Calculator.kt"
public final class Calculator$Just implements Calculator$Expr {
  private final long value;

  public Calculator$Just(long);
    Code:
       0: aload_0
       1: invokespecial #11                 // Method java/lang/Object."<init>":()V
       4: aload_0
       5: lload_1
       6: putfield      #15                 // Field value:J
       9: return

  public final long getValue();
    Code:
       0: aload_0
       1: getfield      #15                 // Field value:J
       4: lreturn

  public final long component1();
    Code:
       0: aload_0
       1: getfield      #15                 // Field value:J
       4: lreturn

  public final Calculator$Just copy(long);
    Code:
       0: new           #2                  // class Calculator$Just
       3: dup
       4: lload_1
       5: invokespecial #25                 // Method "<init>":(J)V
       8: areturn

  public static Calculator$Just copy$default(Calculator$Just, long, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #15                 // Field value:J
      10: lstore_1
      11: aload_0
      12: lload_1
      13: invokevirtual #29                 // Method copy:(J)LCalculator$Just;
      16: areturn

  public java.lang.String toString();
    Code:
       0: new           #33                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #34                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #36                 // String Just(value=
       9: invokevirtual #40                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #15                 // Field value:J
      16: invokevirtual #43                 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
      19: bipush        41
      21: invokevirtual #46                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      24: invokevirtual #48                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      27: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #15                 // Field value:J
       4: invokestatic  #55                 // Method java/lang/Long.hashCode:(J)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 Calculator$Just
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Calculator$Just
      20: astore_2
      21: aload_0
      22: getfield      #15                 // Field value:J
      25: aload_2
      26: getfield      #15                 // Field value:J
      29: lcmp
      30: ifeq          35
      33: iconst_0
      34: ireturn
      35: iconst_1
      36: ireturn
}

Compiled from "Calculator.kt"
final class Calculator$readInput$1$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function0<java.lang.String> {
  public static final Calculator$readInput$1$1 INSTANCE;

  Calculator$readInput$1$1();
    Code:
       0: aload_0
       1: iconst_0
       2: ldc           #11                 // class kotlin/io/ConsoleKt
       4: ldc           #13                 // String readLine
       6: ldc           #15                 // String readLine()Ljava/lang/String;
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.String invoke();
    Code:
       0: invokestatic  #24                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: areturn

  public java.lang.Object invoke();
    Code:
       0: aload_0
       1: invokevirtual #27                 // Method invoke:()Ljava/lang/String;
       4: areturn

  static {};
    Code:
       0: new           #2                  // class Calculator$readInput$1$1
       3: dup
       4: invokespecial #30                 // Method "<init>":()V
       7: putstatic     #33                 // Field INSTANCE:LCalculator$readInput$1$1;
      10: return
}

Compiled from "Calculator.kt"
final class Calculator$Op$Minus extends Calculator$Op {
  Calculator$Op$Minus();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method Calculator$Op."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public long calc(long, long);
    Code:
       0: lload_1
       1: lload_3
       2: lsub
       3: lreturn
}

Compiled from "Calculator.kt"
public final class CalculatorKt {
  public static final void main();
    Code:
       0: getstatic     #12                 // Field Calculator.INSTANCE:LCalculator;
       3: invokevirtual #15                 // Method Calculator.solve:()V
       6: return

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

Compiled from "Calculator.kt"
public abstract class Calculator$Op extends java.lang.Enum<Calculator$Op> {
  public static final Calculator$Op Plus;

  public static final Calculator$Op Minus;

  public static final Calculator$Op Mul;

  public static final Calculator$Op Div;

  private static final Calculator$Op[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

  private Calculator$Op();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #10                 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
       6: return

  public abstract long calc(long, long);

  public static Calculator$Op[] values();
    Code:
       0: getstatic     #24                 // Field $VALUES:[LCalculator$Op;
       3: invokevirtual #30                 // Method java/lang/Object.clone:()Ljava/lang/Object;
       6: checkcast     #31                 // class "[LCalculator$Op;"
       9: areturn

  public static Calculator$Op valueOf(java.lang.String);
    Code:
       0: ldc           #2                  // class Calculator$Op
       2: aload_0
       3: invokestatic  #36                 // Method java/lang/Enum.valueOf:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
       6: checkcast     #2                  // class Calculator$Op
       9: areturn

  public static kotlin.enums.EnumEntries<Calculator$Op> getEntries();
    Code:
       0: getstatic     #45                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
       3: areturn

  private static final Calculator$Op[] $values();
    Code:
       0: iconst_4
       1: anewarray     #2                  // class Calculator$Op
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #49                 // Field Plus:LCalculator$Op;
      10: aastore
      11: aload_0
      12: iconst_1
      13: getstatic     #52                 // Field Minus:LCalculator$Op;
      16: aastore
      17: aload_0
      18: iconst_2
      19: getstatic     #55                 // Field Mul:LCalculator$Op;
      22: aastore
      23: aload_0
      24: iconst_3
      25: getstatic     #58                 // Field Div:LCalculator$Op;
      28: aastore
      29: aload_0
      30: areturn

  public Calculator$Op(java.lang.String, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #60                 // Method "<init>":(Ljava/lang/String;I)V
       6: return

  static {};
    Code:
       0: new           #65                 // class Calculator$Op$Plus
       3: dup
       4: ldc           #66                 // String Plus
       6: iconst_0
       7: invokespecial #67                 // Method Calculator$Op$Plus."<init>":(Ljava/lang/String;I)V
      10: putstatic     #49                 // Field Plus:LCalculator$Op;
      13: new           #69                 // class Calculator$Op$Minus
      16: dup
      17: ldc           #70                 // String Minus
      19: iconst_1
      20: invokespecial #71                 // Method Calculator$Op$Minus."<init>":(Ljava/lang/String;I)V
      23: putstatic     #52                 // Field Minus:LCalculator$Op;
      26: new           #73                 // class Calculator$Op$Mul
      29: dup
      30: ldc           #74                 // String Mul
      32: iconst_2
      33: invokespecial #75                 // Method Calculator$Op$Mul."<init>":(Ljava/lang/String;I)V
      36: putstatic     #55                 // Field Mul:LCalculator$Op;
      39: new           #77                 // class Calculator$Op$Div
      42: dup
      43: ldc           #78                 // String Div
      45: iconst_3
      46: invokespecial #79                 // Method Calculator$Op$Div."<init>":(Ljava/lang/String;I)V
      49: putstatic     #58                 // Field Div:LCalculator$Op;
      52: invokestatic  #81                 // Method $values:()[LCalculator$Op;
      55: putstatic     #24                 // Field $VALUES:[LCalculator$Op;
      58: getstatic     #24                 // Field $VALUES:[LCalculator$Op;
      61: checkcast     #83                 // class "[Ljava/lang/Enum;"
      64: invokestatic  #89                 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
      67: putstatic     #45                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
      70: return
}


fun main() {
    Crane.solve()
}

object Crane {
    fun solve() {
        val input = readInput()
        val result = runMoves(input.state, input.moves)
        println("Top of stacks: ${result.map { it.first() }.joinToString("")}")
    }

    private fun readInput(): Input {
        val stacks = mutableListOf<Pair<Int, String>>()
        val moves = mutableListOf<Move>()
        var width = 0
        var isStateSection = true
        for (line in generateSequence(::readLine)) {
            when {
                isStateSection -> {
                    if (line == "") {
                        isStateSection = false
                        continue
                    }
                    val labelsRowMatch = "^\\s*(\\d+\\s*)+$".toRegex().matchEntire(line)
                    if (labelsRowMatch != null) {
                        width = line.trim().split("\\s+".toRegex()).size
                    }
                    val matchResults = "\\[(\\w+)]".toRegex().findAll(line)
                    for (result in matchResults) {
                        val index = result.range.first / 4
                        val value = result.groupValues[1]
                        stacks.add(0, Pair(index, value))
                    }
                }

                else -> {
                    // parse move
                    val matchResult = "^move (\\d+) from (\\d+) to (\\d+)$".toRegex().matchEntire(line)
                        ?: throw Error("Unexpected move input")
                    moves.add(
                            Move(
                                matchResult.groupValues[2].toInt() - 1,
                                matchResult.groupValues[3].toInt() - 1,
                                matchResult.groupValues[1].toInt()
                            )
                        )
                }
            }
        }
        val state = List<MutableList<String>>(width) { mutableListOf() }
        for (item in stacks) {
            state[item.first].add(0, item.second)
        }

        return Input(state, moves)
    }

    private fun runMoves(state: List<List<String>>, moves: List<Move>): List<List<String>> {
        val result = state.map { it.toMutableList() }
        for (move in moves) {
            val fromStack = result[move.from]
            val loaded = fromStack.subList(0, move.count).toList() //.reversed()
            for (i in loaded) {
                fromStack.removeAt(0)
            }

            result[move.to].addAll(0,loaded)
        }
        return result
    }

    data class Move(val from: Int, val to: Int, val count: Int)

    data class Input(val state: List<List<String>>, val moves: List<Move>)

}

Compiled from "Crane.kt"
public final class Crane$Move {
  private final int from;

  private final int to;

  private final int count;

  public Crane$Move(int, int, int);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #13                 // Field from:I
       9: aload_0
      10: iload_2
      11: putfield      #16                 // Field to:I
      14: aload_0
      15: iload_3
      16: putfield      #19                 // Field count:I
      19: return

  public final int getFrom();
    Code:
       0: aload_0
       1: getfield      #13                 // Field from:I
       4: ireturn

  public final int getTo();
    Code:
       0: aload_0
       1: getfield      #16                 // Field to:I
       4: ireturn

  public final int getCount();
    Code:
       0: aload_0
       1: getfield      #19                 // Field count:I
       4: ireturn

  public final int component1();
    Code:
       0: aload_0
       1: getfield      #13                 // Field from:I
       4: ireturn

  public final int component2();
    Code:
       0: aload_0
       1: getfield      #16                 // Field to:I
       4: ireturn

  public final int component3();
    Code:
       0: aload_0
       1: getfield      #19                 // Field count:I
       4: ireturn

  public final Crane$Move copy(int, int, int);
    Code:
       0: new           #2                  // class Crane$Move
       3: dup
       4: iload_1
       5: iload_2
       6: iload_3
       7: invokespecial #33                 // Method "<init>":(III)V
      10: areturn

  public static Crane$Move copy$default(Crane$Move, int, int, int, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #13                 // Field from:I
      11: istore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #16                 // Field to:I
      23: istore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #19                 // Field count:I
      35: istore_3
      36: aload_0
      37: iload_1
      38: iload_2
      39: iload_3
      40: invokevirtual #37                 // Method copy:(III)LCrane$Move;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #41                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #44                 // String Move(from=
       9: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field from:I
      16: invokevirtual #51                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #53                 // String , to=
      21: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field to:I
      28: invokevirtual #51                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: ldc           #55                 // String , count=
      33: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #19                 // Field count:I
      40: invokevirtual #51                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #58                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #60                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field from:I
       4: invokestatic  #66                 // Method java/lang/Integer.hashCode:(I)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #16                 // Field to:I
      16: invokestatic  #66                 // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #19                 // Field count:I
      29: invokestatic  #66                 // Method java/lang/Integer.hashCode:(I)I
      32: iadd
      33: istore_1
      34: iload_1
      35: 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 Crane$Move
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Crane$Move
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field from:I
      25: aload_2
      26: getfield      #13                 // Field from:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #16                 // Field to:I
      38: aload_2
      39: getfield      #16                 // Field to:I
      42: if_icmpeq     47
      45: iconst_0
      46: ireturn
      47: aload_0
      48: getfield      #19                 // Field count:I
      51: aload_2
      52: getfield      #19                 // Field count:I
      55: if_icmpeq     60
      58: iconst_0
      59: ireturn
      60: iconst_1
      61: ireturn
}

Compiled from "Crane.kt"
final class Crane$readInput$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function0<java.lang.String> {
  public static final Crane$readInput$1 INSTANCE;

  Crane$readInput$1();
    Code:
       0: aload_0
       1: iconst_0
       2: ldc           #11                 // class kotlin/io/ConsoleKt
       4: ldc           #13                 // String readLine
       6: ldc           #15                 // String readLine()Ljava/lang/String;
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.String invoke();
    Code:
       0: invokestatic  #24                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: areturn

  public java.lang.Object invoke();
    Code:
       0: aload_0
       1: invokevirtual #27                 // Method invoke:()Ljava/lang/String;
       4: areturn

  static {};
    Code:
       0: new           #2                  // class Crane$readInput$1
       3: dup
       4: invokespecial #30                 // Method "<init>":()V
       7: putstatic     #33                 // Field INSTANCE:LCrane$readInput$1;
      10: return
}

Compiled from "Crane.kt"
public final class Crane$Input {
  private final java.util.List<java.util.List<java.lang.String>> state;

  private final java.util.List<Crane$Move> moves;

  public Crane$Input(java.util.List<? extends java.util.List<java.lang.String>>, java.util.List<Crane$Move>);
    Code:
       0: aload_1
       1: ldc           #10                 // String state
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #18                 // String moves
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokespecial #21                 // Method java/lang/Object."<init>":()V
      16: aload_0
      17: aload_1
      18: putfield      #24                 // Field state:Ljava/util/List;
      21: aload_0
      22: aload_2
      23: putfield      #26                 // Field moves:Ljava/util/List;
      26: return

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

  public final java.util.List<Crane$Move> getMoves();
    Code:
       0: aload_0
       1: getfield      #26                 // Field moves:Ljava/util/List;
       4: areturn

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

  public final java.util.List<Crane$Move> component2();
    Code:
       0: aload_0
       1: getfield      #26                 // Field moves:Ljava/util/List;
       4: areturn

  public final Crane$Input copy(java.util.List<? extends java.util.List<java.lang.String>>, java.util.List<Crane$Move>);
    Code:
       0: aload_1
       1: ldc           #10                 // String state
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #18                 // String moves
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #2                  // class Crane$Input
      15: dup
      16: aload_1
      17: aload_2
      18: invokespecial #40                 // Method "<init>":(Ljava/util/List;Ljava/util/List;)V
      21: areturn

  public static Crane$Input copy$default(Crane$Input, java.util.List, java.util.List, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #24                 // Field state:Ljava/util/List;
      10: astore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #26                 // Field moves:Ljava/util/List;
      21: astore_2
      22: aload_0
      23: aload_1
      24: aload_2
      25: invokevirtual #44                 // Method copy:(Ljava/util/List;Ljava/util/List;)LCrane$Input;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #48                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #49                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #51                 // String Input(state=
       9: invokevirtual #55                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #24                 // Field state:Ljava/util/List;
      16: invokevirtual #58                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      19: ldc           #60                 // String , moves=
      21: invokevirtual #55                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #26                 // Field moves:Ljava/util/List;
      28: invokevirtual #58                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #63                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #65                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #24                 // Field state:Ljava/util/List;
       4: invokevirtual #69                 // Method java/lang/Object.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #26                 // Field moves:Ljava/util/List;
      16: invokevirtual #69                 // Method java/lang/Object.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 Crane$Input
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Crane$Input
      20: astore_2
      21: aload_0
      22: getfield      #24                 // Field state:Ljava/util/List;
      25: aload_2
      26: getfield      #24                 // Field state:Ljava/util/List;
      29: invokestatic  #78                 // 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      #26                 // Field moves:Ljava/util/List;
      41: aload_2
      42: getfield      #26                 // Field moves:Ljava/util/List;
      45: invokestatic  #78                 // 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
}

Compiled from "Crane.kt"
public final class Crane {
  public static final Crane INSTANCE;

  private Crane();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final void solve();
    Code:
       0: aload_0
       1: invokespecial #15                 // Method readInput:()LCrane$Input;
       4: astore_1
       5: aload_0
       6: aload_1
       7: invokevirtual #21                 // Method Crane$Input.getState:()Ljava/util/List;
      10: aload_1
      11: invokevirtual #24                 // Method Crane$Input.getMoves:()Ljava/util/List;
      14: invokespecial #28                 // Method runMoves:(Ljava/util/List;Ljava/util/List;)Ljava/util/List;
      17: astore_2
      18: new           #30                 // class java/lang/StringBuilder
      21: dup
      22: invokespecial #31                 // Method java/lang/StringBuilder."<init>":()V
      25: ldc           #33                 // String Top of stacks:
      27: invokevirtual #37                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      30: aload_2
      31: checkcast     #39                 // class java/lang/Iterable
      34: astore_3
      35: astore        12
      37: iconst_0
      38: istore        4
      40: aload_3
      41: astore        5
      43: new           #41                 // class java/util/ArrayList
      46: dup
      47: aload_3
      48: bipush        10
      50: invokestatic  #47                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      53: invokespecial #50                 // Method java/util/ArrayList."<init>":(I)V
      56: checkcast     #52                 // class java/util/Collection
      59: astore        6
      61: iconst_0
      62: istore        7
      64: aload         5
      66: invokeinterface #56,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      71: astore        8
      73: aload         8
      75: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      80: ifeq          126
      83: aload         8
      85: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      90: astore        9
      92: aload         6
      94: aload         9
      96: checkcast     #68                 // class java/util/List
      99: astore        10
     101: astore        13
     103: iconst_0
     104: istore        11
     106: aload         10
     108: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     111: checkcast     #74                 // class java/lang/String
     114: aload         13
     116: swap
     117: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     122: pop
     123: goto          73
     126: aload         6
     128: checkcast     #68                 // class java/util/List
     131: nop
     132: aload         12
     134: swap
     135: checkcast     #39                 // class java/lang/Iterable
     138: ldc           #80                 // String
     140: checkcast     #82                 // class java/lang/CharSequence
     143: aconst_null
     144: aconst_null
     145: iconst_0
     146: aconst_null
     147: aconst_null
     148: bipush        62
     150: aconst_null
     151: invokestatic  #86                 // 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;
     154: invokevirtual #37                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     157: invokevirtual #90                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     160: getstatic     #96                 // Field java/lang/System.out:Ljava/io/PrintStream;
     163: swap
     164: invokevirtual #102                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     167: return

  private final Crane$Input readInput();
    Code:
       0: new           #41                 // class java/util/ArrayList
       3: dup
       4: invokespecial #119                // Method java/util/ArrayList."<init>":()V
       7: checkcast     #68                 // class java/util/List
      10: astore_1
      11: new           #41                 // class java/util/ArrayList
      14: dup
      15: invokespecial #119                // Method java/util/ArrayList."<init>":()V
      18: checkcast     #68                 // class java/util/List
      21: astore_2
      22: iconst_0
      23: istore_3
      24: iconst_1
      25: istore        4
      27: getstatic     #125                // Field Crane$readInput$1.INSTANCE:LCrane$readInput$1;
      30: checkcast     #127                // class kotlin/jvm/functions/Function0
      33: invokestatic  #133                // Method kotlin/sequences/SequencesKt.generateSequence:(Lkotlin/jvm/functions/Function0;)Lkotlin/sequences/Sequence;
      36: invokeinterface #136,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      41: astore        5
      43: aload         5
      45: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      50: ifeq          377
      53: aload         5
      55: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      60: checkcast     #74                 // class java/lang/String
      63: astore        6
      65: nop
      66: iload         4
      68: ifeq          265
      71: aload         6
      73: ldc           #80                 // String
      75: invokestatic  #142                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      78: ifeq          87
      81: iconst_0
      82: istore        4
      84: goto          43
      87: new           #144                // class kotlin/text/Regex
      90: dup
      91: ldc           #146                // String ^\\s*(\\d+\\s*)+$
      93: invokespecial #149                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      96: aload         6
      98: checkcast     #82                 // class java/lang/CharSequence
     101: invokevirtual #153                // Method kotlin/text/Regex.matchEntire:(Ljava/lang/CharSequence;)Lkotlin/text/MatchResult;
     104: astore        7
     106: aload         7
     108: ifnull        156
     111: aload         6
     113: checkcast     #82                 // class java/lang/CharSequence
     116: invokestatic  #159                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     119: invokevirtual #160                // Method java/lang/Object.toString:()Ljava/lang/String;
     122: checkcast     #82                 // class java/lang/CharSequence
     125: astore        8
     127: new           #144                // class kotlin/text/Regex
     130: dup
     131: ldc           #162                // String \\s+
     133: invokespecial #149                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
     136: astore        9
     138: iconst_0
     139: istore        10
     141: aload         9
     143: aload         8
     145: iload         10
     147: invokevirtual #166                // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;
     150: invokeinterface #170,  1          // InterfaceMethod java/util/List.size:()I
     155: istore_3
     156: new           #144                // class kotlin/text/Regex
     159: dup
     160: ldc           #172                // String \\[(\\w+)]
     162: invokespecial #149                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
     165: aload         6
     167: checkcast     #82                 // class java/lang/CharSequence
     170: iconst_0
     171: iconst_2
     172: aconst_null
     173: invokestatic  #176                // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;
     176: astore        8
     178: aload         8
     180: invokeinterface #136,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
     185: astore        9
     187: aload         9
     189: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     194: ifeq          43
     197: aload         9
     199: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     204: checkcast     #178                // class kotlin/text/MatchResult
     207: astore        10
     209: aload         10
     211: invokeinterface #182,  1          // InterfaceMethod kotlin/text/MatchResult.getRange:()Lkotlin/ranges/IntRange;
     216: invokevirtual #187                // Method kotlin/ranges/IntRange.getFirst:()I
     219: iconst_4
     220: idiv
     221: istore        11
     223: aload         10
     225: invokeinterface #190,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     230: iconst_1
     231: invokeinterface #194,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     236: checkcast     #74                 // class java/lang/String
     239: astore        12
     241: aload_1
     242: iconst_0
     243: new           #196                // class kotlin/Pair
     246: dup
     247: iload         11
     249: invokestatic  #202                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     252: aload         12
     254: invokespecial #205                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     257: invokeinterface #208,  3          // InterfaceMethod java/util/List.add:(ILjava/lang/Object;)V
     262: goto          187
     265: new           #144                // class kotlin/text/Regex
     268: dup
     269: ldc           #210                // String ^move (\\d+) from (\\d+) to (\\d+)$
     271: invokespecial #149                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
     274: aload         6
     276: checkcast     #82                 // class java/lang/CharSequence
     279: invokevirtual #153                // Method kotlin/text/Regex.matchEntire:(Ljava/lang/CharSequence;)Lkotlin/text/MatchResult;
     282: dup
     283: ifnonnull     297
     286: pop
     287: new           #212                // class java/lang/Error
     290: dup
     291: ldc           #214                // String Unexpected move input
     293: invokespecial #215                // Method java/lang/Error."<init>":(Ljava/lang/String;)V
     296: athrow
     297: astore        7
     299: aload_2
     300: new           #217                // class Crane$Move
     303: dup
     304: aload         7
     306: invokeinterface #190,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     311: iconst_2
     312: invokeinterface #194,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     317: checkcast     #74                 // class java/lang/String
     320: invokestatic  #221                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     323: iconst_1
     324: isub
     325: aload         7
     327: invokeinterface #190,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     332: iconst_3
     333: invokeinterface #194,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     338: checkcast     #74                 // class java/lang/String
     341: invokestatic  #221                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     344: iconst_1
     345: isub
     346: aload         7
     348: invokeinterface #190,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     353: iconst_1
     354: invokeinterface #194,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     359: checkcast     #74                 // class java/lang/String
     362: invokestatic  #221                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     365: invokespecial #224                // Method Crane$Move."<init>":(III)V
     368: invokeinterface #225,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     373: pop
     374: goto          43
     377: new           #41                 // class java/util/ArrayList
     380: dup
     381: iload_3
     382: invokespecial #50                 // Method java/util/ArrayList."<init>":(I)V
     385: astore        6
     387: iconst_0
     388: istore        7
     390: iload         7
     392: iload_3
     393: if_icmpge     435
     396: iload         7
     398: istore        8
     400: aload         6
     402: iload         8
     404: istore        9
     406: astore        13
     408: iconst_0
     409: istore        10
     411: new           #41                 // class java/util/ArrayList
     414: dup
     415: invokespecial #119                // Method java/util/ArrayList."<init>":()V
     418: checkcast     #68                 // class java/util/List
     421: nop
     422: aload         13
     424: swap
     425: invokevirtual #226                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     428: pop
     429: iinc          7, 1
     432: goto          390
     435: aload         6
     437: checkcast     #68                 // class java/util/List
     440: astore        5
     442: aload_1
     443: invokeinterface #227,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     448: astore        6
     450: aload         6
     452: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     457: ifeq          507
     460: aload         6
     462: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     467: checkcast     #196                // class kotlin/Pair
     470: astore        7
     472: aload         5
     474: aload         7
     476: invokevirtual #229                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     479: checkcast     #231                // class java/lang/Number
     482: invokevirtual #234                // Method java/lang/Number.intValue:()I
     485: invokeinterface #194,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     490: checkcast     #68                 // class java/util/List
     493: iconst_0
     494: aload         7
     496: invokevirtual #237                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     499: invokeinterface #208,  3          // InterfaceMethod java/util/List.add:(ILjava/lang/Object;)V
     504: goto          450
     507: new           #17                 // class Crane$Input
     510: dup
     511: aload         5
     513: aload_2
     514: invokespecial #240                // Method Crane$Input."<init>":(Ljava/util/List;Ljava/util/List;)V
     517: areturn

  private final java.util.List<java.util.List<java.lang.String>> runMoves(java.util.List<? extends java.util.List<java.lang.String>>, java.util.List<Crane$Move>);
    Code:
       0: aload_1
       1: checkcast     #39                 // class java/lang/Iterable
       4: astore        4
       6: iconst_0
       7: istore        5
       9: aload         4
      11: astore        6
      13: new           #41                 // class java/util/ArrayList
      16: dup
      17: aload         4
      19: bipush        10
      21: invokestatic  #47                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      24: invokespecial #50                 // Method java/util/ArrayList."<init>":(I)V
      27: checkcast     #52                 // class java/util/Collection
      30: astore        7
      32: iconst_0
      33: istore        8
      35: aload         6
      37: invokeinterface #56,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      42: astore        9
      44: aload         9
      46: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      51: ifeq          97
      54: aload         9
      56: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      61: astore        10
      63: aload         7
      65: aload         10
      67: checkcast     #68                 // class java/util/List
      70: astore        11
      72: astore        13
      74: iconst_0
      75: istore        12
      77: aload         11
      79: checkcast     #52                 // class java/util/Collection
      82: invokestatic  #263                // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;
      85: aload         13
      87: swap
      88: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      93: pop
      94: goto          44
      97: aload         7
      99: checkcast     #68                 // class java/util/List
     102: nop
     103: astore_3
     104: aload_2
     105: invokeinterface #227,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     110: astore        4
     112: aload         4
     114: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     119: ifeq          243
     122: aload         4
     124: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     129: checkcast     #217                // class Crane$Move
     132: astore        5
     134: aload_3
     135: aload         5
     137: invokevirtual #266                // Method Crane$Move.getFrom:()I
     140: invokeinterface #194,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     145: checkcast     #68                 // class java/util/List
     148: astore        6
     150: aload         6
     152: iconst_0
     153: aload         5
     155: invokevirtual #269                // Method Crane$Move.getCount:()I
     158: invokeinterface #273,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
     163: checkcast     #39                 // class java/lang/Iterable
     166: invokestatic  #277                // Method kotlin/collections/CollectionsKt.toList:(Ljava/lang/Iterable;)Ljava/util/List;
     169: astore        7
     171: aload         7
     173: invokeinterface #227,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     178: astore        8
     180: aload         8
     182: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     187: ifeq          214
     190: aload         8
     192: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     197: checkcast     #74                 // class java/lang/String
     200: astore        9
     202: aload         6
     204: iconst_0
     205: invokeinterface #280,  2          // InterfaceMethod java/util/List.remove:(I)Ljava/lang/Object;
     210: pop
     211: goto          180
     214: aload_3
     215: aload         5
     217: invokevirtual #283                // Method Crane$Move.getTo:()I
     220: invokeinterface #194,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     225: checkcast     #68                 // class java/util/List
     228: iconst_0
     229: aload         7
     231: checkcast     #52                 // class java/util/Collection
     234: invokeinterface #287,  3          // InterfaceMethod java/util/List.addAll:(ILjava/util/Collection;)Z
     239: pop
     240: goto          112
     243: aload_3
     244: areturn

  static {};
    Code:
       0: new           #2                  // class Crane
       3: dup
       4: invokespecial #295                // Method "<init>":()V
       7: putstatic     #297                // Field INSTANCE:LCrane;
      10: return
}

Compiled from "Crane.kt"
public final class CraneKt {
  public static final void main();
    Code:
       0: getstatic     #12                 // Field Crane.INSTANCE:LCrane;
       3: invokevirtual #15                 // Method Crane.solve:()V
       6: return

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