package aoc2022

import java.util.*

typealias Coordinates = Pair<Int, Int>

private fun Coordinates.getNeighbors(): List<Coordinates> {
    val leftOf = Coordinates(first - 1, second)
    val rightOf = Coordinates(first + 1, second)
    val topOf = Coordinates(first, second - 1)
    val bottomOf = Coordinates(first, second + 1)

    return listOfNotNull(leftOf, rightOf, topOf, bottomOf)
}

class Day12(input: List<String>) {
    private val heightMap = input.parseHeightMap()

    data class HeightMap(val elevations: Map<Coordinates, Int>, val start: Coordinates, val end: Coordinates) {

        fun shortestPath(
            start: Coordinates,
            isGoal: (Coordinates) -> Boolean,
            canMove: (Int, Int) -> Boolean
        ): Int {
            val seen = mutableSetOf<Coordinates>()
            val prioQueue = PriorityQueue<PathCost>().apply { add(PathCost(start, 0)) }

            while (prioQueue.isNotEmpty()) {
                val nextCoord = prioQueue.poll()

                if (nextCoord.coordinates !in seen) {
                    seen += nextCoord.coordinates
                    val neighbors = nextCoord.coordinates.getNeighbors()
                        .filter { it in elevations }
                        .filter { canMove(elevations.getValue(nextCoord.coordinates), elevations.getValue(it)) }

                    if (neighbors.any { isGoal(it) }) return nextCoord.cost + 1
                    prioQueue.addAll(neighbors.map { PathCost(it, nextCoord.cost + 1) })
                }
            }
            throw IllegalStateException("No path...")
        }
    }

    private class PathCost(val coordinates: Coordinates, val cost: Int) : Comparable<PathCost> {
        override fun compareTo(other: PathCost): Int {
            return this.cost.compareTo(other.cost)
        }
    }

    private fun List<String>.parseHeightMap(): HeightMap {
        var start: Coordinates? = null
        var end: Coordinates? = null

        val elevations = this.flatMapIndexed { y, row ->
            row.mapIndexed { x, char ->
                val here = Coordinates(x, y)
                here to when (char) {
                    'S' -> 0.also { start = here }
                    'E' -> 25.also { end = here }
                    else -> char - 'a'
                }
            }
        }.toMap()

        return HeightMap(elevations, start!!, end!!)
    }

    fun solvePart1(): Int {
        return heightMap.shortestPath(
            start = heightMap.start,
            isGoal = { it == heightMap.end },
            canMove = { from, to -> to - from <= 1 }
        )
    }

    fun solvePart2(): Int {
        return heightMap.shortestPath(
            start = heightMap.end,
            isGoal = { heightMap.elevations[it] == 0 },
            canMove = { from, to -> from - to <= 1 }
        )
    }
}

Compiled from "Day12.kt"
final class aoc2022.Day12$PathCost implements java.lang.Comparable<aoc2022.Day12$PathCost> {
  private final kotlin.Pair<java.lang.Integer, java.lang.Integer> coordinates;

  private final int cost;

  public aoc2022.Day12$PathCost(kotlin.Pair<java.lang.Integer, java.lang.Integer>, int);
    Code:
       0: aload_1
       1: ldc           #13                 // String coordinates
       3: invokestatic  #19                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #22                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #25                 // Field coordinates:Lkotlin/Pair;
      15: aload_0
      16: iload_2
      17: putfield      #29                 // Field cost:I
      20: return

  public final kotlin.Pair<java.lang.Integer, java.lang.Integer> getCoordinates();
    Code:
       0: aload_0
       1: getfield      #25                 // Field coordinates:Lkotlin/Pair;
       4: areturn

  public final int getCost();
    Code:
       0: aload_0
       1: getfield      #29                 // Field cost:I
       4: ireturn

  public int compareTo(aoc2022.Day12$PathCost);
    Code:
       0: aload_1
       1: ldc           #40                 // String other
       3: invokestatic  #19                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #29                 // Field cost:I
      10: aload_1
      11: getfield      #29                 // Field cost:I
      14: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      17: ireturn

  public int compareTo(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #2                  // class aoc2022/Day12$PathCost
       5: invokevirtual #47                 // Method compareTo:(Laoc2022/Day12$PathCost;)I
       8: ireturn
}

Compiled from "Day12.kt"
public final class aoc2022.Day12$HeightMap {
  private final java.util.Map<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Integer> elevations;

  private final kotlin.Pair<java.lang.Integer, java.lang.Integer> start;

  private final kotlin.Pair<java.lang.Integer, java.lang.Integer> end;

  public aoc2022.Day12$HeightMap(java.util.Map<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>);
    Code:
       0: aload_1
       1: ldc           #10                 // String elevations
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #18                 // String start
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #20                 // String end
      15: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_0
      19: invokespecial #23                 // Method java/lang/Object."<init>":()V
      22: aload_0
      23: aload_1
      24: putfield      #26                 // Field elevations:Ljava/util/Map;
      27: aload_0
      28: aload_2
      29: putfield      #29                 // Field start:Lkotlin/Pair;
      32: aload_0
      33: aload_3
      34: putfield      #31                 // Field end:Lkotlin/Pair;
      37: return

  public final java.util.Map<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Integer> getElevations();
    Code:
       0: aload_0
       1: getfield      #26                 // Field elevations:Ljava/util/Map;
       4: areturn

  public final kotlin.Pair<java.lang.Integer, java.lang.Integer> getStart();
    Code:
       0: aload_0
       1: getfield      #29                 // Field start:Lkotlin/Pair;
       4: areturn

  public final kotlin.Pair<java.lang.Integer, java.lang.Integer> getEnd();
    Code:
       0: aload_0
       1: getfield      #31                 // Field end:Lkotlin/Pair;
       4: areturn

