import java.util.LinkedList

object Day12 {
    const val EXPECTED_PART1_CHECK_ANSWER = 31
    const val EXPECTED_PART2_CHECK_ANSWER = 29

    const val CHAR_START = 'S'
    const val CHAR_DESTINATION = 'E'
    const val CHAR_LOWEST = 'a'
}

fun main() {

    fun List<String>.parseData(): Array<CharArray> =
        map { it.toCharArray() }.toTypedArray()

    fun Array<CharArray>.findLocationOfChar(char: Char) =
        this.indexOfFirst { it.contains(char) }.let { vertIndex -> Location(this[vertIndex].indexOf(char), vertIndex) }

    fun Array<CharArray>.findLocationsOfChar(char: Char): List<Location> {
        val locationsOfChar = mutableListOf<Location>()
        this.forEachIndexed { yIndex, listOfChars ->
            listOfChars.forEachIndexed { xIndex, possibleChar ->
                if (char == possibleChar) {
                    locationsOfChar.add(Location(xIndex, yIndex))
                }
            }
        }
        return locationsOfChar
    }

    fun Array<CharArray>.getValueAt(location: Location) = this[location.y][location.x]

    fun Array<CharArray>.width() = this[0].size
    fun Array<CharArray>.height() = this.size
    fun Char.mapToHeightValue() = when (this) {
        Day12.CHAR_START -> 'a'
        Day12.CHAR_DESTINATION -> 'z'
        else -> this
    }

    fun findShortestPath(grid: Array<CharArray>, start: Location): Int {
        val destination = grid.findLocationOfChar('E')
        val queue = LinkedList<Pair<Location, Int>>()
        val visited = mutableSetOf<Location>()

        queue.add(start to 0)
        visited.add(start)
        do {
            val locationAndDistance = queue.remove()
            val locationHeight = grid.getValueAt(locationAndDistance.first).mapToHeightValue()

            if (locationAndDistance.first == destination) {
                return locationAndDistance.second
            }

            val adjCells = listOf(
                Location(locationAndDistance.first.x - 1, locationAndDistance.first.y),
                Location(locationAndDistance.first.x + 1, locationAndDistance.first.y),
                Location(locationAndDistance.first.x, locationAndDistance.first.y - 1),
                Location(locationAndDistance.first.x, locationAndDistance.first.y + 1),
            ).filter { it.x >= 0 && it.y >= 0 && it.x < grid.width() && it.y < grid.height() }

            for (adjLocation in adjCells) {
                val height = grid.getValueAt(adjLocation).mapToHeightValue()
                if ((height - locationHeight <= 1) && !visited.contains(
                        adjLocation
                    )
                ) {
                    queue.add(adjLocation to locationAndDistance.second + 1)
                    visited.add(adjLocation)
                }
            }
        } while (queue.isNotEmpty())

        return -1
    }

    fun part1(input: List<String>): Int {
        val grid = input.parseData()
        return findShortestPath(grid, grid.findLocationOfChar(Day12.CHAR_START))
    }

    fun part2(input: List<String>): Int {
        val grid = input.parseData()
        val locationsOfLowest = grid.findLocationsOfChar(Day12.CHAR_LOWEST) + grid.findLocationOfChar(Day12.CHAR_START)
        return locationsOfLowest.map { findShortestPath(grid, it) }.filter { it != -1 }.also { println(it) }.min()
    }

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

    val input = readInput("Day12")
    println(part1(input))
    println(part2(input))
}

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

  public static final int EXPECTED_PART1_CHECK_ANSWER;

  public static final int EXPECTED_PART2_CHECK_ANSWER;

  public static final char CHAR_START;

  public static final char CHAR_DESTINATION;

  public static final char CHAR_LOWEST;

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

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

