import kotlin.math.max

fun main() {
    val input = readInput("Day16")
    printTime { print(Day16.part1(input)) }
    printTime { print(Day16.part2(input)) }
}

class Day16 {
    companion object {
        fun part1(input: List<String>): Int {
            val valves = input.map {
                it.split(
                    "Valve ", " has flow rate=", "; tunnel leads to valve ", "; tunnels lead to valves "
                ).drop(1)
            }.map { Valve(it[0], it[1].toInt(), it[2].split(", ").toSet()) }

            for (valve in valves) {
                valve.tunnels.addAll(valve.tunnelsTo.map { to -> valves.find { it.name == to }!! })
            }

            val valvesMap: Map<Valve, Map<Valve, Int>> =
                valves.filter { origin -> origin.rate > 0 || origin.name == "AA" }.associateWith { origin ->
                    valves.filter { it !== origin && it.rate > 0 }.associateWith { target -> bfs(origin, target) }
                }

            val valvesIndexes: Map<Valve, Int> =
                valvesMap.keys.withIndex().associateWith { it.index }.mapKeys { it.key.value }

            return dfs(valves.find { it.name == "AA" }!!, valvesMap, valvesIndexes)
        }

        private fun bfs(from: Valve, target: Valve): Int {
            val queue = ArrayDeque<Pair<Valve, Int>>()
            queue.add(from to 0)
            val visited = mutableSetOf<Valve>()
            while (queue.isNotEmpty()) {
                val next = queue.removeFirst()
                if (visited.contains(next.first)) continue
                visited.add(next.first)
                if (target == next.first) {
                    return next.second
                }
                queue.addAll(next.first.tunnels.map { it to next.second + 1 })
            }
            error("No Path Found")
        }

        private fun dfs(
            start: Valve,
            valvesMap: Map<Valve, Map<Valve, Int>>,
            valvesIndexes: Map<Valve, Int>,
            timeLeft: Int = 30,
            valvesState: Int = 0
        ): Int {
            var maxPressure = 0
            for ((neighbor, distance) in valvesMap[start]!!.entries) {
                val bit = 1 shl valvesIndexes[neighbor]!!
                if (valvesState and bit > 0)
                    continue
                val newTimeLeft = timeLeft - distance - 1
                if (newTimeLeft <= 0)//try 1
                    continue
                maxPressure = max(
                    maxPressure,
                    dfs(
                        neighbor,
                        valvesMap,
                        valvesIndexes,
                        newTimeLeft,
                        valvesState or bit
                    ) + neighbor.rate * newTimeLeft
                )
            }
            return maxPressure
        }

        private fun dfs_v1(path: List<Valve>, valvesMap: Map<Valve, Map<Valve, Int>>, timeLeft: Int = 30): Int {
            if (timeLeft <= 1) {
                return 0
            }
            val current = path.last()
            val timeInCurrentCave = if (current.rate > 0) 1 else 0
            val valveTotalPressure = current.rate * (timeLeft - timeInCurrentCave)
            val openValves = valvesMap[current]!!.filter { !path.contains(it.key) }
            if (openValves.isEmpty()) {
                return valveTotalPressure
            }
            return valveTotalPressure + (openValves.maxOfOrNull { (target, distance) ->
                dfs_v1(listOf(*path.toTypedArray(), target), valvesMap, timeLeft - (timeInCurrentCave + distance))
            } ?: 0)
        }

        fun part2(input: List<String>): Int {
            val valves = input.map {
                it.split(
                    "Valve ", " has flow rate=", "; tunnel leads to valve ", "; tunnels lead to valves "
                ).drop(1)
            }.map { Valve(it[0], it[1].toInt(), it[2].split(", ").toSet()) }

            for (valve in valves) {
                valve.tunnels.addAll(valve.tunnelsTo.map { to -> valves.find { it.name == to }!! })
            }

            val valvesMap: Map<Valve, Map<Valve, Int>> =
                valves.filter { origin -> origin.rate > 0 || origin.name == "AA" }.associateWith { origin ->
                    valves.filter { it !== origin && it.rate > 0 }.associateWith { target -> bfs(origin, target) }
                }

            val valvesIndexes: Map<Valve, Int> =
                valvesMap.keys.withIndex().associateWith { it.index }.mapKeys { it.key.value }

            val start = valves.find { it.name == "AA" }!!

            val mask = (1 shl valvesIndexes.size) - 1

            var max = 0

            for (i in 0..(mask / 2)) {
                max = max(
                    max,
                    dfs(start, valvesMap, valvesIndexes, 26, i) + dfs(start, valvesMap, valvesIndexes, 26, mask xor i)
                )
            }

            return max
        }
    }

    class Valve(val name: String, val rate: Int, val tunnelsTo: Set<String>) {
        val tunnels: MutableSet<Valve> = mutableSetOf()

        override fun toString(): String {
            return "Valve(name='$name', rate=$rate)"
        }

        override fun equals(other: Any?): Boolean {

            return name == (other as Valve).name
        }

        override fun hashCode(): Int {
            return name.hashCode()
        }
    }
}

Compiled from "Day16.kt"
public final class Day16$Valve {
  private final java.lang.String name;

  private final int rate;

  private final java.util.Set<java.lang.String> tunnelsTo;

  private final java.util.Set<Day16$Valve> tunnels;

  public Day16$Valve(java.lang.String, int, java.util.Set<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #10                 // String name
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_3
       7: ldc           #18                 // String tunnelsTo
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokespecial #21                 // Method java/lang/Object."<init>":()V
      16: aload_0
      17: aload_1
      18: putfield      #24                 // Field name:Ljava/lang/String;
      21: aload_0
      22: iload_2
      23: putfield      #28                 // Field rate:I
      26: aload_0
      27: aload_3
      28: putfield      #31                 // Field tunnelsTo:Ljava/util/Set;
      31: aload_0
      32: new           #33                 // class java/util/LinkedHashSet
      35: dup
      36: invokespecial #34                 // Method java/util/LinkedHashSet."<init>":()V
      39: checkcast     #36                 // class java/util/Set
      42: putfield      #39                 // Field tunnels:Ljava/util/Set;
      45: return

  public final java.lang.String getName();
    Code:
       0: aload_0
       1: getfield      #24                 // Field name:Ljava/lang/String;
       4: areturn

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

  public final java.util.Set<java.lang.String> getTunnelsTo();
    Code:
       0: aload_0
       1: getfield      #31                 // Field tunnelsTo:Ljava/util/Set;
       4: areturn

  public final java.util.Set<Day16$Valve> getTunnels();
    Code:
       0: aload_0
       1: getfield      #39                 // Field tunnels:Ljava/util/Set;
       4: areturn

  public java.lang.String toString();
    Code:
       0: new           #53                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #54                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #56                 // String Valve(name=\'
       9: invokevirtual #60                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #24                 // Field name:Ljava/lang/String;
      16: invokevirtual #60                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: ldc           #62                 // String \', rate=
      21: invokevirtual #60                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #28                 // Field rate:I
      28: invokevirtual #65                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #68                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #70                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: getfield      #24                 // Field name:Ljava/lang/String;
       4: aload_1
       5: ldc           #75                 // String null cannot be cast to non-null type <root>.Day16.Valve
       7: invokestatic  #78                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;Ljava/lang/String;)V
      10: aload_1
      11: checkcast     #2                  // class Day16$Valve
      14: getfield      #24                 // Field name:Ljava/lang/String;
      17: invokestatic  #82                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      20: ireturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #24                 // Field name:Ljava/lang/String;
       4: invokevirtual #89                 // Method java/lang/String.hashCode:()I
       7: ireturn
}

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

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

