import kotlin.math.abs

fun main() = Seeding.solve()

private object Seeding {
    fun solve() {
        var board = Board(readInput())
        println("Initial")
        board.visualize()
        var i = 0
        while (true) {
            println("$i")
            val direction = Direction.values()[i % 4]
            val (nextBoard, moved) = board.next(direction)
            if (moved == 0) {
                println("Stable after turn ${i + 1}")
                break
            }
            board = nextBoard
            i += 1
        }
//        for (i in 0 until 10) {
//            board = board.next(direction)
//            println("after turn ${i + 1}")
//            board.visualize()
//        }
//        board.visualize()
//        println("Empty cells after 10 rounds: ${board.emptyCells()}")
    }

    private fun readInput(): Set<Pos> {
        val result = mutableSetOf<Pos>()
        generateSequence(::readLine).forEachIndexed { y, line ->
            line.toCharArray().forEachIndexed { x, char ->
                if (char == '#') result.add(Pos(x, y))
            }
        }
        return result
    }

    class Board(val elves: Set<Pos>) {
        fun visualize() {
            val (xRange, yRange) = getBoundingRect()
            for (y in yRange) {
                for (x in xRange) {
                    print(if (Pos(x, y) in elves) '#' else '.')
                }
                println()
            }
            println()
        }

        fun next(firstLook: Direction): Pair<Board, Int> {
            val firstLookIndex = Direction.values().indexOf(firstLook)
            val lookDirections = Direction.values().toList().subList(firstLookIndex, Direction.values().size)
                .plus(Direction.values().sliceArray(0 until firstLookIndex))
            require(lookDirections.size == Direction.values().size && lookDirections.first() == firstLook)
//            println("Look directions: $lookDirections")

            val moves = mutableMapOf<Pos, Pos>()
            for (elf in elves) {
                var nextPos = elf
                if (elf.neighbours().any { elves.contains(it) }) {
                    for (dir in lookDirections) {
                        if (elf.directionNeighbours(dir.delta.x, dir.delta.y).none { pos -> elves.contains(pos) }) {
                            nextPos = Pos(elf.x + dir.delta.x, elf.y + dir.delta.y)
                            break
                        }
                    }
//                    println("Move $elf -> $nextPos")
                }
                moves[elf] = nextPos
            }

            val targets = mutableSetOf<Pos>()
            val conflictingTargets = mutableSetOf<Pos>()
            for (move in moves.values) {
                if (move in targets) {
                    conflictingTargets.add(move)
                } else {
                    targets.add(move)
                }
            }

            val nextElves = moves.map { move ->
                if (move.value in conflictingTargets) {
                    move.key
                } else {
                    move.value
                }
            }.toSet()

            val moveCount = nextElves.count { it !in elves }
            return Pair(Board(nextElves), moveCount)
        }

        fun emptyCells(): Int {
            val (xRange, yRange) = getBoundingRect()
            return (1 + xRange.last - xRange.first) * (1 + yRange.last - yRange.first) - elves.size
        }

        private fun getBoundingRect(): Pair<IntRange, IntRange> {
            val minX = elves.minOf { it.x }
            val maxX = elves.maxOf { it.x }
            val minY = elves.minOf { it.y }
            val maxY = elves.maxOf { it.y }
            return Pair(
                minX..maxX,
                minY..maxY
            )
        }
    }

    enum class Direction(val delta: Pos) {
        North(Pos(0, -1)),
        South(Pos(0, 1)),
        West(Pos(-1, 0)),
        East(Pos(1, 0)),
    }

    data class Pos(val x: Int, val y: Int) {
        fun neighbours(): List<Pos> = listOf(
            Pos(x - 1, y - 1), Pos(x, y - 1), Pos(x + 1, y - 1),
            Pos(x - 1, y), Pos(x + 1, y),
            Pos(x - 1, y + 1), Pos(x, y + 1), Pos(x + 1, y + 1)
        )

        fun directionNeighbours(dx: Int, dy: Int): List<Pos> {
            require(abs(dx) <= 1 && abs(dy) <= 1 && abs(dx) + abs(dy) == 1)
            return if (dx != 0) {
                listOf(Pos(x + dx, y + dx), Pos(x + dx, y), Pos(x + dx, y - dx))
            } else {
                listOf(Pos(x + dy, y + dy), Pos(x, y + dy), Pos(x - dy, y + dy))
            }
        }
    }
}

Compiled from "Seeding.kt"
public final class SeedingKt {
  public static final void main();
    Code:
       0: getstatic     #12                 // Field Seeding.INSTANCE:LSeeding;
       3: invokevirtual #15                 // Method Seeding.solve:()V
       6: return

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

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

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

  public final void solve();
    Code:
       0: new           #13                 // class Seeding$Board
       3: dup
       4: aload_0
       5: invokespecial #17                 // Method readInput:()Ljava/util/Set;
       8: invokespecial #20                 // Method Seeding$Board."<init>":(Ljava/util/Set;)V
      11: astore_1
      12: ldc           #22                 // String Initial
      14: getstatic     #28                 // Field java/lang/System.out:Ljava/io/PrintStream;
      17: swap
      18: invokevirtual #34                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      21: aload_1
      22: invokevirtual #37                 // Method Seeding$Board.visualize:()V
      25: iconst_0
      26: istore_2
      27: nop
      28: iload_2
      29: invokestatic  #43                 // Method java/lang/String.valueOf:(I)Ljava/lang/String;
      32: getstatic     #28                 // Field java/lang/System.out:Ljava/io/PrintStream;
      35: swap
      36: invokevirtual #34                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      39: invokestatic  #49                 // Method Seeding$Direction.values:()[LSeeding$Direction;
      42: iload_2
      43: iconst_4
      44: irem
      45: aaload
      46: astore_3
      47: aload_1
      48: aload_3
      49: invokevirtual #53                 // Method Seeding$Board.next:(LSeeding$Direction;)Lkotlin/Pair;
      52: astore        4
      54: aload         4
      56: invokevirtual #59                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
      59: checkcast     #13                 // class Seeding$Board
      62: astore        5
      64: aload         4
      66: invokevirtual #62                 // Method kotlin/Pair.component2:()Ljava/lang/Object;
      69: checkcast     #64                 // class java/lang/Number
      72: invokevirtual #68                 // Method java/lang/Number.intValue:()I
      75: istore        6
      77: iload         6
      79: ifne          113
      82: new           #70                 // class java/lang/StringBuilder
      85: dup
      86: invokespecial #71                 // Method java/lang/StringBuilder."<init>":()V
      89: ldc           #73                 // String Stable after turn
      91: invokevirtual #77                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      94: iload_2
      95: iconst_1
      96: iadd
      97: invokevirtual #80                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     100: invokevirtual #84                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     103: getstatic     #28                 // Field java/lang/System.out:Ljava/io/PrintStream;
     106: swap
     107: invokevirtual #34                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     110: goto          122
     113: aload         5
     115: astore_1
     116: iinc          2, 1
     119: goto          27
     122: return

