import java.util.*

object Day16 {
    const val EXPECTED_PART1_CHECK_ANSWER = 1651
    const val EXPECTED_PART2_CHECK_ANSWER = 1707

    const val START_VALVE_NAME = "AA"

    const val RUNTIME_MINS_PART1 = 30
    const val RUNTIME_MINS_PART2 = 26
}

data class Valve(val name: String, val flowRate: Int) {
    private var _accessibleValves: Set<Valve> = emptySet()

    val accessibleValves
        get() = _accessibleValves

    fun addAccessibleValve(valve: Valve) {
        _accessibleValves += valve
    }
}

fun main() {

    fun List<String>.parseValves(): MutableMap<String, Valve> {
        val paths = mutableMapOf<String, List<String>>()
        val valves = mutableMapOf<String, Valve>()
        forEach { valveString ->
            val (name, flowRate, accessibleValves) = Regex(
                "Valve (.+) has flow rate=(\\d+); tunnels? leads? to valves? (.*)"
            )
                .matchEntire(valveString)?.destructured ?: error("Valve line not matched")
            if (valves.contains(name)) error("Duplicate valve name detected")
            paths[name] = accessibleValves.split(',').map(String::trim)
            valves[name] = Valve(name, flowRate.toInt())
        }
        paths.forEach { (name, accessibleValves) ->
            accessibleValves.forEach { accessibleValveName ->
                valves[name]?.addAccessibleValve(
                    valves[accessibleValveName] ?: error("Could not find accessible valve")
                )
            }
        }
        return valves
    }

    fun shortestPathDistance(start: Valve, dest: Valve): Int {
        val queue = LinkedList<Pair<Valve, Int>>()
        val visited = mutableSetOf<Valve>()

        queue.add(start to 0)
        visited.add(start)

        while (queue.isNotEmpty()) {
            val (valve, distance) = queue.remove()
            if (valve == dest) {
                return distance
            }

            for (accessibleValve in valve.accessibleValves) {
                if (!visited.contains(accessibleValve)) {
                    queue.add(accessibleValve to distance + 1)
                    visited.add(accessibleValve)
                }
            }
        }
        error("No shortest path found for $start to $dest")
    }

    data class Opener(val currentLocation: Valve, val minutesRemaining: Int)

    fun releasedPressure(
        distances: Map<Valve, Map<Valve, Int>>,
        openenersData: List<Opener>,
        opened: List<Valve> = emptyList(),
        releasedPressure: Int = 0,
    ): Int {
        val openerData = openenersData.maxBy { it.minutesRemaining }
        return distances[openerData.currentLocation]!!.filter { it.key !in opened }
            .maxOfOrNull { (nextValve, distance) ->
                val newMinutesRemaining = openerData.minutesRemaining - distance - 1
                if (newMinutesRemaining > 0) {
                    releasedPressure(
                        distances,
                        openenersData = openenersData.minus(openerData) + Opener(nextValve, newMinutesRemaining),
                        opened = opened + nextValve,
                        releasedPressure = releasedPressure + nextValve.flowRate * newMinutesRemaining,
                    )
                } else {
                    releasedPressure
                }
            } ?: releasedPressure
    }

    fun part1(input: List<String>, startValveName: String): Int {
        val valvesMap = input.parseValves()

        val distances = valvesMap.values.associateWith { startValve ->
            valvesMap.values.filter { it.flowRate > 0 }.associateWith { destValve ->
                shortestPathDistance(startValve, destValve)
            }
        }

        return releasedPressure(
            distances,
            openenersData = listOf(Opener(valvesMap[startValveName]!!, Day16.RUNTIME_MINS_PART1)),
        )
    }

    fun part2(input: List<String>): Int {
        val valvesMap = input.parseValves()

        val distances = valvesMap.values.associateWith { startValve ->
            valvesMap.values.filter { it.flowRate > 0 }.associateWith { destValve ->
                shortestPathDistance(startValve, destValve)
            }
        }

        val result = releasedPressure(
            distances,
            openenersData = listOf(
                Opener(valvesMap[Day16.START_VALVE_NAME]!!, Day16.RUNTIME_MINS_PART2),
                Opener(valvesMap[Day16.START_VALVE_NAME]!!, Day16.RUNTIME_MINS_PART2)
            ),
        )
        println("Part 2 result $result")
        return result
    }

    // test if implementation meets criteria from the description, like:
    val testInput = readInput("Day16_test")
    println("Part 1 check")
    check(part1(testInput, Day16.START_VALVE_NAME) == Day16.EXPECTED_PART1_CHECK_ANSWER) { "Part 1 failed" }
    println("Part 2 check")
    check(part2(testInput) == Day16.EXPECTED_PART2_CHECK_ANSWER) { "Part 2 failed" }

    val input = readInput("Day16")
    println("Part 1")
    println(part1(input, Day16.START_VALVE_NAME))
    println("Part 2")
    println(part2(input))
}

Compiled from "Day16.kt"
public final class Day16Kt$main$Opener {
  private final Valve currentLocation;

  private final int minutesRemaining;