Compiled from "Day12.kt"
public final class Day12Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String Day12_test
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      10: bipush        31
      12: if_icmpne     19
      15: iconst_1
      16: goto          20
      19: iconst_0
      20: ifne          40
      23: iconst_0
      24: istore_2
      25: ldc           #20                 // String Part 1 failed
      27: astore_2
      28: new           #22                 // class java/lang/IllegalStateException
      31: dup
      32: aload_2
      33: invokevirtual #26                 // Method java/lang/Object.toString:()Ljava/lang/String;
      36: invokespecial #30                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      39: athrow
      40: aload_0
      41: invokestatic  #33                 // Method main$part2:(Ljava/util/List;)I
      44: bipush        29
      46: if_icmpne     53
      49: iconst_1
      50: goto          54
      53: iconst_0
      54: ifne          74
      57: iconst_0
      58: istore_2
      59: ldc           #35                 // String Part 2 failed
      61: astore_2
      62: new           #22                 // class java/lang/IllegalStateException
      65: dup
      66: aload_2
      67: invokevirtual #26                 // Method java/lang/Object.toString:()Ljava/lang/String;
      70: invokespecial #30                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      73: athrow
      74: ldc           #37                 // String Day12
      76: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      79: astore_1
      80: aload_1
      81: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      84: istore_2
      85: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
      88: iload_2
      89: invokevirtual #49                 // Method java/io/PrintStream.println:(I)V
      92: aload_1
      93: invokestatic  #33                 // Method main$part2:(Ljava/util/List;)I
      96: istore_2
      97: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
     100: iload_2
     101: invokevirtual #49                 // Method java/io/PrintStream.println:(I)V
     104: return

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

  private static final char[][] main$parseData(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #67                 // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #69                 // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #75                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #77                 // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #79                 // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #83,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          95
      48: aload         6
      50: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #95                 // class java/lang/String
      64: astore        8
      66: astore        10
      68: iconst_0
      69: istore        9
      71: aload         8
      73: invokevirtual #99                 // Method java/lang/String.toCharArray:()[C
      76: dup
      77: ldc           #101                // String toCharArray(...)
      79: invokestatic  #107                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      82: nop
      83: aload         10
      85: swap
      86: invokeinterface #111,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      91: pop
      92: goto          38
      95: aload         4
      97: checkcast     #57                 // class java/util/List
     100: nop
     101: checkcast     #79                 // class java/util/Collection
     104: astore_1
     105: nop
     106: iconst_0
     107: istore_2
     108: aload_1
     109: astore_3
     110: aload_3
     111: iconst_0
     112: anewarray     #113                // class "[C"
     115: invokeinterface #117,  2          // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     120: checkcast     #119                // class "[[C"
     123: areturn

  private static final Location main$findLocationOfChar(char[][], char);
    Code:
       0: aload_0
       1: checkcast     #139                // class "[Ljava/lang/Object;"
       4: astore_2
       5: iconst_0
       6: istore_3
       7: iconst_0
       8: istore        4
      10: aload_2
      11: arraylength
      12: istore        5
      14: iload         4
      16: iload         5
      18: if_icmpge     53
      21: aload_2
      22: iload         4
      24: aaload
      25: checkcast     #113                // class "[C"
      28: astore        6
      30: iconst_0
      31: istore        7
      33: aload         6
      35: iload_1
      36: invokestatic  #145                // Method kotlin/collections/ArraysKt.contains:([CC)Z
      39: ifeq          47
      42: iload         4
      44: goto          54
      47: iinc          4, 1
      50: goto          14
      53: iconst_m1
      54: istore_3
      55: iconst_0
      56: istore        4
      58: new           #147                // class Location
      61: dup
      62: aload_0
      63: iload_3
      64: aaload
      65: iload_1
      66: invokestatic  #151                // Method kotlin/collections/ArraysKt.indexOf:([CC)I
      69: iload_3
      70: invokespecial #154                // Method Location."<init>":(II)V
      73: nop
      74: areturn

  private static final java.util.List<Location> main$findLocationsOfChar(char[][], char);
    Code:
       0: new           #69                 // class java/util/ArrayList
       3: dup
       4: invokespecial #168                // Method java/util/ArrayList."<init>":()V
       7: checkcast     #57                 // class java/util/List
      10: astore_2
      11: aload_0
      12: checkcast     #139                // class "[Ljava/lang/Object;"
      15: astore_3
      16: iconst_0
      17: istore        4
      19: iconst_0
      20: istore        5
      22: iconst_0
      23: istore        6
      25: aload_3
      26: arraylength
      27: istore        7
      29: iload         6
      31: iload         7
      33: if_icmpge     146
      36: aload_3
      37: iload         6
      39: aaload
      40: astore        8
      42: iload         5
      44: iinc          5, 1
      47: aload         8
      49: checkcast     #113                // class "[C"
      52: astore        9
      54: istore        10
      56: iconst_0
      57: istore        11
      59: aload         9
      61: astore        12
      63: iconst_0
      64: istore        13
      66: iconst_0
      67: istore        14
      69: iconst_0
      70: istore        15
      72: aload         12
      74: arraylength
      75: istore        16
      77: iload         15
      79: iload         16
      81: if_icmpge     137
      84: aload         12
      86: iload         15
      88: caload
      89: istore        17
      91: iload         14
      93: iinc          14, 1
      96: iload         17
      98: istore        18
     100: istore        19
     102: iconst_0
     103: istore        20
     105: iload_1
     106: iload         18
     108: if_icmpne     129
     111: aload_2
     112: new           #147                // class Location
     115: dup
     116: iload         19
     118: iload         10
     120: invokespecial #154                // Method Location."<init>":(II)V
     123: invokeinterface #169,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     128: pop
     129: nop
     130: nop
     131: iinc          15, 1
     134: goto          77
     137: nop
     138: nop
     139: nop
     140: iinc          6, 1
     143: goto          29
     146: nop
     147: aload_2
     148: areturn

  private static final char main$getValueAt(char[][], Location);
    Code:
       0: aload_0
       1: aload_1
       2: invokevirtual #186                // Method Location.getY:()I
       5: aaload
       6: aload_1
       7: invokevirtual #189                // Method Location.getX:()I
      10: caload
      11: ireturn

  private static final int main$width(char[][]);
    Code:
       0: aload_0
       1: iconst_0
       2: aaload
       3: arraylength
       4: ireturn

  private static final int main$height(char[][]);
    Code:
       0: aload_0
       1: checkcast     #139                // class "[Ljava/lang/Object;"
       4: arraylength
       5: ireturn

  private static final char main$mapToHeightValue(char);
    Code:
       0: iload_0
       1: lookupswitch  { // 2
                    69: 33
                    83: 28
               default: 38
          }
      28: bipush        97
      30: goto          39
      33: bipush        122
      35: goto          39
      38: iload_0
      39: ireturn

  private static final int main$findShortestPath(char[][], Location);
    Code:
       0: aload_0
       1: bipush        69
       3: invokestatic  #204                // Method main$findLocationOfChar:([[CC)LLocation;
       6: astore_2
       7: new           #206                // class java/util/LinkedList
      10: dup
      11: invokespecial #207                // Method java/util/LinkedList."<init>":()V
      14: astore_3
      15: new           #209                // class java/util/LinkedHashSet
      18: dup
      19: invokespecial #210                // Method java/util/LinkedHashSet."<init>":()V
      22: checkcast     #212                // class java/util/Set
      25: astore        4
      27: aload_3
      28: aload_1
      29: iconst_0
      30: invokestatic  #218                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      33: invokestatic  #224                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      36: invokevirtual #225                // Method java/util/LinkedList.add:(Ljava/lang/Object;)Z
      39: pop
      40: aload         4
      42: aload_1
      43: invokeinterface #226,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
      48: pop
      49: aload_3
      50: invokevirtual #229                // Method java/util/LinkedList.remove:()Ljava/lang/Object;
      53: checkcast     #231                // class kotlin/Pair
      56: astore        5
      58: aload_0
      59: aload         5
      61: invokevirtual #234                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      64: checkcast     #147                // class Location
      67: invokestatic  #236                // Method main$getValueAt:([[CLLocation;)C
      70: invokestatic  #238                // Method main$mapToHeightValue:(C)C
      73: istore        6
      75: aload         5
      77: invokevirtual #234                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      80: aload_2
      81: invokestatic  #242                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      84: ifeq          99
      87: aload         5
      89: invokevirtual #245                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      92: checkcast     #247                // class java/lang/Number
      95: invokevirtual #250                // Method java/lang/Number.intValue:()I
      98: ireturn
      99: iconst_4
     100: anewarray     #147                // class Location
     103: astore        8
     105: aload         8
     107: iconst_0
     108: new           #147                // class Location
     111: dup
     112: aload         5
     114: invokevirtual #234                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     117: checkcast     #147                // class Location
     120: invokevirtual #189                // Method Location.getX:()I
     123: iconst_1
     124: isub
     125: aload         5
     127: invokevirtual #234                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     130: checkcast     #147                // class Location
     133: invokevirtual #186                // Method Location.getY:()I
     136: invokespecial #154                // Method Location."<init>":(II)V
     139: aastore
     140: aload         8
     142: iconst_1
     143: new           #147                // class Location
     146: dup
     147: aload         5
     149: invokevirtual #234                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     152: checkcast     #147                // class Location
     155: invokevirtual #189                // Method Location.getX:()I
     158: iconst_1
     159: iadd
     160: aload         5
     162: invokevirtual #234                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     165: checkcast     #147                // class Location
     168: invokevirtual #186                // Method Location.getY:()I
     171: invokespecial #154                // Method Location."<init>":(II)V
     174: aastore
     175: aload         8
     177: iconst_2
     178: new           #147                // class Location
     181: dup
     182: aload         5
     184: invokevirtual #234                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     187: checkcast     #147                // class Location
     190: invokevirtual #189                // Method Location.getX:()I
     193: aload         5
     195: invokevirtual #234                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     198: checkcast     #147                // class Location
     201: invokevirtual #186                // Method Location.getY:()I
     204: iconst_1
     205: isub
     206: invokespecial #154                // Method Location."<init>":(II)V
     209: aastore
     210: aload         8
     212: iconst_3
     213: new           #147                // class Location
     216: dup
     217: aload         5
     219: invokevirtual #234                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     222: checkcast     #147                // class Location
     225: invokevirtual #189                // Method Location.getX:()I
     228: aload         5
     230: invokevirtual #234                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     233: checkcast     #147                // class Location
     236: invokevirtual #186                // Method Location.getY:()I
     239: iconst_1
     240: iadd
     241: invokespecial #154                // Method Location."<init>":(II)V
     244: aastore
     245: aload         8
     247: invokestatic  #254                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     250: checkcast     #67                 // class java/lang/Iterable
     253: astore        8
     255: nop
     256: iconst_0
     257: istore        9
     259: aload         8
     261: astore        10
     263: new           #69                 // class java/util/ArrayList
     266: dup
     267: invokespecial #168                // Method java/util/ArrayList."<init>":()V
     270: checkcast     #79                 // class java/util/Collection
     273: astore        11
     275: iconst_0
     276: istore        12
     278: aload         10
     280: invokeinterface #83,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     285: astore        13
     287: aload         13
     289: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     294: ifeq          377
     297: aload         13
     299: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     304: astore        14
     306: aload         14
     308: checkcast     #147                // class Location
     311: astore        15
     313: iconst_0
     314: istore        16
     316: aload         15
     318: invokevirtual #189                // Method Location.getX:()I
     321: iflt          360
     324: aload         15
     326: invokevirtual #186                // Method Location.getY:()I
     329: iflt          360
     332: aload         15
     334: invokevirtual #189                // Method Location.getX:()I
     337: aload_0
     338: invokestatic  #256                // Method main$width:([[C)I
     341: if_icmpge     360
     344: aload         15
     346: invokevirtual #186                // Method Location.getY:()I
     349: aload_0
     350: invokestatic  #258                // Method main$height:([[C)I
     353: if_icmpge     360
     356: iconst_1
     357: goto          361
     360: iconst_0
     361: ifeq          287
     364: aload         11
     366: aload         14
     368: invokeinterface #111,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     373: pop
     374: goto          287
     377: aload         11
     379: checkcast     #57                 // class java/util/List
     382: nop
     383: astore        7
     385: aload         7
     387: invokeinterface #259,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     392: astore        8
     394: aload         8
     396: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     401: ifeq          487
     404: aload         8
     406: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     411: checkcast     #147                // class Location
     414: astore        9
     416: aload_0
     417: aload         9
     419: invokestatic  #236                // Method main$getValueAt:([[CLLocation;)C
     422: invokestatic  #238                // Method main$mapToHeightValue:(C)C
     425: istore        10
     427: iload         10
     429: iload         6
     431: isub
     432: iconst_1
     433: if_icmpgt     394
     436: aload         4
     438: aload         9
     440: invokeinterface #261,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     445: ifne          394
     448: aload_3
     449: aload         9
     451: aload         5
     453: invokevirtual #245                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     456: checkcast     #247                // class java/lang/Number
     459: invokevirtual #250                // Method java/lang/Number.intValue:()I
     462: iconst_1
     463: iadd
     464: invokestatic  #218                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     467: invokestatic  #224                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     470: invokevirtual #225                // Method java/util/LinkedList.add:(Ljava/lang/Object;)Z
     473: pop
     474: aload         4
     476: aload         9
     478: invokeinterface #226,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     483: pop
     484: goto          394
     487: aload_3
     488: checkcast     #79                 // class java/util/Collection
     491: invokeinterface #264,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     496: ifne          503
     499: iconst_1
     500: goto          504
     503: iconst_0
     504: ifne          49
     507: iconst_m1
     508: ireturn

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #286                // Method main$parseData:(Ljava/util/List;)[[C
       4: astore_1
       5: aload_1
       6: aload_1
       7: bipush        83
       9: invokestatic  #204                // Method main$findLocationOfChar:([[CC)LLocation;
      12: invokestatic  #288                // Method main$findShortestPath:([[CLLocation;)I
      15: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #286                // Method main$parseData:(Ljava/util/List;)[[C
       4: astore_1
       5: aload_1
       6: bipush        97
       8: invokestatic  #290                // Method main$findLocationsOfChar:([[CC)Ljava/util/List;
      11: checkcast     #79                 // class java/util/Collection
      14: aload_1
      15: bipush        83
      17: invokestatic  #204                // Method main$findLocationOfChar:([[CC)LLocation;
      20: invokestatic  #294                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;
      23: astore_2
      24: aload_2
      25: checkcast     #67                 // class java/lang/Iterable
      28: astore_3
      29: iconst_0
      30: istore        4
      32: aload_3
      33: astore        5
      35: new           #69                 // class java/util/ArrayList
      38: dup
      39: aload_3
      40: bipush        10
      42: invokestatic  #75                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      45: invokespecial #77                 // Method java/util/ArrayList."<init>":(I)V
      48: checkcast     #79                 // class java/util/Collection
      51: astore        6
      53: iconst_0
      54: istore        7
      56: aload         5
      58: invokeinterface #83,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      63: astore        8
      65: aload         8
      67: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      72: ifeq          119
      75: aload         8
      77: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      82: astore        9
      84: aload         6
      86: aload         9
      88: checkcast     #147                // class Location
      91: astore        10
      93: astore        12
      95: iconst_0
      96: istore        11
      98: aload_1
      99: aload         10
     101: invokestatic  #288                // Method main$findShortestPath:([[CLLocation;)I
     104: invokestatic  #218                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     107: aload         12
     109: swap
     110: invokeinterface #111,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     115: pop
     116: goto          65
     119: aload         6
     121: checkcast     #57                 // class java/util/List
     124: nop
     125: checkcast     #67                 // class java/lang/Iterable
     128: astore_3
     129: nop
     130: iconst_0
     131: istore        4
     133: aload_3
     134: astore        5
     136: new           #69                 // class java/util/ArrayList
     139: dup
     140: invokespecial #168                // Method java/util/ArrayList."<init>":()V
     143: checkcast     #79                 // class java/util/Collection
     146: astore        6
     148: iconst_0
     149: istore        7
     151: aload         5
     153: invokeinterface #83,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     158: astore        8
     160: aload         8
     162: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     167: ifeq          219
     170: aload         8
     172: invokeinterface #93,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     177: astore        9
     179: aload         9
     181: checkcast     #247                // class java/lang/Number
     184: invokevirtual #250                // Method java/lang/Number.intValue:()I
     187: istore        10
     189: iconst_0
     190: istore        11
     192: iload         10
     194: iconst_m1
     195: if_icmpeq     202
     198: iconst_1
     199: goto          203
     202: iconst_0
     203: ifeq          160
     206: aload         6
     208: aload         9
     210: invokeinterface #111,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     215: pop
     216: goto          160
     219: aload         6
     221: checkcast     #57                 // class java/util/List
     224: nop
     225: astore_3
     226: aload_3
     227: astore        4
     229: iconst_0
     230: istore        5
     232: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
     235: aload         4
     237: invokevirtual #297                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     240: nop
     241: aload_3
     242: checkcast     #67                 // class java/lang/Iterable
     245: invokestatic  #301                // Method kotlin/collections/CollectionsKt.minOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     248: checkcast     #247                // class java/lang/Number
     251: invokevirtual #250                // Method java/lang/Number.intValue:()I
     254: ireturn
}