  public final int shortestPath(kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.jvm.functions.Function1<? super kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Boolean>, kotlin.jvm.functions.Function2<? super java.lang.Integer, ? super java.lang.Integer, java.lang.Boolean>);
    Code:
       0: aload_1
       1: ldc           #18                 // String start
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #45                 // String isGoal
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #47                 // String canMove
      15: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: new           #49                 // class java/util/LinkedHashSet
      21: dup
      22: invokespecial #50                 // Method java/util/LinkedHashSet."<init>":()V
      25: checkcast     #52                 // class java/util/Set
      28: astore        4
      30: new           #54                 // class java/util/PriorityQueue
      33: dup
      34: invokespecial #55                 // Method java/util/PriorityQueue."<init>":()V
      37: astore        6
      39: aload         6
      41: astore        7
      43: iconst_0
      44: istore        8
      46: aload         7
      48: new           #57                 // class aoc2022/Day12$PathCost
      51: dup
      52: aload_1
      53: iconst_0
      54: invokespecial #60                 // Method aoc2022/Day12$PathCost."<init>":(Lkotlin/Pair;I)V
      57: invokevirtual #64                 // Method java/util/PriorityQueue.add:(Ljava/lang/Object;)Z
      60: pop
      61: aload         6
      63: astore        5
      65: aload         5
      67: checkcast     #66                 // class java/util/Collection
      70: invokeinterface #70,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
      75: ifne          82
      78: iconst_1
      79: goto          83
      82: iconst_0
      83: ifeq          593
      86: aload         5
      88: invokevirtual #74                 // Method java/util/PriorityQueue.poll:()Ljava/lang/Object;
      91: checkcast     #57                 // class aoc2022/Day12$PathCost
      94: astore        6
      96: aload         4
      98: aload         6
     100: invokevirtual #77                 // Method aoc2022/Day12$PathCost.getCoordinates:()Lkotlin/Pair;
     103: invokeinterface #80,  2           // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     108: ifne          65
     111: aload         4
     113: checkcast     #66                 // class java/util/Collection
     116: aload         6
     118: invokevirtual #77                 // Method aoc2022/Day12$PathCost.getCoordinates:()Lkotlin/Pair;
     121: invokeinterface #81,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     126: pop
     127: aload         6
     129: invokevirtual #77                 // Method aoc2022/Day12$PathCost.getCoordinates:()Lkotlin/Pair;
     132: invokestatic  #87                 // Method aoc2022/Day12Kt.access$getNeighbors:(Lkotlin/Pair;)Ljava/util/List;
     135: checkcast     #89                 // class java/lang/Iterable
     138: astore        8
     140: nop
     141: iconst_0
     142: istore        9
     144: aload         8
     146: astore        10
     148: new           #91                 // class java/util/ArrayList
     151: dup
     152: invokespecial #92                 // Method java/util/ArrayList."<init>":()V
     155: checkcast     #66                 // class java/util/Collection
     158: astore        11
     160: iconst_0
     161: istore        12
     163: aload         10
     165: invokeinterface #96,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     170: astore        13
     172: aload         13
     174: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     179: ifeq          229
     182: aload         13
     184: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     189: astore        14
     191: aload         14
     193: checkcast     #106                // class kotlin/Pair
     196: astore        15
     198: iconst_0
     199: istore        16
     201: aload_0
     202: getfield      #26                 // Field elevations:Ljava/util/Map;
     205: aload         15
     207: invokeinterface #111,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
     212: nop
     213: ifeq          172
     216: aload         11
     218: aload         14
     220: invokeinterface #81,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     225: pop
     226: goto          172
     229: aload         11
     231: checkcast     #113                // class java/util/List
     234: nop
     235: checkcast     #89                 // class java/lang/Iterable
     238: astore        8
     240: nop
     241: iconst_0
     242: istore        9
     244: aload         8
     246: astore        10
     248: new           #91                 // class java/util/ArrayList
     251: dup
     252: invokespecial #92                 // Method java/util/ArrayList."<init>":()V
     255: checkcast     #66                 // class java/util/Collection
     258: astore        11
     260: iconst_0
     261: istore        12
     263: aload         10
     265: invokeinterface #96,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     270: astore        13
     272: aload         13
     274: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     279: ifeq          350
     282: aload         13
     284: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     289: astore        14
     291: aload         14
     293: checkcast     #106                // class kotlin/Pair
     296: astore        15
     298: iconst_0
     299: istore        16
     301: aload_3
     302: aload_0
     303: getfield      #26                 // Field elevations:Ljava/util/Map;
     306: aload         6
     308: invokevirtual #77                 // Method aoc2022/Day12$PathCost.getCoordinates:()Lkotlin/Pair;
     311: invokestatic  #119                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
     314: aload_0
     315: getfield      #26                 // Field elevations:Ljava/util/Map;
     318: aload         15
     320: invokestatic  #119                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
     323: invokeinterface #125,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     328: checkcast     #127                // class java/lang/Boolean
     331: invokevirtual #130                // Method java/lang/Boolean.booleanValue:()Z
     334: ifeq          272
     337: aload         11
     339: aload         14
     341: invokeinterface #81,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     346: pop
     347: goto          272
     350: aload         11
     352: checkcast     #113                // class java/util/List
     355: nop
     356: astore        7
     358: aload         7
     360: checkcast     #89                 // class java/lang/Iterable
     363: astore        8
     365: iconst_0
     366: istore        9
     368: aload         8
     370: instanceof    #66                 // class java/util/Collection
     373: ifeq          393
     376: aload         8
     378: checkcast     #66                 // class java/util/Collection
     381: invokeinterface #70,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
     386: ifeq          393
     389: iconst_0
     390: goto          453
     393: aload         8
     395: invokeinterface #96,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     400: astore        10
     402: aload         10
     404: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     409: ifeq          452
     412: aload         10
     414: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     419: astore        11
     421: aload         11
     423: checkcast     #106                // class kotlin/Pair
     426: astore        12
     428: iconst_0
     429: istore        13
     431: aload_2
     432: aload         12
     434: invokeinterface #135,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     439: checkcast     #127                // class java/lang/Boolean
     442: invokevirtual #130                // Method java/lang/Boolean.booleanValue:()Z
     445: ifeq          402
     448: iconst_1
     449: goto          453
     452: iconst_0
     453: ifeq          464
     456: aload         6
     458: invokevirtual #139                // Method aoc2022/Day12$PathCost.getCost:()I
     461: iconst_1
     462: iadd
     463: ireturn
     464: aload         5
     466: aload         7
     468: checkcast     #89                 // class java/lang/Iterable
     471: astore        8
     473: astore        17
     475: iconst_0
     476: istore        9
     478: aload         8
     480: astore        10
     482: new           #91                 // class java/util/ArrayList
     485: dup
     486: aload         8
     488: bipush        10
     490: invokestatic  #145                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     493: invokespecial #148                // Method java/util/ArrayList."<init>":(I)V
     496: checkcast     #66                 // class java/util/Collection
     499: astore        11
     501: iconst_0
     502: istore        12
     504: aload         10
     506: invokeinterface #96,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     511: astore        13
     513: aload         13
     515: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     520: ifeq          574
     523: aload         13
     525: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     530: astore        14
     532: aload         11
     534: aload         14
     536: checkcast     #106                // class kotlin/Pair
     539: astore        15
     541: astore        18
     543: iconst_0
     544: istore        16
     546: new           #57                 // class aoc2022/Day12$PathCost
     549: dup
     550: aload         15
     552: aload         6
     554: invokevirtual #139                // Method aoc2022/Day12$PathCost.getCost:()I
     557: iconst_1
     558: iadd
     559: invokespecial #60                 // Method aoc2022/Day12$PathCost."<init>":(Lkotlin/Pair;I)V
     562: aload         18
     564: swap
     565: invokeinterface #81,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     570: pop
     571: goto          513
     574: aload         11
     576: checkcast     #113                // class java/util/List
     579: nop
     580: aload         17
     582: swap
     583: checkcast     #66                 // class java/util/Collection
     586: invokevirtual #152                // Method java/util/PriorityQueue.addAll:(Ljava/util/Collection;)Z
     589: pop
     590: goto          65
     593: new           #154                // class java/lang/IllegalStateException
     596: dup
     597: ldc           #156                // String No path...
     599: invokespecial #159                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     602: athrow

  public final java.util.Map<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Integer> component1();
    Code:
       0: aload_0
       1: getfield      #26                 // Field elevations:Ljava/util/Map;
       4: areturn

