object Day12 {

    @Suppress("UNUSED_PARAMETER")
    fun part1(input: String): Long = TODO()

    @Suppress("UNUSED_PARAMETER")
    fun part2(input: String): Long = TODO()

    private const val START_CHARACTER = 'S'
    private const val GOAL_CHARACTER = 'E'

    fun findPath(input: String): String {
        val map = parseMap(input)
        var currentState = findInitialState(map)

        val maxY = map.size - 1
        val maxX = map.first().size - 1

        val outputMap: List<MutableList<Char>> = map.map { it.mapTo(mutableListOf()) { '.' } }

        while (map[currentState.y][currentState.x] != GOAL_CHARACTER) {
            print(map[currentState.y][currentState.x])
            val (direction, nextState) = getSuccessors(currentState, maxX, maxY)
//                .filter { (_, coordinate) ->
//                    map[coordinate.y][coordinate.x] == GOAL_CHARACTER || map[coordinate.y][coordinate.x] - map[currentState.y][currentState.x] <= 1
//                }
                .maxBy { (_, coordinate) ->
                    val value = map[coordinate.y][coordinate.x]
                    if (value == GOAL_CHARACTER) 'z' + 1 else value
                }
            outputMap[currentState.y][currentState.x] = direction.char
            currentState = nextState
        }

        outputMap[currentState.y][currentState.x] = GOAL_CHARACTER

        return outputMap.joinToString(separator = "\n") { it.joinToString(separator = "")}
    }

    private fun parseMap(input: String): List<List<Char>> = input.lines().map { it.toList() }

    private fun findInitialState(map: List<List<Char>>) : Coordinate =
        map.withIndex()
            .map { (row, l) ->
                Coordinate(l.withIndex().find { (_, c) -> c == START_CHARACTER }!!.index, row)
            }
            .first()

    private fun getSuccessors(currentCoordinate: Coordinate, maxX: Int, maxY: Int) = Direction.values()
        .map { it to it.getNextSquare(currentCoordinate) }
        .filter { (_, target) -> target.x in (0 .. maxX) && target.y in (0 .. maxY) }

    class Coordinate(val x: Int, val y: Int)

    enum class Direction(val char: Char) {
        UP('^') {
            override fun getNextSquare(currentCoordinate: Coordinate) =
                Coordinate(currentCoordinate.x, currentCoordinate.y - 1)
        },
        DOWN('v') {
            override fun getNextSquare(currentCoordinate: Coordinate) =
                Coordinate(currentCoordinate.x, currentCoordinate.y + 1)
        },
        LEFT('<') {
            override fun getNextSquare(currentCoordinate: Coordinate): Coordinate =
                Coordinate(currentCoordinate.x - 1, currentCoordinate.y)
        },
        RIGHT('>') {
            override fun getNextSquare(currentCoordinate: Coordinate) =
                Coordinate(currentCoordinate.x + 1, currentCoordinate.y)
        };

        abstract fun getNextSquare(currentCoordinate: Coordinate) : Coordinate
    }
}

Compiled from "Day12.kt"
final class Day12$Direction$DOWN extends Day12$Direction {
  Day12$Direction$DOWN();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: bipush        118
       5: aconst_null
       6: invokespecial #10                 // Method Day12$Direction."<init>":(Ljava/lang/String;ICLkotlin/jvm/internal/DefaultConstructorMarker;)V
       9: return

  public Day12$Coordinate getNextSquare(Day12$Coordinate);
    Code:
       0: aload_1
       1: ldc           #21                 // String currentCoordinate
       3: invokestatic  #27                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #29                 // class Day12$Coordinate
       9: dup
      10: aload_1
      11: invokevirtual #33                 // Method Day12$Coordinate.getX:()I
      14: aload_1
      15: invokevirtual #36                 // Method Day12$Coordinate.getY:()I
      18: iconst_1
      19: iadd
      20: invokespecial #39                 // Method Day12$Coordinate."<init>":(II)V
      23: areturn
}

Compiled from "Day12.kt"
public final class Day12$Coordinate {
  private final int x;

  private final int y;

  public Day12$Coordinate(int, int);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #13                 // Field x:I
       9: aload_0
      10: iload_2
      11: putfield      #16                 // Field y:I
      14: return

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

  public final int getY();
    Code:
       0: aload_0
       1: getfield      #16                 // Field y:I
       4: ireturn
}

Compiled from "Day12.kt"
final class Day12$Direction$LEFT extends Day12$Direction {
  Day12$Direction$LEFT();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: bipush        60
       5: aconst_null
       6: invokespecial #10                 // Method Day12$Direction."<init>":(Ljava/lang/String;ICLkotlin/jvm/internal/DefaultConstructorMarker;)V
       9: return

  public Day12$Coordinate getNextSquare(Day12$Coordinate);
    Code:
       0: aload_1
       1: ldc           #21                 // String currentCoordinate
       3: invokestatic  #27                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #29                 // class Day12$Coordinate
       9: dup
      10: aload_1
      11: invokevirtual #33                 // Method Day12$Coordinate.getX:()I
      14: iconst_1
      15: isub
      16: aload_1
      17: invokevirtual #36                 // Method Day12$Coordinate.getY:()I
      20: invokespecial #39                 // Method Day12$Coordinate."<init>":(II)V
      23: areturn
}

Compiled from "Day12.kt"
final class Day12$Direction$RIGHT extends Day12$Direction {
  Day12$Direction$RIGHT();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: bipush        62
       5: aconst_null
       6: invokespecial #10                 // Method Day12$Direction."<init>":(Ljava/lang/String;ICLkotlin/jvm/internal/DefaultConstructorMarker;)V
       9: return