import java.util.LinkedList

object Day20 {
    const val EXPECTED_PART1_CHECK_ANSWER = 3
    const val EXPECTED_PART2_CHECK_ANSWER = 1623178306L

    val ANSWER_POSITIONS = setOf(1000, 2000, 3000)
    const val DECRYPTION_KEY = 811589153L
}

fun main() {
    fun List<String>.parse() = map(String::toLong).foldIndexed(LinkedList<Pair<Long, Int>>()) { idx, acc, nr ->
        acc.add(nr to idx)
        acc
    }

    fun LinkedList<Pair<Long, Int>>.mixIt(orgList: List<Pair<Long, Int>>) {
        orgList.forEach { nrAndOrgIndex ->
            val nr = nrAndOrgIndex.first
            val currentIndex = indexOf(nrAndOrgIndex)
            val uncappedNewIndex = currentIndex + nr
            val moveToIndex = uncappedNewIndex.mod(lastIndex)
            remove(nrAndOrgIndex)
            add(moveToIndex, nrAndOrgIndex)
        }
    }

    fun part1(input: List<String>): Int {
        val numbers = input.parse()
        val newList = LinkedList(numbers)
        newList.mixIt(numbers)
        println(newList)
        val indexOfZero = newList.indexOf(newList.find { it.first == 0L })
        val result = Day20.ANSWER_POSITIONS.sumOf {
            val indexOfNr = indexOfZero + it
            val wrappedIndex = indexOfNr % newList.size
            newList[wrappedIndex].first
        }
        return result.toInt()
    }

    fun part2(input: List<String>): Long {
        val numbers = input.parse().map { Pair(it.first * Day20.DECRYPTION_KEY, it.second) }
        val newList = LinkedList(numbers)
        repeat(10) { newList.mixIt(numbers) }
        println(newList)
        val indexOfZero = newList.indexOf(newList.find { it.first == 0L })
        val result = Day20.ANSWER_POSITIONS.map(Int::toLong).sumOf {
            val indexOfNr = indexOfZero + it
            val wrappedIndex = indexOfNr % newList.size
            newList[wrappedIndex.toInt()].first
        }
        return result
    }

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

    val input = readInput("Day20")
    println(part1(input))
    println(part2(input))
}