  private final java.util.Set<Seeding$Pos> readInput();
    Code:
       0: new           #95                 // class java/util/LinkedHashSet
       3: dup
       4: invokespecial #96                 // Method java/util/LinkedHashSet."<init>":()V
       7: checkcast     #98                 // class java/util/Set
      10: astore_1
      11: getstatic     #104                // Field Seeding$readInput$1.INSTANCE:LSeeding$readInput$1;
      14: checkcast     #106                // class kotlin/jvm/functions/Function0
      17: invokestatic  #112                // Method kotlin/sequences/SequencesKt.generateSequence:(Lkotlin/jvm/functions/Function0;)Lkotlin/sequences/Sequence;
      20: astore_2
      21: iconst_0
      22: istore_3
      23: iconst_0
      24: istore        4
      26: aload_2
      27: invokeinterface #118,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      32: astore        5
      34: aload         5
      36: invokeinterface #124,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      41: ifeq          177
      44: aload         5
      46: invokeinterface #126,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      51: astore        6
      53: iload         4
      55: iinc          4, 1
      58: istore        7
      60: iload         7
      62: ifge          68
      65: invokestatic  #131                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
      68: iload         7
      70: aload         6
      72: checkcast     #39                 // class java/lang/String
      75: astore        8
      77: istore        9
      79: iconst_0
      80: istore        10
      82: aload         8
      84: invokevirtual #135                // Method java/lang/String.toCharArray:()[C
      87: dup
      88: ldc           #137                // String toCharArray(...)
      90: invokestatic  #143                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      93: astore        11
      95: nop
      96: iconst_0
      97: istore        12
      99: iconst_0
     100: istore        13
     102: iconst_0
     103: istore        14
     105: aload         11
     107: arraylength
     108: istore        15
     110: iload         14
     112: iload         15
     114: if_icmpge     171
     117: aload         11
     119: iload         14
     121: caload
     122: istore        16
     124: iload         13
     126: iinc          13, 1
     129: iload         16
     131: istore        17
     133: istore        18
     135: iconst_0
     136: istore        19
     138: iload         17
     140: bipush        35
     142: if_icmpne     163
     145: aload_1
     146: new           #145                // class Seeding$Pos
     149: dup
     150: iload         18
     152: iload         9
     154: invokespecial #148                // Method Seeding$Pos."<init>":(II)V
     157: invokeinterface #152,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     162: pop
     163: nop
     164: nop
     165: iinc          14, 1
     168: goto          110
     171: nop
     172: nop
     173: nop
     174: goto          34
     177: nop
     178: aload_1
     179: areturn

  static {};
    Code:
       0: new           #2                  // class Seeding
       3: dup
       4: invokespecial #172                // Method "<init>":()V
       7: putstatic     #174                // Field INSTANCE:LSeeding;
      10: return
}

Compiled from "Seeding.kt"
final class Seeding$readInput$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function0<java.lang.String> {
  public static final Seeding$readInput$1 INSTANCE;

  Seeding$readInput$1();
    Code:
       0: aload_0
       1: iconst_0
       2: ldc           #11                 // class kotlin/io/ConsoleKt
       4: ldc           #13                 // String readLine
       6: ldc           #15                 // String readLine()Ljava/lang/String;
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.String invoke();
    Code:
       0: invokestatic  #24                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: areturn

  public java.lang.Object invoke();
    Code:
       0: aload_0
       1: invokevirtual #27                 // Method invoke:()Ljava/lang/String;
       4: areturn

  static {};
    Code:
       0: new           #2                  // class Seeding$readInput$1
       3: dup
       4: invokespecial #30                 // Method "<init>":()V
       7: putstatic     #33                 // Field INSTANCE:LSeeding$readInput$1;
      10: return
}

Compiled from "Seeding.kt"
public final class Seeding$Pos {
  private final int x;

  private final int y;

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

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

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

  public final java.util.List<Seeding$Pos> neighbours();
    Code:
       0: bipush        8
       2: anewarray     #2                  // class Seeding$Pos
       5: astore_1
       6: aload_1
       7: iconst_0
       8: new           #2                  // class Seeding$Pos
      11: dup
      12: aload_0
      13: getfield      #13                 // Field x:I
      16: iconst_1
      17: isub
      18: aload_0
      19: getfield      #16                 // Field y:I
      22: iconst_1
      23: isub
      24: invokespecial #27                 // Method "<init>":(II)V
      27: aastore
      28: aload_1
      29: iconst_1
      30: new           #2                  // class Seeding$Pos
      33: dup
      34: aload_0
      35: getfield      #13                 // Field x:I
      38: aload_0
      39: getfield      #16                 // Field y:I
      42: iconst_1
      43: isub
      44: invokespecial #27                 // Method "<init>":(II)V
      47: aastore
      48: aload_1
      49: iconst_2
      50: new           #2                  // class Seeding$Pos
      53: dup
      54: aload_0
      55: getfield      #13                 // Field x:I
      58: iconst_1
      59: iadd
      60: aload_0
      61: getfield      #16                 // Field y:I
      64: iconst_1
      65: isub
      66: invokespecial #27                 // Method "<init>":(II)V
      69: aastore
      70: aload_1
      71: iconst_3
      72: new           #2                  // class Seeding$Pos
      75: dup
      76: aload_0
      77: getfield      #13                 // Field x:I
      80: iconst_1
      81: isub
      82: aload_0
      83: getfield      #16                 // Field y:I
      86: invokespecial #27                 // Method "<init>":(II)V
      89: aastore
      90: aload_1
      91: iconst_4
      92: new           #2                  // class Seeding$Pos
      95: dup
      96: aload_0
      97: getfield      #13                 // Field x:I
     100: iconst_1
     101: iadd
     102: aload_0
     103: getfield      #16                 // Field y:I
     106: invokespecial #27                 // Method "<init>":(II)V
     109: aastore
     110: aload_1
     111: iconst_5
     112: new           #2                  // class Seeding$Pos
     115: dup
     116: aload_0
     117: getfield      #13                 // Field x:I
     120: iconst_1
     121: isub
     122: aload_0
     123: getfield      #16                 // Field y:I
     126: iconst_1
     127: iadd
     128: invokespecial #27                 // Method "<init>":(II)V
     131: aastore
     132: aload_1
     133: bipush        6
     135: new           #2                  // class Seeding$Pos
     138: dup
     139: aload_0
     140: getfield      #13                 // Field x:I
     143: aload_0
     144: getfield      #16                 // Field y:I
     147: iconst_1
     148: iadd
     149: invokespecial #27                 // Method "<init>":(II)V
     152: aastore
     153: aload_1
     154: bipush        7
     156: new           #2                  // class Seeding$Pos
     159: dup
     160: aload_0
     161: getfield      #13                 // Field x:I
     164: iconst_1
     165: iadd
     166: aload_0
     167: getfield      #16                 // Field y:I
     170: iconst_1
     171: iadd
     172: invokespecial #27                 // Method "<init>":(II)V
     175: aastore
     176: aload_1
     177: invokestatic  #33                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     180: areturn

