class Day02 {
    fun part1(input: List<String>): Int {
        return input.map { it.split(" ") }
            .map { (opponentCode, myCode) -> HandShape.fromOpponentCode(opponentCode) to HandShape.fromElfCode(myCode) }
            .sumOf { (opponentHandShape, myHandShape) -> HandScorer.score(opponentHandShape, myHandShape) }
    }

    fun part2(input: List<String>): Int {
        return input.map { it.split(" ") }
            .map { (opponentCode, command) -> HandShape.fromOpponentCode(opponentCode) to command }
            .sumOf { (opponentHandShape, command) ->
                HandScorer.score(
                    opponentHandShape,
                    HandShape.decodeHand(opponentHandShape, command)
                )
            }
    }

    object HandScorer {

        fun score(opponentHand: HandShape, myHandShape: HandShape): Int {
            return myHandShape.score + resultScore(opponentHand, myHandShape)
        }

        private fun resultScore(opponentHand: HandShape, myHandShape: HandShape): Int {
            return when (opponentHand) {
                myHandShape -> 3
                HandShape.defeats[myHandShape] -> 6
                else -> 0
            }
        }

    }

    enum class HandShape(val opponentCode: String, val elfCode: String, val score: Int) {
        ROCK("A", "X", 1),
        PAPER("B", "Y", 2),
        SCISSORS("C", "Z", 3);

        companion object {
            val defeats = mapOf(
                ROCK to SCISSORS,
                PAPER to ROCK,
                SCISSORS to PAPER
            )

            fun fromOpponentCode(code: String) = values().first { it.opponentCode == code }
            fun fromElfCode(code: String) = values().first { it.elfCode == code }
            fun decodeHand(opponentHand: HandShape, command: String): HandShape {
                return when (command) {
                    "X" -> defeats[opponentHand]!!
                    "Y" -> opponentHand
                    "Z" -> defeats.entries.first { it.value == opponentHand }.key
                    else -> throw IllegalStateException()
                }
            }
        }
    }
}

Compiled from "Day02.kt"
public final class Day02$HandShape extends java.lang.Enum<Day02$HandShape> {
  public static final Day02$HandShape$Companion Companion;

  private final java.lang.String opponentCode;

  private final java.lang.String elfCode;

  private final int score;

  private static final java.util.Map<Day02$HandShape, Day02$HandShape> defeats;

  public static final Day02$HandShape ROCK;

  public static final Day02$HandShape PAPER;

  public static final Day02$HandShape SCISSORS;

  private static final Day02$HandShape[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

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

  public final java.lang.String getOpponentCode();
    Code:
       0: aload_0
       1: getfield      #15                 // Field opponentCode:Ljava/lang/String;
       4: areturn

  public final java.lang.String getElfCode();
    Code:
       0: aload_0
       1: getfield      #18                 // Field elfCode:Ljava/lang/String;
       4: areturn

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

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

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

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

  private static final Day02$HandShape[] $values();
    Code:
       0: iconst_3
       1: anewarray     #2                  // class Day02$HandShape
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #62                 // Field ROCK:LDay02$HandShape;
      10: aastore
      11: aload_0
      12: iconst_1
      13: getstatic     #65                 // Field PAPER:LDay02$HandShape;
      16: aastore
      17: aload_0
      18: iconst_2
      19: getstatic     #68                 // Field SCISSORS:LDay02$HandShape;
      22: aastore
      23: aload_0
      24: areturn

  public static final java.util.Map access$getDefeats$cp();
    Code:
       0: getstatic     #74                 // Field defeats:Ljava/util/Map;
       3: areturn

  static {};
    Code:
       0: new           #2                  // class Day02$HandShape
       3: dup
       4: ldc           #77                 // String ROCK
       6: iconst_0
       7: ldc           #79                 // String A
       9: ldc           #81                 // String X
      11: iconst_1
      12: invokespecial #83                 // Method "<init>":(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)V
      15: putstatic     #62                 // Field ROCK:LDay02$HandShape;
      18: new           #2                  // class Day02$HandShape
      21: dup
      22: ldc           #84                 // String PAPER
      24: iconst_1
      25: ldc           #86                 // String B
      27: ldc           #88                 // String Y
      29: iconst_2
      30: invokespecial #83                 // Method "<init>":(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)V
      33: putstatic     #65                 // Field PAPER:LDay02$HandShape;
      36: new           #2                  // class Day02$HandShape
      39: dup
      40: ldc           #89                 // String SCISSORS
      42: iconst_2
      43: ldc           #91                 // String C
      45: ldc           #93                 // String Z
      47: iconst_3
      48: invokespecial #83                 // Method "<init>":(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)V
      51: putstatic     #68                 // Field SCISSORS:LDay02$HandShape;
      54: invokestatic  #95                 // Method $values:()[LDay02$HandShape;
      57: putstatic     #38                 // Field $VALUES:[LDay02$HandShape;
      60: getstatic     #38                 // Field $VALUES:[LDay02$HandShape;
      63: checkcast     #97                 // class "[Ljava/lang/Enum;"
      66: invokestatic  #103                // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
      69: putstatic     #58                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
      72: new           #105                // class Day02$HandShape$Companion
      75: dup
      76: aconst_null
      77: invokespecial #108                // Method Day02$HandShape$Companion."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
      80: putstatic     #112                // Field Companion:LDay02$HandShape$Companion;
      83: iconst_3
      84: anewarray     #114                // class kotlin/Pair
      87: astore_0
      88: aload_0
      89: iconst_0
      90: getstatic     #62                 // Field ROCK:LDay02$HandShape;
      93: getstatic     #68                 // Field SCISSORS:LDay02$HandShape;
      96: invokestatic  #120                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      99: aastore
     100: aload_0
     101: iconst_1
     102: getstatic     #65                 // Field PAPER:LDay02$HandShape;
     105: getstatic     #62                 // Field ROCK:LDay02$HandShape;
     108: invokestatic  #120                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     111: aastore
     112: aload_0
     113: iconst_2
     114: getstatic     #68                 // Field SCISSORS:LDay02$HandShape;
     117: getstatic     #65                 // Field PAPER:LDay02$HandShape;
     120: invokestatic  #120                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     123: aastore
     124: aload_0
     125: invokestatic  #126                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
     128: putstatic     #74                 // Field defeats:Ljava/util/Map;
     131: return
}

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