Compiled from "Day20.kt"
public final class Day20Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String Day20_test
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      10: iconst_3
      11: if_icmpne     18
      14: iconst_1
      15: goto          19
      18: iconst_0
      19: ifne          39
      22: iconst_0
      23: istore_2
      24: ldc           #20                 // String Part 1 failed
      26: astore_2
      27: new           #22                 // class java/lang/IllegalStateException
      30: dup
      31: aload_2
      32: invokevirtual #26                 // Method java/lang/Object.toString:()Ljava/lang/String;
      35: invokespecial #30                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      38: athrow
      39: aload_0
      40: invokestatic  #34                 // Method main$part2:(Ljava/util/List;)J
      43: ldc2_w        #35                 // long 1623178306l
      46: lcmp
      47: ifne          54
      50: iconst_1
      51: goto          55
      54: iconst_0
      55: ifne          75
      58: iconst_0
      59: istore_2
      60: ldc           #38                 // String Part 2 failed
      62: astore_2
      63: new           #22                 // class java/lang/IllegalStateException
      66: dup
      67: aload_2
      68: invokevirtual #26                 // Method java/lang/Object.toString:()Ljava/lang/String;
      71: invokespecial #30                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      74: athrow
      75: ldc           #40                 // String Day20
      77: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      80: astore_1
      81: aload_1
      82: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      85: istore_2
      86: getstatic     #46                 // Field java/lang/System.out:Ljava/io/PrintStream;
      89: iload_2
      90: invokevirtual #52                 // Method java/io/PrintStream.println:(I)V
      93: aload_1
      94: invokestatic  #34                 // Method main$part2:(Ljava/util/List;)J
      97: lstore_2
      98: getstatic     #46                 // Field java/lang/System.out:Ljava/io/PrintStream;
     101: lload_2
     102: invokevirtual #55                 // Method java/io/PrintStream.println:(J)V
     105: return

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

  private static final java.util.LinkedList<kotlin.Pair<java.lang.Long, java.lang.Integer>> main$parse(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #73                 // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: astore_3
       9: new           #75                 // class java/util/ArrayList
      12: dup
      13: aload_1
      14: bipush        10
      16: invokestatic  #81                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      19: invokespecial #83                 // Method java/util/ArrayList."<init>":(I)V
      22: checkcast     #85                 // class java/util/Collection
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload_3
      31: invokeinterface #89,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        6
      38: aload         6
      40: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          92
      48: aload         6
      50: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        7
      57: aload         4
      59: aload         7
      61: checkcast     #101                // class java/lang/String
      64: astore        8
      66: astore        14
      68: iconst_0
      69: istore        9
      71: aload         8
      73: invokestatic  #107                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
      76: nop
      77: invokestatic  #111                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      80: aload         14
      82: swap
      83: invokeinterface #115,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      88: pop
      89: goto          38
      92: aload         4
      94: checkcast     #63                 // class java/util/List
      97: nop
      98: checkcast     #73                 // class java/lang/Iterable
     101: astore_1
     102: new           #117                // class java/util/LinkedList
     105: dup
     106: invokespecial #119                // Method java/util/LinkedList."<init>":()V
     109: astore_2
     110: iconst_0
     111: istore_3
     112: iconst_0
     113: istore        4
     115: aload_2
     116: astore        5
     118: aload_1
     119: invokeinterface #89,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     124: astore        6
     126: aload         6
     128: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     133: ifeq          207
     136: aload         6
     138: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     143: astore        7
     145: iload         4
     147: iinc          4, 1
     150: istore        8
     152: iload         8
     154: ifge          160
     157: invokestatic  #122                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     160: iload         8
     162: aload         5
     164: aload         7
     166: checkcast     #124                // class java/lang/Number
     169: invokevirtual #128                // Method java/lang/Number.longValue:()J
     172: lstore        9
     174: astore        11
     176: istore        12
     178: iconst_0
     179: istore        13
     181: aload         11
     183: lload         9
     185: invokestatic  #111                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     188: iload         12
     190: invokestatic  #133                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     193: invokestatic  #139                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     196: invokevirtual #140                // Method java/util/LinkedList.add:(Ljava/lang/Object;)Z
     199: pop
     200: aload         11
     202: astore        5
     204: goto          126
     207: aload         5
     209: areturn

  private static final void main$mixIt(java.util.LinkedList<kotlin.Pair<java.lang.Long, java.lang.Integer>>, java.util.List<kotlin.Pair<java.lang.Long, java.lang.Integer>>);
    Code:
       0: aload_1
       1: checkcast     #73                 // class java/lang/Iterable
       4: astore_2
       5: iconst_0
       6: istore_3
       7: aload_2
       8: invokeinterface #89,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      13: astore        4
      15: aload         4
      17: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      22: ifeq          138
      25: aload         4
      27: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      32: astore        5
      34: aload         5
      36: checkcast     #170                // class kotlin/Pair
      39: astore        6
      41: iconst_0
      42: istore        7
      44: aload         6
      46: invokevirtual #173                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      49: checkcast     #124                // class java/lang/Number
      52: invokevirtual #128                // Method java/lang/Number.longValue:()J
      55: lstore        8
      57: aload_0
      58: aload         6
      60: invokevirtual #177                // Method java/util/LinkedList.indexOf:(Ljava/lang/Object;)I
      63: istore        10
      65: iload         10
      67: i2l
      68: lload         8
      70: ladd
      71: lstore        11
      73: lload         11
      75: lstore        13
      77: aload_0
      78: checkcast     #63                 // class java/util/List
      81: invokestatic  #180                // Method kotlin/collections/CollectionsKt.getLastIndex:(Ljava/util/List;)I
      84: i2l
      85: lstore        15
      87: lload         13
      89: lload         15
      91: lrem
      92: lstore        17
      94: lload         17
      96: lload         15
      98: lload         17
     100: lload         15
     102: lxor
     103: lload         17
     105: lload         17
     107: lneg
     108: lor
     109: land
     110: bipush        63
     112: lshr
     113: land
     114: ladd
     115: l2i
     116: istore        19
     118: aload_0
     119: aload         6
     121: invokevirtual #183                // Method java/util/LinkedList.remove:(Ljava/lang/Object;)Z
     124: pop
     125: aload_0
     126: iload         19
     128: aload         6
     130: invokevirtual #186                // Method java/util/LinkedList.add:(ILjava/lang/Object;)V
     133: nop
     134: nop
     135: goto          15
     138: nop
     139: return

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #199                // Method main$parse:(Ljava/util/List;)Ljava/util/LinkedList;
       4: astore_1
       5: new           #117                // class java/util/LinkedList
       8: dup
       9: aload_1
      10: checkcast     #85                 // class java/util/Collection
      13: invokespecial #202                // Method java/util/LinkedList."<init>":(Ljava/util/Collection;)V
      16: astore_2
      17: aload_2
      18: aload_1
      19: checkcast     #63                 // class java/util/List
      22: invokestatic  #204                // Method main$mixIt:(Ljava/util/LinkedList;Ljava/util/List;)V
      25: getstatic     #46                 // Field java/lang/System.out:Ljava/io/PrintStream;
      28: aload_2
      29: invokevirtual #207                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      32: aload_2
      33: aload_2
      34: checkcast     #73                 // class java/lang/Iterable
      37: astore        4
      39: astore        15
      41: aload         4
      43: astore        5
      45: aload         5
      47: invokeinterface #89,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      52: astore        6
      54: aload         6
      56: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      61: ifeq          112
      64: aload         6
      66: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      71: astore        7
      73: aload         7
      75: checkcast     #170                // class kotlin/Pair
      78: astore        8
      80: iconst_0
      81: istore        9
      83: aload         8
      85: invokevirtual #173                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      88: checkcast     #124                // class java/lang/Number
      91: invokevirtual #128                // Method java/lang/Number.longValue:()J
      94: lconst_0
      95: lcmp
      96: ifne          103
      99: iconst_1
     100: goto          104
     103: iconst_0
     104: ifeq          54
     107: aload         7
     109: goto          113
     112: aconst_null
     113: aload         15
     115: swap
     116: invokevirtual #177                // Method java/util/LinkedList.indexOf:(Ljava/lang/Object;)I
     119: istore_3
     120: getstatic     #212                // Field Day20.INSTANCE:LDay20;
     123: invokevirtual #216                // Method Day20.getANSWER_POSITIONS:()Ljava/util/Set;
     126: checkcast     #73                 // class java/lang/Iterable
     129: astore        6
     131: lconst_0
     132: lstore        7
     134: aload         6
     136: invokeinterface #89,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     141: astore        9
     143: aload         9
     145: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     150: ifeq          224
     153: aload         9
     155: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     160: astore        10
     162: lload         7
     164: aload         10
     166: checkcast     #124                // class java/lang/Number
     169: invokevirtual #220                // Method java/lang/Number.intValue:()I
     172: istore        11
     174: lstore        15
     176: iconst_0
     177: istore        12
     179: iload_3
     180: iload         11
     182: iadd
     183: istore        13
     185: iload         13
     187: aload_2
     188: invokevirtual #223                // Method java/util/LinkedList.size:()I
     191: irem
     192: istore        14
     194: aload_2
     195: iload         14
     197: invokevirtual #227                // Method java/util/LinkedList.get:(I)Ljava/lang/Object;
     200: checkcast     #170                // class kotlin/Pair
     203: invokevirtual #173                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     206: checkcast     #124                // class java/lang/Number
     209: invokevirtual #128                // Method java/lang/Number.longValue:()J
     212: lstore        17
     214: lload         15
     216: lload         17
     218: ladd
     219: lstore        7
     221: goto          143
     224: lload         7
     226: lstore        4
     228: lload         4
     230: l2i
     231: ireturn

  private static final long main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: invokestatic  #199                // Method main$parse:(Ljava/util/List;)Ljava/util/LinkedList;
       4: checkcast     #73                 // class java/lang/Iterable
       7: astore_2
       8: iconst_0
       9: istore_3
      10: aload_2
      11: astore        4
      13: new           #75                 // class java/util/ArrayList
      16: dup
      17: aload_2
      18: bipush        10
      20: invokestatic  #81                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      23: invokespecial #83                 // Method java/util/ArrayList."<init>":(I)V
      26: checkcast     #85                 // class java/util/Collection
      29: astore        5
      31: iconst_0
      32: istore        6
      34: aload         4
      36: invokeinterface #89,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      41: astore        7
      43: aload         7
      45: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      50: ifeq          118
      53: aload         7
      55: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      60: astore        8
      62: aload         5
      64: aload         8
      66: checkcast     #170                // class kotlin/Pair
      69: astore        9
      71: astore        18
      73: iconst_0
      74: istore        10
      76: new           #170                // class kotlin/Pair
      79: dup
      80: aload         9
      82: invokevirtual #173                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      85: checkcast     #124                // class java/lang/Number
      88: invokevirtual #128                // Method java/lang/Number.longValue:()J
      91: ldc2_w        #238                // long 811589153l
      94: lmul
      95: invokestatic  #111                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      98: aload         9
     100: invokevirtual #242                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     103: invokespecial #245                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     106: aload         18
     108: swap
     109: invokeinterface #115,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     114: pop
     115: goto          43
     118: aload         5
     120: checkcast     #63                 // class java/util/List
     123: nop
     124: astore_1
     125: new           #117                // class java/util/LinkedList
     128: dup
     129: aload_1
     130: checkcast     #85                 // class java/util/Collection
     133: invokespecial #202                // Method java/util/LinkedList."<init>":(Ljava/util/Collection;)V
     136: astore_2
     137: bipush        10
     139: istore_3
     140: iconst_0
     141: istore        4
     143: iload         4
     145: iload_3
     146: if_icmpge     167
     149: iload         4
     151: istore        5
     153: iconst_0
     154: istore        6
     156: aload_2
     157: aload_1
     158: invokestatic  #204                // Method main$mixIt:(Ljava/util/LinkedList;Ljava/util/List;)V
     161: iinc          4, 1
     164: goto          143
     167: getstatic     #46                 // Field java/lang/System.out:Ljava/io/PrintStream;
     170: aload_2
     171: invokevirtual #207                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     174: aload_2
     175: aload_2
     176: checkcast     #73                 // class java/lang/Iterable
     179: astore        4
     181: astore        18
     183: aload         4
     185: astore        5
     187: aload         5
     189: invokeinterface #89,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     194: astore        6
     196: aload         6
     198: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     203: ifeq          254
     206: aload         6
     208: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     213: astore        7
     215: aload         7
     217: checkcast     #170                // class kotlin/Pair
     220: astore        8
     222: iconst_0
     223: istore        9
     225: aload         8
     227: invokevirtual #173                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     230: checkcast     #124                // class java/lang/Number
     233: invokevirtual #128                // Method java/lang/Number.longValue:()J
     236: lconst_0
     237: lcmp
     238: ifne          245
     241: iconst_1
     242: goto          246
     245: iconst_0
     246: ifeq          196
     249: aload         7
     251: goto          255
     254: aconst_null
     255: aload         18
     257: swap
     258: invokevirtual #177                // Method java/util/LinkedList.indexOf:(Ljava/lang/Object;)I
     261: istore_3
     262: getstatic     #212                // Field Day20.INSTANCE:LDay20;
     265: invokevirtual #216                // Method Day20.getANSWER_POSITIONS:()Ljava/util/Set;
     268: checkcast     #73                 // class java/lang/Iterable
     271: astore        6
     273: iconst_0
     274: istore        7
     276: aload         6
     278: astore        8
     280: new           #75                 // class java/util/ArrayList
     283: dup
     284: aload         6
     286: bipush        10
     288: invokestatic  #81                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     291: invokespecial #83                 // Method java/util/ArrayList."<init>":(I)V
     294: checkcast     #85                 // class java/util/Collection
     297: astore        9
     299: iconst_0
     300: istore        10
     302: aload         8
     304: invokeinterface #89,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     309: astore        11
     311: aload         11
     313: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     318: ifeq          365
     321: aload         11
     323: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     328: astore        12
     330: aload         9
     332: aload         12
     334: checkcast     #124                // class java/lang/Number
     337: invokevirtual #220                // Method java/lang/Number.intValue:()I
     340: istore        13
     342: astore        18
     344: iconst_0
     345: istore        14
     347: iload         13
     349: i2l
     350: invokestatic  #111                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     353: aload         18
     355: swap
     356: invokeinterface #115,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     361: pop
     362: goto          311
     365: aload         9
     367: checkcast     #63                 // class java/util/List
     370: nop
     371: checkcast     #73                 // class java/lang/Iterable
     374: astore        6
     376: lconst_0
     377: lstore        7
     379: aload         6
     381: invokeinterface #89,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     386: astore        9
     388: aload         9
     390: invokeinterface #95,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     395: ifeq          472
     398: aload         9
     400: invokeinterface #99,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     405: astore        10
     407: lload         7
     409: aload         10
     411: checkcast     #124                // class java/lang/Number
     414: invokevirtual #128                // Method java/lang/Number.longValue:()J
     417: lstore        11
     419: lstore        18
     421: iconst_0
     422: istore        13
     424: iload_3
     425: i2l
     426: lload         11
     428: ladd
     429: lstore        14
     431: lload         14
     433: aload_2
     434: invokevirtual #223                // Method java/util/LinkedList.size:()I
     437: i2l
     438: lrem
     439: lstore        16
     441: aload_2
     442: lload         16
     444: l2i
     445: invokevirtual #227                // Method java/util/LinkedList.get:(I)Ljava/lang/Object;
     448: checkcast     #170                // class kotlin/Pair
     451: invokevirtual #173                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     454: checkcast     #124                // class java/lang/Number
     457: invokevirtual #128                // Method java/lang/Number.longValue:()J
     460: lstore        20
     462: lload         18
     464: lload         20
     466: ladd
     467: lstore        7
     469: goto          388
     472: lload         7
     474: lstore        4
     476: lload         4
     478: lreturn
}

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

  public static final int EXPECTED_PART1_CHECK_ANSWER;

  public static final long EXPECTED_PART2_CHECK_ANSWER;

  private static final java.util.Set<java.lang.Integer> ANSWER_POSITIONS;

  public static final long DECRYPTION_KEY;

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

  public final java.util.Set<java.lang.Integer> getANSWER_POSITIONS();
    Code:
       0: getstatic     #18                 // Field ANSWER_POSITIONS:Ljava/util/Set;
       3: areturn

  static {};
    Code:
       0: new           #2                  // class Day20
       3: dup
       4: invokespecial #20                 // Method "<init>":()V
       7: putstatic     #23                 // Field INSTANCE:LDay20;
      10: iconst_3
      11: anewarray     #25                 // class java/lang/Integer
      14: astore_0
      15: aload_0
      16: iconst_0
      17: sipush        1000
      20: invokestatic  #29                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      23: aastore
      24: aload_0
      25: iconst_1
      26: sipush        2000
      29: invokestatic  #29                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      32: aastore
      33: aload_0
      34: iconst_2
      35: sipush        3000
      38: invokestatic  #29                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      41: aastore
      42: aload_0
      43: invokestatic  #35                 // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
      46: putstatic     #18                 // Field ANSWER_POSITIONS:Ljava/util/Set;
      49: return
}