  public final java.util.List<Seeding$Pos> directionNeighbours(int, int);
    Code:
       0: iload_1
       1: invokestatic  #42                 // Method java/lang/Math.abs:(I)I
       4: iconst_1
       5: if_icmpgt     33
       8: iload_2
       9: invokestatic  #42                 // Method java/lang/Math.abs:(I)I
      12: iconst_1
      13: if_icmpgt     33
      16: iload_1
      17: invokestatic  #42                 // Method java/lang/Math.abs:(I)I
      20: iload_2
      21: invokestatic  #42                 // Method java/lang/Math.abs:(I)I
      24: iadd
      25: iconst_1
      26: if_icmpne     33
      29: iconst_1
      30: goto          34
      33: iconst_0
      34: ifne          54
      37: ldc           #44                 // String Failed requirement.
      39: astore        4
      41: new           #46                 // class java/lang/IllegalArgumentException
      44: dup
      45: aload         4
      47: invokevirtual #50                 // Method java/lang/Object.toString:()Ljava/lang/String;
      50: invokespecial #53                 // Method java/lang/IllegalArgumentException."<init>":(Ljava/lang/String;)V
      53: athrow
      54: iload_1
      55: ifeq          134
      58: iconst_3
      59: anewarray     #2                  // class Seeding$Pos
      62: astore_3
      63: aload_3
      64: iconst_0
      65: new           #2                  // class Seeding$Pos
      68: dup
      69: aload_0
      70: getfield      #13                 // Field x:I
      73: iload_1
      74: iadd
      75: aload_0
      76: getfield      #16                 // Field y:I
      79: iload_1
      80: iadd
      81: invokespecial #27                 // Method "<init>":(II)V
      84: aastore
      85: aload_3
      86: iconst_1
      87: new           #2                  // class Seeding$Pos
      90: dup
      91: aload_0
      92: getfield      #13                 // Field x:I
      95: iload_1
      96: iadd
      97: aload_0
      98: getfield      #16                 // Field y:I
     101: invokespecial #27                 // Method "<init>":(II)V
     104: aastore
     105: aload_3
     106: iconst_2
     107: new           #2                  // class Seeding$Pos
     110: dup
     111: aload_0
     112: getfield      #13                 // Field x:I
     115: iload_1
     116: iadd
     117: aload_0
     118: getfield      #16                 // Field y:I
     121: iload_1
     122: isub
     123: invokespecial #27                 // Method "<init>":(II)V
     126: aastore
     127: aload_3
     128: invokestatic  #33                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     131: goto          207
     134: iconst_3
     135: anewarray     #2                  // class Seeding$Pos
     138: astore_3
     139: aload_3
     140: iconst_0
     141: new           #2                  // class Seeding$Pos
     144: dup
     145: aload_0
     146: getfield      #13                 // Field x:I
     149: iload_2
     150: iadd
     151: aload_0
     152: getfield      #16                 // Field y:I
     155: iload_2
     156: iadd
     157: invokespecial #27                 // Method "<init>":(II)V
     160: aastore
     161: aload_3
     162: iconst_1
     163: new           #2                  // class Seeding$Pos
     166: dup
     167: aload_0
     168: getfield      #13                 // Field x:I
     171: aload_0
     172: getfield      #16                 // Field y:I
     175: iload_2
     176: iadd
     177: invokespecial #27                 // Method "<init>":(II)V
     180: aastore
     181: aload_3
     182: iconst_2
     183: new           #2                  // class Seeding$Pos
     186: dup
     187: aload_0
     188: getfield      #13                 // Field x:I
     191: iload_2
     192: isub
     193: aload_0
     194: getfield      #16                 // Field y:I
     197: iload_2
     198: iadd
     199: invokespecial #27                 // Method "<init>":(II)V
     202: aastore
     203: aload_3
     204: invokestatic  #33                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     207: areturn

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

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

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

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

  public java.lang.String toString();
    Code:
       0: new           #69                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #70                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #72                 // String Pos(x=
       9: invokevirtual #76                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field x:I
      16: invokevirtual #79                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #81                 // String , y=
      21: invokevirtual #76                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field y:I
      28: invokevirtual #79                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #84                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #85                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field x:I
       4: invokestatic  #90                 // Method java/lang/Integer.hashCode:(I)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #16                 // Field y:I
      16: invokestatic  #90                 // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: ireturn

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

Compiled from "Seeding.kt"
public final class Seeding$Board {
  private final java.util.Set<Seeding$Pos> elves;

  public Seeding$Board(java.util.Set<Seeding$Pos>);
    Code:
       0: aload_1
       1: ldc           #10                 // String elves
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #19                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #22                 // Field elves:Ljava/util/Set;
      15: return

  public final java.util.Set<Seeding$Pos> getElves();
    Code:
       0: aload_0
       1: getfield      #22                 // Field elves:Ljava/util/Set;
       4: areturn

  public final void visualize();
    Code:
       0: aload_0
       1: invokespecial #32                 // Method getBoundingRect:()Lkotlin/Pair;
       4: astore_1
       5: aload_1
       6: invokevirtual #38                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
       9: checkcast     #40                 // class kotlin/ranges/IntRange
      12: astore_2
      13: aload_1
      14: invokevirtual #43                 // Method kotlin/Pair.component2:()Ljava/lang/Object;
      17: checkcast     #40                 // class kotlin/ranges/IntRange
      20: astore_3
      21: aload_3
      22: invokevirtual #47                 // Method kotlin/ranges/IntRange.getFirst:()I
      25: istore        4
      27: aload_3
      28: invokevirtual #50                 // Method kotlin/ranges/IntRange.getLast:()I
      31: istore        5
      33: iload         4
      35: iload         5
      37: if_icmpgt     131
      40: aload_2
      41: invokevirtual #47                 // Method kotlin/ranges/IntRange.getFirst:()I
      44: istore        6
      46: aload_2
      47: invokevirtual #50                 // Method kotlin/ranges/IntRange.getLast:()I
      50: istore        7
      52: iload         6
      54: iload         7
      56: if_icmpgt     112
      59: aload_0
      60: getfield      #22                 // Field elves:Ljava/util/Set;
      63: new           #52                 // class Seeding$Pos
      66: dup
      67: iload         6
      69: iload         4
      71: invokespecial #55                 // Method Seeding$Pos."<init>":(II)V
      74: invokeinterface #61,  2           // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
      79: ifeq          87
      82: bipush        35
      84: goto          89
      87: bipush        46
      89: istore        8
      91: getstatic     #67                 // Field java/lang/System.out:Ljava/io/PrintStream;
      94: iload         8
      96: invokevirtual #73                 // Method java/io/PrintStream.print:(C)V
      99: iload         6
     101: iload         7
     103: if_icmpeq     112
     106: iinc          6, 1
     109: goto          59
     112: getstatic     #67                 // Field java/lang/System.out:Ljava/io/PrintStream;
     115: invokevirtual #76                 // Method java/io/PrintStream.println:()V
     118: iload         4
     120: iload         5
     122: if_icmpeq     131
     125: iinc          4, 1
     128: goto          40
     131: getstatic     #67                 // Field java/lang/System.out:Ljava/io/PrintStream;
     134: invokevirtual #76                 // Method java/io/PrintStream.println:()V
     137: return

