package com.advent.of.code.hjk

import kotlin.math.abs

object Day22 {

    private fun parse(line: String): Node? =
        "/dev/grid/node-x(?<x>\\d+)-y(?<y>\\d+)\\s+(?<size>\\d+)T\\s+(?<used>\\d+)T.+".toRegex()
            .matchEntire(line)?.destructured
            ?.let { (x, y, size, used) -> Node(x.toInt(), y.toInt(), size.toInt(), used.toInt()) }

    fun part1(input: List<String>): Int {
        val nodes = input.drop(2).mapNotNull { parse(it) }
        return nodes.flatMap { node ->
            nodes.mapNotNull { other ->
                setOf(node, other).takeIf { node != other && node.used > 0 && node.used <= other.avail }
            }
        }.toSet().size
    }

    fun part2(input: List<String>): Int {
        val nodes = input.drop(2).mapNotNull { parse(it) }.sortedByDescending { it.avail }
        val maxX = nodes.maxOf { it.x }
        val wall = nodes.filter { it.size > 250 }.minByOrNull { it.x }!!
        val emptyNode = nodes.first { it.used == 0 }
        var result = abs(emptyNode.x - wall.x) + 1
        result += emptyNode.y
        result += maxX - wall.x
        return result + (5 * (maxX - 1)) + 1
    }

    internal data class Node(val x: Int, val y: Int, val size: Int, val used: Int) {
        val avail = size - used
    }
}

Compiled from "Day22.kt"
public final class com.advent.of.code.hjk.Day22$Node {
  private final int x;

  private final int y;

  private final int size;

  private final int used;

  private final int avail;

  public com.advent.of.code.hjk.Day22$Node(int, int, int, int);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #13                 // Field x:I
       9: aload_0
      10: iload_2
      11: putfield      #16                 // Field y:I
      14: aload_0
      15: iload_3
      16: putfield      #19                 // Field size:I
      19: aload_0
      20: iload         4
      22: putfield      #22                 // Field used:I
      25: aload_0
      26: aload_0
      27: getfield      #19                 // Field size:I
      30: aload_0
      31: getfield      #22                 // Field used:I
      34: isub
      35: putfield      #25                 // Field avail:I
      38: 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

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

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

  public final int getAvail();
    Code:
       0: aload_0
       1: getfield      #25                 // Field avail:I
       4: ireturn

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

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

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

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

  public final com.advent.of.code.hjk.Day22$Node copy(int, int, int, int);
    Code:
       0: new           #2                  // class com/advent/of/code/hjk/Day22$Node
       3: dup
       4: iload_1
       5: iload_2
       6: iload_3
       7: iload         4
       9: invokespecial #42                 // Method "<init>":(IIII)V
      12: areturn

  public static com.advent.of.code.hjk.Day22$Node copy$default(com.advent.of.code.hjk.Day22$Node, int, int, int, int, int, java.lang.Object);
    Code:
       0: iload         5
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #13                 // Field x:I
      11: istore_1
      12: iload         5
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #16                 // Field y:I
      23: istore_2
      24: iload         5
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #19                 // Field size:I
      35: istore_3
      36: iload         5
      38: bipush        8
      40: iand
      41: ifeq          50
      44: aload_0
      45: getfield      #22                 // Field used:I
      48: istore        4
      50: aload_0
      51: iload_1
      52: iload_2
      53: iload_3
      54: iload         4
      56: invokevirtual #46                 // Method copy:(IIII)Lcom/advent/of/code/hjk/Day22$Node;
      59: areturn

  public java.lang.String toString();
    Code:
       0: new           #50                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #51                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #53                 // String Node(x=
       9: invokevirtual #57                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field x:I
      16: invokevirtual #60                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #62                 // String , y=
      21: invokevirtual #57                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field y:I
      28: invokevirtual #60                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: ldc           #64                 // String , size=
      33: invokevirtual #57                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #19                 // Field size:I
      40: invokevirtual #60                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      43: ldc           #66                 // String , used=
      45: invokevirtual #57                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      48: aload_0
      49: getfield      #22                 // Field used:I
      52: invokevirtual #60                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      55: bipush        41
      57: invokevirtual #69                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      60: invokevirtual #71                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      63: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field x:I
       4: invokestatic  #77                 // Method java/lang/Integer.hashCode:(I)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #16                 // Field y:I
      16: invokestatic  #77                 // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #19                 // Field size:I
      29: invokestatic  #77                 // Method java/lang/Integer.hashCode:(I)I
      32: iadd
      33: istore_1
      34: iload_1
      35: bipush        31
      37: imul
      38: aload_0
      39: getfield      #22                 // Field used:I
      42: invokestatic  #77                 // Method java/lang/Integer.hashCode:(I)I
      45: iadd
      46: istore_1
      47: iload_1
      48: 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 com/advent/of/code/hjk/Day22$Node
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class com/advent/of/code/hjk/Day22$Node
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field x:I
      25: aload_2
      26: getfield      #13                 // Field x:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #16                 // Field y:I
      38: aload_2
      39: getfield      #16                 // Field y:I
      42: if_icmpeq     47
      45: iconst_0
      46: ireturn
      47: aload_0
      48: getfield      #19                 // Field size:I
      51: aload_2
      52: getfield      #19                 // Field size:I
      55: if_icmpeq     60
      58: iconst_0
      59: ireturn
      60: aload_0
      61: getfield      #22                 // Field used:I
      64: aload_2
      65: getfield      #22                 // Field used:I
      68: if_icmpeq     73
      71: iconst_0
      72: ireturn
      73: iconst_1
      74: ireturn
}

Compiled from "Comparisons.kt"
public final class com.advent.of.code.hjk.Day22$part2$$inlined$sortedByDescending$1<T> implements java.util.Comparator {
  public com.advent.of.code.hjk.Day22$part2$$inlined$sortedByDescending$1();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_2
       1: checkcast     #23                 // class com/advent/of/code/hjk/Day22$Node
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: invokevirtual #27                 // Method com/advent/of/code/hjk/Day22$Node.getAvail:()I
      12: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      15: checkcast     #35                 // class java/lang/Comparable
      18: aload_1
      19: checkcast     #23                 // class com/advent/of/code/hjk/Day22$Node
      22: astore_3
      23: astore        5
      25: iconst_0
      26: istore        4
      28: aload_3
      29: invokevirtual #27                 // Method com/advent/of/code/hjk/Day22$Node.getAvail:()I
      32: invokestatic  #33                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      35: aload         5
      37: swap
      38: checkcast     #35                 // class java/lang/Comparable
      41: invokestatic  #41                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      44: ireturn
}

Compiled from "Day22.kt"
public final class com.advent.of.code.hjk.Day22 {
  public static final com.advent.of.code.hjk.Day22 INSTANCE;