import kotlin.math.pow

object Day25 {
    const val EXPECTED_PART1_CHECK_ANSWER = "2=-1=0"
    const val EXPECTED_PART2_CHECK_ANSWER = 1

}

fun main() {

    fun fivesValueForDigit(char: Char) = when (char) {
        '2' -> 2
        '1' -> 1
        '0' -> 0
        '-' -> -1
        '=' -> -2
        else -> error("Unknown char $char")
    }

    fun digitForFivesValue(value: Long) = when (value) {
        0L -> '0'
        1L -> '1'
        2L -> '2'
        3L -> '='
        4L -> '-'
        else -> error("Unsupported value $value")
    }

    fun convertFivePowerNumberToDecimalNumber(fivePowerNumber: String): Long {
        return fivePowerNumber.reversed().foldIndexed(0L) { idx, total, curFive ->
            total + fivesValueForDigit(curFive) * (5.toDouble().pow(idx).toLong())
        }
    }

    fun convertDecimalNumberToFivePowerNumber(decimalNumber: Long): String {
        if (decimalNumber == 0L) return "0"
        return generateSequence(decimalNumber to "") { (rest, totalNumber) ->
            val low = rest % 5
            (rest + 2) / 5 to digitForFivesValue(low) + totalNumber
        }.first { it.first <= 0L }.second
    }

    fun part1(input: List<String>): String {
        val sumInDecimal = input.sumOf { convertFivePowerNumberToDecimalNumber(it) }
        val snafuValue = convertDecimalNumberToFivePowerNumber(sumInDecimal)
        return snafuValue
    }

    fun part2(input: List<String>): Int {
        return 1
    }

    // test if implementation meets criteria from the description, like:
    val testInput = readInput("Day25_test")
    val input = readInput("Day25")

    val part1TestResult = part1(testInput)
    println("Part 1 test: $part1TestResult")
    check(part1TestResult == Day25.EXPECTED_PART1_CHECK_ANSWER) { "Part 1 failed" }

    println(part1(input))

    val part2TestResult = part2(testInput)
    println("Part 2 test: $part2TestResult")
    check(part2TestResult == Day25.EXPECTED_PART2_CHECK_ANSWER) { "Part 2 failed" }

    println(part2(input))
}