  static {};
    Code:
       0: new           #13                 // class Day16$Companion
       3: dup
       4: aconst_null
       5: invokespecial #16                 // Method Day16$Companion."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
       8: putstatic     #20                 // Field Companion:LDay16$Companion;
      11: return
}

Compiled from "Day16.kt"
public final class Day16Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String Day16
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aconst_null
       7: aconst_null
       8: aload_0
       9: invokedynamic #34,  0             // InvokeDynamic #0:invoke:(Ljava/util/List;)Lkotlin/jvm/functions/Function0;
      14: iconst_3
      15: aconst_null
      16: invokestatic  #38                 // Method UtilsKt.printTime$default:(Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V
      19: aconst_null
      20: aconst_null
      21: aload_0
      22: invokedynamic #43,  0             // InvokeDynamic #1:invoke:(Ljava/util/List;)Lkotlin/jvm/functions/Function0;
      27: iconst_3
      28: aconst_null
      29: invokestatic  #38                 // Method UtilsKt.printTime$default:(Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V
      32: return

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

  private static final kotlin.Unit main$lambda$0(java.util.List);
    Code:
       0: getstatic     #55                 // Field Day16.Companion:LDay16$Companion;
       3: aload_0
       4: invokevirtual #61                 // Method Day16$Companion.part1:(Ljava/util/List;)I
       7: istore_1
       8: getstatic     #67                 // Field java/lang/System.out:Ljava/io/PrintStream;
      11: iload_1
      12: invokevirtual #73                 // Method java/io/PrintStream.print:(I)V
      15: getstatic     #79                 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      18: areturn

  private static final kotlin.Unit main$lambda$1(java.util.List);
    Code:
       0: getstatic     #55                 // Field Day16.Companion:LDay16$Companion;
       3: aload_0
       4: invokevirtual #83                 // Method Day16$Companion.part2:(Ljava/util/List;)I
       7: istore_1
       8: getstatic     #67                 // Field java/lang/System.out:Ljava/io/PrintStream;
      11: iload_1
      12: invokevirtual #73                 // Method java/io/PrintStream.print:(I)V
      15: getstatic     #79                 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      18: areturn
}

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

  public final int part1(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String input
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/Iterable
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_3
      15: astore        5
      17: new           #26                 // class java/util/ArrayList
      20: dup
      21: aload_3
      22: bipush        10
      24: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #37                 // class java/util/Collection
      33: astore        6
      35: iconst_0
      36: istore        7
      38: aload         5
      40: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        8
      47: aload         8
      49: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          144
      57: aload         8
      59: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        9
      66: aload         6
      68: aload         9
      70: checkcast     #53                 // class java/lang/String
      73: astore        10
      75: astore        25
      77: iconst_0
      78: istore        11
      80: aload         10
      82: checkcast     #55                 // class java/lang/CharSequence
      85: iconst_4
      86: anewarray     #53                 // class java/lang/String
      89: astore        12
      91: aload         12
      93: iconst_0
      94: ldc           #57                 // String Valve
      96: aastore
      97: aload         12
      99: iconst_1
     100: ldc           #59                 // String  has flow rate=
     102: aastore
     103: aload         12
     105: iconst_2
     106: ldc           #61                 // String ; tunnel leads to valve
     108: aastore
     109: aload         12
     111: iconst_3
     112: ldc           #63                 // String ; tunnels lead to valves
     114: aastore
     115: aload         12
     117: iconst_0
     118: iconst_0
     119: bipush        6
     121: aconst_null
     122: invokestatic  #69                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     125: checkcast     #24                 // class java/lang/Iterable
     128: iconst_1
     129: invokestatic  #73                 // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
     132: aload         25
     134: swap
     135: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     140: pop
     141: goto          47
     144: aload         6
     146: checkcast     #79                 // class java/util/List
     149: nop
     150: checkcast     #24                 // class java/lang/Iterable
     153: astore_3
     154: nop
     155: iconst_0
     156: istore        4
     158: aload_3
     159: astore        5
     161: new           #26                 // class java/util/ArrayList
     164: dup
     165: aload_3
     166: bipush        10
     168: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     171: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     174: checkcast     #37                 // class java/util/Collection
     177: astore        6
     179: iconst_0
     180: istore        7
     182: aload         5
     184: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     189: astore        8
     191: aload         8
     193: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     198: ifeq          307
     201: aload         8
     203: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     208: astore        9
     210: aload         6
     212: aload         9
     214: checkcast     #79                 // class java/util/List
     217: astore        10
     219: astore        25
     221: iconst_0
     222: istore        11
     224: new           #81                 // class Day16$Valve
     227: dup
     228: aload         10
     230: iconst_0
     231: invokeinterface #85,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     236: checkcast     #53                 // class java/lang/String
     239: aload         10
     241: iconst_1
     242: invokeinterface #85,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     247: checkcast     #53                 // class java/lang/String
     250: invokestatic  #91                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     253: aload         10
     255: iconst_2
     256: invokeinterface #85,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     261: checkcast     #55                 // class java/lang/CharSequence
     264: iconst_1
     265: anewarray     #53                 // class java/lang/String
     268: astore        12
     270: aload         12
     272: iconst_0
     273: ldc           #93                 // String ,
     275: aastore
     276: aload         12
     278: iconst_0
     279: iconst_0
     280: bipush        6
     282: aconst_null
     283: invokestatic  #69                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     286: checkcast     #24                 // class java/lang/Iterable
     289: invokestatic  #97                 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     292: invokespecial #100                // Method Day16$Valve."<init>":(Ljava/lang/String;ILjava/util/Set;)V
     295: aload         25
     297: swap
     298: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     303: pop
     304: goto          191
     307: aload         6
     309: checkcast     #79                 // class java/util/List
     312: nop
     313: astore_2
     314: aload_2
     315: invokeinterface #101,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     320: astore_3
     321: aload_3
     322: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     327: ifeq          533
     330: aload_3
     331: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     336: checkcast     #81                 // class Day16$Valve
     339: astore        4
     341: aload         4
     343: invokevirtual #105                // Method Day16$Valve.getTunnels:()Ljava/util/Set;
     346: aload         4
     348: invokevirtual #108                // Method Day16$Valve.getTunnelsTo:()Ljava/util/Set;
     351: checkcast     #24                 // class java/lang/Iterable
     354: astore        5
     356: astore        25
     358: iconst_0
     359: istore        6
     361: aload         5
     363: astore        7
     365: new           #26                 // class java/util/ArrayList
     368: dup
     369: aload         5
     371: bipush        10
     373: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     376: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     379: checkcast     #37                 // class java/util/Collection
     382: astore        8
     384: iconst_0
     385: istore        9
     387: aload         7
     389: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     394: astore        10
     396: aload         10
     398: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     403: ifeq          512
     406: aload         10
     408: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     413: astore        11
     415: aload         8
     417: aload         11
     419: checkcast     #53                 // class java/lang/String
     422: astore        12
     424: astore        26
     426: iconst_0
     427: istore        13
     429: aload_2
     430: checkcast     #24                 // class java/lang/Iterable
     433: astore        14
     435: aload         14
     437: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     442: astore        15
     444: aload         15
     446: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     451: ifeq          491
     454: aload         15
     456: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     461: astore        16
     463: aload         16
     465: checkcast     #81                 // class Day16$Valve
     468: astore        17
     470: iconst_0
     471: istore        18
     473: aload         17
     475: invokevirtual #112                // Method Day16$Valve.getName:()Ljava/lang/String;
     478: aload         12
     480: invokestatic  #116                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     483: ifeq          444
     486: aload         16
     488: goto          492
     491: aconst_null
     492: dup
     493: invokestatic  #120                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     496: checkcast     #81                 // class Day16$Valve
     499: nop
     500: aload         26
     502: swap
     503: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     508: pop
     509: goto          396
     512: aload         8
     514: checkcast     #79                 // class java/util/List
     517: nop
     518: aload         25
     520: swap
     521: checkcast     #37                 // class java/util/Collection
     524: invokeinterface #126,  2          // InterfaceMethod java/util/Set.addAll:(Ljava/util/Collection;)Z
     529: pop
     530: goto          321
     533: aload_2
     534: checkcast     #24                 // class java/lang/Iterable
     537: astore        4
     539: iconst_0
     540: istore        5
     542: aload         4
     544: astore        6
     546: new           #26                 // class java/util/ArrayList
     549: dup
     550: invokespecial #127                // Method java/util/ArrayList."<init>":()V
     553: checkcast     #37                 // class java/util/Collection
     556: astore        7
     558: iconst_0
     559: istore        8
     561: aload         6
     563: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     568: astore        9
     570: aload         9
     572: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     577: ifeq          641
     580: aload         9
     582: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     587: astore        10
     589: aload         10
     591: checkcast     #81                 // class Day16$Valve
     594: astore        11
     596: iconst_0
     597: istore        12
     599: aload         11
     601: invokevirtual #131                // Method Day16$Valve.getRate:()I
     604: ifgt          620
     607: aload         11
     609: invokevirtual #112                // Method Day16$Valve.getName:()Ljava/lang/String;
     612: ldc           #133                // String AA
     614: invokestatic  #116                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     617: ifeq          624
     620: iconst_1
     621: goto          625
     624: iconst_0
     625: ifeq          570
     628: aload         7
     630: aload         10
     632: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     637: pop
     638: goto          570
     641: aload         7
     643: checkcast     #79                 // class java/util/List
     646: nop
     647: checkcast     #24                 // class java/lang/Iterable
     650: astore        4
     652: nop
     653: iconst_0
     654: istore        5
     656: new           #135                // class java/util/LinkedHashMap
     659: dup
     660: aload         4
     662: bipush        10
     664: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     667: invokestatic  #141                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     670: bipush        16
     672: invokestatic  #147                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     675: invokespecial #148                // Method java/util/LinkedHashMap."<init>":(I)V
     678: astore        6
     680: aload         4
     682: astore        7
     684: iconst_0
     685: istore        8
     687: aload         7
     689: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     694: astore        9
     696: aload         9
     698: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     703: ifeq          987
     706: aload         9
     708: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     713: astore        10
     715: aload         6
     717: checkcast     #150                // class java/util/Map
     720: aload         10
     722: aload         10
     724: checkcast     #81                 // class Day16$Valve
     727: astore        11
     729: astore        26
     731: astore        25
     733: iconst_0
     734: istore        12
     736: aload_2
     737: checkcast     #24                 // class java/lang/Iterable
     740: astore        13
     742: iconst_0
     743: istore        14
     745: aload         13
     747: astore        15
     749: new           #26                 // class java/util/ArrayList
     752: dup
     753: invokespecial #127                // Method java/util/ArrayList."<init>":()V
     756: checkcast     #37                 // class java/util/Collection
     759: astore        16
     761: iconst_0
     762: istore        17
     764: aload         15
     766: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     771: astore        18
     773: aload         18
     775: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     780: ifeq          838
     783: aload         18
     785: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     790: astore        19
     792: aload         19
     794: checkcast     #81                 // class Day16$Valve
     797: astore        20
     799: iconst_0
     800: istore        21
     802: aload         20
     804: aload         11
     806: if_acmpeq     821
     809: aload         20
     811: invokevirtual #131                // Method Day16$Valve.getRate:()I
     814: ifle          821
     817: iconst_1
     818: goto          822
     821: iconst_0
     822: ifeq          773
     825: aload         16
     827: aload         19
     829: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     834: pop
     835: goto          773
     838: aload         16
     840: checkcast     #79                 // class java/util/List
     843: nop
     844: checkcast     #24                 // class java/lang/Iterable
     847: astore        13
     849: nop
     850: iconst_0
     851: istore        14
     853: new           #135                // class java/util/LinkedHashMap
     856: dup
     857: aload         13
     859: bipush        10
     861: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     864: invokestatic  #141                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     867: bipush        16
     869: invokestatic  #147                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     872: invokespecial #148                // Method java/util/LinkedHashMap."<init>":(I)V
     875: astore        15
     877: aload         13
     879: astore        16
     881: iconst_0
     882: istore        17
     884: aload         16
     886: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     891: astore        18
     893: aload         18
     895: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     900: ifeq          963
     903: aload         18
     905: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     910: astore        19
     912: aload         15
     914: checkcast     #150                // class java/util/Map
     917: aload         19
     919: aload         19
     921: checkcast     #81                 // class Day16$Valve
     924: astore        20
     926: astore        22
     928: astore        23
     930: iconst_0
     931: istore        21
     933: getstatic     #155                // Field Day16.Companion:LDay16$Companion;
     936: aload         11
     938: aload         20
     940: invokespecial #159                // Method bfs:(LDay16$Valve;LDay16$Valve;)I
     943: invokestatic  #163                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     946: astore        24
     948: aload         23
     950: aload         22
     952: aload         24
     954: invokeinterface #167,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     959: pop
     960: goto          893
     963: aload         15
     965: checkcast     #150                // class java/util/Map
     968: nop
     969: nop
     970: astore        27
     972: aload         25
     974: aload         26
     976: aload         27
     978: invokeinterface #167,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     983: pop
     984: goto          696
     987: aload         6
     989: checkcast     #150                // class java/util/Map
     992: nop
     993: astore_3
     994: aload_3
     995: invokeinterface #170,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
    1000: checkcast     #24                 // class java/lang/Iterable
    1003: invokestatic  #174                // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
    1006: astore        5
    1008: iconst_0
    1009: istore        6
    1011: new           #135                // class java/util/LinkedHashMap
    1014: dup
    1015: aload         5
    1017: bipush        10
    1019: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
    1022: invokestatic  #141                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
    1025: bipush        16
    1027: invokestatic  #147                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
    1030: invokespecial #148                // Method java/util/LinkedHashMap."<init>":(I)V
    1033: astore        7
    1035: aload         5
    1037: astore        8
    1039: iconst_0
    1040: istore        9
    1042: aload         8
    1044: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1049: astore        10
    1051: aload         10
    1053: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1058: ifeq          1116
    1061: aload         10
    1063: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1068: astore        11
    1070: aload         7
    1072: checkcast     #150                // class java/util/Map
    1075: aload         11
    1077: aload         11
    1079: checkcast     #176                // class kotlin/collections/IndexedValue
    1082: astore        12
    1084: astore        26
    1086: astore        25
    1088: iconst_0
    1089: istore        13
    1091: aload         12
    1093: invokevirtual #179                // Method kotlin/collections/IndexedValue.getIndex:()I
    1096: invokestatic  #163                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1099: astore        27
    1101: aload         25
    1103: aload         26
    1105: aload         27
    1107: invokeinterface #167,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1112: pop
    1113: goto          1051
    1116: aload         7
    1118: checkcast     #150                // class java/util/Map
    1121: nop
    1122: astore        5
    1124: nop
    1125: iconst_0
    1126: istore        6
    1128: aload         5
    1130: astore        7
    1132: new           #135                // class java/util/LinkedHashMap
    1135: dup
    1136: aload         5
    1138: invokeinterface #182,  1          // InterfaceMethod java/util/Map.size:()I
    1143: invokestatic  #141                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
    1146: invokespecial #148                // Method java/util/LinkedHashMap."<init>":(I)V
    1149: checkcast     #150                // class java/util/Map
    1152: astore        8
    1154: iconst_0
    1155: istore        9
    1157: aload         7
    1159: invokeinterface #185,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
    1164: checkcast     #24                 // class java/lang/Iterable
    1167: astore        10
    1169: iconst_0
    1170: istore        11
    1172: aload         10
    1174: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1179: astore        12
    1181: aload         12
    1183: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1188: ifeq          1271
    1191: aload         12
    1193: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1198: astore        13
    1200: aload         8
    1202: aload         13
    1204: checkcast     #187                // class java/util/Map$Entry
    1207: astore        14
    1209: astore        25
    1211: iconst_0
    1212: istore        15
    1214: aload         14
    1216: invokeinterface #190,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
    1221: checkcast     #176                // class kotlin/collections/IndexedValue
    1224: invokevirtual #193                // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
    1227: checkcast     #81                 // class Day16$Valve
    1230: aload         25
    1232: swap
    1233: aload         13
    1235: checkcast     #187                // class java/util/Map$Entry
    1238: astore        16
    1240: astore        17
    1242: astore        18
    1244: iconst_0
    1245: istore        19
    1247: aload         16
    1249: invokeinterface #194,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
    1254: astore        14
    1256: aload         18
    1258: aload         17
    1260: aload         14
    1262: invokeinterface #167,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1267: pop
    1268: goto          1181
    1271: aload         8
    1273: nop
    1274: nop
    1275: astore        4
    1277: aload_0
    1278: aload_2
    1279: checkcast     #24                 // class java/lang/Iterable
    1282: astore        5
    1284: astore        25
    1286: aload         5
    1288: astore        6
    1290: aload         6
    1292: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1297: astore        7
    1299: aload         7
    1301: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1306: ifeq          1346
    1309: aload         7
    1311: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1316: astore        8
    1318: aload         8
    1320: checkcast     #81                 // class Day16$Valve
    1323: astore        9
    1325: iconst_0
    1326: istore        10
    1328: aload         9
    1330: invokevirtual #112                // Method Day16$Valve.getName:()Ljava/lang/String;
    1333: ldc           #133                // String AA
    1335: invokestatic  #116                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
    1338: ifeq          1299
    1341: aload         8
    1343: goto          1347
    1346: aconst_null
    1347: aload         25
    1349: swap
    1350: dup
    1351: invokestatic  #120                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
    1354: checkcast     #81                 // class Day16$Valve
    1357: aload_3
    1358: aload         4
    1360: iconst_0
    1361: iconst_0
    1362: bipush        24
    1364: aconst_null
    1365: invokestatic  #198                // Method dfs$default:(LDay16$Companion;LDay16$Valve;Ljava/util/Map;Ljava/util/Map;IIILjava/lang/Object;)I
    1368: ireturn

  private final int bfs(Day16$Valve, Day16$Valve);
    Code:
       0: new           #255                // class kotlin/collections/ArrayDeque
       3: dup
       4: invokespecial #256                // Method kotlin/collections/ArrayDeque."<init>":()V
       7: astore_3
       8: aload_3
       9: aload_1
      10: iconst_0
      11: invokestatic  #163                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      14: invokestatic  #261                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      17: invokevirtual #262                // Method kotlin/collections/ArrayDeque.add:(Ljava/lang/Object;)Z
      20: pop
      21: new           #264                // class java/util/LinkedHashSet
      24: dup
      25: invokespecial #265                // Method java/util/LinkedHashSet."<init>":()V
      28: checkcast     #122                // class java/util/Set
      31: astore        4
      33: aload_3
      34: checkcast     #37                 // class java/util/Collection
      37: invokeinterface #268,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      42: ifne          49
      45: iconst_1
      46: goto          50
      49: iconst_0
      50: ifeq          256
      53: aload_3
      54: invokevirtual #271                // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;
      57: checkcast     #273                // class kotlin/Pair
      60: astore        5
      62: aload         4
      64: aload         5
      66: invokevirtual #276                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      69: invokeinterface #279,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
      74: ifne          33
      77: aload         4
      79: aload         5
      81: invokevirtual #276                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      84: invokeinterface #280,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
      89: pop
      90: aload_2
      91: aload         5
      93: invokevirtual #276                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      96: invokestatic  #116                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      99: ifeq          114
     102: aload         5
     104: invokevirtual #283                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     107: checkcast     #285                // class java/lang/Number
     110: invokevirtual #288                // Method java/lang/Number.intValue:()I
     113: ireturn
     114: aload_3
     115: aload         5
     117: invokevirtual #276                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     120: checkcast     #81                 // class Day16$Valve
     123: invokevirtual #105                // Method Day16$Valve.getTunnels:()Ljava/util/Set;
     126: checkcast     #24                 // class java/lang/Iterable
     129: astore        6
     131: astore        15
     133: iconst_0
     134: istore        7
     136: aload         6
     138: astore        8
     140: new           #26                 // class java/util/ArrayList
     143: dup
     144: aload         6
     146: bipush        10
     148: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     151: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     154: checkcast     #37                 // class java/util/Collection
     157: astore        9
     159: iconst_0
     160: istore        10
     162: aload         8
     164: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     169: astore        11
     171: aload         11
     173: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     178: ifeq          237
     181: aload         11
     183: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     188: astore        12
     190: aload         9
     192: aload         12
     194: checkcast     #81                 // class Day16$Valve
     197: astore        13
     199: astore        16
     201: iconst_0
     202: istore        14
     204: aload         13
     206: aload         5
     208: invokevirtual #283                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     211: checkcast     #285                // class java/lang/Number
     214: invokevirtual #288                // Method java/lang/Number.intValue:()I
     217: iconst_1
     218: iadd
     219: invokestatic  #163                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     222: invokestatic  #261                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     225: aload         16
     227: swap
     228: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     233: pop
     234: goto          171
     237: aload         9
     239: checkcast     #79                 // class java/util/List
     242: nop
     243: aload         15
     245: swap
     246: checkcast     #37                 // class java/util/Collection
     249: invokevirtual #289                // Method kotlin/collections/ArrayDeque.addAll:(Ljava/util/Collection;)Z
     252: pop
     253: goto          33
     256: new           #291                // class java/lang/IllegalStateException
     259: dup
     260: ldc_w         #293                // String No Path Found
     263: invokevirtual #296                // Method java/lang/Object.toString:()Ljava/lang/String;
     266: invokespecial #299                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     269: athrow

  private final int dfs(Day16$Valve, java.util.Map<Day16$Valve, ? extends java.util.Map<Day16$Valve, java.lang.Integer>>, java.util.Map<Day16$Valve, java.lang.Integer>, int, int);
    Code:
       0: iconst_0
       1: istore        6
       3: aload_2
       4: aload_1
       5: invokeinterface #312,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      10: dup
      11: invokestatic  #120                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      14: checkcast     #150                // class java/util/Map
      17: invokeinterface #185,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      22: invokeinterface #313,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      27: astore        7
      29: aload         7
      31: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      36: ifeq          162
      39: aload         7
      41: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      46: checkcast     #187                // class java/util/Map$Entry
      49: astore        8
      51: aload         8
      53: invokeinterface #190,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      58: checkcast     #81                 // class Day16$Valve
      61: astore        9
      63: aload         8
      65: invokeinterface #194,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
      70: checkcast     #285                // class java/lang/Number
      73: invokevirtual #288                // Method java/lang/Number.intValue:()I
      76: istore        10
      78: iconst_1
      79: aload_3
      80: aload         9
      82: invokeinterface #312,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      87: dup
      88: invokestatic  #120                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      91: checkcast     #285                // class java/lang/Number
      94: invokevirtual #288                // Method java/lang/Number.intValue:()I
      97: ishl
      98: istore        11
     100: iload         5
     102: iload         11
     104: iand
     105: ifle          111
     108: goto          29
     111: iload         4
     113: iload         10
     115: isub
     116: iconst_1
     117: isub
     118: istore        12
     120: iload         12
     122: ifgt          128
     125: goto          29
     128: iload         6
     130: aload_0
     131: aload         9
     133: aload_2
     134: aload_3
     135: iload         12
     137: iload         5
     139: iload         11
     141: ior
     142: invokespecial #315                // Method dfs:(LDay16$Valve;Ljava/util/Map;Ljava/util/Map;II)I
     145: aload         9
     147: invokevirtual #131                // Method Day16$Valve.getRate:()I
     150: iload         12
     152: imul
     153: iadd
     154: invokestatic  #320                // Method java/lang/Math.max:(II)I
     157: istore        6
     159: goto          29
     162: iload         6
     164: ireturn

  static int dfs$default(Day16$Companion, Day16$Valve, java.util.Map, java.util.Map, int, int, int, java.lang.Object);
    Code:
       0: iload         6
       2: bipush        8
       4: iand
       5: ifeq          12
       8: bipush        30
      10: istore        4
      12: iload         6
      14: bipush        16
      16: iand
      17: ifeq          23
      20: iconst_0
      21: istore        5
      23: aload_0
      24: aload_1
      25: aload_2
      26: aload_3
      27: iload         4
      29: iload         5
      31: invokespecial #315                // Method dfs:(LDay16$Valve;Ljava/util/Map;Ljava/util/Map;II)I
      34: ireturn

  private final int dfs_v1(java.util.List<Day16$Valve>, java.util.Map<Day16$Valve, ? extends java.util.Map<Day16$Valve, java.lang.Integer>>, int);
    Code:
       0: iload_3
       1: iconst_1
       2: if_icmpgt     7
       5: iconst_0
       6: ireturn
       7: aload_1
       8: invokestatic  #335                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      11: checkcast     #81                 // class Day16$Valve
      14: astore        4
      16: aload         4
      18: invokevirtual #131                // Method Day16$Valve.getRate:()I
      21: ifle          28
      24: iconst_1
      25: goto          29
      28: iconst_0
      29: istore        5
      31: aload         4
      33: invokevirtual #131                // Method Day16$Valve.getRate:()I
      36: iload_3
      37: iload         5
      39: isub
      40: imul
      41: istore        6
      43: aload_2
      44: aload         4
      46: invokeinterface #312,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      51: dup
      52: invokestatic  #120                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      55: checkcast     #150                // class java/util/Map
      58: astore        8
      60: iconst_0
      61: istore        9
      63: aload         8
      65: astore        10
      67: new           #135                // class java/util/LinkedHashMap
      70: dup
      71: invokespecial #336                // Method java/util/LinkedHashMap."<init>":()V
      74: checkcast     #150                // class java/util/Map
      77: astore        11
      79: iconst_0
      80: istore        12
      82: aload         10
      84: invokeinterface #185,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      89: invokeinterface #313,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      94: astore        13
      96: aload         13
      98: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     103: ifeq          174
     106: aload         13
     108: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     113: checkcast     #187                // class java/util/Map$Entry
     116: astore        14
     118: aload         14
     120: astore        15
     122: iconst_0
     123: istore        16
     125: aload_1
     126: aload         15
     128: invokeinterface #190,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     133: invokeinterface #337,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     138: ifne          145
     141: iconst_1
     142: goto          146
     145: iconst_0
     146: ifeq          96
     149: aload         11
     151: aload         14
     153: invokeinterface #190,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     158: aload         14
     160: invokeinterface #194,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     165: invokeinterface #167,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     170: pop
     171: goto          96
     174: aload         11
     176: nop
     177: astore        7
     179: aload         7
     181: invokeinterface #338,  1          // InterfaceMethod java/util/Map.isEmpty:()Z
     186: ifeq          192
     189: iload         6
     191: ireturn
     192: iload         6
     194: aload         7
     196: astore        9
     198: istore        20
     200: aload         9
     202: invokeinterface #185,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     207: checkcast     #24                 // class java/lang/Iterable
     210: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     215: astore        10
     217: aload         10
     219: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     224: ifne          231
     227: aconst_null
     228: goto          514
     231: aload         10
     233: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     238: checkcast     #187                // class java/util/Map$Entry
     241: astore        11
     243: iconst_0
     244: istore        12
     246: aload         11
     248: invokeinterface #190,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     253: checkcast     #81                 // class Day16$Valve
     256: astore        13
     258: aload         11
     260: invokeinterface #194,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     265: checkcast     #285                // class java/lang/Number
     268: invokevirtual #288                // Method java/lang/Number.intValue:()I
     271: istore        14
     273: getstatic     #155                // Field Day16.Companion:LDay16$Companion;
     276: new           #340                // class kotlin/jvm/internal/SpreadBuilder
     279: dup
     280: iconst_2
     281: invokespecial #341                // Method kotlin/jvm/internal/SpreadBuilder."<init>":(I)V
     284: astore        15
     286: aload         15
     288: aload_1
     289: checkcast     #37                 // class java/util/Collection
     292: astore        16
     294: iconst_0
     295: istore        17
     297: aload         16
     299: astore        18
     301: aload         18
     303: iconst_0
     304: anewarray     #81                 // class Day16$Valve
     307: invokeinterface #345,  2          // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     312: invokevirtual #348                // Method kotlin/jvm/internal/SpreadBuilder.addSpread:(Ljava/lang/Object;)V
     315: aload         15
     317: aload         13
     319: invokevirtual #350                // Method kotlin/jvm/internal/SpreadBuilder.add:(Ljava/lang/Object;)V
     322: aload         15
     324: aload         15
     326: invokevirtual #351                // Method kotlin/jvm/internal/SpreadBuilder.size:()I
     329: anewarray     #81                 // class Day16$Valve
     332: invokevirtual #352                // Method kotlin/jvm/internal/SpreadBuilder.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     335: invokestatic  #356                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     338: aload_2
     339: iload_3
     340: iload         5
     342: iload         14
     344: iadd
     345: isub
     346: invokespecial #358                // Method dfs_v1:(Ljava/util/List;Ljava/util/Map;I)I
     349: invokestatic  #163                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     352: checkcast     #360                // class java/lang/Comparable
     355: astore        11
     357: aload         10
     359: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     364: ifeq          512
     367: aload         10
     369: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     374: checkcast     #187                // class java/util/Map$Entry
     377: astore        12
     379: iconst_0
     380: istore        13
     382: aload         12
     384: invokeinterface #190,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     389: checkcast     #81                 // class Day16$Valve
     392: astore        14
     394: aload         12
     396: invokeinterface #194,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     401: checkcast     #285                // class java/lang/Number
     404: invokevirtual #288                // Method java/lang/Number.intValue:()I
     407: istore        15
     409: getstatic     #155                // Field Day16.Companion:LDay16$Companion;
     412: new           #340                // class kotlin/jvm/internal/SpreadBuilder
     415: dup
     416: iconst_2
     417: invokespecial #341                // Method kotlin/jvm/internal/SpreadBuilder."<init>":(I)V
     420: astore        16
     422: aload         16
     424: aload_1
     425: checkcast     #37                 // class java/util/Collection
     428: astore        17
     430: iconst_0
     431: istore        18
     433: aload         17
     435: astore        19
     437: aload         19
     439: iconst_0
     440: anewarray     #81                 // class Day16$Valve
     443: invokeinterface #345,  2          // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     448: invokevirtual #348                // Method kotlin/jvm/internal/SpreadBuilder.addSpread:(Ljava/lang/Object;)V
     451: aload         16
     453: aload         14
     455: invokevirtual #350                // Method kotlin/jvm/internal/SpreadBuilder.add:(Ljava/lang/Object;)V
     458: aload         16
     460: aload         16
     462: invokevirtual #351                // Method kotlin/jvm/internal/SpreadBuilder.size:()I
     465: anewarray     #81                 // class Day16$Valve
     468: invokevirtual #352                // Method kotlin/jvm/internal/SpreadBuilder.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     471: invokestatic  #356                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     474: aload_2
     475: iload_3
     476: iload         5
     478: iload         15
     480: iadd
     481: isub
     482: invokespecial #358                // Method dfs_v1:(Ljava/util/List;Ljava/util/Map;I)I
     485: invokestatic  #163                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     488: checkcast     #360                // class java/lang/Comparable
     491: astore        12
     493: aload         11
     495: aload         12
     497: invokeinterface #364,  2          // InterfaceMethod java/lang/Comparable.compareTo:(Ljava/lang/Object;)I
     502: ifge          357
     505: aload         12
     507: astore        11
     509: goto          357
     512: aload         11
     514: astore        21
     516: iload         20
     518: aload         21
     520: checkcast     #87                 // class java/lang/Integer
     523: dup
     524: ifnull        533
     527: invokevirtual #365                // Method java/lang/Integer.intValue:()I
     530: goto          535
     533: pop
     534: iconst_0
     535: iadd
     536: ireturn

  static int dfs_v1$default(Day16$Companion, java.util.List, java.util.Map, int, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_4
       3: iand
       4: ifeq          10
       7: bipush        30
       9: istore_3
      10: aload_0
      11: aload_1
      12: aload_2
      13: iload_3
      14: invokespecial #358                // Method dfs_v1:(Ljava/util/List;Ljava/util/Map;I)I
      17: ireturn

  public final int part2(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String input
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/Iterable
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_3
      15: astore        5
      17: new           #26                 // class java/util/ArrayList
      20: dup
      21: aload_3
      22: bipush        10
      24: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #37                 // class java/util/Collection
      33: astore        6
      35: iconst_0
      36: istore        7
      38: aload         5
      40: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        8
      47: aload         8
      49: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          144
      57: aload         8
      59: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        9
      66: aload         6
      68: aload         9
      70: checkcast     #53                 // class java/lang/String
      73: astore        10
      75: astore        25
      77: iconst_0
      78: istore        11
      80: aload         10
      82: checkcast     #55                 // class java/lang/CharSequence
      85: iconst_4
      86: anewarray     #53                 // class java/lang/String
      89: astore        12
      91: aload         12
      93: iconst_0
      94: ldc           #57                 // String Valve
      96: aastore
      97: aload         12
      99: iconst_1
     100: ldc           #59                 // String  has flow rate=
     102: aastore
     103: aload         12
     105: iconst_2
     106: ldc           #61                 // String ; tunnel leads to valve
     108: aastore
     109: aload         12
     111: iconst_3
     112: ldc           #63                 // String ; tunnels lead to valves
     114: aastore
     115: aload         12
     117: iconst_0
     118: iconst_0
     119: bipush        6
     121: aconst_null
     122: invokestatic  #69                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     125: checkcast     #24                 // class java/lang/Iterable
     128: iconst_1
     129: invokestatic  #73                 // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
     132: aload         25
     134: swap
     135: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     140: pop
     141: goto          47
     144: aload         6
     146: checkcast     #79                 // class java/util/List
     149: nop
     150: checkcast     #24                 // class java/lang/Iterable
     153: astore_3
     154: nop
     155: iconst_0
     156: istore        4
     158: aload_3
     159: astore        5
     161: new           #26                 // class java/util/ArrayList
     164: dup
     165: aload_3
     166: bipush        10
     168: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     171: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     174: checkcast     #37                 // class java/util/Collection
     177: astore        6
     179: iconst_0
     180: istore        7
     182: aload         5
     184: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     189: astore        8
     191: aload         8
     193: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     198: ifeq          307
     201: aload         8
     203: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     208: astore        9
     210: aload         6
     212: aload         9
     214: checkcast     #79                 // class java/util/List
     217: astore        10
     219: astore        25
     221: iconst_0
     222: istore        11
     224: new           #81                 // class Day16$Valve
     227: dup
     228: aload         10
     230: iconst_0
     231: invokeinterface #85,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     236: checkcast     #53                 // class java/lang/String
     239: aload         10
     241: iconst_1
     242: invokeinterface #85,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     247: checkcast     #53                 // class java/lang/String
     250: invokestatic  #91                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     253: aload         10
     255: iconst_2
     256: invokeinterface #85,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     261: checkcast     #55                 // class java/lang/CharSequence
     264: iconst_1
     265: anewarray     #53                 // class java/lang/String
     268: astore        12
     270: aload         12
     272: iconst_0
     273: ldc           #93                 // String ,
     275: aastore
     276: aload         12
     278: iconst_0
     279: iconst_0
     280: bipush        6
     282: aconst_null
     283: invokestatic  #69                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     286: checkcast     #24                 // class java/lang/Iterable
     289: invokestatic  #97                 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     292: invokespecial #100                // Method Day16$Valve."<init>":(Ljava/lang/String;ILjava/util/Set;)V
     295: aload         25
     297: swap
     298: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     303: pop
     304: goto          191
     307: aload         6
     309: checkcast     #79                 // class java/util/List
     312: nop
     313: astore_2
     314: aload_2
     315: invokeinterface #101,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     320: astore_3
     321: aload_3
     322: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     327: ifeq          533
     330: aload_3
     331: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     336: checkcast     #81                 // class Day16$Valve
     339: astore        4
     341: aload         4
     343: invokevirtual #105                // Method Day16$Valve.getTunnels:()Ljava/util/Set;
     346: aload         4
     348: invokevirtual #108                // Method Day16$Valve.getTunnelsTo:()Ljava/util/Set;
     351: checkcast     #24                 // class java/lang/Iterable
     354: astore        5
     356: astore        25
     358: iconst_0
     359: istore        6
     361: aload         5
     363: astore        7
     365: new           #26                 // class java/util/ArrayList
     368: dup
     369: aload         5
     371: bipush        10
     373: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     376: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     379: checkcast     #37                 // class java/util/Collection
     382: astore        8
     384: iconst_0
     385: istore        9
     387: aload         7
     389: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     394: astore        10
     396: aload         10
     398: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     403: ifeq          512
     406: aload         10
     408: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     413: astore        11
     415: aload         8
     417: aload         11
     419: checkcast     #53                 // class java/lang/String
     422: astore        12
     424: astore        26
     426: iconst_0
     427: istore        13
     429: aload_2
     430: checkcast     #24                 // class java/lang/Iterable
     433: astore        14
     435: aload         14
     437: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     442: astore        15
     444: aload         15
     446: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     451: ifeq          491
     454: aload         15
     456: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     461: astore        16
     463: aload         16
     465: checkcast     #81                 // class Day16$Valve
     468: astore        17
     470: iconst_0
     471: istore        18
     473: aload         17
     475: invokevirtual #112                // Method Day16$Valve.getName:()Ljava/lang/String;
     478: aload         12
     480: invokestatic  #116                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     483: ifeq          444
     486: aload         16
     488: goto          492
     491: aconst_null
     492: dup
     493: invokestatic  #120                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     496: checkcast     #81                 // class Day16$Valve
     499: nop
     500: aload         26
     502: swap
     503: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     508: pop
     509: goto          396
     512: aload         8
     514: checkcast     #79                 // class java/util/List
     517: nop
     518: aload         25
     520: swap
     521: checkcast     #37                 // class java/util/Collection
     524: invokeinterface #126,  2          // InterfaceMethod java/util/Set.addAll:(Ljava/util/Collection;)Z
     529: pop
     530: goto          321
     533: aload_2
     534: checkcast     #24                 // class java/lang/Iterable
     537: astore        4
     539: iconst_0
     540: istore        5
     542: aload         4
     544: astore        6
     546: new           #26                 // class java/util/ArrayList
     549: dup
     550: invokespecial #127                // Method java/util/ArrayList."<init>":()V
     553: checkcast     #37                 // class java/util/Collection
     556: astore        7
     558: iconst_0
     559: istore        8
     561: aload         6
     563: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     568: astore        9
     570: aload         9
     572: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     577: ifeq          641
     580: aload         9
     582: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     587: astore        10
     589: aload         10
     591: checkcast     #81                 // class Day16$Valve
     594: astore        11
     596: iconst_0
     597: istore        12
     599: aload         11
     601: invokevirtual #131                // Method Day16$Valve.getRate:()I
     604: ifgt          620
     607: aload         11
     609: invokevirtual #112                // Method Day16$Valve.getName:()Ljava/lang/String;
     612: ldc           #133                // String AA
     614: invokestatic  #116                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     617: ifeq          624
     620: iconst_1
     621: goto          625
     624: iconst_0
     625: ifeq          570
     628: aload         7
     630: aload         10
     632: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     637: pop
     638: goto          570
     641: aload         7
     643: checkcast     #79                 // class java/util/List
     646: nop
     647: checkcast     #24                 // class java/lang/Iterable
     650: astore        4
     652: nop
     653: iconst_0
     654: istore        5
     656: new           #135                // class java/util/LinkedHashMap
     659: dup
     660: aload         4
     662: bipush        10
     664: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     667: invokestatic  #141                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     670: bipush        16
     672: invokestatic  #147                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     675: invokespecial #148                // Method java/util/LinkedHashMap."<init>":(I)V
     678: astore        6
     680: aload         4
     682: astore        7
     684: iconst_0
     685: istore        8
     687: aload         7
     689: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     694: astore        9
     696: aload         9
     698: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     703: ifeq          987
     706: aload         9
     708: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     713: astore        10
     715: aload         6
     717: checkcast     #150                // class java/util/Map
     720: aload         10
     722: aload         10
     724: checkcast     #81                 // class Day16$Valve
     727: astore        11
     729: astore        26
     731: astore        25
     733: iconst_0
     734: istore        12
     736: aload_2
     737: checkcast     #24                 // class java/lang/Iterable
     740: astore        13
     742: iconst_0
     743: istore        14
     745: aload         13
     747: astore        15
     749: new           #26                 // class java/util/ArrayList
     752: dup
     753: invokespecial #127                // Method java/util/ArrayList."<init>":()V
     756: checkcast     #37                 // class java/util/Collection
     759: astore        16
     761: iconst_0
     762: istore        17
     764: aload         15
     766: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     771: astore        18
     773: aload         18
     775: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     780: ifeq          838
     783: aload         18
     785: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     790: astore        19
     792: aload         19
     794: checkcast     #81                 // class Day16$Valve
     797: astore        20
     799: iconst_0
     800: istore        21
     802: aload         20
     804: aload         11
     806: if_acmpeq     821
     809: aload         20
     811: invokevirtual #131                // Method Day16$Valve.getRate:()I
     814: ifle          821
     817: iconst_1
     818: goto          822
     821: iconst_0
     822: ifeq          773
     825: aload         16
     827: aload         19
     829: invokeinterface #77,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     834: pop
     835: goto          773
     838: aload         16
     840: checkcast     #79                 // class java/util/List
     843: nop
     844: checkcast     #24                 // class java/lang/Iterable
     847: astore        13
     849: nop
     850: iconst_0
     851: istore        14
     853: new           #135                // class java/util/LinkedHashMap
     856: dup
     857: aload         13
     859: bipush        10
     861: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     864: invokestatic  #141                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     867: bipush        16
     869: invokestatic  #147                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     872: invokespecial #148                // Method java/util/LinkedHashMap."<init>":(I)V
     875: astore        15
     877: aload         13
     879: astore        16
     881: iconst_0
     882: istore        17
     884: aload         16
     886: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     891: astore        18
     893: aload         18
     895: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     900: ifeq          963
     903: aload         18
     905: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     910: astore        19
     912: aload         15
     914: checkcast     #150                // class java/util/Map
     917: aload         19
     919: aload         19
     921: checkcast     #81                 // class Day16$Valve
     924: astore        20
     926: astore        22
     928: astore        23
     930: iconst_0
     931: istore        21
     933: getstatic     #155                // Field Day16.Companion:LDay16$Companion;
     936: aload         11
     938: aload         20
     940: invokespecial #159                // Method bfs:(LDay16$Valve;LDay16$Valve;)I
     943: invokestatic  #163                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     946: astore        24
     948: aload         23
     950: aload         22
     952: aload         24
     954: invokeinterface #167,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     959: pop
     960: goto          893
     963: aload         15
     965: checkcast     #150                // class java/util/Map
     968: nop
     969: nop
     970: astore        27
     972: aload         25
     974: aload         26
     976: aload         27
     978: invokeinterface #167,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     983: pop
     984: goto          696
     987: aload         6
     989: checkcast     #150                // class java/util/Map
     992: nop
     993: astore_3
     994: aload_3
     995: invokeinterface #170,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
    1000: checkcast     #24                 // class java/lang/Iterable
    1003: invokestatic  #174                // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
    1006: astore        5
    1008: iconst_0
    1009: istore        6
    1011: new           #135                // class java/util/LinkedHashMap
    1014: dup
    1015: aload         5
    1017: bipush        10
    1019: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
    1022: invokestatic  #141                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
    1025: bipush        16
    1027: invokestatic  #147                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
    1030: invokespecial #148                // Method java/util/LinkedHashMap."<init>":(I)V
    1033: astore        7
    1035: aload         5
    1037: astore        8
    1039: iconst_0
    1040: istore        9
    1042: aload         8
    1044: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1049: astore        10
    1051: aload         10
    1053: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1058: ifeq          1116
    1061: aload         10
    1063: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1068: astore        11
    1070: aload         7
    1072: checkcast     #150                // class java/util/Map
    1075: aload         11
    1077: aload         11
    1079: checkcast     #176                // class kotlin/collections/IndexedValue
    1082: astore        12
    1084: astore        26
    1086: astore        25
    1088: iconst_0
    1089: istore        13
    1091: aload         12
    1093: invokevirtual #179                // Method kotlin/collections/IndexedValue.getIndex:()I
    1096: invokestatic  #163                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1099: astore        27
    1101: aload         25
    1103: aload         26
    1105: aload         27
    1107: invokeinterface #167,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1112: pop
    1113: goto          1051
    1116: aload         7
    1118: checkcast     #150                // class java/util/Map
    1121: nop
    1122: astore        5
    1124: nop
    1125: iconst_0
    1126: istore        6
    1128: aload         5
    1130: astore        7
    1132: new           #135                // class java/util/LinkedHashMap
    1135: dup
    1136: aload         5
    1138: invokeinterface #182,  1          // InterfaceMethod java/util/Map.size:()I
    1143: invokestatic  #141                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
    1146: invokespecial #148                // Method java/util/LinkedHashMap."<init>":(I)V
    1149: checkcast     #150                // class java/util/Map
    1152: astore        8
    1154: iconst_0
    1155: istore        9
    1157: aload         7
    1159: invokeinterface #185,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
    1164: checkcast     #24                 // class java/lang/Iterable
    1167: astore        10
    1169: iconst_0
    1170: istore        11
    1172: aload         10
    1174: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1179: astore        12
    1181: aload         12
    1183: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1188: ifeq          1271
    1191: aload         12
    1193: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1198: astore        13
    1200: aload         8
    1202: aload         13
    1204: checkcast     #187                // class java/util/Map$Entry
    1207: astore        14
    1209: astore        25
    1211: iconst_0
    1212: istore        15
    1214: aload         14
    1216: invokeinterface #190,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
    1221: checkcast     #176                // class kotlin/collections/IndexedValue
    1224: invokevirtual #193                // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
    1227: checkcast     #81                 // class Day16$Valve
    1230: aload         25
    1232: swap
    1233: aload         13
    1235: checkcast     #187                // class java/util/Map$Entry
    1238: astore        16
    1240: astore        17
    1242: astore        18
    1244: iconst_0
    1245: istore        19
    1247: aload         16
    1249: invokeinterface #194,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
    1254: astore        14
    1256: aload         18
    1258: aload         17
    1260: aload         14
    1262: invokeinterface #167,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1267: pop
    1268: goto          1181
    1271: aload         8
    1273: nop
    1274: nop
    1275: astore        4
    1277: aload_2
    1278: checkcast     #24                 // class java/lang/Iterable
    1281: astore        7
    1283: aload         7
    1285: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1290: astore        8
    1292: aload         8
    1294: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1299: ifeq          1339
    1302: aload         8
    1304: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1309: astore        9
    1311: aload         9
    1313: checkcast     #81                 // class Day16$Valve
    1316: astore        10
    1318: iconst_0
    1319: istore        11
    1321: aload         10
    1323: invokevirtual #112                // Method Day16$Valve.getName:()Ljava/lang/String;
    1326: ldc           #133                // String AA
    1328: invokestatic  #116                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
    1331: ifeq          1292
    1334: aload         9
    1336: goto          1340
    1339: aconst_null
    1340: dup
    1341: invokestatic  #120                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
    1344: checkcast     #81                 // class Day16$Valve
    1347: astore        5
    1349: iconst_1
    1350: aload         4
    1352: invokeinterface #182,  1          // InterfaceMethod java/util/Map.size:()I
    1357: ishl
    1358: iconst_1
    1359: isub
    1360: istore        6
    1362: iconst_0
    1363: istore        7
    1365: iconst_0
    1366: istore        8
    1368: iload         6
    1370: iconst_2
    1371: idiv
    1372: istore        9
    1374: iload         8
    1376: iload         9
    1378: if_icmpgt     1431
    1381: iload         7
    1383: aload_0
    1384: aload         5
    1386: aload_3
    1387: aload         4
    1389: bipush        26
    1391: iload         8
    1393: invokespecial #315                // Method dfs:(LDay16$Valve;Ljava/util/Map;Ljava/util/Map;II)I
    1396: aload_0
    1397: aload         5
    1399: aload_3
    1400: aload         4
    1402: bipush        26
    1404: iload         6
    1406: iload         8
    1408: ixor
    1409: invokespecial #315                // Method dfs:(LDay16$Valve;Ljava/util/Map;Ljava/util/Map;II)I
    1412: iadd
    1413: invokestatic  #320                // Method java/lang/Math.max:(II)I
    1416: istore        7
    1418: iload         8
    1420: iload         9
    1422: if_icmpeq     1431
    1425: iinc          8, 1
    1428: goto          1381
    1431: iload         7
    1433: ireturn

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