fun main() {

    class Terrain constructor(input: List<String>) {
        val distances: HashMap<Point, Int> = HashMap()
        var queue: ArrayDeque<Point> = ArrayDeque()
        var heightmap: List<List<Char>> = input.map { it.toList() }

        fun enqueue(point: Point, distance: Int) {
            if (distances[point] == null || distances[point]!! > distance) {
                queue += point
                distances[point] = distance
            }
        }

        fun find(c: Char): Point {
            heightmap.forEach { x, y ->
                if (heightmap[x][y] == c) {
                    return Point(x, y)
                }
            }

            error("Not found $c")
        }

        fun height(point: Point): Int {
            val height = heightmap[point.x][point.y]
            return when (height) {
                'S' -> 0
                'E' -> 'z' - 'a'
                else -> height - 'a'
            }
        }

        fun minSteps(start: Point, end: Point): Int {
            enqueue(start, 0)

            while (queue.isNotEmpty()) {
                val point = queue.removeFirst()
                val distance = distances[point]!! + 1
                val height = height(point)

                walk(Point(point.x-1, point.y), distance, height)
                walk(Point(point.x+1, point.y), distance, height)
                walk(Point(point.x, point.y-1), distance, height)
                walk(Point(point.x, point.y+1), distance, height)
            }

            return distances[end] ?: Int.MAX_VALUE
        }

        fun walk(p: Point, distance: Int, height: Int) {
            if (p.x !in heightmap.indices || p.y !in 0 until heightmap[0].size) return
            if (height <= height(p) + 1) {
                enqueue(p, distance)
            }
        }
    }

    fun part1(input: List<String>): Int {
        val terrain = Terrain(input)
        val start = terrain.find('E')
        val end = terrain.find('S')
        return terrain.minSteps(start, end)
    }

    fun part2(input: List<String>): Int {
        val endingPoints = mutableListOf<Point>()
        val terrain = Terrain(input)

        terrain.heightmap
            .forEach { x, y ->
                val c = terrain.heightmap[x][y]
                if (c == 'a' || c == 'S') {
                    endingPoints += Point(x, y)
                }
        }

        val start = terrain.find('E')
        terrain.minSteps(start, endingPoints[0])

        return endingPoints.minOf { terrain.distances[it] ?: Int.MAX_VALUE }
    }

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

Compiled from "Day12.kt"
public final class Day12Kt$main$Terrain {
  private final java.util.HashMap<Point, java.lang.Integer> distances;

  private kotlin.collections.ArrayDeque<Point> queue;

  private java.util.List<? extends java.util.List<java.lang.Character>> heightmap;

  public Day12Kt$main$Terrain(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #9                  // String input
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #18                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: new           #20                 // class java/util/HashMap
      14: dup
      15: invokespecial #21                 // Method java/util/HashMap."<init>":()V
      18: putfield      #25                 // Field distances:Ljava/util/HashMap;
      21: aload_0
      22: new           #27                 // class kotlin/collections/ArrayDeque
      25: dup
      26: invokespecial #28                 // Method kotlin/collections/ArrayDeque."<init>":()V
      29: putfield      #32                 // Field queue:Lkotlin/collections/ArrayDeque;
      32: aload_0
      33: aload_1
      34: checkcast     #34                 // class java/lang/Iterable
      37: astore_2
      38: astore        11
      40: iconst_0
      41: istore_3
      42: aload_2
      43: astore        4
      45: new           #36                 // class java/util/ArrayList
      48: dup
      49: aload_2
      50: bipush        10
      52: invokestatic  #42                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      55: invokespecial #45                 // Method java/util/ArrayList."<init>":(I)V
      58: checkcast     #47                 // class java/util/Collection
      61: astore        5
      63: iconst_0
      64: istore        6
      66: aload         4
      68: invokeinterface #51,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      73: astore        7
      75: aload         7
      77: invokeinterface #57,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      82: ifeq          128
      85: aload         7
      87: invokeinterface #61,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      92: astore        8
      94: aload         5
      96: aload         8
      98: checkcast     #63                 // class java/lang/String
     101: astore        9
     103: astore        12
     105: iconst_0
     106: istore        10
     108: aload         9
     110: checkcast     #65                 // class java/lang/CharSequence
     113: invokestatic  #71                 // Method kotlin/text/StringsKt.toList:(Ljava/lang/CharSequence;)Ljava/util/List;
     116: aload         12
     118: swap
     119: invokeinterface #75,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     124: pop
     125: goto          75
     128: aload         5
     130: checkcast     #77                 // class java/util/List
     133: nop
     134: aload         11
     136: swap
     137: putfield      #81                 // Field heightmap:Ljava/util/List;
     140: return

  public final java.util.HashMap<Point, java.lang.Integer> getDistances();
    Code:
       0: aload_0
       1: getfield      #25                 // Field distances:Ljava/util/HashMap;
       4: areturn

  public final kotlin.collections.ArrayDeque<Point> getQueue();
    Code:
       0: aload_0
       1: getfield      #32                 // Field queue:Lkotlin/collections/ArrayDeque;
       4: areturn

  public final void setQueue(kotlin.collections.ArrayDeque<Point>);
    Code:
       0: aload_1
       1: ldc           #107                // String <set-?>
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: putfield      #32                 // Field queue:Lkotlin/collections/ArrayDeque;
      11: return

  public final java.util.List<java.util.List<java.lang.Character>> getHeightmap();
    Code:
       0: aload_0
       1: getfield      #81                 // Field heightmap:Ljava/util/List;
       4: areturn

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

  public final void enqueue(Point, int);
    Code:
       0: aload_1
       1: ldc           #116                // String point
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #25                 // Field distances:Ljava/util/HashMap;
      10: aload_1
      11: invokevirtual #120                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
      14: ifnull        39
      17: aload_0
      18: getfield      #25                 // Field distances:Ljava/util/HashMap;
      21: aload_1
      22: invokevirtual #120                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
      25: dup
      26: invokestatic  #124                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      29: checkcast     #126                // class java/lang/Number
      32: invokevirtual #130                // Method java/lang/Number.intValue:()I
      35: iload_2
      36: if_icmple     73
      39: aload_0
      40: getfield      #32                 // Field queue:Lkotlin/collections/ArrayDeque;
      43: checkcast     #47                 // class java/util/Collection
      46: aload_1
      47: invokeinterface #75,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      52: pop
      53: iload_2
      54: invokestatic  #136                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      57: astore_3
      58: aload_0
      59: getfield      #25                 // Field distances:Ljava/util/HashMap;
      62: checkcast     #138                // class java/util/Map
      65: aload_1
      66: aload_3
      67: invokeinterface #142,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      72: pop
      73: return

  public final Point find(char);
    Code:
       0: aload_0
       1: getfield      #81                 // Field heightmap:Ljava/util/List;
       4: astore_2
       5: iconst_0
       6: istore_3
       7: iconst_0
       8: istore        4
      10: aload_2
      11: checkcast     #47                 // class java/util/Collection
      14: invokeinterface #149,  1          // InterfaceMethod java/util/Collection.size:()I
      19: istore        5
      21: iload         4
      23: iload         5
      25: if_icmpge     131
      28: aload_2
      29: iload         4
      31: invokeinterface #152,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      36: checkcast     #77                 // class java/util/List
      39: astore        6
      41: iconst_0
      42: istore        7
      44: aload         6
      46: checkcast     #47                 // class java/util/Collection
      49: invokeinterface #149,  1          // InterfaceMethod java/util/Collection.size:()I
      54: istore        8
      56: iload         7
      58: iload         8
      60: if_icmpge     125
      63: iload         4
      65: iload         7
      67: istore        9
      69: istore        10
      71: iconst_0
      72: istore        11
      74: aload_0
      75: getfield      #81                 // Field heightmap:Ljava/util/List;
      78: iload         10
      80: invokeinterface #152,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      85: checkcast     #77                 // class java/util/List
      88: iload         9
      90: invokeinterface #152,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      95: checkcast     #154                // class java/lang/Character
      98: invokevirtual #158                // Method java/lang/Character.charValue:()C
     101: iload_1
     102: if_icmpne     117
     105: new           #160                // class Point
     108: dup
     109: iload         10
     111: iload         9
     113: invokespecial #163                // Method Point."<init>":(II)V
     116: areturn
     117: nop
     118: nop
     119: iinc          7, 1
     122: goto          56
     125: iinc          4, 1
     128: goto          21
     131: nop
     132: new           #165                // class java/lang/IllegalStateException
     135: dup
     136: new           #167                // class java/lang/StringBuilder
     139: dup
     140: invokespecial #168                // Method java/lang/StringBuilder."<init>":()V
     143: ldc           #170                // String Not found
     145: invokevirtual #174                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     148: iload_1
     149: invokevirtual #177                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     152: invokevirtual #181                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     155: invokevirtual #182                // Method java/lang/Object.toString:()Ljava/lang/String;
     158: invokespecial #185                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     161: athrow

  public final int height(Point);
    Code:
       0: aload_1
       1: ldc           #116                // String point
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #81                 // Field heightmap:Ljava/util/List;
      10: aload_1
      11: invokevirtual #200                // Method Point.getX:()I
      14: invokeinterface #152,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      19: checkcast     #77                 // class java/util/List
      22: aload_1
      23: invokevirtual #203                // Method Point.getY:()I
      26: invokeinterface #152,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      31: checkcast     #154                // class java/lang/Character
      34: invokevirtual #158                // Method java/lang/Character.charValue:()C
      37: istore_2
      38: iload_2
      39: lookupswitch  { // 2
                    69: 68
                    83: 64
               default: 73
          }
      64: iconst_0
      65: goto          77
      68: bipush        25
      70: goto          77
      73: iload_2
      74: bipush        97
      76: isub
      77: ireturn

  public final int minSteps(Point, Point);
    Code:
       0: aload_1
       1: ldc           #207                // String start
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #209                // String end
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_1
      14: iconst_0
      15: invokevirtual #211                // Method enqueue:(LPoint;I)V
      18: aload_0
      19: getfield      #32                 // Field queue:Lkotlin/collections/ArrayDeque;
      22: checkcast     #47                 // class java/util/Collection
      25: invokeinterface #214,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      30: ifne          37
      33: iconst_1
      34: goto          38
      37: iconst_0
      38: ifeq          184
      41: aload_0
      42: getfield      #32                 // Field queue:Lkotlin/collections/ArrayDeque;
      45: invokevirtual #217                // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;
      48: checkcast     #160                // class Point
      51: astore_3
      52: aload_0
      53: getfield      #25                 // Field distances:Ljava/util/HashMap;
      56: aload_3
      57: invokevirtual #120                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
      60: dup
      61: invokestatic  #124                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      64: checkcast     #126                // class java/lang/Number
      67: invokevirtual #130                // Method java/lang/Number.intValue:()I
      70: iconst_1
      71: iadd
      72: istore        4
      74: aload_0
      75: aload_3
      76: invokevirtual #219                // Method height:(LPoint;)I
      79: istore        5
      81: aload_0
      82: new           #160                // class Point
      85: dup
      86: aload_3
      87: invokevirtual #200                // Method Point.getX:()I
      90: iconst_1
      91: isub
      92: aload_3
      93: invokevirtual #203                // Method Point.getY:()I
      96: invokespecial #163                // Method Point."<init>":(II)V
      99: iload         4
     101: iload         5
     103: invokevirtual #223                // Method walk:(LPoint;II)V
     106: aload_0
     107: new           #160                // class Point
     110: dup
     111: aload_3
     112: invokevirtual #200                // Method Point.getX:()I
     115: iconst_1
     116: iadd
     117: aload_3
     118: invokevirtual #203                // Method Point.getY:()I
     121: invokespecial #163                // Method Point."<init>":(II)V
     124: iload         4
     126: iload         5
     128: invokevirtual #223                // Method walk:(LPoint;II)V
     131: aload_0
     132: new           #160                // class Point
     135: dup
     136: aload_3
     137: invokevirtual #200                // Method Point.getX:()I
     140: aload_3
     141: invokevirtual #203                // Method Point.getY:()I
     144: iconst_1
     145: isub
     146: invokespecial #163                // Method Point."<init>":(II)V
     149: iload         4
     151: iload         5
     153: invokevirtual #223                // Method walk:(LPoint;II)V
     156: aload_0
     157: new           #160                // class Point
     160: dup
     161: aload_3
     162: invokevirtual #200                // Method Point.getX:()I
     165: aload_3
     166: invokevirtual #203                // Method Point.getY:()I
     169: iconst_1
     170: iadd
     171: invokespecial #163                // Method Point."<init>":(II)V
     174: iload         4
     176: iload         5
     178: invokevirtual #223                // Method walk:(LPoint;II)V
     181: goto          18
     184: aload_0
     185: getfield      #25                 // Field distances:Ljava/util/HashMap;
     188: aload_2
     189: invokevirtual #120                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
     192: checkcast     #132                // class java/lang/Integer
     195: dup
     196: ifnull        205
     199: invokevirtual #224                // Method java/lang/Integer.intValue:()I
     202: goto          208
     205: pop
     206: ldc           #225                // int 2147483647
     208: ireturn

  public final void walk(Point, int, int);
    Code:
       0: aload_1
       1: ldc           #227                // String p
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #81                 // Field heightmap:Ljava/util/List;
      10: checkcast     #47                 // class java/util/Collection
      13: invokeinterface #149,  1          // InterfaceMethod java/util/Collection.size:()I
      18: istore        4
      20: aload_1
      21: invokevirtual #200                // Method Point.getX:()I
      24: istore        5
      26: iconst_0
      27: iload         5
      29: if_icmpgt     47
      32: iload         5
      34: iload         4
      36: if_icmpge     43
      39: iconst_1
      40: goto          48
      43: iconst_0
      44: goto          48
      47: iconst_0
      48: ifeq          102
      51: aload_0
      52: getfield      #81                 // Field heightmap:Ljava/util/List;
      55: iconst_0
      56: invokeinterface #152,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      61: checkcast     #77                 // class java/util/List
      64: invokeinterface #228,  1          // InterfaceMethod java/util/List.size:()I
      69: istore        4
      71: aload_1
      72: invokevirtual #203                // Method Point.getY:()I
      75: istore        5
      77: iconst_0
      78: iload         5
      80: if_icmpgt     98
      83: iload         5
      85: iload         4
      87: if_icmpge     94
      90: iconst_1
      91: goto          99
      94: iconst_0
      95: goto          99
      98: iconst_0
      99: ifne          103
     102: return
     103: iload_3
     104: aload_0
     105: aload_1
     106: invokevirtual #219                // Method height:(LPoint;)I
     109: iconst_1
     110: iadd
     111: if_icmpgt     120
     114: aload_0
     115: aload_1
     116: iload_2
     117: invokevirtual #211                // Method enqueue:(LPoint;I)V
     120: return
}

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

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

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: new           #43                 // class Day12Kt$main$Terrain
       3: dup
       4: aload_0
       5: invokespecial #47                 // Method Day12Kt$main$Terrain."<init>":(Ljava/util/List;)V
       8: astore_1
       9: aload_1
      10: bipush        69
      12: invokevirtual #51                 // Method Day12Kt$main$Terrain.find:(C)LPoint;
      15: astore_2
      16: aload_1
      17: bipush        83
      19: invokevirtual #51                 // Method Day12Kt$main$Terrain.find:(C)LPoint;
      22: astore_3
      23: aload_1
      24: aload_2
      25: aload_3
      26: invokevirtual #55                 // Method Day12Kt$main$Terrain.minSteps:(LPoint;LPoint;)I
      29: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: new           #62                 // class java/util/ArrayList
       3: dup
       4: invokespecial #64                 // Method java/util/ArrayList."<init>":()V
       7: checkcast     #66                 // class java/util/List
      10: astore_1
      11: new           #43                 // class Day12Kt$main$Terrain
      14: dup
      15: aload_0
      16: invokespecial #47                 // Method Day12Kt$main$Terrain."<init>":(Ljava/util/List;)V
      19: astore_2
      20: aload_2
      21: invokevirtual #70                 // Method Day12Kt$main$Terrain.getHeightmap:()Ljava/util/List;
      24: astore_3
      25: nop
      26: iconst_0
      27: istore        4
      29: iconst_0
      30: istore        5
      32: aload_3
      33: checkcast     #72                 // class java/util/Collection
      36: invokeinterface #76,  1           // InterfaceMethod java/util/Collection.size:()I
      41: istore        6
      43: iload         5
      45: iload         6
      47: if_icmpge     187
      50: aload_3
      51: iload         5
      53: invokeinterface #80,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      58: checkcast     #66                 // class java/util/List
      61: astore        7
      63: iconst_0
      64: istore        8
      66: aload         7
      68: checkcast     #72                 // class java/util/Collection
      71: invokeinterface #76,  1           // InterfaceMethod java/util/Collection.size:()I
      76: istore        9
      78: iload         8
      80: iload         9
      82: if_icmpge     181
      85: iload         5
      87: iload         8
      89: istore        10
      91: istore        11
      93: iconst_0
      94: istore        12
      96: aload_2
      97: invokevirtual #70                 // Method Day12Kt$main$Terrain.getHeightmap:()Ljava/util/List;
     100: iload         11
     102: invokeinterface #80,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     107: checkcast     #66                 // class java/util/List
     110: iload         10
     112: invokeinterface #80,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     117: checkcast     #82                 // class java/lang/Character
     120: invokevirtual #86                 // Method java/lang/Character.charValue:()C
     123: istore        13
     125: iload         13
     127: lookupswitch  { // 2
                    83: 152
                    97: 152
               default: 173
          }
     152: aload_1
     153: checkcast     #72                 // class java/util/Collection
     156: new           #88                 // class Point
     159: dup
     160: iload         11
     162: iload         10
     164: invokespecial #91                 // Method Point."<init>":(II)V
     167: invokeinterface #95,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     172: pop
     173: nop
     174: nop
     175: iinc          8, 1
     178: goto          78
     181: iinc          5, 1
     184: goto          43
     187: nop
     188: aload_2
     189: bipush        69
     191: invokevirtual #51                 // Method Day12Kt$main$Terrain.find:(C)LPoint;
     194: astore_3
     195: aload_2
     196: aload_3
     197: aload_1
     198: iconst_0
     199: invokeinterface #80,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     204: checkcast     #88                 // class Point
     207: invokevirtual #55                 // Method Day12Kt$main$Terrain.minSteps:(LPoint;LPoint;)I
     210: pop
     211: aload_1
     212: checkcast     #97                 // class java/lang/Iterable
     215: invokeinterface #101,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     220: astore        5
     222: aload         5
     224: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     229: ifne          240
     232: new           #109                // class java/util/NoSuchElementException
     235: dup
     236: invokespecial #110                // Method java/util/NoSuchElementException."<init>":()V
     239: athrow
     240: aload         5
     242: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     247: checkcast     #88                 // class Point
     250: astore        6
     252: iconst_0
     253: istore        7
     255: aload_2
     256: invokevirtual #118                // Method Day12Kt$main$Terrain.getDistances:()Ljava/util/HashMap;
     259: aload         6
     261: invokevirtual #123                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
     264: checkcast     #125                // class java/lang/Integer
     267: dup
     268: ifnull        277
     271: invokevirtual #128                // Method java/lang/Integer.intValue:()I
     274: goto          280
     277: pop
     278: ldc           #129                // int 2147483647
     280: istore        6
     282: aload         5
     284: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     289: ifeq          348
     292: aload         5
     294: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     299: checkcast     #88                 // class Point
     302: astore        7
     304: iconst_0
     305: istore        8
     307: aload_2
     308: invokevirtual #118                // Method Day12Kt$main$Terrain.getDistances:()Ljava/util/HashMap;
     311: aload         7
     313: invokevirtual #123                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
     316: checkcast     #125                // class java/lang/Integer
     319: dup
     320: ifnull        329
     323: invokevirtual #128                // Method java/lang/Integer.intValue:()I
     326: goto          332
     329: pop
     330: ldc           #129                // int 2147483647
     332: istore        7
     334: iload         6
     336: iload         7
     338: if_icmple     282
     341: iload         7
     343: istore        6
     345: goto          282
     348: iload         6
     350: ireturn
}


fun main() {
    val day16 = Day16(readInput("inputs/Day16"))
    println(day16.part1())
    println(day16.part2())
}

class Day16(input: List<String>) {
    private val valves = input.map(Valve::from).associateBy(Valve::name)
    private val usefulValves = valves.filter { it.value.rate > 0 }

    private val distances = computeDistances()

    fun part1() = traverse(minutes = 30)

    fun part2() = traverse(minutes = 26, elephantGoesNext = true)

    private fun traverse(
        minutes: Int,
        current: Valve = valves.getValue("AA"),
        remaining: Set<Valve> = usefulValves.values.toSet(),
        cache: MutableMap<State, Int> = mutableMapOf(),
        elephantGoesNext: Boolean = false
    ): Int {
        val currentScore = minutes * current.rate
        val currentState = State(current.name, minutes, remaining)

        return currentScore + cache.getOrPut(currentState) {
            val validValves = remaining.filter { next -> distances[current.name]!![next.name]!! < minutes }
            var maxCurrent = 0

            if (validValves.isNotEmpty()) {
                maxCurrent = validValves.maxOf { next ->
                    val remainingMinutes = minutes - 1 - distances[current.name]!![next.name]!!
                    traverse(remainingMinutes, next, remaining - next, cache, elephantGoesNext)
                }
            }

            maxOf(maxCurrent, if (elephantGoesNext) traverse(minutes = 26, remaining = remaining) else 0)
        }
    }

    private fun computeDistances(): Map<String, Map<String, Int>> {
        return valves.keys.map { valve ->
            val distances = mutableMapOf<String, Int>().withDefault { Int.MAX_VALUE }.apply { put(valve, 0) }
            val toVisit = mutableListOf(valve)
            while (toVisit.isNotEmpty()) {
                val current = toVisit.removeFirst()
                valves[current]!!.next.forEach { adj ->
                    val newDistance = distances[current]!! + 1
                    if (newDistance < distances.getValue(adj)) {
                        distances[adj] = newDistance
                        toVisit.add(adj)
                    }
                }
            }
            distances
        }.associateBy { it.keys.first() }
    }

    private data class State(val current: String, val minutes: Int, val opened: Set<Valve>)

    private data class Valve(val name: String, val rate: Int, val next: List<String>) {
        companion object {
            fun from(line: String): Valve {
                return Valve(
                    name = line.substringAfter("Valve ").substringBefore(" "),
                    rate = line.substringAfter("rate=").substringBefore(";").toInt(),
                    next = line.substringAfter("to valve").substringAfter(" ").split(", ")
                )
            }
        }
    }
}

Compiled from "Day16.kt"
final class Day16$State {
  private final java.lang.String current;

  private final int minutes;

  private final java.util.Set<Day16$Valve> opened;

  public Day16$State(java.lang.String, int, java.util.Set<Day16$Valve>);
    Code:
       0: aload_1
       1: ldc           #10                 // String current
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_3
       7: ldc           #18                 // String opened
       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 current:Ljava/lang/String;
      21: aload_0
      22: iload_2
      23: putfield      #28                 // Field minutes:I
      26: aload_0
      27: aload_3
      28: putfield      #31                 // Field opened:Ljava/util/Set;
      31: return

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

  public final int getMinutes();
    Code:
       0: aload_0
       1: getfield      #28                 // Field minutes:I
       4: ireturn

  public final java.util.Set<Day16$Valve> getOpened();
    Code:
       0: aload_0
       1: getfield      #31                 // Field opened:Ljava/util/Set;
       4: areturn

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

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

  public final java.util.Set<Day16$Valve> component3();
    Code:
       0: aload_0
       1: getfield      #31                 // Field opened:Ljava/util/Set;
       4: areturn

  public final Day16$State copy(java.lang.String, int, java.util.Set<Day16$Valve>);
    Code:
       0: aload_1
       1: ldc           #10                 // String current
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_3
       7: ldc           #18                 // String opened
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #2                  // class Day16$State
      15: dup
      16: aload_1
      17: iload_2
      18: aload_3
      19: invokespecial #48                 // Method "<init>":(Ljava/lang/String;ILjava/util/Set;)V
      22: areturn

  public static Day16$State copy$default(Day16$State, java.lang.String, int, java.util.Set, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #24                 // Field current:Ljava/lang/String;
      11: astore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #28                 // Field minutes:I
      23: istore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #31                 // Field opened:Ljava/util/Set;
      35: astore_3
      36: aload_0
      37: aload_1
      38: iload_2
      39: aload_3
      40: invokevirtual #52                 // Method copy:(Ljava/lang/String;ILjava/util/Set;)LDay16$State;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #55                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #56                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #58                 // String State(current=
       9: invokevirtual #62                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #24                 // Field current:Ljava/lang/String;
      16: invokevirtual #62                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: ldc           #64                 // String , minutes=
      21: invokevirtual #62                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #28                 // Field minutes:I
      28: invokevirtual #67                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: ldc           #69                 // String , opened=
      33: invokevirtual #62                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #31                 // Field opened:Ljava/util/Set;
      40: invokevirtual #72                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #75                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #77                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #24                 // Field current:Ljava/lang/String;
       4: invokevirtual #82                 // Method java/lang/String.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #28                 // Field minutes:I
      16: invokestatic  #87                 // 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      #31                 // Field opened:Ljava/util/Set;
      29: invokevirtual #88                 // Method java/lang/Object.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 Day16$State
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day16$State
      20: astore_2
      21: aload_0
      22: getfield      #24                 // Field current:Ljava/lang/String;
      25: aload_2
      26: getfield      #24                 // Field current:Ljava/lang/String;
      29: invokestatic  #96                 // 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      #28                 // Field minutes:I
      41: aload_2
      42: getfield      #28                 // Field minutes:I
      45: if_icmpeq     50
      48: iconst_0
      49: ireturn
      50: aload_0
      51: getfield      #31                 // Field opened:Ljava/util/Set;
      54: aload_2
      55: getfield      #31                 // Field opened:Ljava/util/Set;
      58: invokestatic  #96                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      61: ifne          66
      64: iconst_0
      65: ireturn
      66: iconst_1
      67: ireturn
}

Compiled from "Day16.kt"
final class Day16$Valve {
  public static final Day16$Valve$Companion Companion;

  private final java.lang.String name;

  private final int rate;

  private final java.util.List<java.lang.String> next;

  public Day16$Valve(java.lang.String, int, java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #10                 // String name
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_3
       7: ldc           #18                 // String next
       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 name:Ljava/lang/String;
      21: aload_0
      22: iload_2
      23: putfield      #28                 // Field rate:I
      26: aload_0
      27: aload_3
      28: putfield      #31                 // Field next:Ljava/util/List;
      31: return

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

  public final int getRate();
    Code:
       0: aload_0
       1: getfield      #28                 // Field rate:I
       4: ireturn

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

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

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

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

  public final Day16$Valve copy(java.lang.String, int, java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #10                 // String name
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_3
       7: ldc           #18                 // String next
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #2                  // class Day16$Valve
      15: dup
      16: aload_1
      17: iload_2
      18: aload_3
      19: invokespecial #48                 // Method "<init>":(Ljava/lang/String;ILjava/util/List;)V
      22: areturn

  public static Day16$Valve copy$default(Day16$Valve, java.lang.String, int, java.util.List, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #24                 // Field name:Ljava/lang/String;
      11: astore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #28                 // Field rate:I
      23: istore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #31                 // Field next:Ljava/util/List;
      35: astore_3
      36: aload_0
      37: aload_1
      38: iload_2
      39: aload_3
      40: invokevirtual #52                 // Method copy:(Ljava/lang/String;ILjava/util/List;)LDay16$Valve;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #55                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #56                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #58                 // String Valve(name=
       9: invokevirtual #62                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #24                 // Field name:Ljava/lang/String;
      16: invokevirtual #62                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: ldc           #64                 // String , rate=
      21: invokevirtual #62                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #28                 // Field rate:I
      28: invokevirtual #67                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: ldc           #69                 // String , next=
      33: invokevirtual #62                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #31                 // Field next:Ljava/util/List;
      40: invokevirtual #72                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #75                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #77                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #24                 // Field name:Ljava/lang/String;
       4: invokevirtual #82                 // Method java/lang/String.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #28                 // Field rate:I
      16: invokestatic  #87                 // 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      #31                 // Field next:Ljava/util/List;
      29: invokevirtual #88                 // Method java/lang/Object.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 Day16$Valve
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day16$Valve
      20: astore_2
      21: aload_0
      22: getfield      #24                 // Field name:Ljava/lang/String;
      25: aload_2
      26: getfield      #24                 // Field name:Ljava/lang/String;
      29: invokestatic  #96                 // 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      #28                 // Field rate:I
      41: aload_2
      42: getfield      #28                 // Field rate:I
      45: if_icmpeq     50
      48: iconst_0
      49: ireturn
      50: aload_0
      51: getfield      #31                 // Field next:Ljava/util/List;
      54: aload_2
      55: getfield      #31                 // Field next:Ljava/util/List;
      58: invokestatic  #96                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      61: ifne          66
      64: iconst_0
      65: ireturn
      66: iconst_1
      67: ireturn

  static {};
    Code:
       0: new           #101                // class Day16$Valve$Companion
       3: dup
       4: aconst_null
       5: invokespecial #104                // Method Day16$Valve$Companion."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
       8: putstatic     #108                // Field Companion:LDay16$Valve$Companion;
      11: return
}

Compiled from "Day16.kt"
public final class Day16 {
  private final java.util.Map<java.lang.String, Day16$Valve> valves;

  private final java.util.Map<java.lang.String, Day16$Valve> usefulValves;

  private final java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.lang.Integer>> distances;

  public Day16(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #10                 // String input
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #19                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: checkcast     #21                 // class java/lang/Iterable
      15: astore_2
      16: getstatic     #27                 // Field Day16$Valve.Companion:LDay16$Valve$Companion;
      19: astore_3
      20: astore        12
      22: iconst_0
      23: istore        4
      25: aload_2
      26: astore        5
      28: new           #29                 // class java/util/ArrayList
      31: dup
      32: aload_2
      33: bipush        10
      35: invokestatic  #35                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      38: invokespecial #38                 // Method java/util/ArrayList."<init>":(I)V
      41: checkcast     #40                 // class java/util/Collection
      44: astore        6
      46: iconst_0
      47: istore        7
      49: aload         5
      51: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      56: astore        8
      58: aload         8
      60: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      65: ifeq          109
      68: aload         8
      70: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      75: astore        9
      77: aload         6
      79: aload         9
      81: checkcast     #56                 // class java/lang/String
      84: astore        10
      86: astore        13
      88: iconst_0
      89: istore        11
      91: aload_3
      92: aload         10
      94: invokevirtual #62                 // Method Day16$Valve$Companion.from:(Ljava/lang/String;)LDay16$Valve;
      97: aload         13
      99: swap
     100: invokeinterface #66,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     105: pop
     106: goto          58
     109: aload         6
     111: checkcast     #68                 // class java/util/List
     114: nop
     115: aload         12
     117: swap
     118: checkcast     #21                 // class java/lang/Iterable
     121: astore_2
     122: astore        12
     124: iconst_0
     125: istore_3
     126: aload_2
     127: bipush        10
     129: invokestatic  #35                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     132: invokestatic  #74                 // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     135: bipush        16
     137: invokestatic  #80                 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     140: istore        4
     142: aload_2
     143: astore        5
     145: new           #82                 // class java/util/LinkedHashMap
     148: dup
     149: iload         4
     151: invokespecial #83                 // Method java/util/LinkedHashMap."<init>":(I)V
     154: checkcast     #85                 // class java/util/Map
     157: astore        6
     159: iconst_0
     160: istore        7
     162: aload         5
     164: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     169: astore        8
     171: aload         8
     173: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     178: ifeq          223
     181: aload         8
     183: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     188: astore        9
     190: aload         6
     192: aload         9
     194: checkcast     #23                 // class Day16$Valve
     197: astore        10
     199: astore        13
     201: iconst_0
     202: istore        11
     204: aload         10
     206: invokevirtual #89                 // Method Day16$Valve.getName:()Ljava/lang/String;
     209: aload         13
     211: swap
     212: aload         9
     214: invokeinterface #93,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     219: pop
     220: goto          171
     223: aload         6
     225: nop
     226: aload         12
     228: swap
     229: putfield      #97                 // Field valves:Ljava/util/Map;
     232: aload_0
     233: aload_0
     234: getfield      #97                 // Field valves:Ljava/util/Map;
     237: astore_2
     238: astore        12
     240: iconst_0
     241: istore_3
     242: aload_2
     243: astore        4
     245: new           #82                 // class java/util/LinkedHashMap
     248: dup
     249: invokespecial #98                 // Method java/util/LinkedHashMap."<init>":()V
     252: checkcast     #85                 // class java/util/Map
     255: astore        5
     257: iconst_0
     258: istore        6
     260: aload         4
     262: invokeinterface #102,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     267: invokeinterface #105,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     272: astore        7
     274: aload         7
     276: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     281: ifeq          352
     284: aload         7
     286: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     291: checkcast     #107                // class java/util/Map$Entry
     294: astore        8
     296: aload         8
     298: astore        9
     300: iconst_0
     301: istore        10
     303: aload         9
     305: invokeinterface #110,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     310: checkcast     #23                 // class Day16$Valve
     313: invokevirtual #114                // Method Day16$Valve.getRate:()I
     316: ifle          323
     319: iconst_1
     320: goto          324
     323: iconst_0
     324: ifeq          274
     327: aload         5
     329: aload         8
     331: invokeinterface #117,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     336: aload         8
     338: invokeinterface #110,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     343: invokeinterface #93,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     348: pop
     349: goto          274
     352: aload         5
     354: nop
     355: aload         12
     357: swap
     358: putfield      #120                // Field usefulValves:Ljava/util/Map;
     361: aload_0
     362: aload_0
     363: invokespecial #124                // Method computeDistances:()Ljava/util/Map;
     366: putfield      #127                // Field distances:Ljava/util/Map;
     369: return

  public final int part1();
    Code:
       0: aload_0
       1: bipush        30
       3: aconst_null
       4: aconst_null
       5: aconst_null
       6: iconst_0
       7: bipush        30
       9: aconst_null
      10: invokestatic  #163                // Method traverse$default:(LDay16;ILDay16$Valve;Ljava/util/Set;Ljava/util/Map;ZILjava/lang/Object;)I
      13: ireturn

  public final int part2();
    Code:
       0: aload_0
       1: bipush        26
       3: aconst_null
       4: aconst_null
       5: aconst_null
       6: iconst_1
       7: bipush        14
       9: aconst_null
      10: invokestatic  #163                // Method traverse$default:(LDay16;ILDay16$Valve;Ljava/util/Set;Ljava/util/Map;ZILjava/lang/Object;)I
      13: ireturn

  private final int traverse(int, Day16$Valve, java.util.Set<Day16$Valve>, java.util.Map<Day16$State, java.lang.Integer>, boolean);
    Code:
       0: iload_1
       1: aload_2
       2: invokevirtual #114                // Method Day16$Valve.getRate:()I
       5: imul
       6: istore        6
       8: new           #169                // class Day16$State
      11: dup
      12: aload_2
      13: invokevirtual #89                 // Method Day16$Valve.getName:()Ljava/lang/String;
      16: iload_1
      17: aload_3
      18: invokespecial #172                // Method Day16$State."<init>":(Ljava/lang/String;ILjava/util/Set;)V
      21: astore        7
      23: iload         6
      25: aload         4
      27: astore        8
      29: iconst_0
      30: istore        9
      32: aload         8
      34: aload         7
      36: invokeinterface #176,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      41: astore        10
      43: aload         10
      45: ifnonnull     492
      48: istore        23
      50: iconst_0
      51: istore        11
      53: aload_3
      54: checkcast     #21                 // class java/lang/Iterable
      57: astore        12
      59: iconst_0
      60: istore        13
      62: aload         12
      64: astore        14
      66: new           #29                 // class java/util/ArrayList
      69: dup
      70: invokespecial #177                // Method java/util/ArrayList."<init>":()V
      73: checkcast     #40                 // class java/util/Collection
      76: astore        15
      78: iconst_0
      79: istore        16
      81: aload         14
      83: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      88: astore        17
      90: aload         17
      92: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      97: ifeq          184
     100: aload         17
     102: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     107: astore        18
     109: aload         18
     111: checkcast     #23                 // class Day16$Valve
     114: astore        19
     116: iconst_0
     117: istore        20
     119: aload_0
     120: getfield      #127                // Field distances:Ljava/util/Map;
     123: aload_2
     124: invokevirtual #89                 // Method Day16$Valve.getName:()Ljava/lang/String;
     127: invokeinterface #176,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     132: dup
     133: invokestatic  #181                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     136: checkcast     #85                 // class java/util/Map
     139: aload         19
     141: invokevirtual #89                 // Method Day16$Valve.getName:()Ljava/lang/String;
     144: invokeinterface #176,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     149: dup
     150: invokestatic  #181                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     153: checkcast     #183                // class java/lang/Number
     156: invokevirtual #186                // Method java/lang/Number.intValue:()I
     159: iload_1
     160: if_icmpge     167
     163: iconst_1
     164: goto          168
     167: iconst_0
     168: ifeq          90
     171: aload         15
     173: aload         18
     175: invokeinterface #66,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     180: pop
     181: goto          90
     184: aload         15
     186: checkcast     #68                 // class java/util/List
     189: nop
     190: astore        21
     192: iconst_0
     193: istore        12
     195: aload         21
     197: checkcast     #40                 // class java/util/Collection
     200: invokeinterface #189,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     205: ifne          212
     208: iconst_1
     209: goto          213
     212: iconst_0
     213: ifeq          436
     216: aload         21
     218: checkcast     #21                 // class java/lang/Iterable
     221: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     226: astore        14
     228: aload         14
     230: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     235: ifne          246
     238: new           #191                // class java/util/NoSuchElementException
     241: dup
     242: invokespecial #192                // Method java/util/NoSuchElementException."<init>":()V
     245: athrow
     246: aload         14
     248: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     253: checkcast     #23                 // class Day16$Valve
     256: astore        15
     258: iconst_0
     259: istore        16
     261: iload_1
     262: iconst_1
     263: isub
     264: aload_0
     265: getfield      #127                // Field distances:Ljava/util/Map;
     268: aload_2
     269: invokevirtual #89                 // Method Day16$Valve.getName:()Ljava/lang/String;
     272: invokeinterface #176,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     277: dup
     278: invokestatic  #181                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     281: checkcast     #85                 // class java/util/Map
     284: aload         15
     286: invokevirtual #89                 // Method Day16$Valve.getName:()Ljava/lang/String;
     289: invokeinterface #176,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     294: dup
     295: invokestatic  #181                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     298: checkcast     #183                // class java/lang/Number
     301: invokevirtual #186                // Method java/lang/Number.intValue:()I
     304: isub
     305: istore        17
     307: aload_0
     308: iload         17
     310: aload         15
     312: aload_3
     313: aload         15
     315: invokestatic  #198                // Method kotlin/collections/SetsKt.minus:(Ljava/util/Set;Ljava/lang/Object;)Ljava/util/Set;
     318: aload         4
     320: iload         5
     322: invokespecial #200                // Method traverse:(ILDay16$Valve;Ljava/util/Set;Ljava/util/Map;Z)I
     325: istore        15
     327: aload         14
     329: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     334: ifeq          432
     337: aload         14
     339: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     344: checkcast     #23                 // class Day16$Valve
     347: astore        16
     349: iconst_0
     350: istore        17
     352: iload_1
     353: iconst_1
     354: isub
     355: aload_0
     356: getfield      #127                // Field distances:Ljava/util/Map;
     359: aload_2
     360: invokevirtual #89                 // Method Day16$Valve.getName:()Ljava/lang/String;
     363: invokeinterface #176,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     368: dup
     369: invokestatic  #181                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     372: checkcast     #85                 // class java/util/Map
     375: aload         16
     377: invokevirtual #89                 // Method Day16$Valve.getName:()Ljava/lang/String;
     380: invokeinterface #176,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     385: dup
     386: invokestatic  #181                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     389: checkcast     #183                // class java/lang/Number
     392: invokevirtual #186                // Method java/lang/Number.intValue:()I
     395: isub
     396: istore        18
     398: aload_0
     399: iload         18
     401: aload         16
     403: aload_3
     404: aload         16
     406: invokestatic  #198                // Method kotlin/collections/SetsKt.minus:(Ljava/util/Set;Ljava/lang/Object;)Ljava/util/Set;
     409: aload         4
     411: iload         5
     413: invokespecial #200                // Method traverse:(ILDay16$Valve;Ljava/util/Set;Ljava/util/Map;Z)I
     416: istore        16
     418: iload         15
     420: iload         16
     422: if_icmpge     327
     425: iload         16
     427: istore        15
     429: goto          327
     432: iload         15
     434: istore        12
     436: iload         12
     438: iload         5
     440: ifeq          459
     443: aload_0
     444: bipush        26
     446: aconst_null
     447: aload_3
     448: aconst_null
     449: iconst_0
     450: bipush        26
     452: aconst_null
     453: invokestatic  #163                // Method traverse$default:(LDay16;ILDay16$Valve;Ljava/util/Set;Ljava/util/Map;ZILjava/lang/Object;)I
     456: goto          460
     459: iconst_0
     460: invokestatic  #205                // Method java/lang/Math.max:(II)I
     463: nop
     464: invokestatic  #211                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     467: astore        24
     469: iload         23
     471: aload         24
     473: astore        22
     475: aload         8
     477: aload         7
     479: aload         22
     481: invokeinterface #93,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     486: pop
     487: aload         22
     489: goto          494
     492: aload         10
     494: nop
     495: checkcast     #183                // class java/lang/Number
     498: invokevirtual #186                // Method java/lang/Number.intValue:()I
     501: iadd
     502: ireturn

  static int traverse$default(Day16, int, Day16$Valve, java.util.Set, java.util.Map, boolean, int, java.lang.Object);
    Code:
       0: iload         6
       2: iconst_2
       3: iand
       4: ifeq          20
       7: aload_0
       8: getfield      #97                 // Field valves:Ljava/util/Map;
      11: ldc           #233                // String AA
      13: invokestatic  #236                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
      16: checkcast     #23                 // class Day16$Valve
      19: astore_2
      20: iload         6
      22: iconst_4
      23: iand
      24: ifeq          43
      27: aload_0
      28: getfield      #120                // Field usefulValves:Ljava/util/Map;
      31: invokeinterface #240,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
      36: checkcast     #21                 // class java/lang/Iterable
      39: invokestatic  #244                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
      42: astore_3
      43: iload         6
      45: bipush        8
      47: iand
      48: ifeq          63
      51: new           #82                 // class java/util/LinkedHashMap
      54: dup
      55: invokespecial #98                 // Method java/util/LinkedHashMap."<init>":()V
      58: checkcast     #85                 // class java/util/Map
      61: astore        4
      63: iload         6
      65: bipush        16
      67: iand
      68: ifeq          74
      71: iconst_0
      72: istore        5
      74: aload_0
      75: iload_1
      76: aload_2
      77: aload_3
      78: aload         4
      80: iload         5
      82: invokespecial #200                // Method traverse:(ILDay16$Valve;Ljava/util/Set;Ljava/util/Map;Z)I
      85: ireturn

  private final java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.lang.Integer>> computeDistances();
    Code:
       0: aload_0
       1: getfield      #97                 // Field valves:Ljava/util/Map;
       4: invokeinterface #248,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
       9: checkcast     #21                 // class java/lang/Iterable
      12: astore_1
      13: iconst_0
      14: istore_2
      15: aload_1
      16: astore_3
      17: new           #29                 // class java/util/ArrayList
      20: dup
      21: aload_1
      22: bipush        10
      24: invokestatic  #35                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #38                 // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #40                 // class java/util/Collection
      33: astore        4
      35: iconst_0
      36: istore        5
      38: aload_3
      39: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      44: astore        6
      46: aload         6
      48: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      53: ifeq          343
      56: aload         6
      58: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: astore        7
      65: aload         4
      67: aload         7
      69: checkcast     #56                 // class java/lang/String
      72: astore        8
      74: astore        21
      76: iconst_0
      77: istore        9
      79: new           #82                 // class java/util/LinkedHashMap
      82: dup
      83: invokespecial #98                 // Method java/util/LinkedHashMap."<init>":()V
      86: checkcast     #85                 // class java/util/Map
      89: invokedynamic #267,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      94: invokestatic  #271                // Method kotlin/collections/MapsKt.withDefaultMutable:(Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Ljava/util/Map;
      97: astore        10
      99: aload         10
     101: astore        11
     103: iconst_0
     104: istore        12
     106: aload         11
     108: aload         8
     110: iconst_0
     111: invokestatic  #211                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     114: invokeinterface #93,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     119: pop
     120: aload         10
     122: astore        13
     124: iconst_1
     125: anewarray     #56                 // class java/lang/String
     128: astore        11
     130: aload         11
     132: iconst_0
     133: aload         8
     135: aastore
     136: aload         11
     138: invokestatic  #275                // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;
     141: astore        10
     143: aload         10
     145: checkcast     #40                 // class java/util/Collection
     148: invokeinterface #189,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     153: ifne          160
     156: iconst_1
     157: goto          161
     160: iconst_0
     161: ifeq          329
     164: aload         10
     166: invokeinterface #278,  1          // InterfaceMethod java/util/List.removeFirst:()Ljava/lang/Object;
     171: dup
     172: ldc_w         #280                // String removeFirst(...)
     175: invokestatic  #283                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     178: checkcast     #56                 // class java/lang/String
     181: astore        11
     183: aload_0
     184: getfield      #97                 // Field valves:Ljava/util/Map;
     187: aload         11
     189: invokeinterface #176,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     194: dup
     195: invokestatic  #181                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     198: checkcast     #23                 // class Day16$Valve
     201: invokevirtual #287                // Method Day16$Valve.getNext:()Ljava/util/List;
     204: checkcast     #21                 // class java/lang/Iterable
     207: astore        12
     209: iconst_0
     210: istore        14
     212: aload         12
     214: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     219: astore        15
     221: aload         15
     223: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     228: ifeq          325
     231: aload         15
     233: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     238: astore        16
     240: aload         16
     242: checkcast     #56                 // class java/lang/String
     245: astore        17
     247: iconst_0
     248: istore        18
     250: aload         13
     252: aload         11
     254: invokeinterface #176,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     259: dup
     260: invokestatic  #181                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     263: checkcast     #183                // class java/lang/Number
     266: invokevirtual #186                // Method java/lang/Number.intValue:()I
     269: iconst_1
     270: iadd
     271: istore        19
     273: iload         19
     275: aload         13
     277: aload         17
     279: invokestatic  #236                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
     282: checkcast     #183                // class java/lang/Number
     285: invokevirtual #186                // Method java/lang/Number.intValue:()I
     288: if_icmpge     320
     291: iload         19
     293: invokestatic  #211                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     296: astore        20
     298: aload         13
     300: aload         17
     302: aload         20
     304: invokeinterface #93,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     309: pop
     310: aload         10
     312: aload         17
     314: invokeinterface #288,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     319: pop
     320: nop
     321: nop
     322: goto          221
     325: nop
     326: goto          143
     329: aload         13
     331: aload         21
     333: swap
     334: invokeinterface #66,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     339: pop
     340: goto          46
     343: aload         4
     345: checkcast     #68                 // class java/util/List
     348: nop
     349: checkcast     #21                 // class java/lang/Iterable
     352: astore_1
     353: nop
     354: iconst_0
     355: istore_2
     356: aload_1
     357: bipush        10
     359: invokestatic  #35                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     362: invokestatic  #74                 // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     365: bipush        16
     367: invokestatic  #80                 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     370: istore_3
     371: aload_1
     372: astore        4
     374: new           #82                 // class java/util/LinkedHashMap
     377: dup
     378: iload_3
     379: invokespecial #83                 // Method java/util/LinkedHashMap."<init>":(I)V
     382: checkcast     #85                 // class java/util/Map
     385: astore        5
     387: iconst_0
     388: istore        6
     390: aload         4
     392: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     397: astore        7
     399: aload         7
     401: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     406: ifeq          462
     409: aload         7
     411: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     416: astore        8
     418: aload         5
     420: aload         8
     422: checkcast     #85                 // class java/util/Map
     425: astore        9
     427: astore        21
     429: iconst_0
     430: istore        10
     432: aload         9
     434: invokeinterface #248,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     439: checkcast     #21                 // class java/lang/Iterable
     442: invokestatic  #292                // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;
     445: checkcast     #56                 // class java/lang/String
     448: aload         21
     450: swap
     451: aload         8
     453: invokeinterface #93,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     458: pop
     459: goto          399
     462: aload         5
     464: nop
     465: areturn

  private static final int computeDistances$lambda$8$lambda$5(java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #305                // String it
       4: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: ldc_w         #306                // int 2147483647
      10: ireturn
}

Compiled from "Day16.kt"
public final class Day16$Valve$Companion {
  private Day16$Valve$Companion();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final Day16$Valve from(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String line
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #23                 // class Day16$Valve
       9: dup
      10: aload_1
      11: ldc           #25                 // String Valve
      13: aconst_null
      14: iconst_2
      15: aconst_null
      16: invokestatic  #31                 // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      19: ldc           #33                 // String
      21: aconst_null
      22: iconst_2
      23: aconst_null
      24: invokestatic  #36                 // Method kotlin/text/StringsKt.substringBefore$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      27: aload_1
      28: ldc           #38                 // String rate=
      30: aconst_null
      31: iconst_2
      32: aconst_null
      33: invokestatic  #31                 // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      36: ldc           #40                 // String ;
      38: aconst_null
      39: iconst_2
      40: aconst_null
      41: invokestatic  #36                 // Method kotlin/text/StringsKt.substringBefore$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      44: invokestatic  #46                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      47: aload_1
      48: ldc           #48                 // String to valve
      50: aconst_null
      51: iconst_2
      52: aconst_null
      53: invokestatic  #31                 // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      56: ldc           #33                 // String
      58: aconst_null
      59: iconst_2
      60: aconst_null
      61: invokestatic  #31                 // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      64: checkcast     #50                 // class java/lang/CharSequence
      67: iconst_1
      68: anewarray     #52                 // class java/lang/String
      71: astore_2
      72: aload_2
      73: iconst_0
      74: ldc           #54                 // String ,
      76: aastore
      77: aload_2
      78: iconst_0
      79: iconst_0
      80: bipush        6
      82: aconst_null
      83: invokestatic  #58                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      86: invokespecial #61                 // Method Day16$Valve."<init>":(Ljava/lang/String;ILjava/util/List;)V
      89: areturn

  public Day16$Valve$Companion(kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: invokespecial #64                 // Method "<init>":()V
       4: return
}

Compiled from "Day16.kt"
public final class Day16Kt {
  public static final void main();
    Code:
       0: new           #8                  // class Day16
       3: dup
       4: ldc           #10                 // String inputs/Day16
       6: invokestatic  #16                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       9: invokespecial #20                 // Method Day16."<init>":(Ljava/util/List;)V
      12: astore_0
      13: aload_0
      14: invokevirtual #24                 // Method Day16.part1:()I
      17: istore_1
      18: getstatic     #30                 // Field java/lang/System.out:Ljava/io/PrintStream;
      21: iload_1
      22: invokevirtual #36                 // Method java/io/PrintStream.println:(I)V
      25: aload_0
      26: invokevirtual #39                 // Method Day16.part2:()I
      29: istore_1
      30: getstatic     #30                 // Field java/lang/System.out:Ljava/io/PrintStream;
      33: iload_1
      34: invokevirtual #36                 // Method java/io/PrintStream.println:(I)V
      37: return

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