fun main() = Packets.solve()

private object Packets {
    fun solve() {
        val input = readInput().toMutableList()
        val dividers = setOf(
            Lst(listOf(Lst(listOf(Num(2))))),
            Lst(listOf(Lst(listOf(Num(6)))))
        )
        input.addAll(dividers)
        val sorted = input.sorted()
        println("Problem 2: ${(sorted.indexOf(dividers.first()) + 1) * (sorted.indexOf(dividers.last()) + 1)}")
    }

    private fun readInput(): List<Item> {
        val items = mutableListOf<Item>()
        generateSequence(::readLine).forEach {
            when {
                !it.isEmpty() -> {
                    items.add(parseItem(it))
                }
            }
        }
        return items
    }

    private fun parseItem(line: String): Item {
        fun extractNums(string: String): List<Num> =
            string.split(",").map { it.toIntOrNull(10) }.filterNotNull().map { Num(it) }

        fun parseLst(): Lst {
            val values = mutableListOf<MutableList<Item>>()
            val indices = mutableListOf<Int>()
            var lastGroupClose = 0
            for (i in line.indices) {
                when (line[i]) {
                    '[' -> {
                        if (!indices.isEmpty()) {
                            val substr = line.substring((indices.last() + 1) until i)
                            values.last().addAll(extractNums(substr))
                        }
                        indices.add(i)
                        values.add(mutableListOf())
                    }

                    ']' -> {
                        val from = indices.removeLast()
                        val items = values.removeLast()
                        // Non-empty list
                        val substr = line.substring(
                            (maxOf(from, lastGroupClose) + 1) until i
                        )
                        items.addAll(extractNums(substr))
                        lastGroupClose = i
                        if (values.isEmpty()) {
//                            println("Parsed $items")
                            return Lst(items)
                        } else {
                            values.last().add(Lst(items))
                        }
                    }

                    else -> continue
                }
            }
            throw Error("Did not terminate properly")
        }

        return when (line.first()) {
            '[' -> parseLst()
            else -> Num(line.toInt(10))
        }
    }

    private sealed interface Item : Comparable<Item>

    private data class Num(val value: Int) : Item {
        override fun compareTo(other: Item): Int {
            return when (other) {
                is Num -> value.compareTo(other.value)
                is Lst -> Lst(listOf(this)).compareTo(other)
            }
        }
    }