Compiled from "Day25.kt"
public final class Day25Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String Day25_test
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: ldc           #16                 // String Day25
       8: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      11: astore_1
      12: aload_0
      13: invokestatic  #20                 // Method main$part1:(Ljava/util/List;)Ljava/lang/String;
      16: astore_2
      17: new           #22                 // class java/lang/StringBuilder
      20: dup
      21: invokespecial #25                 // Method java/lang/StringBuilder."<init>":()V
      24: ldc           #27                 // String Part 1 test:
      26: invokevirtual #31                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      29: aload_2
      30: invokevirtual #31                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      33: invokevirtual #35                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      36: getstatic     #41                 // Field java/lang/System.out:Ljava/io/PrintStream;
      39: swap
      40: invokevirtual #47                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      43: aload_2
      44: ldc           #49                 // String 2=-1=0
      46: invokestatic  #55                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      49: ifne          72
      52: iconst_0
      53: istore        4
      55: ldc           #57                 // String Part 1 failed
      57: astore        4
      59: new           #59                 // class java/lang/IllegalStateException
      62: dup
      63: aload         4
      65: invokevirtual #60                 // Method java/lang/Object.toString:()Ljava/lang/String;
      68: invokespecial #63                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      71: athrow
      72: aload_1
      73: invokestatic  #20                 // Method main$part1:(Ljava/util/List;)Ljava/lang/String;
      76: getstatic     #41                 // Field java/lang/System.out:Ljava/io/PrintStream;
      79: swap
      80: invokevirtual #47                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      83: aload_0
      84: invokestatic  #67                 // Method main$part2:(Ljava/util/List;)I
      87: istore_3
      88: new           #22                 // class java/lang/StringBuilder
      91: dup
      92: invokespecial #25                 // Method java/lang/StringBuilder."<init>":()V
      95: ldc           #69                 // String Part 2 test:
      97: invokevirtual #31                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     100: iload_3
     101: invokevirtual #72                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     104: invokevirtual #35                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     107: getstatic     #41                 // Field java/lang/System.out:Ljava/io/PrintStream;
     110: swap
     111: invokevirtual #47                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     114: iload_3
     115: iconst_1
     116: if_icmpne     123
     119: iconst_1
     120: goto          124
     123: iconst_0
     124: ifne          147
     127: iconst_0
     128: istore        5
     130: ldc           #74                 // String Part 2 failed
     132: astore        5
     134: new           #59                 // class java/lang/IllegalStateException
     137: dup
     138: aload         5
     140: invokevirtual #60                 // Method java/lang/Object.toString:()Ljava/lang/String;
     143: invokespecial #63                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     146: athrow
     147: aload_1
     148: invokestatic  #67                 // Method main$part2:(Ljava/util/List;)I
     151: istore        4
     153: getstatic     #41                 // Field java/lang/System.out:Ljava/io/PrintStream;
     156: iload         4
     158: invokevirtual #77                 // Method java/io/PrintStream.println:(I)V
     161: return

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

  private static final int main$fivesValueForDigit(char);
    Code:
       0: iload_0
       1: lookupswitch  { // 5
                    45: 64
                    48: 60
                    49: 56
                    50: 52
                    61: 68
               default: 73
          }
      52: iconst_2
      53: goto          103
      56: iconst_1
      57: goto          103
      60: iconst_0
      61: goto          103
      64: iconst_m1
      65: goto          103
      68: bipush        -2
      70: goto          103
      73: new           #59                 // class java/lang/IllegalStateException
      76: dup
      77: new           #22                 // class java/lang/StringBuilder
      80: dup
      81: invokespecial #25                 // Method java/lang/StringBuilder."<init>":()V
      84: ldc           #99                 // String Unknown char
      86: invokevirtual #31                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      89: iload_0
      90: invokevirtual #102                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      93: invokevirtual #35                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      96: invokevirtual #60                 // Method java/lang/Object.toString:()Ljava/lang/String;
      99: invokespecial #63                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     102: athrow
     103: ireturn

  private static final char main$digitForFivesValue(long);
    Code:
       0: lload_0
       1: lstore_2
       2: lload_2
       3: lconst_0
       4: lcmp
       5: ifne          13
       8: bipush        48
      10: goto          93
      13: lload_2
      14: lconst_1
      15: lcmp
      16: ifne          24
      19: bipush        49
      21: goto          93
      24: lload_2
      25: ldc2_w        #107                // long 2l
      28: lcmp
      29: ifne          37
      32: bipush        50
      34: goto          93
      37: lload_2
      38: ldc2_w        #109                // long 3l
      41: lcmp
      42: ifne          50
      45: bipush        61
      47: goto          93
      50: lload_2
      51: ldc2_w        #111                // long 4l
      54: lcmp
      55: ifne          63
      58: bipush        45
      60: goto          93
      63: new           #59                 // class java/lang/IllegalStateException
      66: dup
      67: new           #22                 // class java/lang/StringBuilder
      70: dup
      71: invokespecial #25                 // Method java/lang/StringBuilder."<init>":()V
      74: ldc           #114                // String Unsupported value
      76: invokevirtual #31                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      79: lload_0
      80: invokevirtual #117                // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
      83: invokevirtual #35                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      86: invokevirtual #60                 // Method java/lang/Object.toString:()Ljava/lang/String;
      89: invokespecial #63                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      92: athrow
      93: ireturn

  private static final long main$convertFivePowerNumberToDecimalNumber(java.lang.String);
    Code:
       0: aload_0
       1: checkcast     #123                // class java/lang/CharSequence
       4: invokestatic  #129                // Method kotlin/text/StringsKt.reversed:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
       7: invokevirtual #60                 // Method java/lang/Object.toString:()Ljava/lang/String;
      10: checkcast     #123                // class java/lang/CharSequence
      13: astore_1
      14: lconst_0
      15: lstore_2
      16: iconst_0
      17: istore        4
      19: iconst_0
      20: istore        5
      22: lload_2
      23: lstore        6
      25: iconst_0
      26: istore        8
      28: iload         8
      30: aload_1
      31: invokeinterface #133,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      36: if_icmpge     95
      39: aload_1
      40: iload         8
      42: invokeinterface #137,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      47: istore        9
      49: iload         5
      51: iinc          5, 1
      54: lload         6
      56: iload         9
      58: istore        10
      60: lstore        11
      62: istore        13
      64: iconst_0
      65: istore        14
      67: lload         11
      69: iload         10
      71: invokestatic  #139                // Method main$fivesValueForDigit:(C)I
      74: i2l
      75: ldc2_w        #140                // double 5.0d
      78: iload         13
      80: i2d
      81: invokestatic  #147                // Method java/lang/Math.pow:(DD)D
      84: d2l
      85: lmul
      86: ladd
      87: lstore        6
      89: iinc          8, 1
      92: goto          28
      95: lload         6
      97: lreturn

  private static final kotlin.Pair main$convertDecimalNumberToFivePowerNumber$lambda$1(kotlin.Pair);
    Code:
       0: aload_0
       1: ldc           #163                // String <destruct>
       3: invokestatic  #167                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokevirtual #173                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      10: checkcast     #175                // class java/lang/Number
      13: invokevirtual #179                // Method java/lang/Number.longValue:()J
      16: lstore_1
      17: aload_0
      18: invokevirtual #182                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      21: checkcast     #90                 // class java/lang/String
      24: astore_3
      25: lload_1
      26: iconst_5
      27: i2l
      28: lrem
      29: lstore        4
      31: lload_1
      32: iconst_2
      33: i2l
      34: ladd
      35: iconst_5
      36: i2l
      37: ldiv
      38: invokestatic  #188                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      41: lload         4
      43: invokestatic  #190                // Method main$digitForFivesValue:(J)C
      46: istore        6
      48: new           #22                 // class java/lang/StringBuilder
      51: dup
      52: invokespecial #25                 // Method java/lang/StringBuilder."<init>":()V
      55: iload         6
      57: invokevirtual #102                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      60: aload_3
      61: invokevirtual #31                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      64: invokevirtual #35                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      67: invokestatic  #196                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      70: areturn

  private static final java.lang.String main$convertDecimalNumberToFivePowerNumber(long);
    Code:
       0: lload_0
       1: lconst_0
       2: lcmp
       3: ifne          9
       6: ldc           #203                // String 0
       8: areturn
       9: lload_0
      10: invokestatic  #188                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      13: ldc           #205                // String
      15: invokestatic  #196                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      18: invokedynamic #222,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      23: invokestatic  #228                // Method kotlin/sequences/SequencesKt.generateSequence:(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      26: astore_2
      27: nop
      28: iconst_0
      29: istore_3
      30: aload_2
      31: invokeinterface #234,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      36: astore        4
      38: aload         4
      40: invokeinterface #240,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          96
      48: aload         4
      50: invokeinterface #243,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        5
      57: aload         5
      59: checkcast     #169                // class kotlin/Pair
      62: astore        6
      64: iconst_0
      65: istore        7
      67: aload         6
      69: invokevirtual #246                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      72: checkcast     #175                // class java/lang/Number
      75: invokevirtual #179                // Method java/lang/Number.longValue:()J
      78: lconst_0
      79: lcmp
      80: ifgt          87
      83: iconst_1
      84: goto          88
      87: iconst_0
      88: ifeq          38
      91: aload         5
      93: goto          106
      96: new           #248                // class java/util/NoSuchElementException
      99: dup
     100: ldc           #250                // String Sequence contains no element matching the predicate.
     102: invokespecial #251                // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
     105: athrow
     106: checkcast     #169                // class kotlin/Pair
     109: invokevirtual #254                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     112: checkcast     #90                 // class java/lang/String
     115: areturn

  private static final java.lang.String main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #265                // class java/lang/Iterable
       4: astore_3
       5: lconst_0
       6: lstore        4
       8: aload_3
       9: invokeinterface #266,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      14: astore        6
      16: aload         6
      18: invokeinterface #240,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      23: ifeq          66
      26: aload         6
      28: invokeinterface #243,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      33: astore        7
      35: lload         4
      37: aload         7
      39: checkcast     #90                 // class java/lang/String
      42: astore        8
      44: lstore        10
      46: iconst_0
      47: istore        9
      49: aload         8
      51: invokestatic  #268                // Method main$convertFivePowerNumberToDecimalNumber:(Ljava/lang/String;)J
      54: lstore        12
      56: lload         10
      58: lload         12
      60: ladd
      61: lstore        4
      63: goto          16
      66: lload         4
      68: lstore_1
      69: lload_1
      70: invokestatic  #270                // Method main$convertDecimalNumberToFivePowerNumber:(J)Ljava/lang/String;
      73: astore_3
      74: aload_3
      75: areturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: iconst_1
       1: ireturn
}

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

  public static final java.lang.String EXPECTED_PART1_CHECK_ANSWER;

  public static final int EXPECTED_PART2_CHECK_ANSWER;

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

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