  public final java.util.Map<Day02$HandShape, Day02$HandShape> getDefeats();
    Code:
       0: invokestatic  #19                 // Method Day02$HandShape.access$getDefeats$cp:()Ljava/util/Map;
       3: areturn

  public final Day02$HandShape fromOpponentCode(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #23                 // String code
       3: invokestatic  #29                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: invokestatic  #33                 // Method Day02$HandShape.values:()[LDay02$HandShape;
       9: astore_2
      10: iconst_0
      11: istore_3
      12: iconst_0
      13: istore        4
      15: aload_2
      16: arraylength
      17: istore        5
      19: iload         4
      21: iload         5
      23: if_icmpge     62
      26: aload_2
      27: iload         4
      29: aaload
      30: astore        6
      32: aload         6
      34: astore        7
      36: iconst_0
      37: istore        8
      39: aload         7
      41: invokevirtual #37                 // Method Day02$HandShape.getOpponentCode:()Ljava/lang/String;
      44: aload_1
      45: invokestatic  #41                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifeq          56
      51: aload         6
      53: goto          72
      56: iinc          4, 1
      59: goto          19
      62: new           #43                 // class java/util/NoSuchElementException
      65: dup
      66: ldc           #45                 // String Array contains no element matching the predicate.
      68: invokespecial #48                 // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
      71: athrow
      72: areturn

  public final Day02$HandShape fromElfCode(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #23                 // String code
       3: invokestatic  #29                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: invokestatic  #33                 // Method Day02$HandShape.values:()[LDay02$HandShape;
       9: astore_2
      10: iconst_0
      11: istore_3
      12: iconst_0
      13: istore        4
      15: aload_2
      16: arraylength
      17: istore        5
      19: iload         4
      21: iload         5
      23: if_icmpge     62
      26: aload_2
      27: iload         4
      29: aaload
      30: astore        6
      32: aload         6
      34: astore        7
      36: iconst_0
      37: istore        8
      39: aload         7
      41: invokevirtual #66                 // Method Day02$HandShape.getElfCode:()Ljava/lang/String;
      44: aload_1
      45: invokestatic  #41                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifeq          56
      51: aload         6
      53: goto          72
      56: iinc          4, 1
      59: goto          19
      62: new           #43                 // class java/util/NoSuchElementException
      65: dup
      66: ldc           #45                 // String Array contains no element matching the predicate.
      68: invokespecial #48                 // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
      71: athrow
      72: areturn

  public final Day02$HandShape decodeHand(Day02$HandShape, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #71                 // String opponentHand
       3: invokestatic  #29                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #73                 // String command
       9: invokestatic  #29                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: astore_3
      14: aload_3
      15: invokevirtual #77                 // Method java/lang/String.hashCode:()I
      18: tableswitch   { // 88 to 90
                    88: 44
                    89: 56
                    90: 68
               default: 207
          }
      44: aload_3
      45: ldc           #79                 // String X
      47: invokevirtual #83                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      50: ifne          80
      53: goto          207
      56: aload_3
      57: ldc           #85                 // String Y
      59: invokevirtual #83                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      62: ifne          100
      65: goto          207
      68: aload_3
      69: ldc           #87                 // String Z
      71: invokevirtual #83                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      74: ifne          104
      77: goto          207
      80: aload_0
      81: invokevirtual #89                 // Method getDefeats:()Ljava/util/Map;
      84: aload_1
      85: invokeinterface #95,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      90: dup
      91: invokestatic  #99                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      94: checkcast     #16                 // class Day02$HandShape
      97: goto          215
     100: aload_1
     101: goto          215
     104: aload_0
     105: invokevirtual #89                 // Method getDefeats:()Ljava/util/Map;
     108: invokeinterface #103,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     113: checkcast     #105                // class java/lang/Iterable
     116: astore        4
     118: iconst_0
     119: istore        5
     121: aload         4
     123: invokeinterface #109,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     128: astore        6
     130: aload         6
     132: invokeinterface #115,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     137: ifeq          183
     140: aload         6
     142: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     147: astore        7
     149: aload         7
     151: checkcast     #121                // class java/util/Map$Entry
     154: astore        8
     156: iconst_0
     157: istore        9
     159: aload         8
     161: invokeinterface #124,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     166: aload_1
     167: if_acmpne     174
     170: iconst_1
     171: goto          175
     174: iconst_0
     175: ifeq          130
     178: aload         7
     180: goto          193
     183: new           #43                 // class java/util/NoSuchElementException
     186: dup
     187: ldc           #126                // String Collection contains no element matching the predicate.
     189: invokespecial #48                 // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
     192: athrow
     193: checkcast     #121                // class java/util/Map$Entry
     196: invokeinterface #129,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     201: checkcast     #16                 // class Day02$HandShape
     204: goto          215
     207: new           #131                // class java/lang/IllegalStateException
     210: dup
     211: invokespecial #132                // Method java/lang/IllegalStateException."<init>":()V
     214: athrow
     215: areturn

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

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

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

  public final int score(Day02$HandShape, Day02$HandShape);
    Code:
       0: aload_1
       1: ldc           #15                 // String opponentHand
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #23                 // String myHandShape
       9: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: invokevirtual #29                 // Method Day02$HandShape.getScore:()I
      16: aload_0
      17: aload_1
      18: aload_2
      19: invokespecial #32                 // Method resultScore:(LDay02$HandShape;LDay02$HandShape;)I
      22: iadd
      23: ireturn

  private final int resultScore(Day02$HandShape, Day02$HandShape);
    Code:
       0: aload_1
       1: astore_3
       2: aload_3
       3: aload_2
       4: if_acmpne     11
       7: iconst_3
       8: goto          33
      11: aload_3
      12: getstatic     #37                 // Field Day02$HandShape.Companion:LDay02$HandShape$Companion;
      15: invokevirtual #43                 // Method Day02$HandShape$Companion.getDefeats:()Ljava/util/Map;
      18: aload_2
      19: invokeinterface #49,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      24: if_acmpne     32
      27: bipush        6
      29: goto          33
      32: iconst_0
      33: ireturn

  static {};
    Code:
       0: new           #2                  // class Day02$HandScorer
       3: dup
       4: invokespecial #51                 // Method "<init>":()V
       7: putstatic     #54                 // Field INSTANCE:LDay02$HandScorer;
      10: return
}

Compiled from "Day02.kt"
public final class Day02 {
  public Day02();
    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_2
      11: iconst_0
      12: istore_3
      13: aload_2
      14: astore        4
      16: new           #26                 // class java/util/ArrayList
      19: dup
      20: aload_2
      21: bipush        10
      23: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      26: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
      29: checkcast     #37                 // class java/util/Collection
      32: astore        5
      34: iconst_0
      35: istore        6
      37: aload         4
      39: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      44: astore        7
      46: aload         7
      48: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      53: ifeq          118
      56: aload         7
      58: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: astore        8
      65: aload         5
      67: aload         8
      69: checkcast     #53                 // class java/lang/String
      72: astore        9
      74: astore        13
      76: iconst_0
      77: istore        10
      79: aload         9
      81: checkcast     #55                 // class java/lang/CharSequence
      84: iconst_1
      85: anewarray     #53                 // class java/lang/String
      88: astore        11
      90: aload         11
      92: iconst_0
      93: ldc           #57                 // String
      95: aastore
      96: aload         11
      98: iconst_0
      99: iconst_0
     100: bipush        6
     102: aconst_null
     103: invokestatic  #63                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     106: aload         13
     108: swap
     109: invokeinterface #67,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     114: pop
     115: goto          46
     118: aload         5
     120: checkcast     #69                 // class java/util/List
     123: nop
     124: checkcast     #24                 // class java/lang/Iterable
     127: astore_2
     128: nop
     129: iconst_0
     130: istore_3
     131: aload_2
     132: astore        4
     134: new           #26                 // class java/util/ArrayList
     137: dup
     138: aload_2
     139: bipush        10
     141: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     144: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     147: checkcast     #37                 // class java/util/Collection
     150: astore        5
     152: iconst_0
     153: istore        6
     155: aload         4
     157: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     162: astore        7
     164: aload         7
     166: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     171: ifeq          254
     174: aload         7
     176: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     181: astore        8
     183: aload         5
     185: aload         8
     187: checkcast     #69                 // class java/util/List
     190: astore        9
     192: astore        13
     194: iconst_0
     195: istore        10
     197: aload         9
     199: iconst_0
     200: invokeinterface #73,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     205: checkcast     #53                 // class java/lang/String
     208: astore        11
     210: aload         9
     212: iconst_1
     213: invokeinterface #73,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     218: checkcast     #53                 // class java/lang/String
     221: astore        12
     223: getstatic     #79                 // Field Day02$HandShape.Companion:LDay02$HandShape$Companion;
     226: aload         11
     228: invokevirtual #85                 // Method Day02$HandShape$Companion.fromOpponentCode:(Ljava/lang/String;)LDay02$HandShape;
     231: getstatic     #79                 // Field Day02$HandShape.Companion:LDay02$HandShape$Companion;
     234: aload         12
     236: invokevirtual #88                 // Method Day02$HandShape$Companion.fromElfCode:(Ljava/lang/String;)LDay02$HandShape;
     239: invokestatic  #94                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     242: aload         13
     244: swap
     245: invokeinterface #67,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     250: pop
     251: goto          164
     254: aload         5
     256: checkcast     #69                 // class java/util/List
     259: nop
     260: checkcast     #24                 // class java/lang/Iterable
     263: astore_2
     264: iconst_0
     265: istore_3
     266: aload_2
     267: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     272: astore        4
     274: aload         4
     276: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     281: ifeq          347
     284: aload         4
     286: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     291: astore        5
     293: iload_3
     294: aload         5
     296: checkcast     #96                 // class kotlin/Pair
     299: astore        6
     301: istore        13
     303: iconst_0
     304: istore        7
     306: aload         6
     308: invokevirtual #99                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
     311: checkcast     #75                 // class Day02$HandShape
     314: astore        8
     316: aload         6
     318: invokevirtual #102                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     321: checkcast     #75                 // class Day02$HandShape
     324: astore        9
     326: getstatic     #108                // Field Day02$HandScorer.INSTANCE:LDay02$HandScorer;
     329: aload         8
     331: aload         9
     333: invokevirtual #112                // Method Day02$HandScorer.score:(LDay02$HandShape;LDay02$HandShape;)I
     336: istore        14
     338: iload         13
     340: iload         14
     342: iadd
     343: istore_3
     344: goto          274
     347: iload_3
     348: 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_2
      11: iconst_0
      12: istore_3
      13: aload_2
      14: astore        4
      16: new           #26                 // class java/util/ArrayList
      19: dup
      20: aload_2
      21: bipush        10
      23: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      26: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
      29: checkcast     #37                 // class java/util/Collection
      32: astore        5
      34: iconst_0
      35: istore        6
      37: aload         4
      39: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      44: astore        7
      46: aload         7
      48: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      53: ifeq          118
      56: aload         7
      58: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: astore        8
      65: aload         5
      67: aload         8
      69: checkcast     #53                 // class java/lang/String
      72: astore        9
      74: astore        13
      76: iconst_0
      77: istore        10
      79: aload         9
      81: checkcast     #55                 // class java/lang/CharSequence
      84: iconst_1
      85: anewarray     #53                 // class java/lang/String
      88: astore        11
      90: aload         11
      92: iconst_0
      93: ldc           #57                 // String
      95: aastore
      96: aload         11
      98: iconst_0
      99: iconst_0
     100: bipush        6
     102: aconst_null
     103: invokestatic  #63                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     106: aload         13
     108: swap
     109: invokeinterface #67,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     114: pop
     115: goto          46
     118: aload         5
     120: checkcast     #69                 // class java/util/List
     123: nop
     124: checkcast     #24                 // class java/lang/Iterable
     127: astore_2
     128: nop
     129: iconst_0
     130: istore_3
     131: aload_2
     132: astore        4
     134: new           #26                 // class java/util/ArrayList
     137: dup
     138: aload_2
     139: bipush        10
     141: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     144: invokespecial #35                 // Method java/util/ArrayList."<init>":(I)V
     147: checkcast     #37                 // class java/util/Collection
     150: astore        5
     152: iconst_0
     153: istore        6
     155: aload         4
     157: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     162: astore        7
     164: aload         7
     166: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     171: ifeq          248
     174: aload         7
     176: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     181: astore        8
     183: aload         5
     185: aload         8
     187: checkcast     #69                 // class java/util/List
     190: astore        9
     192: astore        13
     194: iconst_0
     195: istore        10
     197: aload         9
     199: iconst_0
     200: invokeinterface #73,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     205: checkcast     #53                 // class java/lang/String
     208: astore        11
     210: aload         9
     212: iconst_1
     213: invokeinterface #73,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     218: checkcast     #53                 // class java/lang/String
     221: astore        12
     223: getstatic     #79                 // Field Day02$HandShape.Companion:LDay02$HandShape$Companion;
     226: aload         11
     228: invokevirtual #85                 // Method Day02$HandShape$Companion.fromOpponentCode:(Ljava/lang/String;)LDay02$HandShape;
     231: aload         12
     233: invokestatic  #94                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     236: aload         13
     238: swap
     239: invokeinterface #67,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     244: pop
     245: goto          164
     248: aload         5
     250: checkcast     #69                 // class java/util/List
     253: nop
     254: checkcast     #24                 // class java/lang/Iterable
     257: astore_2
     258: iconst_0
     259: istore_3
     260: aload_2
     261: invokeinterface #41,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     266: astore        4
     268: aload         4
     270: invokeinterface #47,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     275: ifeq          350
     278: aload         4
     280: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     285: astore        5
     287: iload_3
     288: aload         5
     290: checkcast     #96                 // class kotlin/Pair
     293: astore        6
     295: istore        13
     297: iconst_0
     298: istore        7
     300: aload         6
     302: invokevirtual #99                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
     305: checkcast     #75                 // class Day02$HandShape
     308: astore        8
     310: aload         6
     312: invokevirtual #102                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     315: checkcast     #53                 // class java/lang/String
     318: astore        9
     320: getstatic     #108                // Field Day02$HandScorer.INSTANCE:LDay02$HandScorer;
     323: aload         8
     325: getstatic     #79                 // Field Day02$HandShape.Companion:LDay02$HandShape$Companion;
     328: aload         8
     330: aload         9
     332: invokevirtual #138                // Method Day02$HandShape$Companion.decodeHand:(LDay02$HandShape;Ljava/lang/String;)LDay02$HandShape;
     335: invokevirtual #112                // Method Day02$HandScorer.score:(LDay02$HandShape;LDay02$HandShape;)I
     338: nop
     339: istore        14
     341: iload         13
     343: iload         14
     345: iadd
     346: istore_3
     347: goto          268
     350: iload_3
     351: ireturn
}


import kotlin.math.abs

class Day15 {

    fun part1(input: List<String>, lookupRow: Int): Int {
        val sensors = mapToSensors(input)

        val minRange = sensors.minOf { sensor ->
            minOf(
                sensor.position.x,
                sensor.beacon.x,
                sensor.position.x - sensor.distanceToBeacon()
            )
        }

        val maxRange = sensors.maxOf { sensor ->
            maxOf(
                sensor.position.x,
                sensor.beacon.x,
                sensor.position.x + sensor.distanceToBeacon()
            )
        }

        return (minRange..maxRange).count { x ->
            val point = Point(x, lookupRow)
            sensors.any { sensor -> sensor.beacon != point && sensor.position.distance(point) <= sensor.distanceToBeacon() }
        }
    }

    fun part2(input: List<String>, limit: Int): Long {
        val sensors = mapToSensors(input)
        val pointNotCovered = findPositionNotCoveredByBeacon(limit, sensors)
        return pointNotCovered.x.toLong() * 4000000 + pointNotCovered.y.toLong()
    }

    private fun findPositionNotCoveredByBeacon(limit: Int, sensors: List<Sensor>): Point {
        for (y in 0..limit) {
            var point = Point(0, y)
            while (point.x <= limit) {
                val coveredBySensor = pointCoveredBySensor(sensors, point)
                if (coveredBySensor == null) {
                    return point
                } else {
                    val maxCovered = coveredBySensor.maxDistanceCovered(point.y)
                    point = Point(maxCovered.x + 1, maxCovered.y)
                }
            }
        }
        error("Should find one...")
    }

    private fun pointCoveredBySensor(sensors: List<Sensor>, point: Point): Sensor? {
        return sensors.find { it.isInRange(point) }
    }

    private fun mapToSensors(input: List<String>) =
        input.map { it.split(": closest beacon is at ") }
            .map { (point1, point2) ->
                Sensor(
                    point1.substringAfter("Sensor at ").mapToPoint(),
                    point2.mapToPoint()
                )
            }

    data class Sensor(val position: Point, val beacon: Point) {

        fun distanceToBeacon(): Int {
            return position.distance(beacon)
        }

        fun isInRange(other: Point): Boolean {
            return position.distance(other) <= position.distance(beacon)
        }

        fun maxDistanceCovered(row: Int): Point {
            return Point(position.x + abs(distanceToBeacon() - abs(row - position.y)), row)
        }
    }

    data class Point(val x: Int, val y: Int) {

        fun distance(other: Point): Int {
            return abs(other.x - x) + abs(other.y - y)
        }
    }

    private fun String.mapToPoint(): Point {
        val (x, y) = split(", ")
        return Point(x.substringAfter("x=").toInt(), y.substringAfter("y=").toInt())
    }
}

Compiled from "Day15.kt"
public final class Day15 {
  public Day15();
    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>, int);
    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_0
       7: aload_1
       8: invokespecial #26                 // Method mapToSensors:(Ljava/util/List;)Ljava/util/List;
      11: astore_3
      12: aload_3
      13: checkcast     #28                 // class java/lang/Iterable
      16: invokeinterface #32,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      21: astore        6
      23: aload         6
      25: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      30: ifne          41
      33: new           #40                 // class java/util/NoSuchElementException
      36: dup
      37: invokespecial #41                 // Method java/util/NoSuchElementException."<init>":()V
      40: athrow
      41: aload         6
      43: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      48: checkcast     #47                 // class Day15$Sensor
      51: astore        7
      53: iconst_0
      54: istore        8
      56: nop
      57: aload         7
      59: invokevirtual #51                 // Method Day15$Sensor.getPosition:()LDay15$Point;
      62: invokevirtual #57                 // Method Day15$Point.getX:()I
      65: aload         7
      67: invokevirtual #60                 // Method Day15$Sensor.getBeacon:()LDay15$Point;
      70: invokevirtual #57                 // Method Day15$Point.getX:()I
      73: aload         7
      75: invokevirtual #51                 // Method Day15$Sensor.getPosition:()LDay15$Point;
      78: invokevirtual #57                 // Method Day15$Point.getX:()I
      81: aload         7
      83: invokevirtual #63                 // Method Day15$Sensor.distanceToBeacon:()I
      86: isub
      87: invokestatic  #69                 // Method java/lang/Math.min:(II)I
      90: invokestatic  #69                 // Method java/lang/Math.min:(II)I
      93: nop
      94: istore        7
      96: aload         6
      98: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     103: ifeq          175
     106: aload         6
     108: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     113: checkcast     #47                 // class Day15$Sensor
     116: astore        8
     118: iconst_0
     119: istore        9
     121: nop
     122: aload         8
     124: invokevirtual #51                 // Method Day15$Sensor.getPosition:()LDay15$Point;
     127: invokevirtual #57                 // Method Day15$Point.getX:()I
     130: aload         8
     132: invokevirtual #60                 // Method Day15$Sensor.getBeacon:()LDay15$Point;
     135: invokevirtual #57                 // Method Day15$Point.getX:()I
     138: aload         8
     140: invokevirtual #51                 // Method Day15$Sensor.getPosition:()LDay15$Point;
     143: invokevirtual #57                 // Method Day15$Point.getX:()I
     146: aload         8
     148: invokevirtual #63                 // Method Day15$Sensor.distanceToBeacon:()I
     151: isub
     152: invokestatic  #69                 // Method java/lang/Math.min:(II)I
     155: invokestatic  #69                 // Method java/lang/Math.min:(II)I
     158: nop
     159: istore        8
     161: iload         7
     163: iload         8
     165: if_icmple     96
     168: iload         8
     170: istore        7
     172: goto          96
     175: iload         7
     177: istore        4
     179: aload_3
     180: checkcast     #28                 // class java/lang/Iterable
     183: invokeinterface #32,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     188: astore        7
     190: aload         7
     192: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     197: ifne          208
     200: new           #40                 // class java/util/NoSuchElementException
     203: dup
     204: invokespecial #41                 // Method java/util/NoSuchElementException."<init>":()V
     207: athrow
     208: aload         7
     210: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     215: checkcast     #47                 // class Day15$Sensor
     218: astore        8
     220: iconst_0
     221: istore        9
     223: nop
     224: aload         8
     226: invokevirtual #51                 // Method Day15$Sensor.getPosition:()LDay15$Point;
     229: invokevirtual #57                 // Method Day15$Point.getX:()I
     232: aload         8
     234: invokevirtual #60                 // Method Day15$Sensor.getBeacon:()LDay15$Point;
     237: invokevirtual #57                 // Method Day15$Point.getX:()I
     240: aload         8
     242: invokevirtual #51                 // Method Day15$Sensor.getPosition:()LDay15$Point;
     245: invokevirtual #57                 // Method Day15$Point.getX:()I
     248: aload         8
     250: invokevirtual #63                 // Method Day15$Sensor.distanceToBeacon:()I
     253: iadd
     254: invokestatic  #72                 // Method java/lang/Math.max:(II)I
     257: invokestatic  #72                 // Method java/lang/Math.max:(II)I
     260: nop
     261: istore        8
     263: aload         7
     265: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     270: ifeq          342
     273: aload         7
     275: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     280: checkcast     #47                 // class Day15$Sensor
     283: astore        9
     285: iconst_0
     286: istore        10
     288: nop
     289: aload         9
     291: invokevirtual #51                 // Method Day15$Sensor.getPosition:()LDay15$Point;
     294: invokevirtual #57                 // Method Day15$Point.getX:()I
     297: aload         9
     299: invokevirtual #60                 // Method Day15$Sensor.getBeacon:()LDay15$Point;
     302: invokevirtual #57                 // Method Day15$Point.getX:()I
     305: aload         9
     307: invokevirtual #51                 // Method Day15$Sensor.getPosition:()LDay15$Point;
     310: invokevirtual #57                 // Method Day15$Point.getX:()I
     313: aload         9
     315: invokevirtual #63                 // Method Day15$Sensor.distanceToBeacon:()I
     318: iadd
     319: invokestatic  #72                 // Method java/lang/Math.max:(II)I
     322: invokestatic  #72                 // Method java/lang/Math.max:(II)I
     325: nop
     326: istore        9
     328: iload         8
     330: iload         9
     332: if_icmpge     263
     335: iload         9
     337: istore        8
     339: goto          263
     342: iload         8
     344: istore        5
     346: new           #74                 // class kotlin/ranges/IntRange
     349: dup
     350: iload         4
     352: iload         5
     354: invokespecial #77                 // Method kotlin/ranges/IntRange."<init>":(II)V
     357: checkcast     #28                 // class java/lang/Iterable
     360: astore        6
     362: iconst_0
     363: istore        7
     365: aload         6
     367: instanceof    #79                 // class java/util/Collection
     370: ifeq          390
     373: aload         6
     375: checkcast     #79                 // class java/util/Collection
     378: invokeinterface #82,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
     383: ifeq          390
     386: iconst_0
     387: goto          577
     390: iconst_0
     391: istore        8
     393: aload         6
     395: invokeinterface #32,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     400: astore        9
     402: aload         9
     404: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     409: ifeq          575
     412: aload         9
     414: checkcast     #84                 // class kotlin/collections/IntIterator
     417: invokevirtual #87                 // Method kotlin/collections/IntIterator.nextInt:()I
     420: istore        10
     422: iload         10
     424: istore        11
     426: iconst_0
     427: istore        12
     429: new           #53                 // class Day15$Point
     432: dup
     433: iload         11
     435: iload_2
     436: invokespecial #88                 // Method Day15$Point."<init>":(II)V
     439: astore        13
     441: aload_3
     442: checkcast     #28                 // class java/lang/Iterable
     445: astore        14
     447: iconst_0
     448: istore        15
     450: aload         14
     452: instanceof    #79                 // class java/util/Collection
     455: ifeq          475
     458: aload         14
     460: checkcast     #79                 // class java/util/Collection
     463: invokeinterface #82,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
     468: ifeq          475
     471: iconst_0
     472: goto          557
     475: aload         14
     477: invokeinterface #32,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     482: astore        16
     484: aload         16
     486: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     491: ifeq          556
     494: aload         16
     496: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     501: astore        17
     503: aload         17
     505: checkcast     #47                 // class Day15$Sensor
     508: astore        18
     510: iconst_0
     511: istore        19
     513: aload         18
     515: invokevirtual #60                 // Method Day15$Sensor.getBeacon:()LDay15$Point;
     518: aload         13
     520: invokestatic  #92                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     523: ifne          548
     526: aload         18
     528: invokevirtual #51                 // Method Day15$Sensor.getPosition:()LDay15$Point;
     531: aload         13
     533: invokevirtual #96                 // Method Day15$Point.distance:(LDay15$Point;)I
     536: aload         18
     538: invokevirtual #63                 // Method Day15$Sensor.distanceToBeacon:()I
     541: if_icmpgt     548
     544: iconst_1
     545: goto          549
     548: iconst_0
     549: ifeq          484
     552: iconst_1
     553: goto          557
     556: iconst_0
     557: nop
     558: ifeq          402
     561: iinc          8, 1
     564: iload         8
     566: ifge          402
     569: invokestatic  #101                // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V
     572: goto          402
     575: iload         8
     577: ireturn

  public final long part2(java.util.List<java.lang.String>, int);
    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_0
       7: aload_1
       8: invokespecial #26                 // Method mapToSensors:(Ljava/util/List;)Ljava/util/List;
      11: astore_3
      12: aload_0
      13: iload_2
      14: aload_3
      15: invokespecial #133                // Method findPositionNotCoveredByBeacon:(ILjava/util/List;)LDay15$Point;
      18: astore        4
      20: aload         4
      22: invokevirtual #57                 // Method Day15$Point.getX:()I
      25: i2l
      26: ldc           #134                // int 4000000
      28: i2l
      29: lmul
      30: aload         4
      32: invokevirtual #137                // Method Day15$Point.getY:()I
      35: i2l
      36: ladd
      37: lreturn

  private final Day15$Point findPositionNotCoveredByBeacon(int, java.util.List<Day15$Sensor>);
    Code:
       0: iconst_0
       1: istore_3
       2: iload_3
       3: iload_1
       4: if_icmpgt     91
       7: new           #53                 // class Day15$Point
      10: dup
      11: iconst_0
      12: iload_3
      13: invokespecial #88                 // Method Day15$Point."<init>":(II)V
      16: astore        4
      18: aload         4
      20: invokevirtual #57                 // Method Day15$Point.getX:()I
      23: iload_1
      24: if_icmpgt     80
      27: aload_0
      28: aload_2
      29: aload         4
      31: invokespecial #144                // Method pointCoveredBySensor:(Ljava/util/List;LDay15$Point;)LDay15$Sensor;
      34: astore        5
      36: aload         5
      38: ifnonnull     44
      41: aload         4
      43: areturn
      44: aload         5
      46: aload         4
      48: invokevirtual #137                // Method Day15$Point.getY:()I
      51: invokevirtual #148                // Method Day15$Sensor.maxDistanceCovered:(I)LDay15$Point;
      54: astore        6
      56: new           #53                 // class Day15$Point
      59: dup
      60: aload         6
      62: invokevirtual #57                 // Method Day15$Point.getX:()I
      65: iconst_1
      66: iadd
      67: aload         6
      69: invokevirtual #137                // Method Day15$Point.getY:()I
      72: invokespecial #88                 // Method Day15$Point."<init>":(II)V
      75: astore        4
      77: goto          18
      80: iload_3
      81: iload_1
      82: if_icmpeq     91
      85: iinc          3, 1
      88: goto          7
      91: new           #150                // class java/lang/IllegalStateException
      94: dup
      95: ldc           #152                // String Should find one...
      97: invokevirtual #156                // Method java/lang/Object.toString:()Ljava/lang/String;
     100: invokespecial #159                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     103: athrow

  private final Day15$Sensor pointCoveredBySensor(java.util.List<Day15$Sensor>, Day15$Point);
    Code:
       0: aload_1
       1: checkcast     #28                 // class java/lang/Iterable
       4: astore_3
       5: aload_3
       6: invokeinterface #32,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      11: astore        4
      13: aload         4
      15: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      20: ifeq          56
      23: aload         4
      25: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      30: astore        5
      32: aload         5
      34: checkcast     #47                 // class Day15$Sensor
      37: astore        6
      39: iconst_0
      40: istore        7
      42: aload         6
      44: aload_2
      45: invokevirtual #167                // Method Day15$Sensor.isInRange:(LDay15$Point;)Z
      48: ifeq          13
      51: aload         5
      53: goto          57
      56: aconst_null
      57: checkcast     #47                 // class Day15$Sensor
      60: areturn

  private final java.util.List<Day15$Sensor> mapToSensors(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: checkcast     #28                 // class java/lang/Iterable
       4: astore_2
       5: iconst_0
       6: istore_3
       7: aload_2
       8: astore        4
      10: new           #172                // class java/util/ArrayList
      13: dup
      14: aload_2
      15: bipush        10
      17: invokestatic  #176                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      20: invokespecial #179                // Method java/util/ArrayList."<init>":(I)V
      23: checkcast     #79                 // class java/util/Collection
      26: astore        5
      28: iconst_0
      29: istore        6
      31: aload         4
      33: invokeinterface #32,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      38: astore        7
      40: aload         7
      42: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      47: ifeq          112
      50: aload         7
      52: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      57: astore        8
      59: aload         5
      61: aload         8
      63: checkcast     #181                // class java/lang/String
      66: astore        9
      68: astore        13
      70: iconst_0
      71: istore        10
      73: aload         9
      75: checkcast     #183                // class java/lang/CharSequence
      78: iconst_1
      79: anewarray     #181                // class java/lang/String
      82: astore        11
      84: aload         11
      86: iconst_0
      87: ldc           #185                // String : closest beacon is at
      89: aastore
      90: aload         11
      92: iconst_0
      93: iconst_0
      94: bipush        6
      96: aconst_null
      97: invokestatic  #191                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     100: aload         13
     102: swap
     103: invokeinterface #195,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     108: pop
     109: goto          40
     112: aload         5
     114: checkcast     #126                // class java/util/List
     117: nop
     118: checkcast     #28                 // class java/lang/Iterable
     121: astore_2
     122: nop
     123: iconst_0
     124: istore_3
     125: aload_2
     126: astore        4
     128: new           #172                // class java/util/ArrayList
     131: dup
     132: aload_2
     133: bipush        10
     135: invokestatic  #176                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     138: invokespecial #179                // Method java/util/ArrayList."<init>":(I)V
     141: checkcast     #79                 // class java/util/Collection
     144: astore        5
     146: iconst_0
     147: istore        6
     149: aload         4
     151: invokeinterface #32,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     156: astore        7
     158: aload         7
     160: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     165: ifeq          257
     168: aload         7
     170: invokeinterface #45,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     175: astore        8
     177: aload         5
     179: aload         8
     181: checkcast     #126                // class java/util/List
     184: astore        9
     186: astore        13
     188: iconst_0
     189: istore        10
     191: aload         9
     193: iconst_0
     194: invokeinterface #199,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     199: checkcast     #181                // class java/lang/String
     202: astore        11
     204: aload         9
     206: iconst_1
     207: invokeinterface #199,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     212: checkcast     #181                // class java/lang/String
     215: astore        12
     217: new           #47                 // class Day15$Sensor
     220: dup
     221: aload_0
     222: aload         11
     224: ldc           #201                // String Sensor at
     226: aconst_null
     227: iconst_2
     228: aconst_null
     229: invokestatic  #205                // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
     232: invokespecial #209                // Method mapToPoint:(Ljava/lang/String;)LDay15$Point;
     235: aload_0
     236: aload         12
     238: invokespecial #209                // Method mapToPoint:(Ljava/lang/String;)LDay15$Point;
     241: invokespecial #212                // Method Day15$Sensor."<init>":(LDay15$Point;LDay15$Point;)V
     244: nop
     245: aload         13
     247: swap
     248: invokeinterface #195,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     253: pop
     254: goto          158
     257: aload         5
     259: checkcast     #126                // class java/util/List
     262: nop
     263: areturn

  private final Day15$Point mapToPoint(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #183                // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #181                // class java/lang/String
       8: astore_3
       9: aload_3
      10: iconst_0
      11: ldc           #226                // String ,
      13: aastore
      14: aload_3
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #191                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: astore_2
      24: aload_2
      25: iconst_0
      26: invokeinterface #199,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      31: checkcast     #181                // class java/lang/String
      34: astore_3
      35: aload_2
      36: iconst_1
      37: invokeinterface #199,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      42: checkcast     #181                // class java/lang/String
      45: astore        4
      47: new           #53                 // class Day15$Point
      50: dup
      51: aload_3
      52: ldc           #228                // String x=
      54: aconst_null
      55: iconst_2
      56: aconst_null
      57: invokestatic  #205                // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      60: invokestatic  #234                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      63: aload         4
      65: ldc           #236                // String y=
      67: aconst_null
      68: iconst_2
      69: aconst_null
      70: invokestatic  #205                // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      73: invokestatic  #234                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      76: invokespecial #88                 // Method Day15$Point."<init>":(II)V
      79: areturn
}

Compiled from "Day15.kt"
public final class Day15$Sensor {
  private final Day15$Point position;

  private final Day15$Point beacon;

  public Day15$Sensor(Day15$Point, Day15$Point);
    Code:
       0: aload_1
       1: ldc           #9                  // String position
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #17                 // String beacon
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokespecial #20                 // Method java/lang/Object."<init>":()V
      16: aload_0
      17: aload_1
      18: putfield      #23                 // Field position:LDay15$Point;
      21: aload_0
      22: aload_2
      23: putfield      #25                 // Field beacon:LDay15$Point;
      26: return

  public final Day15$Point getPosition();
    Code:
       0: aload_0
       1: getfield      #23                 // Field position:LDay15$Point;
       4: areturn

  public final Day15$Point getBeacon();
    Code:
       0: aload_0
       1: getfield      #25                 // Field beacon:LDay15$Point;
       4: areturn

  public final int distanceToBeacon();
    Code:
       0: aload_0
       1: getfield      #23                 // Field position:LDay15$Point;
       4: aload_0
       5: getfield      #25                 // Field beacon:LDay15$Point;
       8: invokevirtual #38                 // Method Day15$Point.distance:(LDay15$Point;)I
      11: ireturn

  public final boolean isInRange(Day15$Point);
    Code:
       0: aload_1
       1: ldc           #42                 // String other
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #23                 // Field position:LDay15$Point;
      10: aload_1
      11: invokevirtual #38                 // Method Day15$Point.distance:(LDay15$Point;)I
      14: aload_0
      15: getfield      #23                 // Field position:LDay15$Point;
      18: aload_0
      19: getfield      #25                 // Field beacon:LDay15$Point;
      22: invokevirtual #38                 // Method Day15$Point.distance:(LDay15$Point;)I
      25: if_icmpgt     32
      28: iconst_1
      29: goto          33
      32: iconst_0
      33: ireturn

  public final Day15$Point maxDistanceCovered(int);
    Code:
       0: new           #34                 // class Day15$Point
       3: dup
       4: aload_0
       5: getfield      #23                 // Field position:LDay15$Point;
       8: invokevirtual #47                 // Method Day15$Point.getX:()I
      11: aload_0
      12: invokevirtual #49                 // Method distanceToBeacon:()I
      15: iload_1
      16: aload_0
      17: getfield      #23                 // Field position:LDay15$Point;
      20: invokevirtual #52                 // Method Day15$Point.getY:()I
      23: isub
      24: invokestatic  #58                 // Method java/lang/Math.abs:(I)I
      27: isub
      28: invokestatic  #58                 // Method java/lang/Math.abs:(I)I
      31: iadd
      32: iload_1
      33: invokespecial #61                 // Method Day15$Point."<init>":(II)V
      36: areturn

  public final Day15$Point component1();
    Code:
       0: aload_0
       1: getfield      #23                 // Field position:LDay15$Point;
       4: areturn

  public final Day15$Point component2();
    Code:
       0: aload_0
       1: getfield      #25                 // Field beacon:LDay15$Point;
       4: areturn

  public final Day15$Sensor copy(Day15$Point, Day15$Point);
    Code:
       0: aload_1
       1: ldc           #9                  // String position
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #17                 // String beacon
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #2                  // class Day15$Sensor
      15: dup
      16: aload_1
      17: aload_2
      18: invokespecial #69                 // Method "<init>":(LDay15$Point;LDay15$Point;)V
      21: areturn

  public static Day15$Sensor copy$default(Day15$Sensor, Day15$Point, Day15$Point, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #23                 // Field position:LDay15$Point;
      10: astore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #25                 // Field beacon:LDay15$Point;
      21: astore_2
      22: aload_0
      23: aload_1
      24: aload_2
      25: invokevirtual #73                 // Method copy:(LDay15$Point;LDay15$Point;)LDay15$Sensor;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #77                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #78                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #80                 // String Sensor(position=
       9: invokevirtual #84                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #23                 // Field position:LDay15$Point;
      16: invokevirtual #87                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      19: ldc           #89                 // String , beacon=
      21: invokevirtual #84                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #25                 // Field beacon:LDay15$Point;
      28: invokevirtual #87                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #92                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #94                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #23                 // Field position:LDay15$Point;
       4: invokevirtual #97                 // Method Day15$Point.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #25                 // Field beacon:LDay15$Point;
      16: invokevirtual #97                 // Method Day15$Point.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 Day15$Sensor
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day15$Sensor
      20: astore_2
      21: aload_0
      22: getfield      #23                 // Field position:LDay15$Point;
      25: aload_2
      26: getfield      #23                 // Field position:LDay15$Point;
      29: invokestatic  #105                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #25                 // Field beacon:LDay15$Point;
      41: aload_2
      42: getfield      #25                 // Field beacon:LDay15$Point;
      45: invokestatic  #105                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifne          53
      51: iconst_0
      52: ireturn
      53: iconst_1
      54: ireturn
}

Compiled from "Day15.kt"
public final class Day15$Point {
  private final int x;

  private final int y;

  public Day15$Point(int, int);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #13                 // Field x:I
       9: aload_0
      10: iload_2
      11: putfield      #16                 // Field y:I
      14: return

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

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

  public final int distance(Day15$Point);
    Code:
       0: aload_1
       1: ldc           #26                 // String other
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: getfield      #13                 // Field x:I
      10: aload_0
      11: getfield      #13                 // Field x:I
      14: isub
      15: invokestatic  #38                 // Method java/lang/Math.abs:(I)I
      18: aload_1
      19: getfield      #16                 // Field y:I
      22: aload_0
      23: getfield      #16                 // Field y:I
      26: isub
      27: invokestatic  #38                 // Method java/lang/Math.abs:(I)I
      30: iadd
      31: ireturn

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

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

  public final Day15$Point copy(int, int);
    Code:
       0: new           #2                  // class Day15$Point
       3: dup
       4: iload_1
       5: iload_2
       6: invokespecial #44                 // Method "<init>":(II)V
       9: areturn

  public static Day15$Point copy$default(Day15$Point, int, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #13                 // Field x:I
      10: istore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #16                 // Field y:I
      21: istore_2
      22: aload_0
      23: iload_1
      24: iload_2
      25: invokevirtual #48                 // Method copy:(II)LDay15$Point;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #52                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #53                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #55                 // String Point(x=
       9: invokevirtual #59                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field x:I
      16: invokevirtual #62                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #64                 // String , y=
      21: invokevirtual #59                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field y:I
      28: invokevirtual #62                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #67                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #69                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field x: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      #16                 // Field y:I
      16: invokestatic  #74                 // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class Day15$Point
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day15$Point
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field x:I
      25: aload_2
      26: getfield      #13                 // Field x:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #16                 // Field y:I
      38: aload_2
      39: getfield      #16                 // Field y:I
      42: if_icmpeq     47
      45: iconst_0
      46: ireturn
      47: iconst_1
      48: ireturn
}