    private data class Lst(val value: List<Item>) : Item {
        override fun compareTo(other: Item): Int {
            return when (other) {
                is Num -> compareTo(Lst(listOf(other)))
                is Lst -> {
                    for (i in value.indices) {
                        if (i >= other.value.size) {
                            return 1
                        }
                        val cmp = value[i].compareTo(other.value[i])
                        if (cmp != 0) {
                            return cmp
                        }
                    }
                    return value.size.compareTo(other.value.size)
                }
            }
        }
    }
}

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

  private Packets();
    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: checkcast     #17                 // class java/util/Collection
       7: invokestatic  #23                 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;
      10: astore_1
      11: iconst_2
      12: anewarray     #25                 // class Packets$Lst
      15: astore_3
      16: aload_3
      17: iconst_0
      18: new           #25                 // class Packets$Lst
      21: dup
      22: new           #25                 // class Packets$Lst
      25: dup
      26: new           #27                 // class Packets$Num
      29: dup
      30: iconst_2
      31: invokespecial #30                 // Method Packets$Num."<init>":(I)V
      34: invokestatic  #34                 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      37: invokespecial #37                 // Method Packets$Lst."<init>":(Ljava/util/List;)V
      40: invokestatic  #34                 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      43: invokespecial #37                 // Method Packets$Lst."<init>":(Ljava/util/List;)V
      46: aastore
      47: aload_3
      48: iconst_1
      49: new           #25                 // class Packets$Lst
      52: dup
      53: new           #25                 // class Packets$Lst
      56: dup
      57: new           #27                 // class Packets$Num
      60: dup
      61: bipush        6
      63: invokespecial #30                 // Method Packets$Num."<init>":(I)V
      66: invokestatic  #34                 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      69: invokespecial #37                 // Method Packets$Lst."<init>":(Ljava/util/List;)V
      72: invokestatic  #34                 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      75: invokespecial #37                 // Method Packets$Lst."<init>":(Ljava/util/List;)V
      78: aastore
      79: aload_3
      80: invokestatic  #43                 // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
      83: astore_2
      84: aload_1
      85: aload_2
      86: checkcast     #17                 // class java/util/Collection
      89: invokeinterface #49,  2           // InterfaceMethod java/util/List.addAll:(Ljava/util/Collection;)Z
      94: pop
      95: aload_1
      96: checkcast     #51                 // class java/lang/Iterable
      99: invokestatic  #55                 // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
     102: astore_3
     103: new           #57                 // class java/lang/StringBuilder
     106: dup
     107: invokespecial #58                 // Method java/lang/StringBuilder."<init>":()V
     110: ldc           #60                 // String Problem 2:
     112: invokevirtual #64                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     115: aload_3
     116: aload_2
     117: checkcast     #51                 // class java/lang/Iterable
     120: invokestatic  #68                 // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;
     123: invokeinterface #72,  2           // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
     128: iconst_1
     129: iadd
     130: aload_3
     131: aload_2
     132: checkcast     #51                 // class java/lang/Iterable
     135: invokestatic  #75                 // Method kotlin/collections/CollectionsKt.last:(Ljava/lang/Iterable;)Ljava/lang/Object;
     138: invokeinterface #72,  2           // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
     143: iconst_1
     144: iadd
     145: imul
     146: invokevirtual #78                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     149: invokevirtual #82                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     152: getstatic     #88                 // Field java/lang/System.out:Ljava/io/PrintStream;
     155: swap
     156: invokevirtual #94                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     159: return

  private final java.util.List<Packets$Item> readInput();
    Code:
       0: new           #101                // class java/util/ArrayList
       3: dup
       4: invokespecial #102                // Method java/util/ArrayList."<init>":()V
       7: checkcast     #45                 // class java/util/List
      10: astore_1
      11: getstatic     #108                // Field Packets$readInput$1.INSTANCE:LPackets$readInput$1;
      14: checkcast     #110                // class kotlin/jvm/functions/Function0
      17: invokestatic  #116                // Method kotlin/sequences/SequencesKt.generateSequence:(Lkotlin/jvm/functions/Function0;)Lkotlin/sequences/Sequence;
      20: astore_2
      21: iconst_0
      22: istore_3
      23: aload_2
      24: invokeinterface #122,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      29: astore        4
      31: aload         4
      33: invokeinterface #128,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      38: ifeq          102
      41: aload         4
      43: invokeinterface #132,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      48: astore        5
      50: aload         5
      52: checkcast     #134                // class java/lang/String
      55: astore        6
      57: iconst_0
      58: istore        7
      60: nop
      61: aload         6
      63: checkcast     #136                // class java/lang/CharSequence
      66: invokeinterface #140,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      71: ifne          78
      74: iconst_1
      75: goto          79
      78: iconst_0
      79: ifne          97
      82: aload_1
      83: getstatic     #142                // Field INSTANCE:LPackets;
      86: aload         6
      88: invokespecial #146                // Method parseItem:(Ljava/lang/String;)LPackets$Item;
      91: invokeinterface #150,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
      96: pop
      97: nop
      98: nop
      99: goto          31
     102: nop
     103: aload_1
     104: areturn

  private final Packets$Item parseItem(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #136                // class java/lang/CharSequence
       4: invokestatic  #165                // Method kotlin/text/StringsKt.first:(Ljava/lang/CharSequence;)C
       7: bipush        91
       9: if_icmpne     22
      12: aload_1
      13: invokestatic  #169                // Method parseItem$parseLst:(Ljava/lang/String;)LPackets$Lst;
      16: checkcast     #171                // class Packets$Item
      19: goto          41
      22: new           #27                 // class Packets$Num
      25: dup
      26: aload_1
      27: bipush        10
      29: invokestatic  #177                // Method kotlin/text/CharsKt.checkRadix:(I)I
      32: invokestatic  #183                // Method java/lang/Integer.parseInt:(Ljava/lang/String;I)I
      35: invokespecial #30                 // Method Packets$Num."<init>":(I)V
      38: checkcast     #171                // class Packets$Item
      41: areturn

  private static final java.util.List<Packets$Num> parseItem$extractNums(java.lang.String);
    Code:
       0: aload_0
       1: checkcast     #136                // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #134                // class java/lang/String
       8: astore_1
       9: aload_1
      10: iconst_0
      11: ldc           #189                // String ,
      13: aastore
      14: aload_1
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #193                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: checkcast     #51                 // class java/lang/Iterable
      26: astore_1
      27: iconst_0
      28: istore_2
      29: aload_1
      30: astore_3
      31: new           #101                // class java/util/ArrayList
      34: dup
      35: aload_1
      36: bipush        10
      38: invokestatic  #197                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      41: invokespecial #198                // Method java/util/ArrayList."<init>":(I)V
      44: checkcast     #17                 // class java/util/Collection
      47: astore        4
      49: iconst_0
      50: istore        5
      52: aload_3
      53: invokeinterface #199,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      58: astore        6
      60: aload         6
      62: invokeinterface #128,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      67: ifeq          112
      70: aload         6
      72: invokeinterface #132,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      77: astore        7
      79: aload         4
      81: aload         7
      83: checkcast     #134                // class java/lang/String
      86: astore        8
      88: astore        10
      90: iconst_0
      91: istore        9
      93: aload         8
      95: bipush        10
      97: invokestatic  #203                // Method kotlin/text/StringsKt.toIntOrNull:(Ljava/lang/String;I)Ljava/lang/Integer;
     100: aload         10
     102: swap
     103: invokeinterface #204,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     108: pop
     109: goto          60
     112: aload         4
     114: checkcast     #45                 // class java/util/List
     117: nop
     118: checkcast     #51                 // class java/lang/Iterable
     121: invokestatic  #207                // Method kotlin/collections/CollectionsKt.filterNotNull:(Ljava/lang/Iterable;)Ljava/util/List;
     124: checkcast     #51                 // class java/lang/Iterable
     127: astore_1
     128: iconst_0
     129: istore_2
     130: aload_1
     131: astore_3
     132: new           #101                // class java/util/ArrayList
     135: dup
     136: aload_1
     137: bipush        10
     139: invokestatic  #197                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     142: invokespecial #198                // Method java/util/ArrayList."<init>":(I)V
     145: checkcast     #17                 // class java/util/Collection
     148: astore        4
     150: iconst_0
     151: istore        5
     153: aload_3
     154: invokeinterface #199,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     159: astore        6
     161: aload         6
     163: invokeinterface #128,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     168: ifeq          218
     171: aload         6
     173: invokeinterface #132,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     178: astore        7
     180: aload         4
     182: aload         7
     184: checkcast     #209                // class java/lang/Number
     187: invokevirtual #212                // Method java/lang/Number.intValue:()I
     190: istore        8
     192: astore        10
     194: iconst_0
     195: istore        9
     197: new           #27                 // class Packets$Num
     200: dup
     201: iload         8
     203: invokespecial #30                 // Method Packets$Num."<init>":(I)V
     206: aload         10
     208: swap
     209: invokeinterface #204,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     214: pop
     215: goto          161
     218: aload         4
     220: checkcast     #45                 // class java/util/List
     223: nop
     224: areturn

  private static final Packets$Lst parseItem$parseLst(java.lang.String);
    Code:
       0: new           #101                // class java/util/ArrayList
       3: dup
       4: invokespecial #102                // Method java/util/ArrayList."<init>":()V
       7: checkcast     #45                 // class java/util/List
      10: astore_1
      11: new           #101                // class java/util/ArrayList
      14: dup
      15: invokespecial #102                // Method java/util/ArrayList."<init>":()V
      18: checkcast     #45                 // class java/util/List
      21: astore_2
      22: iconst_0
      23: istore_3
      24: iconst_0
      25: istore        4
      27: aload_0
      28: checkcast     #136                // class java/lang/CharSequence
      31: invokeinterface #140,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      36: istore        5
      38: iload         4
      40: iload         5
      42: if_icmpge     288
      45: aload_0
      46: iload         4
      48: invokevirtual #227                // Method java/lang/String.charAt:(I)C
      51: tableswitch   { // 91 to 93
                    91: 76
                    92: 278
                    93: 160
               default: 278
          }
      76: aload_2
      77: invokeinterface #230,  1          // InterfaceMethod java/util/List.isEmpty:()Z
      82: ifne          129
      85: aload_0
      86: aload_2
      87: invokestatic  #233                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      90: checkcast     #209                // class java/lang/Number
      93: invokevirtual #212                // Method java/lang/Number.intValue:()I
      96: iconst_1
      97: iadd
      98: iload         4
     100: invokestatic  #239                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     103: invokestatic  #243                // Method kotlin/text/StringsKt.substring:(Ljava/lang/String;Lkotlin/ranges/IntRange;)Ljava/lang/String;
     106: astore        6
     108: aload_1
     109: invokestatic  #233                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     112: checkcast     #45                 // class java/util/List
     115: aload         6
     117: invokestatic  #245                // Method parseItem$extractNums:(Ljava/lang/String;)Ljava/util/List;
     120: checkcast     #17                 // class java/util/Collection
     123: invokeinterface #49,  2           // InterfaceMethod java/util/List.addAll:(Ljava/util/Collection;)Z
     128: pop
     129: aload_2
     130: iload         4
     132: invokestatic  #249                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     135: invokeinterface #150,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     140: pop
     141: aload_1
     142: new           #101                // class java/util/ArrayList
     145: dup
     146: invokespecial #102                // Method java/util/ArrayList."<init>":()V
     149: checkcast     #45                 // class java/util/List
     152: invokeinterface #150,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     157: goto          281
     160: aload_2
     161: invokeinterface #252,  1          // InterfaceMethod java/util/List.removeLast:()Ljava/lang/Object;
     166: dup
     167: ldc           #254                // String removeLast(...)
     169: invokestatic  #260                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     172: checkcast     #209                // class java/lang/Number
     175: invokevirtual #212                // Method java/lang/Number.intValue:()I
     178: istore        6
     180: aload_1
     181: invokeinterface #252,  1          // InterfaceMethod java/util/List.removeLast:()Ljava/lang/Object;
     186: dup
     187: ldc           #254                // String removeLast(...)
     189: invokestatic  #260                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     192: checkcast     #45                 // class java/util/List
     195: astore        7
     197: aload_0
     198: iload         6
     200: iload_3
     201: invokestatic  #266                // Method java/lang/Math.max:(II)I
     204: iconst_1
     205: iadd
     206: iload         4
     208: invokestatic  #239                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     211: invokestatic  #243                // Method kotlin/text/StringsKt.substring:(Ljava/lang/String;Lkotlin/ranges/IntRange;)Ljava/lang/String;
     214: astore        8
     216: aload         7
     218: aload         8
     220: invokestatic  #245                // Method parseItem$extractNums:(Ljava/lang/String;)Ljava/util/List;
     223: checkcast     #17                 // class java/util/Collection
     226: invokeinterface #49,  2           // InterfaceMethod java/util/List.addAll:(Ljava/util/Collection;)Z
     231: pop
     232: iload         4
     234: istore_3
     235: aload_1
     236: invokeinterface #230,  1          // InterfaceMethod java/util/List.isEmpty:()Z
     241: ifeq          254
     244: new           #25                 // class Packets$Lst
     247: dup
     248: aload         7
     250: invokespecial #37                 // Method Packets$Lst."<init>":(Ljava/util/List;)V
     253: areturn
     254: aload_1
     255: invokestatic  #233                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     258: checkcast     #45                 // class java/util/List
     261: new           #25                 // class Packets$Lst
     264: dup
     265: aload         7
     267: invokespecial #37                 // Method Packets$Lst."<init>":(Ljava/util/List;)V
     270: invokeinterface #150,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     275: goto          281
     278: goto          282
     281: pop
     282: iinc          4, 1
     285: goto          38
     288: new           #268                // class java/lang/Error
     291: dup
     292: ldc_w         #270                // String Did not terminate properly
     295: invokespecial #273                // Method java/lang/Error."<init>":(Ljava/lang/String;)V
     298: athrow

  static {};
    Code:
       0: new           #2                  // class Packets
       3: dup
       4: invokespecial #282                // Method "<init>":()V
       7: putstatic     #142                // Field INSTANCE:LPackets;
      10: return
}

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

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

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

  Packets$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 Packets$readInput$1
       3: dup
       4: invokespecial #30                 // Method "<init>":()V
       7: putstatic     #33                 // Field INSTANCE:LPackets$readInput$1;
      10: return
}