  public Day16Kt$main$Opener(Valve, int);
    Code:
       0: aload_1
       1: ldc           #8                  // String currentLocation
       3: invokestatic  #14                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #17                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #20                 // Field currentLocation:LValve;
      15: aload_0
      16: iload_2
      17: putfield      #24                 // Field minutesRemaining:I
      20: return

  public final Valve getCurrentLocation();
    Code:
       0: aload_0
       1: getfield      #20                 // Field currentLocation:LValve;
       4: areturn

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

  public final Valve component1();
    Code:
       0: aload_0
       1: getfield      #20                 // Field currentLocation:LValve;
       4: areturn

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

  public final Day16Kt$main$Opener copy(Valve, int);
    Code:
       0: aload_1
       1: ldc           #8                  // String currentLocation
       3: invokestatic  #14                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class Day16Kt$main$Opener
       9: dup
      10: aload_1
      11: iload_2
      12: invokespecial #36                 // Method "<init>":(LValve;I)V
      15: areturn

  public static Day16Kt$main$Opener copy$default(Day16Kt$main$Opener, Valve, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #20                 // Field currentLocation:LValve;
      10: astore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #24                 // Field minutesRemaining:I
      21: istore_2
      22: aload_0
      23: aload_1
      24: iload_2
      25: invokevirtual #40                 // Method copy:(LValve;I)LDay16Kt$main$Opener;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #44                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #45                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #47                 // String Opener(currentLocation=
       9: invokevirtual #51                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #20                 // Field currentLocation:LValve;
      16: invokevirtual #54                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      19: ldc           #56                 // String , minutesRemaining=
      21: invokevirtual #51                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #24                 // Field minutesRemaining:I
      28: invokevirtual #59                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #62                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #64                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #20                 // Field currentLocation:LValve;
       4: invokevirtual #69                 // Method Valve.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #24                 // Field minutesRemaining:I
      16: invokestatic  #74                 // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: 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 Day16Kt$main$Opener
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day16Kt$main$Opener
      20: astore_2
      21: aload_0
      22: getfield      #20                 // Field currentLocation:LValve;
      25: aload_2
      26: getfield      #20                 // Field currentLocation:LValve;
      29: invokestatic  #81                 // 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      #24                 // Field minutesRemaining:I
      41: aload_2
      42: getfield      #24                 // Field minutesRemaining:I
      45: if_icmpeq     50
      48: iconst_0
      49: ireturn
      50: iconst_1
      51: ireturn
}

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

  public static final int EXPECTED_PART1_CHECK_ANSWER;

  public static final int EXPECTED_PART2_CHECK_ANSWER;

  public static final java.lang.String START_VALVE_NAME;

  public static final int RUNTIME_MINS_PART1;

  public static final int RUNTIME_MINS_PART2;

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

  static {};
    Code:
       0: new           #2                  // class Day16
       3: dup
       4: invokespecial #12                 // Method "<init>":()V
       7: putstatic     #15                 // Field INSTANCE:LDay16;
      10: return
}