  public final kotlin.Pair<Seeding$Board, java.lang.Integer> next(Seeding$Direction);
    Code:
       0: aload_1
       1: ldc           #87                 // String firstLook
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: invokestatic  #93                 // Method Seeding$Direction.values:()[LSeeding$Direction;
       9: aload_1
      10: invokestatic  #99                 // Method kotlin/collections/ArraysKt.indexOf:([Ljava/lang/Object;Ljava/lang/Object;)I
      13: istore_2
      14: invokestatic  #93                 // Method Seeding$Direction.values:()[LSeeding$Direction;
      17: invokestatic  #103                // Method kotlin/collections/ArraysKt.toList:([Ljava/lang/Object;)Ljava/util/List;
      20: iload_2
      21: invokestatic  #93                 // Method Seeding$Direction.values:()[LSeeding$Direction;
      24: arraylength
      25: invokeinterface #109,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
      30: checkcast     #111                // class java/util/Collection
      33: invokestatic  #93                 // Method Seeding$Direction.values:()[LSeeding$Direction;
      36: iconst_0
      37: iload_2
      38: invokestatic  #117                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
      41: invokestatic  #121                // Method kotlin/collections/ArraysKt.sliceArray:([Ljava/lang/Object;Lkotlin/ranges/IntRange;)[Ljava/lang/Object;
      44: invokestatic  #127                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;[Ljava/lang/Object;)Ljava/util/List;
      47: astore_3
      48: aload_3
      49: invokeinterface #130,  1          // InterfaceMethod java/util/List.size:()I
      54: invokestatic  #93                 // Method Seeding$Direction.values:()[LSeeding$Direction;
      57: arraylength
      58: if_icmpne     73
      61: aload_3
      62: invokestatic  #134                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      65: aload_1
      66: if_acmpne     73
      69: iconst_1
      70: goto          74
      73: iconst_0
      74: ifne          94
      77: ldc           #136                // String Failed requirement.
      79: astore        5
      81: new           #138                // class java/lang/IllegalArgumentException
      84: dup
      85: aload         5
      87: invokevirtual #142                // Method java/lang/Object.toString:()Ljava/lang/String;
      90: invokespecial #145                // Method java/lang/IllegalArgumentException."<init>":(Ljava/lang/String;)V
      93: athrow
      94: new           #147                // class java/util/LinkedHashMap
      97: dup
      98: invokespecial #148                // Method java/util/LinkedHashMap."<init>":()V
     101: checkcast     #150                // class java/util/Map
     104: astore        4
     106: aload_0
     107: getfield      #22                 // Field elves:Ljava/util/Set;
     110: invokeinterface #154,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     115: astore        5
     117: aload         5
     119: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     124: ifeq          440
     127: aload         5
     129: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     134: checkcast     #52                 // class Seeding$Pos
     137: astore        6
     139: aload         6
     141: astore        7
     143: aload         6
     145: invokevirtual #166                // Method Seeding$Pos.neighbours:()Ljava/util/List;
     148: checkcast     #168                // class java/lang/Iterable
     151: astore        8
     153: iconst_0
     154: istore        9
     156: aload         8
     158: instanceof    #111                // class java/util/Collection
     161: ifeq          181
     164: aload         8
     166: checkcast     #111                // class java/util/Collection
     169: invokeinterface #171,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     174: ifeq          181
     177: iconst_0
     178: goto          238
     181: aload         8
     183: invokeinterface #172,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     188: astore        10
     190: aload         10
     192: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     197: ifeq          237
     200: aload         10
     202: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     207: astore        11
     209: aload         11
     211: checkcast     #52                 // class Seeding$Pos
     214: astore        12
     216: iconst_0
     217: istore        13
     219: aload_0
     220: getfield      #22                 // Field elves:Ljava/util/Set;
     223: aload         12
     225: invokeinterface #61,  2           // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     230: ifeq          190
     233: iconst_1
     234: goto          238
     237: iconst_0
     238: ifeq          425
     241: aload_3
     242: invokeinterface #173,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     247: astore        8
     249: aload         8
     251: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     256: ifeq          425
     259: aload         8
     261: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     266: checkcast     #89                 // class Seeding$Direction
     269: astore        9
     271: aload         6
     273: aload         9
     275: invokevirtual #177                // Method Seeding$Direction.getDelta:()LSeeding$Pos;
     278: invokevirtual #180                // Method Seeding$Pos.getX:()I
     281: aload         9
     283: invokevirtual #177                // Method Seeding$Direction.getDelta:()LSeeding$Pos;
     286: invokevirtual #183                // Method Seeding$Pos.getY:()I
     289: invokevirtual #186                // Method Seeding$Pos.directionNeighbours:(II)Ljava/util/List;
     292: checkcast     #168                // class java/lang/Iterable
     295: astore        10
     297: iconst_0
     298: istore        11
     300: aload         10
     302: instanceof    #111                // class java/util/Collection
     305: ifeq          325
     308: aload         10
     310: checkcast     #111                // class java/util/Collection
     313: invokeinterface #171,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     318: ifeq          325
     321: iconst_1
     322: goto          382
     325: aload         10
     327: invokeinterface #172,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     332: astore        12
     334: aload         12
     336: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     341: ifeq          381
     344: aload         12
     346: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     351: astore        13
     353: aload         13
     355: checkcast     #52                 // class Seeding$Pos
     358: astore        14
     360: iconst_0
     361: istore        15
     363: aload_0
     364: getfield      #22                 // Field elves:Ljava/util/Set;
     367: aload         14
     369: invokeinterface #61,  2           // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     374: ifeq          334
     377: iconst_0
     378: goto          382
     381: iconst_1
     382: ifeq          249
     385: new           #52                 // class Seeding$Pos
     388: dup
     389: aload         6
     391: invokevirtual #180                // Method Seeding$Pos.getX:()I
     394: aload         9
     396: invokevirtual #177                // Method Seeding$Direction.getDelta:()LSeeding$Pos;
     399: invokevirtual #180                // Method Seeding$Pos.getX:()I
     402: iadd
     403: aload         6
     405: invokevirtual #183                // Method Seeding$Pos.getY:()I
     408: aload         9
     410: invokevirtual #177                // Method Seeding$Direction.getDelta:()LSeeding$Pos;
     413: invokevirtual #183                // Method Seeding$Pos.getY:()I
     416: iadd
     417: invokespecial #55                 // Method Seeding$Pos."<init>":(II)V
     420: astore        7
     422: goto          425
     425: aload         4
     427: aload         6
     429: aload         7
     431: invokeinterface #190,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     436: pop
     437: goto          117
     440: new           #192                // class java/util/LinkedHashSet
     443: dup
     444: invokespecial #193                // Method java/util/LinkedHashSet."<init>":()V
     447: checkcast     #57                 // class java/util/Set
     450: astore        5
     452: new           #192                // class java/util/LinkedHashSet
     455: dup
     456: invokespecial #193                // Method java/util/LinkedHashSet."<init>":()V
     459: checkcast     #57                 // class java/util/Set
     462: astore        6
     464: aload         4
     466: invokeinterface #196,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
     471: invokeinterface #197,  1          // InterfaceMethod java/util/Collection.iterator:()Ljava/util/Iterator;
     476: astore        7
     478: aload         7
     480: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     485: ifeq          537
     488: aload         7
     490: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     495: checkcast     #52                 // class Seeding$Pos
     498: astore        8
     500: aload         5
     502: aload         8
     504: invokeinterface #61,  2           // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     509: ifeq          524
     512: aload         6
     514: aload         8
     516: invokeinterface #200,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     521: goto          533
     524: aload         5
     526: aload         8
     528: invokeinterface #200,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     533: pop
     534: goto          478
     537: aload         4
     539: astore        8
     541: iconst_0
     542: istore        9
     544: aload         8
     546: astore        10
     548: new           #202                // class java/util/ArrayList
     551: dup
     552: aload         8
     554: invokeinterface #203,  1          // InterfaceMethod java/util/Map.size:()I
     559: invokespecial #206                // Method java/util/ArrayList."<init>":(I)V
     562: checkcast     #111                // class java/util/Collection
     565: astore        11
     567: iconst_0
     568: istore        12
     570: aload         10
     572: invokeinterface #209,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     577: invokeinterface #154,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     582: astore        13
     584: aload         13
     586: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     591: ifeq          670
     594: aload         13
     596: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     601: checkcast     #211                // class java/util/Map$Entry
     604: astore        14
     606: aload         11
     608: aload         14
     610: astore        15
     612: astore        17
     614: iconst_0
     615: istore        16
     617: aload         6
     619: aload         15
     621: invokeinterface #214,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     626: invokeinterface #61,  2           // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     631: ifeq          647
     634: aload         15
     636: invokeinterface #217,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     641: checkcast     #52                 // class Seeding$Pos
     644: goto          657
     647: aload         15
     649: invokeinterface #214,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     654: checkcast     #52                 // class Seeding$Pos
     657: nop
     658: aload         17
     660: swap
     661: invokeinterface #218,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     666: pop
     667: goto          584
     670: aload         11
     672: checkcast     #105                // class java/util/List
     675: nop
     676: checkcast     #168                // class java/lang/Iterable
     679: invokestatic  #222                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     682: astore        7
     684: aload         7
     686: checkcast     #168                // class java/lang/Iterable
     689: astore        9
     691: iconst_0
     692: istore        10
     694: aload         9
     696: instanceof    #111                // class java/util/Collection
     699: ifeq          719
     702: aload         9
     704: checkcast     #111                // class java/util/Collection
     707: invokeinterface #171,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     712: ifeq          719
     715: iconst_0
     716: goto          798
     719: iconst_0
     720: istore        11
     722: aload         9
     724: invokeinterface #172,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     729: astore        12
     731: aload         12
     733: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     738: ifeq          796
     741: aload         12
     743: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     748: astore        13
     750: aload         13
     752: checkcast     #52                 // class Seeding$Pos
     755: astore        14
     757: iconst_0
     758: istore        15
     760: aload_0
     761: getfield      #22                 // Field elves:Ljava/util/Set;
     764: aload         14
     766: invokeinterface #61,  2           // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     771: ifne          778
     774: iconst_1
     775: goto          779
     778: iconst_0
     779: ifeq          731
     782: iinc          11, 1
     785: iload         11
     787: ifge          731
     790: invokestatic  #225                // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V
     793: goto          731
     796: iload         11
     798: istore        8
     800: new           #34                 // class kotlin/Pair
     803: dup
     804: new           #2                  // class Seeding$Board
     807: dup
     808: aload         7
     810: invokespecial #227                // Method "<init>":(Ljava/util/Set;)V
     813: iload         8
     815: invokestatic  #233                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     818: invokespecial #236                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     821: areturn

