import kotlin.math.min

fun main() {
    val blockShapes = """####

.#.
###
.#.

..#
..#
###

#
#
#
#

##
##"""

    class Block(val points: List<Vector2d>) {
        fun move(vector2d: Vector2d) = points.forEach { it.increment(vector2d) }

        fun collides(other: Set<Vector2d>) = points.any { it in other }

        fun copy(): Block = Block(points.map { it.copy() })
    }

    val blocks = blockShapes.lines().separateByBlank().asSequence()
        .map { it.map { line -> line.toCharArray().toList() } }
        .map { Grid(it) }
        .map { grid -> grid.data.flatten().filter { cell -> cell.value == '#' }.map { it.position } }
        .map {
            val dy = it.maxOf { point -> point.y } + 1

            it.map { point -> point.increment(Vector2d(0, -dy)) }
        }
        .map { Block(it) }
        .toList()

    fun tetris(input: List<String>, blocksToFall: Int): Pair<Long, List<Int>> {
        val moves = input.first().toCharArray().map { if (it == '<') Vector2d.LEFT else Vector2d.RIGHT }
        val rightWall = 8
        val settled = mutableSetOf<Vector2d>()
        val increments = mutableListOf<Int>()

        var currentTop = 0L
        var currentBlockIndex = 0
        var currentMoveIndex = 0
        var rocksFallen = blocksToFall

        while (rocksFallen-- != 0) {
            val block = blocks[currentBlockIndex++ % blocks.size].copy()

            block.move(Vector2d(3, currentTop.toInt() - 3)) // move to start position

            while (true) {
                val wind = moves[currentMoveIndex++ % moves.size] // first wind movement

                block.move(wind)

                if (block.collides(settled) ||
                    block.points.minOf { it.x } == 0 ||
                    block.points.maxOf { it.x } == rightWall
                )
                    block.move(wind.negative()) // move back

                block.move(Vector2d.DOWN)

                if (block.collides(settled) || block.points.minOf { it.y } == 0) { // block settles
                    block.move(Vector2d.UP) // move back
                    settled.addAll(block.points)
                    val newCurrentTop = min(currentTop, block.points.minOf { it.y }.toLong())
                    increments.add((currentTop - newCurrentTop).toInt())
                    currentTop = newCurrentTop

                    break
                }
            }
        }

        return Pair(-currentTop, increments)
    }

    fun part1(input: List<String>) = tetris(input, 2022).first

    fun part2(input: List<String>): Long {
        val (_, increments) = tetris(input, 8000)
        val bestSequence = increments.findLongestSequence()
        val iters = 1000000000000L
        val sequenceHeight = increments.subList(bestSequence.first, bestSequence.first + bestSequence.second).sum()

        var height = increments.subList(0, bestSequence.first).sum().toLong()
        var itersLeft = iters - bestSequence.first
        val sequencesLeft = itersLeft / bestSequence.second

        height += sequencesLeft * sequenceHeight
        itersLeft -= sequencesLeft * bestSequence.second
        height += increments.subList(bestSequence.first, bestSequence.first + itersLeft.toInt()).sum()

        return height
    }

    test(
        day = 17,
        testTarget1 = 3068L,
        testTarget2 = 1514285714288L,
        part1 = ::part1,
        part2 = ::part2,
    )
}

Compiled from "Day17.kt"
public final class Day17Kt$main$Block {
  private final java.util.List<Vector2d> points;

  public Day17Kt$main$Block(java.util.List<Vector2d>);
    Code:
       0: aload_1
       1: ldc           #9                  // String points
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #18                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #21                 // Field points:Ljava/util/List;
      15: return

  public final java.util.List<Vector2d> getPoints();
    Code:
       0: aload_0
       1: getfield      #21                 // Field points:Ljava/util/List;
       4: areturn

  public final void move(Vector2d);
    Code:
       0: aload_1
       1: ldc           #30                 // String vector2d
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #21                 // Field points:Ljava/util/List;
      10: checkcast     #32                 // class java/lang/Iterable
      13: astore_2
      14: iconst_0
      15: istore_3
      16: aload_2
      17: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      22: astore        4
      24: aload         4
      26: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      31: ifeq          64
      34: aload         4
      36: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      41: astore        5
      43: aload         5
      45: checkcast     #48                 // class Vector2d
      48: astore        6
      50: iconst_0
      51: istore        7
      53: aload         6
      55: aload_1
      56: invokevirtual #52                 // Method Vector2d.increment:(LVector2d;)LVector2d;
      59: pop
      60: nop
      61: goto          24
      64: nop
      65: return

  public final boolean collides(java.util.Set<Vector2d>);
    Code:
       0: aload_1
       1: ldc           #66                 // String other
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #21                 // Field points:Ljava/util/List;
      10: checkcast     #32                 // class java/lang/Iterable
      13: astore_2
      14: iconst_0
      15: istore_3
      16: aload_2
      17: instanceof    #68                 // class java/util/Collection
      20: ifeq          39
      23: aload_2
      24: checkcast     #68                 // class java/util/Collection
      27: invokeinterface #71,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
      32: ifeq          39
      35: iconst_0
      36: goto          92
      39: aload_2
      40: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        4
      47: aload         4
      49: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          91
      57: aload         4
      59: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        5
      66: aload         5
      68: checkcast     #48                 // class Vector2d
      71: astore        6
      73: iconst_0
      74: istore        7
      76: aload_1
      77: aload         6
      79: invokeinterface #77,  2           // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
      84: ifeq          47
      87: iconst_1
      88: goto          92
      91: iconst_0
      92: ireturn

  public final Day17Kt$main$Block copy();
    Code:
       0: aload_0
       1: getfield      #21                 // Field points:Ljava/util/List;
       4: checkcast     #32                 // class java/lang/Iterable
       7: astore_1
       8: iconst_0
       9: istore_2
      10: aload_1
      11: astore_3
      12: new           #85                 // class java/util/ArrayList
      15: dup
      16: aload_1
      17: bipush        10
      19: invokestatic  #91                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      22: invokespecial #94                 // Method java/util/ArrayList."<init>":(I)V
      25: checkcast     #68                 // class java/util/Collection
      28: astore        4
      30: iconst_0
      31: istore        5
      33: aload_3
      34: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      39: astore        6
      41: aload         6
      43: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      48: ifeq          95
      51: aload         6
      53: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      58: astore        7
      60: aload         4
      62: aload         7
      64: checkcast     #48                 // class Vector2d
      67: astore        8
      69: astore        10
      71: iconst_0
      72: istore        9
      74: aload         8
      76: iconst_0
      77: iconst_0
      78: iconst_3
      79: aconst_null
      80: invokestatic  #98                 // Method Vector2d.copy$default:(LVector2d;IIILjava/lang/Object;)LVector2d;
      83: aload         10
      85: swap
      86: invokeinterface #101,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      91: pop
      92: goto          41
      95: aload         4
      97: checkcast     #103                // class java/util/List
     100: nop
     101: astore        11
     103: new           #2                  // class Day17Kt$main$Block
     106: dup
     107: aload         11
     109: invokespecial #105                // Method "<init>":(Ljava/util/List;)V
     112: areturn
}