Compiled from "Packets.kt"
final class Packets$Lst implements Packets$Item {
  private final java.util.List<Packets$Item> value;

  public Packets$Lst(java.util.List<? extends Packets$Item>);
    Code:
       0: aload_1
       1: ldc           #12                 // String value
       3: invokestatic  #18                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #21                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #24                 // Field value:Ljava/util/List;
      15: return

  public final java.util.List<Packets$Item> getValue();
    Code:
       0: aload_0
       1: getfield      #24                 // Field value:Ljava/util/List;
       4: areturn

  public int compareTo(Packets$Item);
    Code:
       0: aload_1
       1: ldc           #33                 // String other
       3: invokestatic  #18                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: astore_2
       8: aload_2
       9: instanceof    #35                 // class Packets$Num
      12: ifeq          36
      15: aload_0
      16: new           #2                  // class Packets$Lst
      19: dup
      20: aload_1
      21: invokestatic  #41                 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      24: invokespecial #43                 // Method "<init>":(Ljava/util/List;)V
      27: checkcast     #6                  // class Packets$Item
      30: invokevirtual #45                 // Method compareTo:(LPackets$Item;)I
      33: goto          163
      36: aload_2
      37: instanceof    #2                  // class Packets$Lst
      40: ifeq          155
      43: iconst_0
      44: istore_3
      45: aload_0
      46: getfield      #24                 // Field value:Ljava/util/List;
      49: checkcast     #47                 // class java/util/Collection
      52: invokeinterface #51,  1           // InterfaceMethod java/util/Collection.size:()I
      57: istore        4
      59: iload_3
      60: iload         4
      62: if_icmpge     130
      65: iload_3
      66: aload_1
      67: checkcast     #2                  // class Packets$Lst
      70: getfield      #24                 // Field value:Ljava/util/List;
      73: invokeinterface #54,  1           // InterfaceMethod java/util/List.size:()I
      78: if_icmplt     83
      81: iconst_1
      82: ireturn
      83: aload_0
      84: getfield      #24                 // Field value:Ljava/util/List;
      87: iload_3
      88: invokeinterface #58,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      93: checkcast     #6                  // class Packets$Item
      96: aload_1
      97: checkcast     #2                  // class Packets$Lst
     100: getfield      #24                 // Field value:Ljava/util/List;
     103: iload_3
     104: invokeinterface #58,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     109: invokeinterface #61,  2           // InterfaceMethod Packets$Item.compareTo:(Ljava/lang/Object;)I
     114: istore        5
     116: iload         5
     118: ifeq          124
     121: iload         5
     123: ireturn
     124: iinc          3, 1
     127: goto          59
     130: aload_0
     131: getfield      #24                 // Field value:Ljava/util/List;
     134: invokeinterface #54,  1           // InterfaceMethod java/util/List.size:()I
     139: aload_1
     140: checkcast     #2                  // class Packets$Lst
     143: getfield      #24                 // Field value:Ljava/util/List;
     146: invokeinterface #54,  1           // InterfaceMethod java/util/List.size:()I
     151: invokestatic  #65                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
     154: ireturn
     155: new           #67                 // class kotlin/NoWhenBranchMatchedException
     158: dup
     159: invokespecial #68                 // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     162: athrow
     163: ireturn

  public final java.util.List<Packets$Item> component1();
    Code:
       0: aload_0
       1: getfield      #24                 // Field value:Ljava/util/List;
       4: areturn

  public final Packets$Lst copy(java.util.List<? extends Packets$Item>);
    Code:
       0: aload_1
       1: ldc           #12                 // String value
       3: invokestatic  #18                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class Packets$Lst
       9: dup
      10: aload_1
      11: invokespecial #43                 // Method "<init>":(Ljava/util/List;)V
      14: areturn

  public static Packets$Lst copy$default(Packets$Lst, java.util.List, int, java.lang.Object);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #24                 // Field value:Ljava/util/List;
      10: astore_1
      11: aload_0
      12: aload_1
      13: invokevirtual #80                 // Method copy:(Ljava/util/List;)LPackets$Lst;
      16: areturn

  public java.lang.String toString();
    Code:
       0: new           #84                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #85                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #87                 // String Lst(value=
       9: invokevirtual #91                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #24                 // Field value:Ljava/util/List;
      16: invokevirtual #94                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      19: bipush        41
      21: invokevirtual #97                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      24: invokevirtual #99                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      27: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #24                 // Field value:Ljava/util/List;
       4: invokevirtual #102                // Method java/lang/Object.hashCode:()I
       7: 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 Packets$Lst
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Packets$Lst
      20: astore_2
      21: aload_0
      22: getfield      #24                 // Field value:Ljava/util/List;
      25: aload_2
      26: getfield      #24                 // Field value:Ljava/util/List;
      29: invokestatic  #109                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: iconst_1
      38: ireturn