  public final int emptyCells();
    Code:
       0: aload_0
       1: invokespecial #32                 // Method getBoundingRect:()Lkotlin/Pair;
       4: astore_1
       5: aload_1
       6: invokevirtual #38                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
       9: checkcast     #40                 // class kotlin/ranges/IntRange
      12: astore_2
      13: aload_1
      14: invokevirtual #43                 // Method kotlin/Pair.component2:()Ljava/lang/Object;
      17: checkcast     #40                 // class kotlin/ranges/IntRange
      20: astore_3
      21: iconst_1
      22: aload_2
      23: invokevirtual #50                 // Method kotlin/ranges/IntRange.getLast:()I
      26: iadd
      27: aload_2
      28: invokevirtual #47                 // Method kotlin/ranges/IntRange.getFirst:()I
      31: isub
      32: iconst_1
      33: aload_3
      34: invokevirtual #50                 // Method kotlin/ranges/IntRange.getLast:()I
      37: iadd
      38: aload_3
      39: invokevirtual #47                 // Method kotlin/ranges/IntRange.getFirst:()I
      42: isub
      43: imul
      44: aload_0
      45: getfield      #22                 // Field elves:Ljava/util/Set;
      48: invokeinterface #277,  1          // InterfaceMethod java/util/Set.size:()I
      53: isub
      54: ireturn

  private final kotlin.Pair<kotlin.ranges.IntRange, kotlin.ranges.IntRange> getBoundingRect();
    Code:
       0: aload_0
       1: getfield      #22                 // Field elves:Ljava/util/Set;
       4: checkcast     #168                // class java/lang/Iterable
       7: invokeinterface #172,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      12: astore_3
      13: aload_3
      14: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      19: ifne          30
      22: new           #280                // class java/util/NoSuchElementException
      25: dup
      26: invokespecial #281                // Method java/util/NoSuchElementException."<init>":()V
      29: athrow
      30: aload_3
      31: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      36: checkcast     #52                 // class Seeding$Pos
      39: astore        4
      41: iconst_0
      42: istore        5
      44: aload         4
      46: invokevirtual #180                // Method Seeding$Pos.getX:()I
      49: istore        4
      51: aload_3
      52: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      57: ifeq          95
      60: aload_3
      61: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      66: checkcast     #52                 // class Seeding$Pos
      69: astore        5
      71: iconst_0
      72: istore        6
      74: aload         5
      76: invokevirtual #180                // Method Seeding$Pos.getX:()I
      79: istore        5
      81: iload         4
      83: iload         5
      85: if_icmple     51
      88: iload         5
      90: istore        4
      92: goto          51
      95: iload         4
      97: istore_1
      98: aload_0
      99: getfield      #22                 // Field elves:Ljava/util/Set;
     102: checkcast     #168                // class java/lang/Iterable
     105: invokeinterface #172,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     110: astore        4
     112: aload         4
     114: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     119: ifne          130
     122: new           #280                // class java/util/NoSuchElementException
     125: dup
     126: invokespecial #281                // Method java/util/NoSuchElementException."<init>":()V
     129: athrow
     130: aload         4
     132: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     137: checkcast     #52                 // class Seeding$Pos
     140: astore        5
     142: iconst_0
     143: istore        6
     145: aload         5
     147: invokevirtual #180                // Method Seeding$Pos.getX:()I
     150: istore        5
     152: aload         4
     154: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     159: ifeq          198
     162: aload         4
     164: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     169: checkcast     #52                 // class Seeding$Pos
     172: astore        6
     174: iconst_0
     175: istore        7
     177: aload         6
     179: invokevirtual #180                // Method Seeding$Pos.getX:()I
     182: istore        6
     184: iload         5
     186: iload         6
     188: if_icmpge     152
     191: iload         6
     193: istore        5
     195: goto          152
     198: iload         5
     200: istore_2
     201: aload_0
     202: getfield      #22                 // Field elves:Ljava/util/Set;
     205: checkcast     #168                // class java/lang/Iterable
     208: invokeinterface #172,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     213: astore        5
     215: aload         5
     217: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     222: ifne          233
     225: new           #280                // class java/util/NoSuchElementException
     228: dup
     229: invokespecial #281                // Method java/util/NoSuchElementException."<init>":()V
     232: athrow
     233: aload         5
     235: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     240: checkcast     #52                 // class Seeding$Pos
     243: astore        6
     245: iconst_0
     246: istore        7
     248: aload         6
     250: invokevirtual #183                // Method Seeding$Pos.getY:()I
     253: istore        6
     255: aload         5
     257: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     262: ifeq          301
     265: aload         5
     267: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     272: checkcast     #52                 // class Seeding$Pos
     275: astore        7
     277: iconst_0
     278: istore        8
     280: aload         7
     282: invokevirtual #183                // Method Seeding$Pos.getY:()I
     285: istore        7
     287: iload         6
     289: iload         7
     291: if_icmple     255
     294: iload         7
     296: istore        6
     298: goto          255
     301: iload         6
     303: istore_3
     304: aload_0
     305: getfield      #22                 // Field elves:Ljava/util/Set;
     308: checkcast     #168                // class java/lang/Iterable
     311: invokeinterface #172,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     316: astore        6
     318: aload         6
     320: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     325: ifne          336
     328: new           #280                // class java/util/NoSuchElementException
     331: dup
     332: invokespecial #281                // Method java/util/NoSuchElementException."<init>":()V
     335: athrow
     336: aload         6
     338: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     343: checkcast     #52                 // class Seeding$Pos
     346: astore        7
     348: iconst_0
     349: istore        8
     351: aload         7
     353: invokevirtual #183                // Method Seeding$Pos.getY:()I
     356: istore        7
     358: aload         6
     360: invokeinterface #160,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     365: ifeq          404
     368: aload         6
     370: invokeinterface #162,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     375: checkcast     #52                 // class Seeding$Pos
     378: astore        8
     380: iconst_0
     381: istore        9
     383: aload         8
     385: invokevirtual #183                // Method Seeding$Pos.getY:()I
     388: istore        8
     390: iload         7
     392: iload         8
     394: if_icmpge     358
     397: iload         8
     399: istore        7
     401: goto          358
     404: iload         7
     406: istore        4
     408: new           #34                 // class kotlin/Pair
     411: dup
     412: new           #40                 // class kotlin/ranges/IntRange
     415: dup
     416: iload_1
     417: iload_2
     418: invokespecial #282                // Method kotlin/ranges/IntRange."<init>":(II)V
     421: new           #40                 // class kotlin/ranges/IntRange
     424: dup
     425: iload_3
     426: iload         4
     428: invokespecial #282                // Method kotlin/ranges/IntRange."<init>":(II)V
     431: invokespecial #236                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     434: areturn
}

Compiled from "Seeding.kt"
public final class Seeding$Direction extends java.lang.Enum<Seeding$Direction> {
  private final Seeding$Pos delta;

