package day13

import java.io.File

fun main() {
    var points: Set<Point> = emptySet()
    var foldCommands: List<FoldCommand> = emptyList()
    File("src/main/kotlin/day13/input.txt").useLines { linesSequence ->
        val linesIterator = linesSequence.iterator()
        points = linesIterator.asSequence().takeWhile { s -> s.isNotBlank() }.map {
            Point(
                it.substringBefore(",").toInt(),
                it.substringAfter(",").toInt()
            )
        }.toSet()
        foldCommands = linesIterator.asSequence().map {
            FoldCommand(
                it.substringBefore('=').last(),
                it.substringAfter('=').toInt()
            )
        }.toList()
    }
    println(fold(points, foldCommands[0]).count())
    val codePoints = foldCommands.fold(points) { acc, foldCommand -> fold(acc, foldCommand) }
    codePoints.display()
}

fun fold(points: Set<Point>, foldCommand: FoldCommand): Set<Point> = points.map { point ->
    if (foldCommand.axis == 'x' && point.x > foldCommand.position) {
        Point(2 * foldCommand.position - point.x, point.y)
    } else if (foldCommand.axis == 'y' && point.y > foldCommand.position) {
        Point(point.x, 2 * foldCommand.position - point.y)
    } else {
        point
    }
}.toSet()

fun Set<Point>.display() {
    (0..this.maxOf { it.y }).forEach { y ->
        (0..this.maxOf { it.x }).forEach { x ->
            print(if (Point(x, y) in this) "\u2588" else "\u2591")
        }
        println()
    }
}

data class Point(val x: Int, val y: Int)
data class FoldCommand(val axis: Char, val position: Int)

Compiled from "solution.kt"
public final class day13.SolutionKt {
  public static final void main();
    Code:
       0: aconst_null
       1: astore_0
       2: invokestatic  #14                 // Method kotlin/collections/SetsKt.emptySet:()Ljava/util/Set;
       5: astore_0
       6: aconst_null
       7: astore_1
       8: invokestatic  #20                 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
      11: astore_1
      12: new           #22                 // class java/io/File
      15: dup
      16: ldc           #24                 // String src/main/kotlin/day13/input.txt
      18: invokespecial #28                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      21: astore_2
      22: getstatic     #34                 // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;
      25: astore_3
      26: iconst_0
      27: istore        4
      29: aload_2
      30: astore        5
      32: sipush        8192
      35: istore        6
      37: aload         5
      39: astore        7
      41: new           #36                 // class java/io/InputStreamReader
      44: dup
      45: new           #38                 // class java/io/FileInputStream
      48: dup
      49: aload         7
      51: invokespecial #41                 // Method java/io/FileInputStream."<init>":(Ljava/io/File;)V
      54: checkcast     #43                 // class java/io/InputStream
      57: aload_3
      58: invokespecial #46                 // Method java/io/InputStreamReader."<init>":(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V
      61: checkcast     #48                 // class java/io/Reader
      64: astore        7
      66: aload         7
      68: instanceof    #50                 // class java/io/BufferedReader
      71: ifeq          82
      74: aload         7
      76: checkcast     #50                 // class java/io/BufferedReader
      79: goto          93
      82: new           #50                 // class java/io/BufferedReader
      85: dup
      86: aload         7
      88: iload         6
      90: invokespecial #53                 // Method java/io/BufferedReader."<init>":(Ljava/io/Reader;I)V
      93: checkcast     #55                 // class java/io/Closeable
      96: astore        5
      98: aconst_null
      99: astore        6
     101: nop
     102: aload         5
     104: checkcast     #50                 // class java/io/BufferedReader
     107: astore        7
     109: iconst_0
     110: istore        8
     112: aload         7
     114: invokestatic  #61                 // Method kotlin/io/TextStreamsKt.lineSequence:(Ljava/io/BufferedReader;)Lkotlin/sequences/Sequence;
     117: astore        9
     119: iconst_0
     120: istore        10
     122: aload         9
     124: invokeinterface #67,  1           // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
     129: astore        11
     131: aload         11
     133: invokestatic  #73                 // Method kotlin/sequences/SequencesKt.asSequence:(Ljava/util/Iterator;)Lkotlin/sequences/Sequence;
     136: invokedynamic #93,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
     141: invokestatic  #97                 // Method kotlin/sequences/SequencesKt.takeWhile:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     144: invokedynamic #104,  0            // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;
     149: invokestatic  #107                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     152: invokestatic  #111                // Method kotlin/sequences/SequencesKt.toSet:(Lkotlin/sequences/Sequence;)Ljava/util/Set;
     155: astore_0
     156: aload         11
     158: invokestatic  #73                 // Method kotlin/sequences/SequencesKt.asSequence:(Ljava/util/Iterator;)Lkotlin/sequences/Sequence;
     161: invokedynamic #118,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;
     166: invokestatic  #107                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     169: invokestatic  #122                // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
     172: astore_1
     173: nop
     174: getstatic     #128                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     177: astore        7
     179: aload         5
     181: aload         6
     183: invokestatic  #134                // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V
     186: goto          210
     189: astore        8
     191: aload         8
     193: astore        6
     195: aload         8
     197: athrow
     198: astore        8
     200: aload         5
     202: aload         6
     204: invokestatic  #134                // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V
     207: aload         8
     209: athrow
     210: nop
     211: aload_0
     212: aload_1
     213: iconst_0
     214: invokeinterface #140,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     219: checkcast     #142                // class day13/FoldCommand
     222: invokestatic  #146                // Method fold:(Ljava/util/Set;Lday13/FoldCommand;)Ljava/util/Set;
     225: checkcast     #148                // class java/util/Collection
     228: invokeinterface #152,  1          // InterfaceMethod java/util/Collection.size:()I
     233: istore_2
     234: getstatic     #158                // Field java/lang/System.out:Ljava/io/PrintStream;
     237: iload_2
     238: invokevirtual #164                // Method java/io/PrintStream.println:(I)V
     241: aload_1
     242: checkcast     #166                // class java/lang/Iterable
     245: astore_3
     246: aload_0
     247: astore        4
     249: iconst_0
     250: istore        5
     252: aload         4
     254: astore        6
     256: aload_3
     257: invokeinterface #167,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     262: astore        7
     264: aload         7
     266: invokeinterface #173,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     271: ifeq          309
     274: aload         7
     276: invokeinterface #177,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     281: astore        8
     283: aload         6
     285: aload         8
     287: checkcast     #142                // class day13/FoldCommand
     290: astore        9
     292: astore        10
     294: iconst_0
     295: istore        11
     297: aload         10
     299: aload         9
     301: invokestatic  #146                // Method fold:(Ljava/util/Set;Lday13/FoldCommand;)Ljava/util/Set;
     304: astore        6
     306: goto          264
     309: aload         6
     311: astore_2
     312: aload_2
     313: invokestatic  #181                // Method display:(Ljava/util/Set;)V
     316: return
    Exception table:
       from    to  target type
         101   179   189   Class java/lang/Throwable
         101   179   198   any
         189   198   198   any
         198   200   198   any