Compiled from "Day16.kt"
public final class Day16Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String Day16_test
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: ldc           #16                 // String Part 1 check
       8: getstatic     #22                 // Field java/lang/System.out:Ljava/io/PrintStream;
      11: swap
      12: invokevirtual #28                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      15: aload_0
      16: ldc           #30                 // String AA
      18: invokestatic  #34                 // Method main$part1:(Ljava/util/List;Ljava/lang/String;)I
      21: sipush        1651
      24: if_icmpne     31
      27: iconst_1
      28: goto          32
      31: iconst_0
      32: ifne          52
      35: iconst_0
      36: istore_2
      37: ldc           #36                 // String Part 1 failed
      39: astore_2
      40: new           #38                 // class java/lang/IllegalStateException
      43: dup
      44: aload_2
      45: invokevirtual #42                 // Method java/lang/Object.toString:()Ljava/lang/String;
      48: invokespecial #46                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      51: athrow
      52: ldc           #48                 // String Part 2 check
      54: getstatic     #22                 // Field java/lang/System.out:Ljava/io/PrintStream;
      57: swap
      58: invokevirtual #28                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      61: aload_0
      62: invokestatic  #52                 // Method main$part2:(Ljava/util/List;)I
      65: sipush        1707
      68: if_icmpne     75
      71: iconst_1
      72: goto          76
      75: iconst_0
      76: ifne          96
      79: iconst_0
      80: istore_2
      81: ldc           #54                 // String Part 2 failed
      83: astore_2
      84: new           #38                 // class java/lang/IllegalStateException
      87: dup
      88: aload_2
      89: invokevirtual #42                 // Method java/lang/Object.toString:()Ljava/lang/String;
      92: invokespecial #46                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      95: athrow
      96: ldc           #56                 // String Day16
      98: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
     101: astore_1
     102: ldc           #58                 // String Part 1
     104: getstatic     #22                 // Field java/lang/System.out:Ljava/io/PrintStream;
     107: swap
     108: invokevirtual #28                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     111: aload_1
     112: ldc           #30                 // String AA
     114: invokestatic  #34                 // Method main$part1:(Ljava/util/List;Ljava/lang/String;)I
     117: istore_2
     118: getstatic     #22                 // Field java/lang/System.out:Ljava/io/PrintStream;
     121: iload_2
     122: invokevirtual #61                 // Method java/io/PrintStream.println:(I)V
     125: ldc           #63                 // String Part 2
     127: getstatic     #22                 // Field java/lang/System.out:Ljava/io/PrintStream;
     130: swap
     131: invokevirtual #28                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     134: aload_1
     135: invokestatic  #52                 // Method main$part2:(Ljava/util/List;)I
     138: istore_2
     139: getstatic     #22                 // Field java/lang/System.out:Ljava/io/PrintStream;
     142: iload_2
     143: invokevirtual #61                 // Method java/io/PrintStream.println:(I)V
     146: return

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

  private static final java.util.Map<java.lang.String, Valve> main$parseValves(java.util.List<java.lang.String>);
    Code:
       0: new           #81                 // class java/util/LinkedHashMap
       3: dup
       4: invokespecial #83                 // Method java/util/LinkedHashMap."<init>":()V
       7: checkcast     #85                 // class java/util/Map
      10: astore_1
      11: new           #81                 // class java/util/LinkedHashMap
      14: dup
      15: invokespecial #83                 // Method java/util/LinkedHashMap."<init>":()V
      18: checkcast     #85                 // class java/util/Map
      21: astore_2
      22: aload_0
      23: checkcast     #87                 // class java/lang/Iterable
      26: astore_3
      27: iconst_0
      28: istore        4
      30: aload_3
      31: invokeinterface #91,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        5
      38: aload         5
      40: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          389
      48: aload         5
      50: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        6
      57: aload         6
      59: checkcast     #103                // class java/lang/String
      62: astore        7
      64: iconst_0
      65: istore        8
      67: new           #105                // class kotlin/text/Regex
      70: dup
      71: ldc           #107                // String Valve (.+) has flow rate=(\\d+); tunnels? leads? to valves? (.*)
      73: invokespecial #108                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      76: aload         7
      78: checkcast     #110                // class java/lang/CharSequence
      81: invokevirtual #114                // Method kotlin/text/Regex.matchEntire:(Ljava/lang/CharSequence;)Lkotlin/text/MatchResult;
      84: astore        9
      86: aload         9
      88: ifnull        110
      91: aload         9
      93: invokeinterface #120,  1          // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;
      98: astore        10
     100: aload         10
     102: ifnull        110
     105: aload         10
     107: goto          123
     110: new           #38                 // class java/lang/IllegalStateException
     113: dup
     114: ldc           #122                // String Valve line not matched
     116: invokevirtual #42                 // Method java/lang/Object.toString:()Ljava/lang/String;
     119: invokespecial #46                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     122: athrow
     123: astore        11
     125: aload         11
     127: invokevirtual #128                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     130: invokeinterface #132,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     135: iconst_1
     136: invokeinterface #136,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     141: checkcast     #103                // class java/lang/String
     144: astore        9
     146: aload         11
     148: invokevirtual #128                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     151: invokeinterface #132,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     156: iconst_2
     157: invokeinterface #136,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     162: checkcast     #103                // class java/lang/String
     165: astore        10
     167: aload         11
     169: invokevirtual #128                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     172: invokeinterface #132,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     177: iconst_3
     178: invokeinterface #136,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     183: checkcast     #103                // class java/lang/String
     186: astore        12
     188: aload_2
     189: aload         9
     191: invokeinterface #140,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
     196: ifeq          212
     199: new           #38                 // class java/lang/IllegalStateException
     202: dup
     203: ldc           #142                // String Duplicate valve name detected
     205: invokevirtual #42                 // Method java/lang/Object.toString:()Ljava/lang/String;
     208: invokespecial #46                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     211: athrow
     212: aload_1
     213: astore        13
     215: aload         12
     217: checkcast     #110                // class java/lang/CharSequence
     220: iconst_1
     221: newarray       char
     223: astore        14
     225: aload         14
     227: iconst_0
     228: bipush        44
     230: castore
     231: aload         14
     233: iconst_0
     234: iconst_0
     235: bipush        6
     237: aconst_null
     238: invokestatic  #148                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
     241: checkcast     #87                 // class java/lang/Iterable
     244: astore        14
     246: iconst_0
     247: istore        15
     249: aload         14
     251: astore        16
     253: new           #150                // class java/util/ArrayList
     256: dup
     257: aload         14
     259: bipush        10
     261: invokestatic  #156                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     264: invokespecial #158                // Method java/util/ArrayList."<init>":(I)V
     267: checkcast     #160                // class java/util/Collection
     270: astore        17
     272: iconst_0
     273: istore        18
     275: aload         16
     277: invokeinterface #91,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     282: astore        19
     284: aload         19
     286: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     291: ifeq          341
     294: aload         19
     296: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     301: astore        20
     303: aload         17
     305: aload         20
     307: checkcast     #103                // class java/lang/String
     310: astore        21
     312: astore        22
     314: iconst_0
     315: istore        23
     317: aload         21
     319: checkcast     #110                // class java/lang/CharSequence
     322: invokestatic  #164                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     325: invokevirtual #42                 // Method java/lang/Object.toString:()Ljava/lang/String;
     328: nop
     329: aload         22
     331: swap
     332: invokeinterface #167,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     337: pop
     338: goto          284
     341: aload         17
     343: checkcast     #71                 // class java/util/List
     346: nop
     347: astore        14
     349: aload         13
     351: aload         9
     353: aload         14
     355: invokeinterface #171,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     360: pop
     361: aload_2
     362: aload         9
     364: new           #173                // class Valve
     367: dup
     368: aload         9
     370: aload         10
     372: invokestatic  #179                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     375: invokespecial #182                // Method Valve."<init>":(Ljava/lang/String;I)V
     378: invokeinterface #171,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     383: pop
     384: nop
     385: nop
     386: goto          38
     389: nop
     390: aload_1
     391: astore_3
     392: iconst_0
     393: istore        4
     395: aload_3
     396: invokeinterface #186,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     401: invokeinterface #189,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     406: astore        5
     408: aload         5
     410: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     415: ifeq          571
     418: aload         5
     420: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     425: checkcast     #191                // class java/util/Map$Entry
     428: astore        6
     430: aload         6
     432: astore        7
     434: iconst_0
     435: istore        8
     437: aload         7
     439: invokeinterface #194,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     444: checkcast     #103                // class java/lang/String
     447: astore        9
     449: aload         7
     451: invokeinterface #197,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     456: checkcast     #71                 // class java/util/List
     459: astore        10
     461: aload         10
     463: checkcast     #87                 // class java/lang/Iterable
     466: astore        11
     468: iconst_0
     469: istore        12
     471: aload         11
     473: invokeinterface #91,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     478: astore        13
     480: aload         13
     482: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     487: ifeq          565
     490: aload         13
     492: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     497: astore        14
     499: aload         14
     501: checkcast     #103                // class java/lang/String
     504: astore        15
     506: iconst_0
     507: istore        16
     509: aload_2
     510: aload         9
     512: invokeinterface #200,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     517: checkcast     #173                // class Valve
     520: dup
     521: ifnull        559
     524: aload_2
     525: aload         15
     527: invokeinterface #200,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     532: checkcast     #173                // class Valve
     535: dup
     536: ifnonnull     553
     539: pop
     540: new           #38                 // class java/lang/IllegalStateException
     543: dup
     544: ldc           #202                // String Could not find accessible valve
     546: invokevirtual #42                 // Method java/lang/Object.toString:()Ljava/lang/String;
     549: invokespecial #46                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     552: athrow
     553: invokevirtual #206                // Method Valve.addAccessibleValve:(LValve;)V
     556: goto          560
     559: pop
     560: nop
     561: nop
     562: goto          480
     565: nop
     566: nop
     567: nop
     568: goto          408
     571: nop
     572: aload_2
     573: areturn

  private static final int main$shortestPathDistance(Valve, Valve);
    Code:
       0: new           #238                // class java/util/LinkedList
       3: dup
       4: invokespecial #239                // Method java/util/LinkedList."<init>":()V
       7: astore_2
       8: new           #241                // class java/util/LinkedHashSet
      11: dup
      12: invokespecial #242                // Method java/util/LinkedHashSet."<init>":()V
      15: checkcast     #188                // class java/util/Set
      18: astore_3
      19: aload_2
      20: aload_0
      21: iconst_0
      22: invokestatic  #246                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      25: invokestatic  #252                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      28: invokevirtual #253                // Method java/util/LinkedList.add:(Ljava/lang/Object;)Z
      31: pop
      32: aload_3
      33: aload_0
      34: invokeinterface #254,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
      39: pop
      40: aload_2
      41: checkcast     #160                // class java/util/Collection
      44: invokeinterface #257,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      49: ifne          56
      52: iconst_1
      53: goto          57
      56: iconst_0
      57: ifeq          178
      60: aload_2
      61: invokevirtual #260                // Method java/util/LinkedList.remove:()Ljava/lang/Object;
      64: checkcast     #262                // class kotlin/Pair
      67: astore        4
      69: aload         4
      71: invokevirtual #265                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      74: checkcast     #173                // class Valve
      77: astore        5
      79: aload         4
      81: invokevirtual #268                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      84: checkcast     #270                // class java/lang/Number
      87: invokevirtual #274                // Method java/lang/Number.intValue:()I
      90: istore        6
      92: aload         5
      94: aload_1
      95: invokestatic  #280                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      98: ifeq          104
     101: iload         6
     103: ireturn
     104: aload         5
     106: invokevirtual #283                // Method Valve.getAccessibleValves:()Ljava/util/Set;
     109: invokeinterface #189,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     114: astore        7
     116: aload         7
     118: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     123: ifeq          40
     126: aload         7
     128: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     133: checkcast     #173                // class Valve
     136: astore        8
     138: aload_3
     139: aload         8
     141: invokeinterface #286,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     146: ifne          116
     149: aload_2
     150: aload         8
     152: iload         6
     154: iconst_1
     155: iadd
     156: invokestatic  #246                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     159: invokestatic  #252                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     162: invokevirtual #253                // Method java/util/LinkedList.add:(Ljava/lang/Object;)Z
     165: pop
     166: aload_3
     167: aload         8
     169: invokeinterface #254,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     174: pop
     175: goto          116
     178: new           #38                 // class java/lang/IllegalStateException
     181: dup
     182: new           #288                // class java/lang/StringBuilder
     185: dup
     186: invokespecial #289                // Method java/lang/StringBuilder."<init>":()V
     189: ldc_w         #291                // String No shortest path found for
     192: invokevirtual #295                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     195: aload_0
     196: invokevirtual #298                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     199: ldc_w         #300                // String  to
     202: invokevirtual #295                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     205: aload_1
     206: invokevirtual #298                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     209: invokevirtual #301                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     212: invokevirtual #42                 // Method java/lang/Object.toString:()Ljava/lang/String;
     215: invokespecial #46                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     218: athrow

  private static final int main$releasedPressure(java.util.Map<Valve, ? extends java.util.Map<Valve, java.lang.Integer>>, java.util.List<Day16Kt$main$Opener>, java.util.List<Valve>, int);
    Code:
       0: aload_1
       1: checkcast     #87                 // class java/lang/Iterable
       4: astore        5
       6: iconst_0
       7: istore        6
       9: aload         5
      11: invokeinterface #91,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      16: astore        7
      18: aload         7
      20: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      25: ifne          36
      28: new           #316                // class java/util/NoSuchElementException
      31: dup
      32: invokespecial #317                // Method java/util/NoSuchElementException."<init>":()V
      35: athrow
      36: aload         7
      38: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      43: astore        8
      45: aload         7
      47: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      52: ifne          60
      55: aload         8
      57: goto          130
      60: aload         8
      62: checkcast     #319                // class Day16Kt$main$Opener
      65: astore        9
      67: iconst_0
      68: istore        10
      70: aload         9
      72: invokevirtual #322                // Method Day16Kt$main$Opener.getMinutesRemaining:()I
      75: istore        9
      77: aload         7
      79: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      84: astore        10
      86: aload         10
      88: checkcast     #319                // class Day16Kt$main$Opener
      91: astore        11
      93: iconst_0
      94: istore        12
      96: aload         11
      98: invokevirtual #322                // Method Day16Kt$main$Opener.getMinutesRemaining:()I
     101: istore        11
     103: iload         9
     105: iload         11
     107: if_icmpge     118
     110: aload         10
     112: astore        8
     114: iload         11
     116: istore        9
     118: aload         7
     120: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     125: ifne          77
     128: aload         8
     130: checkcast     #319                // class Day16Kt$main$Opener
     133: astore        4
     135: aload_0
     136: aload         4
     138: invokevirtual #326                // Method Day16Kt$main$Opener.getCurrentLocation:()LValve;
     141: invokeinterface #200,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     146: dup
     147: invokestatic  #329                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     150: checkcast     #85                 // class java/util/Map
     153: astore        6
     155: iconst_0
     156: istore        7
     158: aload         6
     160: astore        8
     162: new           #81                 // class java/util/LinkedHashMap
     165: dup
     166: invokespecial #83                 // Method java/util/LinkedHashMap."<init>":()V
     169: checkcast     #85                 // class java/util/Map
     172: astore        9
     174: iconst_0
     175: istore        10
     177: aload         8
     179: invokeinterface #186,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     184: invokeinterface #189,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     189: astore        11
     191: aload         11
     193: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     198: ifeq          269
     201: aload         11
     203: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     208: checkcast     #191                // class java/util/Map$Entry
     211: astore        12
     213: aload         12
     215: astore        13
     217: iconst_0
     218: istore        14
     220: aload_2
     221: aload         13
     223: invokeinterface #194,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     228: invokeinterface #330,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     233: ifne          240
     236: iconst_1
     237: goto          241
     240: iconst_0
     241: ifeq          191
     244: aload         9
     246: aload         12
     248: invokeinterface #194,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     253: aload         12
     255: invokeinterface #197,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     260: invokeinterface #171,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     265: pop
     266: goto          191
     269: aload         9
     271: nop
     272: invokeinterface #186,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     277: checkcast     #87                 // class java/lang/Iterable
     280: invokeinterface #91,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     285: astore        7
     287: aload         7
     289: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     294: ifne          301
     297: aconst_null
     298: goto          574
     301: aload         7
     303: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     308: checkcast     #191                // class java/util/Map$Entry
     311: astore        8
     313: iconst_0
     314: istore        9
     316: aload         8
     318: invokeinterface #194,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     323: checkcast     #173                // class Valve
     326: astore        10
     328: aload         8
     330: invokeinterface #197,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     335: checkcast     #270                // class java/lang/Number
     338: invokevirtual #274                // Method java/lang/Number.intValue:()I
     341: istore        11
     343: aload         4
     345: invokevirtual #322                // Method Day16Kt$main$Opener.getMinutesRemaining:()I
     348: iload         11
     350: isub
     351: iconst_1
     352: isub
     353: istore        12
     355: iload         12
     357: ifle          412
     360: aload_0
     361: aload_1
     362: checkcast     #87                 // class java/lang/Iterable
     365: aload         4
     367: invokestatic  #334                // Method kotlin/collections/CollectionsKt.minus:(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/util/List;
     370: checkcast     #160                // class java/util/Collection
     373: new           #319                // class Day16Kt$main$Opener
     376: dup
     377: aload         10
     379: iload         12
     381: invokespecial #337                // Method Day16Kt$main$Opener."<init>":(LValve;I)V
     384: invokestatic  #341                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;
     387: aload_2
     388: checkcast     #160                // class java/util/Collection
     391: aload         10
     393: invokestatic  #341                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;
     396: iload_3
     397: aload         10
     399: invokevirtual #344                // Method Valve.getFlowRate:()I
     402: iload         12
     404: imul
     405: iadd
     406: invokestatic  #346                // Method main$releasedPressure:(Ljava/util/Map;Ljava/util/List;Ljava/util/List;I)I
     409: goto          413
     412: iload_3
     413: nop
     414: invokestatic  #246                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     417: checkcast     #348                // class java/lang/Comparable
     420: astore        8
     422: aload         7
     424: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     429: ifeq          572
     432: aload         7
     434: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     439: checkcast     #191                // class java/util/Map$Entry
     442: astore        9
     444: iconst_0
     445: istore        10
     447: aload         9
     449: invokeinterface #194,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     454: checkcast     #173                // class Valve
     457: astore        11
     459: aload         9
     461: invokeinterface #197,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     466: checkcast     #270                // class java/lang/Number
     469: invokevirtual #274                // Method java/lang/Number.intValue:()I
     472: istore        12
     474: aload         4
     476: invokevirtual #322                // Method Day16Kt$main$Opener.getMinutesRemaining:()I
     479: iload         12
     481: isub
     482: iconst_1
     483: isub
     484: istore        13
     486: iload         13
     488: ifle          543
     491: aload_0
     492: aload_1
     493: checkcast     #87                 // class java/lang/Iterable
     496: aload         4
     498: invokestatic  #334                // Method kotlin/collections/CollectionsKt.minus:(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/util/List;
     501: checkcast     #160                // class java/util/Collection
     504: new           #319                // class Day16Kt$main$Opener
     507: dup
     508: aload         11
     510: iload         13
     512: invokespecial #337                // Method Day16Kt$main$Opener."<init>":(LValve;I)V
     515: invokestatic  #341                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;
     518: aload_2
     519: checkcast     #160                // class java/util/Collection
     522: aload         11
     524: invokestatic  #341                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;
     527: iload_3
     528: aload         11
     530: invokevirtual #344                // Method Valve.getFlowRate:()I
     533: iload         13
     535: imul
     536: iadd
     537: invokestatic  #346                // Method main$releasedPressure:(Ljava/util/Map;Ljava/util/List;Ljava/util/List;I)I
     540: goto          544
     543: iload_3
     544: nop
     545: invokestatic  #246                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     548: checkcast     #348                // class java/lang/Comparable
     551: astore        9
     553: aload         8
     555: aload         9
     557: invokeinterface #352,  2          // InterfaceMethod java/lang/Comparable.compareTo:(Ljava/lang/Object;)I
     562: ifge          422
     565: aload         9
     567: astore        8
     569: goto          422
     572: aload         8
     574: checkcast     #175                // class java/lang/Integer
     577: dup
     578: ifnull        587
     581: invokevirtual #353                // Method java/lang/Integer.intValue:()I
     584: goto          589
     587: pop
     588: iload_3
     589: ireturn

  static int main$releasedPressure$default(java.util.Map, java.util.List, java.util.List, int, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_4
       3: iand
       4: ifeq          11
       7: invokestatic  #383                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
      10: astore_2
      11: iload         4
      13: bipush        8
      15: iand
      16: ifeq          21
      19: iconst_0
      20: istore_3
      21: aload_0
      22: aload_1
      23: aload_2
      24: iload_3
      25: invokestatic  #346                // Method main$releasedPressure:(Ljava/util/Map;Ljava/util/List;Ljava/util/List;I)I
      28: ireturn

  private static final int main$part1(java.util.List<java.lang.String>, java.lang.String);
    Code:
       0: aload_0
       1: invokestatic  #386                // Method main$parseValves:(Ljava/util/List;)Ljava/util/Map;
       4: astore_2
       5: aload_2
       6: invokeinterface #390,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
      11: checkcast     #87                 // class java/lang/Iterable
      14: astore        4
      16: iconst_0
      17: istore        5
      19: new           #81                 // class java/util/LinkedHashMap
      22: dup
      23: aload         4
      25: bipush        10
      27: invokestatic  #156                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      30: invokestatic  #396                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
      33: bipush        16
      35: invokestatic  #402                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
      38: invokespecial #403                // Method java/util/LinkedHashMap."<init>":(I)V
      41: astore        6
      43: aload         4
      45: astore        7
      47: iconst_0
      48: istore        8
      50: aload         7
      52: invokeinterface #91,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      57: astore        9
      59: aload         9
      61: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      66: ifeq          345
      69: aload         9
      71: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      76: astore        10
      78: aload         6
      80: checkcast     #85                 // class java/util/Map
      83: aload         10
      85: aload         10
      87: checkcast     #173                // class Valve
      90: astore        11
      92: astore        26
      94: astore        25
      96: iconst_0
      97: istore        12
      99: aload_2
     100: invokeinterface #390,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
     105: checkcast     #87                 // class java/lang/Iterable
     108: astore        13
     110: iconst_0
     111: istore        14
     113: aload         13
     115: astore        15
     117: new           #150                // class java/util/ArrayList
     120: dup
     121: invokespecial #404                // Method java/util/ArrayList."<init>":()V
     124: checkcast     #160                // class java/util/Collection
     127: astore        16
     129: iconst_0
     130: istore        17
     132: aload         15
     134: invokeinterface #91,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     139: astore        18
     141: aload         18
     143: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     148: ifeq          199
     151: aload         18
     153: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     158: astore        19
     160: aload         19
     162: checkcast     #173                // class Valve
     165: astore        20
     167: iconst_0
     168: istore        21
     170: aload         20
     172: invokevirtual #344                // Method Valve.getFlowRate:()I
     175: ifle          182
     178: iconst_1
     179: goto          183
     182: iconst_0
     183: ifeq          141
     186: aload         16
     188: aload         19
     190: invokeinterface #167,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     195: pop
     196: goto          141
     199: aload         16
     201: checkcast     #71                 // class java/util/List
     204: nop
     205: checkcast     #87                 // class java/lang/Iterable
     208: astore        13
     210: nop
     211: iconst_0
     212: istore        14
     214: new           #81                 // class java/util/LinkedHashMap
     217: dup
     218: aload         13
     220: bipush        10
     222: invokestatic  #156                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     225: invokestatic  #396                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     228: bipush        16
     230: invokestatic  #402                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     233: invokespecial #403                // Method java/util/LinkedHashMap."<init>":(I)V
     236: astore        15
     238: aload         13
     240: astore        16
     242: iconst_0
     243: istore        17
     245: aload         16
     247: invokeinterface #91,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     252: astore        18
     254: aload         18
     256: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     261: ifeq          321
     264: aload         18
     266: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     271: astore        19
     273: aload         15
     275: checkcast     #85                 // class java/util/Map
     278: aload         19
     280: aload         19
     282: checkcast     #173                // class Valve
     285: astore        20
     287: astore        22
     289: astore        23
     291: iconst_0
     292: istore        21
     294: aload         11
     296: aload         20
     298: invokestatic  #406                // Method main$shortestPathDistance:(LValve;LValve;)I
     301: invokestatic  #246                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     304: astore        24
     306: aload         23
     308: aload         22
     310: aload         24
     312: invokeinterface #171,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     317: pop
     318: goto          254
     321: aload         15
     323: checkcast     #85                 // class java/util/Map
     326: nop
     327: nop
     328: astore        27
     330: aload         25
     332: aload         26
     334: aload         27
     336: invokeinterface #171,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     341: pop
     342: goto          59
     345: aload         6
     347: checkcast     #85                 // class java/util/Map
     350: nop
     351: astore_3
     352: aload_3
     353: new           #319                // class Day16Kt$main$Opener
     356: dup
     357: aload_2
     358: aload_1
     359: invokeinterface #200,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     364: dup
     365: invokestatic  #329                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     368: checkcast     #173                // class Valve
     371: bipush        30
     373: invokespecial #337                // Method Day16Kt$main$Opener."<init>":(LValve;I)V
     376: invokestatic  #410                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     379: aconst_null
     380: iconst_0
     381: bipush        12
     383: aconst_null
     384: invokestatic  #412                // Method main$releasedPressure$default:(Ljava/util/Map;Ljava/util/List;Ljava/util/List;IILjava/lang/Object;)I
     387: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #386                // Method main$parseValves:(Ljava/util/List;)Ljava/util/Map;
       4: astore_1
       5: aload_1
       6: invokeinterface #390,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
      11: checkcast     #87                 // class java/lang/Iterable
      14: astore_3
      15: iconst_0
      16: istore        4
      18: new           #81                 // class java/util/LinkedHashMap
      21: dup
      22: aload_3
      23: bipush        10
      25: invokestatic  #156                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      28: invokestatic  #396                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
      31: bipush        16
      33: invokestatic  #402                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
      36: invokespecial #403                // Method java/util/LinkedHashMap."<init>":(I)V
      39: astore        5
      41: aload_3
      42: astore        6
      44: iconst_0
      45: istore        7
      47: aload         6
      49: invokeinterface #91,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      54: astore        8
      56: aload         8
      58: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      63: ifeq          342
      66: aload         8
      68: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      73: astore        9
      75: aload         5
      77: checkcast     #85                 // class java/util/Map
      80: aload         9
      82: aload         9
      84: checkcast     #173                // class Valve
      87: astore        10
      89: astore        25
      91: astore        24
      93: iconst_0
      94: istore        11
      96: aload_1
      97: invokeinterface #390,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
     102: checkcast     #87                 // class java/lang/Iterable
     105: astore        12
     107: iconst_0
     108: istore        13
     110: aload         12
     112: astore        14
     114: new           #150                // class java/util/ArrayList
     117: dup
     118: invokespecial #404                // Method java/util/ArrayList."<init>":()V
     121: checkcast     #160                // class java/util/Collection
     124: astore        15
     126: iconst_0
     127: istore        16
     129: aload         14
     131: invokeinterface #91,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     136: astore        17
     138: aload         17
     140: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     145: ifeq          196
     148: aload         17
     150: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     155: astore        18
     157: aload         18
     159: checkcast     #173                // class Valve
     162: astore        19
     164: iconst_0
     165: istore        20
     167: aload         19
     169: invokevirtual #344                // Method Valve.getFlowRate:()I
     172: ifle          179
     175: iconst_1
     176: goto          180
     179: iconst_0
     180: ifeq          138
     183: aload         15
     185: aload         18
     187: invokeinterface #167,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     192: pop
     193: goto          138
     196: aload         15
     198: checkcast     #71                 // class java/util/List
     201: nop
     202: checkcast     #87                 // class java/lang/Iterable
     205: astore        12
     207: nop
     208: iconst_0
     209: istore        13
     211: new           #81                 // class java/util/LinkedHashMap
     214: dup
     215: aload         12
     217: bipush        10
     219: invokestatic  #156                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     222: invokestatic  #396                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     225: bipush        16
     227: invokestatic  #402                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     230: invokespecial #403                // Method java/util/LinkedHashMap."<init>":(I)V
     233: astore        14
     235: aload         12
     237: astore        15
     239: iconst_0
     240: istore        16
     242: aload         15
     244: invokeinterface #91,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     249: astore        17
     251: aload         17
     253: invokeinterface #97,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     258: ifeq          318
     261: aload         17
     263: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     268: astore        18
     270: aload         14
     272: checkcast     #85                 // class java/util/Map
     275: aload         18
     277: aload         18
     279: checkcast     #173                // class Valve
     282: astore        19
     284: astore        21
     286: astore        22
     288: iconst_0
     289: istore        20
     291: aload         10
     293: aload         19
     295: invokestatic  #406                // Method main$shortestPathDistance:(LValve;LValve;)I
     298: invokestatic  #246                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     301: astore        23
     303: aload         22
     305: aload         21
     307: aload         23
     309: invokeinterface #171,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     314: pop
     315: goto          251
     318: aload         14
     320: checkcast     #85                 // class java/util/Map
     323: nop
     324: nop
     325: astore        26
     327: aload         24
     329: aload         25
     331: aload         26
     333: invokeinterface #171,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     338: pop
     339: goto          56
     342: aload         5
     344: checkcast     #85                 // class java/util/Map
     347: nop
     348: astore_2
     349: aload_2
     350: iconst_2
     351: anewarray     #319                // class Day16Kt$main$Opener
     354: astore        4
     356: aload         4
     358: iconst_0
     359: new           #319                // class Day16Kt$main$Opener
     362: dup
     363: aload_1
     364: ldc           #30                 // String AA
     366: invokeinterface #200,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     371: dup
     372: invokestatic  #329                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     375: checkcast     #173                // class Valve
     378: bipush        26
     380: invokespecial #337                // Method Day16Kt$main$Opener."<init>":(LValve;I)V
     383: aastore
     384: aload         4
     386: iconst_1
     387: new           #319                // class Day16Kt$main$Opener
     390: dup
     391: aload_1
     392: ldc           #30                 // String AA
     394: invokeinterface #200,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     399: dup
     400: invokestatic  #329                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     403: checkcast     #173                // class Valve
     406: bipush        26
     408: invokespecial #337                // Method Day16Kt$main$Opener."<init>":(LValve;I)V
     411: aastore
     412: aload         4
     414: invokestatic  #429                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     417: aconst_null
     418: iconst_0
     419: bipush        12
     421: aconst_null
     422: invokestatic  #412                // Method main$releasedPressure$default:(Ljava/util/Map;Ljava/util/List;Ljava/util/List;IILjava/lang/Object;)I
     425: istore_3
     426: new           #288                // class java/lang/StringBuilder
     429: dup
     430: invokespecial #289                // Method java/lang/StringBuilder."<init>":()V
     433: ldc_w         #431                // String Part 2 result
     436: invokevirtual #295                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     439: iload_3
     440: invokevirtual #434                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     443: invokevirtual #301                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     446: getstatic     #22                 // Field java/lang/System.out:Ljava/io/PrintStream;
     449: swap
     450: invokevirtual #28                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     453: iload_3
     454: ireturn
}