  public static final Seeding$Direction North;

  public static final Seeding$Direction South;

  public static final Seeding$Direction West;

  public static final Seeding$Direction East;

  private static final Seeding$Direction[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

  private Seeding$Direction(Seeding$Pos);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #11                 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
       6: aload_0
       7: aload_3
       8: putfield      #15                 // Field delta:LSeeding$Pos;
      11: return

  public final Seeding$Pos getDelta();
    Code:
       0: aload_0
       1: getfield      #15                 // Field delta:LSeeding$Pos;
       4: areturn

  public static Seeding$Direction[] values();
    Code:
       0: getstatic     #30                 // Field $VALUES:[LSeeding$Direction;
       3: invokevirtual #36                 // Method java/lang/Object.clone:()Ljava/lang/Object;
       6: checkcast     #37                 // class "[LSeeding$Direction;"
       9: areturn

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

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

  private static final Seeding$Direction[] $values();
    Code:
       0: iconst_4
       1: anewarray     #2                  // class Seeding$Direction
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #54                 // Field North:LSeeding$Direction;
      10: aastore
      11: aload_0
      12: iconst_1
      13: getstatic     #57                 // Field South:LSeeding$Direction;
      16: aastore
      17: aload_0
      18: iconst_2
      19: getstatic     #60                 // Field West:LSeeding$Direction;
      22: aastore
      23: aload_0
      24: iconst_3
      25: getstatic     #63                 // Field East:LSeeding$Direction;
      28: aastore
      29: aload_0
      30: areturn

  static {};
    Code:
       0: new           #2                  // class Seeding$Direction
       3: dup
       4: ldc           #66                 // String North
       6: iconst_0
       7: new           #68                 // class Seeding$Pos
      10: dup
      11: iconst_0
      12: iconst_m1
      13: invokespecial #71                 // Method Seeding$Pos."<init>":(II)V
      16: invokespecial #73                 // Method "<init>":(Ljava/lang/String;ILSeeding$Pos;)V
      19: putstatic     #54                 // Field North:LSeeding$Direction;
      22: new           #2                  // class Seeding$Direction
      25: dup
      26: ldc           #74                 // String South
      28: iconst_1
      29: new           #68                 // class Seeding$Pos
      32: dup
      33: iconst_0
      34: iconst_1
      35: invokespecial #71                 // Method Seeding$Pos."<init>":(II)V
      38: invokespecial #73                 // Method "<init>":(Ljava/lang/String;ILSeeding$Pos;)V
      41: putstatic     #57                 // Field South:LSeeding$Direction;
      44: new           #2                  // class Seeding$Direction
      47: dup
      48: ldc           #75                 // String West
      50: iconst_2
      51: new           #68                 // class Seeding$Pos
      54: dup
      55: iconst_m1
      56: iconst_0
      57: invokespecial #71                 // Method Seeding$Pos."<init>":(II)V
      60: invokespecial #73                 // Method "<init>":(Ljava/lang/String;ILSeeding$Pos;)V
      63: putstatic     #60                 // Field West:LSeeding$Direction;
      66: new           #2                  // class Seeding$Direction
      69: dup
      70: ldc           #76                 // String East
      72: iconst_3
      73: new           #68                 // class Seeding$Pos
      76: dup
      77: iconst_1
      78: iconst_0
      79: invokespecial #71                 // Method Seeding$Pos."<init>":(II)V
      82: invokespecial #73                 // Method "<init>":(Ljava/lang/String;ILSeeding$Pos;)V
      85: putstatic     #63                 // Field East:LSeeding$Direction;
      88: invokestatic  #78                 // Method $values:()[LSeeding$Direction;
      91: putstatic     #30                 // Field $VALUES:[LSeeding$Direction;
      94: getstatic     #30                 // Field $VALUES:[LSeeding$Direction;
      97: checkcast     #80                 // class "[Ljava/lang/Enum;"
     100: invokestatic  #86                 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
     103: putstatic     #50                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
     106: return
}


fun main() {
    Forest.solve()
}

private object Forest {
    fun solve() {
        val grid = readInput()
        println("Visible trees: ${countVisible(grid)}")
        println("Max scenic score: ${maxScenicScore(grid)}")
    }

    private fun readInput(): Grid {
        return generateSequence(::readLine).map {
            it.split("").filterNot { it.isEmpty() }.map { it.toInt(10) }
        }.toList()
    }

    private fun maxScenicScore(trees: Grid): Int {
        var result = 0
        trees.forEachIndexed { i, line ->
            line.forEachIndexed { j, tree ->
                var leftView = 0
                for (left in (j - 1) downTo 0) {
                    leftView += 1
                    if (trees[i][left] >= tree) break
                }
                var rightView = 0
                for (right in (j + 1) until line.size) {
                    rightView += 1
                    if (trees[i][right] >= tree) break
                }

                var topView = 0
                for (top in (i - 1) downTo 0) {
                    topView += 1
                    if (trees[top][j] >= tree) break
                }
                var bottomView = 0
                for (bottom in (i + 1) until trees.size) {
                    bottomView += 1
                    if (trees[bottom][j] >= tree) break

                }
                result = maxOf(result, leftView * rightView * topView * bottomView)
            }
        }
        return result
    }

    private fun countVisible(trees: Grid): Int {
        var result = 0
        trees.forEachIndexed { i, line ->
            line.forEachIndexed { j, item ->
                if (i == 0 || j == 0 || i == trees.size - 1 || j == line.size - 1) {
                    result += 1
                } else if (line.subList(0, j).max() < item) {
                    result += 1
                } else if (line.subList(j + 1, line.size).max() < item) {
                    result += 1
                } else {
                    var topVisible = true
                    var bottomVisible = true
                    for (z in trees.indices) {
                        if (z == i) continue
                        if (topVisible && z < i) {
                            topVisible = trees[z][j] < item
                        }
                        if (bottomVisible && z > i) {
                            bottomVisible = trees[z][j] < item
                        }
                    }
                    if (topVisible || bottomVisible) result += 1
                }
            }
        }
        return result
    }
}

private typealias Grid = List<List<Int>>

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

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

  public final void solve();
    Code:
       0: aload_0
       1: invokespecial #15                 // Method readInput:()Ljava/util/List;
       4: astore_1
       5: new           #17                 // class java/lang/StringBuilder
       8: dup
       9: invokespecial #18                 // Method java/lang/StringBuilder."<init>":()V
      12: ldc           #20                 // String Visible trees:
      14: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      17: aload_0
      18: aload_1
      19: invokespecial #28                 // Method countVisible:(Ljava/util/List;)I
      22: invokevirtual #31                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      25: invokevirtual #35                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      28: getstatic     #41                 // Field java/lang/System.out:Ljava/io/PrintStream;
      31: swap
      32: invokevirtual #47                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      35: new           #17                 // class java/lang/StringBuilder
      38: dup
      39: invokespecial #18                 // Method java/lang/StringBuilder."<init>":()V
      42: ldc           #49                 // String Max scenic score:
      44: invokevirtual #24                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      47: aload_0
      48: aload_1
      49: invokespecial #52                 // Method maxScenicScore:(Ljava/util/List;)I
      52: invokevirtual #31                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      55: invokevirtual #35                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      58: getstatic     #41                 // Field java/lang/System.out:Ljava/io/PrintStream;
      61: swap
      62: invokevirtual #47                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      65: return