  private com.advent.of.code.hjk.Day22();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  private final com.advent.of.code.hjk.Day22$Node parse(java.lang.String);
    Code:
       0: new           #14                 // class kotlin/text/Regex
       3: dup
       4: ldc           #16                 // String /dev/grid/node-x(?<x>\\d+)-y(?<y>\\d+)\\s+(?<size>\\d+)T\\s+(?<used>\\d+)T.+
       6: invokespecial #19                 // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
       9: aload_1
      10: checkcast     #21                 // class java/lang/CharSequence
      13: invokevirtual #25                 // Method kotlin/text/Regex.matchEntire:(Ljava/lang/CharSequence;)Lkotlin/text/MatchResult;
      16: astore_2
      17: aload_2
      18: ifnull        152
      21: aload_2
      22: invokeinterface #31,  1           // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;
      27: astore_3
      28: aload_3
      29: ifnull        152
      32: aload_3
      33: astore        4
      35: iconst_0
      36: istore        5
      38: aload         4
      40: invokevirtual #37                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
      43: invokeinterface #41,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
      48: iconst_1
      49: invokeinterface #47,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      54: checkcast     #49                 // class java/lang/String
      57: astore        6
      59: aload         4
      61: invokevirtual #37                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
      64: invokeinterface #41,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
      69: iconst_2
      70: invokeinterface #47,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      75: checkcast     #49                 // class java/lang/String
      78: astore        7
      80: aload         4
      82: invokevirtual #37                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
      85: invokeinterface #41,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
      90: iconst_3
      91: invokeinterface #47,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      96: checkcast     #49                 // class java/lang/String
      99: astore        8
     101: aload         4
     103: invokevirtual #37                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     106: invokeinterface #41,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     111: iconst_4
     112: invokeinterface #47,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     117: checkcast     #49                 // class java/lang/String
     120: astore        9
     122: new           #51                 // class com/advent/of/code/hjk/Day22$Node
     125: dup
     126: aload         6
     128: invokestatic  #57                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     131: aload         7
     133: invokestatic  #57                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     136: aload         8
     138: invokestatic  #57                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     141: aload         9
     143: invokestatic  #57                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     146: invokespecial #60                 // Method com/advent/of/code/hjk/Day22$Node."<init>":(IIII)V
     149: goto          153
     152: aconst_null
     153: areturn