  public final kotlin.Pair<java.lang.Integer, java.lang.Integer> component2();
    Code:
       0: aload_0
       1: getfield      #29                 // Field start:Lkotlin/Pair;
       4: areturn

  public final kotlin.Pair<java.lang.Integer, java.lang.Integer> component3();
    Code:
       0: aload_0
       1: getfield      #31                 // Field end:Lkotlin/Pair;
       4: areturn

  public final aoc2022.Day12$HeightMap copy(java.util.Map<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>);
    Code:
       0: aload_1
       1: ldc           #10                 // String elevations
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #18                 // String start
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #20                 // String end
      15: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: new           #2                  // class aoc2022/Day12$HeightMap
      21: dup
      22: aload_1
      23: aload_2
      24: aload_3
      25: invokespecial #202                // Method "<init>":(Ljava/util/Map;Lkotlin/Pair;Lkotlin/Pair;)V
      28: areturn

  public static aoc2022.Day12$HeightMap copy$default(aoc2022.Day12$HeightMap, java.util.Map, kotlin.Pair, kotlin.Pair, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #26                 // Field elevations:Ljava/util/Map;
      11: astore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #29                 // Field start:Lkotlin/Pair;
      23: astore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #31                 // Field end:Lkotlin/Pair;
      35: astore_3
      36: aload_0
      37: aload_1
      38: aload_2
      39: aload_3
      40: invokevirtual #206                // Method copy:(Ljava/util/Map;Lkotlin/Pair;Lkotlin/Pair;)Laoc2022/Day12$HeightMap;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #210                // class java/lang/StringBuilder
       3: dup
       4: invokespecial #211                // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #213                // String HeightMap(elevations=
       9: invokevirtual #217                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #26                 // Field elevations:Ljava/util/Map;
      16: invokevirtual #220                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      19: ldc           #222                // String , start=
      21: invokevirtual #217                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #29                 // Field start:Lkotlin/Pair;
      28: invokevirtual #220                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      31: ldc           #224                // String , end=
      33: invokevirtual #217                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #31                 // Field end:Lkotlin/Pair;
      40: invokevirtual #220                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #227                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #229                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #26                 // Field elevations:Ljava/util/Map;
       4: invokevirtual #232                // Method java/lang/Object.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #29                 // Field start:Lkotlin/Pair;
      16: invokevirtual #233                // Method kotlin/Pair.hashCode:()I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #31                 // Field end:Lkotlin/Pair;
      29: invokevirtual #233                // Method kotlin/Pair.hashCode:()I
      32: iadd
      33: istore_1
      34: iload_1
      35: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class aoc2022/Day12$HeightMap
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class aoc2022/Day12$HeightMap
      20: astore_2
      21: aload_0
      22: getfield      #26                 // Field elevations:Ljava/util/Map;
      25: aload_2
      26: getfield      #26                 // Field elevations:Ljava/util/Map;
      29: invokestatic  #240                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #29                 // Field start:Lkotlin/Pair;
      41: aload_2
      42: getfield      #29                 // Field start:Lkotlin/Pair;
      45: invokestatic  #240                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifne          53
      51: iconst_0
      52: ireturn
      53: aload_0
      54: getfield      #31                 // Field end:Lkotlin/Pair;
      57: aload_2
      58: getfield      #31                 // Field end:Lkotlin/Pair;
      61: invokestatic  #240                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      64: ifne          69
      67: iconst_0
      68: ireturn
      69: iconst_1
      70: ireturn
}

Compiled from "Day12.kt"
public final class aoc2022.Day12 {
  private final aoc2022.Day12$HeightMap heightMap;

