object Day02 {

    private val plays = Play.values().asSequence()
    private val results = Result.values().asSequence()

    enum class Play(val symbol: String, val score: Int) {
        Rock("A", 1),
        Paper("B", 2),
        Scissors("C", 3),
    }

    enum class Result(val symbol: String, val score: Int) {
        Lose("X", 0),
        Draw("Y", 3),
        Win("Z", 6),
    }

    fun part1(input: String): Int =
        input.lines().sumOf(::part1ScoreOf)

    fun part2(input: String): Int =
        input.lineSequence().sumOf(::part2ScoreOf)

    private fun parsePlay(input: String): Play = plays.first { it.symbol == input }
    private fun parseResult(input: String): Result = results.first { it.symbol == input }

    private fun part1ScoreOf(line: String): Int {
        val (opponent, me) = line.split(' ')
        return score(
            parsePlay(opponent),
            when (me) {
                "X" -> Play.Rock
                "Y" -> Play.Paper
                else -> Play.Scissors
            }
        )
    }

    private fun part2ScoreOf(line: String): Int {
        val (opponent, wanted) = line.split(' ')
            .let { (op, wanted) -> parsePlay(op) to parseResult(wanted) }
        val me = whatToPlay(opponent, wanted)
        return wanted.score + me.score
    }

    private fun score(opponent: Play, me: Play): Int =
        resultOf(opponent, me).score + me.score

    private fun resultOf(opponent: Play, me: Play): Result =
        results.first { whatToPlay(opponent, it) == me }

    fun whatToPlay(opponent: Play, wantedResult: Result): Play = when (wantedResult) {
        Result.Draw -> opponent
        Result.Win -> when (opponent) {
            Play.Rock -> Play.Paper
            Play.Paper -> Play.Scissors
            Play.Scissors -> Play.Rock
        }
        Result.Lose -> plays.first { whatToPlay(it, Result.Win) == opponent }
    }
}

Compiled from "Day02.kt"
public final class Day02$Play extends java.lang.Enum<Day02$Play> {
  private final java.lang.String symbol;

  private final int score;

  public static final Day02$Play Rock;

  public static final Day02$Play Paper;

  public static final Day02$Play Scissors;

  private static final Day02$Play[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

  private Day02$Play(java.lang.String, int);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #10                 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
       6: aload_0
       7: aload_3
       8: putfield      #14                 // Field symbol:Ljava/lang/String;
      11: aload_0
      12: iload         4
      14: putfield      #18                 // Field score:I
      17: return

  public final java.lang.String getSymbol();
    Code:
       0: aload_0
       1: getfield      #14                 // Field symbol:Ljava/lang/String;
       4: areturn

  public final int getScore();
    Code:
       0: aload_0
       1: getfield      #18                 // Field score:I
       4: ireturn

  public static Day02$Play[] values();
    Code:
       0: getstatic     #33                 // Field $VALUES:[LDay02$Play;
       3: invokevirtual #39                 // Method java/lang/Object.clone:()Ljava/lang/Object;
       6: checkcast     #40                 // class "[LDay02$Play;"
       9: areturn

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

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

  private static final Day02$Play[] $values();
    Code:
       0: iconst_3
       1: anewarray     #2                  // class Day02$Play
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #57                 // Field Rock:LDay02$Play;
      10: aastore
      11: aload_0
      12: iconst_1
      13: getstatic     #60                 // Field Paper:LDay02$Play;
      16: aastore
      17: aload_0
      18: iconst_2
      19: getstatic     #63                 // Field Scissors:LDay02$Play;
      22: aastore
      23: aload_0
      24: areturn

  static {};
    Code:
       0: new           #2                  // class Day02$Play
       3: dup
       4: ldc           #66                 // String Rock
       6: iconst_0
       7: ldc           #68                 // String A
       9: iconst_1
      10: invokespecial #70                 // Method "<init>":(Ljava/lang/String;ILjava/lang/String;I)V
      13: putstatic     #57                 // Field Rock:LDay02$Play;
      16: new           #2                  // class Day02$Play
      19: dup
      20: ldc           #71                 // String Paper
      22: iconst_1
      23: ldc           #73                 // String B
      25: iconst_2
      26: invokespecial #70                 // Method "<init>":(Ljava/lang/String;ILjava/lang/String;I)V
      29: putstatic     #60                 // Field Paper:LDay02$Play;
      32: new           #2                  // class Day02$Play
      35: dup
      36: ldc           #74                 // String Scissors
      38: iconst_2
      39: ldc           #76                 // String C
      41: iconst_3
      42: invokespecial #70                 // Method "<init>":(Ljava/lang/String;ILjava/lang/String;I)V
      45: putstatic     #63                 // Field Scissors:LDay02$Play;
      48: invokestatic  #78                 // Method $values:()[LDay02$Play;
      51: putstatic     #33                 // Field $VALUES:[LDay02$Play;
      54: getstatic     #33                 // Field $VALUES:[LDay02$Play;
      57: checkcast     #80                 // class "[Ljava/lang/Enum;"
      60: invokestatic  #86                 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
      63: putstatic     #53                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
      66: return
}

Compiled from "Day02.kt"
public final class Day02$WhenMappings {
  public static final int[] $EnumSwitchMapping$0;

  public static final int[] $EnumSwitchMapping$1;

  static {};
    Code:
       0: invokestatic  #14                 // Method Day02$Play.values:()[LDay02$Play;
       3: arraylength
       4: newarray       int
       6: astore_0
       7: nop
       8: aload_0
       9: getstatic     #18                 // Field Day02$Play.Rock:LDay02$Play;
      12: invokevirtual #22                 // Method Day02$Play.ordinal:()I
      15: iconst_1
      16: iastore
      17: goto          21
      20: astore_1
      21: nop
      22: aload_0
      23: getstatic     #25                 // Field Day02$Play.Paper:LDay02$Play;
      26: invokevirtual #22                 // Method Day02$Play.ordinal:()I
      29: iconst_2
      30: iastore
      31: goto          35
      34: astore_1
      35: nop
      36: aload_0
      37: getstatic     #28                 // Field Day02$Play.Scissors:LDay02$Play;
      40: invokevirtual #22                 // Method Day02$Play.ordinal:()I
      43: iconst_3
      44: iastore
      45: goto          49
      48: astore_1
      49: aload_0
      50: putstatic     #32                 // Field $EnumSwitchMapping$0:[I
      53: invokestatic  #37                 // Method Day02$Result.values:()[LDay02$Result;
      56: arraylength
      57: newarray       int
      59: astore_0
      60: nop
      61: aload_0
      62: getstatic     #41                 // Field Day02$Result.Draw:LDay02$Result;
      65: invokevirtual #42                 // Method Day02$Result.ordinal:()I
      68: iconst_1
      69: iastore
      70: goto          74
      73: astore_1
      74: nop
      75: aload_0
      76: getstatic     #45                 // Field Day02$Result.Win:LDay02$Result;
      79: invokevirtual #42                 // Method Day02$Result.ordinal:()I
      82: iconst_2
      83: iastore
      84: goto          88
      87: astore_1
      88: nop
      89: aload_0
      90: getstatic     #48                 // Field Day02$Result.Lose:LDay02$Result;
      93: invokevirtual #42                 // Method Day02$Result.ordinal:()I
      96: iconst_3
      97: iastore
      98: goto          102
     101: astore_1
     102: aload_0
     103: putstatic     #51                 // Field $EnumSwitchMapping$1:[I
     106: return
    Exception table:
       from    to  target type
           7    17    20   Class java/lang/NoSuchFieldError
          21    31    34   Class java/lang/NoSuchFieldError
          35    45    48   Class java/lang/NoSuchFieldError
          60    70    73   Class java/lang/NoSuchFieldError
          74    84    87   Class java/lang/NoSuchFieldError
          88    98   101   Class java/lang/NoSuchFieldError
}

Compiled from "Day02.kt"
public final class Day02$Result extends java.lang.Enum<Day02$Result> {
  private final java.lang.String symbol;