object Day03 {
    const val EXPECTED_PART1_CHECK_ANSWER = 157
    const val EXPECTED_PART2_CHECK_ANSWER = 70

    const val ELF_GROUP_SIZE = 3
}

fun main() {

    fun Char.mapToItemValue() = if (this.isUpperCase()) (this.minus('A') + 27) else (this.minus('a') + 1)

    fun part1(input: List<String>): Int {
        return input.sumOf {
            val compartment1 = it
                .take(it.length / 2)
            val compartment2 = it
                .takeLast(it.length / 2)
            val inBothCompartments = compartment1.toSet().intersect(compartment2.toSet())
            val itemValue = if (inBothCompartments.isEmpty()) 0 else inBothCompartments.first().mapToItemValue()
            itemValue
        }
    }

    fun part2(input: List<String>): Int {
        val commonItemsValues = input.chunked(Day03.ELF_GROUP_SIZE) {
            it
                .map { rucksackContent -> rucksackContent.toSet() }
                .foldIndexed(emptySet<Char>()) { idx, acc, chars -> if (idx == 0) chars else acc.intersect(chars) }
                .firstOrNull()
                ?.mapToItemValue()
                ?: 0
        }
        return commonItemsValues.sum()
    }

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

    val input = readInput("Day03")
    println(part1(input))
    println(part2(input))
}