  public aoc2022.Day12(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #10                 // String input
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #19                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_0
      12: aload_1
      13: invokespecial #23                 // Method parseHeightMap:(Ljava/util/List;)Laoc2022/Day12$HeightMap;
      16: putfield      #27                 // Field heightMap:Laoc2022/Day12$HeightMap;
      19: return

  private final aoc2022.Day12$HeightMap parseHeightMap(java.util.List<java.lang.String>);
    Code:
       0: aconst_null
       1: astore_2
       2: aconst_null
       3: astore_3
       4: aload_1
       5: checkcast     #33                 // class java/lang/Iterable
       8: astore        5
      10: new           #35                 // class java/util/ArrayList
      13: dup
      14: invokespecial #36                 // Method java/util/ArrayList."<init>":()V
      17: checkcast     #38                 // class java/util/Collection
      20: astore        6
      22: iconst_0
      23: istore        7
      25: aload         5
      27: invokeinterface #42,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      32: astore        8
      34: aload         8
      36: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      41: ifeq          308
      44: aload         8
      46: invokeinterface #52,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      51: astore        9
      53: iload         7
      55: iinc          7, 1
      58: istore        10
      60: iload         10
      62: ifge          68
      65: invokestatic  #57                 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
      68: iload         10
      70: aload         9
      72: checkcast     #59                 // class java/lang/String
      75: astore        11
      77: istore        12
      79: iconst_0
      80: istore        13
      82: aload         11
      84: checkcast     #61                 // class java/lang/CharSequence
      87: astore        14
      89: iconst_0
      90: istore        15
      92: aload         14
      94: astore        16
      96: new           #35                 // class java/util/ArrayList
      99: dup
     100: aload         14
     102: invokeinterface #65,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     107: invokespecial #68                 // Method java/util/ArrayList."<init>":(I)V
     110: checkcast     #38                 // class java/util/Collection
     113: astore        17
     115: iconst_0
     116: istore        18
     118: iconst_0
     119: istore        19
     121: iconst_0
     122: istore        20
     124: iload         20
     126: aload         16
     128: invokeinterface #65,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     133: if_icmpge     288
     136: aload         16
     138: iload         20
     140: invokeinterface #72,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     145: istore        21
     147: aload         17
     149: iload         19
     151: iinc          19, 1
     154: iload         21
     156: istore        22
     158: istore        23
     160: astore        24
     162: iconst_0
     163: istore        25
     165: new           #74                 // class kotlin/Pair
     168: dup
     169: iload         23
     171: invokestatic  #80                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     174: iload         12
     176: invokestatic  #80                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     179: invokespecial #83                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     182: astore        26
     184: aload         26
     186: iload         22
     188: lookupswitch  { // 2
                    69: 238
                    83: 216
               default: 261
          }
     216: iconst_0
     217: istore        27
     219: iload         27
     221: istore        28
     223: astore        29
     225: iconst_0
     226: istore        30
     228: aload         26
     230: astore_2
     231: aload         29
     233: iload         27
     235: goto          266
     238: bipush        25
     240: istore        27
     242: iload         27
     244: istore        28
     246: astore        29
     248: iconst_0
     249: istore        30
     251: aload         26
     253: astore_3
     254: aload         29
     256: iload         27
     258: goto          266
     261: iload         22
     263: bipush        97
     265: isub
     266: invokestatic  #80                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     269: invokestatic  #89                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     272: nop
     273: aload         24
     275: swap
     276: invokeinterface #93,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     281: pop
     282: iinc          20, 1
     285: goto          124
     288: aload         17
     290: checkcast     #95                 // class java/util/List
     293: nop
     294: checkcast     #33                 // class java/lang/Iterable
     297: nop
     298: aload         6
     300: swap
     301: invokestatic  #99                 // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     304: pop
     305: goto          34
     308: aload         6
     310: checkcast     #95                 // class java/util/List
     313: checkcast     #33                 // class java/lang/Iterable
     316: invokestatic  #105                // Method kotlin/collections/MapsKt.toMap:(Ljava/lang/Iterable;)Ljava/util/Map;
     319: astore        4
     321: new           #107                // class aoc2022/Day12$HeightMap
     324: dup
     325: aload         4
     327: aload_2
     328: dup
     329: invokestatic  #111                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     332: aload_3
     333: dup
     334: invokestatic  #111                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     337: invokespecial #114                // Method aoc2022/Day12$HeightMap."<init>":(Ljava/util/Map;Lkotlin/Pair;Lkotlin/Pair;)V
     340: areturn

  public final int solvePart1();
    Code:
       0: aload_0
       1: getfield      #27                 // Field heightMap:Laoc2022/Day12$HeightMap;
       4: aload_0
       5: getfield      #27                 // Field heightMap:Laoc2022/Day12$HeightMap;
       8: invokevirtual #148                // Method aoc2022/Day12$HeightMap.getStart:()Lkotlin/Pair;
      11: aload_0
      12: invokedynamic #168,  0            // InvokeDynamic #0:invoke:(Laoc2022/Day12;)Lkotlin/jvm/functions/Function1;
      17: invokedynamic #180,  0            // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function2;
      22: invokevirtual #184                // Method aoc2022/Day12$HeightMap.shortestPath:(Lkotlin/Pair;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;)I
      25: ireturn

  public final int solvePart2();
    Code:
       0: aload_0
       1: getfield      #27                 // Field heightMap:Laoc2022/Day12$HeightMap;
       4: aload_0
       5: getfield      #27                 // Field heightMap:Laoc2022/Day12$HeightMap;
       8: invokevirtual #188                // Method aoc2022/Day12$HeightMap.getEnd:()Lkotlin/Pair;
      11: aload_0
      12: invokedynamic #193,  0            // InvokeDynamic #2:invoke:(Laoc2022/Day12;)Lkotlin/jvm/functions/Function1;
      17: invokedynamic #198,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function2;
      22: invokevirtual #184                // Method aoc2022/Day12$HeightMap.shortestPath:(Lkotlin/Pair;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;)I
      25: ireturn

  private static final boolean solvePart1$lambda$4(aoc2022.Day12, kotlin.Pair);
    Code:
       0: aload_1
       1: ldc           #199                // String it
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: aload_0
       8: getfield      #27                 // Field heightMap:Laoc2022/Day12$HeightMap;
      11: invokevirtual #188                // Method aoc2022/Day12$HeightMap.getEnd:()Lkotlin/Pair;
      14: invokestatic  #203                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      17: ireturn

  private static final boolean solvePart1$lambda$5(int, int);
    Code:
       0: iload_1
       1: iload_0
       2: isub
       3: iconst_1
       4: if_icmpgt     11
       7: iconst_1
       8: goto          12
      11: iconst_0
      12: ireturn

  private static final boolean solvePart2$lambda$6(aoc2022.Day12, kotlin.Pair);
    Code:
       0: aload_1
       1: ldc           #199                // String it
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #27                 // Field heightMap:Laoc2022/Day12$HeightMap;
      10: invokevirtual #209                // Method aoc2022/Day12$HeightMap.getElevations:()Ljava/util/Map;
      13: aload_1
      14: invokeinterface #214,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      19: checkcast     #76                 // class java/lang/Integer
      22: dup
      23: ifnonnull     30
      26: pop
      27: goto          40
      30: invokevirtual #217                // Method java/lang/Integer.intValue:()I
      33: ifne          40
      36: iconst_1
      37: goto          41
      40: iconst_0
      41: ireturn

  private static final boolean solvePart2$lambda$7(int, int);
    Code:
       0: iload_0
       1: iload_1
       2: isub
       3: iconst_1
       4: if_icmpgt     11
       7: iconst_1
       8: goto          12
      11: iconst_0
      12: ireturn
}

Compiled from "Day12.kt"
public final class aoc2022.Day12Kt {
  private static final java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>> getNeighbors(kotlin.Pair<java.lang.Integer, java.lang.Integer>);
    Code:
       0: new           #9                  // class kotlin/Pair
       3: dup
       4: aload_0
       5: invokevirtual #13                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
       8: checkcast     #15                 // class java/lang/Number
      11: invokevirtual #19                 // Method java/lang/Number.intValue:()I
      14: iconst_1
      15: isub
      16: invokestatic  #25                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      19: aload_0
      20: invokevirtual #28                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      23: invokespecial #32                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      26: astore_1
      27: new           #9                  // class kotlin/Pair
      30: dup
      31: aload_0
      32: invokevirtual #13                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      35: checkcast     #15                 // class java/lang/Number
      38: invokevirtual #19                 // Method java/lang/Number.intValue:()I
      41: iconst_1
      42: iadd
      43: invokestatic  #25                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      46: aload_0
      47: invokevirtual #28                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      50: invokespecial #32                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      53: astore_2
      54: new           #9                  // class kotlin/Pair
      57: dup
      58: aload_0
      59: invokevirtual #13                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      62: aload_0
      63: invokevirtual #28                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      66: checkcast     #15                 // class java/lang/Number
      69: invokevirtual #19                 // Method java/lang/Number.intValue:()I
      72: iconst_1
      73: isub
      74: invokestatic  #25                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      77: invokespecial #32                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      80: astore_3
      81: new           #9                  // class kotlin/Pair
      84: dup
      85: aload_0
      86: invokevirtual #13                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      89: aload_0
      90: invokevirtual #28                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      93: checkcast     #15                 // class java/lang/Number
      96: invokevirtual #19                 // Method java/lang/Number.intValue:()I
      99: iconst_1
     100: iadd
     101: invokestatic  #25                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     104: invokespecial #32                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     107: astore        4
     109: iconst_4
     110: anewarray     #9                  // class kotlin/Pair
     113: astore        5
     115: aload         5
     117: iconst_0
     118: aload_1
     119: aastore
     120: aload         5
     122: iconst_1
     123: aload_2
     124: aastore
     125: aload         5
     127: iconst_2
     128: aload_3
     129: aastore
     130: aload         5
     132: iconst_3
     133: aload         4
     135: aastore
     136: aload         5
     138: invokestatic  #38                 // Method kotlin/collections/CollectionsKt.listOfNotNull:([Ljava/lang/Object;)Ljava/util/List;
     141: areturn

  public static final java.util.List access$getNeighbors(kotlin.Pair);
    Code:
       0: aload_0
       1: invokestatic  #47                 // Method getNeighbors:(Lkotlin/Pair;)Ljava/util/List;
       4: areturn
}


package aoc2022

class Day13(val input: String) {

    sealed class Packets : Comparable<Packets> {
        data class Single(val value: Int) : Packets()

        data class Multi(val packets: List<Packets>) : Packets()

        private fun Single.toList() = Multi(listOf(this))