Compiled from "Day17.kt"
public final class Day17Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String ####\n\n.#.\n###\n.#.\n\n..#\n..#\n###\n\n#\n#\n#\n#\n\n##\n##
       2: astore_0
       3: aload_0
       4: checkcast     #10                 // class java/lang/CharSequence
       7: invokestatic  #16                 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;
      10: invokestatic  #22                 // Method UtilsKt.separateByBlank:(Ljava/util/List;)Ljava/util/List;
      13: checkcast     #24                 // class java/lang/Iterable
      16: invokestatic  #30                 // Method kotlin/collections/CollectionsKt.asSequence:(Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;
      19: invokedynamic #48,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      24: invokestatic  #54                 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      27: invokedynamic #61,  0             // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;
      32: invokestatic  #54                 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      35: invokedynamic #68,  0             // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;
      40: invokestatic  #54                 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      43: invokedynamic #73,  0             // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;
      48: invokestatic  #54                 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      51: invokedynamic #80,  0             // InvokeDynamic #4:invoke:()Lkotlin/jvm/functions/Function1;
      56: invokestatic  #54                 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      59: invokestatic  #84                 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
      62: astore_1
      63: bipush        17
      65: ldc2_w        #85                 // long 3068l
      68: invokestatic  #92                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      71: ldc2_w        #93                 // long 1514285714288l
      74: invokestatic  #92                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      77: new           #96                 // class Day17Kt$main$1
      80: dup
      81: aload_1
      82: invokespecial #100                // Method Day17Kt$main$1."<init>":(Ljava/util/List;)V
      85: checkcast     #102                // class kotlin/jvm/functions/Function1
      88: new           #104                // class Day17Kt$main$2
      91: dup
      92: aload_1
      93: invokespecial #105                // Method Day17Kt$main$2."<init>":(Ljava/util/List;)V
      96: checkcast     #102                // class kotlin/jvm/functions/Function1
      99: invokestatic  #109                // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
     102: return

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

  private static final java.util.List main$lambda$1(java.util.List);
    Code:
       0: aload_0
       1: ldc           #120                // String it
       3: invokestatic  #126                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #24                 // class java/lang/Iterable
      10: astore_1
      11: iconst_0
      12: istore_2
      13: aload_1
      14: astore_3
      15: new           #128                // class java/util/ArrayList
      18: dup
      19: aload_1
      20: bipush        10
      22: invokestatic  #132                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      25: invokespecial #135                // Method java/util/ArrayList."<init>":(I)V
      28: checkcast     #137                // class java/util/Collection
      31: astore        4
      33: iconst_0
      34: istore        5
      36: aload_3
      37: invokeinterface #141,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      42: astore        6
      44: aload         6
      46: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      51: ifeq          103
      54: aload         6
      56: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      61: astore        7
      63: aload         4
      65: aload         7
      67: checkcast     #153                // class java/lang/String
      70: astore        8
      72: astore        10
      74: iconst_0
      75: istore        9
      77: aload         8
      79: invokevirtual #157                // Method java/lang/String.toCharArray:()[C
      82: dup
      83: ldc           #159                // String toCharArray(...)
      85: invokestatic  #162                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      88: invokestatic  #167                // Method kotlin/collections/ArraysKt.toList:([C)Ljava/util/List;
      91: aload         10
      93: swap
      94: invokeinterface #171,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      99: pop
     100: goto          44
     103: aload         4
     105: checkcast     #173                // class java/util/List
     108: nop
     109: areturn

  private static final Grid main$lambda$2(java.util.List);
    Code:
       0: aload_0
       1: ldc           #120                // String it
       3: invokestatic  #126                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #187                // class Grid
       9: dup
      10: aload_0
      11: invokespecial #188                // Method Grid."<init>":(Ljava/util/List;)V
      14: areturn

  private static final java.util.List main$lambda$5(Grid);
    Code:
       0: aload_0
       1: ldc           #190                // String grid
       3: invokestatic  #126                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokevirtual #194                // Method Grid.getData:()Ljava/util/List;
      10: checkcast     #24                 // class java/lang/Iterable
      13: invokestatic  #198                // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;
      16: checkcast     #24                 // class java/lang/Iterable
      19: astore_1
      20: iconst_0
      21: istore_2
      22: aload_1
      23: astore_3
      24: new           #128                // class java/util/ArrayList
      27: dup
      28: invokespecial #200                // Method java/util/ArrayList."<init>":()V
      31: checkcast     #137                // class java/util/Collection
      34: astore        4
      36: iconst_0
      37: istore        5
      39: aload_3
      40: invokeinterface #141,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        6
      47: aload         6
      49: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          113
      57: aload         6
      59: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        7
      66: aload         7
      68: checkcast     #202                // class GridCell
      71: astore        8
      73: iconst_0
      74: istore        9
      76: aload         8
      78: invokevirtual #205                // Method GridCell.getValue:()Ljava/lang/Object;
      81: checkcast     #207                // class java/lang/Character
      84: invokevirtual #211                // Method java/lang/Character.charValue:()C
      87: bipush        35
      89: if_icmpne     96
      92: iconst_1
      93: goto          97
      96: iconst_0
      97: ifeq          47
     100: aload         4
     102: aload         7
     104: invokeinterface #171,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     109: pop
     110: goto          47
     113: aload         4
     115: checkcast     #173                // class java/util/List
     118: nop
     119: checkcast     #24                 // class java/lang/Iterable
     122: astore_1
     123: nop
     124: iconst_0
     125: istore_2
     126: aload_1
     127: astore_3
     128: new           #128                // class java/util/ArrayList
     131: dup
     132: aload_1
     133: bipush        10
     135: invokestatic  #132                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     138: invokespecial #135                // Method java/util/ArrayList."<init>":(I)V
     141: checkcast     #137                // class java/util/Collection
     144: astore        4
     146: iconst_0
     147: istore        5
     149: aload_3
     150: invokeinterface #141,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     155: astore        6
     157: aload         6
     159: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     164: ifeq          207
     167: aload         6
     169: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     174: astore        7
     176: aload         4
     178: aload         7
     180: checkcast     #202                // class GridCell
     183: astore        8
     185: astore        10
     187: iconst_0
     188: istore        9
     190: aload         8
     192: invokevirtual #215                // Method GridCell.getPosition:()LVector2d;
     195: aload         10
     197: swap
     198: invokeinterface #171,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     203: pop
     204: goto          157
     207: aload         4
     209: checkcast     #173                // class java/util/List
     212: nop
     213: areturn

  private static final java.util.List main$lambda$8(java.util.List);
    Code:
       0: aload_0
       1: ldc           #120                // String it
       3: invokestatic  #126                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #24                 // class java/lang/Iterable
      10: invokeinterface #141,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      15: astore_3
      16: aload_3
      17: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      22: ifne          33
      25: new           #227                // class java/util/NoSuchElementException
      28: dup
      29: invokespecial #228                // Method java/util/NoSuchElementException."<init>":()V
      32: athrow
      33: aload_3
      34: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      39: checkcast     #230                // class Vector2d
      42: astore        4
      44: iconst_0
      45: istore        5
      47: aload         4
      49: invokevirtual #234                // Method Vector2d.getY:()I
      52: istore        4
      54: aload_3
      55: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      60: ifeq          98
      63: aload_3
      64: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      69: checkcast     #230                // class Vector2d
      72: astore        5
      74: iconst_0
      75: istore        6
      77: aload         5
      79: invokevirtual #234                // Method Vector2d.getY:()I
      82: istore        5
      84: iload         4
      86: iload         5
      88: if_icmpge     54
      91: iload         5
      93: istore        4
      95: goto          54
      98: iload         4
     100: iconst_1
     101: iadd
     102: istore_1
     103: aload_0
     104: checkcast     #24                 // class java/lang/Iterable
     107: astore_2
     108: iconst_0
     109: istore_3
     110: aload_2
     111: astore        4
     113: new           #128                // class java/util/ArrayList
     116: dup
     117: aload_2
     118: bipush        10
     120: invokestatic  #132                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     123: invokespecial #135                // Method java/util/ArrayList."<init>":(I)V
     126: checkcast     #137                // class java/util/Collection
     129: astore        5
     131: iconst_0
     132: istore        6
     134: aload         4
     136: invokeinterface #141,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     141: astore        7
     143: aload         7
     145: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     150: ifeq          203
     153: aload         7
     155: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     160: astore        8
     162: aload         5
     164: aload         8
     166: checkcast     #230                // class Vector2d
     169: astore        9
     171: astore        11
     173: iconst_0
     174: istore        10
     176: aload         9
     178: new           #230                // class Vector2d
     181: dup
     182: iconst_0
     183: iload_1
     184: ineg
     185: invokespecial #237                // Method Vector2d."<init>":(II)V
     188: invokevirtual #241                // Method Vector2d.increment:(LVector2d;)LVector2d;
     191: aload         11
     193: swap
     194: invokeinterface #171,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     199: pop
     200: goto          143
     203: aload         5
     205: checkcast     #173                // class java/util/List
     208: nop
     209: areturn

  private static final Day17Kt$main$Block main$lambda$9(java.util.List);
    Code:
       0: aload_0
       1: ldc           #120                // String it
       3: invokestatic  #126                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #248                // class Day17Kt$main$Block
       9: dup
      10: aload_0
      11: invokespecial #249                // Method Day17Kt$main$Block."<init>":(Ljava/util/List;)V
      14: areturn

  private static final kotlin.Pair<java.lang.Long, java.util.List<java.lang.Integer>> main$tetris(java.util.List<Day17Kt$main$Block>, java.util.List<java.lang.String>, int);
    Code:
       0: aload_1
       1: invokestatic  #256                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
       4: checkcast     #153                // class java/lang/String
       7: invokevirtual #157                // Method java/lang/String.toCharArray:()[C
      10: dup
      11: ldc           #159                // String toCharArray(...)
      13: invokestatic  #162                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      16: astore        4
      18: nop
      19: iconst_0
      20: istore        5
      22: aload         4
      24: astore        6
      26: new           #128                // class java/util/ArrayList
      29: dup
      30: aload         4
      32: arraylength
      33: invokespecial #135                // Method java/util/ArrayList."<init>":(I)V
      36: checkcast     #137                // class java/util/Collection
      39: astore        7
      41: iconst_0
      42: istore        8
      44: iconst_0
      45: istore        9
      47: aload         6
      49: arraylength
      50: istore        10
      52: iload         9
      54: iload         10
      56: if_icmpge     114
      59: aload         6
      61: iload         9
      63: caload
      64: istore        11
      66: aload         7
      68: iload         11
      70: istore        12
      72: astore        21
      74: iconst_0
      75: istore        13
      77: iload         12
      79: bipush        60
      81: if_icmpne     93
      84: getstatic     #260                // Field Vector2d.Companion:LVector2d$Companion;
      87: invokevirtual #265                // Method Vector2d$Companion.getLEFT:()LVector2d;
      90: goto          99
      93: getstatic     #260                // Field Vector2d.Companion:LVector2d$Companion;
      96: invokevirtual #268                // Method Vector2d$Companion.getRIGHT:()LVector2d;
      99: aload         21
     101: swap
     102: invokeinterface #171,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     107: pop
     108: iinc          9, 1
     111: goto          52
     114: aload         7
     116: checkcast     #173                // class java/util/List
     119: nop
     120: astore_3
     121: bipush        8
     123: istore        4
     125: new           #270                // class java/util/LinkedHashSet
     128: dup
     129: invokespecial #271                // Method java/util/LinkedHashSet."<init>":()V
     132: checkcast     #273                // class java/util/Set
     135: astore        5
     137: new           #128                // class java/util/ArrayList
     140: dup
     141: invokespecial #200                // Method java/util/ArrayList."<init>":()V
     144: checkcast     #173                // class java/util/List
     147: astore        6
     149: lconst_0
     150: lstore        7
     152: iconst_0
     153: istore        9
     155: iconst_0
     156: istore        10
     158: iload_2
     159: istore        11
     161: iload         11
     163: iinc          11, -1
     166: ifeq          771
     169: aload_0
     170: iload         9
     172: iinc          9, 1
     175: aload_0
     176: invokeinterface #276,  1          // InterfaceMethod java/util/List.size:()I
     181: irem
     182: invokeinterface #280,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     187: checkcast     #248                // class Day17Kt$main$Block
     190: invokevirtual #284                // Method Day17Kt$main$Block.copy:()LDay17Kt$main$Block;
     193: astore        12
     195: aload         12
     197: new           #230                // class Vector2d
     200: dup
     201: iconst_3
     202: lload         7
     204: l2i
     205: iconst_3
     206: isub
     207: invokespecial #237                // Method Vector2d."<init>":(II)V
     210: invokevirtual #288                // Method Day17Kt$main$Block.move:(LVector2d;)V
     213: nop
     214: aload_3
     215: iload         10
     217: iinc          10, 1
     220: aload_3
     221: invokeinterface #276,  1          // InterfaceMethod java/util/List.size:()I
     226: irem
     227: invokeinterface #280,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     232: checkcast     #230                // class Vector2d
     235: astore        13
     237: aload         12
     239: aload         13
     241: invokevirtual #288                // Method Day17Kt$main$Block.move:(LVector2d;)V
     244: aload         12
     246: aload         5
     248: invokevirtual #292                // Method Day17Kt$main$Block.collides:(Ljava/util/Set;)Z
     251: ifne          468
     254: aload         12
     256: invokevirtual #295                // Method Day17Kt$main$Block.getPoints:()Ljava/util/List;
     259: checkcast     #24                 // class java/lang/Iterable
     262: invokeinterface #141,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     267: astore        15
     269: aload         15
     271: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     276: ifne          287
     279: new           #227                // class java/util/NoSuchElementException
     282: dup
     283: invokespecial #228                // Method java/util/NoSuchElementException."<init>":()V
     286: athrow
     287: aload         15
     289: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     294: checkcast     #230                // class Vector2d
     297: astore        16
     299: iconst_0
     300: istore        17
     302: aload         16
     304: invokevirtual #298                // Method Vector2d.getX:()I
     307: istore        16
     309: aload         15
     311: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     316: ifeq          355
     319: aload         15
     321: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     326: checkcast     #230                // class Vector2d
     329: astore        17
     331: iconst_0
     332: istore        18
     334: aload         17
     336: invokevirtual #298                // Method Vector2d.getX:()I
     339: istore        17
     341: iload         16
     343: iload         17
     345: if_icmple     309
     348: iload         17
     350: istore        16
     352: goto          309
     355: iload         16
     357: ifeq          468
     360: aload         12
     362: invokevirtual #295                // Method Day17Kt$main$Block.getPoints:()Ljava/util/List;
     365: checkcast     #24                 // class java/lang/Iterable
     368: invokeinterface #141,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     373: astore        15
     375: aload         15
     377: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     382: ifne          393
     385: new           #227                // class java/util/NoSuchElementException
     388: dup
     389: invokespecial #228                // Method java/util/NoSuchElementException."<init>":()V
     392: athrow
     393: aload         15
     395: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     400: checkcast     #230                // class Vector2d
     403: astore        16
     405: iconst_0
     406: istore        17
     408: aload         16
     410: invokevirtual #298                // Method Vector2d.getX:()I
     413: istore        16
     415: aload         15
     417: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     422: ifeq          461
     425: aload         15
     427: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     432: checkcast     #230                // class Vector2d
     435: astore        17
     437: iconst_0
     438: istore        18
     440: aload         17
     442: invokevirtual #298                // Method Vector2d.getX:()I
     445: istore        17
     447: iload         16
     449: iload         17
     451: if_icmpge     415
     454: iload         17
     456: istore        16
     458: goto          415
     461: iload         16
     463: iload         4
     465: if_icmpne     478
     468: aload         12
     470: aload         13
     472: invokevirtual #301                // Method Vector2d.negative:()LVector2d;
     475: invokevirtual #288                // Method Day17Kt$main$Block.move:(LVector2d;)V
     478: aload         12
     480: getstatic     #260                // Field Vector2d.Companion:LVector2d$Companion;
     483: invokevirtual #304                // Method Vector2d$Companion.getDOWN:()LVector2d;
     486: invokevirtual #288                // Method Day17Kt$main$Block.move:(LVector2d;)V
     489: aload         12
     491: aload         5
     493: invokevirtual #292                // Method Day17Kt$main$Block.collides:(Ljava/util/Set;)Z
     496: ifne          605
     499: aload         12
     501: invokevirtual #295                // Method Day17Kt$main$Block.getPoints:()Ljava/util/List;
     504: checkcast     #24                 // class java/lang/Iterable
     507: invokeinterface #141,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     512: astore        15
     514: aload         15
     516: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     521: ifne          532
     524: new           #227                // class java/util/NoSuchElementException
     527: dup
     528: invokespecial #228                // Method java/util/NoSuchElementException."<init>":()V
     531: athrow
     532: aload         15
     534: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     539: checkcast     #230                // class Vector2d
     542: astore        16
     544: iconst_0
     545: istore        17
     547: aload         16
     549: invokevirtual #234                // Method Vector2d.getY:()I
     552: istore        16
     554: aload         15
     556: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     561: ifeq          600
     564: aload         15
     566: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     571: checkcast     #230                // class Vector2d
     574: astore        17
     576: iconst_0
     577: istore        18
     579: aload         17
     581: invokevirtual #234                // Method Vector2d.getY:()I
     584: istore        17
     586: iload         16
     588: iload         17
     590: if_icmple     554
     593: iload         17
     595: istore        16
     597: goto          554
     600: iload         16
     602: ifne          213
     605: aload         12
     607: getstatic     #260                // Field Vector2d.Companion:LVector2d$Companion;
     610: invokevirtual #307                // Method Vector2d$Companion.getUP:()LVector2d;
     613: invokevirtual #288                // Method Day17Kt$main$Block.move:(LVector2d;)V
     616: aload         5
     618: aload         12
     620: invokevirtual #295                // Method Day17Kt$main$Block.getPoints:()Ljava/util/List;
     623: checkcast     #137                // class java/util/Collection
     626: invokeinterface #311,  2          // InterfaceMethod java/util/Set.addAll:(Ljava/util/Collection;)Z
     631: pop
     632: aload         12
     634: invokevirtual #295                // Method Day17Kt$main$Block.getPoints:()Ljava/util/List;
     637: checkcast     #24                 // class java/lang/Iterable
     640: invokeinterface #141,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     645: astore        17
     647: aload         17
     649: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     654: ifne          665
     657: new           #227                // class java/util/NoSuchElementException
     660: dup
     661: invokespecial #228                // Method java/util/NoSuchElementException."<init>":()V
     664: athrow
     665: aload         17
     667: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     672: checkcast     #230                // class Vector2d
     675: astore        18
     677: iconst_0
     678: istore        19
     680: aload         18
     682: invokevirtual #234                // Method Vector2d.getY:()I
     685: istore        18
     687: aload         17
     689: invokeinterface #147,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     694: ifeq          733
     697: aload         17
     699: invokeinterface #151,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     704: checkcast     #230                // class Vector2d
     707: astore        19
     709: iconst_0
     710: istore        20
     712: aload         19
     714: invokevirtual #234                // Method Vector2d.getY:()I
     717: istore        19
     719: iload         18
     721: iload         19
     723: if_icmple     687
     726: iload         19
     728: istore        18
     730: goto          687
     733: iload         18
     735: i2l
     736: lstore        16
     738: lload         7
     740: lload         16
     742: invokestatic  #317                // Method java/lang/Math.min:(JJ)J
     745: lstore        14
     747: aload         6
     749: lload         7
     751: lload         14
     753: lsub
     754: l2i
     755: invokestatic  #322                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     758: invokeinterface #323,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     763: pop
     764: lload         14
     766: lstore        7
     768: goto          161
     771: new           #325                // class kotlin/Pair
     774: dup
     775: lload         7
     777: lneg
     778: invokestatic  #92                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     781: aload         6
     783: invokespecial #328                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     786: areturn

  private static final long main$part1(java.util.List<Day17Kt$main$Block>, java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: aload_1
       2: sipush        2022
       5: invokestatic  #357                // Method main$tetris:(Ljava/util/List;Ljava/util/List;I)Lkotlin/Pair;
       8: invokevirtual #360                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      11: checkcast     #362                // class java/lang/Number
      14: invokevirtual #366                // Method java/lang/Number.longValue:()J
      17: lreturn

  private static final long main$part2(java.util.List<Day17Kt$main$Block>, java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: aload_1
       2: sipush        8000
       5: invokestatic  #357                // Method main$tetris:(Ljava/util/List;Ljava/util/List;I)Lkotlin/Pair;
       8: invokevirtual #370                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      11: checkcast     #173                // class java/util/List
      14: astore_2
      15: aload_2
      16: invokestatic  #374                // Method UtilsKt.findLongestSequence:(Ljava/util/List;)Lkotlin/Pair;
      19: astore_3
      20: ldc2_w        #375                // long 1000000000000l
      23: lstore        4
      25: aload_2
      26: aload_3
      27: invokevirtual #360                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      30: checkcast     #362                // class java/lang/Number
      33: invokevirtual #379                // Method java/lang/Number.intValue:()I
      36: aload_3
      37: invokevirtual #360                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      40: checkcast     #362                // class java/lang/Number
      43: invokevirtual #379                // Method java/lang/Number.intValue:()I
      46: aload_3
      47: invokevirtual #382                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      50: checkcast     #362                // class java/lang/Number
      53: invokevirtual #379                // Method java/lang/Number.intValue:()I
      56: iadd
      57: invokeinterface #386,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
      62: checkcast     #24                 // class java/lang/Iterable
      65: invokestatic  #390                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
      68: istore        6
      70: aload_2
      71: iconst_0
      72: aload_3
      73: invokevirtual #360                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      76: checkcast     #362                // class java/lang/Number
      79: invokevirtual #379                // Method java/lang/Number.intValue:()I
      82: invokeinterface #386,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
      87: checkcast     #24                 // class java/lang/Iterable
      90: invokestatic  #390                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
      93: i2l
      94: lstore        7
      96: lload         4
      98: aload_3
      99: invokevirtual #360                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     102: checkcast     #362                // class java/lang/Number
     105: invokevirtual #366                // Method java/lang/Number.longValue:()J
     108: lsub
     109: lstore        9
     111: lload         9
     113: aload_3
     114: invokevirtual #382                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     117: checkcast     #362                // class java/lang/Number
     120: invokevirtual #366                // Method java/lang/Number.longValue:()J
     123: ldiv
     124: lstore        11
     126: lload         7
     128: lload         11
     130: iload         6
     132: i2l
     133: lmul
     134: ladd
     135: lstore        7
     137: lload         9
     139: lload         11
     141: aload_3
     142: invokevirtual #382                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     145: checkcast     #362                // class java/lang/Number
     148: invokevirtual #366                // Method java/lang/Number.longValue:()J
     151: lmul
     152: lsub
     153: lstore        9
     155: lload         7
     157: aload_2
     158: aload_3
     159: invokevirtual #360                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     162: checkcast     #362                // class java/lang/Number
     165: invokevirtual #379                // Method java/lang/Number.intValue:()I
     168: aload_3
     169: invokevirtual #360                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     172: checkcast     #362                // class java/lang/Number
     175: invokevirtual #379                // Method java/lang/Number.intValue:()I
     178: lload         9
     180: l2i
     181: iadd
     182: invokeinterface #386,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
     187: checkcast     #24                 // class java/lang/Iterable
     190: invokestatic  #390                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     193: i2l
     194: ladd
     195: lstore        7
     197: lload         7
     199: lreturn

  public static final long access$main$part1(java.util.List, java.util.List);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #400                // Method main$part1:(Ljava/util/List;Ljava/util/List;)J
       5: lreturn

  public static final long access$main$part2(java.util.List, java.util.List);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #403                // Method main$part2:(Ljava/util/List;Ljava/util/List;)J
       5: lreturn
}

Compiled from "Day17.kt"
final class Day17Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Long> {
  final java.util.List<Day17Kt$main$Block> $blocks;

  Day17Kt$main$2(java.util.List<Day17Kt$main$Block>);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #14                 // Field $blocks:Ljava/util/List;
       5: aload_0
       6: iconst_1
       7: ldc           #16                 // class kotlin/jvm/internal/Intrinsics$Kotlin
       9: ldc           #18                 // String part2
      11: ldc           #20                 // String main$part2(Ljava/util/List;Ljava/util/List;)J
      13: iconst_0
      14: invokespecial #23                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      17: return

  public final java.lang.Long invoke(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #30                 // String p0
       3: invokestatic  #36                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #14                 // Field $blocks:Ljava/util/List;
      10: aload_1
      11: invokestatic  #42                 // Method Day17Kt.access$main$part2:(Ljava/util/List;Ljava/util/List;)J
      14: invokestatic  #48                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      17: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #51                 // class java/util/List
       5: invokevirtual #53                 // Method invoke:(Ljava/util/List;)Ljava/lang/Long;
       8: areturn
}

Compiled from "Day17.kt"
final class Day17Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Long> {
  final java.util.List<Day17Kt$main$Block> $blocks;

  Day17Kt$main$1(java.util.List<Day17Kt$main$Block>);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #14                 // Field $blocks:Ljava/util/List;
       5: aload_0
       6: iconst_1
       7: ldc           #16                 // class kotlin/jvm/internal/Intrinsics$Kotlin
       9: ldc           #18                 // String part1
      11: ldc           #20                 // String main$part1(Ljava/util/List;Ljava/util/List;)J
      13: iconst_0
      14: invokespecial #23                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      17: return

  public final java.lang.Long invoke(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #30                 // String p0
       3: invokestatic  #36                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #14                 // Field $blocks:Ljava/util/List;
      10: aload_1
      11: invokestatic  #42                 // Method Day17Kt.access$main$part1:(Ljava/util/List;Ljava/util/List;)J
      14: invokestatic  #48                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      17: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #51                 // class java/util/List
       5: invokevirtual #53                 // Method invoke:(Ljava/util/List;)Ljava/lang/Long;
       8: areturn
}


fun main() {
    class Node(val rate: Int, var paths: List<Node> = emptyList())

    val inputLineRegex = """Valve ([A-Z]+) has flow rate=(\d+)""".toRegex()
    val input2LineRegex = """([A-Z]+)""".toRegex()

    fun parseData(input: List<String>): Map<String, Node> {
        val nodes = mutableMapOf<String, Node>()

        for (line in input)
            line.split(";").first().destructured(inputLineRegex).let { (name, rate) -> nodes[name] = Node(rate.toInt()) }

        for (line in input) {
            val (name) = line.split(";").first().destructured(inputLineRegex)
            val paths = input2LineRegex.findAll(line.split(";").last()).map { nodes[it.value]!! }.toList()

            nodes[name]!!.paths = paths
        }

        return nodes
    }

    fun bestPath(startNode: Node, targetNodesLeft: Set<Node>, minutes: Int): Pair<Int, List<Node>> {
        fun visitNode(node: Node, minutesLeft: Int, pressureReleased: Int, opened: Set<Node>, closed: Set<Node>, visited: List<Node>): Pair<Int, List<Node>> {
            val dp = opened.sumOf { it.rate }

            val reachableClosed = closed.map { Pair(it, aStar(node, {end -> end == it}, { 0 }, { n -> n.paths })) }
                .filter { (_, steps) -> steps.size <= minutesLeft }

            if (reachableClosed.isEmpty() || minutesLeft == 0)
                return Pair(pressureReleased + (minutesLeft - 1) * dp, visited)

            return reachableClosed.map { (candidate, path) ->
                visitNode(candidate, minutesLeft - path.size, pressureReleased + path.size * dp + candidate.rate, opened + candidate, closed - candidate, visited + candidate)
            }.maxBy { it.first }
        }

        return visitNode(startNode, minutes, 0, emptySet(), targetNodesLeft, listOf())
    }

    fun part1(input: List<String>): Int {
        val nodes = parseData(input)
        val nonZeroClosedNodes = nodes.values.filter { it.rate != 0 }.toSet()
        val bestPath = bestPath(nodes["AA"]!!, nonZeroClosedNodes, 30)

        return bestPath.first
    }

    fun part2(input: List<String>): Int {
        val nodes = parseData(input)
        val nonZeroClosedNodes = nodes.values.filter { it.rate != 0 }.toSet()
        val myPath = bestPath(nodes["AA"]!!, nonZeroClosedNodes, 26)
        val elephantPath = bestPath(nodes["AA"]!!, nonZeroClosedNodes - myPath.second.toSet(), 26)

        return myPath.first + elephantPath.first
    }

    test(
        day = 16,
        testTarget1 = 1651,
        testTarget2 = 1327, // should be 1707??
        part1 = ::part1,
        part2 = ::part2,
    )
}

Compiled from "Day16.kt"
public final class Day16Kt$main$Node {
  private final int rate;

  private java.util.List<Day16Kt$main$Node> paths;

  public Day16Kt$main$Node(int, java.util.List<Day16Kt$main$Node>);
    Code:
       0: aload_2
       1: ldc           #9                  // String paths
       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: iload_1
      12: putfield      #22                 // Field rate:I
      15: aload_0
      16: aload_2
      17: putfield      #25                 // Field paths:Ljava/util/List;
      20: return

  public Day16Kt$main$Node(int, java.util.List, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: iload_3
       1: iconst_2
       2: iand
       3: ifeq          10
       6: invokestatic  #34                 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
       9: astore_2
      10: aload_0
      11: iload_1
      12: aload_2
      13: invokespecial #36                 // Method "<init>":(ILjava/util/List;)V
      16: return

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

  public final java.util.List<Day16Kt$main$Node> getPaths();
    Code:
       0: aload_0
       1: getfield      #25                 // Field paths:Ljava/util/List;
       4: areturn

  public final void setPaths(java.util.List<Day16Kt$main$Node>);
    Code:
       0: aload_1
       1: ldc           #45                 // 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      #25                 // Field paths:Ljava/util/List;
      11: return
}

Compiled from "Day16.kt"
public final class Day16Kt {
  public static final void main();
    Code:
       0: new           #8                  // class kotlin/text/Regex
       3: dup
       4: ldc           #10                 // String Valve ([A-Z]+) has flow rate=(\\d+)
       6: invokespecial #14                 // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
       9: astore_0
      10: new           #8                  // class kotlin/text/Regex
      13: dup
      14: ldc           #16                 // String ([A-Z]+)
      16: invokespecial #14                 // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      19: astore_1
      20: bipush        16
      22: sipush        1651
      25: invokestatic  #22                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      28: sipush        1327
      31: invokestatic  #22                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      34: new           #24                 // class Day16Kt$main$1
      37: dup
      38: aload_0
      39: aload_1
      40: invokespecial #27                 // Method Day16Kt$main$1."<init>":(Lkotlin/text/Regex;Lkotlin/text/Regex;)V
      43: checkcast     #29                 // class kotlin/jvm/functions/Function1
      46: new           #31                 // class Day16Kt$main$2
      49: dup
      50: aload_0
      51: aload_1
      52: invokespecial #32                 // Method Day16Kt$main$2."<init>":(Lkotlin/text/Regex;Lkotlin/text/Regex;)V
      55: checkcast     #29                 // class kotlin/jvm/functions/Function1
      58: invokestatic  #38                 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
      61: return

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

  private static final Day16Kt$main$Node main$parseData$lambda$1(java.util.Map, kotlin.text.MatchResult);
    Code:
       0: aload_1
       1: ldc           #50                 // String it
       3: invokestatic  #56                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokeinterface #62,  1           // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;
      13: invokeinterface #68,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      18: dup
      19: invokestatic  #72                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      22: checkcast     #74                 // class Day16Kt$main$Node
      25: areturn

  private static final java.util.Map<java.lang.String, Day16Kt$main$Node> main$parseData(kotlin.text.Regex, kotlin.text.Regex, java.util.List<java.lang.String>);
    Code:
       0: new           #82                 // class java/util/LinkedHashMap
       3: dup
       4: invokespecial #84                 // Method java/util/LinkedHashMap."<init>":()V
       7: checkcast     #64                 // class java/util/Map
      10: astore_3
      11: aload_2
      12: invokeinterface #90,  1           // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      17: astore        4
      19: aload         4
      21: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      26: ifeq          154
      29: aload         4
      31: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      36: checkcast     #102                // class java/lang/String
      39: astore        5
      41: aload         5
      43: checkcast     #104                // class java/lang/CharSequence
      46: iconst_1
      47: anewarray     #102                // class java/lang/String
      50: astore        6
      52: aload         6
      54: iconst_0
      55: ldc           #106                // String ;
      57: aastore
      58: aload         6
      60: iconst_0
      61: iconst_0
      62: bipush        6
      64: aconst_null
      65: invokestatic  #112                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      68: invokestatic  #118                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      71: checkcast     #102                // class java/lang/String
      74: aload_0
      75: invokestatic  #122                // Method UtilsKt.destructured:(Ljava/lang/String;Lkotlin/text/Regex;)Lkotlin/text/MatchResult$Destructured;
      78: astore        7
      80: iconst_0
      81: istore        8
      83: aload         7
      85: invokevirtual #128                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
      88: invokeinterface #132,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
      93: iconst_1
      94: invokeinterface #135,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      99: checkcast     #102                // class java/lang/String
     102: astore        9
     104: aload         7
     106: invokevirtual #128                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     109: invokeinterface #132,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     114: iconst_2
     115: invokeinterface #135,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     120: checkcast     #102                // class java/lang/String
     123: astore        10
     125: aload_3
     126: aload         9
     128: new           #74                 // class Day16Kt$main$Node
     131: dup
     132: aload         10
     134: invokestatic  #139                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     137: aconst_null
     138: iconst_2
     139: aconst_null
     140: invokespecial #142                // Method Day16Kt$main$Node."<init>":(ILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     143: invokeinterface #146,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     148: pop
     149: nop
     150: nop
     151: goto          19
     154: aload_2
     155: invokeinterface #90,  1           // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     160: astore        4
     162: aload         4
     164: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     169: ifeq          317
     172: aload         4
     174: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     179: checkcast     #102                // class java/lang/String
     182: astore        5
     184: aload         5
     186: checkcast     #104                // class java/lang/CharSequence
     189: iconst_1
     190: anewarray     #102                // class java/lang/String
     193: astore        7
     195: aload         7
     197: iconst_0
     198: ldc           #106                // String ;
     200: aastore
     201: aload         7
     203: iconst_0
     204: iconst_0
     205: bipush        6
     207: aconst_null
     208: invokestatic  #112                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     211: invokestatic  #118                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     214: checkcast     #102                // class java/lang/String
     217: aload_0
     218: invokestatic  #122                // Method UtilsKt.destructured:(Ljava/lang/String;Lkotlin/text/Regex;)Lkotlin/text/MatchResult$Destructured;
     221: invokevirtual #128                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     224: invokeinterface #132,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     229: iconst_1
     230: invokeinterface #135,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     235: checkcast     #102                // class java/lang/String
     238: astore        7
     240: aload_1
     241: aload         5
     243: checkcast     #104                // class java/lang/CharSequence
     246: iconst_1
     247: anewarray     #102                // class java/lang/String
     250: astore        9
     252: aload         9
     254: iconst_0
     255: ldc           #106                // String ;
     257: aastore
     258: aload         9
     260: iconst_0
     261: iconst_0
     262: bipush        6
     264: aconst_null
     265: invokestatic  #112                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     268: invokestatic  #149                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     271: checkcast     #104                // class java/lang/CharSequence
     274: iconst_0
     275: iconst_2
     276: aconst_null
     277: invokestatic  #153                // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;
     280: aload_3
     281: invokedynamic #170,  0            // InvokeDynamic #0:invoke:(Ljava/util/Map;)Lkotlin/jvm/functions/Function1;
     286: invokestatic  #176                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     289: invokestatic  #180                // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
     292: astore        8
     294: aload_3
     295: aload         7
     297: invokeinterface #68,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     302: dup
     303: invokestatic  #72                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     306: checkcast     #74                 // class Day16Kt$main$Node
     309: aload         8
     311: invokevirtual #184                // Method Day16Kt$main$Node.setPaths:(Ljava/util/List;)V
     314: goto          162
     317: aload_3
     318: areturn

  private static final boolean main$bestPath$visitNode$lambda$6$lambda$3(Day16Kt$main$Node, Day16Kt$main$Node);
    Code:
       0: aload_1
       1: ldc           #198                // String end
       3: invokestatic  #56                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: aload_0
       8: invokestatic  #202                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      11: ireturn

  private static final int main$bestPath$visitNode$lambda$6$lambda$4(Day16Kt$main$Node);
    Code:
       0: aload_0
       1: ldc           #50                 // String it
       3: invokestatic  #56                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: ireturn

  private static final java.util.Collection main$bestPath$visitNode$lambda$6$lambda$5(Day16Kt$main$Node);
    Code:
       0: aload_0
       1: ldc           #210                // String n
       3: invokestatic  #56                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokevirtual #213                // Method Day16Kt$main$Node.getPaths:()Ljava/util/List;
      10: checkcast     #215                // class java/util/Collection
      13: areturn

  private static final kotlin.Pair<java.lang.Integer, java.util.List<Day16Kt$main$Node>> main$bestPath$visitNode(Day16Kt$main$Node, int, int, java.util.Set<Day16Kt$main$Node>, java.util.Set<Day16Kt$main$Node>, java.util.List<Day16Kt$main$Node>);
    Code:
       0: aload_3
       1: checkcast     #220                // class java/lang/Iterable
       4: astore        7
       6: iconst_0
       7: istore        8
       9: aload         7
      11: invokeinterface #221,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      16: astore        9
      18: aload         9
      20: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      25: ifeq          68
      28: aload         9
      30: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      35: astore        10
      37: iload         8
      39: aload         10
      41: checkcast     #74                 // class Day16Kt$main$Node
      44: astore        11
      46: istore        19
      48: iconst_0
      49: istore        12
      51: aload         11
      53: invokevirtual #225                // Method Day16Kt$main$Node.getRate:()I
      56: istore        20
      58: iload         19
      60: iload         20
      62: iadd
      63: istore        8
      65: goto          18
      68: iload         8
      70: istore        6
      72: aload         4
      74: checkcast     #220                // class java/lang/Iterable
      77: astore        8
      79: iconst_0
      80: istore        9
      82: aload         8
      84: astore        10
      86: new           #227                // class java/util/ArrayList
      89: dup
      90: aload         8
      92: bipush        10
      94: invokestatic  #231                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      97: invokespecial #234                // Method java/util/ArrayList."<init>":(I)V
     100: checkcast     #215                // class java/util/Collection
     103: astore        11
     105: iconst_0
     106: istore        12
     108: aload         10
     110: invokeinterface #221,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     115: astore        13
     117: aload         13
     119: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     124: ifeq          192
     127: aload         13
     129: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     134: astore        14
     136: aload         11
     138: aload         14
     140: checkcast     #74                 // class Day16Kt$main$Node
     143: astore        15
     145: astore        19
     147: iconst_0
     148: istore        16
     150: new           #236                // class kotlin/Pair
     153: dup
     154: aload         15
     156: aload_0
     157: aload         15
     159: invokedynamic #244,  0            // InvokeDynamic #1:invoke:(LDay16Kt$main$Node;)Lkotlin/jvm/functions/Function1;
     164: invokedynamic #252,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;
     169: invokedynamic #257,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;
     174: invokestatic  #261                // Method UtilsKt.aStar:(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/util/List;
     177: invokespecial #264                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     180: aload         19
     182: swap
     183: invokeinterface #268,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     188: pop
     189: goto          117
     192: aload         11
     194: checkcast     #86                 // class java/util/List
     197: nop
     198: checkcast     #220                // class java/lang/Iterable
     201: astore        8
     203: nop
     204: iconst_0
     205: istore        9
     207: aload         8
     209: astore        10
     211: new           #227                // class java/util/ArrayList
     214: dup
     215: invokespecial #269                // Method java/util/ArrayList."<init>":()V
     218: checkcast     #215                // class java/util/Collection
     221: astore        11
     223: iconst_0
     224: istore        12
     226: aload         10
     228: invokeinterface #221,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     233: astore        13
     235: aload         13
     237: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     242: ifeq          306
     245: aload         13
     247: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     252: astore        14
     254: aload         14
     256: checkcast     #236                // class kotlin/Pair
     259: astore        15
     261: iconst_0
     262: istore        16
     264: aload         15
     266: invokevirtual #272                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     269: checkcast     #86                 // class java/util/List
     272: astore        17
     274: aload         17
     276: invokeinterface #275,  1          // InterfaceMethod java/util/List.size:()I
     281: iload_1
     282: if_icmpgt     289
     285: iconst_1
     286: goto          290
     289: iconst_0
     290: ifeq          235
     293: aload         11
     295: aload         14
     297: invokeinterface #268,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     302: pop
     303: goto          235
     306: aload         11
     308: checkcast     #86                 // class java/util/List
     311: nop
     312: astore        7
     314: aload         7
     316: invokeinterface #278,  1          // InterfaceMethod java/util/List.isEmpty:()Z
     321: ifne          328
     324: iload_1
     325: ifne          349
     328: new           #236                // class kotlin/Pair
     331: dup
     332: iload_2
     333: iload_1
     334: iconst_1
     335: isub
     336: iload         6
     338: imul
     339: iadd
     340: invokestatic  #22                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     343: aload         5
     345: invokespecial #264                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     348: areturn
     349: aload         7
     351: checkcast     #220                // class java/lang/Iterable
     354: astore        8
     356: iconst_0
     357: istore        9
     359: aload         8
     361: astore        10
     363: new           #227                // class java/util/ArrayList
     366: dup
     367: aload         8
     369: bipush        10
     371: invokestatic  #231                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     374: invokespecial #234                // Method java/util/ArrayList."<init>":(I)V
     377: checkcast     #215                // class java/util/Collection
     380: astore        11
     382: iconst_0
     383: istore        12
     385: aload         10
     387: invokeinterface #221,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     392: astore        13
     394: aload         13
     396: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     401: ifeq          514
     404: aload         13
     406: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     411: astore        14
     413: aload         11
     415: aload         14
     417: checkcast     #236                // class kotlin/Pair
     420: astore        15
     422: astore        19
     424: iconst_0
     425: istore        16
     427: aload         15
     429: invokevirtual #281                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     432: checkcast     #74                 // class Day16Kt$main$Node
     435: astore        17
     437: aload         15
     439: invokevirtual #272                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     442: checkcast     #86                 // class java/util/List
     445: astore        18
     447: aload         17
     449: iload_1
     450: aload         18
     452: invokeinterface #275,  1          // InterfaceMethod java/util/List.size:()I
     457: isub
     458: iload_2
     459: aload         18
     461: invokeinterface #275,  1          // InterfaceMethod java/util/List.size:()I
     466: iload         6
     468: imul
     469: iadd
     470: aload         17
     472: invokevirtual #225                // Method Day16Kt$main$Node.getRate:()I
     475: iadd
     476: aload_3
     477: aload         17
     479: invokestatic  #287                // Method kotlin/collections/SetsKt.plus:(Ljava/util/Set;Ljava/lang/Object;)Ljava/util/Set;
     482: aload         4
     484: aload         17
     486: invokestatic  #290                // Method kotlin/collections/SetsKt.minus:(Ljava/util/Set;Ljava/lang/Object;)Ljava/util/Set;
     489: aload         5
     491: checkcast     #215                // class java/util/Collection
     494: aload         17
     496: invokestatic  #293                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;
     499: invokestatic  #295                // Method main$bestPath$visitNode:(LDay16Kt$main$Node;IILjava/util/Set;Ljava/util/Set;Ljava/util/List;)Lkotlin/Pair;
     502: aload         19
     504: swap
     505: invokeinterface #268,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     510: pop
     511: goto          394
     514: aload         11
     516: checkcast     #86                 // class java/util/List
     519: nop
     520: checkcast     #220                // class java/lang/Iterable
     523: astore        8
     525: nop
     526: iconst_0
     527: istore        9
     529: aload         8
     531: invokeinterface #221,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     536: astore        10
     538: aload         10
     540: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     545: ifne          556
     548: new           #297                // class java/util/NoSuchElementException
     551: dup
     552: invokespecial #298                // Method java/util/NoSuchElementException."<init>":()V
     555: athrow
     556: aload         10
     558: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     563: astore        11
     565: aload         10
     567: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     572: ifne          580
     575: aload         11
     577: goto          662
     580: aload         11
     582: checkcast     #236                // class kotlin/Pair
     585: astore        12
     587: iconst_0
     588: istore        13
     590: aload         12
     592: invokevirtual #301                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     595: checkcast     #303                // class java/lang/Number
     598: invokevirtual #306                // Method java/lang/Number.intValue:()I
     601: istore        12
     603: aload         10
     605: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     610: astore        13
     612: aload         13
     614: checkcast     #236                // class kotlin/Pair
     617: astore        14
     619: iconst_0
     620: istore        15
     622: aload         14
     624: invokevirtual #301                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     627: checkcast     #303                // class java/lang/Number
     630: invokevirtual #306                // Method java/lang/Number.intValue:()I
     633: istore        14
     635: iload         12
     637: iload         14
     639: if_icmpge     650
     642: aload         13
     644: astore        11
     646: iload         14
     648: istore        12
     650: aload         10
     652: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     657: ifne          603
     660: aload         11
     662: checkcast     #236                // class kotlin/Pair
     665: areturn

  private static final kotlin.Pair<java.lang.Integer, java.util.List<Day16Kt$main$Node>> main$bestPath(Day16Kt$main$Node, java.util.Set<Day16Kt$main$Node>, int);
    Code:
       0: aload_0
       1: iload_2
       2: iconst_0
       3: invokestatic  #355                // Method kotlin/collections/SetsKt.emptySet:()Ljava/util/Set;
       6: aload_1
       7: invokestatic  #358                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
      10: invokestatic  #295                // Method main$bestPath$visitNode:(LDay16Kt$main$Node;IILjava/util/Set;Ljava/util/Set;Ljava/util/List;)Lkotlin/Pair;
      13: areturn

  private static final int main$part1(kotlin.text.Regex, kotlin.text.Regex, java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokestatic  #366                // Method main$parseData:(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)Ljava/util/Map;
       6: astore_3
       7: aload_3
       8: invokeinterface #370,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
      13: checkcast     #220                // class java/lang/Iterable
      16: astore        5
      18: iconst_0
      19: istore        6
      21: aload         5
      23: astore        7
      25: new           #227                // class java/util/ArrayList
      28: dup
      29: invokespecial #269                // Method java/util/ArrayList."<init>":()V
      32: checkcast     #215                // class java/util/Collection
      35: astore        8
      37: iconst_0
      38: istore        9
      40: aload         7
      42: invokeinterface #221,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      47: astore        10
      49: aload         10
      51: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      56: ifeq          107
      59: aload         10
      61: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      66: astore        11
      68: aload         11
      70: checkcast     #74                 // class Day16Kt$main$Node
      73: astore        12
      75: iconst_0
      76: istore        13
      78: aload         12
      80: invokevirtual #225                // Method Day16Kt$main$Node.getRate:()I
      83: ifeq          90
      86: iconst_1
      87: goto          91
      90: iconst_0
      91: ifeq          49
      94: aload         8
      96: aload         11
      98: invokeinterface #268,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     103: pop
     104: goto          49
     107: aload         8
     109: checkcast     #86                 // class java/util/List
     112: nop
     113: checkcast     #220                // class java/lang/Iterable
     116: invokestatic  #374                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     119: astore        4
     121: aload_3
     122: ldc_w         #376                // String AA
     125: invokeinterface #68,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     130: dup
     131: invokestatic  #72                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     134: checkcast     #74                 // class Day16Kt$main$Node
     137: aload         4
     139: bipush        30
     141: invokestatic  #378                // Method main$bestPath:(LDay16Kt$main$Node;Ljava/util/Set;I)Lkotlin/Pair;
     144: astore        5
     146: aload         5
     148: invokevirtual #301                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     151: checkcast     #303                // class java/lang/Number
     154: invokevirtual #306                // Method java/lang/Number.intValue:()I
     157: ireturn

  private static final int main$part2(kotlin.text.Regex, kotlin.text.Regex, java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokestatic  #366                // Method main$parseData:(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)Ljava/util/Map;
       6: astore_3
       7: aload_3
       8: invokeinterface #370,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
      13: checkcast     #220                // class java/lang/Iterable
      16: astore        5
      18: iconst_0
      19: istore        6
      21: aload         5
      23: astore        7
      25: new           #227                // class java/util/ArrayList
      28: dup
      29: invokespecial #269                // Method java/util/ArrayList."<init>":()V
      32: checkcast     #215                // class java/util/Collection
      35: astore        8
      37: iconst_0
      38: istore        9
      40: aload         7
      42: invokeinterface #221,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      47: astore        10
      49: aload         10
      51: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      56: ifeq          107
      59: aload         10
      61: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      66: astore        11
      68: aload         11
      70: checkcast     #74                 // class Day16Kt$main$Node
      73: astore        12
      75: iconst_0
      76: istore        13
      78: aload         12
      80: invokevirtual #225                // Method Day16Kt$main$Node.getRate:()I
      83: ifeq          90
      86: iconst_1
      87: goto          91
      90: iconst_0
      91: ifeq          49
      94: aload         8
      96: aload         11
      98: invokeinterface #268,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     103: pop
     104: goto          49
     107: aload         8
     109: checkcast     #86                 // class java/util/List
     112: nop
     113: checkcast     #220                // class java/lang/Iterable
     116: invokestatic  #374                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     119: astore        4
     121: aload_3
     122: ldc_w         #376                // String AA
     125: invokeinterface #68,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     130: dup
     131: invokestatic  #72                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     134: checkcast     #74                 // class Day16Kt$main$Node
     137: aload         4
     139: bipush        26
     141: invokestatic  #378                // Method main$bestPath:(LDay16Kt$main$Node;Ljava/util/Set;I)Lkotlin/Pair;
     144: astore        5
     146: aload_3
     147: ldc_w         #376                // String AA
     150: invokeinterface #68,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     155: dup
     156: invokestatic  #72                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     159: checkcast     #74                 // class Day16Kt$main$Node
     162: aload         4
     164: aload         5
     166: invokevirtual #385                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     169: checkcast     #220                // class java/lang/Iterable
     172: invokestatic  #374                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     175: checkcast     #220                // class java/lang/Iterable
     178: invokestatic  #388                // Method kotlin/collections/SetsKt.minus:(Ljava/util/Set;Ljava/lang/Iterable;)Ljava/util/Set;
     181: bipush        26
     183: invokestatic  #378                // Method main$bestPath:(LDay16Kt$main$Node;Ljava/util/Set;I)Lkotlin/Pair;
     186: astore        6
     188: aload         5
     190: invokevirtual #301                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     193: checkcast     #303                // class java/lang/Number
     196: invokevirtual #306                // Method java/lang/Number.intValue:()I
     199: aload         6
     201: invokevirtual #301                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     204: checkcast     #303                // class java/lang/Number
     207: invokevirtual #306                // Method java/lang/Number.intValue:()I
     210: iadd
     211: ireturn

  public static final int access$main$part1(kotlin.text.Regex, kotlin.text.Regex, java.util.List);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokestatic  #394                // Method main$part1:(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)I
       6: ireturn

  public static final int access$main$part2(kotlin.text.Regex, kotlin.text.Regex, java.util.List);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokestatic  #397                // Method main$part2:(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)I
       6: ireturn
}

Compiled from "Day16.kt"
final class Day16Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {
  final kotlin.text.Regex $inputLineRegex;

  final kotlin.text.Regex $input2LineRegex;

  Day16Kt$main$2(kotlin.text.Regex, kotlin.text.Regex);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #13                 // Field $inputLineRegex:Lkotlin/text/Regex;
       5: aload_0
       6: aload_2
       7: putfield      #16                 // Field $input2LineRegex:Lkotlin/text/Regex;
      10: aload_0
      11: iconst_1
      12: ldc           #18                 // class kotlin/jvm/internal/Intrinsics$Kotlin
      14: ldc           #20                 // String part2
      16: ldc           #22                 // String main$part2(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)I
      18: iconst_0
      19: invokespecial #25                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      22: return

  public final java.lang.Integer invoke(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #32                 // String p0
       3: invokestatic  #38                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #13                 // Field $inputLineRegex:Lkotlin/text/Regex;
      10: aload_0
      11: getfield      #16                 // Field $input2LineRegex:Lkotlin/text/Regex;
      14: aload_1
      15: invokestatic  #44                 // Method Day16Kt.access$main$part2:(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)I
      18: invokestatic  #50                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      21: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #54                 // class java/util/List
       5: invokevirtual #56                 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;
       8: areturn
}

Compiled from "Day16.kt"
final class Day16Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {
  final kotlin.text.Regex $inputLineRegex;

  final kotlin.text.Regex $input2LineRegex;

  Day16Kt$main$1(kotlin.text.Regex, kotlin.text.Regex);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #13                 // Field $inputLineRegex:Lkotlin/text/Regex;
       5: aload_0
       6: aload_2
       7: putfield      #16                 // Field $input2LineRegex:Lkotlin/text/Regex;
      10: aload_0
      11: iconst_1
      12: ldc           #18                 // class kotlin/jvm/internal/Intrinsics$Kotlin
      14: ldc           #20                 // String part1
      16: ldc           #22                 // String main$part1(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)I
      18: iconst_0
      19: invokespecial #25                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      22: return

  public final java.lang.Integer invoke(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #32                 // String p0
       3: invokestatic  #38                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #13                 // Field $inputLineRegex:Lkotlin/text/Regex;
      10: aload_0
      11: getfield      #16                 // Field $input2LineRegex:Lkotlin/text/Regex;
      14: aload_1
      15: invokestatic  #44                 // Method Day16Kt.access$main$part1:(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)I
      18: invokestatic  #50                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      21: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #54                 // class java/util/List
       5: invokevirtual #56                 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;
       8: areturn
}