  public static final java.util.Set<day13.Point> fold(java.util.Set<day13.Point>, day13.FoldCommand);
    Code:
       0: aload_0
       1: ldc           #216                // String points
       3: invokestatic  #222                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #223                // String foldCommand
       9: invokestatic  #222                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: checkcast     #166                // class java/lang/Iterable
      16: astore_2
      17: iconst_0
      18: istore_3
      19: aload_2
      20: astore        4
      22: new           #225                // class java/util/ArrayList
      25: dup
      26: aload_2
      27: bipush        10
      29: invokestatic  #229                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      32: invokespecial #231                // Method java/util/ArrayList."<init>":(I)V
      35: checkcast     #148                // class java/util/Collection
      38: astore        5
      40: iconst_0
      41: istore        6
      43: aload         4
      45: invokeinterface #167,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      50: astore        7
      52: aload         7
      54: invokeinterface #173,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      59: ifeq          196
      62: aload         7
      64: invokeinterface #177,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      69: astore        8
      71: aload         5
      73: aload         8
      75: checkcast     #233                // class day13/Point
      78: astore        9
      80: astore        11
      82: iconst_0
      83: istore        10
      85: aload_1
      86: invokevirtual #237                // Method day13/FoldCommand.getAxis:()C
      89: bipush        120
      91: if_icmpne     133
      94: aload         9
      96: invokevirtual #240                // Method day13/Point.getX:()I
      99: aload_1
     100: invokevirtual #243                // Method day13/FoldCommand.getPosition:()I
     103: if_icmple     133
     106: new           #233                // class day13/Point
     109: dup
     110: iconst_2
     111: aload_1
     112: invokevirtual #243                // Method day13/FoldCommand.getPosition:()I
     115: imul
     116: aload         9
     118: invokevirtual #240                // Method day13/Point.getX:()I
     121: isub
     122: aload         9
     124: invokevirtual #246                // Method day13/Point.getY:()I
     127: invokespecial #249                // Method day13/Point."<init>":(II)V
     130: goto          183
     133: aload_1
     134: invokevirtual #237                // Method day13/FoldCommand.getAxis:()C
     137: bipush        121
     139: if_icmpne     181
     142: aload         9
     144: invokevirtual #246                // Method day13/Point.getY:()I
     147: aload_1
     148: invokevirtual #243                // Method day13/FoldCommand.getPosition:()I
     151: if_icmple     181
     154: new           #233                // class day13/Point
     157: dup
     158: aload         9
     160: invokevirtual #240                // Method day13/Point.getX:()I
     163: iconst_2
     164: aload_1
     165: invokevirtual #243                // Method day13/FoldCommand.getPosition:()I
     168: imul
     169: aload         9
     171: invokevirtual #246                // Method day13/Point.getY:()I
     174: isub
     175: invokespecial #249                // Method day13/Point."<init>":(II)V
     178: goto          183
     181: aload         9
     183: nop
     184: aload         11
     186: swap
     187: invokeinterface #253,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     192: pop
     193: goto          52
     196: aload         5
     198: checkcast     #136                // class java/util/List
     201: nop
     202: checkcast     #166                // class java/lang/Iterable
     205: invokestatic  #256                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     208: areturn

  public static final void display(java.util.Set<day13.Point>);
    Code:
       0: aload_0
       1: ldc_w         #269                // String <this>
       4: invokestatic  #222                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: iconst_0
       8: aload_0
       9: checkcast     #166                // class java/lang/Iterable
      12: astore_1
      13: istore        15
      15: aload_1
      16: invokeinterface #167,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      21: astore_2
      22: aload_2
      23: invokeinterface #173,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      28: ifne          39
      31: new           #271                // class java/util/NoSuchElementException
      34: dup
      35: invokespecial #273                // Method java/util/NoSuchElementException."<init>":()V
      38: athrow
      39: aload_2
      40: invokeinterface #177,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      45: checkcast     #233                // class day13/Point
      48: astore_3
      49: iconst_0
      50: istore        4
      52: aload_3
      53: invokevirtual #246                // Method day13/Point.getY:()I
      56: istore_3
      57: aload_2
      58: invokeinterface #173,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      63: ifeq          99
      66: aload_2
      67: invokeinterface #177,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      72: checkcast     #233                // class day13/Point
      75: astore        4
      77: iconst_0
      78: istore        5
      80: aload         4
      82: invokevirtual #246                // Method day13/Point.getY:()I
      85: istore        4
      87: iload_3
      88: iload         4
      90: if_icmpge     57
      93: iload         4
      95: istore_3
      96: goto          57
      99: iload_3
     100: istore        16
     102: iload         15
     104: iload         16
     106: istore        17
     108: istore        18
     110: new           #275                // class kotlin/ranges/IntRange
     113: dup
     114: iload         18
     116: iload         17
     118: invokespecial #276                // Method kotlin/ranges/IntRange."<init>":(II)V
     121: checkcast     #166                // class java/lang/Iterable
     124: astore_1
     125: iconst_0
     126: istore_2
     127: aload_1
     128: invokeinterface #167,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     133: astore_3
     134: aload_3
     135: invokeinterface #173,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     140: ifeq          383
     143: aload_3
     144: checkcast     #278                // class kotlin/collections/IntIterator
     147: invokevirtual #281                // Method kotlin/collections/IntIterator.nextInt:()I
     150: istore        4
     152: iload         4
     154: istore        5
     156: iconst_0
     157: istore        6
     159: iconst_0
     160: aload_0
     161: checkcast     #166                // class java/lang/Iterable
     164: astore        7
     166: istore        8
     168: aload         7
     170: invokeinterface #167,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     175: astore        9
     177: aload         9
     179: invokeinterface #173,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     184: ifne          195
     187: new           #271                // class java/util/NoSuchElementException
     190: dup
     191: invokespecial #273                // Method java/util/NoSuchElementException."<init>":()V
     194: athrow
     195: aload         9
     197: invokeinterface #177,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     202: checkcast     #233                // class day13/Point
     205: astore        10
     207: iconst_0
     208: istore        11
     210: aload         10
     212: invokevirtual #240                // Method day13/Point.getX:()I
     215: istore        10
     217: aload         9
     219: invokeinterface #173,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     224: ifeq          263
     227: aload         9
     229: invokeinterface #177,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     234: checkcast     #233                // class day13/Point
     237: astore        11
     239: iconst_0
     240: istore        12
     242: aload         11
     244: invokevirtual #240                // Method day13/Point.getX:()I
     247: istore        11
     249: iload         10
     251: iload         11
     253: if_icmpge     217
     256: iload         11
     258: istore        10
     260: goto          217
     263: iload         10
     265: istore        13
     267: iload         8
     269: iload         13
     271: istore        19
     273: istore        20
     275: new           #275                // class kotlin/ranges/IntRange
     278: dup
     279: iload         20
     281: iload         19
     283: invokespecial #276                // Method kotlin/ranges/IntRange."<init>":(II)V
     286: checkcast     #166                // class java/lang/Iterable
     289: astore        7
     291: iconst_0
     292: istore        9
     294: aload         7
     296: invokeinterface #167,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     301: astore        10
     303: aload         10
     305: invokeinterface #173,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     310: ifeq          371
     313: aload         10
     315: checkcast     #278                // class kotlin/collections/IntIterator
     318: invokevirtual #281                // Method kotlin/collections/IntIterator.nextInt:()I
     321: istore        11
     323: iload         11
     325: istore        12
     327: iconst_0
     328: istore        14
     330: aload_0
     331: new           #233                // class day13/Point
     334: dup
     335: iload         12
     337: iload         5
     339: invokespecial #249                // Method day13/Point."<init>":(II)V
     342: invokeinterface #284,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     347: ifeq          356
     350: ldc_w         #286                // String █
     353: goto          359
     356: ldc_w         #288                // String ░
     359: getstatic     #158                // Field java/lang/System.out:Ljava/io/PrintStream;
     362: swap
     363: invokevirtual #292                // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
     366: nop
     367: nop
     368: goto          303
     371: nop
     372: getstatic     #158                // Field java/lang/System.out:Ljava/io/PrintStream;
     375: invokevirtual #294                // Method java/io/PrintStream.println:()V
     378: nop
     379: nop
     380: goto          134
     383: nop
     384: return

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