  private final java.util.List<java.util.List<java.lang.Integer>> readInput();
    Code:
       0: getstatic     #61                 // Field Forest$readInput$1.INSTANCE:LForest$readInput$1;
       3: checkcast     #63                 // class kotlin/jvm/functions/Function0
       6: invokestatic  #69                 // Method kotlin/sequences/SequencesKt.generateSequence:(Lkotlin/jvm/functions/Function0;)Lkotlin/sequences/Sequence;
       9: invokedynamic #88,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      14: invokestatic  #92                 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      17: invokestatic  #96                 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
      20: areturn

  private final int maxScenicScore(java.util.List<? extends java.util.List<java.lang.Integer>>);
    Code:
       0: iconst_0
       1: istore_2
       2: aload_1
       3: checkcast     #99                 // class java/lang/Iterable
       6: astore_3
       7: iconst_0
       8: istore        4
      10: iconst_0
      11: istore        5
      13: aload_3
      14: invokeinterface #103,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      19: astore        6
      21: aload         6
      23: invokeinterface #109,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      28: ifeq          400
      31: aload         6
      33: invokeinterface #113,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      38: astore        7
      40: iload         5
      42: iinc          5, 1
      45: istore        8
      47: iload         8
      49: ifge          55
      52: invokestatic  #118                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
      55: iload         8
      57: aload         7
      59: checkcast     #120                // class java/util/List
      62: astore        9
      64: istore        10
      66: iconst_0
      67: istore        11
      69: aload         9
      71: checkcast     #99                 // class java/lang/Iterable
      74: astore        12
      76: iconst_0
      77: istore        13
      79: iconst_0
      80: istore        14
      82: aload         12
      84: invokeinterface #103,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      89: astore        15
      91: aload         15
      93: invokeinterface #109,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      98: ifeq          394
     101: aload         15
     103: invokeinterface #113,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     108: astore        16
     110: iload         14
     112: iinc          14, 1
     115: istore        17
     117: iload         17
     119: ifge          125
     122: invokestatic  #118                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     125: iload         17
     127: aload         16
     129: checkcast     #122                // class java/lang/Number
     132: invokevirtual #126                // Method java/lang/Number.intValue:()I
     135: istore        18
     137: istore        19
     139: iconst_0
     140: istore        20
     142: iconst_0
     143: istore        21
     145: iload         19
     147: iconst_1
     148: isub
     149: istore        22
     151: iconst_m1
     152: iload         22
     154: if_icmpge     195
     157: iinc          21, 1
     160: aload_1
     161: iload         10
     163: invokeinterface #130,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     168: checkcast     #120                // class java/util/List
     171: iload         22
     173: invokeinterface #130,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     178: checkcast     #122                // class java/lang/Number
     181: invokevirtual #126                // Method java/lang/Number.intValue:()I
     184: iload         18
     186: if_icmpge     195
     189: iinc          22, -1
     192: goto          151
     195: iconst_0
     196: istore        22
     198: iload         19
     200: iconst_1
     201: iadd
     202: istore        23
     204: aload         9
     206: invokeinterface #133,  1          // InterfaceMethod java/util/List.size:()I
     211: istore        24
     213: iload         23
     215: iload         24
     217: if_icmpge     258
     220: iinc          22, 1
     223: aload_1
     224: iload         10
     226: invokeinterface #130,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     231: checkcast     #120                // class java/util/List
     234: iload         23
     236: invokeinterface #130,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     241: checkcast     #122                // class java/lang/Number
     244: invokevirtual #126                // Method java/lang/Number.intValue:()I
     247: iload         18
     249: if_icmpge     258
     252: iinc          23, 1
     255: goto          213
     258: iconst_0
     259: istore        23
     261: iload         10
     263: iconst_1
     264: isub
     265: istore        24
     267: iconst_m1
     268: iload         24
     270: if_icmpge     311
     273: iinc          23, 1
     276: aload_1
     277: iload         24
     279: invokeinterface #130,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     284: checkcast     #120                // class java/util/List
     287: iload         19
     289: invokeinterface #130,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     294: checkcast     #122                // class java/lang/Number
     297: invokevirtual #126                // Method java/lang/Number.intValue:()I
     300: iload         18
     302: if_icmpge     311
     305: iinc          24, -1
     308: goto          267
     311: iconst_0
     312: istore        24
     314: iload         10
     316: iconst_1
     317: iadd
     318: istore        25
     320: aload_1
     321: invokeinterface #133,  1          // InterfaceMethod java/util/List.size:()I
     326: istore        26
     328: iload         25
     330: iload         26
     332: if_icmpge     373
     335: iinc          24, 1
     338: aload_1
     339: iload         25
     341: invokeinterface #130,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     346: checkcast     #120                // class java/util/List
     349: iload         19
     351: invokeinterface #130,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     356: checkcast     #122                // class java/lang/Number
     359: invokevirtual #126                // Method java/lang/Number.intValue:()I
     362: iload         18
     364: if_icmpge     373
     367: iinc          25, 1
     370: goto          328
     373: iload_2
     374: iload         21
     376: iload         22
     378: imul
     379: iload         23
     381: imul
     382: iload         24
     384: imul
     385: invokestatic  #139                // Method java/lang/Math.max:(II)I
     388: istore_2
     389: nop
     390: nop
     391: goto          91
     394: nop
     395: nop
     396: nop
     397: goto          21
     400: nop
     401: iload_2
     402: ireturn