  public final int part1(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #74                 // String input
       3: invokestatic  #80                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #82                 // class java/lang/Iterable
      10: iconst_2
      11: invokestatic  #88                 // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
      14: checkcast     #82                 // class java/lang/Iterable
      17: astore_3
      18: iconst_0
      19: istore        4
      21: aload_3
      22: astore        5
      24: new           #90                 // class java/util/ArrayList
      27: dup
      28: invokespecial #91                 // Method java/util/ArrayList."<init>":()V
      31: checkcast     #93                 // class java/util/Collection
      34: astore        6
      36: iconst_0
      37: istore        7
      39: aload         5
      41: astore        8
      43: iconst_0
      44: istore        9
      46: aload         8
      48: invokeinterface #97,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      53: astore        10
      55: aload         10
      57: invokeinterface #103,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      62: ifeq          126
      65: aload         10
      67: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      72: astore        11
      74: aload         11
      76: astore        12
      78: iconst_0
      79: istore        13
      81: aload         12
      83: checkcast     #49                 // class java/lang/String
      86: astore        14
      88: iconst_0
      89: istore        15
      91: getstatic     #110                // Field INSTANCE:Lcom/advent/of/code/hjk/Day22;
      94: aload         14
      96: invokespecial #112                // Method parse:(Ljava/lang/String;)Lcom/advent/of/code/hjk/Day22$Node;
      99: dup
     100: ifnull        121
     103: astore        16
     105: iconst_0
     106: istore        17
     108: aload         6
     110: aload         16
     112: invokeinterface #116,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     117: pop
     118: goto          122
     121: pop
     122: nop
     123: goto          55
     126: nop
     127: aload         6
     129: checkcast     #43                 // class java/util/List
     132: nop
     133: astore_2
     134: aload_2
     135: checkcast     #82                 // class java/lang/Iterable
     138: astore_3
     139: iconst_0
     140: istore        4
     142: aload_3
     143: astore        5
     145: new           #90                 // class java/util/ArrayList
     148: dup
     149: invokespecial #91                 // Method java/util/ArrayList."<init>":()V
     152: checkcast     #93                 // class java/util/Collection
     155: astore        6
     157: iconst_0
     158: istore        7
     160: aload         5
     162: invokeinterface #97,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     167: astore        8
     169: aload         8
     171: invokeinterface #103,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     176: ifeq          407
     179: aload         8
     181: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     186: astore        9
     188: aload         9
     190: checkcast     #51                 // class com/advent/of/code/hjk/Day22$Node
     193: astore        10
     195: iconst_0
     196: istore        11
     198: aload_2
     199: checkcast     #82                 // class java/lang/Iterable
     202: astore        12
     204: iconst_0
     205: istore        13
     207: aload         12
     209: astore        14
     211: new           #90                 // class java/util/ArrayList
     214: dup
     215: invokespecial #91                 // Method java/util/ArrayList."<init>":()V
     218: checkcast     #93                 // class java/util/Collection
     221: astore        15
     223: iconst_0
     224: istore        16
     226: aload         14
     228: astore        17
     230: iconst_0
     231: istore        18
     233: aload         17
     235: invokeinterface #97,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     240: astore        19
     242: aload         19
     244: invokeinterface #103,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     249: ifeq          383
     252: aload         19
     254: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     259: astore        20
     261: aload         20
     263: astore        21
     265: iconst_0
     266: istore        22
     268: aload         21
     270: checkcast     #51                 // class com/advent/of/code/hjk/Day22$Node
     273: astore        23
     275: iconst_0
     276: istore        24
     278: iconst_2
     279: anewarray     #51                 // class com/advent/of/code/hjk/Day22$Node
     282: astore        25
     284: aload         25
     286: iconst_0
     287: aload         10
     289: aastore
     290: aload         25
     292: iconst_1
     293: aload         23
     295: aastore
     296: aload         25
     298: invokestatic  #122                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
     301: astore        25
     303: aload         25
     305: astore        26
     307: iconst_0
     308: istore        27
     310: aload         10
     312: aload         23
     314: invokestatic  #126                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     317: ifne          345
     320: aload         10
     322: invokevirtual #130                // Method com/advent/of/code/hjk/Day22$Node.getUsed:()I
     325: ifle          345
     328: aload         10
     330: invokevirtual #130                // Method com/advent/of/code/hjk/Day22$Node.getUsed:()I
     333: aload         23
     335: invokevirtual #133                // Method com/advent/of/code/hjk/Day22$Node.getAvail:()I
     338: if_icmpgt     345
     341: iconst_1
     342: goto          346
     345: iconst_0
     346: ifeq          354
     349: aload         25
     351: goto          355
     354: aconst_null
     355: nop
     356: dup
     357: ifnull        378
     360: astore        28
     362: iconst_0
     363: istore        29
     365: aload         15
     367: aload         28
     369: invokeinterface #116,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     374: pop
     375: goto          379
     378: pop
     379: nop
     380: goto          242
     383: nop
     384: aload         15
     386: checkcast     #43                 // class java/util/List
     389: nop
     390: checkcast     #82                 // class java/lang/Iterable
     393: nop
     394: astore        10
     396: aload         6
     398: aload         10
     400: invokestatic  #137                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     403: pop
     404: goto          169
     407: aload         6
     409: checkcast     #43                 // class java/util/List
     412: nop
     413: checkcast     #82                 // class java/lang/Iterable
     416: invokestatic  #141                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     419: invokeinterface #145,  1          // InterfaceMethod java/util/Set.size:()I
     424: ireturn

  public final int part2(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #74                 // String input
       3: invokestatic  #80                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #82                 // class java/lang/Iterable
      10: iconst_2
      11: invokestatic  #88                 // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
      14: checkcast     #82                 // class java/lang/Iterable
      17: astore_3
      18: iconst_0
      19: istore        4
      21: aload_3
      22: astore        5
      24: new           #90                 // class java/util/ArrayList
      27: dup
      28: invokespecial #91                 // Method java/util/ArrayList."<init>":()V
      31: checkcast     #93                 // class java/util/Collection
      34: astore        6
      36: iconst_0
      37: istore        7
      39: aload         5
      41: astore        8
      43: iconst_0
      44: istore        9
      46: aload         8
      48: invokeinterface #97,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      53: astore        10
      55: aload         10
      57: invokeinterface #103,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      62: ifeq          126
      65: aload         10
      67: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      72: astore        11
      74: aload         11
      76: astore        12
      78: iconst_0
      79: istore        13
      81: aload         12
      83: checkcast     #49                 // class java/lang/String
      86: astore        14
      88: iconst_0
      89: istore        15
      91: getstatic     #110                // Field INSTANCE:Lcom/advent/of/code/hjk/Day22;
      94: aload         14
      96: invokespecial #112                // Method parse:(Ljava/lang/String;)Lcom/advent/of/code/hjk/Day22$Node;
      99: dup
     100: ifnull        121
     103: astore        16
     105: iconst_0
     106: istore        17
     108: aload         6
     110: aload         16
     112: invokeinterface #116,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     117: pop
     118: goto          122
     121: pop
     122: nop
     123: goto          55
     126: nop
     127: aload         6
     129: checkcast     #43                 // class java/util/List
     132: nop
     133: checkcast     #82                 // class java/lang/Iterable
     136: astore_3
     137: nop
     138: iconst_0
     139: istore        4
     141: aload_3
     142: new           #179                // class com/advent/of/code/hjk/Day22$part2$$inlined$sortedByDescending$1
     145: dup
     146: invokespecial #180                // Method com/advent/of/code/hjk/Day22$part2$$inlined$sortedByDescending$1."<init>":()V
     149: checkcast     #182                // class java/util/Comparator
     152: invokestatic  #186                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     155: astore_2
     156: aload_2
     157: checkcast     #82                 // class java/lang/Iterable
     160: invokeinterface #97,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     165: astore        5
     167: aload         5
     169: invokeinterface #103,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     174: ifne          185
     177: new           #188                // class java/util/NoSuchElementException
     180: dup
     181: invokespecial #189                // Method java/util/NoSuchElementException."<init>":()V
     184: athrow
     185: aload         5
     187: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     192: checkcast     #51                 // class com/advent/of/code/hjk/Day22$Node
     195: astore        6
     197: iconst_0
     198: istore        7
     200: aload         6
     202: invokevirtual #192                // Method com/advent/of/code/hjk/Day22$Node.getX:()I
     205: istore        6
     207: aload         5
     209: invokeinterface #103,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     214: ifeq          253
     217: aload         5
     219: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     224: checkcast     #51                 // class com/advent/of/code/hjk/Day22$Node
     227: astore        7
     229: iconst_0
     230: istore        8
     232: aload         7
     234: invokevirtual #192                // Method com/advent/of/code/hjk/Day22$Node.getX:()I
     237: istore        7
     239: iload         6
     241: iload         7
     243: if_icmpge     207
     246: iload         7
     248: istore        6
     250: goto          207
     253: iload         6
     255: istore_3
     256: aload_2
     257: checkcast     #82                 // class java/lang/Iterable
     260: astore        5
     262: iconst_0
     263: istore        6
     265: aload         5
     267: astore        7
     269: new           #90                 // class java/util/ArrayList
     272: dup
     273: invokespecial #91                 // Method java/util/ArrayList."<init>":()V
     276: checkcast     #93                 // class java/util/Collection
     279: astore        8
     281: iconst_0
     282: istore        9
     284: aload         7
     286: invokeinterface #97,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     291: astore        10
     293: aload         10
     295: invokeinterface #103,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     300: ifeq          354
     303: aload         10
     305: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     310: astore        11
     312: aload         11
     314: checkcast     #51                 // class com/advent/of/code/hjk/Day22$Node
     317: astore        12
     319: iconst_0
     320: istore        13
     322: aload         12
     324: invokevirtual #195                // Method com/advent/of/code/hjk/Day22$Node.getSize:()I
     327: sipush        250
     330: if_icmple     337
     333: iconst_1
     334: goto          338
     337: iconst_0
     338: ifeq          293
     341: aload         8
     343: aload         11
     345: invokeinterface #116,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     350: pop
     351: goto          293
     354: aload         8
     356: checkcast     #43                 // class java/util/List
     359: nop
     360: checkcast     #82                 // class java/lang/Iterable
     363: astore        5
     365: nop
     366: iconst_0
     367: istore        6
     369: aload         5
     371: invokeinterface #97,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     376: astore        7
     378: aload         7
     380: invokeinterface #103,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     385: ifne          392
     388: aconst_null
     389: goto          486
     392: aload         7
     394: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     399: astore        8
     401: aload         7
     403: invokeinterface #103,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     408: ifne          416
     411: aload         8
     413: goto          486
     416: aload         8
     418: checkcast     #51                 // class com/advent/of/code/hjk/Day22$Node
     421: astore        9
     423: iconst_0
     424: istore        10
     426: aload         9
     428: invokevirtual #192                // Method com/advent/of/code/hjk/Day22$Node.getX:()I
     431: istore        9
     433: aload         7
     435: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     440: astore        10
     442: aload         10
     444: checkcast     #51                 // class com/advent/of/code/hjk/Day22$Node
     447: astore        11
     449: iconst_0
     450: istore        12
     452: aload         11
     454: invokevirtual #192                // Method com/advent/of/code/hjk/Day22$Node.getX:()I
     457: istore        11
     459: iload         9
     461: iload         11
     463: if_icmple     474
     466: aload         10
     468: astore        8
     470: iload         11
     472: istore        9
     474: aload         7
     476: invokeinterface #103,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     481: ifne          433
     484: aload         8
     486: dup
     487: invokestatic  #199                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     490: checkcast     #51                 // class com/advent/of/code/hjk/Day22$Node
     493: astore        4
     495: aload_2
     496: checkcast     #82                 // class java/lang/Iterable
     499: astore        6
     501: iconst_0
     502: istore        7
     504: aload         6
     506: invokeinterface #97,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     511: astore        8
     513: aload         8
     515: invokeinterface #103,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     520: ifeq          563
     523: aload         8
     525: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     530: astore        9
     532: aload         9
     534: checkcast     #51                 // class com/advent/of/code/hjk/Day22$Node
     537: astore        10
     539: iconst_0
     540: istore        11
     542: aload         10
     544: invokevirtual #130                // Method com/advent/of/code/hjk/Day22$Node.getUsed:()I
     547: ifne          554
     550: iconst_1
     551: goto          555
     554: iconst_0
     555: ifeq          513
     558: aload         9
     560: goto          573
     563: new           #188                // class java/util/NoSuchElementException
     566: dup
     567: ldc           #201                // String Collection contains no element matching the predicate.
     569: invokespecial #202                // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
     572: athrow
     573: checkcast     #51                 // class com/advent/of/code/hjk/Day22$Node
     576: astore        5
     578: aload         5
     580: invokevirtual #192                // Method com/advent/of/code/hjk/Day22$Node.getX:()I
     583: aload         4
     585: invokevirtual #192                // Method com/advent/of/code/hjk/Day22$Node.getX:()I
     588: isub
     589: invokestatic  #208                // Method java/lang/Math.abs:(I)I
     592: iconst_1
     593: iadd
     594: istore        6
     596: iload         6
     598: aload         5
     600: invokevirtual #211                // Method com/advent/of/code/hjk/Day22$Node.getY:()I
     603: iadd
     604: istore        6
     606: iload         6
     608: iload_3
     609: aload         4
     611: invokevirtual #192                // Method com/advent/of/code/hjk/Day22$Node.getX:()I
     614: isub
     615: iadd
     616: istore        6
     618: iload         6
     620: iconst_5
     621: iload_3
     622: iconst_1
     623: isub
     624: imul
     625: iadd
     626: iconst_1
     627: iadd
     628: ireturn

  static {};
    Code:
       0: new           #2                  // class com/advent/of/code/hjk/Day22
       3: dup
       4: invokespecial #239                // Method "<init>":()V
       7: putstatic     #110                // Field INSTANCE:Lcom/advent/of/code/hjk/Day22;
      10: return
}


package com.advent.of.code.hjk

import java.util.ArrayDeque

object Day24 {

    private fun parse(input: List<String>): List<List<Position>> = input.indices.map { y ->
        input[0].indices.map { x -> Position(x = x, y = y, value = input[y][x].toString()) }
    }

    private fun Position.from(other: Position, board: List<List<Position>>): Int {
        val seen = mutableMapOf(this to 0)
        val queue = ArrayDeque<Position>().also { it.add(this) }
        while (queue.isNotEmpty()) {
            val current = queue.pop()
            val distance = seen.getValue(current)
            if (current == other) return distance
            listOf(
                board[current.y][current.x - 1],
                board[current.y][current.x + 1],
                board[current.y - 1][current.x],
                board[current.y + 1][current.x]
            ).filter { it.isValid && !it.isWall && it !in seen }.let { neighbors ->
                seen.putAll(neighbors.map { it to distance + 1 })
                queue.addAll(neighbors)
            }
        }
        return 0
    }

    private fun mapDistances(map: List<List<Position>>): Map<Pair<Int, Int>, Int> {
        val targets = map.flatMap { r -> r.mapNotNull { p -> p.n?.let { it to p } } }.toMap()
        return targets.flatMap { (target, position) ->
            targets.filter { it.key > target }.flatMap { (otherTarget, otherPosition) ->
                val distance = position.from(otherPosition, map)
                listOf(target to otherTarget, otherTarget to target).map { it to distance }
            }
        }.toMap()
    }

    private fun shortestPath(map: List<List<Position>>, isReturning: Boolean): Int {
        val (targets, distances) = mapDistances(map).let { it.keys.flatMap { (a, b) -> listOf(a, b) }.toSet() to it }
        fun move(leftover: Set<Int>, current: Int, steps: Int): Int =
            if (leftover.isEmpty()) steps + (distances.getValue(current to 0).takeIf { isReturning } ?: 0)
            else targets.filter { it in leftover }
                .minOf { move(leftover - it, it, steps + distances.getValue(current to it)) }
        return move(targets - 0, 0, 0)
    }

    fun part1(input: List<String>): Int = shortestPath(parse(input), false)

    fun part2(input: List<String>): Int = shortestPath(parse(input), true)

    private data class Position(val x: Int, val y: Int, val value: String) {
        val isValid = x >= 0 && y >= 0
        val isWall = value == "#"
        val n = try {
            value.toInt()
        } catch (e: NumberFormatException) {
            null
        }
    }
}

Compiled from "Day24.kt"
final class com.advent.of.code.hjk.Day24$Position {
  private final int x;

  private final int y;

  private final java.lang.String value;

  private final boolean isValid;

  private final boolean isWall;

  private final java.lang.Integer n;

  public com.advent.of.code.hjk.Day24$Position(int, int, java.lang.String);
    Code:
       0: aload_3
       1: ldc           #11                 // String value
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #20                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: iload_1
      12: putfield      #24                 // Field x:I
      15: aload_0
      16: iload_2
      17: putfield      #27                 // Field y:I
      20: aload_0
      21: aload_3
      22: putfield      #30                 // Field value:Ljava/lang/String;
      25: aload_0
      26: aload_0
      27: getfield      #24                 // Field x:I
      30: iflt          44
      33: aload_0
      34: getfield      #27                 // Field y:I
      37: iflt          44
      40: iconst_1
      41: goto          45
      44: iconst_0
      45: putfield      #34                 // Field isValid:Z
      48: aload_0
      49: aload_0
      50: getfield      #30                 // Field value:Ljava/lang/String;
      53: ldc           #36                 // String #
      55: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      58: putfield      #43                 // Field isWall:Z
      61: aload_0
      62: astore        6
      64: nop
      65: aload         6
      67: aload_0
      68: getfield      #30                 // Field value:Ljava/lang/String;
      71: invokestatic  #49                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      74: invokestatic  #53                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      77: astore        4
      79: goto          89
      82: astore        5
      84: aload         6
      86: aconst_null
      87: astore        4
      89: aload         4
      91: putfield      #57                 // Field n:Ljava/lang/Integer;
      94: return
    Exception table:
       from    to  target type
          64    79    82   Class java/lang/NumberFormatException

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

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

  public final java.lang.String getValue();
    Code:
       0: aload_0
       1: getfield      #30                 // Field value:Ljava/lang/String;
       4: areturn

  public final boolean isValid();
    Code:
       0: aload_0
       1: getfield      #34                 // Field isValid:Z
       4: ireturn

  public final boolean isWall();
    Code:
       0: aload_0
       1: getfield      #43                 // Field isWall:Z
       4: ireturn

  public final java.lang.Integer getN();
    Code:
       0: aload_0
       1: getfield      #57                 // Field n:Ljava/lang/Integer;
       4: areturn

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

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

  public final java.lang.String component3();
    Code:
       0: aload_0
       1: getfield      #30                 // Field value:Ljava/lang/String;
       4: areturn

  public final com.advent.of.code.hjk.Day24$Position copy(int, int, java.lang.String);
    Code:
       0: aload_3
       1: ldc           #11                 // String value
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class com/advent/of/code/hjk/Day24$Position
       9: dup
      10: iload_1
      11: iload_2
      12: aload_3
      13: invokespecial #79                 // Method "<init>":(IILjava/lang/String;)V
      16: areturn

  public static com.advent.of.code.hjk.Day24$Position copy$default(com.advent.of.code.hjk.Day24$Position, int, int, java.lang.String, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #24                 // Field x:I
      11: istore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #27                 // Field y:I
      23: istore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #30                 // Field value:Ljava/lang/String;
      35: astore_3
      36: aload_0
      37: iload_1
      38: iload_2
      39: aload_3
      40: invokevirtual #83                 // Method copy:(IILjava/lang/String;)Lcom/advent/of/code/hjk/Day24$Position;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #86                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #87                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #89                 // String Position(x=
       9: invokevirtual #93                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #24                 // Field x:I
      16: invokevirtual #96                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #98                 // String , y=
      21: invokevirtual #93                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #27                 // Field y:I
      28: invokevirtual #96                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: ldc           #100                // String , value=
      33: invokevirtual #93                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #30                 // Field value:Ljava/lang/String;
      40: invokevirtual #93                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #103                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #105                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #24                 // Field x:I
       4: invokestatic  #109                // Method java/lang/Integer.hashCode:(I)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #27                 // Field y:I
      16: invokestatic  #109                // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #30                 // Field value:Ljava/lang/String;
      29: invokevirtual #111                // Method java/lang/String.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 com/advent/of/code/hjk/Day24$Position
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class com/advent/of/code/hjk/Day24$Position
      20: astore_2
      21: aload_0
      22: getfield      #24                 // Field x:I
      25: aload_2
      26: getfield      #24                 // Field x:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #27                 // Field y:I
      38: aload_2
      39: getfield      #27                 // Field y:I
      42: if_icmpeq     47
      45: iconst_0
      46: ireturn
      47: aload_0
      48: getfield      #30                 // Field value:Ljava/lang/String;
      51: aload_2
      52: getfield      #30                 // Field value:Ljava/lang/String;
      55: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      58: ifne          63
      61: iconst_0
      62: ireturn
      63: iconst_1
      64: ireturn
}

Compiled from "Day24.kt"
public final class com.advent.of.code.hjk.Day24 {
  public static final com.advent.of.code.hjk.Day24 INSTANCE;

  private com.advent.of.code.hjk.Day24();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  private final java.util.List<java.util.List<com.advent.of.code.hjk.Day24$Position>> parse(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: checkcast     #15                 // class java/util/Collection
       4: invokestatic  #21                 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;
       7: checkcast     #23                 // class java/lang/Iterable
      10: astore_2
      11: iconst_0
      12: istore_3
      13: aload_2
      14: astore        4
      16: new           #25                 // class java/util/ArrayList
      19: dup
      20: aload_2
      21: bipush        10
      23: invokestatic  #29                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      26: invokespecial #32                 // Method java/util/ArrayList."<init>":(I)V
      29: checkcast     #15                 // class java/util/Collection
      32: astore        5
      34: iconst_0
      35: istore        6
      37: aload         4
      39: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      44: astore        7
      46: aload         7
      48: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      53: ifeq          225
      56: aload         7
      58: checkcast     #44                 // class kotlin/collections/IntIterator
      61: invokevirtual #48                 // Method kotlin/collections/IntIterator.nextInt:()I
      64: istore        8
      66: aload         5
      68: iload         8
      70: istore        9
      72: astore        21
      74: iconst_0
      75: istore        10
      77: aload_1
      78: iconst_0
      79: invokeinterface #54,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      84: checkcast     #56                 // class java/lang/CharSequence
      87: invokestatic  #61                 // Method kotlin/text/StringsKt.getIndices:(Ljava/lang/CharSequence;)Lkotlin/ranges/IntRange;
      90: checkcast     #23                 // class java/lang/Iterable
      93: astore        11
      95: iconst_0
      96: istore        12
      98: aload         11
     100: astore        13
     102: new           #25                 // class java/util/ArrayList
     105: dup
     106: aload         11
     108: bipush        10
     110: invokestatic  #29                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     113: invokespecial #32                 // Method java/util/ArrayList."<init>":(I)V
     116: checkcast     #15                 // class java/util/Collection
     119: astore        14
     121: iconst_0
     122: istore        15
     124: aload         13
     126: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     131: astore        16
     133: aload         16
     135: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     140: ifeq          206
     143: aload         16
     145: checkcast     #44                 // class kotlin/collections/IntIterator
     148: invokevirtual #48                 // Method kotlin/collections/IntIterator.nextInt:()I
     151: istore        17
     153: aload         14
     155: iload         17
     157: istore        18
     159: astore        19
     161: iconst_0
     162: istore        20
     164: new           #63                 // class com/advent/of/code/hjk/Day24$Position
     167: dup
     168: iload         18
     170: iload         9
     172: aload_1
     173: iload         9
     175: invokeinterface #54,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     180: checkcast     #65                 // class java/lang/String
     183: iload         18
     185: invokevirtual #69                 // Method java/lang/String.charAt:(I)C
     188: invokestatic  #73                 // Method java/lang/String.valueOf:(C)Ljava/lang/String;
     191: invokespecial #76                 // Method com/advent/of/code/hjk/Day24$Position."<init>":(IILjava/lang/String;)V
     194: aload         19
     196: swap
     197: invokeinterface #80,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     202: pop
     203: goto          133
     206: aload         14
     208: checkcast     #50                 // class java/util/List
     211: nop
     212: nop
     213: aload         21
     215: swap
     216: invokeinterface #80,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     221: pop
     222: goto          46
     225: aload         5
     227: checkcast     #50                 // class java/util/List
     230: nop
     231: areturn

  private final int from(com.advent.of.code.hjk.Day24$Position, com.advent.of.code.hjk.Day24$Position, java.util.List<? extends java.util.List<com.advent.of.code.hjk.Day24$Position>>);
    Code:
       0: iconst_1
       1: anewarray     #100                // class kotlin/Pair
       4: astore        5
       6: aload         5
       8: iconst_0
       9: aload_1
      10: iconst_0
      11: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      14: invokestatic  #111                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      17: aastore
      18: aload         5
      20: invokestatic  #117                // Method kotlin/collections/MapsKt.mutableMapOf:([Lkotlin/Pair;)Ljava/util/Map;
      23: astore        4
      25: new           #119                // class java/util/ArrayDeque
      28: dup
      29: invokespecial #120                // Method java/util/ArrayDeque."<init>":()V
      32: astore        6
      34: aload         6
      36: astore        7
      38: iconst_0
      39: istore        8
      41: aload         7
      43: aload_1
      44: invokevirtual #121                // Method java/util/ArrayDeque.add:(Ljava/lang/Object;)Z
      47: pop
      48: aload         6
      50: astore        5
      52: aload         5
      54: checkcast     #15                 // class java/util/Collection
      57: invokeinterface #124,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      62: ifne          69
      65: iconst_1
      66: goto          70
      69: iconst_0
      70: ifeq          502
      73: aload         5
      75: invokevirtual #128                // Method java/util/ArrayDeque.pop:()Ljava/lang/Object;
      78: checkcast     #63                 // class com/advent/of/code/hjk/Day24$Position
      81: astore        6
      83: aload         4
      85: aload         6
      87: invokestatic  #132                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
      90: checkcast     #134                // class java/lang/Number
      93: invokevirtual #137                // Method java/lang/Number.intValue:()I
      96: istore        7
      98: aload         6
     100: aload_2
     101: invokestatic  #143                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     104: ifeq          110
     107: iload         7
     109: ireturn
     110: iconst_4
     111: anewarray     #63                 // class com/advent/of/code/hjk/Day24$Position
     114: astore        8
     116: aload         8
     118: iconst_0
     119: aload_3
     120: aload         6
     122: invokevirtual #146                // Method com/advent/of/code/hjk/Day24$Position.getY:()I
     125: invokeinterface #54,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     130: checkcast     #50                 // class java/util/List
     133: aload         6
     135: invokevirtual #149                // Method com/advent/of/code/hjk/Day24$Position.getX:()I
     138: iconst_1
     139: isub
     140: invokeinterface #54,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     145: aastore
     146: aload         8
     148: iconst_1
     149: aload_3
     150: aload         6
     152: invokevirtual #146                // Method com/advent/of/code/hjk/Day24$Position.getY:()I
     155: invokeinterface #54,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     160: checkcast     #50                 // class java/util/List
     163: aload         6
     165: invokevirtual #149                // Method com/advent/of/code/hjk/Day24$Position.getX:()I
     168: iconst_1
     169: iadd
     170: invokeinterface #54,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     175: aastore
     176: aload         8
     178: iconst_2
     179: aload_3
     180: aload         6
     182: invokevirtual #146                // Method com/advent/of/code/hjk/Day24$Position.getY:()I
     185: iconst_1
     186: isub
     187: invokeinterface #54,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     192: checkcast     #50                 // class java/util/List
     195: aload         6
     197: invokevirtual #149                // Method com/advent/of/code/hjk/Day24$Position.getX:()I
     200: invokeinterface #54,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     205: aastore
     206: aload         8
     208: iconst_3
     209: aload_3
     210: aload         6
     212: invokevirtual #146                // Method com/advent/of/code/hjk/Day24$Position.getY:()I
     215: iconst_1
     216: iadd
     217: invokeinterface #54,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     222: checkcast     #50                 // class java/util/List
     225: aload         6
     227: invokevirtual #149                // Method com/advent/of/code/hjk/Day24$Position.getX:()I
     230: invokeinterface #54,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     235: aastore
     236: aload         8
     238: invokestatic  #153                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     241: checkcast     #23                 // class java/lang/Iterable
     244: astore        8
     246: nop
     247: iconst_0
     248: istore        9
     250: aload         8
     252: astore        10
     254: new           #25                 // class java/util/ArrayList
     257: dup
     258: invokespecial #154                // Method java/util/ArrayList."<init>":()V
     261: checkcast     #15                 // class java/util/Collection
     264: astore        11
     266: iconst_0
     267: istore        12
     269: aload         10
     271: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     276: astore        13
     278: aload         13
     280: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     285: ifeq          356
     288: aload         13
     290: invokeinterface #157,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     295: astore        14
     297: aload         14
     299: checkcast     #63                 // class com/advent/of/code/hjk/Day24$Position
     302: astore        15
     304: iconst_0
     305: istore        16
     307: aload         15
     309: invokevirtual #160                // Method com/advent/of/code/hjk/Day24$Position.isValid:()Z
     312: ifeq          339
     315: aload         15
     317: invokevirtual #163                // Method com/advent/of/code/hjk/Day24$Position.isWall:()Z
     320: ifne          339
     323: aload         4
     325: aload         15
     327: invokeinterface #168,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
     332: ifne          339
     335: iconst_1
     336: goto          340
     339: iconst_0
     340: ifeq          278
     343: aload         11
     345: aload         14
     347: invokeinterface #80,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     352: pop
     353: goto          278
     356: aload         11
     358: checkcast     #50                 // class java/util/List
     361: nop
     362: astore        9
     364: iconst_0
     365: istore        10
     367: aload         4
     369: aload         9
     371: checkcast     #23                 // class java/lang/Iterable
     374: astore        11
     376: astore        12
     378: iconst_0
     379: istore        13
     381: aload         11
     383: astore        14
     385: new           #25                 // class java/util/ArrayList
     388: dup
     389: aload         11
     391: bipush        10
     393: invokestatic  #29                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     396: invokespecial #32                 // Method java/util/ArrayList."<init>":(I)V
     399: checkcast     #15                 // class java/util/Collection
     402: astore        15
     404: iconst_0
     405: istore        16
     407: aload         14
     409: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     414: astore        17
     416: aload         17
     418: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     423: ifeq          473
     426: aload         17
     428: invokeinterface #157,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     433: astore        18
     435: aload         15
     437: aload         18
     439: checkcast     #63                 // class com/advent/of/code/hjk/Day24$Position
     442: astore        19
     444: astore        20
     446: iconst_0
     447: istore        21
     449: aload         19
     451: iload         7
     453: iconst_1
     454: iadd
     455: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     458: invokestatic  #111                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     461: aload         20
     463: swap
     464: invokeinterface #80,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     469: pop
     470: goto          416
     473: aload         15
     475: checkcast     #50                 // class java/util/List
     478: nop
     479: aload         12
     481: swap
     482: checkcast     #23                 // class java/lang/Iterable
     485: invokestatic  #172                // Method kotlin/collections/MapsKt.putAll:(Ljava/util/Map;Ljava/lang/Iterable;)V
     488: aload         5
     490: aload         9
     492: checkcast     #15                 // class java/util/Collection
     495: invokevirtual #176                // Method java/util/ArrayDeque.addAll:(Ljava/util/Collection;)Z
     498: pop
     499: goto          52
     502: iconst_0
     503: ireturn

  private final java.util.Map<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Integer> mapDistances(java.util.List<? extends java.util.List<com.advent.of.code.hjk.Day24$Position>>);
    Code:
       0: aload_1
       1: checkcast     #23                 // class java/lang/Iterable
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: astore        5
      11: new           #25                 // class java/util/ArrayList
      14: dup
      15: invokespecial #154                // Method java/util/ArrayList."<init>":()V
      18: checkcast     #15                 // class java/util/Collection
      21: astore        6
      23: iconst_0
      24: istore        7
      26: aload         5
      28: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      33: astore        8
      35: aload         8
      37: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      42: ifeq          231
      45: aload         8
      47: invokeinterface #157,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      52: astore        9
      54: aload         9
      56: checkcast     #50                 // class java/util/List
      59: astore        10
      61: iconst_0
      62: istore        11
      64: aload         10
      66: checkcast     #23                 // class java/lang/Iterable
      69: astore        12
      71: iconst_0
      72: istore        13
      74: aload         12
      76: astore        14
      78: new           #25                 // class java/util/ArrayList
      81: dup
      82: invokespecial #154                // Method java/util/ArrayList."<init>":()V
      85: checkcast     #15                 // class java/util/Collection
      88: astore        15
      90: iconst_0
      91: istore        16
      93: aload         14
      95: astore        17
      97: iconst_0
      98: istore        18
     100: aload         17
     102: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     107: astore        19
     109: aload         19
     111: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     116: ifeq          207
     119: aload         19
     121: invokeinterface #157,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     126: astore        20
     128: aload         20
     130: astore        21
     132: iconst_0
     133: istore        22
     135: aload         21
     137: checkcast     #63                 // class com/advent/of/code/hjk/Day24$Position
     140: astore        23
     142: iconst_0
     143: istore        24
     145: aload         23
     147: invokevirtual #205                // Method com/advent/of/code/hjk/Day24$Position.getN:()Ljava/lang/Integer;
     150: dup
     151: ifnull        178
     154: checkcast     #134                // class java/lang/Number
     157: invokevirtual #137                // Method java/lang/Number.intValue:()I
     160: istore        25
     162: iconst_0
     163: istore        26
     165: iload         25
     167: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     170: aload         23
     172: invokestatic  #111                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     175: goto          180
     178: pop
     179: aconst_null
     180: dup
     181: ifnull        202
     184: astore        27
     186: iconst_0
     187: istore        28
     189: aload         15
     191: aload         27
     193: invokeinterface #80,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     198: pop
     199: goto          203
     202: pop
     203: nop
     204: goto          109
     207: nop
     208: aload         15
     210: checkcast     #50                 // class java/util/List
     213: nop
     214: checkcast     #23                 // class java/lang/Iterable
     217: nop
     218: astore        10
     220: aload         6
     222: aload         10
     224: invokestatic  #208                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     227: pop
     228: goto          35
     231: aload         6
     233: checkcast     #50                 // class java/util/List
     236: nop
     237: checkcast     #23                 // class java/lang/Iterable
     240: invokestatic  #212                // Method kotlin/collections/MapsKt.toMap:(Ljava/lang/Iterable;)Ljava/util/Map;
     243: astore_2
     244: aload_2
     245: astore_3
     246: iconst_0
     247: istore        4
     249: aload_3
     250: astore        5
     252: new           #25                 // class java/util/ArrayList
     255: dup
     256: invokespecial #154                // Method java/util/ArrayList."<init>":()V
     259: checkcast     #15                 // class java/util/Collection
     262: astore        6
     264: iconst_0
     265: istore        7
     267: aload         5
     269: invokeinterface #216,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     274: invokeinterface #219,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     279: astore        8
     281: aload         8
     283: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     288: ifeq          756
     291: aload         8
     293: invokeinterface #157,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     298: checkcast     #221                // class java/util/Map$Entry
     301: astore        9
     303: aload         9
     305: astore        10
     307: iconst_0
     308: istore        11
     310: aload         10
     312: invokeinterface #224,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     317: checkcast     #134                // class java/lang/Number
     320: invokevirtual #137                // Method java/lang/Number.intValue:()I
     323: istore        12
     325: aload         10
     327: invokeinterface #226,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     332: checkcast     #63                 // class com/advent/of/code/hjk/Day24$Position
     335: astore        13
     337: aload_2
     338: astore        14
     340: iconst_0
     341: istore        15
     343: aload         14
     345: astore        16
     347: new           #228                // class java/util/LinkedHashMap
     350: dup
     351: invokespecial #229                // Method java/util/LinkedHashMap."<init>":()V
     354: checkcast     #165                // class java/util/Map
     357: astore        17
     359: iconst_0
     360: istore        18
     362: aload         16
     364: invokeinterface #216,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     369: invokeinterface #219,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     374: astore        19
     376: aload         19
     378: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     383: ifeq          456
     386: aload         19
     388: invokeinterface #157,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     393: checkcast     #221                // class java/util/Map$Entry
     396: astore        20
     398: aload         20
     400: astore        21
     402: iconst_0
     403: istore        22
     405: aload         21
     407: invokeinterface #224,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     412: checkcast     #134                // class java/lang/Number
     415: invokevirtual #137                // Method java/lang/Number.intValue:()I
     418: iload         12
     420: if_icmple     427
     423: iconst_1
     424: goto          428
     427: iconst_0
     428: ifeq          376
     431: aload         17
     433: aload         20
     435: invokeinterface #224,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     440: aload         20
     442: invokeinterface #226,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     447: invokeinterface #233,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     452: pop
     453: goto          376
     456: aload         17
     458: nop
     459: astore        14
     461: nop
     462: iconst_0
     463: istore        15
     465: aload         14
     467: astore        16
     469: new           #25                 // class java/util/ArrayList
     472: dup
     473: invokespecial #154                // Method java/util/ArrayList."<init>":()V
     476: checkcast     #15                 // class java/util/Collection
     479: astore        17
     481: iconst_0
     482: istore        18
     484: aload         16
     486: invokeinterface #216,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     491: invokeinterface #219,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     496: astore        19
     498: aload         19
     500: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     505: ifeq          733
     508: aload         19
     510: invokeinterface #157,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     515: checkcast     #221                // class java/util/Map$Entry
     518: astore        20
     520: aload         20
     522: astore        21
     524: iconst_0
     525: istore        22
     527: aload         21
     529: invokeinterface #224,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     534: checkcast     #134                // class java/lang/Number
     537: invokevirtual #137                // Method java/lang/Number.intValue:()I
     540: istore        23
     542: aload         21
     544: invokeinterface #226,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     549: checkcast     #63                 // class com/advent/of/code/hjk/Day24$Position
     552: astore        24
     554: getstatic     #236                // Field INSTANCE:Lcom/advent/of/code/hjk/Day24;
     557: aload         13
     559: aload         24
     561: aload_1
     562: invokespecial #238                // Method from:(Lcom/advent/of/code/hjk/Day24$Position;Lcom/advent/of/code/hjk/Day24$Position;Ljava/util/List;)I
     565: istore        25
     567: iconst_2
     568: anewarray     #100                // class kotlin/Pair
     571: astore        26
     573: aload         26
     575: iconst_0
     576: iload         12
     578: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     581: iload         23
     583: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     586: invokestatic  #111                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     589: aastore
     590: aload         26
     592: iconst_1
     593: iload         23
     595: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     598: iload         12
     600: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     603: invokestatic  #111                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     606: aastore
     607: aload         26
     609: invokestatic  #153                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     612: checkcast     #23                 // class java/lang/Iterable
     615: astore        26
     617: iconst_0
     618: istore        27
     620: aload         26
     622: astore        28
     624: new           #25                 // class java/util/ArrayList
     627: dup
     628: aload         26
     630: bipush        10
     632: invokestatic  #29                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     635: invokespecial #32                 // Method java/util/ArrayList."<init>":(I)V
     638: checkcast     #15                 // class java/util/Collection
     641: astore        29
     643: iconst_0
     644: istore        30
     646: aload         28
     648: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     653: astore        31
     655: aload         31
     657: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     662: ifeq          710
     665: aload         31
     667: invokeinterface #157,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     672: astore        32
     674: aload         29
     676: aload         32
     678: checkcast     #100                // class kotlin/Pair
     681: astore        33
     683: astore        34
     685: iconst_0
     686: istore        35
     688: aload         33
     690: iload         25
     692: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     695: invokestatic  #111                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     698: aload         34
     700: swap
     701: invokeinterface #80,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     706: pop
     707: goto          655
     710: aload         29
     712: checkcast     #50                 // class java/util/List
     715: nop
     716: checkcast     #23                 // class java/lang/Iterable
     719: nop
     720: astore        36
     722: aload         17
     724: aload         36
     726: invokestatic  #208                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     729: pop
     730: goto          498
     733: aload         17
     735: checkcast     #50                 // class java/util/List
     738: nop
     739: checkcast     #23                 // class java/lang/Iterable
     742: nop
     743: astore        10
     745: aload         6
     747: aload         10
     749: invokestatic  #208                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     752: pop
     753: goto          281
     756: aload         6
     758: checkcast     #50                 // class java/util/List
     761: nop
     762: checkcast     #23                 // class java/lang/Iterable
     765: invokestatic  #212                // Method kotlin/collections/MapsKt.toMap:(Ljava/lang/Iterable;)Ljava/util/Map;
     768: areturn

  private final int shortestPath(java.util.List<? extends java.util.List<com.advent.of.code.hjk.Day24$Position>>, boolean);
    Code:
       0: aload_0
       1: aload_1
       2: invokespecial #275                // Method mapDistances:(Ljava/util/List;)Ljava/util/Map;
       5: astore        5
       7: iconst_0
       8: istore        6
      10: aload         5
      12: invokeinterface #278,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
      17: checkcast     #23                 // class java/lang/Iterable
      20: astore        7
      22: iconst_0
      23: istore        8
      25: aload         7
      27: astore        9
      29: new           #25                 // class java/util/ArrayList
      32: dup
      33: invokespecial #154                // Method java/util/ArrayList."<init>":()V
      36: checkcast     #15                 // class java/util/Collection
      39: astore        10
      41: iconst_0
      42: istore        11
      44: aload         9
      46: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      51: astore        12
      53: aload         12
      55: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      60: ifeq          153
      63: aload         12
      65: invokeinterface #157,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      70: astore        13
      72: aload         13
      74: checkcast     #100                // class kotlin/Pair
      77: astore        14
      79: iconst_0
      80: istore        15
      82: aload         14
      84: invokevirtual #281                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      87: checkcast     #134                // class java/lang/Number
      90: invokevirtual #137                // Method java/lang/Number.intValue:()I
      93: istore        16
      95: aload         14
      97: invokevirtual #284                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     100: checkcast     #134                // class java/lang/Number
     103: invokevirtual #137                // Method java/lang/Number.intValue:()I
     106: istore        17
     108: iconst_2
     109: anewarray     #102                // class java/lang/Integer
     112: astore        18
     114: aload         18
     116: iconst_0
     117: iload         16
     119: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     122: aastore
     123: aload         18
     125: iconst_1
     126: iload         17
     128: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     131: aastore
     132: aload         18
     134: invokestatic  #153                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     137: checkcast     #23                 // class java/lang/Iterable
     140: astore        14
     142: aload         10
     144: aload         14
     146: invokestatic  #208                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     149: pop
     150: goto          53
     153: aload         10
     155: checkcast     #50                 // class java/util/List
     158: nop
     159: checkcast     #23                 // class java/lang/Iterable
     162: invokestatic  #288                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     165: aload         5
     167: invokestatic  #111                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     170: nop
     171: astore_3
     172: aload_3
     173: invokevirtual #281                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     176: checkcast     #218                // class java/util/Set
     179: astore        4
     181: aload_3
     182: invokevirtual #284                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     185: checkcast     #165                // class java/util/Map
     188: astore        5
     190: aload         5
     192: aload         4
     194: iload_2
     195: aload         4
     197: iconst_0
     198: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     201: invokestatic  #294                // Method kotlin/collections/SetsKt.minus:(Ljava/util/Set;Ljava/lang/Object;)Ljava/util/Set;
     204: iconst_0
     205: iconst_0
     206: invokestatic  #298                // Method shortestPath$move:(Ljava/util/Map;Ljava/util/Set;ZLjava/util/Set;II)I
     209: ireturn

  public final int part1(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc_w         #311                // String input
       4: invokestatic  #315                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: aload_0
       9: aload_1
      10: invokespecial #317                // Method parse:(Ljava/util/List;)Ljava/util/List;
      13: iconst_0
      14: invokespecial #319                // Method shortestPath:(Ljava/util/List;Z)I
      17: ireturn

  public final int part2(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc_w         #311                // String input
       4: invokestatic  #315                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: aload_0
       9: aload_1
      10: invokespecial #317                // Method parse:(Ljava/util/List;)Ljava/util/List;
      13: iconst_1
      14: invokespecial #319                // Method shortestPath:(Ljava/util/List;Z)I
      17: ireturn

  private static final int shortestPath$move(java.util.Map<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Integer>, java.util.Set<java.lang.Integer>, boolean, java.util.Set<java.lang.Integer>, int, int);
    Code:
       0: aload_3
       1: invokeinterface #322,  1          // InterfaceMethod java/util/Set.isEmpty:()Z
       6: ifeq          79
       9: iload         5
      11: aload_0
      12: iload         4
      14: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      17: iconst_0
      18: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      21: invokestatic  #111                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      24: invokestatic  #132                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
      27: astore        7
      29: aload         7
      31: checkcast     #134                // class java/lang/Number
      34: invokevirtual #137                // Method java/lang/Number.intValue:()I
      37: istore        8
      39: istore        15
      41: iconst_0
      42: istore        9
      44: iload_2
      45: istore        16
      47: iload         15
      49: iload         16
      51: ifeq          59
      54: aload         7
      56: goto          60
      59: aconst_null
      60: checkcast     #102                // class java/lang/Integer
      63: dup
      64: ifnull        73
      67: invokevirtual #323                // Method java/lang/Integer.intValue:()I
      70: goto          75
      73: pop
      74: iconst_0
      75: iadd
      76: goto          361
      79: aload_1
      80: checkcast     #23                 // class java/lang/Iterable
      83: astore        6
      85: iconst_0
      86: istore        7
      88: aload         6
      90: astore        8
      92: new           #25                 // class java/util/ArrayList
      95: dup
      96: invokespecial #154                // Method java/util/ArrayList."<init>":()V
      99: checkcast     #15                 // class java/util/Collection
     102: astore        9
     104: iconst_0
     105: istore        10
     107: aload         8
     109: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     114: astore        11
     116: aload         11
     118: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     123: ifeq          175
     126: aload         11
     128: invokeinterface #157,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     133: astore        12
     135: aload         12
     137: checkcast     #134                // class java/lang/Number
     140: invokevirtual #137                // Method java/lang/Number.intValue:()I
     143: istore        13
     145: iconst_0
     146: istore        14
     148: aload_3
     149: iload         13
     151: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     154: invokeinterface #326,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     159: ifeq          116
     162: aload         9
     164: aload         12
     166: invokeinterface #80,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     171: pop
     172: goto          116
     175: aload         9
     177: checkcast     #50                 // class java/util/List
     180: nop
     181: checkcast     #23                 // class java/lang/Iterable
     184: invokeinterface #36,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     189: astore        7
     191: aload         7
     193: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     198: ifne          209
     201: new           #328                // class java/util/NoSuchElementException
     204: dup
     205: invokespecial #329                // Method java/util/NoSuchElementException."<init>":()V
     208: athrow
     209: aload         7
     211: invokeinterface #157,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     216: checkcast     #134                // class java/lang/Number
     219: invokevirtual #137                // Method java/lang/Number.intValue:()I
     222: istore        8
     224: iconst_0
     225: istore        9
     227: aload_0
     228: aload_1
     229: iload_2
     230: aload_3
     231: iload         8
     233: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     236: invokestatic  #294                // Method kotlin/collections/SetsKt.minus:(Ljava/util/Set;Ljava/lang/Object;)Ljava/util/Set;
     239: iload         8
     241: iload         5
     243: aload_0
     244: iload         4
     246: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     249: iload         8
     251: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     254: invokestatic  #111                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     257: invokestatic  #132                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
     260: checkcast     #134                // class java/lang/Number
     263: invokevirtual #137                // Method java/lang/Number.intValue:()I
     266: iadd
     267: invokestatic  #298                // Method shortestPath$move:(Ljava/util/Map;Ljava/util/Set;ZLjava/util/Set;II)I
     270: istore        8
     272: aload         7
     274: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     279: ifeq          359
     282: aload         7
     284: invokeinterface #157,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     289: checkcast     #134                // class java/lang/Number
     292: invokevirtual #137                // Method java/lang/Number.intValue:()I
     295: istore        9
     297: iconst_0
     298: istore        10
     300: aload_0
     301: aload_1
     302: iload_2
     303: aload_3
     304: iload         9
     306: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     309: invokestatic  #294                // Method kotlin/collections/SetsKt.minus:(Ljava/util/Set;Ljava/lang/Object;)Ljava/util/Set;
     312: iload         9
     314: iload         5
     316: aload_0
     317: iload         4
     319: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     322: iload         9
     324: invokestatic  #105                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     327: invokestatic  #111                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     330: invokestatic  #132                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
     333: checkcast     #134                // class java/lang/Number
     336: invokevirtual #137                // Method java/lang/Number.intValue:()I
     339: iadd
     340: invokestatic  #298                // Method shortestPath$move:(Ljava/util/Map;Ljava/util/Set;ZLjava/util/Set;II)I
     343: istore        9
     345: iload         8
     347: iload         9
     349: if_icmple     272
     352: iload         9
     354: istore        8
     356: goto          272
     359: iload         8
     361: ireturn

  static {};
    Code:
       0: new           #2                  // class com/advent/of/code/hjk/Day24
       3: dup
       4: invokespecial #337                // Method "<init>":()V
       7: putstatic     #236                // Field INSTANCE:Lcom/advent/of/code/hjk/Day24;
      10: return
}