  private static final boolean main$lambda$3$lambda$0(java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #313                // String s
       4: invokestatic  #222                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: checkcast     #315                // class java/lang/CharSequence
      11: invokestatic  #321                // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
      14: ifne          21
      17: iconst_1
      18: goto          22
      21: iconst_0
      22: ireturn

  private static final day13.Point main$lambda$3$lambda$1(java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #323                // String it
       4: invokestatic  #222                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: new           #233                // class day13/Point
      10: dup
      11: aload_0
      12: ldc_w         #325                // String ,
      15: aconst_null
      16: iconst_2
      17: aconst_null
      18: invokestatic  #329                // Method kotlin/text/StringsKt.substringBefore$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      21: invokestatic  #335                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      24: aload_0
      25: ldc_w         #325                // String ,
      28: aconst_null
      29: iconst_2
      30: aconst_null
      31: invokestatic  #338                // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      34: invokestatic  #335                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      37: invokespecial #249                // Method day13/Point."<init>":(II)V
      40: areturn

  private static final day13.FoldCommand main$lambda$3$lambda$2(java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #323                // String it
       4: invokestatic  #222                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: new           #142                // class day13/FoldCommand
      10: dup
      11: aload_0
      12: bipush        61
      14: aconst_null
      15: iconst_2
      16: aconst_null
      17: invokestatic  #341                // Method kotlin/text/StringsKt.substringBefore$default:(Ljava/lang/String;CLjava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      20: checkcast     #315                // class java/lang/CharSequence
      23: invokestatic  #345                // Method kotlin/text/StringsKt.last:(Ljava/lang/CharSequence;)C
      26: aload_0
      27: bipush        61
      29: aconst_null
      30: iconst_2
      31: aconst_null
      32: invokestatic  #347                // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;CLjava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      35: invokestatic  #335                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      38: invokespecial #350                // Method day13/FoldCommand."<init>":(CI)V
      41: areturn
}


package day25

import java.io.File

typealias SeaFloor = Array<Array<SeaCucumberType?>>

fun main() {
    val lines = File("src/main/kotlin/day25/input.txt").readLines()

    val seaFloor: SeaFloor =
        SeaFloor(lines.size) { i -> lines[i].map { SeaCucumberType.fromSymbol(it) }.toTypedArray() }
    var iterationCount = 0
    var tmpState = seaFloor.copyOf()
    do {
//        tmpState.print()
        val (newState, numberOfMoves) = evolve(tmpState)
        tmpState = newState
        iterationCount++
    } while (numberOfMoves != 0)
    println(iterationCount)
}

fun evolve(seaFloor: SeaFloor): Pair<SeaFloor, Int> {
    val seaFloorHeight = seaFloor.size
    val seaFloorWidth = seaFloor[0].size
    var movesCount = 0
    val newState = SeaFloor(seaFloorHeight) { Array(seaFloorWidth) { null } }

    for (row in seaFloor.indices) {
        for (col in seaFloor[row].indices) {
            val seaCucumberType = seaFloor[row][col]
            if (seaCucumberType == SeaCucumberType.EAST) {
                if (seaFloor[row][(col + 1) % seaFloorWidth] == null) {
                    newState[row][(col + 1) % seaFloorWidth] = seaCucumberType
                    movesCount++
                } else {
                    newState[row][col] = seaCucumberType
                }
            }
        }
    }

    for (col in 0 until seaFloorWidth) {
        for (row in 0 until seaFloorHeight) {
            val seaCucumberType = seaFloor[row][col]
            if (seaCucumberType == SeaCucumberType.SOUTH) {
                if (seaFloor[(row + 1) % seaFloorHeight][col] == SeaCucumberType.SOUTH || newState[(row + 1) % seaFloorHeight][col] != null) {
                    newState[row][col] = seaCucumberType
                } else {
                    newState[(row + 1) % seaFloorHeight][col] = seaCucumberType
                    movesCount++
                }
            }
        }
    }
    return newState to movesCount
}
fun SeaFloor.print() {
    for (row in indices) {
        for (col in get(row).indices) {
            print(get(row).get(col)?.symbol ?: '.')
        }
        println()
    }
    println("========================")
}

enum class SeaCucumberType(val symbol: Char) {
    EAST('>'),
    SOUTH('v'),
    ;

    companion object {
        fun fromSymbol(symbol: Char) = values().firstOrNull { it.symbol == symbol }
    }
}

Compiled from "solution.kt"
public final class day25.SolutionKt {
  public static final void main();
    Code:
       0: new           #8                  // class java/io/File
       3: dup
       4: ldc           #10                 // String src/main/kotlin/day25/input.txt
       6: invokespecial #14                 // Method java/io/File."<init>":(Ljava/lang/String;)V
       9: aconst_null
      10: iconst_1
      11: aconst_null
      12: invokestatic  #20                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      15: astore_0
      16: iconst_0
      17: istore_2
      18: aload_0
      19: invokeinterface #26,  1           // InterfaceMethod java/util/List.size:()I
      24: istore_3
      25: iload_3
      26: anewarray     #28                 // class "[Lday25/SeaCucumberType;"
      29: astore        4
      31: iload_2
      32: iload_3
      33: if_icmpge     194
      36: iload_2
      37: istore        5
      39: aload         4
      41: iload         5
      43: aload_0
      44: iload         5
      46: invokeinterface #32,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      51: checkcast     #34                 // class java/lang/CharSequence
      54: astore        6
      56: istore        16
      58: astore        15
      60: iconst_0
      61: istore        7
      63: aload         6
      65: astore        8
      67: new           #36                 // class java/util/ArrayList
      70: dup
      71: aload         6
      73: invokeinterface #39,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      78: invokespecial #42                 // Method java/util/ArrayList."<init>":(I)V
      81: checkcast     #44                 // class java/util/Collection
      84: astore        9
      86: iconst_0
      87: istore        10
      89: iconst_0
      90: istore        11
      92: iload         11
      94: aload         8
      96: invokeinterface #39,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     101: if_icmpge     149
     104: aload         8
     106: iload         11
     108: invokeinterface #48,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     113: istore        12
     115: aload         9
     117: iload         12
     119: istore        13
     121: astore        17
     123: iconst_0
     124: istore        14
     126: getstatic     #54                 // Field day25/SeaCucumberType.Companion:Lday25/SeaCucumberType$Companion;
     129: iload         13
     131: invokevirtual #60                 // Method day25/SeaCucumberType$Companion.fromSymbol:(C)Lday25/SeaCucumberType;
     134: aload         17
     136: swap
     137: invokeinterface #64,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     142: pop
     143: iinc          11, 1
     146: goto          92
     149: aload         9
     151: checkcast     #22                 // class java/util/List
     154: nop
     155: astore        17
     157: aload         15
     159: iload         16
     161: aload         17
     163: checkcast     #44                 // class java/util/Collection
     166: astore        6
     168: nop
     169: iconst_0
     170: istore        7
     172: aload         6
     174: astore        8
     176: aload         8
     178: iconst_0
     179: anewarray     #50                 // class day25/SeaCucumberType
     182: invokeinterface #68,  2           // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     187: aastore
     188: iinc          2, 1
     191: goto          31
     194: aload         4
     196: astore_1
     197: iconst_0
     198: istore_2
     199: aload_1
     200: checkcast     #70                 // class "[Ljava/lang/Object;"
     203: dup
     204: arraylength
     205: invokestatic  #76                 // Method java/util/Arrays.copyOf:([Ljava/lang/Object;I)[Ljava/lang/Object;
     208: dup
     209: ldc           #78                 // String copyOf(...)
     211: invokestatic  #84                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     214: checkcast     #86                 // class "[[Lday25/SeaCucumberType;"
     217: astore_3
     218: aload_3
     219: invokestatic  #90                 // Method evolve:([[Lday25/SeaCucumberType;)Lkotlin/Pair;
     222: astore        4
     224: aload         4
     226: invokevirtual #96                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
     229: checkcast     #86                 // class "[[Lday25/SeaCucumberType;"
     232: astore        5
     234: aload         4
     236: invokevirtual #99                 // Method kotlin/Pair.component2:()Ljava/lang/Object;
     239: checkcast     #101                // class java/lang/Number
     242: invokevirtual #104                // Method java/lang/Number.intValue:()I
     245: istore        6
     247: aload         5
     249: astore_3
     250: iinc          2, 1
     253: iload         6
     255: ifne          218
     258: getstatic     #110                // Field java/lang/System.out:Ljava/io/PrintStream;
     261: iload_2
     262: invokevirtual #115                // Method java/io/PrintStream.println:(I)V
     265: return

  public static final kotlin.Pair<day25.SeaCucumberType[][], java.lang.Integer> evolve(day25.SeaCucumberType[][]);
    Code:
       0: aload_0
       1: ldc           #140                // String seaFloor
       3: invokestatic  #143                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #70                 // class "[Ljava/lang/Object;"
      10: arraylength
      11: istore_1
      12: aload_0
      13: iconst_0
      14: aaload
      15: arraylength
      16: istore_2
      17: iconst_0
      18: istore_3
      19: iconst_0
      20: istore        5
      22: iload_1
      23: anewarray     #28                 // class "[Lday25/SeaCucumberType;"
      26: astore        6
      28: iload         5
      30: iload_1
      31: if_icmpge     90
      34: iload         5
      36: istore        7
      38: aload         6
      40: iload         7
      42: iconst_0
      43: istore        8
      45: iload_2
      46: anewarray     #50                 // class day25/SeaCucumberType
      49: astore        9
      51: istore        12
      53: astore        11
      55: iload         8
      57: iload_2
      58: if_icmpge     77
      61: iload         8
      63: istore        10
      65: aload         9
      67: iload         10
      69: aconst_null
      70: aastore
      71: iinc          8, 1
      74: goto          55
      77: aload         11
      79: iload         12
      81: aload         9
      83: aastore
      84: iinc          5, 1
      87: goto          28
      90: aload         6
      92: astore        4
      94: iconst_0
      95: istore        5
      97: aload_0
      98: checkcast     #70                 // class "[Ljava/lang/Object;"
     101: arraylength
     102: istore        6
     104: iload         5
     106: iload         6
     108: if_icmpge     203
     111: iconst_0
     112: istore        7
     114: aload_0
     115: iload         5
     117: aaload
     118: arraylength
     119: istore        8
     121: iload         7
     123: iload         8
     125: if_icmpge     197
     128: aload_0
     129: iload         5
     131: aaload
     132: iload         7
     134: aaload
     135: astore        9
     137: aload         9
     139: getstatic     #147                // Field day25/SeaCucumberType.EAST:Lday25/SeaCucumberType;
     142: if_acmpne     191
     145: aload_0
     146: iload         5
     148: aaload
     149: iload         7
     151: iconst_1
     152: iadd
     153: iload_2
     154: irem
     155: aaload
     156: ifnonnull     181
     159: aload         4
     161: iload         5
     163: aaload
     164: iload         7
     166: iconst_1
     167: iadd
     168: iload_2
     169: irem
     170: aload         9
     172: aastore
     173: iload_3
     174: iinc          3, 1
     177: pop
     178: goto          191
     181: aload         4
     183: iload         5
     185: aaload
     186: iload         7
     188: aload         9
     190: aastore
     191: iinc          7, 1
     194: goto          121
     197: iinc          5, 1
     200: goto          104
     203: iconst_0
     204: istore        5
     206: iload         5
     208: iload_2
     209: if_icmpge     314
     212: iconst_0
     213: istore        6
     215: iload         6
     217: iload_1
     218: if_icmpge     308
     221: aload_0
     222: iload         6
     224: aaload
     225: iload         5
     227: aaload
     228: astore        7
     230: aload         7
     232: getstatic     #150                // Field day25/SeaCucumberType.SOUTH:Lday25/SeaCucumberType;
     235: if_acmpne     302
     238: aload_0
     239: iload         6
     241: iconst_1
     242: iadd
     243: iload_1
     244: irem
     245: aaload
     246: iload         5
     248: aaload
     249: getstatic     #150                // Field day25/SeaCucumberType.SOUTH:Lday25/SeaCucumberType;
     252: if_acmpeq     270
     255: aload         4
     257: iload         6
     259: iconst_1
     260: iadd
     261: iload_1
     262: irem
     263: aaload
     264: iload         5
     266: aaload
     267: ifnull        283
     270: aload         4
     272: iload         6
     274: aaload
     275: iload         5
     277: aload         7
     279: aastore
     280: goto          302
     283: aload         4
     285: iload         6
     287: iconst_1
     288: iadd
     289: iload_1
     290: irem
     291: aaload
     292: iload         5
     294: aload         7
     296: aastore
     297: iload_3
     298: iinc          3, 1
     301: pop
     302: iinc          6, 1
     305: goto          215
     308: iinc          5, 1
     311: goto          206
     314: aload         4
     316: iload_3
     317: invokestatic  #156                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     320: invokestatic  #162                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     323: areturn

  public static final void print(day25.SeaCucumberType[][]);
    Code:
       0: aload_0
       1: ldc           #172                // String <this>
       3: invokestatic  #143                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_1
       8: aload_0
       9: checkcast     #70                 // class "[Ljava/lang/Object;"
      12: arraylength
      13: istore_2
      14: iload_1
      15: iload_2
      16: if_icmpge     79
      19: iconst_0
      20: istore_3
      21: aload_0
      22: iload_1
      23: aaload
      24: arraylength
      25: istore        4
      27: iload_3
      28: iload         4
      30: if_icmpge     67
      33: aload_0
      34: iload_1
      35: aaload
      36: iload_3
      37: aaload
      38: dup
      39: ifnull        48
      42: invokevirtual #176                // Method day25/SeaCucumberType.getSymbol:()C
      45: goto          51
      48: pop
      49: bipush        46
      51: istore        5
      53: getstatic     #110                // Field java/lang/System.out:Ljava/io/PrintStream;
      56: iload         5
      58: invokevirtual #179                // Method java/io/PrintStream.print:(C)V
      61: iinc          3, 1
      64: goto          27
      67: getstatic     #110                // Field java/lang/System.out:Ljava/io/PrintStream;
      70: invokevirtual #181                // Method java/io/PrintStream.println:()V
      73: iinc          1, 1
      76: goto          14
      79: ldc           #183                // String ========================
      81: getstatic     #110                // Field java/lang/System.out:Ljava/io/PrintStream;
      84: swap
      85: invokevirtual #186                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      88: return

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


package day22

import java.io.File

fun main() {
    val inputLineRegex = """(on|off) x=([-]?\d+)..([-]?\d+),y=([-]?\d+)..([-]?\d+),z=([-]?\d+)..([-]?\d+)""".toRegex()
    val lines = File("src/main/kotlin/day22/input.txt").readLines()
    val rebootSteps = lines.map { line ->
        val (state, x0, x1, y0, y1, z0, z1) =
            inputLineRegex.matchEntire(line)?.destructured ?: throw IllegalArgumentException("Invalid input")
        RebootStep(state == "on", Cuboid(x0.toInt()..x1.toInt(), y0.toInt()..y1.toInt(), z0.toInt()..z1.toInt()))
    }
    val initializingRebootSteps = rebootSteps.filter {
        it.cube.x.first >= -50 && it.cube.x.last <= 50 &&
        it.cube.y.first >= -50 && it.cube.y.last <= 50 &&
        it.cube.z.first >= -50 && it.cube.z.last <= 50
    }

    println(initializingRebootSteps.calculateTurnedOn())
    println(rebootSteps.calculateTurnedOn())
}

fun List<RebootStep>.calculateTurnedOn(): Long {
    val xCutPoints = flatMap { listOf(it.cube.x.first, it.cube.x.last + 1) }.distinct().sorted()
    val yCutPoints = flatMap { listOf(it.cube.y.first, it.cube.y.last + 1) }.distinct().sorted()
    val zCutPoints = flatMap { listOf(it.cube.z.first, it.cube.z.last + 1) }.distinct().sorted()

    val space = Array(xCutPoints.size - 1) { Array(yCutPoints.size - 1) { BooleanArray(zCutPoints.size - 1) } }

    //compress
    val xCompressedCutPoints = xCutPoints.withIndex().associateBy({ it.value }, { it.index })
    val yCompressedCutPoints = yCutPoints.withIndex().associateBy({ it.value }, { it.index })
    val zCompressedCutPoints = zCutPoints.withIndex().associateBy({ it.value }, { it.index })

    for (rebootStep in this) {
        val cube = rebootStep.cube
        for (x in xCompressedCutPoints[cube.x.first]!! until xCompressedCutPoints[cube.x.last + 1]!!) {
            for (y in yCompressedCutPoints[cube.y.first]!! until yCompressedCutPoints[cube.y.last + 1]!!) {
                for (z in zCompressedCutPoints[cube.z.first]!! until zCompressedCutPoints[cube.z.last + 1]!!) {
                    space[x][y][z] = rebootStep.turnedOn
                }
            }
        }
    }
    //decompress and count
    var count = 0L
    for (x in space.indices) {
        for (y in space[x].indices) {
            for (z in space[x][y].indices) {
                if (space[x][y][z]) count += 1L * (xCutPoints[x + 1] - xCutPoints[x]) * (yCutPoints[y + 1] - yCutPoints[y]) * (zCutPoints[z + 1] - zCutPoints[z])
            }
        }
    }
    return count
}

data class RebootStep(val turnedOn: Boolean, val cube: Cuboid)
data class Cuboid(val x: IntRange, val y: IntRange, val z: IntRange)

Compiled from "solution.kt"
public final class day22.SolutionKt {
  public static final void main();
    Code:
       0: new           #8                  // class kotlin/text/Regex
       3: dup
       4: ldc           #10                 // String (on|off) x=([-]?\\d+)..([-]?\\d+),y=([-]?\\d+)..([-]?\\d+),z=([-]?\\d+)..([-]?\\d+)
       6: invokespecial #14                 // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
       9: astore_0
      10: new           #16                 // class java/io/File
      13: dup
      14: ldc           #18                 // String src/main/kotlin/day22/input.txt
      16: invokespecial #19                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      19: aconst_null
      20: iconst_1
      21: aconst_null
      22: invokestatic  #25                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      25: astore_1
      26: aload_1
      27: checkcast     #27                 // class java/lang/Iterable
      30: astore_3
      31: iconst_0
      32: istore        4
      34: aload_3
      35: astore        5
      37: new           #29                 // class java/util/ArrayList
      40: dup
      41: aload_3
      42: bipush        10
      44: invokestatic  #35                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      47: invokespecial #38                 // Method java/util/ArrayList."<init>":(I)V
      50: checkcast     #40                 // class java/util/Collection
      53: astore        6
      55: iconst_0
      56: istore        7
      58: aload         5
      60: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      65: astore        8
      67: aload         8
      69: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      74: ifeq          368
      77: aload         8
      79: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      84: astore        9
      86: aload         6
      88: aload         9
      90: checkcast     #56                 // class java/lang/String
      93: astore        10
      95: astore        20
      97: iconst_0
      98: istore        11
     100: aload_0
     101: aload         10
     103: checkcast     #58                 // class java/lang/CharSequence
     106: invokevirtual #62                 // Method kotlin/text/Regex.matchEntire:(Ljava/lang/CharSequence;)Lkotlin/text/MatchResult;
     109: dup
     110: ifnull        122
     113: invokeinterface #68,  1           // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;
     118: dup
     119: ifnonnull     133
     122: pop
     123: new           #70                 // class java/lang/IllegalArgumentException
     126: dup
     127: ldc           #72                 // String Invalid input
     129: invokespecial #73                 // Method java/lang/IllegalArgumentException."<init>":(Ljava/lang/String;)V
     132: athrow
     133: astore        12
     135: aload         12
     137: invokevirtual #79                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     140: invokeinterface #83,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     145: iconst_1
     146: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     151: checkcast     #56                 // class java/lang/String
     154: astore        13
     156: aload         12
     158: invokevirtual #79                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     161: invokeinterface #83,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     166: iconst_2
     167: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     172: checkcast     #56                 // class java/lang/String
     175: astore        14
     177: aload         12
     179: invokevirtual #79                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     182: invokeinterface #83,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     187: iconst_3
     188: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     193: checkcast     #56                 // class java/lang/String
     196: astore        15
     198: aload         12
     200: invokevirtual #79                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     203: invokeinterface #83,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     208: iconst_4
     209: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     214: checkcast     #56                 // class java/lang/String
     217: astore        16
     219: aload         12
     221: invokevirtual #79                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     224: invokeinterface #83,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     229: iconst_5
     230: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     235: checkcast     #56                 // class java/lang/String
     238: astore        17
     240: aload         12
     242: invokevirtual #79                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     245: invokeinterface #83,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     250: bipush        6
     252: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     257: checkcast     #56                 // class java/lang/String
     260: astore        18
     262: aload         12
     264: invokevirtual #79                 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
     267: invokeinterface #83,  1           // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
     272: bipush        7
     274: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     279: checkcast     #56                 // class java/lang/String
     282: astore        19
     284: new           #91                 // class day22/RebootStep
     287: dup
     288: aload         13
     290: ldc           #93                 // String on
     292: invokestatic  #99                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     295: new           #101                // class day22/Cuboid
     298: dup
     299: new           #103                // class kotlin/ranges/IntRange
     302: dup
     303: aload         14
     305: invokestatic  #109                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     308: aload         15
     310: invokestatic  #109                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     313: invokespecial #112                // Method kotlin/ranges/IntRange."<init>":(II)V
     316: new           #103                // class kotlin/ranges/IntRange
     319: dup
     320: aload         16
     322: invokestatic  #109                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     325: aload         17
     327: invokestatic  #109                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     330: invokespecial #112                // Method kotlin/ranges/IntRange."<init>":(II)V
     333: new           #103                // class kotlin/ranges/IntRange
     336: dup
     337: aload         18
     339: invokestatic  #109                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     342: aload         19
     344: invokestatic  #109                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     347: invokespecial #112                // Method kotlin/ranges/IntRange."<init>":(II)V
     350: invokespecial #115                // Method day22/Cuboid."<init>":(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)V
     353: invokespecial #118                // Method day22/RebootStep."<init>":(ZLday22/Cuboid;)V
     356: aload         20
     358: swap
     359: invokeinterface #122,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     364: pop
     365: goto          67
     368: aload         6
     370: checkcast     #85                 // class java/util/List
     373: nop
     374: astore_2
     375: aload_2
     376: checkcast     #27                 // class java/lang/Iterable
     379: astore        4
     381: iconst_0
     382: istore        5
     384: aload         4
     386: astore        6
     388: new           #29                 // class java/util/ArrayList
     391: dup
     392: invokespecial #124                // Method java/util/ArrayList."<init>":()V
     395: checkcast     #40                 // class java/util/Collection
     398: astore        7
     400: iconst_0
     401: istore        8
     403: aload         6
     405: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     410: astore        9
     412: aload         9
     414: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     419: ifeq          558
     422: aload         9
     424: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     429: astore        10
     431: aload         10
     433: checkcast     #91                 // class day22/RebootStep
     436: astore        11
     438: iconst_0
     439: istore        12
     441: aload         11
     443: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
     446: invokevirtual #132                // Method day22/Cuboid.getX:()Lkotlin/ranges/IntRange;
     449: invokevirtual #136                // Method kotlin/ranges/IntRange.getFirst:()I
     452: bipush        -50
     454: if_icmplt     541
     457: aload         11
     459: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
     462: invokevirtual #132                // Method day22/Cuboid.getX:()Lkotlin/ranges/IntRange;
     465: invokevirtual #139                // Method kotlin/ranges/IntRange.getLast:()I
     468: bipush        50
     470: if_icmpgt     541
     473: aload         11
     475: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
     478: invokevirtual #142                // Method day22/Cuboid.getY:()Lkotlin/ranges/IntRange;
     481: invokevirtual #136                // Method kotlin/ranges/IntRange.getFirst:()I
     484: bipush        -50
     486: if_icmplt     541
     489: aload         11
     491: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
     494: invokevirtual #142                // Method day22/Cuboid.getY:()Lkotlin/ranges/IntRange;
     497: invokevirtual #139                // Method kotlin/ranges/IntRange.getLast:()I
     500: bipush        50
     502: if_icmpgt     541
     505: aload         11
     507: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
     510: invokevirtual #145                // Method day22/Cuboid.getZ:()Lkotlin/ranges/IntRange;
     513: invokevirtual #136                // Method kotlin/ranges/IntRange.getFirst:()I
     516: bipush        -50
     518: if_icmplt     541
     521: aload         11
     523: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
     526: invokevirtual #145                // Method day22/Cuboid.getZ:()Lkotlin/ranges/IntRange;
     529: invokevirtual #139                // Method kotlin/ranges/IntRange.getLast:()I
     532: bipush        50
     534: if_icmpgt     541
     537: iconst_1
     538: goto          542
     541: iconst_0
     542: ifeq          412
     545: aload         7
     547: aload         10
     549: invokeinterface #122,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     554: pop
     555: goto          412
     558: aload         7
     560: checkcast     #85                 // class java/util/List
     563: nop
     564: astore_3
     565: aload_3
     566: invokestatic  #149                // Method calculateTurnedOn:(Ljava/util/List;)J
     569: lstore        4
     571: getstatic     #155                // Field java/lang/System.out:Ljava/io/PrintStream;
     574: lload         4
     576: invokevirtual #161                // Method java/io/PrintStream.println:(J)V
     579: aload_2
     580: invokestatic  #149                // Method calculateTurnedOn:(Ljava/util/List;)J
     583: lstore        4
     585: getstatic     #155                // Field java/lang/System.out:Ljava/io/PrintStream;
     588: lload         4
     590: invokevirtual #161                // Method java/io/PrintStream.println:(J)V
     593: return

  public static final long calculateTurnedOn(java.util.List<day22.RebootStep>);
    Code:
       0: aload_0
       1: ldc           #199                // String <this>
       3: invokestatic  #203                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #27                 // class java/lang/Iterable
      10: astore_2
      11: iconst_0
      12: istore_3
      13: aload_2
      14: astore        4
      16: new           #29                 // class java/util/ArrayList
      19: dup
      20: invokespecial #124                // Method java/util/ArrayList."<init>":()V
      23: checkcast     #40                 // class java/util/Collection
      26: astore        5
      28: iconst_0
      29: istore        6
      31: aload         4
      33: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      38: astore        7
      40: aload         7
      42: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      47: ifeq          134
      50: aload         7
      52: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      57: astore        8
      59: aload         8
      61: checkcast     #91                 // class day22/RebootStep
      64: astore        9
      66: iconst_0
      67: istore        10
      69: iconst_2
      70: anewarray     #105                // class java/lang/Integer
      73: astore        11
      75: aload         11
      77: iconst_0
      78: aload         9
      80: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
      83: invokevirtual #132                // Method day22/Cuboid.getX:()Lkotlin/ranges/IntRange;
      86: invokevirtual #136                // Method kotlin/ranges/IntRange.getFirst:()I
      89: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      92: aastore
      93: aload         11
      95: iconst_1
      96: aload         9
      98: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
     101: invokevirtual #132                // Method day22/Cuboid.getX:()Lkotlin/ranges/IntRange;
     104: invokevirtual #139                // Method kotlin/ranges/IntRange.getLast:()I
     107: iconst_1
     108: iadd
     109: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     112: aastore
     113: aload         11
     115: invokestatic  #211                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     118: checkcast     #27                 // class java/lang/Iterable
     121: astore        9
     123: aload         5
     125: aload         9
     127: invokestatic  #215                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     130: pop
     131: goto          40
     134: aload         5
     136: checkcast     #85                 // class java/util/List
     139: nop
     140: checkcast     #27                 // class java/lang/Iterable
     143: invokestatic  #219                // Method kotlin/collections/CollectionsKt.distinct:(Ljava/lang/Iterable;)Ljava/util/List;
     146: checkcast     #27                 // class java/lang/Iterable
     149: invokestatic  #222                // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
     152: astore_1
     153: aload_0
     154: checkcast     #27                 // class java/lang/Iterable
     157: astore_3
     158: iconst_0
     159: istore        4
     161: aload_3
     162: astore        5
     164: new           #29                 // class java/util/ArrayList
     167: dup
     168: invokespecial #124                // Method java/util/ArrayList."<init>":()V
     171: checkcast     #40                 // class java/util/Collection
     174: astore        6
     176: iconst_0
     177: istore        7
     179: aload         5
     181: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     186: astore        8
     188: aload         8
     190: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     195: ifeq          282
     198: aload         8
     200: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     205: astore        9
     207: aload         9
     209: checkcast     #91                 // class day22/RebootStep
     212: astore        10
     214: iconst_0
     215: istore        11
     217: iconst_2
     218: anewarray     #105                // class java/lang/Integer
     221: astore        12
     223: aload         12
     225: iconst_0
     226: aload         10
     228: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
     231: invokevirtual #142                // Method day22/Cuboid.getY:()Lkotlin/ranges/IntRange;
     234: invokevirtual #136                // Method kotlin/ranges/IntRange.getFirst:()I
     237: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     240: aastore
     241: aload         12
     243: iconst_1
     244: aload         10
     246: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
     249: invokevirtual #142                // Method day22/Cuboid.getY:()Lkotlin/ranges/IntRange;
     252: invokevirtual #139                // Method kotlin/ranges/IntRange.getLast:()I
     255: iconst_1
     256: iadd
     257: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     260: aastore
     261: aload         12
     263: invokestatic  #211                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     266: checkcast     #27                 // class java/lang/Iterable
     269: astore        10
     271: aload         6
     273: aload         10
     275: invokestatic  #215                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     278: pop
     279: goto          188
     282: aload         6
     284: checkcast     #85                 // class java/util/List
     287: nop
     288: checkcast     #27                 // class java/lang/Iterable
     291: invokestatic  #219                // Method kotlin/collections/CollectionsKt.distinct:(Ljava/lang/Iterable;)Ljava/util/List;
     294: checkcast     #27                 // class java/lang/Iterable
     297: invokestatic  #222                // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
     300: astore_2
     301: aload_0
     302: checkcast     #27                 // class java/lang/Iterable
     305: astore        4
     307: iconst_0
     308: istore        5
     310: aload         4
     312: astore        6
     314: new           #29                 // class java/util/ArrayList
     317: dup
     318: invokespecial #124                // Method java/util/ArrayList."<init>":()V
     321: checkcast     #40                 // class java/util/Collection
     324: astore        7
     326: iconst_0
     327: istore        8
     329: aload         6
     331: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     336: astore        9
     338: aload         9
     340: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     345: ifeq          432
     348: aload         9
     350: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     355: astore        10
     357: aload         10
     359: checkcast     #91                 // class day22/RebootStep
     362: astore        11
     364: iconst_0
     365: istore        12
     367: iconst_2
     368: anewarray     #105                // class java/lang/Integer
     371: astore        13
     373: aload         13
     375: iconst_0
     376: aload         11
     378: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
     381: invokevirtual #145                // Method day22/Cuboid.getZ:()Lkotlin/ranges/IntRange;
     384: invokevirtual #136                // Method kotlin/ranges/IntRange.getFirst:()I
     387: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     390: aastore
     391: aload         13
     393: iconst_1
     394: aload         11
     396: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
     399: invokevirtual #145                // Method day22/Cuboid.getZ:()Lkotlin/ranges/IntRange;
     402: invokevirtual #139                // Method kotlin/ranges/IntRange.getLast:()I
     405: iconst_1
     406: iadd
     407: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     410: aastore
     411: aload         13
     413: invokestatic  #211                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     416: checkcast     #27                 // class java/lang/Iterable
     419: astore        11
     421: aload         7
     423: aload         11
     425: invokestatic  #215                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     428: pop
     429: goto          338
     432: aload         7
     434: checkcast     #85                 // class java/util/List
     437: nop
     438: checkcast     #27                 // class java/lang/Iterable
     441: invokestatic  #219                // Method kotlin/collections/CollectionsKt.distinct:(Ljava/lang/Iterable;)Ljava/util/List;
     444: checkcast     #27                 // class java/lang/Iterable
     447: invokestatic  #222                // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
     450: astore_3
     451: iconst_0
     452: istore        5
     454: aload_1
     455: invokeinterface #225,  1          // InterfaceMethod java/util/List.size:()I
     460: iconst_1
     461: isub
     462: istore        6
     464: iload         6
     466: anewarray     #227                // class "[[Z"
     469: astore        7
     471: iload         5
     473: iload         6
     475: if_icmpge     555
     478: iload         5
     480: istore        8
     482: aload         7
     484: iload         8
     486: iconst_0
     487: istore        9
     489: aload_2
     490: invokeinterface #225,  1          // InterfaceMethod java/util/List.size:()I
     495: iconst_1
     496: isub
     497: istore        10
     499: iload         10
     501: anewarray     #229                // class "[Z"
     504: astore        11
     506: istore        19
     508: astore        18
     510: iload         9
     512: iload         10
     514: if_icmpge     542
     517: iload         9
     519: istore        12
     521: aload         11
     523: iload         12
     525: aload_3
     526: invokeinterface #225,  1          // InterfaceMethod java/util/List.size:()I
     531: iconst_1
     532: isub
     533: newarray       boolean
     535: aastore
     536: iinc          9, 1
     539: goto          510
     542: aload         18
     544: iload         19
     546: aload         11
     548: aastore
     549: iinc          5, 1
     552: goto          471
     555: aload         7
     557: astore        4
     559: aload_1
     560: checkcast     #27                 // class java/lang/Iterable
     563: invokestatic  #233                // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
     566: astore        6
     568: iconst_0
     569: istore        7
     571: aload         6
     573: bipush        10
     575: invokestatic  #35                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     578: invokestatic  #239                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     581: bipush        16
     583: invokestatic  #245                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     586: istore        8
     588: aload         6
     590: astore        9
     592: new           #247                // class java/util/LinkedHashMap
     595: dup
     596: iload         8
     598: invokespecial #248                // Method java/util/LinkedHashMap."<init>":(I)V
     601: checkcast     #250                // class java/util/Map
     604: astore        10
     606: iconst_0
     607: istore        11
     609: aload         9
     611: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     616: astore        12
     618: aload         12
     620: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     625: ifeq          707
     628: aload         12
     630: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     635: astore        13
     637: aload         10
     639: aload         13
     641: checkcast     #252                // class kotlin/collections/IndexedValue
     644: astore        14
     646: astore        18
     648: iconst_0
     649: istore        15
     651: aload         14
     653: invokevirtual #255                // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     656: checkcast     #257                // class java/lang/Number
     659: invokevirtual #260                // Method java/lang/Number.intValue:()I
     662: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     665: aload         18
     667: swap
     668: aload         13
     670: checkcast     #252                // class kotlin/collections/IndexedValue
     673: astore        14
     675: astore        19
     677: astore        18
     679: iconst_0
     680: istore        15
     682: aload         14
     684: invokevirtual #263                // Method kotlin/collections/IndexedValue.getIndex:()I
     687: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     690: astore        20
     692: aload         18
     694: aload         19
     696: aload         20
     698: invokeinterface #267,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     703: pop
     704: goto          618
     707: aload         10
     709: nop
     710: astore        5
     712: aload_2
     713: checkcast     #27                 // class java/lang/Iterable
     716: invokestatic  #233                // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
     719: astore        7
     721: iconst_0
     722: istore        8
     724: aload         7
     726: bipush        10
     728: invokestatic  #35                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     731: invokestatic  #239                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     734: bipush        16
     736: invokestatic  #245                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     739: istore        9
     741: aload         7
     743: astore        10
     745: new           #247                // class java/util/LinkedHashMap
     748: dup
     749: iload         9
     751: invokespecial #248                // Method java/util/LinkedHashMap."<init>":(I)V
     754: checkcast     #250                // class java/util/Map
     757: astore        11
     759: iconst_0
     760: istore        12
     762: aload         10
     764: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     769: astore        13
     771: aload         13
     773: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     778: ifeq          860
     781: aload         13
     783: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     788: astore        14
     790: aload         11
     792: aload         14
     794: checkcast     #252                // class kotlin/collections/IndexedValue
     797: astore        15
     799: astore        18
     801: iconst_0
     802: istore        16
     804: aload         15
     806: invokevirtual #255                // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     809: checkcast     #257                // class java/lang/Number
     812: invokevirtual #260                // Method java/lang/Number.intValue:()I
     815: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     818: aload         18
     820: swap
     821: aload         14
     823: checkcast     #252                // class kotlin/collections/IndexedValue
     826: astore        15
     828: astore        19
     830: astore        18
     832: iconst_0
     833: istore        16
     835: aload         15
     837: invokevirtual #263                // Method kotlin/collections/IndexedValue.getIndex:()I
     840: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     843: astore        20
     845: aload         18
     847: aload         19
     849: aload         20
     851: invokeinterface #267,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     856: pop
     857: goto          771
     860: aload         11
     862: nop
     863: astore        6
     865: aload_3
     866: checkcast     #27                 // class java/lang/Iterable
     869: invokestatic  #233                // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
     872: astore        8
     874: iconst_0
     875: istore        9
     877: aload         8
     879: bipush        10
     881: invokestatic  #35                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     884: invokestatic  #239                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     887: bipush        16
     889: invokestatic  #245                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     892: istore        10
     894: aload         8
     896: astore        11
     898: new           #247                // class java/util/LinkedHashMap
     901: dup
     902: iload         10
     904: invokespecial #248                // Method java/util/LinkedHashMap."<init>":(I)V
     907: checkcast     #250                // class java/util/Map
     910: astore        12
     912: iconst_0
     913: istore        13
     915: aload         11
     917: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     922: astore        14
     924: aload         14
     926: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     931: ifeq          1013
     934: aload         14
     936: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     941: astore        15
     943: aload         12
     945: aload         15
     947: checkcast     #252                // class kotlin/collections/IndexedValue
     950: astore        16
     952: astore        18
     954: iconst_0
     955: istore        17
     957: aload         16
     959: invokevirtual #255                // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;
     962: checkcast     #257                // class java/lang/Number
     965: invokevirtual #260                // Method java/lang/Number.intValue:()I
     968: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     971: aload         18
     973: swap
     974: aload         15
     976: checkcast     #252                // class kotlin/collections/IndexedValue
     979: astore        16
     981: astore        19
     983: astore        18
     985: iconst_0
     986: istore        17
     988: aload         16
     990: invokevirtual #263                // Method kotlin/collections/IndexedValue.getIndex:()I
     993: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     996: astore        20
     998: aload         18
    1000: aload         19
    1002: aload         20
    1004: invokeinterface #267,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1009: pop
    1010: goto          924
    1013: aload         12
    1015: nop
    1016: astore        7
    1018: aload_0
    1019: invokeinterface #268,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
    1024: astore        8
    1026: aload         8
    1028: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1033: ifeq          1296
    1036: aload         8
    1038: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1043: checkcast     #91                 // class day22/RebootStep
    1046: astore        9
    1048: aload         9
    1050: invokevirtual #128                // Method day22/RebootStep.getCube:()Lday22/Cuboid;
    1053: astore        10
    1055: aload         5
    1057: aload         10
    1059: invokevirtual #132                // Method day22/Cuboid.getX:()Lkotlin/ranges/IntRange;
    1062: invokevirtual #136                // Method kotlin/ranges/IntRange.getFirst:()I
    1065: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1068: invokeinterface #271,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1073: dup
    1074: invokestatic  #275                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
    1077: checkcast     #257                // class java/lang/Number
    1080: invokevirtual #260                // Method java/lang/Number.intValue:()I
    1083: istore        11
    1085: aload         5
    1087: aload         10
    1089: invokevirtual #132                // Method day22/Cuboid.getX:()Lkotlin/ranges/IntRange;
    1092: invokevirtual #139                // Method kotlin/ranges/IntRange.getLast:()I
    1095: iconst_1
    1096: iadd
    1097: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1100: invokeinterface #271,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1105: dup
    1106: invokestatic  #275                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
    1109: checkcast     #257                // class java/lang/Number
    1112: invokevirtual #260                // Method java/lang/Number.intValue:()I
    1115: istore        12
    1117: iload         11
    1119: iload         12
    1121: if_icmpge     1026
    1124: aload         6
    1126: aload         10
    1128: invokevirtual #142                // Method day22/Cuboid.getY:()Lkotlin/ranges/IntRange;
    1131: invokevirtual #136                // Method kotlin/ranges/IntRange.getFirst:()I
    1134: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1137: invokeinterface #271,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1142: dup
    1143: invokestatic  #275                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
    1146: checkcast     #257                // class java/lang/Number
    1149: invokevirtual #260                // Method java/lang/Number.intValue:()I
    1152: istore        13
    1154: aload         6
    1156: aload         10
    1158: invokevirtual #142                // Method day22/Cuboid.getY:()Lkotlin/ranges/IntRange;
    1161: invokevirtual #139                // Method kotlin/ranges/IntRange.getLast:()I
    1164: iconst_1
    1165: iadd
    1166: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1169: invokeinterface #271,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1174: dup
    1175: invokestatic  #275                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
    1178: checkcast     #257                // class java/lang/Number
    1181: invokevirtual #260                // Method java/lang/Number.intValue:()I
    1184: istore        14
    1186: iload         13
    1188: iload         14
    1190: if_icmpge     1290
    1193: aload         7
    1195: aload         10
    1197: invokevirtual #145                // Method day22/Cuboid.getZ:()Lkotlin/ranges/IntRange;
    1200: invokevirtual #136                // Method kotlin/ranges/IntRange.getFirst:()I
    1203: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1206: invokeinterface #271,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1211: dup
    1212: invokestatic  #275                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
    1215: checkcast     #257                // class java/lang/Number
    1218: invokevirtual #260                // Method java/lang/Number.intValue:()I
    1221: istore        15
    1223: aload         7
    1225: aload         10
    1227: invokevirtual #145                // Method day22/Cuboid.getZ:()Lkotlin/ranges/IntRange;
    1230: invokevirtual #139                // Method kotlin/ranges/IntRange.getLast:()I
    1233: iconst_1
    1234: iadd
    1235: invokestatic  #207                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1238: invokeinterface #271,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1243: dup
    1244: invokestatic  #275                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
    1247: checkcast     #257                // class java/lang/Number
    1250: invokevirtual #260                // Method java/lang/Number.intValue:()I
    1253: istore        16
    1255: iload         15
    1257: iload         16
    1259: if_icmpge     1284
    1262: aload         4
    1264: iload         11
    1266: aaload
    1267: iload         13
    1269: aaload
    1270: iload         15
    1272: aload         9
    1274: invokevirtual #278                // Method day22/RebootStep.getTurnedOn:()Z
    1277: bastore
    1278: iinc          15, 1
    1281: goto          1255
    1284: iinc          13, 1
    1287: goto          1186
    1290: iinc          11, 1
    1293: goto          1117
    1296: lconst_0
    1297: lstore        8
    1299: iconst_0
    1300: istore        10
    1302: aload         4
    1304: checkcast     #280                // class "[Ljava/lang/Object;"
    1307: arraylength
    1308: istore        11
    1310: iload         10
    1312: iload         11
    1314: if_icmpge     1496
    1317: iconst_0
    1318: istore        12
    1320: aload         4
    1322: iload         10
    1324: aaload
    1325: checkcast     #280                // class "[Ljava/lang/Object;"
    1328: arraylength
    1329: istore        13
    1331: iload         12
    1333: iload         13
    1335: if_icmpge     1490
    1338: iconst_0
    1339: istore        14
    1341: aload         4
    1343: iload         10
    1345: aaload
    1346: iload         12
    1348: aaload
    1349: arraylength
    1350: istore        15
    1352: iload         14
    1354: iload         15
    1356: if_icmpge     1484
    1359: aload         4
    1361: iload         10
    1363: aaload
    1364: iload         12
    1366: aaload
    1367: iload         14
    1369: baload
    1370: ifeq          1478
    1373: lload         8
    1375: lconst_1
    1376: aload_1
    1377: iload         10
    1379: iconst_1
    1380: iadd
    1381: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1386: checkcast     #257                // class java/lang/Number
    1389: invokevirtual #260                // Method java/lang/Number.intValue:()I
    1392: aload_1
    1393: iload         10
    1395: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1400: checkcast     #257                // class java/lang/Number
    1403: invokevirtual #260                // Method java/lang/Number.intValue:()I
    1406: isub
    1407: i2l
    1408: lmul
    1409: aload_2
    1410: iload         12
    1412: iconst_1
    1413: iadd
    1414: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1419: checkcast     #257                // class java/lang/Number
    1422: invokevirtual #260                // Method java/lang/Number.intValue:()I
    1425: aload_2
    1426: iload         12
    1428: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1433: checkcast     #257                // class java/lang/Number
    1436: invokevirtual #260                // Method java/lang/Number.intValue:()I
    1439: isub
    1440: i2l
    1441: lmul
    1442: aload_3
    1443: iload         14
    1445: iconst_1
    1446: iadd
    1447: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1452: checkcast     #257                // class java/lang/Number
    1455: invokevirtual #260                // Method java/lang/Number.intValue:()I
    1458: aload_3
    1459: iload         14
    1461: invokeinterface #89,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1466: checkcast     #257                // class java/lang/Number
    1469: invokevirtual #260                // Method java/lang/Number.intValue:()I
    1472: isub
    1473: i2l
    1474: lmul
    1475: ladd
    1476: lstore        8
    1478: iinc          14, 1
    1481: goto          1352
    1484: iinc          12, 1
    1487: goto          1331
    1490: iinc          10, 1
    1493: goto          1310
    1496: lload         8
    1498: lreturn

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