Compiled from "Day03.kt"
public final class Day03Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String Day03_test
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      10: sipush        157
      13: if_icmpne     20
      16: iconst_1
      17: goto          21
      20: iconst_0
      21: ifne          41
      24: iconst_0
      25: istore_2
      26: ldc           #20                 // String Part 1 failed
      28: astore_2
      29: new           #22                 // class java/lang/IllegalStateException
      32: dup
      33: aload_2
      34: invokevirtual #26                 // Method java/lang/Object.toString:()Ljava/lang/String;
      37: invokespecial #30                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      40: athrow
      41: aload_0
      42: invokestatic  #33                 // Method main$part2:(Ljava/util/List;)I
      45: bipush        70
      47: if_icmpne     54
      50: iconst_1
      51: goto          55
      54: iconst_0
      55: ifne          75
      58: iconst_0
      59: istore_2
      60: ldc           #35                 // String Part 2 failed
      62: astore_2
      63: new           #22                 // class java/lang/IllegalStateException
      66: dup
      67: aload_2
      68: invokevirtual #26                 // Method java/lang/Object.toString:()Ljava/lang/String;
      71: invokespecial #30                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      74: athrow
      75: ldc           #37                 // String Day03
      77: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
      80: astore_1
      81: aload_1
      82: invokestatic  #18                 // Method main$part1:(Ljava/util/List;)I
      85: istore_2
      86: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
      89: iload_2
      90: invokevirtual #49                 // Method java/io/PrintStream.println:(I)V
      93: aload_1
      94: invokestatic  #33                 // Method main$part2:(Ljava/util/List;)I
      97: istore_2
      98: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
     101: iload_2
     102: invokevirtual #49                 // Method java/io/PrintStream.println:(I)V
     105: return

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

  private static final int main$mapToItemValue(char);
    Code:
       0: iload_0
       1: invokestatic  #70                 // Method java/lang/Character.isUpperCase:(C)Z
       4: ifeq          17
       7: iload_0
       8: bipush        65
      10: isub
      11: bipush        27
      13: iadd
      14: goto          23
      17: iload_0
      18: bipush        97
      20: isub
      21: iconst_1
      22: iadd
      23: ireturn

  private static final int main$part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #75                 // class java/lang/Iterable
       4: astore_1
       5: iconst_0
       6: istore_2
       7: aload_1
       8: invokeinterface #79,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      13: astore_3
      14: aload_3
      15: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      20: ifeq          145
      23: aload_3
      24: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      29: astore        4
      31: iload_2
      32: aload         4
      34: checkcast     #91                 // class java/lang/String
      37: astore        5
      39: istore        11
      41: iconst_0
      42: istore        6
      44: aload         5
      46: aload         5
      48: invokevirtual #95                 // Method java/lang/String.length:()I
      51: iconst_2
      52: idiv
      53: invokestatic  #101                // Method kotlin/text/StringsKt.take:(Ljava/lang/String;I)Ljava/lang/String;
      56: astore        7
      58: aload         5
      60: aload         5
      62: invokevirtual #95                 // Method java/lang/String.length:()I
      65: iconst_2
      66: idiv
      67: invokestatic  #104                // Method kotlin/text/StringsKt.takeLast:(Ljava/lang/String;I)Ljava/lang/String;
      70: astore        8
      72: aload         7
      74: checkcast     #106                // class java/lang/CharSequence
      77: invokestatic  #110                // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
      80: checkcast     #75                 // class java/lang/Iterable
      83: aload         8
      85: checkcast     #106                // class java/lang/CharSequence
      88: invokestatic  #110                // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
      91: checkcast     #75                 // class java/lang/Iterable
      94: invokestatic  #116                // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
      97: astore        9
      99: aload         9
     101: invokeinterface #121,  1          // InterfaceMethod java/util/Set.isEmpty:()Z
     106: ifeq          113
     109: iconst_0
     110: goto          130
     113: aload         9
     115: checkcast     #75                 // class java/lang/Iterable
     118: invokestatic  #125                // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;
     121: checkcast     #66                 // class java/lang/Character
     124: invokevirtual #129                // Method java/lang/Character.charValue:()C
     127: invokestatic  #131                // Method main$mapToItemValue:(C)I
     130: istore        10
     132: iload         10
     134: istore        12
     136: iload         11
     138: iload         12
     140: iadd
     141: istore_2
     142: goto          14
     145: iload_2
     146: ireturn

  private static final int main$part2$lambda$3(java.util.List);
    Code:
       0: aload_0
       1: ldc           #141                // String it
       3: invokestatic  #147                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #75                 // class java/lang/Iterable
      10: astore_2
      11: nop
      12: iconst_0
      13: istore_3
      14: aload_2
      15: astore        4
      17: new           #149                // class java/util/ArrayList
      20: dup
      21: aload_2
      22: bipush        10
      24: invokestatic  #153                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #155                // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #157                // class java/util/Collection
      33: astore        5
      35: iconst_0
      36: istore        6
      38: aload         4
      40: invokeinterface #79,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        7
      47: aload         7
      49: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          100
      57: aload         7
      59: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        8
      66: aload         5
      68: aload         8
      70: checkcast     #91                 // class java/lang/String
      73: astore        9
      75: astore        14
      77: iconst_0
      78: istore        10
      80: aload         9
      82: checkcast     #106                // class java/lang/CharSequence
      85: invokestatic  #110                // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
      88: aload         14
      90: swap
      91: invokeinterface #161,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      96: pop
      97: goto          47
     100: aload         5
     102: checkcast     #57                 // class java/util/List
     105: nop
     106: checkcast     #75                 // class java/lang/Iterable
     109: astore_2
     110: invokestatic  #167                // Method kotlin/collections/SetsKt.emptySet:()Ljava/util/Set;
     113: astore_3
     114: iconst_0
     115: istore        4
     117: iconst_0
     118: istore        5
     120: aload_3
     121: astore        6
     123: aload_2
     124: invokeinterface #79,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     129: astore        7
     131: aload         7
     133: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     138: ifeq          211
     141: aload         7
     143: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     148: astore        8
     150: iload         5
     152: iinc          5, 1
     155: istore        9
     157: iload         9
     159: ifge          165
     162: invokestatic  #170                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     165: iload         9
     167: aload         6
     169: aload         8
     171: checkcast     #118                // class java/util/Set
     174: astore        10
     176: astore        11
     178: istore        12
     180: iconst_0
     181: istore        13
     183: iload         12
     185: ifne          193
     188: aload         10
     190: goto          206
     193: aload         11
     195: checkcast     #75                 // class java/lang/Iterable
     198: aload         10
     200: checkcast     #75                 // class java/lang/Iterable
     203: invokestatic  #116                // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
     206: astore        6
     208: goto          131
     211: aload         6
     213: checkcast     #75                 // class java/lang/Iterable
     216: invokestatic  #173                // Method kotlin/collections/CollectionsKt.firstOrNull:(Ljava/lang/Iterable;)Ljava/lang/Object;
     219: checkcast     #66                 // class java/lang/Character
     222: astore_1
     223: aload_1
     224: ifnull        237
     227: aload_1
     228: invokevirtual #129                // Method java/lang/Character.charValue:()C
     231: invokestatic  #131                // Method main$mapToItemValue:(C)I
     234: goto          238
     237: iconst_0
     238: ireturn

  private static final int main$part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: checkcast     #75                 // class java/lang/Iterable
       4: iconst_3
       5: invokedynamic #212,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      10: invokestatic  #216                // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;ILkotlin/jvm/functions/Function1;)Ljava/util/List;
      13: astore_1
      14: aload_1
      15: checkcast     #75                 // class java/lang/Iterable
      18: invokestatic  #220                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
      21: ireturn
}

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

  public static final int EXPECTED_PART1_CHECK_ANSWER;

  public static final int EXPECTED_PART2_CHECK_ANSWER;

  public static final int ELF_GROUP_SIZE;

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

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