  private final int score;

  public static final Day02$Result Lose;

  public static final Day02$Result Draw;

  public static final Day02$Result Win;

  private static final Day02$Result[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

  private Day02$Result(java.lang.String, int);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #10                 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
       6: aload_0
       7: aload_3
       8: putfield      #14                 // Field symbol:Ljava/lang/String;
      11: aload_0
      12: iload         4
      14: putfield      #18                 // Field score:I
      17: return

  public final java.lang.String getSymbol();
    Code:
       0: aload_0
       1: getfield      #14                 // Field symbol:Ljava/lang/String;
       4: areturn

  public final int getScore();
    Code:
       0: aload_0
       1: getfield      #18                 // Field score:I
       4: ireturn

  public static Day02$Result[] values();
    Code:
       0: getstatic     #33                 // Field $VALUES:[LDay02$Result;
       3: invokevirtual #39                 // Method java/lang/Object.clone:()Ljava/lang/Object;
       6: checkcast     #40                 // class "[LDay02$Result;"
       9: areturn

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

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

  private static final Day02$Result[] $values();
    Code:
       0: iconst_3
       1: anewarray     #2                  // class Day02$Result
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #57                 // Field Lose:LDay02$Result;
      10: aastore
      11: aload_0
      12: iconst_1
      13: getstatic     #60                 // Field Draw:LDay02$Result;
      16: aastore
      17: aload_0
      18: iconst_2
      19: getstatic     #63                 // Field Win:LDay02$Result;
      22: aastore
      23: aload_0
      24: areturn

  static {};
    Code:
       0: new           #2                  // class Day02$Result
       3: dup
       4: ldc           #66                 // String Lose
       6: iconst_0
       7: ldc           #68                 // String X
       9: iconst_0
      10: invokespecial #70                 // Method "<init>":(Ljava/lang/String;ILjava/lang/String;I)V
      13: putstatic     #57                 // Field Lose:LDay02$Result;
      16: new           #2                  // class Day02$Result
      19: dup
      20: ldc           #71                 // String Draw
      22: iconst_1
      23: ldc           #73                 // String Y
      25: iconst_3
      26: invokespecial #70                 // Method "<init>":(Ljava/lang/String;ILjava/lang/String;I)V
      29: putstatic     #60                 // Field Draw:LDay02$Result;
      32: new           #2                  // class Day02$Result
      35: dup
      36: ldc           #74                 // String Win
      38: iconst_2
      39: ldc           #76                 // String Z
      41: bipush        6
      43: invokespecial #70                 // Method "<init>":(Ljava/lang/String;ILjava/lang/String;I)V
      46: putstatic     #63                 // Field Win:LDay02$Result;
      49: invokestatic  #78                 // Method $values:()[LDay02$Result;
      52: putstatic     #33                 // Field $VALUES:[LDay02$Result;
      55: getstatic     #33                 // Field $VALUES:[LDay02$Result;
      58: checkcast     #80                 // class "[Ljava/lang/Enum;"
      61: invokestatic  #86                 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
      64: putstatic     #53                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
      67: return
}

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

  private static final kotlin.sequences.Sequence<Day02$Play> plays;

  private static final kotlin.sequences.Sequence<Day02$Result> results;

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