        override fun compareTo(other: Packets): Int {
            when {
                this is Single && other is Single -> {
                    return this.value.compareTo(other.value)
                }

                this is Multi && other is Multi -> {
                    repeat(minOf(this.packets.size, other.packets.size)) { i ->
                        val comparison = this.packets[i].compareTo(other.packets[i])
                        if (comparison != 0) {
                            return comparison
                        }
                    }
                    return this.packets.size.compareTo(other.packets.size)
                }

                else -> when {
                    this is Single -> return this.toList().compareTo(other)
                    other is Single -> return this.compareTo(other.toList())
                }
            }
            throw IllegalStateException("Bad comparison: $this :: $other")
        }

        companion object {
            fun parse(input: String): Packets {
                val list = input.substring(1, input.lastIndex)

                return Multi(
                    if (list.isEmpty()) {
                        emptyList()
                    } else {
                        buildList {
                            var index = 0
                            while (index < list.length) {
                                if (list[index] == '[') {
                                    val parenthesis = ArrayDeque<Unit>()
                                    parenthesis.addLast(Unit)
                                    var p = index + 1
                                    while (parenthesis.isNotEmpty()) {
                                        if (list[p] == '[') {
                                            parenthesis.addLast(Unit)
                                        } else if (list[p] == ']') {
                                            parenthesis.removeLast()
                                        }
                                        p++
                                    }
                                    add(parse(list.substring(index, p)))
                                    index = p + 1
                                } else {
                                    var nextIndex = list.indexOf(',', startIndex = index + 1)
                                    if (nextIndex == -1) {
                                        nextIndex = list.lastIndex + 1
                                    }
                                    add(Single(list.substring(index, nextIndex).toInt()))
                                    index = nextIndex + 1
                                }
                            }
                        }
                    }
                )
            }
        }
    }

    private fun String.parseInputPairs(): List<Pair<Packets, Packets>> {
        val pairs = this.split("\n\n").map { it.split("\n") }

        return pairs.map { Pair(Packets.parse(it[0]), Packets.parse(it[1])) }
    }

    private fun String.parseInput(): List<Packets> {
        return this.split("\n").filter(String::isNotEmpty).map { Packets.parse(it) }
    }

    fun solvePart1(): Int {
        val res = input.parseInputPairs().mapIndexed { index, pair ->
            if (pair.first < pair.second) {
                index + 1
            } else {
                0
            }
        }.sum()
        return res
    }

    fun solvePart2(): Int {
        val firstDivider = Packets.parse("[[2]]")
        val secondDivider = Packets.parse("[[6]]")
        val packets = input.parseInput().plus(listOf(firstDivider, secondDivider)).sorted()

        return (packets.indexOf(firstDivider) + 1) * (packets.indexOf(secondDivider) + 1)
    }
}

Compiled from "Day13.kt"
public final class aoc2022.Day13$Packets$Single extends aoc2022.Day13$Packets {
  private final int value;

  public aoc2022.Day13$Packets$Single(int);
    Code:
       0: aload_0
       1: aconst_null
       2: invokespecial #9                  // Method aoc2022/Day13$Packets."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
       5: aload_0
       6: iload_1
       7: putfield      #13                 // Field value:I
      10: return

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

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

  public final aoc2022.Day13$Packets$Single copy(int);
    Code:
       0: new           #2                  // class aoc2022/Day13$Packets$Single
       3: dup
       4: iload_1
       5: invokespecial #23                 // Method "<init>":(I)V
       8: areturn

  public static aoc2022.Day13$Packets$Single copy$default(aoc2022.Day13$Packets$Single, int, int, java.lang.Object);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #13                 // Field value:I
      10: istore_1
      11: aload_0
      12: iload_1
      13: invokevirtual #27                 // Method copy:(I)Laoc2022/Day13$Packets$Single;
      16: areturn

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

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field value:I
       4: invokestatic  #54                 // Method java/lang/Integer.hashCode:(I)I
       7: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class aoc2022/Day13$Packets$Single
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class aoc2022/Day13$Packets$Single
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field value:I
      25: aload_2
      26: getfield      #13                 // Field value:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: iconst_1
      35: ireturn
}

Compiled from "Day13.kt"
public final class aoc2022.Day13 {
  private final java.lang.String input;

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

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