  public int compareTo(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #6                  // class Packets$Item
       5: invokevirtual #45                 // Method compareTo:(LPackets$Item;)I
       8: ireturn
}

Compiled from "Packets.kt"
final class Packets$Num implements Packets$Item {
  private final int value;

  public Packets$Num(int);
    Code:
       0: aload_0
       1: invokespecial #11                 // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #15                 // Field value:I
       9: return

  public final int getValue();
    Code:
       0: aload_0
       1: getfield      #15                 // Field value:I
       4: ireturn

  public int compareTo(Packets$Item);
    Code:
       0: aload_1
       1: ldc           #24                 // String other
       3: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: astore_2
       8: aload_2
       9: instanceof    #2                  // class Packets$Num
      12: ifeq          32
      15: aload_0
      16: getfield      #15                 // Field value:I
      19: aload_1
      20: checkcast     #2                  // class Packets$Num
      23: getfield      #15                 // Field value:I
      26: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      29: goto          65
      32: aload_2
      33: instanceof    #36                 // class Packets$Lst
      36: ifeq          57
      39: new           #36                 // class Packets$Lst
      42: dup
      43: aload_0
      44: invokestatic  #42                 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      47: invokespecial #45                 // Method Packets$Lst."<init>":(Ljava/util/List;)V
      50: aload_1
      51: invokevirtual #47                 // Method Packets$Lst.compareTo:(LPackets$Item;)I
      54: goto          65
      57: new           #49                 // class kotlin/NoWhenBranchMatchedException
      60: dup
      61: invokespecial #50                 // Method kotlin/NoWhenBranchMatchedException."<init>":()V
      64: athrow
      65: ireturn

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

  public final Packets$Num copy(int);
    Code:
       0: new           #2                  // class Packets$Num
       3: dup
       4: iload_1
       5: invokespecial #56                 // Method "<init>":(I)V
       8: areturn

  public static Packets$Num copy$default(Packets$Num, int, int, java.lang.Object);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #15                 // Field value:I
      10: istore_1
      11: aload_0
      12: iload_1
      13: invokevirtual #60                 // Method copy:(I)LPackets$Num;
      16: areturn

  public java.lang.String toString();
    Code:
       0: new           #64                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #65                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #67                 // String Num(value=
       9: invokevirtual #71                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #15                 // Field value:I
      16: invokevirtual #74                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: bipush        41
      21: invokevirtual #77                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      24: invokevirtual #79                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      27: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #15                 // Field value:I
       4: invokestatic  #85                 // Method java/lang/Integer.hashCode:(I)I
       7: 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 Packets$Num
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Packets$Num
      20: astore_2
      21: aload_0
      22: getfield      #15                 // Field value:I
      25: aload_2
      26: getfield      #15                 // Field value:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: iconst_1
      35: ireturn

  public int compareTo(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #6                  // class Packets$Item
       5: invokevirtual #91                 // Method compareTo:(LPackets$Item;)I
       8: ireturn
}

Compiled from "Packets.kt"
interface Packets$Item extends java.lang.Comparable<Packets$Item> {
}


fun main() {
    DirWalk.solve()
}

private object DirWalk {
    fun solve() {
        val tree = buildTree(readInput())
        val sizes = getDirSizes(tree)
//        for (size in sizes) {
//            println("${size.key.name} ${size.value}")
//        }
        val smallDirsTotal = sizes.filter { it.value <= 100_000 }.values.sum()
        println("Small dirs total: $smallDirsTotal")
        val totalSpace = 70_000_000
        val targetFreeSpace = 30_000_000
        val spaceToFree = targetFreeSpace - (totalSpace - sizes.getValue(tree))
        println("Space to free: $spaceToFree")
        val sortedDirs = sizes.toList().sortedBy { it.second }
        val smallestToDelete = sortedDirs.find { it.second >= spaceToFree }
        println("Delete dir ${smallestToDelete?.first?.name}, size: ${smallestToDelete?.second}")
    }

    private fun readInput(): Sequence<Input> {
        return generateSequence(::readLine).map(::parseLine)
    }

    private fun buildTree(input: Sequence<Input>): Dir {
        val root = Dir("/", mutableListOf<Node>())
        var dir: Dir = root
        val stack = mutableListOf<Dir>()
        for (item in input) {
            when (item) {
                is CommandCd -> {
                    when (item.path) {
                        "/" -> {
                            dir = root
                            stack.clear()
                            stack.add(dir)
                        }
                        ".." -> {
                            stack.removeLast()
                            dir = stack.last()
                        }
                        else -> {
                            dir = dir.items.find { if (it is Dir) it.name == item.path else false } as Dir
                            stack.add(dir)
                        }
                    }
                }
                is CommandLs -> {}
                is File -> dir.items.add(item)
                is Dir -> dir.items.add(item)
            }
        }
        return root
    }

    private fun parseLine(line: String): Input {
        return when {
            line == "$ ls" -> CommandLs()
            line.startsWith("$ cd") -> CommandCd(line.substringAfter("$ cd "))
            line.startsWith("dir") -> Dir(line.substringAfter("dir "))
            else -> {
                val parts = line.split(" ")
                val size = parts[0].toInt(10)
                File(parts[1],size)
            }
        }
    }

    private fun getDirSizes(root: Dir): Map<Dir, Int> {
        val result = mutableMapOf<Dir, Int>()
        fun walk(dir: Dir) {
            var current = 0
            for (item in dir.items) {
                current += when (item) {
                    is File -> item.size
                    is Dir -> {
                        walk(item)
                        result.getValue(item)
                    }
                }
            }
            result[dir] = current
        }
        walk(root)
        return result
    }

    sealed interface Input
    data class CommandCd(val path: String) : Input
    data class CommandLs(val path: String = ""): Input

    sealed interface Node
    data class File(val name: String, val size: Int): Node, Input
    data class Dir(val name: String, val items: MutableList<Node> = mutableListOf()): Node, Input
}

Compiled from "DirWalk.kt"
public final class DirWalk$CommandLs implements DirWalk$Input {
  private final java.lang.String path;