  public final int part1(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #23                 // class java/lang/CharSequence
      10: invokestatic  #29                 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;
      13: checkcast     #31                 // class java/lang/Iterable
      16: astore_2
      17: iconst_0
      18: istore_3
      19: aload_2
      20: invokeinterface #35,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      25: astore        4
      27: aload         4
      29: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      34: ifeq          76
      37: aload         4
      39: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      44: astore        5
      46: iload_3
      47: aload         5
      49: checkcast     #47                 // class java/lang/String
      52: astore        6
      54: istore        8
      56: iconst_0
      57: istore        7
      59: aload_0
      60: aload         6
      62: invokespecial #50                 // Method part1ScoreOf:(Ljava/lang/String;)I
      65: istore        9
      67: iload         8
      69: iload         9
      71: iadd
      72: istore_3
      73: goto          27
      76: iload_3
      77: ireturn

  public final int part2(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #23                 // class java/lang/CharSequence
      10: invokestatic  #59                 // Method kotlin/text/StringsKt.lineSequence:(Ljava/lang/CharSequence;)Lkotlin/sequences/Sequence;
      13: astore_2
      14: iconst_0
      15: istore_3
      16: aload_2
      17: invokeinterface #62,  1           // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      22: astore        4
      24: aload         4
      26: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      31: ifeq          73
      34: aload         4
      36: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      41: astore        5
      43: iload_3
      44: aload         5
      46: checkcast     #47                 // class java/lang/String
      49: astore        6
      51: istore        8
      53: iconst_0
      54: istore        7
      56: aload_0
      57: aload         6
      59: invokespecial #65                 // Method part2ScoreOf:(Ljava/lang/String;)I
      62: istore        9
      64: iload         8
      66: iload         9
      68: iadd
      69: istore_3
      70: goto          24
      73: iload_3
      74: ireturn

  private final Day02$Play parsePlay(java.lang.String);
    Code:
       0: getstatic     #72                 // Field plays:Lkotlin/sequences/Sequence;
       3: astore_2
       4: iconst_0
       5: istore_3
       6: aload_2
       7: invokeinterface #62,  1           // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      12: astore        4
      14: aload         4
      16: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      21: ifeq          60
      24: aload         4
      26: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      31: astore        5
      33: aload         5
      35: checkcast     #74                 // class Day02$Play
      38: astore        6
      40: iconst_0
      41: istore        7
      43: aload         6
      45: invokevirtual #78                 // Method Day02$Play.getSymbol:()Ljava/lang/String;
      48: aload_1
      49: invokestatic  #82                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      52: ifeq          14
      55: aload         5
      57: goto          70
      60: new           #84                 // class java/util/NoSuchElementException
      63: dup
      64: ldc           #86                 // String Sequence contains no element matching the predicate.
      66: invokespecial #89                 // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
      69: athrow
      70: checkcast     #74                 // class Day02$Play
      73: areturn

  private final Day02$Result parseResult(java.lang.String);
    Code:
       0: getstatic     #101                // Field results:Lkotlin/sequences/Sequence;
       3: astore_2
       4: iconst_0
       5: istore_3
       6: aload_2
       7: invokeinterface #62,  1           // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      12: astore        4
      14: aload         4
      16: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      21: ifeq          60
      24: aload         4
      26: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      31: astore        5
      33: aload         5
      35: checkcast     #103                // class Day02$Result
      38: astore        6
      40: iconst_0
      41: istore        7
      43: aload         6
      45: invokevirtual #104                // Method Day02$Result.getSymbol:()Ljava/lang/String;
      48: aload_1
      49: invokestatic  #82                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      52: ifeq          14
      55: aload         5
      57: goto          70
      60: new           #84                 // class java/util/NoSuchElementException
      63: dup
      64: ldc           #86                 // String Sequence contains no element matching the predicate.
      66: invokespecial #89                 // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
      69: athrow
      70: checkcast     #103                // class Day02$Result
      73: areturn

  private final int part1ScoreOf(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #23                 // class java/lang/CharSequence
       4: iconst_1
       5: newarray       char
       7: astore_3
       8: aload_3
       9: iconst_0
      10: bipush        32
      12: castore
      13: aload_3
      14: iconst_0
      15: iconst_0
      16: bipush        6
      18: aconst_null
      19: invokestatic  #110                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
      22: astore_2
      23: aload_2
      24: iconst_0
      25: invokeinterface #116,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      30: checkcast     #47                 // class java/lang/String
      33: astore_3
      34: aload_2
      35: iconst_1
      36: invokeinterface #116,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      41: checkcast     #47                 // class java/lang/String
      44: astore        4
      46: aload_0
      47: aload_0
      48: aload_3
      49: invokespecial #118                // Method parsePlay:(Ljava/lang/String;)LDay02$Play;
      52: aload         4
      54: astore        5
      56: aload         5
      58: ldc           #120                // String X
      60: invokestatic  #82                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      63: ifeq          72
      66: getstatic     #123                // Field Day02$Play.Rock:LDay02$Play;
      69: goto          91
      72: aload         5
      74: ldc           #125                // String Y
      76: invokestatic  #82                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      79: ifeq          88
      82: getstatic     #128                // Field Day02$Play.Paper:LDay02$Play;
      85: goto          91
      88: getstatic     #131                // Field Day02$Play.Scissors:LDay02$Play;
      91: invokespecial #135                // Method score:(LDay02$Play;LDay02$Play;)I
      94: ireturn

  private final int part2ScoreOf(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #23                 // class java/lang/CharSequence
       4: iconst_1
       5: newarray       char
       7: astore_3
       8: aload_3
       9: iconst_0
      10: bipush        32
      12: castore
      13: aload_3
      14: iconst_0
      15: iconst_0
      16: bipush        6
      18: aconst_null
      19: invokestatic  #110                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
      22: astore        4
      24: iconst_0
      25: istore        5
      27: aload         4
      29: iconst_0
      30: invokeinterface #116,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      35: checkcast     #47                 // class java/lang/String
      38: astore        6
      40: aload         4
      42: iconst_1
      43: invokeinterface #116,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      48: checkcast     #47                 // class java/lang/String
      51: astore        7
      53: getstatic     #141                // Field INSTANCE:LDay02;
      56: aload         6
      58: invokespecial #118                // Method parsePlay:(Ljava/lang/String;)LDay02$Play;
      61: getstatic     #141                // Field INSTANCE:LDay02;
      64: aload         7
      66: invokespecial #143                // Method parseResult:(Ljava/lang/String;)LDay02$Result;
      69: invokestatic  #149                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      72: nop
      73: astore_2
      74: aload_2
      75: invokevirtual #154                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      78: checkcast     #74                 // class Day02$Play
      81: astore_3
      82: aload_2
      83: invokevirtual #157                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      86: checkcast     #103                // class Day02$Result
      89: astore        4
      91: aload_0
      92: aload_3
      93: aload         4
      95: invokevirtual #161                // Method whatToPlay:(LDay02$Play;LDay02$Result;)LDay02$Play;
      98: astore        5
     100: aload         4
     102: invokevirtual #165                // Method Day02$Result.getScore:()I
     105: aload         5
     107: invokevirtual #166                // Method Day02$Play.getScore:()I
     110: iadd
     111: ireturn

  private final int score(Day02$Play, Day02$Play);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokespecial #173                // Method resultOf:(LDay02$Play;LDay02$Play;)LDay02$Result;
       6: invokevirtual #165                // Method Day02$Result.getScore:()I
       9: aload_2
      10: invokevirtual #166                // Method Day02$Play.getScore:()I
      13: iadd
      14: ireturn

  private final Day02$Result resultOf(Day02$Play, Day02$Play);
    Code:
       0: getstatic     #101                // Field results:Lkotlin/sequences/Sequence;
       3: astore_3
       4: iconst_0
       5: istore        4
       7: aload_3
       8: invokeinterface #62,  1           // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      13: astore        5
      15: aload         5
      17: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      22: ifeq          70
      25: aload         5
      27: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      32: astore        6
      34: aload         6
      36: checkcast     #103                // class Day02$Result
      39: astore        7
      41: iconst_0
      42: istore        8
      44: getstatic     #141                // Field INSTANCE:LDay02;
      47: aload_1
      48: aload         7
      50: invokevirtual #161                // Method whatToPlay:(LDay02$Play;LDay02$Result;)LDay02$Play;
      53: aload_2
      54: if_acmpne     61
      57: iconst_1
      58: goto          62
      61: iconst_0
      62: ifeq          15
      65: aload         6
      67: goto          80
      70: new           #84                 // class java/util/NoSuchElementException
      73: dup
      74: ldc           #86                 // String Sequence contains no element matching the predicate.
      76: invokespecial #89                 // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
      79: athrow
      80: checkcast     #103                // class Day02$Result
      83: areturn

  public final Day02$Play whatToPlay(Day02$Play, Day02$Result);
    Code:
       0: aload_1
       1: ldc           #175                // String opponent
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #177                // String wantedResult
       9: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: getstatic     #183                // Field Day02$WhenMappings.$EnumSwitchMapping$1:[I
      16: swap
      17: invokevirtual #186                // Method Day02$Result.ordinal:()I
      20: iaload
      21: tableswitch   { // 1 to 3
                     1: 48
                     2: 52
                     3: 114
               default: 202
          }
      48: aload_1
      49: goto          210
      52: aload_1
      53: getstatic     #189                // Field Day02$WhenMappings.$EnumSwitchMapping$0:[I
      56: swap
      57: invokevirtual #190                // Method Day02$Play.ordinal:()I
      60: iaload
      61: tableswitch   { // 1 to 3
                     1: 88
                     2: 94
                     3: 100
               default: 106
          }
      88: getstatic     #128                // Field Day02$Play.Paper:LDay02$Play;
      91: goto          210
      94: getstatic     #131                // Field Day02$Play.Scissors:LDay02$Play;
      97: goto          210
     100: getstatic     #123                // Field Day02$Play.Rock:LDay02$Play;
     103: goto          210
     106: new           #192                // class kotlin/NoWhenBranchMatchedException
     109: dup
     110: invokespecial #193                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     113: athrow
     114: getstatic     #72                 // Field plays:Lkotlin/sequences/Sequence;
     117: astore_3
     118: iconst_0
     119: istore        4
     121: aload_3
     122: invokeinterface #62,  1           // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
     127: astore        5
     129: aload         5
     131: invokeinterface #41,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     136: ifeq          186
     139: aload         5
     141: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     146: astore        6
     148: aload         6
     150: checkcast     #74                 // class Day02$Play
     153: astore        7
     155: iconst_0
     156: istore        8
     158: getstatic     #141                // Field INSTANCE:LDay02;
     161: aload         7
     163: getstatic     #196                // Field Day02$Result.Win:LDay02$Result;
     166: invokevirtual #161                // Method whatToPlay:(LDay02$Play;LDay02$Result;)LDay02$Play;
     169: aload_1
     170: if_acmpne     177
     173: iconst_1
     174: goto          178
     177: iconst_0
     178: ifeq          129
     181: aload         6
     183: goto          196
     186: new           #84                 // class java/util/NoSuchElementException
     189: dup
     190: ldc           #86                 // String Sequence contains no element matching the predicate.
     192: invokespecial #89                 // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
     195: athrow
     196: checkcast     #74                 // class Day02$Play
     199: goto          210
     202: new           #192                // class kotlin/NoWhenBranchMatchedException
     205: dup
     206: invokespecial #193                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     209: athrow
     210: areturn

  static {};
    Code:
       0: new           #2                  // class Day02
       3: dup
       4: invokespecial #199                // Method "<init>":()V
       7: putstatic     #141                // Field INSTANCE:LDay02;
      10: invokestatic  #203                // Method Day02$Play.values:()[LDay02$Play;
      13: invokestatic  #209                // Method kotlin/collections/ArraysKt.asSequence:([Ljava/lang/Object;)Lkotlin/sequences/Sequence;
      16: putstatic     #72                 // Field plays:Lkotlin/sequences/Sequence;
      19: invokestatic  #212                // Method Day02$Result.values:()[LDay02$Result;
      22: invokestatic  #209                // Method kotlin/collections/ArraysKt.asSequence:([Ljava/lang/Object;)Lkotlin/sequences/Sequence;
      25: putstatic     #101                // Field results:Lkotlin/sequences/Sequence;
      28: return
}


import java.util.*

private typealias ValveId = String

object Day16 {

    private val LINE_REGEX = Regex("Valve ([A-Z]+) has flow rate=(\\d+); tunnels? leads? to valves? (.+)")

    fun part1(input: String, time: Int = 30): Int {
        val valves = input.lineSequence()
            .map(::parseValve)
            .toMap()
        val solver = Solver(maxStep = time, initialState = SearchState(valves.keys.first(), valves.mapValues { false }, 0, null), valves = valves)
        return solver.solve()
    }

    private fun parseValve(input: String): Pair<ValveId, Valve> {
        val (_, valve, rate, edges) =LINE_REGEX.find(input)?.groupValues ?: error("failed to match input line: $input")
        return valve to Valve(rate.toInt(), edges.split(", "))
    }

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

    data class Valve(val rate: Int, val connections: Collection<ValveId>)

    class SearchState(val valve: ValveId, val openValves: Map<ValveId, Boolean>, val step: Int, val parent: SearchState?) {

        override fun equals(other: Any?): Boolean {
            if (other !is SearchState) return false
            return valve == other.valve && openValves == other.openValves
        }

        override fun hashCode(): Int = valve.hashCode() + 31 * openValves.hashCode()

        override fun toString(): String = "$valve at $step (${openValves.filterValues { it }.keys})"
    }

    class Solver(val maxStep: Int, private val initialState: SearchState, private val valves: Map<ValveId, Valve>) {

        private val visitedStates: MutableSet<SearchState> = mutableSetOf()

        private val priorityQueue: PriorityQueue<Pair<SearchState, Int>> = PriorityQueue<Pair<SearchState, Int>>(compareBy { -it.second })
            .apply { add(initialState to 0) }

        private fun getSuccessorState(searchState: SearchState, score: Int): Sequence<Pair<SearchState, Int>> {
            if (searchState.step >= maxStep) return emptySequence()
            val currentValve = valves[searchState.valve] ?: return emptySequence()

            val nextStep = searchState.step + 1
            val connectedStates = currentValve.connections.asSequence().map {
                SearchState(it, searchState.openValves, nextStep, searchState) to score
            }

            return if(searchState.openValves[searchState.valve] == false && currentValve.rate != 0)
                connectedStates + (SearchState(searchState.valve, searchState.openValves + (searchState.valve to true), nextStep, searchState.parent) to computeScore(score, nextStep, currentValve.rate))
            else
                connectedStates
        }

        private fun computeScore(score: Int, step: Int, rate: Int) = score + ((maxStep - step) * rate)

        fun solve() : Int {
            var bestStateThusFar = initialState to 0

            while (!priorityQueue.isEmpty()) {
                val (state, score) = priorityQueue.poll()
                visitedStates.add(state)

                if (bestStateThusFar.second < score) bestStateThusFar = state to score

                getSuccessorState(state, score)
                    .filter { it.first !in visitedStates }
                    .forEach { priorityQueue.add(it) }
            }

            val seq = sequence {
                var currentState: SearchState = bestStateThusFar.first
                while (currentState.parent != null) {
                    yield(currentState)
                    currentState = currentState.parent!!
                }
            }
            seq.toList().reversed().forEach(::println)

            return bestStateThusFar.second
        }
    }
}

Compiled from "Day16.kt"
final class Day16$Solver$solve$seq$1 extends kotlin.coroutines.jvm.internal.RestrictedSuspendLambda implements kotlin.jvm.functions.Function2<kotlin.sequences.SequenceScope<? super Day16$SearchState>, kotlin.coroutines.Continuation<? super kotlin.Unit>, java.lang.Object> {
  java.lang.Object L$1;

  int label;

  private java.lang.Object L$0;

  final kotlin.jvm.internal.Ref$ObjectRef<kotlin.Pair<Day16$SearchState, java.lang.Integer>> $bestStateThusFar;

  Day16$Solver$solve$seq$1(kotlin.jvm.internal.Ref$ObjectRef<kotlin.Pair<Day16$SearchState, java.lang.Integer>>, kotlin.coroutines.Continuation<? super Day16$Solver$solve$seq$1>);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #14                 // Field $bestStateThusFar:Lkotlin/jvm/internal/Ref$ObjectRef;
       5: aload_0
       6: iconst_2
       7: aload_2
       8: invokespecial #17                 // Method kotlin/coroutines/jvm/internal/RestrictedSuspendLambda."<init>":(ILkotlin/coroutines/Continuation;)V
      11: return

  public final java.lang.Object invokeSuspend(java.lang.Object);
    Code:
       0: invokestatic  #45                 // Method kotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINE_SUSPENDED:()Ljava/lang/Object;
       3: astore        4
       5: aload_0
       6: getfield      #49                 // Field label:I
       9: tableswitch   { // 0 to 1
                     0: 32
                     1: 101
               default: 139
          }
      32: aload_1
      33: invokestatic  #55                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
      36: aload_0
      37: getfield      #57                 // Field L$0:Ljava/lang/Object;
      40: checkcast     #59                 // class kotlin/sequences/SequenceScope
      43: astore_2
      44: aload_0
      45: getfield      #14                 // Field $bestStateThusFar:Lkotlin/jvm/internal/Ref$ObjectRef;
      48: getfield      #64                 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;
      51: checkcast     #66                 // class kotlin/Pair
      54: invokevirtual #69                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      57: checkcast     #71                 // class Day16$SearchState
      60: astore_3
      61: aload_3
      62: invokevirtual #75                 // Method Day16$SearchState.getParent:()LDay16$SearchState;
      65: ifnull        135
      68: aload_2
      69: aload_3
      70: aload_0
      71: checkcast     #77                 // class kotlin/coroutines/Continuation
      74: aload_0
      75: aload_2
      76: putfield      #57                 // Field L$0:Ljava/lang/Object;
      79: aload_0
      80: aload_3
      81: putfield      #79                 // Field L$1:Ljava/lang/Object;
      84: aload_0
      85: iconst_1
      86: putfield      #49                 // Field label:I
      89: invokevirtual #83                 // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
      92: dup
      93: aload         4
      95: if_acmpne     122
      98: aload         4
     100: areturn
     101: aload_0
     102: getfield      #79                 // Field L$1:Ljava/lang/Object;
     105: checkcast     #71                 // class Day16$SearchState
     108: astore_3
     109: aload_0
     110: getfield      #57                 // Field L$0:Ljava/lang/Object;
     113: checkcast     #59                 // class kotlin/sequences/SequenceScope
     116: astore_2
     117: aload_1
     118: invokestatic  #55                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
     121: aload_1
     122: pop
     123: aload_3
     124: invokevirtual #75                 // Method Day16$SearchState.getParent:()LDay16$SearchState;
     127: dup
     128: invokestatic  #88                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     131: astore_3
     132: goto          61
     135: getstatic     #94                 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     138: areturn
     139: new           #96                 // class java/lang/IllegalStateException
     142: dup
     143: ldc           #98                 // String call to \'resume\' before \'invoke\' with coroutine
     145: invokespecial #101                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     148: athrow

  public final kotlin.coroutines.Continuation<kotlin.Unit> create(java.lang.Object, kotlin.coroutines.Continuation<?>);
    Code:
       0: new           #2                  // class Day16$Solver$solve$seq$1
       3: dup
       4: aload_0
       5: getfield      #14                 // Field $bestStateThusFar:Lkotlin/jvm/internal/Ref$ObjectRef;
       8: aload_2
       9: invokespecial #111                // Method "<init>":(Lkotlin/jvm/internal/Ref$ObjectRef;Lkotlin/coroutines/Continuation;)V
      12: astore_3
      13: aload_3
      14: aload_1
      15: putfield      #57                 // Field L$0:Ljava/lang/Object;
      18: aload_3
      19: checkcast     #77                 // class kotlin/coroutines/Continuation
      22: areturn

  public final java.lang.Object invoke(kotlin.sequences.SequenceScope<? super Day16$SearchState>, kotlin.coroutines.Continuation<? super kotlin.Unit>);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokevirtual #117                // Method create:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;
       6: checkcast     #2                  // class Day16$Solver$solve$seq$1
       9: getstatic     #94                 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      12: invokevirtual #119                // Method invokeSuspend:(Ljava/lang/Object;)Ljava/lang/Object;
      15: areturn

  public java.lang.Object invoke(java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #59                 // class kotlin/sequences/SequenceScope
       5: aload_2
       6: checkcast     #77                 // class kotlin/coroutines/Continuation
       9: invokevirtual #124                // Method invoke:(Lkotlin/sequences/SequenceScope;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
      12: areturn
}

Compiled from "Day16.kt"
public final class Day16$Valve {
  private final int rate;

  private final java.util.Collection<java.lang.String> connections;

  public Day16$Valve(int, java.util.Collection<java.lang.String>);
    Code:
       0: aload_2
       1: ldc           #10                 // String connections
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #19                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: iload_1
      12: putfield      #23                 // Field rate:I
      15: aload_0
      16: aload_2
      17: putfield      #26                 // Field connections:Ljava/util/Collection;
      20: return

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

  public final java.util.Collection<java.lang.String> getConnections();
    Code:
       0: aload_0
       1: getfield      #26                 // Field connections:Ljava/util/Collection;
       4: areturn

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

  public final java.util.Collection<java.lang.String> component2();
    Code:
       0: aload_0
       1: getfield      #26                 // Field connections:Ljava/util/Collection;
       4: areturn

  public final Day16$Valve copy(int, java.util.Collection<java.lang.String>);
    Code:
       0: aload_2
       1: ldc           #10                 // String connections
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class Day16$Valve
       9: dup
      10: iload_1
      11: aload_2
      12: invokespecial #40                 // Method "<init>":(ILjava/util/Collection;)V
      15: areturn

  public static Day16$Valve copy$default(Day16$Valve, int, java.util.Collection, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #23                 // Field rate:I
      10: istore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #26                 // Field connections:Ljava/util/Collection;
      21: astore_2
      22: aload_0
      23: iload_1
      24: aload_2
      25: invokevirtual #44                 // Method copy:(ILjava/util/Collection;)LDay16$Valve;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #48                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #49                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #51                 // String Valve(rate=
       9: invokevirtual #55                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #23                 // Field rate:I
      16: invokevirtual #58                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #60                 // String , connections=
      21: invokevirtual #55                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #26                 // Field connections:Ljava/util/Collection;
      28: invokevirtual #63                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #66                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #68                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #23                 // Field rate:I
       4: invokestatic  #74                 // Method java/lang/Integer.hashCode:(I)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #26                 // Field connections:Ljava/util/Collection;
      16: invokevirtual #76                 // Method java/lang/Object.hashCode:()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 Day16$Valve
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day16$Valve
      20: astore_2
      21: aload_0
      22: getfield      #23                 // Field rate:I
      25: aload_2
      26: getfield      #23                 // Field rate:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #26                 // Field connections:Ljava/util/Collection;
      38: aload_2
      39: getfield      #26                 // Field connections:Ljava/util/Collection;
      42: invokestatic  #84                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      45: ifne          50
      48: iconst_0
      49: ireturn
      50: iconst_1
      51: ireturn
}

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

  private static final kotlin.text.Regex LINE_REGEX;

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

  public final int part1(java.lang.String, int);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #23                 // class java/lang/CharSequence
      10: invokestatic  #29                 // Method kotlin/text/StringsKt.lineSequence:(Ljava/lang/CharSequence;)Lkotlin/sequences/Sequence;
      13: new           #31                 // class Day16$part1$valves$1
      16: dup
      17: aload_0
      18: invokespecial #34                 // Method Day16$part1$valves$1."<init>":(Ljava/lang/Object;)V
      21: checkcast     #36                 // class kotlin/jvm/functions/Function1
      24: invokestatic  #42                 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      27: invokestatic  #48                 // Method kotlin/collections/MapsKt.toMap:(Lkotlin/sequences/Sequence;)Ljava/util/Map;
      30: astore_3
      31: iload_2
      32: aload_3
      33: invokeinterface #54,  1           // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
      38: checkcast     #56                 // class java/lang/Iterable
      41: invokestatic  #62                 // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;
      44: checkcast     #64                 // class java/lang/String
      47: aload_3
      48: astore        5
      50: astore        20
      52: istore        19
      54: iconst_0
      55: istore        6
      57: aload         5
      59: astore        7
      61: new           #66                 // class java/util/LinkedHashMap
      64: dup
      65: aload         5
      67: invokeinterface #70,  1           // InterfaceMethod java/util/Map.size:()I
      72: invokestatic  #74                 // Method kotlin/collections/MapsKt.mapCapacity:(I)I
      75: invokespecial #77                 // Method java/util/LinkedHashMap."<init>":(I)V
      78: checkcast     #50                 // class java/util/Map
      81: astore        8
      83: iconst_0
      84: istore        9
      86: aload         7
      88: invokeinterface #80,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      93: checkcast     #56                 // class java/lang/Iterable
      96: astore        10
      98: iconst_0
      99: istore        11
     101: aload         10
     103: invokeinterface #84,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     108: astore        12
     110: aload         12
     112: invokeinterface #90,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     117: ifeq          188
     120: aload         12
     122: invokeinterface #94,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     127: astore        13
     129: aload         8
     131: aload         13
     133: checkcast     #96                 // class java/util/Map$Entry
     136: astore        14
     138: astore        15
     140: iconst_0
     141: istore        16
     143: aload         14
     145: invokeinterface #99,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     150: aload         15
     152: swap
     153: aload         13
     155: checkcast     #96                 // class java/util/Map$Entry
     158: astore        17
     160: astore        22
     162: astore        21
     164: iconst_0
     165: istore        18
     167: iconst_0
     168: invokestatic  #105                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
     171: astore        23
     173: aload         21
     175: aload         22
     177: aload         23
     179: invokeinterface #109,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     184: pop
     185: goto          110
     188: aload         8
     190: nop
     191: nop
     192: astore        21
     194: iload         19
     196: aload         20
     198: aload         21
     200: iconst_0
     201: aconst_null
     202: astore        24
     204: istore        25
     206: astore        26
     208: astore        27
     210: new           #111                // class Day16$SearchState
     213: dup
     214: aload         27
     216: aload         26
     218: iload         25
     220: aload         24
     222: invokespecial #114                // Method Day16$SearchState."<init>":(Ljava/lang/String;Ljava/util/Map;ILDay16$SearchState;)V
     225: aload_3
     226: astore        28
     228: astore        29
     230: istore        30
     232: new           #116                // class Day16$Solver
     235: dup
     236: iload         30
     238: aload         29
     240: aload         28
     242: invokespecial #119                // Method Day16$Solver."<init>":(ILDay16$SearchState;Ljava/util/Map;)V
     245: astore        4
     247: aload         4
     249: invokevirtual #122                // Method Day16$Solver.solve:()I
     252: ireturn

  public static int part1$default(Day16, java.lang.String, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_2
       2: iand
       3: ifeq          9
       6: bipush        30
       8: istore_2
       9: aload_0
      10: aload_1
      11: iload_2
      12: invokevirtual #148                // Method part1:(Ljava/lang/String;I)I
      15: ireturn

  private final kotlin.Pair<java.lang.String, Day16$Valve> parseValve(java.lang.String);
    Code:
       0: getstatic     #155                // Field LINE_REGEX:Lkotlin/text/Regex;
       3: aload_1
       4: checkcast     #23                 // class java/lang/CharSequence
       7: iconst_0
       8: iconst_2
       9: aconst_null
      10: invokestatic  #161                // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;
      13: dup
      14: ifnull        26
      17: invokeinterface #167,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
      22: dup
      23: ifnonnull     57
      26: pop
      27: new           #169                // class java/lang/IllegalStateException
      30: dup
      31: new           #171                // class java/lang/StringBuilder
      34: dup
      35: invokespecial #172                // Method java/lang/StringBuilder."<init>":()V
      38: ldc           #174                // String failed to match input line:
      40: invokevirtual #178                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      43: aload_1
      44: invokevirtual #178                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      47: invokevirtual #182                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      50: invokevirtual #183                // Method java/lang/Object.toString:()Ljava/lang/String;
      53: invokespecial #186                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      56: athrow
      57: astore_2
      58: aload_2
      59: iconst_1
      60: invokeinterface #192,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      65: checkcast     #64                 // class java/lang/String
      68: astore_3
      69: aload_2
      70: iconst_2
      71: invokeinterface #192,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      76: checkcast     #64                 // class java/lang/String
      79: astore        4
      81: aload_2
      82: iconst_3
      83: invokeinterface #192,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      88: checkcast     #64                 // class java/lang/String
      91: astore        5
      93: aload_3
      94: new           #194                // class Day16$Valve
      97: dup
      98: aload         4
     100: invokestatic  #200                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     103: aload         5
     105: checkcast     #23                 // class java/lang/CharSequence
     108: iconst_1
     109: anewarray     #64                 // class java/lang/String
     112: astore        6
     114: aload         6
     116: iconst_0
     117: ldc           #202                // String ,
     119: aastore
     120: aload         6
     122: iconst_0
     123: iconst_0
     124: bipush        6
     126: aconst_null
     127: invokestatic  #206                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     130: checkcast     #208                // class java/util/Collection
     133: invokespecial #211                // Method Day16$Valve."<init>":(ILjava/util/Collection;)V
     136: invokestatic  #217                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     139: areturn

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

  public static final kotlin.Pair access$parseValve(Day16, java.lang.String);
    Code:
       0: aload_0
       1: aload_1
       2: invokespecial #231                // Method parseValve:(Ljava/lang/String;)Lkotlin/Pair;
       5: areturn

  static {};
    Code:
       0: new           #2                  // class Day16
       3: dup
       4: invokespecial #234                // Method "<init>":()V
       7: putstatic     #237                // Field INSTANCE:LDay16;
      10: new           #157                // class kotlin/text/Regex
      13: dup
      14: ldc           #239                // String Valve ([A-Z]+) has flow rate=(\\d+); tunnels? leads? to valves? (.+)
      16: invokespecial #240                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      19: putstatic     #155                // Field LINE_REGEX:Lkotlin/text/Regex;
      22: return
}

Compiled from "Day16.kt"
public final class Day16Kt {
}

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

  private final java.util.Map<java.lang.String, java.lang.Boolean> openValves;

  private final int step;

  private final Day16$SearchState parent;

  public Day16$SearchState(java.lang.String, java.util.Map<java.lang.String, java.lang.Boolean>, int, Day16$SearchState);
    Code:
       0: aload_1
       1: ldc           #11                 // String valve
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #19                 // String openValves
       9: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokespecial #22                 // Method java/lang/Object."<init>":()V
      16: aload_0
      17: aload_1
      18: putfield      #25                 // Field valve:Ljava/lang/String;
      21: aload_0
      22: aload_2
      23: putfield      #28                 // Field openValves:Ljava/util/Map;
      26: aload_0
      27: iload_3
      28: putfield      #32                 // Field step:I
      31: aload_0
      32: aload         4
      34: putfield      #36                 // Field parent:LDay16$SearchState;
      37: return

  public final java.lang.String getValve();
    Code:
       0: aload_0
       1: getfield      #25                 // Field valve:Ljava/lang/String;
       4: areturn

  public final java.util.Map<java.lang.String, java.lang.Boolean> getOpenValves();
    Code:
       0: aload_0
       1: getfield      #28                 // Field openValves:Ljava/util/Map;
       4: areturn

  public final int getStep();
    Code:
       0: aload_0
       1: getfield      #32                 // Field step:I
       4: ireturn

  public final Day16$SearchState getParent();
    Code:
       0: aload_0
       1: getfield      #36                 // Field parent:LDay16$SearchState;
       4: areturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_1
       1: instanceof    #2                  // class Day16$SearchState
       4: ifne          9
       7: iconst_0
       8: ireturn
       9: aload_0
      10: getfield      #25                 // Field valve:Ljava/lang/String;
      13: aload_1
      14: checkcast     #2                  // class Day16$SearchState
      17: getfield      #25                 // Field valve:Ljava/lang/String;
      20: invokestatic  #52                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      23: ifeq          47
      26: aload_0
      27: getfield      #28                 // Field openValves:Ljava/util/Map;
      30: aload_1
      31: checkcast     #2                  // class Day16$SearchState
      34: getfield      #28                 // Field openValves:Ljava/util/Map;
      37: invokestatic  #52                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      40: ifeq          47
      43: iconst_1
      44: goto          48
      47: iconst_0
      48: ireturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #25                 // Field valve:Ljava/lang/String;
       4: invokevirtual #59                 // Method java/lang/String.hashCode:()I
       7: bipush        31
       9: aload_0
      10: getfield      #28                 // Field openValves:Ljava/util/Map;
      13: invokevirtual #60                 // Method java/lang/Object.hashCode:()I
      16: imul
      17: iadd
      18: ireturn

  public java.lang.String toString();
    Code:
       0: new           #63                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #64                 // Method java/lang/StringBuilder."<init>":()V
       7: aload_0
       8: getfield      #25                 // Field valve:Ljava/lang/String;
      11: invokevirtual #68                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      14: ldc           #70                 // String  at
      16: invokevirtual #68                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: aload_0
      20: getfield      #32                 // Field step:I
      23: invokevirtual #73                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      26: ldc           #75                 // String  (
      28: invokevirtual #68                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      31: aload_0
      32: getfield      #28                 // Field openValves:Ljava/util/Map;
      35: astore_1
      36: astore        8
      38: iconst_0
      39: istore_2
      40: new           #77                 // class java/util/LinkedHashMap
      43: dup
      44: invokespecial #78                 // Method java/util/LinkedHashMap."<init>":()V
      47: astore_3
      48: aload_1
      49: invokeinterface #84,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      54: invokeinterface #90,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      59: astore        4
      61: aload         4
      63: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      68: ifeq          128
      71: aload         4
      73: invokeinterface #100,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      78: checkcast     #102                // class java/util/Map$Entry
      81: astore        5
      83: aload         5
      85: invokeinterface #105,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
      90: checkcast     #107                // class java/lang/Boolean
      93: invokevirtual #110                // Method java/lang/Boolean.booleanValue:()Z
      96: istore        6
      98: iconst_0
      99: istore        7
     101: iload         6
     103: ifeq          61
     106: aload_3
     107: aload         5
     109: invokeinterface #113,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     114: aload         5
     116: invokeinterface #105,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     121: invokevirtual #117                // Method java/util/LinkedHashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     124: pop
     125: goto          61
     128: aload_3
     129: checkcast     #80                 // class java/util/Map
     132: aload         8
     134: swap
     135: invokeinterface #120,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     140: invokevirtual #123                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     143: bipush        41
     145: invokevirtual #126                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     148: invokevirtual #128                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     151: areturn
}

Compiled from "Day16.kt"
final class Day16$part1$valves$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.lang.String, kotlin.Pair<? extends java.lang.String, ? extends Day16$Valve>> {
  Day16$part1$valves$1(java.lang.Object);
    Code:
       0: aload_0
       1: iconst_1
       2: aload_1
       3: ldc           #11                 // class Day16
       5: ldc           #13                 // String parseValve
       7: ldc           #15                 // String parseValve(Ljava/lang/String;)Lkotlin/Pair;
       9: iconst_0
      10: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Object;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      13: return

  public final kotlin.Pair<java.lang.String, Day16$Valve> invoke(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #27                 // String p0
       3: invokestatic  #33                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #35                 // Field receiver:Ljava/lang/Object;
      10: checkcast     #11                 // class Day16
      13: aload_1
      14: invokestatic  #39                 // Method Day16.access$parseValve:(LDay16;Ljava/lang/String;)Lkotlin/Pair;
      17: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #43                 // class java/lang/String
       5: invokevirtual #45                 // Method invoke:(Ljava/lang/String;)Lkotlin/Pair;
       8: areturn
}

Compiled from "Comparisons.kt"
public final class Day16$Solver$special$$inlined$compareBy$1<T> implements java.util.Comparator {
  public Day16$Solver$special$$inlined$compareBy$1();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class kotlin/Pair
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      12: checkcast     #29                 // class java/lang/Number
      15: invokevirtual #33                 // Method java/lang/Number.intValue:()I
      18: ineg
      19: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      22: checkcast     #41                 // class java/lang/Comparable
      25: aload_2
      26: checkcast     #23                 // class kotlin/Pair
      29: astore_3
      30: astore        5
      32: iconst_0
      33: istore        4
      35: aload_3
      36: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      39: checkcast     #29                 // class java/lang/Number
      42: invokevirtual #33                 // Method java/lang/Number.intValue:()I
      45: ineg
      46: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      49: checkcast     #41                 // class java/lang/Comparable
      52: aload         5
      54: swap
      55: invokestatic  #47                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      58: ireturn
}

Compiled from "Day16.kt"
public final class Day16$Solver {
  private final int maxStep;

  private final Day16$SearchState initialState;

  private final java.util.Map<java.lang.String, Day16$Valve> valves;

  private final java.util.Set<Day16$SearchState> visitedStates;

  private final java.util.PriorityQueue<kotlin.Pair<Day16$SearchState, java.lang.Integer>> priorityQueue;

  public Day16$Solver(int, Day16$SearchState, java.util.Map<java.lang.String, Day16$Valve>);
    Code:
       0: aload_2
       1: ldc           #10                 // String initialState
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_3
       7: ldc           #18                 // String valves
       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: iload_1
      18: putfield      #25                 // Field maxStep:I
      21: aload_0
      22: aload_2
      23: putfield      #28                 // Field initialState:LDay16$SearchState;
      26: aload_0
      27: aload_3
      28: putfield      #31                 // Field valves:Ljava/util/Map;
      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      #40                 // Field visitedStates:Ljava/util/Set;
      45: aload_0
      46: new           #42                 // class java/util/PriorityQueue
      49: dup
      50: new           #44                 // class Day16$Solver$special$$inlined$compareBy$1
      53: dup
      54: invokespecial #45                 // Method Day16$Solver$special$$inlined$compareBy$1."<init>":()V
      57: checkcast     #47                 // class java/util/Comparator
      60: invokespecial #50                 // Method java/util/PriorityQueue."<init>":(Ljava/util/Comparator;)V
      63: astore        4
      65: aload         4
      67: astore        5
      69: astore        7
      71: iconst_0
      72: istore        6
      74: aload         5
      76: aload_0
      77: getfield      #28                 // Field initialState:LDay16$SearchState;
      80: iconst_0
      81: invokestatic  #56                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      84: invokestatic  #62                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      87: invokevirtual #66                 // Method java/util/PriorityQueue.add:(Ljava/lang/Object;)Z
      90: pop
      91: aload         7
      93: aload         4
      95: putfield      #70                 // Field priorityQueue:Ljava/util/PriorityQueue;
      98: return

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

  private final kotlin.sequences.Sequence<kotlin.Pair<Day16$SearchState, java.lang.Integer>> getSuccessorState(Day16$SearchState, int);
    Code:
       0: aload_1
       1: invokevirtual #84                 // Method Day16$SearchState.getStep:()I
       4: aload_0
       5: getfield      #25                 // Field maxStep:I
       8: if_icmplt     15
      11: invokestatic  #90                 // Method kotlin/sequences/SequencesKt.emptySequence:()Lkotlin/sequences/Sequence;
      14: areturn
      15: aload_0
      16: getfield      #31                 // Field valves:Ljava/util/Map;
      19: aload_1
      20: invokevirtual #94                 // Method Day16$SearchState.getValve:()Ljava/lang/String;
      23: invokeinterface #100,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      28: checkcast     #102                // class Day16$Valve
      31: dup
      32: ifnonnull     40
      35: pop
      36: invokestatic  #90                 // Method kotlin/sequences/SequencesKt.emptySequence:()Lkotlin/sequences/Sequence;
      39: areturn
      40: astore_3
      41: aload_1
      42: invokevirtual #84                 // Method Day16$SearchState.getStep:()I
      45: iconst_1
      46: iadd
      47: istore        4
      49: aload_3
      50: invokevirtual #106                // Method Day16$Valve.getConnections:()Ljava/util/Collection;
      53: checkcast     #108                // class java/lang/Iterable
      56: invokestatic  #114                // Method kotlin/collections/CollectionsKt.asSequence:(Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;
      59: aload_1
      60: iload         4
      62: iload_2
      63: invokedynamic #133,  0            // InvokeDynamic #0:invoke:(LDay16$SearchState;II)Lkotlin/jvm/functions/Function1;
      68: invokestatic  #137                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      71: astore        5
      73: aload_1
      74: invokevirtual #141                // Method Day16$SearchState.getOpenValves:()Ljava/util/Map;
      77: aload_1
      78: invokevirtual #94                 // Method Day16$SearchState.getValve:()Ljava/lang/String;
      81: invokeinterface #100,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      86: iconst_0
      87: invokestatic  #146                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
      90: invokestatic  #150                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      93: ifeq          163
      96: aload_3
      97: invokevirtual #153                // Method Day16$Valve.getRate:()I
     100: ifeq          163
     103: aload         5
     105: new           #81                 // class Day16$SearchState
     108: dup
     109: aload_1
     110: invokevirtual #94                 // Method Day16$SearchState.getValve:()Ljava/lang/String;
     113: aload_1
     114: invokevirtual #141                // Method Day16$SearchState.getOpenValves:()Ljava/util/Map;
     117: aload_1
     118: invokevirtual #94                 // Method Day16$SearchState.getValve:()Ljava/lang/String;
     121: iconst_1
     122: invokestatic  #146                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
     125: invokestatic  #62                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     128: invokestatic  #159                // Method kotlin/collections/MapsKt.plus:(Ljava/util/Map;Lkotlin/Pair;)Ljava/util/Map;
     131: iload         4
     133: aload_1
     134: invokevirtual #163                // Method Day16$SearchState.getParent:()LDay16$SearchState;
     137: invokespecial #166                // Method Day16$SearchState."<init>":(Ljava/lang/String;Ljava/util/Map;ILDay16$SearchState;)V
     140: aload_0
     141: iload_2
     142: iload         4
     144: aload_3
     145: invokevirtual #153                // Method Day16$Valve.getRate:()I
     148: invokespecial #170                // Method computeScore:(III)I
     151: invokestatic  #56                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     154: invokestatic  #62                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     157: invokestatic  #173                // Method kotlin/sequences/SequencesKt.plus:(Lkotlin/sequences/Sequence;Ljava/lang/Object;)Lkotlin/sequences/Sequence;
     160: goto          165
     163: aload         5
     165: areturn

  private final int computeScore(int, int, int);
    Code:
       0: iload_1
       1: aload_0
       2: getfield      #25                 // Field maxStep:I
       5: iload_2
       6: isub
       7: iload_3
       8: imul
       9: iadd
      10: ireturn

  public final int solve();
    Code:
       0: new           #187                // class kotlin/jvm/internal/Ref$ObjectRef
       3: dup
       4: invokespecial #188                // Method kotlin/jvm/internal/Ref$ObjectRef."<init>":()V
       7: astore_1
       8: aload_1
       9: aload_0
      10: getfield      #28                 // Field initialState:LDay16$SearchState;
      13: iconst_0
      14: invokestatic  #56                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      17: invokestatic  #62                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      20: putfield      #192                // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;
      23: aload_0
      24: getfield      #70                 // Field priorityQueue:Ljava/util/PriorityQueue;
      27: invokevirtual #196                // Method java/util/PriorityQueue.isEmpty:()Z
      30: ifne          187
      33: aload_0
      34: getfield      #70                 // Field priorityQueue:Ljava/util/PriorityQueue;
      37: invokevirtual #200                // Method java/util/PriorityQueue.poll:()Ljava/lang/Object;
      40: checkcast     #202                // class kotlin/Pair
      43: astore_2
      44: aload_2
      45: invokevirtual #205                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      48: checkcast     #81                 // class Day16$SearchState
      51: astore_3
      52: aload_2
      53: invokevirtual #208                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      56: checkcast     #210                // class java/lang/Number
      59: invokevirtual #213                // Method java/lang/Number.intValue:()I
      62: istore        4
      64: aload_0
      65: getfield      #40                 // Field visitedStates:Ljava/util/Set;
      68: aload_3
      69: invokeinterface #214,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
      74: pop
      75: aload_1
      76: getfield      #192                // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;
      79: checkcast     #202                // class kotlin/Pair
      82: invokevirtual #217                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      85: checkcast     #210                // class java/lang/Number
      88: invokevirtual #213                // Method java/lang/Number.intValue:()I
      91: iload         4
      93: if_icmpge     109
      96: aload_1
      97: aload_3
      98: iload         4
     100: invokestatic  #56                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     103: invokestatic  #62                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     106: putfield      #192                // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;
     109: aload_0
     110: aload_3
     111: iload         4
     113: invokespecial #219                // Method getSuccessorState:(LDay16$SearchState;I)Lkotlin/sequences/Sequence;
     116: aload_0
     117: invokedynamic #229,  0            // InvokeDynamic #1:invoke:(LDay16$Solver;)Lkotlin/jvm/functions/Function1;
     122: invokestatic  #232                // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     125: astore        5
     127: nop
     128: iconst_0
     129: istore        6
     131: aload         5
     133: invokeinterface #236,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
     138: astore        7
     140: aload         7
     142: invokeinterface #241,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     147: ifeq          183
     150: aload         7
     152: invokeinterface #244,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     157: astore        8
     159: aload         8
     161: checkcast     #202                // class kotlin/Pair
     164: astore        9
     166: iconst_0
     167: istore        10
     169: aload_0
     170: getfield      #70                 // Field priorityQueue:Ljava/util/PriorityQueue;
     173: aload         9
     175: invokevirtual #66                 // Method java/util/PriorityQueue.add:(Ljava/lang/Object;)Z
     178: pop
     179: nop
     180: goto          140
     183: nop
     184: goto          23
     187: new           #246                // class Day16$Solver$solve$seq$1
     190: dup
     191: aload_1
     192: aconst_null
     193: invokespecial #249                // Method Day16$Solver$solve$seq$1."<init>":(Lkotlin/jvm/internal/Ref$ObjectRef;Lkotlin/coroutines/Continuation;)V
     196: checkcast     #251                // class kotlin/jvm/functions/Function2
     199: invokestatic  #255                // Method kotlin/sequences/SequencesKt.sequence:(Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;
     202: astore_2
     203: aload_2
     204: invokestatic  #259                // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
     207: checkcast     #108                // class java/lang/Iterable
     210: invokestatic  #263                // Method kotlin/collections/CollectionsKt.reversed:(Ljava/lang/Iterable;)Ljava/util/List;
     213: checkcast     #108                // class java/lang/Iterable
     216: astore_3
     217: iconst_0
     218: istore        4
     220: aload_3
     221: invokeinterface #264,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     226: astore        5
     228: aload         5
     230: invokeinterface #241,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     235: ifeq          267
     238: aload         5
     240: invokeinterface #244,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     245: astore        6
     247: aload         6
     249: astore        7
     251: iconst_0
     252: istore        8
     254: getstatic     #270                // Field java/lang/System.out:Ljava/io/PrintStream;
     257: aload         7
     259: invokevirtual #276                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     262: nop
     263: nop
     264: goto          228
     267: nop
     268: aload_1
     269: getfield      #192                // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;
     272: checkcast     #202                // class kotlin/Pair
     275: invokevirtual #217                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     278: checkcast     #210                // class java/lang/Number
     281: invokevirtual #213                // Method java/lang/Number.intValue:()I
     284: ireturn

  private static final kotlin.Pair getSuccessorState$lambda$2(Day16$SearchState, int, int, java.lang.String);
    Code:
       0: aload_3
       1: ldc_w         #290                // String it
       4: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: new           #81                 // class Day16$SearchState
      10: dup
      11: aload_3
      12: aload_0
      13: invokevirtual #141                // Method Day16$SearchState.getOpenValves:()Ljava/util/Map;
      16: iload_1
      17: aload_0
      18: invokespecial #166                // Method Day16$SearchState."<init>":(Ljava/lang/String;Ljava/util/Map;ILDay16$SearchState;)V
      21: iload_2
      22: invokestatic  #56                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      25: invokestatic  #62                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      28: areturn

  private static final boolean solve$lambda$3(Day16$Solver, kotlin.Pair);
    Code:
       0: aload_1
       1: ldc_w         #290                // String it
       4: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: getfield      #40                 // Field visitedStates:Ljava/util/Set;
      11: aload_1
      12: invokevirtual #297                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      15: invokeinterface #300,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
      20: ifne          27
      23: iconst_1
      24: goto          28
      27: iconst_0
      28: ireturn
}