  private final java.util.List<kotlin.Pair<aoc2022.Day13$Packets, aoc2022.Day13$Packets>> parseInputPairs(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #30                 // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #32                 // class java/lang/String
       8: astore_3
       9: aload_3
      10: iconst_0
      11: ldc           #34                 // String \n\n
      13: aastore
      14: aload_3
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #40                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: checkcast     #42                 // class java/lang/Iterable
      26: astore_3
      27: iconst_0
      28: istore        4
      30: aload_3
      31: astore        5
      33: new           #44                 // class java/util/ArrayList
      36: dup
      37: aload_3
      38: bipush        10
      40: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      43: invokespecial #53                 // Method java/util/ArrayList."<init>":(I)V
      46: checkcast     #55                 // class java/util/Collection
      49: astore        6
      51: iconst_0
      52: istore        7
      54: aload         5
      56: invokeinterface #59,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      61: astore        8
      63: aload         8
      65: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      70: ifeq          135
      73: aload         8
      75: invokeinterface #69,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      80: astore        9
      82: aload         6
      84: aload         9
      86: checkcast     #32                 // class java/lang/String
      89: astore        10
      91: astore        13
      93: iconst_0
      94: istore        11
      96: aload         10
      98: checkcast     #30                 // class java/lang/CharSequence
     101: iconst_1
     102: anewarray     #32                 // class java/lang/String
     105: astore        12
     107: aload         12
     109: iconst_0
     110: ldc           #71                 // String \n
     112: aastore
     113: aload         12
     115: iconst_0
     116: iconst_0
     117: bipush        6
     119: aconst_null
     120: invokestatic  #40                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     123: aload         13
     125: swap
     126: invokeinterface #75,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     131: pop
     132: goto          63
     135: aload         6
     137: checkcast     #77                 // class java/util/List
     140: nop
     141: astore_2
     142: aload_2
     143: checkcast     #42                 // class java/lang/Iterable
     146: astore_3
     147: iconst_0
     148: istore        4
     150: aload_3
     151: astore        5
     153: new           #44                 // class java/util/ArrayList
     156: dup
     157: aload_3
     158: bipush        10
     160: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     163: invokespecial #53                 // Method java/util/ArrayList."<init>":(I)V
     166: checkcast     #55                 // class java/util/Collection
     169: astore        6
     171: iconst_0
     172: istore        7
     174: aload         5
     176: invokeinterface #59,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     181: astore        8
     183: aload         8
     185: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     190: ifeq          269
     193: aload         8
     195: invokeinterface #69,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     200: astore        9
     202: aload         6
     204: aload         9
     206: checkcast     #77                 // class java/util/List
     209: astore        10
     211: astore        13
     213: iconst_0
     214: istore        11
     216: new           #79                 // class kotlin/Pair
     219: dup
     220: getstatic     #85                 // Field aoc2022/Day13$Packets.Companion:Laoc2022/Day13$Packets$Companion;
     223: aload         10
     225: iconst_0
     226: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     231: checkcast     #32                 // class java/lang/String
     234: invokevirtual #95                 // Method aoc2022/Day13$Packets$Companion.parse:(Ljava/lang/String;)Laoc2022/Day13$Packets;
     237: getstatic     #85                 // Field aoc2022/Day13$Packets.Companion:Laoc2022/Day13$Packets$Companion;
     240: aload         10
     242: iconst_1
     243: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     248: checkcast     #32                 // class java/lang/String
     251: invokevirtual #95                 // Method aoc2022/Day13$Packets$Companion.parse:(Ljava/lang/String;)Laoc2022/Day13$Packets;
     254: invokespecial #98                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     257: aload         13
     259: swap
     260: invokeinterface #75,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     265: pop
     266: goto          183
     269: aload         6
     271: checkcast     #77                 // class java/util/List
     274: nop
     275: areturn

  private final java.util.List<aoc2022.Day13$Packets> parseInput(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #30                 // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #32                 // class java/lang/String
       8: astore_2
       9: aload_2
      10: iconst_0
      11: ldc           #71                 // String \n
      13: aastore
      14: aload_2
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #40                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: checkcast     #42                 // class java/lang/Iterable
      26: astore_2
      27: iconst_0
      28: istore_3
      29: aload_2
      30: astore        4
      32: new           #44                 // class java/util/ArrayList
      35: dup
      36: invokespecial #117                // Method java/util/ArrayList."<init>":()V
      39: checkcast     #55                 // class java/util/Collection
      42: astore        5
      44: iconst_0
      45: istore        6
      47: aload         4
      49: invokeinterface #59,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      54: astore        7
      56: aload         7
      58: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      63: ifeq          120
      66: aload         7
      68: invokeinterface #69,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      73: astore        8
      75: aload         8
      77: checkcast     #32                 // class java/lang/String
      80: astore        9
      82: iconst_0
      83: istore        10
      85: aload         9
      87: checkcast     #30                 // class java/lang/CharSequence
      90: invokeinterface #121,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      95: ifle          102
      98: iconst_1
      99: goto          103
     102: iconst_0
     103: nop
     104: ifeq          56
     107: aload         5
     109: aload         8
     111: invokeinterface #75,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     116: pop
     117: goto          56
     120: aload         5
     122: checkcast     #77                 // class java/util/List
     125: nop
     126: checkcast     #42                 // class java/lang/Iterable
     129: astore_2
     130: nop
     131: iconst_0
     132: istore_3
     133: aload_2
     134: astore        4
     136: new           #44                 // class java/util/ArrayList
     139: dup
     140: aload_2
     141: bipush        10
     143: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     146: invokespecial #53                 // Method java/util/ArrayList."<init>":(I)V
     149: checkcast     #55                 // class java/util/Collection
     152: astore        5
     154: iconst_0
     155: istore        6
     157: aload         4
     159: invokeinterface #59,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     164: astore        7
     166: aload         7
     168: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     173: ifeq          219
     176: aload         7
     178: invokeinterface #69,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     183: astore        8
     185: aload         5
     187: aload         8
     189: checkcast     #32                 // class java/lang/String
     192: astore        9
     194: astore        11
     196: iconst_0
     197: istore        10
     199: getstatic     #85                 // Field aoc2022/Day13$Packets.Companion:Laoc2022/Day13$Packets$Companion;
     202: aload         9
     204: invokevirtual #95                 // Method aoc2022/Day13$Packets$Companion.parse:(Ljava/lang/String;)Laoc2022/Day13$Packets;
     207: aload         11
     209: swap
     210: invokeinterface #75,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     215: pop
     216: goto          166
     219: aload         5
     221: checkcast     #77                 // class java/util/List
     224: nop
     225: areturn

  public final int solvePart1();
    Code:
       0: aload_0
       1: aload_0
       2: getfield      #21                 // Field input:Ljava/lang/String;
       5: invokespecial #133                // Method parseInputPairs:(Ljava/lang/String;)Ljava/util/List;
       8: checkcast     #42                 // class java/lang/Iterable
      11: astore_2
      12: iconst_0
      13: istore_3
      14: aload_2
      15: astore        4
      17: new           #44                 // class java/util/ArrayList
      20: dup
      21: aload_2
      22: bipush        10
      24: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #53                 // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #55                 // class java/util/Collection
      33: astore        5
      35: iconst_0
      36: istore        6
      38: iconst_0
      39: istore        7
      41: aload         4
      43: invokeinterface #59,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      48: astore        8
      50: aload         8
      52: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      57: ifeq          148
      60: aload         8
      62: invokeinterface #69,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      67: astore        9
      69: aload         5
      71: iload         7
      73: iinc          7, 1
      76: istore        10
      78: iload         10
      80: ifge          86
      83: invokestatic  #136                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
      86: iload         10
      88: aload         9
      90: checkcast     #79                 // class kotlin/Pair
      93: astore        11
      95: istore        12
      97: astore        14
      99: iconst_0
     100: istore        13
     102: aload         11
     104: invokevirtual #139                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     107: checkcast     #81                 // class aoc2022/Day13$Packets
     110: aload         11
     112: invokevirtual #142                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     115: checkcast     #81                 // class aoc2022/Day13$Packets
     118: invokevirtual #146                // Method aoc2022/Day13$Packets.compareTo:(Laoc2022/Day13$Packets;)I
     121: ifge          131
     124: iload         12
     126: iconst_1
     127: iadd
     128: goto          132
     131: iconst_0
     132: nop
     133: invokestatic  #152                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     136: aload         14
     138: swap
     139: invokeinterface #75,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     144: pop
     145: goto          50
     148: aload         5
     150: checkcast     #77                 // class java/util/List
     153: nop
     154: checkcast     #42                 // class java/lang/Iterable
     157: invokestatic  #156                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     160: istore_1
     161: iload_1
     162: ireturn

  public final int solvePart2();
    Code:
       0: getstatic     #85                 // Field aoc2022/Day13$Packets.Companion:Laoc2022/Day13$Packets$Companion;
       3: ldc           #169                // String [[2]]
       5: invokevirtual #95                 // Method aoc2022/Day13$Packets$Companion.parse:(Ljava/lang/String;)Laoc2022/Day13$Packets;
       8: astore_1
       9: getstatic     #85                 // Field aoc2022/Day13$Packets.Companion:Laoc2022/Day13$Packets$Companion;
      12: ldc           #171                // String [[6]]
      14: invokevirtual #95                 // Method aoc2022/Day13$Packets$Companion.parse:(Ljava/lang/String;)Laoc2022/Day13$Packets;
      17: astore_2
      18: aload_0
      19: aload_0
      20: getfield      #21                 // Field input:Ljava/lang/String;
      23: invokespecial #173                // Method parseInput:(Ljava/lang/String;)Ljava/util/List;
      26: checkcast     #55                 // class java/util/Collection
      29: iconst_2
      30: anewarray     #81                 // class aoc2022/Day13$Packets
      33: astore        4
      35: aload         4
      37: iconst_0
      38: aload_1
      39: aastore
      40: aload         4
      42: iconst_1
      43: aload_2
      44: aastore
      45: aload         4
      47: invokestatic  #177                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      50: checkcast     #42                 // class java/lang/Iterable
      53: invokestatic  #181                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Iterable;)Ljava/util/List;
      56: checkcast     #42                 // class java/lang/Iterable
      59: invokestatic  #185                // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
      62: astore_3
      63: aload_3
      64: aload_1
      65: invokeinterface #189,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
      70: iconst_1
      71: iadd
      72: aload_3
      73: aload_2
      74: invokeinterface #189,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
      79: iconst_1
      80: iadd
      81: imul
      82: ireturn
}

Compiled from "Day13.kt"
public final class aoc2022.Day13$Packets$Multi extends aoc2022.Day13$Packets {
  private final java.util.List<aoc2022.Day13$Packets> packets;

  public aoc2022.Day13$Packets$Multi(java.util.List<? extends aoc2022.Day13$Packets>);
    Code:
       0: aload_1
       1: ldc           #10                 // String packets
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aconst_null
       8: invokespecial #19                 // Method aoc2022/Day13$Packets."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
      11: aload_0
      12: aload_1
      13: putfield      #22                 // Field packets:Ljava/util/List;
      16: return

  public final java.util.List<aoc2022.Day13$Packets> getPackets();
    Code:
       0: aload_0
       1: getfield      #22                 // Field packets:Ljava/util/List;
       4: areturn

  public final java.util.List<aoc2022.Day13$Packets> component1();
    Code:
       0: aload_0
       1: getfield      #22                 // Field packets:Ljava/util/List;
       4: areturn

  public final aoc2022.Day13$Packets$Multi copy(java.util.List<? extends aoc2022.Day13$Packets>);
    Code:
       0: aload_1
       1: ldc           #10                 // String packets
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class aoc2022/Day13$Packets$Multi
       9: dup
      10: aload_1
      11: invokespecial #33                 // Method "<init>":(Ljava/util/List;)V
      14: areturn

  public static aoc2022.Day13$Packets$Multi copy$default(aoc2022.Day13$Packets$Multi, java.util.List, int, java.lang.Object);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #22                 // Field packets:Ljava/util/List;
      10: astore_1
      11: aload_0
      12: aload_1
      13: invokevirtual #37                 // Method copy:(Ljava/util/List;)Laoc2022/Day13$Packets$Multi;
      16: areturn

  public java.lang.String toString();
    Code:
       0: new           #41                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #44                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #46                 // String Multi(packets=
       9: invokevirtual #50                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #22                 // Field packets:Ljava/util/List;
      16: invokevirtual #53                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      19: bipush        41
      21: invokevirtual #56                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      24: invokevirtual #58                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      27: areturn

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

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

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

  public final aoc2022.Day13$Packets parse(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: iconst_1
       8: aload_1
       9: checkcast     #23                 // class java/lang/CharSequence
      12: invokestatic  #29                 // Method kotlin/text/StringsKt.getLastIndex:(Ljava/lang/CharSequence;)I
      15: invokevirtual #35                 // Method java/lang/String.substring:(II)Ljava/lang/String;
      18: dup
      19: ldc           #37                 // String substring(...)
      21: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      24: astore_2
      25: aload_2
      26: checkcast     #23                 // class java/lang/CharSequence
      29: invokeinterface #44,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      34: ifne          41
      37: iconst_1
      38: goto          42
      41: iconst_0
      42: ifeq          51
      45: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
      48: goto          291
      51: invokestatic  #53                 // Method kotlin/collections/CollectionsKt.createListBuilder:()Ljava/util/List;
      54: astore_3
      55: aload_3
      56: astore        4
      58: iconst_0
      59: istore        5
      61: iconst_0
      62: istore        6
      64: iload         6
      66: aload_2
      67: invokevirtual #54                 // Method java/lang/String.length:()I
      70: if_icmpge     286
      73: aload_2
      74: iload         6
      76: invokevirtual #58                 // Method java/lang/String.charAt:(I)C
      79: bipush        91
      81: if_icmpne     210
      84: new           #60                 // class kotlin/collections/ArrayDeque
      87: dup
      88: invokespecial #61                 // Method kotlin/collections/ArrayDeque."<init>":()V
      91: astore        7
      93: aload         7
      95: getstatic     #67                 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      98: invokevirtual #71                 // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     101: iload         6
     103: iconst_1
     104: iadd
     105: istore        8
     107: aload         7
     109: checkcast     #73                 // class java/util/Collection
     112: invokeinterface #77,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
     117: ifne          124
     120: iconst_1
     121: goto          125
     124: iconst_0
     125: ifeq          173
     128: aload_2
     129: iload         8
     131: invokevirtual #58                 // Method java/lang/String.charAt:(I)C
     134: bipush        91
     136: if_icmpne     150
     139: aload         7
     141: getstatic     #67                 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     144: invokevirtual #71                 // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     147: goto          167
     150: aload_2
     151: iload         8
     153: invokevirtual #58                 // Method java/lang/String.charAt:(I)C
     156: bipush        93
     158: if_icmpne     167
     161: aload         7
     163: invokevirtual #81                 // Method kotlin/collections/ArrayDeque.removeLast:()Ljava/lang/Object;
     166: pop
     167: iinc          8, 1
     170: goto          107
     173: aload         4
     175: getstatic     #86                 // Field aoc2022/Day13$Packets.Companion:Laoc2022/Day13$Packets$Companion;
     178: aload_2
     179: iload         6
     181: iload         8
     183: invokevirtual #35                 // Method java/lang/String.substring:(II)Ljava/lang/String;
     186: dup
     187: ldc           #37                 // String substring(...)
     189: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     192: invokevirtual #88                 // Method parse:(Ljava/lang/String;)Laoc2022/Day13$Packets;
     195: invokeinterface #94,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     200: pop
     201: iload         8
     203: iconst_1
     204: iadd
     205: istore        6
     207: goto          64
     210: aload_2
     211: checkcast     #23                 // class java/lang/CharSequence
     214: bipush        44
     216: iload         6
     218: iconst_1
     219: iadd
     220: iconst_0
     221: iconst_4
     222: aconst_null
     223: invokestatic  #98                 // Method kotlin/text/StringsKt.indexOf$default:(Ljava/lang/CharSequence;CIZILjava/lang/Object;)I
     226: istore        7
     228: iload         7
     230: iconst_m1
     231: if_icmpne     245
     234: aload_2
     235: checkcast     #23                 // class java/lang/CharSequence
     238: invokestatic  #29                 // Method kotlin/text/StringsKt.getLastIndex:(Ljava/lang/CharSequence;)I
     241: iconst_1
     242: iadd
     243: istore        7
     245: aload         4
     247: new           #100                // class aoc2022/Day13$Packets$Single
     250: dup
     251: aload_2
     252: iload         6
     254: iload         7
     256: invokevirtual #35                 // Method java/lang/String.substring:(II)Ljava/lang/String;
     259: dup
     260: ldc           #37                 // String substring(...)
     262: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     265: invokestatic  #106                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     268: invokespecial #109                // Method aoc2022/Day13$Packets$Single."<init>":(I)V
     271: invokeinterface #94,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     276: pop
     277: iload         7
     279: iconst_1
     280: iadd
     281: istore        6
     283: goto          64
     286: nop
     287: aload_3
     288: invokestatic  #113                // Method kotlin/collections/CollectionsKt.build:(Ljava/util/List;)Ljava/util/List;
     291: astore        9
     293: new           #115                // class aoc2022/Day13$Packets$Multi
     296: dup
     297: aload         9
     299: invokespecial #118                // Method aoc2022/Day13$Packets$Multi."<init>":(Ljava/util/List;)V
     302: checkcast     #83                 // class aoc2022/Day13$Packets
     305: areturn

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

Compiled from "Day13.kt"
public abstract class aoc2022.Day13$Packets implements java.lang.Comparable<aoc2022.Day13$Packets> {
  public static final aoc2022.Day13$Packets$Companion Companion;

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

  private final aoc2022.Day13$Packets$Multi toList(aoc2022.Day13$Packets$Single);
    Code:
       0: new           #17                 // class aoc2022/Day13$Packets$Multi
       3: dup
       4: aload_1
       5: invokestatic  #23                 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
       8: invokespecial #26                 // Method aoc2022/Day13$Packets$Multi."<init>":(Ljava/util/List;)V
      11: areturn

  public int compareTo(aoc2022.Day13$Packets);
    Code:
       0: aload_1
       1: ldc           #33                 // String other
       3: invokestatic  #39                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: nop
       7: aload_0
       8: instanceof    #41                 // class aoc2022/Day13$Packets$Single
      11: ifeq          39
      14: aload_1
      15: instanceof    #41                 // class aoc2022/Day13$Packets$Single
      18: ifeq          39
      21: aload_0
      22: checkcast     #41                 // class aoc2022/Day13$Packets$Single
      25: invokevirtual #45                 // Method aoc2022/Day13$Packets$Single.getValue:()I
      28: aload_1
      29: checkcast     #41                 // class aoc2022/Day13$Packets$Single
      32: invokevirtual #45                 // Method aoc2022/Day13$Packets$Single.getValue:()I
      35: invokestatic  #49                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      38: ireturn
      39: aload_0
      40: instanceof    #17                 // class aoc2022/Day13$Packets$Multi
      43: ifeq          176
      46: aload_1
      47: instanceof    #17                 // class aoc2022/Day13$Packets$Multi
      50: ifeq          176
      53: aload_0
      54: checkcast     #17                 // class aoc2022/Day13$Packets$Multi
      57: invokevirtual #53                 // Method aoc2022/Day13$Packets$Multi.getPackets:()Ljava/util/List;
      60: invokeinterface #58,  1           // InterfaceMethod java/util/List.size:()I
      65: aload_1
      66: checkcast     #17                 // class aoc2022/Day13$Packets$Multi
      69: invokevirtual #53                 // Method aoc2022/Day13$Packets$Multi.getPackets:()Ljava/util/List;
      72: invokeinterface #58,  1           // InterfaceMethod java/util/List.size:()I
      77: invokestatic  #63                 // Method java/lang/Math.min:(II)I
      80: istore_2
      81: iconst_0
      82: istore_3
      83: iload_3
      84: iload_2
      85: if_icmpge     148
      88: iload_3
      89: istore        4
      91: iconst_0
      92: istore        5
      94: aload_0
      95: checkcast     #17                 // class aoc2022/Day13$Packets$Multi
      98: invokevirtual #53                 // Method aoc2022/Day13$Packets$Multi.getPackets:()Ljava/util/List;
     101: iload         4
     103: invokeinterface #67,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     108: checkcast     #2                  // class aoc2022/Day13$Packets
     111: aload_1
     112: checkcast     #17                 // class aoc2022/Day13$Packets$Multi
     115: invokevirtual #53                 // Method aoc2022/Day13$Packets$Multi.getPackets:()Ljava/util/List;
     118: iload         4
     120: invokeinterface #67,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     125: checkcast     #2                  // class aoc2022/Day13$Packets
     128: invokevirtual #69                 // Method compareTo:(Laoc2022/Day13$Packets;)I
     131: istore        6
     133: iload         6
     135: ifeq          141
     138: iload         6
     140: ireturn
     141: nop
     142: iinc          3, 1
     145: goto          83
     148: aload_0
     149: checkcast     #17                 // class aoc2022/Day13$Packets$Multi
     152: invokevirtual #53                 // Method aoc2022/Day13$Packets$Multi.getPackets:()Ljava/util/List;
     155: invokeinterface #58,  1           // InterfaceMethod java/util/List.size:()I
     160: aload_1
     161: checkcast     #17                 // class aoc2022/Day13$Packets$Multi
     164: invokevirtual #53                 // Method aoc2022/Day13$Packets$Multi.getPackets:()Ljava/util/List;
     167: invokeinterface #58,  1           // InterfaceMethod java/util/List.size:()I
     172: invokestatic  #49                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
     175: ireturn
     176: nop
     177: aload_0
     178: instanceof    #41                 // class aoc2022/Day13$Packets$Single
     181: ifeq          197
     184: aload_0
     185: aload_0
     186: checkcast     #41                 // class aoc2022/Day13$Packets$Single
     189: invokespecial #71                 // Method toList:(Laoc2022/Day13$Packets$Single;)Laoc2022/Day13$Packets$Multi;
     192: aload_1
     193: invokevirtual #72                 // Method aoc2022/Day13$Packets$Multi.compareTo:(Laoc2022/Day13$Packets;)I
     196: ireturn
     197: aload_1
     198: instanceof    #41                 // class aoc2022/Day13$Packets$Single
     201: ifeq          220
     204: aload_0
     205: aload_0
     206: aload_1
     207: checkcast     #41                 // class aoc2022/Day13$Packets$Single
     210: invokespecial #71                 // Method toList:(Laoc2022/Day13$Packets$Single;)Laoc2022/Day13$Packets$Multi;
     213: checkcast     #2                  // class aoc2022/Day13$Packets
     216: invokevirtual #69                 // Method compareTo:(Laoc2022/Day13$Packets;)I
     219: ireturn
     220: new           #74                 // class java/lang/IllegalStateException
     223: dup
     224: new           #76                 // class java/lang/StringBuilder
     227: dup
     228: invokespecial #77                 // Method java/lang/StringBuilder."<init>":()V
     231: ldc           #79                 // String Bad comparison:
     233: invokevirtual #83                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     236: aload_0
     237: invokevirtual #86                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     240: ldc           #88                 // String  ::
     242: invokevirtual #83                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     245: aload_1
     246: invokevirtual #86                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     249: invokevirtual #92                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     252: invokespecial #95                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     255: athrow

  public int compareTo(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #2                  // class aoc2022/Day13$Packets
       5: invokevirtual #69                 // Method compareTo:(Laoc2022/Day13$Packets;)I
       8: ireturn

  public aoc2022.Day13$Packets(kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: invokespecial #103                // Method "<init>":()V
       4: return

  static {};
    Code:
       0: new           #108                // class aoc2022/Day13$Packets$Companion
       3: dup
       4: aconst_null
       5: invokespecial #110                // Method aoc2022/Day13$Packets$Companion."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
       8: putstatic     #114                // Field Companion:Laoc2022/Day13$Packets$Companion;
      11: return
}