  public DirWalk$CommandLs(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #11                 // String path
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #20                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #23                 // Field path:Ljava/lang/String;
      15: return

  public DirWalk$CommandLs(java.lang.String, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          9
       6: ldc           #28                 // String
       8: astore_1
       9: aload_0
      10: aload_1
      11: invokespecial #30                 // Method "<init>":(Ljava/lang/String;)V
      14: return

  public final java.lang.String getPath();
    Code:
       0: aload_0
       1: getfield      #23                 // Field path:Ljava/lang/String;
       4: areturn

  public final java.lang.String component1();
    Code:
       0: aload_0
       1: getfield      #23                 // Field path:Ljava/lang/String;
       4: areturn

  public final DirWalk$CommandLs copy(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #11                 // String path
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class DirWalk$CommandLs
       9: dup
      10: aload_1
      11: invokespecial #30                 // Method "<init>":(Ljava/lang/String;)V
      14: areturn

  public static DirWalk$CommandLs copy$default(DirWalk$CommandLs, java.lang.String, int, java.lang.Object);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #23                 // Field path:Ljava/lang/String;
      10: astore_1
      11: aload_0
      12: aload_1
      13: invokevirtual #39                 // Method copy:(Ljava/lang/String;)LDirWalk$CommandLs;
      16: areturn

  public java.lang.String toString();
    Code:
       0: new           #42                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #43                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #45                 // String CommandLs(path=
       9: invokevirtual #49                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #23                 // Field path:Ljava/lang/String;
      16: invokevirtual #49                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: bipush        41
      21: invokevirtual #52                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      24: invokevirtual #54                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      27: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #23                 // Field path:Ljava/lang/String;
       4: invokevirtual #60                 // Method java/lang/String.hashCode:()I
       7: 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 DirWalk$CommandLs
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class DirWalk$CommandLs
      20: astore_2
      21: aload_0
      22: getfield      #23                 // Field path:Ljava/lang/String;
      25: aload_2
      26: getfield      #23                 // Field path:Ljava/lang/String;
      29: invokestatic  #67                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: iconst_1
      38: ireturn

  public DirWalk$CommandLs();
    Code:
       0: aload_0
       1: aconst_null
       2: iconst_1
       3: aconst_null
       4: invokespecial #71                 // Method "<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return
}

Compiled from "DirWalk.kt"
public final class DirWalk$Dir implements DirWalk$Node,DirWalk$Input {
  private final java.lang.String name;

  private final java.util.List<DirWalk$Node> items;

  public DirWalk$Dir(java.lang.String, java.util.List<DirWalk$Node>);
    Code:
       0: aload_1
       1: ldc           #14                 // String name
       3: invokestatic  #20                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #22                 // String items
       9: invokestatic  #20                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokespecial #25                 // Method java/lang/Object."<init>":()V
      16: aload_0
      17: aload_1
      18: putfield      #28                 // Field name:Ljava/lang/String;
      21: aload_0
      22: aload_2
      23: putfield      #31                 // Field items:Ljava/util/List;
      26: return

  public DirWalk$Dir(java.lang.String, java.util.List, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: iload_3
       1: iconst_2
       2: iand
       3: ifeq          17
       6: new           #36                 // class java/util/ArrayList
       9: dup
      10: invokespecial #37                 // Method java/util/ArrayList."<init>":()V
      13: checkcast     #39                 // class java/util/List
      16: astore_2
      17: aload_0
      18: aload_1
      19: aload_2
      20: invokespecial #41                 // Method "<init>":(Ljava/lang/String;Ljava/util/List;)V
      23: return

  public final java.lang.String getName();
    Code:
       0: aload_0
       1: getfield      #28                 // Field name:Ljava/lang/String;
       4: areturn

  public final java.util.List<DirWalk$Node> getItems();
    Code:
       0: aload_0
       1: getfield      #31                 // Field items:Ljava/util/List;
       4: areturn

  public final java.lang.String component1();
    Code:
       0: aload_0
       1: getfield      #28                 // Field name:Ljava/lang/String;
       4: areturn

  public final java.util.List<DirWalk$Node> component2();
    Code:
       0: aload_0
       1: getfield      #31                 // Field items:Ljava/util/List;
       4: areturn

  public final DirWalk$Dir copy(java.lang.String, java.util.List<DirWalk$Node>);
    Code:
       0: aload_1
       1: ldc           #14                 // String name
       3: invokestatic  #20                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #22                 // String items
       9: invokestatic  #20                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #2                  // class DirWalk$Dir
      15: dup
      16: aload_1
      17: aload_2
      18: invokespecial #41                 // Method "<init>":(Ljava/lang/String;Ljava/util/List;)V
      21: areturn

  public static DirWalk$Dir copy$default(DirWalk$Dir, java.lang.String, java.util.List, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #28                 // Field name:Ljava/lang/String;
      10: astore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #31                 // Field items:Ljava/util/List;
      21: astore_2
      22: aload_0
      23: aload_1
      24: aload_2
      25: invokevirtual #55                 // Method copy:(Ljava/lang/String;Ljava/util/List;)LDirWalk$Dir;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #58                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #59                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #61                 // String Dir(name=
       9: invokevirtual #65                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #28                 // Field name:Ljava/lang/String;
      16: invokevirtual #65                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: ldc           #67                 // String , items=
      21: invokevirtual #65                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #31                 // Field items:Ljava/util/List;
      28: invokevirtual #70                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #73                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #75                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #28                 // Field name:Ljava/lang/String;
       4: invokevirtual #81                 // Method java/lang/String.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #31                 // Field items:Ljava/util/List;
      16: invokevirtual #82                 // Method java/lang/Object.hashCode:()I
      19: iadd
      20: istore_1
      21: iload_1
      22: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class DirWalk$Dir
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class DirWalk$Dir
      20: astore_2
      21: aload_0
      22: getfield      #28                 // Field name:Ljava/lang/String;
      25: aload_2
      26: getfield      #28                 // Field name:Ljava/lang/String;
      29: invokestatic  #91                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #31                 // Field items:Ljava/util/List;
      41: aload_2
      42: getfield      #31                 // Field items:Ljava/util/List;
      45: invokestatic  #91                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifne          53
      51: iconst_0
      52: ireturn
      53: iconst_1
      54: ireturn
}

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

  public final DirWalk$Input invoke(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #26                 // String p0
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #34                 // Field receiver:Ljava/lang/Object;
      10: checkcast     #11                 // class DirWalk
      13: aload_1
      14: invokestatic  #38                 // Method DirWalk.access$parseLine:(LDirWalk;Ljava/lang/String;)LDirWalk$Input;
      17: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #42                 // class java/lang/String
       5: invokevirtual #44                 // Method invoke:(Ljava/lang/String;)LDirWalk$Input;
       8: areturn
}

Compiled from "DirWalk.kt"
public final class DirWalk$File implements DirWalk$Node,DirWalk$Input {
  private final java.lang.String name;

  private final int size;

  public DirWalk$File(java.lang.String, int);
    Code:
       0: aload_1
       1: ldc           #13                 // String name
       3: invokestatic  #19                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #22                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #25                 // Field name:Ljava/lang/String;
      15: aload_0
      16: iload_2
      17: putfield      #29                 // Field size:I
      20: return

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

  public final int getSize();
    Code:
       0: aload_0
       1: getfield      #29                 // Field size:I
       4: ireturn

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

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

  public final DirWalk$File copy(java.lang.String, int);
    Code:
       0: aload_1
       1: ldc           #13                 // String name
       3: invokestatic  #19                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class DirWalk$File
       9: dup
      10: aload_1
      11: iload_2
      12: invokespecial #41                 // Method "<init>":(Ljava/lang/String;I)V
      15: areturn

  public static DirWalk$File copy$default(DirWalk$File, java.lang.String, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #25                 // Field name:Ljava/lang/String;
      10: astore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #29                 // Field size:I
      21: istore_2
      22: aload_0
      23: aload_1
      24: iload_2
      25: invokevirtual #45                 // Method copy:(Ljava/lang/String;I)LDirWalk$File;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #48                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #49                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #51                 // String File(name=
       9: invokevirtual #55                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #25                 // Field name:Ljava/lang/String;
      16: invokevirtual #55                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: ldc           #57                 // String , size=
      21: invokevirtual #55                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #29                 // Field size:I
      28: invokevirtual #60                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #63                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #65                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #25                 // Field name:Ljava/lang/String;
       4: invokevirtual #70                 // Method java/lang/String.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #29                 // Field size:I
      16: invokestatic  #75                 // 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 DirWalk$File
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class DirWalk$File
      20: astore_2
      21: aload_0
      22: getfield      #25                 // Field name:Ljava/lang/String;
      25: aload_2
      26: getfield      #25                 // Field name:Ljava/lang/String;
      29: invokestatic  #83                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #29                 // Field size:I
      41: aload_2
      42: getfield      #29                 // Field size:I
      45: if_icmpeq     50
      48: iconst_0
      49: ireturn
      50: iconst_1
      51: ireturn
}

Compiled from "DirWalk.kt"
public interface DirWalk$Input {
}

Compiled from "DirWalk.kt"
public final class DirWalk$CommandCd implements DirWalk$Input {
  private final java.lang.String path;

  public DirWalk$CommandCd(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #11                 // String path
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #20                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #23                 // Field path:Ljava/lang/String;
      15: return

  public final java.lang.String getPath();
    Code:
       0: aload_0
       1: getfield      #23                 // Field path:Ljava/lang/String;
       4: areturn

  public final java.lang.String component1();
    Code:
       0: aload_0
       1: getfield      #23                 // Field path:Ljava/lang/String;
       4: areturn

  public final DirWalk$CommandCd copy(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #11                 // String path
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class DirWalk$CommandCd
       9: dup
      10: aload_1
      11: invokespecial #32                 // Method "<init>":(Ljava/lang/String;)V
      14: areturn

  public static DirWalk$CommandCd copy$default(DirWalk$CommandCd, java.lang.String, int, java.lang.Object);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #23                 // Field path:Ljava/lang/String;
      10: astore_1
      11: aload_0
      12: aload_1
      13: invokevirtual #36                 // Method copy:(Ljava/lang/String;)LDirWalk$CommandCd;
      16: areturn

  public java.lang.String toString();
    Code:
       0: new           #39                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #40                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #42                 // String CommandCd(path=
       9: invokevirtual #46                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #23                 // Field path:Ljava/lang/String;
      16: invokevirtual #46                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: bipush        41
      21: invokevirtual #49                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      24: invokevirtual #51                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      27: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #23                 // Field path:Ljava/lang/String;
       4: invokevirtual #57                 // Method java/lang/String.hashCode:()I
       7: 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 DirWalk$CommandCd
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class DirWalk$CommandCd
      20: astore_2
      21: aload_0
      22: getfield      #23                 // Field path:Ljava/lang/String;
      25: aload_2
      26: getfield      #23                 // Field path:Ljava/lang/String;
      29: invokestatic  #64                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: iconst_1
      38: ireturn
}

Compiled from "DirWalk.kt"
public interface DirWalk$Node {
}

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

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

  public final void solve();
    Code:
       0: aload_0
       1: aload_0
       2: invokespecial #15                 // Method readInput:()Lkotlin/sequences/Sequence;
       5: invokespecial #19                 // Method buildTree:(Lkotlin/sequences/Sequence;)LDirWalk$Dir;
       8: astore_1
       9: aload_0
      10: aload_1
      11: invokespecial #23                 // Method getDirSizes:(LDirWalk$Dir;)Ljava/util/Map;
      14: astore_2
      15: aload_2
      16: astore        4
      18: iconst_0
      19: istore        5
      21: aload         4
      23: astore        6
      25: new           #25                 // class java/util/LinkedHashMap
      28: dup
      29: invokespecial #26                 // Method java/util/LinkedHashMap."<init>":()V
      32: checkcast     #28                 // class java/util/Map
      35: astore        7
      37: iconst_0
      38: istore        8
      40: aload         6
      42: invokeinterface #32,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      47: invokeinterface #38,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      52: astore        9
      54: aload         9
      56: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      61: ifeq          134
      64: aload         9
      66: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      71: checkcast     #50                 // class java/util/Map$Entry
      74: astore        10
      76: aload         10
      78: astore        11
      80: iconst_0
      81: istore        12
      83: aload         11
      85: invokeinterface #53,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
      90: checkcast     #55                 // class java/lang/Number
      93: invokevirtual #59                 // Method java/lang/Number.intValue:()I
      96: ldc           #60                 // int 100000
      98: if_icmpgt     105
     101: iconst_1
     102: goto          106
     105: iconst_0
     106: ifeq          54
     109: aload         7
     111: aload         10
     113: invokeinterface #63,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     118: aload         10
     120: invokeinterface #53,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     125: invokeinterface #67,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     130: pop
     131: goto          54
     134: aload         7
     136: nop
     137: invokeinterface #71,  1           // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
     142: checkcast     #73                 // class java/lang/Iterable
     145: invokestatic  #79                 // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     148: istore_3
     149: new           #81                 // class java/lang/StringBuilder
     152: dup
     153: invokespecial #82                 // Method java/lang/StringBuilder."<init>":()V
     156: ldc           #84                 // String Small dirs total:
     158: invokevirtual #88                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     161: iload_3
     162: invokevirtual #91                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     165: invokevirtual #95                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     168: getstatic     #101                // Field java/lang/System.out:Ljava/io/PrintStream;
     171: swap
     172: invokevirtual #107                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     175: ldc           #108                // int 70000000
     177: istore        4
     179: ldc           #109                // int 30000000
     181: istore        5
     183: iload         5
     185: iload         4
     187: aload_2
     188: aload_1
     189: invokestatic  #114                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
     192: checkcast     #55                 // class java/lang/Number
     195: invokevirtual #59                 // Method java/lang/Number.intValue:()I
     198: isub
     199: isub
     200: istore        6
     202: new           #81                 // class java/lang/StringBuilder
     205: dup
     206: invokespecial #82                 // Method java/lang/StringBuilder."<init>":()V
     209: ldc           #116                // String Space to free:
     211: invokevirtual #88                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     214: iload         6
     216: invokevirtual #91                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     219: invokevirtual #95                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     222: getstatic     #101                // Field java/lang/System.out:Ljava/io/PrintStream;
     225: swap
     226: invokevirtual #107                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     229: aload_2
     230: invokestatic  #120                // Method kotlin/collections/MapsKt.toList:(Ljava/util/Map;)Ljava/util/List;
     233: checkcast     #73                 // class java/lang/Iterable
     236: astore        8
     238: iconst_0
     239: istore        9
     241: aload         8
     243: new           #122                // class DirWalk$solve$$inlined$sortedBy$1
     246: dup
     247: invokespecial #123                // Method DirWalk$solve$$inlined$sortedBy$1."<init>":()V
     250: checkcast     #125                // class java/util/Comparator
     253: invokestatic  #129                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     256: astore        7
     258: aload         7
     260: checkcast     #73                 // class java/lang/Iterable
     263: astore        10
     265: aload         10
     267: invokeinterface #130,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     272: astore        11
     274: aload         11
     276: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     281: ifeq          332
     284: aload         11
     286: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     291: astore        12
     293: aload         12
     295: checkcast     #132                // class kotlin/Pair
     298: astore        13
     300: iconst_0
     301: istore        14
     303: aload         13
     305: invokevirtual #135                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     308: checkcast     #55                 // class java/lang/Number
     311: invokevirtual #59                 // Method java/lang/Number.intValue:()I
     314: iload         6
     316: if_icmplt     323
     319: iconst_1
     320: goto          324
     323: iconst_0
     324: ifeq          274
     327: aload         12
     329: goto          333
     332: aconst_null
     333: checkcast     #132                // class kotlin/Pair
     336: astore        8
     338: new           #81                 // class java/lang/StringBuilder
     341: dup
     342: invokespecial #82                 // Method java/lang/StringBuilder."<init>":()V
     345: ldc           #137                // String Delete dir
     347: invokevirtual #88                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     350: aload         8
     352: dup
     353: ifnull        372
     356: invokevirtual #140                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     359: checkcast     #142                // class DirWalk$Dir
     362: dup
     363: ifnull        372
     366: invokevirtual #145                // Method DirWalk$Dir.getName:()Ljava/lang/String;
     369: goto          374
     372: pop
     373: aconst_null
     374: invokevirtual #88                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     377: ldc           #147                // String , size:
     379: invokevirtual #88                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     382: aload         8
     384: dup
     385: ifnull        397
     388: invokevirtual #135                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     391: checkcast     #149                // class java/lang/Integer
     394: goto          399
     397: pop
     398: aconst_null
     399: invokevirtual #152                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     402: invokevirtual #95                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     405: getstatic     #101                // Field java/lang/System.out:Ljava/io/PrintStream;
     408: swap
     409: invokevirtual #107                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     412: return

  private final kotlin.sequences.Sequence<DirWalk$Input> readInput();
    Code:
       0: getstatic     #189                // Field DirWalk$readInput$1.INSTANCE:LDirWalk$readInput$1;
       3: checkcast     #191                // class kotlin/jvm/functions/Function0
       6: invokestatic  #197                // Method kotlin/sequences/SequencesKt.generateSequence:(Lkotlin/jvm/functions/Function0;)Lkotlin/sequences/Sequence;
       9: new           #199                // class DirWalk$readInput$2
      12: dup
      13: aload_0
      14: invokespecial #201                // Method DirWalk$readInput$2."<init>":(Ljava/lang/Object;)V
      17: checkcast     #203                // class kotlin/jvm/functions/Function1
      20: invokestatic  #207                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      23: areturn

  private final DirWalk$Dir buildTree(kotlin.sequences.Sequence<? extends DirWalk$Input>);
    Code:
       0: new           #142                // class DirWalk$Dir
       3: dup
       4: ldc           #210                // String /
       6: new           #212                // class java/util/ArrayList
       9: dup
      10: invokespecial #213                // Method java/util/ArrayList."<init>":()V
      13: checkcast     #180                // class java/util/List
      16: invokespecial #216                // Method DirWalk$Dir."<init>":(Ljava/lang/String;Ljava/util/List;)V
      19: astore_2
      20: aload_2
      21: astore_3
      22: new           #212                // class java/util/ArrayList
      25: dup
      26: invokespecial #213                // Method java/util/ArrayList."<init>":()V
      29: checkcast     #180                // class java/util/List
      32: astore        4
      34: aload_1
      35: invokeinterface #219,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
      40: astore        5
      42: aload         5
      44: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      49: ifeq          319
      52: aload         5
      54: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      59: checkcast     #221                // class DirWalk$Input
      62: astore        6
      64: aload         6
      66: astore        7
      68: aload         7
      70: instanceof    #223                // class DirWalk$CommandCd
      73: ifeq          257
      76: aload         6
      78: checkcast     #223                // class DirWalk$CommandCd
      81: invokevirtual #226                // Method DirWalk$CommandCd.getPath:()Ljava/lang/String;
      84: astore        8
      86: aload         8
      88: ldc           #210                // String /
      90: invokestatic  #232                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      93: ifeq          117
      96: aload_2
      97: astore_3
      98: aload         4
     100: invokeinterface #235,  1          // InterfaceMethod java/util/List.clear:()V
     105: aload         4
     107: aload_3
     108: invokeinterface #239,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     113: pop
     114: goto          42
     117: aload         8
     119: ldc           #241                // String ..
     121: invokestatic  #232                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     124: ifeq          147
     127: aload         4
     129: invokeinterface #244,  1          // InterfaceMethod java/util/List.removeLast:()Ljava/lang/Object;
     134: pop
     135: aload         4
     137: invokestatic  #248                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     140: checkcast     #142                // class DirWalk$Dir
     143: astore_3
     144: goto          42
     147: aload_3
     148: invokevirtual #252                // Method DirWalk$Dir.getItems:()Ljava/util/List;
     151: checkcast     #73                 // class java/lang/Iterable
     154: astore        9
     156: aload         9
     158: invokeinterface #130,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     163: astore        10
     165: aload         10
     167: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     172: ifeq          233
     175: aload         10
     177: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     182: astore        11
     184: aload         11
     186: checkcast     #254                // class DirWalk$Node
     189: astore        12
     191: iconst_0
     192: istore        13
     194: aload         12
     196: instanceof    #142                // class DirWalk$Dir
     199: ifeq          224
     202: aload         12
     204: checkcast     #142                // class DirWalk$Dir
     207: invokevirtual #145                // Method DirWalk$Dir.getName:()Ljava/lang/String;
     210: aload         6
     212: checkcast     #223                // class DirWalk$CommandCd
     215: invokevirtual #226                // Method DirWalk$CommandCd.getPath:()Ljava/lang/String;
     218: invokestatic  #232                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     221: goto          225
     224: iconst_0
     225: ifeq          165
     228: aload         11
     230: goto          234
     233: aconst_null
     234: dup
     235: ldc_w         #256                // String null cannot be cast to non-null type <root>.DirWalk.Dir
     238: invokestatic  #260                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;Ljava/lang/String;)V
     241: checkcast     #142                // class DirWalk$Dir
     244: astore_3
     245: aload         4
     247: aload_3
     248: invokeinterface #239,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     253: pop
     254: goto          42
     257: aload         7
     259: instanceof    #262                // class DirWalk$CommandLs
     262: ifne          42
     265: aload         7
     267: instanceof    #264                // class DirWalk$File
     270: ifeq          288
     273: aload_3
     274: invokevirtual #252                // Method DirWalk$Dir.getItems:()Ljava/util/List;
     277: aload         6
     279: invokeinterface #239,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     284: pop
     285: goto          42
     288: aload         7
     290: instanceof    #142                // class DirWalk$Dir
     293: ifeq          311
     296: aload_3
     297: invokevirtual #252                // Method DirWalk$Dir.getItems:()Ljava/util/List;
     300: aload         6
     302: invokeinterface #239,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     307: pop
     308: goto          42
     311: new           #266                // class kotlin/NoWhenBranchMatchedException
     314: dup
     315: invokespecial #267                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     318: athrow
     319: aload_2
     320: areturn

  private final DirWalk$Input parseLine(java.lang.String);
    Code:
       0: nop
       1: aload_1
       2: ldc_w         #280                // String $ ls
       5: invokestatic  #232                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
       8: ifeq          27
      11: new           #262                // class DirWalk$CommandLs
      14: dup
      15: aconst_null
      16: iconst_1
      17: aconst_null
      18: invokespecial #283                // Method DirWalk$CommandLs."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
      21: checkcast     #221                // class DirWalk$Input
      24: goto          167
      27: aload_1
      28: ldc_w         #285                // String $ cd
      31: iconst_0
      32: iconst_2
      33: aconst_null
      34: invokestatic  #291                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
      37: ifeq          63
      40: new           #223                // class DirWalk$CommandCd
      43: dup
      44: aload_1
      45: ldc_w         #293                // String $ cd
      48: aconst_null
      49: iconst_2
      50: aconst_null
      51: invokestatic  #297                // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      54: invokespecial #300                // Method DirWalk$CommandCd."<init>":(Ljava/lang/String;)V
      57: checkcast     #221                // class DirWalk$Input
      60: goto          167
      63: aload_1
      64: ldc_w         #301                // String dir
      67: iconst_0
      68: iconst_2
      69: aconst_null
      70: invokestatic  #291                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
      73: ifeq          102
      76: new           #142                // class DirWalk$Dir
      79: dup
      80: aload_1
      81: ldc_w         #303                // String dir
      84: aconst_null
      85: iconst_2
      86: aconst_null
      87: invokestatic  #297                // Method kotlin/text/StringsKt.substringAfter$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
      90: aconst_null
      91: iconst_2
      92: aconst_null
      93: invokespecial #306                // Method DirWalk$Dir."<init>":(Ljava/lang/String;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
      96: checkcast     #221                // class DirWalk$Input
      99: goto          167
     102: aload_1
     103: checkcast     #308                // class java/lang/CharSequence
     106: iconst_1
     107: anewarray     #182                // class java/lang/String
     110: astore_3
     111: aload_3
     112: iconst_0
     113: ldc_w         #310                // String
     116: aastore
     117: aload_3
     118: iconst_0
     119: iconst_0
     120: bipush        6
     122: aconst_null
     123: invokestatic  #314                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     126: astore_2
     127: aload_2
     128: iconst_0
     129: invokeinterface #318,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     134: checkcast     #182                // class java/lang/String
     137: bipush        10
     139: invokestatic  #324                // Method kotlin/text/CharsKt.checkRadix:(I)I
     142: invokestatic  #328                // Method java/lang/Integer.parseInt:(Ljava/lang/String;I)I
     145: istore_3
     146: new           #264                // class DirWalk$File
     149: dup
     150: aload_2
     151: iconst_1
     152: invokeinterface #318,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     157: checkcast     #182                // class java/lang/String
     160: iload_3
     161: invokespecial #331                // Method DirWalk$File."<init>":(Ljava/lang/String;I)V
     164: checkcast     #221                // class DirWalk$Input
     167: areturn

  private final java.util.Map<DirWalk$Dir, java.lang.Integer> getDirSizes(DirWalk$Dir);
    Code:
       0: new           #25                 // class java/util/LinkedHashMap
       3: dup
       4: invokespecial #26                 // Method java/util/LinkedHashMap."<init>":()V
       7: checkcast     #28                 // class java/util/Map
      10: astore_2
      11: aload_2
      12: aload_1
      13: invokestatic  #340                // Method getDirSizes$walk:(Ljava/util/Map;LDirWalk$Dir;)V
      16: aload_2
      17: areturn

  private static final void getDirSizes$walk(java.util.Map<DirWalk$Dir, java.lang.Integer>, DirWalk$Dir);
    Code:
       0: iconst_0
       1: istore_2
       2: aload_1
       3: invokevirtual #252                // Method DirWalk$Dir.getItems:()Ljava/util/List;
       6: invokeinterface #343,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      11: astore_3
      12: aload_3
      13: invokeinterface #44,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      18: ifeq          101
      21: aload_3
      22: invokeinterface #48,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      27: checkcast     #254                // class DirWalk$Node
      30: astore        4
      32: iload_2
      33: aload         4
      35: astore        5
      37: aload         5
      39: instanceof    #264                // class DirWalk$File
      42: ifeq          56
      45: aload         4
      47: checkcast     #264                // class DirWalk$File
      50: invokevirtual #346                // Method DirWalk$File.getSize:()I
      53: goto          96
      56: aload         5
      58: instanceof    #142                // class DirWalk$Dir
      61: ifeq          88
      64: aload_0
      65: aload         4
      67: checkcast     #142                // class DirWalk$Dir
      70: invokestatic  #340                // Method getDirSizes$walk:(Ljava/util/Map;LDirWalk$Dir;)V
      73: aload_0
      74: aload         4
      76: invokestatic  #114                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
      79: checkcast     #55                 // class java/lang/Number
      82: invokevirtual #59                 // Method java/lang/Number.intValue:()I
      85: goto          96
      88: new           #266                // class kotlin/NoWhenBranchMatchedException
      91: dup
      92: invokespecial #267                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
      95: athrow
      96: iadd
      97: istore_2
      98: goto          12
     101: iload_2
     102: invokestatic  #350                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     105: astore        4
     107: aload_0
     108: aload_1
     109: aload         4
     111: invokeinterface #67,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     116: pop
     117: return

  public static final DirWalk$Input access$parseLine(DirWalk, java.lang.String);
    Code:
       0: aload_0
       1: aload_1
       2: invokespecial #355                // Method parseLine:(Ljava/lang/String;)LDirWalk$Input;
       5: areturn

  static {};
    Code:
       0: new           #2                  // class DirWalk
       3: dup
       4: invokespecial #358                // Method "<init>":()V
       7: putstatic     #360                // Field INSTANCE:LDirWalk;
      10: return
}

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

  DirWalk$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 DirWalk$readInput$1
       3: dup
       4: invokespecial #30                 // Method "<init>":()V
       7: putstatic     #33                 // Field INSTANCE:LDirWalk$readInput$1;
      10: return
}

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

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

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

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class kotlin/Pair
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      12: checkcast     #29                 // class java/lang/Integer
      15: checkcast     #31                 // class java/lang/Comparable
      18: aload_2
      19: checkcast     #23                 // class kotlin/Pair
      22: astore_3
      23: astore        5
      25: iconst_0
      26: istore        4
      28: aload_3
      29: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      32: checkcast     #29                 // class java/lang/Integer
      35: aload         5
      37: swap
      38: checkcast     #31                 // class java/lang/Comparable
      41: invokestatic  #37                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      44: ireturn
}