  private final int countVisible(java.util.List<? extends java.util.List<java.lang.Integer>>);
    Code:
       0: iconst_0
       1: istore_2
       2: aload_1
       3: checkcast     #99                 // class java/lang/Iterable
       6: astore_3
       7: iconst_0
       8: istore        4
      10: iconst_0
      11: istore        5
      13: aload_3
      14: invokeinterface #103,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      19: astore        6
      21: aload         6
      23: invokeinterface #109,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      28: ifeq          423
      31: aload         6
      33: invokeinterface #113,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      38: astore        7
      40: iload         5
      42: iinc          5, 1
      45: istore        8
      47: iload         8
      49: ifge          55
      52: invokestatic  #118                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
      55: iload         8
      57: aload         7
      59: checkcast     #120                // class java/util/List
      62: astore        9
      64: istore        10
      66: iconst_0
      67: istore        11
      69: aload         9
      71: checkcast     #99                 // class java/lang/Iterable
      74: astore        12
      76: iconst_0
      77: istore        13
      79: iconst_0
      80: istore        14
      82: aload         12
      84: invokeinterface #103,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      89: astore        15
      91: aload         15
      93: invokeinterface #109,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      98: ifeq          417
     101: aload         15
     103: invokeinterface #113,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     108: astore        16
     110: iload         14
     112: iinc          14, 1
     115: istore        17
     117: iload         17
     119: ifge          125
     122: invokestatic  #118                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     125: iload         17
     127: aload         16
     129: checkcast     #122                // class java/lang/Number
     132: invokevirtual #126                // Method java/lang/Number.intValue:()I
     135: istore        18
     137: istore        19
     139: iconst_0
     140: istore        20
     142: iload         10
     144: ifeq          179
     147: iload         19
     149: ifeq          179
     152: iload         10
     154: aload_1
     155: invokeinterface #133,  1          // InterfaceMethod java/util/List.size:()I
     160: iconst_1
     161: isub
     162: if_icmpeq     179
     165: iload         19
     167: aload         9
     169: invokeinterface #133,  1          // InterfaceMethod java/util/List.size:()I
     174: iconst_1
     175: isub
     176: if_icmpne     186
     179: iload_2
     180: iconst_1
     181: iadd
     182: istore_2
     183: goto          412
     186: aload         9
     188: iconst_0
     189: iload         19
     191: invokeinterface #166,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
     196: checkcast     #99                 // class java/lang/Iterable
     199: invokestatic  #170                // Method kotlin/collections/CollectionsKt.maxOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     202: checkcast     #122                // class java/lang/Number
     205: invokevirtual #126                // Method java/lang/Number.intValue:()I
     208: iload         18
     210: if_icmpge     220
     213: iload_2
     214: iconst_1
     215: iadd
     216: istore_2
     217: goto          412
     220: aload         9
     222: iload         19
     224: iconst_1
     225: iadd
     226: aload         9
     228: invokeinterface #133,  1          // InterfaceMethod java/util/List.size:()I
     233: invokeinterface #166,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
     238: checkcast     #99                 // class java/lang/Iterable
     241: invokestatic  #170                // Method kotlin/collections/CollectionsKt.maxOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     244: checkcast     #122                // class java/lang/Number
     247: invokevirtual #126                // Method java/lang/Number.intValue:()I
     250: iload         18
     252: if_icmpge     262
     255: iload_2
     256: iconst_1
     257: iadd
     258: istore_2
     259: goto          412
     262: iconst_1
     263: istore        21
     265: iconst_1
     266: istore        22
     268: iconst_0
     269: istore        23
     271: aload_1
     272: checkcast     #172                // class java/util/Collection
     275: invokeinterface #173,  1          // InterfaceMethod java/util/Collection.size:()I
     280: istore        24
     282: iload         23
     284: iload         24
     286: if_icmpge     398
     289: iload         23
     291: iload         10
     293: if_icmpeq     392
     296: iload         21
     298: ifeq          344
     301: iload         23
     303: iload         10
     305: if_icmpge     344
     308: aload_1
     309: iload         23
     311: invokeinterface #130,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     316: checkcast     #120                // class java/util/List
     319: iload         19
     321: invokeinterface #130,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     326: checkcast     #122                // class java/lang/Number
     329: invokevirtual #126                // Method java/lang/Number.intValue:()I
     332: iload         18
     334: if_icmpge     341
     337: iconst_1
     338: goto          342
     341: iconst_0
     342: istore        21
     344: iload         22
     346: ifeq          392
     349: iload         23
     351: iload         10
     353: if_icmple     392
     356: aload_1
     357: iload         23
     359: invokeinterface #130,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     364: checkcast     #120                // class java/util/List
     367: iload         19
     369: invokeinterface #130,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     374: checkcast     #122                // class java/lang/Number
     377: invokevirtual #126                // Method java/lang/Number.intValue:()I
     380: iload         18
     382: if_icmpge     389
     385: iconst_1
     386: goto          390
     389: iconst_0
     390: istore        22
     392: iinc          23, 1
     395: goto          282
     398: iload         21
     400: ifne          408
     403: iload         22
     405: ifeq          412
     408: iload_2
     409: iconst_1
     410: iadd
     411: istore_2
     412: nop
     413: nop
     414: goto          91
     417: nop
     418: nop
     419: nop
     420: goto          21
     423: nop
     424: iload_2
     425: ireturn

  private static final java.util.List readInput$lambda$2(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #182                // String it
       3: invokestatic  #188                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #190                // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #192                // class java/lang/String
      14: astore_1
      15: aload_1
      16: iconst_0
      17: ldc           #194                // String
      19: aastore
      20: aload_1
      21: iconst_0
      22: iconst_0
      23: bipush        6
      25: aconst_null
      26: invokestatic  #200                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      29: checkcast     #99                 // class java/lang/Iterable
      32: astore_1
      33: iconst_0
      34: istore_2
      35: aload_1
      36: astore_3
      37: new           #202                // class java/util/ArrayList
      40: dup
      41: invokespecial #203                // Method java/util/ArrayList."<init>":()V
      44: checkcast     #172                // class java/util/Collection
      47: astore        4
      49: iconst_0
      50: istore        5
      52: aload_3
      53: invokeinterface #103,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      58: astore        6
      60: aload         6
      62: invokeinterface #109,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      67: ifeq          124
      70: aload         6
      72: invokeinterface #113,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      77: astore        7
      79: aload         7
      81: checkcast     #192                // class java/lang/String
      84: astore        8
      86: iconst_0
      87: istore        9
      89: aload         8
      91: checkcast     #190                // class java/lang/CharSequence
      94: invokeinterface #206,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      99: ifne          106
     102: iconst_1
     103: goto          107
     106: iconst_0
     107: nop
     108: ifne          60
     111: aload         4
     113: aload         7
     115: invokeinterface #210,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     120: pop
     121: goto          60
     124: aload         4
     126: checkcast     #120                // class java/util/List
     129: nop
     130: checkcast     #99                 // class java/lang/Iterable
     133: astore_1
     134: nop
     135: iconst_0
     136: istore_2
     137: aload_1
     138: astore_3
     139: new           #202                // class java/util/ArrayList
     142: dup
     143: aload_1
     144: bipush        10
     146: invokestatic  #214                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     149: invokespecial #217                // Method java/util/ArrayList."<init>":(I)V
     152: checkcast     #172                // class java/util/Collection
     155: astore        4
     157: iconst_0
     158: istore        5
     160: aload_3
     161: invokeinterface #103,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     166: astore        6
     168: aload         6
     170: invokeinterface #109,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     175: ifeq          227
     178: aload         6
     180: invokeinterface #113,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     185: astore        7
     187: aload         4
     189: aload         7
     191: checkcast     #192                // class java/lang/String
     194: astore        8
     196: astore        10
     198: iconst_0
     199: istore        9
     201: aload         8
     203: bipush        10
     205: invokestatic  #223                // Method kotlin/text/CharsKt.checkRadix:(I)I
     208: invokestatic  #229                // Method java/lang/Integer.parseInt:(Ljava/lang/String;I)I
     211: nop
     212: invokestatic  #233                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     215: aload         10
     217: swap
     218: invokeinterface #210,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     223: pop
     224: goto          168
     227: aload         4
     229: checkcast     #120                // class java/util/List
     232: nop
     233: areturn

  static {};
    Code:
       0: new           #2                  // class Forest
       3: dup
       4: invokespecial #250                // Method "<init>":()V
       7: putstatic     #252                // Field INSTANCE:LForest;
      10: return
}

Compiled from "Forest.kt"
final class Forest$readInput$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function0<java.lang.String> {
  public static final Forest$readInput$1 INSTANCE;

  Forest$readInput$1();
    Code:
       0: aload_0
       1: iconst_0
       2: ldc           #11                 // class kotlin/io/ConsoleKt
       4: ldc           #13                 // String readLine
       6: ldc           #15                 // String readLine()Ljava/lang/String;
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.String invoke();
    Code:
       0: invokestatic  #24                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: areturn

  public java.lang.Object invoke();
    Code:
       0: aload_0
       1: invokevirtual #27                 // Method invoke:()Ljava/lang/String;
       4: areturn

  static {};
    Code:
       0: new           #2                  // class Forest$readInput$1
       3: dup
       4: invokespecial #30                 // Method "<init>":()V
       7: putstatic     #33                 // Field INSTANCE:LForest$readInput$1;
      10: return
}

Compiled from "Forest.kt"
public final class ForestKt {
  public static final void main();
    Code:
       0: getstatic     #12                 // Field Forest.INSTANCE:LForest;
       3: invokevirtual #15                 // Method Forest.solve:()V
       6: return

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