  public Day12$Coordinate getNextSquare(Day12$Coordinate);
    Code:
       0: aload_1
       1: ldc           #21                 // String currentCoordinate
       3: invokestatic  #27                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #29                 // class Day12$Coordinate
       9: dup
      10: aload_1
      11: invokevirtual #33                 // Method Day12$Coordinate.getX:()I
      14: iconst_1
      15: iadd
      16: aload_1
      17: invokevirtual #36                 // Method Day12$Coordinate.getY:()I
      20: invokespecial #39                 // Method Day12$Coordinate."<init>":(II)V
      23: areturn
}

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

  private static final char START_CHARACTER;

  private static final char GOAL_CHARACTER;

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

  public final long part1(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #23                 // class kotlin/NotImplementedError
       9: dup
      10: aconst_null
      11: iconst_1
      12: aconst_null
      13: invokespecial #26                 // Method kotlin/NotImplementedError."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
      16: athrow

  public final long part2(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #23                 // class kotlin/NotImplementedError
       9: dup
      10: aconst_null
      11: iconst_1
      12: aconst_null
      13: invokespecial #26                 // Method kotlin/NotImplementedError."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
      16: athrow

  public final java.lang.String findPath(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokespecial #34                 // Method parseMap:(Ljava/lang/String;)Ljava/util/List;
      11: astore_2
      12: aload_0
      13: aload_2
      14: invokespecial #38                 // Method findInitialState:(Ljava/util/List;)LDay12$Coordinate;
      17: astore_3
      18: aload_2
      19: invokeinterface #44,  1           // InterfaceMethod java/util/List.size:()I
      24: iconst_1
      25: isub
      26: istore        4
      28: aload_2
      29: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      32: checkcast     #40                 // class java/util/List
      35: invokeinterface #44,  1           // InterfaceMethod java/util/List.size:()I
      40: iconst_1
      41: isub
      42: istore        5
      44: aload_2
      45: checkcast     #52                 // class java/lang/Iterable
      48: astore        7
      50: iconst_0
      51: istore        8
      53: aload         7
      55: astore        9
      57: new           #54                 // class java/util/ArrayList
      60: dup
      61: aload         7
      63: bipush        10
      65: invokestatic  #58                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      68: invokespecial #61                 // Method java/util/ArrayList."<init>":(I)V
      71: checkcast     #63                 // class java/util/Collection
      74: astore        10
      76: iconst_0
      77: istore        11
      79: aload         9
      81: invokeinterface #67,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      86: astore        12
      88: aload         12
      90: invokeinterface #73,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      95: ifeq          227
      98: aload         12
     100: invokeinterface #77,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     105: astore        13
     107: aload         10
     109: aload         13
     111: checkcast     #40                 // class java/util/List
     114: astore        14
     116: astore        24
     118: iconst_0
     119: istore        15
     121: aload         14
     123: checkcast     #52                 // class java/lang/Iterable
     126: astore        16
     128: new           #54                 // class java/util/ArrayList
     131: dup
     132: invokespecial #78                 // Method java/util/ArrayList."<init>":()V
     135: checkcast     #40                 // class java/util/List
     138: checkcast     #63                 // class java/util/Collection
     141: astore        17
     143: nop
     144: iconst_0
     145: istore        18
     147: aload         16
     149: invokeinterface #67,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     154: astore        19
     156: aload         19
     158: invokeinterface #73,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     163: ifeq          209
     166: aload         19
     168: invokeinterface #77,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     173: astore        20
     175: aload         17
     177: aload         20
     179: checkcast     #80                 // class java/lang/Character
     182: invokevirtual #84                 // Method java/lang/Character.charValue:()C
     185: istore        21
     187: astore        22
     189: iconst_0
     190: istore        23
     192: bipush        46
     194: invokestatic  #88                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     197: aload         22
     199: swap
     200: invokeinterface #92,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     205: pop
     206: goto          156
     209: aload         17
     211: checkcast     #40                 // class java/util/List
     214: nop
     215: aload         24
     217: swap
     218: invokeinterface #92,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     223: pop
     224: goto          88
     227: aload         10
     229: checkcast     #40                 // class java/util/List
     232: nop
     233: astore        6
     235: aload_2
     236: aload_3
     237: invokevirtual #97                 // Method Day12$Coordinate.getY:()I
     240: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     245: checkcast     #40                 // class java/util/List
     248: aload_3
     249: invokevirtual #104                // Method Day12$Coordinate.getX:()I
     252: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     257: checkcast     #80                 // class java/lang/Character
     260: invokevirtual #84                 // Method java/lang/Character.charValue:()C
     263: bipush        69
     265: if_icmpeq     610
     268: aload_2
     269: aload_3
     270: invokevirtual #97                 // Method Day12$Coordinate.getY:()I
     273: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     278: checkcast     #40                 // class java/util/List
     281: aload_3
     282: invokevirtual #104                // Method Day12$Coordinate.getX:()I
     285: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     290: checkcast     #80                 // class java/lang/Character
     293: invokevirtual #84                 // Method java/lang/Character.charValue:()C
     296: istore        7
     298: getstatic     #110                // Field java/lang/System.out:Ljava/io/PrintStream;
     301: iload         7
     303: invokevirtual #116                // Method java/io/PrintStream.print:(C)V
     306: aload_0
     307: aload_3
     308: iload         5
     310: iload         4
     312: invokespecial #120                // Method getSuccessors:(LDay12$Coordinate;II)Ljava/util/List;
     315: checkcast     #52                 // class java/lang/Iterable
     318: astore        8
     320: nop
     321: iconst_0
     322: istore        9
     324: aload         8
     326: invokeinterface #67,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     331: astore        10
     333: aload         10
     335: invokeinterface #73,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     340: ifne          351
     343: new           #122                // class java/util/NoSuchElementException
     346: dup
     347: invokespecial #123                // Method java/util/NoSuchElementException."<init>":()V
     350: athrow
     351: aload         10
     353: invokeinterface #77,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     358: astore        11
     360: aload         10
     362: invokeinterface #73,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     367: ifne          375
     370: aload         11
     372: goto          547
     375: aload         11
     377: checkcast     #125                // class kotlin/Pair
     380: astore        12
     382: iconst_0
     383: istore        13
     385: aload         12
     387: invokevirtual #128                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     390: checkcast     #94                 // class Day12$Coordinate
     393: astore        14
     395: aload_2
     396: aload         14
     398: invokevirtual #97                 // Method Day12$Coordinate.getY:()I
     401: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     406: checkcast     #40                 // class java/util/List
     409: aload         14
     411: invokevirtual #104                // Method Day12$Coordinate.getX:()I
     414: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     419: checkcast     #80                 // class java/lang/Character
     422: invokevirtual #84                 // Method java/lang/Character.charValue:()C
     425: istore        15
     427: iload         15
     429: bipush        69
     431: if_icmpne     439
     434: bipush        123
     436: goto          441
     439: iload         15
     441: istore        12
     443: aload         10
     445: invokeinterface #77,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     450: astore        13
     452: aload         13
     454: checkcast     #125                // class kotlin/Pair
     457: astore        14
     459: iconst_0
     460: istore        15
     462: aload         14
     464: invokevirtual #128                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     467: checkcast     #94                 // class Day12$Coordinate
     470: astore        16
     472: aload_2
     473: aload         16
     475: invokevirtual #97                 // Method Day12$Coordinate.getY:()I
     478: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     483: checkcast     #40                 // class java/util/List
     486: aload         16
     488: invokevirtual #104                // Method Day12$Coordinate.getX:()I
     491: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     496: checkcast     #80                 // class java/lang/Character
     499: invokevirtual #84                 // Method java/lang/Character.charValue:()C
     502: istore        17
     504: iload         17
     506: bipush        69
     508: if_icmpne     516
     511: bipush        123
     513: goto          518
     516: iload         17
     518: istore        14
     520: iload         12
     522: iload         14
     524: if_icmpge     535
     527: aload         13
     529: astore        11
     531: iload         14
     533: istore        12
     535: aload         10
     537: invokeinterface #73,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     542: ifne          443
     545: aload         11
     547: checkcast     #125                // class kotlin/Pair
     550: astore        7
     552: aload         7
     554: invokevirtual #131                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     557: checkcast     #133                // class Day12$Direction
     560: astore        8
     562: aload         7
     564: invokevirtual #128                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     567: checkcast     #94                 // class Day12$Coordinate
     570: astore        9
     572: aload         6
     574: aload_3
     575: invokevirtual #97                 // Method Day12$Coordinate.getY:()I
     578: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     583: checkcast     #40                 // class java/util/List
     586: aload_3
     587: invokevirtual #104                // Method Day12$Coordinate.getX:()I
     590: aload         8
     592: invokevirtual #136                // Method Day12$Direction.getChar:()C
     595: invokestatic  #88                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     598: invokeinterface #140,  3          // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
     603: pop
     604: aload         9
     606: astore_3
     607: goto          235
     610: aload         6
     612: aload_3
     613: invokevirtual #97                 // Method Day12$Coordinate.getY:()I
     616: invokeinterface #101,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     621: checkcast     #40                 // class java/util/List
     624: aload_3
     625: invokevirtual #104                // Method Day12$Coordinate.getX:()I
     628: bipush        69
     630: invokestatic  #88                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     633: invokeinterface #140,  3          // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
     638: pop
     639: aload         6
     641: checkcast     #52                 // class java/lang/Iterable
     644: ldc           #142                // String \n
     646: checkcast     #144                // class java/lang/CharSequence
     649: aconst_null
     650: aconst_null
     651: iconst_0
     652: aconst_null
     653: invokedynamic #163,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
     658: bipush        30
     660: aconst_null
     661: invokestatic  #167                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     664: areturn

  private final java.util.List<java.util.List<java.lang.Character>> parseMap(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #144                // class java/lang/CharSequence
       4: invokestatic  #214                // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;
       7: checkcast     #52                 // class java/lang/Iterable
      10: astore_2
      11: iconst_0
      12: istore_3
      13: aload_2
      14: astore        4
      16: new           #54                 // class java/util/ArrayList
      19: dup
      20: aload_2
      21: bipush        10
      23: invokestatic  #58                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      26: invokespecial #61                 // Method java/util/ArrayList."<init>":(I)V
      29: checkcast     #63                 // class java/util/Collection
      32: astore        5
      34: iconst_0
      35: istore        6
      37: aload         4
      39: invokeinterface #67,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      44: astore        7
      46: aload         7
      48: invokeinterface #73,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      53: ifeq          99
      56: aload         7
      58: invokeinterface #77,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: astore        8
      65: aload         5
      67: aload         8
      69: checkcast     #207                // class java/lang/String
      72: astore        9
      74: astore        11
      76: iconst_0
      77: istore        10
      79: aload         9
      81: checkcast     #144                // class java/lang/CharSequence
      84: invokestatic  #217                // Method kotlin/text/StringsKt.toList:(Ljava/lang/CharSequence;)Ljava/util/List;
      87: aload         11
      89: swap
      90: invokeinterface #92,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      95: pop
      96: goto          46
      99: aload         5
     101: checkcast     #40                 // class java/util/List
     104: nop
     105: areturn

  private final Day12$Coordinate findInitialState(java.util.List<? extends java.util.List<java.lang.Character>>);
    Code:
       0: aload_1
       1: checkcast     #52                 // class java/lang/Iterable
       4: invokestatic  #223                // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
       7: astore_2
       8: nop
       9: iconst_0
      10: istore_3
      11: aload_2
      12: astore        4
      14: new           #54                 // class java/util/ArrayList
      17: dup
      18: aload_2
      19: bipush        10
      21: invokestatic  #58                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      24: invokespecial #61                 // Method java/util/ArrayList."<init>":(I)V
      27: checkcast     #63                 // class java/util/Collection
      30: astore        5
      32: iconst_0
      33: istore        6
      35: aload         4
      37: invokeinterface #67,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      42: astore        7
      44: aload         7
      46: invokeinterface #73,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      51: ifeq          215
      54: aload         7
      56: invokeinterface #77,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      61: astore        8
      63: aload         5
      65: aload         8
      67: checkcast     #225                // class kotlin/collections/IndexedValue
      70: astore        9
      72: astore        19
      74: iconst_0
      75: istore        10
      77: aload         9
      79: invokevirtual #227                // Method kotlin/collections/IndexedValue.component1:()I
      82: istore        11
      84: aload         9
      86: invokevirtual #228                // Method kotlin/collections/IndexedValue.component2:()Ljava/lang/Object;
      89: checkcast     #40                 // class java/util/List
      92: astore        12
      94: aload         12
      96: checkcast     #52                 // class java/lang/Iterable
      99: invokestatic  #223                // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
     102: astore        13
     104: aload         13
     106: invokeinterface #67,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     111: astore        14
     113: aload         14
     115: invokeinterface #73,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     120: ifeq          175
     123: aload         14
     125: invokeinterface #77,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     130: astore        15
     132: aload         15
     134: checkcast     #225                // class kotlin/collections/IndexedValue
     137: astore        16
     139: iconst_0
     140: istore        17
     142: aload         16
     144: invokevirtual #228                // Method kotlin/collections/IndexedValue.component2:()Ljava/lang/Object;
     147: checkcast     #80                 // class java/lang/Character
     150: invokevirtual #84                 // Method java/lang/Character.charValue:()C
     153: istore        18
     155: iload         18
     157: bipush        83
     159: if_icmpne     166
     162: iconst_1
     163: goto          167
     166: iconst_0
     167: ifeq          113
     170: aload         15
     172: goto          176
     175: aconst_null
     176: dup
     177: invokestatic  #232                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     180: checkcast     #225                // class kotlin/collections/IndexedValue
     183: invokevirtual #235                // Method kotlin/collections/IndexedValue.getIndex:()I
     186: iload         11
     188: istore        20
     190: istore        21
     192: new           #94                 // class Day12$Coordinate
     195: dup
     196: iload         21
     198: iload         20
     200: invokespecial #238                // Method Day12$Coordinate."<init>":(II)V
     203: aload         19
     205: swap
     206: invokeinterface #92,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     211: pop
     212: goto          44
     215: aload         5
     217: checkcast     #40                 // class java/util/List
     220: nop
     221: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     224: checkcast     #94                 // class Day12$Coordinate
     227: areturn

  private final java.util.List<kotlin.Pair<Day12$Direction, Day12$Coordinate>> getSuccessors(Day12$Coordinate, int, int);
    Code:
       0: invokestatic  #248                // Method Day12$Direction.values:()[LDay12$Direction;
       3: astore        4
       5: nop
       6: iconst_0
       7: istore        5
       9: aload         4
      11: astore        6
      13: new           #54                 // class java/util/ArrayList
      16: dup
      17: aload         4
      19: arraylength
      20: invokespecial #61                 // Method java/util/ArrayList."<init>":(I)V
      23: checkcast     #63                 // class java/util/Collection
      26: astore        7
      28: iconst_0
      29: istore        8
      31: iconst_0
      32: istore        9
      34: aload         6
      36: arraylength
      37: istore        10
      39: iload         9
      41: iload         10
      43: if_icmpge     90
      46: aload         6
      48: iload         9
      50: aaload
      51: astore        11
      53: aload         7
      55: aload         11
      57: astore        12
      59: astore        15
      61: iconst_0
      62: istore        13
      64: aload         12
      66: aload         12
      68: aload_1
      69: invokevirtual #252                // Method Day12$Direction.getNextSquare:(LDay12$Coordinate;)LDay12$Coordinate;
      72: invokestatic  #258                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      75: aload         15
      77: swap
      78: invokeinterface #92,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      83: pop
      84: iinc          9, 1
      87: goto          39
      90: aload         7
      92: checkcast     #40                 // class java/util/List
      95: nop
      96: checkcast     #52                 // class java/lang/Iterable
      99: astore        4
     101: nop
     102: iconst_0
     103: istore        5
     105: aload         4
     107: astore        6
     109: new           #54                 // class java/util/ArrayList
     112: dup
     113: invokespecial #78                 // Method java/util/ArrayList."<init>":()V
     116: checkcast     #63                 // class java/util/Collection
     119: astore        7
     121: iconst_0
     122: istore        8
     124: aload         6
     126: invokeinterface #67,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     131: astore        9
     133: aload         9
     135: invokeinterface #73,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     140: ifeq          255
     143: aload         9
     145: invokeinterface #77,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     150: astore        10
     152: aload         10
     154: checkcast     #125                // class kotlin/Pair
     157: astore        11
     159: iconst_0
     160: istore        12
     162: aload         11
     164: invokevirtual #128                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     167: checkcast     #94                 // class Day12$Coordinate
     170: astore        13
     172: aload         13
     174: invokevirtual #104                // Method Day12$Coordinate.getX:()I
     177: istore        14
     179: iconst_0
     180: iload         14
     182: if_icmpgt     199
     185: iload         14
     187: iload_2
     188: if_icmpgt     195
     191: iconst_1
     192: goto          200
     195: iconst_0
     196: goto          200
     199: iconst_0
     200: ifeq          238
     203: aload         13
     205: invokevirtual #97                 // Method Day12$Coordinate.getY:()I
     208: istore        14
     210: iconst_0
     211: iload         14
     213: if_icmpgt     230
     216: iload         14
     218: iload_3
     219: if_icmpgt     226
     222: iconst_1
     223: goto          231
     226: iconst_0
     227: goto          231
     230: iconst_0
     231: ifeq          238
     234: iconst_1
     235: goto          239
     238: iconst_0
     239: ifeq          133
     242: aload         7
     244: aload         10
     246: invokeinterface #92,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     251: pop
     252: goto          133
     255: aload         7
     257: checkcast     #40                 // class java/util/List
     260: nop
     261: areturn

  private static final java.lang.CharSequence findPath$lambda$3(java.util.List);
    Code:
       0: aload_0
       1: ldc_w         #271                // String it
       4: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: checkcast     #52                 // class java/lang/Iterable
      11: ldc_w         #273                // String
      14: checkcast     #144                // class java/lang/CharSequence
      17: aconst_null
      18: aconst_null
      19: iconst_0
      20: aconst_null
      21: aconst_null
      22: bipush        62
      24: aconst_null
      25: invokestatic  #167                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
      28: checkcast     #144                // class java/lang/CharSequence
      31: areturn

  static {};
    Code:
       0: new           #2                  // class Day12
       3: dup
       4: invokespecial #275                // Method "<init>":()V
       7: putstatic     #278                // Field INSTANCE:LDay12;
      10: return
}

Compiled from "Day12.kt"
public abstract class Day12$Direction extends java.lang.Enum<Day12$Direction> {
  private final char char;

  public static final Day12$Direction UP;

  public static final Day12$Direction DOWN;

  public static final Day12$Direction LEFT;

  public static final Day12$Direction RIGHT;

  private static final Day12$Direction[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

  private Day12$Direction(char);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #11                 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
       6: aload_0
       7: iload_3
       8: putfield      #15                 // Field char:C
      11: return

  public final char getChar();
    Code:
       0: aload_0
       1: getfield      #15                 // Field char:C
       4: ireturn

  public abstract Day12$Coordinate getNextSquare(Day12$Coordinate);

  public static Day12$Direction[] values();
    Code:
       0: getstatic     #32                 // Field $VALUES:[LDay12$Direction;
       3: invokevirtual #38                 // Method java/lang/Object.clone:()Ljava/lang/Object;
       6: checkcast     #39                 // class "[LDay12$Direction;"
       9: areturn

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

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

  private static final Day12$Direction[] $values();
    Code:
       0: iconst_4
       1: anewarray     #2                  // class Day12$Direction
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #56                 // Field UP:LDay12$Direction;
      10: aastore
      11: aload_0
      12: iconst_1
      13: getstatic     #59                 // Field DOWN:LDay12$Direction;
      16: aastore
      17: aload_0
      18: iconst_2
      19: getstatic     #62                 // Field LEFT:LDay12$Direction;
      22: aastore
      23: aload_0
      24: iconst_3
      25: getstatic     #65                 // Field RIGHT:LDay12$Direction;
      28: aastore
      29: aload_0
      30: areturn

  public Day12$Direction(java.lang.String, int, char, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: iload_3
       4: invokespecial #68                 // Method "<init>":(Ljava/lang/String;IC)V
       7: return

  static {};
    Code:
       0: new           #74                 // class Day12$Direction$UP
       3: dup
       4: ldc           #75                 // String UP
       6: iconst_0
       7: invokespecial #76                 // Method Day12$Direction$UP."<init>":(Ljava/lang/String;I)V
      10: putstatic     #56                 // Field UP:LDay12$Direction;
      13: new           #78                 // class Day12$Direction$DOWN
      16: dup
      17: ldc           #79                 // String DOWN
      19: iconst_1
      20: invokespecial #80                 // Method Day12$Direction$DOWN."<init>":(Ljava/lang/String;I)V
      23: putstatic     #59                 // Field DOWN:LDay12$Direction;
      26: new           #82                 // class Day12$Direction$LEFT
      29: dup
      30: ldc           #83                 // String LEFT
      32: iconst_2
      33: invokespecial #84                 // Method Day12$Direction$LEFT."<init>":(Ljava/lang/String;I)V
      36: putstatic     #62                 // Field LEFT:LDay12$Direction;
      39: new           #86                 // class Day12$Direction$RIGHT
      42: dup
      43: ldc           #87                 // String RIGHT
      45: iconst_3
      46: invokespecial #88                 // Method Day12$Direction$RIGHT."<init>":(Ljava/lang/String;I)V
      49: putstatic     #65                 // Field RIGHT:LDay12$Direction;
      52: invokestatic  #90                 // Method $values:()[LDay12$Direction;
      55: putstatic     #32                 // Field $VALUES:[LDay12$Direction;
      58: getstatic     #32                 // Field $VALUES:[LDay12$Direction;
      61: checkcast     #92                 // class "[Ljava/lang/Enum;"
      64: invokestatic  #98                 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
      67: putstatic     #52                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
      70: return
}

Compiled from "Day12.kt"
final class Day12$Direction$UP extends Day12$Direction {
  Day12$Direction$UP();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: bipush        94
       5: aconst_null
       6: invokespecial #10                 // Method Day12$Direction."<init>":(Ljava/lang/String;ICLkotlin/jvm/internal/DefaultConstructorMarker;)V
       9: return

  public Day12$Coordinate getNextSquare(Day12$Coordinate);
    Code:
       0: aload_1
       1: ldc           #21                 // String currentCoordinate
       3: invokestatic  #27                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #29                 // class Day12$Coordinate
       9: dup
      10: aload_1
      11: invokevirtual #33                 // Method Day12$Coordinate.getX:()I
      14: aload_1
      15: invokevirtual #36                 // Method Day12$Coordinate.getY:()I
      18: iconst_1
      19: isub
      20: invokespecial #39                 // Method Day12$Coordinate."<init>":(II)V
      23: areturn
}


import java.lang.StringBuilder

object Day13 {

    fun part1(input: String): Int =
        input.split("\n\n").withIndex()
            .filter { (_, both) ->
                isInCorrectOrder(both.lines().first(), both.lines().last())!!
            }
            .sumOf { it.index + 1 }

    @Suppress("UNUSED_PARAMETER")
    fun part2(input: String): Int {
        val dividers = listOf("[[2]]", "[[6]]")
        val sorted = (input.lines() + dividers)
            .filter { it.isNotBlank() }
            .sortedWith { left, right ->
                isInCorrectOrder(left, right)
                    ?.let { if (it) -1 else 1 }
                    ?: 0
            }
        return dividers.map { sorted.indexOf(it) + 1 }.fold(1) { a, b -> a * b }
    }

    fun isInCorrectOrder(left: String, right: String): Boolean? {
        return if (left.startsWith("[") || right.startsWith("[")) {
            val leftArray = left.toArray()
            val rightArray = right.toArray()
            leftArray.zip(rightArray).forEach { (a, b) ->
                isInCorrectOrder(a, b)?.let { return it }
            }
            isInCorrectOrder(leftArray.size, rightArray.size)
        } else {
            isInCorrectOrder(left.toInt(), right.toInt())
        }
    }

    private fun isInCorrectOrder(left: Int, right: Int): Boolean? =
        if (left < right) true else if (left > right) false else null

    private fun String.toArray(): List<String> {
        if (!startsWith("[")) return listOf(this)
        return buildList {
            var nestedLevel = 0
            val current = StringBuilder()
            removePrefix("[")
                .forEach { char ->
                    if ((char == ',' || char == ']') && nestedLevel == 0 && current.isNotBlank()) {
                        add(current.toString())
                        current.clear()
                    } else {
                        current.append(char)
                        if (char == '[') {
                            nestedLevel += 1
                        } else if (char == ']') {
                            nestedLevel -= 1
                        }
                    }
                }
        }
    }
}

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

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

  public final int part1(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #23                 // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #25                 // class java/lang/String
      14: astore_2
      15: aload_2
      16: iconst_0
      17: ldc           #27                 // String \n\n
      19: aastore
      20: aload_2
      21: iconst_0
      22: iconst_0
      23: bipush        6
      25: aconst_null
      26: invokestatic  #33                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      29: checkcast     #35                 // class java/lang/Iterable
      32: invokestatic  #41                 // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
      35: astore_2
      36: nop
      37: iconst_0
      38: istore_3
      39: aload_2
      40: astore        4
      42: new           #43                 // class java/util/ArrayList
      45: dup
      46: invokespecial #44                 // Method java/util/ArrayList."<init>":()V
      49: checkcast     #46                 // class java/util/Collection
      52: astore        5
      54: iconst_0
      55: istore        6
      57: aload         4
      59: invokeinterface #50,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      64: astore        7
      66: aload         7
      68: invokeinterface #56,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      73: ifeq          162
      76: aload         7
      78: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      83: astore        8
      85: aload         8
      87: checkcast     #62                 // class kotlin/collections/IndexedValue
      90: astore        9
      92: iconst_0
      93: istore        10
      95: aload         9
      97: invokevirtual #65                 // Method kotlin/collections/IndexedValue.component2:()Ljava/lang/Object;
     100: checkcast     #25                 // class java/lang/String
     103: astore        11
     105: getstatic     #68                 // Field INSTANCE:LDay13;
     108: aload         11
     110: checkcast     #23                 // class java/lang/CharSequence
     113: invokestatic  #72                 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;
     116: invokestatic  #76                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     119: checkcast     #25                 // class java/lang/String
     122: aload         11
     124: checkcast     #23                 // class java/lang/CharSequence
     127: invokestatic  #72                 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;
     130: invokestatic  #79                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     133: checkcast     #25                 // class java/lang/String
     136: invokevirtual #83                 // Method isInCorrectOrder:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Boolean;
     139: dup
     140: invokestatic  #87                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     143: invokevirtual #92                 // Method java/lang/Boolean.booleanValue:()Z
     146: ifeq          66
     149: aload         5
     151: aload         8
     153: invokeinterface #96,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     158: pop
     159: goto          66
     162: aload         5
     164: checkcast     #98                 // class java/util/List
     167: nop
     168: checkcast     #35                 // class java/lang/Iterable
     171: astore_2
     172: iconst_0
     173: istore_3
     174: aload_2
     175: invokeinterface #50,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     180: astore        4
     182: aload         4
     184: invokeinterface #56,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     189: ifeq          232
     192: aload         4
     194: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     199: astore        5
     201: iload_3
     202: aload         5
     204: checkcast     #62                 // class kotlin/collections/IndexedValue
     207: astore        6
     209: istore        12
     211: iconst_0
     212: istore        7
     214: aload         6
     216: invokevirtual #102                // Method kotlin/collections/IndexedValue.getIndex:()I
     219: iconst_1
     220: iadd
     221: istore        13
     223: iload         12
     225: iload         13
     227: iadd
     228: istore_3
     229: goto          182
     232: iload_3
     233: ireturn

  public final int part2(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_2
       7: anewarray     #25                 // class java/lang/String
      10: astore_3
      11: aload_3
      12: iconst_0
      13: ldc           #121                // String [[2]]
      15: aastore
      16: aload_3
      17: iconst_1
      18: ldc           #123                // String [[6]]
      20: aastore
      21: aload_3
      22: invokestatic  #127                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      25: astore_2
      26: aload_1
      27: checkcast     #23                 // class java/lang/CharSequence
      30: invokestatic  #72                 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;
      33: checkcast     #46                 // class java/util/Collection
      36: aload_2
      37: checkcast     #35                 // class java/lang/Iterable
      40: invokestatic  #131                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Iterable;)Ljava/util/List;
      43: checkcast     #35                 // class java/lang/Iterable
      46: astore        4
      48: nop
      49: iconst_0
      50: istore        5
      52: aload         4
      54: astore        6
      56: new           #43                 // class java/util/ArrayList
      59: dup
      60: invokespecial #44                 // Method java/util/ArrayList."<init>":()V
      63: checkcast     #46                 // class java/util/Collection
      66: astore        7
      68: iconst_0
      69: istore        8
      71: aload         6
      73: invokeinterface #50,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      78: astore        9
      80: aload         9
      82: invokeinterface #56,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      87: ifeq          142
      90: aload         9
      92: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      97: astore        10
      99: aload         10
     101: checkcast     #25                 // class java/lang/String
     104: astore        11
     106: iconst_0
     107: istore        12
     109: aload         11
     111: checkcast     #23                 // class java/lang/CharSequence
     114: invokestatic  #135                // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     117: ifne          124
     120: iconst_1
     121: goto          125
     124: iconst_0
     125: nop
     126: ifeq          80
     129: aload         7
     131: aload         10
     133: invokeinterface #96,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     138: pop
     139: goto          80
     142: aload         7
     144: checkcast     #98                 // class java/util/List
     147: nop
     148: checkcast     #35                 // class java/lang/Iterable
     151: invokedynamic #155,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function2;
     156: invokedynamic #166,  0            // InvokeDynamic #1:compare:(Lkotlin/jvm/functions/Function2;)Ljava/util/Comparator;
     161: invokestatic  #170                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     164: astore_3
     165: aload_2
     166: checkcast     #35                 // class java/lang/Iterable
     169: astore        4
     171: iconst_0
     172: istore        5
     174: aload         4
     176: astore        6
     178: new           #43                 // class java/util/ArrayList
     181: dup
     182: aload         4
     184: bipush        10
     186: invokestatic  #174                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     189: invokespecial #177                // Method java/util/ArrayList."<init>":(I)V
     192: checkcast     #46                 // class java/util/Collection
     195: astore        7
     197: iconst_0
     198: istore        8
     200: aload         6
     202: invokeinterface #50,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     207: astore        9
     209: aload         9
     211: invokeinterface #56,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     216: ifeq          267
     219: aload         9
     221: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     226: astore        10
     228: aload         7
     230: aload         10
     232: checkcast     #25                 // class java/lang/String
     235: astore        11
     237: astore        13
     239: iconst_0
     240: istore        12
     242: aload_3
     243: aload         11
     245: invokeinterface #181,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
     250: iconst_1
     251: iadd
     252: invokestatic  #187                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     255: aload         13
     257: swap
     258: invokeinterface #96,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     263: pop
     264: goto          209
     267: aload         7
     269: checkcast     #98                 // class java/util/List
     272: nop
     273: checkcast     #35                 // class java/lang/Iterable
     276: astore        4
     278: iconst_1
     279: istore        5
     281: iconst_0
     282: istore        6
     284: iload         5
     286: istore        7
     288: aload         4
     290: invokeinterface #50,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     295: astore        8
     297: aload         8
     299: invokeinterface #56,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     304: ifeq          343
     307: aload         8
     309: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     314: astore        9
     316: iload         7
     318: aload         9
     320: checkcast     #189                // class java/lang/Number
     323: invokevirtual #192                // Method java/lang/Number.intValue:()I
     326: istore        10
     328: istore        11
     330: iconst_0
     331: istore        12
     333: iload         11
     335: iload         10
     337: imul
     338: istore        7
     340: goto          297
     343: iload         7
     345: ireturn

  public final java.lang.Boolean isInCorrectOrder(java.lang.String, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #215                // String left
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #217                // String right
       9: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_1
      13: ldc           #219                // String [
      15: iconst_0
      16: iconst_2
      17: aconst_null
      18: invokestatic  #223                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
      21: ifne          36
      24: aload_2
      25: ldc           #219                // String [
      27: iconst_0
      28: iconst_2
      29: aconst_null
      30: invokestatic  #223                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
      33: ifeq          183
      36: aload_0
      37: aload_1
      38: invokespecial #227                // Method toArray:(Ljava/lang/String;)Ljava/util/List;
      41: astore_3
      42: aload_0
      43: aload_2
      44: invokespecial #227                // Method toArray:(Ljava/lang/String;)Ljava/util/List;
      47: astore        4
      49: aload_3
      50: checkcast     #35                 // class java/lang/Iterable
      53: aload         4
      55: checkcast     #35                 // class java/lang/Iterable
      58: invokestatic  #231                // Method kotlin/collections/CollectionsKt.zip:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/List;
      61: checkcast     #35                 // class java/lang/Iterable
      64: astore        5
      66: iconst_0
      67: istore        6
      69: aload         5
      71: invokeinterface #50,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      76: astore        7
      78: aload         7
      80: invokeinterface #56,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      85: ifeq          162
      88: aload         7
      90: invokeinterface #60,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      95: astore        8
      97: aload         8
      99: checkcast     #233                // class kotlin/Pair
     102: astore        9
     104: iconst_0
     105: istore        10
     107: aload         9
     109: invokevirtual #236                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     112: checkcast     #25                 // class java/lang/String
     115: astore        11
     117: aload         9
     119: invokevirtual #237                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     122: checkcast     #25                 // class java/lang/String
     125: astore        12
     127: getstatic     #68                 // Field INSTANCE:LDay13;
     130: aload         11
     132: aload         12
     134: invokevirtual #83                 // Method isInCorrectOrder:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Boolean;
     137: dup
     138: ifnull        155
     141: invokevirtual #92                 // Method java/lang/Boolean.booleanValue:()Z
     144: istore        13
     146: iconst_0
     147: istore        14
     149: iload         13
     151: invokestatic  #240                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
     154: areturn
     155: pop
     156: nop
     157: nop
     158: nop
     159: goto          78
     162: nop
     163: aload_0
     164: aload_3
     165: invokeinterface #243,  1          // InterfaceMethod java/util/List.size:()I
     170: aload         4
     172: invokeinterface #243,  1          // InterfaceMethod java/util/List.size:()I
     177: invokespecial #246                // Method isInCorrectOrder:(II)Ljava/lang/Boolean;
     180: goto          195
     183: aload_0
     184: aload_1
     185: invokestatic  #249                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     188: aload_2
     189: invokestatic  #249                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     192: invokespecial #246                // Method isInCorrectOrder:(II)Ljava/lang/Boolean;
     195: areturn

  private final java.lang.Boolean isInCorrectOrder(int, int);
    Code:
       0: iload_1
       1: iload_2
       2: if_icmpge     12
       5: iconst_1
       6: invokestatic  #240                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
       9: goto          25
      12: iload_1
      13: iload_2
      14: if_icmple     24
      17: iconst_0
      18: invokestatic  #240                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
      21: goto          25
      24: aconst_null
      25: areturn

  private final java.util.List<java.lang.String> toArray(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #219                // String [
       3: iconst_0
       4: iconst_2
       5: aconst_null
       6: invokestatic  #223                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
       9: ifne          17
      12: aload_1
      13: invokestatic  #260                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      16: areturn
      17: invokestatic  #264                // Method kotlin/collections/CollectionsKt.createListBuilder:()Ljava/util/List;
      20: astore_2
      21: aload_2
      22: astore_3
      23: iconst_0
      24: istore        4
      26: iconst_0
      27: istore        5
      29: new           #266                // class java/lang/StringBuilder
      32: dup
      33: invokespecial #267                // Method java/lang/StringBuilder."<init>":()V
      36: astore        6
      38: aload_1
      39: ldc           #219                // String [
      41: checkcast     #23                 // class java/lang/CharSequence
      44: invokestatic  #271                // Method kotlin/text/StringsKt.removePrefix:(Ljava/lang/String;Ljava/lang/CharSequence;)Ljava/lang/String;
      47: checkcast     #23                 // class java/lang/CharSequence
      50: astore        7
      52: nop
      53: iconst_0
      54: istore        8
      56: iconst_0
      57: istore        9
      59: iload         9
      61: aload         7
      63: invokeinterface #274,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      68: if_icmpge     215
      71: aload         7
      73: iload         9
      75: invokeinterface #278,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      80: istore        10
      82: iload         10
      84: istore        11
      86: iconst_0
      87: istore        12
      89: iload         11
      91: bipush        44
      93: if_icmpeq     103
      96: iload         11
      98: bipush        93
     100: if_icmpne     155
     103: iload         5
     105: ifne          155
     108: aload         6
     110: checkcast     #23                 // class java/lang/CharSequence
     113: invokestatic  #135                // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     116: ifne          123
     119: iconst_1
     120: goto          124
     123: iconst_0
     124: ifeq          155
     127: aload_3
     128: aload         6
     130: invokevirtual #282                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     133: dup
     134: ldc_w         #284                // String toString(...)
     137: invokestatic  #287                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     140: invokeinterface #288,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     145: pop
     146: aload         6
     148: invokestatic  #292                // Method kotlin/text/StringsKt.clear:(Ljava/lang/StringBuilder;)Ljava/lang/StringBuilder;
     151: pop
     152: goto          207
     155: aload         6
     157: iload         11
     159: invokevirtual #296                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     162: pop
     163: iload         11
     165: tableswitch   { // 91 to 93
                    91: 192
                    92: 207
                    93: 201
               default: 207
          }
     192: iload         5
     194: iconst_1
     195: iadd
     196: istore        5
     198: goto          207
     201: iload         5
     203: iconst_1
     204: isub
     205: istore        5
     207: nop
     208: nop
     209: iinc          9, 1
     212: goto          59
     215: nop
     216: nop
     217: aload_2
     218: invokestatic  #300                // Method kotlin/collections/CollectionsKt.build:(Ljava/util/List;)Ljava/util/List;
     221: areturn

  private static final int part2$lambda$4(java.lang.String, java.lang.String);
    Code:
       0: getstatic     #68                 // Field INSTANCE:LDay13;
       3: aload_0
       4: invokestatic  #87                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       7: aload_0
       8: aload_1
       9: invokestatic  #87                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      12: aload_1
      13: invokevirtual #83                 // Method isInCorrectOrder:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Boolean;
      16: astore_2
      17: aload_2
      18: ifnull        42
      21: aload_2
      22: invokevirtual #92                 // Method java/lang/Boolean.booleanValue:()Z
      25: istore_3
      26: iconst_0
      27: istore        4
      29: iload_3
      30: ifeq          37
      33: iconst_m1
      34: goto          38
      37: iconst_1
      38: nop
      39: goto          43
      42: iconst_0
      43: ireturn

  private static final int part2$lambda$5(kotlin.jvm.functions.Function2, java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokeinterface #315,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
       8: checkcast     #189                // class java/lang/Number
      11: invokevirtual #192                // Method java/lang/Number.intValue:()I
      14: ireturn

  static {};
    Code:
       0: new           #2                  // class Day13
       3: dup
       4: invokespecial #321                // Method "<init>":()V
       7: putstatic     #68                 // Field INSTANCE:LDay13;
      10: return
}


import java.util.*

object Day05 {

    fun part1(input: String): String {
        val stacks = input.initialState()
        input.instructions().forEach { instruction ->
            repeat(instruction.count) {
                stacks[instruction.to].push(stacks[instruction.from].pop())
            }
        }
        return topOfStackToString(stacks)
    }

    fun part2(input: String): String {
        val stacks = input.initialState()
        input.instructions().forEach { instruction ->
            (1..instruction.count)
                .map { stacks[instruction.from].pop() }
                .reversed()
                .forEach { stacks[instruction.to].push(it) }
        }
        return topOfStackToString(stacks)
    }

    private fun topOfStackToString(stacks: List<Stack<Char>>): String =
        stacks
            .map { it.pop() }
            .joinToString(separator = "")

    private fun String.initialState(): List<Stack<Char>> {
        val indices = generateSequence(1) { it + 4 }
        val initialStateLines = lines().takeWhile { "1" !in it }
        return indices
            .takeWhile { it < initialStateLines.first().length }
            .map { i ->
                val stack = Stack<Char>()
                initialStateLines.mapNotNull { line -> line.getOrNull(i)?.takeIf { !it.isWhitespace() } }
                    .forEach(stack::push)
                stack.reverse()
                stack
            }.toList()
    }

    private fun String.instructions(): Sequence<Instruction> =
        lineSequence()
            .dropWhile { it.isNotBlank() }
            .drop(1)
            .map {
                val (n, _, from, _, to) = it.removePrefix("move ").split(" ")
                Instruction(n.toInt(), from.toInt() - 1, to.toInt() - 1)
            }

}

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

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

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

  public final java.lang.String part1(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokespecial #25                 // Method initialState:(Ljava/lang/String;)Ljava/util/List;
      11: astore_2
      12: aload_0
      13: aload_1
      14: invokespecial #29                 // Method instructions:(Ljava/lang/String;)Lkotlin/sequences/Sequence;
      17: astore_3
      18: iconst_0
      19: istore        4
      21: aload_3
      22: invokeinterface #35,  1           // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      27: astore        5
      29: aload         5
      31: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      36: ifeq          129
      39: aload         5
      41: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      46: astore        6
      48: aload         6
      50: checkcast     #47                 // class Instruction
      53: astore        7
      55: iconst_0
      56: istore        8
      58: aload         7
      60: invokevirtual #51                 // Method Instruction.getCount:()I
      63: istore        9
      65: iconst_0
      66: istore        10
      68: iload         10
      70: iload         9
      72: if_icmpge     124
      75: iload         10
      77: istore        11
      79: iconst_0
      80: istore        12
      82: aload_2
      83: aload         7
      85: invokevirtual #54                 // Method Instruction.getTo:()I
      88: invokeinterface #60,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      93: checkcast     #62                 // class java/util/Stack
      96: aload_2
      97: aload         7
      99: invokevirtual #65                 // Method Instruction.getFrom:()I
     102: invokeinterface #60,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     107: checkcast     #62                 // class java/util/Stack
     110: invokevirtual #68                 // Method java/util/Stack.pop:()Ljava/lang/Object;
     113: invokevirtual #72                 // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
     116: pop
     117: nop
     118: iinc          10, 1
     121: goto          68
     124: nop
     125: nop
     126: goto          29
     129: nop
     130: aload_0
     131: aload_2
     132: invokespecial #76                 // Method topOfStackToString:(Ljava/util/List;)Ljava/lang/String;
     135: areturn

  public final java.lang.String part2(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokespecial #25                 // Method initialState:(Ljava/lang/String;)Ljava/util/List;
      11: astore_2
      12: aload_0
      13: aload_1
      14: invokespecial #29                 // Method instructions:(Ljava/lang/String;)Lkotlin/sequences/Sequence;
      17: astore_3
      18: iconst_0
      19: istore        4
      21: aload_3
      22: invokeinterface #35,  1           // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      27: astore        5
      29: aload         5
      31: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      36: ifeq          267
      39: aload         5
      41: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      46: astore        6
      48: aload         6
      50: checkcast     #47                 // class Instruction
      53: astore        7
      55: iconst_0
      56: istore        8
      58: new           #95                 // class kotlin/ranges/IntRange
      61: dup
      62: iconst_1
      63: aload         7
      65: invokevirtual #51                 // Method Instruction.getCount:()I
      68: invokespecial #98                 // Method kotlin/ranges/IntRange."<init>":(II)V
      71: checkcast     #100                // class java/lang/Iterable
      74: astore        9
      76: nop
      77: iconst_0
      78: istore        10
      80: aload         9
      82: astore        11
      84: new           #102                // class java/util/ArrayList
      87: dup
      88: aload         9
      90: bipush        10
      92: invokestatic  #108                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      95: invokespecial #111                // Method java/util/ArrayList."<init>":(I)V
      98: checkcast     #113                // class java/util/Collection
     101: astore        12
     103: iconst_0
     104: istore        13
     106: aload         11
     108: invokeinterface #114,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     113: astore        14
     115: aload         14
     117: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     122: ifeq          178
     125: aload         14
     127: checkcast     #116                // class kotlin/collections/IntIterator
     130: invokevirtual #119                // Method kotlin/collections/IntIterator.nextInt:()I
     133: istore        15
     135: aload         12
     137: iload         15
     139: istore        16
     141: astore        17
     143: iconst_0
     144: istore        18
     146: aload_2
     147: aload         7
     149: invokevirtual #65                 // Method Instruction.getFrom:()I
     152: invokeinterface #60,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     157: checkcast     #62                 // class java/util/Stack
     160: invokevirtual #68                 // Method java/util/Stack.pop:()Ljava/lang/Object;
     163: checkcast     #121                // class java/lang/Character
     166: aload         17
     168: swap
     169: invokeinterface #125,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     174: pop
     175: goto          115
     178: aload         12
     180: checkcast     #56                 // class java/util/List
     183: nop
     184: checkcast     #100                // class java/lang/Iterable
     187: invokestatic  #129                // Method kotlin/collections/CollectionsKt.reversed:(Ljava/lang/Iterable;)Ljava/util/List;
     190: checkcast     #100                // class java/lang/Iterable
     193: astore        9
     195: nop
     196: iconst_0
     197: istore        10
     199: aload         9
     201: invokeinterface #114,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     206: astore        11
     208: aload         11
     210: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     215: ifeq          261
     218: aload         11
     220: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     225: astore        12
     227: aload         12
     229: checkcast     #121                // class java/lang/Character
     232: astore        13
     234: iconst_0
     235: istore        14
     237: aload_2
     238: aload         7
     240: invokevirtual #54                 // Method Instruction.getTo:()I
     243: invokeinterface #60,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     248: checkcast     #62                 // class java/util/Stack
     251: aload         13
     253: invokevirtual #72                 // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
     256: pop
     257: nop
     258: goto          208
     261: nop
     262: nop
     263: nop
     264: goto          29
     267: nop
     268: aload_0
     269: aload_2
     270: invokespecial #76                 // Method topOfStackToString:(Ljava/util/List;)Ljava/lang/String;
     273: areturn

  private final java.lang.String topOfStackToString(java.util.List<? extends java.util.Stack<java.lang.Character>>);
    Code:
       0: aload_1
       1: checkcast     #100                // class java/lang/Iterable
       4: astore_2
       5: nop
       6: iconst_0
       7: istore_3
       8: aload_2
       9: astore        4
      11: new           #102                // class java/util/ArrayList
      14: dup
      15: aload_2
      16: bipush        10
      18: invokestatic  #108                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #111                // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #113                // class java/util/Collection
      27: astore        5
      29: iconst_0
      30: istore        6
      32: aload         4
      34: invokeinterface #114,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      39: astore        7
      41: aload         7
      43: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      48: ifeq          94
      51: aload         7
      53: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      58: astore        8
      60: aload         5
      62: aload         8
      64: checkcast     #62                 // class java/util/Stack
      67: astore        9
      69: astore        11
      71: iconst_0
      72: istore        10
      74: aload         9
      76: invokevirtual #68                 // Method java/util/Stack.pop:()Ljava/lang/Object;
      79: checkcast     #121                // class java/lang/Character
      82: aload         11
      84: swap
      85: invokeinterface #125,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      90: pop
      91: goto          41
      94: aload         5
      96: checkcast     #56                 // class java/util/List
      99: nop
     100: checkcast     #100                // class java/lang/Iterable
     103: ldc           #144                // String
     105: checkcast     #146                // class java/lang/CharSequence
     108: aconst_null
     109: aconst_null
     110: iconst_0
     111: aconst_null
     112: aconst_null
     113: bipush        62
     115: aconst_null
     116: invokestatic  #150                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     119: areturn

  private final java.util.List<java.util.Stack<java.lang.Character>> initialState(java.lang.String);
    Code:
       0: iconst_1
       1: invokestatic  #159                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
       4: invokedynamic #177,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
       9: invokestatic  #183                // Method kotlin/sequences/SequencesKt.generateSequence:(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      12: astore_2
      13: aload_1
      14: checkcast     #146                // class java/lang/CharSequence
      17: invokestatic  #189                // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;
      20: checkcast     #100                // class java/lang/Iterable
      23: astore        4
      25: iconst_0
      26: istore        5
      28: new           #102                // class java/util/ArrayList
      31: dup
      32: invokespecial #190                // Method java/util/ArrayList."<init>":()V
      35: astore        6
      37: aload         4
      39: invokeinterface #114,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      44: astore        7
      46: aload         7
      48: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      53: ifeq          116
      56: aload         7
      58: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: astore        8
      65: aload         8
      67: checkcast     #92                 // class java/lang/String
      70: astore        9
      72: iconst_0
      73: istore        10
      75: aload         9
      77: checkcast     #146                // class java/lang/CharSequence
      80: ldc           #192                // String 1
      82: checkcast     #146                // class java/lang/CharSequence
      85: iconst_0
      86: iconst_2
      87: aconst_null
      88: invokestatic  #196                // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z
      91: ifne          98
      94: iconst_1
      95: goto          99
      98: iconst_0
      99: ifne          105
     102: goto          116
     105: aload         6
     107: aload         8
     109: invokevirtual #197                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     112: pop
     113: goto          46
     116: aload         6
     118: checkcast     #56                 // class java/util/List
     121: astore_3
     122: aload_2
     123: aload_3
     124: invokedynamic #207,  0            // InvokeDynamic #1:invoke:(Ljava/util/List;)Lkotlin/jvm/functions/Function1;
     129: invokestatic  #211                // Method kotlin/sequences/SequencesKt.takeWhile:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     132: aload_3
     133: invokedynamic #219,  0            // InvokeDynamic #2:invoke:(Ljava/util/List;)Lkotlin/jvm/functions/Function1;
     138: invokestatic  #222                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     141: invokestatic  #226                // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
     144: areturn

  private final kotlin.sequences.Sequence<Instruction> instructions(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #146                // class java/lang/CharSequence
       4: invokestatic  #240                // Method kotlin/text/StringsKt.lineSequence:(Ljava/lang/CharSequence;)Lkotlin/sequences/Sequence;
       7: invokedynamic #248,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;
      12: invokestatic  #251                // Method kotlin/sequences/SequencesKt.dropWhile:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      15: iconst_1
      16: invokestatic  #255                // Method kotlin/sequences/SequencesKt.drop:(Lkotlin/sequences/Sequence;I)Lkotlin/sequences/Sequence;
      19: invokedynamic #262,  0            // InvokeDynamic #4:invoke:()Lkotlin/jvm/functions/Function1;
      24: invokestatic  #222                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      27: areturn

  private static final java.lang.Integer initialState$lambda$6(int);
    Code:
       0: iload_0
       1: iconst_4
       2: iadd
       3: invokestatic  #159                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
       6: areturn

  private static final boolean initialState$lambda$8(java.util.List, int);
    Code:
       0: iload_1
       1: aload_0
       2: invokestatic  #267                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
       5: checkcast     #92                 // class java/lang/String
       8: invokevirtual #270                // Method java/lang/String.length:()I
      11: if_icmpge     18
      14: iconst_1
      15: goto          19
      18: iconst_0
      19: ireturn

  private static final java.util.Stack initialState$lambda$11(java.util.List, int);
    Code:
       0: new           #62                 // class java/util/Stack
       3: dup
       4: invokespecial #272                // Method java/util/Stack."<init>":()V
       7: astore_2
       8: aload_0
       9: checkcast     #100                // class java/lang/Iterable
      12: astore_3
      13: iconst_0
      14: istore        4
      16: aload_3
      17: astore        5
      19: new           #102                // class java/util/ArrayList
      22: dup
      23: invokespecial #190                // Method java/util/ArrayList."<init>":()V
      26: checkcast     #113                // class java/util/Collection
      29: astore        6
      31: iconst_0
      32: istore        7
      34: aload         5
      36: astore        8
      38: iconst_0
      39: istore        9
      41: aload         8
      43: invokeinterface #114,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      48: astore        10
      50: aload         10
      52: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      57: ifeq          165
      60: aload         10
      62: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      67: astore        11
      69: aload         11
      71: astore        12
      73: iconst_0
      74: istore        13
      76: aload         12
      78: checkcast     #92                 // class java/lang/String
      81: astore        14
      83: iconst_0
      84: istore        15
      86: aload         14
      88: checkcast     #146                // class java/lang/CharSequence
      91: iload_1
      92: invokestatic  #276                // Method kotlin/text/StringsKt.getOrNull:(Ljava/lang/CharSequence;I)Ljava/lang/Character;
      95: dup
      96: ifnull        136
      99: astore        16
     101: aload         16
     103: invokevirtual #280                // Method java/lang/Character.charValue:()C
     106: istore        17
     108: iconst_0
     109: istore        18
     111: iload         17
     113: invokestatic  #286                // Method kotlin/text/CharsKt.isWhitespace:(C)Z
     116: ifne          123
     119: iconst_1
     120: goto          124
     123: iconst_0
     124: ifeq          132
     127: aload         16
     129: goto          138
     132: aconst_null
     133: goto          138
     136: pop
     137: aconst_null
     138: dup
     139: ifnull        160
     142: astore        19
     144: iconst_0
     145: istore        20
     147: aload         6
     149: aload         19
     151: invokeinterface #125,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     156: pop
     157: goto          161
     160: pop
     161: nop
     162: goto          50
     165: nop
     166: aload         6
     168: checkcast     #56                 // class java/util/List
     171: nop
     172: checkcast     #100                // class java/lang/Iterable
     175: astore_3
     176: nop
     177: iconst_0
     178: istore        4
     180: aload_3
     181: invokeinterface #114,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     186: astore        5
     188: aload         5
     190: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     195: ifeq          228
     198: aload         5
     200: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     205: astore        6
     207: aload         6
     209: checkcast     #121                // class java/lang/Character
     212: astore        7
     214: iconst_0
     215: istore        8
     217: aload_2
     218: aload         7
     220: invokevirtual #72                 // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
     223: pop
     224: nop
     225: goto          188
     228: nop
     229: aload_2
     230: checkcast     #56                 // class java/util/List
     233: invokestatic  #290                // Method kotlin/collections/CollectionsKt.reverse:(Ljava/util/List;)V
     236: aload_2
     237: areturn

  private static final boolean instructions$lambda$12(java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #309                // String it
       4: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: checkcast     #146                // class java/lang/CharSequence
      11: invokestatic  #313                // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
      14: ifne          21
      17: iconst_1
      18: goto          22
      21: iconst_0
      22: ireturn

  private static final Instruction instructions$lambda$13(java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #309                // String it
       4: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: ldc_w         #315                // String move
      11: checkcast     #146                // class java/lang/CharSequence
      14: invokestatic  #319                // Method kotlin/text/StringsKt.removePrefix:(Ljava/lang/String;Ljava/lang/CharSequence;)Ljava/lang/String;
      17: checkcast     #146                // class java/lang/CharSequence
      20: iconst_1
      21: anewarray     #92                 // class java/lang/String
      24: astore_2
      25: aload_2
      26: iconst_0
      27: ldc_w         #321                // String
      30: aastore
      31: aload_2
      32: iconst_0
      33: iconst_0
      34: bipush        6
      36: aconst_null
      37: invokestatic  #325                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      40: astore_1
      41: aload_1
      42: iconst_0
      43: invokeinterface #60,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      48: checkcast     #92                 // class java/lang/String
      51: astore_2
      52: aload_1
      53: iconst_2
      54: invokeinterface #60,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      59: checkcast     #92                 // class java/lang/String
      62: astore_3
      63: aload_1
      64: iconst_4
      65: invokeinterface #60,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      70: checkcast     #92                 // class java/lang/String
      73: astore        4
      75: new           #47                 // class Instruction
      78: dup
      79: aload_2
      80: invokestatic  #329                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      83: aload_3
      84: invokestatic  #329                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      87: iconst_1
      88: isub
      89: aload         4
      91: invokestatic  #329                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      94: iconst_1
      95: isub
      96: invokespecial #332                // Method Instruction."<init>":(III)V
      99: areturn

  static {};
    Code:
       0: new           #2                  // class Day05
       3: dup
       4: invokespecial #337                // Method "<init>":()V
       7: putstatic     #340                // Field INSTANCE:LDay05;
      10: return
}